From 15801133d1f60fa82d125f0b92b5462395b9e618 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Mon, 16 Nov 2026 14:17:32 +0100 Subject: [PATCH 1/7] Add CONTRIBUTING.md --- CONTRIBUTING.md | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..8d3902a6ec --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,62 @@ +# Compilation/Formatting + +- Read the README.md in the repository root for instructions on how to compile on Linux, Windows/Visual Studio, ... +- Compilation **MUST** finish without any warnings +- Formatting uses clang-format-10 and can be automatically done via `make clangFormat` +- `clang-tidy` is used for further static analysis, `tools/runClangTidy.sh` can be used to run it manually with a configured build tree + +# Testing / Bug fixing + +- For each Bug fixed/feature added, there should be a test (GUI excluded until this is possible too) +- Keep tests small, complete and descriptive +- Some tests may run differently based on the Random Generator (RNG), make sure they succeed in all cases but keep the constraints tight +- If a test fails suddenly, it may depend on the RNG. Make sure the behaviour is correct before e.g increasing max. GF amount to wait till the event is checked + +# Naming + +- Classes/Structs: UpperCamelCase +- Parameters, local variables, member functions: lowerCamelCase +- Member variables: Suffix "\_" (e.g. `myMember_`) +- Do not shadow variables (e.g. using the name of a member as a parameter) +- Use imperative for setters and question-style for getters e.g. `lieSomewhere`, `carry`, `burn` and `isLying`, `isValid`, `canChange` + +# Locals / String encoding / Paths / UTF8 + +- All strings (`std::string`) used in the program **must** be encoded in UTF8. Conversion from different encodings must be done on reading/writing ONLY. Use the helper functions in libUtil (`ucString.h` or `utf8.h`) +- Filepaths/Folderpaths must be stored in `bfs::path` variables +- 'Filepath' means a complete path whereas 'Filename' is just the name itself +- Use `bfs` function for all file system operations +- Note: 'bfs::path::string()` returns an UTF8 encoded string already. No need to use conversions there (see https://github.com/Return-To-The-Roots/s25client/pull/645) + +# General + +- Small include files + - Use forward declarations instead of including headers + - Include what you use (e.g. when using `std::vector`, include ``) + - Once class/struct per file, avoid "collections" of structs even when they belong partly together +- Check STL/Boost before rolling your own implementations +- Implementing any of the **Big 3** (copy ctor, copy assignment, destructor) requires implementing the others as well. For classes, that should not be copied (e.g. having open handles) declare copy ctor **AND** copy assignment in private region and *do not* implement it. Put a comment there. +- Comment functions you write at least with a summary in the header. use JavaDoc syntax (Either `///` or `/** foo bar */`) +- Make sure assumptions are met -> + - Use `static_assert` to check what is possible during compile-time + - Use exceptions for enforcing stuff at runtime (e.g. parameter values, switch(enum) defaults) + - Use `assert`s for general conditions that should be met, but are less critical or performance-wise expensive to check +- Avoid unnecessary branches: No need for an `else` after a `return`. Additional branches require additional indentation which makes (especially) longer functions hard to read. +- Avoid code duplication: If you write the same or very similar thing twice (even in one function), factor it out into a new function. This eases maintainability if one ever needs to change or fix that. +- **Document your functions!** + - put at least a one-liner in the header describing what it does + - For more complex functions include also pre-/post-conditions, special cases, ... + - If you have problems understanding a function and finally figured it out: Help others and add that to the docu + - Do not describe trivial things like "this is a copy-ctor/sets foo/gets bar" as this should be obvious from the function name (`FooBar(const FooBar&)` / `void setFoo(foo)` / `Bar getBar()`) + +# Safety + +- Use RAII idiom + - Encapsulate all resources once they are acquired + - Use STL collections (`vector`, `list`, ...) + - Use smart pointers (`std::unique_ptr`, `boost::intrusive_shared_ptr`, `std::shared_pointer` in that order) +- `delete[]` should never be used. Use C++ structs (e.g. `vector`) +- Use `std::array`instead of plain C-arrays +- Do __NOT__ use magic constants. All constants should be made named consts (or defines). For iterations, use iterators or actual sizes +- Do not use printf/sprint/snprintf,fprintf,... They can easily cause buffer overflows. Use C++ streams instead + From f10778de7dc0e0e60eec4fbbb1984f4582bb9f51 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Mon, 16 Nov 2026 12:13:37 +0100 Subject: [PATCH 2/7] Rename Msg_* handlers to lowerCamelCase --- extras/audioDrivers/SDL/AudioSDL.cpp | 2 +- extras/videoDrivers/SDL2/VideoSDL2.cpp | 36 ++-- extras/videoDrivers/WinAPI/WinAPI.cpp | 22 +- .../include/driver/IAudioDriverCallback.h | 2 +- .../driver/VideoDriverLoaderInterface.h | 20 +- libs/driver/src/VideoDriver.cpp | 2 +- libs/s25main/Window.cpp | 12 +- libs/s25main/Window.h | 96 ++++----- libs/s25main/WindowManager.cpp | 60 +++--- libs/s25main/WindowManager.h | 22 +- libs/s25main/controls/ctrlBuildingIcon.cpp | 4 +- libs/s25main/controls/ctrlBuildingIcon.h | 2 +- libs/s25main/controls/ctrlButton.cpp | 8 +- libs/s25main/controls/ctrlButton.h | 6 +- libs/s25main/controls/ctrlChat.cpp | 16 +- libs/s25main/controls/ctrlChat.h | 10 +- libs/s25main/controls/ctrlCheck.cpp | 6 +- libs/s25main/controls/ctrlCheck.h | 4 +- libs/s25main/controls/ctrlComboBox.cpp | 32 +-- libs/s25main/controls/ctrlComboBox.h | 18 +- libs/s25main/controls/ctrlEdit.cpp | 8 +- libs/s25main/controls/ctrlEdit.h | 4 +- libs/s25main/controls/ctrlGroup.cpp | 152 +++++++------- libs/s25main/controls/ctrlGroup.h | 78 +++---- libs/s25main/controls/ctrlImage.cpp | 2 +- libs/s25main/controls/ctrlImage.h | 2 +- libs/s25main/controls/ctrlIngameMinimap.cpp | 6 +- libs/s25main/controls/ctrlIngameMinimap.h | 4 +- libs/s25main/controls/ctrlList.cpp | 24 +-- libs/s25main/controls/ctrlList.h | 12 +- libs/s25main/controls/ctrlMapSelection.cpp | 4 +- libs/s25main/controls/ctrlMapSelection.h | 2 +- .../s25main/controls/ctrlMultiSelectGroup.cpp | 26 +-- libs/s25main/controls/ctrlMultiSelectGroup.h | 12 +- libs/s25main/controls/ctrlMultiline.cpp | 16 +- libs/s25main/controls/ctrlMultiline.h | 10 +- libs/s25main/controls/ctrlOptionGroup.cpp | 24 +-- libs/s25main/controls/ctrlOptionGroup.h | 12 +- libs/s25main/controls/ctrlProgress.cpp | 28 +-- libs/s25main/controls/ctrlProgress.h | 12 +- libs/s25main/controls/ctrlScrollBar.cpp | 22 +- libs/s25main/controls/ctrlScrollBar.h | 8 +- libs/s25main/controls/ctrlTab.cpp | 87 ++++---- libs/s25main/controls/ctrlTab.h | 46 ++-- libs/s25main/controls/ctrlTable.cpp | 36 ++-- libs/s25main/controls/ctrlTable.h | 18 +- libs/s25main/controls/ctrlTimer.cpp | 6 +- libs/s25main/controls/ctrlTimer.h | 2 +- libs/s25main/desktops/Desktop.cpp | 4 +- libs/s25main/desktops/Desktop.h | 4 +- libs/s25main/desktops/dskBenchmark.cpp | 10 +- libs/s25main/desktops/dskBenchmark.h | 4 +- .../desktops/dskCampaignMissionSelection.cpp | 4 +- .../desktops/dskCampaignMissionSelection.h | 4 +- .../s25main/desktops/dskCampaignSelection.cpp | 8 +- libs/s25main/desktops/dskCampaignSelection.h | 8 +- libs/s25main/desktops/dskCredits.cpp | 12 +- libs/s25main/desktops/dskCredits.h | 12 +- libs/s25main/desktops/dskDirectIP.cpp | 2 +- libs/s25main/desktops/dskDirectIP.h | 2 +- libs/s25main/desktops/dskGameInterface.cpp | 32 +-- libs/s25main/desktops/dskGameInterface.h | 26 +-- libs/s25main/desktops/dskGameLoader.cpp | 4 +- libs/s25main/desktops/dskGameLoader.h | 4 +- libs/s25main/desktops/dskGameLobby.cpp | 28 +-- libs/s25main/desktops/dskGameLobby.h | 20 +- libs/s25main/desktops/dskIntro.cpp | 2 +- libs/s25main/desktops/dskIntro.h | 2 +- libs/s25main/desktops/dskLAN.cpp | 10 +- libs/s25main/desktops/dskLAN.h | 8 +- libs/s25main/desktops/dskLobby.cpp | 18 +- libs/s25main/desktops/dskLobby.h | 16 +- libs/s25main/desktops/dskMainMenu.cpp | 8 +- libs/s25main/desktops/dskMainMenu.h | 8 +- libs/s25main/desktops/dskMultiPlayer.cpp | 2 +- libs/s25main/desktops/dskMultiPlayer.h | 2 +- libs/s25main/desktops/dskOptions.cpp | 30 +-- libs/s25main/desktops/dskOptions.h | 22 +- libs/s25main/desktops/dskSelectMap.cpp | 10 +- libs/s25main/desktops/dskSelectMap.h | 10 +- libs/s25main/desktops/dskSinglePlayer.cpp | 2 +- libs/s25main/desktops/dskSinglePlayer.h | 2 +- libs/s25main/desktops/dskSplash.cpp | 4 +- libs/s25main/desktops/dskSplash.h | 4 +- libs/s25main/desktops/dskTest.cpp | 12 +- libs/s25main/desktops/dskTest.h | 10 +- libs/s25main/desktops/dskTextureTest.cpp | 14 +- libs/s25main/desktops/dskTextureTest.h | 8 +- libs/s25main/drivers/AudioDriverWrapper.cpp | 2 +- libs/s25main/drivers/AudioDriverWrapper.h | 2 +- libs/s25main/drivers/VideoDriverWrapper.cpp | 2 +- libs/s25main/ingameWindows/IngameWindow.cpp | 10 +- libs/s25main/ingameWindows/IngameWindow.h | 10 +- .../TransmitSettingsIgwAdapter.cpp | 4 +- .../TransmitSettingsIgwAdapter.h | 4 +- libs/s25main/ingameWindows/iwAIDebug.cpp | 6 +- libs/s25main/ingameWindows/iwAIDebug.h | 4 +- libs/s25main/ingameWindows/iwAction.cpp | 42 ++-- libs/s25main/ingameWindows/iwAction.h | 26 +-- libs/s25main/ingameWindows/iwAddonPresets.cpp | 20 +- libs/s25main/ingameWindows/iwAddonPresets.h | 16 +- libs/s25main/ingameWindows/iwAddons.cpp | 12 +- libs/s25main/ingameWindows/iwAddons.h | 10 +- .../s25main/ingameWindows/iwBaseWarehouse.cpp | 8 +- libs/s25main/ingameWindows/iwBaseWarehouse.h | 4 +- libs/s25main/ingameWindows/iwBuildOrder.cpp | 6 +- libs/s25main/ingameWindows/iwBuildOrder.h | 6 +- libs/s25main/ingameWindows/iwBuilding.cpp | 10 +- libs/s25main/ingameWindows/iwBuilding.h | 6 +- .../iwBuildingProductivities.cpp | 4 +- .../ingameWindows/iwBuildingProductivities.h | 2 +- libs/s25main/ingameWindows/iwBuildingSite.cpp | 6 +- libs/s25main/ingameWindows/iwBuildingSite.h | 4 +- libs/s25main/ingameWindows/iwBuildings.cpp | 6 +- libs/s25main/ingameWindows/iwBuildings.h | 4 +- libs/s25main/ingameWindows/iwChat.cpp | 8 +- libs/s25main/ingameWindows/iwChat.h | 6 +- libs/s25main/ingameWindows/iwConnecting.cpp | 2 +- libs/s25main/ingameWindows/iwConnecting.h | 2 +- .../ingameWindows/iwDemolishBuilding.cpp | 2 +- .../ingameWindows/iwDemolishBuilding.h | 2 +- libs/s25main/ingameWindows/iwDiplomacy.cpp | 10 +- libs/s25main/ingameWindows/iwDiplomacy.h | 6 +- .../ingameWindows/iwDirectIPConnect.cpp | 10 +- .../s25main/ingameWindows/iwDirectIPConnect.h | 8 +- .../ingameWindows/iwDirectIPCreate.cpp | 10 +- libs/s25main/ingameWindows/iwDirectIPCreate.h | 8 +- libs/s25main/ingameWindows/iwDistribution.cpp | 6 +- libs/s25main/ingameWindows/iwDistribution.h | 4 +- .../ingameWindows/iwEconomicProgress.cpp | 6 +- .../ingameWindows/iwEconomicProgress.h | 4 +- libs/s25main/ingameWindows/iwEndgame.cpp | 2 +- libs/s25main/ingameWindows/iwEndgame.h | 2 +- libs/s25main/ingameWindows/iwHQ.cpp | 4 +- libs/s25main/ingameWindows/iwHQ.h | 2 +- .../ingameWindows/iwHarborBuilding.cpp | 4 +- libs/s25main/ingameWindows/iwHarborBuilding.h | 2 +- libs/s25main/ingameWindows/iwLobbyConnect.cpp | 12 +- libs/s25main/ingameWindows/iwLobbyConnect.h | 10 +- .../ingameWindows/iwLobbyServerInfo.cpp | 2 +- .../s25main/ingameWindows/iwLobbyServerInfo.h | 2 +- libs/s25main/ingameWindows/iwMainMenu.cpp | 2 +- libs/s25main/ingameWindows/iwMainMenu.h | 2 +- libs/s25main/ingameWindows/iwMapDebug.cpp | 14 +- libs/s25main/ingameWindows/iwMapDebug.h | 10 +- libs/s25main/ingameWindows/iwMapGenerator.cpp | 2 +- libs/s25main/ingameWindows/iwMapGenerator.h | 2 +- .../ingameWindows/iwMerchandiseStatistics.cpp | 4 +- .../ingameWindows/iwMerchandiseStatistics.h | 4 +- libs/s25main/ingameWindows/iwMilitary.cpp | 4 +- libs/s25main/ingameWindows/iwMilitary.h | 4 +- .../ingameWindows/iwMilitaryBuilding.cpp | 2 +- .../ingameWindows/iwMilitaryBuilding.h | 2 +- libs/s25main/ingameWindows/iwMinimap.cpp | 2 +- libs/s25main/ingameWindows/iwMinimap.h | 2 +- .../ingameWindows/iwMissionStatement.cpp | 2 +- .../ingameWindows/iwMissionStatement.h | 2 +- libs/s25main/ingameWindows/iwMsgbox.cpp | 4 +- libs/s25main/ingameWindows/iwMsgbox.h | 2 +- libs/s25main/ingameWindows/iwMusicPlayer.cpp | 18 +- libs/s25main/ingameWindows/iwMusicPlayer.h | 12 +- libs/s25main/ingameWindows/iwObservate.cpp | 12 +- libs/s25main/ingameWindows/iwObservate.h | 10 +- .../s25main/ingameWindows/iwOptionsWindow.cpp | 6 +- libs/s25main/ingameWindows/iwOptionsWindow.h | 6 +- libs/s25main/ingameWindows/iwPlayReplay.cpp | 6 +- libs/s25main/ingameWindows/iwPlayReplay.h | 6 +- libs/s25main/ingameWindows/iwPostWindow.cpp | 16 +- libs/s25main/ingameWindows/iwPostWindow.h | 6 +- libs/s25main/ingameWindows/iwRoadWindow.cpp | 2 +- libs/s25main/ingameWindows/iwRoadWindow.h | 2 +- libs/s25main/ingameWindows/iwSave.cpp | 10 +- libs/s25main/ingameWindows/iwSave.h | 10 +- libs/s25main/ingameWindows/iwSettings.cpp | 12 +- libs/s25main/ingameWindows/iwSettings.h | 10 +- libs/s25main/ingameWindows/iwShip.cpp | 2 +- libs/s25main/ingameWindows/iwShip.h | 2 +- libs/s25main/ingameWindows/iwSkipGFs.cpp | 4 +- libs/s25main/ingameWindows/iwSkipGFs.h | 4 +- libs/s25main/ingameWindows/iwStatistics.cpp | 4 +- libs/s25main/ingameWindows/iwStatistics.h | 4 +- libs/s25main/ingameWindows/iwSurrender.cpp | 2 +- libs/s25main/ingameWindows/iwSurrender.h | 2 +- .../ingameWindows/iwTempleBuilding.cpp | 4 +- libs/s25main/ingameWindows/iwTempleBuilding.h | 2 +- libs/s25main/ingameWindows/iwTools.cpp | 8 +- libs/s25main/ingameWindows/iwTools.h | 6 +- libs/s25main/ingameWindows/iwTrade.cpp | 8 +- libs/s25main/ingameWindows/iwTrade.h | 4 +- libs/s25main/ingameWindows/iwTransport.cpp | 2 +- libs/s25main/ingameWindows/iwTransport.h | 2 +- libs/s25main/ingameWindows/iwVictory.cpp | 2 +- libs/s25main/ingameWindows/iwVictory.h | 2 +- libs/s25main/ingameWindows/iwWares.cpp | 6 +- libs/s25main/ingameWindows/iwWares.h | 4 +- tests/mockupDrivers/MockupAudioDriver.h | 2 +- tests/s25Main/UI/testAnimations.cpp | 8 +- tests/s25Main/UI/testComboBox.cpp | 26 +-- tests/s25Main/UI/testControls.cpp | 40 ++-- tests/s25Main/UI/testDskGameLobby.cpp | 2 +- tests/s25Main/UI/testIngameWindow.cpp | 56 ++--- tests/s25Main/UI/testMapSelection.cpp | 28 +-- tests/s25Main/UI/testWindowManager.cpp | 196 +++++++++--------- tests/s25Main/UI/testWindows.cpp | 32 +-- .../integration/testBuildingRadius.cpp | 6 +- .../integration/testDskGameInterface.cpp | 102 ++++----- 206 files changed, 1294 insertions(+), 1295 deletions(-) diff --git a/extras/audioDrivers/SDL/AudioSDL.cpp b/extras/audioDrivers/SDL/AudioSDL.cpp index e7e2ee73f3..2ce2e4792e 100644 --- a/extras/audioDrivers/SDL/AudioSDL.cpp +++ b/extras/audioDrivers/SDL/AudioSDL.cpp @@ -103,7 +103,7 @@ bool AudioSDL::Initialize() void AudioSDL::MusicFinished() { if(currentInstance) - currentInstance->driverCallback->Msg_MusicFinished(); + currentInstance->driverCallback->msgMusicFinished(); } /** diff --git a/extras/videoDrivers/SDL2/VideoSDL2.cpp b/extras/videoDrivers/SDL2/VideoSDL2.cpp index eef2a846b6..113f9034eb 100644 --- a/extras/videoDrivers/SDL2/VideoSDL2.cpp +++ b/extras/videoDrivers/SDL2/VideoSDL2.cpp @@ -312,7 +312,7 @@ void VideoSDL2::HandlePaste() PrintError(text ? SDL_GetError() : "Paste failed."); for(const char32_t c : s25util::utf8to32(text.get())) - CallBack->Msg_KeyDown(KeyEvent(c)); + CallBack->msgKeyDown(KeyEvent(c)); } void VideoSDL2::DestroyScreen() @@ -392,7 +392,7 @@ bool VideoSDL2::MessageLoop() setSpecialKeys(ke, SDL_Keymod(ev.key.keysym.mod)); if(ke.kt != KeyType::Invalid) - CallBack->Msg_KeyDown(ke); + CallBack->msgKeyDown(ke); else if(ke.alt || ke.ctrl) { // Handle shortcuts (CTRL+x, ALT+y) @@ -402,7 +402,7 @@ bool VideoSDL2::MessageLoop() { ke.kt = KeyType::Char; ke.c = static_cast(keycode); - CallBack->Msg_KeyDown(ke); + CallBack->msgKeyDown(ke); } } } @@ -415,7 +415,7 @@ bool VideoSDL2::MessageLoop() for(char32_t c : text) { ke.c = c; - CallBack->Msg_KeyDown(ke); + CallBack->msgKeyDown(ke); } break; } @@ -426,17 +426,17 @@ bool VideoSDL2::MessageLoop() { case SDL_BUTTON_LEFT: mouse_xy.ldown = true; - CallBack->Msg_LeftDown(mouse_xy); + CallBack->msgLeftDown(mouse_xy); break; case SDL_BUTTON_RIGHT: mouse_xy.rdown = true; - CallBack->Msg_RightDown(mouse_xy); + CallBack->msgRightDown(mouse_xy); break; case SDL_BUTTON_MIDDLE: mouse_xy.mdown = true; - CallBack->Msg_MiddleDown(mouse_xy); + CallBack->msgMiddleDown(mouse_xy); break; } break; @@ -447,17 +447,17 @@ bool VideoSDL2::MessageLoop() { case SDL_BUTTON_LEFT: mouse_xy.ldown = false; - CallBack->Msg_LeftUp(mouse_xy); + CallBack->msgLeftUp(mouse_xy); break; case SDL_BUTTON_RIGHT: mouse_xy.rdown = false; - CallBack->Msg_RightUp(mouse_xy); + CallBack->msgRightUp(mouse_xy); break; case SDL_BUTTON_MIDDLE: mouse_xy.mdown = false; - CallBack->Msg_MiddleUp(mouse_xy); + CallBack->msgMiddleUp(mouse_xy); break; } break; @@ -467,9 +467,9 @@ bool VideoSDL2::MessageLoop() if(ev.wheel.direction == SDL_MOUSEWHEEL_FLIPPED) y = -y; if(y > 0) - CallBack->Msg_WheelUp(mouse_xy); + CallBack->msgWheelUp(mouse_xy); else if(y < 0) - CallBack->Msg_WheelDown(mouse_xy); + CallBack->msgWheelDown(mouse_xy); } break; case SDL_MOUSEMOTION: @@ -479,7 +479,7 @@ bool VideoSDL2::MessageLoop() if(newPos != mouse_xy.pos) { mouse_xy.pos = newPos; - CallBack->Msg_MouseMove(mouse_xy); + CallBack->msgMouseMove(mouse_xy); } } break; @@ -490,7 +490,7 @@ bool VideoSDL2::MessageLoop() static_cast(ev.tfinger.y * wnSize.height))); mouse_xy.ldown = true; mouse_xy.num_tfingers++; - CallBack->Msg_LeftDown(mouse_xy); + CallBack->msgLeftDown(mouse_xy); break; } case SDL_FINGERUP: @@ -499,7 +499,7 @@ bool VideoSDL2::MessageLoop() mouse_xy.pos = getGuiScale().screenToView(Position(static_cast(ev.tfinger.x * wnSize.width), static_cast(ev.tfinger.y * wnSize.height))); mouse_xy.ldown = false; - CallBack->Msg_LeftUp(mouse_xy); + CallBack->msgLeftUp(mouse_xy); mouse_xy.num_tfingers--; // Dirty way to count leftUp as touch event without extra isTouch bool break; } @@ -512,7 +512,7 @@ bool VideoSDL2::MessageLoop() if(newPos != mouse_xy.pos) { mouse_xy.pos = newPos; - CallBack->Msg_MouseMove(mouse_xy); + CallBack->msgMouseMove(mouse_xy); } break; } @@ -521,9 +521,9 @@ bool VideoSDL2::MessageLoop() if(std::fabs(ev.mgesture.dDist) > 0.001) { if(ev.mgesture.dDist > 0) - CallBack->Msg_WheelUp(mouse_xy); + CallBack->msgWheelUp(mouse_xy); else - CallBack->Msg_WheelDown(mouse_xy); + CallBack->msgWheelDown(mouse_xy); } break; } diff --git a/extras/videoDrivers/WinAPI/WinAPI.cpp b/extras/videoDrivers/WinAPI/WinAPI.cpp index f6b49eab85..a11b8b4476 100644 --- a/extras/videoDrivers/WinAPI/WinAPI.cpp +++ b/extras/videoDrivers/WinAPI/WinAPI.cpp @@ -471,7 +471,7 @@ void VideoWinAPI::OnWMChar(unsigned c, bool disablepaste, LPARAM lParam) } } - CallBack->Msg_KeyDown(ke); + CallBack->msgKeyDown(ke); } void VideoWinAPI::OnWMKeyDown(unsigned c, LPARAM lParam) @@ -512,7 +512,7 @@ void VideoWinAPI::OnWMKeyDown(unsigned c, LPARAM lParam) } if(ke.kt != KeyType::Invalid) - CallBack->Msg_KeyDown(ke); + CallBack->msgKeyDown(ke); } void VideoWinAPI::OnWMPaste() @@ -577,31 +577,31 @@ LRESULT CALLBACK VideoWinAPI::WindowProc(HWND window, UINT msg, WPARAM wParam, L case WM_MOUSEMOVE: pVideoWinAPI->mouse_xy.pos.x = LOWORD(lParam); pVideoWinAPI->mouse_xy.pos.y = HIWORD(lParam); - pVideoWinAPI->CallBack->Msg_MouseMove(pVideoWinAPI->mouse_xy); + pVideoWinAPI->CallBack->msgMouseMove(pVideoWinAPI->mouse_xy); break; case WM_LBUTTONDOWN: pVideoWinAPI->mouse_xy.ldown = true; - pVideoWinAPI->CallBack->Msg_LeftDown(pVideoWinAPI->mouse_xy); + pVideoWinAPI->CallBack->msgLeftDown(pVideoWinAPI->mouse_xy); break; case WM_LBUTTONUP: pVideoWinAPI->mouse_xy.ldown = false; - pVideoWinAPI->CallBack->Msg_LeftUp(pVideoWinAPI->mouse_xy); + pVideoWinAPI->CallBack->msgLeftUp(pVideoWinAPI->mouse_xy); break; case WM_RBUTTONDOWN: pVideoWinAPI->mouse_xy.rdown = true; - pVideoWinAPI->CallBack->Msg_RightDown(pVideoWinAPI->mouse_xy); + pVideoWinAPI->CallBack->msgRightDown(pVideoWinAPI->mouse_xy); break; case WM_RBUTTONUP: pVideoWinAPI->mouse_xy.rdown = false; - pVideoWinAPI->CallBack->Msg_RightUp(pVideoWinAPI->mouse_xy); + pVideoWinAPI->CallBack->msgRightUp(pVideoWinAPI->mouse_xy); break; case WM_MBUTTONDOWN: pVideoWinAPI->mouse_xy.mdown = true; - pVideoWinAPI->CallBack->Msg_MiddleDown(pVideoWinAPI->mouse_xy); + pVideoWinAPI->CallBack->msgMiddleDown(pVideoWinAPI->mouse_xy); break; case WM_MBUTTONUP: pVideoWinAPI->mouse_xy.mdown = false; - pVideoWinAPI->CallBack->Msg_MiddleUp(pVideoWinAPI->mouse_xy); + pVideoWinAPI->CallBack->msgMiddleUp(pVideoWinAPI->mouse_xy); break; case WM_MOUSEWHEEL: // Obtain scrolling distance. For every multiple of WHEEL_DELTA, we have to fire an event, because we treat @@ -615,11 +615,11 @@ LRESULT CALLBACK VideoWinAPI::WindowProc(HWND window, UINT msg, WPARAM wParam, L if(pVideoWinAPI->mouse_z > 0) // Scrolled to top { pVideoWinAPI->mouse_z -= WHEEL_DELTA; - pVideoWinAPI->CallBack->Msg_WheelUp(pVideoWinAPI->mouse_xy); + pVideoWinAPI->CallBack->msgWheelUp(pVideoWinAPI->mouse_xy); } else // Scrolled to bottom { pVideoWinAPI->mouse_z += WHEEL_DELTA; - pVideoWinAPI->CallBack->Msg_WheelDown(pVideoWinAPI->mouse_xy); + pVideoWinAPI->CallBack->msgWheelDown(pVideoWinAPI->mouse_xy); } } break; diff --git a/libs/driver/include/driver/IAudioDriverCallback.h b/libs/driver/include/driver/IAudioDriverCallback.h index 611bae1793..1354a99ad2 100644 --- a/libs/driver/include/driver/IAudioDriverCallback.h +++ b/libs/driver/include/driver/IAudioDriverCallback.h @@ -10,5 +10,5 @@ class BOOST_SYMBOL_VISIBLE IAudioDriverCallback { public: virtual ~IAudioDriverCallback() = default; - virtual void Msg_MusicFinished() = 0; + virtual void msgMusicFinished() = 0; }; diff --git a/libs/driver/include/driver/VideoDriverLoaderInterface.h b/libs/driver/include/driver/VideoDriverLoaderInterface.h index 5db9c804cc..be278fc01e 100644 --- a/libs/driver/include/driver/VideoDriverLoaderInterface.h +++ b/libs/driver/include/driver/VideoDriverLoaderInterface.h @@ -13,17 +13,17 @@ class BOOST_SYMBOL_VISIBLE VideoDriverLoaderInterface public: virtual ~VideoDriverLoaderInterface() = default; - virtual void Msg_LeftDown(MouseCoords mc) = 0; - virtual void Msg_LeftUp(MouseCoords mc) = 0; - virtual void Msg_RightDown(const MouseCoords& mc) = 0; - virtual void Msg_RightUp(const MouseCoords& mc) = 0; - virtual void Msg_MiddleDown(const MouseCoords& mc) = 0; - virtual void Msg_MiddleUp(const MouseCoords& mc) = 0; - virtual void Msg_WheelUp(const MouseCoords& mc) = 0; - virtual void Msg_WheelDown(const MouseCoords& mc) = 0; - virtual void Msg_MouseMove(const MouseCoords& mc) = 0; + virtual void msgLeftDown(MouseCoords mc) = 0; + virtual void msgLeftUp(MouseCoords mc) = 0; + virtual void msgRightDown(const MouseCoords& mc) = 0; + virtual void msgRightUp(const MouseCoords& mc) = 0; + virtual void msgMiddleDown(const MouseCoords& mc) = 0; + virtual void msgMiddleUp(const MouseCoords& mc) = 0; + virtual void msgWheelUp(const MouseCoords& mc) = 0; + virtual void msgWheelDown(const MouseCoords& mc) = 0; + virtual void msgMouseMove(const MouseCoords& mc) = 0; - virtual void Msg_KeyDown(const KeyEvent& ke) = 0; + virtual void msgKeyDown(const KeyEvent& ke) = 0; virtual void WindowResized() = 0; }; diff --git a/libs/driver/src/VideoDriver.cpp b/libs/driver/src/VideoDriver.cpp index 11cb31fc36..3cdb7288ac 100644 --- a/libs/driver/src/VideoDriver.cpp +++ b/libs/driver/src/VideoDriver.cpp @@ -114,7 +114,7 @@ void VideoDriver::setGuiScalePercent(unsigned percent) // move cursor to new position in view space // must happen after window resize event to avoid drawing spurious hover events mouse_xy.pos = guiScale_.screenToView(screenPos); - CallBack->Msg_MouseMove(mouse_xy); + CallBack->msgMouseMove(mouse_xy); } GuiScaleRange VideoDriver::getGuiScaleRange() const diff --git a/libs/s25main/Window.cpp b/libs/s25main/Window.cpp index 88b60f91d4..1875293a5c 100644 --- a/libs/s25main/Window.cpp +++ b/libs/s25main/Window.cpp @@ -437,17 +437,17 @@ void Window::DrawLine(DrawPoint pt1, DrawPoint pt2, unsigned short width, unsign VIDEODRIVER.GetRenderer()->DrawLine(pt1, pt2, width, color); } -void Window::Msg_PaintBefore() +void Window::msgPaintBefore() { animations_.update(VIDEODRIVER.GetTickCount()); for(auto& control : childIdToWnd_ | boost::adaptors::map_values) - control->Msg_PaintBefore(); + control->msgPaintBefore(); } -void Window::Msg_PaintAfter() +void Window::msgPaintAfter() { for(auto& control : childIdToWnd_ | boost::adaptors::map_values) - control->Msg_PaintAfter(); + control->msgPaintAfter(); } void Window::Draw_() @@ -456,7 +456,7 @@ void Window::Draw_() control->Draw(); } -void Window::Msg_ScreenResize(const ScreenResizeEvent& sr) +void Window::msgScreenResize(const ScreenResizeEvent& sr) { // If the window elements don't get scaled there is nothing to do if(!scale_) @@ -467,7 +467,7 @@ void Window::Msg_ScreenResize(const ScreenResizeEvent& sr) // Save new size (could otherwise be changed(?) in Msg_ScreenResize) Extent newSize = rescale(ctrl->GetSize()); ctrl->SetPos(rescale(ctrl->GetPos())); - ctrl->Msg_ScreenResize(sr); + ctrl->msgScreenResize(sr); ctrl->Resize(newSize); } animations_.onRescale(sr); diff --git a/libs/s25main/Window.h b/libs/s25main/Window.h index 1b81512f74..f50996e177 100644 --- a/libs/s25main/Window.h +++ b/libs/s25main/Window.h @@ -222,62 +222,62 @@ class Window // These messages get passed downwards (WindowManager to controls) // Return true if the message was handled - virtual void Msg_PaintBefore(); - virtual void Msg_PaintAfter(); - virtual bool Msg_LeftDown(const MouseCoords&) { return false; } - virtual bool Msg_RightDown(const MouseCoords&) { return false; } - virtual bool Msg_MiddleDown(const MouseCoords&) { return false; } - virtual bool Msg_LeftUp(const MouseCoords&) { return false; } - virtual bool Msg_RightUp(const MouseCoords&) { return false; } - virtual bool Msg_MiddleUp(const MouseCoords&) { return false; } - virtual bool Msg_WheelUp(const MouseCoords&) { return false; } - virtual bool Msg_WheelDown(const MouseCoords&) { return false; } - virtual bool Msg_MouseMove(const MouseCoords&) { return false; } - virtual bool Msg_KeyDown(const KeyEvent&) { return false; } - virtual void Msg_ScreenResize(const ScreenResizeEvent& sr); + virtual void msgPaintBefore(); + virtual void msgPaintAfter(); + virtual bool msgLeftDown(const MouseCoords&) { return false; } + virtual bool msgRightDown(const MouseCoords&) { return false; } + virtual bool msgMiddleDown(const MouseCoords&) { return false; } + virtual bool msgLeftUp(const MouseCoords&) { return false; } + virtual bool msgRightUp(const MouseCoords&) { return false; } + virtual bool msgMiddleUp(const MouseCoords&) { return false; } + virtual bool msgWheelUp(const MouseCoords&) { return false; } + virtual bool msgWheelDown(const MouseCoords&) { return false; } + virtual bool msgMouseMove(const MouseCoords&) { return false; } + virtual bool msgKeyDown(const KeyEvent&) { return false; } + virtual void msgScreenResize(const ScreenResizeEvent& sr); // Callback messages that are passed upwards (from controls to window) - virtual void Msg_ButtonClick(unsigned /*ctrl_id*/) {} - virtual void Msg_EditEnter(unsigned /*ctrl_id*/) {} - virtual void Msg_EditChange(unsigned /*ctrl_id*/) {} - virtual void Msg_TabChange(unsigned /*ctrl_id*/, unsigned short /*tab_id*/) {} - virtual void Msg_ListSelectItem(unsigned /*ctrl_id*/, int /*selection*/) {} - virtual void Msg_ListChooseItem(unsigned /*ctrl_id*/, unsigned /*selection*/) {} - virtual void Msg_ComboSelectItem(unsigned /*ctrl_id*/, unsigned /*selection*/) {} - virtual void Msg_CheckboxChange(unsigned /*ctrl_id*/, bool /*checked*/) {} - virtual void Msg_ProgressChange(unsigned /*ctrl_id*/, unsigned short /*position*/) {} - virtual void Msg_ScrollChange(unsigned /*ctrl_id*/, unsigned short /*position*/) {} - virtual void Msg_ScrollShow(unsigned /*ctrl_id*/, bool /*visible*/) {} - virtual void Msg_OptionGroupChange(unsigned /*ctrl_id*/, unsigned /*selection*/) {} - virtual void Msg_Timer(unsigned /*ctrl_id*/) {} - virtual void Msg_TableSelectItem(unsigned /*ctrl_id*/, const std::optional& /*selection*/) {} - virtual void Msg_TableChooseItem(unsigned /*ctrl_id*/, unsigned /*selection*/) {} - virtual void Msg_TableRightButton(unsigned /*ctrl_id*/, const std::optional& /*selection*/) {} - virtual void Msg_TableLeftButton(unsigned /*ctrl_id*/, const std::optional& /*selection*/) {} + virtual void msgButtonClick(unsigned /*ctrl_id*/) {} + virtual void msgEditEnter(unsigned /*ctrl_id*/) {} + virtual void msgEditChange(unsigned /*ctrl_id*/) {} + virtual void msgTabChange(unsigned /*ctrl_id*/, unsigned short /*tab_id*/) {} + virtual void msgListSelectItem(unsigned /*ctrl_id*/, int /*selection*/) {} + virtual void msgListChooseItem(unsigned /*ctrl_id*/, unsigned /*selection*/) {} + virtual void msgComboSelectItem(unsigned /*ctrl_id*/, unsigned /*selection*/) {} + virtual void msgCheckboxChange(unsigned /*ctrl_id*/, bool /*checked*/) {} + virtual void msgProgressChange(unsigned /*ctrl_id*/, unsigned short /*position*/) {} + virtual void msgScrollChange(unsigned /*ctrl_id*/, unsigned short /*position*/) {} + virtual void msgScrollShow(unsigned /*ctrl_id*/, bool /*visible*/) {} + virtual void msgOptionGroupChange(unsigned /*ctrl_id*/, unsigned /*selection*/) {} + virtual void msgTimer(unsigned /*ctrl_id*/) {} + virtual void msgTableSelectItem(unsigned /*ctrl_id*/, const std::optional& /*selection*/) {} + virtual void msgTableChooseItem(unsigned /*ctrl_id*/, unsigned /*selection*/) {} + virtual void msgTableRightButton(unsigned /*ctrl_id*/, const std::optional& /*selection*/) {} + virtual void msgTableLeftButton(unsigned /*ctrl_id*/, const std::optional& /*selection*/) {} /// Callback of a message box when closed - virtual void Msg_MsgBoxResult(unsigned /*msgbox_id*/, MsgboxResult /*mbr*/) {} + virtual void msgMsgBoxResult(unsigned /*msgbox_id*/, MsgboxResult /*mbr*/) {} // Callbacks triggered by controls of ctrlGroup - virtual void Msg_Group_ButtonClick(unsigned /*group_id*/, unsigned /*ctrl_id*/) {} - virtual void Msg_Group_EditEnter(unsigned /*group_id*/, unsigned /*ctrl_id*/) {} - virtual void Msg_Group_EditChange(unsigned /*group_id*/, unsigned /*ctrl_id*/) {} - virtual void Msg_Group_TabChange(unsigned /*group_id*/, unsigned /*ctrl_id*/, unsigned short /*tab_id*/) {} - virtual void Msg_Group_ListSelectItem(unsigned /*group_id*/, unsigned /*ctrl_id*/, int /*selection*/) {} - virtual void Msg_Group_ComboSelectItem(unsigned /*group_id*/, unsigned /*ctrl_id*/, unsigned /*selection*/) {} - virtual void Msg_Group_CheckboxChange(unsigned /*group_id*/, unsigned /*ctrl_id*/, bool /*checked*/) {} - virtual void Msg_Group_ProgressChange(unsigned /*group_id*/, unsigned /*ctrl_id*/, unsigned short /*position*/) {} - virtual void Msg_Group_ScrollShow(unsigned /*group_id*/, unsigned /*ctrl_id*/, bool /*visible*/) {} - virtual void Msg_Group_OptionGroupChange(unsigned /*group_id*/, unsigned /*ctrl_id*/, unsigned /*selection*/) {} - virtual void Msg_Group_Timer(unsigned /*group_id*/, unsigned /*ctrl_id*/) {} - virtual void Msg_Group_TableSelectItem(unsigned /*group_id*/, unsigned /*ctrl_id*/, - const std::optional& /*selection*/) + virtual void msgGroupButtonClick(unsigned /*group_id*/, unsigned /*ctrl_id*/) {} + virtual void msgGroupEditEnter(unsigned /*group_id*/, unsigned /*ctrl_id*/) {} + virtual void msgGroupEditChange(unsigned /*group_id*/, unsigned /*ctrl_id*/) {} + virtual void msgGroupTabChange(unsigned /*group_id*/, unsigned /*ctrl_id*/, unsigned short /*tab_id*/) {} + virtual void msgGroupListSelectItem(unsigned /*group_id*/, unsigned /*ctrl_id*/, int /*selection*/) {} + virtual void msgGroupComboSelectItem(unsigned /*group_id*/, unsigned /*ctrl_id*/, unsigned /*selection*/) {} + virtual void msgGroupCheckboxChange(unsigned /*group_id*/, unsigned /*ctrl_id*/, bool /*checked*/) {} + virtual void msgGroupProgressChange(unsigned /*group_id*/, unsigned /*ctrl_id*/, unsigned short /*position*/) {} + virtual void msgGroupScrollShow(unsigned /*group_id*/, unsigned /*ctrl_id*/, bool /*visible*/) {} + virtual void msgGroupOptionGroupChange(unsigned /*group_id*/, unsigned /*ctrl_id*/, unsigned /*selection*/) {} + virtual void msgGroupTimer(unsigned /*group_id*/, unsigned /*ctrl_id*/) {} + virtual void msgGroupTableSelectItem(unsigned /*group_id*/, unsigned /*ctrl_id*/, + const std::optional& /*selection*/) {} - virtual void Msg_Group_TableRightButton(unsigned /*group_id*/, unsigned /*ctrl_id*/, - const std::optional& /*selection*/) + virtual void msgGroupTableRightButton(unsigned /*group_id*/, unsigned /*ctrl_id*/, + const std::optional& /*selection*/) {} - virtual void Msg_Group_TableLeftButton(unsigned /*group_id*/, unsigned /*ctrl_id*/, - const std::optional& /*selection*/) + virtual void msgGroupTableLeftButton(unsigned /*group_id*/, unsigned /*ctrl_id*/, + const std::optional& /*selection*/) {} enum class ButtonState diff --git a/libs/s25main/WindowManager.cpp b/libs/s25main/WindowManager.cpp index 2fb179de02..091452859d 100644 --- a/libs/s25main/WindowManager.cpp +++ b/libs/s25main/WindowManager.cpp @@ -83,9 +83,9 @@ void WindowManager::Draw() if(!curDesktop) return; - curDesktop->Msg_PaintBefore(); + curDesktop->msgPaintBefore(); curDesktop->Draw(); - curDesktop->Msg_PaintAfter(); + curDesktop->msgPaintAfter(); // First close all marked windows CloseMarkedIngameWnds(); @@ -93,11 +93,11 @@ void WindowManager::Draw() { // If the window is not minimized, call paintAfter if(!wnd->IsMinimized()) - wnd->Msg_PaintBefore(); + wnd->msgPaintBefore(); wnd->Draw(); // If the window is not minimized, call paintAfter if(!wnd->IsMinimized()) - wnd->Msg_PaintAfter(); + wnd->msgPaintAfter(); } DrawToolTip(); @@ -264,7 +264,7 @@ Window* WindowManager::getActiveWindow() const return nullptr; } -void WindowManager::Msg_LeftDown(MouseCoords mc) +void WindowManager::msgLeftDown(MouseCoords mc) { // play click sound SoundEffectItem* sound = LOADER.GetSoundN("sound", 112); @@ -274,10 +274,10 @@ void WindowManager::Msg_LeftDown(MouseCoords mc) Window* activeWindow = findAndActivateWindow(mc.pos); // Ignore mouse message, e.g. right after switching desktop, to avoid unwanted clicks if(!disable_mouse && activeWindow) - RelayMouseMessage(&Window::Msg_LeftDown, mc, activeWindow); + RelayMouseMessage(&Window::msgLeftDown, mc, activeWindow); } -void WindowManager::Msg_LeftUp(MouseCoords mc) +void WindowManager::msgLeftUp(MouseCoords mc) { // Any desktop active? if(!curDesktop) @@ -307,12 +307,12 @@ void WindowManager::Msg_LeftUp(MouseCoords mc) // Don't relay message if mouse is disabled (e.g. right after desktop switch) if(!disable_mouse) - RelayMouseMessage(&Window::Msg_LeftUp, mc); + RelayMouseMessage(&Window::msgLeftUp, mc); else if(!nextdesktop) disable_mouse = false; } -void WindowManager::Msg_RightDown(const MouseCoords& mc) +void WindowManager::msgRightDown(const MouseCoords& mc) { if(!curDesktop) return; @@ -340,44 +340,44 @@ void WindowManager::Msg_RightDown(const MouseCoords& mc) } } } - RelayMouseMessage(&Window::Msg_RightDown, mc, findAndActivateWindow(mc.pos)); + RelayMouseMessage(&Window::msgRightDown, mc, findAndActivateWindow(mc.pos)); } -void WindowManager::Msg_RightUp(const MouseCoords& mc) +void WindowManager::msgRightUp(const MouseCoords& mc) { - RelayMouseMessage(&Window::Msg_RightUp, mc); + RelayMouseMessage(&Window::msgRightUp, mc); } -void WindowManager::Msg_MiddleDown(const MouseCoords& mc) +void WindowManager::msgMiddleDown(const MouseCoords& mc) { Window* activeWindow = findAndActivateWindow(mc.pos); if(activeWindow) - RelayMouseMessage(&Window::Msg_MiddleDown, mc, activeWindow); + RelayMouseMessage(&Window::msgMiddleDown, mc, activeWindow); } -void WindowManager::Msg_MiddleUp(const MouseCoords& mc) +void WindowManager::msgMiddleUp(const MouseCoords& mc) { - RelayMouseMessage(&Window::Msg_MiddleUp, mc); + RelayMouseMessage(&Window::msgMiddleUp, mc); } -void WindowManager::Msg_WheelUp(const MouseCoords& mc) +void WindowManager::msgWheelUp(const MouseCoords& mc) { - RelayMouseMessage(&Window::Msg_WheelUp, mc, findAndActivateWindow(mc.pos)); + RelayMouseMessage(&Window::msgWheelUp, mc, findAndActivateWindow(mc.pos)); } -void WindowManager::Msg_WheelDown(const MouseCoords& mc) +void WindowManager::msgWheelDown(const MouseCoords& mc) { - RelayMouseMessage(&Window::Msg_WheelDown, mc, findAndActivateWindow(mc.pos)); + RelayMouseMessage(&Window::msgWheelDown, mc, findAndActivateWindow(mc.pos)); } -void WindowManager::Msg_MouseMove(const MouseCoords& mc) +void WindowManager::msgMouseMove(const MouseCoords& mc) { lastMousePos = mc.pos; - RelayMouseMessage(&Window::Msg_MouseMove, mc); + RelayMouseMessage(&Window::msgMouseMove, mc); } -void WindowManager::Msg_KeyDown(const KeyEvent& ke) +void WindowManager::msgKeyDown(const KeyEvent& ke) { if(ke.alt && (ke.kt == KeyType::Return)) { @@ -392,7 +392,7 @@ void WindowManager::Msg_KeyDown(const KeyEvent& ke) } else if(ke.kt == KeyType::Print) TakeScreenshot(); else - RelayKeyboardMessage(&Window::Msg_KeyDown, ke); + RelayKeyboardMessage(&Window::msgKeyDown, ke); } /** @@ -401,13 +401,13 @@ void WindowManager::Msg_KeyDown(const KeyEvent& ke) void WindowManager::WindowResized() { VIDEODRIVER.RenewViewport(); - Msg_ScreenResize(VIDEODRIVER.GetRenderSize()); + msgScreenResize(VIDEODRIVER.GetRenderSize()); } /** * React to change of the render size */ -void WindowManager::Msg_ScreenResize(const Extent& newSize) +void WindowManager::msgScreenResize(const Extent& newSize) { // Don't handle it if nothing changed if(newSize == curRenderSize) @@ -425,7 +425,7 @@ void WindowManager::Msg_ScreenResize(const Extent& newSize) if(!curDesktop) return; - curDesktop->Msg_ScreenResize(sr); + curDesktop->msgScreenResize(sr); // Move IngameWindows so they are completely visible for(const auto& window : windows) @@ -433,7 +433,7 @@ void WindowManager::Msg_ScreenResize(const Extent& newSize) DrawPoint delta = window->GetPos() + DrawPoint(window->GetSize()) - DrawPoint(sr.newSize); if(delta.x > 0 || delta.y > 0) window->SetPos(window->GetPos() - elMax(delta, DrawPoint(0, 0))); - window->Msg_ScreenResize(sr); + window->msgScreenResize(sr); } } @@ -466,7 +466,7 @@ void WindowManager::DoClose(IngameWindow* window) else SetActiveWindow(*windows.back()); } - curDesktop->Msg_WindowClosed(*tmpHolder); + curDesktop->msgWindowClosed(*tmpHolder); } /** @@ -516,7 +516,7 @@ void WindowManager::DoDesktopSwitch() disable_mouse = false; // Dummy mouse move to init hovering etc - Msg_MouseMove(MouseCoords(VIDEODRIVER.GetMousePos())); + msgMouseMove(MouseCoords(VIDEODRIVER.GetMousePos())); } void WindowManager::CloseMarkedIngameWnds() diff --git a/libs/s25main/WindowManager.h b/libs/s25main/WindowManager.h index 97720199be..1dc943c402 100644 --- a/libs/s25main/WindowManager.h +++ b/libs/s25main/WindowManager.h @@ -88,25 +88,25 @@ class WindowManager : public Singleton, public VideoDriverLoaderI /// merkt einen Desktop zum Wechsel vor. Desktop* Switch(std::unique_ptr desktop); /// Process press of left mouse button - void Msg_LeftDown(MouseCoords mc) override; + void msgLeftDown(MouseCoords mc) override; /// Process release of left mouse button - void Msg_LeftUp(MouseCoords mc) override; + void msgLeftUp(MouseCoords mc) override; /// Process press of right mouse button - void Msg_RightDown(const MouseCoords& mc) override; + void msgRightDown(const MouseCoords& mc) override; /// Process release of right mouse button - void Msg_RightUp(const MouseCoords& mc) override; + void msgRightUp(const MouseCoords& mc) override; /// Process press of middle mouse button - void Msg_MiddleDown(const MouseCoords& mc) override; + void msgMiddleDown(const MouseCoords& mc) override; /// Process release of middle mouse button - void Msg_MiddleUp(const MouseCoords& mc) override; + void msgMiddleUp(const MouseCoords& mc) override; /// Verarbeitung des Drückens des Rad hoch. - void Msg_WheelUp(const MouseCoords& mc) override; + void msgWheelUp(const MouseCoords& mc) override; /// Verarbeitung Rad runter. - void Msg_WheelDown(const MouseCoords& mc) override; + void msgWheelDown(const MouseCoords& mc) override; /// Verarbeitung des Verschiebens der Maus. - void Msg_MouseMove(const MouseCoords& mc) override; + void msgMouseMove(const MouseCoords& mc) override; /// Verarbeitung Keyboard-Event - void Msg_KeyDown(const KeyEvent& ke) override; + void msgKeyDown(const KeyEvent& ke) override; // Show a tooltip // ttw: Window that the tooltip is for, used when updating current tooltip // tooltip: The tooltip text, empty to hide @@ -117,7 +117,7 @@ class WindowManager : public Singleton, public VideoDriverLoaderI void WindowResized() override; /// Verarbeitung Spielfenstergröße verändert (vom Spiel aus) // Achtung: nicht dieselbe Nachricht, die die Window-Klasse empfängt - void Msg_ScreenResize(const Extent& newSize); + void msgScreenResize(const Extent& newSize); /// Return the window currently on the top (probably active) IngameWindow* GetTopMostWindow() const; diff --git a/libs/s25main/controls/ctrlBuildingIcon.cpp b/libs/s25main/controls/ctrlBuildingIcon.cpp index 51ba42099c..26d3413e9d 100644 --- a/libs/s25main/controls/ctrlBuildingIcon.cpp +++ b/libs/s25main/controls/ctrlBuildingIcon.cpp @@ -30,10 +30,10 @@ void ctrlBuildingIcon::Draw_() void ctrlBuildingIcon::DrawContent() const {} -bool ctrlBuildingIcon::Msg_MouseMove(const MouseCoords& mc) +bool ctrlBuildingIcon::msgMouseMove(const MouseCoords& mc) { const bool wasHovered = (state == ButtonState::Hover); - const bool result = ctrlButton::Msg_MouseMove(mc); + const bool result = ctrlButton::msgMouseMove(mc); const bool nowHovered = (state == ButtonState::Hover); if(wasHovered != nowHovered && onHoverChanged_) onHoverChanged_(nowHovered); diff --git a/libs/s25main/controls/ctrlBuildingIcon.h b/libs/s25main/controls/ctrlBuildingIcon.h index 060cc70648..9ee0d67ec2 100644 --- a/libs/s25main/controls/ctrlBuildingIcon.h +++ b/libs/s25main/controls/ctrlBuildingIcon.h @@ -25,7 +25,7 @@ class ctrlBuildingIcon : public ctrlButton /// zeichnet das Fenster. void Draw_() override; void DrawContent() const override; - bool Msg_MouseMove(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; const BuildingType type; /// der GebäudeType des Icons. const Nation nation; /// Volk diff --git a/libs/s25main/controls/ctrlButton.cpp b/libs/s25main/controls/ctrlButton.cpp index b07c65393c..e46ea645ad 100644 --- a/libs/s25main/controls/ctrlButton.cpp +++ b/libs/s25main/controls/ctrlButton.cpp @@ -30,7 +30,7 @@ void ctrlButton::SetActive(bool activate) state = ButtonState::Hover; } -bool ctrlButton::Msg_MouseMove(const MouseCoords& mc) +bool ctrlButton::msgMouseMove(const MouseCoords& mc) { if(isEnabled && IsMouseOver(mc)) { @@ -47,7 +47,7 @@ bool ctrlButton::Msg_MouseMove(const MouseCoords& mc) } } -bool ctrlButton::Msg_LeftDown(const MouseCoords& mc) +bool ctrlButton::msgLeftDown(const MouseCoords& mc) { if(isEnabled && IsMouseOver(mc)) { @@ -58,14 +58,14 @@ bool ctrlButton::Msg_LeftDown(const MouseCoords& mc) return false; } -bool ctrlButton::Msg_LeftUp(const MouseCoords& mc) +bool ctrlButton::msgLeftUp(const MouseCoords& mc) { if(state == ButtonState::Pressed) { if(isEnabled && IsMouseOver(mc)) { state = ButtonState::Hover; - GetParent()->Msg_ButtonClick(GetID()); + GetParent()->msgButtonClick(GetID()); return true; } else state = ButtonState::Up; diff --git a/libs/s25main/controls/ctrlButton.h b/libs/s25main/controls/ctrlButton.h index fde3b43de0..9754a976f2 100644 --- a/libs/s25main/controls/ctrlButton.h +++ b/libs/s25main/controls/ctrlButton.h @@ -32,9 +32,9 @@ class ctrlButton : public Window, public ctrlBaseTooltip bool GetIlluminated() const { return isIlluminated; } void SetBorder(bool hasBorder) { this->hasBorder = hasBorder; } - bool Msg_MouseMove(const MouseCoords& mc) override; - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_LeftUp(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgLeftUp(const MouseCoords& mc) override; ButtonState getState() const { return state; } diff --git a/libs/s25main/controls/ctrlChat.cpp b/libs/s25main/controls/ctrlChat.cpp index 332d793951..5989b43a2d 100644 --- a/libs/s25main/controls/ctrlChat.cpp +++ b/libs/s25main/controls/ctrlChat.cpp @@ -218,22 +218,22 @@ void ctrlChat::AddMessage(const std::string& time_string, const std::string& pla scrollbar->SetScrollPos(chat_lines.size() - page_size); } -bool ctrlChat::Msg_MouseMove(const MouseCoords& mc) +bool ctrlChat::msgMouseMove(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_MouseMove, mc); + return RelayMouseMessage(&Window::msgMouseMove, mc); } -bool ctrlChat::Msg_LeftDown(const MouseCoords& mc) +bool ctrlChat::msgLeftDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_LeftDown, mc); + return RelayMouseMessage(&Window::msgLeftDown, mc); } -bool ctrlChat::Msg_LeftUp(const MouseCoords& mc) +bool ctrlChat::msgLeftUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_LeftUp, mc); + return RelayMouseMessage(&Window::msgLeftUp, mc); } -bool ctrlChat::Msg_WheelUp(const MouseCoords& mc) +bool ctrlChat::msgWheelUp(const MouseCoords& mc) { if(IsPointInRect(mc.pos, Rect(GetDrawPos() + DrawPoint(2, 2), GetSize() - Extent(2, 4)))) { @@ -244,7 +244,7 @@ bool ctrlChat::Msg_WheelUp(const MouseCoords& mc) return false; } -bool ctrlChat::Msg_WheelDown(const MouseCoords& mc) +bool ctrlChat::msgWheelDown(const MouseCoords& mc) { if(IsPointInRect(mc.pos, Rect(GetDrawPos() + DrawPoint(2, 2), GetSize() - Extent(2, 4)))) { diff --git a/libs/s25main/controls/ctrlChat.h b/libs/s25main/controls/ctrlChat.h index c05b59a091..9c4919b9fc 100644 --- a/libs/s25main/controls/ctrlChat.h +++ b/libs/s25main/controls/ctrlChat.h @@ -26,11 +26,11 @@ class ctrlChat : public Window /// Setzt Farbe der Zeitangaben. void SetTimeColor(unsigned color) { time_color = color; } - bool Msg_MouseMove(const MouseCoords& mc) override; - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_LeftUp(const MouseCoords& mc) override; - bool Msg_WheelUp(const MouseCoords& mc) override; - bool Msg_WheelDown(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgLeftUp(const MouseCoords& mc) override; + bool msgWheelUp(const MouseCoords& mc) override; + bool msgWheelDown(const MouseCoords& mc) override; /// Create a (almost) unique color for the given name static unsigned CalcUniqueColor(const std::string& name); diff --git a/libs/s25main/controls/ctrlCheck.cpp b/libs/s25main/controls/ctrlCheck.cpp index 9c5bc83d26..4abc0bc337 100644 --- a/libs/s25main/controls/ctrlCheck.cpp +++ b/libs/s25main/controls/ctrlCheck.cpp @@ -17,19 +17,19 @@ ctrlCheck::ctrlCheck(Window* parent, unsigned id, const DrawPoint& pos, const Ex : Window(parent, id, pos, size), tc(tc), text(std::move(text)), font(font), check(false), readonly(readonly) {} -bool ctrlCheck::Msg_LeftDown(const MouseCoords& mc) +bool ctrlCheck::msgLeftDown(const MouseCoords& mc) { if(!readonly && IsPointInRect(mc.pos, GetDrawRect())) { check = !check; - GetParent()->Msg_CheckboxChange(GetID(), check); + GetParent()->msgCheckboxChange(GetID(), check); return true; } return false; } -bool ctrlCheck::Msg_MouseMove(const MouseCoords& mc) +bool ctrlCheck::msgMouseMove(const MouseCoords& mc) { if(IsMouseOver(mc.pos)) { diff --git a/libs/s25main/controls/ctrlCheck.h b/libs/s25main/controls/ctrlCheck.h index 587727d2b1..0f89c8e461 100644 --- a/libs/s25main/controls/ctrlCheck.h +++ b/libs/s25main/controls/ctrlCheck.h @@ -29,8 +29,8 @@ class ctrlCheck : public Window, public ctrlBaseTooltip } bool isReadOnly() const { return readonly; } - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_MouseMove(const MouseCoords& mc) override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; protected: void Draw_() override; diff --git a/libs/s25main/controls/ctrlComboBox.cpp b/libs/s25main/controls/ctrlComboBox.cpp index acc9fdf4ae..98b666a3b9 100644 --- a/libs/s25main/controls/ctrlComboBox.cpp +++ b/libs/s25main/controls/ctrlComboBox.cpp @@ -72,13 +72,13 @@ std::optional ctrlComboBox::GetSelectedText() const return std::nullopt; } -bool ctrlComboBox::Msg_MouseMove(const MouseCoords& mc) +bool ctrlComboBox::msgMouseMove(const MouseCoords& mc) { // Für Button und Liste weiterleiten - return RelayMouseMessage(&Window::Msg_MouseMove, mc); + return RelayMouseMessage(&Window::msgMouseMove, mc); } -bool ctrlComboBox::Msg_LeftDown(const MouseCoords& mc) +bool ctrlComboBox::msgLeftDown(const MouseCoords& mc) { auto* list = GetCtrl(0); @@ -98,21 +98,21 @@ bool ctrlComboBox::Msg_LeftDown(const MouseCoords& mc) } // Für Button und Liste weiterleiten - return RelayMouseMessage(&Window::Msg_LeftDown, mc); + return RelayMouseMessage(&Window::msgLeftDown, mc); } -bool ctrlComboBox::Msg_LeftUp(const MouseCoords& mc) +bool ctrlComboBox::msgLeftUp(const MouseCoords& mc) { // Für Button und Liste weiterleiten - return RelayMouseMessage(&Window::Msg_LeftUp, mc); + return RelayMouseMessage(&Window::msgLeftUp, mc); } -bool ctrlComboBox::Msg_RightDown(const MouseCoords& mc) +bool ctrlComboBox::msgRightDown(const MouseCoords& mc) { auto* list = GetCtrl(0); // Für Button und Liste weiterleiten (und danach erst schließen) - bool ret = RelayMouseMessage(&Window::Msg_RightDown, mc); + bool ret = RelayMouseMessage(&Window::msgRightDown, mc); // Clicked on list -> close it if(!readonly && IsPointInRect(mc.pos, list->GetDrawRect())) @@ -124,14 +124,14 @@ bool ctrlComboBox::Msg_RightDown(const MouseCoords& mc) return ret; } -bool ctrlComboBox::Msg_WheelUp(const MouseCoords& mc) +bool ctrlComboBox::msgWheelUp(const MouseCoords& mc) { if(readonly) return false; auto* list = GetCtrl(0); if(list->IsVisible() && IsPointInRect(mc.pos, list->GetDrawRect())) - return RelayMouseMessage(&Window::Msg_WheelUp, mc); + return RelayMouseMessage(&Window::msgWheelUp, mc); if(IsPointInRect(mc.pos, GetDrawRect())) { @@ -144,7 +144,7 @@ bool ctrlComboBox::Msg_WheelUp(const MouseCoords& mc) return false; } -bool ctrlComboBox::Msg_WheelDown(const MouseCoords& mc) +bool ctrlComboBox::msgWheelDown(const MouseCoords& mc) { if(readonly) return false; @@ -154,7 +154,7 @@ bool ctrlComboBox::Msg_WheelDown(const MouseCoords& mc) if(list->IsVisible() && IsPointInRect(mc.pos, list->GetDrawRect())) { // Scrolled in opened list -> - return RelayMouseMessage(&Window::Msg_WheelDown, mc); + return RelayMouseMessage(&Window::msgWheelDown, mc); } if(IsPointInRect(mc.pos, GetDrawRect())) @@ -174,7 +174,7 @@ Rect ctrlComboBox::GetFullDrawRect(const ctrlList* list) return myRect; } -void ctrlComboBox::Msg_ListSelectItem(unsigned, const int selection) +void ctrlComboBox::msgListSelectItem(unsigned, const int selection) { // Liste wieder ausblenden ShowList(false); @@ -183,7 +183,7 @@ void ctrlComboBox::Msg_ListSelectItem(unsigned, const int selection) if(selection >= 0 && !suppressSelectEvent) { // Nachricht an übergeordnetes Fenster verschicken - GetParent()->Msg_ComboSelectItem(GetID(), selection); + GetParent()->msgComboSelectItem(GetID(), selection); } } @@ -226,11 +226,11 @@ void ctrlComboBox::Draw_() button->Draw(); } -void ctrlComboBox::Msg_PaintAfter() +void ctrlComboBox::msgPaintAfter() { // Draw list now so it is on top of everything GetCtrl(0)->Draw(); - Window::Msg_PaintAfter(); + Window::msgPaintAfter(); } void ctrlComboBox::ShowList(bool show) diff --git a/libs/s25main/controls/ctrlComboBox.h b/libs/s25main/controls/ctrlComboBox.h index 658446297e..63862132df 100644 --- a/libs/s25main/controls/ctrlComboBox.h +++ b/libs/s25main/controls/ctrlComboBox.h @@ -29,15 +29,15 @@ class ctrlComboBox final : public Window void SetText(unsigned item, const std::string& text) { GetCtrl(0)->SetItemText(item, text); } std::optional GetSelectedText() const; - void Msg_PaintAfter() override; - bool Msg_MouseMove(const MouseCoords& mc) override; - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_LeftUp(const MouseCoords& mc) override; - bool Msg_RightDown(const MouseCoords& mc) override; - bool Msg_WheelUp(const MouseCoords& mc) override; - bool Msg_WheelDown(const MouseCoords& mc) override; - - void Msg_ListSelectItem(unsigned ctrl_id, int selection) override; + void msgPaintAfter() override; + bool msgMouseMove(const MouseCoords& mc) override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgLeftUp(const MouseCoords& mc) override; + bool msgRightDown(const MouseCoords& mc) override; + bool msgWheelUp(const MouseCoords& mc) override; + bool msgWheelDown(const MouseCoords& mc) override; + + void msgListSelectItem(unsigned ctrl_id, int selection) override; protected: void Draw_() override; diff --git a/libs/s25main/controls/ctrlEdit.cpp b/libs/s25main/controls/ctrlEdit.cpp index 33a4521ae3..7b1a5255f1 100644 --- a/libs/s25main/controls/ctrlEdit.cpp +++ b/libs/s25main/controls/ctrlEdit.cpp @@ -229,7 +229,7 @@ void ctrlEdit::Notify() if(!notify_ || !GetParent()) return; - GetParent()->Msg_EditChange(GetID()); + GetParent()->msgEditChange(GetID()); } void ctrlEdit::Resize(const Extent& newSize) @@ -241,7 +241,7 @@ void ctrlEdit::Resize(const Extent& newSize) /** * Maustaste-gedrückt Callback */ -bool ctrlEdit::Msg_LeftDown(const MouseCoords& mc) +bool ctrlEdit::msgLeftDown(const MouseCoords& mc) { SetFocus(IsPointInRect(mc.pos, GetDrawRect())); return false; // "Unhandled" so other edits can handle this too and set their focus accordingly @@ -250,7 +250,7 @@ bool ctrlEdit::Msg_LeftDown(const MouseCoords& mc) /** * Taste-gedrückt Callback */ -bool ctrlEdit::Msg_KeyDown(const KeyEvent& ke) +bool ctrlEdit::msgKeyDown(const KeyEvent& ke) { auto isDelimiter = [](char32_t c) { for(const auto cur : U" \t\n-+=") @@ -328,7 +328,7 @@ bool ctrlEdit::Msg_KeyDown(const KeyEvent& ke) case KeyType::Return: // Enter gedrückt if(!isDisabled_ && GetParent()) - GetParent()->Msg_EditEnter(GetID()); + GetParent()->msgEditEnter(GetID()); break; case KeyType::Home: // Pos1 gedrückt diff --git a/libs/s25main/controls/ctrlEdit.h b/libs/s25main/controls/ctrlEdit.h index f7ad442970..b309272ea6 100644 --- a/libs/s25main/controls/ctrlEdit.h +++ b/libs/s25main/controls/ctrlEdit.h @@ -52,8 +52,8 @@ class ctrlEdit : public Window void Resize(const Extent& newSize) override; - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_KeyDown(const KeyEvent& ke) override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgKeyDown(const KeyEvent& ke) override; protected: void Draw_() override; diff --git a/libs/s25main/controls/ctrlGroup.cpp b/libs/s25main/controls/ctrlGroup.cpp index ce137be4fe..83d24aabcf 100644 --- a/libs/s25main/controls/ctrlGroup.cpp +++ b/libs/s25main/controls/ctrlGroup.cpp @@ -9,186 +9,186 @@ struct KeyEvent; ctrlGroup::ctrlGroup(Window* parent, unsigned id) : Window(parent, id, DrawPoint(0, 0)) {} -void ctrlGroup::Msg_ButtonClick(const unsigned ctrl_id) +void ctrlGroup::msgButtonClick(const unsigned ctrl_id) { - GetParent()->Msg_Group_ButtonClick(this->GetID(), ctrl_id); + GetParent()->msgGroupButtonClick(this->GetID(), ctrl_id); } -void ctrlGroup::Msg_EditEnter(const unsigned ctrl_id) +void ctrlGroup::msgEditEnter(const unsigned ctrl_id) { - GetParent()->Msg_Group_EditEnter(this->GetID(), ctrl_id); + GetParent()->msgGroupEditEnter(this->GetID(), ctrl_id); } -void ctrlGroup::Msg_EditChange(const unsigned ctrl_id) +void ctrlGroup::msgEditChange(const unsigned ctrl_id) { - GetParent()->Msg_Group_EditChange(this->GetID(), ctrl_id); + GetParent()->msgGroupEditChange(this->GetID(), ctrl_id); } -void ctrlGroup::Msg_TabChange(const unsigned ctrl_id, const unsigned short tab_id) +void ctrlGroup::msgTabChange(const unsigned ctrl_id, const unsigned short tab_id) { - GetParent()->Msg_Group_TabChange(this->GetID(), ctrl_id, tab_id); + GetParent()->msgGroupTabChange(this->GetID(), ctrl_id, tab_id); } -void ctrlGroup::Msg_ListSelectItem(const unsigned ctrl_id, const int selection) +void ctrlGroup::msgListSelectItem(const unsigned ctrl_id, const int selection) { - GetParent()->Msg_Group_ListSelectItem(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupListSelectItem(this->GetID(), ctrl_id, selection); } -void ctrlGroup::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned selection) +void ctrlGroup::msgComboSelectItem(const unsigned ctrl_id, const unsigned selection) { - GetParent()->Msg_Group_ComboSelectItem(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupComboSelectItem(this->GetID(), ctrl_id, selection); } -void ctrlGroup::Msg_CheckboxChange(const unsigned ctrl_id, const bool checked) +void ctrlGroup::msgCheckboxChange(const unsigned ctrl_id, const bool checked) { - GetParent()->Msg_Group_CheckboxChange(this->GetID(), ctrl_id, checked); + GetParent()->msgGroupCheckboxChange(this->GetID(), ctrl_id, checked); } -void ctrlGroup::Msg_ProgressChange(const unsigned ctrl_id, const unsigned short position) +void ctrlGroup::msgProgressChange(const unsigned ctrl_id, const unsigned short position) { - GetParent()->Msg_Group_ProgressChange(this->GetID(), ctrl_id, position); + GetParent()->msgGroupProgressChange(this->GetID(), ctrl_id, position); } -void ctrlGroup::Msg_ScrollShow(const unsigned ctrl_id, const bool visible) +void ctrlGroup::msgScrollShow(const unsigned ctrl_id, const bool visible) { - GetParent()->Msg_Group_ScrollShow(this->GetID(), ctrl_id, visible); + GetParent()->msgGroupScrollShow(this->GetID(), ctrl_id, visible); } -void ctrlGroup::Msg_OptionGroupChange(const unsigned ctrl_id, const unsigned selection) +void ctrlGroup::msgOptionGroupChange(const unsigned ctrl_id, const unsigned selection) { - GetParent()->Msg_Group_OptionGroupChange(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupOptionGroupChange(this->GetID(), ctrl_id, selection); } -void ctrlGroup::Msg_Timer(const unsigned ctrl_id) +void ctrlGroup::msgTimer(const unsigned ctrl_id) { - GetParent()->Msg_Group_Timer(this->GetID(), ctrl_id); + GetParent()->msgGroupTimer(this->GetID(), ctrl_id); } -void ctrlGroup::Msg_TableSelectItem(const unsigned ctrl_id, const std::optional& selection) +void ctrlGroup::msgTableSelectItem(const unsigned ctrl_id, const std::optional& selection) { - GetParent()->Msg_Group_TableSelectItem(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupTableSelectItem(this->GetID(), ctrl_id, selection); } -void ctrlGroup::Msg_TableRightButton(const unsigned ctrl_id, const std::optional& selection) +void ctrlGroup::msgTableRightButton(const unsigned ctrl_id, const std::optional& selection) { - GetParent()->Msg_Group_TableRightButton(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupTableRightButton(this->GetID(), ctrl_id, selection); } -void ctrlGroup::Msg_TableLeftButton(const unsigned ctrl_id, const std::optional& selection) +void ctrlGroup::msgTableLeftButton(const unsigned ctrl_id, const std::optional& selection) { - GetParent()->Msg_Group_TableLeftButton(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupTableLeftButton(this->GetID(), ctrl_id, selection); } -bool ctrlGroup::Msg_LeftDown(const MouseCoords& mc) +bool ctrlGroup::msgLeftDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_LeftDown, mc); + return RelayMouseMessage(&Window::msgLeftDown, mc); } -bool ctrlGroup::Msg_RightDown(const MouseCoords& mc) +bool ctrlGroup::msgRightDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_RightDown, mc); + return RelayMouseMessage(&Window::msgRightDown, mc); } -bool ctrlGroup::Msg_LeftUp(const MouseCoords& mc) +bool ctrlGroup::msgLeftUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_LeftUp, mc); + return RelayMouseMessage(&Window::msgLeftUp, mc); } -bool ctrlGroup::Msg_RightUp(const MouseCoords& mc) +bool ctrlGroup::msgRightUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_RightUp, mc); + return RelayMouseMessage(&Window::msgRightUp, mc); } -bool ctrlGroup::Msg_WheelUp(const MouseCoords& mc) +bool ctrlGroup::msgWheelUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_WheelUp, mc); + return RelayMouseMessage(&Window::msgWheelUp, mc); } -bool ctrlGroup::Msg_WheelDown(const MouseCoords& mc) +bool ctrlGroup::msgWheelDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_WheelDown, mc); + return RelayMouseMessage(&Window::msgWheelDown, mc); } -bool ctrlGroup::Msg_MouseMove(const MouseCoords& mc) +bool ctrlGroup::msgMouseMove(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_MouseMove, mc); + return RelayMouseMessage(&Window::msgMouseMove, mc); } -bool ctrlGroup::Msg_KeyDown(const KeyEvent& ke) +bool ctrlGroup::msgKeyDown(const KeyEvent& ke) { - return RelayKeyboardMessage(&Window::Msg_KeyDown, ke); + return RelayKeyboardMessage(&Window::msgKeyDown, ke); } -void ctrlGroup::Msg_Group_ButtonClick(const unsigned /*group_id*/, const unsigned ctrl_id) +void ctrlGroup::msgGroupButtonClick(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->Msg_Group_ButtonClick(this->GetID(), ctrl_id); + GetParent()->msgGroupButtonClick(this->GetID(), ctrl_id); } -void ctrlGroup::Msg_Group_EditEnter(const unsigned /*group_id*/, const unsigned ctrl_id) +void ctrlGroup::msgGroupEditEnter(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->Msg_Group_EditEnter(this->GetID(), ctrl_id); + GetParent()->msgGroupEditEnter(this->GetID(), ctrl_id); } -void ctrlGroup::Msg_Group_EditChange(const unsigned /*group_id*/, const unsigned ctrl_id) +void ctrlGroup::msgGroupEditChange(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->Msg_Group_EditChange(this->GetID(), ctrl_id); + GetParent()->msgGroupEditChange(this->GetID(), ctrl_id); } -void ctrlGroup::Msg_Group_TabChange(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned short tab_id) +void ctrlGroup::msgGroupTabChange(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned short tab_id) { - GetParent()->Msg_Group_TabChange(this->GetID(), ctrl_id, tab_id); + GetParent()->msgGroupTabChange(this->GetID(), ctrl_id, tab_id); } -void ctrlGroup::Msg_Group_ListSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, const int selection) +void ctrlGroup::msgGroupListSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, const int selection) { - GetParent()->Msg_Group_ListSelectItem(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupListSelectItem(this->GetID(), ctrl_id, selection); } -void ctrlGroup::Msg_Group_ComboSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned selection) +void ctrlGroup::msgGroupComboSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned selection) { - GetParent()->Msg_Group_ComboSelectItem(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupComboSelectItem(this->GetID(), ctrl_id, selection); } -void ctrlGroup::Msg_Group_CheckboxChange(const unsigned /*group_id*/, const unsigned ctrl_id, const bool checked) +void ctrlGroup::msgGroupCheckboxChange(const unsigned /*group_id*/, const unsigned ctrl_id, const bool checked) { - GetParent()->Msg_Group_CheckboxChange(this->GetID(), ctrl_id, checked); + GetParent()->msgGroupCheckboxChange(this->GetID(), ctrl_id, checked); } -void ctrlGroup::Msg_Group_ProgressChange(const unsigned /*group_id*/, const unsigned ctrl_id, - const unsigned short position) +void ctrlGroup::msgGroupProgressChange(const unsigned /*group_id*/, const unsigned ctrl_id, + const unsigned short position) { - GetParent()->Msg_Group_ProgressChange(this->GetID(), ctrl_id, position); + GetParent()->msgGroupProgressChange(this->GetID(), ctrl_id, position); } -void ctrlGroup::Msg_Group_ScrollShow(const unsigned /*group_id*/, const unsigned ctrl_id, const bool visible) +void ctrlGroup::msgGroupScrollShow(const unsigned /*group_id*/, const unsigned ctrl_id, const bool visible) { - GetParent()->Msg_Group_ScrollShow(this->GetID(), ctrl_id, visible); + GetParent()->msgGroupScrollShow(this->GetID(), ctrl_id, visible); } -void ctrlGroup::Msg_Group_OptionGroupChange(const unsigned /*group_id*/, const unsigned ctrl_id, unsigned selection) +void ctrlGroup::msgGroupOptionGroupChange(const unsigned /*group_id*/, const unsigned ctrl_id, unsigned selection) { - GetParent()->Msg_Group_OptionGroupChange(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupOptionGroupChange(this->GetID(), ctrl_id, selection); } -void ctrlGroup::Msg_Group_Timer(const unsigned /*group_id*/, const unsigned ctrl_id) +void ctrlGroup::msgGroupTimer(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->Msg_Group_Timer(this->GetID(), ctrl_id); + GetParent()->msgGroupTimer(this->GetID(), ctrl_id); } -void ctrlGroup::Msg_Group_TableSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, - const std::optional& selection) +void ctrlGroup::msgGroupTableSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, + const std::optional& selection) { - GetParent()->Msg_Group_TableSelectItem(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupTableSelectItem(this->GetID(), ctrl_id, selection); } -void ctrlGroup::Msg_Group_TableRightButton(const unsigned /*group_id*/, const unsigned ctrl_id, - const std::optional& selection) +void ctrlGroup::msgGroupTableRightButton(const unsigned /*group_id*/, const unsigned ctrl_id, + const std::optional& selection) { - GetParent()->Msg_Group_TableRightButton(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupTableRightButton(this->GetID(), ctrl_id, selection); } -void ctrlGroup::Msg_Group_TableLeftButton(const unsigned /*group_id*/, const unsigned ctrl_id, - const std::optional& selection) +void ctrlGroup::msgGroupTableLeftButton(const unsigned /*group_id*/, const unsigned ctrl_id, + const std::optional& selection) { - GetParent()->Msg_Group_TableLeftButton(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupTableLeftButton(this->GetID(), ctrl_id, selection); } diff --git a/libs/s25main/controls/ctrlGroup.h b/libs/s25main/controls/ctrlGroup.h index 94b07ab9e0..ef7f748c6d 100644 --- a/libs/s25main/controls/ctrlGroup.h +++ b/libs/s25main/controls/ctrlGroup.h @@ -20,45 +20,45 @@ class ctrlGroup : public Window public: ctrlGroup(Window* parent, unsigned id); - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_EditEnter(unsigned ctrl_id) override; - void Msg_EditChange(unsigned ctrl_id) override; - void Msg_TabChange(unsigned ctrl_id, unsigned short tab_id) override; - void Msg_ListSelectItem(unsigned ctrl_id, int selection) override; - void Msg_ComboSelectItem(unsigned ctrl_id, unsigned selection) override; - void Msg_CheckboxChange(unsigned ctrl_id, bool checked) override; - void Msg_ProgressChange(unsigned ctrl_id, unsigned short position) override; - void Msg_ScrollShow(unsigned ctrl_id, bool visible) override; - void Msg_OptionGroupChange(unsigned ctrl_id, unsigned selection) override; - void Msg_Timer(unsigned ctrl_id) override; - void Msg_TableSelectItem(unsigned ctrl_id, const std::optional& selection) override; - void Msg_TableRightButton(unsigned ctrl_id, const std::optional& selection) override; - void Msg_TableLeftButton(unsigned ctrl_id, const std::optional& selection) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgEditEnter(unsigned ctrl_id) override; + void msgEditChange(unsigned ctrl_id) override; + void msgTabChange(unsigned ctrl_id, unsigned short tab_id) override; + void msgListSelectItem(unsigned ctrl_id, int selection) override; + void msgComboSelectItem(unsigned ctrl_id, unsigned selection) override; + void msgCheckboxChange(unsigned ctrl_id, bool checked) override; + void msgProgressChange(unsigned ctrl_id, unsigned short position) override; + void msgScrollShow(unsigned ctrl_id, bool visible) override; + void msgOptionGroupChange(unsigned ctrl_id, unsigned selection) override; + void msgTimer(unsigned ctrl_id) override; + void msgTableSelectItem(unsigned ctrl_id, const std::optional& selection) override; + void msgTableRightButton(unsigned ctrl_id, const std::optional& selection) override; + void msgTableLeftButton(unsigned ctrl_id, const std::optional& selection) override; - void Msg_Group_ButtonClick(unsigned group_id, unsigned ctrl_id) override; - void Msg_Group_EditEnter(unsigned group_id, unsigned ctrl_id) override; - void Msg_Group_EditChange(unsigned group_id, unsigned ctrl_id) override; - void Msg_Group_TabChange(unsigned group_id, unsigned ctrl_id, unsigned short tab_id) override; - void Msg_Group_ListSelectItem(unsigned group_id, unsigned ctrl_id, int selection) override; - void Msg_Group_ComboSelectItem(unsigned group_id, unsigned ctrl_id, unsigned selection) override; - void Msg_Group_CheckboxChange(unsigned group_id, unsigned ctrl_id, bool checked) override; - void Msg_Group_ProgressChange(unsigned group_id, unsigned ctrl_id, unsigned short position) override; - void Msg_Group_ScrollShow(unsigned group_id, unsigned ctrl_id, bool visible) override; - void Msg_Group_OptionGroupChange(unsigned group_id, unsigned ctrl_id, unsigned selection) override; - void Msg_Group_Timer(unsigned group_id, unsigned ctrl_id) override; - void Msg_Group_TableSelectItem(unsigned group_id, unsigned ctrl_id, - const std::optional& selection) override; - void Msg_Group_TableRightButton(unsigned group_id, unsigned ctrl_id, - const std::optional& selection) override; - void Msg_Group_TableLeftButton(unsigned group_id, unsigned ctrl_id, - const std::optional& selection) override; + void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; + void msgGroupEditEnter(unsigned group_id, unsigned ctrl_id) override; + void msgGroupEditChange(unsigned group_id, unsigned ctrl_id) override; + void msgGroupTabChange(unsigned group_id, unsigned ctrl_id, unsigned short tab_id) override; + void msgGroupListSelectItem(unsigned group_id, unsigned ctrl_id, int selection) override; + void msgGroupComboSelectItem(unsigned group_id, unsigned ctrl_id, unsigned selection) override; + void msgGroupCheckboxChange(unsigned group_id, unsigned ctrl_id, bool checked) override; + void msgGroupProgressChange(unsigned group_id, unsigned ctrl_id, unsigned short position) override; + void msgGroupScrollShow(unsigned group_id, unsigned ctrl_id, bool visible) override; + void msgGroupOptionGroupChange(unsigned group_id, unsigned ctrl_id, unsigned selection) override; + void msgGroupTimer(unsigned group_id, unsigned ctrl_id) override; + void msgGroupTableSelectItem(unsigned group_id, unsigned ctrl_id, + const std::optional& selection) override; + void msgGroupTableRightButton(unsigned group_id, unsigned ctrl_id, + const std::optional& selection) override; + void msgGroupTableLeftButton(unsigned group_id, unsigned ctrl_id, + const std::optional& selection) override; - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_RightDown(const MouseCoords& mc) override; - bool Msg_LeftUp(const MouseCoords& mc) override; - bool Msg_RightUp(const MouseCoords& mc) override; - bool Msg_WheelUp(const MouseCoords& mc) override; - bool Msg_WheelDown(const MouseCoords& mc) override; - bool Msg_MouseMove(const MouseCoords& mc) override; - bool Msg_KeyDown(const KeyEvent& ke) override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgRightDown(const MouseCoords& mc) override; + bool msgLeftUp(const MouseCoords& mc) override; + bool msgRightUp(const MouseCoords& mc) override; + bool msgWheelUp(const MouseCoords& mc) override; + bool msgWheelDown(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; + bool msgKeyDown(const KeyEvent& ke) override; }; diff --git a/libs/s25main/controls/ctrlImage.cpp b/libs/s25main/controls/ctrlImage.cpp index 30dd2e2044..6370b02869 100644 --- a/libs/s25main/controls/ctrlImage.cpp +++ b/libs/s25main/controls/ctrlImage.cpp @@ -17,7 +17,7 @@ void ctrlImage::Draw_() DrawImage(Rect(GetDrawPos(), GetImageRect().getSize())); } -bool ctrlImage::Msg_MouseMove(const MouseCoords& mc) +bool ctrlImage::msgMouseMove(const MouseCoords& mc) { if(GetImage()) { diff --git a/libs/s25main/controls/ctrlImage.h b/libs/s25main/controls/ctrlImage.h index d15d3fead5..60f70c061f 100644 --- a/libs/s25main/controls/ctrlImage.h +++ b/libs/s25main/controls/ctrlImage.h @@ -17,7 +17,7 @@ class ctrlImage : public Window, public ctrlBaseTooltip, public ctrlBaseImage ctrlImage(Window* parent, unsigned id, const DrawPoint& pos, ITexture* image, const std::string& tooltip); ~ctrlImage() override; - bool Msg_MouseMove(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; Rect GetBoundaryRect() const override; protected: diff --git a/libs/s25main/controls/ctrlIngameMinimap.cpp b/libs/s25main/controls/ctrlIngameMinimap.cpp index 05b3e1a651..3efde87cd5 100644 --- a/libs/s25main/controls/ctrlIngameMinimap.cpp +++ b/libs/s25main/controls/ctrlIngameMinimap.cpp @@ -67,12 +67,12 @@ void ctrlIngameMinimap::Draw_() image->DrawPart(Rect(GetMapDrawArea().getOrigin() + pos, drawSize), srcOffset); } -bool ctrlIngameMinimap::Msg_LeftDown(const MouseCoords& mc) +bool ctrlIngameMinimap::msgLeftDown(const MouseCoords& mc) { - return Msg_MouseMove(mc); + return msgMouseMove(mc); } -bool ctrlIngameMinimap::Msg_MouseMove(const MouseCoords& mc) +bool ctrlIngameMinimap::msgMouseMove(const MouseCoords& mc) { if(mc.ldown) { diff --git a/libs/s25main/controls/ctrlIngameMinimap.h b/libs/s25main/controls/ctrlIngameMinimap.h index fd36046f37..69d17cc52e 100644 --- a/libs/s25main/controls/ctrlIngameMinimap.h +++ b/libs/s25main/controls/ctrlIngameMinimap.h @@ -26,8 +26,8 @@ class ctrlIngameMinimap : public ctrlMinimap /// Zeichnet die MapPreview void Draw_() override; - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_MouseMove(const MouseCoords& mc) override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; /// Die einzelnen Dinge umschalten void ToggleTerritory(); diff --git a/libs/s25main/controls/ctrlList.cpp b/libs/s25main/controls/ctrlList.cpp index 00e745310a..020fa17b71 100644 --- a/libs/s25main/controls/ctrlList.cpp +++ b/libs/s25main/controls/ctrlList.cpp @@ -28,11 +28,11 @@ void ctrlList::SetSelection(const std::optional& selection) { selection_ = selection; if(selection && GetParent()) - GetParent()->Msg_ListSelectItem(GetID(), *selection); + GetParent()->msgListSelectItem(GetID(), *selection); } } -bool ctrlList::Msg_MouseMove(const MouseCoords& mc) +bool ctrlList::msgMouseMove(const MouseCoords& mc) { auto* scrollbar = GetCtrl(0); @@ -48,10 +48,10 @@ bool ctrlList::Msg_MouseMove(const MouseCoords& mc) tooltip_.HideTooltip(); // Für die Scrollbar weiterleiten - return scrollbar->Msg_MouseMove(mc); + return scrollbar->msgMouseMove(mc); } -bool ctrlList::Msg_LeftDown(const MouseCoords& mc) +bool ctrlList::msgLeftDown(const MouseCoords& mc) { auto* scrollbar = GetCtrl(0); @@ -64,10 +64,10 @@ bool ctrlList::Msg_LeftDown(const MouseCoords& mc) } // Für die Scrollbar weiterleiten - return scrollbar->Msg_LeftDown(mc); + return scrollbar->msgLeftDown(mc); } -bool ctrlList::Msg_RightDown(const MouseCoords& mc) +bool ctrlList::msgRightDown(const MouseCoords& mc) { auto* scrollbar = GetCtrl(0); @@ -80,10 +80,10 @@ bool ctrlList::Msg_RightDown(const MouseCoords& mc) } // Für die Scrollbar weiterleiten - return scrollbar->Msg_RightDown(mc); + return scrollbar->msgRightDown(mc); } -bool ctrlList::Msg_LeftUp(const MouseCoords& mc) +bool ctrlList::msgLeftUp(const MouseCoords& mc) { auto* scrollbar = GetCtrl(0); @@ -92,16 +92,16 @@ bool ctrlList::Msg_LeftUp(const MouseCoords& mc) { // Doppelklick? Dann noch einen extra Eventhandler aufrufen if(mc.dbl_click && GetParent() && selection_) - GetParent()->Msg_ListChooseItem(GetID(), *selection_); + GetParent()->msgListChooseItem(GetID(), *selection_); return true; } // Für die Scrollbar weiterleiten - return scrollbar->Msg_LeftUp(mc); + return scrollbar->msgLeftUp(mc); } -bool ctrlList::Msg_WheelUp(const MouseCoords& mc) +bool ctrlList::msgWheelUp(const MouseCoords& mc) { // If mouse in list or scrollbar if(IsPointInRect(mc.pos, GetFullDrawArea())) @@ -114,7 +114,7 @@ bool ctrlList::Msg_WheelUp(const MouseCoords& mc) return false; } -bool ctrlList::Msg_WheelDown(const MouseCoords& mc) +bool ctrlList::msgWheelDown(const MouseCoords& mc) { // If mouse in list if(IsPointInRect(mc.pos, GetFullDrawArea())) diff --git a/libs/s25main/controls/ctrlList.h b/libs/s25main/controls/ctrlList.h index fe1c1139f1..824c951a9a 100644 --- a/libs/s25main/controls/ctrlList.h +++ b/libs/s25main/controls/ctrlList.h @@ -40,12 +40,12 @@ class ctrlList : public Window const std::optional& GetSelection() const { return selection_; }; void SetSelection(const std::optional& selection); - bool Msg_MouseMove(const MouseCoords& mc) override; - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_RightDown(const MouseCoords& mc) override; - bool Msg_LeftUp(const MouseCoords& mc) override; - bool Msg_WheelUp(const MouseCoords& mc) override; - bool Msg_WheelDown(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgRightDown(const MouseCoords& mc) override; + bool msgLeftUp(const MouseCoords& mc) override; + bool msgWheelUp(const MouseCoords& mc) override; + bool msgWheelDown(const MouseCoords& mc) override; protected: void Draw_() override; diff --git a/libs/s25main/controls/ctrlMapSelection.cpp b/libs/s25main/controls/ctrlMapSelection.cpp index 8cd5aa351f..4edfa19086 100644 --- a/libs/s25main/controls/ctrlMapSelection.cpp +++ b/libs/s25main/controls/ctrlMapSelection.cpp @@ -117,7 +117,7 @@ void ctrlMapSelection::setPreview(bool previewOnly) preview = previewOnly; } -bool ctrlMapSelection::Msg_LeftUp(const MouseCoords& mc) +bool ctrlMapSelection::msgLeftUp(const MouseCoords& mc) { if(!preview && IsMouseOver(mc)) { @@ -134,7 +134,7 @@ bool ctrlMapSelection::Msg_LeftUp(const MouseCoords& mc) if(matchingMissionIdx >= 0) { setSelection(matchingMissionIdx); - GetParent()->Msg_ButtonClick(GetID()); + GetParent()->msgButtonClick(GetID()); } return true; } diff --git a/libs/s25main/controls/ctrlMapSelection.h b/libs/s25main/controls/ctrlMapSelection.h index 1abb86c36e..82732d5c24 100644 --- a/libs/s25main/controls/ctrlMapSelection.h +++ b/libs/s25main/controls/ctrlMapSelection.h @@ -32,7 +32,7 @@ class ctrlMapSelection : public Window std::optional getSelection() const; void setPreview(bool previewOnly); - bool Msg_LeftUp(const MouseCoords& mc) override; + bool msgLeftUp(const MouseCoords& mc) override; protected: void Draw_() override; diff --git a/libs/s25main/controls/ctrlMultiSelectGroup.cpp b/libs/s25main/controls/ctrlMultiSelectGroup.cpp index 03f1c3c6be..c8f39209b8 100644 --- a/libs/s25main/controls/ctrlMultiSelectGroup.cpp +++ b/libs/s25main/controls/ctrlMultiSelectGroup.cpp @@ -27,7 +27,7 @@ void ctrlMultiSelectGroup::AddSelection(unsigned selection, bool notify) this->selectedItems_.insert(selection); if(notify && GetParent()) - GetParent()->Msg_OptionGroupChange(GetID(), selection); + GetParent()->msgOptionGroupChange(GetID(), selection); } /** @@ -48,7 +48,7 @@ void ctrlMultiSelectGroup::RemoveSelection(unsigned selection, bool notify) this->selectedItems_.erase(selection); if(notify && GetParent()) - GetParent()->Msg_OptionGroupChange(GetID(), selection); + GetParent()->msgOptionGroupChange(GetID(), selection); } /** @@ -67,32 +67,32 @@ bool ctrlMultiSelectGroup::IsSelected(unsigned selection) const return (this->selectedItems_.count(selection) == 1); } -void ctrlMultiSelectGroup::Msg_ButtonClick(const unsigned ctrl_id) +void ctrlMultiSelectGroup::msgButtonClick(const unsigned ctrl_id) { ToggleSelection(ctrl_id, true); } -bool ctrlMultiSelectGroup::Msg_LeftDown(const MouseCoords& mc) +bool ctrlMultiSelectGroup::msgLeftDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_LeftDown, mc); + return RelayMouseMessage(&Window::msgLeftDown, mc); } -bool ctrlMultiSelectGroup::Msg_LeftUp(const MouseCoords& mc) +bool ctrlMultiSelectGroup::msgLeftUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_LeftUp, mc); + return RelayMouseMessage(&Window::msgLeftUp, mc); } -bool ctrlMultiSelectGroup::Msg_WheelUp(const MouseCoords& mc) +bool ctrlMultiSelectGroup::msgWheelUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_WheelUp, mc); + return RelayMouseMessage(&Window::msgWheelUp, mc); } -bool ctrlMultiSelectGroup::Msg_WheelDown(const MouseCoords& mc) +bool ctrlMultiSelectGroup::msgWheelDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_WheelDown, mc); + return RelayMouseMessage(&Window::msgWheelDown, mc); } -bool ctrlMultiSelectGroup::Msg_MouseMove(const MouseCoords& mc) +bool ctrlMultiSelectGroup::msgMouseMove(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_MouseMove, mc); + return RelayMouseMessage(&Window::msgMouseMove, mc); } diff --git a/libs/s25main/controls/ctrlMultiSelectGroup.h b/libs/s25main/controls/ctrlMultiSelectGroup.h index eeaf808aea..cbcb360baa 100644 --- a/libs/s25main/controls/ctrlMultiSelectGroup.h +++ b/libs/s25main/controls/ctrlMultiSelectGroup.h @@ -29,12 +29,12 @@ class ctrlMultiSelectGroup : public ctrlGroup // Gibt einen Button aus der Gruppe zurück zum direkten Bearbeiten ctrlButton* GetButton(unsigned id) { return GetCtrl(id); } - void Msg_ButtonClick(unsigned ctrl_id) override; - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_LeftUp(const MouseCoords& mc) override; - bool Msg_WheelUp(const MouseCoords& mc) override; - bool Msg_WheelDown(const MouseCoords& mc) override; - bool Msg_MouseMove(const MouseCoords& mc) override; + void msgButtonClick(unsigned ctrl_id) override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgLeftUp(const MouseCoords& mc) override; + bool msgWheelUp(const MouseCoords& mc) override; + bool msgWheelDown(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; private: std::set selectedItems_; /// aktuell ausgewählte Buttons diff --git a/libs/s25main/controls/ctrlMultiline.cpp b/libs/s25main/controls/ctrlMultiline.cpp index dac9ce9c4f..2e51f7b1a2 100644 --- a/libs/s25main/controls/ctrlMultiline.cpp +++ b/libs/s25main/controls/ctrlMultiline.cpp @@ -135,16 +135,16 @@ void ctrlMultiline::SetScrollBarAllowed(bool allowed) } } -bool ctrlMultiline::Msg_LeftDown(const MouseCoords& mc) +bool ctrlMultiline::msgLeftDown(const MouseCoords& mc) { - return GetCtrl(0)->Msg_LeftDown(mc); + return GetCtrl(0)->msgLeftDown(mc); } -bool ctrlMultiline::Msg_LeftUp(const MouseCoords& mc) +bool ctrlMultiline::msgLeftUp(const MouseCoords& mc) { - return GetCtrl(0)->Msg_LeftUp(mc); + return GetCtrl(0)->msgLeftUp(mc); } -bool ctrlMultiline::Msg_WheelUp(const MouseCoords& mc) +bool ctrlMultiline::msgWheelUp(const MouseCoords& mc) { const Extent padding(PADDING, PADDING); if(IsPointInRect(mc.pos, Rect(GetDrawPos() + DrawPoint(padding), GetSize() - padding * 2u))) @@ -156,7 +156,7 @@ bool ctrlMultiline::Msg_WheelUp(const MouseCoords& mc) return false; } -bool ctrlMultiline::Msg_WheelDown(const MouseCoords& mc) +bool ctrlMultiline::msgWheelDown(const MouseCoords& mc) { const Extent padding(PADDING, PADDING); if(IsPointInRect(mc.pos, Rect(GetDrawPos() + DrawPoint(padding), GetSize() - padding * 2u))) @@ -168,9 +168,9 @@ bool ctrlMultiline::Msg_WheelDown(const MouseCoords& mc) return false; } -bool ctrlMultiline::Msg_MouseMove(const MouseCoords& mc) +bool ctrlMultiline::msgMouseMove(const MouseCoords& mc) { - return GetCtrl(0)->Msg_MouseMove(mc); + return GetCtrl(0)->msgMouseMove(mc); } void ctrlMultiline::Resize(const Extent& newSize) diff --git a/libs/s25main/controls/ctrlMultiline.h b/libs/s25main/controls/ctrlMultiline.h index 67650945a0..8840efed0d 100644 --- a/libs/s25main/controls/ctrlMultiline.h +++ b/libs/s25main/controls/ctrlMultiline.h @@ -43,11 +43,11 @@ class ctrlMultiline : public Window /// lines won't be shown void SetScrollBarAllowed(bool allowed); - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_LeftUp(const MouseCoords& mc) override; - bool Msg_WheelUp(const MouseCoords& mc) override; - bool Msg_WheelDown(const MouseCoords& mc) override; - bool Msg_MouseMove(const MouseCoords& mc) override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgLeftUp(const MouseCoords& mc) override; + bool msgWheelUp(const MouseCoords& mc) override; + bool msgWheelDown(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; protected: void Draw_() override; diff --git a/libs/s25main/controls/ctrlOptionGroup.cpp b/libs/s25main/controls/ctrlOptionGroup.cpp index b2d832e968..5739e0b687 100644 --- a/libs/s25main/controls/ctrlOptionGroup.cpp +++ b/libs/s25main/controls/ctrlOptionGroup.cpp @@ -39,7 +39,7 @@ void ctrlOptionGroup::SetSelection(unsigned selection, bool notify) this->selection_ = selection; if(notify && GetParent()) - GetParent()->Msg_OptionGroupChange(GetID(), selection); + GetParent()->msgOptionGroupChange(GetID(), selection); } unsigned ctrlOptionGroup::GetSelection() const @@ -49,32 +49,32 @@ unsigned ctrlOptionGroup::GetSelection() const return *selection_; } -void ctrlOptionGroup::Msg_ButtonClick(const unsigned ctrl_id) +void ctrlOptionGroup::msgButtonClick(const unsigned ctrl_id) { SetSelection(ctrl_id, true); } -bool ctrlOptionGroup::Msg_LeftDown(const MouseCoords& mc) +bool ctrlOptionGroup::msgLeftDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_LeftDown, mc); + return RelayMouseMessage(&Window::msgLeftDown, mc); } -bool ctrlOptionGroup::Msg_LeftUp(const MouseCoords& mc) +bool ctrlOptionGroup::msgLeftUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_LeftUp, mc); + return RelayMouseMessage(&Window::msgLeftUp, mc); } -bool ctrlOptionGroup::Msg_WheelUp(const MouseCoords& mc) +bool ctrlOptionGroup::msgWheelUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_WheelUp, mc); + return RelayMouseMessage(&Window::msgWheelUp, mc); } -bool ctrlOptionGroup::Msg_WheelDown(const MouseCoords& mc) +bool ctrlOptionGroup::msgWheelDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_WheelDown, mc); + return RelayMouseMessage(&Window::msgWheelDown, mc); } -bool ctrlOptionGroup::Msg_MouseMove(const MouseCoords& mc) +bool ctrlOptionGroup::msgMouseMove(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_MouseMove, mc); + return RelayMouseMessage(&Window::msgMouseMove, mc); } diff --git a/libs/s25main/controls/ctrlOptionGroup.h b/libs/s25main/controls/ctrlOptionGroup.h index f463eaed8a..7cedbe0929 100644 --- a/libs/s25main/controls/ctrlOptionGroup.h +++ b/libs/s25main/controls/ctrlOptionGroup.h @@ -23,12 +23,12 @@ class ctrlOptionGroup : public ctrlGroup // Gibt einen Button aus der Gruppe zurück zum direkten Bearbeiten ctrlButton* GetButton(unsigned id) { return GetCtrl(id); } - void Msg_ButtonClick(unsigned ctrl_id) override; - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_LeftUp(const MouseCoords& mc) override; - bool Msg_WheelUp(const MouseCoords& mc) override; - bool Msg_WheelDown(const MouseCoords& mc) override; - bool Msg_MouseMove(const MouseCoords& mc) override; + void msgButtonClick(unsigned ctrl_id) override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgLeftUp(const MouseCoords& mc) override; + bool msgWheelUp(const MouseCoords& mc) override; + bool msgWheelDown(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; private: std::optional diff --git a/libs/s25main/controls/ctrlProgress.cpp b/libs/s25main/controls/ctrlProgress.cpp index f26afcf8ba..0b106db6b5 100644 --- a/libs/s25main/controls/ctrlProgress.cpp +++ b/libs/s25main/controls/ctrlProgress.cpp @@ -110,7 +110,7 @@ unsigned ctrlProgress::CalcBarWidth() const return GetSize().x - 2 * (padding_.x + GetSize().y); } -void ctrlProgress::Msg_ButtonClick(const unsigned ctrl_id) +void ctrlProgress::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -119,7 +119,7 @@ void ctrlProgress::Msg_ButtonClick(const unsigned ctrl_id) if(position) --position; if(GetParent()) - GetParent()->Msg_ProgressChange(GetID(), position); + GetParent()->msgProgressChange(GetID(), position); } break; case 1: // Plus @@ -127,13 +127,13 @@ void ctrlProgress::Msg_ButtonClick(const unsigned ctrl_id) if(position < maximum) ++position; if(GetParent()) - GetParent()->Msg_ProgressChange(GetID(), position); + GetParent()->msgProgressChange(GetID(), position); } break; } } -bool ctrlProgress::Msg_LeftDown(const MouseCoords& mc) +bool ctrlProgress::msgLeftDown(const MouseCoords& mc) { // Test if clicked on progress bar DrawPoint progressOrigin = GetDrawPos() + DrawPoint(padding_) + DrawPoint(GetSize().y + 2, 4); @@ -144,43 +144,43 @@ bool ctrlProgress::Msg_LeftDown(const MouseCoords& mc) helpers::iround(static_cast((mc.pos.x - progressOrigin.x) * maximum) / progressSize.x); if(GetParent()) - GetParent()->Msg_ProgressChange(GetID(), position); + GetParent()->msgProgressChange(GetID(), position); return true; } else - return RelayMouseMessage(&Window::Msg_LeftDown, mc); + return RelayMouseMessage(&Window::msgLeftDown, mc); } -bool ctrlProgress::Msg_LeftUp(const MouseCoords& mc) +bool ctrlProgress::msgLeftUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_LeftUp, mc); + return RelayMouseMessage(&Window::msgLeftUp, mc); } -bool ctrlProgress::Msg_WheelUp(const MouseCoords& mc) +bool ctrlProgress::msgWheelUp(const MouseCoords& mc) { // If mouse is over the controls, simulate button click if(IsPointInRect(mc.pos, GetDrawRect())) { - Msg_ButtonClick(1); + msgButtonClick(1); return true; } return false; } -bool ctrlProgress::Msg_WheelDown(const MouseCoords& mc) +bool ctrlProgress::msgWheelDown(const MouseCoords& mc) { // If mouse is over the controls, simulate button click if(IsPointInRect(mc.pos, GetDrawRect())) { - Msg_ButtonClick(0); + msgButtonClick(0); return true; } return false; } -bool ctrlProgress::Msg_MouseMove(const MouseCoords& mc) +bool ctrlProgress::msgMouseMove(const MouseCoords& mc) { // an Buttons weiterleiten - RelayMouseMessage(&Window::Msg_MouseMove, mc); + RelayMouseMessage(&Window::msgMouseMove, mc); Extent offset(GetSize().y + padding_.x, 0); DrawPoint rectOrig = GetDrawPos() + DrawPoint(offset); diff --git a/libs/s25main/controls/ctrlProgress.h b/libs/s25main/controls/ctrlProgress.h index ba673d1912..1d8bbda275 100644 --- a/libs/s25main/controls/ctrlProgress.h +++ b/libs/s25main/controls/ctrlProgress.h @@ -20,12 +20,12 @@ class ctrlProgress : public Window, public ctrlBaseTooltip void SetPosition(unsigned short position); const unsigned short& GetPosition() const { return position; } - void Msg_ButtonClick(unsigned ctrl_id) override; - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_LeftUp(const MouseCoords& mc) override; - bool Msg_WheelUp(const MouseCoords& mc) override; - bool Msg_WheelDown(const MouseCoords& mc) override; - bool Msg_MouseMove(const MouseCoords& mc) override; + void msgButtonClick(unsigned ctrl_id) override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgLeftUp(const MouseCoords& mc) override; + bool msgWheelUp(const MouseCoords& mc) override; + bool msgWheelDown(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; protected: void Draw_() override; diff --git a/libs/s25main/controls/ctrlScrollBar.cpp b/libs/s25main/controls/ctrlScrollBar.cpp index 31103bca48..2d8523078c 100644 --- a/libs/s25main/controls/ctrlScrollBar.cpp +++ b/libs/s25main/controls/ctrlScrollBar.cpp @@ -37,19 +37,19 @@ void ctrlScrollBar::Scroll(int distance) { scroll_pos = static_cast(newScrollPos); UpdateSliderFromPos(); - GetParent()->Msg_ScrollChange(GetID(), scroll_pos); + GetParent()->msgScrollChange(GetID(), scroll_pos); } } -bool ctrlScrollBar::Msg_LeftUp(const MouseCoords& mc) +bool ctrlScrollBar::msgLeftUp(const MouseCoords& mc) { isMouseScrolling = false; // ButtonMessages weiterleiten - return RelayMouseMessage(&Window::Msg_LeftUp, mc); + return RelayMouseMessage(&Window::msgLeftUp, mc); } -bool ctrlScrollBar::Msg_LeftDown(const MouseCoords& mc) +bool ctrlScrollBar::msgLeftDown(const MouseCoords& mc) { if(IsPointInRect(mc.pos, Rect(GetDrawPos().x, GetDrawPos().y + button_height + sliderPos, GetSize().x, sliderHeight))) @@ -88,10 +88,10 @@ bool ctrlScrollBar::Msg_LeftDown(const MouseCoords& mc) } } - return RelayMouseMessage(&Window::Msg_LeftDown, mc); + return RelayMouseMessage(&Window::msgLeftDown, mc); } -bool ctrlScrollBar::Msg_MouseMove(const MouseCoords& mc) +bool ctrlScrollBar::msgMouseMove(const MouseCoords& mc) { if(isMouseScrolling) { @@ -105,10 +105,10 @@ bool ctrlScrollBar::Msg_MouseMove(const MouseCoords& mc) last_y = mc.pos.y; // ButtonMessages weiterleiten - return RelayMouseMessage(&Window::Msg_MouseMove, mc); + return RelayMouseMessage(&Window::msgMouseMove, mc); } -void ctrlScrollBar::Msg_ButtonClick(const unsigned ctrl_id) +void ctrlScrollBar::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -207,7 +207,7 @@ void ctrlScrollBar::UpdatePosFromSlider() { RTTR_Assert(newScrollPos + pagesize <= scroll_range); // Probably slider to small? scroll_pos = newScrollPos; - GetParent()->Msg_ScrollChange(GetID(), scroll_pos); + GetParent()->msgScrollChange(GetID(), scroll_pos); } } @@ -235,7 +235,7 @@ void ctrlScrollBar::RecalculateSizes() if(!IsVisible()) { SetVisible(true); - GetParent()->Msg_ScrollShow(GetID(), IsVisible()); + GetParent()->msgScrollShow(GetID(), IsVisible()); } } else { @@ -245,7 +245,7 @@ void ctrlScrollBar::RecalculateSizes() if(IsVisible()) { SetVisible(false); - GetParent()->Msg_ScrollShow(GetID(), IsVisible()); + GetParent()->msgScrollShow(GetID(), IsVisible()); } } } diff --git a/libs/s25main/controls/ctrlScrollBar.h b/libs/s25main/controls/ctrlScrollBar.h index a0104008e0..c97663ed2b 100644 --- a/libs/s25main/controls/ctrlScrollBar.h +++ b/libs/s25main/controls/ctrlScrollBar.h @@ -22,10 +22,10 @@ class ctrlScrollBar final : public Window /// Scrolls by the given distance (less than 0 = up, else down) void Scroll(int distance); - bool Msg_LeftUp(const MouseCoords& mc) override; - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_MouseMove(const MouseCoords& mc) override; - void Msg_ButtonClick(unsigned ctrl_id) override; + bool msgLeftUp(const MouseCoords& mc) override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; + void msgButtonClick(unsigned ctrl_id) override; protected: void Draw_() override; diff --git a/libs/s25main/controls/ctrlTab.cpp b/libs/s25main/controls/ctrlTab.cpp index 25b6bc9cd4..ed7f539b37 100644 --- a/libs/s25main/controls/ctrlTab.cpp +++ b/libs/s25main/controls/ctrlTab.cpp @@ -13,34 +13,34 @@ ctrlTab::ctrlTab(Window* parent, unsigned id, const DrawPoint& pos, unsigned sho : Window(parent, id, pos, Extent(width, 45)), tab_count(0), tab_selection(0) {} -void ctrlTab::Msg_ButtonClick(const unsigned ctrl_id) +void ctrlTab::msgButtonClick(const unsigned ctrl_id) { SetSelection(ctrl_id, true); } -bool ctrlTab::Msg_LeftDown(const MouseCoords& mc) +bool ctrlTab::msgLeftDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_LeftDown, mc); + return RelayMouseMessage(&Window::msgLeftDown, mc); } -bool ctrlTab::Msg_LeftUp(const MouseCoords& mc) +bool ctrlTab::msgLeftUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_LeftUp, mc); + return RelayMouseMessage(&Window::msgLeftUp, mc); } -bool ctrlTab::Msg_WheelUp(const MouseCoords& mc) +bool ctrlTab::msgWheelUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_WheelUp, mc); + return RelayMouseMessage(&Window::msgWheelUp, mc); } -bool ctrlTab::Msg_WheelDown(const MouseCoords& mc) +bool ctrlTab::msgWheelDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_WheelDown, mc); + return RelayMouseMessage(&Window::msgWheelDown, mc); } -bool ctrlTab::Msg_MouseMove(const MouseCoords& mc) +bool ctrlTab::msgMouseMove(const MouseCoords& mc) { - return RelayMouseMessage(&Window::Msg_MouseMove, mc); + return RelayMouseMessage(&Window::msgMouseMove, mc); } /** @@ -83,7 +83,7 @@ void ctrlTab::SetSelection(unsigned short nr, bool /*notify*/) return; /// Eltern informieren, dass Tab geändert wurde - GetParent()->Msg_TabChange(GetID(), tabs[nr]); + GetParent()->msgTabChange(GetID(), tabs[nr]); // Farbe des alten Buttons ändern ctrlButton* button; @@ -137,76 +137,75 @@ void ctrlTab::Draw_() button->Draw(); } -void ctrlTab::Msg_Group_ButtonClick(const unsigned /*group_id*/, const unsigned ctrl_id) +void ctrlTab::msgGroupButtonClick(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->Msg_Group_ButtonClick(this->GetID(), ctrl_id); + GetParent()->msgGroupButtonClick(this->GetID(), ctrl_id); } -void ctrlTab::Msg_Group_EditEnter(const unsigned /*group_id*/, const unsigned ctrl_id) +void ctrlTab::msgGroupEditEnter(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->Msg_Group_EditEnter(this->GetID(), ctrl_id); + GetParent()->msgGroupEditEnter(this->GetID(), ctrl_id); } -void ctrlTab::Msg_Group_EditChange(const unsigned /*group_id*/, const unsigned ctrl_id) +void ctrlTab::msgGroupEditChange(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->Msg_Group_EditChange(this->GetID(), ctrl_id); + GetParent()->msgGroupEditChange(this->GetID(), ctrl_id); } -void ctrlTab::Msg_Group_TabChange(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned short tab_id) +void ctrlTab::msgGroupTabChange(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned short tab_id) { - GetParent()->Msg_Group_TabChange(this->GetID(), ctrl_id, tab_id); + GetParent()->msgGroupTabChange(this->GetID(), ctrl_id, tab_id); } -void ctrlTab::Msg_Group_ListSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, const int selection) +void ctrlTab::msgGroupListSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, const int selection) { - GetParent()->Msg_Group_ListSelectItem(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupListSelectItem(this->GetID(), ctrl_id, selection); } -void ctrlTab::Msg_Group_ComboSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned selection) +void ctrlTab::msgGroupComboSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned selection) { - GetParent()->Msg_Group_ComboSelectItem(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupComboSelectItem(this->GetID(), ctrl_id, selection); } -void ctrlTab::Msg_Group_CheckboxChange(const unsigned /*group_id*/, const unsigned ctrl_id, const bool checked) +void ctrlTab::msgGroupCheckboxChange(const unsigned /*group_id*/, const unsigned ctrl_id, const bool checked) { - GetParent()->Msg_Group_CheckboxChange(this->GetID(), ctrl_id, checked); + GetParent()->msgGroupCheckboxChange(this->GetID(), ctrl_id, checked); } -void ctrlTab::Msg_Group_ProgressChange(const unsigned /*group_id*/, const unsigned ctrl_id, - const unsigned short position) +void ctrlTab::msgGroupProgressChange(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned short position) { - GetParent()->Msg_Group_ProgressChange(this->GetID(), ctrl_id, position); + GetParent()->msgGroupProgressChange(this->GetID(), ctrl_id, position); } -void ctrlTab::Msg_Group_ScrollShow(const unsigned /*group_id*/, const unsigned ctrl_id, const bool visible) +void ctrlTab::msgGroupScrollShow(const unsigned /*group_id*/, const unsigned ctrl_id, const bool visible) { - GetParent()->Msg_Group_ScrollShow(this->GetID(), ctrl_id, visible); + GetParent()->msgGroupScrollShow(this->GetID(), ctrl_id, visible); } -void ctrlTab::Msg_Group_OptionGroupChange(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned selection) +void ctrlTab::msgGroupOptionGroupChange(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned selection) { - GetParent()->Msg_Group_OptionGroupChange(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupOptionGroupChange(this->GetID(), ctrl_id, selection); } -void ctrlTab::Msg_Group_Timer(const unsigned /*group_id*/, const unsigned ctrl_id) +void ctrlTab::msgGroupTimer(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->Msg_Group_Timer(this->GetID(), ctrl_id); + GetParent()->msgGroupTimer(this->GetID(), ctrl_id); } -void ctrlTab::Msg_Group_TableSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, - const std::optional& selection) +void ctrlTab::msgGroupTableSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, + const std::optional& selection) { - GetParent()->Msg_Group_TableSelectItem(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupTableSelectItem(this->GetID(), ctrl_id, selection); } -void ctrlTab::Msg_Group_TableRightButton(const unsigned /*group_id*/, const unsigned ctrl_id, - const std::optional& selection) +void ctrlTab::msgGroupTableRightButton(const unsigned /*group_id*/, const unsigned ctrl_id, + const std::optional& selection) { - GetParent()->Msg_Group_TableRightButton(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupTableRightButton(this->GetID(), ctrl_id, selection); } -void ctrlTab::Msg_Group_TableLeftButton(const unsigned /*group_id*/, const unsigned ctrl_id, - const std::optional& selection) +void ctrlTab::msgGroupTableLeftButton(const unsigned /*group_id*/, const unsigned ctrl_id, + const std::optional& selection) { - GetParent()->Msg_Group_TableLeftButton(this->GetID(), ctrl_id, selection); + GetParent()->msgGroupTableLeftButton(this->GetID(), ctrl_id, selection); } diff --git a/libs/s25main/controls/ctrlTab.h b/libs/s25main/controls/ctrlTab.h index 8ad71bd088..762a65fdd8 100644 --- a/libs/s25main/controls/ctrlTab.h +++ b/libs/s25main/controls/ctrlTab.h @@ -29,29 +29,29 @@ class ctrlTab : public Window /// Gibt aktuell ausgewählte Tab-Gruppe zürck ctrlGroup* GetCurrentGroup() { return GetGroup(GetCurrentTab()); } - void Msg_Group_ButtonClick(unsigned group_id, unsigned ctrl_id) override; - void Msg_Group_EditEnter(unsigned group_id, unsigned ctrl_id) override; - void Msg_Group_EditChange(unsigned group_id, unsigned ctrl_id) override; - void Msg_Group_TabChange(unsigned group_id, unsigned ctrl_id, unsigned short tab_id) override; - void Msg_Group_ListSelectItem(unsigned group_id, unsigned ctrl_id, int selection) override; - void Msg_Group_ComboSelectItem(unsigned group_id, unsigned ctrl_id, unsigned selection) override; - void Msg_Group_CheckboxChange(unsigned group_id, unsigned ctrl_id, bool checked) override; - void Msg_Group_ProgressChange(unsigned group_id, unsigned ctrl_id, unsigned short position) override; - void Msg_Group_ScrollShow(unsigned group_id, unsigned ctrl_id, bool visible) override; - void Msg_Group_OptionGroupChange(unsigned group_id, unsigned ctrl_id, unsigned selection) override; - void Msg_Group_Timer(unsigned group_id, unsigned ctrl_id) override; - void Msg_Group_TableSelectItem(unsigned group_id, unsigned ctrl_id, - const std::optional& selection) override; - void Msg_Group_TableRightButton(unsigned group_id, unsigned ctrl_id, - const std::optional& selection) override; - void Msg_Group_TableLeftButton(unsigned group_id, unsigned ctrl_id, - const std::optional& selection) override; - void Msg_ButtonClick(unsigned ctrl_id) override; - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_LeftUp(const MouseCoords& mc) override; - bool Msg_WheelUp(const MouseCoords& mc) override; - bool Msg_WheelDown(const MouseCoords& mc) override; - bool Msg_MouseMove(const MouseCoords& mc) override; + void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; + void msgGroupEditEnter(unsigned group_id, unsigned ctrl_id) override; + void msgGroupEditChange(unsigned group_id, unsigned ctrl_id) override; + void msgGroupTabChange(unsigned group_id, unsigned ctrl_id, unsigned short tab_id) override; + void msgGroupListSelectItem(unsigned group_id, unsigned ctrl_id, int selection) override; + void msgGroupComboSelectItem(unsigned group_id, unsigned ctrl_id, unsigned selection) override; + void msgGroupCheckboxChange(unsigned group_id, unsigned ctrl_id, bool checked) override; + void msgGroupProgressChange(unsigned group_id, unsigned ctrl_id, unsigned short position) override; + void msgGroupScrollShow(unsigned group_id, unsigned ctrl_id, bool visible) override; + void msgGroupOptionGroupChange(unsigned group_id, unsigned ctrl_id, unsigned selection) override; + void msgGroupTimer(unsigned group_id, unsigned ctrl_id) override; + void msgGroupTableSelectItem(unsigned group_id, unsigned ctrl_id, + const std::optional& selection) override; + void msgGroupTableRightButton(unsigned group_id, unsigned ctrl_id, + const std::optional& selection) override; + void msgGroupTableLeftButton(unsigned group_id, unsigned ctrl_id, + const std::optional& selection) override; + void msgButtonClick(unsigned ctrl_id) override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgLeftUp(const MouseCoords& mc) override; + bool msgWheelUp(const MouseCoords& mc) override; + bool msgWheelDown(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; protected: void Draw_() override; diff --git a/libs/s25main/controls/ctrlTable.cpp b/libs/s25main/controls/ctrlTable.cpp index 885baf4e89..e2f2865d82 100644 --- a/libs/s25main/controls/ctrlTable.cpp +++ b/libs/s25main/controls/ctrlTable.cpp @@ -178,7 +178,7 @@ void ctrlTable::Resize(const Extent& newSize) ResetButtonWidths(); if(scrollbar->IsVisible()) - Msg_ScrollShow(0, true); + msgScrollShow(0, true); } /** @@ -218,7 +218,7 @@ void ctrlTable::SetSelection(const std::optional& selection) } if(GetParent()) - GetParent()->Msg_TableSelectItem(GetID(), selection_); + GetParent()->msgTableSelectItem(GetID(), selection_); } void ctrlTable::AddRow(std::vector row) @@ -340,7 +340,7 @@ void ctrlTable::Draw_() } } -void ctrlTable::Msg_ButtonClick(const unsigned ctrl_id) +void ctrlTable::msgButtonClick(const unsigned ctrl_id) { RTTR_Assert(ctrl_id > 0); const int column = ctrl_id - 1; @@ -365,30 +365,30 @@ Rect ctrlTable::GetFullDrawArea() const return Rect(orig, size); } -bool ctrlTable::Msg_LeftDown(const MouseCoords& mc) +bool ctrlTable::msgLeftDown(const MouseCoords& mc) { if(IsPointInRect(mc.pos, GetContentDrawArea())) { SetSelection(GetSelectionFromMouse(mc)); if(GetParent()) - GetParent()->Msg_TableLeftButton(this->GetID(), selection_); + GetParent()->msgTableLeftButton(this->GetID(), selection_); return true; } else - return RelayMouseMessage(&Window::Msg_LeftDown, mc); + return RelayMouseMessage(&Window::msgLeftDown, mc); } -bool ctrlTable::Msg_RightDown(const MouseCoords& mc) +bool ctrlTable::msgRightDown(const MouseCoords& mc) { if(IsPointInRect(mc.pos, GetContentDrawArea())) { SetSelection(GetSelectionFromMouse(mc)); if(GetParent()) - GetParent()->Msg_TableRightButton(this->GetID(), selection_); + GetParent()->msgTableRightButton(this->GetID(), selection_); return true; } else - return RelayMouseMessage(&Window::Msg_RightDown, mc); + return RelayMouseMessage(&Window::msgRightDown, mc); } std::optional ctrlTable::GetSelectionFromMouse(const MouseCoords& mc) const @@ -402,7 +402,7 @@ std::optional ctrlTable::GetSelectionFromMouse(const MouseCoords& mc) return itemIdx; } -bool ctrlTable::Msg_WheelUp(const MouseCoords& mc) +bool ctrlTable::msgWheelUp(const MouseCoords& mc) { // If mouse in list or scrollbar if(IsPointInRect(mc.pos, GetFullDrawArea())) @@ -414,7 +414,7 @@ bool ctrlTable::Msg_WheelUp(const MouseCoords& mc) return false; } -bool ctrlTable::Msg_WheelDown(const MouseCoords& mc) +bool ctrlTable::msgWheelDown(const MouseCoords& mc) { if(IsPointInRect(mc.pos, GetFullDrawArea())) { @@ -425,7 +425,7 @@ bool ctrlTable::Msg_WheelDown(const MouseCoords& mc) return false; } -bool ctrlTable::Msg_LeftUp(const MouseCoords& mc) +bool ctrlTable::msgLeftUp(const MouseCoords& mc) { if(IsPointInRect(mc.pos, GetContentDrawArea())) { @@ -435,21 +435,21 @@ bool ctrlTable::Msg_LeftUp(const MouseCoords& mc) SetSelection(GetSelectionFromMouse(mc)); if(selection_ && oldSelection == selection_) { - GetParent()->Msg_TableChooseItem(this->GetID(), *selection_); + GetParent()->msgTableChooseItem(this->GetID(), *selection_); return true; } } } - return RelayMouseMessage(&Window::Msg_LeftUp, mc); + return RelayMouseMessage(&Window::msgLeftUp, mc); } -bool ctrlTable::Msg_MouseMove(const MouseCoords& mc) +bool ctrlTable::msgMouseMove(const MouseCoords& mc) { // ButtonMessages weiterleiten - return RelayMouseMessage(&Window::Msg_MouseMove, mc); + return RelayMouseMessage(&Window::msgMouseMove, mc); } -void ctrlTable::Msg_ScrollShow(const unsigned /*ctrl_id*/, const bool /*visible*/) +void ctrlTable::msgScrollShow(const unsigned /*ctrl_id*/, const bool /*visible*/) { ResetButtonWidths(); } @@ -483,7 +483,7 @@ void ctrlTable::ResetButtonWidths() } } -bool ctrlTable::Msg_KeyDown(const KeyEvent& ke) +bool ctrlTable::msgKeyDown(const KeyEvent& ke) { switch(ke.kt) { diff --git a/libs/s25main/controls/ctrlTable.h b/libs/s25main/controls/ctrlTable.h index 81d2d49319..0b0b0ea6bb 100644 --- a/libs/s25main/controls/ctrlTable.h +++ b/libs/s25main/controls/ctrlTable.h @@ -63,15 +63,15 @@ class ctrlTable : public Window const std::optional& GetSelection() const { return selection_; } void SetSelection(const std::optional& selection); - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_RightDown(const MouseCoords& mc) override; - bool Msg_LeftUp(const MouseCoords& mc) override; - bool Msg_WheelUp(const MouseCoords& mc) override; - bool Msg_WheelDown(const MouseCoords& mc) override; - bool Msg_MouseMove(const MouseCoords& mc) override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_ScrollShow(unsigned ctrl_id, bool visible) override; - bool Msg_KeyDown(const KeyEvent& ke) override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgRightDown(const MouseCoords& mc) override; + bool msgLeftUp(const MouseCoords& mc) override; + bool msgWheelUp(const MouseCoords& mc) override; + bool msgWheelDown(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgScrollShow(unsigned ctrl_id, bool visible) override; + bool msgKeyDown(const KeyEvent& ke) override; protected: void Draw_() override; diff --git a/libs/s25main/controls/ctrlTimer.cpp b/libs/s25main/controls/ctrlTimer.cpp index 840c8f9c4b..8214323d5d 100644 --- a/libs/s25main/controls/ctrlTimer.cpp +++ b/libs/s25main/controls/ctrlTimer.cpp @@ -32,9 +32,9 @@ void ctrlTimer::Stop() timer_.stop(); } -void ctrlTimer::Msg_PaintBefore() +void ctrlTimer::msgPaintBefore() { - Window::Msg_PaintBefore(); + Window::msgPaintBefore(); if(!timer_.isRunning()) return; @@ -42,6 +42,6 @@ void ctrlTimer::Msg_PaintBefore() if(timer_.getElapsed() >= timeout_) { timer_.restart(); // Do this first so parent can stop or change duration - GetParent()->Msg_Timer(GetID()); + GetParent()->msgTimer(GetID()); } } diff --git a/libs/s25main/controls/ctrlTimer.h b/libs/s25main/controls/ctrlTimer.h index b8399ff0ca..b041766391 100644 --- a/libs/s25main/controls/ctrlTimer.h +++ b/libs/s25main/controls/ctrlTimer.h @@ -18,7 +18,7 @@ class ctrlTimer : public Window bool isRunning() const { return timer_.isRunning(); } Timer::duration getElapsed() const { return timer_.getElapsed(); } - void Msg_PaintBefore() override; + void msgPaintBefore() override; protected: void Draw_() override{}; diff --git a/libs/s25main/desktops/Desktop.cpp b/libs/s25main/desktops/Desktop.cpp index 09aa6b270c..f9aa08c4c6 100644 --- a/libs/s25main/desktops/Desktop.cpp +++ b/libs/s25main/desktops/Desktop.cpp @@ -45,9 +45,9 @@ void Desktop::Draw_() Window::Draw_(); } -void Desktop::Msg_ScreenResize(const ScreenResizeEvent& sr) +void Desktop::msgScreenResize(const ScreenResizeEvent& sr) { - Window::Msg_ScreenResize(sr); + Window::msgScreenResize(sr); // Resize to new screen size Resize(sr.newSize); auto* fpsDisplay = GetCtrl(fpsDisplayId); diff --git a/libs/s25main/desktops/Desktop.h b/libs/s25main/desktops/Desktop.h index dfb56f138b..8a1f17b2f5 100644 --- a/libs/s25main/desktops/Desktop.h +++ b/libs/s25main/desktops/Desktop.h @@ -16,9 +16,9 @@ class Desktop : public Window public: Desktop(glArchivItem_Bitmap* background); ~Desktop(); - void Msg_ScreenResize(const ScreenResizeEvent& sr) override; + void msgScreenResize(const ScreenResizeEvent& sr) override; /// Callback when a window was closed - virtual void Msg_WindowClosed(IngameWindow&){}; + virtual void msgWindowClosed(IngameWindow&){}; /// Show or hide the fps void SetFpsDisplay(bool show); diff --git a/libs/s25main/desktops/dskBenchmark.cpp b/libs/s25main/desktops/dskBenchmark.cpp index 7301ab1314..d0b6a3333c 100644 --- a/libs/s25main/desktops/dskBenchmark.cpp +++ b/libs/s25main/desktops/dskBenchmark.cpp @@ -76,7 +76,7 @@ dskBenchmark::~dskBenchmark() {} } -bool dskBenchmark::Msg_KeyDown(const KeyEvent& ke) +bool dskBenchmark::msgKeyDown(const KeyEvent& ke) { switch(ke.kt) { @@ -99,13 +99,13 @@ bool dskBenchmark::Msg_KeyDown(const KeyEvent& ke) GetCtrl(ID_txtAmount)->SetText("Instances: " + helpers::toString(numInstances_)); break; } else - return dskMenuBase::Msg_KeyDown(ke); - default: return dskMenuBase::Msg_KeyDown(ke); + return dskMenuBase::msgKeyDown(ke); + default: return dskMenuBase::msgKeyDown(ke); } return true; } -void dskBenchmark::Msg_PaintAfter() +void dskBenchmark::msgPaintAfter() { for(const ColoredRect& rect : rects_) DrawRectangle(rect.rect, rect.clr); @@ -125,7 +125,7 @@ void dskBenchmark::Msg_PaintAfter() if(frameCtr_.getCurNumFrames() >= numTestFrames) finishTest(); } - dskMenuBase::Msg_PaintAfter(); + dskMenuBase::msgPaintAfter(); } void dskBenchmark::SetActive(bool activate) diff --git a/libs/s25main/desktops/dskBenchmark.h b/libs/s25main/desktops/dskBenchmark.h index 6f19893a12..61fd506cad 100644 --- a/libs/s25main/desktops/dskBenchmark.h +++ b/libs/s25main/desktops/dskBenchmark.h @@ -47,8 +47,8 @@ class dskBenchmark : public dskMenuBase dskBenchmark(); ~dskBenchmark(); - bool Msg_KeyDown(const KeyEvent& ke) override; - void Msg_PaintAfter() override; + bool msgKeyDown(const KeyEvent& ke) override; + void msgPaintAfter() override; void SetActive(bool activate) override; private: diff --git a/libs/s25main/desktops/dskCampaignMissionSelection.cpp b/libs/s25main/desktops/dskCampaignMissionSelection.cpp index 3d14bc2a6d..52a543148c 100644 --- a/libs/s25main/desktops/dskCampaignMissionSelection.cpp +++ b/libs/s25main/desktops/dskCampaignMissionSelection.cpp @@ -180,14 +180,14 @@ void dskCampaignMissionSelection::UpdateStateOfNavigationButtons() GetCtrl(ID_btLastPage)->SetEnabled(currentPage_ < lastPage_); } -void dskCampaignMissionSelection::Msg_Group_ButtonClick(unsigned group_id, unsigned ctrl_id) +void dskCampaignMissionSelection::msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) { const auto page = group_id - ID_FirstPageGrp; RTTR_Assert(page == currentPage_); StartServer(page * missionsPerPage_ + ctrl_id); } -void dskCampaignMissionSelection::Msg_ButtonClick(unsigned ctrl_id) +void dskCampaignMissionSelection::msgButtonClick(unsigned ctrl_id) { if(ctrl_id == ID_btBack) WINDOWMANAGER.Switch(std::make_unique(csi_)); diff --git a/libs/s25main/desktops/dskCampaignMissionSelection.h b/libs/s25main/desktops/dskCampaignMissionSelection.h index 5ce2dfe168..8c41020a6f 100644 --- a/libs/s25main/desktops/dskCampaignMissionSelection.h +++ b/libs/s25main/desktops/dskCampaignMissionSelection.h @@ -17,8 +17,8 @@ class dskCampaignMissionSelection : public Desktop private: void UpdateMissionPage(); - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_Group_ButtonClick(unsigned group_id, unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; void StartServer(unsigned missionIdx); void UpdateStateOfNavigationButtons(); CreateServerInfo csi_; diff --git a/libs/s25main/desktops/dskCampaignSelection.cpp b/libs/s25main/desktops/dskCampaignSelection.cpp index 3d88077caa..d87d1465ab 100644 --- a/libs/s25main/desktops/dskCampaignSelection.cpp +++ b/libs/s25main/desktops/dskCampaignSelection.cpp @@ -97,13 +97,13 @@ dskCampaignSelection::dskCampaignSelection(CreateServerInfo csi) dskCampaignSelection::~dskCampaignSelection() noexcept = default; -void dskCampaignSelection::Msg_TableChooseItem(const unsigned ctrl_id, const unsigned) +void dskCampaignSelection::msgTableChooseItem(const unsigned ctrl_id, const unsigned) { if(ctrl_id == ID_Table) showCampaignMissionSelectionScreen(); } -void dskCampaignSelection::Msg_TableSelectItem(const unsigned ctrl_id, const std::optional& selection) +void dskCampaignSelection::msgTableSelectItem(const unsigned ctrl_id, const std::optional& selection) { if(ctrl_id != ID_Table) return; @@ -157,7 +157,7 @@ void dskCampaignSelection::showCampaignMissionSelectionScreen() WINDOWMANAGER.Switch(std::make_unique(csi_, campaign)); } -void dskCampaignSelection::Msg_ButtonClick(unsigned ctrl_id) +void dskCampaignSelection::msgButtonClick(unsigned ctrl_id) { if(ctrl_id == ID_btBack) WINDOWMANAGER.Switch(std::make_unique()); @@ -165,7 +165,7 @@ void dskCampaignSelection::Msg_ButtonClick(unsigned ctrl_id) showCampaignMissionSelectionScreen(); } -void dskCampaignSelection::Msg_Timer(unsigned ctrl_id) +void dskCampaignSelection::msgTimer(unsigned ctrl_id) { GetCtrl(ctrl_id)->Stop(); loadCampaigns(); diff --git a/libs/s25main/desktops/dskCampaignSelection.h b/libs/s25main/desktops/dskCampaignSelection.h index 5c93d70ae1..276d2bac2d 100644 --- a/libs/s25main/desktops/dskCampaignSelection.h +++ b/libs/s25main/desktops/dskCampaignSelection.h @@ -23,10 +23,10 @@ class dskCampaignSelection : public Desktop private: class CampaignDataHolder; - void Msg_TableChooseItem(unsigned, unsigned) override; - void Msg_TableSelectItem(unsigned ctrl_id, const std::optional& selection) override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_Timer(unsigned ctrl_id) override; + void msgTableChooseItem(unsigned, unsigned) override; + void msgTableSelectItem(unsigned ctrl_id, const std::optional& selection) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgTimer(unsigned ctrl_id) override; void FillCampaignsTable(); void showCampaignInfo(bool show); void showCampaignMissionSelectionScreen(); diff --git a/libs/s25main/desktops/dskCredits.cpp b/libs/s25main/desktops/dskCredits.cpp index 0ab0153c9c..ab36b96c94 100644 --- a/libs/s25main/desktops/dskCredits.cpp +++ b/libs/s25main/desktops/dskCredits.cpp @@ -453,7 +453,7 @@ void dskCredits::DrawBobs() } } -void dskCredits::Msg_Timer(unsigned timerId) +void dskCredits::msgTimer(unsigned timerId) { if(timerId == ID_tmrBobAnim) { @@ -495,31 +495,31 @@ glArchivItem_Bitmap* dskCredits::GetCreditsImgOrDefault(const std::string& name) return result; } -bool dskCredits::Msg_KeyDown(const KeyEvent&) +bool dskCredits::msgKeyDown(const KeyEvent&) { GotoNextPage(); return true; } -bool dskCredits::Msg_LeftUp(const MouseCoords&) +bool dskCredits::msgLeftUp(const MouseCoords&) { GotoNextPage(); bobSpawnTimer.restart(); // Little easteregg return true; } -bool dskCredits::Msg_RightUp(const MouseCoords&) +bool dskCredits::msgRightUp(const MouseCoords&) { GotoPrevPage(); return true; } -void dskCredits::Msg_ButtonClick(const unsigned) +void dskCredits::msgButtonClick(const unsigned) { Close(); } -void dskCredits::Msg_MsgBoxResult(unsigned, MsgboxResult) +void dskCredits::msgMsgBoxResult(unsigned, MsgboxResult) { Close(); } diff --git a/libs/s25main/desktops/dskCredits.h b/libs/s25main/desktops/dskCredits.h index b24d902d26..f6bb423b25 100644 --- a/libs/s25main/desktops/dskCredits.h +++ b/libs/s25main/desktops/dskCredits.h @@ -21,13 +21,13 @@ class dskCredits : public Desktop dskCredits(); ~dskCredits() override; - bool Msg_LeftUp(const MouseCoords& mc) override; - bool Msg_RightUp(const MouseCoords& mc) override; - bool Msg_KeyDown(const KeyEvent& ke) override; - void Msg_Timer(unsigned timerId) override; + bool msgLeftUp(const MouseCoords& mc) override; + bool msgRightUp(const MouseCoords& mc) override; + bool msgKeyDown(const KeyEvent& ke) override; + void msgTimer(unsigned timerId) override; void Draw_() override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_MsgBoxResult(unsigned msgbox_id, MsgboxResult) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult) override; void SetActive(bool active) override; static bool Close(); diff --git a/libs/s25main/desktops/dskDirectIP.cpp b/libs/s25main/desktops/dskDirectIP.cpp index 9d0cff237a..d833e2ffd3 100644 --- a/libs/s25main/desktops/dskDirectIP.cpp +++ b/libs/s25main/desktops/dskDirectIP.cpp @@ -33,7 +33,7 @@ dskDirectIP::dskDirectIP() AddImage(ID_imgLogo, DrawPoint(20, 20), LOADER.GetImageN("logo", 0)); } -void dskDirectIP::Msg_ButtonClick(const unsigned ctrl_id) +void dskDirectIP::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/desktops/dskDirectIP.h b/libs/s25main/desktops/dskDirectIP.h index 791a1983cc..da76d7c29c 100644 --- a/libs/s25main/desktops/dskDirectIP.h +++ b/libs/s25main/desktops/dskDirectIP.h @@ -12,5 +12,5 @@ class dskDirectIP : public dskMenuBase dskDirectIP(); private: - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/desktops/dskGameInterface.cpp b/libs/s25main/desktops/dskGameInterface.cpp index 49d19bcdad..659168ddd1 100644 --- a/libs/s25main/desktops/dskGameInterface.cpp +++ b/libs/s25main/desktops/dskGameInterface.cpp @@ -335,7 +335,7 @@ void dskGameInterface::Resize(const Extent& newSize) gwv.Resize(newSize); } -void dskGameInterface::Msg_ButtonClick(const unsigned ctrl_id) +void dskGameInterface::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -352,9 +352,9 @@ void dskGameInterface::Msg_ButtonClick(const unsigned ctrl_id) } } -void dskGameInterface::Msg_PaintBefore() +void dskGameInterface::msgPaintBefore() { - Desktop::Msg_PaintBefore(); + Desktop::msgPaintBefore(); // Spiel ausführen Run(); @@ -383,9 +383,9 @@ void dskGameInterface::Msg_PaintBefore() DrawPoint((screenSize.x - imgButtonBar.getWidth()) / 2, screenSize.y - imgButtonBar.getHeight())); } -void dskGameInterface::Msg_PaintAfter() +void dskGameInterface::msgPaintAfter() { - Desktop::Msg_PaintAfter(); + Desktop::msgPaintAfter(); const GameWorldBase& world = worldViewer.GetWorld(); @@ -704,7 +704,7 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) return true; } -bool dskGameInterface::Msg_LeftDown(const MouseCoords& mc) +bool dskGameInterface::msgLeftDown(const MouseCoords& mc) { const glArchivItem_Bitmap& imgButtonBar = *LOADER.GetImageN("resource", 29); const auto btOrig = DrawPoint(VIDEODRIVER.GetRenderSize().x / 2 - imgButtonBar.getWidth() / 2, @@ -718,7 +718,7 @@ bool dskGameInterface::Msg_LeftDown(const MouseCoords& mc) // Start scrolling also on Ctrl + left click if(VIDEODRIVER.GetModKeyState().ctrl) { - Msg_RightDown(mc); + msgRightDown(mc); return true; } else if(isScrolling) StopScrolling(); @@ -733,7 +733,7 @@ bool dskGameInterface::Msg_LeftDown(const MouseCoords& mc) return true; } -bool dskGameInterface::Msg_LeftUp(const MouseCoords& mc) +bool dskGameInterface::msgLeftUp(const MouseCoords& mc) { if(isScrolling) { @@ -749,12 +749,12 @@ bool dskGameInterface::Msg_LeftUp(const MouseCoords& mc) return false; } -bool dskGameInterface::Msg_MouseMove(const MouseCoords& mc) +bool dskGameInterface::msgMouseMove(const MouseCoords& mc) { if(!isScrolling) { if(mc.num_tfingers == 1) - Msg_RightDown(mc); + msgRightDown(mc); else return false; } @@ -781,7 +781,7 @@ bool dskGameInterface::Msg_MouseMove(const MouseCoords& mc) return true; } -bool dskGameInterface::Msg_RightDown(const MouseCoords& mc) +bool dskGameInterface::msgRightDown(const MouseCoords& mc) { if(SETTINGS.interface.mapScrollMode == MapScrollMode::GrabAndDrag) StartScrolling(gwv.ViewPosToMap(mc.pos)); @@ -790,14 +790,14 @@ bool dskGameInterface::Msg_RightDown(const MouseCoords& mc) return true; } -bool dskGameInterface::Msg_RightUp(const MouseCoords& /*mc*/) //-V524 +bool dskGameInterface::msgRightUp(const MouseCoords& /*mc*/) //-V524 { if(isScrolling) StopScrolling(); return false; } -bool dskGameInterface::Msg_KeyDown(const KeyEvent& ke) +bool dskGameInterface::msgKeyDown(const KeyEvent& ke) { cheatCommandTracker_.onKeyEvent(ke); @@ -955,12 +955,12 @@ bool dskGameInterface::Msg_KeyDown(const KeyEvent& ke) return false; } -bool dskGameInterface::Msg_WheelUp(const MouseCoords&) +bool dskGameInterface::msgWheelUp(const MouseCoords&) { WheelZoom(ZOOM_WHEEL_INCREMENT); return true; } -bool dskGameInterface::Msg_WheelDown(const MouseCoords&) +bool dskGameInterface::msgWheelDown(const MouseCoords&) { WheelZoom(-ZOOM_WHEEL_INCREMENT); return true; @@ -1173,7 +1173,7 @@ void dskGameInterface::GI_BuildRoad() } } -void dskGameInterface::Msg_WindowClosed(IngameWindow& wnd) +void dskGameInterface::msgWindowClosed(IngameWindow& wnd) { if(actionwindow == &wnd) actionwindow = nullptr; diff --git a/libs/s25main/desktops/dskGameInterface.h b/libs/s25main/desktops/dskGameInterface.h index 483f6539fb..572e59739f 100644 --- a/libs/s25main/desktops/dskGameInterface.h +++ b/libs/s25main/desktops/dskGameInterface.h @@ -120,21 +120,21 @@ class dskGameInterface : /// Executed during left click. Checks click pos for buildings/roads bool ContextClick(const MouseCoords& mc); - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_PaintBefore() override; - void Msg_PaintAfter() override; - bool Msg_LeftDown(const MouseCoords& mc) override; - bool Msg_LeftUp(const MouseCoords& mc) override; - bool Msg_MouseMove(const MouseCoords& mc) override; - bool Msg_RightDown(const MouseCoords& mc) override; - bool Msg_RightUp(const MouseCoords& mc) override; - bool Msg_KeyDown(const KeyEvent& ke) override; - - bool Msg_WheelUp(const MouseCoords& mc) override; - bool Msg_WheelDown(const MouseCoords& mc) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgPaintBefore() override; + void msgPaintAfter() override; + bool msgLeftDown(const MouseCoords& mc) override; + bool msgLeftUp(const MouseCoords& mc) override; + bool msgMouseMove(const MouseCoords& mc) override; + bool msgRightDown(const MouseCoords& mc) override; + bool msgRightUp(const MouseCoords& mc) override; + bool msgKeyDown(const KeyEvent& ke) override; + + bool msgWheelUp(const MouseCoords& mc) override; + bool msgWheelDown(const MouseCoords& mc) override; void WheelZoom(float step); - void Msg_WindowClosed(IngameWindow& wnd) override; + void msgWindowClosed(IngameWindow& wnd) override; void OnBuildingNote(const BuildingNote& note); diff --git a/libs/s25main/desktops/dskGameLoader.cpp b/libs/s25main/desktops/dskGameLoader.cpp index 67122c90b3..297306b1fc 100644 --- a/libs/s25main/desktops/dskGameLoader.cpp +++ b/libs/s25main/desktops/dskGameLoader.cpp @@ -49,7 +49,7 @@ dskGameLoader::~dskGameLoader() GAMECLIENT.RemoveInterface(this); } -void dskGameLoader::Msg_MsgBoxResult(const unsigned msgbox_id, const MsgboxResult /*mbr*/) +void dskGameLoader::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult /*mbr*/) { if(msgbox_id == 0) // Verbindung zu Server verloren? { @@ -64,7 +64,7 @@ void dskGameLoader::Msg_MsgBoxResult(const unsigned msgbox_id, const MsgboxResul } } -void dskGameLoader::Msg_Timer(const unsigned /*ctrl_id*/) +void dskGameLoader::msgTimer(const unsigned /*ctrl_id*/) { auto* timer = GetCtrl(1); auto* text = GetCtrl(10 + position); diff --git a/libs/s25main/desktops/dskGameLoader.h b/libs/s25main/desktops/dskGameLoader.h index 0995c55d45..0a36d44a43 100644 --- a/libs/s25main/desktops/dskGameLoader.h +++ b/libs/s25main/desktops/dskGameLoader.h @@ -23,8 +23,8 @@ class dskGameLoader : public Desktop, public ClientInterface, public LobbyInterf void CI_Error(ClientError ce) override; private: - void Msg_MsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; - void Msg_Timer(unsigned ctrl_id) override; + void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; + void msgTimer(unsigned ctrl_id) override; void ShowErrorMsg(const std::string& error); unsigned position; diff --git a/libs/s25main/desktops/dskGameLobby.cpp b/libs/s25main/desktops/dskGameLobby.cpp index db672bb8cb..d2549cac90 100644 --- a/libs/s25main/desktops/dskGameLobby.cpp +++ b/libs/s25main/desktops/dskGameLobby.cpp @@ -543,15 +543,15 @@ void dskGameLobby::UpdatePlayerRow(const unsigned row) /** * Methode vor dem Zeichnen */ -void dskGameLobby::Msg_PaintBefore() +void dskGameLobby::msgPaintBefore() { - Desktop::Msg_PaintBefore(); + Desktop::msgPaintBefore(); // Chatfenster Fokus geben if(!IsSinglePlayer()) GetCtrl(ID_edtChatMsg)->SetFocus(); } -void dskGameLobby::Msg_Group_ButtonClick(const unsigned group_id, const unsigned ctrl_id) +void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned ctrl_id) { unsigned playerId = group_id - ID_grpPlayerStart; @@ -655,7 +655,7 @@ void dskGameLobby::Msg_Group_ButtonClick(const unsigned group_id, const unsigned } } -void dskGameLobby::Msg_Group_CheckboxChange(const unsigned group_id, const unsigned /*ctrl_id*/, const bool checked) +void dskGameLobby::msgGroupCheckboxChange(const unsigned group_id, const unsigned /*ctrl_id*/, const bool checked) { unsigned playerId = group_id - ID_grpPlayerStart; @@ -664,8 +664,8 @@ void dskGameLobby::Msg_Group_CheckboxChange(const unsigned group_id, const unsig SetPlayerReady(playerId, checked); } -void dskGameLobby::Msg_Group_ComboSelectItem(const unsigned group_id, const unsigned /*ctrl_id*/, - const unsigned selection) +void dskGameLobby::msgGroupComboSelectItem(const unsigned group_id, const unsigned /*ctrl_id*/, + const unsigned selection) { if(!gameLobby_->isHost()) return; @@ -705,7 +705,7 @@ bool dskGameLobby::IsChangeAllowed(const std::string& setting) const return !lua || lua->IsChangeAllowed(setting); } -void dskGameLobby::Msg_ButtonClick(const unsigned ctrl_id) +void dskGameLobby::msgButtonClick(const unsigned ctrl_id) { if(ctrl_id >= ID_btSwap && ctrl_id < ID_btSwap + MAX_PLAYERS) { @@ -769,7 +769,7 @@ void dskGameLobby::Msg_ButtonClick(const unsigned ctrl_id) } } -void dskGameLobby::Msg_EditEnter(const unsigned ctrl_id) +void dskGameLobby::msgEditEnter(const unsigned ctrl_id) { if(ctrl_id != ID_edtChatMsg) return; @@ -837,7 +837,7 @@ void dskGameLobby::FlashGameChat() } } -void dskGameLobby::Msg_MsgBoxResult(const unsigned msgbox_id, const MsgboxResult mbr) +void dskGameLobby::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult mbr) { switch(msgbox_id) { @@ -867,7 +867,7 @@ void dskGameLobby::Msg_MsgBoxResult(const unsigned msgbox_id, const MsgboxResult } else if(mbr == MsgboxResult::No) { forceOptions = true; - Msg_ButtonClick(ID_btStartGame); + msgButtonClick(ID_btStartGame); } } break; @@ -879,14 +879,14 @@ void dskGameLobby::Msg_MsgBoxResult(const unsigned msgbox_id, const MsgboxResult } else if(mbr == MsgboxResult::No) { forceOptions = true; - Msg_ButtonClick(ID_btStartGame); + msgButtonClick(ID_btStartGame); } } break; } } -void dskGameLobby::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned /*selection*/) +void dskGameLobby::msgComboSelectItem(const unsigned ctrl_id, const unsigned /*selection*/) { switch(ctrl_id) { @@ -904,7 +904,7 @@ void dskGameLobby::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned /* } } -void dskGameLobby::Msg_CheckboxChange(const unsigned ctrl_id, const bool /*checked*/) +void dskGameLobby::msgCheckboxChange(const unsigned ctrl_id, const bool /*checked*/) { switch(ctrl_id) { @@ -920,7 +920,7 @@ void dskGameLobby::Msg_CheckboxChange(const unsigned ctrl_id, const bool /*check } } -void dskGameLobby::Msg_OptionGroupChange(const unsigned ctrl_id, const unsigned selection) +void dskGameLobby::msgOptionGroupChange(const unsigned ctrl_id, const unsigned selection) { if(ctrl_id == ID_optChatTab) { diff --git a/libs/s25main/desktops/dskGameLobby.h b/libs/s25main/desktops/dskGameLobby.h index 8643c34e95..50c22fca97 100644 --- a/libs/s25main/desktops/dskGameLobby.h +++ b/libs/s25main/desktops/dskGameLobby.h @@ -45,16 +45,16 @@ class dskGameLobby final : public Desktop, public ClientInterface, public LobbyI void ChangePing(unsigned playerId); void ChangeColor(unsigned player, unsigned color); - void Msg_PaintBefore() override; - void Msg_Group_ButtonClick(unsigned group_id, unsigned ctrl_id) override; - void Msg_Group_CheckboxChange(unsigned group_id, unsigned ctrl_id, bool checked) override; - void Msg_Group_ComboSelectItem(unsigned group_id, unsigned ctrl_id, unsigned selection) override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_EditEnter(unsigned ctrl_id) override; - void Msg_MsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; - void Msg_ComboSelectItem(unsigned ctrl_id, unsigned selection) override; - void Msg_CheckboxChange(unsigned ctrl_id, bool checked) override; - void Msg_OptionGroupChange(unsigned ctrl_id, unsigned selection) override; + void msgPaintBefore() override; + void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; + void msgGroupCheckboxChange(unsigned group_id, unsigned ctrl_id, bool checked) override; + void msgGroupComboSelectItem(unsigned group_id, unsigned ctrl_id, unsigned selection) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgEditEnter(unsigned ctrl_id) override; + void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; + void msgComboSelectItem(unsigned ctrl_id, unsigned selection) override; + void msgCheckboxChange(unsigned ctrl_id, bool checked) override; + void msgOptionGroupChange(unsigned ctrl_id, unsigned selection) override; void CI_Error(ClientError ce) override; diff --git a/libs/s25main/desktops/dskIntro.cpp b/libs/s25main/desktops/dskIntro.cpp index 3407db8247..433af6ebd2 100644 --- a/libs/s25main/desktops/dskIntro.cpp +++ b/libs/s25main/desktops/dskIntro.cpp @@ -22,7 +22,7 @@ dskIntro::dskIntro() : Desktop(LOADER.GetImageN("menu", 0)) AddImage(11, DrawPoint(20, 20), LOADER.GetImageN("logo", 0)); } -void dskIntro::Msg_ButtonClick(const unsigned ctrl_id) +void dskIntro::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/desktops/dskIntro.h b/libs/s25main/desktops/dskIntro.h index 9fcb1e63fd..c47216208a 100644 --- a/libs/s25main/desktops/dskIntro.h +++ b/libs/s25main/desktops/dskIntro.h @@ -13,5 +13,5 @@ class dskIntro : public Desktop dskIntro(); private: - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/desktops/dskLAN.cpp b/libs/s25main/desktops/dskLAN.cpp index 8926076f63..5cc2423b68 100644 --- a/libs/s25main/desktops/dskLAN.cpp +++ b/libs/s25main/desktops/dskLAN.cpp @@ -55,7 +55,7 @@ dskLAN::dskLAN() : dskMenuBase(LOADER.GetImageN("setup013", 0)), discovery(LAN_D AddTimer(ID_tmrRefreshList, 2s); } -void dskLAN::Msg_Timer(const unsigned ctrl_id) +void dskLAN::msgTimer(const unsigned ctrl_id) { if(ctrl_id == ID_tmrRefreshServers) discovery.Refresh(); @@ -65,13 +65,13 @@ void dskLAN::Msg_Timer(const unsigned ctrl_id) RTTR_Assert(false); } -void dskLAN::Msg_PaintBefore() +void dskLAN::msgPaintBefore() { - dskMenuBase::Msg_PaintBefore(); + dskMenuBase::msgPaintBefore(); discovery.Run(); } -void dskLAN::Msg_ButtonClick(const unsigned ctrl_id) +void dskLAN::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -90,7 +90,7 @@ void dskLAN::Msg_ButtonClick(const unsigned ctrl_id) } } -void dskLAN::Msg_TableChooseItem(const unsigned ctrl_id, const unsigned /*selection*/) +void dskLAN::msgTableChooseItem(const unsigned ctrl_id, const unsigned /*selection*/) { if(ctrl_id == ID_tblServer) ConnectToSelectedGame(); diff --git a/libs/s25main/desktops/dskLAN.h b/libs/s25main/desktops/dskLAN.h index 1449f8755e..feabc1bf30 100644 --- a/libs/s25main/desktops/dskLAN.h +++ b/libs/s25main/desktops/dskLAN.h @@ -20,10 +20,10 @@ class dskLAN : public dskMenuBase dskLAN(); protected: - void Msg_Timer(unsigned ctrl_id) override; - void Msg_PaintBefore() override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_TableChooseItem(unsigned ctrl_id, unsigned selection) override; + void msgTimer(unsigned ctrl_id) override; + void msgPaintBefore() override; + void msgButtonClick(unsigned ctrl_id) override; + void msgTableChooseItem(unsigned ctrl_id, unsigned selection) override; /** * Connects to the currently selected game and returns true on success diff --git a/libs/s25main/desktops/dskLobby.cpp b/libs/s25main/desktops/dskLobby.cpp index 7a2b1fdb49..34f5ba9846 100644 --- a/libs/s25main/desktops/dskLobby.cpp +++ b/libs/s25main/desktops/dskLobby.cpp @@ -83,28 +83,28 @@ dskLobby::~dskLobby() LOBBYCLIENT.RemoveListener(this); } -void dskLobby::Msg_Timer(const unsigned /*ctrl_id*/) +void dskLobby::msgTimer(const unsigned /*ctrl_id*/) { if(LOBBYCLIENT.IsLoggedIn()) LOBBYCLIENT.SendServerListRequest(); } -void dskLobby::Msg_PaintBefore() +void dskLobby::msgPaintBefore() { - dskMenuBase::Msg_PaintBefore(); + dskMenuBase::msgPaintBefore(); UpdateServerList(); UpdatePlayerList(); GetCtrl(ID_edtChat)->SetFocus(); } -void dskLobby::Msg_MsgBoxResult(const unsigned msgbox_id, const MsgboxResult /*mbr*/) +void dskLobby::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult /*mbr*/) { // Verbindung verloren if(msgbox_id == 0) WINDOWMANAGER.Switch(std::make_unique()); } -void dskLobby::Msg_ButtonClick(const unsigned ctrl_id) +void dskLobby::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -131,7 +131,7 @@ void dskLobby::Msg_ButtonClick(const unsigned ctrl_id) } } -void dskLobby::Msg_EditEnter(const unsigned ctrl_id) +void dskLobby::msgEditEnter(const unsigned ctrl_id) { if(ctrl_id == ID_edtChat) { @@ -141,7 +141,7 @@ void dskLobby::Msg_EditEnter(const unsigned ctrl_id) } } -void dskLobby::Msg_TableRightButton(const unsigned ctrl_id, const std::optional& selection) +void dskLobby::msgTableRightButton(const unsigned ctrl_id, const std::optional& selection) { if(!selection) return; @@ -166,7 +166,7 @@ void dskLobby::Msg_TableRightButton(const unsigned ctrl_id, const std::optional< } } -void dskLobby::Msg_TableChooseItem(const unsigned ctrl_id, const unsigned /*selection*/) +void dskLobby::msgTableChooseItem(const unsigned ctrl_id, const unsigned /*selection*/) { if(ctrl_id == ID_tblGames) // Server list ConnectToSelectedGame(); @@ -186,7 +186,7 @@ void dskLobby::UpdateServerList() LC_ServerList(LOBBYCLIENT.GetServerList()); } -void dskLobby::Msg_WindowClosed(IngameWindow& wnd) +void dskLobby::msgWindowClosed(IngameWindow& wnd) { if(&wnd == serverInfoWnd) serverInfoWnd = nullptr; diff --git a/libs/s25main/desktops/dskLobby.h b/libs/s25main/desktops/dskLobby.h index e3b0cd833e..dcbee18389 100644 --- a/libs/s25main/desktops/dskLobby.h +++ b/libs/s25main/desktops/dskLobby.h @@ -28,7 +28,7 @@ class dskLobby final : public dskMenuBase, public LobbyInterface void UpdatePlayerList(); void UpdateServerList(); - void Msg_WindowClosed(IngameWindow& wnd) override; + void msgWindowClosed(IngameWindow& wnd) override; void LC_Status_ConnectionLost() override; void LC_Status_IncompleteMessage() override; @@ -40,13 +40,13 @@ class dskLobby final : public dskMenuBase, public LobbyInterface void LC_ServerInfo(const LobbyServerInfo& info) override; protected: - void Msg_Timer(unsigned ctrl_id) override; - void Msg_PaintBefore() override; - void Msg_MsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_EditEnter(unsigned ctrl_id) override; - void Msg_TableRightButton(unsigned ctrl_id, const std::optional& selection) override; - void Msg_TableChooseItem(unsigned ctrl_id, unsigned selection) override; + void msgTimer(unsigned ctrl_id) override; + void msgPaintBefore() override; + void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgEditEnter(unsigned ctrl_id) override; + void msgTableRightButton(unsigned ctrl_id, const std::optional& selection) override; + void msgTableChooseItem(unsigned ctrl_id, unsigned selection) override; /** * Connects to the currently selected game and returns true on success diff --git a/libs/s25main/desktops/dskMainMenu.cpp b/libs/s25main/desktops/dskMainMenu.cpp index 28e00022c6..07a19e3696 100644 --- a/libs/s25main/desktops/dskMainMenu.cpp +++ b/libs/s25main/desktops/dskMainMenu.cpp @@ -59,7 +59,7 @@ dskMainMenu::dskMainMenu() // !\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz\\_ABCDEFGHIJKLMNOPQRSTUVWXYZÇüéâäàåçêëèïîì©ÄÅôöòûùÖÜáíóúñ } -void dskMainMenu::Msg_Timer(const unsigned ctrl_id) +void dskMainMenu::msgTimer(const unsigned ctrl_id) { GetCtrl(ctrl_id)->Stop(); WINDOWMANAGER.Show(std::make_unique( @@ -68,7 +68,7 @@ void dskMainMenu::Msg_Timer(const unsigned ctrl_id) this, MsgboxButton::YesNo, MsgboxIcon::QuestionRed, 100)); } -void dskMainMenu::Msg_MsgBoxResult(const unsigned msgbox_id, const MsgboxResult mbr) +void dskMainMenu::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult mbr) { if(msgbox_id == 100) { @@ -81,7 +81,7 @@ void dskMainMenu::Msg_MsgBoxResult(const unsigned msgbox_id, const MsgboxResult } } -bool dskMainMenu::Msg_LeftUp(const MouseCoords& mc) +bool dskMainMenu::msgLeftUp(const MouseCoords& mc) { auto* txtVersion = GetCtrl(dskMenuBase::ID_txtVersion); if(mc.dbl_click && IsPointInRect(mc.pos, txtVersion->GetBoundaryRect())) @@ -92,7 +92,7 @@ bool dskMainMenu::Msg_LeftUp(const MouseCoords& mc) return false; } -void dskMainMenu::Msg_ButtonClick(const unsigned ctrl_id) +void dskMainMenu::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/desktops/dskMainMenu.h b/libs/s25main/desktops/dskMainMenu.h index 9b6cd47cef..b37707846c 100644 --- a/libs/s25main/desktops/dskMainMenu.h +++ b/libs/s25main/desktops/dskMainMenu.h @@ -12,8 +12,8 @@ class dskMainMenu : public dskMenuBase public: dskMainMenu(); - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_Timer(unsigned ctrl_id) override; - void Msg_MsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; - bool Msg_LeftUp(const MouseCoords& mc) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgTimer(unsigned ctrl_id) override; + void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; + bool msgLeftUp(const MouseCoords& mc) override; }; diff --git a/libs/s25main/desktops/dskMultiPlayer.cpp b/libs/s25main/desktops/dskMultiPlayer.cpp index d172499114..9b1a746569 100644 --- a/libs/s25main/desktops/dskMultiPlayer.cpp +++ b/libs/s25main/desktops/dskMultiPlayer.cpp @@ -33,7 +33,7 @@ dskMultiPlayer::dskMultiPlayer() AddImage(11, DrawPoint(20, 20), LOADER.GetImageN("logo", 0)); } -void dskMultiPlayer::Msg_ButtonClick(const unsigned ctrl_id) +void dskMultiPlayer::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/desktops/dskMultiPlayer.h b/libs/s25main/desktops/dskMultiPlayer.h index 2eb8357687..737c051a21 100644 --- a/libs/s25main/desktops/dskMultiPlayer.h +++ b/libs/s25main/desktops/dskMultiPlayer.h @@ -13,5 +13,5 @@ class dskMultiPlayer : public dskMenuBase dskMultiPlayer(); private: - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/desktops/dskOptions.cpp b/libs/s25main/desktops/dskOptions.cpp index c175d8bc42..329bb57777 100644 --- a/libs/s25main/desktops/dskOptions.cpp +++ b/libs/s25main/desktops/dskOptions.cpp @@ -504,8 +504,8 @@ dskOptions::~dskOptions() ggs.SaveSettings(); } -void dskOptions::Msg_Group_ProgressChange(const unsigned /*group_id*/, const unsigned ctrl_id, - const unsigned short position) +void dskOptions::msgGroupProgressChange(const unsigned /*group_id*/, const unsigned ctrl_id, + const unsigned short position) { switch(ctrl_id) { @@ -520,7 +520,7 @@ void dskOptions::Msg_Group_ProgressChange(const unsigned /*group_id*/, const uns } } -void dskOptions::Msg_Group_ComboSelectItem(const unsigned group_id, const unsigned ctrl_id, const unsigned selection) +void dskOptions::msgGroupComboSelectItem(const unsigned group_id, const unsigned ctrl_id, const unsigned selection) { auto* group = GetCtrl(group_id); auto* combo = group->GetCtrl(ctrl_id); @@ -601,8 +601,8 @@ void dskOptions::Msg_Group_ComboSelectItem(const unsigned group_id, const unsign } } -void dskOptions::Msg_Group_OptionGroupChange(const unsigned /*group_id*/, const unsigned ctrl_id, - const unsigned selection) +void dskOptions::msgGroupOptionGroupChange(const unsigned /*group_id*/, const unsigned ctrl_id, + const unsigned selection) { const bool enabled = selection == ID_btOn; switch(ctrl_id) @@ -642,7 +642,7 @@ void dskOptions::Msg_Group_OptionGroupChange(const unsigned /*group_id*/, const } } -void dskOptions::Msg_OptionGroupChange(const unsigned ctrl_id, const unsigned selection) +void dskOptions::msgOptionGroupChange(const unsigned ctrl_id, const unsigned selection) { if(ctrl_id == ID_grpOptions) { @@ -667,7 +667,7 @@ static bool validatePort(const std::string& sPort, uint16_t& outPort) return static_cast(port); } -void dskOptions::Msg_ButtonClick(const unsigned ctrl_id) +void dskOptions::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -728,7 +728,7 @@ void dskOptions::Msg_ButtonClick(const unsigned ctrl_id) } } -void dskOptions::Msg_Group_ButtonClick(const unsigned /*group_id*/, const unsigned ctrl_id) +void dskOptions::msgGroupButtonClick(const unsigned /*group_id*/, const unsigned ctrl_id) { switch(ctrl_id) { @@ -744,7 +744,7 @@ void dskOptions::Msg_Group_ButtonClick(const unsigned /*group_id*/, const unsign } } -void dskOptions::Msg_MsgBoxResult(const unsigned msgbox_id, const MsgboxResult /*mbr*/) +void dskOptions::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult /*mbr*/) { switch(msgbox_id) { @@ -765,31 +765,31 @@ void dskOptions::loadVideoModes() windowSizes_.assign(windowSizes.begin(), windowSizes.end()); } -void dskOptions::Msg_ScreenResize(const ScreenResizeEvent& sr) +void dskOptions::msgScreenResize(const ScreenResizeEvent& sr) { - Desktop::Msg_ScreenResize(sr); + Desktop::msgScreenResize(sr); updateGuiScale(); updateWindowSizeComboBox(); } -bool dskOptions::Msg_WheelUp(const MouseCoords& mc) +bool dskOptions::msgWheelUp(const MouseCoords& mc) { if(VIDEODRIVER.GetModKeyState().ctrl) { scrollGuiScale(true); return true; } else - return Desktop::Msg_WheelUp(mc); + return Desktop::msgWheelUp(mc); } -bool dskOptions::Msg_WheelDown(const MouseCoords& mc) +bool dskOptions::msgWheelDown(const MouseCoords& mc) { if(VIDEODRIVER.GetModKeyState().ctrl) { scrollGuiScale(false); return true; } else - return Desktop::Msg_WheelDown(mc); + return Desktop::msgWheelDown(mc); } void dskOptions::updateGuiScale() diff --git a/libs/s25main/desktops/dskOptions.h b/libs/s25main/desktops/dskOptions.h index 98adfd2c19..97be14fe0f 100644 --- a/libs/s25main/desktops/dskOptions.h +++ b/libs/s25main/desktops/dskOptions.h @@ -15,19 +15,19 @@ class dskOptions : public Desktop dskOptions(); ~dskOptions() override; - void Msg_ScreenResize(const ScreenResizeEvent& sr) override; - bool Msg_WheelUp(const MouseCoords& mc) override; - bool Msg_WheelDown(const MouseCoords& mc) override; + void msgScreenResize(const ScreenResizeEvent& sr) override; + bool msgWheelUp(const MouseCoords& mc) override; + bool msgWheelDown(const MouseCoords& mc) override; private: - void Msg_OptionGroupChange(unsigned ctrl_id, unsigned selection) override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_MsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; - - void Msg_Group_ButtonClick(unsigned group_id, unsigned ctrl_id) override; - void Msg_Group_ProgressChange(unsigned group_id, unsigned ctrl_id, unsigned short position) override; - void Msg_Group_ComboSelectItem(unsigned group_id, unsigned ctrl_id, unsigned selection) override; - void Msg_Group_OptionGroupChange(unsigned group_id, unsigned ctrl_id, unsigned selection) override; + void msgOptionGroupChange(unsigned ctrl_id, unsigned selection) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; + + void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; + void msgGroupProgressChange(unsigned group_id, unsigned ctrl_id, unsigned short position) override; + void msgGroupComboSelectItem(unsigned group_id, unsigned ctrl_id, unsigned selection) override; + void msgGroupOptionGroupChange(unsigned group_id, unsigned ctrl_id, unsigned selection) override; void updateGuiScale(); void scrollGuiScale(bool up); diff --git a/libs/s25main/desktops/dskSelectMap.cpp b/libs/s25main/desktops/dskSelectMap.cpp index 7054e128ef..1657a3d72e 100644 --- a/libs/s25main/desktops/dskSelectMap.cpp +++ b/libs/s25main/desktops/dskSelectMap.cpp @@ -140,7 +140,7 @@ dskSelectMap::~dskSelectMap() LOBBYCLIENT.RemoveListener(this); } -void dskSelectMap::Msg_OptionGroupChange(const unsigned /*ctrl_id*/, unsigned selection) +void dskSelectMap::msgOptionGroupChange(const unsigned /*ctrl_id*/, unsigned selection) { auto* table = GetCtrl(1); @@ -199,7 +199,7 @@ static std::unique_ptr loadAndVerifyMap(const std:: /** * Occurs when user changes the selection in the table of maps. */ -void dskSelectMap::Msg_TableSelectItem(const unsigned ctrl_id, const std::optional& selection) +void dskSelectMap::msgTableSelectItem(const unsigned ctrl_id, const std::optional& selection) { if(ctrl_id != 1) return; @@ -256,7 +256,7 @@ void dskSelectMap::GoBack() const WINDOWMANAGER.Switch(std::make_unique()); } -void dskSelectMap::Msg_ButtonClick(const unsigned ctrl_id) +void dskSelectMap::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -296,7 +296,7 @@ void dskSelectMap::Msg_ButtonClick(const unsigned ctrl_id) } } -void dskSelectMap::Msg_TableChooseItem(const unsigned /*ctrl_id*/, const unsigned /*selection*/) +void dskSelectMap::msgTableChooseItem(const unsigned /*ctrl_id*/, const unsigned /*selection*/) { // Doppelklick auf bestimmte Map -> weiter StartServer(); @@ -367,7 +367,7 @@ void dskSelectMap::StartServer() } } -void dskSelectMap::Msg_MsgBoxResult(const unsigned msgbox_id, const MsgboxResult /*mbr*/) +void dskSelectMap::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult /*mbr*/) { if(msgbox_id == ID_msgBoxError) { diff --git a/libs/s25main/desktops/dskSelectMap.h b/libs/s25main/desktops/dskSelectMap.h index 74f958f756..196f4f8e8b 100644 --- a/libs/s25main/desktops/dskSelectMap.h +++ b/libs/s25main/desktops/dskSelectMap.h @@ -29,11 +29,11 @@ class dskSelectMap final : public Desktop, public LobbyInterface void FillTable(const std::vector& files); - void Msg_OptionGroupChange(unsigned ctrl_id, unsigned selection) override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_MsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; - void Msg_TableSelectItem(unsigned ctrl_id, const std::optional& selection) override; - void Msg_TableChooseItem(unsigned ctrl_id, unsigned selection) override; + void msgOptionGroupChange(unsigned ctrl_id, unsigned selection) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; + void msgTableSelectItem(unsigned ctrl_id, const std::optional& selection) override; + void msgTableChooseItem(unsigned ctrl_id, unsigned selection) override; void LC_Status_Error(const std::string& error) override; diff --git a/libs/s25main/desktops/dskSinglePlayer.cpp b/libs/s25main/desktops/dskSinglePlayer.cpp index 5f645db43b..e9fbadacd7 100644 --- a/libs/s25main/desktops/dskSinglePlayer.cpp +++ b/libs/s25main/desktops/dskSinglePlayer.cpp @@ -51,7 +51,7 @@ dskSinglePlayer::dskSinglePlayer() AddImage(11, DrawPoint(20, 20), LOADER.GetImageN("logo", 0)); } -void dskSinglePlayer::Msg_ButtonClick(const unsigned ctrl_id) +void dskSinglePlayer::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/desktops/dskSinglePlayer.h b/libs/s25main/desktops/dskSinglePlayer.h index 6c93385ef2..775aaf36ce 100644 --- a/libs/s25main/desktops/dskSinglePlayer.h +++ b/libs/s25main/desktops/dskSinglePlayer.h @@ -13,7 +13,7 @@ class dskSinglePlayer : public dskMenuBase dskSinglePlayer(); private: - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; void PrepareSinglePlayerServer(); void PrepareLoadGame(); }; diff --git a/libs/s25main/desktops/dskSplash.cpp b/libs/s25main/desktops/dskSplash.cpp index 59f59ad678..154ac2c50b 100644 --- a/libs/s25main/desktops/dskSplash.cpp +++ b/libs/s25main/desktops/dskSplash.cpp @@ -42,7 +42,7 @@ void dskSplash::SetActive(bool activate) AddTimer(0, 1ms); } -void dskSplash::Msg_Timer(const unsigned ctrl_id) +void dskSplash::msgTimer(const unsigned ctrl_id) { GetCtrl(ctrl_id)->Stop(); if(ctrl_id == 0) @@ -55,7 +55,7 @@ void dskSplash::Msg_Timer(const unsigned ctrl_id) WINDOWMANAGER.Switch(std::make_unique()); } -bool dskSplash::Msg_LeftDown(const MouseCoords& /*mc*/) +bool dskSplash::msgLeftDown(const MouseCoords& /*mc*/) { if(isLoaded) WINDOWMANAGER.Switch(std::make_unique()); diff --git a/libs/s25main/desktops/dskSplash.h b/libs/s25main/desktops/dskSplash.h index f3907ff593..c01d7d3213 100644 --- a/libs/s25main/desktops/dskSplash.h +++ b/libs/s25main/desktops/dskSplash.h @@ -18,8 +18,8 @@ class dskSplash : public Desktop void SetActive(bool activate) override; private: - void Msg_Timer(unsigned ctrl_id) override; - bool Msg_LeftDown(const MouseCoords& mc) override; + void msgTimer(unsigned ctrl_id) override; + bool msgLeftDown(const MouseCoords& mc) override; void LoadFiles(); std::unique_ptr splashImg; diff --git a/libs/s25main/desktops/dskTest.cpp b/libs/s25main/desktops/dskTest.cpp index 6b350cd8f4..c4dec96516 100644 --- a/libs/s25main/desktops/dskTest.cpp +++ b/libs/s25main/desktops/dskTest.cpp @@ -106,13 +106,13 @@ dskTest::dskTest() : curBGIdx(LOAD_SCREENS.size()) NormalFont); } -void dskTest::Msg_EditChange(const unsigned ctrl_id) +void dskTest::msgEditChange(const unsigned ctrl_id) { if(ctrl_id == ID_edtTest) GetCtrl(ID_txtTest)->SetText(GetCtrl(ID_edtTest)->GetText()); } -void dskTest::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned selection) +void dskTest::msgComboSelectItem(const unsigned ctrl_id, const unsigned selection) { if(ctrl_id == ID_cbTxtSize) { @@ -125,7 +125,7 @@ void dskTest::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned selecti } } -void dskTest::Msg_ButtonClick(const unsigned ctrl_id) +void dskTest::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -168,7 +168,7 @@ void dskTest::Msg_ButtonClick(const unsigned ctrl_id) } } -bool dskTest::Msg_RightUp(const MouseCoords& mc) +bool dskTest::msgRightUp(const MouseCoords& mc) { std::vector bts = GetCtrls(); for(ctrlButton* bt : bts) @@ -179,7 +179,7 @@ bool dskTest::Msg_RightUp(const MouseCoords& mc) return true; } } - return dskMenuBase::Msg_RightUp(mc); + return dskMenuBase::msgRightUp(mc); } void dskTest::ToggleCtrlVisibility() @@ -192,7 +192,7 @@ void dskTest::ToggleCtrlVisibility() } } -bool dskTest::Msg_KeyDown(const KeyEvent& ke) +bool dskTest::msgKeyDown(const KeyEvent& ke) { if(ke.kt == KeyType::Char && ke.c == 'h') ToggleCtrlVisibility(); diff --git a/libs/s25main/desktops/dskTest.h b/libs/s25main/desktops/dskTest.h index a5e5fcd7a0..100e61bf60 100644 --- a/libs/s25main/desktops/dskTest.h +++ b/libs/s25main/desktops/dskTest.h @@ -12,14 +12,14 @@ class dskTest : public dskMenuBase public: dskTest(); - void Msg_EditChange(unsigned ctrl_id) override; - void Msg_ComboSelectItem(unsigned ctrl_id, unsigned selection) override; - void Msg_ButtonClick(unsigned ctrl_id) override; - bool Msg_RightUp(const MouseCoords& mc) override; + void msgEditChange(unsigned ctrl_id) override; + void msgComboSelectItem(unsigned ctrl_id, unsigned selection) override; + void msgButtonClick(unsigned ctrl_id) override; + bool msgRightUp(const MouseCoords& mc) override; void ToggleCtrlVisibility(); - bool Msg_KeyDown(const KeyEvent& ke) override; + bool msgKeyDown(const KeyEvent& ke) override; private: unsigned curBGIdx; diff --git a/libs/s25main/desktops/dskTextureTest.cpp b/libs/s25main/desktops/dskTextureTest.cpp index 51d1ffeb3b..f495a6a0a6 100644 --- a/libs/s25main/desktops/dskTextureTest.cpp +++ b/libs/s25main/desktops/dskTextureTest.cpp @@ -55,10 +55,10 @@ void dskTextureTest::Load() for(const auto& t : desc.terrain) cb->AddItem(t.name); cb->SetSelection(selection); - Msg_ComboSelectItem(ID_cbTexture, selection); + msgComboSelectItem(ID_cbTexture, selection); } -void dskTextureTest::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned selection) +void dskTextureTest::msgComboSelectItem(const unsigned ctrl_id, const unsigned selection) { curTerrainIdx = desc.terrain.getIndex(GetCtrl(ctrl_id)->GetText(selection)); if(!curTerrainIdx) @@ -70,7 +70,7 @@ void dskTextureTest::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned curTexture = LOADER.ExtractTexture(*texBmp, cur.posInTexture); } -void dskTextureTest::Msg_ButtonClick(const unsigned /*ctrl_id*/) +void dskTextureTest::msgButtonClick(const unsigned /*ctrl_id*/) { WINDOWMANAGER.Switch(std::make_unique()); } @@ -78,9 +78,9 @@ void dskTextureTest::Msg_ButtonClick(const unsigned /*ctrl_id*/) using PointF = Point; using Triangle = std::array; -void dskTextureTest::Msg_PaintAfter() +void dskTextureTest::msgPaintAfter() { - dskMenuBase::Msg_PaintAfter(); + dskMenuBase::msgPaintAfter(); if(!curTexture) return; DrawRectangle(Rect(0, 50, 800, 550), COLOR_BLACK); @@ -126,12 +126,12 @@ void dskTextureTest::Msg_PaintAfter() glDrawArrays(GL_TRIANGLES, 0, 2 * 3); } -bool dskTextureTest::Msg_KeyDown(const KeyEvent& ke) +bool dskTextureTest::msgKeyDown(const KeyEvent& ke) { if(ke.kt == KeyType::F5) { Load(); return true; } - return dskMenuBase::Msg_KeyDown(ke); + return dskMenuBase::msgKeyDown(ke); } diff --git a/libs/s25main/desktops/dskTextureTest.h b/libs/s25main/desktops/dskTextureTest.h index fd436b227f..46bd550c3c 100644 --- a/libs/s25main/desktops/dskTextureTest.h +++ b/libs/s25main/desktops/dskTextureTest.h @@ -16,10 +16,10 @@ class dskTextureTest : public dskMenuBase void Load(); - void Msg_ComboSelectItem(unsigned ctrl_id, unsigned selection) override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_PaintAfter() override; - bool Msg_KeyDown(const KeyEvent& ke) override; + void msgComboSelectItem(unsigned ctrl_id, unsigned selection) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgPaintAfter() override; + bool msgKeyDown(const KeyEvent& ke) override; private: WorldDescription desc; diff --git a/libs/s25main/drivers/AudioDriverWrapper.cpp b/libs/s25main/drivers/AudioDriverWrapper.cpp index 41f813bf8c..0de6859ad0 100644 --- a/libs/s25main/drivers/AudioDriverWrapper.cpp +++ b/libs/s25main/drivers/AudioDriverWrapper.cpp @@ -170,7 +170,7 @@ void AudioDriverWrapper::StopEffect(EffectPlayId& playId) playId = EffectPlayId::Invalid; } -void AudioDriverWrapper::Msg_MusicFinished() +void AudioDriverWrapper::msgMusicFinished() { // MusicManager Bescheid sagen MUSICPLAYER.MusicFinished(); diff --git a/libs/s25main/drivers/AudioDriverWrapper.h b/libs/s25main/drivers/AudioDriverWrapper.h index 65602d292f..fae53f4eb5 100644 --- a/libs/s25main/drivers/AudioDriverWrapper.h +++ b/libs/s25main/drivers/AudioDriverWrapper.h @@ -70,7 +70,7 @@ class AudioDriverWrapper : private: using Handle = std::unique_ptr; bool Init(); - void Msg_MusicFinished() override; + void msgMusicFinished() override; SoundHandle createSoundHandle(const driver::RawSoundHandle& rawHandle); drivers::DriverWrapper driver_wrapper; diff --git a/libs/s25main/drivers/VideoDriverWrapper.cpp b/libs/s25main/drivers/VideoDriverWrapper.cpp index 311e96315d..5c7c295669 100644 --- a/libs/s25main/drivers/VideoDriverWrapper.cpp +++ b/libs/s25main/drivers/VideoDriverWrapper.cpp @@ -113,7 +113,7 @@ bool VideoDriverWrapper::CreateScreen(const VideoMode size, const DisplayMode di SwapBuffers(); // WindowManager informieren - WINDOWMANAGER.Msg_ScreenResize(GetRenderSize()); + WINDOWMANAGER.msgScreenResize(GetRenderSize()); return true; } diff --git a/libs/s25main/ingameWindows/IngameWindow.cpp b/libs/s25main/ingameWindows/IngameWindow.cpp index 10d84a60e4..d441341f27 100644 --- a/libs/s25main/ingameWindows/IngameWindow.cpp +++ b/libs/s25main/ingameWindows/IngameWindow.cpp @@ -191,7 +191,7 @@ void IngameWindow::SetPinned(bool pinned) windowSettings_->isPinned = isPinned_; } -bool IngameWindow::Msg_LeftDown(const MouseCoords& mc) +bool IngameWindow::msgLeftDown(const MouseCoords& mc) { for(const auto btn : helpers::enumRange()) { @@ -208,7 +208,7 @@ bool IngameWindow::Msg_LeftDown(const MouseCoords& mc) return false; } -bool IngameWindow::Msg_LeftUp(const MouseCoords& mc) +bool IngameWindow::msgLeftUp(const MouseCoords& mc) { // If we handled the msg event. Don't return yet in case touch dblclick triggered dragging const bool handled = StopDragging(); @@ -262,18 +262,18 @@ bool IngameWindow::Msg_LeftUp(const MouseCoords& mc) return handled; } -bool IngameWindow::Msg_MiddleDown(const MouseCoords& mc) +bool IngameWindow::msgMiddleDown(const MouseCoords& mc) { StartDragging(mc.pos); return true; } -bool IngameWindow::Msg_MiddleUp(const MouseCoords&) +bool IngameWindow::msgMiddleUp(const MouseCoords&) { return StopDragging(); } -bool IngameWindow::Msg_MouseMove(const MouseCoords& mc) +bool IngameWindow::msgMouseMove(const MouseCoords& mc) { if(isMoving) { diff --git a/libs/s25main/ingameWindows/IngameWindow.h b/libs/s25main/ingameWindows/IngameWindow.h index 3066837858..ddcc672c05 100644 --- a/libs/s25main/ingameWindows/IngameWindow.h +++ b/libs/s25main/ingameWindows/IngameWindow.h @@ -99,11 +99,11 @@ class IngameWindow : public Window GUI_ID GetGUIID() const { return static_cast(Window::GetID()); } - bool Msg_LeftDown(const MouseCoords&) override; - bool Msg_LeftUp(const MouseCoords&) override; - bool Msg_MiddleDown(const MouseCoords&) override; - bool Msg_MiddleUp(const MouseCoords&) override; - bool Msg_MouseMove(const MouseCoords&) override; + bool msgLeftDown(const MouseCoords&) override; + bool msgLeftUp(const MouseCoords&) override; + bool msgMiddleDown(const MouseCoords&) override; + bool msgMiddleUp(const MouseCoords&) override; + bool msgMouseMove(const MouseCoords&) override; protected: void Draw_() final; diff --git a/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.cpp b/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.cpp index d302228382..57803c5285 100644 --- a/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.cpp +++ b/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.cpp @@ -35,13 +35,13 @@ void TransmitSettingsIgwAdapter::Close() } } -void TransmitSettingsIgwAdapter::Msg_MsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) +void TransmitSettingsIgwAdapter::msgMsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) { if(msgbox_id == firstCtrlID && mbr == MsgboxResult::Ok) IngameWindow::Close(); } -void TransmitSettingsIgwAdapter::Msg_Timer(const unsigned /*ctrl_id*/) +void TransmitSettingsIgwAdapter::msgTimer(const unsigned /*ctrl_id*/) { if(GAMECLIENT.IsReplayModeOn()) UpdateSettings(); diff --git a/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.h b/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.h index 81a57604ab..2e3d5203e6 100644 --- a/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.h +++ b/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.h @@ -25,6 +25,6 @@ class TransmitSettingsIgwAdapter : public IngameWindow void Close() override; - void Msg_Timer(unsigned ctrl_id) override; - void Msg_MsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; + void msgTimer(unsigned ctrl_id) override; + void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; }; diff --git a/libs/s25main/ingameWindows/iwAIDebug.cpp b/libs/s25main/ingameWindows/iwAIDebug.cpp index 1e7b8723a6..cc821d9d14 100644 --- a/libs/s25main/ingameWindows/iwAIDebug.cpp +++ b/libs/s25main/ingameWindows/iwAIDebug.cpp @@ -133,7 +133,7 @@ iwAIDebug::~iwAIDebug() } } -void iwAIDebug::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned selection) +void iwAIDebug::msgComboSelectItem(const unsigned ctrl_id, const unsigned selection) { switch(ctrl_id) { @@ -142,9 +142,9 @@ void iwAIDebug::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned selec } } -void iwAIDebug::Msg_PaintBefore() +void iwAIDebug::msgPaintBefore() { - IngameWindow::Msg_PaintBefore(); + IngameWindow::msgPaintBefore(); std::stringstream ss; const AIJH::AIJob* currentJob = printer->ai->GetCurrentJob(); diff --git a/libs/s25main/ingameWindows/iwAIDebug.h b/libs/s25main/ingameWindows/iwAIDebug.h index 711f305bea..1814bc5fa8 100644 --- a/libs/s25main/ingameWindows/iwAIDebug.h +++ b/libs/s25main/ingameWindows/iwAIDebug.h @@ -21,10 +21,10 @@ class iwAIDebug : public IngameWindow ~iwAIDebug() override; private: - void Msg_ComboSelectItem(unsigned ctrl_id, unsigned selection) override; + void msgComboSelectItem(unsigned ctrl_id, unsigned selection) override; // void Msg_ButtonClick(unsigned ctrl_id); // void Msg_ProgressChange(unsigned ctrl_id, unsigned short position); - void Msg_PaintBefore() override; + void msgPaintBefore() override; class DebugPrinter; diff --git a/libs/s25main/ingameWindows/iwAction.cpp b/libs/s25main/ingameWindows/iwAction.cpp index 534b2f9750..ce4706162b 100644 --- a/libs/s25main/ingameWindows/iwAction.cpp +++ b/libs/s25main/ingameWindows/iwAction.cpp @@ -437,7 +437,7 @@ void iwAction::Close() VIDEODRIVER.SetMousePos(mousePosAtOpen_); } -void iwAction::Msg_Group_ButtonClick(const unsigned /*group_id*/, const unsigned ctrl_id) +void iwAction::msgGroupButtonClick(const unsigned /*group_id*/, const unsigned ctrl_id) { switch(GetCtrl(0)->GetCurrentTab()) { @@ -445,54 +445,54 @@ void iwAction::Msg_Group_ButtonClick(const unsigned /*group_id*/, const unsigned case TAB_ATTACK: { - Msg_ButtonClick_TabAttack(ctrl_id); + msgButtonClickTabAttack(ctrl_id); } break; case TAB_SEAATTACK: { - Msg_ButtonClick_TabSeaAttack(ctrl_id); + msgButtonClickTabSeaAttack(ctrl_id); } break; case TAB_FLAG: { - Msg_ButtonClick_TabFlag(ctrl_id); + msgButtonClickTabFlag(ctrl_id); } break; case TAB_BUILD: { - Msg_ButtonClick_TabBuild(ctrl_id); + msgButtonClickTabBuild(ctrl_id); } break; case TAB_SETFLAG: { - Msg_ButtonClick_TabSetFlag(ctrl_id); + msgButtonClickTabSetFlag(ctrl_id); } break; case TAB_CUTROAD: { - Msg_ButtonClick_TabCutRoad(ctrl_id); + msgButtonClickTabCutRoad(ctrl_id); } break; case TAB_WATCH: { - Msg_ButtonClick_TabWatch(ctrl_id); + msgButtonClickTabWatch(ctrl_id); } break; case TAB_CHEAT: { - Msg_ButtonClick_TabCheat(ctrl_id); + msgButtonClickTabCheat(ctrl_id); } break; } } -void iwAction::Msg_TabChange(const unsigned ctrl_id, const unsigned short tab_id) +void iwAction::msgTabChange(const unsigned ctrl_id, const unsigned short tab_id) { switch(ctrl_id) { @@ -536,7 +536,7 @@ void iwAction::Msg_TabChange(const unsigned ctrl_id, const unsigned short tab_id } } -void iwAction::Msg_Group_TabChange(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned short tab_id) +void iwAction::msgGroupTabChange(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned short tab_id) { switch(ctrl_id) { @@ -548,9 +548,9 @@ void iwAction::Msg_Group_TabChange(const unsigned /*group_id*/, const unsigned c } } -void iwAction::Msg_PaintAfter() +void iwAction::msgPaintAfter() { - IngameWindow::Msg_PaintAfter(); + IngameWindow::msgPaintAfter(); auto* tab = GetCtrl(0); if(tab) @@ -569,7 +569,7 @@ void iwAction::Msg_PaintAfter() } } -void iwAction::Msg_ButtonClick_TabAttack(const unsigned ctrl_id) +void iwAction::msgButtonClickTabAttack(const unsigned ctrl_id) { switch(ctrl_id) { @@ -606,7 +606,7 @@ void iwAction::Msg_ButtonClick_TabAttack(const unsigned ctrl_id) } } -void iwAction::Msg_ButtonClick_TabSeaAttack(const unsigned ctrl_id) +void iwAction::msgButtonClickTabSeaAttack(const unsigned ctrl_id) { switch(ctrl_id) { @@ -643,7 +643,7 @@ void iwAction::Msg_ButtonClick_TabSeaAttack(const unsigned ctrl_id) } } -void iwAction::Msg_ButtonClick_TabFlag(const unsigned ctrl_id) +void iwAction::msgButtonClickTabFlag(const unsigned ctrl_id) { switch(ctrl_id) { @@ -707,7 +707,7 @@ void iwAction::Msg_ButtonClick_TabFlag(const unsigned ctrl_id) } } -void iwAction::Msg_ButtonClick_TabBuild(const unsigned ctrl_id) +void iwAction::msgButtonClickTabBuild(const unsigned ctrl_id) { // Klick auf Gebäudebauicon if(GAMECLIENT.SetBuildingSite(selectedPt, GetCtrl(0) @@ -722,7 +722,7 @@ void iwAction::Msg_ButtonClick_TabBuild(const unsigned ctrl_id) } } -void iwAction::Msg_ButtonClick_TabSetFlag(const unsigned ctrl_id) +void iwAction::msgButtonClickTabSetFlag(const unsigned ctrl_id) { bool success = false; switch(ctrl_id) @@ -739,7 +739,7 @@ void iwAction::Msg_ButtonClick_TabSetFlag(const unsigned ctrl_id) Close(); } -void iwAction::Msg_ButtonClick_TabCutRoad(const unsigned ctrl_id) +void iwAction::msgButtonClickTabCutRoad(const unsigned ctrl_id) { bool success = true; switch(ctrl_id) @@ -761,7 +761,7 @@ void iwAction::Msg_ButtonClick_TabCutRoad(const unsigned ctrl_id) Close(); } -void iwAction::Msg_ButtonClick_TabWatch(const unsigned ctrl_id) +void iwAction::msgButtonClickTabWatch(const unsigned ctrl_id) { switch(ctrl_id) { @@ -787,7 +787,7 @@ void iwAction::Msg_ButtonClick_TabWatch(const unsigned ctrl_id) } } -void iwAction::Msg_ButtonClick_TabCheat(const unsigned ctrl_id) +void iwAction::msgButtonClickTabCheat(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwAction.h b/libs/s25main/ingameWindows/iwAction.h index 2384f64189..719af53c10 100644 --- a/libs/s25main/ingameWindows/iwAction.h +++ b/libs/s25main/ingameWindows/iwAction.h @@ -83,19 +83,19 @@ class iwAction : public IngameWindow const MapPoint& GetSelectedPt() const { return selectedPt; } private: - void Msg_Group_ButtonClick(unsigned group_id, unsigned ctrl_id) override; - void Msg_TabChange(unsigned ctrl_id, unsigned short tab_id) override; - void Msg_Group_TabChange(unsigned group_id, unsigned ctrl_id, unsigned short tab_id) override; - void Msg_PaintAfter() override; - - inline void Msg_ButtonClick_TabBuild(unsigned ctrl_id); - inline void Msg_ButtonClick_TabCutRoad(unsigned ctrl_id); - inline void Msg_ButtonClick_TabFlag(unsigned ctrl_id); - inline void Msg_ButtonClick_TabAttack(unsigned ctrl_id); - inline void Msg_ButtonClick_TabSeaAttack(unsigned ctrl_id); - inline void Msg_ButtonClick_TabSetFlag(unsigned ctrl_id); - inline void Msg_ButtonClick_TabWatch(unsigned ctrl_id); - inline void Msg_ButtonClick_TabCheat(unsigned ctrl_id); + void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; + void msgTabChange(unsigned ctrl_id, unsigned short tab_id) override; + void msgGroupTabChange(unsigned group_id, unsigned ctrl_id, unsigned short tab_id) override; + void msgPaintAfter() override; + + inline void msgButtonClickTabBuild(unsigned ctrl_id); + inline void msgButtonClickTabCutRoad(unsigned ctrl_id); + inline void msgButtonClickTabFlag(unsigned ctrl_id); + inline void msgButtonClickTabAttack(unsigned ctrl_id); + inline void msgButtonClickTabSeaAttack(unsigned ctrl_id); + inline void msgButtonClickTabSetFlag(unsigned ctrl_id); + inline void msgButtonClickTabWatch(unsigned ctrl_id); + inline void msgButtonClickTabCheat(unsigned ctrl_id); void DisableMousePosResetOnClose(); diff --git a/libs/s25main/ingameWindows/iwAddonPresets.cpp b/libs/s25main/ingameWindows/iwAddonPresets.cpp index db097d4e18..e5a504ceb7 100644 --- a/libs/s25main/ingameWindows/iwAddonPresets.cpp +++ b/libs/s25main/ingameWindows/iwAddonPresets.cpp @@ -145,7 +145,7 @@ bool iwAddonPresetsBase::CanDoAction() const return IsPresetSelected(); } -void iwAddonPresetsBase::Msg_ButtonClick(const unsigned ctrl_id) +void iwAddonPresetsBase::msgButtonClick(const unsigned ctrl_id) { if(ctrl_id == ID_btDelete) ConfirmDelete(); @@ -156,12 +156,12 @@ void iwAddonPresetsBase::Msg_ButtonClick(const unsigned ctrl_id) } } -void iwAddonPresetsBase::Msg_TableSelectItem(const unsigned /*ctrl_id*/, const std::optional& /*selection*/) +void iwAddonPresetsBase::msgTableSelectItem(const unsigned /*ctrl_id*/, const std::optional& /*selection*/) { UpdateButtons(); } -void iwAddonPresetsBase::Msg_TableChooseItem(const unsigned /*ctrl_id*/, const unsigned /*selection*/) +void iwAddonPresetsBase::msgTableChooseItem(const unsigned /*ctrl_id*/, const unsigned /*selection*/) { DoAction(); } @@ -176,7 +176,7 @@ void iwAddonPresetsBase::ConfirmDelete() this, MsgboxButton::YesNo, MsgboxIcon::QuestionRed, ID_mbDelete)); } -void iwAddonPresetsBase::Msg_MsgBoxResult(const unsigned msgbox_id, const MsgboxResult mbr) +void iwAddonPresetsBase::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult mbr) { if(msgbox_id != ID_mbDelete || mbr != MsgboxResult::Yes) return; @@ -208,18 +208,18 @@ iwSaveAddonPreset::iwSaveAddonPreset(std::map states) ->SetType(EditType::Filename); } -void iwSaveAddonPreset::Msg_EditEnter(const unsigned /*ctrl_id*/) +void iwSaveAddonPreset::msgEditEnter(const unsigned /*ctrl_id*/) { DoAction(); } -void iwSaveAddonPreset::Msg_EditChange(const unsigned /*ctrl_id*/) +void iwSaveAddonPreset::msgEditChange(const unsigned /*ctrl_id*/) { // Editing makes the selected preset ambiguous, so drop the selection instead of guessing which one is meant assertNonNull(GetCtrl(ID_tblPresets)).SetSelection(std::nullopt); } -void iwSaveAddonPreset::Msg_TableSelectItem(const unsigned ctrl_id, const std::optional& selection) +void iwSaveAddonPreset::msgTableSelectItem(const unsigned ctrl_id, const std::optional& selection) { if(selection) { @@ -231,7 +231,7 @@ void iwSaveAddonPreset::Msg_TableSelectItem(const unsigned ctrl_id, const std::o edit.SetNotify(true); } // The name must be filled first, as it decides whether saving is possible - iwAddonPresetsBase::Msg_TableSelectItem(ctrl_id, selection); + iwAddonPresetsBase::msgTableSelectItem(ctrl_id, selection); } bool iwSaveAddonPreset::CanDoAction() const @@ -293,11 +293,11 @@ void iwSaveAddonPreset::SaveToPath(const bfs::path& filePath) RefreshTable(); } -void iwSaveAddonPreset::Msg_MsgBoxResult(const unsigned msgbox_id, const MsgboxResult mbr) +void iwSaveAddonPreset::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult mbr) { if(msgbox_id != ID_mbOverwrite) { - iwAddonPresetsBase::Msg_MsgBoxResult(msgbox_id, mbr); + iwAddonPresetsBase::msgMsgBoxResult(msgbox_id, mbr); return; } if(mbr != MsgboxResult::Yes) diff --git a/libs/s25main/ingameWindows/iwAddonPresets.h b/libs/s25main/ingameWindows/iwAddonPresets.h index 0de278488d..70484078a4 100644 --- a/libs/s25main/ingameWindows/iwAddonPresets.h +++ b/libs/s25main/ingameWindows/iwAddonPresets.h @@ -34,10 +34,10 @@ class iwAddonPresetsBase : public IngameWindow /// Empty if no preset is selected boost::filesystem::path GetSelectedFilePath() const; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_TableSelectItem(unsigned ctrl_id, const std::optional& selection) override; - void Msg_TableChooseItem(unsigned ctrl_id, unsigned selection) override; - void Msg_MsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgTableSelectItem(unsigned ctrl_id, const std::optional& selection) override; + void msgTableChooseItem(unsigned ctrl_id, unsigned selection) override; + void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; private: bool IsPresetSelected() const; @@ -57,10 +57,10 @@ class iwSaveAddonPreset : public iwAddonPresetsBase void SaveToPath(const boost::filesystem::path& filePath); bool CanDoAction() const override; void DoAction() override; - void Msg_EditEnter(unsigned ctrl_id) override; - void Msg_EditChange(unsigned ctrl_id) override; - void Msg_TableSelectItem(unsigned ctrl_id, const std::optional& selection) override; - void Msg_MsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; + void msgEditEnter(unsigned ctrl_id) override; + void msgEditChange(unsigned ctrl_id) override; + void msgTableSelectItem(unsigned ctrl_id, const std::optional& selection) override; + void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; }; class iwLoadAddonPreset : public iwAddonPresetsBase diff --git a/libs/s25main/ingameWindows/iwAddons.cpp b/libs/s25main/ingameWindows/iwAddons.cpp index f7bc4bd8f0..c95c44f031 100644 --- a/libs/s25main/ingameWindows/iwAddons.cpp +++ b/libs/s25main/ingameWindows/iwAddons.cpp @@ -104,7 +104,7 @@ void iwAddons::Close() IngameWindow::Close(); } -void iwAddons::Msg_ButtonClick(const unsigned ctrl_id) +void iwAddons::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -124,7 +124,7 @@ void iwAddons::Msg_ButtonClick(const unsigned ctrl_id) case AddonChangeAllowed::All: case AddonChangeAllowed::WhitelistOnly: // send message via msgboxresult - GetParent()->Msg_MsgBoxResult(GetID(), MsgboxResult::Yes); + GetParent()->msgMsgBoxResult(GetID(), MsgboxResult::Yes); break; } } @@ -208,7 +208,7 @@ bool iwAddons::isReadOnly(AddonId id) const || (policy_ == AddonChangeAllowed::WhitelistOnly && !helpers::contains(whitelistedAddons_, id)); } -void iwAddons::Msg_OptionGroupChange(const unsigned ctrl_id, const unsigned selection) +void iwAddons::msgOptionGroupChange(const unsigned ctrl_id, const unsigned selection) { switch(ctrl_id) { @@ -224,19 +224,19 @@ void iwAddons::Msg_OptionGroupChange(const unsigned ctrl_id, const unsigned sele /** * get scrollbar notification */ -void iwAddons::Msg_ScrollChange(const unsigned /*ctrl_id*/, const unsigned short /*position*/) +void iwAddons::msgScrollChange(const unsigned /*ctrl_id*/, const unsigned short /*position*/) { auto* optiongroup = GetCtrl(ID_grpAddonGroup); UpdateView(static_cast(optiongroup->GetSelection())); } -bool iwAddons::Msg_WheelUp(const MouseCoords& /*mc*/) +bool iwAddons::msgWheelUp(const MouseCoords& /*mc*/) { GetCtrl(ID_scroll)->Scroll(-2); return true; } -bool iwAddons::Msg_WheelDown(const MouseCoords& /*mc*/) +bool iwAddons::msgWheelDown(const MouseCoords& /*mc*/) { GetCtrl(ID_scroll)->Scroll(+2); return true; diff --git a/libs/s25main/ingameWindows/iwAddons.h b/libs/s25main/ingameWindows/iwAddons.h index 2e2c36e645..22b83fa780 100644 --- a/libs/s25main/ingameWindows/iwAddons.h +++ b/libs/s25main/ingameWindows/iwAddons.h @@ -33,11 +33,11 @@ class iwAddons : public IngameWindow void Close() override; protected: - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_OptionGroupChange(unsigned ctrl_id, unsigned selection) override; - void Msg_ScrollChange(unsigned ctrl_id, unsigned short position) override; - bool Msg_WheelUp(const MouseCoords& mc) override; - bool Msg_WheelDown(const MouseCoords& mc) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgOptionGroupChange(unsigned ctrl_id, unsigned selection) override; + void msgScrollChange(unsigned ctrl_id, unsigned short position) override; + bool msgWheelUp(const MouseCoords& mc) override; + bool msgWheelDown(const MouseCoords& mc) override; private: /// settings we edit in this window diff --git a/libs/s25main/ingameWindows/iwBaseWarehouse.cpp b/libs/s25main/ingameWindows/iwBaseWarehouse.cpp index 1a9d776ac4..6ed1b51377 100644 --- a/libs/s25main/ingameWindows/iwBaseWarehouse.cpp +++ b/libs/s25main/ingameWindows/iwBaseWarehouse.cpp @@ -98,10 +98,10 @@ iwBaseWarehouse::~iwBaseWarehouse() wh->RemoveListener(this); } -void iwBaseWarehouse::Msg_Group_ButtonClick(const unsigned group_id, const unsigned ctrl_id) +void iwBaseWarehouse::msgGroupButtonClick(const unsigned group_id, const unsigned ctrl_id) { if(group_id != warePageID && group_id != peoplePageID) - iwWares::Msg_Group_ButtonClick(group_id, ctrl_id); + iwWares::msgGroupButtonClick(group_id, ctrl_id); else { if(GAMECLIENT.IsReplayModeOn()) @@ -134,7 +134,7 @@ void iwBaseWarehouse::Msg_Group_ButtonClick(const unsigned group_id, const unsig } } -void iwBaseWarehouse::Msg_ButtonClick(const unsigned ctrl_id) +void iwBaseWarehouse::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -255,7 +255,7 @@ void iwBaseWarehouse::Msg_ButtonClick(const unsigned ctrl_id) break; default: // an Basis weiterleiten { - iwWares::Msg_ButtonClick(ctrl_id); + iwWares::msgButtonClick(ctrl_id); } break; } diff --git a/libs/s25main/ingameWindows/iwBaseWarehouse.h b/libs/s25main/ingameWindows/iwBaseWarehouse.h index 84cce9c57c..92c2a503c8 100644 --- a/libs/s25main/ingameWindows/iwBaseWarehouse.h +++ b/libs/s25main/ingameWindows/iwBaseWarehouse.h @@ -33,8 +33,8 @@ class iwBaseWarehouse : public iwWares, public IDataChangedListener void UpdateOverlay(unsigned i, bool isWare); void UpdateOverlays(); - void Msg_Group_ButtonClick(unsigned group_id, unsigned ctrl_id) override; - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; void SetPage(unsigned page) override; }; diff --git a/libs/s25main/ingameWindows/iwBuildOrder.cpp b/libs/s25main/ingameWindows/iwBuildOrder.cpp index 3f6cb388eb..f1598eba3d 100644 --- a/libs/s25main/ingameWindows/iwBuildOrder.cpp +++ b/libs/s25main/ingameWindows/iwBuildOrder.cpp @@ -109,7 +109,7 @@ void iwBuildOrder::TransmitSettings() } } -void iwBuildOrder::Msg_ListSelectItem(const unsigned ctrl_id, const int selection) +void iwBuildOrder::msgListSelectItem(const unsigned ctrl_id, const int selection) { if(GAMECLIENT.IsReplayModeOn()) return; @@ -126,7 +126,7 @@ void iwBuildOrder::Msg_ListSelectItem(const unsigned ctrl_id, const int selectio } } -void iwBuildOrder::Msg_ComboSelectItem(unsigned ctrl_id, unsigned selection) +void iwBuildOrder::msgComboSelectItem(unsigned ctrl_id, unsigned selection) { if(ctrl_id == 6) { @@ -135,7 +135,7 @@ void iwBuildOrder::Msg_ComboSelectItem(unsigned ctrl_id, unsigned selection) } } -void iwBuildOrder::Msg_ButtonClick(const unsigned ctrl_id) +void iwBuildOrder::msgButtonClick(const unsigned ctrl_id) { if(GAMECLIENT.IsReplayModeOn()) return; diff --git a/libs/s25main/ingameWindows/iwBuildOrder.h b/libs/s25main/ingameWindows/iwBuildOrder.h index c2a338acb4..eb13d125ad 100644 --- a/libs/s25main/ingameWindows/iwBuildOrder.h +++ b/libs/s25main/ingameWindows/iwBuildOrder.h @@ -26,9 +26,9 @@ class iwBuildOrder final : public TransmitSettingsIgwAdapter /// Sendet veränderte Einstellungen (an den Client), falls sie verändert wurden void TransmitSettings() override; - void Msg_ListSelectItem(unsigned ctrl_id, int selection) override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_ComboSelectItem(unsigned ctrl_id, unsigned selection) override; + void msgListSelectItem(unsigned ctrl_id, int selection) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgComboSelectItem(unsigned ctrl_id, unsigned selection) override; void fillBuildOrder(const BuildOrders& build_order); }; diff --git a/libs/s25main/ingameWindows/iwBuilding.cpp b/libs/s25main/ingameWindows/iwBuilding.cpp index cc30f43a31..e59fcf14e3 100644 --- a/libs/s25main/ingameWindows/iwBuilding.cpp +++ b/libs/s25main/ingameWindows/iwBuilding.cpp @@ -96,18 +96,18 @@ iwBuilding::iwBuilding(GameWorldView& gwv, GameCommandFactory& gcFactory, nobUsu LOADER.GetImageN("io_new", 11), _("Go to next building of same type")); } -void iwBuilding::Msg_PaintBefore() +void iwBuilding::msgPaintBefore() { - IngameWindow::Msg_PaintBefore(); + IngameWindow::msgPaintBefore(); productivity = building->GetProductivity(); // Haus unbesetzt ggf ausblenden GetCtrl(10)->SetVisible(!building->HasWorker()); } -void iwBuilding::Msg_PaintAfter() +void iwBuilding::msgPaintAfter() { - IngameWindow::Msg_PaintAfter(); + IngameWindow::msgPaintAfter(); const auto& bldWorkDesk = BLD_WORK_DESC[building->GetBuildingType()]; if(BuildingProperties::IsMine(building->GetBuildingType())) { @@ -152,7 +152,7 @@ void iwBuilding::Msg_PaintAfter() } } -void iwBuilding::Msg_ButtonClick(const unsigned ctrl_id) +void iwBuilding::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwBuilding.h b/libs/s25main/ingameWindows/iwBuilding.h index 03dce9dab9..2900f760aa 100644 --- a/libs/s25main/ingameWindows/iwBuilding.h +++ b/libs/s25main/ingameWindows/iwBuilding.h @@ -22,9 +22,9 @@ class iwBuilding : public IngameWindow iwBuilding(GameWorldView& gwv, GameCommandFactory& gcFactory, nobUsual* building, Extent extent = Extent(226, 194)); private: - void Msg_PaintBefore() override; - void Msg_PaintAfter() override; + void msgPaintBefore() override; + void msgPaintAfter() override; protected: - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwBuildingProductivities.cpp b/libs/s25main/ingameWindows/iwBuildingProductivities.cpp index af44722c60..d245dcaa4b 100644 --- a/libs/s25main/ingameWindows/iwBuildingProductivities.cpp +++ b/libs/s25main/ingameWindows/iwBuildingProductivities.cpp @@ -103,8 +103,8 @@ void iwBuildingProductivities::UpdatePercents() percents = player.GetBuildingRegister().CalcProductivities(); } -void iwBuildingProductivities::Msg_PaintAfter() +void iwBuildingProductivities::msgPaintAfter() { - IngameWindow::Msg_PaintAfter(); + IngameWindow::msgPaintAfter(); UpdatePercents(); } diff --git a/libs/s25main/ingameWindows/iwBuildingProductivities.h b/libs/s25main/ingameWindows/iwBuildingProductivities.h index da0c56f831..dfaf7b72bc 100644 --- a/libs/s25main/ingameWindows/iwBuildingProductivities.h +++ b/libs/s25main/ingameWindows/iwBuildingProductivities.h @@ -24,7 +24,7 @@ class iwBuildingProductivities : public IngameWindow private: void UpdatePercents(); - void Msg_PaintAfter() override; + void msgPaintAfter() override; void setBuildingOrder(); /// Icons shown (in this order) diff --git a/libs/s25main/ingameWindows/iwBuildingSite.cpp b/libs/s25main/ingameWindows/iwBuildingSite.cpp index 21e79c4244..1f74472b45 100644 --- a/libs/s25main/ingameWindows/iwBuildingSite.cpp +++ b/libs/s25main/ingameWindows/iwBuildingSite.cpp @@ -37,7 +37,7 @@ iwBuildingSite::iwBuildingSite(GameWorldView& gwv, const noBuildingSite* const b _("Go to place")); } -void iwBuildingSite::Msg_ButtonClick(const unsigned ctrl_id) +void iwBuildingSite::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -62,9 +62,9 @@ void iwBuildingSite::Msg_ButtonClick(const unsigned ctrl_id) } } -void iwBuildingSite::Msg_PaintAfter() +void iwBuildingSite::msgPaintAfter() { - IngameWindow::Msg_PaintAfter(); + IngameWindow::msgPaintAfter(); // Baukosten zeichnen DrawPoint curPos = GetDrawPos() + DrawPoint(GetSize().x / 2, 60); for(unsigned char i = 0; i < 2; ++i) diff --git a/libs/s25main/ingameWindows/iwBuildingSite.h b/libs/s25main/ingameWindows/iwBuildingSite.h index 6252a5efba..2c778c63ed 100644 --- a/libs/s25main/ingameWindows/iwBuildingSite.h +++ b/libs/s25main/ingameWindows/iwBuildingSite.h @@ -15,8 +15,8 @@ class iwBuildingSite : public IngameWindow iwBuildingSite(GameWorldView& gwv, const noBuildingSite* buildingsite); protected: - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_PaintAfter() override; + void msgButtonClick(unsigned ctrl_id) override; + void msgPaintAfter() override; private: GameWorldView& gwv; diff --git a/libs/s25main/ingameWindows/iwBuildings.cpp b/libs/s25main/ingameWindows/iwBuildings.cpp index 4ec0ea6470..0d4b9cfb56 100644 --- a/libs/s25main/ingameWindows/iwBuildings.cpp +++ b/libs/s25main/ingameWindows/iwBuildings.cpp @@ -100,10 +100,10 @@ iwBuildings::iwBuildings(GameWorldView& gwv, GameCommandFactory& gcFactory) } /// Anzahlen der Gebäude zeichnen -void iwBuildings::Msg_PaintAfter() +void iwBuildings::msgPaintAfter() { static boost::format fmt("%1%/%2%"); - IngameWindow::Msg_PaintAfter(); + IngameWindow::msgPaintAfter(); // Anzahlen herausfinden BuildingCount bc = gwv.GetViewer().GetPlayer().GetBuildingRegister().GetBuildingNums(); @@ -125,7 +125,7 @@ void iwBuildings::Msg_PaintAfter() } } -void iwBuildings::Msg_ButtonClick(const unsigned ctrl_id) +void iwBuildings::msgButtonClick(const unsigned ctrl_id) { if(ctrl_id == ID_Help) // Help button { diff --git a/libs/s25main/ingameWindows/iwBuildings.h b/libs/s25main/ingameWindows/iwBuildings.h index 1717189ea3..ddd6716766 100644 --- a/libs/s25main/ingameWindows/iwBuildings.h +++ b/libs/s25main/ingameWindows/iwBuildings.h @@ -23,9 +23,9 @@ class iwBuildings : public IngameWindow private: /// Anzahlen der Gebäude zeichnen - void Msg_PaintAfter() override; + void msgPaintAfter() override; - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; template void GoToFirstMatching(BuildingType bldType, const std::list& blds); diff --git a/libs/s25main/ingameWindows/iwChat.cpp b/libs/s25main/ingameWindows/iwChat.cpp index 096a8f28a9..ff9afd68ea 100644 --- a/libs/s25main/ingameWindows/iwChat.cpp +++ b/libs/s25main/ingameWindows/iwChat.cpp @@ -36,20 +36,20 @@ iwChat::iwChat(Window* parent) group->SetSelection(rttr::enum_cast(lastChatDestination)); } -void iwChat::Msg_PaintBefore() +void iwChat::msgPaintBefore() { - IngameWindow::Msg_PaintBefore(); + IngameWindow::msgPaintBefore(); GetCtrl(0)->SetFocus(); } -void iwChat::Msg_OptionGroupChange(const unsigned /*ctrl_id*/, unsigned selection) +void iwChat::msgOptionGroupChange(const unsigned /*ctrl_id*/, unsigned selection) { RTTR_Assert(selection <= helpers::MaxEnumValue_v); lastChatDestination = static_cast(selection); GetCtrl(0)->SetFocus(); } -void iwChat::Msg_EditEnter(const unsigned /*ctrl_id*/) +void iwChat::msgEditEnter(const unsigned /*ctrl_id*/) { Close(); diff --git a/libs/s25main/ingameWindows/iwChat.h b/libs/s25main/ingameWindows/iwChat.h index 066a8d8f3c..cf4d51e70d 100644 --- a/libs/s25main/ingameWindows/iwChat.h +++ b/libs/s25main/ingameWindows/iwChat.h @@ -18,7 +18,7 @@ class iwChat : public IngameWindow iwChat(Window* parent); private: - void Msg_PaintBefore() override; - void Msg_OptionGroupChange(unsigned ctrl_id, unsigned selection) override; - void Msg_EditEnter(unsigned ctrl_id) override; + void msgPaintBefore() override; + void msgOptionGroupChange(unsigned ctrl_id, unsigned selection) override; + void msgEditEnter(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwConnecting.cpp b/libs/s25main/ingameWindows/iwConnecting.cpp index a6de212b75..5c1898d4ab 100644 --- a/libs/s25main/ingameWindows/iwConnecting.cpp +++ b/libs/s25main/ingameWindows/iwConnecting.cpp @@ -46,7 +46,7 @@ void iwConnecting::Close() GAMECLIENT.RemoveInterface(this); } -void iwConnecting::Msg_ButtonClick(unsigned ctrlId) +void iwConnecting::msgButtonClick(unsigned ctrlId) { RTTR_Assert(ctrlId == ID_btAbort); GAMECLIENT.Stop(); diff --git a/libs/s25main/ingameWindows/iwConnecting.h b/libs/s25main/ingameWindows/iwConnecting.h index 7fb35e9a8f..36bc3fed74 100644 --- a/libs/s25main/ingameWindows/iwConnecting.h +++ b/libs/s25main/ingameWindows/iwConnecting.h @@ -23,7 +23,7 @@ class iwConnecting : public IngameWindow, public ClientInterface boost::signals2::signal onError; void Close() override; - void Msg_ButtonClick(unsigned ctrlId) override; + void msgButtonClick(unsigned ctrlId) override; private: ServerType serverType_; diff --git a/libs/s25main/ingameWindows/iwDemolishBuilding.cpp b/libs/s25main/ingameWindows/iwDemolishBuilding.cpp index f741d14d89..5ac736c7a8 100644 --- a/libs/s25main/ingameWindows/iwDemolishBuilding.cpp +++ b/libs/s25main/ingameWindows/iwDemolishBuilding.cpp @@ -33,7 +33,7 @@ iwDemolishBuilding::iwDemolishBuilding(GameWorldView& gwv, const noBaseBuilding* NormalFont); } -void iwDemolishBuilding::Msg_ButtonClick(const unsigned ctrl_id) +void iwDemolishBuilding::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwDemolishBuilding.h b/libs/s25main/ingameWindows/iwDemolishBuilding.h index aa61cbaf1d..8f8e35a99a 100644 --- a/libs/s25main/ingameWindows/iwDemolishBuilding.h +++ b/libs/s25main/ingameWindows/iwDemolishBuilding.h @@ -20,5 +20,5 @@ class iwDemolishBuilding : public IngameWindow iwDemolishBuilding(GameWorldView& gwv, const noBaseBuilding* building, bool flag = false); private: - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwDiplomacy.cpp b/libs/s25main/ingameWindows/iwDiplomacy.cpp index 6c085599ea..6b20a7ac5b 100644 --- a/libs/s25main/ingameWindows/iwDiplomacy.cpp +++ b/libs/s25main/ingameWindows/iwDiplomacy.cpp @@ -93,15 +93,15 @@ iwDiplomacy::iwDiplomacy(const GameWorldViewer& gwv, GameCommandFactory& gcFacto AddText(600 + i, remainingTimePos, "", COLOR_YELLOW, FontStyle::CENTER, SmallFont); } // Farben festlegen - Msg_PaintAfter(); + msgPaintAfter(); } -void iwDiplomacy::Msg_PaintBefore() +void iwDiplomacy::msgPaintBefore() { // Farben, die zu den 3 Bündnisstates gesetzt werden (0-kein Bündnis, 1-in Arbeit, 2-Bündnis abgeschlossen) constexpr helpers::EnumArray PACT_COLORS = {COLOR_RED, COLOR_YELLOW, COLOR_GREEN}; - IngameWindow::Msg_PaintBefore(); + IngameWindow::msgPaintBefore(); // Die farbigen Zeilen malen DrawPoint curPos = GetDrawPos() + DrawPoint(LINE_DISTANCE_TO_MARGINS, FIRST_LINE_Y); Rect curRect(curPos, Extent(GetSize().x - 2 * LINE_DISTANCE_TO_MARGINS, CELL_HEIGHT)); @@ -147,7 +147,7 @@ void iwDiplomacy::Msg_PaintBefore() } } -void iwDiplomacy::Msg_ButtonClick(const unsigned ctrl_id) +void iwDiplomacy::msgButtonClick(const unsigned ctrl_id) { if(gwv.GetWorld().GetGGS().lockedTeams) { @@ -240,7 +240,7 @@ iwSuggestPact::iwSuggestPact(const PactType pt, const GamePlayer& player, GameCo AddTextButton(7, DrawPoint(110, 170), Extent(100, 22), TextureColor::Green2, _("Confirm"), NormalFont); } -void iwSuggestPact::Msg_ButtonClick(const unsigned /*ctrl_id*/) +void iwSuggestPact::msgButtonClick(const unsigned /*ctrl_id*/) { /// Dauer auswählen (wenn id == NUM_DURATIONS, dann "für alle Ewigkeit" ausgewählt) const unsigned selected_id = GetCtrl(6)->GetSelection().value(); diff --git a/libs/s25main/ingameWindows/iwDiplomacy.h b/libs/s25main/ingameWindows/iwDiplomacy.h index 179af4d654..bcc1813f5e 100644 --- a/libs/s25main/ingameWindows/iwDiplomacy.h +++ b/libs/s25main/ingameWindows/iwDiplomacy.h @@ -20,8 +20,8 @@ class iwDiplomacy : public IngameWindow private: const GameWorldViewer& gwv; GameCommandFactory& gcFactory; - void Msg_PaintBefore() override; - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgPaintBefore() override; + void msgButtonClick(unsigned ctrl_id) override; }; /// Kleines Fenster, über das einem Spieler ein neues Bündnis angeboten werden kann @@ -34,5 +34,5 @@ class iwSuggestPact : public IngameWindow public: iwSuggestPact(PactType pt, const GamePlayer& player, GameCommandFactory& gcFactory); - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwDirectIPConnect.cpp b/libs/s25main/ingameWindows/iwDirectIPConnect.cpp index 2d375095fd..afc62a22af 100644 --- a/libs/s25main/ingameWindows/iwDirectIPConnect.cpp +++ b/libs/s25main/ingameWindows/iwDirectIPConnect.cpp @@ -69,13 +69,13 @@ iwDirectIPConnect::iwDirectIPConnect(ServerType serverType) port->SetText(SETTINGS.server.localPort); } -void iwDirectIPConnect::Msg_EditChange(const unsigned /*ctrl_id*/) +void iwDirectIPConnect::msgEditChange(const unsigned /*ctrl_id*/) { // Reset status SetStatus("", COLOR_RED); } -void iwDirectIPConnect::Msg_EditEnter(const unsigned ctrl_id) +void iwDirectIPConnect::msgEditEnter(const unsigned ctrl_id) { switch(ctrl_id) { @@ -85,7 +85,7 @@ void iwDirectIPConnect::Msg_EditEnter(const unsigned ctrl_id) } } -void iwDirectIPConnect::Msg_ButtonClick(const unsigned ctrl_id) +void iwDirectIPConnect::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -131,7 +131,7 @@ void iwDirectIPConnect::Msg_ButtonClick(const unsigned ctrl_id) } } -void iwDirectIPConnect::Msg_OptionGroupChange(const unsigned ctrl_id, const unsigned selection) +void iwDirectIPConnect::msgOptionGroupChange(const unsigned ctrl_id, const unsigned selection) { if(ctrl_id == ID_grpIpv6) SETTINGS.server.ipv6 = (selection == 1); @@ -155,5 +155,5 @@ void iwDirectIPConnect::Connect(const std::string& hostOrIp, const unsigned shor if(hasPwd) GetCtrl(ID_edtPw)->SetFocus(true); else - Msg_ButtonClick(ID_btConnect); + msgButtonClick(ID_btConnect); } diff --git a/libs/s25main/ingameWindows/iwDirectIPConnect.h b/libs/s25main/ingameWindows/iwDirectIPConnect.h index 46f6d3e75f..b0421c7137 100644 --- a/libs/s25main/ingameWindows/iwDirectIPConnect.h +++ b/libs/s25main/ingameWindows/iwDirectIPConnect.h @@ -22,8 +22,8 @@ class iwDirectIPConnect : public IngameWindow private: void SetStatus(const std::string& text, unsigned color); - void Msg_EditChange(unsigned ctrl_id) override; - void Msg_EditEnter(unsigned ctrl_id) override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_OptionGroupChange(unsigned ctrl_id, unsigned selection) override; + void msgEditChange(unsigned ctrl_id) override; + void msgEditEnter(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgOptionGroupChange(unsigned ctrl_id, unsigned selection) override; }; diff --git a/libs/s25main/ingameWindows/iwDirectIPCreate.cpp b/libs/s25main/ingameWindows/iwDirectIPCreate.cpp index fca0ab3713..870b9307e4 100644 --- a/libs/s25main/ingameWindows/iwDirectIPCreate.cpp +++ b/libs/s25main/ingameWindows/iwDirectIPCreate.cpp @@ -59,7 +59,7 @@ iwDirectIPCreate::iwDirectIPCreate(ServerType server_type) /** * Statustext resetten */ -void iwDirectIPCreate::Msg_EditChange(const unsigned /*ctrl_id*/) +void iwDirectIPCreate::msgEditChange(const unsigned /*ctrl_id*/) { // Statustext resetten SetText("", COLOR_RED, true); @@ -68,7 +68,7 @@ void iwDirectIPCreate::Msg_EditChange(const unsigned /*ctrl_id*/) /** * Bei Enter nächstes Steuerelement auswählen */ -void iwDirectIPCreate::Msg_EditEnter(const unsigned ctrl_id) +void iwDirectIPCreate::msgEditEnter(const unsigned ctrl_id) { auto* name = GetCtrl(1); auto* port = GetCtrl(3); @@ -93,13 +93,13 @@ void iwDirectIPCreate::Msg_EditEnter(const unsigned ctrl_id) case 5: { // Starten klicken - Msg_ButtonClick(7); + msgButtonClick(7); } break; } } -void iwDirectIPCreate::Msg_OptionGroupChange(const unsigned ctrl_id, const unsigned selection) +void iwDirectIPCreate::msgOptionGroupChange(const unsigned ctrl_id, const unsigned selection) { switch(ctrl_id) { @@ -114,7 +114,7 @@ void iwDirectIPCreate::Msg_OptionGroupChange(const unsigned ctrl_id, const unsig /** * Button Clicki-Di-Bunti-Li */ -void iwDirectIPCreate::Msg_ButtonClick(const unsigned ctrl_id) +void iwDirectIPCreate::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwDirectIPCreate.h b/libs/s25main/ingameWindows/iwDirectIPCreate.h index e9fc8c404d..fb17d0b05c 100644 --- a/libs/s25main/ingameWindows/iwDirectIPCreate.h +++ b/libs/s25main/ingameWindows/iwDirectIPCreate.h @@ -15,10 +15,10 @@ class iwDirectIPCreate : public IngameWindow void LC_Status_Error(const std::string& error); protected: - void Msg_EditChange(unsigned ctrl_id) override; - void Msg_EditEnter(unsigned ctrl_id) override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_OptionGroupChange(unsigned ctrl_id, unsigned selection) override; + void msgEditChange(unsigned ctrl_id) override; + void msgEditEnter(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgOptionGroupChange(unsigned ctrl_id, unsigned selection) override; private: void SetText(const std::string& text, unsigned color, bool button); diff --git a/libs/s25main/ingameWindows/iwDistribution.cpp b/libs/s25main/ingameWindows/iwDistribution.cpp index 41b11ba7b9..dd1dd560aa 100644 --- a/libs/s25main/ingameWindows/iwDistribution.cpp +++ b/libs/s25main/ingameWindows/iwDistribution.cpp @@ -106,8 +106,8 @@ void iwDistribution::TransmitSettings() } } -void iwDistribution::Msg_Group_ProgressChange(const unsigned /*group_id*/, const unsigned /*ctrl_id*/, - const unsigned short /*position*/) +void iwDistribution::msgGroupProgressChange(const unsigned /*group_id*/, const unsigned /*ctrl_id*/, + const unsigned short /*position*/) { settings_changed = true; } @@ -133,7 +133,7 @@ void iwDistribution::UpdateSettings() UpdateSettings(GAMECLIENT.visual_settings.distribution); } -void iwDistribution::Msg_ButtonClick(const unsigned ctrl_id) +void iwDistribution::msgButtonClick(const unsigned ctrl_id) { if(GAMECLIENT.IsReplayModeOn()) return; diff --git a/libs/s25main/ingameWindows/iwDistribution.h b/libs/s25main/ingameWindows/iwDistribution.h index 42bf5d7564..d2a416ef61 100644 --- a/libs/s25main/ingameWindows/iwDistribution.h +++ b/libs/s25main/ingameWindows/iwDistribution.h @@ -34,8 +34,8 @@ class iwDistribution final : public TransmitSettingsIgwAdapter /// Sendet veränderte Einstellungen (an den Client), falls sie verändert wurden void TransmitSettings() override; - void Msg_Group_ProgressChange(unsigned group_id, unsigned ctrl_id, unsigned short position) override; - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgGroupProgressChange(unsigned group_id, unsigned ctrl_id, unsigned short position) override; + void msgButtonClick(unsigned ctrl_id) override; /// Groups for the settings std::vector groups; diff --git a/libs/s25main/ingameWindows/iwEconomicProgress.cpp b/libs/s25main/ingameWindows/iwEconomicProgress.cpp index 5d3c714c05..1e0aa43659 100644 --- a/libs/s25main/ingameWindows/iwEconomicProgress.cpp +++ b/libs/s25main/ingameWindows/iwEconomicProgress.cpp @@ -126,7 +126,7 @@ void iwEconomicProgress::DrawContent() } } -void iwEconomicProgress::Msg_ButtonClick(const unsigned ctrl_id) +void iwEconomicProgress::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -143,9 +143,9 @@ void iwEconomicProgress::Msg_ButtonClick(const unsigned ctrl_id) } } -void iwEconomicProgress::Msg_PaintBefore() +void iwEconomicProgress::msgPaintBefore() { - IngameWindow::Msg_PaintBefore(); + IngameWindow::msgPaintBefore(); const GameWorldBase& world = gwv.GetWorld(); EconomyModeHandler* eH = world.getEconHandler(); diff --git a/libs/s25main/ingameWindows/iwEconomicProgress.h b/libs/s25main/ingameWindows/iwEconomicProgress.h index 8e328f1a34..03dfb38634 100644 --- a/libs/s25main/ingameWindows/iwEconomicProgress.h +++ b/libs/s25main/ingameWindows/iwEconomicProgress.h @@ -26,6 +26,6 @@ class iwEconomicProgress : public IngameWindow void DrawContent() override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_PaintBefore() override; + void msgButtonClick(unsigned ctrl_id) override; + void msgPaintBefore() override; }; diff --git a/libs/s25main/ingameWindows/iwEndgame.cpp b/libs/s25main/ingameWindows/iwEndgame.cpp index 9f8aedd15e..b9e4c2dc8a 100644 --- a/libs/s25main/ingameWindows/iwEndgame.cpp +++ b/libs/s25main/ingameWindows/iwEndgame.cpp @@ -21,7 +21,7 @@ iwEndgame::iwEndgame() AddImageButton(2, DrawPoint(160, 24), Extent(65, 57), TextureColor::Grey, LOADER.GetImageN("io", 47)); } -void iwEndgame::Msg_ButtonClick(const unsigned ctrl_id) +void iwEndgame::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwEndgame.h b/libs/s25main/ingameWindows/iwEndgame.h index 6101df7937..51369418f5 100644 --- a/libs/s25main/ingameWindows/iwEndgame.h +++ b/libs/s25main/ingameWindows/iwEndgame.h @@ -12,5 +12,5 @@ class iwEndgame : public IngameWindow iwEndgame(); private: - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwHQ.cpp b/libs/s25main/ingameWindows/iwHQ.cpp index 9a3d8c7d0a..fd6c632c83 100644 --- a/libs/s25main/ingameWindows/iwHQ.cpp +++ b/libs/s25main/ingameWindows/iwHQ.cpp @@ -42,7 +42,7 @@ iwHQ::iwHQ(GameWorldView& gwv, GameCommandFactory& gcFactory, nobBaseWarehouse* } } -void iwHQ::Msg_Group_ButtonClick(const unsigned group_id, const unsigned ctrl_id) +void iwHQ::msgGroupButtonClick(const unsigned group_id, const unsigned ctrl_id) { if(group_id == grpIdReserve) { @@ -70,5 +70,5 @@ void iwHQ::Msg_Group_ButtonClick(const unsigned group_id, const unsigned ctrl_id } // an Basis weiterleiten - iwBaseWarehouse::Msg_Group_ButtonClick(group_id, ctrl_id); + iwBaseWarehouse::msgGroupButtonClick(group_id, ctrl_id); } diff --git a/libs/s25main/ingameWindows/iwHQ.h b/libs/s25main/ingameWindows/iwHQ.h index feafa26c1d..1c439e58e0 100644 --- a/libs/s25main/ingameWindows/iwHQ.h +++ b/libs/s25main/ingameWindows/iwHQ.h @@ -15,6 +15,6 @@ class iwHQ : public iwBaseWarehouse iwHQ(GameWorldView& gwv, GameCommandFactory& gcFactory, nobBaseWarehouse* wh); protected: - void Msg_Group_ButtonClick(unsigned group_id, unsigned ctrl_id) override; + void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; unsigned grpIdReserve; }; diff --git a/libs/s25main/ingameWindows/iwHarborBuilding.cpp b/libs/s25main/ingameWindows/iwHarborBuilding.cpp index 5c570f94fa..da2154ee15 100644 --- a/libs/s25main/ingameWindows/iwHarborBuilding.cpp +++ b/libs/s25main/ingameWindows/iwHarborBuilding.cpp @@ -90,7 +90,7 @@ void iwHarborBuilding::AdjustExplorationExpeditionButton(bool flip) } } -void iwHarborBuilding::Msg_Group_ButtonClick(const unsigned group_id, const unsigned ctrl_id) +void iwHarborBuilding::msgGroupButtonClick(const unsigned group_id, const unsigned ctrl_id) { if(group_id == grpIdExpedition) // Hafengruppe? { @@ -112,5 +112,5 @@ void iwHarborBuilding::Msg_Group_ButtonClick(const unsigned group_id, const unsi } // an Basis weiterleiten - iwHQ::Msg_Group_ButtonClick(group_id, ctrl_id); + iwHQ::msgGroupButtonClick(group_id, ctrl_id); } diff --git a/libs/s25main/ingameWindows/iwHarborBuilding.h b/libs/s25main/ingameWindows/iwHarborBuilding.h index c6445f4c47..80d9247cff 100644 --- a/libs/s25main/ingameWindows/iwHarborBuilding.h +++ b/libs/s25main/ingameWindows/iwHarborBuilding.h @@ -15,7 +15,7 @@ class iwHarborBuilding : public iwHQ iwHarborBuilding(GameWorldView& gwv, GameCommandFactory& gcFactory, nobHarborBuilding* hb); protected: - void Msg_Group_ButtonClick(unsigned group_id, unsigned ctrl_id) override; + void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; private: void AdjustExpeditionButton(bool flip); diff --git a/libs/s25main/ingameWindows/iwLobbyConnect.cpp b/libs/s25main/ingameWindows/iwLobbyConnect.cpp index e8a468a23e..5af53528b7 100644 --- a/libs/s25main/ingameWindows/iwLobbyConnect.cpp +++ b/libs/s25main/ingameWindows/iwLobbyConnect.cpp @@ -129,13 +129,13 @@ void iwLobbyConnect::ReadFromEditAndSaveLobbyData(std::string& user, std::string SETTINGS.lobby.password.clear(); } -void iwLobbyConnect::Msg_EditChange(const unsigned /*ctrl_id*/) +void iwLobbyConnect::msgEditChange(const unsigned /*ctrl_id*/) { // Reset status text SetText("", COLOR_RED, true); } -void iwLobbyConnect::Msg_EditEnter(const unsigned ctrl_id) +void iwLobbyConnect::msgEditEnter(const unsigned ctrl_id) { auto* user = GetCtrl(ID_edtUser); auto* pass = GetCtrl(ID_edtPw); @@ -145,11 +145,11 @@ void iwLobbyConnect::Msg_EditEnter(const unsigned ctrl_id) user->SetFocus(false); pass->SetFocus(true); break; - case ID_edtPw: Msg_ButtonClick(ID_btConnect); break; + case ID_edtPw: msgButtonClick(ID_btConnect); break; } } -void iwLobbyConnect::Msg_ButtonClick(const unsigned ctrl_id) +void iwLobbyConnect::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -179,7 +179,7 @@ void iwLobbyConnect::Msg_ButtonClick(const unsigned ctrl_id) } } -void iwLobbyConnect::Msg_OptionGroupChange(const unsigned ctrl_id, const unsigned selection) +void iwLobbyConnect::msgOptionGroupChange(const unsigned ctrl_id, const unsigned selection) { switch(ctrl_id) { @@ -190,7 +190,7 @@ void iwLobbyConnect::Msg_OptionGroupChange(const unsigned ctrl_id, const unsigne } } -bool iwLobbyConnect::Msg_KeyDown(const KeyEvent& ev) +bool iwLobbyConnect::msgKeyDown(const KeyEvent& ev) { if(ev.kt != KeyType::Tab) return false; diff --git a/libs/s25main/ingameWindows/iwLobbyConnect.h b/libs/s25main/ingameWindows/iwLobbyConnect.h index 43d6ee07d6..fee82c5699 100644 --- a/libs/s25main/ingameWindows/iwLobbyConnect.h +++ b/libs/s25main/ingameWindows/iwLobbyConnect.h @@ -19,11 +19,11 @@ class iwLobbyConnect : public IngameWindow, public LobbyInterface void LC_Status_Error(const std::string& error) override; protected: - void Msg_EditChange(unsigned ctrl_id) override; - void Msg_EditEnter(unsigned ctrl_id) override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_OptionGroupChange(unsigned ctrl_id, unsigned selection) override; - bool Msg_KeyDown(const KeyEvent&) override; + void msgEditChange(unsigned ctrl_id) override; + void msgEditEnter(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgOptionGroupChange(unsigned ctrl_id, unsigned selection) override; + bool msgKeyDown(const KeyEvent&) override; private: void SetText(const std::string& text, unsigned color, bool button); diff --git a/libs/s25main/ingameWindows/iwLobbyServerInfo.cpp b/libs/s25main/ingameWindows/iwLobbyServerInfo.cpp index 058762b4e1..ac9b5904ef 100644 --- a/libs/s25main/ingameWindows/iwLobbyServerInfo.cpp +++ b/libs/s25main/ingameWindows/iwLobbyServerInfo.cpp @@ -44,7 +44,7 @@ iwLobbyServerInfo::iwLobbyServerInfo(unsigned serverId) AddTimer(9, 5s); } -void iwLobbyServerInfo::Msg_Timer(const unsigned ctrl_id) +void iwLobbyServerInfo::msgTimer(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwLobbyServerInfo.h b/libs/s25main/ingameWindows/iwLobbyServerInfo.h index fa56ef0212..ef656acfa2 100644 --- a/libs/s25main/ingameWindows/iwLobbyServerInfo.h +++ b/libs/s25main/ingameWindows/iwLobbyServerInfo.h @@ -19,5 +19,5 @@ class iwLobbyServerInfo : public IngameWindow void UpdateServerInfo(); protected: - void Msg_Timer(unsigned ctrl_id) override; + void msgTimer(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwMainMenu.cpp b/libs/s25main/ingameWindows/iwMainMenu.cpp index edc71c4c2a..6a63066695 100644 --- a/libs/s25main/ingameWindows/iwMainMenu.cpp +++ b/libs/s25main/ingameWindows/iwMainMenu.cpp @@ -102,7 +102,7 @@ iwMainMenu::iwMainMenu(GameWorldView& gwv, GameCommandFactory& gcFactory) /** * Button-Click-Handler. */ -void iwMainMenu::Msg_ButtonClick(const unsigned ctrl_id) +void iwMainMenu::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwMainMenu.h b/libs/s25main/ingameWindows/iwMainMenu.h index a2405f5265..086ea6f069 100644 --- a/libs/s25main/ingameWindows/iwMainMenu.h +++ b/libs/s25main/ingameWindows/iwMainMenu.h @@ -18,5 +18,5 @@ class iwMainMenu : public IngameWindow GameWorldView& gwv; GameCommandFactory& gcFactory; - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwMapDebug.cpp b/libs/s25main/ingameWindows/iwMapDebug.cpp index 4cb4d65112..80cb63189f 100644 --- a/libs/s25main/ingameWindows/iwMapDebug.cpp +++ b/libs/s25main/ingameWindows/iwMapDebug.cpp @@ -225,7 +225,7 @@ iwMapDebug::~iwMapDebug() gwv.RemoveDrawNodeCallback(printer.get()); } -void iwMapDebug::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned select) +void iwMapDebug::msgComboSelectItem(const unsigned ctrl_id, const unsigned select) { if(ctrl_id == ID_cbShowWhat) printer->showDataIdx = select; @@ -245,19 +245,19 @@ void iwMapDebug::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned sele } } -void iwMapDebug::Msg_CheckboxChange(const unsigned ctrl_id, const bool checked) +void iwMapDebug::msgCheckboxChange(const unsigned ctrl_id, const bool checked) { if(ctrl_id == ID_cbShowCoordinates) printer->showCoords = checked; } -void iwMapDebug::Msg_Timer(unsigned /*ctrl_id*/) +void iwMapDebug::msgTimer(unsigned /*ctrl_id*/) { if(eventChecker) eventChecker->check(); } -void iwMapDebug::Msg_EditEnter(unsigned ctrl_id) +void iwMapDebug::msgEditEnter(unsigned ctrl_id) { RTTR_Assert(ctrl_id == ID_edtJumpX || ctrl_id == ID_edtJumpY); Position pos; @@ -268,11 +268,11 @@ void iwMapDebug::Msg_EditEnter(unsigned ctrl_id) } } -bool iwMapDebug::Msg_KeyDown(const KeyEvent& ke) +bool iwMapDebug::msgKeyDown(const KeyEvent& ke) { switch(ke.kt) { - case KeyType::Return: Msg_EditEnter(ID_edtJumpY); break; + case KeyType::Return: msgEditEnter(ID_edtJumpY); break; case KeyType::Tab: { auto* edtNewFocus = GetCtrl(ID_edtJumpX); @@ -282,7 +282,7 @@ bool iwMapDebug::Msg_KeyDown(const KeyEvent& ke) edtNewFocus->SetText(""); }; break; - default: return IngameWindow::Msg_KeyDown(ke); + default: return IngameWindow::msgKeyDown(ke); } return true; } diff --git a/libs/s25main/ingameWindows/iwMapDebug.h b/libs/s25main/ingameWindows/iwMapDebug.h index 8ae2f275af..3a6a2e10a9 100644 --- a/libs/s25main/ingameWindows/iwMapDebug.h +++ b/libs/s25main/ingameWindows/iwMapDebug.h @@ -19,11 +19,11 @@ class iwMapDebug : public IngameWindow class DebugPrinter; class EventChecker; - void Msg_ComboSelectItem(unsigned ctrl_id, unsigned select) override; - void Msg_CheckboxChange(unsigned ctrl_id, bool checked) override; - void Msg_Timer(unsigned ctrl_id) override; - void Msg_EditEnter(unsigned ctrl_id) override; - bool Msg_KeyDown(const KeyEvent& ke) override; + void msgComboSelectItem(unsigned ctrl_id, unsigned select) override; + void msgCheckboxChange(unsigned ctrl_id, bool checked) override; + void msgTimer(unsigned ctrl_id) override; + void msgEditEnter(unsigned ctrl_id) override; + bool msgKeyDown(const KeyEvent& ke) override; void SetActive(bool activate) override; diff --git a/libs/s25main/ingameWindows/iwMapGenerator.cpp b/libs/s25main/ingameWindows/iwMapGenerator.cpp index 506800d66a..944ceae7aa 100644 --- a/libs/s25main/ingameWindows/iwMapGenerator.cpp +++ b/libs/s25main/ingameWindows/iwMapGenerator.cpp @@ -119,7 +119,7 @@ iwMapGenerator::iwMapGenerator(MapSettings& settings) Reset(); } -void iwMapGenerator::Msg_ButtonClick(const unsigned ctrl_id) +void iwMapGenerator::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwMapGenerator.h b/libs/s25main/ingameWindows/iwMapGenerator.h index 6297e5ed58..a1b29c3bae 100644 --- a/libs/s25main/ingameWindows/iwMapGenerator.h +++ b/libs/s25main/ingameWindows/iwMapGenerator.h @@ -50,7 +50,7 @@ class iwMapGenerator : public IngameWindow */ iwMapGenerator(rttr::mapGenerator::MapSettings& settings); - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; private: rttr::mapGenerator::MapSettings& mapSettings; diff --git a/libs/s25main/ingameWindows/iwMerchandiseStatistics.cpp b/libs/s25main/ingameWindows/iwMerchandiseStatistics.cpp index e92e0fd074..54d78a2145 100644 --- a/libs/s25main/ingameWindows/iwMerchandiseStatistics.cpp +++ b/libs/s25main/ingameWindows/iwMerchandiseStatistics.cpp @@ -103,7 +103,7 @@ iwMerchandiseStatistics::iwMerchandiseStatistics(const GamePlayer& player) iwMerchandiseStatistics::~iwMerchandiseStatistics() = default; -void iwMerchandiseStatistics::Msg_ButtonClick(const unsigned ctrl_id) +void iwMerchandiseStatistics::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -126,7 +126,7 @@ void iwMerchandiseStatistics::Msg_ButtonClick(const unsigned ctrl_id) } } -void iwMerchandiseStatistics::Msg_OptionGroupChange(const unsigned ctrl_id, const unsigned selection) +void iwMerchandiseStatistics::msgOptionGroupChange(const unsigned ctrl_id, const unsigned selection) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwMerchandiseStatistics.h b/libs/s25main/ingameWindows/iwMerchandiseStatistics.h index 7258f51981..fe7403e0eb 100644 --- a/libs/s25main/ingameWindows/iwMerchandiseStatistics.h +++ b/libs/s25main/ingameWindows/iwMerchandiseStatistics.h @@ -40,6 +40,6 @@ class iwMerchandiseStatistics : public IngameWindow void DrawContent() override; // Durchgereichte Methoden vom Window - void Msg_OptionGroupChange(unsigned ctrl_id, unsigned selection) override; - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgOptionGroupChange(unsigned ctrl_id, unsigned selection) override; + void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwMilitary.cpp b/libs/s25main/ingameWindows/iwMilitary.cpp index 3b31b6172f..4cc2a4e991 100644 --- a/libs/s25main/ingameWindows/iwMilitary.cpp +++ b/libs/s25main/ingameWindows/iwMilitary.cpp @@ -97,7 +97,7 @@ void iwMilitary::TransmitSettings() } } -void iwMilitary::Msg_ProgressChange(const unsigned /*ctrl_id*/, const unsigned short /*position*/) +void iwMilitary::msgProgressChange(const unsigned /*ctrl_id*/, const unsigned short /*position*/) { settings_changed = true; } @@ -115,7 +115,7 @@ void iwMilitary::UpdateSettings() UpdateSettings(GAMECLIENT.visual_settings.military_settings); } -void iwMilitary::Msg_ButtonClick(const unsigned ctrl_id) +void iwMilitary::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwMilitary.h b/libs/s25main/ingameWindows/iwMilitary.h index 243867e643..af171785fa 100644 --- a/libs/s25main/ingameWindows/iwMilitary.h +++ b/libs/s25main/ingameWindows/iwMilitary.h @@ -25,6 +25,6 @@ class iwMilitary final : public TransmitSettingsIgwAdapter /// Send changed values to client, if any have changed void TransmitSettings() override; - void Msg_ProgressChange(unsigned ctrl_id, unsigned short position) override; - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgProgressChange(unsigned ctrl_id, unsigned short position) override; + void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwMilitaryBuilding.cpp b/libs/s25main/ingameWindows/iwMilitaryBuilding.cpp index ca81cfae30..a804cd8e62 100644 --- a/libs/s25main/ingameWindows/iwMilitaryBuilding.cpp +++ b/libs/s25main/ingameWindows/iwMilitaryBuilding.cpp @@ -226,7 +226,7 @@ void iwMilitaryBuilding::DrawContent() } } -void iwMilitaryBuilding::Msg_ButtonClick(const unsigned ctrl_id) +void iwMilitaryBuilding::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwMilitaryBuilding.h b/libs/s25main/ingameWindows/iwMilitaryBuilding.h index dccbeec694..c770321464 100644 --- a/libs/s25main/ingameWindows/iwMilitaryBuilding.h +++ b/libs/s25main/ingameWindows/iwMilitaryBuilding.h @@ -26,5 +26,5 @@ class iwMilitaryBuilding : public IngameWindow private: void DrawContent() override; - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwMinimap.cpp b/libs/s25main/ingameWindows/iwMinimap.cpp index e6dd5a39f2..4b9caa02e8 100644 --- a/libs/s25main/ingameWindows/iwMinimap.cpp +++ b/libs/s25main/ingameWindows/iwMinimap.cpp @@ -78,7 +78,7 @@ void iwMinimap::Resize(const Extent& newSize) GetCtrl(4)->SetImage(LOADER.GetTextureN("io", extended ? 108 : 109)); } -void iwMinimap::Msg_ButtonClick(const unsigned ctrl_id) +void iwMinimap::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwMinimap.h b/libs/s25main/ingameWindows/iwMinimap.h index 54b0a2e0eb..d46af3a468 100644 --- a/libs/s25main/ingameWindows/iwMinimap.h +++ b/libs/s25main/ingameWindows/iwMinimap.h @@ -16,7 +16,7 @@ class iwMinimap final : public IngameWindow bool extended; private: - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; public: iwMinimap(IngameMinimap& minimap, GameWorldView& gwv); diff --git a/libs/s25main/ingameWindows/iwMissionStatement.cpp b/libs/s25main/ingameWindows/iwMissionStatement.cpp index 18cb0414a5..91db5d548f 100644 --- a/libs/s25main/ingameWindows/iwMissionStatement.cpp +++ b/libs/s25main/ingameWindows/iwMissionStatement.cpp @@ -49,7 +49,7 @@ iwMissionStatement::iwMissionStatement(const std::string& title, const std::stri } } -void iwMissionStatement::Msg_ButtonClick(const unsigned /*ctrl_id*/) +void iwMissionStatement::msgButtonClick(const unsigned /*ctrl_id*/) { if(pauseGame_ && GAMECLIENT.GetState() != ClientState::Stopped) GAMECLIENT.SetPause(false); diff --git a/libs/s25main/ingameWindows/iwMissionStatement.h b/libs/s25main/ingameWindows/iwMissionStatement.h index b08d97eff9..db08a407ec 100644 --- a/libs/s25main/ingameWindows/iwMissionStatement.h +++ b/libs/s25main/ingameWindows/iwMissionStatement.h @@ -38,7 +38,7 @@ class iwMissionStatement : public IngameWindow }; iwMissionStatement(const std::string& title, const std::string& content, bool pauseGame, HelpImage image = IM_SWORDSMAN); - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; void SetActive(bool activate) override; private: diff --git a/libs/s25main/ingameWindows/iwMsgbox.cpp b/libs/s25main/ingameWindows/iwMsgbox.cpp index 927b6fae07..3458c64a30 100644 --- a/libs/s25main/ingameWindows/iwMsgbox.cpp +++ b/libs/s25main/ingameWindows/iwMsgbox.cpp @@ -158,10 +158,10 @@ constexpr helpers::EnumArray, MsgboxButton> RET_IDS {MsgboxResult::Yes, MsgboxResult::No}, {MsgboxResult::Yes, MsgboxResult::No, MsgboxResult::Cancel}}}; -void iwMsgbox::Msg_ButtonClick(const unsigned ctrl_id) +void iwMsgbox::msgButtonClick(const unsigned ctrl_id) { if(msgHandler_) - msgHandler_->Msg_MsgBoxResult(msgboxid, RET_IDS[button][ctrl_id - ID_BT_0]); + msgHandler_->msgMsgBoxResult(msgboxid, RET_IDS[button][ctrl_id - ID_BT_0]); Close(); } diff --git a/libs/s25main/ingameWindows/iwMsgbox.h b/libs/s25main/ingameWindows/iwMsgbox.h index 53dd37e8bd..4ea37e115e 100644 --- a/libs/s25main/ingameWindows/iwMsgbox.h +++ b/libs/s25main/ingameWindows/iwMsgbox.h @@ -36,5 +36,5 @@ class iwMsgbox : public IngameWindow void AddButton(unsigned short id, int x, const std::string& text, TextureColor tc); - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwMusicPlayer.cpp b/libs/s25main/ingameWindows/iwMusicPlayer.cpp index dc36e944bf..992a650dda 100644 --- a/libs/s25main/ingameWindows/iwMusicPlayer.cpp +++ b/libs/s25main/ingameWindows/iwMusicPlayer.cpp @@ -65,17 +65,17 @@ iwMusicPlayer::InputWindow::InputWindow(iwMusicPlayer& playerWnd, const unsigned AddTextButton(ID_btAbort, DrawPoint(130, 60), Extent(100, 22), TextureColor::Red1, _("Abort"), NormalFont); } -void iwMusicPlayer::InputWindow::Msg_ButtonClick(const unsigned ctrl_id) +void iwMusicPlayer::InputWindow::msgButtonClick(const unsigned ctrl_id) { if(ctrl_id == ID_btOk) - playerWnd_.Msg_Input(win_id, GetCtrl(ID_edtName)->GetText()); + playerWnd_.msgInput(win_id, GetCtrl(ID_edtName)->GetText()); Close(); } -void iwMusicPlayer::InputWindow::Msg_EditEnter(const unsigned /*ctrl_id*/) +void iwMusicPlayer::InputWindow::msgEditEnter(const unsigned /*ctrl_id*/) { - Msg_ButtonClick(ID_btOk); + msgButtonClick(ID_btOk); } iwMusicPlayer::iwMusicPlayer() @@ -124,7 +124,7 @@ iwMusicPlayer::iwMusicPlayer() if(!cbPlayList->GetSelection() && cbPlayList->GetNumItems() > 0u) { cbPlayList->SetSelection(0u); - Msg_ComboSelectItem(ID_cbPlaylist, 0u); + msgComboSelectItem(ID_cbPlaylist, 0u); } } @@ -157,7 +157,7 @@ void iwMusicPlayer::Close() } } -void iwMusicPlayer::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned selection) +void iwMusicPlayer::msgComboSelectItem(const unsigned ctrl_id, const unsigned selection) { RTTR_Assert(ctrl_id == ID_cbPlaylist); Playlist pl; @@ -174,7 +174,7 @@ void iwMusicPlayer::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned s UpdateSaveChangeButtonsState(); } -void iwMusicPlayer::Msg_ListChooseItem(const unsigned /*ctrl_id*/, const unsigned selection) +void iwMusicPlayer::msgListChooseItem(const unsigned /*ctrl_id*/, const unsigned selection) { // (Re)create playlist with selected song as start song set in musicplayer Playlist pl = MakePlaylist(); @@ -252,7 +252,7 @@ Playlist iwMusicPlayer::MakePlaylist() return Playlist(std::move(songs), GetRepeats(), GetRandomPlayback()); } -void iwMusicPlayer::Msg_ButtonClick(const unsigned ctrl_id) +void iwMusicPlayer::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -349,7 +349,7 @@ void iwMusicPlayer::Msg_ButtonClick(const unsigned ctrl_id) } } -void iwMusicPlayer::Msg_Input(const unsigned win_id, const std::string& msg) +void iwMusicPlayer::msgInput(const unsigned win_id, const std::string& msg) { switch(win_id) { diff --git a/libs/s25main/ingameWindows/iwMusicPlayer.h b/libs/s25main/ingameWindows/iwMusicPlayer.h index b9022a7104..88f279d648 100644 --- a/libs/s25main/ingameWindows/iwMusicPlayer.h +++ b/libs/s25main/ingameWindows/iwMusicPlayer.h @@ -21,8 +21,8 @@ class iwMusicPlayer final : public IngameWindow public: InputWindow(iwMusicPlayer& playerWnd, unsigned win_id, const std::string& title); - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_EditEnter(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgEditEnter(unsigned ctrl_id) override; }; /// Set to true if anything changed to (re)start music on close @@ -50,9 +50,9 @@ class iwMusicPlayer final : public IngameWindow void UpdateSaveChangeButtonsState(); Playlist MakePlaylist(); - void Msg_ListChooseItem(unsigned ctrl_id, unsigned selection) override; - void Msg_ComboSelectItem(unsigned ctrl_id, unsigned selection) override; - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgListChooseItem(unsigned ctrl_id, unsigned selection) override; + void msgComboSelectItem(unsigned ctrl_id, unsigned selection) override; + void msgButtonClick(unsigned ctrl_id) override; - void Msg_Input(unsigned win_id, const std::string& msg); + void msgInput(unsigned win_id, const std::string& msg); }; diff --git a/libs/s25main/ingameWindows/iwObservate.cpp b/libs/s25main/ingameWindows/iwObservate.cpp index db747b6ffc..6c4da67d51 100644 --- a/libs/s25main/ingameWindows/iwObservate.cpp +++ b/libs/s25main/ingameWindows/iwObservate.cpp @@ -65,7 +65,7 @@ iwObservate::iwObservate(GameWorldView& gwv, const MapPoint selectedPt) AddTimer(ID_tmrUpdateFollow, 1s)->Stop(); } -void iwObservate::Msg_ButtonClick(const unsigned ctrl_id) +void iwObservate::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -165,7 +165,7 @@ void iwObservate::Msg_ButtonClick(const unsigned ctrl_id) } } -void iwObservate::Msg_Timer(const unsigned ctrl_id) +void iwObservate::msgTimer(const unsigned ctrl_id) { switch(ctrl_id) { @@ -242,7 +242,7 @@ bool iwObservate::MoveToFollowedObj(const MapPoint ptToCheck) return false; } -bool iwObservate::Msg_MouseMove(const MouseCoords& mc) +bool iwObservate::msgMouseMove(const MouseCoords& mc) { if(isScrolling) { @@ -255,10 +255,10 @@ bool iwObservate::Msg_MouseMove(const MouseCoords& mc) VIDEODRIVER.SetMousePos(scrollOrigin); return true; } else - return IngameWindow::Msg_MouseMove(mc); + return IngameWindow::msgMouseMove(mc); } -bool iwObservate::Msg_RightDown(const MouseCoords& mc) +bool iwObservate::msgRightDown(const MouseCoords& mc) { if(IsPointInRect(mc.pos, Rect(view->GetPos(), view->GetSize())) && !IsPointInRect(mc.pos, GetCtrl(1)->GetDrawRect()) @@ -279,7 +279,7 @@ bool iwObservate::Msg_RightDown(const MouseCoords& mc) return true; } -bool iwObservate::Msg_RightUp(const MouseCoords& /*mc*/) +bool iwObservate::msgRightUp(const MouseCoords& /*mc*/) { if(isScrolling) WINDOWMANAGER.SetCursor(Cursor::Hand); diff --git a/libs/s25main/ingameWindows/iwObservate.h b/libs/s25main/ingameWindows/iwObservate.h index 780b382701..c5dd0bb56c 100644 --- a/libs/s25main/ingameWindows/iwObservate.h +++ b/libs/s25main/ingameWindows/iwObservate.h @@ -38,11 +38,11 @@ class iwObservate : public IngameWindow private: void DrawBackground() override; - void Msg_ButtonClick(unsigned ctrl_id) override; - bool Msg_MouseMove(const MouseCoords& mc) override; - bool Msg_RightDown(const MouseCoords& mc) override; - bool Msg_RightUp(const MouseCoords& mc) override; - void Msg_Timer(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; + bool msgMouseMove(const MouseCoords& mc) override; + bool msgRightDown(const MouseCoords& mc) override; + bool msgRightUp(const MouseCoords& mc) override; + void msgTimer(unsigned ctrl_id) override; /// Move view to the object we currently follow, return true if it can still be found bool MoveToFollowedObj(); bool MoveToFollowedObj(MapPoint ptToCheck); diff --git a/libs/s25main/ingameWindows/iwOptionsWindow.cpp b/libs/s25main/ingameWindows/iwOptionsWindow.cpp index b7644d6e81..cab7621c11 100644 --- a/libs/s25main/ingameWindows/iwOptionsWindow.cpp +++ b/libs/s25main/ingameWindows/iwOptionsWindow.cpp @@ -141,7 +141,7 @@ iwOptionsWindow::iwOptionsWindow(SoundManager& soundManager) AddTextButton(ID_btEndGame, curPos, optionSizeBig, TextureColor::Red1, _("End game"), NormalFont); } -void iwOptionsWindow::Msg_ButtonClick(const unsigned ctrl_id) +void iwOptionsWindow::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -185,7 +185,7 @@ void iwOptionsWindow::Msg_ButtonClick(const unsigned ctrl_id) } } -void iwOptionsWindow::Msg_ProgressChange(const unsigned ctrl_id, const unsigned short position) +void iwOptionsWindow::msgProgressChange(const unsigned ctrl_id, const unsigned short position) { switch(ctrl_id) { @@ -200,7 +200,7 @@ void iwOptionsWindow::Msg_ProgressChange(const unsigned ctrl_id, const unsigned } } -void iwOptionsWindow::Msg_CheckboxChange(const unsigned ctrl_id, const bool checked) +void iwOptionsWindow::msgCheckboxChange(const unsigned ctrl_id, const bool checked) { RTTR_Assert(ctrl_id == ID_cpBirdSounds); SETTINGS.sound.birdsEnabled = checked; diff --git a/libs/s25main/ingameWindows/iwOptionsWindow.h b/libs/s25main/ingameWindows/iwOptionsWindow.h index 6671da7e79..cbd709298a 100644 --- a/libs/s25main/ingameWindows/iwOptionsWindow.h +++ b/libs/s25main/ingameWindows/iwOptionsWindow.h @@ -16,7 +16,7 @@ class iwOptionsWindow : public IngameWindow iwOptionsWindow(SoundManager& soundManager); private: - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_ProgressChange(unsigned ctrl_id, unsigned short position) override; - void Msg_CheckboxChange(unsigned ctrl_id, bool checked) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgProgressChange(unsigned ctrl_id, unsigned short position) override; + void msgCheckboxChange(unsigned ctrl_id, bool checked) override; }; diff --git a/libs/s25main/ingameWindows/iwPlayReplay.cpp b/libs/s25main/ingameWindows/iwPlayReplay.cpp index 3e689d03c3..90d2d08c90 100644 --- a/libs/s25main/ingameWindows/iwPlayReplay.cpp +++ b/libs/s25main/ingameWindows/iwPlayReplay.cpp @@ -135,7 +135,7 @@ void iwPlayReplay::PopulateTable() loadedOnce = true; } -void iwPlayReplay::Msg_ButtonClick(const unsigned ctrl_id) +void iwPlayReplay::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -162,7 +162,7 @@ void iwPlayReplay::Msg_ButtonClick(const unsigned ctrl_id) } } -void iwPlayReplay::Msg_TableChooseItem(const unsigned /*ctrl_id*/, const unsigned /*selection*/) +void iwPlayReplay::msgTableChooseItem(const unsigned /*ctrl_id*/, const unsigned /*selection*/) { StartReplay(); } @@ -184,7 +184,7 @@ void iwPlayReplay::StartReplay() } } -void iwPlayReplay::Msg_MsgBoxResult(const unsigned msgbox_id, const MsgboxResult mbr) +void iwPlayReplay::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult mbr) { // Sollen alle Replays gelöscht werden? if(msgbox_id == 1 && mbr == MsgboxResult::Yes) diff --git a/libs/s25main/ingameWindows/iwPlayReplay.h b/libs/s25main/ingameWindows/iwPlayReplay.h index 74ca0e86b3..2e56d53a06 100644 --- a/libs/s25main/ingameWindows/iwPlayReplay.h +++ b/libs/s25main/ingameWindows/iwPlayReplay.h @@ -12,9 +12,9 @@ class iwPlayReplay : public IngameWindow public: iwPlayReplay(); - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_MsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; - void Msg_TableChooseItem(unsigned ctrl_id, unsigned selection) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; + void msgTableChooseItem(unsigned ctrl_id, unsigned selection) override; private: void PopulateTable(); diff --git a/libs/s25main/ingameWindows/iwPostWindow.cpp b/libs/s25main/ingameWindows/iwPostWindow.cpp index 3df0d500c0..22b4cfd040 100644 --- a/libs/s25main/ingameWindows/iwPostWindow.cpp +++ b/libs/s25main/ingameWindows/iwPostWindow.cpp @@ -109,7 +109,7 @@ iwPostWindow::iwPostWindow(GameWorldView& gwv, PostBox& postBox) DisplayPostMessage(); } -void iwPostWindow::Msg_ButtonClick(const unsigned ctrl_id) +void iwPostWindow::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -209,9 +209,9 @@ void iwPostWindow::Msg_ButtonClick(const unsigned ctrl_id) } } -void iwPostWindow::Msg_PaintBefore() +void iwPostWindow::msgPaintBefore() { - IngameWindow::Msg_PaintBefore(); + IngameWindow::msgPaintBefore(); ValidateMessages(); if(lastHasMissionGoal != !postBox.GetCurrentMissionGoal().empty()) { @@ -223,7 +223,7 @@ void iwPostWindow::Msg_PaintBefore() /** * React on keypress */ -bool iwPostWindow::Msg_KeyDown(const KeyEvent& ke) +bool iwPostWindow::msgKeyDown(const KeyEvent& ke) { switch(ke.kt) { @@ -232,20 +232,20 @@ bool iwPostWindow::Msg_KeyDown(const KeyEvent& ke) #ifdef __APPLE__ case KeyType::Backspace: // Macs usually have no delete key on small keyboards, so backspace is more convenient #endif - Msg_ButtonClick(ID_DELETE); + msgButtonClick(ID_DELETE); return true; } switch(ke.c) { case '+': // Next message - Msg_ButtonClick(ID_GO_FWD); + msgButtonClick(ID_GO_FWD); return true; case '-': // Previous message - Msg_ButtonClick(ID_GO_BACK); + msgButtonClick(ID_GO_BACK); return true; case 'g': // Go to site of event - Msg_ButtonClick(ID_GOTO); + msgButtonClick(ID_GOTO); return true; } diff --git a/libs/s25main/ingameWindows/iwPostWindow.h b/libs/s25main/ingameWindows/iwPostWindow.h index 45b10f0a0e..98eb85d8ab 100644 --- a/libs/s25main/ingameWindows/iwPostWindow.h +++ b/libs/s25main/ingameWindows/iwPostWindow.h @@ -17,9 +17,9 @@ class iwPostWindow : public IngameWindow { public: iwPostWindow(GameWorldView& gwv, PostBox& postBox); - void Msg_PaintBefore() override; - void Msg_ButtonClick(unsigned ctrl_id) override; - bool Msg_KeyDown(const KeyEvent& ke) override; + void msgPaintBefore() override; + void msgButtonClick(unsigned ctrl_id) override; + bool msgKeyDown(const KeyEvent& ke) override; private: GameWorldView& gwv; diff --git a/libs/s25main/ingameWindows/iwRoadWindow.cpp b/libs/s25main/ingameWindows/iwRoadWindow.cpp index 5b29eadb82..69d1eed1e7 100644 --- a/libs/s25main/ingameWindows/iwRoadWindow.cpp +++ b/libs/s25main/ingameWindows/iwRoadWindow.cpp @@ -32,7 +32,7 @@ iwRoadWindow::iwRoadWindow(GameInterface& gi, bool flagpossible, const Position& VIDEODRIVER.SetMousePos(defaultBt->GetDrawPos() + DrawPoint(defaultBt->GetSize()) / 2); } -void iwRoadWindow::Msg_ButtonClick(const unsigned ctrl_id) +void iwRoadWindow::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwRoadWindow.h b/libs/s25main/ingameWindows/iwRoadWindow.h index dfd5dd89c2..3bbc800219 100644 --- a/libs/s25main/ingameWindows/iwRoadWindow.h +++ b/libs/s25main/ingameWindows/iwRoadWindow.h @@ -18,5 +18,5 @@ class iwRoadWindow : public IngameWindow iwRoadWindow(GameInterface& gi, bool flagpossible, const Position& mousePos); private: - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwSave.cpp b/libs/s25main/ingameWindows/iwSave.cpp index 5889011e2e..a59646f5b3 100644 --- a/libs/s25main/ingameWindows/iwSave.cpp +++ b/libs/s25main/ingameWindows/iwSave.cpp @@ -66,18 +66,18 @@ iwSaveLoad::iwSaveLoad(const std::string& window_title, ITexture* btImg, const u RefreshTable(); } -void iwSaveLoad::Msg_EditEnter(const unsigned /*ctrl_id*/) +void iwSaveLoad::msgEditEnter(const unsigned /*ctrl_id*/) { SaveLoad(); } -void iwSaveLoad::Msg_ButtonClick(const unsigned ctrl_id) +void iwSaveLoad::msgButtonClick(const unsigned ctrl_id) { RTTR_Assert(ctrl_id == ID_btSaveOrLoad); SaveLoad(); } -void iwSaveLoad::Msg_TableSelectItem(const unsigned /*ctrl_id*/, const std::optional& selection) +void iwSaveLoad::msgTableSelectItem(const unsigned /*ctrl_id*/, const std::optional& selection) { // On selecting a table entry put the filename into the edit control GetCtrl(ID_edtFilename) @@ -177,7 +177,7 @@ iwSave::iwSave() : iwSaveLoad(_("Save game!"), LOADER.GetTextureN("io", 47), 30) } } -void iwSave::Msg_ComboSelectItem(const unsigned /*ctrl_id*/, const unsigned selection) +void iwSave::msgComboSelectItem(const unsigned /*ctrl_id*/, const unsigned selection) { if(selection == 0) // First entry is "disabled" SETTINGS.interface.autosaveInterval = 0; @@ -215,7 +215,7 @@ void iwLoad::SaveLoad() } /// Handle double click on the table -void iwLoad::Msg_TableChooseItem(const unsigned /*ctrl_id*/, const unsigned /*selection*/) +void iwLoad::msgTableChooseItem(const unsigned /*ctrl_id*/, const unsigned /*selection*/) { SaveLoad(); } diff --git a/libs/s25main/ingameWindows/iwSave.h b/libs/s25main/ingameWindows/iwSave.h index d330fc5323..10f56e542d 100644 --- a/libs/s25main/ingameWindows/iwSave.h +++ b/libs/s25main/ingameWindows/iwSave.h @@ -22,9 +22,9 @@ class iwSaveLoad : public IngameWindow /// Save or load the currently selected file virtual void SaveLoad() = 0; - void Msg_EditEnter(unsigned ctrl_id) override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_TableSelectItem(unsigned ctrl_id, const std::optional& selection) override; + void msgEditEnter(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgTableSelectItem(unsigned ctrl_id, const std::optional& selection) override; }; class iwSave : public iwSaveLoad @@ -36,7 +36,7 @@ class iwSave : public iwSaveLoad // Save game void SaveLoad() override; - void Msg_ComboSelectItem(unsigned ctrl_id, unsigned selection) override; + void msgComboSelectItem(unsigned ctrl_id, unsigned selection) override; }; class iwLoad : public iwSaveLoad @@ -48,7 +48,7 @@ class iwLoad : public iwSaveLoad private: /// Handle double click on the table - void Msg_TableChooseItem(unsigned ctrl_id, unsigned selection) override; + void msgTableChooseItem(unsigned ctrl_id, unsigned selection) override; // Load game void SaveLoad() override; diff --git a/libs/s25main/ingameWindows/iwSettings.cpp b/libs/s25main/ingameWindows/iwSettings.cpp index ddb983ba01..522ade2b3d 100644 --- a/libs/s25main/ingameWindows/iwSettings.cpp +++ b/libs/s25main/ingameWindows/iwSettings.cpp @@ -120,7 +120,7 @@ iwSettings::iwSettings() updateResolutionGroups(); } -void iwSettings::Msg_ButtonClick(unsigned ctrl_id) +void iwSettings::msgButtonClick(unsigned ctrl_id) { switch(ctrl_id) { @@ -166,7 +166,7 @@ void iwSettings::Msg_ButtonClick(unsigned ctrl_id) } } -void iwSettings::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned /*selection*/) +void iwSettings::msgComboSelectItem(const unsigned ctrl_id, const unsigned /*selection*/) { // Handle on apply and just disable closing the window without the buttons (apply/discard) closeBehavior_ = CloseBehavior::Custom; @@ -174,13 +174,13 @@ void iwSettings::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned /*se updateResolutionGroups(); } -void iwSettings::Msg_CheckboxChange(const unsigned /*ctrl_id*/, const bool /*checked*/) +void iwSettings::msgCheckboxChange(const unsigned /*ctrl_id*/, const bool /*checked*/) { // Handle on apply and just disable closing the window without the buttons (apply/discard) closeBehavior_ = CloseBehavior::Custom; } -void iwSettings::Msg_Group_ComboSelectItem(unsigned /*group_id*/, unsigned ctrl_id, unsigned selection) +void iwSettings::msgGroupComboSelectItem(unsigned /*group_id*/, unsigned ctrl_id, unsigned selection) { if(ctrl_id == ID_cbWindowSize && selection > 0) { @@ -195,9 +195,9 @@ void iwSettings::Msg_Group_ComboSelectItem(unsigned /*group_id*/, unsigned ctrl_ closeBehavior_ = CloseBehavior::Custom; } -void iwSettings::Msg_ScreenResize(const ScreenResizeEvent& sr) +void iwSettings::msgScreenResize(const ScreenResizeEvent& sr) { - IngameWindow::Msg_ScreenResize(sr); + IngameWindow::msgScreenResize(sr); updateWindowSizeComboBox(); } diff --git a/libs/s25main/ingameWindows/iwSettings.h b/libs/s25main/ingameWindows/iwSettings.h index 51cb115b92..e7cad8857a 100644 --- a/libs/s25main/ingameWindows/iwSettings.h +++ b/libs/s25main/ingameWindows/iwSettings.h @@ -13,11 +13,11 @@ class iwSettings : public IngameWindow iwSettings(); protected: - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_ComboSelectItem(unsigned ctrl_id, unsigned selection) override; - void Msg_CheckboxChange(unsigned ctrl_id, bool checked) override; - void Msg_Group_ComboSelectItem(unsigned group_id, unsigned ctrl_id, unsigned selection) override; - void Msg_ScreenResize(const ScreenResizeEvent& sr) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgComboSelectItem(unsigned ctrl_id, unsigned selection) override; + void msgCheckboxChange(unsigned ctrl_id, bool checked) override; + void msgGroupComboSelectItem(unsigned group_id, unsigned ctrl_id, unsigned selection) override; + void msgScreenResize(const ScreenResizeEvent& sr) override; private: std::vector supportedResolutions_, windowSizes_; diff --git a/libs/s25main/ingameWindows/iwShip.cpp b/libs/s25main/ingameWindows/iwShip.cpp index f60f25603e..72b0cb0090 100644 --- a/libs/s25main/ingameWindows/iwShip.cpp +++ b/libs/s25main/ingameWindows/iwShip.cpp @@ -128,7 +128,7 @@ void iwShip::DrawContent() DrawCargo(); } -void iwShip::Msg_ButtonClick(const unsigned ctrl_id) +void iwShip::msgButtonClick(const unsigned ctrl_id) { if(ctrl_id == 2) // Hilfe { diff --git a/libs/s25main/ingameWindows/iwShip.h b/libs/s25main/ingameWindows/iwShip.h index 77c8ca1c51..40fef23d2f 100644 --- a/libs/s25main/ingameWindows/iwShip.h +++ b/libs/s25main/ingameWindows/iwShip.h @@ -23,7 +23,7 @@ class iwShip : public IngameWindow private: void DrawContent() override; - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; void DrawCargo(); }; diff --git a/libs/s25main/ingameWindows/iwSkipGFs.cpp b/libs/s25main/ingameWindows/iwSkipGFs.cpp index f8032e9e93..24017bdf75 100644 --- a/libs/s25main/ingameWindows/iwSkipGFs.cpp +++ b/libs/s25main/ingameWindows/iwSkipGFs.cpp @@ -78,7 +78,7 @@ void iwSkipGFs::SkipGFs(const unsigned edtCtrlId) GAMECLIENT.SkipGF(targetGF, gwv); } -void iwSkipGFs::Msg_ButtonClick(const unsigned ctrlId) +void iwSkipGFs::msgButtonClick(const unsigned ctrlId) { if(ctrlId < ID_btJumpPresetStart) SkipGFs((ctrlId == ID_btByGf) ? ID_edtByGf : ID_edtToGf); @@ -89,7 +89,7 @@ void iwSkipGFs::Msg_ButtonClick(const unsigned ctrlId) } } -void iwSkipGFs::Msg_EditEnter(const unsigned ctrlId) +void iwSkipGFs::msgEditEnter(const unsigned ctrlId) { SkipGFs(ctrlId); } diff --git a/libs/s25main/ingameWindows/iwSkipGFs.h b/libs/s25main/ingameWindows/iwSkipGFs.h index b395e1afdb..f5346ea0b2 100644 --- a/libs/s25main/ingameWindows/iwSkipGFs.h +++ b/libs/s25main/ingameWindows/iwSkipGFs.h @@ -18,6 +18,6 @@ class iwSkipGFs : public IngameWindow void SkipGFs(unsigned edtCtrlId); - void Msg_ButtonClick(unsigned ctrlId) override; - void Msg_EditEnter(unsigned ctrlId) override; + void msgButtonClick(unsigned ctrlId) override; + void msgEditEnter(unsigned ctrlId) override; }; diff --git a/libs/s25main/ingameWindows/iwStatistics.cpp b/libs/s25main/ingameWindows/iwStatistics.cpp index 360204744a..60cb74595b 100644 --- a/libs/s25main/ingameWindows/iwStatistics.cpp +++ b/libs/s25main/ingameWindows/iwStatistics.cpp @@ -189,7 +189,7 @@ iwStatistics::iwStatistics(const GameWorldViewer& gwv) iwStatistics::~iwStatistics() = default; -void iwStatistics::Msg_ButtonClick(const unsigned ctrl_id) +void iwStatistics::msgButtonClick(const unsigned ctrl_id) { const unsigned playerIndex = ctrl_id - ID_btPlayer_Start; if(playerIndex < showStatistic.size()) @@ -204,7 +204,7 @@ void iwStatistics::Msg_ButtonClick(const unsigned ctrl_id) } } -void iwStatistics::Msg_OptionGroupChange(const unsigned ctrl_id, const unsigned selection) +void iwStatistics::msgOptionGroupChange(const unsigned ctrl_id, const unsigned selection) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwStatistics.h b/libs/s25main/ingameWindows/iwStatistics.h index 5e2215de12..c9204c6b1a 100644 --- a/libs/s25main/ingameWindows/iwStatistics.h +++ b/libs/s25main/ingameWindows/iwStatistics.h @@ -32,9 +32,9 @@ class iwStatistics : public IngameWindow std::vector showStatistic; unsigned numPlayingPlayers; - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; void DrawContent() override; - void Msg_OptionGroupChange(unsigned ctrl_id, unsigned selection) override; + void msgOptionGroupChange(unsigned ctrl_id, unsigned selection) override; void DrawPlayerBox(DrawPoint const& drawPt, const GamePlayer& player); void DrawPlayerAlliances(DrawPoint const& drawPt, const GamePlayer& player); void DrawPlayerOverlays(); diff --git a/libs/s25main/ingameWindows/iwSurrender.cpp b/libs/s25main/ingameWindows/iwSurrender.cpp index cb65f1aad7..87c892b1ff 100644 --- a/libs/s25main/ingameWindows/iwSurrender.cpp +++ b/libs/s25main/ingameWindows/iwSurrender.cpp @@ -22,7 +22,7 @@ iwSurrender::iwSurrender() _("Don't surrender")); } -void iwSurrender::Msg_ButtonClick(const unsigned ctrl_id) +void iwSurrender::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwSurrender.h b/libs/s25main/ingameWindows/iwSurrender.h index a7d71b64fe..bb53797aea 100644 --- a/libs/s25main/ingameWindows/iwSurrender.h +++ b/libs/s25main/ingameWindows/iwSurrender.h @@ -12,5 +12,5 @@ class iwSurrender : public IngameWindow iwSurrender(); private: - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwTempleBuilding.cpp b/libs/s25main/ingameWindows/iwTempleBuilding.cpp index 738ecda601..e5fec22d70 100644 --- a/libs/s25main/ingameWindows/iwTempleBuilding.cpp +++ b/libs/s25main/ingameWindows/iwTempleBuilding.cpp @@ -20,7 +20,7 @@ iwTempleBuilding::iwTempleBuilding(GameWorldView& gwv, GameCommandFactory& gcFac _("Output mineral")); } -void iwTempleBuilding::Msg_ButtonClick(const unsigned ctrl_id) +void iwTempleBuilding::msgButtonClick(const unsigned ctrl_id) { if(ctrl_id == 8) { @@ -31,5 +31,5 @@ void iwTempleBuilding::Msg_ButtonClick(const unsigned ctrl_id) static_cast(building)->SetProductionMode(nextProductionMode); } } else - iwBuilding::Msg_ButtonClick(ctrl_id); + iwBuilding::msgButtonClick(ctrl_id); } \ No newline at end of file diff --git a/libs/s25main/ingameWindows/iwTempleBuilding.h b/libs/s25main/ingameWindows/iwTempleBuilding.h index 4c886b9427..e91b17a396 100644 --- a/libs/s25main/ingameWindows/iwTempleBuilding.h +++ b/libs/s25main/ingameWindows/iwTempleBuilding.h @@ -16,5 +16,5 @@ class iwTempleBuilding : public iwBuilding iwTempleBuilding(GameWorldView& gwv, GameCommandFactory& gcFactory, nobUsual* building); private: - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; }; \ No newline at end of file diff --git a/libs/s25main/ingameWindows/iwTools.cpp b/libs/s25main/ingameWindows/iwTools.cpp index 1c8d27d058..dd661a2734 100644 --- a/libs/s25main/ingameWindows/iwTools.cpp +++ b/libs/s25main/ingameWindows/iwTools.cpp @@ -140,9 +140,9 @@ void iwTools::UpdateTexts() } } -void iwTools::Msg_PaintBefore() +void iwTools::msgPaintBefore() { - IngameWindow::Msg_PaintBefore(); + IngameWindow::msgPaintBefore(); if(shouldUpdateTexts) { @@ -151,7 +151,7 @@ void iwTools::Msg_PaintBefore() } } -void iwTools::Msg_ButtonClick(const unsigned ctrl_id) +void iwTools::msgButtonClick(const unsigned ctrl_id) { if(isReplay) return; @@ -197,7 +197,7 @@ void iwTools::Msg_ButtonClick(const unsigned ctrl_id) } } -void iwTools::Msg_ProgressChange(const unsigned /*ctrl_id*/, const unsigned short /*position*/) +void iwTools::msgProgressChange(const unsigned /*ctrl_id*/, const unsigned short /*position*/) { // Einstellungen wurden geändert settings_changed = true; diff --git a/libs/s25main/ingameWindows/iwTools.h b/libs/s25main/ingameWindows/iwTools.h index 6cf139f972..d32c08b65a 100644 --- a/libs/s25main/ingameWindows/iwTools.h +++ b/libs/s25main/ingameWindows/iwTools.h @@ -37,9 +37,9 @@ class iwTools final : public TransmitSettingsIgwAdapter /// Sendet veränderte Einstellungen (an den Client), falls sie verändert wurden void TransmitSettings() override; - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_ProgressChange(unsigned ctrl_id, unsigned short position) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgProgressChange(unsigned ctrl_id, unsigned short position) override; void UpdateTexts(); - void Msg_PaintBefore() override; + void msgPaintBefore() override; }; diff --git a/libs/s25main/ingameWindows/iwTrade.cpp b/libs/s25main/ingameWindows/iwTrade.cpp index 3a8a6f7f2e..0f8aaea035 100644 --- a/libs/s25main/ingameWindows/iwTrade.cpp +++ b/libs/s25main/ingameWindows/iwTrade.cpp @@ -72,10 +72,10 @@ iwTrade::iwTrade(const nobBaseWarehouse& wh, const GameWorldViewer& gwv, GameCom // Choose wares at first box->SetSelection(0); - Msg_ComboSelectItem(2, 0); + msgComboSelectItem(2, 0); } -void iwTrade::Msg_ButtonClick(const unsigned /*ctrl_id*/) +void iwTrade::msgButtonClick(const unsigned /*ctrl_id*/) { // pressed the send button const unsigned ware_figure_selection = GetCtrl(4)->GetSelection().value(); @@ -96,7 +96,7 @@ void iwTrade::Msg_ButtonClick(const unsigned /*ctrl_id*/) } } -void iwTrade::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned selection) +void iwTrade::msgComboSelectItem(const unsigned ctrl_id, const unsigned selection) { switch(ctrl_id) { @@ -118,7 +118,7 @@ void iwTrade::Msg_ComboSelectItem(const unsigned ctrl_id, const unsigned selecti names->AddItem(_(JOB_NAMES[job])); } names->SetSelection(0); - Msg_ComboSelectItem(4, 0); + msgComboSelectItem(4, 0); } break; case 4: diff --git a/libs/s25main/ingameWindows/iwTrade.h b/libs/s25main/ingameWindows/iwTrade.h index f1c5727b19..90a14a83f6 100644 --- a/libs/s25main/ingameWindows/iwTrade.h +++ b/libs/s25main/ingameWindows/iwTrade.h @@ -28,8 +28,8 @@ class iwTrade final : public IngameWindow iwTrade(const nobBaseWarehouse& wh, const GameWorldViewer& gwv, GameCommandFactory& gcFactory); private: - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_ComboSelectItem(unsigned ctrl_id, unsigned selection) override; + void msgButtonClick(unsigned ctrl_id) override; + void msgComboSelectItem(unsigned ctrl_id, unsigned selection) override; unsigned GetPossibleTradeAmount(Job job) const; unsigned GetPossibleTradeAmount(GoodType good) const; }; diff --git a/libs/s25main/ingameWindows/iwTransport.cpp b/libs/s25main/ingameWindows/iwTransport.cpp index 85809635c9..21376d01fa 100644 --- a/libs/s25main/ingameWindows/iwTransport.cpp +++ b/libs/s25main/ingameWindows/iwTransport.cpp @@ -134,7 +134,7 @@ void iwTransport::TransmitSettings() } } -void iwTransport::Msg_ButtonClick(const unsigned ctrl_id) +void iwTransport::msgButtonClick(const unsigned ctrl_id) { if(GAMECLIENT.IsReplayModeOn()) return; diff --git a/libs/s25main/ingameWindows/iwTransport.h b/libs/s25main/ingameWindows/iwTransport.h index 6b9d7e33c1..b0436ba7c3 100644 --- a/libs/s25main/ingameWindows/iwTransport.h +++ b/libs/s25main/ingameWindows/iwTransport.h @@ -37,7 +37,7 @@ class iwTransport final : public TransmitSettingsIgwAdapter /// Sendet veränderte Einstellungen (an den Client), falls sie verändert wurden void TransmitSettings() override; - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; void fillTransportOrder(const TransportOrders& transport_order); }; diff --git a/libs/s25main/ingameWindows/iwVictory.cpp b/libs/s25main/ingameWindows/iwVictory.cpp index 80a68a657e..bb66f77fc5 100644 --- a/libs/s25main/ingameWindows/iwVictory.cpp +++ b/libs/s25main/ingameWindows/iwVictory.cpp @@ -48,7 +48,7 @@ iwVictory::iwVictory(const std::vector& winnerNames) NormalFont); } -void iwVictory::Msg_ButtonClick(const unsigned ctrl_id) +void iwVictory::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { diff --git a/libs/s25main/ingameWindows/iwVictory.h b/libs/s25main/ingameWindows/iwVictory.h index 534e8ace98..b6c9c34d4d 100644 --- a/libs/s25main/ingameWindows/iwVictory.h +++ b/libs/s25main/ingameWindows/iwVictory.h @@ -12,5 +12,5 @@ class iwVictory : public IngameWindow iwVictory(const std::vector& winnerNames); private: - void Msg_ButtonClick(unsigned ctrl_id) override; + void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwWares.cpp b/libs/s25main/ingameWindows/iwWares.cpp index b6f8b16082..5732e57002 100644 --- a/libs/s25main/ingameWindows/iwWares.cpp +++ b/libs/s25main/ingameWindows/iwWares.cpp @@ -172,7 +172,7 @@ iwWares::iwWares(unsigned id, const DrawPoint& pos, unsigned additionalYSpace, c curPage_ = warePageID; } -void iwWares::Msg_ButtonClick(const unsigned ctrl_id) +void iwWares::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { @@ -187,9 +187,9 @@ void iwWares::Msg_ButtonClick(const unsigned ctrl_id) } } -void iwWares::Msg_PaintBefore() +void iwWares::msgPaintBefore() { - IngameWindow::Msg_PaintBefore(); + IngameWindow::msgPaintBefore(); // Farben ggf. aktualisieren diff --git a/libs/s25main/ingameWindows/iwWares.h b/libs/s25main/ingameWindows/iwWares.h index bde024d76f..68d5c7387b 100644 --- a/libs/s25main/ingameWindows/iwWares.h +++ b/libs/s25main/ingameWindows/iwWares.h @@ -27,8 +27,8 @@ class iwWares : public IngameWindow /// Add a new page and return it. ID will be in range 100+ ctrlGroup& AddPage(); - void Msg_ButtonClick(unsigned ctrl_id) override; - void Msg_PaintBefore() override; + void msgButtonClick(unsigned ctrl_id) override; + void msgPaintBefore() override; unsigned GetCurPage() const { return curPage_; } diff --git a/tests/mockupDrivers/MockupAudioDriver.h b/tests/mockupDrivers/MockupAudioDriver.h index 4e8bb45328..4a04ac6e50 100644 --- a/tests/mockupDrivers/MockupAudioDriver.h +++ b/tests/mockupDrivers/MockupAudioDriver.h @@ -18,7 +18,7 @@ struct MockupSoundData MOCK_BASE_CLASS(MockAudioDriverCallback, IAudioDriverCallback) { - MOCK_NON_CONST_METHOD(Msg_MusicFinished, 0); + MOCK_NON_CONST_METHOD(msgMusicFinished, 0); }; MOCK_BASE_CLASS(MockupAudioDriver, driver::AudioDriver) diff --git a/tests/s25Main/UI/testAnimations.cpp b/tests/s25Main/UI/testAnimations.cpp index 8c82120ee0..651707a912 100644 --- a/tests/s25Main/UI/testAnimations.cpp +++ b/tests/s25Main/UI/testAnimations.cpp @@ -668,10 +668,10 @@ BOOST_AUTO_TEST_CASE(MoveAniScale) dsk->AddTextButton(1, DrawPoint(130, bt->GetPos().y), bt->GetSize(), TextureColor::Red1, "", NormalFont); dsk->GetAnimationManager().addAnimation( new MoveAnimation(bt, btReference->GetPos(), 1000, Animation::RepeatType::None)); - dsk->Msg_PaintBefore(); + dsk->msgPaintBefore(); // Pass the animation video->tickCount_ += 1100; - dsk->Msg_PaintBefore(); + dsk->msgPaintBefore(); BOOST_TEST_REQUIRE(bt->GetPos() == btReference->GetPos()); // Restart @@ -679,12 +679,12 @@ BOOST_AUTO_TEST_CASE(MoveAniScale) dsk->GetAnimationManager().addAnimation( new MoveAnimation(bt, btReference->GetPos(), 1000, Animation::RepeatType::None)); video->tickCount_ += 1; - dsk->Msg_PaintBefore(); + dsk->msgPaintBefore(); // Resize the screen and test that the final position got updated too VIDEODRIVER.ResizeScreen(VideoMode(1024, 768), DisplayMode::Windowed); // Pass the animation video->tickCount_ += 1100; - dsk->Msg_PaintBefore(); + dsk->msgPaintBefore(); BOOST_TEST_REQUIRE(bt->GetPos() == btReference->GetPos()); } diff --git a/tests/s25Main/UI/testComboBox.cpp b/tests/s25Main/UI/testComboBox.cpp index d35021e6b5..d5b897b207 100644 --- a/tests/s25Main/UI/testComboBox.cpp +++ b/tests/s25Main/UI/testComboBox.cpp @@ -23,8 +23,8 @@ MOCK_BASE_CLASS(TestWindow, Window) { public: TestWindow() : Window(nullptr, randomValue(), DrawPoint(0, 0)) {} - MOCK_METHOD(Msg_ComboSelectItem, 2) - MOCK_METHOD(Msg_ListSelectItem, 2) + MOCK_METHOD(msgComboSelectItem, 2) + MOCK_METHOD(msgListSelectItem, 2) }; } // namespace @@ -90,22 +90,22 @@ BOOST_AUTO_TEST_CASE(ControlWithScrollWheel) + Position(randomValue(0u, cb->GetSize().x - 1u), randomValue(0u, cb->GetSize().y - 1u))}; for(unsigned i = 0; i < 3u; i++) { - MOCK_EXPECT(wnd.Msg_ComboSelectItem).once().with(cb->GetID(), static_cast(i)).in(s); - cb->Msg_WheelDown(mc); + MOCK_EXPECT(wnd.msgComboSelectItem).once().with(cb->GetID(), static_cast(i)).in(s); + cb->msgWheelDown(mc); REQUIRE(cb->GetSelection() == i); } // 4th time does nothing - cb->Msg_WheelDown(mc); + cb->msgWheelDown(mc); REQUIRE(cb->GetSelection() == 2u); // Same but up for(int i = 1; i >= 0; i--) { - MOCK_EXPECT(wnd.Msg_ComboSelectItem).once().with(cb->GetID(), static_cast(i)).in(s); - cb->Msg_WheelUp(mc); + MOCK_EXPECT(wnd.msgComboSelectItem).once().with(cb->GetID(), static_cast(i)).in(s); + cb->msgWheelUp(mc); REQUIRE(cb->GetSelection() == static_cast(i)); } // next time does nothing - cb->Msg_WheelUp(mc); + cb->msgWheelUp(mc); REQUIRE(cb->GetSelection() == 0u); } @@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE(ListRemove) REQUIRE(!list->GetSelection()); } mock::sequence s; - MOCK_EXPECT(wnd.Msg_ListSelectItem).once().with(list->GetID(), 4).in(s); + MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->GetID(), 4).in(s); list->SetSelection(4); REQUIRE(list->GetSelection() == 4u); REQUIRE(list->GetSelItemText() == lines[4]); @@ -149,15 +149,15 @@ BOOST_AUTO_TEST_CASE(ListRemove) // Remove selection -> Next selected REQUIRE(list->GetNumLines() == 5); REQUIRE(list->GetSelection() == 0u); - MOCK_EXPECT(wnd.Msg_ListSelectItem).once().with(list->GetID(), 0).in(s); + MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->GetID(), 0).in(s); list->Remove(0); REQUIRE(list->GetNumLines() == 4); REQUIRE(list->GetSelection() == 0u); REQUIRE(list->GetSelItemText() == lines[1]); lines.erase(lines.begin()); // Also for middle pos - MOCK_EXPECT(wnd.Msg_ListSelectItem).once().with(list->GetID(), 2).in(s); - MOCK_EXPECT(wnd.Msg_ListSelectItem).once().with(list->GetID(), 2).in(s); + MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->GetID(), 2).in(s); + MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->GetID(), 2).in(s); list->SetSelection(2); list->Remove(2); REQUIRE(list->GetNumLines() == 3); @@ -166,7 +166,7 @@ BOOST_AUTO_TEST_CASE(ListRemove) lines.erase(lines.begin() + 2); // For last pos previous is selected list->SetSelection(list->GetNumLines() - 1); - MOCK_EXPECT(wnd.Msg_ListSelectItem).once().with(list->GetID(), 1).in(s); + MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->GetID(), 1).in(s); list->Remove(list->GetNumLines() - 1); REQUIRE(list->GetNumLines() == 2); REQUIRE(list->GetSelection() == 1u); diff --git a/tests/s25Main/UI/testControls.cpp b/tests/s25Main/UI/testControls.cpp index 3f875fd538..d300e9d14c 100644 --- a/tests/s25Main/UI/testControls.cpp +++ b/tests/s25Main/UI/testControls.cpp @@ -170,9 +170,9 @@ BOOST_FIXTURE_TEST_CASE(EditShowsCorrectChars, uiHelper::Fixture) // Activate MouseCoords mc(edt2.GetPos()); mc.ldown = true; - edt2.Msg_LeftDown(mc); - edt2.Msg_PaintAfter(); - edt2.Msg_KeyDown(KeyEvent(c)); + edt2.msgLeftDown(mc); + edt2.msgPaintAfter(); + edt2.msgKeyDown(KeyEvent(c)); // Remove chars from front until in size auto itFirst = curChars.begin(); while(font->getWidth(curText) > allowedWidth) @@ -185,20 +185,20 @@ BOOST_FIXTURE_TEST_CASE(EditShowsCorrectChars, uiHelper::Fixture) // Check navigating of cursor MouseCoords mc(edt2.GetPos()); mc.ldown = true; - edt.Msg_LeftDown(mc); // Activate - edt.Msg_PaintAfter(); + edt.msgLeftDown(mc); // Activate + edt.msgPaintAfter(); int curCursorPos = curChars.size(); // Current cursor should be at end while(!curChars.empty()) { int moveOffset = rttr::test::randomValue(-curCursorPos - 1, curChars.size() - curCursorPos + 1); //+-1 to check for "overrun" for(; moveOffset < 0; ++moveOffset, --curCursorPos) - edt.Msg_KeyDown(KeyEvent(KeyType::Left)); + edt.msgKeyDown(KeyEvent(KeyType::Left)); for(; moveOffset > 0; --moveOffset, ++curCursorPos) - edt.Msg_KeyDown(KeyEvent(KeyType::Right)); + edt.msgKeyDown(KeyEvent(KeyType::Right)); curCursorPos = helpers::clamp(curCursorPos, 0, static_cast(curChars.size())); // Erase one char (currently only good way to check where the cursor is - edt.Msg_KeyDown(KeyEvent(KeyType::Backspace)); + edt.msgKeyDown(KeyEvent(KeyType::Backspace)); if(curCursorPos > 0) { curChars.erase(curChars.begin() + --curCursorPos); @@ -224,18 +224,18 @@ BOOST_FIXTURE_TEST_CASE(EditShowsCorrectChars, uiHelper::Fixture) do { BOOST_TEST_REQUIRE(txt->GetText() == txtWithoutFirst); - edt.Msg_KeyDown(KeyEvent(KeyType::Left)); + edt.msgKeyDown(KeyEvent(KeyType::Left)); --curCursorPos; } while(curCursorPos > 5); while(curCursorPos-- >= 0) { BOOST_TEST_REQUIRE(txt->GetText() == curText); // Trailing chars are removed by font rendering - edt.Msg_KeyDown(KeyEvent(KeyType::Left)); + edt.msgKeyDown(KeyEvent(KeyType::Left)); } // Moving fully right shows txt again curCursorPos = 0; while(static_cast(curCursorPos++) < curChars.size()) - edt.Msg_KeyDown(KeyEvent(KeyType::Right)); + edt.msgKeyDown(KeyEvent(KeyType::Right)); BOOST_TEST_REQUIRE(txt->GetText() == txtWithoutFirst); } @@ -248,15 +248,15 @@ BOOST_FIXTURE_TEST_CASE(EditFileNameOnlyFiltersInvalidChars, uiHelper::Fixture) MouseCoords mc(edt.GetPos()); mc.ldown = true; - edt.Msg_LeftDown(mc); // give focus + edt.msgLeftDown(mc); // give focus for(char32_t c : {U'a', U'B', U'1', U'2', U' '}) // valid chars - edt.Msg_KeyDown(KeyEvent(c)); + edt.msgKeyDown(KeyEvent(c)); BOOST_TEST(edt.GetText() == "aB12 "); // all accepted for(char32_t c : {U'c', U'<', U'D', U'>', U'-', U':', U'"', U'3', U'/', U'\\', U'4', U'|', U'?', U'!', U'*'}) // mixed valid and invalid chars - edt.Msg_KeyDown(KeyEvent(c)); + edt.msgKeyDown(KeyEvent(c)); BOOST_TEST(edt.GetText() == "aB12 cD-34!"); // only valid accepted edt.SetText("a/B\\1"); @@ -335,13 +335,13 @@ BOOST_FIXTURE_TEST_CASE(EditSpaceKeyDoesNotDuplicateChar, uiHelper::Fixture) ctrlEdit edt(nullptr, 0, DrawPoint(0, 0), Extent(200, 15), TextureColor::Green1, font.get()); MouseCoords mc(edt.GetPos()); mc.ldown = true; - edt.Msg_LeftDown(mc); + edt.msgLeftDown(mc); // A real space press fires both of these on SDL2 (SDL_KEYDOWN+SDL_TEXTINPUT) and WinAPI // (WM_KEYDOWN+WM_CHAR) for one physical key press. - edt.Msg_KeyDown(KeyEvent(KeyType::Space)); // OS "key down" event - must not insert anything - edt.Msg_KeyDown(KeyEvent(U' ')); // OS "char/text-input" event - inserts the space - BOOST_TEST(edt.GetText() == " "); // exactly one space, not two + edt.msgKeyDown(KeyEvent(KeyType::Space)); // OS "key down" event - must not insert anything + edt.msgKeyDown(KeyEvent(U' ')); // OS "char/text-input" event - inserts the space + BOOST_TEST(edt.GetText() == " "); // exactly one space, not two } BOOST_FIXTURE_TEST_CASE(EditMaxLengthTruncatesInput, uiHelper::Fixture) @@ -350,10 +350,10 @@ BOOST_FIXTURE_TEST_CASE(EditMaxLengthTruncatesInput, uiHelper::Fixture) ctrlEdit edt(nullptr, 0, DrawPoint(0, 0), Extent(200, 15), TextureColor::Green1, font.get(), 3 /*maxlength*/); MouseCoords mc(edt.GetPos()); mc.ldown = true; - edt.Msg_LeftDown(mc); + edt.msgLeftDown(mc); for(char32_t c : {U'a', U'b', U'c', U'd', U'e'}) // 5 chars typed, cap is 3 - edt.Msg_KeyDown(KeyEvent(c)); + edt.msgKeyDown(KeyEvent(c)); BOOST_TEST(edt.GetText() == "abc"); // input beyond maxLength is dropped edt.SetText("abcde"); // input beyond maxLength is dropped diff --git a/tests/s25Main/UI/testDskGameLobby.cpp b/tests/s25Main/UI/testDskGameLobby.cpp index 1f24672809..0af195b39c 100644 --- a/tests/s25Main/UI/testDskGameLobby.cpp +++ b/tests/s25Main/UI/testDskGameLobby.cpp @@ -71,7 +71,7 @@ BOOST_FIXTURE_TEST_CASE(LobbyChat, uiHelper::Fixture) RTTR_REQUIRE_LOG_CONTAINS("", false); li->LC_Chat("OtherPlayer", "Test"); RTTR_REQUIRE_LOG_CONTAINS("", false); - desktop->Msg_OptionGroupChange(chatTab.front()->GetID(), chatBts[i % 2]->GetID()); + desktop->msgOptionGroupChange(chatTab.front()->GetID(), chatBts[i % 2]->GetID()); } // Free desktop etc to trigger mock verification WINDOWMANAGER.CleanUp(); diff --git a/tests/s25Main/UI/testIngameWindow.cpp b/tests/s25Main/UI/testIngameWindow.cpp index 8ef7fc6e48..a642bb4e0d 100644 --- a/tests/s25Main/UI/testIngameWindow.cpp +++ b/tests/s25Main/UI/testIngameWindow.cpp @@ -118,7 +118,7 @@ BOOST_AUTO_TEST_CASE(IwMapGenerator) wnd.GetCtrl(iwMapGenerator::ID_pgTrees)->SetPosition(expectedTrees); BOOST_TEST(wnd.GetCtrl(iwMapGenerator::ID_pgStonePiles)->GetPosition() == settings.stonePiles); wnd.GetCtrl(iwMapGenerator::ID_pgStonePiles)->SetPosition(expectedStonePiles); - wnd.Msg_ButtonClick(iwMapGenerator::ID_btApply); + wnd.msgButtonClick(iwMapGenerator::ID_btApply); BOOST_TEST(wnd.ShouldBeClosed()); BOOST_TEST(settings.numPlayers == expectedNumPlayers); @@ -211,7 +211,7 @@ BOOST_AUTO_TEST_CASE(ConnectingWindow) { iwConnecting wnd(ServerType::Local, nullptr); // Clicking the button sends the onError signal (or if not set opens an error window) and closes the window - wnd.Msg_ButtonClick(wnd.GetCtrls().at(0)->GetID()); + wnd.msgButtonClick(wnd.GetCtrls().at(0)->GetID()); BOOST_TEST(wnd.ShouldBeClosed()); BOOST_TEST((dynamic_cast(WINDOWMANAGER.GetTopMostWindow()))); } @@ -301,23 +301,23 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) // Only react when clicking the button not when moving the mouse to the button // while holding left mouse button - wnd.Msg_LeftDown(evLDownInsideWindow); - wnd.Msg_MouseMove(evLDown); - wnd.Msg_LeftUp(evLUp); + wnd.msgLeftDown(evLDownInsideWindow); + wnd.msgMouseMove(evLDown); + wnd.msgLeftUp(evLUp); BOOST_TEST(!wnd.ShouldBeClosed()); BOOST_TEST(!wnd.IsMinimized()); BOOST_TEST(!wnd.IsPinned()); // Similar when moving out of the button - wnd.Msg_LeftDown(evLDown); - wnd.Msg_MouseMove(evLDownInsideWindow); - wnd.Msg_MouseMove(evLDown); - wnd.Msg_LeftUp(evLUp); + wnd.msgLeftDown(evLDown); + wnd.msgMouseMove(evLDownInsideWindow); + wnd.msgMouseMove(evLDown); + wnd.msgLeftUp(evLUp); BOOST_TEST(!wnd.ShouldBeClosed()); BOOST_TEST(!wnd.IsMinimized()); BOOST_TEST(!wnd.IsPinned()); - wnd.Msg_LeftDown(evLDown); - wnd.Msg_LeftUp(evLUp); + wnd.msgLeftDown(evLDown); + wnd.msgLeftUp(evLUp); BOOST_TEST(wnd.ShouldBeClosed()); BOOST_TEST(!wnd.IsMinimized()); BOOST_TEST(!wnd.IsPinned()); @@ -335,8 +335,8 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) BOOST_TEST(!wnd.ShouldBeClosed()); BOOST_TEST(!wnd.IsMinimized()); BOOST_TEST(!wnd.IsPinned()); - wnd.Msg_LeftDown(evLDown); - wnd.Msg_LeftUp(evLDblClick); + wnd.msgLeftDown(evLDown); + wnd.msgLeftUp(evLDblClick); BOOST_TEST(!wnd.ShouldBeClosed()); BOOST_TEST(!wnd.IsMinimized()); BOOST_TEST(!wnd.IsPinned()); @@ -355,8 +355,8 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) BOOST_TEST(!wnd.ShouldBeClosed()); BOOST_TEST(!wnd.IsMinimized()); BOOST_TEST(!wnd.IsPinned()); - wnd.Msg_LeftDown(evLDown); - wnd.Msg_LeftUp(evLUp); + wnd.msgLeftDown(evLDown); + wnd.msgLeftUp(evLUp); BOOST_TEST(!wnd.ShouldBeClosed()); BOOST_TEST(wnd.IsMinimized()); BOOST_TEST(!wnd.IsPinned()); @@ -380,8 +380,8 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) BOOST_TEST(!wnd.ShouldBeClosed()); BOOST_TEST(!wnd.IsMinimized()); BOOST_TEST(!wnd.IsPinned()); - wnd.Msg_LeftDown(evLDown); - wnd.Msg_LeftUp(evLUp); + wnd.msgLeftDown(evLDown); + wnd.msgLeftUp(evLUp); BOOST_TEST(wnd.ShouldBeClosed()); BOOST_TEST(!wnd.IsMinimized()); BOOST_TEST(!wnd.IsPinned()); @@ -399,8 +399,8 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) BOOST_TEST(!wnd.ShouldBeClosed()); BOOST_TEST(!wnd.IsMinimized()); BOOST_TEST(!wnd.IsPinned()); - wnd.Msg_LeftDown(evLDown); - wnd.Msg_LeftUp(evLDblClick); + wnd.msgLeftDown(evLDown); + wnd.msgLeftUp(evLDblClick); BOOST_TEST(!wnd.ShouldBeClosed()); BOOST_TEST(wnd.IsMinimized()); BOOST_TEST(!wnd.IsPinned()); @@ -420,8 +420,8 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) BOOST_TEST(!wnd.ShouldBeClosed()); BOOST_TEST(!wnd.IsMinimized()); BOOST_TEST(!wnd.IsPinned()); - wnd.Msg_LeftDown(evLDown); - wnd.Msg_LeftUp(evLUp); + wnd.msgLeftDown(evLDown); + wnd.msgLeftUp(evLUp); BOOST_TEST(!wnd.ShouldBeClosed()); BOOST_TEST(!wnd.IsMinimized()); BOOST_TEST(wnd.IsPinned()); @@ -608,12 +608,12 @@ BOOST_AUTO_TEST_CASE(WindowSnapping) { const DrawPoint mousePosRel = DrawPoint(wnd2.GetSize().x / 2, 4); const MouseCoords evLDown = makeLeftDown(wnd2.GetPos() + mousePosRel); - wnd2.Msg_LeftDown(evLDown); + wnd2.msgLeftDown(evLDown); { const auto mc = makeLeftDown(evLDown.pos + DrawPoint(-80, 0)); VIDEODRIVER.SetMousePos(mc.pos); - wnd2.Msg_MouseMove(mc); + wnd2.msgMouseMove(mc); BOOST_TEST(wnd2.GetPos() == DrawPoint(120, 480)); // Not in snap range yet BOOST_TEST(VIDEODRIVER.GetMousePos() == (wnd2.GetPos() + mousePosRel)); } @@ -621,7 +621,7 @@ BOOST_AUTO_TEST_CASE(WindowSnapping) { const auto mc = makeLeftDown(evLDown.pos + DrawPoint(-90, 0)); VIDEODRIVER.SetMousePos(mc.pos); - wnd2.Msg_MouseMove(mc); + wnd2.msgMouseMove(mc); BOOST_TEST(wnd2.GetPos() == DrawPoint(100, 480)); // In snap range BOOST_TEST(VIDEODRIVER.GetMousePos() == mc.pos); // Cursor position is off by snap offset @@ -632,7 +632,7 @@ BOOST_AUTO_TEST_CASE(WindowSnapping) const auto mc = makeLeftDown(evLDown.pos + DrawPoint(-90, 30)); // Reset mouse position to ensure it's properly updated in Msg_MouseMove() VIDEODRIVER.SetMousePos(Position(0, 0)); - wnd2.Msg_MouseMove(mc); + wnd2.msgMouseMove(mc); BOOST_TEST(wnd2.GetPos() == DrawPoint(100, 500)); // Still in snap range BOOST_TEST(VIDEODRIVER.GetMousePos() == Position(mc.pos.x, wnd2.GetPos().y + mousePosRel.y)); // Cursor position is off by snap offset @@ -647,14 +647,14 @@ BOOST_AUTO_TEST_CASE(WindowSnapping) const DrawPoint mousePosRel = DrawPoint(wnd3.GetSize().x / 2, 4); const MouseCoords evLDown = makeLeftDown(wnd3.GetPos() + mousePosRel); - wnd3.Msg_LeftDown(evLDown); + wnd3.msgLeftDown(evLDown); { wnd1.SetPos(DrawPoint(0, 0)); wnd2.SetPos(DrawPoint(5, 0)); const auto mc = makeLeftDown(evLDown.pos + DrawPoint(-90, 0)); VIDEODRIVER.SetMousePos(mc.pos); - wnd3.Msg_MouseMove(mc); + wnd3.msgMouseMove(mc); // In snap range of wnd1 and wnd2, but closest to wnd2 BOOST_TEST(wnd3.GetPos() == DrawPoint(wnd2.GetPos().x + wnd2.GetSize().x, 0)); BOOST_TEST(VIDEODRIVER.GetMousePos() == mc.pos); @@ -667,7 +667,7 @@ BOOST_AUTO_TEST_CASE(WindowSnapping) wnd2.SetPos(DrawPoint(0, 0)); const auto mc = makeLeftDown(evLDown.pos + DrawPoint(-90, 0)); VIDEODRIVER.SetMousePos(mc.pos); - wnd3.Msg_MouseMove(mc); + wnd3.msgMouseMove(mc); // In snap range of wnd1 and wnd2, but closest to wnd1 BOOST_TEST(wnd3.GetPos() == DrawPoint(wnd1.GetPos().x + wnd1.GetSize().x, 0)); BOOST_TEST(VIDEODRIVER.GetMousePos() == mc.pos); diff --git a/tests/s25Main/UI/testMapSelection.cpp b/tests/s25Main/UI/testMapSelection.cpp index bc9e4c4ad0..757c730dc3 100644 --- a/tests/s25Main/UI/testMapSelection.cpp +++ b/tests/s25Main/UI/testMapSelection.cpp @@ -137,16 +137,16 @@ void testMapSelection(Position const& windowPos, Extent const& windowExtent, Ext // Initial the selection is not set BOOST_TEST(!ms.getSelection()); // Click on non mission area => selection will not change - ms.Msg_LeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + freeQuadrantMidPoint)); + ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + freeQuadrantMidPoint)); BOOST_TEST(!ms.getSelection()); // Click on mission area of first mission => selection will change because mission is playable - ms.Msg_LeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + firstMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + firstMissionMidPoint)); BOOST_TEST(ms.getSelection() == 0u); // Click on mission area of second mission => selection will not change because mission is not playable - ms.Msg_LeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + secondMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + secondMissionMidPoint)); BOOST_TEST(ms.getSelection() == 0u); // Click on mission area of third mission => selection will not change because mission is not playable - ms.Msg_LeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + thirdMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + thirdMissionMidPoint)); BOOST_TEST(ms.getSelection() == 0u); // Activate first and second mission @@ -154,16 +154,16 @@ void testMapSelection(Position const& windowPos, Extent const& windowExtent, Ext // Selection stays the same as before BOOST_TEST(ms.getSelection() == 0u); // Click on mission area of second mission => selection will change because mission is playable - ms.Msg_LeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + secondMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + secondMissionMidPoint)); BOOST_TEST(ms.getSelection() == 1u); // Click on mission area of third mission => selection will not change because mission is not playable - ms.Msg_LeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + thirdMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + thirdMissionMidPoint)); BOOST_TEST(ms.getSelection() == 1u); // Click on non mission area => selection will not change - ms.Msg_LeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + freeQuadrantMidPoint)); + ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + freeQuadrantMidPoint)); BOOST_TEST(ms.getSelection() == 1u); // Click on mission area of first mission => selection will change because mission is playable - ms.Msg_LeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + firstMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + firstMissionMidPoint)); BOOST_TEST(ms.getSelection() == 0u); // Test selection @@ -192,13 +192,13 @@ void testMapSelection(Position const& windowPos, Extent const& windowExtent, Ext ms.setSelection(0); ms.setPreview(true); BOOST_TEST(ms.getSelection() == 0u); - ms.Msg_LeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + secondMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + secondMissionMidPoint)); BOOST_TEST(ms.getSelection() == 0u); - ms.Msg_LeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + thirdMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + thirdMissionMidPoint)); BOOST_TEST(ms.getSelection() == 0u); - ms.Msg_LeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + freeQuadrantMidPoint)); + ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + freeQuadrantMidPoint)); BOOST_TEST(ms.getSelection() == 0u); - ms.Msg_LeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + firstMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + firstMissionMidPoint)); BOOST_TEST(ms.getSelection() == 0u); ms.setPreview(false); @@ -217,9 +217,9 @@ void testMapSelection(Position const& windowPos, Extent const& windowExtent, Ext borderPoint.y--; const unsigned deselectIndex = (mid + 1) < midPoints.size() ? (mid + 1) : 0; - ms.Msg_LeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + midPoints[deselectIndex])); + ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + midPoints[deselectIndex])); BOOST_TEST(ms.getSelection() == deselectIndex); - ms.Msg_LeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + borderPoint)); + ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + borderPoint)); BOOST_TEST(ms.getSelection() == mid); } } diff --git a/tests/s25Main/UI/testWindowManager.cpp b/tests/s25Main/UI/testWindowManager.cpp index a7e17571b9..aa34d17e56 100644 --- a/tests/s25Main/UI/testWindowManager.cpp +++ b/tests/s25Main/UI/testWindowManager.cpp @@ -35,9 +35,9 @@ namespace { MOCK_BASE_CLASS(TestDesktop, Desktop) { TestDesktop() : Desktop(nullptr) {} - MOCK_METHOD(Msg_LeftDown, 1) - MOCK_METHOD(Msg_LeftUp, 1) - MOCK_METHOD(Msg_MouseMove, 1) + MOCK_METHOD(msgLeftDown, 1) + MOCK_METHOD(msgLeftUp, 1) + MOCK_METHOD(msgMouseMove, 1) }; struct WMFixture : mock::cleanup @@ -47,9 +47,9 @@ struct WMFixture : mock::cleanup WMFixture() : video(uiHelper::GetVideoDriver()) { dsk = static_cast(WINDOWMANAGER.Switch(std::make_unique())); - MOCK_EXPECT(dsk->Msg_MouseMove).once().returns(true); - MOCK_EXPECT(dsk->Msg_LeftDown).once().returns(true); - MOCK_EXPECT(dsk->Msg_LeftUp).once().returns(true); + MOCK_EXPECT(dsk->msgMouseMove).once().returns(true); + MOCK_EXPECT(dsk->msgLeftDown).once().returns(true); + MOCK_EXPECT(dsk->msgLeftUp).once().returns(true); WINDOWMANAGER.Draw(); // Ensure next click in test won't be registered as double-click @@ -58,8 +58,8 @@ struct WMFixture : mock::cleanup mc1.ldown = true; MouseCoords mc1_u(mc1.pos); video->tickCount_ = DOUBLE_CLICK_INTERVAL * 100; - WINDOWMANAGER.Msg_LeftDown(mc1); - WINDOWMANAGER.Msg_LeftUp(mc1); + WINDOWMANAGER.msgLeftDown(mc1); + WINDOWMANAGER.msgLeftUp(mc1); video->tickCount_ = 0; mock::verify(*dsk); @@ -90,22 +90,22 @@ BOOST_FIXTURE_TEST_CASE(LeftClick, WMFixture) MouseCoords mc2(10, 7); mc2.ldown = true; MouseCoords mc2_u(mc2.pos); - MOCK_EXPECT(dsk->Msg_LeftDown).once().with(mc1).in(s).returns(true); - MOCK_EXPECT(dsk->Msg_LeftUp).once().with(mc1_u).in(s).returns(true); - MOCK_EXPECT(dsk->Msg_LeftDown).once().with(mc2).in(s).returns(true); - MOCK_EXPECT(dsk->Msg_LeftUp).once().with(mc2_u).in(s).returns(true); - MOCK_EXPECT(dsk->Msg_LeftDown).once().with(mc1).in(s).returns(true); - MOCK_EXPECT(dsk->Msg_LeftUp).once().with(mc2_u).in(s).returns(true); - WINDOWMANAGER.Msg_LeftDown(mc1); + MOCK_EXPECT(dsk->msgLeftDown).once().with(mc1).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftUp).once().with(mc1_u).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftDown).once().with(mc2).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftUp).once().with(mc2_u).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftDown).once().with(mc1).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftUp).once().with(mc2_u).in(s).returns(true); + WINDOWMANAGER.msgLeftDown(mc1); video->tickCount_ += 50; - WINDOWMANAGER.Msg_LeftUp(mc1_u); + WINDOWMANAGER.msgLeftUp(mc1_u); video->tickCount_ += 2000; - WINDOWMANAGER.Msg_LeftDown(mc2); + WINDOWMANAGER.msgLeftDown(mc2); video->tickCount_ += 50; - WINDOWMANAGER.Msg_LeftUp(mc2_u); + WINDOWMANAGER.msgLeftUp(mc2_u); video->tickCount_ += 3000; - WINDOWMANAGER.Msg_LeftDown(mc1); - WINDOWMANAGER.Msg_LeftUp(mc2_u); + WINDOWMANAGER.msgLeftDown(mc1); + WINDOWMANAGER.msgLeftUp(mc2_u); mock::verify(); } @@ -120,41 +120,41 @@ BOOST_FIXTURE_TEST_CASE(DblClick, WMFixture) mc2.ldown = true; MouseCoords mc2_u(mc2.pos); // Click with time > DOUBLE_CLICK_INTERVAL is no dbl click - MOCK_EXPECT(dsk->Msg_LeftDown).once().with(mc1).in(s).returns(true); - MOCK_EXPECT(dsk->Msg_LeftUp).once().with(mc1_u).in(s).returns(true); - MOCK_EXPECT(dsk->Msg_LeftDown).once().with(mc1).in(s).returns(true); - MOCK_EXPECT(dsk->Msg_LeftUp).once().with(mc1_u).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftDown).once().with(mc1).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftUp).once().with(mc1_u).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftDown).once().with(mc1).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftUp).once().with(mc1_u).in(s).returns(true); // Click on different positions is no dbl click - MOCK_EXPECT(dsk->Msg_LeftDown).once().with(mc2).in(s).returns(true); - MOCK_EXPECT(dsk->Msg_LeftUp).once().with(mc2_u).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftDown).once().with(mc2).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftUp).once().with(mc2_u).in(s).returns(true); // Click on same pos with time < DOUBLE_CLICK_INTERVAL is dbl click - MOCK_EXPECT(dsk->Msg_LeftDown).once().with(mc2).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftDown).once().with(mc2).in(s).returns(true); MouseCoords dbl_mc2(mc2.pos); dbl_mc2.dbl_click = true; - MOCK_EXPECT(dsk->Msg_LeftUp).once().with(dbl_mc2).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftUp).once().with(dbl_mc2).in(s).returns(true); // No triple click - MOCK_EXPECT(dsk->Msg_LeftDown).once().with(mc2).in(s).returns(true); - MOCK_EXPECT(dsk->Msg_LeftUp).once().with(mc2_u).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftDown).once().with(mc2).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftUp).once().with(mc2_u).in(s).returns(true); - WINDOWMANAGER.Msg_LeftDown(mc1); + WINDOWMANAGER.msgLeftDown(mc1); video->tickCount_ += 1; - WINDOWMANAGER.Msg_LeftUp(mc1_u); + WINDOWMANAGER.msgLeftUp(mc1_u); // time > DOUBLE_CLICK_INTERVAL video->tickCount_ += DOUBLE_CLICK_INTERVAL; - WINDOWMANAGER.Msg_LeftDown(mc1); + WINDOWMANAGER.msgLeftDown(mc1); video->tickCount_ += 1; - WINDOWMANAGER.Msg_LeftUp(mc1_u); + WINDOWMANAGER.msgLeftUp(mc1_u); // Different position - WINDOWMANAGER.Msg_LeftDown(mc2); - WINDOWMANAGER.Msg_LeftUp(mc2_u); + WINDOWMANAGER.msgLeftDown(mc2); + WINDOWMANAGER.msgLeftUp(mc2_u); // time < DOUBLE_CLICK_INTERVAL video->tickCount_ += DOUBLE_CLICK_INTERVAL - 1; - WINDOWMANAGER.Msg_LeftDown(mc2); - WINDOWMANAGER.Msg_LeftUp(mc2_u); + WINDOWMANAGER.msgLeftDown(mc2); + WINDOWMANAGER.msgLeftUp(mc2_u); // Triple? video->tickCount_ += DOUBLE_CLICK_INTERVAL - 1; - WINDOWMANAGER.Msg_LeftDown(mc2); - WINDOWMANAGER.Msg_LeftUp(mc2_u); + WINDOWMANAGER.msgLeftDown(mc2); + WINDOWMANAGER.msgLeftUp(mc2_u); mock::verify(); } @@ -183,47 +183,47 @@ BOOST_FIXTURE_TEST_CASE(DblClickTouch, WMFixture) mc3_u.num_tfingers = 1; // Set last click position on mc1 - MOCK_EXPECT(dsk->Msg_LeftDown).once().with(mc1).in(s).returns(true); - MOCK_EXPECT(dsk->Msg_LeftUp).once().with(mc1_u).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftDown).once().with(mc1).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftUp).once().with(mc1_u).in(s).returns(true); // Touch position mc2 -> Too far away fom previous point -> Set last click position on mc2 - MOCK_EXPECT(dsk->Msg_LeftDown).once().with(mc2).in(s).returns(true); - MOCK_EXPECT(dsk->Msg_LeftUp).once().with(mc2_u).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftDown).once().with(mc2).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftUp).once().with(mc2_u).in(s).returns(true); // Touch position mc3 -> In range of mc -> dblclick - MOCK_EXPECT(dsk->Msg_LeftDown).once().with(mc3).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftDown).once().with(mc3).in(s).returns(true); MouseCoords range_mc3(mc3.pos); range_mc3.dbl_click = true; range_mc3.num_tfingers = 1; - MOCK_EXPECT(dsk->Msg_LeftUp).once().with(range_mc3).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftUp).once().with(range_mc3).in(s).returns(true); // Try to touch 3rd time -> no dblclick -> Set last click position to mc3 - MOCK_EXPECT(dsk->Msg_LeftDown).once().with(mc3).in(s).returns(true); - MOCK_EXPECT(dsk->Msg_LeftUp).once().with(mc3_u).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftDown).once().with(mc3).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftUp).once().with(mc3_u).in(s).returns(true); // Touch position mc3 again -> In range of mc but duration > TOUCH_DOUBLE_CLICK_INTERVAL no dblclick - MOCK_EXPECT(dsk->Msg_LeftDown).once().with(mc3).in(s).returns(true); - MOCK_EXPECT(dsk->Msg_LeftUp).once().with(mc3_u).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftDown).once().with(mc3).in(s).returns(true); + MOCK_EXPECT(dsk->msgLeftUp).once().with(mc3_u).in(s).returns(true); - WINDOWMANAGER.Msg_LeftDown(mc1); + WINDOWMANAGER.msgLeftDown(mc1); video->tickCount_ += 1; - WINDOWMANAGER.Msg_LeftUp(mc1_u); + WINDOWMANAGER.msgLeftUp(mc1_u); - WINDOWMANAGER.Msg_LeftDown(mc2); + WINDOWMANAGER.msgLeftDown(mc2); video->tickCount_ += 1; - WINDOWMANAGER.Msg_LeftUp(mc2_u); + WINDOWMANAGER.msgLeftUp(mc2_u); video->tickCount_ += TOUCH_DOUBLE_CLICK_INTERVAL - 1; - WINDOWMANAGER.Msg_LeftDown(mc3); - WINDOWMANAGER.Msg_LeftUp(mc3_u); + WINDOWMANAGER.msgLeftDown(mc3); + WINDOWMANAGER.msgLeftUp(mc3_u); video->tickCount_ += TOUCH_DOUBLE_CLICK_INTERVAL - 1; - WINDOWMANAGER.Msg_LeftDown(mc3); - WINDOWMANAGER.Msg_LeftUp(mc3_u); + WINDOWMANAGER.msgLeftDown(mc3); + WINDOWMANAGER.msgLeftUp(mc3_u); video->tickCount_ += TOUCH_DOUBLE_CLICK_INTERVAL; - WINDOWMANAGER.Msg_LeftDown(mc3); - WINDOWMANAGER.Msg_LeftUp(mc3_u); + WINDOWMANAGER.msgLeftDown(mc3); + WINDOWMANAGER.msgLeftUp(mc3_u); mock::verify(); } @@ -237,9 +237,9 @@ MOCK_BASE_CLASS(TestIngameWnd, IngameWindow) } ~TestIngameWnd() override { closed.push_back(this); } MOCK_METHOD(DrawContent, 0, void()) - MOCK_METHOD(Msg_KeyDown, 1) - MOCK_METHOD(Msg_LeftDown, 1) - MOCK_METHOD(Msg_MiddleDown, 1) + MOCK_METHOD(msgKeyDown, 1) + MOCK_METHOD(msgLeftDown, 1) + MOCK_METHOD(msgMiddleDown, 1) static std::vector closed; }; std::vector TestIngameWnd::closed; @@ -453,7 +453,7 @@ BOOST_FIXTURE_TEST_CASE(ModalWindowPlacement, uiHelper::Fixture) mock::sequence s; for(TestIngameWnd* curWnd : expectedOrder) { - MOCK_EXPECT(curWnd->Msg_KeyDown).once().in(s).returns(true); + MOCK_EXPECT(curWnd->msgKeyDown).once().in(s).returns(true); MOCK_EXPECT(curWnd->DrawContent); // Ignore all draw calls } // Way outside any window, should still be handled @@ -461,7 +461,7 @@ BOOST_FIXTURE_TEST_CASE(ModalWindowPlacement, uiHelper::Fixture) for(TestIngameWnd* curWnd : expectedOrder) { REQUIRE_WINDOW_ACTIVE(curWnd); - WINDOWMANAGER.Msg_KeyDown(ke); + WINDOWMANAGER.msgKeyDown(ke); curWnd->Close(); WINDOWMANAGER.Draw(); } @@ -482,27 +482,27 @@ BOOST_FIXTURE_TEST_CASE(ModalBlocksMouseActivation, uiHelper::Fixture) // Click is over non-modal A, not modal B; B must still receive it instead of the window under the cursor. const Position posInA = wndA->GetDrawPos() + Position(10, 10); - MOCK_EXPECT(wndB->Msg_LeftDown).once().returns(true); + MOCK_EXPECT(wndB->msgLeftDown).once().returns(true); MouseCoords mcDown(posInA); mcDown.ldown = true; - WINDOWMANAGER.Msg_LeftDown(mcDown); - WINDOWMANAGER.Msg_LeftUp(MouseCoords(posInA)); + WINDOWMANAGER.msgLeftDown(mcDown); + WINDOWMANAGER.msgLeftUp(MouseCoords(posInA)); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wndB); REQUIRE_WINDOW_ACTIVE(wndB); BOOST_TEST(!wndA->IsActive()); mock::verify(); - MOCK_EXPECT(wndB->Msg_MiddleDown).once().returns(true); + MOCK_EXPECT(wndB->msgMiddleDown).once().returns(true); MouseCoords mcMiddle(posInA); mcMiddle.mdown = true; - WINDOWMANAGER.Msg_MiddleDown(mcMiddle); + WINDOWMANAGER.msgMiddleDown(mcMiddle); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wndB); BOOST_TEST(!wndA->IsActive()); mock::verify(); // Wheel events must respect modal blocking too; the stack/active state must stay unchanged regardless. - WINDOWMANAGER.Msg_WheelUp(MouseCoords(posInA)); - WINDOWMANAGER.Msg_WheelDown(MouseCoords(posInA)); + WINDOWMANAGER.msgWheelUp(MouseCoords(posInA)); + WINDOWMANAGER.msgWheelDown(MouseCoords(posInA)); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wndB); REQUIRE_WINDOW_ACTIVE(wndB); BOOST_TEST(!wndA->IsActive()); @@ -546,22 +546,22 @@ BOOST_FIXTURE_TEST_CASE(ClickActivatesBackgroundNonModal, uiHelper::Fixture) BOOST_TEST(!wndA->IsActive()); // B is topmost, click is over A which must become topmost/active - MOCK_EXPECT(wndA->Msg_LeftDown).once().returns(true); + MOCK_EXPECT(wndA->msgLeftDown).once().returns(true); MouseCoords mcDownA(wndA->GetDrawPos() + Position(10, 10)); mcDownA.ldown = true; - WINDOWMANAGER.Msg_LeftDown(mcDownA); - WINDOWMANAGER.Msg_LeftUp(MouseCoords(mcDownA.pos)); + WINDOWMANAGER.msgLeftDown(mcDownA); + WINDOWMANAGER.msgLeftUp(MouseCoords(mcDownA.pos)); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wndA); REQUIRE_WINDOW_ACTIVE(wndA); BOOST_TEST(!wndB->IsActive()); mock::verify(); // A is topmost, click is over B which must become topmost/active again - MOCK_EXPECT(wndB->Msg_LeftDown).once().returns(true); + MOCK_EXPECT(wndB->msgLeftDown).once().returns(true); MouseCoords mcDownB(wndB->GetDrawPos() + Position(10, 10)); mcDownB.ldown = true; - WINDOWMANAGER.Msg_LeftDown(mcDownB); - WINDOWMANAGER.Msg_LeftUp(MouseCoords(mcDownB.pos)); + WINDOWMANAGER.msgLeftDown(mcDownB); + WINDOWMANAGER.msgLeftUp(MouseCoords(mcDownB.pos)); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wndB); REQUIRE_WINDOW_ACTIVE(wndB); BOOST_TEST(!wndA->IsActive()); @@ -573,7 +573,7 @@ BOOST_FIXTURE_TEST_CASE(EscClosesWindow, uiHelper::Fixture) auto* wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); const KeyEvent evEsc(KeyType::Escape); - WINDOWMANAGER.Msg_KeyDown(evEsc); + WINDOWMANAGER.msgKeyDown(evEsc); WINDOWMANAGER.Draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == nullptr); REQUIRE_WINDOW_DESTROYED(wnd); @@ -582,21 +582,21 @@ BOOST_FIXTURE_TEST_CASE(EscClosesWindow, uiHelper::Fixture) auto* wnd1 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); auto* wnd2 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); auto* wnd3 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, true)); - WINDOWMANAGER.Msg_KeyDown(evEsc); - WINDOWMANAGER.Msg_KeyDown(evEsc); + WINDOWMANAGER.msgKeyDown(evEsc); + WINDOWMANAGER.msgKeyDown(evEsc); MOCK_EXPECT(wnd1->DrawContent).once(); WINDOWMANAGER.Draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd1); REQUIRE_WINDOW_DESTROYED(wnd2); REQUIRE_WINDOW_DESTROYED(wnd3); - WINDOWMANAGER.Msg_KeyDown(evEsc); + WINDOWMANAGER.msgKeyDown(evEsc); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_DESTROYED(wnd1); // ESC does not close non-user-closable windows wnd1 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, false, CloseBehavior::Custom)); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd1); - WINDOWMANAGER.Msg_KeyDown(evEsc); + WINDOWMANAGER.msgKeyDown(evEsc); REQUIRE_WINDOW_ALIVE(wnd1); MOCK_EXPECT(wnd1->DrawContent).once(); WINDOWMANAGER.Draw(); @@ -604,7 +604,7 @@ BOOST_FIXTURE_TEST_CASE(EscClosesWindow, uiHelper::Fixture) wnd2 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, true, CloseBehavior::Custom)); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd2); - WINDOWMANAGER.Msg_KeyDown(evEsc); + WINDOWMANAGER.msgKeyDown(evEsc); REQUIRE_WINDOW_ALIVE(wnd1); REQUIRE_WINDOW_ALIVE(wnd2); MOCK_EXPECT(wnd1->DrawContent).once(); @@ -619,7 +619,7 @@ BOOST_FIXTURE_TEST_CASE(RightclickClosesWindow, uiHelper::Fixture) BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); MouseCoords evRDown(wnd->GetDrawPos() + Position(10, 10)); evRDown.rdown = true; - WINDOWMANAGER.Msg_RightDown(evRDown); + WINDOWMANAGER.msgRightDown(evRDown); WINDOWMANAGER.Draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == nullptr); REQUIRE_WINDOW_DESTROYED(wnd); @@ -627,7 +627,7 @@ BOOST_FIXTURE_TEST_CASE(RightclickClosesWindow, uiHelper::Fixture) // Only close top most window auto* wnd1 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); auto* wnd2 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); - WINDOWMANAGER.Msg_RightDown(evRDown); + WINDOWMANAGER.msgRightDown(evRDown); MOCK_EXPECT(wnd1->DrawContent).once(); WINDOWMANAGER.Draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd1); @@ -635,7 +635,7 @@ BOOST_FIXTURE_TEST_CASE(RightclickClosesWindow, uiHelper::Fixture) // Also modal windows, even when not opened last wnd2 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, true)); auto* wnd3 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); - WINDOWMANAGER.Msg_RightDown(evRDown); + WINDOWMANAGER.msgRightDown(evRDown); REQUIRE_WINDOW_ALIVE(wnd1); REQUIRE_WINDOW_ALIVE(wnd3); MOCK_EXPECT(wnd1->DrawContent).once(); @@ -643,10 +643,10 @@ BOOST_FIXTURE_TEST_CASE(RightclickClosesWindow, uiHelper::Fixture) WINDOWMANAGER.Draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd3); REQUIRE_WINDOW_DESTROYED(wnd2); - WINDOWMANAGER.Msg_RightDown(evRDown); + WINDOWMANAGER.msgRightDown(evRDown); MOCK_EXPECT(wnd1->DrawContent).once(); WINDOWMANAGER.Draw(); - WINDOWMANAGER.Msg_RightDown(evRDown); + WINDOWMANAGER.msgRightDown(evRDown); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_DESTROYED(wnd1); REQUIRE_WINDOW_DESTROYED(wnd3); @@ -654,14 +654,14 @@ BOOST_FIXTURE_TEST_CASE(RightclickClosesWindow, uiHelper::Fixture) // Don't close non-user-closable windows wnd1 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, false, CloseBehavior::Custom)); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd1); - WINDOWMANAGER.Msg_RightDown(evRDown); + WINDOWMANAGER.msgRightDown(evRDown); MOCK_EXPECT(wnd1->DrawContent).once(); WINDOWMANAGER.Draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd1); wnd2 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, true, CloseBehavior::NoRightClick)); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd2); - WINDOWMANAGER.Msg_RightDown(evRDown); + WINDOWMANAGER.msgRightDown(evRDown); MOCK_EXPECT(wnd1->DrawContent).once(); MOCK_EXPECT(wnd2->DrawContent).once(); WINDOWMANAGER.Draw(); @@ -682,7 +682,7 @@ BOOST_FIXTURE_TEST_CASE(PinnedWindows, uiHelper::Fixture) BOOST_TEST_CONTEXT("Pinned") { BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); - WINDOWMANAGER.Msg_KeyDown(evEsc); + WINDOWMANAGER.msgKeyDown(evEsc); MOCK_EXPECT(wnd->DrawContent).once(); WINDOWMANAGER.Draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); @@ -691,7 +691,7 @@ BOOST_FIXTURE_TEST_CASE(PinnedWindows, uiHelper::Fixture) wnd->SetPinned(false); BOOST_TEST_CONTEXT("Un-pinned") { - WINDOWMANAGER.Msg_KeyDown(evEsc); + WINDOWMANAGER.msgKeyDown(evEsc); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_DESTROYED(wnd); } @@ -705,7 +705,7 @@ BOOST_FIXTURE_TEST_CASE(PinnedWindows, uiHelper::Fixture) BOOST_TEST_CONTEXT("Pinned") { BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); - WINDOWMANAGER.Msg_KeyDown(evAltW); + WINDOWMANAGER.msgKeyDown(evAltW); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_DESTROYED(wnd); } @@ -721,7 +721,7 @@ BOOST_FIXTURE_TEST_CASE(PinnedWindows, uiHelper::Fixture) wnd->SetPinned(); BOOST_TEST_CONTEXT("Pinned") { - WINDOWMANAGER.Msg_RightDown(evRDown); + WINDOWMANAGER.msgRightDown(evRDown); MOCK_EXPECT(wnd->DrawContent).once(); WINDOWMANAGER.Draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); @@ -730,7 +730,7 @@ BOOST_FIXTURE_TEST_CASE(PinnedWindows, uiHelper::Fixture) wnd->SetPinned(false); BOOST_TEST_CONTEXT("Un-pinned") { - WINDOWMANAGER.Msg_RightDown(evRDown); + WINDOWMANAGER.msgRightDown(evRDown); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_DESTROYED(wnd); } @@ -802,7 +802,7 @@ BOOST_FIXTURE_TEST_CASE(TestTransmitSettingsAdapter, uiHelper::Fixture) wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_TOOLS)); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); MOCK_EXPECT(wnd->TransmitSettings).once(); - WINDOWMANAGER.Msg_KeyDown(KeyEvent(KeyType::Escape)); + WINDOWMANAGER.msgKeyDown(KeyEvent(KeyType::Escape)); WINDOWMANAGER.Draw(); BOOST_TEST(MockSettingsWnd::activeWnds == 0); BOOST_TEST(WINDOWMANAGER.GetTopMostWindow() == nullptr); @@ -814,7 +814,7 @@ BOOST_FIXTURE_TEST_CASE(TestTransmitSettingsAdapter, uiHelper::Fixture) MOCK_EXPECT(wnd->TransmitSettings).once(); KeyEvent ke('w'); ke.alt = true; - WINDOWMANAGER.Msg_KeyDown(ke); + WINDOWMANAGER.msgKeyDown(ke); WINDOWMANAGER.Draw(); BOOST_TEST(MockSettingsWnd::activeWnds == 0); BOOST_TEST(WINDOWMANAGER.GetTopMostWindow() == nullptr); diff --git a/tests/s25Main/UI/testWindows.cpp b/tests/s25Main/UI/testWindows.cpp index f128446c7f..d835b3576c 100644 --- a/tests/s25Main/UI/testWindows.cpp +++ b/tests/s25Main/UI/testWindows.cpp @@ -156,7 +156,7 @@ struct AddonPresetFixture : uiHelper::Fixture static void answerMsgbox(Window& wnd, unsigned msgboxId, MsgboxResult result) { auto& prompt = ensureNonNull(topMsgbox()); - wnd.Msg_MsgBoxResult(msgboxId, result); + wnd.msgMsgBoxResult(msgboxId, result); closeMsgbox(prompt); } @@ -165,7 +165,7 @@ struct AddonPresetFixture : uiHelper::Fixture iwSaveAddonPreset wnd(states); Window& base = wnd; base.GetCtrls().at(0)->SetText(name); - base.Msg_ButtonClick(iwAddonPresetsBase::ID_btAction); + base.msgButtonClick(iwAddonPresetsBase::ID_btAction); } // Returns the given preset's settings, or empty if the preset is missing or corrupt. @@ -175,7 +175,7 @@ struct AddonPresetFixture : uiHelper::Fixture iwLoadAddonPreset wnd([&](const std::map& s) { out = s; }); Window& base = wnd; if(select(base, name)) - base.Msg_ButtonClick(iwAddonPresetsBase::ID_btAction); + base.msgButtonClick(iwAddonPresetsBase::ID_btAction); return out; } @@ -206,7 +206,7 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetOverwrite, AddonPresetFixture) iwSaveAddonPreset wnd(newStates); Window& base = wnd; base.GetCtrls().at(0)->SetText("myPreset"); - base.Msg_EditEnter(0); + base.msgEditEnter(0); const auto& msgbox = ensureNonNull(topMsgbox()); BOOST_TEST(msgbox.GetTitle() == _("Overwrite Preset")); @@ -221,7 +221,7 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetOverwrite, AddonPresetFixture) iwSaveAddonPreset wnd(newStates); Window& base = wnd; base.GetCtrls().at(0)->SetText("myPreset"); - base.Msg_EditEnter(0); + base.msgEditEnter(0); answerMsgbox(base, iwSaveAddonPreset::ID_mbOverwrite, MsgboxResult::Yes); } BOOST_TEST(load("myPreset") == newStates); @@ -249,7 +249,7 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetDoubleClickLoads, AddonPresetFixture) iwLoadAddonPreset wnd([&](const std::map& s) { loaded = s; }); Window& base = wnd; BOOST_TEST_REQUIRE(select(base, "myPreset")); - base.Msg_TableChooseItem(iwAddonPresetsBase::ID_tblPresets, 0u); + base.msgTableChooseItem(iwAddonPresetsBase::ID_tblPresets, 0u); BOOST_TEST_REQUIRE(loaded.has_value()); BOOST_TEST(*loaded == states); @@ -267,11 +267,11 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetLoadCorrupt, AddonPresetFixture) iwLoadAddonPreset wnd([&](const std::map&) noexcept { ++numLoaded; }); Window& base = wnd; BOOST_TEST_REQUIRE(select(base, "valid")); - base.Msg_ButtonClick(iwAddonPresetsBase::ID_btAction); + base.msgButtonClick(iwAddonPresetsBase::ID_btAction); BOOST_TEST_REQUIRE(numLoaded == 1u); BOOST_TEST_REQUIRE(select(base, "corrupt")); - base.Msg_ButtonClick(iwAddonPresetsBase::ID_btAction); + base.msgButtonClick(iwAddonPresetsBase::ID_btAction); BOOST_TEST(numLoaded == 1u); // nothing is applied from a corrupt preset auto& msgbox = ensureNonNull(topMsgbox()); @@ -289,7 +289,7 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetSaveUnwritable, AddonPresetFixture) iwSaveAddonPreset wnd(states); Window& base = wnd; base.GetCtrls().at(0)->SetText("blocked"); - base.Msg_ButtonClick(iwAddonPresetsBase::ID_btAction); + base.msgButtonClick(iwAddonPresetsBase::ID_btAction); answerMsgbox(base, iwSaveAddonPreset::ID_mbOverwrite, MsgboxResult::Yes); auto& msgbox = ensureNonNull(topMsgbox()); @@ -331,7 +331,7 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetSaveNameFollowsSelection, AddonPresetFixture) BOOST_TEST(!table.GetSelection().has_value()); BOOST_TEST(!deleteBtn.GetEnabled()); BOOST_TEST(edit.GetText() == "presetC"); - base.Msg_EditEnter(0); + base.msgEditEnter(0); BOOST_TEST(numPresets() == 3u); BOOST_TEST(load("presetC") == statesNew); // saved under the typed name @@ -346,7 +346,7 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetDelete, AddonPresetFixture) iwLoadAddonPreset wnd([](const std::map&) noexcept {}); Window& base = wnd; BOOST_TEST_REQUIRE(select(base, "toDelete")); - base.Msg_ButtonClick(iwAddonPresetsBase::ID_btDelete); + base.msgButtonClick(iwAddonPresetsBase::ID_btDelete); const auto& msgbox = ensureNonNull(topMsgbox()); BOOST_TEST(msgbox.GetTitle() == _("Delete Preset")); @@ -367,7 +367,7 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetSaveWindowCanDelete, AddonPresetFixture) iwSaveAddonPreset wnd(std::map{{9, 9}}); Window& base = wnd; BOOST_TEST_REQUIRE(select(base, "toDelete")); - base.Msg_ButtonClick(iwAddonPresetsBase::ID_btDelete); + base.msgButtonClick(iwAddonPresetsBase::ID_btDelete); answerMsgbox(base, iwAddonPresetsBase::ID_mbDelete, MsgboxResult::Yes); BOOST_TEST(numPresets() == 0u); @@ -425,8 +425,8 @@ MOCK_BASE_CLASS(TestWindow, Window) { public: TestWindow(Window * parent, unsigned id, const DrawPoint& position) : Window(parent, id, position) {} - MOCK_METHOD(Msg_PaintBefore, 0) - MOCK_METHOD(Msg_PaintAfter, 0) + MOCK_METHOD(msgPaintBefore, 0) + MOCK_METHOD(msgPaintAfter, 0) MOCK_METHOD(Draw_, 0, void()) }; } // namespace @@ -455,11 +455,11 @@ BOOST_AUTO_TEST_CASE(DrawOrder) mock::sequence s; // Note: Actually order of calls to controls is undefined but in practice matches the IDs for(TestWindow* wnd : wnds) - MOCK_EXPECT(wnd->Msg_PaintBefore).once().in(s); + MOCK_EXPECT(wnd->msgPaintBefore).once().in(s); for(TestWindow* wnd : wnds) MOCK_EXPECT(wnd->Draw_).once().in(s); for(TestWindow* wnd : wnds) - MOCK_EXPECT(wnd->Msg_PaintAfter).once().in(s); + MOCK_EXPECT(wnd->msgPaintAfter).once().in(s); WINDOWMANAGER.Draw(); mock::verify(); } diff --git a/tests/s25Main/integration/testBuildingRadius.cpp b/tests/s25Main/integration/testBuildingRadius.cpp index 2b946846c5..c999a146f3 100644 --- a/tests/s25Main/integration/testBuildingRadius.cpp +++ b/tests/s25Main/integration/testBuildingRadius.cpp @@ -214,7 +214,7 @@ BOOST_FIXTURE_TEST_CASE(TestUpdateRadiusPreview, GameWorldViewFixture) for(const auto bt : {BuildingType::Watchtower, BuildingType::Mill, BuildingType::Catapult}) { const auto& icon = findIcon(bt); - WINDOWMANAGER.Msg_MouseMove(MouseCoords(icon.GetDrawPos() + DrawPoint(1, 1))); + WINDOWMANAGER.msgMouseMove(MouseCoords(icon.GetDrawPos() + DrawPoint(1, 1))); BOOST_TEST_REQUIRE(icon.getState() == Window::ButtonState::Hover); const auto& radius = view.getRadiusPreview(); // Mill has no radius, so preview is hidden @@ -228,12 +228,12 @@ BOOST_FIXTURE_TEST_CASE(TestUpdateRadiusPreview, GameWorldViewFixture) } // Moving mouse away from icons hides radius preview BOOST_TEST_REQUIRE(view.getRadiusPreview().has_value()); - WINDOWMANAGER.Msg_MouseMove(MouseCoords(action.GetDrawPos())); + WINDOWMANAGER.msgMouseMove(MouseCoords(action.GetDrawPos())); BOOST_TEST(!view.getRadiusPreview()); // Closing the action window hides radius preview const auto& icon = findIcon(BuildingType::Watchtower); - WINDOWMANAGER.Msg_MouseMove(MouseCoords(icon.GetDrawPos() + DrawPoint(1, 1))); + WINDOWMANAGER.msgMouseMove(MouseCoords(icon.GetDrawPos() + DrawPoint(1, 1))); BOOST_TEST_REQUIRE(view.getRadiusPreview().has_value()); WINDOWMANAGER.CloseNow(&action); BOOST_TEST(!view.getRadiusPreview()); diff --git a/tests/s25Main/integration/testDskGameInterface.cpp b/tests/s25Main/integration/testDskGameInterface.cpp index 9277f03fc6..1d2b42b71b 100644 --- a/tests/s25Main/integration/testDskGameInterface.cpp +++ b/tests/s25Main/integration/testDskGameInterface.cpp @@ -35,12 +35,12 @@ struct dskGameInterfaceMock : public dskGameInterface dskGameInterfaceMock(std::shared_ptr game) : dskGameInterface(std::move(game), std::shared_ptr(), 0, false) {} - void Msg_PaintBefore() override {} - void Msg_PaintAfter() override {} + void msgPaintBefore() override {} + void msgPaintAfter() override {} using dskGameInterface::actionwindow; - using dskGameInterface::Msg_KeyDown; - using dskGameInterface::Msg_WheelDown; - using dskGameInterface::Msg_WheelUp; + using dskGameInterface::msgKeyDown; + using dskGameInterface::msgWheelDown; + using dskGameInterface::msgWheelUp; }; struct GameInterfaceFixture : uiHelper::Fixture { @@ -59,11 +59,11 @@ void checkNotScrolling(const GameWorldView& view, Cursor cursor = Cursor::Hand) { const DrawPoint pos = view.GetOffset(); MouseCoords mouse(Position(40, 11)); - WINDOWMANAGER.Msg_MouseMove(mouse); + WINDOWMANAGER.msgMouseMove(mouse); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == cursor); BOOST_TEST_REQUIRE(view.GetOffset() == pos); mouse.pos += Position(-20, 30); - WINDOWMANAGER.Msg_MouseMove(mouse); + WINDOWMANAGER.msgMouseMove(mouse); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == cursor); BOOST_TEST_REQUIRE(view.GetOffset() == pos); } @@ -80,21 +80,21 @@ BOOST_FIXTURE_TEST_CASE(Scrolling, GameInterfaceFixture) // Regular scrolling: Right down, 2 moves, right up { - WINDOWMANAGER.Msg_RightDown(mouse); + WINDOWMANAGER.msgRightDown(mouse); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); DrawPoint pos = view->GetOffset(); mouse.pos = startPos + Position(4, 3); - WINDOWMANAGER.Msg_MouseMove(mouse); + WINDOWMANAGER.msgMouseMove(mouse); pos += acceleration * Position(4, 3); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); BOOST_TEST_REQUIRE(view->GetOffset() == pos); mouse.pos = startPos + Position(-6, 7); - WINDOWMANAGER.Msg_MouseMove(mouse); + WINDOWMANAGER.msgMouseMove(mouse); pos += acceleration * Position(-6, 7); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); BOOST_TEST_REQUIRE(view->GetOffset() == pos); mouse.rdown = false; - WINDOWMANAGER.Msg_RightUp(mouse); + WINDOWMANAGER.msgRightUp(mouse); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Hand); BOOST_TEST_REQUIRE(view->GetOffset() == pos); checkNotScrolling(*view); @@ -102,68 +102,68 @@ BOOST_FIXTURE_TEST_CASE(Scrolling, GameInterfaceFixture) { SETTINGS.interface.mapScrollMode = MapScrollMode::ScrollSame; - WINDOWMANAGER.Msg_RightDown(mouse); + WINDOWMANAGER.msgRightDown(mouse); startPos = mouse.pos; BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); const DrawPoint pos = view->GetOffset(); mouse.pos = startPos + Position(4, 3); - WINDOWMANAGER.Msg_MouseMove(mouse); + WINDOWMANAGER.msgMouseMove(mouse); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); BOOST_TEST_REQUIRE(view->GetOffset() == pos - acceleration * Position(4, 3)); mouse.rdown = false; - WINDOWMANAGER.Msg_RightUp(mouse); + WINDOWMANAGER.msgRightUp(mouse); SETTINGS.interface.mapScrollMode = MapScrollMode::ScrollOpposite; } { SETTINGS.interface.mapScrollMode = MapScrollMode::GrabAndDrag; - WINDOWMANAGER.Msg_RightDown(mouse); + WINDOWMANAGER.msgRightDown(mouse); startPos = mouse.pos; BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); const DrawPoint pos = view->GetOffset(); mouse.pos = startPos + Position(4, 3); - WINDOWMANAGER.Msg_MouseMove(mouse); + WINDOWMANAGER.msgMouseMove(mouse); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); BOOST_TEST_REQUIRE(view->GetOffset() == pos - Position(4, 3)); mouse.rdown = false; - WINDOWMANAGER.Msg_RightUp(mouse); + WINDOWMANAGER.msgRightUp(mouse); SETTINGS.interface.mapScrollMode = MapScrollMode::ScrollOpposite; } // Opening a window does not cancel scrolling { mouse.rdown = true; - WINDOWMANAGER.Msg_RightDown(mouse); + WINDOWMANAGER.msgRightDown(mouse); startPos = mouse.pos; DrawPoint pos = view->GetOffset(); KeyEvent key; key.kt = KeyType::Char; key.c = 'm'; key.ctrl = key.alt = key.shift = false; - WINDOWMANAGER.Msg_KeyDown(key); + WINDOWMANAGER.msgKeyDown(key); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow()); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); mouse.pos = startPos + Position(-6, 7); - WINDOWMANAGER.Msg_MouseMove(mouse); + WINDOWMANAGER.msgMouseMove(mouse); pos += acceleration * Position(-6, 7); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); BOOST_TEST_REQUIRE(view->GetOffset() == pos); // Closing it doesn't either - WINDOWMANAGER.Msg_KeyDown(key); + WINDOWMANAGER.msgKeyDown(key); WINDOWMANAGER.Draw(); BOOST_TEST_REQUIRE(gameDesktop->IsActive()); BOOST_TEST_REQUIRE(!WINDOWMANAGER.GetTopMostWindow()); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); mouse.pos = startPos + Position(-6, 7); - WINDOWMANAGER.Msg_MouseMove(mouse); + WINDOWMANAGER.msgMouseMove(mouse); pos += acceleration * Position(-6, 7); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); BOOST_TEST_REQUIRE(view->GetOffset() == pos); // Left click does cancel it mouse.ldown = true; - WINDOWMANAGER.Msg_LeftDown(mouse); + WINDOWMANAGER.msgLeftDown(mouse); mouse.ldown = false; - WINDOWMANAGER.Msg_LeftUp(mouse); + WINDOWMANAGER.msgLeftUp(mouse); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Hand); BOOST_TEST_REQUIRE(view->GetOffset() == pos); checkNotScrolling(*view); @@ -180,34 +180,34 @@ BOOST_FIXTURE_TEST_CASE(ScrollingWhileRoadBuilding, GameInterfaceFixture) MouseCoords mouse(startPos); mouse.rdown = true; // Regular scrolling - WINDOWMANAGER.Msg_RightDown(mouse); + WINDOWMANAGER.msgRightDown(mouse); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); DrawPoint pos = view->GetOffset(); mouse.pos = startPos + Position(4, 3); - WINDOWMANAGER.Msg_MouseMove(mouse); + WINDOWMANAGER.msgMouseMove(mouse); pos += acceleration * Position(4, 3); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); BOOST_TEST_REQUIRE(view->GetOffset() == pos); mouse.rdown = false; - WINDOWMANAGER.Msg_RightUp(mouse); + WINDOWMANAGER.msgRightUp(mouse); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Remove); BOOST_TEST_REQUIRE(view->GetOffset() == pos); checkNotScrolling(*view, Cursor::Remove); // left click also stops scrolling mouse.rdown = true; - WINDOWMANAGER.Msg_RightDown(mouse); + WINDOWMANAGER.msgRightDown(mouse); startPos = mouse.pos; BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); mouse.pos = startPos + Position(-6, 7); - WINDOWMANAGER.Msg_MouseMove(mouse); + WINDOWMANAGER.msgMouseMove(mouse); pos += acceleration * Position(-6, 7); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); BOOST_TEST_REQUIRE(view->GetOffset() == pos); mouse.ldown = true; - WINDOWMANAGER.Msg_LeftDown(mouse); + WINDOWMANAGER.msgLeftDown(mouse); mouse.ldown = false; - WINDOWMANAGER.Msg_LeftUp(mouse); + WINDOWMANAGER.msgLeftUp(mouse); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Remove); BOOST_TEST_REQUIRE(view->GetOffset() == pos); checkNotScrolling(*view, Cursor::Remove); @@ -220,16 +220,16 @@ BOOST_FIXTURE_TEST_CASE(ScrollingWithCtrl, GameInterfaceFixture) MouseCoords mouse(startPos); mouse.ldown = true; uiHelper::GetVideoDriver()->modKeyState_.ctrl = true; - WINDOWMANAGER.Msg_LeftDown(mouse); + WINDOWMANAGER.msgLeftDown(mouse); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); DrawPoint pos = view->GetOffset(); mouse.pos = startPos + Position(4, 3); - WINDOWMANAGER.Msg_MouseMove(mouse); + WINDOWMANAGER.msgMouseMove(mouse); pos += acceleration * Position(4, 3); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); BOOST_TEST_REQUIRE(view->GetOffset() == pos); mouse.ldown = false; - WINDOWMANAGER.Msg_LeftUp(mouse); + WINDOWMANAGER.msgLeftUp(mouse); BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Hand); BOOST_TEST_REQUIRE(view->GetOffset() == pos); checkNotScrolling(*view); @@ -257,58 +257,58 @@ BOOST_FIXTURE_TEST_CASE(Zooming, GameInterfaceFixture) BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); for(size_t i = ZOOM_DEFAULT_INDEX + 1; i < ZOOM_FACTORS.size(); i++) { - gameDesktop->Msg_KeyDown(zoomInEv); + gameDesktop->msgKeyDown(zoomInEv); BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[i]); } // Wrap around - gameDesktop->Msg_KeyDown(zoomInEv); + gameDesktop->msgKeyDown(zoomInEv); BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[0]); - gameDesktop->Msg_KeyDown(zoomInEv); + gameDesktop->msgKeyDown(zoomInEv); BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[1]); - gameDesktop->Msg_KeyDown(zoomOutEv); + gameDesktop->msgKeyDown(zoomOutEv); BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[0]); - gameDesktop->Msg_KeyDown(zoomOutEv); + gameDesktop->msgKeyDown(zoomOutEv); BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS.back()); - gameDesktop->Msg_KeyDown(zoomDefaultEv); + gameDesktop->msgKeyDown(zoomDefaultEv); BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); - gameDesktop->Msg_WheelDown({}); + gameDesktop->msgWheelDown({}); auto curZoom = view->GetCurrentTargetZoomFactor(); BOOST_TEST(curZoom < ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); BOOST_TEST(curZoom > ZOOM_FACTORS[ZOOM_DEFAULT_INDEX - 1]); // Go to prev index - gameDesktop->Msg_KeyDown(zoomOutEv); + gameDesktop->msgKeyDown(zoomOutEv); BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[ZOOM_DEFAULT_INDEX - 1]); - gameDesktop->Msg_KeyDown(zoomDefaultEv); - gameDesktop->Msg_WheelUp({}); + gameDesktop->msgKeyDown(zoomDefaultEv); + gameDesktop->msgWheelUp({}); curZoom = view->GetCurrentTargetZoomFactor(); BOOST_TEST(curZoom > ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); BOOST_TEST(curZoom < ZOOM_FACTORS[ZOOM_DEFAULT_INDEX + 1]); // Go to next index - gameDesktop->Msg_KeyDown(zoomInEv); + gameDesktop->msgKeyDown(zoomInEv); BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[ZOOM_DEFAULT_INDEX + 1]); - gameDesktop->Msg_WheelDown({}); + gameDesktop->msgWheelDown({}); curZoom = view->GetCurrentTargetZoomFactor(); BOOST_TEST(curZoom > ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); BOOST_TEST(curZoom < ZOOM_FACTORS[ZOOM_DEFAULT_INDEX + 1]); // Go to prev index - gameDesktop->Msg_KeyDown(zoomOutEv); + gameDesktop->msgKeyDown(zoomOutEv); BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); // Zoom in and out gets to 1.0 (default) static_assert(ZOOM_FACTORS[ZOOM_DEFAULT_INDEX] == 1.f); - gameDesktop->Msg_WheelUp({}); - gameDesktop->Msg_WheelDown({}); + gameDesktop->msgWheelUp({}); + gameDesktop->msgWheelDown({}); BOOST_TEST(view->GetCurrentTargetZoomFactor() == 1.f); const auto numZoom = rttr::test::randomValue(2, 10); for(int i = 0; i < numZoom; i++) - gameDesktop->Msg_WheelDown({}); + gameDesktop->msgWheelDown({}); for(int i = 0; i < numZoom; i++) - gameDesktop->Msg_WheelUp({}); + gameDesktop->msgWheelUp({}); BOOST_TEST(view->GetCurrentTargetZoomFactor() == 1.f); } From 3ffc4a718eb84e7360f0788b731197350021fa75 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Mon, 16 Nov 2026 12:17:28 +0100 Subject: [PATCH 3/7] Rename remaining underscore-style methods to lowerCamelCase --- libs/common/include/RTTR_Assert.h | 32 +++++------ libs/common/src/RTTR_Assert.cpp | 6 +- libs/s25main/SerializedGameData.cpp | 8 +-- libs/s25main/SerializedGameData.h | 4 +- libs/s25main/desktops/dskGameLobby.cpp | 12 ++-- libs/s25main/figures/noFigure.cpp | 4 +- libs/s25main/figures/noFigure.h | 2 +- libs/s25main/figures/nofAttacker.cpp | 6 +- libs/s25main/figures/nofAttacker.h | 2 +- libs/s25main/figures/nofCarrier.cpp | 2 +- libs/s25main/figures/nofCarrier.h | 2 +- libs/s25main/ingameWindows/iwChat.cpp | 2 +- libs/s25main/network/GameClient.cpp | 8 +-- libs/s25main/network/GameClient.h | 16 +++--- libs/s25main/network/GameClientCommands.cpp | 12 ++-- libs/s25main/network/GameClientGF_Replay.cpp | 2 +- libs/s25main/network/GameMessage.cpp | 2 +- libs/s25main/network/GameMessage.h | 4 +- libs/s25main/network/NetworkPlayer.cpp | 2 +- libs/s25main/nodeObjs/noShip.cpp | 56 +++++++++---------- libs/s25main/nodeObjs/noShip.h | 12 ++-- .../s25Main/integration/testSerialization.cpp | 2 +- tests/s25Main/simple/testGameMessages.cpp | 2 +- tests/testHelpers/rttr/test/LogAccessor.hpp | 4 +- 24 files changed, 102 insertions(+), 102 deletions(-) diff --git a/libs/common/include/RTTR_Assert.h b/libs/common/include/RTTR_Assert.h index 65fd44124f..4b4647636b 100644 --- a/libs/common/include/RTTR_Assert.h +++ b/libs/common/include/RTTR_Assert.h @@ -27,12 +27,12 @@ extern void __cdecl __debugbreak(); # define RTTR_BREAKPOINT #endif -[[noreturn]] void RTTR_AssertFailure(const char* condition, const char* file, int line, const char* function); +[[noreturn]] void rttrAssertFailure(const char* condition, const char* file, int line, const char* function); /// If true(default), a breakpoint is triggered on assert (if available) /// Note: This breakpoint can be globally disabled by setting the environment variable /// RTTR_DISABLE_ASSERT_BREAKPOINT to "1" or "yes" which overrides this setting -bool RTTR_IsBreakOnAssertFailureEnabled(); -bool RTTR_SetBreakOnAssertFailure(bool enabled); +bool rttrIsBreakOnAssertFailureEnabled(); +bool rttrSetBreakOnAssertFailure(bool enabled); /* Some aspects about RTTR_Assert: - do-while(false) so it can be used in conditions: if(foo) RTTR_Assert(bar); @@ -41,19 +41,19 @@ bool RTTR_SetBreakOnAssertFailure(bool enabled); - RTTR_AssertNoThrow which does just logging and triggers a breakpoint but does not throw (e.g. for dtors) */ #if RTTR_ENABLE_ASSERTS -# define RTTR_Assert(cond) \ - do \ - { \ - RTTR_IGNORE_UNREACHABLE_CODE \ - if(!(cond)) /* NOLINT(readability-simplify-boolean-expr)*/ \ - { \ - if(RTTR_IsBreakOnAssertFailureEnabled()) \ - { \ - RTTR_BREAKPOINT; \ - } \ - RTTR_AssertFailure(#cond, __FILE__, __LINE__, __func__); \ - } \ - RTTR_POP_DIAGNOSTIC \ +# define RTTR_Assert(cond) \ + do \ + { \ + RTTR_IGNORE_UNREACHABLE_CODE \ + if(!(cond)) /* NOLINT(readability-simplify-boolean-expr)*/ \ + { \ + if(rttrIsBreakOnAssertFailureEnabled()) \ + { \ + RTTR_BREAKPOINT; \ + } \ + rttrAssertFailure(#cond, __FILE__, __LINE__, __func__); \ + } \ + RTTR_POP_DIAGNOSTIC \ } while(false) #else # define RTTR_Assert(cond) \ diff --git a/libs/common/src/RTTR_Assert.cpp b/libs/common/src/RTTR_Assert.cpp index 09548f9a69..1e37b09046 100644 --- a/libs/common/src/RTTR_Assert.cpp +++ b/libs/common/src/RTTR_Assert.cpp @@ -14,14 +14,14 @@ static bool breakOnAssertFailureEnabled = true; -bool RTTR_SetBreakOnAssertFailure(bool enabled) +bool rttrSetBreakOnAssertFailure(bool enabled) { const bool old = breakOnAssertFailureEnabled; breakOnAssertFailureEnabled = enabled; return old; } -bool RTTR_IsBreakOnAssertFailureEnabled() +bool rttrIsBreakOnAssertFailureEnabled() { if(!breakOnAssertFailureEnabled) return false; @@ -36,7 +36,7 @@ bool RTTR_IsBreakOnAssertFailureEnabled() return true; } -void RTTR_AssertFailure(const char* condition, const char* file, const int line, const char* function) +void rttrAssertFailure(const char* condition, const char* file, const int line, const char* function) { static const std::string thisFilePath = __FILE__; static bool inAssertFailure = false; diff --git a/libs/s25main/SerializedGameData.cpp b/libs/s25main/SerializedGameData.cpp index 50ef81f662..ef444aedca 100644 --- a/libs/s25main/SerializedGameData.cpp +++ b/libs/s25main/SerializedGameData.cpp @@ -112,7 +112,7 @@ static const unsigned currentGameDataVersion = 15; // clang-format on -std::unique_ptr SerializedGameData::Create_GameObject(const GO_Type got, const unsigned obj_id) +std::unique_ptr SerializedGameData::createGameObject(const GO_Type got, const unsigned obj_id) { switch(got) { @@ -198,7 +198,7 @@ std::unique_ptr SerializedGameData::Create_GameObject(const GO_Type + " found!"); } -std::unique_ptr SerializedGameData::Create_FOWObject(const FoW_Type fowtype) +std::unique_ptr SerializedGameData::createFOWObject(const FoW_Type fowtype) { switch(fowtype) { @@ -463,7 +463,7 @@ std::unique_ptr SerializedGameData::PopFOWObject() return nullptr; // entsprechendes Objekt erzeugen - return Create_FOWObject(type); + return createFOWObject(type); } GameObject* SerializedGameData::PopObject_(helpers::OptionalEnum got) @@ -484,7 +484,7 @@ GameObject* SerializedGameData::PopObject_(helpers::OptionalEnum got) got = Pop(); // und erzeugen - std::unique_ptr go = Create_GameObject(*got, objId); + std::unique_ptr go = createGameObject(*got, objId); // Sicherheitscode auslesen unsigned short safety_code = PopUnsignedShort(); diff --git a/libs/s25main/SerializedGameData.h b/libs/s25main/SerializedGameData.h index c4bef26afd..7ff05ce70d 100644 --- a/libs/s25main/SerializedGameData.h +++ b/libs/s25main/SerializedGameData.h @@ -210,9 +210,9 @@ class SerializedGameData : public Serializer /// Starts reading or writing according to the param void Prepare(bool reading); /// Erzeugt GameObject - std::unique_ptr Create_GameObject(GO_Type got, unsigned obj_id); + std::unique_ptr createGameObject(GO_Type got, unsigned obj_id); /// Erzeugt FOWObject - std::unique_ptr Create_FOWObject(FoW_Type fowtype); + std::unique_ptr createFOWObject(FoW_Type fowtype); void PushObject_(const GameObject* go, bool known); /// Objekt(referenzen) lesen diff --git a/libs/s25main/desktops/dskGameLobby.cpp b/libs/s25main/desktops/dskGameLobby.cpp index d2549cac90..b466d3d0db 100644 --- a/libs/s25main/desktops/dskGameLobby.cpp +++ b/libs/s25main/desktops/dskGameLobby.cpp @@ -575,7 +575,7 @@ void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned c if(gameLobby_->isHost()) lobbyController->SetNation(playerId, player.nation); else - GAMECLIENT.Command_SetNation(player.nation); + GAMECLIENT.commandSetNation(player.nation); ChangeNation(playerId, player.nation); } } @@ -592,7 +592,7 @@ void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned c if(gameLobby_->isHost()) lobbyController->SetPortrait(playerId, player.portraitIndex); else - GAMECLIENT.Command_SetPortrait(player.portraitIndex); + GAMECLIENT.commandSetPortrait(player.portraitIndex); ChangePortrait(playerId, player.portraitIndex); } } @@ -628,7 +628,7 @@ void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned c if(gameLobby_->isHost()) lobbyController->SetColor(playerId, player.color); else - GAMECLIENT.Command_SetColor(player.color); + GAMECLIENT.commandSetColor(player.color); ChangeColor(playerId, player.color); } @@ -647,7 +647,7 @@ void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned c if(gameLobby_->isHost()) lobbyController->SetTeam(playerId, player.team); else - GAMECLIENT.Command_SetTeam(player.team); + GAMECLIENT.commandSetTeam(player.team); ChangeTeam(playerId, player.team); } } @@ -777,7 +777,7 @@ void dskGameLobby::msgEditEnter(const unsigned ctrl_id) const std::string msg = edit->GetText(); edit->SetText(""); if(gameChat->IsVisible()) - GAMECLIENT.Command_Chat(msg, ChatDestination::All); + GAMECLIENT.commandChat(msg, ChatDestination::All); else if(lobbyClient_ && lobbyClient_->IsLoggedIn() && lobbyChat->IsVisible()) lobbyClient_->SendChat(msg); } @@ -1029,7 +1029,7 @@ void dskGameLobby::SetPlayerReady(unsigned char player, bool ready) if(gameLobby_->getPlayer(player).isReady != ready) { gameLobby_->getPlayer(player).isReady = ready; - GAMECLIENT.Command_SetReady(ready); + GAMECLIENT.commandSetReady(ready); } ChangeReady(player, ready); } diff --git a/libs/s25main/figures/noFigure.cpp b/libs/s25main/figures/noFigure.cpp index d0b000fee0..8f6a08c33c 100644 --- a/libs/s25main/figures/noFigure.cpp +++ b/libs/s25main/figures/noFigure.cpp @@ -753,11 +753,11 @@ void noFigure::CorrectSplitData(const RoadSegment* const rs2) } } - CorrectSplitData_Derived(); + correctSplitDataDerived(); } /// Wird aufgerufen, wenn die Straße unter der Figur geteilt wurde (für abgeleitete Klassen) -void noFigure::CorrectSplitData_Derived() {} +void noFigure::correctSplitDataDerived() {} unsigned noFigure::CalcWalkAnimationFrame() const { diff --git a/libs/s25main/figures/noFigure.h b/libs/s25main/figures/noFigure.h index 75a8cb4255..36a8cb82d6 100644 --- a/libs/s25main/figures/noFigure.h +++ b/libs/s25main/figures/noFigure.h @@ -211,7 +211,7 @@ class noFigure : public noMovable /// Straße läuft! void CorrectSplitData(const RoadSegment* rs2); /// Wird aufgerufen, wenn die Straße unter der Figur geteilt wurde (für abgeleitete Klassen) - virtual void CorrectSplitData_Derived(); + virtual void correctSplitDataDerived(); /// Lässt die Figur sterben (löst sich auf und hinterlässt ggf. Leiche) void Die(); /// Removes the figure from the players inventory (e.g. when it does not exist anymore) diff --git a/libs/s25main/figures/nofAttacker.cpp b/libs/s25main/figures/nofAttacker.cpp index 987b13bc17..0ecf1021c7 100644 --- a/libs/s25main/figures/nofAttacker.cpp +++ b/libs/s25main/figures/nofAttacker.cpp @@ -276,7 +276,7 @@ void nofAttacker::Walked() // Can't walk while on the ship RTTR_Assert(false); break; - case SoldierState::SeaattackingReturnToShip: HandleState_SeaAttack_ReturnToShip(); break; + case SoldierState::SeaattackingReturnToShip: handleStateSeaAttackReturnToShip(); break; } } @@ -389,7 +389,7 @@ void nofAttacker::ReturnHomeMissionAttacking() if(ship_obj_id) { state = SoldierState::SeaattackingReturnToShip; - HandleState_SeaAttack_ReturnToShip(); + handleStateSeaAttackReturnToShip(); } else ReturnHome(); } @@ -881,7 +881,7 @@ void nofAttacker::CancelAtHuntingDefender() } } -void nofAttacker::HandleState_SeaAttack_ReturnToShip() +void nofAttacker::handleStateSeaAttackReturnToShip() { if(!homeBld) { diff --git a/libs/s25main/figures/nofAttacker.h b/libs/s25main/figures/nofAttacker.h index 5e05ce31ed..feeb18a5ce 100644 --- a/libs/s25main/figures/nofAttacker.h +++ b/libs/s25main/figures/nofAttacker.h @@ -73,7 +73,7 @@ class nofAttacker : public nofActiveSoldier void CancelAtShip(); void CancelAtHuntingDefender(); /// Handle walking back to ship - void HandleState_SeaAttack_ReturnToShip(); + void handleStateSeaAttackReturnToShip(); protected: SoldierState FreeFightAborted() override; diff --git a/libs/s25main/figures/nofCarrier.cpp b/libs/s25main/figures/nofCarrier.cpp index 57df813264..1b90149bda 100644 --- a/libs/s25main/figures/nofCarrier.cpp +++ b/libs/s25main/figures/nofCarrier.cpp @@ -893,7 +893,7 @@ void nofCarrier::StopWorking() } /// Wird aufgerufen, wenn die Straße unter der Figur geteilt wurde (für abgeleitete Klassen) -void nofCarrier::CorrectSplitData_Derived() +void nofCarrier::correctSplitDataDerived() { // Tragen wir eine Ware? if(state == CarrierState::CarryWare) diff --git a/libs/s25main/figures/nofCarrier.h b/libs/s25main/figures/nofCarrier.h index 9e2709c730..5ed05e1fcb 100644 --- a/libs/s25main/figures/nofCarrier.h +++ b/libs/s25main/figures/nofCarrier.h @@ -143,5 +143,5 @@ class nofCarrier : public noFigure noRoadNode* GetSecondFlag() const; /// Wird aufgerufen, wenn die Straße unter der Figur geteilt wurde (für abgeleitete Klassen) - void CorrectSplitData_Derived() override; + void correctSplitDataDerived() override; }; diff --git a/libs/s25main/ingameWindows/iwChat.cpp b/libs/s25main/ingameWindows/iwChat.cpp index ff9afd68ea..d9b702df68 100644 --- a/libs/s25main/ingameWindows/iwChat.cpp +++ b/libs/s25main/ingameWindows/iwChat.cpp @@ -63,5 +63,5 @@ void iwChat::msgEditEnter(const unsigned /*ctrl_id*/) if(listener) listener->OnChatCommand(text.substr(1)); } else - GAMECLIENT.Command_Chat(text, ChatDestination(lastChatDestination)); + GAMECLIENT.commandChat(text, ChatDestination(lastChatDestination)); } diff --git a/libs/s25main/network/GameClient.cpp b/libs/s25main/network/GameClient.cpp index 2db77813f9..af58e4db0f 100644 --- a/libs/s25main/network/GameClient.cpp +++ b/libs/s25main/network/GameClient.cpp @@ -1307,7 +1307,7 @@ void GameClient::ExecuteGameFrame() if(replayMode) { // In replay mode we have all commands in the file -> Execute them - ExecuteGameFrame_Replay(); + executeGameFrameReplay(); } else { RTTR_Assert(curGF <= nwfInfo->getNextNWF()); @@ -1577,7 +1577,7 @@ unsigned GameClient::GetGlobalAnimation(const unsigned short max, const unsigned } template -T GameClient::do_interpolate(const T x1, const T x2, const GameEvent& ev) const +T GameClient::doInterpolate(const T x1, const T x2, const GameEvent& ev) const { // TODO: Move to some animation system that is part of game std::chrono::milliseconds elapsedTime{}; @@ -1589,12 +1589,12 @@ T GameClient::do_interpolate(const T x1, const T x2, const GameEvent& ev) const unsigned GameClient::Interpolate(const unsigned maxVal, const GameEvent* ev) const { - return do_interpolate(0u, maxVal, assertNonNull(ev)); + return doInterpolate(0u, maxVal, assertNonNull(ev)); } int GameClient::Interpolate(const int x1, const int x2, const GameEvent* ev) const { - return do_interpolate(x1, x2, assertNonNull(ev)); + return doInterpolate(x1, x2, assertNonNull(ev)); } void GameClient::ServerLost() diff --git a/libs/s25main/network/GameClient.h b/libs/s25main/network/GameClient.h index 572d318e13..b83677623a 100644 --- a/libs/s25main/network/GameClient.h +++ b/libs/s25main/network/GameClient.h @@ -117,12 +117,12 @@ class GameClient final : unsigned Interpolate(unsigned maxVal, const GameEvent* ev) const; int Interpolate(int x1, int x2, const GameEvent* ev) const; - void Command_Chat(const std::string& text, ChatDestination cd); - void Command_SetNation(Nation newNation); - void Command_SetPortrait(unsigned portraitIndex); - void Command_SetTeam(Team newTeam); - void Command_SetColor(unsigned newColor); - void Command_SetReady(bool isReady); + void commandChat(const std::string& text, ChatDestination cd); + void commandSetNation(Nation newNation); + void commandSetPortrait(unsigned portraitIndex); + void commandSetTeam(Team newTeam); + void commandSetColor(unsigned newColor); + void commandSetReady(bool isReady); /// Called internally when the game is ready to start (loaded and all players ready) /// And a 2nd time when the GUI is ready which actually starty the game @@ -195,7 +195,7 @@ class GameClient final : /// Versucht einen neuen GameFrame auszuführen, falls die Zeit dafür gekommen ist void ExecuteGameFrame(); - void ExecuteGameFrame_Replay(); + void executeGameFrameReplay(); void ExecuteNWF(); /// Filtert aus einem Network-Command-Paket alle Commands aus und führt sie aus, falls ein Spielerwechsel-Command /// dabei ist, füllt er die übergebenen IDs entsprechend aus @@ -211,7 +211,7 @@ class GameClient final : /// Interpolate implementation for generic types /// Returns x in [x1, x2] according to the current time in the range of the events duration. template - T do_interpolate(T x1, T x2, const GameEvent& ev) const; + T doInterpolate(T x1, T x2, const GameEvent& ev) const; // Netzwerknachrichten RTTR_IGNORE_OVERLOADED_VIRTUAL diff --git a/libs/s25main/network/GameClientCommands.cpp b/libs/s25main/network/GameClientCommands.cpp index 2cf56ef93a..763357a565 100644 --- a/libs/s25main/network/GameClientCommands.cpp +++ b/libs/s25main/network/GameClientCommands.cpp @@ -15,7 +15,7 @@ * @param[in] text Der Text * @param[in] destination Ziel der Nachricht */ -void GameClient::Command_Chat(const std::string& text, const ChatDestination cd) +void GameClient::commandChat(const std::string& text, const ChatDestination cd) { // Replaymodus oder kein Text --> nichts senden if(IsReplayModeOn() || text.empty()) @@ -24,17 +24,17 @@ void GameClient::Command_Chat(const std::string& text, const ChatDestination cd) mainPlayer.sendMsgAsync(new GameMessage_Chat(0xff, cd, text)); } -void GameClient::Command_SetNation(Nation newNation) +void GameClient::commandSetNation(Nation newNation) { mainPlayer.sendMsgAsync(new GameMessage_Player_Nation(0xff, newNation)); } -void GameClient::Command_SetPortrait(unsigned portraitIndex) +void GameClient::commandSetPortrait(unsigned portraitIndex) { mainPlayer.sendMsgAsync(new GameMessage_Player_Portrait(0xff, portraitIndex)); } -void GameClient::Command_SetTeam(Team newTeam) +void GameClient::commandSetTeam(Team newTeam) { mainPlayer.sendMsgAsync(new GameMessage_Player_Team(0xff, newTeam)); } @@ -42,12 +42,12 @@ void GameClient::Command_SetTeam(Team newTeam) /** * sendet den "Bereit"-Status. */ -void GameClient::Command_SetReady(bool isReady) +void GameClient::commandSetReady(bool isReady) { mainPlayer.sendMsgAsync(new GameMessage_Player_Ready(0xFF, isReady)); } -void GameClient::Command_SetColor(unsigned newColor) +void GameClient::commandSetColor(unsigned newColor) { mainPlayer.sendMsgAsync(new GameMessage_Player_Color(0xFF, newColor)); } diff --git a/libs/s25main/network/GameClientGF_Replay.cpp b/libs/s25main/network/GameClientGF_Replay.cpp index 1518a99b55..c72ce29d0e 100644 --- a/libs/s25main/network/GameClientGF_Replay.cpp +++ b/libs/s25main/network/GameClientGF_Replay.cpp @@ -10,7 +10,7 @@ #include "network/GameClient.h" #include "s25util/Log.h" -void GameClient::ExecuteGameFrame_Replay() +void GameClient::executeGameFrameReplay() { const unsigned curGF = GetGFNumber(); RTTR_Assert(replayinfo->nextGF.value_or(curGF) >= curGF || curGF > replayinfo->replay.GetLastGF()); //-V807 diff --git a/libs/s25main/network/GameMessage.cpp b/libs/s25main/network/GameMessage.cpp index 477dc48420..79c60f79f2 100644 --- a/libs/s25main/network/GameMessage.cpp +++ b/libs/s25main/network/GameMessage.cpp @@ -13,7 +13,7 @@ bool GameMessage::run(MessageInterface* callback, unsigned senderPlayerID) return Run(checkedCast(callback)); } -Message* GameMessage::create_game(unsigned short id) +Message* GameMessage::createGame(unsigned short id) { Message* msg = nullptr; diff --git a/libs/s25main/network/GameMessage.h b/libs/s25main/network/GameMessage.h index 16439c8607..df77f9646e 100644 --- a/libs/s25main/network/GameMessage.h +++ b/libs/s25main/network/GameMessage.h @@ -23,8 +23,8 @@ class GameMessage : public Message bool run(MessageInterface* callback, unsigned senderPlayerID) override; - static Message* create_game(unsigned short id); - Message* create(unsigned short id) const override { return create_game(id); } + static Message* createGame(unsigned short id); + Message* create(unsigned short id) const override { return createGame(id); } }; /// Game message that optionally has a player ID diff --git a/libs/s25main/network/NetworkPlayer.cpp b/libs/s25main/network/NetworkPlayer.cpp index 1cac20accb..7497a84f7c 100644 --- a/libs/s25main/network/NetworkPlayer.cpp +++ b/libs/s25main/network/NetworkPlayer.cpp @@ -6,7 +6,7 @@ #include "GameMessage.h" NetworkPlayer::NetworkPlayer(unsigned playerId) - : playerId(playerId), recvQueue(GameMessage::create_game), sendQueue(GameMessage::create_game) + : playerId(playerId), recvQueue(GameMessage::createGame), sendQueue(GameMessage::createGame) {} void NetworkPlayer::closeConnection() diff --git a/libs/s25main/nodeObjs/noShip.cpp b/libs/s25main/nodeObjs/noShip.cpp index 96de3f1c70..bbf76be4f2 100644 --- a/libs/s25main/nodeObjs/noShip.cpp +++ b/libs/s25main/nodeObjs/noShip.cpp @@ -264,7 +264,7 @@ void noShip::HandleEvent(const unsigned id) { // target harbor for unloading doesnt exist anymore -> set state to driving and handle the new state state = State::ExpeditionDriving; - HandleState_ExpeditionDriving(); + handleStateExpeditionDriving(); } break; } @@ -287,7 +287,7 @@ void noShip::HandleEvent(const unsigned id) { // target harbor for unloading doesnt exist anymore -> set state to driving and handle the new state state = State::ExplorationexpeditionDriving; - HandleState_ExplorationExpeditionDriving(); + handleStateExplorationExpeditionDriving(); } // Sichtbarkeiten neu berechnen @@ -377,12 +377,12 @@ void noShip::Driven() switch(state) { - case State::Gotoharbor: HandleState_GoToHarbor(); break; - case State::ExpeditionDriving: HandleState_ExpeditionDriving(); break; - case State::ExplorationexpeditionDriving: HandleState_ExplorationExpeditionDriving(); break; - case State::TransportDriving: HandleState_TransportDriving(); break; - case State::SeaattackDrivingToDestination: HandleState_SeaAttackDriving(); break; - case State::SeaattackReturnDriving: HandleState_SeaAttackReturn(); break; + case State::Gotoharbor: handleStateGoToHarbor(); break; + case State::ExpeditionDriving: handleStateExpeditionDriving(); break; + case State::ExplorationexpeditionDriving: handleStateExplorationExpeditionDriving(); break; + case State::TransportDriving: handleStateTransportDriving(); break; + case State::SeaattackDrivingToDestination: handleStateSeaAttackDriving(); break; + case State::SeaattackReturnDriving: handleStateSeaAttackReturn(); break; default: RTTR_Assert(false); break; } } @@ -558,7 +558,7 @@ void noShip::ContinueExpedition(const ShipDirection dir) goalHarbor = new_goal; state = State::ExpeditionDriving; - HandleState_ExpeditionDriving(); + handleStateExpeditionDriving(); } /// Weist das Schiff an, eine Expedition abzubrechen (nur wenn es steht) und zum @@ -579,13 +579,13 @@ void noShip::CancelExpedition() route_.clear(); curRouteIdx = 0; state = State::ExpeditionDriving; // just in case the home harbor was destroyed - HandleState_ExpeditionDriving(); + handleStateExpeditionDriving(); } else { state = State::ExpeditionDriving; goalHarbor = homeHarbor; StartDrivingToHarborPlace(); - HandleState_ExpeditionDriving(); + handleStateExpeditionDriving(); } } @@ -608,7 +608,7 @@ void noShip::FoundColony() world->GetNotifications().publish(ExpeditionNote(ExpeditionNote::Waiting, ownerId_, pos)); } -void noShip::HandleState_GoToHarbor() +void noShip::handleStateGoToHarbor() { // Hafen schon zerstört? if(!goalHarbor) @@ -645,7 +645,7 @@ void noShip::HandleState_GoToHarbor() } } -void noShip::HandleState_ExpeditionDriving() +void noShip::handleStateExpeditionDriving() { Result res; // Zum Heimathafen fahren? @@ -687,7 +687,7 @@ void noShip::HandleState_ExpeditionDriving() { // Try to go back goalHarbor = homeHarbor; - HandleState_ExpeditionDriving(); + handleStateExpeditionDriving(); } else FindUnloadGoal(State::ExpeditionDriving); // Unload anywhere! } @@ -695,7 +695,7 @@ void noShip::HandleState_ExpeditionDriving() } } -void noShip::HandleState_ExplorationExpeditionDriving() +void noShip::handleStateExplorationExpeditionDriving() { Result res; // Zum Heimathafen fahren? @@ -732,14 +732,14 @@ void noShip::HandleState_ExplorationExpeditionDriving() { // Try to go back goalHarbor = homeHarbor; - HandleState_ExplorationExpeditionDriving(); + handleStateExplorationExpeditionDriving(); } else FindUnloadGoal(State::ExplorationexpeditionDriving); // Unload anywhere! break; } } -void noShip::HandleState_TransportDriving() +void noShip::handleStateTransportDriving() { Result res = DriveToHarbour(); switch(res) @@ -778,7 +778,7 @@ void noShip::HandleState_TransportDriving() } } -void noShip::HandleState_SeaAttackDriving() +void noShip::handleStateSeaAttackDriving() { Result res = DriveToHarbourPlace(); switch(res) @@ -798,7 +798,7 @@ void noShip::HandleState_SeaAttackDriving() } } -void noShip::HandleState_SeaAttackReturn() +void noShip::handleStateSeaAttackReturn() { Result res = DriveToHarbour(); switch(res) @@ -906,7 +906,7 @@ void noShip::StartSeaAttack() { state = State::SeaattackDrivingToDestination; StartDrivingToHarborPlace(); - HandleState_SeaAttackDriving(); + handleStateSeaAttackDriving(); } void noShip::AbortSeaAttack() @@ -932,7 +932,7 @@ void noShip::AbortSeaAttack() { // Else start driving back state = State::SeaattackReturnDriving; - HandleState_SeaAttackReturn(); + handleStateSeaAttackReturn(); } } else { @@ -1001,7 +1001,7 @@ void noShip::StartTransport() StartDrivingToHarborPlace(); // Einfach weiterfahren - HandleState_TransportDriving(); + handleStateTransportDriving(); } void noShip::FindUnloadGoal(State newState) @@ -1014,13 +1014,13 @@ void noShip::FindUnloadGoal(State newState) curRouteIdx = 0; homeHarbor = goalHarbor; // To allow unloading here if(state == State::ExpeditionDriving) - HandleState_ExpeditionDriving(); + handleStateExpeditionDriving(); else if(state == State::ExplorationexpeditionDriving) - HandleState_ExplorationExpeditionDriving(); + handleStateExplorationExpeditionDriving(); else if(state == State::TransportDriving) - HandleState_TransportDriving(); + handleStateTransportDriving(); else if(state == State::SeaattackReturnDriving) - HandleState_SeaAttackReturn(); + handleStateSeaAttackReturn(); else { RTTR_Assert(false); @@ -1146,7 +1146,7 @@ void noShip::SeaAttackerWishesNoReturn() goalHarbor = homeHarbor; state = State::SeaattackReturnDriving; StartDrivingToHarborPlace(); - HandleState_SeaAttackReturn(); + handleStateSeaAttackReturn(); } else { // Wenn keine Soldaten mehr da sind können wir auch erstmal idlen @@ -1193,7 +1193,7 @@ void noShip::ContinueExplorationExpedition() StartDrivingToHarborPlace(); state = State::ExplorationexpeditionDriving; - HandleState_ExplorationExpeditionDriving(); + handleStateExplorationExpeditionDriving(); } /// Sagt dem Schiff, dass ein neuer Hafen erbaut wurde diff --git a/libs/s25main/nodeObjs/noShip.h b/libs/s25main/nodeObjs/noShip.h index fd5072dd00..6d77440291 100644 --- a/libs/s25main/nodeObjs/noShip.h +++ b/libs/s25main/nodeObjs/noShip.h @@ -83,12 +83,12 @@ class noShip : public noMovable /// Fängt an zu fahren void StartDriving(Direction dir); - void HandleState_GoToHarbor(); - void HandleState_ExpeditionDriving(); - void HandleState_ExplorationExpeditionDriving(); - void HandleState_TransportDriving(); - void HandleState_SeaAttackDriving(); - void HandleState_SeaAttackReturn(); + void handleStateGoToHarbor(); + void handleStateExpeditionDriving(); + void handleStateExplorationExpeditionDriving(); + void handleStateTransportDriving(); + void handleStateSeaAttackDriving(); + void handleStateSeaAttackReturn(); enum class Result { diff --git a/tests/s25Main/integration/testSerialization.cpp b/tests/s25Main/integration/testSerialization.cpp index 4f551c9627..fdd5ba1e12 100644 --- a/tests/s25Main/integration/testSerialization.cpp +++ b/tests/s25Main/integration/testSerialization.cpp @@ -772,7 +772,7 @@ BOOST_AUTO_TEST_CASE(SerializeGameMessageChat) const GameMessage_Chat msg(rttr::test::randomValue(0u, 10u), rttr::test::randomEnum(), "Hello"); Serializer ser; msg.Serialize(ser); - std::unique_ptr newMsg(GameMessage::create_game(msg.getId())); + std::unique_ptr newMsg(GameMessage::createGame(msg.getId())); BOOST_TEST_REQUIRE(!!newMsg); newMsg->Deserialize(ser); const auto* newMsgChat = dynamic_cast(newMsg.get()); diff --git a/tests/s25Main/simple/testGameMessages.cpp b/tests/s25Main/simple/testGameMessages.cpp index 067fe976e3..582956d91d 100644 --- a/tests/s25Main/simple/testGameMessages.cpp +++ b/tests/s25Main/simple/testGameMessages.cpp @@ -49,7 +49,7 @@ auto serializeDeserializeMessage(const TMsg& msgIn) static Serializer ser; ser.Clear(); msgIn.Serialize(ser); - Message* msgOut(GameMessage::create_game(msgIn.getId())); + Message* msgOut(GameMessage::createGame(msgIn.getId())); BOOST_TEST_REQUIRE(msgOut); std::unique_ptr msgResult(dynamic_cast(msgOut)); BOOST_TEST_REQUIRE(!!msgResult); diff --git a/tests/testHelpers/rttr/test/LogAccessor.hpp b/tests/testHelpers/rttr/test/LogAccessor.hpp index 9c1cbc1588..065f84682c 100644 --- a/tests/testHelpers/rttr/test/LogAccessor.hpp +++ b/tests/testHelpers/rttr/test/LogAccessor.hpp @@ -67,8 +67,8 @@ struct LogAccessor #define RTTR_REQUIRE_ASSERT(stmt) \ do \ { \ - const bool old = RTTR_SetBreakOnAssertFailure(false); \ + const bool old = rttrSetBreakOnAssertFailure(false); \ BOOST_CHECK_THROW(stmt, RTTR_AssertError); \ - RTTR_SetBreakOnAssertFailure(old); \ + rttrSetBreakOnAssertFailure(old); \ RTTR_REQUIRE_LOG_CONTAINS("Assertion failure", false); \ } while(false) From 31d01b5038955f8b0dac2127487734998777f15d Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Mon, 16 Nov 2026 12:35:54 +0100 Subject: [PATCH 4/7] Rename getters, setters and predicates to lowerCamelCase --- extras/ai-battle/HeadlessGame.cpp | 44 +- extras/ai-battle/main.cpp | 4 +- extras/audioDrivers/SDL/AudioSDL.cpp | 14 +- extras/audioDrivers/SDL/AudioSDL.h | 8 +- extras/headlessConsole/HeadlessConsole.cpp | 12 +- extras/replay-player/ReplayOutput.cpp | 18 +- extras/replay-player/main.cpp | 6 +- extras/videoDrivers/SDL2/VideoSDL2.cpp | 26 +- extras/videoDrivers/SDL2/VideoSDL2.h | 12 +- extras/videoDrivers/WinAPI/WinAPI.cpp | 36 +- extras/videoDrivers/WinAPI/WinAPI.h | 14 +- libs/common/include/makeException.h | 4 +- libs/common/src/makeException.cpp | 2 +- libs/driver/include/driver/AudioDriver.h | 6 +- libs/driver/include/driver/AudioInterface.h | 10 +- libs/driver/include/driver/VideoDriver.h | 20 +- libs/driver/include/driver/VideoInterface.h | 30 +- libs/driver/src/AudioDriver.cpp | 8 +- libs/driver/src/VideoDriver.cpp | 10 +- libs/libGamedata/gameData/TerrainDesc.cpp | 8 +- libs/libGamedata/gameData/TerrainDesc.h | 8 +- libs/libGamedata/lua/CampaignDataLoader.cpp | 6 +- libs/libGamedata/lua/CampaignDataLoader.h | 2 +- libs/rttrConfig/src/RTTR_Version.cpp | 20 +- libs/rttrConfig/src/RTTR_Version.h | 14 +- libs/rttrConfig/src/RttrConfig.cpp | 6 +- libs/rttrConfig/src/RttrConfig.h | 4 +- libs/s25client/s25client.cpp | 4 +- libs/s25main/AsyncChecksum.cpp | 4 +- libs/s25main/BasePlayerInfo.cpp | 6 +- libs/s25main/BasePlayerInfo.h | 4 +- libs/s25main/BuildingRegister.cpp | 40 +- libs/s25main/BuildingRegister.h | 12 +- libs/s25main/CatapultStone.cpp | 24 +- libs/s25main/CatapultStone.h | 2 +- libs/s25main/Cheats.cpp | 22 +- libs/s25main/Debug.cpp | 16 +- libs/s25main/Debug.h | 2 +- libs/s25main/EconomyModeHandler.cpp | 42 +- libs/s25main/EconomyModeHandler.h | 12 +- libs/s25main/EventManager.cpp | 26 +- libs/s25main/EventManager.h | 12 +- libs/s25main/FOWObjects.cpp | 18 +- libs/s25main/FOWObjects.h | 12 +- libs/s25main/FindWhConditions.cpp | 20 +- libs/s25main/FoWObject.h | 2 +- libs/s25main/Game.cpp | 38 +- libs/s25main/Game.h | 8 +- libs/s25main/GameCommands.cpp | 86 +- libs/s25main/GameEvent.h | 4 +- libs/s25main/GameLobbyController.cpp | 24 +- libs/s25main/GameLobbyController.h | 20 +- libs/s25main/GameManager.cpp | 10 +- libs/s25main/GameManager.h | 6 +- libs/s25main/GameObject.cpp | 8 +- libs/s25main/GameObject.h | 10 +- libs/s25main/GamePlayer.cpp | 544 ++++++------- libs/s25main/GamePlayer.h | 88 +-- libs/s25main/GamePlayerInfo.h | 2 +- libs/s25main/GameSetup.cpp | 12 +- libs/s25main/GameSetup.h | 2 +- libs/s25main/GlobalGameSettings.cpp | 8 +- libs/s25main/GlobalGameSettings.h | 4 +- libs/s25main/HeadlessReplay.cpp | 20 +- libs/s25main/ILocalGameState.h | 8 +- libs/s25main/IngameMinimap.cpp | 48 +- libs/s25main/IngameMinimap.h | 2 +- libs/s25main/JoinPlayerInfo.cpp | 2 +- libs/s25main/JoinPlayerInfo.h | 2 +- libs/s25main/LeatherLoader.cpp | 34 +- libs/s25main/LeatherLoader.h | 8 +- libs/s25main/Loader.cpp | 178 ++--- libs/s25main/Loader.h | 52 +- libs/s25main/Messenger.cpp | 10 +- libs/s25main/Minimap.h | 4 +- libs/s25main/MusicPlayer.h | 4 +- libs/s25main/Pathfinding.cpp | 30 +- libs/s25main/Playlist.cpp | 2 +- libs/s25main/Playlist.h | 2 +- libs/s25main/PreviewMinimap.cpp | 32 +- libs/s25main/PreviewMinimap.h | 2 +- libs/s25main/QuickStartGame.cpp | 6 +- libs/s25main/Replay.cpp | 26 +- libs/s25main/Replay.h | 16 +- libs/s25main/ReplayPlayback.cpp | 2 +- libs/s25main/RoadSegment.cpp | 100 +-- libs/s25main/RoadSegment.h | 24 +- libs/s25main/SavedFile.cpp | 28 +- libs/s25main/SavedFile.h | 24 +- libs/s25main/Savegame.cpp | 6 +- libs/s25main/Savegame.h | 6 +- libs/s25main/SerializedGameData.cpp | 80 +- libs/s25main/SerializedGameData.h | 16 +- libs/s25main/Settings.cpp | 16 +- libs/s25main/SoundManager.cpp | 12 +- libs/s25main/TerrainRenderer.cpp | 244 +++--- libs/s25main/TerrainRenderer.h | 24 +- libs/s25main/TextFormatSetter.h | 4 +- libs/s25main/TradePathCache.cpp | 8 +- libs/s25main/Ware.cpp | 86 +- libs/s25main/Ware.h | 32 +- libs/s25main/Window.cpp | 66 +- libs/s25main/Window.h | 62 +- libs/s25main/WindowManager.cpp | 98 +-- libs/s25main/WindowManager.h | 18 +- libs/s25main/WineLoader.cpp | 36 +- libs/s25main/WineLoader.h | 10 +- libs/s25main/addons/Addon.cpp | 2 +- libs/s25main/addons/AddonBool.cpp | 2 +- libs/s25main/addons/AddonList.cpp | 6 +- libs/s25main/ai/AIEventManager.cpp | 2 +- libs/s25main/ai/AIEventManager.h | 4 +- libs/s25main/ai/AIEvents.h | 12 +- libs/s25main/ai/AIInterface.cpp | 136 ++-- libs/s25main/ai/AIInterface.h | 92 +-- libs/s25main/ai/AIPlayer.h | 6 +- libs/s25main/ai/aijh/AIConstruction.cpp | 224 +++--- libs/s25main/ai/aijh/AIConstruction.h | 16 +- libs/s25main/ai/aijh/AIPlayerJH.cpp | 716 ++++++++--------- libs/s25main/ai/aijh/AIPlayerJH.h | 42 +- libs/s25main/ai/aijh/AIResourceMap.cpp | 26 +- libs/s25main/ai/aijh/BuildingPlanner.cpp | 166 ++-- libs/s25main/ai/aijh/BuildingPlanner.h | 12 +- libs/s25main/ai/aijh/Jobs.cpp | 122 +-- libs/s25main/ai/aijh/Jobs.h | 14 +- libs/s25main/ai/aijh/PositionSearch.cpp | 14 +- libs/s25main/ai/aijh/PositionSearch.h | 4 +- libs/s25main/animation/Animation.cpp | 4 +- libs/s25main/animation/AnimationManager.cpp | 4 +- libs/s25main/animation/BlinkButtonAnim.cpp | 2 +- libs/s25main/animation/MoveAnimation.cpp | 4 +- libs/s25main/buildings/BurnedWarehouse.cpp | 18 +- libs/s25main/buildings/BurnedWarehouse.h | 2 +- libs/s25main/buildings/noBaseBuilding.cpp | 104 +-- libs/s25main/buildings/noBaseBuilding.h | 28 +- libs/s25main/buildings/noBuilding.cpp | 12 +- libs/s25main/buildings/noBuilding.h | 2 +- libs/s25main/buildings/noBuildingSite.cpp | 64 +- libs/s25main/buildings/noBuildingSite.h | 10 +- libs/s25main/buildings/nobBaseMilitary.cpp | 58 +- libs/s25main/buildings/nobBaseMilitary.h | 24 +- libs/s25main/buildings/nobBaseWarehouse.cpp | 280 +++---- libs/s25main/buildings/nobBaseWarehouse.h | 82 +- libs/s25main/buildings/nobHQ.cpp | 16 +- libs/s25main/buildings/nobHQ.h | 8 +- libs/s25main/buildings/nobHarborBuilding.cpp | 286 +++---- libs/s25main/buildings/nobHarborBuilding.h | 32 +- libs/s25main/buildings/nobMilitary.cpp | 360 ++++----- libs/s25main/buildings/nobMilitary.h | 64 +- libs/s25main/buildings/nobShipYard.cpp | 2 +- libs/s25main/buildings/nobShipYard.h | 6 +- libs/s25main/buildings/nobStorehouse.cpp | 2 +- libs/s25main/buildings/nobStorehouse.h | 6 +- libs/s25main/buildings/nobTemple.cpp | 2 +- libs/s25main/buildings/nobTemple.h | 6 +- libs/s25main/buildings/nobUsual.cpp | 106 +-- libs/s25main/buildings/nobUsual.h | 16 +- libs/s25main/controls/ctrlBaseColor.h | 4 +- libs/s25main/controls/ctrlBaseImage.cpp | 6 +- libs/s25main/controls/ctrlBaseImage.h | 10 +- libs/s25main/controls/ctrlBaseText.h | 12 +- libs/s25main/controls/ctrlBaseTooltip.cpp | 8 +- libs/s25main/controls/ctrlBaseTooltip.h | 4 +- libs/s25main/controls/ctrlBaseVarText.cpp | 2 +- libs/s25main/controls/ctrlBaseVarText.h | 2 +- libs/s25main/controls/ctrlBuildingIcon.cpp | 6 +- libs/s25main/controls/ctrlBuildingIcon.h | 4 +- libs/s25main/controls/ctrlButton.cpp | 22 +- libs/s25main/controls/ctrlButton.h | 22 +- libs/s25main/controls/ctrlChat.cpp | 48 +- libs/s25main/controls/ctrlChat.h | 2 +- libs/s25main/controls/ctrlCheck.cpp | 16 +- libs/s25main/controls/ctrlColorButton.cpp | 4 +- libs/s25main/controls/ctrlColorDeepening.cpp | 2 +- libs/s25main/controls/ctrlComboBox.cpp | 98 +-- libs/s25main/controls/ctrlComboBox.h | 14 +- libs/s25main/controls/ctrlDeepening.cpp | 2 +- libs/s25main/controls/ctrlEdit.cpp | 50 +- libs/s25main/controls/ctrlEdit.h | 18 +- libs/s25main/controls/ctrlGroup.cpp | 56 +- libs/s25main/controls/ctrlImage.cpp | 10 +- libs/s25main/controls/ctrlImage.h | 2 +- libs/s25main/controls/ctrlImageButton.cpp | 6 +- libs/s25main/controls/ctrlImageDeepening.cpp | 2 +- libs/s25main/controls/ctrlIngameMinimap.cpp | 22 +- libs/s25main/controls/ctrlList.cpp | 100 +-- libs/s25main/controls/ctrlList.h | 18 +- libs/s25main/controls/ctrlMapSelection.cpp | 28 +- libs/s25main/controls/ctrlMinimap.cpp | 28 +- libs/s25main/controls/ctrlMinimap.h | 12 +- .../s25main/controls/ctrlMultiSelectGroup.cpp | 28 +- libs/s25main/controls/ctrlMultiSelectGroup.h | 6 +- libs/s25main/controls/ctrlMultiline.cpp | 74 +- libs/s25main/controls/ctrlMultiline.h | 14 +- libs/s25main/controls/ctrlOptionGroup.cpp | 26 +- libs/s25main/controls/ctrlOptionGroup.h | 6 +- libs/s25main/controls/ctrlPercent.cpp | 8 +- libs/s25main/controls/ctrlPreviewMinimap.cpp | 18 +- libs/s25main/controls/ctrlPreviewMinimap.h | 6 +- libs/s25main/controls/ctrlProgress.cpp | 54 +- libs/s25main/controls/ctrlProgress.h | 4 +- libs/s25main/controls/ctrlScrollBar.cpp | 54 +- libs/s25main/controls/ctrlScrollBar.h | 10 +- libs/s25main/controls/ctrlTab.cpp | 60 +- libs/s25main/controls/ctrlTab.h | 8 +- libs/s25main/controls/ctrlTable.cpp | 150 ++-- libs/s25main/controls/ctrlTable.h | 20 +- libs/s25main/controls/ctrlText.cpp | 12 +- libs/s25main/controls/ctrlText.h | 2 +- libs/s25main/controls/ctrlTextButton.cpp | 8 +- libs/s25main/controls/ctrlTextDeepening.cpp | 18 +- libs/s25main/controls/ctrlTextDeepening.h | 2 +- libs/s25main/controls/ctrlTimer.cpp | 2 +- libs/s25main/controls/ctrlVarDeepening.cpp | 2 +- libs/s25main/controls/ctrlVarText.cpp | 6 +- libs/s25main/controls/ctrlVarText.h | 2 +- libs/s25main/customborderbuilder.cpp | 2 +- libs/s25main/desktops/Desktop.cpp | 24 +- libs/s25main/desktops/Desktop.h | 2 +- libs/s25main/desktops/dskBenchmark.cpp | 42 +- libs/s25main/desktops/dskBenchmark.h | 2 +- .../desktops/dskCampaignMissionSelection.cpp | 38 +- .../s25main/desktops/dskCampaignSelection.cpp | 28 +- libs/s25main/desktops/dskCredits.cpp | 52 +- libs/s25main/desktops/dskCredits.h | 4 +- libs/s25main/desktops/dskDirectIP.cpp | 2 +- libs/s25main/desktops/dskGameInterface.cpp | 430 +++++----- libs/s25main/desktops/dskGameInterface.h | 10 +- libs/s25main/desktops/dskGameLoader.cpp | 34 +- libs/s25main/desktops/dskGameLobby.cpp | 254 +++--- libs/s25main/desktops/dskGameLobby.h | 8 +- libs/s25main/desktops/dskIntro.cpp | 4 +- libs/s25main/desktops/dskLAN.cpp | 20 +- libs/s25main/desktops/dskLobby.cpp | 60 +- libs/s25main/desktops/dskMainMenu.cpp | 10 +- libs/s25main/desktops/dskMenuBase.cpp | 6 +- libs/s25main/desktops/dskMultiPlayer.cpp | 2 +- libs/s25main/desktops/dskOptions.cpp | 196 ++--- libs/s25main/desktops/dskSelectMap.cpp | 62 +- libs/s25main/desktops/dskSinglePlayer.cpp | 6 +- libs/s25main/desktops/dskSplash.cpp | 16 +- libs/s25main/desktops/dskSplash.h | 2 +- libs/s25main/desktops/dskTest.cpp | 76 +- libs/s25main/desktops/dskTextureTest.cpp | 18 +- libs/s25main/drivers/AudioDriverWrapper.cpp | 24 +- libs/s25main/drivers/AudioDriverWrapper.h | 8 +- libs/s25main/drivers/DriverWrapper.cpp | 10 +- libs/s25main/drivers/DriverWrapper.h | 8 +- libs/s25main/drivers/VideoDriverWrapper.cpp | 86 +- libs/s25main/drivers/VideoDriverWrapper.h | 38 +- libs/s25main/factories/BuildingFactory.cpp | 4 +- libs/s25main/factories/JobFactory.cpp | 18 +- libs/s25main/figures/noFigure.cpp | 220 +++--- libs/s25main/figures/noFigure.h | 34 +- libs/s25main/figures/nofActiveSoldier.cpp | 78 +- libs/s25main/figures/nofActiveSoldier.h | 10 +- .../s25main/figures/nofAggressiveDefender.cpp | 28 +- libs/s25main/figures/nofAggressiveDefender.h | 8 +- libs/s25main/figures/nofArmorer.cpp | 20 +- libs/s25main/figures/nofArmorer.h | 4 +- libs/s25main/figures/nofAttacker.cpp | 156 ++-- libs/s25main/figures/nofAttacker.h | 22 +- libs/s25main/figures/nofBaker.cpp | 14 +- libs/s25main/figures/nofBaker.h | 4 +- libs/s25main/figures/nofBrewer.cpp | 8 +- libs/s25main/figures/nofBrewer.h | 4 +- libs/s25main/figures/nofBuilder.cpp | 48 +- libs/s25main/figures/nofBuilder.h | 2 +- libs/s25main/figures/nofBuildingWorker.cpp | 32 +- libs/s25main/figures/nofBuildingWorker.h | 4 +- libs/s25main/figures/nofButcher.cpp | 6 +- libs/s25main/figures/nofButcher.h | 4 +- libs/s25main/figures/nofCarpenter.cpp | 6 +- libs/s25main/figures/nofCarpenter.h | 4 +- libs/s25main/figures/nofCarrier.cpp | 194 ++--- libs/s25main/figures/nofCarrier.h | 14 +- libs/s25main/figures/nofCatapultMan.cpp | 42 +- libs/s25main/figures/nofCatapultMan.h | 4 +- libs/s25main/figures/nofCharburner.cpp | 54 +- libs/s25main/figures/nofCharburner.h | 8 +- libs/s25main/figures/nofDefender.cpp | 10 +- libs/s25main/figures/nofDefender.h | 8 +- libs/s25main/figures/nofDonkeybreeder.cpp | 12 +- libs/s25main/figures/nofDonkeybreeder.h | 4 +- libs/s25main/figures/nofFarmer.cpp | 52 +- libs/s25main/figures/nofFarmer.h | 10 +- libs/s25main/figures/nofFarmhand.cpp | 38 +- libs/s25main/figures/nofFarmhand.h | 8 +- libs/s25main/figures/nofFisher.cpp | 22 +- libs/s25main/figures/nofFisher.h | 6 +- libs/s25main/figures/nofFlagWorker.cpp | 18 +- libs/s25main/figures/nofFlagWorker.h | 2 +- libs/s25main/figures/nofForester.cpp | 44 +- libs/s25main/figures/nofForester.h | 6 +- libs/s25main/figures/nofGeologist.cpp | 110 +-- libs/s25main/figures/nofGeologist.h | 12 +- libs/s25main/figures/nofHunter.cpp | 80 +- libs/s25main/figures/nofHunter.h | 10 +- libs/s25main/figures/nofIronfounder.cpp | 8 +- libs/s25main/figures/nofIronfounder.h | 4 +- libs/s25main/figures/nofLeatherWorker.cpp | 12 +- libs/s25main/figures/nofLeatherWorker.h | 4 +- libs/s25main/figures/nofMetalworker.cpp | 58 +- libs/s25main/figures/nofMetalworker.h | 10 +- libs/s25main/figures/nofMiller.cpp | 36 +- libs/s25main/figures/nofMiller.h | 4 +- libs/s25main/figures/nofMiner.cpp | 46 +- libs/s25main/figures/nofMiner.h | 6 +- libs/s25main/figures/nofMinter.cpp | 10 +- libs/s25main/figures/nofMinter.h | 4 +- libs/s25main/figures/nofPassiveSoldier.cpp | 22 +- libs/s25main/figures/nofPassiveSoldier.h | 2 +- libs/s25main/figures/nofPassiveWorker.cpp | 2 +- libs/s25main/figures/nofPassiveWorker.h | 2 +- libs/s25main/figures/nofPigbreeder.cpp | 16 +- libs/s25main/figures/nofPigbreeder.h | 4 +- libs/s25main/figures/nofPlaner.cpp | 24 +- libs/s25main/figures/nofPlaner.h | 2 +- libs/s25main/figures/nofScout_Free.cpp | 8 +- libs/s25main/figures/nofScout_Free.h | 4 +- .../s25main/figures/nofScout_LookoutTower.cpp | 2 +- libs/s25main/figures/nofScout_LookoutTower.h | 4 +- libs/s25main/figures/nofShipWright.cpp | 68 +- libs/s25main/figures/nofShipWright.h | 6 +- libs/s25main/figures/nofSkinner.cpp | 32 +- libs/s25main/figures/nofSkinner.h | 4 +- libs/s25main/figures/nofSoldier.cpp | 8 +- libs/s25main/figures/nofSoldier.h | 18 +- libs/s25main/figures/nofStonemason.cpp | 20 +- libs/s25main/figures/nofStonemason.h | 6 +- libs/s25main/figures/nofTanner.cpp | 6 +- libs/s25main/figures/nofTanner.h | 4 +- libs/s25main/figures/nofTempleServant.cpp | 24 +- libs/s25main/figures/nofTempleServant.h | 4 +- libs/s25main/figures/nofTradeDonkey.cpp | 32 +- libs/s25main/figures/nofTradeDonkey.h | 12 +- libs/s25main/figures/nofTradeLeader.cpp | 46 +- libs/s25main/figures/nofTradeLeader.h | 6 +- libs/s25main/figures/nofVintner.cpp | 10 +- libs/s25main/figures/nofVintner.h | 4 +- libs/s25main/figures/nofWarehouseWorker.cpp | 32 +- libs/s25main/figures/nofWarehouseWorker.h | 2 +- libs/s25main/figures/nofWellguy.cpp | 16 +- libs/s25main/figures/nofWellguy.h | 4 +- libs/s25main/figures/nofWinegrower.cpp | 46 +- libs/s25main/figures/nofWinegrower.h | 8 +- libs/s25main/figures/nofWoodcutter.cpp | 40 +- libs/s25main/figures/nofWoodcutter.h | 6 +- libs/s25main/figures/nofWorkman.cpp | 8 +- libs/s25main/gameData/BuildingProperties.cpp | 14 +- libs/s25main/gameData/BuildingProperties.h | 10 +- libs/s25main/gameData/GameLoader.cpp | 16 +- libs/s25main/gameData/SettingTypeConv.cpp | 4 +- libs/s25main/gameData/SettingTypeConv.h | 4 +- libs/s25main/gameTypes/InventorySetting.h | 4 +- libs/s25main/gameTypes/MapNode.cpp | 4 +- .../gameTypes/MineResourceBehavior.cpp | 22 +- libs/s25main/gameTypes/MineResourceBehavior.h | 14 +- libs/s25main/ingameWindows/IngameWindow.cpp | 168 ++-- libs/s25main/ingameWindows/IngameWindow.h | 34 +- .../TransmitSettingsIgwAdapter.cpp | 4 +- libs/s25main/ingameWindows/iwAIDebug.cpp | 42 +- libs/s25main/ingameWindows/iwAction.cpp | 190 ++--- libs/s25main/ingameWindows/iwAction.h | 2 +- libs/s25main/ingameWindows/iwAddonPresets.cpp | 56 +- libs/s25main/ingameWindows/iwAddonPresets.h | 8 +- libs/s25main/ingameWindows/iwAddons.cpp | 46 +- .../s25main/ingameWindows/iwBaseWarehouse.cpp | 146 ++-- libs/s25main/ingameWindows/iwBaseWarehouse.h | 2 +- libs/s25main/ingameWindows/iwBuildOrder.cpp | 60 +- libs/s25main/ingameWindows/iwBuilding.cpp | 122 +-- .../iwBuildingProductivities.cpp | 12 +- libs/s25main/ingameWindows/iwBuildingSite.cpp | 28 +- libs/s25main/ingameWindows/iwBuildings.cpp | 40 +- libs/s25main/ingameWindows/iwChat.cpp | 16 +- libs/s25main/ingameWindows/iwConnecting.cpp | 22 +- .../ingameWindows/iwDemolishBuilding.cpp | 20 +- libs/s25main/ingameWindows/iwDiplomacy.cpp | 68 +- .../ingameWindows/iwDirectIPConnect.cpp | 68 +- .../s25main/ingameWindows/iwDirectIPConnect.h | 2 +- .../ingameWindows/iwDirectIPCreate.cpp | 86 +- libs/s25main/ingameWindows/iwDirectIPCreate.h | 2 +- libs/s25main/ingameWindows/iwDistribution.cpp | 52 +- .../ingameWindows/iwEconomicProgress.cpp | 64 +- libs/s25main/ingameWindows/iwEndgame.cpp | 8 +- libs/s25main/ingameWindows/iwHQ.cpp | 22 +- .../ingameWindows/iwHarborBuilding.cpp | 38 +- libs/s25main/ingameWindows/iwHelp.cpp | 10 +- libs/s25main/ingameWindows/iwInventory.cpp | 2 +- libs/s25main/ingameWindows/iwLobbyConnect.cpp | 72 +- libs/s25main/ingameWindows/iwLobbyConnect.h | 2 +- .../ingameWindows/iwLobbyServerInfo.cpp | 14 +- .../s25main/ingameWindows/iwLobbyServerInfo.h | 4 +- libs/s25main/ingameWindows/iwMainMenu.cpp | 72 +- libs/s25main/ingameWindows/iwMapDebug.cpp | 66 +- libs/s25main/ingameWindows/iwMapDebug.h | 2 +- libs/s25main/ingameWindows/iwMapGenerator.cpp | 98 +-- .../ingameWindows/iwMerchandiseStatistics.cpp | 184 ++--- libs/s25main/ingameWindows/iwMilitary.cpp | 26 +- .../ingameWindows/iwMilitaryBuilding.cpp | 146 ++-- libs/s25main/ingameWindows/iwMinimap.cpp | 28 +- .../ingameWindows/iwMissionStatement.cpp | 34 +- .../ingameWindows/iwMissionStatement.h | 2 +- libs/s25main/ingameWindows/iwMsgbox.cpp | 68 +- libs/s25main/ingameWindows/iwMusicPlayer.cpp | 138 ++-- libs/s25main/ingameWindows/iwMusicPlayer.h | 10 +- libs/s25main/ingameWindows/iwObservate.cpp | 114 +-- .../s25main/ingameWindows/iwOptionsWindow.cpp | 34 +- libs/s25main/ingameWindows/iwPlayReplay.cpp | 48 +- libs/s25main/ingameWindows/iwPleaseWait.cpp | 8 +- libs/s25main/ingameWindows/iwPostWindow.cpp | 144 ++-- libs/s25main/ingameWindows/iwPostWindow.h | 4 +- libs/s25main/ingameWindows/iwRoadWindow.cpp | 12 +- libs/s25main/ingameWindows/iwSave.cpp | 40 +- libs/s25main/ingameWindows/iwSettings.cpp | 56 +- libs/s25main/ingameWindows/iwShip.cpp | 108 +-- libs/s25main/ingameWindows/iwSkipGFs.cpp | 14 +- libs/s25main/ingameWindows/iwStatistics.cpp | 148 ++-- libs/s25main/ingameWindows/iwSurrender.cpp | 8 +- .../ingameWindows/iwTempleBuilding.cpp | 12 +- libs/s25main/ingameWindows/iwTextfile.cpp | 8 +- libs/s25main/ingameWindows/iwTools.cpp | 52 +- libs/s25main/ingameWindows/iwTrade.cpp | 56 +- libs/s25main/ingameWindows/iwTrade.h | 4 +- libs/s25main/ingameWindows/iwTransport.cpp | 96 +-- libs/s25main/ingameWindows/iwVictory.cpp | 16 +- libs/s25main/ingameWindows/iwWares.cpp | 74 +- libs/s25main/ingameWindows/iwWares.h | 4 +- libs/s25main/languages.cpp | 2 +- libs/s25main/lua/LuaInterfaceGame.cpp | 56 +- libs/s25main/lua/LuaInterfaceGame.h | 10 +- libs/s25main/lua/LuaInterfaceGameBase.cpp | 24 +- libs/s25main/lua/LuaInterfaceGameBase.h | 8 +- libs/s25main/lua/LuaInterfaceSettings.cpp | 42 +- libs/s25main/lua/LuaInterfaceSettings.h | 18 +- libs/s25main/lua/LuaPlayer.cpp | 102 +-- libs/s25main/lua/LuaPlayer.h | 22 +- libs/s25main/lua/LuaPlayerBase.cpp | 60 +- libs/s25main/lua/LuaPlayerBase.h | 20 +- libs/s25main/lua/LuaServerPlayer.cpp | 40 +- libs/s25main/lua/LuaServerPlayer.h | 14 +- libs/s25main/lua/LuaWorld.cpp | 18 +- libs/s25main/lua/LuaWorld.h | 2 +- libs/s25main/mapGenerator/Algorithms.cpp | 6 +- libs/s25main/mapGenerator/Algorithms.h | 16 +- libs/s25main/mapGenerator/Harbors.cpp | 8 +- libs/s25main/mapGenerator/HeadQuarters.cpp | 4 +- libs/s25main/mapGenerator/HeadQuarters.h | 2 +- libs/s25main/mapGenerator/Islands.cpp | 14 +- libs/s25main/mapGenerator/Map.cpp | 10 +- libs/s25main/mapGenerator/NodeMapUtilities.h | 6 +- libs/s25main/mapGenerator/RandomMap.cpp | 34 +- libs/s25main/mapGenerator/RandomMap.h | 12 +- libs/s25main/mapGenerator/Resources.cpp | 16 +- libs/s25main/mapGenerator/Rivers.cpp | 4 +- libs/s25main/mapGenerator/TextureHelper.cpp | 24 +- libs/s25main/mapGenerator/TextureHelper.h | 20 +- libs/s25main/mapGenerator/Textures.cpp | 56 +- libs/s25main/mapGenerator/Textures.h | 14 +- libs/s25main/network/GameClient.cpp | 202 ++--- libs/s25main/network/GameClient.h | 74 +- libs/s25main/network/GameClientCommands.cpp | 24 +- libs/s25main/network/GameClientGF_Game.cpp | 8 +- libs/s25main/network/GameClientGF_Replay.cpp | 14 +- libs/s25main/network/GameServer.cpp | 122 +-- libs/s25main/network/GameServer.h | 16 +- libs/s25main/network/IGameLobbyController.h | 18 +- libs/s25main/nodeObjs/noAnimal.cpp | 64 +- libs/s25main/nodeObjs/noAnimal.h | 16 +- libs/s25main/nodeObjs/noBase.cpp | 4 +- libs/s25main/nodeObjs/noBase.h | 6 +- libs/s25main/nodeObjs/noCharburnerPile.cpp | 48 +- libs/s25main/nodeObjs/noCharburnerPile.h | 8 +- libs/s25main/nodeObjs/noCoordBase.h | 6 +- .../nodeObjs/noDisappearingEnvObject.cpp | 20 +- .../nodeObjs/noDisappearingEnvObject.h | 4 +- .../nodeObjs/noDisappearingMapEnvObject.cpp | 4 +- .../nodeObjs/noDisappearingMapEnvObject.h | 2 +- libs/s25main/nodeObjs/noEnvObject.h | 2 +- libs/s25main/nodeObjs/noExtension.h | 6 +- libs/s25main/nodeObjs/noFighting.cpp | 84 +- libs/s25main/nodeObjs/noFighting.h | 6 +- libs/s25main/nodeObjs/noFire.cpp | 32 +- libs/s25main/nodeObjs/noFire.h | 4 +- libs/s25main/nodeObjs/noFlag.cpp | 72 +- libs/s25main/nodeObjs/noFlag.h | 16 +- libs/s25main/nodeObjs/noGrainfield.cpp | 20 +- libs/s25main/nodeObjs/noGrainfield.h | 8 +- libs/s25main/nodeObjs/noGranite.h | 8 +- libs/s25main/nodeObjs/noGrapefield.cpp | 22 +- libs/s25main/nodeObjs/noGrapefield.h | 8 +- libs/s25main/nodeObjs/noMovable.cpp | 40 +- libs/s25main/nodeObjs/noMovable.h | 14 +- libs/s25main/nodeObjs/noNothing.h | 2 +- libs/s25main/nodeObjs/noRoadNode.cpp | 24 +- libs/s25main/nodeObjs/noRoadNode.h | 20 +- libs/s25main/nodeObjs/noShip.cpp | 212 ++--- libs/s25main/nodeObjs/noShip.h | 42 +- libs/s25main/nodeObjs/noShipBuildingSite.cpp | 26 +- libs/s25main/nodeObjs/noShipBuildingSite.h | 6 +- libs/s25main/nodeObjs/noSign.cpp | 6 +- libs/s25main/nodeObjs/noSign.h | 4 +- libs/s25main/nodeObjs/noSkeleton.cpp | 18 +- libs/s25main/nodeObjs/noSkeleton.h | 2 +- libs/s25main/nodeObjs/noStaticObject.cpp | 32 +- libs/s25main/nodeObjs/noStaticObject.h | 14 +- libs/s25main/nodeObjs/noTree.cpp | 40 +- libs/s25main/nodeObjs/noTree.h | 6 +- .../notifications/NotificationManager_impl.h | 6 +- libs/s25main/ogl/ITexture.h | 4 +- libs/s25main/ogl/MusicItem.cpp | 2 +- libs/s25main/ogl/SoundEffectItem.cpp | 2 +- libs/s25main/ogl/SoundItem.h | 2 +- libs/s25main/ogl/glArchivItem_Bitmap.cpp | 20 +- libs/s25main/ogl/glArchivItem_BitmapBase.cpp | 8 +- libs/s25main/ogl/glArchivItem_BitmapBase.h | 14 +- .../ogl/glArchivItem_Bitmap_Direct.cpp | 6 +- .../ogl/glArchivItem_Bitmap_Player.cpp | 22 +- libs/s25main/ogl/glFont.cpp | 16 +- libs/s25main/ogl/glFont.h | 6 +- libs/s25main/ogl/glSmartBitmap.cpp | 4 +- libs/s25main/ogl/glSmartBitmap.h | 4 +- libs/s25main/pathfinding/FindPathForRoad.cpp | 4 +- .../s25main/pathfinding/FindPathReachable.cpp | 10 +- libs/s25main/pathfinding/FreePathFinder.cpp | 16 +- libs/s25main/pathfinding/FreePathFinderImpl.h | 26 +- libs/s25main/pathfinding/OpenListBinaryHeap.h | 30 +- libs/s25main/pathfinding/OpenListVector.h | 6 +- libs/s25main/pathfinding/PathConditionHuman.h | 18 +- .../pathfinding/PathConditionReachable.h | 14 +- libs/s25main/pathfinding/PathConditionRoad.h | 6 +- libs/s25main/pathfinding/PathConditionShip.h | 10 +- libs/s25main/pathfinding/PathConditionTrade.h | 10 +- libs/s25main/pathfinding/RoadPathFinder.cpp | 36 +- libs/s25main/pathfinding/ShipPathData.cpp | 16 +- .../postSystem/DiplomacyPostQuestion.cpp | 8 +- .../postSystem/DiplomacyPostQuestion.h | 8 +- libs/s25main/postSystem/PostBox.cpp | 6 +- libs/s25main/postSystem/PostBox.h | 10 +- libs/s25main/postSystem/PostManager.cpp | 12 +- libs/s25main/postSystem/PostManager.h | 4 +- libs/s25main/postSystem/PostMsg.h | 14 +- .../postSystem/PostMsgWithBuilding.cpp | 6 +- libs/s25main/postSystem/PostMsgWithBuilding.h | 2 +- libs/s25main/postSystem/ShipPostMsg.cpp | 6 +- libs/s25main/postSystem/ShipPostMsg.h | 2 +- libs/s25main/random/Random.cpp | 6 +- libs/s25main/random/Random.h | 8 +- libs/s25main/random/randomIO.cpp | 4 +- libs/s25main/world/BQCalculator.h | 26 +- libs/s25main/world/GameWorld.cpp | 472 +++++------ libs/s25main/world/GameWorld.h | 28 +- libs/s25main/world/GameWorldBase.cpp | 250 +++--- libs/s25main/world/GameWorldBase.h | 88 +-- libs/s25main/world/GameWorldView.cpp | 182 ++--- libs/s25main/world/GameWorldView.h | 28 +- libs/s25main/world/GameWorldViewer.cpp | 158 ++-- libs/s25main/world/GameWorldViewer.h | 50 +- libs/s25main/world/MapBase.cpp | 12 +- libs/s25main/world/MapBase.h | 40 +- libs/s25main/world/MapGeometry.cpp | 14 +- libs/s25main/world/MapGeometry.h | 10 +- libs/s25main/world/MapLoader.cpp | 126 +-- libs/s25main/world/MapLoader.h | 6 +- libs/s25main/world/MapSerializer.cpp | 52 +- libs/s25main/world/MilitarySquares.cpp | 10 +- libs/s25main/world/MilitarySquares.h | 4 +- libs/s25main/world/NodeMapBase.h | 4 +- libs/s25main/world/TerritoryRegion.cpp | 44 +- libs/s25main/world/TerritoryRegion.h | 20 +- libs/s25main/world/TradeRoute.cpp | 4 +- libs/s25main/world/TradeRoute.h | 8 +- libs/s25main/world/World.cpp | 198 ++--- libs/s25main/world/World.h | 120 +-- tests/legacyFiles/src/legacy/TerrainData.cpp | 52 +- tests/legacyFiles/src/legacy/TerrainData.h | 38 +- tests/libGameData/testCampaignLuaFile.cpp | 8 +- tests/libGameData/testGameData.cpp | 38 +- tests/mockupDrivers/MockupAudioDriver.h | 12 +- tests/mockupDrivers/MockupVideoDriver.cpp | 16 +- tests/mockupDrivers/MockupVideoDriver.h | 18 +- tests/rttrConfig/testRttrConfig.cpp | 8 +- tests/s25Main/UI/testAnimations.cpp | 70 +- tests/s25Main/UI/testComboBox.cpp | 122 +-- tests/s25Main/UI/testControls.cpp | 222 +++--- tests/s25Main/UI/testDskGameLobby.cpp | 14 +- tests/s25Main/UI/testFont.cpp | 6 +- tests/s25Main/UI/testImageButton.cpp | 4 +- tests/s25Main/UI/testIngameWindow.cpp | 348 ++++---- tests/s25Main/UI/testMapSelection.cpp | 28 +- tests/s25Main/UI/testSmartBitmap.cpp | 34 +- tests/s25Main/UI/testVideoDriver.cpp | 26 +- tests/s25Main/UI/testWindowManager.cpp | 144 ++-- tests/s25Main/UI/testWindows.cpp | 154 ++-- .../UI/uiHelper/uiHelper/uiHelpers.cpp | 10 +- .../UI/uiHelper/uiHelper/uiHelpers.hpp | 2 +- tests/s25Main/audio/LoadMockupAudio.h | 2 +- tests/s25Main/audio/testPlaylist.cpp | 6 +- tests/s25Main/audio/testSoundManager.cpp | 24 +- tests/s25Main/audio/testSounds.cpp | 18 +- tests/s25Main/drivers/testDriverWrapper.cpp | 18 +- tests/s25Main/integration/testAI.cpp | 178 ++--- tests/s25Main/integration/testArmor.cpp | 98 +-- tests/s25Main/integration/testAttacking.cpp | 698 ++++++++--------- .../s25Main/integration/testBaseWarehouse.cpp | 162 ++-- .../integration/testBoundaryStones.cpp | 78 +- tests/s25Main/integration/testBuilding.cpp | 282 +++---- .../s25Main/integration/testBuildingProps.cpp | 10 +- .../integration/testBuildingRadius.cpp | 86 +- .../integration/testCheatCommandTracker.cpp | 8 +- tests/s25Main/integration/testCheats.cpp | 50 +- .../testDisappearingMapObjects.cpp | 48 +- .../integration/testDskGameInterface.cpp | 144 ++-- tests/s25Main/integration/testEconomyMode.cpp | 56 +- .../integration/testEmergencyProtocol.cpp | 16 +- tests/s25Main/integration/testFarmer.cpp | 82 +- tests/s25Main/integration/testFigures.cpp | 124 +-- .../integration/testFrontierDistance.cpp | 150 ++-- .../s25Main/integration/testGameCommands.cpp | 574 +++++++------- tests/s25Main/integration/testGameEvents.cpp | 32 +- tests/s25Main/integration/testGamePlayer.cpp | 90 +-- .../s25Main/integration/testGameWorldView.cpp | 60 +- tests/s25Main/integration/testHarbor.cpp | 26 +- tests/s25Main/integration/testPacts.cpp | 138 ++-- tests/s25Main/integration/testPathfinding.cpp | 82 +- tests/s25Main/integration/testProduction.cpp | 92 +-- .../s25Main/integration/testSeaAttacking.cpp | 380 ++++----- .../integration/testSeaWorldCreation.cpp | 82 +- tests/s25Main/integration/testSeafaring.cpp | 740 +++++++++--------- .../s25Main/integration/testSerialization.cpp | 242 +++--- .../integration/testTerritoryRegion.cpp | 84 +- tests/s25Main/integration/testTrading.cpp | 172 ++-- tests/s25Main/integration/testWorld.cpp | 126 +-- .../s25Main/integration/testWorldCreation.cpp | 14 +- .../s25Main/integration/testWorldFixtures.cpp | 18 +- tests/s25Main/lua/GameWithLuaAccess.h | 24 +- tests/s25Main/lua/testLua.cpp | 316 ++++---- tests/s25Main/lua/testLuaGUI.cpp | 114 +-- tests/s25Main/lua/testLuaSettings.cpp | 52 +- tests/s25Main/mapGenerator/testAlgorithms.cpp | 10 +- tests/s25Main/mapGenerator/testHarbors.cpp | 20 +- .../s25Main/mapGenerator/testHeadQuarters.cpp | 28 +- tests/s25Main/mapGenerator/testMap.cpp | 12 +- .../mapGenerator/testNodeMapUtilities.cpp | 2 +- tests/s25Main/mapGenerator/testRandomMap.cpp | 2 +- tests/s25Main/mapGenerator/testResources.cpp | 10 +- tests/s25Main/mapGenerator/testRivers.cpp | 4 +- tests/s25Main/mapGenerator/testTextures.cpp | 52 +- tests/s25Main/network/testGameClient.cpp | 174 ++-- tests/s25Main/simple/testGameData.cpp | 4 +- tests/s25Main/simple/testMapBase.cpp | 64 +- tests/s25Main/simple/testPostBox.cpp | 66 +- tests/s25Main/simple/testRandom.cpp | 10 +- .../worldFixtures/CreateEmptyWorld.cpp | 24 +- .../s25Main/worldFixtures/CreateSeaWorld.cpp | 40 +- tests/s25Main/worldFixtures/GCExecutor.cpp | 8 +- tests/s25Main/worldFixtures/GCExecutor.h | 4 +- .../worldFixtures/MockLocalGameState.h | 4 +- .../worldFixtures/SeaWorldWithGCExecution.h | 2 +- .../worldFixtures/TestEventManager.cpp | 16 +- .../s25Main/worldFixtures/TestEventManager.h | 6 +- tests/s25Main/worldFixtures/WorldFixture.h | 10 +- .../worldFixtures/WorldWithGCExecution.h | 4 +- 663 files changed, 13566 insertions(+), 13566 deletions(-) diff --git a/extras/ai-battle/HeadlessGame.cpp b/extras/ai-battle/HeadlessGame.cpp index 070593b22a..47365f1f1f 100644 --- a/extras/ai-battle/HeadlessGame.cpp +++ b/extras/ai-battle/HeadlessGame.cpp @@ -35,17 +35,17 @@ HeadlessGame::HeadlessGame(const GlobalGameSettings& ggs, const bfs::path& map, mapInfo.type = MapType::OldMap; mapInfo.filepath = map; mapInfo.luaFilepath = luaPath; - SetupGameWorld(game_, mapInfo, localState_, nullptr); + setupGameWorld(game_, mapInfo, localState_, nullptr); - if(world_.HasLua()) + if(world_.hasLua()) { - world_.GetLua().setSuppressStdout(true); + world_.getLua().setSuppressStdout(true); luaPath_ = luaPath; bnw::cout << "Lua script loaded: " << luaPath << '\n'; } - for(unsigned playerId = 0; playerId < world_.GetNumPlayers(); ++playerId) - players_.push_back(AIFactory::Create(world_.GetPlayer(playerId).aiInfo, playerId, world_)); + for(unsigned playerId = 0; playerId < world_.getNumPlayers(); ++playerId) + players_.push_back(AIFactory::Create(world_.getPlayer(playerId).aiInfo, playerId, world_)); } HeadlessGame::~HeadlessGame() @@ -61,40 +61,40 @@ void HeadlessGame::Run(unsigned maxGF) game_.Start(false); - while(em_.GetCurrentGF() < maxGF && !game_.IsGameFinished()) + while(em_.getCurrentGF() < maxGF && !game_.isGameFinished()) { // In the actual game, the network frame intervall is based on ping (highest_ping < NFW-length < 20*gf_length). - bool isnfw = em_.GetCurrentGF() % 20 == 0; + bool isnfw = em_.getCurrentGF() % 20 == 0; if(isnfw) { - if(replay_.IsRecording()) + if(replay_.isRecording()) checksum = AsyncChecksum::create(game_); - for(unsigned playerId = 0; playerId < world_.GetNumPlayers(); ++playerId) + for(unsigned playerId = 0; playerId < world_.getNumPlayers(); ++playerId) { - world_.GetPlayer(playerId); + world_.getPlayer(playerId); AIPlayer* player = players_[playerId].get(); PlayerGameCommands cmds; cmds.gcs = player->FetchGameCommands(); - if(replay_.IsRecording() && !cmds.gcs.empty()) + if(replay_.isRecording() && !cmds.gcs.empty()) { cmds.checksum = checksum; - replay_.AddGameCommand(em_.GetCurrentGF(), playerId, cmds); + replay_.AddGameCommand(em_.getCurrentGF(), playerId, cmds); } for(const gc::GameCommandPtr& gc : cmds.gcs) - gc->Execute(world_, player->GetPlayerId()); + gc->Execute(world_, player->getPlayerId()); } } for(auto& player : players_) - player->RunGF(em_.GetCurrentGF(), isnfw); + player->RunGF(em_.getCurrentGF(), isnfw); game_.RunGF(); - if(replay_.IsRecording()) - replay_.UpdateLastGF(em_.GetCurrentGF()); + if(replay_.isRecording()) + replay_.UpdateLastGF(em_.getCurrentGF()); if(std::chrono::steady_clock::now() > nextReport) { @@ -109,7 +109,7 @@ void HeadlessGame::Close() { bnw::cout << '\n'; - if(replay_.IsRecording()) + if(replay_.isRecording()) { replay_.StopRecording(); bnw::cout << "Replay written to " << canonical(replayPath_) << '\n'; @@ -153,7 +153,7 @@ void HeadlessGame::SaveGame(const bfs::path& path) const save.AddPlayer(player); save.ggs = game_.ggs_; save.ggs.exploration = Exploration::Disabled; // no FOW - save.start_gf = em_.GetCurrentGF(); + save.start_gf = em_.getCurrentGF(); save.sgd.MakeSnapshot(game_); save.Save(path, "AI Battle"); @@ -163,14 +163,14 @@ void HeadlessGame::SaveGame(const bfs::path& path) const void HeadlessGame::PrintState() { HeadlessStats stats; - stats.currentGF = em_.GetCurrentGF(); + stats.currentGF = em_.getCurrentGF(); stats.gameTime = - std::chrono::duration_cast(SPEED_GF_LENGTHS[GameSpeed::Normal] * em_.GetCurrentGF()); + std::chrono::duration_cast(SPEED_GF_LENGTHS[GameSpeed::Normal] * em_.getCurrentGF()); stats.wallTime = std::chrono::duration_cast(std::chrono::steady_clock::now() - gameStartTime_); - stats.gfPerSecond = em_.GetCurrentGF() - lastReportGf_; + stats.gfPerSecond = em_.getCurrentGF() - lastReportGf_; statsPrinter_.print(stats, world_); - lastReportGf_ = em_.GetCurrentGF(); + lastReportGf_ = em_.getCurrentGF(); } std::vector GeneratePlayerInfo(const std::vector& ais, const std::vector& teams) diff --git a/extras/ai-battle/main.cpp b/extras/ai-battle/main.cpp index e23e38a9ca..a5bd93f9de 100644 --- a/extras/ai-battle/main.cpp +++ b/extras/ai-battle/main.cpp @@ -142,8 +142,8 @@ int main(int argc, char** argv) } if(options.count("version")) { - bnw::cout << rttr::version::GetTitle() << " v" << rttr::version::GetVersion() << "-" - << rttr::version::GetRevision() << std::endl + bnw::cout << rttr::version::getTitle() << " v" << rttr::version::getVersion() << "-" + << rttr::version::getRevision() << std::endl << "Compiled with " << System::getCompilerName() << " for " << System::getOSName() << std::endl; return 0; } diff --git a/extras/audioDrivers/SDL/AudioSDL.cpp b/extras/audioDrivers/SDL/AudioSDL.cpp index 2ce2e4792e..b6c00f151b 100644 --- a/extras/audioDrivers/SDL/AudioSDL.cpp +++ b/extras/audioDrivers/SDL/AudioSDL.cpp @@ -60,7 +60,7 @@ AudioSDL::~AudioSDL() * * @return liefert den Treibernamen zurück */ -const char* AudioSDL::GetName() const +const char* AudioSDL::getName() const { return GetDriverName(); } @@ -90,7 +90,7 @@ bool AudioSDL::Initialize() std::cerr << Mix_GetError() << std::endl; return false; } - SetNumChannels(Mix_AllocateChannels(DEFAULT_NUM_CHANNELS)); + setNumChannels(Mix_AllocateChannels(DEFAULT_NUM_CHANNELS)); Mix_SetMusicCMD(nullptr); currentInstance = this; Mix_HookMusicFinished(AudioSDL::MusicFinished); @@ -224,9 +224,9 @@ void AudioSDL::doStopEffect(int channel) Mix_HaltChannel(channel); } -bool AudioSDL::IsEffectPlaying(EffectPlayId play_id) +bool AudioSDL::isEffectPlaying(EffectPlayId play_id) { - int channel = GetEffectChannel(play_id); + int channel = getEffectChannel(play_id); if(channel < 0) return false; if(Mix_Playing(channel)) @@ -237,17 +237,17 @@ bool AudioSDL::IsEffectPlaying(EffectPlayId play_id) void AudioSDL::ChangeVolume(EffectPlayId play_id, uint8_t volume) { - int channel = GetEffectChannel(play_id); + int channel = getEffectChannel(play_id); if(channel >= 0) Mix_Volume(channel, CalcEffectVolume(volume)); } -void AudioSDL::SetMasterEffectVolume(uint8_t volume) +void AudioSDL::setMasterEffectVolume(uint8_t volume) { master_effects_volume = volume; } -void AudioSDL::SetMusicVolume(uint8_t volume) +void AudioSDL::setMusicVolume(uint8_t volume) { master_music_volume = volume; diff --git a/extras/audioDrivers/SDL/AudioSDL.h b/extras/audioDrivers/SDL/AudioSDL.h index c7cf025c95..6b101b233d 100644 --- a/extras/audioDrivers/SDL/AudioSDL.h +++ b/extras/audioDrivers/SDL/AudioSDL.h @@ -22,7 +22,7 @@ class AudioSDL final : public driver::AudioDriver ~AudioSDL() override; /// Return the name of the driver - const char* GetName() const override; + const char* getName() const override; bool Initialize() override; /// Closes all open handles of the driver (stops and unloads music and effects) void CleanUp() override; @@ -42,14 +42,14 @@ class AudioSDL final : public driver::AudioDriver /// Stop the effect on this channel void doStopEffect(int channel) override; /// Is the effect still being played - bool IsEffectPlaying(EffectPlayId play_id) override; + bool isEffectPlaying(EffectPlayId play_id) override; /// Changes volume [0..256) of a played sound (if it is still playing) relative to the master effect volume void ChangeVolume(EffectPlayId play_id, uint8_t volume) override; /// Set the master effect volume [0..256) at which all effects will be played. Changing the volume of an effect will /// be relative to this - void SetMasterEffectVolume(uint8_t volume) override; + void setMasterEffectVolume(uint8_t volume) override; /// Sets the music volume [0..256) - void SetMusicVolume(uint8_t volume) override; + void setMusicVolume(uint8_t volume) override; protected: void doUnloadSound(driver::RawSoundHandle sound) override; diff --git a/extras/headlessConsole/HeadlessConsole.cpp b/extras/headlessConsole/HeadlessConsole.cpp index c9eb5c8456..2afdc2e687 100644 --- a/extras/headlessConsole/HeadlessConsole.cpp +++ b/extras/headlessConsole/HeadlessConsole.cpp @@ -80,7 +80,7 @@ std::string formatNumber(unsigned num) void StatsTablePrinter::print(const HeadlessStats& stats, const GameWorldBase& world) { - const unsigned numPlayers = world.GetNumPlayers(); + const unsigned numPlayers = world.getNumPlayers(); if(!firstPrint_) printConsole("\x1b[%uA", 8 + numPlayers); // Move back up over the previously printed table firstPrint_ = false; @@ -100,13 +100,13 @@ void StatsTablePrinter::print(const HeadlessStats& stats, const GameWorldBase& w printConsole("├────────────────────────────┼────────────────────┼───────────────┼────────────┼────────────┤\n"); for(unsigned i = 0; i < numPlayers; ++i) { - const GamePlayer& p = world.GetPlayer(i); + const GamePlayer& p = world.getPlayer(i); printConsole("│ %s%-26s%s │ %18s │ %13s │ %10s │ %10s │\n", p.IsDefeated() ? "\x1b[9m" : "", p.name.c_str(), p.IsDefeated() ? "\x1b[29m" : "", - formatNumber(p.GetStatisticCurrentValue(StatisticType::Country)).c_str(), - formatNumber(p.GetStatisticCurrentValue(StatisticType::Buildings)).c_str(), - formatNumber(p.GetStatisticCurrentValue(StatisticType::Military)).c_str(), - formatNumber(p.GetStatisticCurrentValue(StatisticType::Gold)).c_str()); + formatNumber(p.getStatisticCurrentValue(StatisticType::Country)).c_str(), + formatNumber(p.getStatisticCurrentValue(StatisticType::Buildings)).c_str(), + formatNumber(p.getStatisticCurrentValue(StatisticType::Military)).c_str(), + formatNumber(p.getStatisticCurrentValue(StatisticType::Gold)).c_str()); } printConsole("└────────────────────────────┴────────────────────┴───────────────┴────────────┴────────────┘\n"); } diff --git a/extras/replay-player/ReplayOutput.cpp b/extras/replay-player/ReplayOutput.cpp index d96db4dd63..4c3d538fda 100644 --- a/extras/replay-player/ReplayOutput.cpp +++ b/extras/replay-player/ReplayOutput.cpp @@ -34,18 +34,18 @@ void printInitialInfo(const HeadlessReplay& replay) { const Replay& file = replay.getReplay(); const GameWorld& world = replay.getWorld(); - const MapPoint mapSize = world.GetSize(); + const MapPoint mapSize = world.getSize(); bnw::cout << "\n"; - bnw::cout << "Replay: " << file.GetMapName() << "\n"; - bnw::cout << "Version: " << static_cast(file.GetMajorVersion()) << "." - << static_cast(file.GetMinorVersion()) << "\n"; + bnw::cout << "Replay: " << file.getMapName() << "\n"; + bnw::cout << "Version: " << static_cast(file.getMajorVersion()) << "." + << static_cast(file.getMinorVersion()) << "\n"; bnw::cout << "Type: " << (replay.isFromSavegame() ? "savegame replay" : "new-game replay") << "\n"; bnw::cout << "Map size: " << mapSize.x << " x " << mapSize.y << "\n"; bnw::cout << "Seed: " << file.getSeed() << "\n"; - bnw::cout << "GF range: " << replay.getStartGF() << " - " << file.GetLastGF() << " (" - << (file.GetLastGF() + 1 - replay.getStartGF()) << " GFs)\n"; - if(world.HasLua()) + bnw::cout << "GF range: " << replay.getStartGF() << " - " << file.getLastGF() << " (" + << (file.getLastGF() + 1 - replay.getStartGF()) << " GFs)\n"; + if(world.hasLua()) bnw::cout << "Lua: script loaded from replay\n"; if(!replay.isFromSavegame() && !file.usesFishFix()) bnw::cout << "Note: fish fix skipped, this replay predates version 8.3\n"; @@ -54,9 +54,9 @@ void printInitialInfo(const HeadlessReplay& replay) bnw::cout << "Players:\n"; bnw::cout << " # Name Nation Team\n"; bnw::cout << " ─────────────────────────────────────────────\n"; - for(unsigned i = 0; i < world.GetNumPlayers(); ++i) + for(unsigned i = 0; i < world.getNumPlayers(); ++i) { - const GamePlayer& p = world.GetPlayer(i); + const GamePlayer& p = world.getPlayer(i); char buf[80]; snprintf(buf, sizeof(buf), " %-2u %-24s %-12s %s\n", i, p.name.c_str(), NationNames[p.nation], teamStr(p.team).c_str()); diff --git a/extras/replay-player/main.cpp b/extras/replay-player/main.cpp index 13e719547a..4298c23d8d 100644 --- a/extras/replay-player/main.cpp +++ b/extras/replay-player/main.cpp @@ -63,8 +63,8 @@ int main(int argc, char** argv) } if(options.count("version")) { - bnw::cout << rttr::version::GetTitle() << " v" << rttr::version::GetVersion() << "-" - << rttr::version::GetRevision() << std::endl + bnw::cout << rttr::version::getTitle() << " v" << rttr::version::getVersion() << "-" + << rttr::version::getRevision() << std::endl << "Compiled with " << System::getCompilerName() << " for " << System::getOSName() << std::endl; return 0; } @@ -105,7 +105,7 @@ int main(int argc, char** argv) const auto printStats = [&] { HeadlessStats stats; stats.currentGF = replay.getCurrentGF(); - stats.totalGFs = replay.getReplay().GetLastGF() + 1; + stats.totalGFs = replay.getReplay().getLastGF() + 1; stats.gameTime = std::chrono::duration_cast(SPEED_GF_LENGTHS[GameSpeed::Normal] * stats.currentGF); stats.wallTime = diff --git a/extras/videoDrivers/SDL2/VideoSDL2.cpp b/extras/videoDrivers/SDL2/VideoSDL2.cpp index 113f9034eb..7d220f45a2 100644 --- a/extras/videoDrivers/SDL2/VideoSDL2.cpp +++ b/extras/videoDrivers/SDL2/VideoSDL2.cpp @@ -91,7 +91,7 @@ VideoSDL2::~VideoSDL2() CleanUp(); } -const char* VideoSDL2::GetName() const +const char* VideoSDL2::getName() const { return GetDriverName(); } @@ -126,7 +126,7 @@ void VideoSDL2::UpdateCurrentSizes() int w, h, w2, h2; SDL_GetWindowSize(window, &w, &h); SDL_GL_GetDrawableSize(window, &w2, &h2); - SetNewSize(VideoMode(w, h), Extent(w2, h2)); + setNewSize(VideoMode(w, h), Extent(w2, h2)); } static VideoMode getDesktopSize(SDL_Window* window, VideoMode fallback) @@ -251,7 +251,7 @@ bool VideoSDL2::ResizeScreen(VideoMode newSize, DisplayMode displayMode) } if(displayMode_ == DisplayMode::BorderlessWindow) newSize = getDesktopSize(nullptr, newSize); - if(newSize != GetWindowSize()) + if(newSize != getWindowSize()) { if(displayMode_ == DisplayMode::Fullscreen) { @@ -342,7 +342,7 @@ bool VideoSDL2::MessageLoop() { UpdateCurrentDisplayMode(); VideoMode newSize(ev.window.data1, ev.window.data2); - if(newSize != GetWindowSize()) + if(newSize != getWindowSize()) { UpdateCurrentSizes(); CallBack->WindowResized(); @@ -485,7 +485,7 @@ bool VideoSDL2::MessageLoop() break; case SDL_FINGERDOWN: { - VideoMode wnSize = GetWindowSize(); + VideoMode wnSize = getWindowSize(); mouse_xy.pos = getGuiScale().screenToView(Position(static_cast(ev.tfinger.x * wnSize.width), static_cast(ev.tfinger.y * wnSize.height))); mouse_xy.ldown = true; @@ -495,7 +495,7 @@ bool VideoSDL2::MessageLoop() } case SDL_FINGERUP: { - VideoMode wnSize = GetWindowSize(); + VideoMode wnSize = getWindowSize(); mouse_xy.pos = getGuiScale().screenToView(Position(static_cast(ev.tfinger.x * wnSize.width), static_cast(ev.tfinger.y * wnSize.height))); mouse_xy.ldown = false; @@ -505,7 +505,7 @@ bool VideoSDL2::MessageLoop() } case SDL_FINGERMOTION: { - VideoMode wnSize = GetWindowSize(); + VideoMode wnSize = getWindowSize(); const auto newPos = getGuiScale().screenToView(Position( static_cast(ev.tfinger.x * wnSize.width), static_cast(ev.tfinger.y * wnSize.height))); @@ -533,7 +533,7 @@ bool VideoSDL2::MessageLoop() return true; } -unsigned long VideoSDL2::GetTickCount() const +unsigned long VideoSDL2::getTickCount() const { return SDL_GetTicks(); } @@ -559,7 +559,7 @@ std::vector VideoSDL2::ListVideoModes() const return video_modes; } -OpenGL_Loader_Proc VideoSDL2::GetLoaderFunction() const +OpenGL_Loader_Proc VideoSDL2::getLoaderFunction() const { #if RTTR_OGL_GL4ES return gl4es_GetProcAddress; @@ -568,21 +568,21 @@ OpenGL_Loader_Proc VideoSDL2::GetLoaderFunction() const #endif } -void VideoSDL2::SetMousePos(Position pos) +void VideoSDL2::setMousePos(Position pos) { const auto screenPos = getGuiScale().viewToScreen(pos); mouse_xy.pos = pos; SDL_WarpMouseInWindow(window, screenPos.x, screenPos.y); } -KeyEvent VideoSDL2::GetModKeyState() const +KeyEvent VideoSDL2::getModKeyState() const { KeyEvent ke; setSpecialKeys(ke); return ke; } -void* VideoSDL2::GetMapPointer() const +void* VideoSDL2::getMapPointer() const { #ifdef WIN32 SDL_SysWMinfo wmInfo; @@ -605,7 +605,7 @@ void VideoSDL2::MoveWindowToCenter() int top, left, bottom, right; if(!CHECK_SDL(SDL_GetWindowBordersSize(window, &top, &left, &bottom, &right))) top = left = bottom = right = 0; - auto wndOuterSize = GetWindowSize(); + auto wndOuterSize = getWindowSize(); wndOuterSize.width += left + right; wndOuterSize.height += top + bottom; if(usableBounds.w < wndOuterSize.width || usableBounds.h < wndOuterSize.height) diff --git a/extras/videoDrivers/SDL2/VideoSDL2.h b/extras/videoDrivers/SDL2/VideoSDL2.h index 0e771a0b22..f1b4537e4f 100644 --- a/extras/videoDrivers/SDL2/VideoSDL2.h +++ b/extras/videoDrivers/SDL2/VideoSDL2.h @@ -20,7 +20,7 @@ class VideoSDL2 final : public VideoDriver ~VideoSDL2() override; /// Get the name of the driver - const char* GetName() const override; + const char* getName() const override; bool Initialize() override; @@ -37,21 +37,21 @@ class VideoSDL2 final : public VideoDriver void ShowErrorMessage(const std::string& title, const std::string& message) override; /// Get a timestamp - unsigned long GetTickCount() const override; + unsigned long getTickCount() const override; - OpenGL_Loader_Proc GetLoaderFunction() const override; + OpenGL_Loader_Proc getLoaderFunction() const override; /// Get supported video modes std::vector ListVideoModes() const override; /// Set mouse position - void SetMousePos(Position pos) override; + void setMousePos(Position pos) override; /// Get state of the modifier keys - KeyEvent GetModKeyState() const override; + KeyEvent getModKeyState() const override; /// Get (device-dependent!) window pointer, HWND in Windows - void* GetMapPointer() const override; + void* getMapPointer() const override; static void PrintError(); static void PrintError(const std::string& msg); diff --git a/extras/videoDrivers/WinAPI/WinAPI.cpp b/extras/videoDrivers/WinAPI/WinAPI.cpp index a11b8b4476..bcf045ec55 100644 --- a/extras/videoDrivers/WinAPI/WinAPI.cpp +++ b/extras/videoDrivers/WinAPI/WinAPI.cpp @@ -57,7 +57,7 @@ VideoWinAPI::~VideoWinAPI() pVideoWinAPI = nullptr; } -const char* VideoWinAPI::GetName() const +const char* VideoWinAPI::getName() const { return GetDriverName(); } @@ -88,7 +88,7 @@ bool VideoWinAPI::CreateScreen(const std::string& title, const VideoMode newSize if(!RegisterAndCreateWindow(title, newSize, displayMode)) return false; - if(displayMode == DisplayMode::Fullscreen && !MakeFullscreen(GetWindowSize())) + if(displayMode == DisplayMode::Fullscreen && !MakeFullscreen(getWindowSize())) return false; displayMode_ = displayMode; @@ -110,7 +110,7 @@ bool VideoWinAPI::ResizeScreen(const VideoMode newSize, DisplayMode displayMode) if(!initialized || !isDisplayModeChangeable) return false; - if(displayMode == displayMode_ && newSize == GetWindowSize()) + if(displayMode == displayMode_ && newSize == getWindowSize()) return true; VideoMode windowSize = (displayMode == DisplayMode::Fullscreen) ? FindClosestVideoMode(newSize) : newSize; @@ -134,7 +134,7 @@ bool VideoWinAPI::ResizeScreen(const VideoMode newSize, DisplayMode displayMode) } // Adjust style - const auto [style, exStyle] = GetStyleFlags(displayMode); + const auto [style, exStyle] = getStyleFlags(displayMode); SetWindowLongPtr(screen, GWL_STYLE, style); SetWindowLongPtr(screen, GWL_EXSTYLE, exStyle); displayMode_ = displayMode; @@ -144,7 +144,7 @@ bool VideoWinAPI::ResizeScreen(const VideoMode newSize, DisplayMode displayMode) // Set size and position UINT flags = SWP_SHOWWINDOW | SWP_DRAWFRAME | SWP_FRAMECHANGED; SetWindowPos(screen, HWND_TOP, wndArea.left, wndArea.top, wndArea.getSize().x, wndArea.getSize().y, flags); - SetNewSize(adjustedSize, Extent(adjustedSize.width, adjustedSize.height)); + setNewSize(adjustedSize, Extent(adjustedSize.width, adjustedSize.height)); ShowWindow(screen, SW_SHOW); SetActiveWindow(screen); @@ -154,7 +154,7 @@ bool VideoWinAPI::ResizeScreen(const VideoMode newSize, DisplayMode displayMode) return true; } -std::pair VideoWinAPI::GetStyleFlags(const DisplayMode mode) const +std::pair VideoWinAPI::getStyleFlags(const DisplayMode mode) const { if(mode == DisplayMode::Fullscreen) return std::make_pair(WS_POPUP, WS_EX_APPWINDOW); @@ -202,7 +202,7 @@ std::pair VideoWinAPI::CalculateWindowRect(const DisplayMode mo wRect.right = wRect.left + size.width; wRect.bottom = wRect.top + size.height; // Calculate real right/bottom based on the window style - const auto [style, exStyle] = GetStyleFlags(mode); + const auto [style, exStyle] = getStyleFlags(mode); AdjustWindowRectEx(&wRect, style, false, exStyle); // Make sure border/title bar is visible wRect.left = std::max(wRect.left, 0); @@ -238,7 +238,7 @@ bool VideoWinAPI::RegisterAndCreateWindow(const std::string& title, const VideoM // Create window const auto [wndArea, adjustedSize] = CalculateWindowRect(displayMode, wndSize); - const auto [style, exStyle] = GetStyleFlags(displayMode); + const auto [style, exStyle] = getStyleFlags(displayMode); screen = CreateWindowExW(exStyle, windowClassName.c_str(), wTitle.c_str(), style, wndArea.left, wndArea.top, wndArea.getSize().x, wndArea.getSize().y, nullptr, nullptr, GetModuleHandle(nullptr), nullptr); @@ -246,7 +246,7 @@ bool VideoWinAPI::RegisterAndCreateWindow(const std::string& title, const VideoM if(screen == nullptr) return false; - SetNewSize(adjustedSize, Extent(adjustedSize.width, adjustedSize.height)); + setNewSize(adjustedSize, Extent(adjustedSize.width, adjustedSize.height)); SetClipboardViewer(screen); @@ -385,7 +385,7 @@ bool VideoWinAPI::SwapBuffers() if(!screen_dc) return false; - ::SwapBuffers(screen_dc); + SwapBuffers(screen_dc); return true; } @@ -408,9 +408,9 @@ void VideoWinAPI::ShowErrorMessage(const std::string& title, const std::string& MessageBoxA(nullptr, message.c_str(), title.c_str(), MB_OK | MB_ICONEXCLAMATION); } -unsigned long VideoWinAPI::GetTickCount() const +unsigned long VideoWinAPI::getTickCount() const { - return ::GetTickCount(); + return GetTickCount(); } static void* wglGetProcAddress_Wrapper(const char* name) @@ -424,7 +424,7 @@ static void* wglGetProcAddress_Wrapper(const char* name) return func; } -OpenGL_Loader_Proc VideoWinAPI::GetLoaderFunction() const +OpenGL_Loader_Proc VideoWinAPI::getLoaderFunction() const { return wglGetProcAddress_Wrapper; } @@ -445,7 +445,7 @@ std::vector VideoWinAPI::ListVideoModes() const return video_modes; } -void VideoWinAPI::SetMousePos(Position pos) +void VideoWinAPI::setMousePos(Position pos) { if(GetActiveWindow()) { @@ -549,9 +549,9 @@ LRESULT CALLBACK VideoWinAPI::WindowProc(HWND window, UINT msg, WPARAM wParam, L if(wParam != SIZE_MAXIMIZED && wParam != SIZE_RESTORED) break; VideoMode newSize(LOWORD(lParam), HIWORD(lParam)); - if(pVideoWinAPI->GetWindowSize() != newSize || pVideoWinAPI->isMinimized) + if(pVideoWinAPI->getWindowSize() != newSize || pVideoWinAPI->isMinimized) { - pVideoWinAPI->SetNewSize(newSize, Extent(newSize.width, newSize.height)); + pVideoWinAPI->setNewSize(newSize, Extent(newSize.width, newSize.height)); pVideoWinAPI->isDisplayModeChangeable = false; pVideoWinAPI->CallBack->WindowResized(); @@ -635,7 +635,7 @@ LRESULT CALLBACK VideoWinAPI::WindowProc(HWND window, UINT msg, WPARAM wParam, L return DefWindowProcW(window, msg, wParam, lParam); } -KeyEvent VideoWinAPI::GetModKeyState() const +KeyEvent VideoWinAPI::getModKeyState() const { KeyEvent ke; ke.ctrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0; @@ -644,7 +644,7 @@ KeyEvent VideoWinAPI::GetModKeyState() const return ke; } -void* VideoWinAPI::GetMapPointer() const +void* VideoWinAPI::getMapPointer() const { return (void*)this->screen; } diff --git a/extras/videoDrivers/WinAPI/WinAPI.h b/extras/videoDrivers/WinAPI/WinAPI.h index 8876565e40..0c147e1e49 100644 --- a/extras/videoDrivers/WinAPI/WinAPI.h +++ b/extras/videoDrivers/WinAPI/WinAPI.h @@ -23,7 +23,7 @@ class VideoWinAPI final : public VideoDriver ~VideoWinAPI(); /// Return name of driver - const char* GetName() const override; + const char* getName() const override; /// Initialize the driver, return true on success bool Initialize() override; @@ -47,26 +47,26 @@ class VideoWinAPI final : public VideoDriver void ShowErrorMessage(const std::string& title, const std::string& message) override; /// Return the current tick count (time since epoch in ms) - unsigned long GetTickCount() const override; + unsigned long getTickCount() const override; /// Get a pointer to an OpenGL function loader - OpenGL_Loader_Proc GetLoaderFunction() const override; + OpenGL_Loader_Proc getLoaderFunction() const override; /// Return supported resolutions std::vector ListVideoModes() const override; /// Set position of the mouse cursor in screen coordinates - void SetMousePos(Position pos) override; + void setMousePos(Position pos) override; /// Get state of the modifier keys - KeyEvent GetModKeyState() const override; + KeyEvent getModKeyState() const override; /// Get pointer to window (device-dependent!) - void* GetMapPointer() const override; + void* getMapPointer() const override; private: /// Get style and extended style flags - std::pair GetStyleFlags(DisplayMode mode) const; + std::pair getStyleFlags(DisplayMode mode) const; /// Calculate the rect for the window of the requested size at the display mode /// Returns the final rect (position&size) for the window and the possibly adjusted size of the render region std::pair CalculateWindowRect(DisplayMode mode, VideoMode requestedSize) const; diff --git a/libs/common/include/makeException.h b/libs/common/include/makeException.h index 7a9153c50c..0b0893a94e 100644 --- a/libs/common/include/makeException.h +++ b/libs/common/include/makeException.h @@ -16,10 +16,10 @@ auto makeException(Args&&... args) } /// Return the last error (either GetLastError or errno) -std::error_code GetLastErrorCode(); +std::error_code getLastErrorCode(); template std::system_error makeLastSystemError(Args&&... args) { - return {GetLastErrorCode(), helpers::concat(std::forward(args)...)}; + return {getLastErrorCode(), helpers::concat(std::forward(args)...)}; } diff --git a/libs/common/src/makeException.cpp b/libs/common/src/makeException.cpp index 5d3cc2a0a3..3810a5f1ac 100644 --- a/libs/common/src/makeException.cpp +++ b/libs/common/src/makeException.cpp @@ -12,7 +12,7 @@ # error "Must define windows or posix API" #endif -std::error_code GetLastErrorCode() +std::error_code getLastErrorCode() { #ifdef BOOST_WINDOWS_API return std::error_code(GetLastError(), std::system_category()); diff --git a/libs/driver/include/driver/AudioDriver.h b/libs/driver/include/driver/AudioDriver.h index 76a1ecdf1d..5c1d211b48 100644 --- a/libs/driver/include/driver/AudioDriver.h +++ b/libs/driver/include/driver/AudioDriver.h @@ -19,7 +19,7 @@ class AudioDriver : public IAudioDriver ~AudioDriver() override; /// prüft auf Initialisierung. - bool IsInitialized() final override { return initialized; } + bool isInitialized() final override { return initialized; } void CleanUp() override; EffectPlayId PlayEffect(const RawSoundHandle& sound, uint8_t volume, bool loop) final override; @@ -32,9 +32,9 @@ class AudioDriver : public IAudioDriver protected: static constexpr unsigned DEFAULT_NUM_CHANNELS = 64; /// Sets the actual number of channels used. Must be called before using channels - void SetNumChannels(unsigned numChannels); + void setNumChannels(unsigned numChannels); /// Get the channel an effect is being played at or -1 if not found - int GetEffectChannel(EffectPlayId playId) const; + int getEffectChannel(EffectPlayId playId) const; /// Removes the effect from the channel list void RemoveEffect(EffectPlayId playId); /// Add the sound to the list of loaded sounds and return a RawSoundHandle diff --git a/libs/driver/include/driver/AudioInterface.h b/libs/driver/include/driver/AudioInterface.h index 6bc7835bb1..6797631632 100644 --- a/libs/driver/include/driver/AudioInterface.h +++ b/libs/driver/include/driver/AudioInterface.h @@ -20,9 +20,9 @@ class BOOST_SYMBOL_VISIBLE IAudioDriver virtual ~IAudioDriver() = 0; /// Return the name of the driver - virtual const char* GetName() const = 0; + virtual const char* getName() const = 0; /// True iff the driver is initialized - virtual bool IsInitialized() = 0; + virtual bool isInitialized() = 0; virtual bool Initialize() = 0; /// Closes all open handles of the driver (stops and unloads music and effects) virtual void CleanUp() = 0; @@ -47,14 +47,14 @@ class BOOST_SYMBOL_VISIBLE IAudioDriver /// Stop the effect with the given id (if it is still playing) virtual void StopEffect(EffectPlayId play_id) = 0; /// Is the effect still being played - virtual bool IsEffectPlaying(EffectPlayId play_id) = 0; + virtual bool isEffectPlaying(EffectPlayId play_id) = 0; /// Changes volume [0..256) of a played sound (if it is still playing) relative to the master effect volume virtual void ChangeVolume(EffectPlayId play_id, uint8_t volume) = 0; /// Set the master effect volume [0..256) at which all effects will be played. Changing the volume of an effect will /// be relative to this - virtual void SetMasterEffectVolume(uint8_t volume) = 0; + virtual void setMasterEffectVolume(uint8_t volume) = 0; /// Sets the music volume [0..256) - virtual void SetMusicVolume(uint8_t volume) = 0; + virtual void setMusicVolume(uint8_t volume) = 0; }; } // namespace driver diff --git a/libs/driver/include/driver/VideoDriver.h b/libs/driver/include/driver/VideoDriver.h index fd771fb847..9f991f71d6 100644 --- a/libs/driver/include/driver/VideoDriver.h +++ b/libs/driver/include/driver/VideoDriver.h @@ -19,20 +19,20 @@ class VideoDriver : public IVideoDriver ~VideoDriver() override = default; /// Funktion zum Auslesen der Mauskoordinaten. - Position GetMousePos() const override; + Position getMousePos() const override; /// Funktion zum Auslesen ob die Linke Maustaste gedrückt ist. - bool GetMouseStateL() const override; + bool getMouseStateL() const override; /// Funktion zum Auslesen ob die Rechte Maustaste gedrückt ist. - bool GetMouseStateR() const override; + bool getMouseStateR() const override; /// Function to check if at least 1 finger is on screen - bool IsTouchEvent() const override; + bool isTouchEvent() const override; - VideoMode GetWindowSize() const override final { return windowSize_; } - Extent GetRenderSize() const override final { return scaledRenderSize_; } - DisplayMode GetDisplayMode() const override final { return displayMode_; } + VideoMode getWindowSize() const override final { return windowSize_; } + Extent getRenderSize() const override final { return scaledRenderSize_; } + DisplayMode getDisplayMode() const override final { return displayMode_; } float getDpiScale() const override final { return dpiScale_; } @@ -42,12 +42,12 @@ class VideoDriver : public IVideoDriver GuiScaleRange getGuiScaleRange() const override; /// prüft auf Initialisierung. - bool IsInitialized() const override final { return initialized; } - bool IsOpenGL() const override { return true; } + bool isInitialized() const override final { return initialized; } + bool isOpenGL() const override { return true; } protected: VideoMode FindClosestVideoMode(VideoMode mode) const; - void SetNewSize(VideoMode windowSize, Extent renderSize); + void setNewSize(VideoMode windowSize, Extent renderSize); VideoDriverLoaderInterface* CallBack; /// DriverCallback to notify on player input bool initialized; diff --git a/libs/driver/include/driver/VideoInterface.h b/libs/driver/include/driver/VideoInterface.h index 51b7344b08..87343e8a9a 100644 --- a/libs/driver/include/driver/VideoInterface.h +++ b/libs/driver/include/driver/VideoInterface.h @@ -22,7 +22,7 @@ class BOOST_SYMBOL_VISIBLE IVideoDriver virtual ~IVideoDriver() = 0; /// Funktion zum Auslesen des Treibernamens. - virtual const char* GetName() const = 0; + virtual const char* getName() const = 0; virtual bool Initialize() = 0; @@ -41,31 +41,31 @@ class BOOST_SYMBOL_VISIBLE IVideoDriver virtual bool MessageLoop() = 0; /// Return the current tick count (time since epoch in ms) - virtual unsigned long GetTickCount() const = 0; + virtual unsigned long getTickCount() const = 0; /// Funktion zum Holen einer Subfunktion. - virtual OpenGL_Loader_Proc GetLoaderFunction() const = 0; + virtual OpenGL_Loader_Proc getLoaderFunction() const = 0; virtual std::vector ListVideoModes() const = 0; /// Funktion zum Auslesen der Mauskoordinaten. - virtual Position GetMousePos() const = 0; + virtual Position getMousePos() const = 0; /// Funktion zum Setzen der Mauskoordinaten. - virtual void SetMousePos(Position pos) = 0; + virtual void setMousePos(Position pos) = 0; /// Return true when left mouse button is pressed - virtual bool GetMouseStateL() const = 0; + virtual bool getMouseStateL() const = 0; /// Return true when right mouse button is pressed - virtual bool GetMouseStateR() const = 0; + virtual bool getMouseStateR() const = 0; /// Return true if at least 1 finger is on screen - virtual bool IsTouchEvent() const = 0; + virtual bool isTouchEvent() const = 0; /// Get the size of the window in screen coordinates - virtual VideoMode GetWindowSize() const = 0; + virtual VideoMode getWindowSize() const = 0; /// Get the size of the render region in pixels - virtual Extent GetRenderSize() const = 0; - virtual DisplayMode GetDisplayMode() const = 0; + virtual Extent getRenderSize() const = 0; + virtual DisplayMode getDisplayMode() const = 0; /// Get the factor required to scale "normal" DPI to the display DPI virtual float getDpiScale() const = 0; @@ -80,14 +80,14 @@ class BOOST_SYMBOL_VISIBLE IVideoDriver virtual GuiScaleRange getGuiScaleRange() const = 0; /// Get state of the modifier keys - virtual KeyEvent GetModKeyState() const = 0; + virtual KeyEvent getModKeyState() const = 0; /// Get pointer to window (device-dependent!), HWND unter Windows - virtual void* GetMapPointer() const = 0; + virtual void* getMapPointer() const = 0; - virtual bool IsInitialized() const = 0; + virtual bool isInitialized() const = 0; /// Shall we support OpenGL? (Disabled for tests) - virtual bool IsOpenGL() const = 0; + virtual bool isOpenGL() const = 0; // Display the problem to the gamer virtual void ShowErrorMessage(const std::string& title, const std::string& message) = 0; diff --git a/libs/driver/src/AudioDriver.cpp b/libs/driver/src/AudioDriver.cpp index e04940630b..ef5385e88a 100644 --- a/libs/driver/src/AudioDriver.cpp +++ b/libs/driver/src/AudioDriver.cpp @@ -51,7 +51,7 @@ EffectPlayId AudioDriver::PlayEffect(const RawSoundHandle& sound, uint8_t volume void AudioDriver::StopEffect(EffectPlayId play_id) { - const int channel = GetEffectChannel(play_id); + const int channel = getEffectChannel(play_id); if(channel >= 0) { doStopEffect(channel); @@ -83,13 +83,13 @@ void AudioDriver::registerForUnload(RawSoundHandle* handlePtr) handlesRegisteredForUnload_.push_back(handlePtr); } -void AudioDriver::SetNumChannels(unsigned numChannels) +void AudioDriver::setNumChannels(unsigned numChannels) { channels_.resize(numChannels); std::fill(channels_.begin(), channels_.end(), EffectPlayId::Invalid); } -int AudioDriver::GetEffectChannel(EffectPlayId playId) const +int AudioDriver::getEffectChannel(EffectPlayId playId) const { const auto it = helpers::find(channels_, playId); return (it == channels_.end()) ? -1 : static_cast(std::distance(channels_.begin(), it)); @@ -97,7 +97,7 @@ int AudioDriver::GetEffectChannel(EffectPlayId playId) const void AudioDriver::RemoveEffect(EffectPlayId playId) { - int channel = GetEffectChannel(playId); + int channel = getEffectChannel(playId); if(channel >= 0) channels_[channel] = EffectPlayId::Invalid; } diff --git a/libs/driver/src/VideoDriver.cpp b/libs/driver/src/VideoDriver.cpp index 3cdb7288ac..4153d599e8 100644 --- a/libs/driver/src/VideoDriver.cpp +++ b/libs/driver/src/VideoDriver.cpp @@ -25,7 +25,7 @@ VideoDriver::VideoDriver(VideoDriverLoaderInterface* CallBack) std::fill(keyboard.begin(), keyboard.end(), false); } -Position VideoDriver::GetMousePos() const +Position VideoDriver::getMousePos() const { return mouse_xy.pos; } @@ -35,7 +35,7 @@ Position VideoDriver::GetMousePos() const * * @return @p true bei Gedrückt, @p false bei Losgelassen */ -bool VideoDriver::GetMouseStateL() const +bool VideoDriver::getMouseStateL() const { return mouse_xy.ldown; } @@ -45,7 +45,7 @@ bool VideoDriver::GetMouseStateL() const * * @return @p true bei Gedrückt, @p false bei Losgelassen */ -bool VideoDriver::GetMouseStateR() const +bool VideoDriver::getMouseStateR() const { return mouse_xy.rdown; } @@ -55,7 +55,7 @@ bool VideoDriver::GetMouseStateR() const * * @return @p true at least 1 finger, @p false when mouse used */ -bool VideoDriver::IsTouchEvent() const +bool VideoDriver::isTouchEvent() const { return mouse_xy.num_tfingers > 0; } @@ -81,7 +81,7 @@ VideoMode VideoDriver::FindClosestVideoMode(const VideoMode mode) const return best; } -void VideoDriver::SetNewSize(VideoMode windowSize, Extent renderSize) +void VideoDriver::setNewSize(VideoMode windowSize, Extent renderSize) { windowSize_ = windowSize; renderSize_ = renderSize; diff --git a/libs/libGamedata/gameData/TerrainDesc.cpp b/libs/libGamedata/gameData/TerrainDesc.cpp index 107b2411fe..86a2ee894a 100644 --- a/libs/libGamedata/gameData/TerrainDesc.cpp +++ b/libs/libGamedata/gameData/TerrainDesc.cpp @@ -122,18 +122,18 @@ TerrainBQ TerrainDesc::GetBQ() const return TerrainBQ::Nothing; } -bool TerrainDesc::IsUsableByAnimals() const +bool TerrainDesc::isUsableByAnimals() const { // If it is buildable land or mountain, animals can use it return (kind == TerrainKind::Land || kind == TerrainKind::Mountain) && Is(ETerrain::Buildable); } -bool TerrainDesc::IsVital() const +bool TerrainDesc::isVital() const { return kind == TerrainKind::Land && Is(ETerrain::Buildable); } -TerrainDesc::Triangle TerrainDesc::GetUSDTriangle() const +TerrainDesc::Triangle TerrainDesc::getUSDTriangle() const { // Inset by 0.5 on all sites to sample middle of pixel in OGL RectBase oglRect(posInTexture.getOrigin() + PointF::all(.5f), posInTexture.getSize() - PointF::all(1)); @@ -162,7 +162,7 @@ TerrainDesc::Triangle TerrainDesc::GetUSDTriangle() const return result; } -TerrainDesc::Triangle TerrainDesc::GetRSUTriangle() const +TerrainDesc::Triangle TerrainDesc::getRSUTriangle() const { // Inset by 0.5 on all sites to sample middle of pixel in OGL RectBase oglRect(posInTexture.getOrigin() + PointF::all(.5f), posInTexture.getSize() - PointF::all(1)); diff --git a/libs/libGamedata/gameData/TerrainDesc.h b/libs/libGamedata/gameData/TerrainDesc.h index b9e5afda71..f8f1e31365 100644 --- a/libs/libGamedata/gameData/TerrainDesc.h +++ b/libs/libGamedata/gameData/TerrainDesc.h @@ -80,15 +80,15 @@ struct TerrainDesc /// Get the building quality of the terrain from the flags TerrainBQ GetBQ() const; /// Returns whether "regular" animals walk on that terrain (no water or snow animals) - bool IsUsableByAnimals() const; + bool isUsableByAnimals() const; /// Returns whether corn fields can grow on the terrain (no dessert, mountain etc) - bool IsVital() const; + bool isVital() const; /// Return true if the terrain has the given attribute bool Is(ETerrain what) const; /// Get the position of the up side down triangle - Triangle GetUSDTriangle() const; + Triangle getUSDTriangle() const; /// Get the position of right side up down triangle - Triangle GetRSUTriangle() const; + Triangle getRSUTriangle() const; }; inline bool TerrainDesc::Is(ETerrain what) const diff --git a/libs/libGamedata/lua/CampaignDataLoader.cpp b/libs/libGamedata/lua/CampaignDataLoader.cpp index 4828cb8c8d..02acda3bc3 100644 --- a/libs/libGamedata/lua/CampaignDataLoader.cpp +++ b/libs/libGamedata/lua/CampaignDataLoader.cpp @@ -15,7 +15,7 @@ #include #include -unsigned CampaignDataLoader::GetVersion() +unsigned CampaignDataLoader::getVersion() { return 3; } @@ -35,11 +35,11 @@ bool CampaignDataLoader::CheckScriptVersion() if(func.type() == LUA_TFUNCTION) { const auto scriptVersion = func.call(); - if(scriptVersion <= GetVersion()) + if(scriptVersion <= getVersion()) return true; else { - LOG.write(_("Wrong lua script version: %1%. Current version: %2%.\n")) % scriptVersion % GetVersion(); + LOG.write(_("Wrong lua script version: %1%. Current version: %2%.\n")) % scriptVersion % getVersion(); return false; } } else diff --git a/libs/libGamedata/lua/CampaignDataLoader.h b/libs/libGamedata/lua/CampaignDataLoader.h index a55d585665..70646e483a 100644 --- a/libs/libGamedata/lua/CampaignDataLoader.h +++ b/libs/libGamedata/lua/CampaignDataLoader.h @@ -19,7 +19,7 @@ class CampaignDataLoader : public LuaInterfaceBase ~CampaignDataLoader() override; /// Return version of the interface. Changes here reflect breaking changes - static unsigned GetVersion(); + static unsigned getVersion(); bool Load(); diff --git a/libs/rttrConfig/src/RTTR_Version.cpp b/libs/rttrConfig/src/RTTR_Version.cpp index 2a779e7b0d..2880769998 100644 --- a/libs/rttrConfig/src/RTTR_Version.cpp +++ b/libs/rttrConfig/src/RTTR_Version.cpp @@ -7,39 +7,39 @@ namespace rttr::version { -std::string GetTitle() +std::string getTitle() { return "Return To The Roots"; } -std::string GetVersion() +std::string getVersion() { return rttr::VERSION; } -std::string GetBuildDate() +std::string getBuildDate() { return rttr::BUILD_DATE; } -std::string GetRevision() +std::string getRevision() { return rttr::REVISION; } -std::string GetShortRevision() +std::string getShortRevision() { - return GetRevision().substr(0, 7); + return getRevision().substr(0, 7); } -std::string GetYear() +std::string getYear() { - return GetBuildDate().substr(0, 4); + return getBuildDate().substr(0, 4); } -std::string GetReadableVersion() +std::string getReadableVersion() { - return "v" + GetVersion() + " - " + GetShortRevision(); + return "v" + getVersion() + " - " + getShortRevision(); } } // namespace rttr::version \ No newline at end of file diff --git a/libs/rttrConfig/src/RTTR_Version.h b/libs/rttrConfig/src/RTTR_Version.h index a7d94ddc6b..444984e2f2 100644 --- a/libs/rttrConfig/src/RTTR_Version.h +++ b/libs/rttrConfig/src/RTTR_Version.h @@ -7,11 +7,11 @@ #include namespace rttr::version { -std::string GetTitle(); -std::string GetVersion(); -std::string GetBuildDate(); -std::string GetRevision(); -std::string GetShortRevision(); -std::string GetYear(); -std::string GetReadableVersion(); +std::string getTitle(); +std::string getVersion(); +std::string getBuildDate(); +std::string getRevision(); +std::string getShortRevision(); +std::string getYear(); +std::string getReadableVersion(); } // namespace rttr::version diff --git a/libs/rttrConfig/src/RttrConfig.cpp b/libs/rttrConfig/src/RttrConfig.cpp index b42be52aa5..ca0498f2e7 100644 --- a/libs/rttrConfig/src/RttrConfig.cpp +++ b/libs/rttrConfig/src/RttrConfig.cpp @@ -31,7 +31,7 @@ namespace bfs = boost::filesystem; # endif #endif // !RTTR_SETTINGSDIR -bfs::path RttrConfig::GetPrefixPath() +bfs::path RttrConfig::getPrefixPath() { // Determine install prefix // Get path to current executable (at least for checks) @@ -82,7 +82,7 @@ bfs::path RttrConfig::GetPrefixPath() return bfs::absolute(prefixPath); } -boost::filesystem::path RttrConfig::GetSourceDir() +boost::filesystem::path RttrConfig::getSourceDir() { return RTTR_SRCDIR; } @@ -123,7 +123,7 @@ void RttrConfig::overridePathMapping(const std::string& id, const boost::filesys bool RttrConfig::Init() { - prefixPath_ = GetPrefixPath(); + prefixPath_ = getPrefixPath(); if(prefixPath_.empty()) return false; // Make the prefix path our working directory as all other paths are relative to that diff --git a/libs/rttrConfig/src/RttrConfig.h b/libs/rttrConfig/src/RttrConfig.h index 8589fde9b9..5eda609465 100644 --- a/libs/rttrConfig/src/RttrConfig.h +++ b/libs/rttrConfig/src/RttrConfig.h @@ -20,9 +20,9 @@ class RttrConfig : public Singleton /// Checks the env var for path override and returns result path static boost::filesystem::path getEnvOverride(const std::string& id, const boost::filesystem::path& defaultPath); /// Return the prefix path for the installation - static boost::filesystem::path GetPrefixPath(); + static boost::filesystem::path getPrefixPath(); /// Return the path from which RTTR was compiled - static boost::filesystem::path GetSourceDir(); + static boost::filesystem::path getSourceDir(); /// Expand the given path to a valid, absolute path replacing placeholders like /foo.bar boost::filesystem::path ExpandPath(const std::string& path) const; /// Overwrite a given path mapping diff --git a/libs/s25client/s25client.cpp b/libs/s25client/s25client.cpp index 9d659082fa..5924135090 100644 --- a/libs/s25client/s25client.cpp +++ b/libs/s25client/s25client.cpp @@ -97,7 +97,7 @@ void WaitForEnter() std::string GetProgramDescription() { std::stringstream s; - s << rttr::version::GetTitle() << " v" << rttr::version::GetVersion() << "-" << rttr::version::GetRevision() << "\n" + s << rttr::version::getTitle() << " v" << rttr::version::getVersion() << "-" << rttr::version::getRevision() << "\n" << "Compiled with " << System::getCompilerName() << " for " << System::getOSName(); return s.str(); } @@ -173,7 +173,7 @@ void showCrashMessage() void handleException(void* pCtx = nullptr) noexcept { - const auto stacktrace = DebugInfo::GetStackTrace(pCtx); + const auto stacktrace = DebugInfo::getStackTrace(pCtx); try { LogTarget target = (LOG.getFileWriter()) ? LogTarget::FileAndStderr : LogTarget::Stderr; diff --git a/libs/s25main/AsyncChecksum.cpp b/libs/s25main/AsyncChecksum.cpp index 880076c19b..81ea8c739f 100644 --- a/libs/s25main/AsyncChecksum.cpp +++ b/libs/s25main/AsyncChecksum.cpp @@ -45,8 +45,8 @@ unsigned AsyncChecksum::getHash() const AsyncChecksum AsyncChecksum::create(const Game& game) { - return AsyncChecksum(RANDOM.GetChecksum(), GameObject::GetNumObjs(), GameObject::GetObjIDCounter(), - game.em_->GetNumActiveEvents(), game.em_->GetEventInstanceCtr()); + return AsyncChecksum(RANDOM.getChecksum(), GameObject::getNumObjs(), GameObject::getObjIDCounter(), + game.em_->getNumActiveEvents(), game.em_->getEventInstanceCtr()); } std::ostream& operator<<(std::ostream& os, const AsyncChecksum& checksum) diff --git a/libs/s25main/BasePlayerInfo.cpp b/libs/s25main/BasePlayerInfo.cpp index 30b8a6778f..ba10768b4f 100644 --- a/libs/s25main/BasePlayerInfo.cpp +++ b/libs/s25main/BasePlayerInfo.cpp @@ -48,12 +48,12 @@ void BasePlayerInfo::Serialize(Serializer& ser, bool lightData) const helpers::pushEnum(ser, team); } -int BasePlayerInfo::GetColorIdx() const +int BasePlayerInfo::getColorIdx() const { - return GetColorIdx(color); + return getColorIdx(color); } -int BasePlayerInfo::GetColorIdx(unsigned color) //-V688 +int BasePlayerInfo::getColorIdx(unsigned color) //-V688 { for(int i = 0; i < static_cast(PLAYER_COLORS.size()); ++i) { diff --git a/libs/s25main/BasePlayerInfo.h b/libs/s25main/BasePlayerInfo.h index b4931c7416..e06b9338ba 100644 --- a/libs/s25main/BasePlayerInfo.h +++ b/libs/s25main/BasePlayerInfo.h @@ -36,8 +36,8 @@ struct BasePlayerInfo bool isUsed() const { return (ps == PlayerState::AI || ps == PlayerState::Occupied); } /// Returns index of color in PLAYER_COLORS array or -1 if not found - int GetColorIdx() const; - static int GetColorIdx(unsigned color); + int getColorIdx() const; + static int getColorIdx(unsigned color); static int getCurrentVersion(); }; diff --git a/libs/s25main/BuildingRegister.cpp b/libs/s25main/BuildingRegister.cpp index 88cb1849f9..9cfe037be7 100644 --- a/libs/s25main/BuildingRegister.cpp +++ b/libs/s25main/BuildingRegister.cpp @@ -23,7 +23,7 @@ void BuildingRegister::Serialize(SerializedGameData& sgd) const sgd.PushObjectContainer(harbors, true); for(const auto bld : helpers::enumRange()) { - if(BuildingProperties::IsUsual(bld)) + if(BuildingProperties::isUsual(bld)) sgd.PushObjectContainer(buildings[bld], true); } sgd.PushObjectContainer(building_sites, true); @@ -35,22 +35,22 @@ void BuildingRegister::Deserialize(SerializedGameData& sgd) sgd.PopObjectContainer(warehouses); sgd.PopObjectContainer(harbors, GO_Type::NobHarborbuilding); - if(sgd.GetGameDataVersion() >= 6) + if(sgd.getGameDataVersion() >= 6) { for(const auto bld : helpers::enumRange()) { - if(sgd.GetGameDataVersion() < 11 && wineaddon::isWineAddonBuildingType(bld)) + if(sgd.getGameDataVersion() < 11 && wineaddon::isWineAddonBuildingType(bld)) continue; - if(sgd.GetGameDataVersion() < 12 && leatheraddon::isLeatherAddonBuildingType(bld)) + if(sgd.getGameDataVersion() < 12 && leatheraddon::isLeatherAddonBuildingType(bld)) continue; - if(BuildingProperties::IsUsual(bld)) + if(BuildingProperties::isUsual(bld)) sgd.PopObjectContainer(buildings[bld], GO_Type::NobUsual); } sgd.PopObjectContainer(building_sites, GO_Type::Buildingsite); sgd.PopObjectContainer(military_buildings, GO_Type::NobMilitary); - } else if(sgd.GetGameDataVersion() >= 2) + } else if(sgd.getGameDataVersion() >= 2) Deserialize2(sgd); } @@ -77,11 +77,11 @@ void BuildingRegister::Remove(noBuildingSite* building_site) void BuildingRegister::Add(noBuilding* bld, BuildingType bldType) { - if(BuildingProperties::IsMilitary(bldType)) + if(BuildingProperties::isMilitary(bldType)) { RTTR_Assert(!helpers::contains(military_buildings, bld)); military_buildings.push_back(static_cast(bld)); - } else if(BuildingProperties::IsWareHouse(bldType)) + } else if(BuildingProperties::isWareHouse(bldType)) { RTTR_Assert(!helpers::contains(warehouses, bld)); warehouses.push_back(static_cast(bld)); @@ -99,11 +99,11 @@ void BuildingRegister::Add(noBuilding* bld, BuildingType bldType) void BuildingRegister::Remove(noBuilding* bld, BuildingType bldType) { - if(BuildingProperties::IsMilitary(bldType)) + if(BuildingProperties::isMilitary(bldType)) { RTTR_Assert(helpers::contains(military_buildings, bld)); military_buildings.remove(static_cast(bld)); - } else if(BuildingProperties::IsWareHouse(bldType)) + } else if(BuildingProperties::isWareHouse(bldType)) { RTTR_Assert(helpers::contains(warehouses, bld)); warehouses.remove(static_cast(bld)); @@ -120,14 +120,14 @@ void BuildingRegister::Remove(noBuilding* bld, BuildingType bldType) } /// Gibt Liste von Gebäuden des Spieler zurück -const std::list& BuildingRegister::GetBuildings(const BuildingType type) const +const std::list& BuildingRegister::getBuildings(const BuildingType type) const { - RTTR_Assert(BuildingProperties::IsUsual(type)); + RTTR_Assert(BuildingProperties::isUsual(type)); return buildings[type]; } /// Liefert die Anzahl aller Gebäude einzeln -BuildingCount BuildingRegister::GetBuildingNums() const +BuildingCount BuildingRegister::getBuildingNums() const { BuildingCount bc{}; @@ -136,13 +136,13 @@ BuildingCount BuildingRegister::GetBuildingNums() const bc.buildings[bld] = buildings[bld].size(); // Lagerhäuser zählen for(const nobBaseWarehouse* bld : warehouses) - ++bc.buildings[bld->GetBuildingType()]; + ++bc.buildings[bld->getBuildingType()]; // Militärgebäude zählen for(const nobMilitary* bld : military_buildings) - ++bc.buildings[bld->GetBuildingType()]; + ++bc.buildings[bld->getBuildingType()]; // Baustellen zählen for(const noBuildingSite* bld : building_sites) - ++bc.buildingSites[bld->GetBuildingType()]; + ++bc.buildingSites[bld->getBuildingType()]; return bc; } @@ -160,12 +160,12 @@ unsigned BuildingRegister::CalcAverageProductivity(BuildingType bldType) const if(holds_alternative(BLD_WORK_DESC[bldType].producedWare)) return 0; unsigned productivity = 0; - const auto& buildings = GetBuildings(bldType); + const auto& buildings = getBuildings(bldType); const unsigned numBlds = buildings.size(); if(numBlds > 0) { for(const nobUsual* bld : buildings) - productivity += bld->GetProductivity(); + productivity += bld->getProductivity(); productivity /= numBlds; } return productivity; @@ -180,10 +180,10 @@ unsigned short BuildingRegister::CalcAverageProductivity() const if(holds_alternative(BLD_WORK_DESC[bldType].producedWare)) continue; - const auto& buildings = GetBuildings(bldType); + const auto& buildings = getBuildings(bldType); numBlds += buildings.size(); for(const nobUsual* bld : buildings) - totalProductivity += bld->GetProductivity(); + totalProductivity += bld->getProductivity(); } if(numBlds == 0) return 0; diff --git a/libs/s25main/BuildingRegister.h b/libs/s25main/BuildingRegister.h index bcc5fb488c..2051c2c182 100644 --- a/libs/s25main/BuildingRegister.h +++ b/libs/s25main/BuildingRegister.h @@ -31,14 +31,14 @@ class BuildingRegister void Add(noBuilding* bld, BuildingType bldType); void Remove(noBuilding* bld, BuildingType bldType); - const std::list& GetBuildingSites() const { return building_sites; } - const std::list& GetBuildings(BuildingType type) const; - const std::list& GetMilitaryBuildings() const { return military_buildings; } - const std::list& GetHarbors() const { return harbors; } - const std::list& GetStorehouses() const { return warehouses; } + const std::list& getBuildingSites() const { return building_sites; } + const std::list& getBuildings(BuildingType type) const; + const std::list& getMilitaryBuildings() const { return military_buildings; } + const std::list& getHarbors() const { return harbors; } + const std::list& getStorehouses() const { return warehouses; } /// Liefert die Anzahl aller Gebäude einzeln - BuildingCount GetBuildingNums() const; + BuildingCount getBuildingNums() const; /// Calculate and fill the average productivities for all buildings. helpers::EnumArray CalcProductivities() const; /// Calculate the average productivity for a building type diff --git a/libs/s25main/CatapultStone.cpp b/libs/s25main/CatapultStone.cpp index 3674d37e3a..6fe4de97f6 100644 --- a/libs/s25main/CatapultStone.cpp +++ b/libs/s25main/CatapultStone.cpp @@ -22,7 +22,7 @@ CatapultStone::CatapultStone(const MapPoint dest_building, const MapPoint dest_m const DrawPoint dest, const unsigned fly_duration) : dest_building(dest_building), dest_map(dest_map), startPos(start), destPos(dest), explode(false) { - event = GetEvMgr().AddEvent(this, fly_duration); + event = getEvMgr().AddEvent(this, fly_duration); } CatapultStone::CatapultStone(SerializedGameData& sgd, const unsigned obj_id) @@ -46,7 +46,7 @@ void CatapultStone::Destroy() {} void CatapultStone::Draw(DrawPoint drawOffset) { - const DrawPoint worldSize = DrawPoint(world->GetWidth() * TR_W, world->GetHeight() * TR_H); + const DrawPoint worldSize = DrawPoint(world->getWidth() * TR_W, world->getHeight() * TR_H); if(explode) { @@ -54,7 +54,7 @@ void CatapultStone::Draw(DrawPoint drawOffset) DrawPoint drawPos = destPos - drawOffset + worldSize; drawPos.x %= worldSize.x; drawPos.y %= worldSize.y; - LOADER.GetMapTexture(3102 + GAMECLIENT.Interpolate(4, event))->DrawFull(drawPos); + LOADER.getMapTexture(3102 + GAMECLIENT.Interpolate(4, event))->DrawFull(drawPos); } else { // Linear interpolieren zwischen Ausgangs- und Zielpunkt @@ -64,7 +64,7 @@ void CatapultStone::Draw(DrawPoint drawOffset) drawPos.x %= worldSize.x; drawPos.y %= worldSize.y; // Schatten auf linearer Linie zeichnen - LOADER.GetMapTexture(3101)->DrawFull(drawPos, COLOR_SHADOW); + LOADER.getMapTexture(3101)->DrawFull(drawPos, COLOR_SHADOW); Position distance = destPos - startPos; double whole = std::sqrt(double(distance.x * distance.x + distance.y * distance.y)); @@ -80,7 +80,7 @@ void CatapultStone::Draw(DrawPoint drawOffset) // Stein auf Parabel zeichnen drawPos.y = (drawPos.y + diff) % worldSize.y; - LOADER.GetMapTexture(3100)->DrawFull(drawPos); + LOADER.getMapTexture(3100)->DrawFull(drawPos); } } @@ -90,31 +90,31 @@ void CatapultStone::HandleEvent(const unsigned /*id*/) { // Explodiert --> mich zerstören world->RemoveCatapultStone(this); - GetEvMgr().AddToKillList(this); + getEvMgr().AddToKillList(this); } else { // Stein ist aufgeschlagen --> Explodierevent anmelden - event = GetEvMgr().AddEvent(this, 10); + event = getEvMgr().AddEvent(this, 10); explode = true; // Trifft der Stein? if(dest_building == dest_map) { // Steht an der Stelle noch ein Militärgebäude zum Bombardieren? - auto* milBld = world->GetSpecObj(dest_building); + auto* milBld = world->getSpecObj(dest_building); if(milBld) { milBld->HitOfCatapultStone(); // If there are no troops left, destroy it - if(milBld->GetNumTroops() == 0) - world->DestroyNO(milBld->GetPos()); + if(milBld->getNumTroops() == 0) + world->DestroyNO(milBld->getPos()); } } else { // Trifft nicht // ggf. Leiche hinlegen, falls da nix ist - if(!world->GetSpecObj(dest_map)) - world->SetNO(dest_map, new noEnvObject(dest_map, 502 + RANDOM_RAND(2))); + if(!world->getSpecObj(dest_map)) + world->setNO(dest_map, new noEnvObject(dest_map, 502 + RANDOM_RAND(2))); } } } diff --git a/libs/s25main/CatapultStone.h b/libs/s25main/CatapultStone.h index e97ce2c445..ba49b51026 100644 --- a/libs/s25main/CatapultStone.h +++ b/libs/s25main/CatapultStone.h @@ -45,5 +45,5 @@ class CatapultStone : public GameObject /// Event-Handler void HandleEvent(unsigned id) override; - GO_Type GetGOT() const final { return GO_Type::Catapultstone; } + GO_Type getGOT() const final { return GO_Type::Catapultstone; } }; diff --git a/libs/s25main/Cheats.cpp b/libs/s25main/Cheats.cpp index a80c7dd502..2a5a61cfbd 100644 --- a/libs/s25main/Cheats.cpp +++ b/libs/s25main/Cheats.cpp @@ -16,7 +16,7 @@ Cheats::Cheats(GameWorldBase& world, GameCommandFactory& gcFactory) : world_(wor bool Cheats::areCheatsAllowed() const { - return world_.IsSinglePlayer(); + return world_.isSinglePlayer(); } void Cheats::toggleCheatMode() @@ -38,7 +38,7 @@ void Cheats::toggleAllVisible() // In S2, the minimap is not updated immediately. // In RTTR, the minimap would become messed up if it wasn't updated here. - if(GameInterface* gi = world_.GetGameInterface()) + if(GameInterface* gi = world_.getGameInterface()) gi->GI_UpdateMapVisibility(); } } @@ -68,8 +68,8 @@ bool Cheats::canPlaceCheatBuilding(const MapPoint& mp) const // It seems that in the original game you can only build headquarters in unoccupied territory at least 2 nodes // away from any border markers and that it doesn't need more bq than a hut. - const MapNode& node = world_.GetNode(mp); - return !node.owner && !world_.IsAnyNeighborOwned(mp) && node.bq >= BuildingQuality::Hut; + const MapNode& node = world_.getNode(mp); + return !node.owner && !world_.isAnyNeighborOwned(mp) && node.bq >= BuildingQuality::Hut; } void Cheats::placeCheatBuilding(const MapPoint& mp, const GamePlayer& player) @@ -79,13 +79,13 @@ void Cheats::placeCheatBuilding(const MapPoint& mp, const GamePlayer& player) world_.DestroyNO(mp, false); // if CanPlaceCheatBuilding is true then this must be safe to destroy auto* hq = - BuildingFactory::CreateBuilding(world_, BuildingType::Headquarters, mp, player.GetPlayerId(), player.nation); - checkedCast(hq)->SetIsTent(player.IsHQTent()); + BuildingFactory::CreateBuilding(world_, BuildingType::Headquarters, mp, player.getPlayerId(), player.nation); + checkedCast(hq)->setIsTent(player.isHQTent()); } void Cheats::toggleHumanAIPlayer() { - if(isCheatModeOn() && !GAMECLIENT.IsReplayModeOn()) + if(isCheatModeOn() && !GAMECLIENT.isReplayModeOn()) { GAMECLIENT.ToggleHumanAIPlayer(AI::Info{AI::Type::Default, AI::Level::Easy}); isHumanAIPlayer_ = !isHumanAIPlayer_; @@ -119,9 +119,9 @@ void Cheats::destroyBuildings(const PlayerIDSet& playerIds) if(!isCheatModeOn()) return; - RTTR_FOREACH_PT(MapPoint, world_.GetSize()) + RTTR_FOREACH_PT(MapPoint, world_.getSize()) { - if(world_.GetNO(pt)->GetType() == NodalObjectType::Building && playerIds.count(world_.GetNode(pt).owner - 1)) + if(world_.getNO(pt)->getType() == NodalObjectType::Building && playerIds.count(world_.getNode(pt).owner - 1)) world_.DestroyNO(pt); } } @@ -132,9 +132,9 @@ void Cheats::destroyAllAIBuildings() return; PlayerIDSet ais; - for(auto i = 0u; i < world_.GetNumPlayers(); ++i) + for(auto i = 0u; i < world_.getNumPlayers(); ++i) { - if(!world_.GetPlayer(i).isHuman()) + if(!world_.getPlayer(i).isHuman()) ais.insert(i); } destroyBuildings(ais); diff --git a/libs/s25main/Debug.cpp b/libs/s25main/Debug.cpp index de0268b96c..ee3b28b8a5 100644 --- a/libs/s25main/Debug.cpp +++ b/libs/s25main/Debug.cpp @@ -170,10 +170,10 @@ DebugInfo::DebugInfo() // Bits SendUnsigned(sizeof(void*) * 8u); - SendString(rttr::version::GetVersion()); - SendString(rttr::version::GetRevision()); + SendString(rttr::version::getVersion()); + SendString(rttr::version::getRevision()); - SendUnsigned(GAMECLIENT.GetGFNumber()); + SendUnsigned(GAMECLIENT.getGFNumber()); } DebugInfo::~DebugInfo() @@ -182,7 +182,7 @@ DebugInfo::~DebugInfo() sock.Close(); } -DebugInfo::stacktrace_t DebugInfo::GetStackTrace(void* ctx) noexcept(false) +DebugInfo::stacktrace_t DebugInfo::getStackTrace(void* ctx) noexcept(false) { #ifndef RTTR_CONTEXT_PTR_TYPE using RTTR_CONTEXT_PTR_TYPE = void*; @@ -275,13 +275,13 @@ bool DebugInfo::SendReplay() LOG.write("Sending replay...\n"); // Replay mode is on, no recording of replays active - if(!GAMECLIENT.IsReplayModeOn()) + if(!GAMECLIENT.isReplayModeOn()) { - Replay* rpl = GAMECLIENT.GetReplay(); + Replay* rpl = GAMECLIENT.getReplay(); - if(!rpl || !rpl->IsRecording()) + if(!rpl || !rpl->isRecording()) return true; - const auto replayPath = rpl->GetPath(); + const auto replayPath = rpl->getPath(); rpl->Close(); BinaryFile f; diff --git a/libs/s25main/Debug.h b/libs/s25main/Debug.h index 399c5a08d1..f469f4679c 100644 --- a/libs/s25main/Debug.h +++ b/libs/s25main/Debug.h @@ -21,7 +21,7 @@ class DebugInfo DebugInfo(); ~DebugInfo(); - static stacktrace_t GetStackTrace(void* ctx = nullptr) noexcept(false); + static stacktrace_t getStackTrace(void* ctx = nullptr) noexcept(false); bool Send(const void* buffer, size_t length); bool SendSigned(int32_t i); diff --git a/libs/s25main/EconomyModeHandler.cpp b/libs/s25main/EconomyModeHandler.cpp index d6b554ecdb..531af61ed0 100644 --- a/libs/s25main/EconomyModeHandler.cpp +++ b/libs/s25main/EconomyModeHandler.cpp @@ -62,7 +62,7 @@ EconomyModeHandler::EconomyModeHandler(unsigned endFrame) : endFrame(endFrame), // Schedule end game event and trust the event manager to keep track of it if(!isInfinite()) - GetEvMgr().AddEvent(this, endFrame); + getEvMgr().AddEvent(this, endFrame); // Find and set up Teams and trackers DetermineTeams(); @@ -70,7 +70,7 @@ EconomyModeHandler::EconomyModeHandler(unsigned endFrame) : endFrame(endFrame), maxAmountsATeamCollected.resize(goodsToCollect.size()); // Send Mission Goal - for(unsigned p = 0; p < world->GetNumPlayers(); ++p) + for(unsigned p = 0; p < world->getNumPlayers(); ++p) { std::string goalText = _("Economy Mode: Collect as much as you can of the following good types: "); for(unsigned i = 0; i < numGoodTypesToCollect; i++) @@ -83,7 +83,7 @@ EconomyModeHandler::EconomyModeHandler(unsigned endFrame) : endFrame(endFrame), goalText += _("Tools in the hands of workers are also counted. So are weapons, and beer, that soldiers have in " "use. For an updating tally of the collected goods see the economic progress window."); - world->GetPostMgr().SetMissionGoal(p, goalText); + world->getPostMgr().setMissionGoal(p, goalText); } } @@ -122,9 +122,9 @@ void EconomyModeHandler::Serialize(SerializedGameData& sgd) const void EconomyModeHandler::DetermineTeams() { RTTR_Assert(economyModeTeams.empty()); - for(unsigned i = 0; i < world->GetNumPlayers(); ++i) + for(unsigned i = 0; i < world->getNumPlayers(); ++i) { - if(world->GetPlayer(i).isUsed()) + if(world->getPlayer(i).isUsed()) { bool foundTeam = false; for(const auto& team : economyModeTeams) @@ -137,12 +137,12 @@ void EconomyModeHandler::DetermineTeams() } if(!foundTeam) { - const GamePlayer& player = world->GetPlayer(i); + const GamePlayer& player = world->getPlayer(i); std::bitset newTeam; newTeam.set(i); - for(unsigned j = i + 1; j < world->GetNumPlayers(); ++j) + for(unsigned j = i + 1; j < world->getNumPlayers(); ++j) { - if(world->GetPlayer(j).isUsed() && player.IsAlly(j)) + if(world->getPlayer(j).isUsed() && player.isAlly(j)) { newTeam.set(j); } @@ -181,16 +181,16 @@ unsigned EconomyModeHandler::SumUpGood(GoodType good, const Inventory& Inventory void EconomyModeHandler::UpdateAmounts() { // Return if the game is over or we already updated the amounts this game frame - if(isOver() || gfLastUpdated == GetEvMgr().GetCurrentGF()) + if(isOver() || gfLastUpdated == getEvMgr().getCurrentGF()) { return; } // Sum up goods - for(unsigned i = 0; i < world->GetNumPlayers(); ++i) + for(unsigned i = 0; i < world->getNumPlayers(); ++i) { - const GamePlayer& player = world->GetPlayer(i); - Inventory playerInventory = player.GetInventory(); + const GamePlayer& player = world->getPlayer(i); + Inventory playerInventory = player.getInventory(); for(unsigned g = 0; g < goodsToCollect.size(); g++) { amountsThePlayersCollected[g][i] = SumUpGood(goodsToCollect[g], playerInventory); @@ -202,13 +202,13 @@ void EconomyModeHandler::UpdateAmounts() for(auto& team : economyModeTeams) { std::fill(team.amountsTheTeamCollected.begin(), team.amountsTheTeamCollected.end(), 0); - for(unsigned i = 0; i < world->GetNumPlayers(); ++i) + for(unsigned i = 0; i < world->getNumPlayers(); ++i) { if(team.containsPlayer(i)) { for(unsigned g = 0; g < goodsToCollect.size(); g++) { - team.amountsTheTeamCollected[g] += GetAmount(g, i); + team.amountsTheTeamCollected[g] += getAmount(g, i); if(team.amountsTheTeamCollected[g] > maxAmountsATeamCollected[g]) { maxAmountsATeamCollected[g] = team.amountsTheTeamCollected[g]; @@ -235,7 +235,7 @@ void EconomyModeHandler::UpdateAmounts() } } - gfLastUpdated = GetEvMgr().GetCurrentGF(); + gfLastUpdated = getEvMgr().getCurrentGF(); } void EconomyModeHandler::HandleEvent(const unsigned) @@ -262,24 +262,24 @@ void EconomyModeHandler::HandleEvent(const unsigned) // Let players know who won if(bestMask.count() > 1) - world->GetGameInterface()->GI_TeamWinner(bestMask.to_ulong()); + world->getGameInterface()->GI_TeamWinner(bestMask.to_ulong()); else - for(unsigned i = 0; i < world->GetNumPlayers(); ++i) + for(unsigned i = 0; i < world->getNumPlayers(); ++i) { if(bestMask[i]) { - world->GetGameInterface()->GI_Winner(i); + world->getGameInterface()->GI_Winner(i); } } world->MakeWholeMapVisibleForAllPlayers(); - world->GetGameInterface()->GI_UpdateMapVisibility(); + world->getGameInterface()->GI_UpdateMapVisibility(); } bool EconomyModeHandler::isOver() const { - return world->GetGGS().objective == GameObjective::EconomyMode && !isInfinite() - && endFrame < GetEvMgr().GetCurrentGF(); + return world->getGGS().objective == GameObjective::EconomyMode && !isInfinite() + && endFrame < getEvMgr().getCurrentGF(); } EconomyModeHandler::EconTeam::EconTeam(SerializedGameData& sgd, unsigned numGoodTypesToCollect) diff --git a/libs/s25main/EconomyModeHandler.h b/libs/s25main/EconomyModeHandler.h index ae41f575a7..6d080329f8 100644 --- a/libs/s25main/EconomyModeHandler.h +++ b/libs/s25main/EconomyModeHandler.h @@ -81,27 +81,27 @@ class EconomyModeHandler : public GameObject void HandleEvent(unsigned id) override; /// Return vector of the teams (and their collected amounts) - const std::vector& GetTeams() const { return economyModeTeams; } + const std::vector& getTeams() const { return economyModeTeams; } /// Method to update the ware trackers void UpdateAmounts(); /// Get the amounts collected by a player - unsigned GetAmount(unsigned goodNumber, unsigned playerId) const + unsigned getAmount(unsigned goodNumber, unsigned playerId) const { return amountsThePlayersCollected[goodNumber][playerId]; } /// Get the amount of good the leading team (with regards to that good) has collected - unsigned GetMaxTeamAmount(unsigned goodNumber) const { return maxAmountsATeamCollected[goodNumber]; } + unsigned getMaxTeamAmount(unsigned goodNumber) const { return maxAmountsATeamCollected[goodNumber]; } /// Get Game frame in which the economy mode winners will be determined - unsigned GetEndFrame() const { return endFrame; } + unsigned getEndFrame() const { return endFrame; } /// Return the good types to collect - const std::vector& GetGoodTypesToCollect() const { return goodsToCollect; } + const std::vector& getGoodTypesToCollect() const { return goodsToCollect; } - GO_Type GetGOT() const final { return GO_Type::Economymodehandler; } + GO_Type getGOT() const final { return GO_Type::Economymodehandler; } /// Miscellaneous status checks bool isOver() const; diff --git a/libs/s25main/EventManager.cpp b/libs/s25main/EventManager.cpp index a4868bb211..5c06bd51ff 100644 --- a/libs/s25main/EventManager.cpp +++ b/libs/s25main/EventManager.cpp @@ -50,8 +50,8 @@ void EventManager::Clear() const GameEvent* EventManager::AddEventToQueue(const GameEvent* event) { // Should be in the future! - RTTR_Assert(event->GetTargetGF() > currentGF); - events[event->GetTargetGF()].push_back(event); + RTTR_Assert(event->getTargetGF() > currentGF); + events[event->getTargetGF()].push_back(event); ++numActiveEvents; return event; } @@ -61,7 +61,7 @@ const GameEvent* EventManager::AddEvent(GameObject* obj, unsigned gf_length, uns RTTR_Assert(obj); RTTR_Assert(gf_length); - return AddEventToQueue(new GameEvent(GetNextEventInstanceId(), obj, currentGF, gf_length, id)); + return AddEventToQueue(new GameEvent(getNextEventInstanceId(), obj, currentGF, gf_length, id)); } const GameEvent* EventManager::AddEvent(GameObject* obj, unsigned gf_length, unsigned id, unsigned gf_elapsed) @@ -69,10 +69,10 @@ const GameEvent* EventManager::AddEvent(GameObject* obj, unsigned gf_length, uns RTTR_Assert(gf_length > gf_elapsed); // Anfang des Events in die Vergangenheit zurückverlegen RTTR_Assert(currentGF >= gf_elapsed); - return AddEventToQueue(new GameEvent(GetNextEventInstanceId(), obj, currentGF - gf_elapsed, gf_length, id)); + return AddEventToQueue(new GameEvent(getNextEventInstanceId(), obj, currentGF - gf_elapsed, gf_length, id)); } -unsigned EventManager::GetNextEventInstanceId() +unsigned EventManager::getNextEventInstanceId() { unsigned result = eventInstanceCtr++; // Overflow detection. Highly unlikely @@ -104,7 +104,7 @@ void EventManager::DestroyCurrentObjects() killList.clear(); } -std::vector EventManager::GetEvents() const +std::vector EventManager::getEvents() const { std::vector nextEv; for(const auto& event : events) @@ -135,7 +135,7 @@ void EventManager::ExecuteEvents(const EventMap::iterator& itEvents) { const GameEvent* ev = *e_it; RTTR_Assert(ev->obj); - RTTR_Assert(ev->obj->GetObjId() <= GameObject::GetObjIDCounter()); + RTTR_Assert(ev->obj->getObjId() <= GameObject::getObjIDCounter()); curActiveEvent = ev; ev->obj->HandleEvent(ev->id); @@ -153,7 +153,7 @@ void EventManager::Serialize(SerializedGameData& sgd) const RTTR_Assert(killList.empty()); // Gather all events in the correct order - std::vector saveEvents = GetEvents(); + std::vector saveEvents = getEvents(); if(saveEvents.size() != numActiveEvents) { boost::format eventCtError(_("Event count mismatch. Found events: %1%. Expected: %2%.\n")); @@ -187,10 +187,10 @@ void EventManager::Deserialize(SerializedGameData& sgd) { for(const GameEvent* ev : it.second) { - if(ev->GetInstanceId() >= eventInstanceCtr) + if(ev->getInstanceId() >= eventInstanceCtr) { boost::format eventIdError(_("Invalid event instance id. Found: %1%. Expected less than %2%.\n")); - throw SerializedGameData::Error((eventIdError % ev->GetInstanceId() % eventInstanceCtr).str()); + throw SerializedGameData::Error((eventIdError % ev->getInstanceId() % eventInstanceCtr).str()); } } } @@ -209,7 +209,7 @@ bool EventManager::ObjectHasEvents(const GameObject& obj) return false; } -bool EventManager::IsObjectInKillList(const GameObject& obj) +bool EventManager::isObjectInKillList(const GameObject& obj) { return helpers::contains(killList, &obj); } @@ -233,7 +233,7 @@ void EventManager::RemoveEvent(const GameEvent*& ep) void EventManager::RemoveEventFromQueue(const GameEvent& event) { RTTR_Assert(curActiveEvent != &event); - auto itEventsAtTime = events.find(event.GetTargetGF()); + auto itEventsAtTime = events.find(event.getTargetGF()); if(itEventsAtTime != events.end()) { EventList& eventsAtTime = itEventsAtTime->second; @@ -262,7 +262,7 @@ void EventManager::RemoveEventFromQueue(const GameEvent& event) void EventManager::AddToKillList(GameObject* obj) { - RTTR_Assert(!IsObjectInKillList(assertNonNull(obj))); + RTTR_Assert(!isObjectInKillList(assertNonNull(obj))); killList.emplace_back(obj); } diff --git a/libs/s25main/EventManager.h b/libs/s25main/EventManager.h index 4a4982978e..bbf54e6c27 100644 --- a/libs/s25main/EventManager.h +++ b/libs/s25main/EventManager.h @@ -22,8 +22,8 @@ class EventManager /// Deletes all events and objects to be killed. Then resets counters void Clear(); - unsigned GetNumActiveEvents() const { return numActiveEvents; } - unsigned GetEventInstanceCtr() const { return eventInstanceCtr; } + unsigned getNumActiveEvents() const { return numActiveEvents; } + unsigned getEventInstanceCtr() const { return eventInstanceCtr; } /// Increase the GF# and execute all events of that GF void ExecuteNextGF(); @@ -44,14 +44,14 @@ class EventManager void Serialize(SerializedGameData& sgd) const; void Deserialize(SerializedGameData& sgd); - unsigned GetNextEventInstanceId(); + unsigned getNextEventInstanceId(); - unsigned GetCurrentGF() const { return currentGF; } + unsigned getCurrentGF() const { return currentGF; } /// Return true if the object has any active events. SLOW! bool ObjectHasEvents(const GameObject& obj); /// Return true if the object will be destroyed after the current GF - bool IsObjectInKillList(const GameObject& obj); + bool isObjectInKillList(const GameObject& obj); protected: // Use list to allow removing of events while iterating (Event A can cause Event B in the same GF to be removed) @@ -76,5 +76,5 @@ class EventManager /// Destroy all objects in the kill list void DestroyCurrentObjects(); /// Get all events in the order they will be processed - std::vector GetEvents() const; + std::vector getEvents() const; }; diff --git a/libs/s25main/FOWObjects.cpp b/libs/s25main/FOWObjects.cpp index dc4b4121c1..455dd034ba 100644 --- a/libs/s25main/FOWObjects.cpp +++ b/libs/s25main/FOWObjects.cpp @@ -40,7 +40,7 @@ void fowBuilding::Serialize(SerializedGameData& sgd) const void fowBuilding::Draw(DrawPoint drawPt) const { - noBaseBuilding::GetBuildingImage(type, nation).DrawFull(drawPt, FOW_DRAW_COLOR); + noBaseBuilding::getBuildingImage(type, nation).DrawFull(drawPt, FOW_DRAW_COLOR); } //////////////////////////////////////////////////////////////////////////////////// @@ -69,13 +69,13 @@ void fowBuildingSite::Draw(DrawPoint drawPt) const if(planing) { // Baustellenschild mit Schatten zeichnen - LOADER.GetNationImage(nation, 450)->DrawFull(drawPt, FOW_DRAW_COLOR); - LOADER.GetNationImage(nation, 451)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getNationImage(nation, 450)->DrawFull(drawPt, FOW_DRAW_COLOR); + LOADER.getNationImage(nation, 451)->DrawFull(drawPt, COLOR_SHADOW); } else { // Baustellenstein und -schatten zeichnen - LOADER.GetNationImage(nation, 455)->DrawFull(drawPt, FOW_DRAW_COLOR); - LOADER.GetNationImage(nation, 456)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getNationImage(nation, 455)->DrawFull(drawPt, FOW_DRAW_COLOR); + LOADER.getNationImage(nation, 456)->DrawFull(drawPt, COLOR_SHADOW); // bis dahin gebautes Haus zeichnen @@ -144,12 +144,12 @@ void fowTree::Draw(DrawPoint drawPt) const if(size == 3) { // Ausgewachsen - LOADER.GetMapTexture(200 + type * 15)->DrawFull(drawPt, FOW_DRAW_COLOR); - LOADER.GetMapTexture(350 + type * 15)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getMapTexture(200 + type * 15)->DrawFull(drawPt, FOW_DRAW_COLOR); + LOADER.getMapTexture(350 + type * 15)->DrawFull(drawPt, COLOR_SHADOW); } else { - LOADER.GetMapTexture(208 + type * 15 + size)->DrawFull(drawPt, FOW_DRAW_COLOR); - LOADER.GetMapTexture(358 + type * 15 + size)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getMapTexture(208 + type * 15 + size)->DrawFull(drawPt, FOW_DRAW_COLOR); + LOADER.getMapTexture(358 + type * 15 + size)->DrawFull(drawPt, COLOR_SHADOW); } } diff --git a/libs/s25main/FOWObjects.h b/libs/s25main/FOWObjects.h index a206f94cce..98675e9027 100644 --- a/libs/s25main/FOWObjects.h +++ b/libs/s25main/FOWObjects.h @@ -31,8 +31,8 @@ class fowBuilding : public FOWObject fowBuilding(SerializedGameData& sgd); void Serialize(SerializedGameData& sgd) const override; void Draw(DrawPoint drawPt) const override; - FoW_Type GetType() const override { return FoW_Type::Building; } - BuildingType GetBuildingType() const { return type; } + FoW_Type getType() const override { return FoW_Type::Building; } + BuildingType getBuildingType() const { return type; } }; /// Baustelle @@ -53,7 +53,7 @@ class fowBuildingSite : public FOWObject fowBuildingSite(SerializedGameData& sgd); void Serialize(SerializedGameData& sgd) const override; void Draw(DrawPoint drawPt) const override; - FoW_Type GetType() const override { return FoW_Type::Buildingsite; } + FoW_Type getType() const override { return FoW_Type::Buildingsite; } }; /// Flagge @@ -70,7 +70,7 @@ class fowFlag : public FOWObject fowFlag(SerializedGameData& sgd); void Serialize(SerializedGameData& sgd) const override; void Draw(DrawPoint drawPt) const override; - FoW_Type GetType() const override { return FoW_Type::Flag; } + FoW_Type getType() const override { return FoW_Type::Flag; } }; /// Baum @@ -87,7 +87,7 @@ class fowTree : public FOWObject fowTree(SerializedGameData& sgd); void Serialize(SerializedGameData& sgd) const override; void Draw(DrawPoint drawPt) const override; - FoW_Type GetType() const override { return FoW_Type::Tree; } + FoW_Type getType() const override { return FoW_Type::Tree; } }; /// Granitblock @@ -102,5 +102,5 @@ class fowGranite : public FOWObject fowGranite(SerializedGameData& sgd); void Serialize(SerializedGameData& sgd) const override; void Draw(DrawPoint drawPt) const override; - FoW_Type GetType() const override { return FoW_Type::Granite; } + FoW_Type getType() const override { return FoW_Type::Granite; } }; diff --git a/libs/s25main/FindWhConditions.cpp b/libs/s25main/FindWhConditions.cpp index babe42733c..002f62904e 100644 --- a/libs/s25main/FindWhConditions.cpp +++ b/libs/s25main/FindWhConditions.cpp @@ -10,15 +10,15 @@ namespace FW { bool HasMinWares::operator()(const nobBaseWarehouse& wh) const { - return wh.GetNumRealWares(type) >= count; + return wh.getNumRealWares(type) >= count; } bool HasFigure::operator()(const nobBaseWarehouse& wh) const { - if(wh.GetNumRealFigures(type) > 0) + if(wh.getNumRealFigures(type) > 0) return true; else if(recruitingAllowed && type != Job::PackDonkey) - return wh.CanRecruit(type); + return wh.canRecruit(type); else return false; } @@ -32,7 +32,7 @@ bool HasAnyMatchingSoldier::operator()(const nobBaseWarehouse& wh) const { for(unsigned i = 0; i < SOLDIER_JOBS.size(); i++) { - if(ranks[i] && wh.GetNumRealFigures(SOLDIER_JOBS[i]) > 0) + if(ranks[i] && wh.getNumRealFigures(SOLDIER_JOBS[i]) > 0) return true; } return false; @@ -43,7 +43,7 @@ bool AcceptsWare::operator()(const nobBaseWarehouse& wh) const // Einlagern darf nicht verboten sein // Schilder beachten! const GoodType good = ConvertShields(type); - return !wh.GetInventorySetting(good).IsSet(EInventorySetting::Stop); + return !wh.getInventorySetting(good).isSet(EInventorySetting::Stop); } bool AcceptsFigure::operator()(const nobBaseWarehouse& wh) const @@ -53,7 +53,7 @@ bool AcceptsFigure::operator()(const nobBaseWarehouse& wh) const if(job == Job::BoatCarrier) job = Job::Helper; - return !wh.GetInventorySetting(job).IsSet(EInventorySetting::Stop); + return !wh.getInventorySetting(job).isSet(EInventorySetting::Stop); } bool CollectsWare::operator()(const nobBaseWarehouse& wh) const @@ -61,7 +61,7 @@ bool CollectsWare::operator()(const nobBaseWarehouse& wh) const // Einlagern muss gewollt sein // Schilder beachten! GoodType gt = ConvertShields(type); - return (wh.GetInventorySetting(gt).IsSet(EInventorySetting::Collect)); + return (wh.getInventorySetting(gt).isSet(EInventorySetting::Collect)); } bool CollectsFigure::operator()(const nobBaseWarehouse& wh) const @@ -70,7 +70,7 @@ bool CollectsFigure::operator()(const nobBaseWarehouse& wh) const Job job = type; if(job == Job::BoatCarrier) job = Job::Helper; - return (wh.GetInventorySetting(job).IsSet(EInventorySetting::Collect)); + return (wh.getInventorySetting(job).isSet(EInventorySetting::Collect)); } bool HasWareButNoCollect::operator()(const nobBaseWarehouse& wh) const @@ -86,7 +86,7 @@ bool HasFigureButNoCollect::operator()(const nobBaseWarehouse& wh) const bool AcceptsWareButNoSend::operator()(const nobBaseWarehouse& wh) const { const GoodType good = ConvertShields(type); - return AcceptsWare::operator()(wh) && !wh.GetInventorySetting(good).IsSet(EInventorySetting::Send); + return AcceptsWare::operator()(wh) && !wh.getInventorySetting(good).isSet(EInventorySetting::Send); } bool AcceptsFigureButNoSend::operator()(const nobBaseWarehouse& wh) const @@ -95,7 +95,7 @@ bool AcceptsFigureButNoSend::operator()(const nobBaseWarehouse& wh) const if(job == Job::BoatCarrier) job = Job::Helper; - return AcceptsFigure::operator()(wh) && !wh.GetInventorySetting(job).IsSet(EInventorySetting::Send); + return AcceptsFigure::operator()(wh) && !wh.getInventorySetting(job).isSet(EInventorySetting::Send); } } // namespace FW diff --git a/libs/s25main/FoWObject.h b/libs/s25main/FoWObject.h index 9434802a5a..f9ab166241 100644 --- a/libs/s25main/FoWObject.h +++ b/libs/s25main/FoWObject.h @@ -31,5 +31,5 @@ class FOWObject virtual ~FOWObject() = default; virtual void Draw(DrawPoint drawPt) const = 0; virtual void Serialize(SerializedGameData& sgd) const = 0; - virtual FoW_Type GetType() const = 0; + virtual FoW_Type getType() const = 0; }; diff --git a/libs/s25main/Game.cpp b/libs/s25main/Game.cpp index d855f8ed80..77994b8243 100644 --- a/libs/s25main/Game.cpp +++ b/libs/s25main/Game.cpp @@ -42,8 +42,8 @@ void Game::Start(bool startFromSave) } StatisticStep(); } - if(world_.HasLua()) - world_.GetLua().EventStart(!startFromSave); + if(world_.hasLua()) + world_.getLua().EventStart(!startFromSave); } void Game::AddAIPlayer(std::unique_ptr newAI) @@ -51,10 +51,10 @@ void Game::AddAIPlayer(std::unique_ptr newAI) aiPlayers_.push_back(std::move(newAI)); } -void Game::SetLua(std::unique_ptr newLua) +void Game::setLua(std::unique_ptr newLua) { lua = std::move(newLua); - world_.SetLua(lua.get()); + world_.setLua(lua.get()); } namespace { @@ -86,11 +86,11 @@ void Game::RunGF() } } - if(world_.HasLua()) - world_.GetLua().EventGameFrame(em_->GetCurrentGF()); + if(world_.hasLua()) + world_.getLua().EventGameFrame(em_->getCurrentGF()); // Update statistic every 30 seconds constexpr auto GFsIn30s = static_cast(duration_to_gfs(30s)); - if(em_->GetCurrentGF() % GFsIn30s == 0) + if(em_->getCurrentGF() % GFsIn30s == 0) StatisticStep(); // If some players got defeated check objective if(getNumAlivePlayers(world_) < numPlayersAlive) @@ -117,12 +117,12 @@ void Game::CheckObjective() const auto getPlayerMask = [](unsigned playerId) { return 1u << playerId; }; // Find out best player. Since at least 3/4 of the populated land is needed to win, we don't care about ties. - for(unsigned i = 0; i < world_.GetNumPlayers(); ++i) + for(unsigned i = 0; i < world_.getNumPlayers(); ++i) { - const GamePlayer& player = world_.GetPlayer(i); + const GamePlayer& player = world_.getPlayer(i); if(player.IsDefeated()) continue; - const unsigned points = player.GetStatisticCurrentValue(StatisticType::Country); + const unsigned points = player.getStatisticCurrentValue(StatisticType::Country); if(points > maxPoints) { maxPoints = points; @@ -134,14 +134,14 @@ void Game::CheckObjective() unsigned curTeam = getPlayerMask(i); unsigned teamPoints = points; // Add points of all players in this players team (excluding himself) - for(unsigned j = 0; j < world_.GetNumPlayers(); ++j) + for(unsigned j = 0; j < world_.getNumPlayers(); ++j) { - if(i == j || !player.IsAlly(j)) + if(i == j || !player.isAlly(j)) continue; curTeam = curTeam | getPlayerMask(j); - const GamePlayer& teamPlayer = world_.GetPlayer(j); + const GamePlayer& teamPlayer = world_.getPlayer(j); if(!teamPlayer.IsDefeated()) - teamPoints += teamPlayer.GetStatisticCurrentValue(StatisticType::Country); + teamPoints += teamPlayer.getStatisticCurrentValue(StatisticType::Country); } if(teamPoints > maxTeamPoints) { @@ -169,22 +169,22 @@ void Game::CheckObjective() } // We have a winner! - if(world_.GetGameInterface() && finished_) + if(world_.getGameInterface() && finished_) { // If there is a team that is best and it does not only consist of the best player // then it is a team victory, else a single players victory if(bestTeam && *bestTeam != getPlayerMask(bestPlayer)) - world_.GetGameInterface()->GI_TeamWinner(*bestTeam); + world_.getGameInterface()->GI_TeamWinner(*bestTeam); else - world_.GetGameInterface()->GI_Winner(bestPlayer); + world_.getGameInterface()->GI_Winner(bestPlayer); } } -AIPlayer* Game::GetAIPlayer(unsigned id) +AIPlayer* Game::getAIPlayer(unsigned id) { for(AIPlayer& ai : aiPlayers_) { - if(ai.GetPlayerId() == id) + if(ai.getPlayerId() == id) return &ai; } return nullptr; diff --git a/libs/s25main/Game.h b/libs/s25main/Game.h index 45b3c0c954..289ccf838c 100644 --- a/libs/s25main/Game.h +++ b/libs/s25main/Game.h @@ -27,11 +27,11 @@ class Game /// Does the remaining initializations for starting the game void Start(bool startFromSave); void RunGF(); - bool IsStarted() const { return started_; } - bool IsGameFinished() const { return finished_; } - AIPlayer* GetAIPlayer(unsigned id); + bool isStarted() const { return started_; } + bool isGameFinished() const { return finished_; } + AIPlayer* getAIPlayer(unsigned id); void AddAIPlayer(std::unique_ptr newAI); - void SetLua(std::unique_ptr newLua); + void setLua(std::unique_ptr newLua); private: /// Updates the statistics diff --git a/libs/s25main/GameCommands.cpp b/libs/s25main/GameCommands.cpp index 5f16074dee..5e3a39b75e 100644 --- a/libs/s25main/GameCommands.cpp +++ b/libs/s25main/GameCommands.cpp @@ -69,8 +69,8 @@ void DestroyRoad::Serialize(Serializer& ser) const void DestroyRoad::Execute(GameWorld& world, uint8_t playerId) { - auto* flag = world.GetSpecObj(pt_); - if(flag && flag->GetPlayer() == playerId) + auto* flag = world.getSpecObj(pt_); + if(flag && flag->getPlayer() == playerId) flag->DestroyRoad(start_dir); } @@ -86,8 +86,8 @@ void UpgradeRoad::Serialize(Serializer& ser) const void UpgradeRoad::Execute(GameWorld& world, uint8_t playerId) { - auto* flag = world.GetSpecObj(pt_); - if(flag && flag->GetPlayer() == playerId) + auto* flag = world.getSpecObj(pt_); + if(flag && flag->getPlayer() == playerId) flag->UpgradeRoad(start_dir); } @@ -137,7 +137,7 @@ ChangeDistribution::ChangeDistribution(Deserializer& ser) : GameCommand(GCType:: void ChangeDistribution::Execute(GameWorld& world, uint8_t playerId) { - world.GetPlayer(playerId).ChangeDistribution(data); + world.getPlayer(playerId).ChangeDistribution(data); } ChangeBuildOrder::ChangeBuildOrder(Deserializer& ser) @@ -171,7 +171,7 @@ ChangeBuildOrder::ChangeBuildOrder(Deserializer& ser) void ChangeBuildOrder::Execute(GameWorld& world, uint8_t playerId) { - world.GetPlayer(playerId).ChangeBuildOrder(useCustomBuildOrder, data); + world.getPlayer(playerId).ChangeBuildOrder(useCustomBuildOrder, data); } void SetBuildingSite::Execute(GameWorld& world, uint8_t playerId) @@ -207,12 +207,12 @@ ChangeTransport::ChangeTransport(Deserializer& ser) : GameCommand(GCType::Change void ChangeTransport::Execute(GameWorld& world, uint8_t playerId) { - world.GetPlayer(playerId).ConvertTransportData(data); + world.getPlayer(playerId).ConvertTransportData(data); } void ChangeMilitary::Execute(GameWorld& world, uint8_t playerId) { - world.GetPlayer(playerId).ChangeMilitarySettings(data); + world.getPlayer(playerId).ChangeMilitarySettings(data); } ChangeTools::ChangeTools(const ToolSettings& data, const int8_t* order_delta) @@ -224,12 +224,12 @@ ChangeTools::ChangeTools(const ToolSettings& data, const int8_t* order_delta) void ChangeTools::Execute(GameWorld& world, uint8_t playerId) { - world.GetPlayer(playerId).ChangeToolsSettings(data, orders); + world.getPlayer(playerId).ChangeToolsSettings(data, orders); } void CallSpecialist::Execute(GameWorld& world, uint8_t playerId) { - world.GetPlayer(playerId).CallFlagWorker(pt_, job); + world.getPlayer(playerId).CallFlagWorker(pt_, job); } void Attack::Execute(GameWorld& world, uint8_t playerId) @@ -244,36 +244,36 @@ void SeaAttack::Execute(GameWorld& world, uint8_t playerId) void SetCoinsAllowed::Execute(GameWorld& world, uint8_t playerId) { - auto* const bld = world.GetSpecObj(pt_); - if(bld && bld->GetPlayer() == playerId) + auto* const bld = world.getSpecObj(pt_); + if(bld && bld->getPlayer() == playerId) bld->SetCoinsAllowed(enabled); } void SetArmorAllowed::Execute(GameWorld& world, uint8_t playerId) { - auto* const bld = world.GetSpecObj(pt_); - if(bld && bld->GetPlayer() == playerId) + auto* const bld = world.getSpecObj(pt_); + if(bld && bld->getPlayer() == playerId) bld->SetArmorAllowed(enabled); } void SetTroopLimit::Execute(GameWorld& world, uint8_t playerId) { - auto* const bld = world.GetSpecObj(pt_); - if(bld && bld->GetPlayer() == playerId) + auto* const bld = world.getSpecObj(pt_); + if(bld && bld->getPlayer() == playerId) bld->SetTroopLimit(rank, count); } void SetProductionEnabled::Execute(GameWorld& world, uint8_t playerId) { - auto* const bld = world.GetSpecObj(pt_); - if(bld && bld->GetPlayer() == playerId) + auto* const bld = world.getSpecObj(pt_); + if(bld && bld->getPlayer() == playerId) bld->SetProductionEnabled(enabled); } void SetInventorySetting::Execute(GameWorld& world, uint8_t playerId) { - auto* const bld = world.GetSpecObj(pt_); - if(bld && bld->GetPlayer() == playerId) + auto* const bld = world.getSpecObj(pt_); + if(bld && bld->getPlayer() == playerId) bld->SetInventorySetting(what, state); } @@ -324,21 +324,21 @@ SetAllInventorySettings::SetAllInventorySettings(Deserializer& ser) void SetAllInventorySettings::Execute(GameWorld& world, uint8_t playerId) { - auto* const bld = world.GetSpecObj(pt_); - if(bld && bld->GetPlayer() == playerId) + auto* const bld = world.getSpecObj(pt_); + if(bld && bld->getPlayer() == playerId) bld->SetAllInventorySettings(isJob, states); } void ChangeReserve::Execute(GameWorld& world, uint8_t playerId) { - auto* const bld = world.GetSpecObj(pt_); - if(bld && bld->GetPlayer() == playerId) - bld->SetRealReserve(rank, count); + auto* const bld = world.getSpecObj(pt_); + if(bld && bld->getPlayer() == playerId) + bld->setRealReserve(rank, count); } void Surrender::Execute(GameWorld& world, uint8_t playerId) { - world.GetPlayer(playerId).Surrender(); + world.getPlayer(playerId).Surrender(); } void CheatArmageddon::Execute(GameWorld& world, unsigned char /*playerId*/) @@ -353,42 +353,42 @@ void DestroyAll::Execute(GameWorld& world, uint8_t playerId) void SuggestPact::Execute(GameWorld& world, uint8_t playerId) { - world.GetPlayer(playerId).SuggestPact(targetPlayer, pt, duration); + world.getPlayer(playerId).SuggestPact(targetPlayer, pt, duration); } void AcceptPact::Execute(GameWorld& world, uint8_t playerId) { - world.GetPlayer(fromPlayer).AcceptPact(id, pt, playerId); + world.getPlayer(fromPlayer).AcceptPact(id, pt, playerId); } void CancelPact::Execute(GameWorld& world, uint8_t playerId) { - world.GetPlayer(playerId).CancelPact(pt, otherPlayer); + world.getPlayer(playerId).CancelPact(pt, otherPlayer); } void NotifyAlliesOfLocation::Execute(GameWorld& world, uint8_t playerId) { - world.GetPlayer(playerId).NotifyAlliesOfLocation(pt_); + world.getPlayer(playerId).NotifyAlliesOfLocation(pt_); } void SetShipYardMode::Execute(GameWorld& world, uint8_t playerId) { - auto* const bld = world.GetSpecObj(pt_); - if(bld && bld->GetPlayer() == playerId) - bld->SetMode(buildShips ? nobShipYard::Mode::Ships : nobShipYard::Mode::Boats); + auto* const bld = world.getSpecObj(pt_); + if(bld && bld->getPlayer() == playerId) + bld->setMode(buildShips ? nobShipYard::Mode::Ships : nobShipYard::Mode::Boats); } void SetTempleProductionMode::Execute(GameWorld& world, uint8_t playerId) { - auto* const bld = world.GetSpecObj(pt_); - if(bld && bld->GetPlayer() == playerId) - bld->SetProductionMode(productionMode); + auto* const bld = world.getSpecObj(pt_); + if(bld && bld->getPlayer() == playerId) + bld->setProductionMode(productionMode); } void StartStopExpedition::Execute(GameWorld& world, uint8_t playerId) { - auto* const bld = world.GetSpecObj(pt_); - if(bld && bld->GetPlayer() == playerId) + auto* const bld = world.getSpecObj(pt_); + if(bld && bld->getPlayer() == playerId) { if(start) bld->StartExpedition(); @@ -399,8 +399,8 @@ void StartStopExpedition::Execute(GameWorld& world, uint8_t playerId) void StartStopExplorationExpedition::Execute(GameWorld& world, uint8_t playerId) { - auto* const bld = world.GetSpecObj(pt_); - if(bld && bld->GetPlayer() == playerId) + auto* const bld = world.getSpecObj(pt_); + if(bld && bld->getPlayer() == playerId) { if(start) bld->StartExplorationExpedition(); @@ -411,7 +411,7 @@ void StartStopExplorationExpedition::Execute(GameWorld& world, uint8_t playerId) void ExpeditionCommand::Execute(GameWorld& world, uint8_t playerId) { - noShip* ship = world.GetPlayer(playerId).GetShipByID(this->ship_id); + noShip* ship = world.getPlayer(playerId).getShipByID(this->ship_id); if(!ship) return; @@ -431,9 +431,9 @@ void ExpeditionCommand::Execute(GameWorld& world, uint8_t playerId) /// Fuehrt das GameCommand aus void TradeOverLand::Execute(GameWorld& world, uint8_t playerId) { - auto* const bld = world.GetSpecObj(pt_); + auto* const bld = world.getSpecObj(pt_); if(bld) - world.GetPlayer(playerId).Trade(bld, what, count); + world.getPlayer(playerId).Trade(bld, what, count); } } // namespace gc diff --git a/libs/s25main/GameEvent.h b/libs/s25main/GameEvent.h index e591af7d40..9f399fbe62 100644 --- a/libs/s25main/GameEvent.h +++ b/libs/s25main/GameEvent.h @@ -25,6 +25,6 @@ class GameEvent void Serialize(SerializedGameData& sgd) const; /// Return GF at which this event will be executed - unsigned GetTargetGF() const { return startGF + length; } - unsigned GetInstanceId() const { return instanceId; } + unsigned getTargetGF() const { return startGF + length; } + unsigned getInstanceId() const { return instanceId; } }; diff --git a/libs/s25main/GameLobbyController.cpp b/libs/s25main/GameLobbyController.cpp index d257a6195e..459e5857eb 100644 --- a/libs/s25main/GameLobbyController.cpp +++ b/libs/s25main/GameLobbyController.cpp @@ -15,22 +15,22 @@ GameLobbyController::GameLobbyController(std::shared_ptr lobby, Netwo GameLobbyController::~GameLobbyController() = default; -unsigned GameLobbyController::GetMaxNumPlayers() const +unsigned GameLobbyController::getMaxNumPlayers() const { return lobby->getNumPlayers(); } -JoinPlayerInfo& GameLobbyController::GetJoinPlayer(unsigned playerIdx) +JoinPlayerInfo& GameLobbyController::getJoinPlayer(unsigned playerIdx) { return lobby->getPlayer(playerIdx); } void GameLobbyController::CloseSlot(unsigned playerIdx) { - SetPlayerState(playerIdx, PlayerState::Locked, AI::Info()); + setPlayerState(playerIdx, PlayerState::Locked, AI::Info()); } -void GameLobbyController::SetPlayerState(unsigned playerIdx, PlayerState state, const AI::Info& aiInfo) +void GameLobbyController::setPlayerState(unsigned playerIdx, PlayerState state, const AI::Info& aiInfo) { mainPlayer_.sendMsgAsync(new GameMessage_Player_State(playerIdx, state, aiInfo)); } @@ -69,25 +69,25 @@ void GameLobbyController::TogglePlayerState(unsigned playerIdx) break; case PlayerState::Locked: newPs = PlayerState::Free; break; } - SetPlayerState(playerIdx, newPs, aiInfo); + setPlayerState(playerIdx, newPs, aiInfo); } -void GameLobbyController::SetColor(unsigned playerIdx, unsigned newColor) +void GameLobbyController::setColor(unsigned playerIdx, unsigned newColor) { mainPlayer_.sendMsgAsync(new GameMessage_Player_Color(playerIdx, newColor)); } -void GameLobbyController::SetTeam(unsigned playerIdx, Team newTeam) +void GameLobbyController::setTeam(unsigned playerIdx, Team newTeam) { mainPlayer_.sendMsgAsync(new GameMessage_Player_Team(playerIdx, newTeam)); } -void GameLobbyController::SetNation(unsigned playerIdx, Nation newNation) +void GameLobbyController::setNation(unsigned playerIdx, Nation newNation) { mainPlayer_.sendMsgAsync(new GameMessage_Player_Nation(playerIdx, newNation)); } -const GlobalGameSettings& GameLobbyController::GetGGS() const +const GlobalGameSettings& GameLobbyController::getGGS() const { return lobby->getSettings(); } @@ -109,7 +109,7 @@ void GameLobbyController::StartCountdown(unsigned numSecs) mainPlayer_.sendMsgAsync(new GameMessage_Countdown(numSecs)); } -void GameLobbyController::CancelCountdown() +void GameLobbyController::cancelCountdown() { mainPlayer_.sendMsgAsync(new GameMessage_CancelCountdown()); } @@ -119,12 +119,12 @@ void GameLobbyController::RemoveLuaScript() mainPlayer_.sendMsgAsync(new GameMessage_RemoveLua()); } -void GameLobbyController::SetName(unsigned playerIdx, const std::string& name) +void GameLobbyController::setName(unsigned playerIdx, const std::string& name) { mainPlayer_.sendMsgAsync(new GameMessage_Player_Name(playerIdx, name)); } -void GameLobbyController::SetPortrait(unsigned playerIdx, unsigned portraitIndex) +void GameLobbyController::setPortrait(unsigned playerIdx, unsigned portraitIndex) { mainPlayer_.sendMsgAsync(new GameMessage_Player_Portrait(playerIdx, portraitIndex)); } diff --git a/libs/s25main/GameLobbyController.h b/libs/s25main/GameLobbyController.h index 6081cc06b6..3de8396c28 100644 --- a/libs/s25main/GameLobbyController.h +++ b/libs/s25main/GameLobbyController.h @@ -22,20 +22,20 @@ class GameLobbyController : public IGameLobbyController GameLobbyController(std::shared_ptr lobby, NetworkPlayer& mainPlayer); ~GameLobbyController() override; - unsigned GetMaxNumPlayers() const override; - JoinPlayerInfo& GetJoinPlayer(unsigned playerIdx) override; + unsigned getMaxNumPlayers() const override; + JoinPlayerInfo& getJoinPlayer(unsigned playerIdx) override; void CloseSlot(unsigned playerIdx) override; - void SetPlayerState(unsigned playerIdx, PlayerState state, const AI::Info& aiInfo) override; + void setPlayerState(unsigned playerIdx, PlayerState state, const AI::Info& aiInfo) override; void TogglePlayerState(unsigned playerIdx); - void SetName(unsigned playerIdx, const std::string& name) override; - void SetPortrait(unsigned playerIdx, unsigned portraitIndex) override; - void SetColor(unsigned playerIdx, unsigned newColor) override; - void SetTeam(unsigned playerIdx, Team newTeam) override; - void SetNation(unsigned playerIdx, Nation newNation) override; - const GlobalGameSettings& GetGGS() const override; + void setName(unsigned playerIdx, const std::string& name) override; + void setPortrait(unsigned playerIdx, unsigned portraitIndex) override; + void setColor(unsigned playerIdx, unsigned newColor) override; + void setTeam(unsigned playerIdx, Team newTeam) override; + void setNation(unsigned playerIdx, Nation newNation) override; + const GlobalGameSettings& getGGS() const override; void ChangeGlobalGameSettings(const GlobalGameSettings& ggs) override; void SwapPlayers(unsigned player1, unsigned player2); void StartCountdown(unsigned numSecs); - void CancelCountdown(); + void cancelCountdown(); void RemoveLuaScript(); }; diff --git a/libs/s25main/GameManager.cpp b/libs/s25main/GameManager.cpp index f2ecdffe3f..7290ec0c8e 100644 --- a/libs/s25main/GameManager.cpp +++ b/libs/s25main/GameManager.cpp @@ -54,7 +54,7 @@ bool GameManager::Start() if(!videoDriver_.CreateScreen(screenSize, settings_.video.displayMode)) return false; videoDriver_.setTargetFramerate(settings_.video.framerate); - videoDriver_.SetMouseWarping(settings_.global.smartCursor); + videoDriver_.setMouseWarping(settings_.global.smartCursor); videoDriver_.setGuiScalePercent(settings_.video.guiScale); /// Audiodriver laden @@ -65,8 +65,8 @@ bool GameManager::Start() } /// Lautstärken gleich mit setzen - audioDriver_.SetMasterEffectVolume(settings_.sound.effectsVolume); //-V807 - audioDriver_.SetMusicVolume(settings_.sound.musicVolume); + audioDriver_.setMasterEffectVolume(settings_.sound.effectsVolume); //-V807 + audioDriver_.setMusicVolume(settings_.sound.musicVolume); // Treibereinstellungen abspeichern settings_.Save(); @@ -109,8 +109,8 @@ bool GameManager::Run() if(targetSkipGF) { // if we skip drawing write a comment every 5k gf - unsigned current_time = videoDriver_.GetTickCount(); - const unsigned curGF = GAMECLIENT.GetGFNumber(); + unsigned current_time = videoDriver_.getTickCount(); + const unsigned curGF = GAMECLIENT.getGFNumber(); if(targetSkipGF > curGF) { if(curGF % 5000 == 0) diff --git a/libs/s25main/GameManager.h b/libs/s25main/GameManager.h index 6f95db5bb0..410497fa35 100644 --- a/libs/s25main/GameManager.h +++ b/libs/s25main/GameManager.h @@ -28,9 +28,9 @@ class GameManager /// Average FPS Zähler zurücksetzen. void ResetAverageGFPS(); - FrameCounter::clock::duration GetRuntime() { return gfCounter_.getCurIntervalLength(); } - unsigned GetNumFrames() { return gfCounter_.getCurNumFrames(); } - unsigned GetAverageGFPS() { return gfCounter_.getCurFrameRate(); } + FrameCounter::clock::duration getRuntime() { return gfCounter_.getCurIntervalLength(); } + unsigned getNumFrames() { return gfCounter_.getCurNumFrames(); } + unsigned getAverageGFPS() { return gfCounter_.getCurFrameRate(); } private: bool ShowSplashscreen(); diff --git a/libs/s25main/GameObject.cpp b/libs/s25main/GameObject.cpp index b504868aab..fe14f35ab0 100644 --- a/libs/s25main/GameObject.cpp +++ b/libs/s25main/GameObject.cpp @@ -41,19 +41,19 @@ void GameObject::Destroy() {} GameObject::~GameObject() { // RTTR_Assert(!world || !GetEvMgr().ObjectHasEvents(*this)); - RTTR_Assert(!world || !GetEvMgr().IsObjectInKillList(*this)); + RTTR_Assert(!world || !getEvMgr().isObjectInKillList(*this)); // ein Objekt weniger --objCounter_; } -EventManager& GameObject::GetEvMgr() +EventManager& GameObject::getEvMgr() { - return world->GetEvMgr(); + return world->getEvMgr(); } void GameObject::SendPostMessage(unsigned player, std::unique_ptr msg) { - world->GetPostMgr().SendMsg(player, std::move(msg)); + world->getPostMgr().SendMsg(player, std::move(msg)); } void GameObject::DetachWorld(GameWorld* gameWorld) diff --git a/libs/s25main/GameObject.h b/libs/s25main/GameObject.h index 6ff454e919..c00355085d 100644 --- a/libs/s25main/GameObject.h +++ b/libs/s25main/GameObject.h @@ -37,16 +37,16 @@ class GameObject virtual void HandleEvent(unsigned /*id*/) {} /// Return the unique ID of an object. Always non-zero! - unsigned GetObjId() const { return objId; } + unsigned getObjId() const { return objId; } virtual void Serialize(SerializedGameData& sgd) const = 0; - virtual GO_Type GetGOT() const = 0; + virtual GO_Type getGOT() const = 0; virtual std::string ToString() const; protected: // Following are some "sandbox methods". They avoid dependencies of subclasses to commonly used functions - static EventManager& GetEvMgr(); + static EventManager& getEvMgr(); /// Send the msg to given player static void SendPostMessage(unsigned player, std::unique_ptr msg); @@ -60,9 +60,9 @@ class GameObject /// Remove the world from all game objects static void DetachWorld(GameWorld* gameWorld); /// Return the number of objects alive - static unsigned GetNumObjs() { return objCounter_; } + static unsigned getNumObjs() { return objCounter_; } /// Return ID counter, i.e. the last object ID used - static unsigned GetObjIDCounter() { return objIdCounter_; } + static unsigned getObjIDCounter() { return objIdCounter_; } /// Reset the object counter and the object ID counter to 0 static void ResetCounters() { diff --git a/libs/s25main/GamePlayer.cpp b/libs/s25main/GamePlayer.cpp index 9e730ced91..2df2df620d 100644 --- a/libs/s25main/GamePlayer.cpp +++ b/libs/s25main/GamePlayer.cpp @@ -57,7 +57,7 @@ GamePlayer::GamePlayer(unsigned playerId, const PlayerInfo& playerInfo, GameWorl LoadStandardDistribution(); useCustomBuildOrder_ = false; - build_order = GetStandardBuildOrder(); + build_order = getStandardBuildOrder(); transportPrio = STD_TRANSPORT_PRIO; LoadStandardMilitarySettings(); LoadStandardToolSettings(); @@ -109,7 +109,7 @@ void GamePlayer::LoadStandardMilitarySettings() militarySettings_[7] = MILITARY_SETTINGS_SCALE[7]; } -BuildOrders GamePlayer::GetStandardBuildOrder() +BuildOrders GamePlayer::getStandardBuildOrder() { BuildOrders ordering; @@ -117,7 +117,7 @@ BuildOrders GamePlayer::GetStandardBuildOrder() unsigned curPrio = 0; for(const auto bld : helpers::enumRange()) { - if(bld == BuildingType::Headquarters || !BuildingProperties::IsValid(bld)) + if(bld == BuildingType::Headquarters || !BuildingProperties::isValid(bld)) continue; RTTR_Assert(curPrio < ordering.size()); @@ -255,7 +255,7 @@ void GamePlayer::Deserialize(SerializedGameData& sgd) job.workplace = sgd.PopObject(); } - if(sgd.GetGameDataVersion() < 2) + if(sgd.getGameDataVersion() < 2) buildings.Deserialize2(sgd); sgd.PopObjectContainer(ware_list, GO_Type::Ware); @@ -268,20 +268,20 @@ void GamePlayer::Deserialize(SerializedGameData& sgd) for(const auto i : helpers::enumRange()) { - if(sgd.GetGameDataVersion() < 11 && wineaddon::isWineAddonGoodType(i)) + if(sgd.getGameDataVersion() < 11 && wineaddon::isWineAddonGoodType(i)) continue; - if(sgd.GetGameDataVersion() < 12 && leatheraddon::isLeatherAddonGoodType(i)) + if(sgd.getGameDataVersion() < 12 && leatheraddon::isLeatherAddonGoodType(i)) continue; Distribution& dist = distribution[i]; helpers::popContainer(sgd, dist.percent_buildings); // Set standard value otherwise its zero and Slaughterhouse never gets ham // because the ham distribution was not there in earlier versions - if(sgd.GetGameDataVersion() < 12 && i == GoodType::Ham) + if(sgd.getGameDataVersion() < 12 && i == GoodType::Ham) dist.percent_buildings[BuildingType::Slaughterhouse] = 8; - if(sgd.GetGameDataVersion() < 7) + if(sgd.getGameDataVersion() < 7) { dist.client_buildings.resize(sgd.PopUnsignedInt()); helpers::popContainer(sgd, dist.client_buildings, true); @@ -297,20 +297,20 @@ void GamePlayer::Deserialize(SerializedGameData& sgd) useCustomBuildOrder_ = sgd.PopBool(); - if(sgd.GetGameDataVersion() < 12) + if(sgd.getGameDataVersion() < 12) { auto countOfNotAvailableBuildingsInSaveGame = - sgd.GetGameDataVersion() < 11 ? numWineAndLeatherAddonBuildings : numLeatherAddonBuildings; + sgd.getGameDataVersion() < 11 ? numWineAndLeatherAddonBuildings : numLeatherAddonBuildings; std::vector build_order_raw(build_order.size() - countOfNotAvailableBuildingsInSaveGame); helpers::popContainer(sgd, build_order_raw, true); - if(sgd.GetGameDataVersion() < 11) + if(sgd.getGameDataVersion() < 11) { build_order_raw.insert(build_order_raw.end(), {BuildingType::Vineyard, BuildingType::Winery, BuildingType::Temple}); } - if(sgd.GetGameDataVersion() < 12) + if(sgd.getGameDataVersion() < 12) { build_order_raw.insert(build_order_raw.end(), {BuildingType::Skinner, BuildingType::Tannery, BuildingType::LeatherWorks}); @@ -319,7 +319,7 @@ void GamePlayer::Deserialize(SerializedGameData& sgd) std::copy(build_order_raw.begin(), build_order_raw.end(), build_order.begin()); auto countOfNotAvailableGoodsInSaveGame = - sgd.GetGameDataVersion() < 11 ? numWineAndLeatherAddonGoods : numLeatherAddonGoods; + sgd.getGameDataVersion() < 11 ? numWineAndLeatherAddonGoods : numLeatherAddonGoods; std::vector transportPrio_raw(transportPrio.size() - countOfNotAvailableGoodsInSaveGame); helpers::popContainer(sgd, transportPrio_raw, true); std::copy(transportPrio_raw.begin(), transportPrio_raw.end(), transportPrio.begin()); @@ -339,17 +339,17 @@ void GamePlayer::Deserialize(SerializedGameData& sgd) helpers::popContainer(sgd, tools_ordered); tools_ordered_delta = {}; - if(sgd.GetGameDataVersion() < 12) + if(sgd.getGameDataVersion() < 12) { auto countOfNotAvailableGoodsInSaveGame = - sgd.GetGameDataVersion() < 11 ? numWineAndLeatherAddonGoods : numLeatherAddonGoods; + sgd.getGameDataVersion() < 11 ? numWineAndLeatherAddonGoods : numLeatherAddonGoods; std::vector global_inventory_good_raw(global_inventory.goods.size() - countOfNotAvailableGoodsInSaveGame); helpers::popContainer(sgd, global_inventory_good_raw, true); std::copy(global_inventory_good_raw.begin(), global_inventory_good_raw.end(), global_inventory.goods.begin()); auto countOfNotAvailableJobsInSaveGame = - sgd.GetGameDataVersion() < 11 ? numWineAndLeatherAddonJobs : numLeatherAddonJobs; + sgd.getGameDataVersion() < 11 ? numWineAndLeatherAddonJobs : numLeatherAddonJobs; std::vector global_inventory_people_raw(global_inventory.people.size() - countOfNotAvailableJobsInSaveGame); helpers::popContainer(sgd, global_inventory_people_raw, true); @@ -402,13 +402,13 @@ nobBaseWarehouse* GamePlayer::FindWarehouse(const noRoadNode& start, const T_IsW unsigned best_length = std::numeric_limits::max(); - for(nobBaseWarehouse* wh : buildings.GetStorehouses()) + for(nobBaseWarehouse* wh : buildings.getStorehouses()) { // Lagerhaus geeignet? if(!isWarehouseGood(assertNonNull(wh))) continue; - if(start.GetPos() == wh->GetPos()) + if(start.getPos() == wh->getPos()) { // We are already there -> Take it if(length) @@ -418,12 +418,12 @@ nobBaseWarehouse* GamePlayer::FindWarehouse(const noRoadNode& start, const T_IsW // now check if there is at least a chance that the next wh is closer than current best because pathfinding // takes time - if(world.CalcDistance(start.GetPos(), wh->GetPos()) > best_length) + if(world.CalcDistance(start.getPos(), wh->getPos()) > best_length) continue; // Bei der erlaubten Benutzung von Bootsstraßen Waren-Pathfinding benutzen wenns zu nem Lagerhaus gehn soll // start <-> ziel tauschen bei der wegfindung unsigned tlength; - if(world.GetRoadPathFinder().FindPath(to_wh ? start : *wh, to_wh ? *wh : start, use_boat_roads, best_length, + if(world.getRoadPathFinder().FindPath(to_wh ? start : *wh, to_wh ? *wh : start, use_boat_roads, best_length, forbidden, &tlength)) { if(tlength < best_length || !best) @@ -442,32 +442,32 @@ nobBaseWarehouse* GamePlayer::FindWarehouse(const noRoadNode& start, const T_IsW void GamePlayer::AddBuildingSite(noBuildingSite* bldSite) { - RTTR_Assert(bldSite->GetPlayer() == GetPlayerId()); + RTTR_Assert(bldSite->getPlayer() == getPlayerId()); buildings.Add(bldSite); } void GamePlayer::RemoveBuildingSite(noBuildingSite* bldSite) { - RTTR_Assert(bldSite->GetPlayer() == GetPlayerId()); + RTTR_Assert(bldSite->getPlayer() == getPlayerId()); buildings.Remove(bldSite); } -bool GamePlayer::IsHQTent() const +bool GamePlayer::isHQTent() const { - if(const nobHQ* hq = GetHQ()) - return hq->IsTent(); + if(const nobHQ* hq = getHQ()) + return hq->isTent(); return false; } -void GamePlayer::SetHQIsTent(bool isTent) +void GamePlayer::setHQIsTent(bool isTent) { - if(nobHQ* hq = GetHQ()) - hq->SetIsTent(isTent); + if(nobHQ* hq = getHQ()) + hq->setIsTent(isTent); } void GamePlayer::AddBuilding(noBuilding* bld, BuildingType bldType) { - RTTR_Assert(bld->GetPlayer() == GetPlayerId()); + RTTR_Assert(bld->getPlayer() == getPlayerId()); buildings.Add(bld, bldType); ChangeStatisticValue(StatisticType::Buildings, 1); @@ -487,38 +487,38 @@ void GamePlayer::AddBuilding(noBuilding* bld, BuildingType bldType) { // If there is more than one HQ, keep the original position. if(!hqPos.isValid()) - hqPos = bld->GetPos(); - } else if(BuildingProperties::IsMilitary(bldType)) + hqPos = bld->getPos(); + } else if(BuildingProperties::isMilitary(bldType)) { auto* milBld = static_cast(bld); // New built? -> Calculate frontier distance - if(milBld->IsNewBuilt()) + if(milBld->isNewBuilt()) milBld->LookForEnemyBuildings(); } } void GamePlayer::RemoveBuilding(noBuilding* bld, BuildingType bldType) { - RTTR_Assert(bld->GetPlayer() == GetPlayerId()); + RTTR_Assert(bld->getPlayer() == getPlayerId()); buildings.Remove(bld, bldType); ChangeStatisticValue(StatisticType::Buildings, -1); if(bldType == BuildingType::HarborBuilding) { // Schiffen Bescheid sagen for(noShip* ship : ships) ship->HarborDestroyed(static_cast(bld)); - } else if(bldType == BuildingType::Headquarters && bld->GetPos() == hqPos) + } else if(bldType == BuildingType::Headquarters && bld->getPos() == hqPos) { hqPos = MapPoint::Invalid(); - for(const noBaseBuilding* bld : buildings.GetStorehouses()) + for(const noBaseBuilding* bld : buildings.getStorehouses()) { - if(bld->GetBuildingType() == BuildingType::Headquarters) + if(bld->getBuildingType() == BuildingType::Headquarters) { - hqPos = bld->GetPos(); + hqPos = bld->getPos(); break; } } } - if(BuildingProperties::IsWareHouse(bldType) || BuildingProperties::IsMilitary(bldType)) + if(BuildingProperties::isWareHouse(bldType) || BuildingProperties::isMilitary(bldType)) TestDefeat(); } @@ -546,7 +546,7 @@ void GamePlayer::NewRoadConnection(RoadSegment* rs) // Alle Militärgebäude müssen ihre Truppen überprüfen und können nun ggf. neue bestellen // und müssen prüfen, ob sie evtl Gold bekommen - for(nobMilitary* mil : buildings.GetMilitaryBuildings()) + for(nobMilitary* mil : buildings.getMilitaryBuildings()) { mil->RegulateTroops(); mil->SearchCoins(); @@ -569,9 +569,9 @@ void GamePlayer::FindClientForLostWares() // Alle Lost-Wares müssen gucken, ob sie ein Lagerhaus finden for(Ware* ware : ware_list) { - if(ware->IsLostWare()) + if(ware->isLostWare()) { - if(ware->FindRouteToWarehouse() && ware->IsWaitingAtFlag()) + if(ware->FindRouteToWarehouse() && ware->isWaitingAtFlag()) ware->CallCarrier(); } } @@ -584,29 +584,29 @@ void GamePlayer::RoadDestroyed() for(auto it = ware_list.begin(); it != ware_list.end();) { Ware* ware = *it; - if(ware->IsWaitingAtFlag()) // Liegt die Flagge an einer Flagge, muss ihr Weg neu berechnet werden + if(ware->isWaitingAtFlag()) // Liegt die Flagge an einer Flagge, muss ihr Weg neu berechnet werden { - RoadPathDirection last_next_dir = ware->GetNextDir(); + RoadPathDirection last_next_dir = ware->getNextDir(); ware->RecalcRoute(); // special case: ware was lost some time ago and the new goal is at this flag and not a warehouse,hq,harbor // and the "flip-route" picked so a carrier would pick up the ware carry it away from goal then back and // drop it off at the goal was just destroyed? // -> try to pick another flip route or tell the goal about failure. - noRoadNode& wareLocation = *ware->GetLocation(); - noBaseBuilding* wareGoal = ware->GetGoal(); - if(wareGoal && ware->GetNextDir() == RoadPathDirection::NorthWest - && wareLocation.GetPos() == wareGoal->GetFlagPos() - && ((wareGoal->GetBuildingType() != BuildingType::Storehouse - && wareGoal->GetBuildingType() != BuildingType::Headquarters - && wareGoal->GetBuildingType() != BuildingType::HarborBuilding) - || wareGoal->GetType() == NodalObjectType::Buildingsite)) + noRoadNode& wareLocation = *ware->getLocation(); + noBaseBuilding* wareGoal = ware->getGoal(); + if(wareGoal && ware->getNextDir() == RoadPathDirection::NorthWest + && wareLocation.getPos() == wareGoal->getFlagPos() + && ((wareGoal->getBuildingType() != BuildingType::Storehouse + && wareGoal->getBuildingType() != BuildingType::Headquarters + && wareGoal->getBuildingType() != BuildingType::HarborBuilding) + || wareGoal->getType() == NodalObjectType::Buildingsite)) { Direction newWareDir = Direction::NorthWest; for(auto dir : helpers::EnumRange{}) { dir += 2u; // Need to skip Direction::NorthWest and we used to start with an offset of 2. TODO: // Increase gameDataVersion and just skip NW - if(wareLocation.GetRoute(dir)) + if(wareLocation.getRoute(dir)) { newWareDir = dir; break; @@ -614,7 +614,7 @@ void GamePlayer::RoadDestroyed() } if(newWareDir != Direction::NorthWest) { - ware->SetNextDir(toRoadPathDirection(newWareDir)); + ware->setNextDir(toRoadPathDirection(newWareDir)); } else // no route to goal -> notify goal, try to send ware to a warehouse { ware->NotifyGoalAboutLostWare(); @@ -624,26 +624,26 @@ void GamePlayer::RoadDestroyed() // end of special case // notify carriers/flags about news if there are any - if(ware->GetNextDir() != last_next_dir) + if(ware->getNextDir() != last_next_dir) { // notify current flag that transport in the old direction might not longer be required ware->RemoveWareJobForDir(last_next_dir); - if(ware->GetNextDir() != RoadPathDirection::None) + if(ware->getNextDir() != RoadPathDirection::None) ware->CallCarrier(); } - } else if(ware->IsWaitingInWarehouse()) + } else if(ware->isWaitingInWarehouse()) { - if(!ware->IsRouteToGoal()) + if(!ware->isRouteToGoal()) { // Das Ziel wird nun nich mehr beliefert ware->NotifyGoalAboutLostWare(); // Ware aus der Warteliste des Lagerhauses entfernen - static_cast(ware->GetLocation())->CancelWare(ware); + static_cast(ware->getLocation())->cancelWare(ware); // Ware aus der Liste raus it = ware_list.erase(it); continue; } - } else if(ware->IsWaitingForShip()) + } else if(ware->isWaitingForShip()) { // Weg neu berechnen ware->RecalcRoute(); @@ -653,7 +653,7 @@ void GamePlayer::RoadDestroyed() } // Alle Häfen müssen ihre Figuren den Weg überprüfen lassen - for(nobHarborBuilding* hb : buildings.GetHarbors()) + for(nobHarborBuilding* hb : buildings.getHarbors()) { hb->ExamineShipRouteOfPeople(); } @@ -661,41 +661,41 @@ void GamePlayer::RoadDestroyed() bool GamePlayer::FindCarrierForRoad(RoadSegment& rs) const { - RTTR_Assert(rs.GetF1() != nullptr && rs.GetF2() != nullptr); + RTTR_Assert(rs.getF1() != nullptr && rs.getF2() != nullptr); std::array length; std::array best; // Braucht der ein Boot? - if(rs.GetRoadType() == RoadType::Water) + if(rs.getRoadType() == RoadType::Water) { // dann braucht man Träger UND Boot - best[0] = FindWarehouse(*rs.GetF1(), FW::HasWareAndFigure(GoodType::Boat, Job::Helper, false), false, false, + best[0] = FindWarehouse(*rs.getF1(), FW::HasWareAndFigure(GoodType::Boat, Job::Helper, false), false, false, length.data(), &rs); // 2. Flagge des Weges - best[1] = FindWarehouse(*rs.GetF2(), FW::HasWareAndFigure(GoodType::Boat, Job::Helper, false), false, false, + best[1] = FindWarehouse(*rs.getF2(), FW::HasWareAndFigure(GoodType::Boat, Job::Helper, false), false, false, &length[1], &rs); } else { // 1. Flagge des Weges - best[0] = FindWarehouse(*rs.GetF1(), FW::HasFigure(Job::Helper, false), false, false, length.data(), &rs); + best[0] = FindWarehouse(*rs.getF1(), FW::HasFigure(Job::Helper, false), false, false, length.data(), &rs); // 2. Flagge des Weges - best[1] = FindWarehouse(*rs.GetF2(), FW::HasFigure(Job::Helper, false), false, false, &length[1], &rs); + best[1] = FindWarehouse(*rs.getF2(), FW::HasFigure(Job::Helper, false), false, false, &length[1], &rs); } // überhaupt nen Weg gefunden? // Welche Flagge benutzen? if(best[0] && (!best[1] || length[0] < length[1])) - best[0]->OrderCarrier(*rs.GetF1(), rs); + best[0]->OrderCarrier(*rs.getF1(), rs); else if(best[1]) - best[1]->OrderCarrier(*rs.GetF2(), rs); + best[1]->OrderCarrier(*rs.getF2(), rs); else return false; return true; } -bool GamePlayer::IsWarehouseValid(nobBaseWarehouse* wh) const +bool GamePlayer::isWarehouseValid(nobBaseWarehouse* wh) const { - return helpers::contains(buildings.GetStorehouses(), wh); + return helpers::contains(buildings.getStorehouses(), wh); } void GamePlayer::RecalcDistribution() @@ -764,7 +764,7 @@ void GamePlayer::FindCarrierForAllRoads() void GamePlayer::FindMaterialForBuildingSites() { - for(noBuildingSite* bldSite : buildings.GetBuildingSites()) + for(noBuildingSite* bldSite : buildings.getBuildingSites()) bldSite->OrderConstructionMaterial(); } @@ -803,15 +803,15 @@ void GamePlayer::OneJobNotWanted(const Job job, noRoadNode* workplace) void GamePlayer::SendPostMessage(std::unique_ptr msg) { - world.GetPostMgr().SendMsg(GetPlayerId(), std::move(msg)); + world.getPostMgr().SendMsg(getPlayerId(), std::move(msg)); } -unsigned GamePlayer::GetToolsOrderedVisual(Tool tool) const +unsigned GamePlayer::getToolsOrderedVisual(Tool tool) const { return std::max(0, int(tools_ordered[tool] + tools_ordered_delta[tool])); } -unsigned GamePlayer::GetToolsOrdered(Tool tool) const +unsigned GamePlayer::getToolsOrdered(Tool tool) const { return tools_ordered[tool]; } @@ -820,14 +820,14 @@ bool GamePlayer::ChangeToolOrderVisual(Tool tool, int changeAmount) const { if(std::abs(changeAmount) > 100) return false; - int newOrderAmount = int(GetToolsOrderedVisual(tool)) + changeAmount; + int newOrderAmount = int(getToolsOrderedVisual(tool)) + changeAmount; if(newOrderAmount < 0 || newOrderAmount > 100) return false; tools_ordered_delta[tool] += changeAmount; return true; } -unsigned GamePlayer::GetToolPriority(Tool tool) const +unsigned GamePlayer::getToolPriority(Tool tool) const { return toolsSettings_[tool]; } @@ -837,16 +837,16 @@ void GamePlayer::ToolOrderProcessed(Tool tool) if(tools_ordered[tool]) { --tools_ordered[tool]; - world.GetNotifications().publish(ToolNote(ToolNote::OrderCompleted, GetPlayerId())); + world.getNotifications().publish(ToolNote(ToolNote::OrderCompleted, getPlayerId())); } } bool GamePlayer::FindWarehouseForJob(const Job job, noRoadNode& goal) const { // Optimization: return early if building is isolated - if(goal.GetType() == NodalObjectType::Building || goal.GetType() == NodalObjectType::Buildingsite) + if(goal.getType() == NodalObjectType::Building || goal.getType() == NodalObjectType::Buildingsite) { - if(!static_cast(goal).IsConnected()) + if(!static_cast(goal).isConnected()) return false; } @@ -891,7 +891,7 @@ void GamePlayer::FindWarehouseForAllJobs(const Job job) static bool IsWareFineWithEmergencyProtocol(GoodType goodType, const noBaseBuilding& goal) { return (goodType != GoodType::Boards && goodType != GoodType::Stones) - || goal.GetBuildingType() == BuildingType::Woodcutter || goal.GetBuildingType() == BuildingType::Sawmill; + || goal.getBuildingType() == BuildingType::Woodcutter || goal.getBuildingType() == BuildingType::Sawmill; } Ware* GamePlayer::OrderWare(const GoodType ware, noBaseBuilding& goal) @@ -918,7 +918,7 @@ Ware* GamePlayer::OrderWare(const GoodType ware, noBaseBuilding& goal) Ware* bestWare = nullptr; for(Ware* curWare : ware_list) { - if(curWare->IsLostWare() && curWare->type == ware) + if(curWare->isLostWare() && curWare->type == ware) { // got a lost ware with a road to goal -> find best unsigned curLength = curWare->CheckNewGoalForLostWare(goal); @@ -931,7 +931,7 @@ Ware* GamePlayer::OrderWare(const GoodType ware, noBaseBuilding& goal) } if(bestWare) { - bestWare->SetNewGoalForLostWare(goal); + bestWare->setNewGoalForLostWare(goal); return bestWare; } } @@ -944,16 +944,16 @@ nofCarrier* GamePlayer::OrderDonkey(RoadSegment& road) const std::array best; // 1. Flagge des Weges - best[0] = FindWarehouse(*road.GetF1(), FW::HasFigure(Job::PackDonkey, false), false, false, length.data(), &road); + best[0] = FindWarehouse(*road.getF1(), FW::HasFigure(Job::PackDonkey, false), false, false, length.data(), &road); // 2. Flagge des Weges - best[1] = FindWarehouse(*road.GetF2(), FW::HasFigure(Job::PackDonkey, false), false, false, &length[1], &road); + best[1] = FindWarehouse(*road.getF2(), FW::HasFigure(Job::PackDonkey, false), false, false, &length[1], &road); // überhaupt nen Weg gefunden? // Welche Flagge benutzen? if(best[0] && (!best[1] || length[0] < length[1])) - return best[0]->OrderDonkey(road, *road.GetF1()); + return best[0]->OrderDonkey(road, *road.getF1()); else if(best[1]) - return best[1]->OrderDonkey(road, *road.GetF2()); + return best[1]->OrderDonkey(road, *road.getF2()); else return nullptr; } @@ -975,20 +975,20 @@ RoadSegment* GamePlayer::FindRoadForDonkey(noRoadNode& start, noRoadNode** goal) noRoadNode* current_best_goal = nullptr; // Weg zu beiden Flaggen berechnen unsigned length1, length2; - bool isF1Reachable = world.FindHumanPathOnRoads(start, *roadSeg->GetF1(), &length1, nullptr, roadSeg) + bool isF1Reachable = world.FindHumanPathOnRoads(start, *roadSeg->getF1(), &length1, nullptr, roadSeg) != RoadPathDirection::None; - bool isF2Reachable = world.FindHumanPathOnRoads(start, *roadSeg->GetF2(), &length2, nullptr, roadSeg) + bool isF2Reachable = world.FindHumanPathOnRoads(start, *roadSeg->getF2(), &length2, nullptr, roadSeg) != RoadPathDirection::None; // Wenn man zu einer Flagge nich kommt, die jeweils andere nehmen if(!isF1Reachable) - current_best_goal = (isF2Reachable) ? roadSeg->GetF2() : nullptr; + current_best_goal = (isF2Reachable) ? roadSeg->getF2() : nullptr; else if(!isF2Reachable) - current_best_goal = roadSeg->GetF1(); + current_best_goal = roadSeg->getF1(); else { // ansonsten die kürzeste von beiden - current_best_goal = (length1 < length2) ? roadSeg->GetF1() : roadSeg->GetF2(); + current_best_goal = (length1 < length2) ? roadSeg->getF1() : roadSeg->getF2(); } // Kein Weg führt hin, nächste Straße bitte @@ -996,11 +996,11 @@ RoadSegment* GamePlayer::FindRoadForDonkey(noRoadNode& start, noRoadNode** goal) continue; // Jeweiligen Weg bestimmen - unsigned current_best_way = (roadSeg->GetF1() == current_best_goal) ? length1 : length2; + unsigned current_best_way = (roadSeg->getF1() == current_best_goal) ? length1 : length2; // Produktivität ausrechnen, *10 die Produktivität + die Wegstrecke, damit die // auch noch mit einberechnet wird - unsigned current_productivity = 10 * roadSeg->getCarrier(0)->GetProductivity() + current_best_way; + unsigned current_productivity = 10 * roadSeg->getCarrier(0)->getProductivity() + current_best_way; // Besser als der bisher beste? if(current_productivity > best_productivity) @@ -1034,7 +1034,7 @@ struct ClientForWare else if(points != b.points) return points > b.points; else - return bld->GetObjId() > b.bld->GetObjId(); + return bld->getObjId() > b.bld->getObjId(); } }; @@ -1054,19 +1054,19 @@ noBaseBuilding* GamePlayer::FindClientForWare(const Ware& ware) std::vector possibleClients; - const noRoadNode* start = ware.GetLocation(); + const noRoadNode* start = ware.getLocation(); // Bretter und Steine können evtl. auch Häfen für Expeditionen gebrauchen if(gt == GoodType::Stones || gt == GoodType::Boards) { - for(nobHarborBuilding* harbor : buildings.GetHarbors()) + for(nobHarborBuilding* harbor : buildings.getHarbors()) { unsigned points = harbor->CalcDistributionPoints(gt); if(!points) continue; points += 10 * 30; // Verteilung existiert nicht, Expeditionen haben allerdings hohe Priorität - unsigned distance = world.CalcDistance(start->GetPos(), harbor->GetPos()) / 2; + unsigned distance = world.CalcDistance(start->getPos(), harbor->getPos()) / 2; possibleClients.push_back(ClientForWare(harbor, points > distance ? points - distance : 0, points)); } } @@ -1077,10 +1077,10 @@ noBaseBuilding* GamePlayer::FindClientForWare(const Ware& ware) if(bldType == BuildingType::Headquarters) { // Bei Baustellen die Extraliste abfragen - for(noBuildingSite* bldSite : buildings.GetBuildingSites()) + for(noBuildingSite* bldSite : buildings.getBuildingSites()) { // Optimization: Ignore if unconnected - if(!bldSite->IsConnected()) + if(!bldSite->isConnected()) continue; unsigned points = bldSite->CalcDistributionPoints(gt); @@ -1088,16 +1088,16 @@ noBaseBuilding* GamePlayer::FindClientForWare(const Ware& ware) continue; points += wareDistribution.percent_buildings[BuildingType::Headquarters] * 30; - unsigned distance = world.CalcDistance(start->GetPos(), bldSite->GetPos()) / 2; + unsigned distance = world.CalcDistance(start->getPos(), bldSite->getPos()) / 2; possibleClients.push_back(ClientForWare(bldSite, points > distance ? points - distance : 0, points)); } } else { // Für übrige Gebäude - for(nobUsual* bld : buildings.GetBuildings(bldType)) + for(nobUsual* bld : buildings.getBuildings(bldType)) { // Optimization: Ignore if unconnected - if(!bld->IsConnected()) + if(!bld->isConnected()) continue; unsigned points = bld->CalcDistributionPoints(gt); @@ -1106,7 +1106,7 @@ noBaseBuilding* GamePlayer::FindClientForWare(const Ware& ware) if(!wareDistribution.goals.empty()) { - if(bld->GetBuildingType() + if(bld->getBuildingType() == static_cast(wareDistribution.goals[wareDistribution.selected_goal])) points += 300; else if(points >= 300) // avoid overflows (async!) @@ -1115,7 +1115,7 @@ noBaseBuilding* GamePlayer::FindClientForWare(const Ware& ware) points = 0; } - unsigned distance = world.CalcDistance(start->GetPos(), bld->GetPos()) / 2; + unsigned distance = world.CalcDistance(start->getPos(), bld->getPos()) / 2; possibleClients.push_back(ClientForWare(bld, points > distance ? points - distance : 0, points)); } } @@ -1179,16 +1179,16 @@ noBaseBuilding* GamePlayer::FindClientForWare(const Ware& ware) nobBaseWarehouse* GamePlayer::FindWarehouseForWare(const Ware& ware) const { // Check whs that collect this ware - nobBaseWarehouse* wh = FindWarehouse(*ware.GetLocation(), FW::CollectsWare(ware.type), true, true); + nobBaseWarehouse* wh = FindWarehouse(*ware.getLocation(), FW::CollectsWare(ware.type), true, true); // If there is none, check those that accept it if(!wh) { // First find the ones, that do not send it right away (IMPORTANT: This avoids sending a ware to the wh that is // sending the ware out) - wh = FindWarehouse(*ware.GetLocation(), FW::AcceptsWareButNoSend(ware.type), true, true); + wh = FindWarehouse(*ware.getLocation(), FW::AcceptsWareButNoSend(ware.type), true, true); // The others only if this fails if(!wh) - wh = FindWarehouse(*ware.GetLocation(), FW::AcceptsWare(ware.type), true, true); + wh = FindWarehouse(*ware.getLocation(), FW::AcceptsWare(ware.type), true, true); } return wh; } @@ -1201,12 +1201,12 @@ typename T_Buildings::value_type GamePlayer::FindClientImpl(const Ware& ware, T_ // See PR #1720 typename T_Buildings::value_type bestClient = nullptr; unsigned bestPoints = 0; - const auto& wareLocation = *ware.GetLocation(); - const MapPoint warePos = wareLocation.GetPos(); + const auto& wareLocation = *ware.getLocation(); + const MapPoint warePos = wareLocation.getPos(); for(auto* bld : buildings) { // Optimization: Ignore if unconnected - if(!bld->IsConnected()) + if(!bld->isConnected()) continue; const auto points = getPriority(*bld); @@ -1216,7 +1216,7 @@ typename T_Buildings::value_type GamePlayer::FindClientImpl(const Ware& ware, T_ if(points > bestPoints) { const unsigned maxPathCosts = points - bestPoints - 1; - const unsigned distance = world.CalcDistance(warePos, bld->GetPos()); + const unsigned distance = world.CalcDistance(warePos, bld->getPos()); if(distance > maxPathCosts) continue; unsigned pathCosts; @@ -1235,7 +1235,7 @@ typename T_Buildings::value_type GamePlayer::FindClientImpl(const Ware& ware, T_ nobBaseMilitary* GamePlayer::FindClientForCoin(const Ware& ware) const { nobBaseMilitary* result = FindClientImpl( - ware, [](const nobMilitary& bld) { return bld.CalcCoinsPoints(); }, buildings.GetMilitaryBuildings()); + ware, [](const nobMilitary& bld) { return bld.CalcCoinsPoints(); }, buildings.getMilitaryBuildings()); // Send to warehouse if no military building needs the coins if(!result) result = FindWarehouseForWare(ware); @@ -1246,7 +1246,7 @@ nobBaseMilitary* GamePlayer::FindClientForCoin(const Ware& ware) const nobBaseMilitary* GamePlayer::FindClientForArmor(const Ware& ware) const { nobBaseMilitary* result = FindClientImpl( - ware, [](const nobMilitary& bld) { return bld.CalcArmorPoints(); }, buildings.GetMilitaryBuildings()); + ware, [](const nobMilitary& bld) { return bld.CalcArmorPoints(); }, buildings.getMilitaryBuildings()); // Send to warehouse if no military building needs the coins if(!result) result = FindWarehouseForWare(ware); @@ -1254,7 +1254,7 @@ nobBaseMilitary* GamePlayer::FindClientForArmor(const Ware& ware) const return result; } -unsigned GamePlayer::GetBuidingSitePriority(const noBuildingSite* building_site) +unsigned GamePlayer::getBuidingSitePriority(const noBuildingSite* building_site) { if(useCustomBuildOrder_) { @@ -1263,14 +1263,14 @@ unsigned GamePlayer::GetBuidingSitePriority(const noBuildingSite* building_site) // Typ in der Reihenfolge suchen und Position als Priorität zurückgeben for(unsigned i = 0; i < build_order.size(); ++i) { - if(building_site->GetBuildingType() == build_order[i]) + if(building_site->getBuildingType() == build_order[i]) return i; } } else { // Reihenfolge der Bauaufträge, also was zuerst in Auftrag gegeben wurde, wird zuerst gebaut unsigned i = 0; - for(noBuildingSite* bldSite : buildings.GetBuildingSites()) + for(noBuildingSite* bldSite : buildings.getBuildingSites()) { if(building_site == bldSite) return i; @@ -1287,26 +1287,26 @@ unsigned GamePlayer::GetBuidingSitePriority(const noBuildingSite* building_site) void GamePlayer::ConvertTransportData(const TransportOrders& transport_data) { for(const auto ware : helpers::EnumRange{}) - transportPrio[ware] = GetTransportPrioFromOrdering(transport_data, ware); + transportPrio[ware] = getTransportPrioFromOrdering(transport_data, ware); } -bool GamePlayer::IsAlly(const unsigned char playerId) const +bool GamePlayer::isAlly(const unsigned char playerId) const { // Der Spieler ist ja auch zu sich selber verbündet - if(GetPlayerId() == playerId) + if(getPlayerId() == playerId) return true; else - return GetPactState(PactType::TreatyOfAlliance, playerId) == PactState::Accepted; + return getPactState(PactType::TreatyOfAlliance, playerId) == PactState::Accepted; } -bool GamePlayer::IsAttackable(const unsigned char playerId) const +bool GamePlayer::isAttackable(const unsigned char playerId) const { // Verbündete dürfen nicht angegriffen werden - if(IsAlly(playerId)) + if(isAlly(playerId)) return false; else // Ansonsten darf bei bestehendem Nichtangriffspakt ebenfalls nicht angegriffen werden - return GetPactState(PactType::NonAgressionPact, playerId) != PactState::Accepted; + return getPactState(PactType::NonAgressionPact, playerId) != PactState::Accepted; } void GamePlayer::OrderTroops(nobMilitary& goal, std::array counts, @@ -1332,13 +1332,13 @@ void GamePlayer::OrderTroops(nobMilitary& goal, std::arrayRegulateTroops(); } void GamePlayer::RecalcMilitaryFlags() { - for(nobMilitary* milBld : buildings.GetMilitaryBuildings()) + for(nobMilitary* milBld : buildings.getMilitaryBuildings()) milBld->LookForEnemyBuildings(nullptr); } @@ -1347,9 +1347,9 @@ void GamePlayer::NewSoldiersAvailable(const unsigned& soldier_count) RTTR_Assert(soldier_count > 0); // solange laufen lassen, bis soldier_count = 0, d.h. der Soldat irgendwohin geschickt wurde // Zuerst nach unbesetzten Militärgebäude schauen - for(nobMilitary* milBld : buildings.GetMilitaryBuildings()) + for(nobMilitary* milBld : buildings.getMilitaryBuildings()) { - if(milBld->IsNewBuilt()) + if(milBld->isNewBuilt()) { milBld->RegulateTroops(); // Used that soldier? Go out @@ -1359,9 +1359,9 @@ void GamePlayer::NewSoldiersAvailable(const unsigned& soldier_count) } // Als nächstes Gebäude in Grenznähe - for(nobMilitary* milBld : buildings.GetMilitaryBuildings()) + for(nobMilitary* milBld : buildings.getMilitaryBuildings()) { - if(milBld->GetFrontierDistance() == FrontierDistance::Near) + if(milBld->getFrontierDistance() == FrontierDistance::Near) { milBld->RegulateTroops(); // Used that soldier? Go out @@ -1371,10 +1371,10 @@ void GamePlayer::NewSoldiersAvailable(const unsigned& soldier_count) } // Und den Rest ggf. - for(nobMilitary* milBld : buildings.GetMilitaryBuildings()) + for(nobMilitary* milBld : buildings.getMilitaryBuildings()) { // already checked? -> skip - if(milBld->GetFrontierDistance() == FrontierDistance::Near || milBld->IsNewBuilt()) + if(milBld->getFrontierDistance() == FrontierDistance::Near || milBld->isNewBuilt()) continue; milBld->RegulateTroops(); if(!soldier_count) // used the soldier? @@ -1384,7 +1384,7 @@ void GamePlayer::NewSoldiersAvailable(const unsigned& soldier_count) void GamePlayer::CallFlagWorker(const MapPoint pt, const Job job) { - auto* flag = world.GetSpecObj(pt); + auto* flag = world.getSpecObj(pt); if(!flag) return; /// Find wh with given job type (e.g. geologist, scout, ...) @@ -1394,7 +1394,7 @@ void GamePlayer::CallFlagWorker(const MapPoint pt, const Job job) wh->OrderJob(job, *flag, true); } -bool GamePlayer::IsFlagWorker(const nofFlagWorker* flagworker) +bool GamePlayer::isFlagWorker(const nofFlagWorker* flagworker) { return helpers::contains(flagworkers, flagworker); } @@ -1404,7 +1404,7 @@ void GamePlayer::FlagDestroyed(noFlag* flag) // Alle durchgehen und ggf. sagen, dass sie keine Flagge mehr haben, wenn das ihre Flagge war, die zerstört wurde for(auto it = flagworkers.begin(); it != flagworkers.end();) { - if((*it)->GetFlag() == flag) + if((*it)->getFlag() == flag) { (*it)->LostWork(); it = flagworkers.erase(it); @@ -1443,7 +1443,7 @@ void GamePlayer::ChangeToolsSettings(const ToolSettings& tools_settings, const bool settingsChanged = toolsSettings_ != tools_settings; toolsSettings_ = tools_settings; if(settingsChanged) - world.GetNotifications().publish(ToolNote(ToolNote::SettingsChanged, GetPlayerId())); + world.getNotifications().publish(ToolNote(ToolNote::SettingsChanged, getPlayerId())); for(const auto tool : helpers::enumRange()) { @@ -1454,7 +1454,7 @@ void GamePlayer::ChangeToolsSettings(const ToolSettings& tools_settings, { LOG.write(">> Committing an order of %1% for tool #%2%(%3%)\n", LogTarget::File) % (int)orderChanges[tool] % static_cast(tool) % _(WARE_NAMES[TOOL_TO_GOOD[tool]]); - world.GetNotifications().publish(ToolNote(ToolNote::OrderPlaced, GetPlayerId())); + world.getNotifications().publish(ToolNote(ToolNote::OrderPlaced, getPlayerId())); } } } @@ -1491,18 +1491,18 @@ void GamePlayer::TestDefeat() { // Nicht schon besiegt? // Keine Militärgebäude, keine Lagerhäuser (HQ,Häfen) -> kein Land --> verloren - if(!isDefeated && buildings.GetMilitaryBuildings().empty() && buildings.GetStorehouses().empty()) + if(!isDefeated && buildings.getMilitaryBuildings().empty() && buildings.getStorehouses().empty()) Surrender(); } -const nobHQ* GamePlayer::GetHQ() const +const nobHQ* GamePlayer::getHQ() const { - return hqPos.isValid() ? GetGameWorld().GetSpecObj(hqPos) : nullptr; + return hqPos.isValid() ? getGameWorld().getSpecObj(hqPos) : nullptr; } -nobHQ* GamePlayer::GetHQ() +nobHQ* GamePlayer::getHQ() { - return const_cast(std::as_const(*this).GetHQ()); + return const_cast(std::as_const(*this).getHQ()); } void GamePlayer::Surrender() @@ -1513,11 +1513,11 @@ void GamePlayer::Surrender() isDefeated = true; // GUI Bescheid sagen - if(world.GetGameInterface()) - world.GetGameInterface()->GI_PlayerDefeated(GetPlayerId()); + if(world.getGameInterface()) + world.getGameInterface()->GI_PlayerDefeated(getPlayerId()); } -void GamePlayer::SetStatisticValue(StatisticType type, unsigned value) +void GamePlayer::setStatisticValue(StatisticType type, unsigned value) { statisticCurrentData[type] = value; } @@ -1670,27 +1670,27 @@ void GamePlayer::PactChanged(const PactType pt) // Ggf. den GUI Bescheid sagen, um Sichtbarkeiten etc. neu zu berechnen if(pt == PactType::TreatyOfAlliance) { - if(world.GetGameInterface()) - world.GetGameInterface()->GI_TreatyOfAllianceChanged(GetPlayerId()); + if(world.getGameInterface()) + world.getGameInterface()->GI_TreatyOfAllianceChanged(getPlayerId()); } } void GamePlayer::SuggestPact(const unsigned char targetPlayerId, const PactType pt, const unsigned duration) { // Don't try to make pact with self - if(targetPlayerId == GetPlayerId()) + if(targetPlayerId == getPlayerId()) return; if(!pacts[targetPlayerId][pt].accepted && duration > 0) { pacts[targetPlayerId][pt].duration = duration; - pacts[targetPlayerId][pt].start = world.GetEvMgr().GetCurrentGF(); - GamePlayer targetPlayer = world.GetPlayer(targetPlayerId); + pacts[targetPlayerId][pt].start = world.getEvMgr().getCurrentGF(); + GamePlayer targetPlayer = world.getPlayer(targetPlayerId); if(targetPlayer.isHuman()) targetPlayer.SendPostMessage(std::make_unique( - world.GetEvMgr().GetCurrentGF(), pt, pacts[targetPlayerId][pt].start, *this, duration)); - else if(world.HasLua()) - world.GetLua().EventSuggestPact(pt, GetPlayerId(), targetPlayerId, duration); + world.getEvMgr().getCurrentGF(), pt, pacts[targetPlayerId][pt].start, *this, duration)); + else if(world.hasLua()) + world.getLua().EventSuggestPact(pt, getPlayerId(), targetPlayerId, duration); } } @@ -1699,26 +1699,26 @@ void GamePlayer::AcceptPact(const unsigned id, const PactType pt, const unsigned if(!pacts[targetPlayer][pt].accepted && pacts[targetPlayer][pt].duration > 0 && pacts[targetPlayer][pt].start == id) { MakePact(pt, targetPlayer, pacts[targetPlayer][pt].duration); - world.GetPlayer(targetPlayer).MakePact(pt, GetPlayerId(), pacts[targetPlayer][pt].duration); + world.getPlayer(targetPlayer).MakePact(pt, getPlayerId(), pacts[targetPlayer][pt].duration); PactChanged(pt); - world.GetPlayer(targetPlayer).PactChanged(pt); - if(world.HasLua()) - world.GetLua().EventPactCreated(pt, GetPlayerId(), targetPlayer, pacts[targetPlayer][pt].duration); + world.getPlayer(targetPlayer).PactChanged(pt); + if(world.hasLua()) + world.getLua().EventPactCreated(pt, getPlayerId(), targetPlayer, pacts[targetPlayer][pt].duration); } } void GamePlayer::MakePact(const PactType pt, const unsigned char other_player, const unsigned duration) { pacts[other_player][pt].accepted = true; - pacts[other_player][pt].start = world.GetEvMgr().GetCurrentGF(); + pacts[other_player][pt].start = world.getEvMgr().getCurrentGF(); pacts[other_player][pt].duration = duration; pacts[other_player][pt].want_cancel = false; SendPostMessage( - std::make_unique(world.GetEvMgr().GetCurrentGF(), pt, world.GetPlayer(other_player), true)); + std::make_unique(world.getEvMgr().getCurrentGF(), pt, world.getPlayer(other_player), true)); } -PactState GamePlayer::GetPactState(const PactType pt, const unsigned char other_player) const +PactState GamePlayer::getPactState(const PactType pt, const unsigned char other_player) const { // Prüfen, ob Bündnis in Kraft ist if(pacts[other_player][pt].duration) @@ -1727,7 +1727,7 @@ PactState GamePlayer::GetPactState(const PactType pt, const unsigned char other_ return PactState::InProgress; if(pacts[other_player][pt].duration == DURATION_INFINITE - || world.GetEvMgr().GetCurrentGF() < pacts[other_player][pt].start + pacts[other_player][pt].duration) + || world.getEvMgr().getCurrentGF() < pacts[other_player][pt].start + pacts[other_player][pt].duration) return PactState::Accepted; } @@ -1736,16 +1736,16 @@ PactState GamePlayer::GetPactState(const PactType pt, const unsigned char other_ void GamePlayer::NotifyAlliesOfLocation(const MapPoint pt) { - for(unsigned i = 0; i < world.GetNumPlayers(); ++i) + for(unsigned i = 0; i < world.getNumPlayers(); ++i) { - if(i != GetPlayerId() && IsAlly(i)) - world.GetPlayer(i).SendPostMessage(std::make_unique( - world.GetEvMgr().GetCurrentGF(), _("Your ally wishes to notify you of this location"), + if(i != getPlayerId() && isAlly(i)) + world.getPlayer(i).SendPostMessage(std::make_unique( + world.getEvMgr().getCurrentGF(), _("Your ally wishes to notify you of this location"), PostCategory::Diplomacy, pt)); } } -unsigned GamePlayer::GetRemainingPactTime(const PactType pt, const unsigned char other_player) const +unsigned GamePlayer::getRemainingPactTime(const PactType pt, const unsigned char other_player) const { if(pacts[other_player][pt].duration) { @@ -1753,9 +1753,9 @@ unsigned GamePlayer::GetRemainingPactTime(const PactType pt, const unsigned char { if(pacts[other_player][pt].duration == DURATION_INFINITE) return DURATION_INFINITE; - else if(world.GetEvMgr().GetCurrentGF() <= pacts[other_player][pt].start + pacts[other_player][pt].duration) + else if(world.getEvMgr().getCurrentGF() <= pacts[other_player][pt].start + pacts[other_player][pt].duration) return ((pacts[other_player][pt].start + pacts[other_player][pt].duration) - - world.GetEvMgr().GetCurrentGF()); + - world.getEvMgr().getCurrentGF()); } } @@ -1765,7 +1765,7 @@ unsigned GamePlayer::GetRemainingPactTime(const PactType pt, const unsigned char void GamePlayer::CancelPact(const PactType pt, const unsigned char otherPlayerIdx) { // Don't try to cancel pact with self - if(otherPlayerIdx == GetPlayerId()) + if(otherPlayerIdx == getPlayerId()) return; // Besteht bereits ein Bündnis? @@ -1775,46 +1775,46 @@ void GamePlayer::CancelPact(const PactType pt, const unsigned char otherPlayerId pacts[otherPlayerIdx][pt].want_cancel = true; // Will der andere Spieler das Bündnis auch auflösen? - GamePlayer& otherPlayer = world.GetPlayer(otherPlayerIdx); - if(otherPlayer.pacts[GetPlayerId()][pt].want_cancel) + GamePlayer& otherPlayer = world.getPlayer(otherPlayerIdx); + if(otherPlayer.pacts[getPlayerId()][pt].want_cancel) { // Dann wird das Bündnis aufgelöst pacts[otherPlayerIdx][pt].accepted = false; pacts[otherPlayerIdx][pt].duration = 0; pacts[otherPlayerIdx][pt].want_cancel = false; - otherPlayer.pacts[GetPlayerId()][pt].accepted = false; - otherPlayer.pacts[GetPlayerId()][pt].duration = 0; - otherPlayer.pacts[GetPlayerId()][pt].want_cancel = false; + otherPlayer.pacts[getPlayerId()][pt].accepted = false; + otherPlayer.pacts[getPlayerId()][pt].duration = 0; + otherPlayer.pacts[getPlayerId()][pt].want_cancel = false; // Den Spielern eine Informationsnachricht schicken - world.GetPlayer(otherPlayerIdx) - .SendPostMessage(std::make_unique(world.GetEvMgr().GetCurrentGF(), pt, *this, false)); + world.getPlayer(otherPlayerIdx) + .SendPostMessage(std::make_unique(world.getEvMgr().getCurrentGF(), pt, *this, false)); SendPostMessage( - std::make_unique(world.GetEvMgr().GetCurrentGF(), pt, world.GetPlayer(otherPlayerIdx), false)); + std::make_unique(world.getEvMgr().getCurrentGF(), pt, world.getPlayer(otherPlayerIdx), false)); PactChanged(pt); otherPlayer.PactChanged(pt); - if(world.HasLua()) - world.GetLua().EventPactCanceled(pt, GetPlayerId(), otherPlayerIdx); + if(world.hasLua()) + world.getLua().EventPactCanceled(pt, getPlayerId(), otherPlayerIdx); } else { // Ansonsten den anderen Spieler fragen, ob der das auch so sieht if(otherPlayer.isHuman()) otherPlayer.SendPostMessage(std::make_unique( - world.GetEvMgr().GetCurrentGF(), pt, pacts[otherPlayerIdx][pt].start, *this)); - else if(!world.HasLua() || world.GetLua().EventCancelPactRequest(pt, GetPlayerId(), otherPlayerIdx)) + world.getEvMgr().getCurrentGF(), pt, pacts[otherPlayerIdx][pt].start, *this)); + else if(!world.hasLua() || world.getLua().EventCancelPactRequest(pt, getPlayerId(), otherPlayerIdx)) { // AI accepts cancels, if there is no lua-interace pacts[otherPlayerIdx][pt].accepted = false; pacts[otherPlayerIdx][pt].duration = 0; pacts[otherPlayerIdx][pt].want_cancel = false; - otherPlayer.pacts[GetPlayerId()][pt].accepted = false; - otherPlayer.pacts[GetPlayerId()][pt].duration = 0; - otherPlayer.pacts[GetPlayerId()][pt].want_cancel = false; + otherPlayer.pacts[getPlayerId()][pt].accepted = false; + otherPlayer.pacts[getPlayerId()][pt].duration = 0; + otherPlayer.pacts[getPlayerId()][pt].want_cancel = false; - if(world.HasLua()) - world.GetLua().EventPactCanceled(pt, GetPlayerId(), otherPlayerIdx); + if(world.hasLua()) + world.getLua().EventPactCanceled(pt, getPlayerId(), otherPlayerIdx); } } } else @@ -1827,7 +1827,7 @@ void GamePlayer::CancelPact(const PactType pt, const unsigned char otherPlayerId void GamePlayer::MakeStartPacts() { // Reset pacts - for(unsigned i = 0; i < world.GetNumPlayers(); ++i) + for(unsigned i = 0; i < world.getNumPlayers(); ++i) { for(const auto z : helpers::enumRange()) pacts[i][z] = Pact(); @@ -1839,9 +1839,9 @@ void GamePlayer::MakeStartPacts() RTTR_Assert(isTeam(team)); // Create ally- and non-aggression-pact for all players of same team - for(unsigned i = 0; i < world.GetNumPlayers(); ++i) + for(unsigned i = 0; i < world.getNumPlayers(); ++i) { - if(team != world.GetPlayer(i).team) + if(team != world.getPlayer(i).team) continue; for(const auto z : helpers::enumRange()) { @@ -1853,16 +1853,16 @@ void GamePlayer::MakeStartPacts() } } -bool GamePlayer::IsWareRegistred(const Ware& ware) +bool GamePlayer::isWareRegistred(const Ware& ware) { return helpers::contains(ware_list, &ware); } -bool GamePlayer::IsWareDependent(const Ware& ware) +bool GamePlayer::isWareDependent(const Ware& ware) { - for(nobBaseWarehouse* wh : buildings.GetStorehouses()) + for(nobBaseWarehouse* wh : buildings.getStorehouses()) { - if(wh->IsWareDependent(ware)) + if(wh->isWareDependent(ware)) return true; } @@ -1882,7 +1882,7 @@ void GamePlayer::DecreaseInventoryWare(const GoodType ware, const unsigned count void GamePlayer::RegisterShip(noShip& ship) { ships.push_back(&ship); - GetJobForShip(ship); + getJobForShip(ship); } struct ShipForHarbor @@ -1894,7 +1894,7 @@ struct ShipForHarbor bool operator<(const ShipForHarbor& b) const noexcept { - return (estimate < b.estimate) || (estimate == b.estimate && ship->GetObjId() < b.ship->GetObjId()); + return (estimate < b.estimate) || (estimate == b.estimate && ship->getObjId() < b.ship->getObjId()); } }; @@ -1903,21 +1903,21 @@ bool GamePlayer::OrderShip(nobHarborBuilding& hb) std::vector sfh; // we need more ships than those that are already on their way? limit search to idle ships - if(GetShipsToHarbor(hb) < hb.GetNumNeededShips()) + if(getShipsToHarbor(hb) < hb.getNumNeededShips()) { for(noShip* ship : ships) { - if(ship->IsIdling() && world.IsHarborAtSea(world.GetHarborPointID(hb.GetPos()), ship->GetSeaID())) - sfh.push_back(ShipForHarbor(ship, world.CalcDistance(hb.GetPos(), ship->GetPos()))); + if(ship->isIdling() && world.isHarborAtSea(world.getHarborPointID(hb.getPos()), ship->getSeaID())) + sfh.push_back(ShipForHarbor(ship, world.CalcDistance(hb.getPos(), ship->getPos()))); } } else { for(noShip* ship : ships) { - if((ship->IsIdling() && world.IsHarborAtSea(world.GetHarborPointID(hb.GetPos()), ship->GetSeaID())) - || ship->IsGoingToHarbor(hb)) + if((ship->isIdling() && world.isHarborAtSea(world.getHarborPointID(hb.getPos()), ship->getSeaID())) + || ship->isGoingToHarbor(hb)) { - sfh.push_back(ShipForHarbor(ship, world.CalcDistance(hb.GetPos(), ship->GetPos()))); + sfh.push_back(ShipForHarbor(ship, world.CalcDistance(hb.getPos(), ship->getPos()))); } } } @@ -1940,7 +1940,7 @@ bool GamePlayer::OrderShip(nobHarborBuilding& hb) noShip& ship = *it.ship; - if(world.FindShipPathToHarbor(ship.GetPos(), hb.GetHarborPosID(), ship.GetSeaID(), &route, &distance)) + if(world.FindShipPathToHarbor(ship.getPos(), hb.getHarborPosID(), ship.getSeaID(), &route, &distance)) { // ship already there? if(distance == 0) @@ -1959,7 +1959,7 @@ bool GamePlayer::OrderShip(nobHarborBuilding& hb) } // only order ships not already on their way - if(best_ship && best_ship->IsIdling()) + if(best_ship && best_ship->isIdling()) { best_ship->GoToHarbor(hb, best_route); @@ -1976,33 +1976,33 @@ void GamePlayer::RemoveShip(noShip* ship) ships.erase(it); } -void GamePlayer::GetJobForShip(noShip& ship) +void GamePlayer::getJobForShip(noShip& ship) { nobHarborBuilding* best = nullptr; int best_points = 0; std::vector best_route; // Beste Weglänge, die ein Schiff zurücklegen muss, welches gerade nichts zu tun hat - for(nobHarborBuilding* harbor : buildings.GetHarbors()) + for(nobHarborBuilding* harbor : buildings.getHarbors()) { // Braucht der Hafen noch Schiffe? - if(harbor->GetNumNeededShips() == 0) + if(harbor->getNumNeededShips() == 0) continue; // Anzahl der Schiffe ermitteln, die diesen Hafen bereits anfahren - unsigned ships_coming = GetShipsToHarbor(*harbor); + unsigned ships_coming = getShipsToHarbor(*harbor); // Evtl. kommen schon genug? - if(harbor->GetNumNeededShips() <= ships_coming) + if(harbor->getNumNeededShips() <= ships_coming) continue; // liegen wir am gleichen Meer? - if(world.IsHarborAtSea(harbor->GetHarborPosID(), ship.GetSeaID())) + if(world.isHarborAtSea(harbor->getHarborPosID(), ship.getSeaID())) { unsigned length; std::vector route; - if(world.FindShipPathToHarbor(ship.GetPos(), harbor->GetHarborPosID(), ship.GetSeaID(), &route, &length)) + if(world.FindShipPathToHarbor(ship.getPos(), harbor->getHarborPosID(), ship.getSeaID(), &route, &length)) { // ship already there? if(length == 0) @@ -2012,7 +2012,7 @@ void GamePlayer::GetJobForShip(noShip& ship) } // Punkte ausrechnen - int points = harbor->GetNeedForShip(ships_coming) - length; + int points = harbor->getNeedForShip(ships_coming) - length; if(points > best_points || !best) { best = harbor; @@ -2028,12 +2028,12 @@ void GamePlayer::GetJobForShip(noShip& ship) ship.GoToHarbor(*best, best_route); } -unsigned GamePlayer::GetShipID(const noShip& ship) const +unsigned GamePlayer::getShipID(const noShip& ship) const { return static_cast(helpers::indexOf(ships, &ship)); } -noShip* GamePlayer::GetShipByID(const unsigned ship_id) const +noShip* GamePlayer::getShipByID(const unsigned ship_id) const { if(ship_id >= ships.size()) return nullptr; @@ -2041,12 +2041,12 @@ noShip* GamePlayer::GetShipByID(const unsigned ship_id) const return ships[ship_id]; } -unsigned GamePlayer::GetShipsToHarbor(const nobHarborBuilding& hb) const +unsigned GamePlayer::getShipsToHarbor(const nobHarborBuilding& hb) const { unsigned count = 0; for(const auto* ship : ships) { - if(ship->IsGoingToHarbor(hb)) + if(ship->isGoingToHarbor(hb)) ++count; } @@ -2059,18 +2059,18 @@ bool GamePlayer::FindHarborForUnloading(noShip* ship, const MapPoint start, Harb nobHarborBuilding* best = nullptr; unsigned best_distance = 0xffffffff; - for(nobHarborBuilding* hb : buildings.GetHarbors()) + for(nobHarborBuilding* hb : buildings.getHarbors()) { // Bestimmten Hafen ausschließen if(hb == exception) continue; // Prüfen, ob Hafen an das Meer, wo sich das Schiff gerade befindet, angrenzt - if(!world.IsHarborAtSea(hb->GetHarborPosID(), ship->GetSeaID())) + if(!world.isHarborAtSea(hb->getHarborPosID(), ship->getSeaID())) continue; // Distanz ermitteln zwischen Schiff und Hafen, Schiff kann natürlich auch über Kartenränder fahren - unsigned distance = world.CalcDistance(ship->GetPos(), hb->GetPos()); + unsigned distance = world.CalcDistance(ship->getPos(), hb->getPos()); // Kürzerer Weg als bisher bestes Ziel? if(distance < best_distance) @@ -2085,24 +2085,24 @@ bool GamePlayer::FindHarborForUnloading(noShip* ship, const MapPoint start, Harb { // Weg dorthin suchen route->clear(); - *goalHarborId = best->GetHarborPosID(); - if(world.FindShipPathToHarbor(start, best->GetHarborPosID(), ship->GetSeaID(), route, nullptr)) + *goalHarborId = best->getHarborPosID(); + if(world.FindShipPathToHarbor(start, best->getHarborPosID(), ship->getSeaID(), route, nullptr)) return true; } return false; } -void GamePlayer::CancelWaresForEmergencyProtocol() +void GamePlayer::cancelWaresForEmergencyProtocol() { for(auto it = ware_list.begin(); it != ware_list.end();) { Ware* ware = *it; - if(ware->IsWaitingInWarehouse() && ware->GetGoal() - && !IsWareFineWithEmergencyProtocol(ware->type, *ware->GetGoal())) + if(ware->isWaitingInWarehouse() && ware->getGoal() + && !IsWareFineWithEmergencyProtocol(ware->type, *ware->getGoal())) { ware->NotifyGoalAboutLostWare(); - static_cast(ware->GetLocation())->CancelWare(ware); + static_cast(ware->getLocation())->cancelWare(ware); it = ware_list.erase(it); continue; } @@ -2119,17 +2119,17 @@ void GamePlayer::TestForEmergencyProgramm() // In Lagern vorhandene Bretter und Steine zählen unsigned boards = 0; unsigned stones = 0; - for(nobBaseWarehouse* wh : buildings.GetStorehouses()) + for(nobBaseWarehouse* wh : buildings.getStorehouses()) { - boards += wh->GetInventory().goods[GoodType::Boards]; - stones += wh->GetInventory().goods[GoodType::Stones]; + boards += wh->getInventory().goods[GoodType::Boards]; + stones += wh->getInventory().goods[GoodType::Stones]; } // Emergency happens, if we have less than 10 boards or stones... bool isNewEmergency = boards <= 10 || stones <= 10; // ...and no woddcutter or sawmill isNewEmergency &= - buildings.GetBuildings(BuildingType::Woodcutter).empty() || buildings.GetBuildings(BuildingType::Sawmill).empty(); + buildings.getBuildings(BuildingType::Woodcutter).empty() || buildings.getBuildings(BuildingType::Sawmill).empty(); // Wenn nötig, Notfallprogramm auslösen if(isNewEmergency) @@ -2138,10 +2138,10 @@ void GamePlayer::TestForEmergencyProgramm() { emergency = true; SendPostMessage(std::make_unique( - world.GetEvMgr().GetCurrentGF(), _("The emergency program has been activated."), PostCategory::Economy)); + world.getEvMgr().getCurrentGF(), _("The emergency program has been activated."), PostCategory::Economy)); // Handle wares already ordered - CancelWaresForEmergencyProtocol(); + cancelWaresForEmergencyProtocol(); } } else { @@ -2149,7 +2149,7 @@ void GamePlayer::TestForEmergencyProgramm() if(emergency) { emergency = false; - SendPostMessage(std::make_unique(world.GetEvMgr().GetCurrentGF(), + SendPostMessage(std::make_unique(world.getEvMgr().getCurrentGF(), _("The emergency program has been deactivated."), PostCategory::Economy)); FindMaterialForBuildingSites(); @@ -2159,9 +2159,9 @@ void GamePlayer::TestForEmergencyProgramm() void GamePlayer::TestPacts() { - for(unsigned i = 0; i < world.GetNumPlayers(); ++i) + for(unsigned i = 0; i < world.getNumPlayers(); ++i) { - if(i == GetPlayerId()) + if(i == getPlayerId()) continue; for(const auto pact : helpers::enumRange()) @@ -2169,16 +2169,16 @@ void GamePlayer::TestPacts() // Pact not running if(pacts[i][pact].duration == 0) continue; - if(GetPactState(pact, i) == PactState::None) + if(getPactState(pact, i) == PactState::None) { // Pact was running but is expired -> Cancel for both players pacts[i][pact].duration = 0; pacts[i][pact].accepted = false; - GamePlayer& otherPlayer = world.GetPlayer(i); - RTTR_Assert(otherPlayer.pacts[GetPlayerId()][pact].duration); - RTTR_Assert(otherPlayer.pacts[GetPlayerId()][pact].accepted); - otherPlayer.pacts[GetPlayerId()][pact].duration = 0; - otherPlayer.pacts[GetPlayerId()][pact].accepted = false; + GamePlayer& otherPlayer = world.getPlayer(i); + RTTR_Assert(otherPlayer.pacts[getPlayerId()][pact].duration); + RTTR_Assert(otherPlayer.pacts[getPlayerId()][pact].accepted); + otherPlayer.pacts[getPlayerId()][pact].duration = 0; + otherPlayer.pacts[getPlayerId()][pact].accepted = false; // And notify PactChanged(pact); otherPlayer.PactChanged(pact); @@ -2187,25 +2187,25 @@ void GamePlayer::TestPacts() } } -bool GamePlayer::CanBuildCatapult() const +bool GamePlayer::canBuildCatapult() const { // Wenn AddonId::LIMIT_CATAPULTS nicht aktiv ist, bauen immer erlaubt - if(!world.GetGGS().isEnabled(AddonId::LIMIT_CATAPULTS)) //-V807 + if(!world.getGGS().isEnabled(AddonId::LIMIT_CATAPULTS)) //-V807 return true; - BuildingCount bc = buildings.GetBuildingNums(); + BuildingCount bc = buildings.getBuildingNums(); unsigned max = 0; // proportional? - if(world.GetGGS().getSelection(AddonId::LIMIT_CATAPULTS) == 1) + if(world.getGGS().getSelection(AddonId::LIMIT_CATAPULTS) == 1) { max = int(bc.buildings[BuildingType::Barracks] * 0.125 + bc.buildings[BuildingType::Guardhouse] * 0.25 + bc.buildings[BuildingType::Watchtower] * 0.5 + bc.buildings[BuildingType::Fortress] + 0.111); // to avoid rounding errors - } else if(world.GetGGS().getSelection(AddonId::LIMIT_CATAPULTS) < 8) + } else if(world.getGGS().getSelection(AddonId::LIMIT_CATAPULTS) < 8) { const std::array limits = {{0, 3, 5, 10, 20, 30}}; - max = limits[world.GetGGS().getSelection(AddonId::LIMIT_CATAPULTS) - 2]; + max = limits[world.getGGS().getSelection(AddonId::LIMIT_CATAPULTS) - 2]; } return bc.buildings[BuildingType::Catapult] + bc.buildingSites[BuildingType::Catapult] < max; @@ -2226,31 +2226,31 @@ bool GamePlayer::ShipDiscoveredHostileTerritory(const MapPoint location) return true; } -bool GamePlayer::IsDependentFigure(const noFigure& fig) +bool GamePlayer::isDependentFigure(const noFigure& fig) { - for(const nobBaseWarehouse* wh : buildings.GetStorehouses()) + for(const nobBaseWarehouse* wh : buildings.getStorehouses()) { - if(wh->IsDependentFigure(fig)) + if(wh->isDependentFigure(fig)) return true; } return false; } -std::vector GamePlayer::GetWarehousesForTrading(const nobBaseWarehouse& goalWh) const +std::vector GamePlayer::getWarehousesForTrading(const nobBaseWarehouse& goalWh) const { std::vector result; // Don't try to trade with us! - if(goalWh.GetPlayer() == GetPlayerId()) + if(goalWh.getPlayer() == getPlayerId()) return result; - const MapPoint goalFlagPos = goalWh.GetFlagPos(); + const MapPoint goalFlagPos = goalWh.getFlagPos(); - TradePathCache& tradePathCache = world.GetTradePathCache(); - for(nobBaseWarehouse* wh : buildings.GetStorehouses()) + TradePathCache& tradePathCache = world.getTradePathCache(); + for(nobBaseWarehouse* wh : buildings.getStorehouses()) { // Is there a trade path from this warehouse to wh? (flag to flag) - if(tradePathCache.pathExists(wh->GetFlagPos(), goalFlagPos, GetPlayerId())) + if(tradePathCache.pathExists(wh->getFlagPos(), goalFlagPos, getPlayerId())) result.push_back(wh); } @@ -2265,44 +2265,44 @@ struct WarehouseDistanceComparator const GameWorld& gwg_; WarehouseDistanceComparator(const nobBaseWarehouse& refWareHouse, const GameWorld& world) - : refWareHousePos_(refWareHouse.GetPos()), gwg_(world) + : refWareHousePos_(refWareHouse.getPos()), gwg_(world) {} bool operator()(nobBaseWarehouse* const wh1, nobBaseWarehouse* const wh2) const { - unsigned dist1 = gwg_.CalcDistance(wh1->GetPos(), refWareHousePos_); - unsigned dist2 = gwg_.CalcDistance(wh2->GetPos(), refWareHousePos_); - return (dist1 < dist2) || (dist1 == dist2 && wh1->GetObjId() < wh2->GetObjId()); + unsigned dist1 = gwg_.CalcDistance(wh1->getPos(), refWareHousePos_); + unsigned dist2 = gwg_.CalcDistance(wh2->getPos(), refWareHousePos_); + return (dist1 < dist2) || (dist1 == dist2 && wh1->getObjId() < wh2->getObjId()); } }; void GamePlayer::Trade(nobBaseWarehouse* goalWh, const boost_variant2& what, unsigned count) const { - if(!world.GetGGS().isEnabled(AddonId::TRADE)) + if(!world.getGGS().isEnabled(AddonId::TRADE)) return; if(count == 0) return; // Don't try to trade with us! - if(goalWh->GetPlayer() == GetPlayerId()) + if(goalWh->getPlayer() == getPlayerId()) return; // No trades with enemies - if(!IsAlly(goalWh->GetPlayer())) + if(!isAlly(goalWh->getPlayer())) return; - const MapPoint goalFlagPos = goalWh->GetFlagPos(); + const MapPoint goalFlagPos = goalWh->getFlagPos(); - std::vector whs(buildings.GetStorehouses().begin(), buildings.GetStorehouses().end()); + std::vector whs(buildings.getStorehouses().begin(), buildings.getStorehouses().end()); helpers::sort(whs, WarehouseDistanceComparator(*goalWh, world)); - TradePathCache& tradePathCache = world.GetTradePathCache(); + TradePathCache& tradePathCache = world.getTradePathCache(); for(nobBaseWarehouse* wh : whs) { // Get available wares const unsigned available = - boost::variant2::visit(composeVisitor([wh](GoodType gt) { return wh->GetAvailableWaresForTrading(gt); }, - [wh](Job job) { return wh->GetAvailableFiguresForTrading(job); }), + boost::variant2::visit(composeVisitor([wh](GoodType gt) { return wh->getAvailableWaresForTrading(gt); }, + [wh](Job job) { return wh->getAvailableFiguresForTrading(job); }), what); if(available == 0) continue; @@ -2310,13 +2310,13 @@ void GamePlayer::Trade(nobBaseWarehouse* goalWh, const boost_variant2GetFlagPos(), goalFlagPos); + TradeRoute tr(world, getPlayerId(), wh->getFlagPos(), goalFlagPos); // Found a path? - if(tr.IsValid()) + if(tr.isValid()) { // Add to cache for future searches - tradePathCache.addEntry(tr.GetTradePath(), GetPlayerId()); + tradePathCache.addEntry(tr.getTradePath(), getPlayerId()); wh->StartTradeCaravane(what, actualCount, tr, goalWh); count -= actualCount; @@ -2326,12 +2326,12 @@ void GamePlayer::Trade(nobBaseWarehouse* goalWh, const boost_variant2GI_GetCheats().areAllBuildingsEnabled()); + || (isHuman() && world.getGameInterface() + && world.getGameInterface()->GI_GetCheats().areAllBuildingsEnabled()); } void GamePlayer::FillVisualSettings(VisualSettings& visualSettings) const @@ -2346,7 +2346,7 @@ void GamePlayer::FillVisualSettings(VisualSettings& visualSettings) const visualSettings.useCustomBuildOrder = useCustomBuildOrder_; visualSettings.build_order = build_order; - visualSettings.transport_order = GetOrderingFromTransportPrio(transportPrio); + visualSettings.transport_order = getOrderingFromTransportPrio(transportPrio); visualSettings.military_settings = militarySettings_; visualSettings.tools_settings = toolsSettings_; diff --git a/libs/s25main/GamePlayer.h b/libs/s25main/GamePlayer.h index 35207d77fc..8824fefe79 100644 --- a/libs/s25main/GamePlayer.h +++ b/libs/s25main/GamePlayer.h @@ -89,20 +89,20 @@ class GamePlayer : public GamePlayerInfo // Deserialisieren void Deserialize(SerializedGameData& sgd); - GameWorld& GetGameWorld() { return world; } - const GameWorld& GetGameWorld() const { return world; } + GameWorld& getGameWorld() { return world; } + const GameWorld& getGameWorld() const { return world; } - const MapPoint& GetHQPos() const { return hqPos; } - const nobHQ* GetHQ() const; - nobHQ* GetHQ(); - bool IsHQTent() const; - void SetHQIsTent(bool isTent); + const MapPoint& getHQPos() const { return hqPos; } + const nobHQ* getHQ() const; + nobHQ* getHQ(); + bool isHQTent() const; + void setHQIsTent(bool isTent); void AddBuilding(noBuilding* bld, BuildingType bldType); void RemoveBuilding(noBuilding* bld, BuildingType bldType); void AddBuildingSite(noBuildingSite* bldSite); void RemoveBuildingSite(noBuildingSite* bldSite); - const BuildingRegister& GetBuildingRegister() const { return buildings; } + const BuildingRegister& getBuildingRegister() const { return buildings; } /// Notify that a new road connection exists (not only an existing road splitted) void NewRoadConnection(RoadSegment* rs); @@ -115,11 +115,11 @@ class GamePlayer : public GamePlayerInfo /// Sucht einen Träger für die Straße und ruft ggf den Träger aus dem jeweiligen nächsten Lagerhaus bool FindCarrierForRoad(RoadSegment& rs) const; /// Returns true if the given wh does still exist and hence the ptr is valid - bool IsWarehouseValid(nobBaseWarehouse* wh) const; + bool isWarehouseValid(nobBaseWarehouse* wh) const; /// Gibt erstes Lagerhaus zurück - nobBaseWarehouse* GetFirstWH() + nobBaseWarehouse* getFirstWH() { - return buildings.GetStorehouses().empty() ? nullptr : buildings.GetStorehouses().front(); + return buildings.getStorehouses().empty() ? nullptr : buildings.getStorehouses().front(); } /// Looks for the closest warehouse for the point 'start' (including it) that matches the conditions by the functor /// - isWarehouseGood must be a functor taking a "const nobBaseWarhouse&", that returns a bool whether this @@ -164,7 +164,7 @@ class GamePlayer : public GamePlayerInfo /// Gibt Priorität der Baustelle zurück (entscheidet selbständig, welche Reihenfolge usw) /// je kleiner die Rückgabe, destro größer die Priorität! - unsigned GetBuidingSitePriority(const noBuildingSite* building_site); + unsigned getBuidingSitePriority(const noBuildingSite* building_site); /// Berechnet die Verteilung der Waren auf die einzelnen Gebäude neu void RecalcDistribution(); @@ -177,11 +177,11 @@ class GamePlayer : public GamePlayerInfo void RegisterWare(Ware& ware) { ware_list.push_back(&ware); } void RemoveWare(Ware& ware) { - RTTR_Assert(IsWareRegistred(ware)); + RTTR_Assert(isWareRegistred(ware)); ware_list.remove(&ware); } - bool IsWareRegistred(const Ware& ware); - bool IsWareDependent(const Ware& ware); + bool isWareRegistred(const Ware& ware); + bool isWareDependent(const Ware& ware); /// Fügt Waren zur Inventur hinzu void IncreaseInventoryWare(GoodType ware, unsigned count); @@ -192,7 +192,7 @@ class GamePlayer : public GamePlayerInfo void DecreaseInventoryJob(const ArmoredSoldier job, unsigned count) { global_inventory.Remove(job, count); } /// Gibt Inventory-Settings zurück - const Inventory& GetInventory() const { return global_inventory; } + const Inventory& getInventory() const { return global_inventory; } /// Setzt neue Militäreinstellungen void ChangeMilitarySettings(const MilitarySettings& military_settings); @@ -204,9 +204,9 @@ class GamePlayer : public GamePlayerInfo void ChangeBuildOrder(bool useCustomBuildOrder, const BuildOrders& order_data); /// Can this player and the other attack each other? - bool IsAttackable(unsigned char playerId) const; + bool isAttackable(unsigned char playerId) const; /// Are these players allied? (-> Teamview, attack support, ...) - bool IsAlly(unsigned char playerId) const; + bool isAlly(unsigned char playerId) const; /// Order troops of each rank according to `counts` without exceeding `total_max` in total void OrderTroops(nobMilitary& goal, std::array counts, unsigned total_max) const; /// Prüft die Besatzung von allen Militärgebäuden und reguliert entsprechend (bei Veränderung der @@ -229,10 +229,10 @@ class GamePlayer : public GamePlayerInfo void RegisterFlagWorker(nofFlagWorker* flagworker) { flagworkers.push_back(flagworker); } void RemoveFlagWorker(nofFlagWorker* flagworker) { - RTTR_Assert(IsFlagWorker(flagworker)); + RTTR_Assert(isFlagWorker(flagworker)); flagworkers.remove(flagworker); } - bool IsFlagWorker(const nofFlagWorker* flagworker); + bool isFlagWorker(const nofFlagWorker* flagworker); /// Wird aufgerufen, wenn eine Flagge abgerissen wurde, damit das den Flaggen-Arbeitern gesagt werden kann void FlagDestroyed(noFlag* flag); @@ -242,19 +242,19 @@ class GamePlayer : public GamePlayerInfo /// Meldet das Schiff wieder ab void RemoveShip(noShip* ship); /// Versucht, für ein untätiges Schiff eine Arbeit zu suchen - void GetJobForShip(noShip& ship); + void getJobForShip(noShip& ship); /// Schiff für Hafen bestellen. Wenn ein Schiff kommt, true. bool OrderShip(nobHarborBuilding& hb); /// Gibt die ID eines Schiffes zurück - unsigned GetShipID(const noShip& ship) const; + unsigned getShipID(const noShip& ship) const; /// Gibt ein Schiff anhand der ID zurück bzw. nullptr, wenn keines mit der ID existiert - noShip* GetShipByID(unsigned ship_id) const; + noShip* getShipByID(unsigned ship_id) const; /// Gibt die Gesamtanzahl von Schiffen zurück - unsigned GetNumShips() const { return ships.size(); } + unsigned getNumShips() const { return ships.size(); } /// Gibt liste der Schiffe zurück - const std::vector& GetShips() const { return ships; } + const std::vector& getShips() const { return ships; } /// Gibt die Anzahl der Schiffe, die einen bestimmten Hafen ansteuern, zurück - unsigned GetShipsToHarbor(const nobHarborBuilding& hb) const; + unsigned getShipsToHarbor(const nobHarborBuilding& hb) const; /// Sucht einen Hafen in der Nähe, wo dieses Schiff seine Waren abladen kann /// gibt true zurück, falls erfolgreich /// If starting point equals the coastal point of target harbor, return true and an empty `route`. @@ -278,9 +278,9 @@ class GamePlayer : public GamePlayerInfo /// Gibt Einverständnis, dass dieser Spieler den Pakt auflösen will /// Falls dieser Spieler einen Bündnisvorschlag gemacht hat, wird dieser dagegen zurückgenommen void CancelPact(PactType pt, unsigned char otherPlayerIdx); - PactState GetPactState(PactType pt, unsigned char other_player) const; + PactState getPactState(PactType pt, unsigned char other_player) const; /// Gibt die verbleibende Dauer zurück, die ein Bündnis noch laufen wird (DURATION_INFINITE = für immer) - unsigned GetRemainingPactTime(PactType pt, unsigned char other_player) const; + unsigned getRemainingPactTime(PactType pt, unsigned char other_player) const; /// Setzt die initialen Bündnisse anhand der Teams void MakeStartPacts(); /// Testet die Bündnisse, ob sie nicht schon abgelaufen sind @@ -288,38 +288,38 @@ class GamePlayer : public GamePlayerInfo /// Returns all warehouses that can trade with the given goal /// IMPORTANT: Warehouses can be destroyed. So check them first before using! - std::vector GetWarehousesForTrading(const nobBaseWarehouse& goalWh) const; + std::vector getWarehousesForTrading(const nobBaseWarehouse& goalWh) const; /// Send wares to warehouse wh void Trade(nobBaseWarehouse* goalWh, const boost_variant2& what, unsigned count) const; void EnableBuilding(BuildingType type) { building_enabled[type] = true; } void DisableBuilding(BuildingType type) { building_enabled[type] = false; } - bool IsBuildingEnabled(BuildingType type) const; + bool isBuildingEnabled(BuildingType type) const; /// Set the area the player may have territory in /// Nothing means all is allowed. See Lua description - std::vector& GetRestrictedArea() { return restricted_area; } - const std::vector& GetRestrictedArea() const { return restricted_area; } + std::vector& getRestrictedArea() { return restricted_area; } + const std::vector& getRestrictedArea() const { return restricted_area; } void SendPostMessage(std::unique_ptr msg); /// Returns number of tools ordered for the given tool including visual orders (not yet committed) - unsigned GetToolsOrderedVisual(Tool tool) const; - unsigned GetToolsOrdered(Tool tool) const; + unsigned getToolsOrderedVisual(Tool tool) const; + unsigned getToolsOrdered(Tool tool) const; /// Changes the current visual tool order by the given amount. Return true if anything was changed (tool order is /// clamped to [0,100]) bool ChangeToolOrderVisual(Tool tool, int changeAmount) const; - unsigned GetToolPriority(Tool tool) const; + unsigned getToolPriority(Tool tool) const; /// Called when a ordered tool was finished void ToolOrderProcessed(Tool tool); /// Get a military setting. TODO: Use named type instead of index - unsigned char GetMilitarySetting(unsigned type) const { return militarySettings_[type]; } - unsigned char GetTransportPriority(GoodType ware) const { return transportPrio[ware]; } + unsigned char getMilitarySetting(unsigned type) const { return militarySettings_[type]; } + unsigned char getTransportPriority(GoodType ware) const { return transportPrio[ware]; } ////////////////////////////////////////////////////////////////////////// // Statistik-Sachen - void SetStatisticValue(StatisticType type, unsigned value); + void setStatisticValue(StatisticType type, unsigned value); void ChangeStatisticValue(StatisticType type, int change); void IncreaseMerchandiseStatistic(GoodType type); @@ -328,22 +328,22 @@ class GamePlayer : public GamePlayerInfo void CalcStatistics(); void StatisticStep(); - const Statistic& GetStatistic(StatisticTime time) const { return statistic[time]; }; - unsigned GetStatisticCurrentValue(StatisticType idx) const { return statisticCurrentData[idx]; } + const Statistic& getStatistic(StatisticTime time) const { return statistic[time]; }; + unsigned getStatisticCurrentValue(StatisticType idx) const { return statisticCurrentData[idx]; } // Stop wares restricted in emergency mode that are waiting in warehouse to be transported already - void CancelWaresForEmergencyProtocol(); + void cancelWaresForEmergencyProtocol(); // Testet ob Notfallprogramm aktiviert werden muss und tut dies dann void TestForEmergencyProgramm(); bool hasEmergency() const { return emergency; } /// Testet ob der Spieler noch mehr Katapulte bauen darf - bool CanBuildCatapult() const; + bool canBuildCatapult() const; /// For debug only - bool IsDependentFigure(const noFigure& fig); + bool isDependentFigure(const noFigure& fig); void FillVisualSettings(VisualSettings& visualSettings) const; - static BuildOrders GetStandardBuildOrder(); + static BuildOrders getStandardBuildOrder(); private: /// Access to the world diff --git a/libs/s25main/GamePlayerInfo.h b/libs/s25main/GamePlayerInfo.h index ff566d5c31..61e505f4aa 100644 --- a/libs/s25main/GamePlayerInfo.h +++ b/libs/s25main/GamePlayerInfo.h @@ -11,7 +11,7 @@ struct GamePlayerInfo : public PlayerInfo { GamePlayerInfo(unsigned playerId, const PlayerInfo& playerInfo); - unsigned GetPlayerId() const { return id; } + unsigned getPlayerId() const { return id; } bool IsDefeated() const { return isDefeated; } private: diff --git a/libs/s25main/GameSetup.cpp b/libs/s25main/GameSetup.cpp index 05022a90a5..c5f34ded2e 100644 --- a/libs/s25main/GameSetup.cpp +++ b/libs/s25main/GameSetup.cpp @@ -33,7 +33,7 @@ namespace { void removeLeatherAddonDistributions(Game& game, unsigned localPlayerId) { VisualSettings settings; - game.world_.GetPlayer(localPlayerId).FillVisualSettings(settings); + game.world_.getPlayer(localPlayerId).FillVisualSettings(settings); Distributions newDistributions = settings.distribution; unsigned idx = 0; @@ -49,7 +49,7 @@ void removeLeatherAddonDistributions(Game& game, unsigned localPlayerId) } } // namespace -void SetupGameWorld(Game& game, const MapInfo& mapInfo, ILocalGameState& localGameState, const Replay* replay) +void setupGameWorld(Game& game, const MapInfo& mapInfo, ILocalGameState& localGameState, const Replay* replay) { GameWorld& gameWorld = game.world_; if(mapInfo.savegame) @@ -92,12 +92,12 @@ void SetupGameWorld(Game& game, const MapInfo& mapInfo, ILocalGameState& localGa if(!luaFilePath.empty() && !loader.LoadLuaScript(game, localGameState, luaFilePath)) throw GameSetupError("Could not load the Lua script " + luaFilePath.string()); - MapLoader::SetupResources(gameWorld, !replay || replay->usesFishFix()); + MapLoader::setupResources(gameWorld, !replay || replay->usesFishFix()); } if(replay) - gameWorld.SetReplayCompatVersion(replay->GetMinorVersion()); + gameWorld.setReplayCompatVersion(replay->getMinorVersion()); gameWorld.InitAfterLoad(); - if(replay && !mapInfo.savegame && replay->GetMinorVersion() < 2) - removeLeatherAddonDistributions(game, localGameState.GetPlayerId()); + if(replay && !mapInfo.savegame && replay->getMinorVersion() < 2) + removeLeatherAddonDistributions(game, localGameState.getPlayerId()); } diff --git a/libs/s25main/GameSetup.h b/libs/s25main/GameSetup.h index 140dbb03b1..36cb0977d9 100644 --- a/libs/s25main/GameSetup.h +++ b/libs/s25main/GameSetup.h @@ -23,4 +23,4 @@ struct GameSetupError : std::runtime_error /// the way the version they were recorded with did it. /// Throws GameSetupError if the map or Lua script could not be read, SerializedGameData::Error if the savegame is /// corrupt. -void SetupGameWorld(Game& game, const MapInfo& mapInfo, ILocalGameState& localGameState, const Replay* replay); +void setupGameWorld(Game& game, const MapInfo& mapInfo, ILocalGameState& localGameState, const Replay* replay); diff --git a/libs/s25main/GlobalGameSettings.cpp b/libs/s25main/GlobalGameSettings.cpp index d7262df075..bcede8c845 100644 --- a/libs/s25main/GlobalGameSettings.cpp +++ b/libs/s25main/GlobalGameSettings.cpp @@ -310,8 +310,8 @@ void GlobalGameSettings::applyLegacyInexhaustibleMines() { for(const BuildingType mineType : MINE_BUILDING_TYPES) { - if(GetMineResourceBehavior(*this, mineType) == MineResourceBehavior::Default) - setSelection(GetMineResourceBehaviorAddonId(mineType), + if(getMineResourceBehavior(*this, mineType) == MineResourceBehavior::Default) + setSelection(getMineResourceBehaviorAddonId(mineType), static_cast(MineResourceBehavior::Inexhaustible)); } } @@ -325,13 +325,13 @@ void GlobalGameSettings::setSelection(AddonId id, unsigned selection) addon->status = selection; } -unsigned GlobalGameSettings::GetMaxMilitaryRank() const +unsigned GlobalGameSettings::getMaxMilitaryRank() const { unsigned selection = getSelection(AddonId::MAX_RANK); RTTR_Assert(selection <= MAX_MILITARY_RANK); return MAX_MILITARY_RANK - selection; } -unsigned GlobalGameSettings::GetNumScoutsExpedition() const +unsigned GlobalGameSettings::getNumScoutsExpedition() const { unsigned selection = getSelection(AddonId::NUM_SCOUTS_EXPLORATION); return selection + 1; diff --git a/libs/s25main/GlobalGameSettings.h b/libs/s25main/GlobalGameSettings.h index d471b94e5a..92d7cb681d 100644 --- a/libs/s25main/GlobalGameSettings.h +++ b/libs/s25main/GlobalGameSettings.h @@ -60,9 +60,9 @@ class GlobalGameSettings /// Get current maximum rank for soldiers /// 0 = Private, 1 = Private First Class, ... - unsigned GetMaxMilitaryRank() const; + unsigned getMaxMilitaryRank() const; /// Returns number of scouts required for exploration expeditions - unsigned GetNumScoutsExpedition() const; + unsigned getNumScoutsExpedition() const; private: struct AddonWithState diff --git a/libs/s25main/HeadlessReplay.cpp b/libs/s25main/HeadlessReplay.cpp index 6b0458e148..5fbfba8e56 100644 --- a/libs/s25main/HeadlessReplay.cpp +++ b/libs/s25main/HeadlessReplay.cpp @@ -19,25 +19,25 @@ HeadlessReplay::HeadlessReplay(const boost::filesystem::path& replayPath) if(!replay_.LoadHeader(replayPath) || !replay_.LoadGameData(mapInfo_)) { const std::string reason = - replay_.GetLastErrorMsg().empty() ? std::string("Unknown error") : replay_.GetLastErrorMsg(); + replay_.getLastErrorMsg().empty() ? std::string("Unknown error") : replay_.getLastErrorMsg(); throw std::runtime_error("Could not load replay " + replayPath.string() + ": " + reason); } std::vector players; - players.reserve(replay_.GetNumPlayers()); - for(unsigned i = 0; i < replay_.GetNumPlayers(); ++i) - players.emplace_back(replay_.GetPlayer(i)); + players.reserve(replay_.getNumPlayers()); + for(unsigned i = 0; i < replay_.getNumPlayers(); ++i) + players.emplace_back(replay_.getPlayer(i)); startGF_ = mapInfo_.savegame ? mapInfo_.savegame->start_gf : 0; RANDOM.Init(replay_.getSeed()); AI::getRandomGenerator().seed(replay_.getSeed()); game_ = std::make_unique(replay_.ggs, startGF_, players); - SetupGameWorld(*game_, mapInfo_, localGameState_, &replay_); + setupGameWorld(*game_, mapInfo_, localGameState_, &replay_); // A script writing to stdout would corrupt whatever the caller prints - if(game_->world_.HasLua()) - game_->world_.GetLua().setSuppressStdout(true); + if(game_->world_.hasLua()) + game_->world_.getLua().setSuppressStdout(true); game_->Start(isFromSavegame()); nextGF_ = replay_.ReadGF(); @@ -52,13 +52,13 @@ const GameWorld& HeadlessReplay::getWorld() const unsigned HeadlessReplay::getCurrentGF() const { - return game_->em_->GetCurrentGF(); + return game_->em_->getCurrentGF(); } bool HeadlessReplay::RunGF() { const unsigned curGF = getCurrentGF(); - if(desync_ || curGF > replay_.GetLastGF()) + if(desync_ || curGF > replay_.getLastGF()) return false; if(nextGF_ && *nextGF_ < curGF) { @@ -72,7 +72,7 @@ bool HeadlessReplay::RunGF() if(desync_) return false; game_->RunGF(); - return getCurrentGF() <= replay_.GetLastGF(); + return getCurrentGF() <= replay_.getLastGF(); } bool HeadlessReplay::Run(const std::function& onGameFrame) diff --git a/libs/s25main/ILocalGameState.h b/libs/s25main/ILocalGameState.h index a880e1ba72..908fa40d5e 100644 --- a/libs/s25main/ILocalGameState.h +++ b/libs/s25main/ILocalGameState.h @@ -10,9 +10,9 @@ class ILocalGameState { public: /// Get the local player id - virtual unsigned GetPlayerId() const = 0; + virtual unsigned getPlayerId() const = 0; /// Return true if the local player is the host - virtual bool IsHost() const = 0; + virtual bool isHost() const = 0; /// Convert a number of GameFrames into real time (HH:MM:SS or MM:SS if hours = 0) virtual std::string FormatGFTime(unsigned numGFs) const = 0; /// Send a chat message to the local player @@ -22,8 +22,8 @@ class ILocalGameState /// For headless contexts: acts as the host playing as player 0 and discards all output. struct NullLocalGameState : ILocalGameState { - unsigned GetPlayerId() const override { return 0; } - bool IsHost() const override { return true; } + unsigned getPlayerId() const override { return 0; } + bool isHost() const override { return true; } std::string FormatGFTime(unsigned) const override { return ""; } void SystemChat(const std::string&) override {} }; diff --git a/libs/s25main/IngameMinimap.cpp b/libs/s25main/IngameMinimap.cpp index e2ffd7842c..a48fa861c4 100644 --- a/libs/s25main/IngameMinimap.cpp +++ b/libs/s25main/IngameMinimap.cpp @@ -13,8 +13,8 @@ #include "libsiedler2/ColorBGRA.h" IngameMinimap::IngameMinimap(const GameWorldViewer& gwv) - : Minimap(gwv.GetWorld().GetSize()), gwv(gwv), nodes_updated(GetMapSize().x * GetMapSize().y, false), - dos(GetMapSize().x * GetMapSize().y, DrawnObject::Invalid), territory(true), houses(true), roads(true) + : Minimap(gwv.getWorld().getSize()), gwv(gwv), nodes_updated(getMapSize().x * getMapSize().y, false), + dos(getMapSize().x * getMapSize().y, DrawnObject::Invalid), territory(true), houses(true), roads(true) { CreateMapTexture(); } @@ -23,11 +23,11 @@ unsigned IngameMinimap::CalcPixelColor(const MapPoint pt, const unsigned t) { unsigned color = 0; - Visibility visibility = gwv.GetVisibility(pt); + Visibility visibility = gwv.getVisibility(pt); if(visibility == Visibility::Invisible) { - dos[GetMMIdx(pt)] = DrawnObject::Invisible; + dos[getMMIdx(pt)] = DrawnObject::Invisible; // Man sieht nichts --> schwarz return 0xFF000000; } else @@ -41,16 +41,16 @@ unsigned IngameMinimap::CalcPixelColor(const MapPoint pt, const unsigned t) FoW_Type fot = FoW_Type::Nothing; if(!fow) { - const MapNode& node = gwv.GetNode(pt); + const MapNode& node = gwv.getNode(pt); owner = node.owner; if(node.obj) - noType = node.obj->GetType(); + noType = node.obj->getType(); } else { - const FoWNode& node = gwv.GetYoungestFOWNode(pt); + const FoWNode& node = gwv.getYoungestFOWNode(pt); owner = node.owner; if(node.object) - fot = node.object->GetType(); + fot = node.object->getType(); } // Baum an dieser Stelle? @@ -90,7 +90,7 @@ unsigned IngameMinimap::CalcPixelColor(const MapPoint pt, const unsigned t) || (fow && (fot == FoW_Type::Building || fot == FoW_Type::Buildingsite)))) drawn_object = DrawnObject::Buidling; /// Roads? - else if(IsRoad(pt, visibility)) + else if(isRoad(pt, visibility)) drawn_object = DrawnObject::Road; // ansonsten normales Territorium? else @@ -120,7 +120,7 @@ unsigned IngameMinimap::CalcPixelColor(const MapPoint pt, const unsigned t) if(fow) color = MakeColor(0xFF, GetRed(color) / 2, GetGreen(color) / 2, GetBlue(color) / 2); - dos[GetMMIdx(pt)] = drawn_object; + dos[getMMIdx(pt)] = drawn_object; } return color; @@ -132,10 +132,10 @@ unsigned IngameMinimap::CalcPixelColor(const MapPoint pt, const unsigned t) unsigned IngameMinimap::CalcTerrainColor(const MapPoint pt, const unsigned t) { unsigned color = - gwv.GetWorld().GetDescription().get((t == 0) ? gwv.GetNode(pt).t1 : gwv.GetNode(pt).t2).minimapColor; //-V807 + gwv.getWorld().getDescription().get((t == 0) ? gwv.getNode(pt).t1 : gwv.getNode(pt).t2).minimapColor; //-V807 // Schattierung - int shadow = gwv.GetNode(pt).shadow; + int shadow = gwv.getNode(pt).shadow; int r = GetRed(color) + shadow - 0x40; int g = GetGreen(color) + shadow - 0x40; int b = GetBlue(color) + shadow - 0x40; @@ -159,11 +159,11 @@ unsigned IngameMinimap::CalcTerrainColor(const MapPoint pt, const unsigned t) /** * Check if there is a road at that point */ -bool IngameMinimap::IsRoad(const MapPoint pt, const Visibility visibility) +bool IngameMinimap::isRoad(const MapPoint pt, const Visibility visibility) { for(const auto dir : helpers::EnumRange{}) { - if(gwv.GetVisibleRoad(pt, dir, visibility) != PointRoad::None) + if(gwv.getVisibleRoad(pt, dir, visibility) != PointRoad::None) return true; } @@ -177,7 +177,7 @@ bool IngameMinimap::IsRoad(const MapPoint pt, const Visibility visibility) unsigned IngameMinimap::CombineWithPlayerColor(const unsigned color, const unsigned char player) const { // Spielerfarbe mit einberechnen - unsigned player_color = gwv.GetWorld().GetPlayer(player - 1).color; + unsigned player_color = gwv.getWorld().getPlayer(player - 1).color; return MakeColor(0xFF, (GetRed(color) + GetRed(player_color)) / 2, (GetGreen(color) + GetGreen(player_color)) / 2, (GetBlue(color) + GetBlue(player_color)) / 2); @@ -185,9 +185,9 @@ unsigned IngameMinimap::CombineWithPlayerColor(const unsigned color, const unsig void IngameMinimap::UpdateNode(const MapPoint pt) { - if(!nodes_updated[GetMMIdx(pt)]) + if(!nodes_updated[getMMIdx(pt)]) { - nodes_updated[GetMMIdx(pt)] = true; + nodes_updated[getMMIdx(pt)] = true; nodesToUpdate.push_back(pt); } } @@ -217,10 +217,10 @@ void IngameMinimap::BeforeDrawing() for(unsigned t = 0; t < 2; ++t) { unsigned color = CalcPixelColor(it, t); - DrawPoint texPos((it.x * 2 + t + (it.y & 1)) % (GetMapSize().x * 2), it.y); + DrawPoint texPos((it.x * 2 + t + (it.y & 1)) % (getMapSize().x * 2), it.y); map.updatePixel(texPos, libsiedler2::ColorBGRA(color)); } - nodes_updated[GetMMIdx(it)] = false; + nodes_updated[getMMIdx(it)] = false; } map.endUpdate(); } @@ -245,18 +245,18 @@ void IngameMinimap::UpdateAll(const DrawnObject drawn_object) { map.beginUpdate(); // Gesamte Karte neu berechnen - RTTR_FOREACH_PT(MapPoint, GetMapSize()) + RTTR_FOREACH_PT(MapPoint, getMapSize()) { for(unsigned t = 0; t < 2; ++t) { - if(dos[GetMMIdx(pt)] == drawn_object + if(dos[getMMIdx(pt)] == drawn_object || (drawn_object == DrawnObject::Player && // for DrawnObject::Player check for not drawn buildings or // roads as there is only the player territory visible - ((dos[GetMMIdx(pt)] == DrawnObject::Buidling && !houses) - || (dos[GetMMIdx(pt)] == DrawnObject::Road && !roads)))) + ((dos[getMMIdx(pt)] == DrawnObject::Buidling && !houses) + || (dos[getMMIdx(pt)] == DrawnObject::Road && !roads)))) { unsigned color = CalcPixelColor(pt, t); - DrawPoint texPos((pt.x * 2 + t + (pt.y & 1)) % (GetMapSize().x * 2), pt.y); + DrawPoint texPos((pt.x * 2 + t + (pt.y & 1)) % (getMapSize().x * 2), pt.y); map.updatePixel(texPos, libsiedler2::ColorBGRA(color)); } } diff --git a/libs/s25main/IngameMinimap.h b/libs/s25main/IngameMinimap.h index ce5005962b..aadccdb890 100644 --- a/libs/s25main/IngameMinimap.h +++ b/libs/s25main/IngameMinimap.h @@ -58,7 +58,7 @@ class IngameMinimap : public Minimap /// Berechnet für einen bestimmten Punkt und ein Dreieck die normale Terrainfarbe unsigned CalcTerrainColor(MapPoint pt, unsigned t); /// Prüft ob an einer Stelle eine Straße gezeichnet werden muss - bool IsRoad(MapPoint pt, Visibility visibility); + bool isRoad(MapPoint pt, Visibility visibility); /// Berechnet Spielerfarbe mit in eine gegebene Farbe mit ein (player muss mit +1 gegeben sein!) unsigned CombineWithPlayerColor(unsigned color, unsigned char player) const; /// Zusätzliche Dinge, die die einzelnen Maps vor dem Zeichenvorgang zu tun haben diff --git a/libs/s25main/JoinPlayerInfo.cpp b/libs/s25main/JoinPlayerInfo.cpp index 01dc2b2bc6..f1f9ba446b 100644 --- a/libs/s25main/JoinPlayerInfo.cpp +++ b/libs/s25main/JoinPlayerInfo.cpp @@ -38,7 +38,7 @@ void JoinPlayerInfo::FixSwappedSaveSlot(JoinPlayerInfo& other) swap(team, other.team); } -void JoinPlayerInfo::SetAIName(unsigned playerId) +void JoinPlayerInfo::setAIName(unsigned playerId) { RTTR_Assert(ps == PlayerState::AI); name = MakeAIName(aiInfo, playerId); diff --git a/libs/s25main/JoinPlayerInfo.h b/libs/s25main/JoinPlayerInfo.h index 963a99609b..1d9db3f7c5 100644 --- a/libs/s25main/JoinPlayerInfo.h +++ b/libs/s25main/JoinPlayerInfo.h @@ -20,7 +20,7 @@ struct JoinPlayerInfo : public PlayerInfo // Serialize complete struct void Serialize(Serializer& ser) const; - void SetAIName(unsigned playerId); + void setAIName(unsigned playerId); // Recovers fixed data in savegames after player slots are swapped void FixSwappedSaveSlot(JoinPlayerInfo& other); diff --git a/libs/s25main/LeatherLoader.cpp b/libs/s25main/LeatherLoader.cpp index 7f2a610534..e99da84672 100644 --- a/libs/s25main/LeatherLoader.cpp +++ b/libs/s25main/LeatherLoader.cpp @@ -18,54 +18,54 @@ helpers::EnumArray bobIndex = {0, 21, 69, 117, 125, 173, 484, 532, 580, 628, 629, 630, 630, 631, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 641, 642, 643}; -ITexture* GetWareTex(const GoodType good) +ITexture* getWareTex(const GoodType good) { switch(good) { - case GoodType::Skins: return LOADER.GetImageN("leather_bobs", bobIndex[BobType::SkinsWareIcon]); - case GoodType::Leather: return LOADER.GetImageN("leather_bobs", bobIndex[BobType::LeatherWareIcon]); - case GoodType::Armor: return LOADER.GetImageN("leather_bobs", bobIndex[BobType::ArmorWareIcon]); + case GoodType::Skins: return LOADER.getImageN("leather_bobs", bobIndex[BobType::SkinsWareIcon]); + case GoodType::Leather: return LOADER.getImageN("leather_bobs", bobIndex[BobType::LeatherWareIcon]); + case GoodType::Armor: return LOADER.getImageN("leather_bobs", bobIndex[BobType::ArmorWareIcon]); default: return nullptr; } } -ITexture* GetWareStackTex(const GoodType good) +ITexture* getWareStackTex(const GoodType good) { switch(good) { - case GoodType::Skins: return LOADER.GetImageN("leather_bobs", bobIndex[BobType::SkinsWareOnGroundOfFlag]); - case GoodType::Leather: return LOADER.GetImageN("leather_bobs", bobIndex[BobType::LeatherWareOnGroundOfFlag]); - case GoodType::Armor: return LOADER.GetImageN("leather_bobs", bobIndex[BobType::ArmorWareOnGroundOfFlag]); + case GoodType::Skins: return LOADER.getImageN("leather_bobs", bobIndex[BobType::SkinsWareOnGroundOfFlag]); + case GoodType::Leather: return LOADER.getImageN("leather_bobs", bobIndex[BobType::LeatherWareOnGroundOfFlag]); + case GoodType::Armor: return LOADER.getImageN("leather_bobs", bobIndex[BobType::ArmorWareOnGroundOfFlag]); default: return nullptr; } } -ITexture* GetWareDonkeyTex(const GoodType good) +ITexture* getWareDonkeyTex(const GoodType good) { switch(good) { - case GoodType::Skins: return LOADER.GetImageN("leather_bobs", bobIndex[BobType::DonkeyBoatCarryingSkinsWare]); + case GoodType::Skins: return LOADER.getImageN("leather_bobs", bobIndex[BobType::DonkeyBoatCarryingSkinsWare]); case GoodType::Leather: - return LOADER.GetImageN("leather_bobs", bobIndex[BobType::DonkeyBoatCarryingLeatherWare]); - case GoodType::Armor: return LOADER.GetImageN("leather_bobs", bobIndex[BobType::DonkeyBoatCarryingArmorWare]); + return LOADER.getImageN("leather_bobs", bobIndex[BobType::DonkeyBoatCarryingLeatherWare]); + case GoodType::Armor: return LOADER.getImageN("leather_bobs", bobIndex[BobType::DonkeyBoatCarryingArmorWare]); default: return nullptr; } } -ITexture* GetJobTex(Job job) +ITexture* getJobTex(Job job) { switch(job) { - case Job::Skinner: return LOADER.GetImageN("leather_bobs", bobIndex[BobType::SkinnerJobIcon]); - case Job::Tanner: return LOADER.GetImageN("leather_bobs", bobIndex[BobType::TannerJobIcon]); - case Job::LeatherWorker: return LOADER.GetImageN("leather_bobs", bobIndex[BobType::LeatherworkerJobIcon]); + case Job::Skinner: return LOADER.getImageN("leather_bobs", bobIndex[BobType::SkinnerJobIcon]); + case Job::Tanner: return LOADER.getImageN("leather_bobs", bobIndex[BobType::TannerJobIcon]); + case Job::LeatherWorker: return LOADER.getImageN("leather_bobs", bobIndex[BobType::LeatherworkerJobIcon]); default: return nullptr; } } bool isAddonActive(const GameWorldBase& gwb) { - return gwb.GetGGS().isEnabled(AddonId::LEATHER); + return gwb.getGGS().isEnabled(AddonId::LEATHER); } BobType wareToCarrierBobIndex(const GoodType good, const bool fat) diff --git a/libs/s25main/LeatherLoader.h b/libs/s25main/LeatherLoader.h index 7b65576a27..2803eeda9c 100644 --- a/libs/s25main/LeatherLoader.h +++ b/libs/s25main/LeatherLoader.h @@ -77,10 +77,10 @@ constexpr auto maxEnumValue(BobType) extern helpers::EnumArray bobIndex; -ITexture* GetWareTex(GoodType good); -ITexture* GetWareStackTex(GoodType good); -ITexture* GetWareDonkeyTex(GoodType good); -ITexture* GetJobTex(Job job); +ITexture* getWareTex(GoodType good); +ITexture* getWareStackTex(GoodType good); +ITexture* getWareDonkeyTex(GoodType good); +ITexture* getJobTex(Job job); bool isAddonActive(const GameWorldBase& gwb); BobType wareToCarrierBobIndex(GoodType good, bool fat); diff --git a/libs/s25main/Loader.cpp b/libs/s25main/Loader.cpp index b0502b7730..6ff0686e94 100644 --- a/libs/s25main/Loader.cpp +++ b/libs/s25main/Loader.cpp @@ -87,143 +87,143 @@ void Loader::initResourceFolders(const std::vector& usedNations, const s addDefaultResourceFolders(config_, *archiveLocator_, usedNations, enabledAddons); } -glArchivItem_Bitmap* Loader::GetImageN(const ResourceId& file, unsigned nr) +glArchivItem_Bitmap* Loader::getImageN(const ResourceId& file, unsigned nr) { return convertChecked(files_[file].archive[nr]); } -ITexture* Loader::GetTextureN(const ResourceId& file, unsigned nr) +ITexture* Loader::getTextureN(const ResourceId& file, unsigned nr) { return convertChecked(files_[file].archive[nr]); } -glArchivItem_Bitmap* Loader::GetImage(const ResourceId& file, const std::string& name) +glArchivItem_Bitmap* Loader::getImage(const ResourceId& file, const std::string& name) { return convertChecked(files_[file].archive.find(name)); } -glArchivItem_Bitmap_Player* Loader::GetPlayerImage(const ResourceId& file, unsigned nr) +glArchivItem_Bitmap_Player* Loader::getPlayerImage(const ResourceId& file, unsigned nr) { return convertChecked(files_[file].archive[nr]); } -glFont* Loader::GetFont(FontSize size) +glFont* Loader::getFont(FontSize size) { return fonts.empty() ? nullptr : &fonts[static_cast(size)]; } -libsiedler2::ArchivItem_Palette* Loader::GetPaletteN(const ResourceId& file, unsigned nr) +libsiedler2::ArchivItem_Palette* Loader::getPaletteN(const ResourceId& file, unsigned nr) { return dynamic_cast(files_[file].archive[nr]); } -SoundEffectItem* Loader::GetSoundN(const ResourceId& file, unsigned nr) +SoundEffectItem* Loader::getSoundN(const ResourceId& file, unsigned nr) { return dynamic_cast(files_[file].archive[nr]); } -std::string Loader::GetTextN(const ResourceId& file, unsigned nr) +std::string Loader::getTextN(const ResourceId& file, unsigned nr) { auto* archive = dynamic_cast(files_[file].archive[nr]); return archive ? archive->getText() : "text missing"; } -libsiedler2::Archiv& Loader::GetArchive(const ResourceId& file) +libsiedler2::Archiv& Loader::getArchive(const ResourceId& file) { RTTR_Assert(helpers::contains(files_, file)); return files_[file].archive; } -glArchivItem_Bob* Loader::GetBob(const ResourceId& file) +glArchivItem_Bob* Loader::getBob(const ResourceId& file) { return dynamic_cast(files_[file].archive.get(0)); } -glArchivItem_BitmapBase* Loader::GetNationImageN(Nation nation, unsigned nr) +glArchivItem_BitmapBase* Loader::getNationImageN(Nation nation, unsigned nr) { return dynamic_cast(nation_gfx[nation]->get(nr)); } -glArchivItem_Bitmap* Loader::GetNationImage(Nation nation, unsigned nr) +glArchivItem_Bitmap* Loader::getNationImage(Nation nation, unsigned nr) { - return checkedCast(GetNationImageN(nation, nr)); + return checkedCast(getNationImageN(nation, nr)); } -glArchivItem_Bitmap* Loader::GetNationIcon(Nation nation, BuildingType bld) +glArchivItem_Bitmap* Loader::getNationIcon(Nation nation, BuildingType bld) { if(bld == BuildingType::Charburner) - return LOADER.GetImageN("charburner", rttr::enum_cast(nation) * 8 + 8); + return LOADER.getImageN("charburner", rttr::enum_cast(nation) * 8 + 8); else return convertChecked(nationIcons_[nation]->get(rttr::enum_cast(bld))); } -ITexture* Loader::GetBuildingTex(Nation nation, BuildingType bld) +ITexture* Loader::getBuildingTex(Nation nation, BuildingType bld) { if(bld == BuildingType::Charburner) { unsigned id = rttr::enum_cast(nation) * 8; - return GetImageN("charburner", id + (isWinterGFX_ ? 6 : 1)); + return getImageN("charburner", id + (isWinterGFX_ ? 6 : 1)); } else - return checkedCast(GetNationImage(nation, 250 + rttr::enum_cast(bld) * 5)); + return checkedCast(getNationImage(nation, 250 + rttr::enum_cast(bld) * 5)); return nullptr; } -glArchivItem_Bitmap_Player* Loader::GetNationPlayerImage(Nation nation, unsigned nr) +glArchivItem_Bitmap_Player* Loader::getNationPlayerImage(Nation nation, unsigned nr) { - return checkedCast(GetNationImageN(nation, nr)); + return checkedCast(getNationImageN(nation, nr)); } -glArchivItem_Bitmap* Loader::GetMapImage(unsigned nr) +glArchivItem_Bitmap* Loader::getMapImage(unsigned nr) { return convertChecked(map_gfx->get(nr)); } -ITexture* Loader::GetMapTexture(unsigned nr) +ITexture* Loader::getMapTexture(unsigned nr) { return convertChecked(map_gfx->get(nr)); } -ITexture* Loader::GetWareTex(GoodType ware) +ITexture* Loader::getWareTex(GoodType ware) { if(wineaddon::isWineAddonGoodType(ware)) - return wineaddon::GetWareTex(ware); + return wineaddon::getWareTex(ware); else if(leatheraddon::isLeatherAddonGoodType(ware)) - return leatheraddon::GetWareTex(ware); + return leatheraddon::getWareTex(ware); else - return GetMapTexture(WARES_TEX_MAP_OFFSET + rttr::enum_cast(ware)); + return getMapTexture(WARES_TEX_MAP_OFFSET + rttr::enum_cast(ware)); } -ITexture* Loader::GetWareStackTex(GoodType ware) +ITexture* Loader::getWareStackTex(GoodType ware) { if(wineaddon::isWineAddonGoodType(ware)) - return wineaddon::GetWareStackTex(ware); + return wineaddon::getWareStackTex(ware); else if(leatheraddon::isLeatherAddonGoodType(ware)) - return leatheraddon::GetWareStackTex(ware); + return leatheraddon::getWareStackTex(ware); else - return GetMapTexture(WARE_STACK_TEX_MAP_OFFSET + rttr::enum_cast(ware)); + return getMapTexture(WARE_STACK_TEX_MAP_OFFSET + rttr::enum_cast(ware)); } -ITexture* Loader::GetWareDonkeyTex(GoodType ware) +ITexture* Loader::getWareDonkeyTex(GoodType ware) { if(wineaddon::isWineAddonGoodType(ware)) - return wineaddon::GetWareDonkeyTex(ware); + return wineaddon::getWareDonkeyTex(ware); if(leatheraddon::isLeatherAddonGoodType(ware)) - return leatheraddon::GetWareDonkeyTex(ware); + return leatheraddon::getWareDonkeyTex(ware); else - return GetMapTexture(WARES_DONKEY_TEX_MAP_OFFSET + rttr::enum_cast(ware)); + return getMapTexture(WARES_DONKEY_TEX_MAP_OFFSET + rttr::enum_cast(ware)); } -ITexture* Loader::GetJobTex(Job job) +ITexture* Loader::getJobTex(Job job) { if(wineaddon::isWineAddonJobType(job)) - return wineaddon::GetJobTex(job); + return wineaddon::getJobTex(job); else if(leatheraddon::isLeatherAddonJobType(job)) - return leatheraddon::GetJobTex(job); + return leatheraddon::getJobTex(job); else - return (job == Job::CharBurner) ? GetTextureN("io_new", 5) : GetMapTexture(2300 + rttr::enum_cast(job)); + return (job == Job::CharBurner) ? getTextureN("io_new", 5) : getMapTexture(2300 + rttr::enum_cast(job)); } -glArchivItem_Bitmap_Player* Loader::GetMapPlayerImage(unsigned nr) +glArchivItem_Bitmap_Player* Loader::getMapPlayerImage(unsigned nr) { return convertChecked(map_gfx->get(nr)); } @@ -276,7 +276,7 @@ bool Loader::LoadSounds() logger_.write(_("Starting sound conversion: ")); try { - convertSounds(GetArchive("sound"), config_.ExpandPath(s25::files::soundScript)); + convertSounds(getArchive("sound"), config_.ExpandPath(s25::files::soundScript)); } catch(const std::runtime_error& e) { logger_.write(_("failed: %1%\n")) % e.what(); @@ -317,10 +317,10 @@ bool Loader::LoadSounds() bool Loader::LoadFonts() { - if(!Load(ResourceId("fonts"), GetPaletteN("pal5"))) + if(!Load(ResourceId("fonts"), getPaletteN("pal5"))) return false; fonts.clear(); - const auto& loadedFonts = GetArchive("fonts"); + const auto& loadedFonts = getArchive("fonts"); for(const auto i : helpers::enumRange()) { const auto* curFont = dynamic_cast(loadedFonts[rttr::enum_cast(i)]); @@ -381,7 +381,7 @@ void Loader::LoadDummyGUIFiles() io_new.push(std::move(bmp)); } // Fonts - auto* palette = GetPaletteN("colors"); + auto* palette = getPaletteN("colors"); libsiedler2::PixelBufferBGRA buffer(15, 16); for(const auto i : helpers::enumRange()) { @@ -508,7 +508,7 @@ bool Loader::LoadFilesAtGame(const std::string& mapGfxPath, bool isWinterGFX, co res::boot_z, res::mis0bobs, res::mis1bobs, res::mis2bobs, res::mis3bobs, res::mis4bobs, res::mis5bobs}; - const libsiedler2::ArchivItem_Palette* pal5 = GetPaletteN("pal5"); + const libsiedler2::ArchivItem_Palette* pal5 = getPaletteN("pal5"); if(!LoadFiles(files) || !Load(ResourceId("map_new"), pal5)) return false; @@ -537,7 +537,7 @@ bool Loader::LoadFilesAtGame(const std::string& mapGfxPath, bool isWinterGFX, co const bfs::path mapGFXFile = config_.ExpandPath(mapGfxPath); if(!Load(mapGFXFile, pal5)) return false; - map_gfx = &GetArchive(ResourceId::make(mapGFXFile)); + map_gfx = &getArchive(ResourceId::make(mapGFXFile)); isWinterGFX_ = isWinterGFX; @@ -546,7 +546,7 @@ bool Loader::LoadFilesAtGame(const std::string& mapGfxPath, bool isWinterGFX, co bool Loader::LoadFiles(const std::vector& files) { - const libsiedler2::ArchivItem_Palette* pal5 = GetPaletteN("pal5"); + const libsiedler2::ArchivItem_Palette* pal5 = getPaletteN("pal5"); // load the files for(const std::string& curFile : files) { @@ -563,7 +563,7 @@ bool Loader::LoadFiles(const std::vector& files) bool Loader::LoadResources(const std::vector& resources) { - const libsiedler2::ArchivItem_Palette* pal5 = GetPaletteN("pal5"); + const libsiedler2::ArchivItem_Palette* pal5 = getPaletteN("pal5"); for(const ResourceId& curResource : resources) { if(!Load(curResource, pal5)) @@ -591,17 +591,17 @@ void Loader::fillCaches() bmp.reset(); - bmp.add(GetMapImage(ANIMALCONSTS[species].walking_id + bmp.add(getMapImage(ANIMALCONSTS[species].walking_id + ANIMALCONSTS[species].animation_steps * rttr::enum_cast(dir + 3u) + ani_step)); if(ANIMALCONSTS[species].shadow_id) { if(species == Species::Duck) // Ente Sonderfall, da gibts nur einen Schatten für jede Richtung! - bmp.addShadow(GetMapImage(ANIMALCONSTS[species].shadow_id)); + bmp.addShadow(getMapImage(ANIMALCONSTS[species].shadow_id)); else // ansonsten immer pro Richtung einen Schatten - bmp.addShadow(GetMapImage(ANIMALCONSTS[species].shadow_id + rttr::enum_cast(dir + 3u))); + bmp.addShadow(getMapImage(ANIMALCONSTS[species].shadow_id + rttr::enum_cast(dir + 3u))); } stp->add(bmp); @@ -614,18 +614,18 @@ void Loader::fillCaches() if(ANIMALCONSTS[species].dead_id) { - bmp.add(GetMapImage(ANIMALCONSTS[species].dead_id)); + bmp.add(getMapImage(ANIMALCONSTS[species].dead_id)); if(ANIMALCONSTS[species].shadow_dead_id) { - bmp.addShadow(GetMapImage(ANIMALCONSTS[species].shadow_dead_id)); + bmp.addShadow(getMapImage(ANIMALCONSTS[species].shadow_dead_id)); } stp->add(bmp); } } - glArchivItem_Bob* bob_jobs = GetBob("jobs"); + glArchivItem_Bob* bob_jobs = getBob("jobs"); if(!bob_jobs) throw std::runtime_error("jobs not found"); @@ -646,28 +646,28 @@ void Loader::fillCaches() { unsigned id = rttr::enum_cast(nation) * 8; - sprites.building.add(GetImageN("charburner", id + (isWinterGFX_ ? 6 : 1))); - sprites.building.addShadow(GetImageN("charburner", id + 2)); + sprites.building.add(getImageN("charburner", id + (isWinterGFX_ ? 6 : 1))); + sprites.building.addShadow(getImageN("charburner", id + 2)); - sprites.skeleton.add(GetImageN("charburner", id + 3)); - sprites.skeleton.addShadow(GetImageN("charburner", id + 4)); + sprites.skeleton.add(getImageN("charburner", id + 3)); + sprites.skeleton.addShadow(getImageN("charburner", id + 4)); - sprites.door.add(GetImageN("charburner", id + (isWinterGFX_ ? 7 : 5))); + sprites.door.add(getImageN("charburner", id + (isWinterGFX_ ? 7 : 5))); } else { - sprites.building.add(GetNationImage(nation, 250 + 5 * rttr::enum_cast(type))); - sprites.building.addShadow(GetNationImage(nation, 250 + 5 * rttr::enum_cast(type) + 1)); + sprites.building.add(getNationImage(nation, 250 + 5 * rttr::enum_cast(type))); + sprites.building.addShadow(getNationImage(nation, 250 + 5 * rttr::enum_cast(type) + 1)); if(type == BuildingType::Headquarters) { // HQ has no skeleton, but we have a tent that can act as an HQ - sprites.skeleton.add(GetImageN("mis0bobs", 6)); - sprites.skeleton.addShadow(GetImageN("mis0bobs", 7)); + sprites.skeleton.add(getImageN("mis0bobs", 6)); + sprites.skeleton.addShadow(getImageN("mis0bobs", 7)); } else { - sprites.skeleton.add(GetNationImage(nation, 250 + 5 * rttr::enum_cast(type) + 2)); - sprites.skeleton.addShadow(GetNationImage(nation, 250 + 5 * rttr::enum_cast(type) + 3)); + sprites.skeleton.add(getNationImage(nation, 250 + 5 * rttr::enum_cast(type) + 2)); + sprites.skeleton.addShadow(getNationImage(nation, 250 + 5 * rttr::enum_cast(type) + 3)); } - sprites.door.add(GetNationImage(nation, 250 + 5 * rttr::enum_cast(type) + 4)); + sprites.door.add(getNationImage(nation, 250 + 5 * rttr::enum_cast(type) + 4)); } stp->add(sprites.building); @@ -687,8 +687,8 @@ void Loader::fillCaches() bmp.reset(); - bmp.add(GetNationPlayerImage(nation, nr)); - bmp.addShadow(GetNationImage(nation, nr + 10)); + bmp.add(getNationPlayerImage(nation, nr)); + bmp.addShadow(getNationImage(nation, nr + 10)); stp->add(bmp); } @@ -712,7 +712,7 @@ void Loader::fillCaches() auto overlay = bob_jobs->getOverlay(spriteData.getBobId(Nation(nation)), spriteData.isFat(), imgDir, ani_step); bmp.add(dynamic_cast(overlay.first), overlay.second); - bmp.addShadow(GetMapImage(900 + static_cast(imgDir) * 8 + ani_step)); + bmp.addShadow(getMapImage(900 + static_cast(imgDir) * 8 + ani_step)); stp->add(bmp); } @@ -731,7 +731,7 @@ void Loader::fillCaches() bmp.add(dynamic_cast(bob_jobs->getBody(true, imgDir, ani_step))); auto overlay = bob_jobs->getOverlay(0, true, imgDir, ani_step); bmp.add(dynamic_cast(overlay.first), overlay.second); - bmp.addShadow(GetMapImage(900 + static_cast(imgDir) * 8 + ani_step)); + bmp.addShadow(getMapImage(900 + static_cast(imgDir) * 8 + ani_step)); stp->add(bmp); } @@ -741,13 +741,13 @@ void Loader::fillCaches() glSmartBitmap& bmp = boundary_stone_cache[nation]; bmp.reset(); - bmp.add(GetNationPlayerImage(nation, 0)); - bmp.addShadow(GetNationImage(nation, 1)); + bmp.add(getNationPlayerImage(nation, 0)); + bmp.addShadow(getNationImage(nation, 1)); stp->add(bmp); } - libsiedler2::Archiv& romBobs = GetArchive("rom_bobs"); + libsiedler2::Archiv& romBobs = getArchive("rom_bobs"); const auto getAlternative = [&romBobs](unsigned id, unsigned altId) { auto* bmp = convertChecked(romBobs[id]); return bmp ? bmp : convertChecked(romBobs[altId]); @@ -820,8 +820,8 @@ void Loader::fillCaches() bmp.reset(); - bmp.add(GetMapImage(200 + type * 15 + ani_step)); - bmp.addShadow(GetMapImage(350 + type * 15 + ani_step)); + bmp.add(getMapImage(200 + type * 15 + ani_step)); + bmp.addShadow(getMapImage(350 + type * 15 + ani_step)); stp->add(bmp); } @@ -836,8 +836,8 @@ void Loader::fillCaches() bmp.reset(); - bmp.add(GetMapImage(516 + rttr::enum_cast(type) * 6 + size)); - bmp.addShadow(GetMapImage(616 + rttr::enum_cast(type) * 6 + size)); + bmp.add(getMapImage(516 + rttr::enum_cast(type) * 6 + size)); + bmp.addShadow(getMapImage(616 + rttr::enum_cast(type) * 6 + size)); stp->add(bmp); } @@ -852,8 +852,8 @@ void Loader::fillCaches() bmp.reset(); - bmp.add(GetMapImage(532 + type * 5 + size)); - bmp.addShadow(GetMapImage(632 + type * 5 + size)); + bmp.add(getMapImage(532 + type * 5 + size)); + bmp.addShadow(getMapImage(632 + type * 5 + size)); stp->add(bmp); } @@ -868,8 +868,8 @@ void Loader::fillCaches() bmp.reset(); - bmp.add(GetMapImage(2000 + rttr::enum_cast(dir + 3u) * 8 + ani_step)); - bmp.addShadow(GetMapImage(2048 + rttr::enum_cast(dir) % 3)); + bmp.add(getMapImage(2000 + rttr::enum_cast(dir + 3u) * 8 + ani_step)); + bmp.addShadow(getMapImage(2048 + rttr::enum_cast(dir) % 3)); stp->add(bmp); } @@ -884,8 +884,8 @@ void Loader::fillCaches() bmp.reset(); - bmp.add(GetPlayerImage("boat", rttr::enum_cast(dir + 3u) * 8 + ani_step)); - bmp.addShadow(GetMapImage(2048 + rttr::enum_cast(dir) % 3)); + bmp.add(getPlayerImage("boat", rttr::enum_cast(dir + 3u) * 8 + ani_step)); + bmp.addShadow(getMapImage(2048 + rttr::enum_cast(dir) % 3)); stp->add(bmp); } @@ -894,12 +894,12 @@ void Loader::fillCaches() wineaddon::fillCache(*stp); // carrier_cache[ware][direction][animation_step][fat] - glArchivItem_Bob* bob_carrier = GetBob("carrier"); + glArchivItem_Bob* bob_carrier = getBob("carrier"); if(!bob_carrier) throw std::runtime_error("carrier not found"); - libsiedler2::Archiv& wine_bob_carrier = GetArchive("wine_bobs"); - libsiedler2::Archiv& leather_bob_carrier = GetArchive("leather_bobs"); + libsiedler2::Archiv& wine_bob_carrier = getArchive("wine_bobs"); + libsiedler2::Archiv& leather_bob_carrier = getArchive("leather_bobs"); for(bool fat : {true, false}) { @@ -944,7 +944,7 @@ void Loader::fillCaches() auto overlay = bob_carrier->getOverlay(id, fat, imgDir, ani_step); bmp.add(dynamic_cast(overlay.first), overlay.second); } - bmp.addShadow(GetMapImage(900 + static_cast(imgDir) * 8 + ani_step)); + bmp.addShadow(getMapImage(900 + static_cast(imgDir) * 8 + ani_step)); stp->add(bmp); } @@ -957,9 +957,9 @@ void Loader::fillCaches() const unsigned char start_index = 248; const unsigned char color_count = 4; - libsiedler2::ArchivItem_Palette* palette = GetPaletteN("pal5"); - auto* image = GetMapImage(561); - auto* shadow = GetMapImage(661); + libsiedler2::ArchivItem_Palette* palette = getPaletteN("pal5"); + auto* image = getMapImage(561); + auto* shadow = getMapImage(661); if((image) && (shadow) && (palette)) { diff --git a/libs/s25main/Loader.h b/libs/s25main/Loader.h index 9bd564731c..91afd82362 100644 --- a/libs/s25main/Loader.h +++ b/libs/s25main/Loader.h @@ -103,37 +103,37 @@ class Loader const Rect& rect, uint8_t start_index, uint8_t color_count); - glArchivItem_Bitmap* GetImageN(const ResourceId& file, unsigned nr); + glArchivItem_Bitmap* getImageN(const ResourceId& file, unsigned nr); /// Same as GetImageN but returns a ITexture. Note glArchivItem_Bitmap is a ITexture - ITexture* GetTextureN(const ResourceId& file, unsigned nr); - glArchivItem_Bitmap* GetImage(const ResourceId& file, const std::string& name); - glArchivItem_Bitmap_Player* GetPlayerImage(const ResourceId& file, unsigned nr); - glFont* GetFont(FontSize); - libsiedler2::ArchivItem_Palette* GetPaletteN(const ResourceId& file, unsigned nr = 0); - SoundEffectItem* GetSoundN(const ResourceId& file, unsigned nr); - std::string GetTextN(const ResourceId& file, unsigned nr); - libsiedler2::Archiv& GetArchive(const ResourceId& file); - glArchivItem_Bob* GetBob(const ResourceId& file); - glArchivItem_BitmapBase* GetNationImageN(Nation nation, unsigned nr); - glArchivItem_Bitmap* GetNationImage(Nation nation, unsigned nr); - glArchivItem_Bitmap* GetNationIcon(Nation nation, BuildingType bld); - ITexture* GetBuildingTex(Nation nation, BuildingType bld); - glArchivItem_Bitmap_Player* GetNationPlayerImage(Nation nation, unsigned nr); + ITexture* getTextureN(const ResourceId& file, unsigned nr); + glArchivItem_Bitmap* getImage(const ResourceId& file, const std::string& name); + glArchivItem_Bitmap_Player* getPlayerImage(const ResourceId& file, unsigned nr); + glFont* getFont(FontSize); + libsiedler2::ArchivItem_Palette* getPaletteN(const ResourceId& file, unsigned nr = 0); + SoundEffectItem* getSoundN(const ResourceId& file, unsigned nr); + std::string getTextN(const ResourceId& file, unsigned nr); + libsiedler2::Archiv& getArchive(const ResourceId& file); + glArchivItem_Bob* getBob(const ResourceId& file); + glArchivItem_BitmapBase* getNationImageN(Nation nation, unsigned nr); + glArchivItem_Bitmap* getNationImage(Nation nation, unsigned nr); + glArchivItem_Bitmap* getNationIcon(Nation nation, BuildingType bld); + ITexture* getBuildingTex(Nation nation, BuildingType bld); + glArchivItem_Bitmap_Player* getNationPlayerImage(Nation nation, unsigned nr); /// Return the map texture with the given number - ITexture* GetMapTexture(unsigned nr); + ITexture* getMapTexture(unsigned nr); /// Return the more specialized map image. Note: Prefer GetMapTexture which also handles (pseudo) player bitmaps - glArchivItem_Bitmap* GetMapImage(unsigned nr); + glArchivItem_Bitmap* getMapImage(unsigned nr); /// Get the ware symbol texture - ITexture* GetWareTex(GoodType ware); + ITexture* getWareTex(GoodType ware); /// Get the ware stack texture (lying on ground) - ITexture* GetWareStackTex(GoodType ware); + ITexture* getWareStackTex(GoodType ware); /// Get the ware texture when carried by donky - ITexture* GetWareDonkeyTex(GoodType ware); + ITexture* getWareDonkeyTex(GoodType ware); /// Get job symbol texture - ITexture* GetJobTex(Job job); - glArchivItem_Bitmap_Player* GetMapPlayerImage(unsigned nr); + ITexture* getJobTex(Job job); + glArchivItem_Bitmap_Player* getMapPlayerImage(unsigned nr); - bool IsWinterGFX() const { return isWinterGFX_; } + bool isWinterGFX() const { return isWinterGFX_; } std::vector> sng_lst; @@ -240,6 +240,6 @@ Loader& getGlobalLoader(); #define LOADER getGlobalLoader() // Helper macros for easy access to fonts -#define SmallFont (LOADER.GetFont(FontSize::Small)) -#define NormalFont (LOADER.GetFont(FontSize::Normal)) -#define LargeFont (LOADER.GetFont(FontSize::Large)) +#define SmallFont (LOADER.getFont(FontSize::Small)) +#define NormalFont (LOADER.getFont(FontSize::Normal)) +#define LargeFont (LOADER.getFont(FontSize::Large)) diff --git a/libs/s25main/Messenger.cpp b/libs/s25main/Messenger.cpp index b00131e2ea..2d856e0d9c 100644 --- a/libs/s25main/Messenger.cpp +++ b/libs/s25main/Messenger.cpp @@ -24,7 +24,7 @@ Messenger::~Messenger() = default; /// Zeit, die void Messenger::Draw() { - const unsigned curTime = VIDEODRIVER.GetTickCount(); + const unsigned curTime = VIDEODRIVER.getTickCount(); DrawPoint textPos(20, 100); for(auto it = messages.begin(); it != messages.end(); textPos.y += LargeFont->getHeight()) { @@ -62,10 +62,10 @@ void Messenger::AddMessage(const std::string& author, const unsigned color_autho // in Zeilen aufteilen, damit alles auf den Bildschirm passt glFont::WrapInfo wi = - LargeFont->GetWrapInfo(msg, - VIDEODRIVER.GetRenderSize().x - 60 - LargeFont->getWidth(author) + LargeFont->getWrapInfo(msg, + VIDEODRIVER.getRenderSize().x - 60 - LargeFont->getWidth(author) - ((cd == ChatDestination::System) ? 0 : LargeFont->getWidth(_(CD_STRINGS[cd]))), - VIDEODRIVER.GetRenderSize().x - 60); + VIDEODRIVER.getRenderSize().x - 60); // Message-Strings erzeugen aus den WrapInfo std::vector strings = wi.CreateSingleStrings(msg); @@ -91,7 +91,7 @@ void Messenger::AddMessage(const std::string& author, const unsigned color_autho tmp.color_author = color_author; tmp.color_msg = color_msg; - tmp.starttime = VIDEODRIVER.GetTickCount(); + tmp.starttime = VIDEODRIVER.getTickCount(); messages.push_back(tmp); } diff --git a/libs/s25main/Minimap.h b/libs/s25main/Minimap.h index acaa5fbad4..e1c46605d1 100644 --- a/libs/s25main/Minimap.h +++ b/libs/s25main/Minimap.h @@ -26,10 +26,10 @@ class Minimap void Draw(const Rect& rect); /// Gibt Größe der Map zurück - MapExtent GetMapSize() const { return mapSize; } + MapExtent getMapSize() const { return mapSize; } protected: - unsigned GetMMIdx(const MapPoint pt) const + unsigned getMMIdx(const MapPoint pt) const { return static_cast(pt.y) * mapSize.x + static_cast(pt.x); } diff --git a/libs/s25main/MusicPlayer.h b/libs/s25main/MusicPlayer.h index 5ff05cbcdc..a0f780e35c 100644 --- a/libs/s25main/MusicPlayer.h +++ b/libs/s25main/MusicPlayer.h @@ -26,8 +26,8 @@ class MusicPlayer : public Singleton GameWorldBase::FindHumanPath(const MapPoint sta unsigned* length, std::vector* route) const { Direction first_dir{}; - if(GetFreePathFinder().FindPath(start, dest, random_route, max_route, route, length, &first_dir, + if(getFreePathFinder().FindPath(start, dest, random_route, max_route, route, length, &first_dir, PathConditionHuman(*this))) return first_dir; else @@ -34,7 +34,7 @@ RoadPathDirection GameWorld::FindHumanPathOnRoads(const noRoadNode& start, const MapPoint* firstPt, const RoadSegment* const forbidden) { RoadPathDirection first_dir; - if(GetRoadPathFinder().FindPath(start, goal, false, std::numeric_limits::max(), forbidden, length, + if(getRoadPathFinder().FindPath(start, goal, false, std::numeric_limits::max(), forbidden, length, &first_dir, firstPt)) return first_dir; else @@ -46,7 +46,7 @@ RoadPathDirection GameWorld::FindPathForWareOnRoads(const noRoadNode& start, con MapPoint* firstPt, unsigned max) { RoadPathDirection first_dir; - if(GetRoadPathFinder().FindPath(start, goal, true, max, nullptr, length, &first_dir, firstPt)) + if(getRoadPathFinder().FindPath(start, goal, true, max, nullptr, length, &first_dir, firstPt)) return first_dir; else return RoadPathDirection::None; @@ -55,7 +55,7 @@ RoadPathDirection GameWorld::FindPathForWareOnRoads(const noRoadNode& start, con bool GameWorldBase::FindShipPathToHarbor(const MapPoint start, HarborId harborId, SeaId seaId, std::vector* route, unsigned* length) const { - const MapPoint coastalPoint = GetCoastalPoint(harborId, seaId); + const MapPoint coastalPoint = getCoastalPoint(harborId, seaId); RTTR_Assert(coastalPoint.isValid()); // already arrived? @@ -67,11 +67,11 @@ bool GameWorldBase::FindShipPathToHarbor(const MapPoint start, HarborId harborId route->clear(); return true; } - auto& shipPathData = GetShipPathData(); + auto& shipPathData = getShipPathData(); // If we start from a harbor we can get the route directly w/o the costly pathfinding - for(const auto startHbId : helpers::idRange(GetNumHarborPoints())) + for(const auto startHbId : helpers::idRange(getNumHarborPoints())) { - if(GetCoastalPoint(startHbId, seaId) == start) + if(getCoastalPoint(startHbId, seaId) == start) { auto hbRoute = shipPathData.getHarborConnection(startHbId, harborId, seaId); if(length) @@ -114,7 +114,7 @@ bool GameWorldBase::FindShipPathToHarbor(const MapPoint start, HarborId harborId bool GameWorldBase::FindShipPath(const MapPoint start, const MapPoint dest, unsigned maxDistance, std::vector* route, unsigned* length) const { - return GetFreePathFinder().FindPath(start, dest, true, maxDistance, route, length, nullptr, + return getFreePathFinder().FindPath(start, dest, true, maxDistance, route, length, nullptr, PathConditionShip(*this)); } @@ -122,7 +122,7 @@ bool GameWorldBase::FindShipPath(const MapPoint start, const MapPoint dest, unsi bool GameWorld::CheckShipRoute(const MapPoint start, const std::vector& route, const unsigned pos, MapPoint* dest) const { - return GetFreePathFinder().CheckRoute(start, route, pos, PathConditionShip(*this), dest); + return getFreePathFinder().CheckRoute(start, route, pos, PathConditionShip(*this), dest); } /// Find a route for trade caravanes @@ -130,17 +130,17 @@ helpers::OptionalEnum GameWorld::FindTradePath(const MapPoint start, unsigned char player, unsigned max_route, bool random_route, std::vector* route, unsigned* length) const { - unsigned char owner = GetNode(dest).owner; - if(owner != 0 && !GetPlayer(player).IsAlly(owner - 1)) + unsigned char owner = getNode(dest).owner; + if(owner != 0 && !getPlayer(player).isAlly(owner - 1)) return std::nullopt; - RTTR_Assert(GetNO(dest)->GetType() == NodalObjectType::Flag); // Goal should be the flag of a wh + RTTR_Assert(getNO(dest)->getType() == NodalObjectType::Flag); // Goal should be the flag of a wh - if(!PathConditionHuman(*this).IsNodeOk(dest)) + if(!PathConditionHuman(*this).isNodeOk(dest)) return std::nullopt; Direction first_dir{}; - if(GetFreePathFinder().FindPath(start, dest, random_route, max_route, route, length, &first_dir, + if(getFreePathFinder().FindPath(start, dest, random_route, max_route, route, length, &first_dir, PathConditionTrade(*this, player))) return first_dir; else @@ -150,5 +150,5 @@ helpers::OptionalEnum GameWorld::FindTradePath(const MapPoint start, bool GameWorld::CheckTradeRoute(const MapPoint start, const std::vector& route, unsigned pos, unsigned char player, MapPoint* dest) const { - return GetFreePathFinder().CheckRoute(start, route, pos, PathConditionTrade(*this, player), dest); + return getFreePathFinder().CheckRoute(start, route, pos, PathConditionTrade(*this, player), dest); } diff --git a/libs/s25main/Playlist.cpp b/libs/s25main/Playlist.cpp index d78d65254d..ae82e22637 100644 --- a/libs/s25main/Playlist.cpp +++ b/libs/s25main/Playlist.cpp @@ -86,7 +86,7 @@ bool Playlist::Load(Log& logger, const boost::filesystem::path& filepath) return in.eof(); } -void Playlist::SetStartSong(const unsigned id) +void Playlist::setStartSong(const unsigned id) { if(order_.empty()) Prepare(); diff --git a/libs/s25main/Playlist.h b/libs/s25main/Playlist.h index 680693e41e..d8d3666b0c 100644 --- a/libs/s25main/Playlist.h +++ b/libs/s25main/Playlist.h @@ -38,7 +38,7 @@ class Playlist /// Moves the song with the given index (in the songs_ array) to the front of the list of songs to be played /// Has no effect if the song is not in the queue (anymore), e.g. if it was already played - void SetStartSong(unsigned id); + void setStartSong(unsigned id); private: /// Get the playlist ready for playing diff --git a/libs/s25main/PreviewMinimap.cpp b/libs/s25main/PreviewMinimap.cpp index 360ad9d0d9..8481f7949b 100644 --- a/libs/s25main/PreviewMinimap.cpp +++ b/libs/s25main/PreviewMinimap.cpp @@ -18,10 +18,10 @@ PreviewMinimap::PreviewMinimap(const libsiedler2::ArchivItem_Map* const s2map) { if(s2map) - SetMap(*s2map); + setMap(*s2map); } -void PreviewMinimap::SetMap(const libsiedler2::ArchivItem_Map& s2map) +void PreviewMinimap::setMap(const libsiedler2::ArchivItem_Map& s2map) { const libsiedler2::ArchivItem_Map_Header& header = s2map.getHeader(); mapSize.x = header.getWidth(); @@ -59,7 +59,7 @@ unsigned PreviewMinimap::CalcPixelColor(const MapPoint pt, const unsigned t) { unsigned color = 0; // Baum an dieser Stelle? - unsigned char landscape_obj = objects[GetMMIdx(pt)]; + unsigned char landscape_obj = objects[getMMIdx(pt)]; if(landscape_obj >= 0xC4 && landscape_obj <= 0xC6) color = VaryBrightness(TREE_COLOR, VARY_TREE_COLOR); // Granit an dieser Stelle? @@ -68,10 +68,10 @@ unsigned PreviewMinimap::CalcPixelColor(const MapPoint pt, const unsigned t) // Ansonsten die jeweilige Terrainfarbe nehmen else { - color = terrain2Clr[t == 0 ? terrain1[GetMMIdx(pt)] : terrain2[GetMMIdx(pt)]]; + color = terrain2Clr[t == 0 ? terrain1[getMMIdx(pt)] : terrain2[getMMIdx(pt)]]; // Schattierung - const int shading = shadows[GetMMIdx(pt)] - 0x40; + const int shading = shadows[getMMIdx(pt)] - 0x40; if(shading != 0) { const auto r = static_cast(GetRed(color)) + shading; @@ -87,15 +87,15 @@ unsigned PreviewMinimap::CalcPixelColor(const MapPoint pt, const unsigned t) unsigned char PreviewMinimap::CalcShading(const MapPoint pt, const std::vector& altitudes) const { - int altitude = altitudes[GetMMIdx(pt)]; - MapPoint tmp = MakeMapPoint(GetNeighbour(Position(pt), Direction::NorthEast), GetMapSize()); - int A = altitudes[GetMMIdx(tmp)] - altitude; - tmp = MakeMapPoint(GetNeighbour2(Position(pt), 0), GetMapSize()); - int B = altitudes[GetMMIdx(tmp)] - altitude; - tmp = MakeMapPoint(GetNeighbour(Position(pt), Direction::West), GetMapSize()); - int C = altitudes[GetMMIdx(tmp)] - altitude; - tmp = MakeMapPoint(GetNeighbour2(Position(pt), 7), GetMapSize()); - int D = altitudes[GetMMIdx(tmp)] - altitude; + int altitude = altitudes[getMMIdx(pt)]; + MapPoint tmp = MakeMapPoint(getNeighbour(Position(pt), Direction::NorthEast), getMapSize()); + int A = altitudes[getMMIdx(tmp)] - altitude; + tmp = MakeMapPoint(getNeighbour2(Position(pt), 0), getMapSize()); + int B = altitudes[getMMIdx(tmp)] - altitude; + tmp = MakeMapPoint(getNeighbour(Position(pt), Direction::West), getMapSize()); + int C = altitudes[getMMIdx(tmp)] - altitude; + tmp = MakeMapPoint(getNeighbour2(Position(pt), 7), getMapSize()); + int D = altitudes[getMMIdx(tmp)] - altitude; int shadingS2 = 64 + 9 * A - 3 * B - 6 * C - 9 * D; if(shadingS2 > 128) @@ -109,6 +109,6 @@ unsigned char PreviewMinimap::CalcShading(const MapPoint pt, const std::vector& altitudes) { shadows.resize(altitudes.size()); - RTTR_FOREACH_PT(MapPoint, GetMapSize()) - shadows[GetMMIdx(pt)] = CalcShading(pt, altitudes); + RTTR_FOREACH_PT(MapPoint, getMapSize()) + shadows[getMMIdx(pt)] = CalcShading(pt, altitudes); } diff --git a/libs/s25main/PreviewMinimap.h b/libs/s25main/PreviewMinimap.h index 390e1aa39e..aa82144b49 100644 --- a/libs/s25main/PreviewMinimap.h +++ b/libs/s25main/PreviewMinimap.h @@ -19,7 +19,7 @@ class PreviewMinimap : public Minimap public: explicit PreviewMinimap(const libsiedler2::ArchivItem_Map* s2map); - void SetMap(const libsiedler2::ArchivItem_Map& s2map); + void setMap(const libsiedler2::ArchivItem_Map& s2map); protected: /// Berechnet die Farbe für einen bestimmten Pixel der Minimap (t = Terrain1 oder 2) diff --git a/libs/s25main/QuickStartGame.cpp b/libs/s25main/QuickStartGame.cpp index 665ee5b6d2..9e0be51d20 100644 --- a/libs/s25main/QuickStartGame.cpp +++ b/libs/s25main/QuickStartGame.cpp @@ -23,7 +23,7 @@ class SwitchOnStart : public ClientInterface { public: - SwitchOnStart() { GAMECLIENT.SetInterface(this); } + SwitchOnStart() { GAMECLIENT.setInterface(this); } ~SwitchOnStart() override { GAMECLIENT.RemoveInterface(this); } void CI_GameLoading(std::shared_ptr game) override @@ -63,7 +63,7 @@ bool QuickStartGame(const boost::filesystem::path& mapOrReplayPath, const std::v if(!loader.load()) return false; if(loader.getPlaylist()) - MUSICPLAYER.SetPlaylist(std::move(*loader.getPlaylist())); + MUSICPLAYER.setPlaylist(std::move(*loader.getPlaylist())); if(SETTINGS.sound.musicEnabled) MUSICPLAYER.Play(); @@ -91,7 +91,7 @@ bool QuickStartGame(const boost::filesystem::path& mapOrReplayPath, const std::v || ((extension == ".swd" || extension == ".wld") && GAMECLIENT.HostGame(csi, {mapOrReplayPath, MapType::OldMap}))) { - GAMECLIENT.SetAIBattlePlayers(std::move(aiInfos)); + GAMECLIENT.setAIBattlePlayers(std::move(aiInfos)); WINDOWMANAGER.ShowAfterSwitch(std::make_unique(csi.type, nullptr)); return true; } else diff --git a/libs/s25main/Replay.cpp b/libs/s25main/Replay.cpp index f5ea3054a2..0d56a17059 100644 --- a/libs/s25main/Replay.cpp +++ b/libs/s25main/Replay.cpp @@ -13,7 +13,7 @@ #include #include -std::string Replay::GetSignature() const +std::string Replay::getSignature() const { return "RTTRRP2"; } @@ -35,7 +35,7 @@ static const uint8_t currentReplayDataVersion = 1; // clang-format on /// Format version of replay files -uint8_t Replay::GetLatestMinorVersion() const +uint8_t Replay::getLatestMinorVersion() const { // 8.1: Portraits support // 8.2: Set correct initial distributions if replay starts without savegame for leather addon (see GameClient.cpp @@ -45,7 +45,7 @@ uint8_t Replay::GetLatestMinorVersion() const return 4; } -uint8_t Replay::GetLatestMajorVersion() const +uint8_t Replay::getLatestMajorVersion() const { // Search for "TODO(Replay)" when increasing this (breaking Replay compatibility) // and handle/remove the relevant code @@ -180,7 +180,7 @@ bool Replay::StartRecording(const boost::filesystem::path& filepath, const MapIn if(!mapInfo.luaData.data.empty()) file_.WriteRawData(mapInfo.luaData.data.data(), mapInfo.luaData.data.size()); break; - case MapType::Savegame: mapInfo.savegame->Save(file_, GetMapName()); break; + case MapType::Savegame: mapInfo.savegame->Save(file_, getMapName()); break; } // Flush now to not loose any information file_.Flush(); @@ -188,7 +188,7 @@ bool Replay::StartRecording(const boost::filesystem::path& filepath, const MapIn return true; } -const boost::filesystem::path& Replay::GetPath() const +const boost::filesystem::path& Replay::getPath() const { RTTR_Assert(file_.IsOpen()); return filepath_; @@ -240,7 +240,7 @@ bool Replay::LoadHeader(const boost::filesystem::path& filepath) Savegame save; if(!save.ReadFileHeader(file_)) { - lastErrorMsg = std::string(_("Savegame error: ")) + save.GetLastErrorMsg(); + lastErrorMsg = std::string(_("Savegame error: ")) + save.getLastErrorMsg(); return false; } } @@ -280,7 +280,7 @@ bool Replay::LoadGameData(MapInfo& mapInfo) mapInfo.Clear(); mapInfo.type = mapType_; - mapInfo.title = GetMapName(); + mapInfo.title = getMapName(); mapInfo.filepath = file_.ReadLongString(); switch(mapType_) { @@ -298,7 +298,7 @@ bool Replay::LoadGameData(MapInfo& mapInfo) mapInfo.savegame = std::make_unique(); if(!mapInfo.savegame->Load(file_, SaveGameDataToLoad::All)) { - lastErrorMsg = std::string(_("Savegame error: ")) + mapInfo.savegame->GetLastErrorMsg(); + lastErrorMsg = std::string(_("Savegame error: ")) + mapInfo.savegame->getLastErrorMsg(); return false; } break; @@ -313,7 +313,7 @@ bool Replay::LoadGameData(MapInfo& mapInfo) void Replay::AddChatCommand(unsigned gf, uint8_t player, ChatDestination dest, const std::string& str) { - RTTR_Assert(IsRecording()); + RTTR_Assert(isRecording()); if(!file_.IsOpen()) return; @@ -330,7 +330,7 @@ void Replay::AddChatCommand(unsigned gf, uint8_t player, ChatDestination dest, c void Replay::AddGameCommand(unsigned gf, uint8_t player, const PlayerGameCommands& cmds) { - RTTR_Assert(IsRecording()); + RTTR_Assert(isRecording()); if(!file_.IsOpen()) return; @@ -348,7 +348,7 @@ void Replay::AddGameCommand(unsigned gf, uint8_t player, const PlayerGameCommand std::optional Replay::ReadGF() { - RTTR_Assert(IsReplaying()); + RTTR_Assert(isReplaying()); try { return file_.ReadUnsignedInt(); @@ -362,7 +362,7 @@ std::optional Replay::ReadGF() boost_variant2 Replay::ReadCommand() { - RTTR_Assert(IsReplaying()); + RTTR_Assert(isReplaying()); const auto type = static_cast(file_.ReadUnsignedChar() - (subVersion_ == 0 ? 1 : 0)); switch(type) { @@ -374,7 +374,7 @@ boost_variant2 Replay::ReadCommand() void Replay::UpdateLastGF(unsigned last_gf) { - RTTR_Assert(IsRecording()); + RTTR_Assert(isRecording()); if(!file_.IsOpen()) return; diff --git a/libs/s25main/Replay.h b/libs/s25main/Replay.h index 93a54afe5b..86cc40319d 100644 --- a/libs/s25main/Replay.h +++ b/libs/s25main/Replay.h @@ -50,9 +50,9 @@ class Replay : public SavedFile void Close(); - std::string GetSignature() const override; - uint8_t GetLatestMinorVersion() const override; - uint8_t GetLatestMajorVersion() const override; + std::string getSignature() const override; + uint8_t getLatestMinorVersion() const override; + uint8_t getLatestMajorVersion() const override; /// Opens the replay for recording bool StartRecording(const boost::filesystem::path& filepath, const MapInfo& mapInfo, unsigned randomSeed); @@ -60,10 +60,10 @@ class Replay : public SavedFile bool StopRecording(); /// Is the replay in the state for accepting commands to record - bool IsRecording() const { return isRecording_ && file_.IsOpen(); } + bool isRecording() const { return isRecording_ && file_.IsOpen(); } /// Is the replay open for reading commands - bool IsReplaying() const { return !isRecording_ && file_.IsOpen(); } - const boost::filesystem::path& GetPath() const; + bool isReplaying() const { return !isRecording_ && file_.IsOpen(); } + const boost::filesystem::path& getPath() const; /// Load the header (containing map and player names) bool LoadHeader(const boost::filesystem::path& filepath); @@ -83,9 +83,9 @@ class Replay : public SavedFile void UpdateLastGF(unsigned last_gf); unsigned getSeed() const { return randomSeed_; } - unsigned GetLastGF() const { return lastGF_; } + unsigned getLastGF() const { return lastGF_; } /// TODO(Replay): Fish fix introduced in 8.3. - bool usesFishFix() const { return GetMinorVersion() >= 3; } + bool usesFishFix() const { return getMinorVersion() >= 3; } protected: BinaryFile file_; diff --git a/libs/s25main/ReplayPlayback.cpp b/libs/s25main/ReplayPlayback.cpp index b9ff4c20f0..479534d2e8 100644 --- a/libs/s25main/ReplayPlayback.cpp +++ b/libs/s25main/ReplayPlayback.cpp @@ -12,7 +12,7 @@ ReplayCommandsResult ExecuteReplayCommands(Replay& replay, std::optional& onChat) { ReplayCommandsResult result; - const unsigned curGF = game.em_->GetCurrentGF(); + const unsigned curGF = game.em_->getCurrentGF(); if(nextGF != curGF) return result; diff --git a/libs/s25main/RoadSegment.cpp b/libs/s25main/RoadSegment.cpp index 40e5ee62f2..d615206420 100644 --- a/libs/s25main/RoadSegment.cpp +++ b/libs/s25main/RoadSegment.cpp @@ -25,7 +25,7 @@ RoadSegment::RoadSegment(const RoadType rt, noRoadNode* const f1, noRoadNode* co RoadSegment::RoadSegment(SerializedGameData& sgd, const unsigned obj_id) : GameObject(sgd, obj_id), rt(sgd.Pop()), f1(sgd.PopObject()), f2(sgd.PopObject()) { - if(sgd.GetGameDataVersion() < 7) + if(sgd.getGameDataVersion() < 7) route.resize(sgd.PopUnsignedShort()); else helpers::popContainer(sgd, route); @@ -33,15 +33,15 @@ RoadSegment::RoadSegment(SerializedGameData& sgd, const unsigned obj_id) carriers_[0] = sgd.PopObject(GO_Type::NofCarrier); carriers_[1] = sgd.PopObject(GO_Type::NofCarrier); - if(sgd.GetGameDataVersion() < 7) + if(sgd.getGameDataVersion() < 7) helpers::popContainer(sgd, route, true); // tell the noRoadNodes about our existance - f1->SetRoute(route.front(), this); - f2->SetRoute(route.back() + 3u, this); + f1->setRoute(route.front(), this); + f2->setRoute(route.back() + 3u, this); } -bool RoadSegment::GetNodeID(const noRoadNode& rn) const +bool RoadSegment::getNodeID(const noRoadNode& rn) const { RTTR_Assert(&rn == f1 || &rn == f2); // Return true if it is the 2nd node @@ -52,9 +52,9 @@ void RoadSegment::Destroy() { // This can be the road segment from the flag to the building (always in this order!) // Those are not considered "roads" and therefore never registered - RTTR_Assert(f1->GetGOT() == GO_Type::Flag); - if(f2->GetGOT() == GO_Type::Flag) - world->GetPlayer(f1->GetPlayer()).DeleteRoad(this); + RTTR_Assert(f1->getGOT() == GO_Type::Flag); + if(f2->getGOT() == GO_Type::Flag) + world->getPlayer(f1->getPlayer()).DeleteRoad(this); if(carriers_[0]) carriers_[0]->LostWork(); @@ -64,17 +64,17 @@ void RoadSegment::Destroy() if(!route.empty()) { // Tell all characters on this road they lost their jobs - MapPoint pt = f1->GetPos(); + MapPoint pt = f1->getPos(); for(unsigned short i = 0; i < route.size() + 1; ++i) { // Figuren sammeln - for(noBase& object : world->GetFigures(pt)) + for(noBase& object : world->getFigures(pt)) { - if(object.GetType() == NodalObjectType::Figure) + if(object.getType() == NodalObjectType::Figure) { auto& figure = static_cast(object); - if(figure.GetCurrentRoad() == this) + if(figure.getCurrentRoad() == this) { figure.Abrogate(); figure.StartWandering(); @@ -86,7 +86,7 @@ void RoadSegment::Destroy() if(i != route.size()) { - pt = world->GetNeighbour(pt, route[i]); + pt = world->getNeighbour(pt, route[i]); } } @@ -117,13 +117,13 @@ void RoadSegment::SplitRoad(noFlag* splitflag) // find the place where the road is cut ( = length of the first section ) unsigned length1, length2; - MapPoint t = f1->GetPos(); + MapPoint t = f1->getPos(); for(length1 = 0; length1 < route.size(); ++length1) { - if(t == splitflag->GetPos()) + if(t == splitflag->getPos()) break; - t = world->GetNeighbour(t, route[length1]); + t = world->getNeighbour(t, route[length1]); } length2 = this->route.size() - length1; @@ -143,36 +143,36 @@ void RoadSegment::SplitRoad(noFlag* splitflag) // f1 = f1; f2 = splitflag; - f1->SetRoute(route.front(), this); - splitflag->SetRoute(route.back() + 3u, this); + f1->setRoute(route.front(), this); + splitflag->setRoute(route.back() + 3u, this); // 2nd section from this F to F2 - splitflag->SetRoute(second->route.front(), second); - second->f2->SetRoute(second->route.back() + 3u, second); + splitflag->setRoute(second->route.front(), second); + second->f2->setRoute(second->route.back() + 3u, second); // Notify all characters on the road - t = f1->GetPos(); + t = f1->getPos(); for(unsigned short i = 0; i < old_route.size() + 1; ++i) { - for(noBase& object : world->GetFigures(t)) + for(noBase& object : world->getFigures(t)) { - if(object.GetType() == NodalObjectType::Figure) + if(object.getType() == NodalObjectType::Figure) { auto& figure = static_cast(object); - if(figure.GetCurrentRoad() == this) + if(figure.getCurrentRoad() == this) figure.CorrectSplitData(second); } } if(i != old_route.size()) { - t = world->GetNeighbour(t, old_route[i]); + t = world->getNeighbour(t, old_route[i]); } } - world->GetPlayer(f1->GetPlayer()).AddRoad(second); + world->getPlayer(f1->getPlayer()).AddRoad(second); for(unsigned char i = 0; i < 2; ++i) { @@ -181,7 +181,7 @@ void RoadSegment::SplitRoad(noFlag* splitflag) else if(i == 0) // If road was unoccupied before then add 2nd part to the unoccupied roads // (1st is already included) - world->GetPlayer(f1->GetPlayer()).FindCarrierForRoad(*second); + world->getPlayer(f1->getPlayer()).FindCarrierForRoad(*second); } } @@ -195,9 +195,9 @@ bool RoadSegment::AreWareJobs(const bool flag, CarrierType ct, const bool take_w // Anzahl der Waren, die getragen werden wollen, ermitteln if(flag) - jobs_count = static_cast(f2)->GetNumWaresForRoad((route.back() + 3u)); + jobs_count = static_cast(f2)->getNumWaresForRoad((route.back() + 3u)); else - jobs_count = static_cast(f1)->GetNumWaresForRoad(route.front()); + jobs_count = static_cast(f1)->getNumWaresForRoad(route.front()); // Nur eine Ware da --> evtl läuft schon ein anderer Träger/Esel hin, nur wo Esel und Träger da sind // Wenn der Träger nun natürlich schon da ist, kann er die mitnehmen @@ -206,7 +206,7 @@ bool RoadSegment::AreWareJobs(const bool flag, CarrierType ct, const bool take_w // anderen Esel ermitteln unsigned otherCarrier = (ct == CarrierType::Donkey) ? 0 : 1; - switch(carriers_[otherCarrier]->GetCarrierState()) + switch(carriers_[otherCarrier]->getCarrierState()) { default: break; case CarrierState::FetchWare: @@ -215,7 +215,7 @@ bool RoadSegment::AreWareJobs(const bool flag, CarrierType ct, const bool take_w case CarrierState::GoBackFromFlag: { // Läuft der in die Richtung, holt eine Ware bzw. ist schon fast da, braucht der hier nicht hinlaufen - if(carriers_[otherCarrier]->GetRoadDir() == !flag) + if(carriers_[otherCarrier]->getRoadDir() == !flag) return false; } break; @@ -224,8 +224,8 @@ bool RoadSegment::AreWareJobs(const bool flag, CarrierType ct, const bool take_w { // Wenn an die Flagge ein Gebäude angrenzt und der Träger da was reinträgt, kann der auch die Ware // gleich mitnehmen, der zweite muss hier also nicht kommen - if((carriers_[otherCarrier]->GetCurrentRoad()->f1 == f1 && !flag) - || (carriers_[otherCarrier]->GetCurrentRoad()->f1 == f2 && flag)) + if((carriers_[otherCarrier]->getCurrentRoad()->f1 == f1 && !flag) + || (carriers_[otherCarrier]->getCurrentRoad()->f1 == f2 && flag)) return false; } break; @@ -245,16 +245,16 @@ void RoadSegment::AddWareJob(const noRoadNode* rn) // nur Lagerhäuser!) if(route.size() == 1) { - if(f2->GetType() == NodalObjectType::Building) + if(f2->getType() == NodalObjectType::Building) { - if(BuildingProperties::IsWareHouse(static_cast(f2)->GetBuildingType())) + if(BuildingProperties::isWareHouse(static_cast(f2)->getBuildingType())) static_cast(f2)->FetchWare(); else LOG.write("RoadSegment::AddWareJob: WARNING: Ware in front of building at %i,%i (gf: %u)!\n") - % f2->GetPos().x % f2->GetPos().y % GetEvMgr().GetCurrentGF(); + % f2->getPos().x % f2->getPos().y % getEvMgr().getCurrentGF(); } else LOG.write("RoadSegment::AddWareJob: WARNING: Ware in front of building site at %i,%i (gf: %u)!\n") - % f2->GetPos().x % f2->GetPos().y % GetEvMgr().GetCurrentGF(); + % f2->getPos().x % f2->getPos().y % getEvMgr().getCurrentGF(); } // Zufällig Esel oder Träger zuerst fragen, ob er Zeit hat @@ -295,16 +295,16 @@ void RoadSegment::UpgradeDonkeyRoad() rt = RoadType::Donkey; // Eselstraßen setzen - MapPoint pt = f1->GetPos(); + MapPoint pt = f1->getPos(); for(auto i : route) { - world->SetPointRoad(pt, i, PointRoad::Donkey); - pt = world->GetNeighbour(pt, i); + world->setPointRoad(pt, i, PointRoad::Donkey); + pt = world->getNeighbour(pt, i); } // Flaggen auf beiden Seiten upgraden - RTTR_Assert(f1->GetGOT() == GO_Type::Flag); - RTTR_Assert(f2->GetGOT() == GO_Type::Flag); + RTTR_Assert(f1->getGOT() == GO_Type::Flag); + RTTR_Assert(f2->getGOT() == GO_Type::Flag); static_cast(f1)->Upgrade(); static_cast(f2)->Upgrade(); @@ -320,7 +320,7 @@ void RoadSegment::TryGetDonkey() { // Nur rufen, falls es eine Eselstraße ist, noch kein Esel da ist, aber schon ein Träger da ist if(NeedDonkey()) - carriers_[1] = world->GetPlayer(f1->GetPlayer()).OrderDonkey(*this); + carriers_[1] = world->getPlayer(f1->getPlayer()).OrderDonkey(*this); } /** @@ -329,23 +329,23 @@ void RoadSegment::TryGetDonkey() void RoadSegment::CarrierAbrogated(nofCarrier* carrier) { // Gucken, ob Träger und Esel gekündigt hat - if(carrier->GetCarrierType() == CarrierType::Normal || carrier->GetCarrierType() == CarrierType::Boat) + if(carrier->getCarrierType() == CarrierType::Normal || carrier->getCarrierType() == CarrierType::Boat) { // Straße wieder unbesetzt, bzw. nur noch Esel this->carriers_[0] = nullptr; - world->GetPlayer(f1->GetPlayer()).FindCarrierForRoad(*this); + world->getPlayer(f1->getPlayer()).FindCarrierForRoad(*this); } else { // Kein Esel mehr da, versuchen, neuen zu bestellen - this->carriers_[1] = world->GetPlayer(f1->GetPlayer()).OrderDonkey(*this); + this->carriers_[1] = world->getPlayer(f1->getPlayer()).OrderDonkey(*this); } } /** * Return flag at the other end of the road */ -const noFlag& RoadSegment::GetOtherFlag(const noFlag& flag) const +const noFlag& RoadSegment::getOtherFlag(const noFlag& flag) const { - if(GetNodeID(flag)) + if(getNodeID(flag)) return dynamic_cast(*f1); else return dynamic_cast(*f2); @@ -353,9 +353,9 @@ const noFlag& RoadSegment::GetOtherFlag(const noFlag& flag) const /** * Return last road direction to flag at the other end of the road */ -Direction RoadSegment::GetOtherFlagDir(const noFlag& flag) const +Direction RoadSegment::getOtherFlagDir(const noFlag& flag) const { - if(GetNodeID(flag)) + if(getNodeID(flag)) return (route.front() + 3u); else return route.back(); diff --git a/libs/s25main/RoadSegment.h b/libs/s25main/RoadSegment.h index ec34d9c37d..572b6cecb7 100644 --- a/libs/s25main/RoadSegment.h +++ b/libs/s25main/RoadSegment.h @@ -38,26 +38,26 @@ class RoadSegment : public GameObject /// serialisiert das Objekt. void Serialize(SerializedGameData& sgd) const override; /// liefert den GO-Type. - GO_Type GetGOT() const final { return GO_Type::Roadsegment; } + GO_Type getGOT() const final { return GO_Type::Roadsegment; } /// Gibt die ID (0 oder 1) eines RoadNodes dieser Straße zurück (die Flagge muss zu dieser Straße gehören, sonst /// kommt Müll raus!!) - bool GetNodeID(const noRoadNode& rn) const; + bool getNodeID(const noRoadNode& rn) const; /// Gibt Straßen-Typ zurück - RoadType GetRoadType() const { return rt; } + RoadType getRoadType() const { return rt; } /// Gibt die Länge der Staße zurück unsigned GetLength() const { return route.size(); } /// gibt Flagge 1 zurück - noRoadNode* GetF1() const { return f1; } + noRoadNode* getF1() const { return f1; } /// setzt Flagge 1 auf o - void SetF1(noRoadNode* o) { f1 = o; } + void setF1(noRoadNode* o) { f1 = o; } /// gibt Flagge 2 zurück - noRoadNode* GetF2() const { return f2; } + noRoadNode* getF2() const { return f2; } /// setzt Flagge 2 auf o - void SetF2(noRoadNode* o) { f2 = o; } + void setF2(noRoadNode* o) { f2 = o; } /// gibt die Route nr zurück - Direction GetRoute(unsigned nr) const { return route.at(nr); } + Direction getRoute(unsigned nr) const { return route.at(nr); } /// setzt die Route nr auf r - void SetRoute(unsigned short nr, Direction r) { route[nr] = r; } + void setRoute(unsigned short nr, Direction r) { route[nr] = r; } /// gibt den Carrier nr zurück nofCarrier* getCarrier(unsigned char nr) const { return carriers_[nr]; } /// setzt den Carrier nr auf c @@ -80,7 +80,7 @@ class RoadSegment : public GameObject /// haben wir überhaupt Carrier? bool isOccupied() const { return (carriers_[0] || carriers_[1]); } - Direction GetDir(bool bwdDir, unsigned id) const + Direction getDir(bool bwdDir, unsigned id) const { if(bwdDir) return route[route.size() - id - 1] + 3u; @@ -103,9 +103,9 @@ class RoadSegment : public GameObject /// Ein Träger muss kündigen, aus welchen Gründen auch immer. void CarrierAbrogated(nofCarrier* carrier); /// given a flag returns the flag at the other end - const noFlag& GetOtherFlag(const noFlag& flag) const; + const noFlag& getOtherFlag(const noFlag& flag) const; /// given a flag returns last direction of the route towards the other flag - Direction GetOtherFlagDir(const noFlag& flag) const; + Direction getOtherFlagDir(const noFlag& flag) const; private: /// Straßentyp diff --git a/libs/s25main/SavedFile.cpp b/libs/s25main/SavedFile.cpp index eb4f54955a..3434e2a051 100644 --- a/libs/s25main/SavedFile.cpp +++ b/libs/s25main/SavedFile.cpp @@ -18,18 +18,18 @@ SavedFile::SavedFile() : saveTime_(0) { - const std::string rev = rttr::version::GetRevision(); + const std::string rev = rttr::version::getRevision(); std::copy(rev.begin(), rev.begin() + revision.size(), revision.begin()); } SavedFile::~SavedFile() = default; -uint8_t SavedFile::GetMinorVersion() const +uint8_t SavedFile::getMinorVersion() const { return minorVersion_.value(); } -uint8_t SavedFile::GetMajorVersion() const +uint8_t SavedFile::getMajorVersion() const { return majorVersion_.value(); } @@ -37,11 +37,11 @@ uint8_t SavedFile::GetMajorVersion() const void SavedFile::WriteFileHeader(BinaryFile& file) const { // Signature - const std::string signature = GetSignature(); + const std::string signature = getSignature(); file.WriteRawData(signature.c_str(), signature.length()); // Format version - file.WriteUnsignedChar(GetLatestMajorVersion()); - file.WriteUnsignedChar(GetLatestMinorVersion()); + file.WriteUnsignedChar(getLatestMajorVersion()); + file.WriteUnsignedChar(getLatestMinorVersion()); } void SavedFile::WriteExtHeader(BinaryFile& file, const std::string& mapName) @@ -64,7 +64,7 @@ bool SavedFile::ReadFileHeader(BinaryFile& file) { lastErrorMsg.clear(); - const std::string signature = GetSignature(); + const std::string signature = getSignature(); std::array read_signature; if(signature.size() > read_signature.size()) throw std::range_error("Program signature is to long!"); @@ -82,15 +82,15 @@ bool SavedFile::ReadFileHeader(BinaryFile& file) // Version überprüfen majorVersion_ = file.ReadUnsignedChar(); minorVersion_ = file.ReadUnsignedChar(); - if(majorVersion_ != GetLatestMajorVersion() || minorVersion_ > GetLatestMinorVersion()) + if(majorVersion_ != getLatestMajorVersion() || minorVersion_ > getLatestMinorVersion()) { boost::format fmt = - boost::format((majorVersion_ < GetLatestMajorVersion()) ? + boost::format((majorVersion_ < getLatestMajorVersion()) ? _("File has an old version and cannot be used (version: %1%.%2%, expected: %3%.%4%)!") : _("File was created with more recent program and cannot be used (version: %1%.%2%, " "expected: %3%.%4%)!")); lastErrorMsg = - (fmt % majorVersion_.value() % minorVersion_.value() % GetLatestMajorVersion() % GetLatestMinorVersion()) + (fmt % majorVersion_.value() % minorVersion_.value() % getLatestMajorVersion() % getLatestMinorVersion()) .str(); return false; } @@ -156,7 +156,7 @@ void SavedFile::ReadPlayerData(BinaryFile& file) for(unsigned i = 0; i < playerCt; i++) { // TODO(Replay) TODO(Savegame) minor versions will change their meaning when major is bumped - BasePlayerInfo player(ser, GetMinorVersion() >= 1 ? 1 : 0, true); + BasePlayerInfo player(ser, getMinorVersion() >= 1 ? 1 : 0, true); // Temporary workaround: The random team was stored in the file but should not anymore, see PR #1331 if(player.team > Team::Team4) player.team = Team(rttr::enum_cast(player.team) - 3); // Was random team 2-4 @@ -186,12 +186,12 @@ void SavedFile::ReadGGS(BinaryFile& file) ggs.Deserialize(ser); } -const BasePlayerInfo& SavedFile::GetPlayer(unsigned idx) const +const BasePlayerInfo& SavedFile::getPlayer(unsigned idx) const { return players[idx]; } -unsigned SavedFile::GetNumPlayers() +unsigned SavedFile::getNumPlayers() { return players.size(); } @@ -209,7 +209,7 @@ void SavedFile::ClearPlayers() playerNames_.clear(); } -std::string SavedFile::GetRevision() const +std::string SavedFile::getRevision() const { return std::string(revision.begin(), revision.end()); } diff --git a/libs/s25main/SavedFile.h b/libs/s25main/SavedFile.h index 17255fa592..829ac4a0f9 100644 --- a/libs/s25main/SavedFile.h +++ b/libs/s25main/SavedFile.h @@ -22,15 +22,15 @@ class SavedFile virtual ~SavedFile(); /// Return the file signature. Must be at most 32 bytes - virtual std::string GetSignature() const = 0; + virtual std::string getSignature() const = 0; /// Return the maximum supported file format version - virtual uint8_t GetLatestMinorVersion() const = 0; - virtual uint8_t GetLatestMajorVersion() const = 0; + virtual uint8_t getLatestMinorVersion() const = 0; + virtual uint8_t getLatestMajorVersion() const = 0; /// Return the file format version read from file - minor part - uint8_t GetMinorVersion() const; + uint8_t getMinorVersion() const; /// Return the file format version read from file - major part - uint8_t GetMajorVersion() const; + uint8_t getMajorVersion() const; /// Schreibt Signatur und Version der Datei void WriteFileHeader(BinaryFile& file) const; @@ -54,17 +54,17 @@ class SavedFile /// liest die GlobalGameSettings aus der Datei. void ReadGGS(BinaryFile& file); - const BasePlayerInfo& GetPlayer(unsigned idx) const; - unsigned GetNumPlayers(); + const BasePlayerInfo& getPlayer(unsigned idx) const; + unsigned getNumPlayers(); void AddPlayer(const BasePlayerInfo& player); void ClearPlayers(); - const std::string& GetLastErrorMsg() const { return lastErrorMsg; } + const std::string& getLastErrorMsg() const { return lastErrorMsg; } - std::string GetRevision() const; - const std::string& GetMapName() const { return mapName_; } - s25util::time64_t GetSaveTime() const { return saveTime_; } - const std::vector& GetPlayerNames() const { return playerNames_; } + std::string getRevision() const; + const std::string& getMapName() const { return mapName_; } + s25util::time64_t getSaveTime() const { return saveTime_; } + const std::vector& getPlayerNames() const { return playerNames_; } GlobalGameSettings ggs; diff --git a/libs/s25main/Savegame.cpp b/libs/s25main/Savegame.cpp index 29244bb5b1..5a102e043b 100644 --- a/libs/s25main/Savegame.cpp +++ b/libs/s25main/Savegame.cpp @@ -8,18 +8,18 @@ #include #include -std::string Savegame::GetSignature() const +std::string Savegame::getSignature() const { return "RTTRSV"; } -uint8_t Savegame::GetLatestMinorVersion() const +uint8_t Savegame::getLatestMinorVersion() const { // 4.1: Portraits support return 1; } -uint8_t Savegame::GetLatestMajorVersion() const +uint8_t Savegame::getLatestMajorVersion() const { // Note: If you increase the version, reset currentGameDataVersion in SerializedGameData.cpp (see note there) // Note2: Also remove the workaround for the team in BasePlayerInfo & CompressedFlag here diff --git a/libs/s25main/Savegame.h b/libs/s25main/Savegame.h index 03608e2565..51f901b6c2 100644 --- a/libs/s25main/Savegame.h +++ b/libs/s25main/Savegame.h @@ -23,9 +23,9 @@ class Savegame : public SavedFile Savegame(); ~Savegame() override; - std::string GetSignature() const override; - uint8_t GetLatestMinorVersion() const override; - uint8_t GetLatestMajorVersion() const override; + std::string getSignature() const override; + uint8_t getLatestMinorVersion() const override; + uint8_t getLatestMajorVersion() const override; /// Schreibst Savegame oder Teile davon bool Save(const boost::filesystem::path& filepath, const std::string& mapName); diff --git a/libs/s25main/SerializedGameData.cpp b/libs/s25main/SerializedGameData.cpp index ef444aedca..659e8d3727 100644 --- a/libs/s25main/SerializedGameData.cpp +++ b/libs/s25main/SerializedGameData.cpp @@ -243,10 +243,10 @@ void SerializedGameData::MakeSnapshot(const Game& game) Prepare(false); const GameWorldBase& gw = game.world_; - writeEm = &gw.GetEvMgr(); + writeEm = &gw.getEvMgr(); // Anzahl Objekte reinschreiben (used for safety checks only) - expectedNumObjects = GameObject::GetNumObjs(); + expectedNumObjects = GameObject::getNumObjs(); PushUnsignedInt(expectedNumObjects); // World and objects @@ -261,15 +261,15 @@ void SerializedGameData::MakeSnapshot(const Game& game) for(const auto& player : gw.getPlayers()) { if(debugMode) - LOG.write("Start serializing player %1% at %2%\n") % player.GetPlayerId() % GetLength(); + LOG.write("Start serializing player %1% at %2%\n") % player.getPlayerId() % GetLength(); player.Serialize(*this); if(debugMode) - LOG.write("Done serializing player %1% at %2%\n") % player.GetPlayerId() % GetLength(); + LOG.write("Done serializing player %1% at %2%\n") % player.getPlayerId() % GetLength(); } - if(writtenEventIds.size() != writeEm->GetNumActiveEvents()) + if(writtenEventIds.size() != writeEm->getNumActiveEvents()) { - throw Error(helpers::format("Event count mismatch. Expected: %1%, written: %2%", writeEm->GetNumActiveEvents(), + throw Error(helpers::format("Event count mismatch. Expected: %1%, written: %2%", writeEm->getNumActiveEvents(), writtenEventIds.size())); } // If this check fails, we missed some objects or some objects were destroyed without decreasing the obj count @@ -289,13 +289,13 @@ void SerializedGameData::ReadSnapshot(Game& game, ILocalGameState& localGameStat Prepare(true); GameWorld& gw = game.world_; - em = &gw.GetEvMgr(); + em = &gw.getEvMgr(); expectedNumObjects = PopUnsignedInt(); MapSerializer::Deserialize(gw, *this, game, localGameState); em->Deserialize(*this); - if(gw.GetGGS().objective == GameObjective::EconomyMode) + if(gw.getGGS().objective == GameObjective::EconomyMode) { gw.setEconHandler( std::unique_ptr(PopObject(GO_Type::Economymodehandler))); @@ -305,15 +305,15 @@ void SerializedGameData::ReadSnapshot(Game& game, ILocalGameState& localGameStat player.Deserialize(*this); // If this check fails, we did not serialize all objects or there was an async - if(readEvents.size() != em->GetNumActiveEvents()) + if(readEvents.size() != em->getNumActiveEvents()) { - throw Error(helpers::format("Event count mismatch. Expected: %1%, read: %2%", em->GetNumActiveEvents(), + throw Error(helpers::format("Event count mismatch. Expected: %1%, read: %2%", em->getNumActiveEvents(), readEvents.size())); } - if(expectedNumObjects != GameObject::GetNumObjs()) + if(expectedNumObjects != GameObject::getNumObjs()) { throw Error(helpers::format("Object count mismatch. Expected: %1%, Existing: %2%", expectedNumObjects, - GameObject::GetNumObjs())); + GameObject::getNumObjs())); } if(expectedNumObjects != readObjects.size() + 1) // "Nothing" nodeObj does not get serialized { @@ -325,9 +325,9 @@ void SerializedGameData::ReadSnapshot(Game& game, ILocalGameState& localGameStat for(const auto& entry : readObjects) { const auto* worker = dynamic_cast(entry.second); - if(worker && worker->GetFlag() && worker->GetPlayer() != worker->GetFlag()->GetPlayer()) + if(worker && worker->getFlag() && worker->getPlayer() != worker->getFlag()->getPlayer()) { - throw Error(helpers::format("Invalid flag worker at %1%", worker->GetPos())); + throw Error(helpers::format("Invalid flag worker at %1%", worker->getPos())); } } @@ -348,10 +348,10 @@ void SerializedGameData::PushObject_(const GameObject* go, const bool known) return; } - const unsigned objId = go->GetObjId(); + const unsigned objId = go->getObjId(); - RTTR_Assert(objId <= GameObject::GetObjIDCounter()); - if(objId > GameObject::GetObjIDCounter()) + RTTR_Assert(objId <= GameObject::getObjIDCounter()); + if(objId > GameObject::getObjIDCounter()) { LOG.write("%s\n") % _("An error occured while saving which was suppressed!"); PushUnsignedInt(0); @@ -361,7 +361,7 @@ void SerializedGameData::PushObject_(const GameObject* go, const bool known) PushUnsignedInt(objId); // If the object was already serialized skip the data - if(IsObjectSerialized(objId)) + if(isObjectSerialized(objId)) { if(debugMode) LOG.write("Saved known objId %u\n") % objId; @@ -374,11 +374,11 @@ void SerializedGameData::PushObject_(const GameObject* go, const bool known) // Objekt merken writtenObjIds.insert(objId); - RTTR_Assert(writtenObjIds.size() < GameObject::GetNumObjs()); + RTTR_Assert(writtenObjIds.size() < GameObject::getNumObjs()); // Objekt nich bekannt? Dann Type-ID noch mit drauf if(!known) - PushEnum(go->GetGOT()); + PushEnum(go->getGOT()); // Objekt serialisieren if(debugMode) @@ -388,7 +388,7 @@ void SerializedGameData::PushObject_(const GameObject* go, const bool known) LOG.write("Done serializing %1% at %2%\n") % objId % GetLength(); // Sicherheitscode reinschreiben - PushUnsignedShort(GetSafetyCode(*go)); + PushUnsignedShort(getSafetyCode(*go)); } void SerializedGameData::PushEvent(const GameEvent* event) @@ -399,9 +399,9 @@ void SerializedGameData::PushEvent(const GameEvent* event) return; } - unsigned instanceId = event->GetInstanceId(); + unsigned instanceId = event->getInstanceId(); PushUnsignedInt(instanceId); - if(IsEventSerialized(instanceId)) + if(isEventSerialized(instanceId)) return; writtenEventIds.insert(instanceId); if(debugMode) @@ -409,7 +409,7 @@ void SerializedGameData::PushEvent(const GameEvent* event) event->Serialize(*this); if(debugMode) LOG.write("Done serializing event %1% at %2%\n") % instanceId % GetLength(); - PushUnsignedShort(GetSafetyCode(*event)); + PushUnsignedShort(getSafetyCode(*event)); } const GameEvent* SerializedGameData::PopEvent() @@ -426,7 +426,7 @@ const GameEvent* SerializedGameData::PopEvent() unsigned short safety_code = PopUnsignedShort(); - if(safety_code != GetSafetyCode(*ev)) + if(safety_code != getSafetyCode(*ev)) { LOG.write("SerializedGameData::PopEvent: ERROR: After loading Event(instanceId = %1%); Code is wrong!\n") % instanceId; @@ -447,7 +447,7 @@ void SerializedGameData::PushFOWObject(const FOWObject* fowobj) } // Objekt-Typ - PushEnum(fowobj->GetType()); + PushEnum(fowobj->getType()); // Objekt serialisieren fowobj->Serialize(*this); @@ -476,7 +476,7 @@ GameObject* SerializedGameData::PopObject_(helpers::OptionalEnum got) if(!objId) return nullptr; - if(GameObject* go = GetReadGameObject(objId)) + if(GameObject* go = getReadGameObject(objId)) return go; // Objekt nich bekannt? Dann in den heiligen Schriften lesen @@ -489,7 +489,7 @@ GameObject* SerializedGameData::PopObject_(helpers::OptionalEnum got) // Sicherheitscode auslesen unsigned short safety_code = PopUnsignedShort(); - if(safety_code != GetSafetyCode(*go)) + if(safety_code != getSafetyCode(*go)) { LOG.write( "SerializedGameData::PopObject_: ERROR: After loading Object(obj_id = %u, got = %u); Code is wrong!\n") @@ -500,14 +500,14 @@ GameObject* SerializedGameData::PopObject_(helpers::OptionalEnum got) return go.release(); } -unsigned short SerializedGameData::GetSafetyCode(const GameObject& go) +unsigned short SerializedGameData::getSafetyCode(const GameObject& go) { - return 0xFFFF ^ rttr::enum_cast(go.GetGOT()) ^ go.GetObjId(); + return 0xFFFF ^ rttr::enum_cast(go.getGOT()) ^ go.getObjId(); } -unsigned short SerializedGameData::GetSafetyCode(const GameEvent& ev) +unsigned short SerializedGameData::getSafetyCode(const GameEvent& ev) { - return 0xFFFF ^ ev.GetInstanceId(); + return 0xFFFF ^ ev.getInstanceId(); } SerializedGameData::Error SerializedGameData::makeOutOfRange(unsigned value, unsigned maxValue) @@ -518,8 +518,8 @@ SerializedGameData::Error SerializedGameData::makeOutOfRange(unsigned value, uns void SerializedGameData::AddObject(GameObject* go) { RTTR_Assert(isReading); - RTTR_Assert(!readObjects[go->GetObjId()]); // Do not call this multiple times per GameObject - readObjects[go->GetObjId()] = go; + RTTR_Assert(!readObjects[go->getObjId()]); // Do not call this multiple times per GameObject + readObjects[go->getObjId()] = go; RTTR_Assert(readObjects.size() < expectedNumObjects); } @@ -531,24 +531,24 @@ unsigned SerializedGameData::AddEvent(unsigned instanceId, GameEvent* ev) return instanceId; } -bool SerializedGameData::IsObjectSerialized(unsigned obj_id) const +bool SerializedGameData::isObjectSerialized(unsigned obj_id) const { RTTR_Assert(!isReading); - RTTR_Assert(obj_id <= GameObject::GetObjIDCounter()); + RTTR_Assert(obj_id <= GameObject::getObjIDCounter()); return helpers::contains(writtenObjIds, obj_id); } -bool SerializedGameData::IsEventSerialized(unsigned evInstanceid) const +bool SerializedGameData::isEventSerialized(unsigned evInstanceid) const { RTTR_Assert(!isReading); - RTTR_Assert(evInstanceid < writeEm->GetEventInstanceCtr()); + RTTR_Assert(evInstanceid < writeEm->getEventInstanceCtr()); return helpers::contains(writtenEventIds, evInstanceid); } -GameObject* SerializedGameData::GetReadGameObject(const unsigned obj_id) const +GameObject* SerializedGameData::getReadGameObject(const unsigned obj_id) const { RTTR_Assert(isReading); - RTTR_Assert(obj_id <= GameObject::GetObjIDCounter()); + RTTR_Assert(obj_id <= GameObject::getObjIDCounter()); auto foundObj = readObjects.find(obj_id); if(foundObj == readObjects.end()) return nullptr; diff --git a/libs/s25main/SerializedGameData.h b/libs/s25main/SerializedGameData.h index 7ff05ce70d..8b7970a53c 100644 --- a/libs/s25main/SerializedGameData.h +++ b/libs/s25main/SerializedGameData.h @@ -87,7 +87,7 @@ class SerializedGameData : public Serializer /// Get the format version the data is saved in. Deserializing methods can use this to support /// loading data saved in an earlier format. /// See `currentGameDataVersion` in SerializedGameData.cpp for version history - unsigned GetGameDataVersion() const { return gameDataVersion; } + unsigned getGameDataVersion() const { return gameDataVersion; } ////////////////////////////////////////////////////////////////////////// // Write methods @@ -179,12 +179,12 @@ class SerializedGameData : public Serializer /// Adds a deserialized event to the storage. Return instanceId. Must be called exactly once per read event unsigned AddEvent(unsigned instanceId, GameEvent* ev); /// Only valid during writing - bool IsEventSerialized(unsigned evInstanceid) const; + bool isEventSerialized(unsigned evInstanceid) const; bool debugMode; private: - static unsigned short GetSafetyCode(const GameObject& go); - static unsigned short GetSafetyCode(const GameEvent& ev); + static unsigned short getSafetyCode(const GameObject& go); + static unsigned short getSafetyCode(const GameEvent& ev); static Error makeOutOfRange(unsigned value, unsigned maxValue); /// Version of the game data that is read. Gets set to the current version for writing @@ -219,9 +219,9 @@ class SerializedGameData : public Serializer GameObject* PopObject_(helpers::OptionalEnum got); /// Returns the object with the given id when it was read, nullptr otherwise (only valid during reading) - GameObject* GetReadGameObject(unsigned obj_id) const; + GameObject* getReadGameObject(unsigned obj_id) const; /// Returns whether the object with the given id was already serialized (only valid during writing) - bool IsObjectSerialized(unsigned obj_id) const; + bool isObjectSerialized(unsigned obj_id) const; }; //////////////////////////////////////////////////////////////////////////////// @@ -244,7 +244,7 @@ void SerializedGameData::PopObjectContainer(T& gos, helpers::OptionalEnum; - unsigned size = (GetGameDataVersion() >= 2) ? PopVarSize() : PopUnsignedInt(); + unsigned size = (getGameDataVersion() >= 2) ? PopVarSize() : PopUnsignedInt(); gos.clear(); if constexpr(detail::has_reserve_v) gos.reserve(size); @@ -258,7 +258,7 @@ template void SerializedGameData::PopContainer(T& result) { // Remove this method after raising GameDataVersion - if(GetGameDataVersion() >= 2) + if(getGameDataVersion() >= 2) helpers::popContainer(*this, result); else { diff --git a/libs/s25main/Settings.cpp b/libs/s25main/Settings.cpp index 46ca3b92e4..3bb892eb72 100644 --- a/libs/s25main/Settings.cpp +++ b/libs/s25main/Settings.cpp @@ -93,13 +93,13 @@ void Settings::LoadDefaults() // video // { - if(VIDEODRIVER.IsLoaded()) + if(VIDEODRIVER.isLoaded()) { - video.fullscreenSize = (VIDEODRIVER.GetDisplayMode() == DisplayMode::Fullscreen) ? VIDEODRIVER.GetWindowSize() : + video.fullscreenSize = (VIDEODRIVER.getDisplayMode() == DisplayMode::Fullscreen) ? VIDEODRIVER.getWindowSize() : VIDEODRIVER.MinWindowSize; - video.windowedSize = (VIDEODRIVER.GetDisplayMode() == DisplayMode::Windowed) ? VIDEODRIVER.GetWindowSize() : + video.windowedSize = (VIDEODRIVER.getDisplayMode() == DisplayMode::Windowed) ? VIDEODRIVER.getWindowSize() : VIDEODRIVER.MinWindowSize; - video.displayMode = VIDEODRIVER.GetDisplayMode(); + video.displayMode = VIDEODRIVER.getDisplayMode(); } else { video.windowedSize = video.fullscreenSize = VIDEODRIVER.MinWindowSize; @@ -120,8 +120,8 @@ void Settings::LoadDefaults() // driver // { - driver.audio = AUDIODRIVER.GetName(); - driver.video = VIDEODRIVER.GetName(); + driver.audio = AUDIODRIVER.getName(); + driver.video = VIDEODRIVER.getName(); // } // sound @@ -227,7 +227,7 @@ void Settings::Load() // global // { - if(iniGlobal->getValue("gameversion") != rttr::version::GetRevision()) + if(iniGlobal->getValue("gameversion") != rttr::version::getRevision()) s25util::warning("Your application version has changed - please recheck your settings!"); unsigned submitDebugData = iniGlobal->getIntValue("submit_debug_data"); @@ -444,7 +444,7 @@ void Settings::Save() // global // { iniGlobal->setValue("version", VERSION); - iniGlobal->setValue("gameversion", rttr::version::GetRevision()); + iniGlobal->setValue("gameversion", rttr::version::getRevision()); iniGlobal->setValue("submit_debug_data", rttr::enum_cast(global.submitDebugData)); iniGlobal->setValue("use_upnp", global.useUPNP); iniGlobal->setValue("smartCursor", global.smartCursor); diff --git a/libs/s25main/SoundManager.cpp b/libs/s25main/SoundManager.cpp index 81e1ea1e2c..71a232e2d3 100644 --- a/libs/s25main/SoundManager.cpp +++ b/libs/s25main/SoundManager.cpp @@ -46,7 +46,7 @@ void SoundManager::playNOSound(unsigned soundLstId, const noBase& obj, unsigned if(numPlayedCt >= maxPlayCtPerSound) return; - EffectPlayId playId = LOADER.GetSoundN("sound", soundLstId)->Play(volume, false); + EffectPlayId playId = LOADER.getSoundN("sound", soundLstId)->Play(volume, false); if(playId != EffectPlayId::Invalid) noSounds.push_back(NOSound{soundLstId, &obj, id, playId}); @@ -74,7 +74,7 @@ void SoundManager::playAnimalSound(unsigned soundLstId) { if(it->soundId == soundLstId) { - if(AUDIODRIVER.IsEffectPlaying(it->playId)) + if(AUDIODRIVER.isEffectPlaying(it->playId)) ++numPlayedCt; else { @@ -88,7 +88,7 @@ void SoundManager::playAnimalSound(unsigned soundLstId) return; const unsigned volume = helpers::randomValue(getSoundRng(), 50u, 70u); - EffectPlayId playId = LOADER.GetSoundN("sound", soundLstId)->Play(volume, false); + EffectPlayId playId = LOADER.getSoundN("sound", soundLstId)->Play(volume, false); if(playId != EffectPlayId::Invalid) animalSounds.push_back(AnimalSound{soundLstId, playId}); @@ -115,7 +115,7 @@ void SoundManager::playBirdSounds(const unsigned treeCount) { const unsigned soundIdx = helpers::randomValue(getSoundRng(), 87u, 91u); const unsigned volume = helpers::randomValue(getSoundRng(), 50u, 70u); - birdPlayId = LOADER.GetSoundN("sound", soundIdx)->Play(volume, false); + birdPlayId = LOADER.getSoundN("sound", soundIdx)->Play(volume, false); } minNextBirdSound = now + milliseconds(helpers::randomValue(getSoundRng(), 150u, 1000u)); } @@ -132,7 +132,7 @@ void SoundManager::playOceanBrawling(const unsigned waterPercent) if(waterPercent >= 10) { const unsigned volume = waterPercent * 2u + 55u; - if(!AUDIODRIVER.IsEffectPlaying(oceanPlayId)) + if(!AUDIODRIVER.isEffectPlaying(oceanPlayId)) { // SDL Mixer may wrongly return that the sound is not playing, so make sure the old effect is stopped. // DO NOT REMOVE - THIS PREVENTS A BUG! @@ -140,7 +140,7 @@ void SoundManager::playOceanBrawling(const unsigned waterPercent) AUDIODRIVER.StopEffect(oceanPlayId); const unsigned soundIdx = helpers::randomValue(getSoundRng(), 98u, 100u); - oceanPlayId = LOADER.GetSoundN("sound", soundIdx)->Play(volume, true); + oceanPlayId = LOADER.getSoundN("sound", soundIdx)->Play(volume, true); } else AUDIODRIVER.ChangeVolume(oceanPlayId, volume); } else if(oceanPlayId != EffectPlayId::Invalid) diff --git a/libs/s25main/TerrainRenderer.cpp b/libs/s25main/TerrainRenderer.cpp index bb85431608..78408905b4 100644 --- a/libs/s25main/TerrainRenderer.cpp +++ b/libs/s25main/TerrainRenderer.cpp @@ -67,27 +67,27 @@ static constexpr unsigned getFlatIndex(DescIdx ls, LandRoadType r return ls.value * helpers::NumEnumValues_v + rttr::enum_cast(road); } -PointF TerrainRenderer::GetNeighbourVertexPos(MapPoint pt, const Direction dir) const +PointF TerrainRenderer::getNeighbourVertexPos(MapPoint pt, const Direction dir) const { // Note: We want the real neighbour point which might be outside of the map to get the offset right - Position ptNb = ::GetNeighbour(Position(pt), dir); + Position ptNb = ::getNeighbour(Position(pt), dir); Position offset; MapPoint t = ConvertCoords(ptNb, &offset); - return GetVertexPos(t) + PointF(offset); + return getVertexPos(t) + PointF(offset); } -PointF TerrainRenderer::GetNeighbourBorderPos(const MapPoint pt, const unsigned char triangle, +PointF TerrainRenderer::getNeighbourBorderPos(const MapPoint pt, const unsigned char triangle, const Direction dir) const { // Note: We want the real neighbour point which might be outside of the map to get the offset right - Position ptNb = ::GetNeighbour(Position(pt), dir); + Position ptNb = ::getNeighbour(Position(pt), dir); Position offset; MapPoint t = ConvertCoords(ptNb, &offset); - return GetBorderPos(t, triangle) + PointF(offset); + return getBorderPos(t, triangle) + PointF(offset); } void TerrainRenderer::LoadTextures(const WorldDescription& desc) @@ -124,12 +124,12 @@ void TerrainRenderer::LoadTextures(const WorldDescription& desc) { const TerrainDesc& cur = desc.get(curIdx); const auto textureName = ResourceId::make(bfs::path(cur.texturePath)); - glArchivItem_Bitmap* texBmp = LOADER.GetImageN(textureName, 0); + glArchivItem_Bitmap* texBmp = LOADER.getImageN(textureName, 0); if(!texBmp) throw std::runtime_error("Invalid texture '" + cur.texturePath + "' for terrain '" + cur.name + "'"); if(cur.palAnimIdx >= 0) { - libsiedler2::ArchivItem* animItem = LOADER.GetArchive(textureName)[cur.palAnimIdx]; + libsiedler2::ArchivItem* animItem = LOADER.getArchive(textureName)[cur.palAnimIdx]; if(!texBmp->getPalette() || !animItem || animItem->getBobType() != libsiedler2::BobType::PaletteAnim) { LOG.write("Invalid palette animation '%1%' for '%2%'") % unsigned(cur.palAnimIdx) % cur.name; @@ -151,12 +151,12 @@ void TerrainRenderer::LoadTextures(const WorldDescription& desc) } // Initialize OpenGL textures for(glArchivItem_Bitmap& bmp : terrainTextures[curIdx].textures) - bmp.GetTexture(); - TerrainDesc::Triangle trianglePos = cur.GetRSUTriangle(); + bmp.getTexture(); + TerrainDesc::Triangle trianglePos = cur.getRSUTriangle(); Position texOrigin = cur.posInTexture.getOrigin(); const glArchivItem_Bitmap& texture = terrainTextures[curIdx].textures[0]; Triangle& rsuCoord = terrainTextures[curIdx].rsuCoords; - PointF texSize(texture.GetTexSize()); + PointF texSize(texture.getTexSize()); rsuCoord[0] = PointF(trianglePos.tip - texOrigin); rsuCoord[1] = PointF(trianglePos.left - texOrigin); rsuCoord[2] = PointF(trianglePos.right - texOrigin); @@ -165,7 +165,7 @@ void TerrainRenderer::LoadTextures(const WorldDescription& desc) rsuCoord[i] /= texSize; Triangle& usdCoord = terrainTextures[curIdx].usdCoords; - trianglePos = cur.GetUSDTriangle(); + trianglePos = cur.getUSDTriangle(); usdCoord[0] = PointF(trianglePos.left - texOrigin); usdCoord[1] = PointF(trianglePos.tip - texOrigin); usdCoord[2] = PointF(trianglePos.right - texOrigin); @@ -177,11 +177,11 @@ void TerrainRenderer::LoadTextures(const WorldDescription& desc) { const EdgeDesc& cur = desc.get(curIdx); const auto textureName = ResourceId::make(bfs::path(cur.texturePath)); - glArchivItem_Bitmap* texBmp = LOADER.GetImageN(textureName, 0); + glArchivItem_Bitmap* texBmp = LOADER.getImageN(textureName, 0); if(!texBmp) throw std::runtime_error("Invalid texture '" + cur.texturePath + "' for edge '" + cur.name + "'"); edgeTextures[curIdx] = LOADER.ExtractTexture(*texBmp, cur.posInTexture); - edgeTextures[curIdx]->GetTexture(); // Init texture + edgeTextures[curIdx]->getTexture(); // Init texture } for(DescIdx curIdx : usedLandscapes) { @@ -189,12 +189,12 @@ void TerrainRenderer::LoadTextures(const WorldDescription& desc) for(const auto i : helpers::enumRange()) { const auto textureName = ResourceId::make(bfs::path(cur.roadTexDesc[i].texturePath)); - glArchivItem_Bitmap* texBmp = LOADER.GetImageN(textureName, 0); + glArchivItem_Bitmap* texBmp = LOADER.getImageN(textureName, 0); if(!texBmp) throw std::runtime_error("Invalid texture '" + cur.roadTexDesc[i].texturePath + "' for road in landscape '" + cur.name + "'"); roadTextures[getFlatIndex(curIdx, i)] = LOADER.ExtractTexture(*texBmp, cur.roadTexDesc[i].posInTexture); - roadTextures[getFlatIndex(curIdx, i)]->GetTexture(); // Init texture + roadTextures[getFlatIndex(curIdx, i)]->getTexture(); // Init texture } } } @@ -216,52 +216,52 @@ void TerrainRenderer::GenerateVertices(const GameWorldViewer& gwv) void TerrainRenderer::UpdateVertexPos(const MapPoint pt, const GameWorldViewer& gwv) { - GetVertex(pt).pos = PointF(gwv.GetWorld().GetNodePos(pt)); + getVertex(pt).pos = PointF(gwv.getWorld().getNodePos(pt)); } void TerrainRenderer::UpdateVertexColor(const MapPoint pt, const GameWorldViewer& gwv) { - auto shadow = static_cast(gwv.GetNode(pt).shadow); + auto shadow = static_cast(gwv.getNode(pt).shadow); float clr = -1.f / (256.f * 256.f) * shadow * shadow + 1.f / 90.f * shadow + 0.38f; - switch(gwv.GetVisibility(pt)) + switch(gwv.getVisibility(pt)) { case Visibility::Invisible: // Unsichtbar -> schwarz - GetVertex(pt).color = 0.0f; + getVertex(pt).color = 0.0f; break; case Visibility::FogOfWar: // Fog of War -> abgedunkelt - GetVertex(pt).color = clr / (TEXTURE_COLOR_DIVISOR * 2); + getVertex(pt).color = clr / (TEXTURE_COLOR_DIVISOR * 2); break; case Visibility::Visible: // Normal sichtbar - GetVertex(pt).color = clr / TEXTURE_COLOR_DIVISOR; + getVertex(pt).color = clr / TEXTURE_COLOR_DIVISOR; break; } } void TerrainRenderer::LoadVertexTerrain(const MapPoint pt, const GameWorldViewer& gwv) { - const MapNode& node = gwv.GetNode(pt); - terrain[GetVertexIdx(pt)][0] = node.t1; - terrain[GetVertexIdx(pt)][1] = node.t2; + const MapNode& node = gwv.getNode(pt); + terrain[getVertexIdx(pt)][0] = node.t1; + terrain[getVertexIdx(pt)][1] = node.t2; } void TerrainRenderer::UpdateBorderVertex(const MapPoint pt) { - Vertex& vertex = GetVertex(pt); - vertex.borderPos[0] = (GetNeighbourVertexPos(pt, Direction::SouthWest) + GetVertexPos(pt) - + GetNeighbourVertexPos(pt, Direction::SouthEast)) + Vertex& vertex = getVertex(pt); + vertex.borderPos[0] = (getNeighbourVertexPos(pt, Direction::SouthWest) + getVertexPos(pt) + + getNeighbourVertexPos(pt, Direction::SouthEast)) / 3.0f; - vertex.borderColor[0] = (GetColor(GetNeighbour(pt, Direction::SouthWest)) + GetColor(pt) - + GetColor(GetNeighbour(pt, Direction::SouthEast))) + vertex.borderColor[0] = (getColor(getNeighbour(pt, Direction::SouthWest)) + getColor(pt) + + getColor(getNeighbour(pt, Direction::SouthEast))) / 3.0f; vertex.borderPos[1] = - (GetNeighbourVertexPos(pt, Direction::East) + GetVertexPos(pt) + GetNeighbourVertexPos(pt, Direction::SouthEast)) + (getNeighbourVertexPos(pt, Direction::East) + getVertexPos(pt) + getNeighbourVertexPos(pt, Direction::SouthEast)) / 3.0f; vertex.borderColor[1] = - (GetColor(GetNeighbour(pt, Direction::East)) + GetColor(pt) + GetColor(GetNeighbour(pt, Direction::SouthEast))) + (getColor(getNeighbour(pt, Direction::East)) + getColor(pt) + getColor(getNeighbour(pt, Direction::SouthEast))) / 3.0f; } @@ -286,7 +286,7 @@ void TerrainRenderer::Init(const MapExtent& size) } /// Get the edge type description index that t1 draws over t2. If none a falsy index is returned -static DescIdx GetEdgeType(const TerrainDesc& t1, const TerrainDesc& t2) +static DescIdx getEdgeType(const TerrainDesc& t1, const TerrainDesc& t2) { if(!t1.edgeType || t1.edgePriority <= t2.edgePriority) return {}; @@ -299,36 +299,36 @@ static DescIdx GetEdgeType(const TerrainDesc& t1, const TerrainDesc& t */ void TerrainRenderer::GenerateOpenGL(const GameWorldViewer& gwv) { - const GameWorldBase& world = gwv.GetWorld(); - Init(world.GetSize()); + const GameWorldBase& world = gwv.getWorld(); + Init(world.getSize()); GenerateVertices(gwv); - const WorldDescription& desc = world.GetDescription(); + const WorldDescription& desc = world.getDescription(); LoadTextures(desc); // Add extra vertices for borders unsigned numTriangles = gl_vertices.size(); RTTR_FOREACH_PT(MapPoint, size_) { - const unsigned pos = GetVertexIdx(pt); + const unsigned pos = getVertexIdx(pt); const TerrainDesc& t1 = desc.get(terrain[pos][0]); const TerrainDesc& t2 = desc.get(terrain[pos][1]); - const TerrainDesc& t3 = desc.get(terrain[GetVertexIdx(GetNeighbour(pt, Direction::East))][0]); - const TerrainDesc& t4 = desc.get(terrain[GetVertexIdx(GetNeighbour(pt, Direction::SouthWest))][1]); + const TerrainDesc& t3 = desc.get(terrain[getVertexIdx(getNeighbour(pt, Direction::East))][0]); + const TerrainDesc& t4 = desc.get(terrain[getVertexIdx(getNeighbour(pt, Direction::SouthWest))][1]); - if((borders[pos].left_right[0] = GetEdgeType(t2, t1))) + if((borders[pos].left_right[0] = getEdgeType(t2, t1))) borders[pos].left_right_offset[0] = numTriangles++; - if((borders[pos].left_right[1] = GetEdgeType(t1, t2))) + if((borders[pos].left_right[1] = getEdgeType(t1, t2))) borders[pos].left_right_offset[1] = numTriangles++; - if((borders[pos].right_left[0] = GetEdgeType(t3, t2))) + if((borders[pos].right_left[0] = getEdgeType(t3, t2))) borders[pos].right_left_offset[0] = numTriangles++; - if((borders[pos].right_left[1] = GetEdgeType(t2, t3))) + if((borders[pos].right_left[1] = getEdgeType(t2, t3))) borders[pos].right_left_offset[1] = numTriangles++; - if((borders[pos].top_down[0] = GetEdgeType(t4, t1))) + if((borders[pos].top_down[0] = getEdgeType(t4, t1))) borders[pos].top_down_offset[0] = numTriangles++; - if((borders[pos].top_down[1] = GetEdgeType(t1, t4))) + if((borders[pos].top_down[1] = getEdgeType(t1, t4))) borders[pos].top_down_offset[1] = numTriangles++; } @@ -371,17 +371,17 @@ void TerrainRenderer::GenerateOpenGL(const GameWorldViewer& gwv) void TerrainRenderer::UpdateTrianglePos(const MapPoint pt, bool updateVBO) { - unsigned pos = GetTriangleIdx(pt); + unsigned pos = getTriangleIdx(pt); - gl_vertices[pos][0] = GetVertexPos(pt); - gl_vertices[pos][1] = GetNeighbourVertexPos(pt, Direction::SouthWest); - gl_vertices[pos][2] = GetNeighbourVertexPos(pt, Direction::SouthEast); + gl_vertices[pos][0] = getVertexPos(pt); + gl_vertices[pos][1] = getNeighbourVertexPos(pt, Direction::SouthWest); + gl_vertices[pos][2] = getNeighbourVertexPos(pt, Direction::SouthEast); ++pos; - gl_vertices[pos][0] = GetVertexPos(pt); - gl_vertices[pos][1] = GetNeighbourVertexPos(pt, Direction::SouthEast); - gl_vertices[pos][2] = GetNeighbourVertexPos(pt, Direction::East); + gl_vertices[pos][0] = getVertexPos(pt); + gl_vertices[pos][1] = getNeighbourVertexPos(pt, Direction::SouthEast); + gl_vertices[pos][2] = getNeighbourVertexPos(pt, Direction::East); if(updateVBO && vbo_vertices.isValid()) { @@ -392,23 +392,23 @@ void TerrainRenderer::UpdateTrianglePos(const MapPoint pt, bool updateVBO) void TerrainRenderer::UpdateTriangleColor(const MapPoint pt, bool updateVBO) { - unsigned pos = GetTriangleIdx(pt); + unsigned pos = getTriangleIdx(pt); Color& clr0 = gl_colors[pos][0]; Color& clr1 = gl_colors[pos][1]; Color& clr2 = gl_colors[pos][2]; - clr0.r = clr0.g = clr0.b = GetColor(pt); - clr1.r = clr1.g = clr1.b = GetColor(GetNeighbour(pt, Direction::SouthWest)); - clr2.r = clr2.g = clr2.b = GetColor(GetNeighbour(pt, Direction::SouthEast)); + clr0.r = clr0.g = clr0.b = getColor(pt); + clr1.r = clr1.g = clr1.b = getColor(getNeighbour(pt, Direction::SouthWest)); + clr2.r = clr2.g = clr2.b = getColor(getNeighbour(pt, Direction::SouthEast)); ++pos; Color& clr3 = gl_colors[pos][0]; Color& clr4 = gl_colors[pos][1]; Color& clr5 = gl_colors[pos][2]; - clr3.r = clr3.g = clr3.b = GetColor(pt); - clr4.r = clr4.g = clr4.b = GetColor(GetNeighbour(pt, Direction::SouthEast)); - clr5.r = clr5.g = clr5.b = GetColor(GetNeighbour(pt, Direction::East)); + clr3.r = clr3.g = clr3.b = getColor(pt); + clr4.r = clr4.g = clr4.b = getColor(getNeighbour(pt, Direction::SouthEast)); + clr5.r = clr5.g = clr5.b = getColor(getNeighbour(pt, Direction::East)); if(updateVBO && vbo_colors.isValid()) { @@ -419,11 +419,11 @@ void TerrainRenderer::UpdateTriangleColor(const MapPoint pt, bool updateVBO) void TerrainRenderer::UpdateTriangleTerrain(const MapPoint pt, bool updateVBO) { - const unsigned nodeIdx = GetVertexIdx(pt); + const unsigned nodeIdx = getVertexIdx(pt); const DescIdx t1 = terrain[nodeIdx][0]; const DescIdx t2 = terrain[nodeIdx][1]; - const unsigned triangleIdx = GetTriangleIdx(pt); + const unsigned triangleIdx = getTriangleIdx(pt); gl_texcoords[triangleIdx] = terrainTextures[t1].rsuCoords; gl_texcoords[triangleIdx + 1] = terrainTextures[t2].usdCoords; @@ -437,7 +437,7 @@ void TerrainRenderer::UpdateTriangleTerrain(const MapPoint pt, bool updateVBO) /// Erzeugt die Dreiecke für die Ränder void TerrainRenderer::UpdateBorderTrianglePos(const MapPoint pt, bool updateVBO) { - unsigned pos = GetVertexIdx(pt); + unsigned pos = getVertexIdx(pt); // Für VBO-Aktualisierung: // Erzeugte Ränder zählen @@ -455,9 +455,9 @@ void TerrainRenderer::UpdateBorderTrianglePos(const MapPoint pt, bool updateVBO) if(!first_offset) first_offset = offset; - gl_vertices[offset][i ? 0 : 2] = GetVertexPos(pt); - gl_vertices[offset][1] = GetNeighbourVertexPos(pt, Direction::SouthEast); - gl_vertices[offset][i ? 2 : 0] = GetBorderPos(pt, i); + gl_vertices[offset][i ? 0 : 2] = getVertexPos(pt); + gl_vertices[offset][1] = getNeighbourVertexPos(pt, Direction::SouthEast); + gl_vertices[offset][i ? 2 : 0] = getBorderPos(pt, i); ++count_borders; } @@ -472,13 +472,13 @@ void TerrainRenderer::UpdateBorderTrianglePos(const MapPoint pt, bool updateVBO) if(!first_offset) first_offset = offset; - gl_vertices[offset][i ? 2 : 0] = GetNeighbourVertexPos(pt, Direction::SouthEast); - gl_vertices[offset][1] = GetNeighbourVertexPos(pt, Direction::East); + gl_vertices[offset][i ? 2 : 0] = getNeighbourVertexPos(pt, Direction::SouthEast); + gl_vertices[offset][1] = getNeighbourVertexPos(pt, Direction::East); if(i == 0) - gl_vertices[offset][2] = GetBorderPos(pt, 1); + gl_vertices[offset][2] = getBorderPos(pt, 1); else - gl_vertices[offset][0] = GetNeighbourBorderPos(pt, 0, Direction::East); + gl_vertices[offset][0] = getNeighbourBorderPos(pt, 0, Direction::East); ++count_borders; } @@ -493,13 +493,13 @@ void TerrainRenderer::UpdateBorderTrianglePos(const MapPoint pt, bool updateVBO) if(!first_offset) first_offset = offset; - gl_vertices[offset][i ? 2 : 0] = GetNeighbourVertexPos(pt, Direction::SouthWest); - gl_vertices[offset][1] = GetNeighbourVertexPos(pt, Direction::SouthEast); + gl_vertices[offset][i ? 2 : 0] = getNeighbourVertexPos(pt, Direction::SouthWest); + gl_vertices[offset][1] = getNeighbourVertexPos(pt, Direction::SouthEast); if(i == 0) - gl_vertices[offset][2] = GetBorderPos(pt, i); + gl_vertices[offset][2] = getBorderPos(pt, i); else - gl_vertices[offset][0] = GetNeighbourBorderPos(pt, i, Direction::SouthWest); + gl_vertices[offset][0] = getNeighbourBorderPos(pt, i, Direction::SouthWest); ++count_borders; } @@ -513,7 +513,7 @@ void TerrainRenderer::UpdateBorderTrianglePos(const MapPoint pt, bool updateVBO) void TerrainRenderer::UpdateBorderTriangleColor(const MapPoint pt, bool updateVBO) { - unsigned pos = GetVertexIdx(pt); + unsigned pos = getVertexIdx(pt); // Für VBO-Aktualisierung: // Erzeugte Ränder zählen @@ -532,11 +532,11 @@ void TerrainRenderer::UpdateBorderTriangleColor(const MapPoint pt, bool updateVB first_offset = offset; gl_colors[offset][i ? 0 : 2].r = gl_colors[offset][i ? 0 : 2].g = gl_colors[offset][i ? 0 : 2].b = - GetColor(pt); //-V807 + getColor(pt); //-V807 gl_colors[offset][1].r = gl_colors[offset][1].g = gl_colors[offset][1].b = - GetColor(GetNeighbour(pt, Direction::SouthEast)); //-V807 + getColor(getNeighbour(pt, Direction::SouthEast)); //-V807 gl_colors[offset][i ? 2 : 0].r = gl_colors[offset][i ? 2 : 0].g = gl_colors[offset][i ? 2 : 0].b = - GetBorderColor(pt, i); //-V807 + getBorderColor(pt, i); //-V807 ++count_borders; } @@ -552,14 +552,14 @@ void TerrainRenderer::UpdateBorderTriangleColor(const MapPoint pt, bool updateVB first_offset = offset; gl_colors[offset][i ? 2 : 0].r = gl_colors[offset][i ? 2 : 0].g = gl_colors[offset][i ? 2 : 0].b = - GetColor(GetNeighbour(pt, Direction::SouthEast)); + getColor(getNeighbour(pt, Direction::SouthEast)); gl_colors[offset][1].r = gl_colors[offset][1].g = gl_colors[offset][1].b = - GetColor(GetNeighbour(pt, Direction::East)); + getColor(getNeighbour(pt, Direction::East)); MapPoint pt2(pt.x + i, pt.y); if(pt2.x >= size_.x) pt2.x -= size_.x; gl_colors[offset][i ? 0 : 2].r = gl_colors[offset][i ? 0 : 2].g = gl_colors[offset][i ? 0 : 2].b = - GetBorderColor(pt2, i ? 0 : 1); + getBorderColor(pt2, i ? 0 : 1); ++count_borders; } @@ -575,15 +575,15 @@ void TerrainRenderer::UpdateBorderTriangleColor(const MapPoint pt, bool updateVB first_offset = offset; gl_colors[offset][i ? 2 : 0].r = gl_colors[offset][i ? 2 : 0].g = gl_colors[offset][i ? 2 : 0].b = - GetColor(GetNeighbour(pt, Direction::SouthWest)); + getColor(getNeighbour(pt, Direction::SouthWest)); gl_colors[offset][1].r = gl_colors[offset][1].g = gl_colors[offset][1].b = - GetColor(GetNeighbour(pt, Direction::SouthEast)); + getColor(getNeighbour(pt, Direction::SouthEast)); if(i == 0) - gl_colors[offset][2].r = gl_colors[offset][2].g = gl_colors[offset][2].b = GetBorderColor(pt, i); //-V807 + gl_colors[offset][2].r = gl_colors[offset][2].g = gl_colors[offset][2].b = getBorderColor(pt, i); //-V807 else gl_colors[offset][0].r = gl_colors[offset][0].g = gl_colors[offset][0].b = - GetBorderColor(GetNeighbour(pt, Direction::SouthWest), i); //-V807 + getBorderColor(getNeighbour(pt, Direction::SouthWest), i); //-V807 ++count_borders; } @@ -597,7 +597,7 @@ void TerrainRenderer::UpdateBorderTriangleColor(const MapPoint pt, bool updateVB void TerrainRenderer::UpdateBorderTriangleTerrain(const MapPoint pt, bool updateVBO) { - unsigned pos = GetVertexIdx(pt); + unsigned pos = getVertexIdx(pt); // For updating the VBO count created borders and first offset unsigned count_borders = 0; @@ -614,8 +614,8 @@ void TerrainRenderer::UpdateBorderTriangleTerrain(const MapPoint pt, bool update first_offset = offset; const glArchivItem_Bitmap& texture = *edgeTextures[borders[pos].left_right[i]]; - Extent bmpSize = texture.GetSize(); - PointF texSize(texture.GetTexSize()); + Extent bmpSize = texture.getSize(); + PointF texSize(texture.getTexSize()); gl_texcoords[offset][i ? 0 : 2] = PointF(0.0f, 0.0f); gl_texcoords[offset][1] = PointF(bmpSize.x / texSize.x, 0.0f); @@ -636,8 +636,8 @@ void TerrainRenderer::UpdateBorderTriangleTerrain(const MapPoint pt, bool update first_offset = offset; const glArchivItem_Bitmap& texture = *edgeTextures[borders[pos].right_left[i]]; - Extent bmpSize = texture.GetSize(); - PointF texSize(texture.GetTexSize()); + Extent bmpSize = texture.getSize(); + PointF texSize(texture.getTexSize()); gl_texcoords[offset][i ? 2 : 0] = PointF(0.0f, 0.0f); gl_texcoords[offset][1] = PointF(bmpSize.x / texSize.x, 0.0f); @@ -658,8 +658,8 @@ void TerrainRenderer::UpdateBorderTriangleTerrain(const MapPoint pt, bool update first_offset = offset; const glArchivItem_Bitmap& texture = *edgeTextures[borders[pos].top_down[i]]; - Extent bmpSize = texture.GetSize(); - PointF texSize(texture.GetTexSize()); + Extent bmpSize = texture.getSize(); + PointF texSize(texture.getTexSize()); gl_texcoords[offset][i ? 2 : 0] = PointF(0.0f, 0.0f); gl_texcoords[offset][1] = PointF(bmpSize.x / texSize.x, 0.0f); @@ -700,7 +700,7 @@ void TerrainRenderer::Draw(const Position& firstPt, const Position& lastPt, cons Position posOffset; MapPoint tP = ConvertCoords(Position(x, y), &posOffset); - auto t = terrain[GetVertexIdx(tP)][0]; + auto t = terrain[getVertexIdx(tP)][0]; if(posOffset != lastOffset) lastTerrain = DescIdx(); @@ -708,24 +708,24 @@ void TerrainRenderer::Draw(const Position& firstPt, const Position& lastPt, cons ++sorted_textures[t].back().count; else { - MapTile tmp(GetTriangleIdx(tP), posOffset); + MapTile tmp(getTriangleIdx(tP), posOffset); sorted_textures[t].push_back(tmp); lastTerrain = t; } - t = terrain[GetVertexIdx(tP)][1]; + t = terrain[getVertexIdx(tP)][1]; if(t == lastTerrain) ++sorted_textures[t].back().count; else { - MapTile tmp(GetTriangleIdx(tP) + 1, posOffset); + MapTile tmp(getTriangleIdx(tP) + 1, posOffset); sorted_textures[t].push_back(tmp); } lastTerrain = t; - const Borders& curBorders = borders[GetVertexIdx(tP)]; + const Borders& curBorders = borders[getVertexIdx(tP)]; helpers::EnumArray, Direction> tiles = { {curBorders.left_right[0], curBorders.left_right[1], curBorders.right_left[0], curBorders.right_left[1], curBorders.top_down[0], curBorders.top_down[1]}}; @@ -762,7 +762,7 @@ void TerrainRenderer::Draw(const Position& firstPt, const Position& lastPt, cons if(water) { - const WorldDescription& desc = gwv.GetWorld().GetDescription(); + const WorldDescription& desc = gwv.getWorld().getDescription(); unsigned water_count = 0; for(const auto t : sorted_textures.indices()) { @@ -822,11 +822,11 @@ void TerrainRenderer::Draw(const Position& firstPt, const Position& lastPt, cons unsigned animationFrame; const unsigned numFrames = terrainTextures[t].textures.size(); if(numFrames > 1) - animationFrame = GAMECLIENT.GetGlobalAnimation(numFrames, 5 * numFrames, 16, 0); // We have 5/16 per frame + animationFrame = GAMECLIENT.getGlobalAnimation(numFrames, 5 * numFrames, 16, 0); // We have 5/16 per frame else animationFrame = 0; - VIDEODRIVER.BindTexture(terrainTextures[t].textures[animationFrame].GetTextureNoCreate()); + VIDEODRIVER.BindTexture(terrainTextures[t].textures[animationFrame].getTextureNoCreate()); for(const auto& texture : sorted_textures[t]) { @@ -852,7 +852,7 @@ void TerrainRenderer::Draw(const Position& firstPt, const Position& lastPt, cons { if(sorted_borders[i].empty()) continue; - VIDEODRIVER.BindTexture(edgeTextures[i]->GetTextureNoCreate()); + VIDEODRIVER.BindTexture(edgeTextures[i]->getTextureNoCreate()); for(const auto& texture : sorted_borders[i]) { @@ -896,10 +896,10 @@ MapPoint TerrainRenderer::ConvertCoords(const Position pt, Position* offset) con void TerrainRenderer::PrepareWaysPoint(PreparedRoads& sorted_roads, const GameWorldViewer& gwViewer, MapPoint pt, const Position& offset) const { - const WorldDescription& desc = gwViewer.GetWorld().GetDescription(); - Position startPos = Position(Position::Truncate, GetVertexPos(pt)) + offset; + const WorldDescription& desc = gwViewer.getWorld().getDescription(); + Position startPos = Position(Position::Truncate, getVertexPos(pt)) + offset; - Visibility visibility = gwViewer.GetVisibility(pt); + Visibility visibility = gwViewer.getVisibility(pt); int totalWidth = size_.x * TR_W; int totalHeight = size_.y * TR_H; @@ -907,13 +907,13 @@ void TerrainRenderer::PrepareWaysPoint(PreparedRoads& sorted_roads, const GameWo // Wegtypen für die drei Richtungen for(const RoadDir dir : helpers::EnumRange{}) { - const PointRoad type = gwViewer.GetVisibleRoad(pt, dir, visibility); + const PointRoad type = gwViewer.getVisibleRoad(pt, dir, visibility); if(type == PointRoad::None) continue; const Direction targetDir = toDirection(dir); - MapPoint ta = gwViewer.GetNeighbour(pt, targetDir); + MapPoint ta = gwViewer.getNeighbour(pt, targetDir); - Position endPos = Position(Position::Truncate, GetVertexPos(ta)) + offset; + Position endPos = Position(Position::Truncate, getVertexPos(ta)) + offset; Position diff = startPos - endPos; // Gehen wir über einen Kartenrand (horizontale Richung?) @@ -939,7 +939,7 @@ void TerrainRenderer::PrepareWaysPoint(PreparedRoads& sorted_roads, const GameWo // else Upgraded for Donkey roads // else Normal uint8_t gfxRoadType; - const auto terrain = gwViewer.GetWorld().GetTerrain(pt, targetDir); + const auto terrain = gwViewer.getWorld().getTerrain(pt, targetDir); const TerrainDesc& lTerrain = desc.get(terrain.left); if(type == PointRoad::Boat) { @@ -960,7 +960,7 @@ void TerrainRenderer::PrepareWaysPoint(PreparedRoads& sorted_roads, const GameWo } } - sorted_roads[gfxRoadType].push_back(PreparedRoad(startPos, endPos, GetColor(pt), GetColor(ta), dir)); + sorted_roads[gfxRoadType].push_back(PreparedRoad(startPos, endPos, getColor(pt), getColor(ta), dir)); } } @@ -1001,7 +1001,7 @@ void TerrainRenderer::DrawWays(const PreparedRoads& sorted_roads) const continue; Tex2C3Ver2* curVertexData = vertexData.get(); const glArchivItem_Bitmap& texture = *roadTextures[itRoad.index()]; - PointF scaledTexSize = texture.GetSize() / PointF(texture.GetTexSize()); + PointF scaledTexSize = texture.getSize() / PointF(texture.getTexSize()); for(const auto& it : itRoad.value()) { @@ -1041,7 +1041,7 @@ void TerrainRenderer::DrawWays(const PreparedRoads& sorted_roads) const curVertexData++; } - VIDEODRIVER.BindTexture(texture.GetTextureNoCreate()); + VIDEODRIVER.BindTexture(texture.getTextureNoCreate()); glDrawArrays(GL_QUADS, 0, itRoad.value().size() * 4); } // Note: No glDisableClientState as we did not enable it @@ -1053,20 +1053,20 @@ void TerrainRenderer::AltitudeChanged(const MapPoint pt, const GameWorldViewer& UpdateVertexPos(pt, gwv); UpdateVertexColor(pt, gwv); - for(const MapPoint nb : gwv.GetNeighbours(pt)) + for(const MapPoint nb : gwv.getNeighbours(pt)) UpdateVertexColor(nb, gwv); // und für die Ränder UpdateBorderVertex(pt); - for(const MapPoint nb : gwv.GetNeighbours(pt)) + for(const MapPoint nb : gwv.getNeighbours(pt)) UpdateBorderVertex(nb); // den selbst sowieso die Punkte darum updaten, da sich bei letzteren die Schattierung geändert haben könnte UpdateTrianglePos(pt, true); UpdateTriangleColor(pt, true); - for(const MapPoint nb : gwv.GetNeighbours(pt)) + for(const MapPoint nb : gwv.getNeighbours(pt)) { UpdateTrianglePos(nb, true); UpdateTriangleColor(nb, true); @@ -1075,20 +1075,20 @@ void TerrainRenderer::AltitudeChanged(const MapPoint pt, const GameWorldViewer& // Auch im zweiten Kreis drumherum die Dreiecke neu berechnen, da die durch die Schattenänderung der umliegenden // Punkte auch geändert werden könnten for(unsigned i = 0; i < 12; ++i) - UpdateTriangleColor(gwv.GetWorld().GetNeighbour2(pt, i), true); + UpdateTriangleColor(gwv.getWorld().getNeighbour2(pt, i), true); // und für die Ränder UpdateBorderTrianglePos(pt, true); UpdateBorderTriangleColor(pt, true); - for(const MapPoint nb : gwv.GetNeighbours(pt)) + for(const MapPoint nb : gwv.getNeighbours(pt)) { UpdateBorderTrianglePos(nb, true); UpdateBorderTriangleColor(nb, true); } for(unsigned i = 0; i < 12; ++i) - UpdateBorderTriangleColor(gwv.GetWorld().GetNeighbour2(pt, i), true); + UpdateBorderTriangleColor(gwv.getWorld().getNeighbour2(pt, i), true); } void TerrainRenderer::VisibilityChanged(const MapPoint pt, const GameWorldViewer& gwv) @@ -1098,22 +1098,22 @@ void TerrainRenderer::VisibilityChanged(const MapPoint pt, const GameWorldViewer return; UpdateVertexColor(pt, gwv); - for(const MapPoint nb : gwv.GetNeighbours(pt)) + for(const MapPoint nb : gwv.getNeighbours(pt)) UpdateVertexColor(nb, gwv); // und für die Ränder UpdateBorderVertex(pt); - for(const MapPoint nb : gwv.GetNeighbours(pt)) + for(const MapPoint nb : gwv.getNeighbours(pt)) UpdateBorderVertex(nb); // den selbst sowieso die Punkte darum updaten, da sich bei letzteren die Schattierung geändert haben könnte UpdateTriangleColor(pt, true); - for(const MapPoint nb : gwv.GetNeighbours(pt)) + for(const MapPoint nb : gwv.getNeighbours(pt)) UpdateTriangleColor(nb, true); // und für die Ränder UpdateBorderTriangleColor(pt, true); - for(const MapPoint nb : gwv.GetNeighbours(pt)) + for(const MapPoint nb : gwv.getNeighbours(pt)) UpdateBorderTriangleColor(nb, true); } @@ -1138,7 +1138,7 @@ void TerrainRenderer::UpdateAllColors(const GameWorldViewer& gwv) } } -MapPoint TerrainRenderer::GetNeighbour(const MapPoint& pt, const Direction dir) const +MapPoint TerrainRenderer::getNeighbour(const MapPoint& pt, const Direction dir) const { - return MakeMapPoint(::GetNeighbour(Position(pt), dir), size_); + return MakeMapPoint(::getNeighbour(Position(pt), dir), size_); } diff --git a/libs/s25main/TerrainRenderer.h b/libs/s25main/TerrainRenderer.h index f9d83ff9c0..b06fc10abf 100644 --- a/libs/s25main/TerrainRenderer.h +++ b/libs/s25main/TerrainRenderer.h @@ -44,10 +44,10 @@ class TerrainRenderer : private boost::noncopyable /// Optionally returns offset of returned point to original point in pixels (for drawing) MapPoint ConvertCoords(Position pt, Position* offset = nullptr) const; /// Get position of node in pixels (VertexPos) - PointF GetVertexPos(const MapPoint pt) const { return GetVertex(pt).pos; } + PointF getVertexPos(const MapPoint pt) const { return getVertex(pt).pos; } /// Get neighbour position of a node (VertexPos) potentially shifted so that the returned value is next to /// GetNodePos(pt) - PointF GetNeighbourVertexPos(MapPoint pt, Direction dir) const; + PointF getNeighbourVertexPos(MapPoint pt, Direction dir) const; /// Callback function for altitude changes void AltitudeChanged(MapPoint pt, const GameWorldViewer& gwv); @@ -145,18 +145,18 @@ class TerrainRenderer : private boost::noncopyable std::vector roadTextures; /// Returns the index of a vertex. Used to access vertices and borders - unsigned GetVertexIdx(const MapPoint pt) const + unsigned getVertexIdx(const MapPoint pt) const { return static_cast(pt.y) * static_cast(size_.x) + static_cast(pt.x); } /// Returns the index of the first triangle (each point has 2). Used to access gl_* structs - unsigned GetTriangleIdx(const MapPoint pt) const { return GetVertexIdx(pt) * 2; } + unsigned getTriangleIdx(const MapPoint pt) const { return getVertexIdx(pt) * 2; } /// Return the coordinates of the neighbour node - MapPoint GetNeighbour(const MapPoint& pt, Direction dir) const; + MapPoint getNeighbour(const MapPoint& pt, Direction dir) const; /// liefert den Vertex an der Stelle X, Y. - Vertex& GetVertex(const MapPoint pt) { return vertices[GetVertexIdx(pt)]; } - const Vertex& GetVertex(const MapPoint pt) const { return vertices[GetVertexIdx(pt)]; } + Vertex& getVertex(const MapPoint pt) { return vertices[getVertexIdx(pt)]; } + const Vertex& getVertex(const MapPoint pt) const { return vertices[getVertexIdx(pt)]; } void LoadTextures(const WorldDescription& desc); @@ -179,16 +179,16 @@ class TerrainRenderer : private boost::noncopyable void UpdateBorderTriangleTerrain(MapPoint pt, bool updateVBO); /// liefert den Vertex-Farbwert an der Stelle X,Y - float GetColor(const MapPoint pt) const { return GetVertex(pt).color; } + float getColor(const MapPoint pt) const { return getVertex(pt).color; } /// liefert den Rand-Vertex an der Stelle X,Y - PointF GetBorderPos(const MapPoint pt, unsigned char triangle) const { return GetVertex(pt).borderPos[triangle]; } + PointF getBorderPos(const MapPoint pt, unsigned char triangle) const { return getVertex(pt).borderPos[triangle]; } /// Get neighbour border position of a node (VertexPos) potentially shifted so that the returned value is next to /// GetBorderPos(pt) - PointF GetNeighbourBorderPos(MapPoint pt, unsigned char triangle, Direction dir) const; + PointF getNeighbourBorderPos(MapPoint pt, unsigned char triangle, Direction dir) const; /// liefert den Rand-Vertex-Farbwert an der Stelle X,Y - float GetBorderColor(const MapPoint pt, unsigned char triangle) const + float getBorderColor(const MapPoint pt, unsigned char triangle) const { - return GetVertex(pt).borderColor[triangle]; + return getVertex(pt).borderColor[triangle]; } /// Adds possible roads from the given point to the prepared data struct diff --git a/libs/s25main/TextFormatSetter.h b/libs/s25main/TextFormatSetter.h index 0c4d0096f3..a8aacc2d02 100644 --- a/libs/s25main/TextFormatSetter.h +++ b/libs/s25main/TextFormatSetter.h @@ -11,8 +11,8 @@ struct TextFormatSetter { ctrlBaseText* ctrl; boost::format fmt; - TextFormatSetter(ctrlBaseText* ctrl) : ctrl(ctrl), fmt(ctrl->GetText()) {} - ~TextFormatSetter() { ctrl->SetText(fmt.str()); } + TextFormatSetter(ctrlBaseText* ctrl) : ctrl(ctrl), fmt(ctrl->getText()) {} + ~TextFormatSetter() { ctrl->setText(fmt.str()); } template TextFormatSetter& operator%(const T& val) { diff --git a/libs/s25main/TradePathCache.cpp b/libs/s25main/TradePathCache.cpp index 9f72142f31..97c77f1a63 100644 --- a/libs/s25main/TradePathCache.cpp +++ b/libs/s25main/TradePathCache.cpp @@ -20,7 +20,7 @@ bool TradePathCache::pathExists(const MapPoint start, const MapPoint goal, const if(world.CheckTradeRoute(paths[entryIdx].path.start, paths[entryIdx].path.route, 0, player, &checkedGoal)) { RTTR_Assert(checkedGoal == start || checkedGoal == goal); - paths[entryIdx].lastUse = world.GetEvMgr().GetCurrentGF(); + paths[entryIdx].lastUse = world.getEvMgr().getCurrentGF(); return true; } else { @@ -41,7 +41,7 @@ bool TradePathCache::pathExists(const MapPoint start, const MapPoint goal, const int TradePathCache::findEntry(const MapPoint start, const MapPoint goal, const PlayerIdx player) const { - const GamePlayer& thisPlayer = world.GetPlayer(player); + const GamePlayer& thisPlayer = world.getPlayer(player); for(unsigned i = 0; i < paths.size(); i++) { @@ -50,7 +50,7 @@ int TradePathCache::findEntry(const MapPoint start, const MapPoint goal, const P continue; if(pathEntry.path.goal != goal && pathEntry.path.start != goal) continue; - if(!thisPlayer.IsAlly(pathEntry.player)) + if(!thisPlayer.isAlly(pathEntry.player)) continue; return i; } @@ -59,7 +59,7 @@ int TradePathCache::findEntry(const MapPoint start, const MapPoint goal, const P void TradePathCache::addEntry(TradePath path, const PlayerIdx player) { - Entry entry{player, world.GetEvMgr().GetCurrentGF(), std::move(path)}; + Entry entry{player, world.getEvMgr().getCurrentGF(), std::move(path)}; int idx = findEntry(entry.path.start, entry.path.goal, player); if(idx < 0) diff --git a/libs/s25main/Ware.cpp b/libs/s25main/Ware.cpp index 78bcbf7366..96e2e566a6 100644 --- a/libs/s25main/Ware.cpp +++ b/libs/s25main/Ware.cpp @@ -23,12 +23,12 @@ Ware::Ware(const GoodType type, noBaseBuilding* goal, noRoadNode* location) : next_dir(RoadPathDirection::None), state(State::WaitInWarehouse), location(location), type(convertShieldToNation(type, - world->GetPlayer(location->GetPlayer()).nation)), // Use nation specific shield + world->getPlayer(location->getPlayer()).nation)), // Use nation specific shield goal(goal), next_harbor(MapPoint::Invalid()) { RTTR_Assert(location); // Ware in den Index mit eintragen - world->GetPlayer(location->GetPlayer()).RegisterWare(*this); + world->getPlayer(location->getPlayer()).RegisterWare(*this); if(goal) goal->TakeWare(this); } @@ -40,10 +40,10 @@ void Ware::Destroy() RTTR_Assert(!goal); RTTR_Assert(!location); #if RTTR_ENABLE_ASSERTS - for(unsigned p = 0; p < world->GetNumPlayers(); p++) + for(unsigned p = 0; p < world->getNumPlayers(); p++) { - RTTR_Assert(!world->GetPlayer(p).IsWareRegistred(*this)); - RTTR_Assert(!world->GetPlayer(p).IsWareDependent(*this)); + RTTR_Assert(!world->getPlayer(p).isWareRegistred(*this)); + RTTR_Assert(!world->getPlayer(p).isWareDependent(*this)); } #endif } @@ -60,7 +60,7 @@ void Ware::Serialize(SerializedGameData& sgd) const static RoadPathDirection PopRoadPathDirection(SerializedGameData& sgd) { - if(sgd.GetGameDataVersion() < 5) + if(sgd.getGameDataVersion() < 5) { const auto iDir = sgd.PopUnsignedChar(); if(iDir == 100) @@ -79,12 +79,12 @@ Ware::Ware(SerializedGameData& sgd, const unsigned obj_id) location(sgd.PopObject()), type([&]() { // GoodType::Nothing is moved because of adding new wares due addons auto ware = sgd.Pop(); - if(sgd.GetGameDataVersion() < 11) + if(sgd.getGameDataVersion() < 11) { // The old GoodType::Nothing is now GoodType::Grapes if(ware == GoodType::Grapes) ware = GoodType::Nothing; - } else if(sgd.GetGameDataVersion() < 12) + } else if(sgd.getGameDataVersion() < 12) { // The old GoodType::Nothing is now GoodType::Skins if(ware == GoodType::Skins) @@ -95,7 +95,7 @@ Ware::Ware(SerializedGameData& sgd, const unsigned obj_id) goal(sgd.PopObject()), next_harbor(sgd.PopMapPoint()) {} -void Ware::SetGoal(noBaseBuilding* newGoal) +void Ware::setGoal(noBaseBuilding* newGoal) { goal = newGoal; if(goal) @@ -119,9 +119,9 @@ void Ware::RecalcRoute() if(state == State::WaitForShip) { // Ware was waiting for a ship so send the ware into the harbor - RTTR_Assert(location->GetGOT() == GO_Type::NobHarborbuilding); + RTTR_Assert(location->getGOT() == GO_Type::NobHarborbuilding); state = State::WaitInWarehouse; - SetGoal(static_cast(location)); + setGoal(static_cast(location)); // but not going by ship static_cast(goal)->WareDontWantToTravelByShip(this); } else @@ -136,7 +136,7 @@ void Ware::RecalcRoute() if(state == State::WaitForShip && next_dir != RoadPathDirection::Ship) { RTTR_Assert(location); - RTTR_Assert(location->GetGOT() == GO_Type::NobHarborbuilding); + RTTR_Assert(location->getGOT() == GO_Type::NobHarborbuilding); state = State::WaitInWarehouse; static_cast(location)->WareDontWantToTravelByShip(this); } @@ -164,26 +164,26 @@ void Ware::GoalDestroyed() { // Dann dem Hafen Bescheid sagen RTTR_Assert(location); - RTTR_Assert(location->GetGOT() == GO_Type::NobHarborbuilding); + RTTR_Assert(location->getGOT() == GO_Type::NobHarborbuilding); // This also adds the ware to the harbors inventory - auto ownedWare = static_cast(location)->CancelWareForShip(this); + auto ownedWare = static_cast(location)->cancelWareForShip(this); // Kill the ware - world->GetPlayer(location->GetPlayer()).RemoveWare(*this); + world->getPlayer(location->getPlayer()).RemoveWare(*this); goal = nullptr; location = nullptr; - GetEvMgr().AddToKillList(std::move(ownedWare)); + getEvMgr().AddToKillList(std::move(ownedWare)); } else { // Ware ist unterwegs, Lagerhaus finden und Ware dort einliefern RTTR_Assert(location); - RTTR_Assert(location->GetPlayer() < MAX_PLAYERS); + RTTR_Assert(location->getPlayer() < MAX_PLAYERS); // Currently carried out of a warehouse? - if(nobBaseWarehouse::isStorehouseGOT(location->GetGOT())) + if(nobBaseWarehouse::isStorehouseGOT(location->getGOT())) { if(location != goal) { - SetGoal(static_cast(location)); + setGoal(static_cast(location)); } else // at the goal (which was just destroyed) and get carried out right now? -> we are about to get // destroyed... { @@ -214,16 +214,16 @@ void Ware::GoalDestroyed() // find a warehouse for us (if we are entering a warehouse already set this as new goal (should only // happen if its a harbor for shipping as the building wasn't our goal)) if(nobBaseWarehouse::isStorehouseGOT( - location->GetGOT())) // currently carried into a warehouse? -> add ware (pathfinding + location->getGOT())) // currently carried into a warehouse? -> add ware (pathfinding // will not return this wh because of path lengths 0) { - if(location->GetGOT() != GO_Type::NobHarborbuilding) + if(location->getGOT() != GO_Type::NobHarborbuilding) LOG.write("WARNING: Ware::GoalDestroyed() -- ware is currently being carried into warehouse or " "hq that was not " "it's goal! ware id %i, type %s, player %i, wareloc %i,%i, goal loc %i,%i \n") - % GetObjId() % WARE_NAMES[type] % location->GetPlayer() % GetLocation()->GetX() - % GetLocation()->GetY() % goal->GetX() % goal->GetY(); - SetGoal(static_cast(location)); + % getObjId() % WARE_NAMES[type] % location->getPlayer() % getLocation()->getX() + % getLocation()->getY() % goal->getX() % goal->getY(); + setGoal(static_cast(location)); } else { goal = nullptr; @@ -274,11 +274,11 @@ void Ware::WareLost(const unsigned char player) { location = nullptr; // Inventur verringern - world->GetPlayer(player).DecreaseInventoryWare(type, 1); + world->getPlayer(player).DecreaseInventoryWare(type, 1); // Ziel der Ware Bescheid sagen NotifyGoalAboutLostWare(); // Zentrale Registrierung der Ware löschen - world->GetPlayer(player).RemoveWare(*this); + world->getPlayer(player).RemoveWare(*this); } void Ware::RemoveWareJobForDir(const RoadPathDirection last_next_dir) @@ -291,32 +291,32 @@ void Ware::RemoveWareJobForDir(const RoadPathDirection last_next_dir) return; Direction lastDir = toDirection(last_next_dir); // Existiert da noch ne Straße? - if(!location->GetRoute(lastDir)) + if(!location->getRoute(lastDir)) return; // Den Trägern Bescheid sagen - location->GetRoute(lastDir)->WareJobRemoved(nullptr); + location->getRoute(lastDir)->WareJobRemoved(nullptr); // Wenn nicht, könntes ja sein, dass die Straße in ein Lagerhaus führt, dann muss dort Bescheid gesagt werden - if(location->GetRoute(lastDir)->GetF2()->GetType() == NodalObjectType::Building) + if(location->getRoute(lastDir)->getF2()->getType() == NodalObjectType::Building) { - auto* bld = static_cast(location->GetRoute(Direction::NorthWest)->GetF2()); - if(BuildingProperties::IsWareHouse(bld->GetBuildingType())) + auto* bld = static_cast(location->getRoute(Direction::NorthWest)->getF2()); + if(BuildingProperties::isWareHouse(bld->getBuildingType())) static_cast(bld)->DontFetchNextWare(); } } void Ware::CallCarrier() { - RTTR_Assert(IsWaitingAtFlag()); + RTTR_Assert(isWaitingAtFlag()); RTTR_Assert(next_dir != RoadPathDirection::None && next_dir != RoadPathDirection::Ship); RTTR_Assert(location); - location->GetRoute(toDirection(next_dir))->AddWareJob(location); + location->getRoute(toDirection(next_dir))->AddWareJob(location); } bool Ware::FindRouteToWarehouse() { RTTR_Assert(location); RTTR_Assert(!goal); // Goal should have been notified and therefore reset - SetGoal(world->GetPlayer(location->GetPlayer()).FindWarehouseForWare(*this)); + setGoal(world->getPlayer(location->getPlayer()).FindWarehouseForWare(*this)); if(goal) { @@ -339,7 +339,7 @@ bool Ware::FindRouteToWarehouse() /// a lost ware got ordered unsigned Ware::CheckNewGoalForLostWare(const noBaseBuilding& newgoal) const { - if(!IsWaitingAtFlag()) // todo: check all special cases for wares being carried right now and where possible allow + if(!isWaitingAtFlag()) // todo: check all special cases for wares being carried right now and where possible allow // them to be ordered return 0xFFFFFFFF; return CalcPathToGoal(newgoal).length; @@ -353,14 +353,14 @@ Ware::RouteParams Ware::CalcPathToGoal(const noBaseBuilding& newgoal) const { // in case the ware is right in front of the goal building the ware has to be moved away 1 flag and then back // because non-warehouses cannot just carry in new wares they need a helper to do this - if(possibledir == RoadPathDirection::NorthWest && newgoal.GetFlagPos() == location->GetPos()) + if(possibledir == RoadPathDirection::NorthWest && newgoal.getFlagPos() == location->getPos()) { // Not executed for road from flag to the warehouse as that is handled directly by the warehouse - RTTR_Assert(!BuildingProperties::IsWareHouse(newgoal.GetBuildingType())); + RTTR_Assert(!BuildingProperties::isWareHouse(newgoal.getBuildingType())); for(const auto dir : helpers::EnumRange{}) { // Bounce of in this direction - if(dir != Direction::NorthWest && location->GetRoute(dir)) + if(dir != Direction::NorthWest && location->getRoute(dir)) return {1, toRoadPathDirection(dir)}; } // got no other route from the flag -> impossible @@ -372,18 +372,18 @@ Ware::RouteParams Ware::CalcPathToGoal(const noBaseBuilding& newgoal) const } /// this assumes that the ware is at a flag (todo: handle carried wares) and that there is a valid path to the goal -void Ware::SetNewGoalForLostWare(noBaseBuilding& newgoal) +void Ware::setNewGoalForLostWare(noBaseBuilding& newgoal) { const auto newDir = CalcPathToGoal(newgoal).dir; if(newDir != RoadPathDirection::None) // there is a valid path to the goal? -> ordered! { next_dir = newDir; - SetGoal(&newgoal); + setGoal(&newgoal); CallCarrier(); } } -bool Ware::IsRouteToGoal() +bool Ware::isRouteToGoal() { RTTR_Assert(location); if(!goal) @@ -419,7 +419,7 @@ void Ware::WaitForShip(nobHarborBuilding* hb) std::string Ware::ToString() const { std::stringstream s; - s << "Ware(" << GetObjId() << "): type=" << GoodType2String(type) << ", location=" << location->GetX() << "," - << location->GetY(); + s << "Ware(" << getObjId() << "): type=" << GoodType2String(type) << ", location=" << location->getX() << "," + << location->getY(); return s.str(); } diff --git a/libs/s25main/Ware.h b/libs/s25main/Ware.h index 52397ee470..f38e963c47 100644 --- a/libs/s25main/Ware.h +++ b/libs/s25main/Ware.h @@ -56,19 +56,19 @@ class Ware : public GameObject void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Ware; } + GO_Type getGOT() const final { return GO_Type::Ware; } - RoadPathDirection GetNextDir() const { return next_dir; } + RoadPathDirection getNextDir() const { return next_dir; } /// Gibt nächsten Hafen zurück, falls vorhanden - MapPoint GetNextHarbor() const { return next_harbor; } - noBaseBuilding* GetGoal() const { return goal; } + MapPoint getNextHarbor() const { return next_harbor; } + noBaseBuilding* getGoal() const { return goal; } /// Sets the new goal and notifies it - void SetGoal(noBaseBuilding* newGoal); + void setGoal(noBaseBuilding* newGoal); /// Berechnet den Weg neu zu ihrem Ziel void RecalcRoute(); /// set new next dir - void SetNextDir(RoadPathDirection newNextDir) { next_dir = newNextDir; } - void SetNextDir(Direction newNextDir) { next_dir = toRoadPathDirection(newNextDir); } + void setNextDir(RoadPathDirection newNextDir) { next_dir = newNextDir; } + void setNextDir(Direction newNextDir) { next_dir = toRoadPathDirection(newNextDir); } /// Wird aufgerufen, wenn es das Ziel der Ware nicht mehr gibt und sie wieder "nach Hause" getragen werden muss void GoalDestroyed(); /// Changes the state of the ware @@ -80,14 +80,14 @@ class Ware : public GameObject /// Wenn die Ware vernichtet werden muss void WareLost(unsigned char player); /// Gibt Status der Ware zurück - bool IsWaitingAtFlag() const { return (state == State::WaitAtFlag); } - bool IsWaitingInWarehouse() const { return (state == State::WaitInWarehouse); } - bool IsWaitingForShip() const { return (state == State::WaitForShip); } - bool IsCarried() const { return (state == State::Carried); } + bool isWaitingAtFlag() const { return (state == State::WaitAtFlag); } + bool isWaitingInWarehouse() const { return (state == State::WaitInWarehouse); } + bool isWaitingForShip() const { return (state == State::WaitForShip); } + bool isCarried() const { return (state == State::Carried); } /// Sagt dem Träger Bescheid, dass sie in die aktuelle (next_dir) Richtung nicht mehr getragen werden will void RemoveWareJobForDir(RoadPathDirection last_next_dir); /// Überprüft, ob es noch ein Weg zum Ziel gibt - bool IsRouteToGoal(); + bool isRouteToGoal(); /// Tells the ware that it should look for a warehouse to go to and notifies that (if found) /// Sets nextDir to the next direction or invalid of no warehouse found bool FindRouteToWarehouse(); @@ -95,12 +95,12 @@ class Ware : public GameObject void CallCarrier(); /// a building is looking for a ware - check if this lost ware can be send to the building and then do it unsigned CheckNewGoalForLostWare(const noBaseBuilding& newgoal) const; - void SetNewGoalForLostWare(noBaseBuilding& newgoal); + void setNewGoalForLostWare(noBaseBuilding& newgoal); /// Gibt Ort der Ware zurück - noRoadNode* GetLocation() { return location; } - const noRoadNode* GetLocation() const { return location; } + noRoadNode* getLocation() { return location; } + const noRoadNode* getLocation() const { return location; } /// Ist die Ware eine LostWare (Ware, die kein Ziel mehr hat und irgendwo sinnlos rumliegt)? - bool IsLostWare() const { return ((goal == nullptr) && state != State::OnShip); } + bool isLostWare() const { return ((goal == nullptr) && state != State::OnShip); } /// Informiert Ware, dass eine Schiffsreise beginnt void StartShipJourney(); /// Informiert Ware, dass Schiffsreise beendet ist und die Ware nun in einem Hafengebäude liegt diff --git a/libs/s25main/Window.cpp b/libs/s25main/Window.cpp index 1875293a5c..2096b664cc 100644 --- a/libs/s25main/Window.cpp +++ b/libs/s25main/Window.cpp @@ -33,12 +33,12 @@ void Window::Draw() Draw_(); } -DrawPoint Window::GetPos() const +DrawPoint Window::getPos() const { return pos_; } -DrawPoint Window::GetDrawPos() const +DrawPoint Window::getDrawPos() const { DrawPoint result = pos_; const Window* temp = this; @@ -53,27 +53,27 @@ DrawPoint Window::GetDrawPos() const return result; } -Extent Window::GetSize() const +Extent Window::getSize() const { return size_; } -Rect Window::GetDrawRect() const +Rect Window::getDrawRect() const { - return Rect(GetDrawPos(), GetSize()); + return Rect(getDrawPos(), getSize()); } -Rect Window::GetBoundaryRect() const +Rect Window::getBoundaryRect() const { // Default to draw rect - return GetDrawRect(); + return getDrawRect(); } bool Window::RelayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& ke) { // Ask derived classes whether relaying messages is allowed // (For example, ingame windows might not want to receive keyboard messages when they are minimized) - if(!IsMessageRelayAllowed()) + if(!isMessageRelayAllowed()) return false; for(auto& wnd : childIdToWnd_ | boost::adaptors::map_values) @@ -88,7 +88,7 @@ bool Window::RelayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& ke) bool Window::RelayMouseMessage(MouseMsgHandler msg, const MouseCoords& mc) { // Ask derived classes whether relaying messages is allowed - if(!IsMessageRelayAllowed()) + if(!isMessageRelayAllowed()) return false; bool processed = false; @@ -97,7 +97,7 @@ bool Window::RelayMouseMessage(MouseMsgHandler msg, const MouseCoords& mc) // Use reverse iterator because the topmost (=last elements) should receive the messages first! for(auto& wnd : childIdToWnd_ | boost::adaptors::map_values | boost::adaptors::reversed) { - if(!lockedAreas_.empty() && IsInLockedRegion(mc.pos, wnd.get())) + if(!lockedAreas_.empty() && isInLockedRegion(mc.pos, wnd.get())) continue; if(wnd->visible_ && wnd->active_ && CALL_MEMBER_FN(*wnd, msg)(mc)) @@ -117,7 +117,7 @@ bool Window::RelayMouseMessage(MouseMsgHandler msg, const MouseCoords& mc) * * @param[in] activate Fenster aktivieren? */ -void Window::SetActive(bool activate) +void Window::setActive(bool activate) { active_ = activate; ActivateControls(activate); @@ -131,7 +131,7 @@ void Window::SetActive(bool activate) void Window::ActivateControls(bool activate) { for(auto& it : childIdToWnd_) - it.second->SetActive(activate); + it.second->setActive(activate); } /** @@ -148,8 +148,8 @@ void Window::LockRegion(Window* window, const Rect& rect) tofreeAreas_.erase(it); // Also lock the region for all parents - if(GetParent()) - GetParent()->LockRegion(this, rect); + if(getParent()) + getParent()->LockRegion(this, rect); } /** @@ -166,16 +166,16 @@ void Window::FreeRegion(Window* window) lockedAreas_.erase(window); // Also free the locked region for all parents - if(GetParent()) - GetParent()->FreeRegion(this); + if(getParent()) + getParent()->FreeRegion(this); } -void Window::SetPos(const DrawPoint& newPos) +void Window::setPos(const DrawPoint& newPos) { pos_ = newPos; } -bool Window::IsMessageRelayAllowed() const +bool Window::isMessageRelayAllowed() const { return true; } @@ -414,8 +414,8 @@ void Window::Draw3DBorder(const Rect& rect, TextureColor tc, bool elevated) { if(tc == TextureColor::Invisible) return; - glArchivItem_Bitmap* borderImg = LOADER.GetImageN("io", 12 + rttr::enum_cast(tc)); - VIDEODRIVER.GetRenderer()->Draw3DBorder(rect, elevated, *borderImg); + glArchivItem_Bitmap* borderImg = LOADER.getImageN("io", 12 + rttr::enum_cast(tc)); + VIDEODRIVER.getRenderer()->Draw3DBorder(rect, elevated, *borderImg); } void Window::Draw3DContent(const Rect& rect, TextureColor tc, bool elevated, bool highlighted, bool illuminated, @@ -423,23 +423,23 @@ void Window::Draw3DContent(const Rect& rect, TextureColor tc, bool elevated, boo { if(tc == TextureColor::Invisible) return; - glArchivItem_Bitmap* contentImg = LOADER.GetImageN("io", rttr::enum_cast(tc) * 2 + (highlighted ? 0 : 1)); - VIDEODRIVER.GetRenderer()->Draw3DContent(rect, elevated, *contentImg, illuminated, contentColor); + glArchivItem_Bitmap* contentImg = LOADER.getImageN("io", rttr::enum_cast(tc) * 2 + (highlighted ? 0 : 1)); + VIDEODRIVER.getRenderer()->Draw3DContent(rect, elevated, *contentImg, illuminated, contentColor); } void Window::DrawRectangle(const Rect& rect, unsigned color) { - VIDEODRIVER.GetRenderer()->DrawRect(rect, color); + VIDEODRIVER.getRenderer()->DrawRect(rect, color); } void Window::DrawLine(DrawPoint pt1, DrawPoint pt2, unsigned short width, unsigned color) { - VIDEODRIVER.GetRenderer()->DrawLine(pt1, pt2, width, color); + VIDEODRIVER.getRenderer()->DrawLine(pt1, pt2, width, color); } void Window::msgPaintBefore() { - animations_.update(VIDEODRIVER.GetTickCount()); + animations_.update(VIDEODRIVER.getTickCount()); for(auto& control : childIdToWnd_ | boost::adaptors::map_values) control->msgPaintBefore(); } @@ -465,8 +465,8 @@ void Window::msgScreenResize(const ScreenResizeEvent& sr) for(auto& ctrl : childIdToWnd_ | boost::adaptors::map_values) { // Save new size (could otherwise be changed(?) in Msg_ScreenResize) - Extent newSize = rescale(ctrl->GetSize()); - ctrl->SetPos(rescale(ctrl->GetPos())); + Extent newSize = rescale(ctrl->getSize()); + ctrl->setPos(rescale(ctrl->getPos())); ctrl->msgScreenResize(sr); ctrl->Resize(newSize); } @@ -476,7 +476,7 @@ void Window::msgScreenResize(const ScreenResizeEvent& sr) template T_Pt Window::Scale(const T_Pt& pt) { - return ScaleWindowPropUp::scale(pt, VIDEODRIVER.GetRenderSize()); + return ScaleWindowPropUp::scale(pt, VIDEODRIVER.getRenderSize()); } template @@ -491,7 +491,7 @@ template Extent Window::Scale(const Extent&); template DrawPoint Window::ScaleIf(const DrawPoint&) const; template Extent Window::ScaleIf(const Extent&) const; -bool Window::IsInLockedRegion(const Position& pos, const Window* exception) const +bool Window::isInLockedRegion(const Position& pos, const Window* exception) const { for(const auto& lockEntry : lockedAreas_) { @@ -504,12 +504,12 @@ bool Window::IsInLockedRegion(const Position& pos, const Window* exception) cons return false; } -bool Window::IsMouseOver() const +bool Window::isMouseOver() const { - return IsMouseOver(VIDEODRIVER.GetMousePos()); + return isMouseOver(VIDEODRIVER.getMousePos()); } -bool Window::IsMouseOver(const MouseCoords& mousePos) const +bool Window::isMouseOver(const MouseCoords& mousePos) const { - return IsPointInRect(mousePos.pos, GetBoundaryRect()); + return IsPointInRect(mousePos.pos, getBoundaryRect()); } diff --git a/libs/s25main/Window.h b/libs/s25main/Window.h index f50996e177..f2154db2b0 100644 --- a/libs/s25main/Window.h +++ b/libs/s25main/Window.h @@ -71,28 +71,28 @@ class Window /// Draw all contained controls if the window is visible void Draw(); /// Get the current position relative to the parent window - DrawPoint GetPos() const; + DrawPoint getPos() const; /// Get the absolute position for drawing - DrawPoint GetDrawPos() const; + DrawPoint getDrawPos() const; /// Get the size of the window - Extent GetSize() const; + Extent getSize() const; /// Get the extent of the window in absolute coordinates - Rect GetDrawRect() const; + Rect getDrawRect() const; /// Get the actual extents of the rect /// (might be different to the draw rect if the window resizes according to content) - virtual Rect GetBoundaryRect() const; + virtual Rect getBoundaryRect() const; /// Change the size virtual void Resize(const Extent& newSize) { size_ = newSize; } /// Change only the width - void SetWidth(unsigned width) { Resize(Extent(width, size_.y)); } + void setWidth(unsigned width) { Resize(Extent(width, size_.y)); } /// Change only the height - void SetHeight(unsigned height) { Resize(Extent(size_.x, height)); } + void setHeight(unsigned height) { Resize(Extent(size_.x, height)); } /// Send a keyboard message to all controls, return true if handled bool RelayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& ke); /// Send a mouse message to all controls, return true if handled bool RelayMouseMessage(MouseMsgHandler msg, const MouseCoords& mc); /// Make the window active or inactive. Inactive controls e.g. don't react to events - virtual void SetActive(bool activate = true); + virtual void setActive(bool activate = true); /// Activate/deactivate only the elements of the window void ActivateControls(bool activate = true); /// Lock a region which won't react to mouse events anymore except for the given window/control. @@ -101,39 +101,39 @@ class Window /// Release the region locked for the given window/control. void FreeRegion(Window* window); /// Check if the given point is in a region locked by any window other than exception - bool IsInLockedRegion(const Position& pos, const Window* exception = nullptr) const; + bool isInLockedRegion(const Position& pos, const Window* exception = nullptr) const; /// Check if the mouse is hovering over this control, i.e. inside its boundary. - bool IsMouseOver() const; + bool isMouseOver() const; /// Check if the given mouse position inside the boundary of this control. - bool IsMouseOver(const MouseCoords& mousePos) const; + bool isMouseOver(const MouseCoords& mousePos) const; /// Set the position for the window - void SetPos(const DrawPoint& newPos); + void setPos(const DrawPoint& newPos); // Make the window visible or hide it - virtual void SetVisible(bool visible) { visible_ = visible; } - bool IsVisible() const { return visible_; } + virtual void setVisible(bool visible) { visible_ = visible; } + bool isVisible() const { return visible_; } bool IsActive() const { return active_; } /// Get the parent window (containing this) or nullptr if this is a top-level window - Window* GetParent() const { return parent_; } - unsigned GetID() const { return id_; } + Window* getParent() const { return parent_; } + unsigned getID() const { return id_; } /// Get control with given ID of given type or nullptr if not found or other type template - T* GetCtrl(unsigned id); + T* getCtrl(unsigned id); /// Get control with given ID of given type or nullptr if not found or other type template - const T* GetCtrl(unsigned id) const; + const T* getCtrl(unsigned id) const; /// Get all controls of given type template - std::vector GetCtrls(); + std::vector getCtrls(); /// Get all controls of given type template - std::vector GetCtrls() const; + std::vector getCtrls() const; void DeleteCtrl(unsigned id); - AnimationManager& GetAnimationManager() { return animations_; } + AnimationManager& getAnimationManager() { return animations_; } template T* AddCtrl(std::unique_ptr ctrl); @@ -298,11 +298,11 @@ class Window template T_Pt ScaleIf(const T_Pt& pt) const; /// Set whether controls of this window shall be scaled - void SetScale(bool scale = true) { scale_ = scale; } + void setScale(bool scale = true) { scale_ = scale; } /// Implementation of drawing the window, derived classes can override this to draw custom backgrounds or similar virtual void Draw_(); /// Shall messages be relayed to the controls of this window? - virtual bool IsMessageRelayAllowed() const; + virtual bool isMessageRelayAllowed() const; private: Window* const parent_; /// Handle to parent window @@ -328,24 +328,24 @@ template T* Window::AddCtrl(std::unique_ptr ctrl) { RTTR_Assert(ctrl); - RTTR_Assert(childIdToWnd_.find(ctrl->GetID()) == childIdToWnd_.end()); + RTTR_Assert(childIdToWnd_.find(ctrl->getID()) == childIdToWnd_.end()); T* ctrlPtr = ctrl.get(); ctrl->scale_ = scale_; - childIdToWnd_.emplace(ctrl->GetID(), std::move(ctrl)); + childIdToWnd_.emplace(ctrl->getID(), std::move(ctrl)); - ctrlPtr->SetActive(active_); + ctrlPtr->setActive(active_); return ctrlPtr; } template -T* Window::GetCtrl(unsigned id) +T* Window::getCtrl(unsigned id) { - return const_cast(static_cast(*this).GetCtrl(id)); + return const_cast(static_cast(*this).getCtrl(id)); } template -const T* Window::GetCtrl(unsigned id) const +const T* Window::getCtrl(unsigned id) const { auto it = childIdToWnd_.find(id); if(it == childIdToWnd_.end()) @@ -355,7 +355,7 @@ const T* Window::GetCtrl(unsigned id) const } template -std::vector Window::GetCtrls() +std::vector Window::getCtrls() { std::vector result; for(const auto& wnd : childIdToWnd_ | boost::adaptors::map_values) @@ -368,7 +368,7 @@ std::vector Window::GetCtrls() } template -std::vector Window::GetCtrls() const +std::vector Window::getCtrls() const { std::vector result; for(const auto& wnd : childIdToWnd_ | boost::adaptors::map_values) diff --git a/libs/s25main/WindowManager.cpp b/libs/s25main/WindowManager.cpp index 091452859d..a2fc07da96 100644 --- a/libs/s25main/WindowManager.cpp +++ b/libs/s25main/WindowManager.cpp @@ -52,7 +52,7 @@ void WindowManager::CleanUp() nextdesktop.reset(); } -void WindowManager::SetCursor(Cursor cursor) +void WindowManager::setCursor(Cursor cursor) { cursor_ = cursor; } @@ -63,11 +63,11 @@ void WindowManager::DrawCursor() switch(cursor_) { case Cursor::Hand: - case Cursor::Remove: resId += VIDEODRIVER.IsLeftDown() ? 1 : 0; break; + case Cursor::Remove: resId += VIDEODRIVER.isLeftDown() ? 1 : 0; break; default: break; } if(resId) - LOADER.GetImageN("resource", resId)->DrawFull(VIDEODRIVER.GetMousePos()); + LOADER.getImageN("resource", resId)->DrawFull(VIDEODRIVER.getMousePos()); } /** @@ -92,11 +92,11 @@ void WindowManager::Draw() for(auto& wnd : windows) { // If the window is not minimized, call paintAfter - if(!wnd->IsMinimized()) + if(!wnd->isMinimized()) wnd->msgPaintBefore(); wnd->Draw(); // If the window is not minimized, call paintAfter - if(!wnd->IsMinimized()) + if(!wnd->isMinimized()) wnd->msgPaintAfter(); } @@ -104,7 +104,7 @@ void WindowManager::Draw() DrawCursor(); } -bool WindowManager::IsDesktopActive() const +bool WindowManager::isDesktopActive() const { if(curDesktop) return curDesktop->IsActive(); @@ -134,7 +134,7 @@ void WindowManager::RelayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& // Find one which isn't yet marked for closing so multiple ESC in between draw calls can close multiple windows // ESC doesn't close pinned windows const auto itActiveWnd = std::find_if(windows.rbegin(), windows.rend(), [escape](const auto& wnd) { - return !wnd->ShouldBeClosed() && !(escape && wnd->IsPinned()); + return !wnd->ShouldBeClosed() && !(escape && wnd->isPinned()); }); if(itActiveWnd != windows.rend() && (*itActiveWnd)->getCloseBehavior() != CloseBehavior::Custom) (*itActiveWnd)->Close(); @@ -173,19 +173,19 @@ IngameWindow& WindowManager::DoShow(std::unique_ptr window, bool m if(!curDesktop) throw std::runtime_error("No desktop active for window to be shown on"); - SetToolTip(nullptr, ""); + setToolTip(nullptr, ""); // New modal window goes on top, non-modal window goes behind all modals - const auto itInsert = window->IsModal() ? + const auto itInsert = window->isModal() ? windows.end() : - helpers::find_if(windows, [](const auto& curWnd) { return curWnd->IsModal(); }); + helpers::find_if(windows, [](const auto& curWnd) { return curWnd->isModal(); }); auto& result = **windows.emplace(itInsert, std::move(window)); // Make the new window active (special cases handled in the function) - SetActiveWindow(result); + setActiveWindow(result); // Maus deaktivieren, bis sie losgelassen wurde (Fix des Switch-Anschließend-Drück-Bugs) - if(!VIDEODRIVER.IsTouch()) + if(!VIDEODRIVER.isTouch()) disable_mouse = mouse; return result; } @@ -217,7 +217,7 @@ IngameWindow* WindowManager::FindWindowAtPos(const Position& pos) const for(const auto& window : helpers::reverse(windows)) { // FensterRect für Kollisionsabfrage - Rect window_rect = window->GetDrawRect(); + Rect window_rect = window->getDrawRect(); // trifft die Maus auf ein Fenster? if(IsPointInRect(pos, window_rect)) @@ -225,7 +225,7 @@ IngameWindow* WindowManager::FindWindowAtPos(const Position& pos) const return window.get(); } // Check also if we are in the locked area of a window (e.g. dropdown extends outside of window) - if(window->IsInLockedRegion(pos)) + if(window->isInLockedRegion(pos)) return window.get(); } return nullptr; @@ -234,7 +234,7 @@ IngameWindow* WindowManager::FindWindowAtPos(const Position& pos) const IngameWindow* WindowManager::FindNonModalWindow(unsigned id) const { auto itWnd = helpers::find_if( - windows, [id](const auto& wnd) { return !wnd->ShouldBeClosed() && !wnd->IsModal() && wnd->GetID() == id; }); + windows, [id](const auto& wnd) { return !wnd->ShouldBeClosed() && !wnd->isModal() && wnd->getID() == id; }); return itWnd == windows.end() ? nullptr : itWnd->get(); } @@ -243,7 +243,7 @@ Window* WindowManager::findAndActivateWindow(const Position mousePos) Window* activeWindow = nullptr; if(!windows.empty()) { - if(windows.back()->IsModal()) + if(windows.back()->isModal()) activeWindow = windows.back().get(); else activeWindow = FindWindowAtPos(mousePos); @@ -251,13 +251,13 @@ Window* WindowManager::findAndActivateWindow(const Position mousePos) if(!activeWindow) activeWindow = curDesktop.get(); if(activeWindow && !activeWindow->IsActive()) - SetActiveWindow(*activeWindow); + setActiveWindow(*activeWindow); return activeWindow; } Window* WindowManager::getActiveWindow() const { - if(IsDesktopActive()) + if(isDesktopActive()) return curDesktop.get(); if(!windows.empty()) return windows.back().get(); @@ -267,7 +267,7 @@ Window* WindowManager::getActiveWindow() const void WindowManager::msgLeftDown(MouseCoords mc) { // play click sound - SoundEffectItem* sound = LOADER.GetSoundN("sound", 112); + SoundEffectItem* sound = LOADER.getSoundN("sound", 112); if(sound) sound->Play(255, false); @@ -283,9 +283,9 @@ void WindowManager::msgLeftUp(MouseCoords mc) if(!curDesktop) return; - unsigned time_now = VIDEODRIVER.GetTickCount(); + unsigned time_now = VIDEODRIVER.getTickCount(); - if(VIDEODRIVER.IsTouch()) + if(VIDEODRIVER.isTouch()) { if(time_now - lastLeftClickTime < TOUCH_DOUBLE_CLICK_INTERVAL) { @@ -321,12 +321,12 @@ void WindowManager::msgRightDown(const MouseCoords& mc) if(!windows.empty()) { IngameWindow* foundWindow = FindWindowAtPos(mc.pos); - if(windows.back()->IsModal()) + if(windows.back()->isModal()) { // We have a modal window -> Activate it - SetActiveWindow(*windows.back()); + setActiveWindow(*windows.back()); // Ignore actions in all other windows - if(foundWindow != GetTopMostWindow()) + if(foundWindow != getTopMostWindow()) return; } if(foundWindow) @@ -334,7 +334,7 @@ void WindowManager::msgRightDown(const MouseCoords& mc) // Close it if requested (unless pinned) if(foundWindow->getCloseBehavior() == CloseBehavior::Regular) { - if(!foundWindow->IsPinned()) + if(!foundWindow->isPinned()) foundWindow->Close(); return; } @@ -388,7 +388,7 @@ void WindowManager::msgKeyDown(const KeyEvent& ke) (newMode == DisplayMode::Fullscreen) ? SETTINGS.video.fullscreenSize : SETTINGS.video.windowedSize; VIDEODRIVER.ResizeScreen(newScreenSize, newMode); - SETTINGS.video.displayMode = VIDEODRIVER.GetDisplayMode(); + SETTINGS.video.displayMode = VIDEODRIVER.getDisplayMode(); } else if(ke.kt == KeyType::Print) TakeScreenshot(); else @@ -401,7 +401,7 @@ void WindowManager::msgKeyDown(const KeyEvent& ke) void WindowManager::WindowResized() { VIDEODRIVER.RenewViewport(); - msgScreenResize(VIDEODRIVER.GetRenderSize()); + msgScreenResize(VIDEODRIVER.getRenderSize()); } /** @@ -419,7 +419,7 @@ void WindowManager::msgScreenResize(const Extent& newSize) // Don't change fullscreen size (only in menu) if(SETTINGS.video.displayMode == DisplayMode::Windowed) - SETTINGS.video.windowedSize = VIDEODRIVER.GetWindowSize(); + SETTINGS.video.windowedSize = VIDEODRIVER.getWindowSize(); // Desktop (still) valid? if(!curDesktop) @@ -430,14 +430,14 @@ void WindowManager::msgScreenResize(const Extent& newSize) // Move IngameWindows so they are completely visible for(const auto& window : windows) { - DrawPoint delta = window->GetPos() + DrawPoint(window->GetSize()) - DrawPoint(sr.newSize); + DrawPoint delta = window->getPos() + DrawPoint(window->getSize()) - DrawPoint(sr.newSize); if(delta.x > 0 || delta.y > 0) - window->SetPos(window->GetPos() - elMax(delta, DrawPoint(0, 0))); + window->setPos(window->getPos() - elMax(delta, DrawPoint(0, 0))); window->msgScreenResize(sr); } } -IngameWindow* WindowManager::GetTopMostWindow() const +IngameWindow* WindowManager::getTopMostWindow() const { if(windows.empty()) return nullptr; @@ -451,10 +451,10 @@ void WindowManager::DoClose(IngameWindow* window) RTTR_Assert(it != windows.end()); - SetToolTip(nullptr, ""); + setToolTip(nullptr, ""); // Store if this was the active window - const bool isActiveWnd = window == GetTopMostWindow(); + const bool isActiveWnd = window == getTopMostWindow(); // Remove from list and notify parent, hold onto it till parent is notified const auto tmpHolder = std::move(*it); @@ -462,9 +462,9 @@ void WindowManager::DoClose(IngameWindow* window) if(isActiveWnd) { if(windows.empty()) - SetActiveWindow(*curDesktop); + setActiveWindow(*curDesktop); else - SetActiveWindow(*windows.back()); + setActiveWindow(*windows.back()); } curDesktop->msgWindowClosed(*tmpHolder); } @@ -478,7 +478,7 @@ void WindowManager::Close(unsigned id) { for(auto& wnd : windows) { - if(wnd->GetID() == id && !wnd->ShouldBeClosed()) + if(wnd->getID() == id && !wnd->ShouldBeClosed()) wnd->Close(); } } @@ -498,7 +498,7 @@ void WindowManager::DoDesktopSwitch() RTTR_Assert(nextdesktop); VIDEODRIVER.ClearScreen(); - SetToolTip(nullptr, ""); + setToolTip(nullptr, ""); // If we have a current desktop close all windows if(curDesktop) @@ -506,17 +506,17 @@ void WindowManager::DoDesktopSwitch() // Do the switch curDesktop = std::move(nextdesktop); - curDesktop->SetActive(true); + curDesktop->setActive(true); for(auto& nextWnd : nextWnds) Show(std::move(nextWnd)); nextWnds.clear(); - if(!VIDEODRIVER.IsLeftDown()) + if(!VIDEODRIVER.isLeftDown()) disable_mouse = false; // Dummy mouse move to init hovering etc - msgMouseMove(MouseCoords(VIDEODRIVER.GetMousePos())); + msgMouseMove(MouseCoords(VIDEODRIVER.getMousePos())); } void WindowManager::CloseMarkedIngameWnds() @@ -537,22 +537,22 @@ void SetActiveWindowImpl(const Window& wnd, Desktop& desktop, T_Windows& windows if(itWnd != windows.end()) { // If we have a modal window, don't make this active unless it is the top most one - if(&wnd != windows.back().get() && helpers::contains_if(windows, [](const auto& it) { return it->IsModal(); })) + if(&wnd != windows.back().get() && helpers::contains_if(windows, [](const auto& it) { return it->isModal(); })) { return; } - desktop.SetActive(false); + desktop.setActive(false); // Move window to the end (itWnd+1 -> itWnd -> end()) std::rotate(itWnd, std::next(itWnd), windows.end()); } else if(&wnd == &desktop) - desktop.SetActive(true); + desktop.setActive(true); else return; for(const auto& curWnd : windows) - curWnd->SetActive(&wnd == curWnd.get()); + curWnd->setActive(&wnd == curWnd.get()); } -void WindowManager::SetActiveWindow(Window& wnd) +void WindowManager::setActiveWindow(Window& wnd) { if(curDesktop) SetActiveWindowImpl(wnd, *curDesktop, windows); @@ -562,7 +562,7 @@ void WindowManager::SetActiveWindow(Window& wnd) void WindowManager::TakeScreenshot() const { - const auto windowSize = VIDEODRIVER.GetWindowSize(); + const auto windowSize = VIDEODRIVER.getWindowSize(); libsiedler2::PixelBufferBGRA buffer(windowSize.width, windowSize.height); glReadPixels(0, 0, windowSize.width, windowSize.height, GL_BGRA, GL_UNSIGNED_BYTE, buffer.getPixelPtr()); flipVertical(buffer); @@ -599,7 +599,7 @@ class WindowManager::Tooltip void setText(const std::string& text) { - lines = font->GetWrapInfo(text, maxWidth, maxWidth).CreateSingleStrings(text); + lines = font->getWrapInfo(text, maxWidth, maxWidth).CreateSingleStrings(text); if(lines.empty()) return; width = 0; @@ -622,7 +622,7 @@ class WindowManager::Tooltip } }; -void WindowManager::SetToolTip(const ctrlBaseTooltip* ttw, const std::string& tooltip, bool updateCurrent) +void WindowManager::setToolTip(const ctrlBaseTooltip* ttw, const std::string& tooltip, bool updateCurrent) { // Max width of tooltip constexpr unsigned short MAX_TOOLTIP_WIDTH = 260; @@ -687,7 +687,7 @@ SnapOffset WindowManager::snapWindow(Window* wnd, const Rect& wndRect) const if(curWnd.get() == wnd) continue; - const Rect curWndRect = curWnd->GetBoundaryRect(); + const Rect curWndRect = curWnd->getBoundaryRect(); // Calculate smallest offset for each parallel pair of window edges, iff the windows overlap along the // orthogonal axis (± snap distance) diff --git a/libs/s25main/WindowManager.h b/libs/s25main/WindowManager.h index 1dc943c402..5da8508b92 100644 --- a/libs/s25main/WindowManager.h +++ b/libs/s25main/WindowManager.h @@ -45,7 +45,7 @@ class WindowManager : public Singleton, public VideoDriverLoaderI /// Zeichnet Desktop und alle Fenster. void Draw(); /// liefert ob der aktuelle Desktop den Focus besitzt oder nicht. - bool IsDesktopActive() const; + bool isDesktopActive() const; /// schickt eine Nachricht an das aktive Fenster bzw den aktiven Desktop. /// Sendet eine Tastaturnachricht an die Steuerelemente. @@ -63,7 +63,7 @@ class WindowManager : public Singleton, public VideoDriverLoaderI template T& ReplaceWindow(std::unique_ptr window) { - auto* oldWnd = FindNonModalWindow(window->GetID()); + auto* oldWnd = FindNonModalWindow(window->getID()); if(oldWnd) oldWnd->Close(); return Show(std::move(window)); @@ -71,7 +71,7 @@ class WindowManager : public Singleton, public VideoDriverLoaderI template T* ToggleWindow(std::unique_ptr window) { - auto* oldWnd = FindNonModalWindow(window->GetID()); + auto* oldWnd = FindNonModalWindow(window->getID()); if(oldWnd) { oldWnd->Close(); @@ -111,7 +111,7 @@ class WindowManager : public Singleton, public VideoDriverLoaderI // ttw: Window that the tooltip is for, used when updating current tooltip // tooltip: The tooltip text, empty to hide // updateCurrent: If true, only update if the current tooltip is for ttw - void SetToolTip(const ctrlBaseTooltip* ttw, const std::string& tooltip, bool updateCurrent = false); + void setToolTip(const ctrlBaseTooltip* ttw, const std::string& tooltip, bool updateCurrent = false); /// Verarbeitung Spielfenstergröße verändert (vom Betriebssystem aus) void WindowResized() override; @@ -120,16 +120,16 @@ class WindowManager : public Singleton, public VideoDriverLoaderI void msgScreenResize(const Extent& newSize); /// Return the window currently on the top (probably active) - IngameWindow* GetTopMostWindow() const; + IngameWindow* getTopMostWindow() const; IngameWindow* FindWindowAtPos(const Position& pos) const; IngameWindow* FindNonModalWindow(unsigned id) const; - Desktop* GetCurrentDesktop() { return curDesktop.get(); } + Desktop* getCurrentDesktop() { return curDesktop.get(); } /// Makes the given window (desktop or ingame window) active and all others inactive - void SetActiveWindow(Window&); + void setActiveWindow(Window&); - void SetCursor(Cursor cursor = Cursor::Hand); - Cursor GetCursor() const { return cursor_; } + void setCursor(Cursor cursor = Cursor::Hand); + Cursor getCursor() const { return cursor_; } SnapOffset snapWindow(Window* wnd, const Rect& wndRect) const; diff --git a/libs/s25main/WineLoader.cpp b/libs/s25main/WineLoader.cpp index f0a680643e..2937169d57 100644 --- a/libs/s25main/WineLoader.cpp +++ b/libs/s25main/WineLoader.cpp @@ -33,51 +33,51 @@ helpers::EnumArray bobIndex = {1, 17, 22, 27, 32, 37, 540, 270, 282, 289, 295, 600, 650, 700, 750, 412, 461, 510, 517, 525, 526, 527, 528, 529, 530, 532, 533, 535, 536}; -ITexture* GetWareTex(const GoodType good) +ITexture* getWareTex(const GoodType good) { - return LOADER.GetImageN("wine_bobs", + return LOADER.getImageN("wine_bobs", bobIndex[good == GoodType::Wine ? BobTypes::WINE_WARE_ICON : BobTypes::GRAPES_WARE_ICON]); } -ITexture* GetWareStackTex(const GoodType good) +ITexture* getWareStackTex(const GoodType good) { - return LOADER.GetImageN("wine_bobs", bobIndex[good == GoodType::Wine ? BobTypes::WINE_WARE_ON_GROUND_OF_FLAG : + return LOADER.getImageN("wine_bobs", bobIndex[good == GoodType::Wine ? BobTypes::WINE_WARE_ON_GROUND_OF_FLAG : BobTypes::GRAPES_WARE_ON_GROUND_OF_FLAG]); } -ITexture* GetWareDonkeyTex(const GoodType good) +ITexture* getWareDonkeyTex(const GoodType good) { - return LOADER.GetImageN("wine_bobs", bobIndex[good == GoodType::Wine ? BobTypes::DONKEY_BOAT_CARRYING_WINE_WARE : + return LOADER.getImageN("wine_bobs", bobIndex[good == GoodType::Wine ? BobTypes::DONKEY_BOAT_CARRYING_WINE_WARE : BobTypes::DONKEY_BOAT_CARRYING_GRAPES_WARE]); } -ITexture* GetJobTex(Job job) +ITexture* getJobTex(Job job) { switch(job) { - case Job::Winegrower: return LOADER.GetImageN("wine_bobs", bobIndex[BobTypes::WINEGROWER_JOB_ICON]); - case Job::Vintner: return LOADER.GetImageN("wine_bobs", bobIndex[BobTypes::VINTNER_JOB_ICON]); - case Job::TempleServant: return LOADER.GetImageN("wine_bobs", bobIndex[BobTypes::TEMPLESERVANT_JOB_ICON]); + case Job::Winegrower: return LOADER.getImageN("wine_bobs", bobIndex[BobTypes::WINEGROWER_JOB_ICON]); + case Job::Vintner: return LOADER.getImageN("wine_bobs", bobIndex[BobTypes::VINTNER_JOB_ICON]); + case Job::TempleServant: return LOADER.getImageN("wine_bobs", bobIndex[BobTypes::TEMPLESERVANT_JOB_ICON]); default: return nullptr; } } -ITexture* GetTempleProductionModeTex(ProductionMode productionMode) +ITexture* getTempleProductionModeTex(ProductionMode productionMode) { switch(productionMode) { case ProductionMode::Default: - return LOADER.GetImageN("wine_bobs", bobIndex[BobTypes::TEMPLE_OUTPUT_WARE_ICON_RANDOM]); - case ProductionMode::IronOre: return LOADER.GetWareTex(GoodType::IronOre); - case ProductionMode::Coal: return LOADER.GetWareTex(GoodType::Coal); - case ProductionMode::Stone: return LOADER.GetWareTex(GoodType::Stones); + return LOADER.getImageN("wine_bobs", bobIndex[BobTypes::TEMPLE_OUTPUT_WARE_ICON_RANDOM]); + case ProductionMode::IronOre: return LOADER.getWareTex(GoodType::IronOre); + case ProductionMode::Coal: return LOADER.getWareTex(GoodType::Coal); + case ProductionMode::Stone: return LOADER.getWareTex(GoodType::Stones); } return nullptr; } bool isAddonActive(const GameWorldBase& gwb) { - return gwb.GetGGS().isEnabled(AddonId::WINE); + return gwb.getGGS().isEnabled(AddonId::WINE); } helpers::MultiArray grapefield_cache; @@ -92,8 +92,8 @@ void fillCache(glTexturePacker& stp) { glSmartBitmap& bmp = grapefield_cache[type][size]; bmp.reset(); - bmp.add(LOADER.GetImageN("wine_bobs", field + size)); - bmp.addShadow(LOADER.GetImageN("wine_bobs", shadow + size)); + bmp.add(LOADER.getImageN("wine_bobs", field + size)); + bmp.addShadow(LOADER.getImageN("wine_bobs", shadow + size)); stp.add(bmp); } } diff --git a/libs/s25main/WineLoader.h b/libs/s25main/WineLoader.h index 2526cfb49b..14fa2ecd9f 100644 --- a/libs/s25main/WineLoader.h +++ b/libs/s25main/WineLoader.h @@ -69,11 +69,11 @@ constexpr auto maxEnumValue(BobTypes) extern helpers::EnumArray bobIndex; extern helpers::MultiArray grapefield_cache; -ITexture* GetWareTex(GoodType good); -ITexture* GetWareStackTex(GoodType good); -ITexture* GetWareDonkeyTex(GoodType good); -ITexture* GetJobTex(Job job); -ITexture* GetTempleProductionModeTex(ProductionMode mode); +ITexture* getWareTex(GoodType good); +ITexture* getWareStackTex(GoodType good); +ITexture* getWareDonkeyTex(GoodType good); +ITexture* getJobTex(Job job); +ITexture* getTempleProductionModeTex(ProductionMode mode); bool isAddonActive(const GameWorldBase& gwb); void fillCache(glTexturePacker& stp); diff --git a/libs/s25main/addons/Addon.cpp b/libs/s25main/addons/Addon.cpp index 05a5415e2c..0637806082 100644 --- a/libs/s25main/addons/Addon.cpp +++ b/libs/s25main/addons/Addon.cpp @@ -11,6 +11,6 @@ AddonGui::AddonGui(const Addon& addon, Window& window, bool /*readonly*/) : addo { DrawPoint btPos(20, 0), txtPos(52, 4); window.AddText(0, txtPos, addon.getName(), COLOR_YELLOW, FontStyle{}, NormalFont); - window.AddImageButton(1, btPos, Extent(22, 22), TextureColor::Grey, LOADER.GetImageN("io", 21), + window.AddImageButton(1, btPos, Extent(22, 22), TextureColor::Grey, LOADER.getImageN("io", 21), addon.getDescription()); } diff --git a/libs/s25main/addons/AddonBool.cpp b/libs/s25main/addons/AddonBool.cpp index 9321e3da7e..b851c1f34a 100644 --- a/libs/s25main/addons/AddonBool.cpp +++ b/libs/s25main/addons/AddonBool.cpp @@ -28,7 +28,7 @@ AddonBool::Gui::Gui(const Addon& addon, Window& window, bool readonly) window.AddCheckBox(2, DrawPoint(430, 0), Extent(220, 20), TextureColor::Grey, _("Use"), NormalFont, readonly))) { if(readonly) - window.AddImage(3, cb_.GetPos() - DrawPoint(1, 0), LOADER.GetImageN("io_new", 14), _("Locked")); + window.AddImage(3, cb_.getPos() - DrawPoint(1, 0), LOADER.getImageN("io_new", 14), _("Locked")); } void AddonBool::Gui::setStatus(unsigned status) diff --git a/libs/s25main/addons/AddonList.cpp b/libs/s25main/addons/AddonList.cpp index d2c2328d78..c4acc40500 100644 --- a/libs/s25main/addons/AddonList.cpp +++ b/libs/s25main/addons/AddonList.cpp @@ -40,15 +40,15 @@ AddonList::Gui::Gui(const AddonList& addon, Window& window, bool readonly) for(const auto& option : addon.options) cb_.AddItem(option); if(readonly) - window.AddImage(3, cb_.GetPos() - DrawPoint(1, 0), LOADER.GetImageN("io_new", 14), _("Locked")); + window.AddImage(3, cb_.getPos() - DrawPoint(1, 0), LOADER.getImageN("io_new", 14), _("Locked")); } void AddonList::Gui::setStatus(unsigned status) { - cb_.SetSelection(status); + cb_.setSelection(status); } unsigned AddonList::Gui::getStatus() const { - return cb_.GetSelection().value(); + return cb_.getSelection().value(); } diff --git a/libs/s25main/ai/AIEventManager.cpp b/libs/s25main/ai/AIEventManager.cpp index 819e00baf0..c53efe1c0e 100644 --- a/libs/s25main/ai/AIEventManager.cpp +++ b/libs/s25main/ai/AIEventManager.cpp @@ -13,7 +13,7 @@ void AIEventManager::AddAIEvent(std::unique_ptr ev) events.push(std::move(ev)); } -std::unique_ptr AIEventManager::GetEvent() +std::unique_ptr AIEventManager::getEvent() { if(events.empty()) return nullptr; diff --git a/libs/s25main/ai/AIEventManager.h b/libs/s25main/ai/AIEventManager.h index c91624f4b6..bfaaf4233a 100644 --- a/libs/s25main/ai/AIEventManager.h +++ b/libs/s25main/ai/AIEventManager.h @@ -17,9 +17,9 @@ class AIEventManager AIEventManager(); ~AIEventManager(); void AddAIEvent(std::unique_ptr ev); - std::unique_ptr GetEvent(); + std::unique_ptr getEvent(); bool EventAvailable() const { return !events.empty(); } - unsigned GetEventNum() const { return events.size(); } + unsigned getEventNum() const { return events.size(); } protected: std::queue> events; diff --git a/libs/s25main/ai/AIEvents.h b/libs/s25main/ai/AIEvents.h index 3192d8cb7b..a3b2bfcb9b 100644 --- a/libs/s25main/ai/AIEvents.h +++ b/libs/s25main/ai/AIEvents.h @@ -35,7 +35,7 @@ class Base public: Base(EventType type) : type(type) {} virtual ~Base() = default; - EventType GetType() const { return type; } + EventType getType() const { return type; } protected: EventType type; @@ -46,9 +46,9 @@ class Location : public Base public: Location(EventType type, const MapPoint pt) : Base(type), pos(pt) {} ~Location() override = default; - MapCoord GetX() const { return pos.x; } - MapCoord GetY() const { return pos.y; } - MapPoint GetPos() const { return pos; } + MapCoord getX() const { return pos.x; } + MapCoord getY() const { return pos.y; } + MapPoint getPos() const { return pos; } protected: MapPoint pos; @@ -59,7 +59,7 @@ class Direction : public Location public: Direction(EventType type, const MapPoint pt, ::Direction direction) : Location(type, pt), direction(direction) {} ~Direction() override = default; - ::Direction GetDirection() const { return direction; } + ::Direction getDirection() const { return direction; } protected: ::Direction direction; @@ -70,7 +70,7 @@ class Building : public Location public: Building(EventType type, const MapPoint pt, BuildingType building) : Location(type, pt), building(building) {} ~Building() override = default; - BuildingType GetBuildingType() const { return building; } + BuildingType getBuildingType() const { return building; } protected: BuildingType building; diff --git a/libs/s25main/ai/AIInterface.cpp b/libs/s25main/ai/AIInterface.cpp index fe714702e0..2475ecc9b2 100644 --- a/libs/s25main/ai/AIInterface.cpp +++ b/libs/s25main/ai/AIInterface.cpp @@ -35,7 +35,7 @@ struct Param_RoadPath bool IsPointOK_RoadPath(const GameWorldBase& gwb, const MapPoint pt, const Direction, const void* param) { const auto* prp = static_cast(param); - return makePathConditionRoad(gwb, prp->boat_road).IsNodeOk(pt); + return makePathConditionRoad(gwb, prp->boat_road).isNodeOk(pt); } /// Condition for comfort road construction with a possible flag every 2 steps @@ -44,7 +44,7 @@ bool IsPointOK_RoadPathEvenStep(const GameWorldBase& gwb, const MapPoint pt, con if(!IsPointOK_RoadPath(gwb, pt, dir, param)) return false; const auto* prp = static_cast(param); - return prp->boat_road || gwb.GetBQ(pt, gwb.GetNode(pt).owner - 1) != BuildingQuality::Nothing; + return prp->boat_road || gwb.GetBQ(pt, gwb.getNode(pt).owner - 1) != BuildingQuality::Nothing; } int GetS4LikeMineResourceRating(const Resource resource, const unsigned defaultRating) @@ -57,20 +57,20 @@ int GetS4LikeMineResourceRating(const Resource resource, const unsigned defaultR } // namespace AIInterface::AIInterface(const GameWorldBase& gwb, std::vector& gcs, unsigned char playerID) - : gwb(gwb), player_(gwb.GetPlayer(playerID)), gcs(gcs), playerID_(playerID) + : gwb(gwb), player_(gwb.getPlayer(playerID)), gcs(gcs), playerID_(playerID) { - for(const auto curHarborId : helpers::idRange(gwb.GetNumHarborPoints())) + for(const auto curHarborId : helpers::idRange(gwb.getNumHarborPoints())) { bool hasOtherHarbor = false; for(const auto dir : helpers::EnumRange{}) { - const SeaId seaId = gwb.GetSeaId(curHarborId, dir); + const SeaId seaId = gwb.getSeaId(curHarborId, dir); if(!seaId) continue; - for(const auto otherHarborId : helpers::idRangeAfter(curHarborId, gwb.GetNumHarborPoints())) + for(const auto otherHarborId : helpers::idRangeAfter(curHarborId, gwb.getNumHarborPoints())) { - if(gwb.IsHarborAtSea(otherHarborId, seaId)) + if(gwb.isHarborAtSea(otherHarborId, seaId)) { hasOtherHarbor = true; break; @@ -84,9 +84,9 @@ AIInterface::AIInterface(const GameWorldBase& gwb, std::vectorGetType() : NodalObjectType::Nothing; + const auto& node = gwb.getNode(pt); + NodalObjectType no = node.obj ? node.obj->getType() : NodalObjectType::Nothing; DescIdx t1 = node.t1; // valid terrain? - if(gwb.GetDescription().get(t1).Is(ETerrain::Walkable)) + if(gwb.getDescription().get(t1).Is(ETerrain::Walkable)) { if(no == NodalObjectType::Tree) { @@ -127,38 +127,38 @@ AISurfaceResource AIInterface::GetSurfaceResource(const MapPoint pt) const return AISurfaceResource::Blocked; } -int AIInterface::GetResourceRating(const MapPoint pt, AIResource res) const +int AIInterface::getResourceRating(const MapPoint pt, AIResource res) const { switch(res) { case AIResource::Wood: - if(GetSurfaceResource(pt) == AISurfaceResource::Wood) + if(getSurfaceResource(pt) == AISurfaceResource::Wood) return RES_RADIUS[res]; - else if(IsBuildingOnNode(pt, BuildingType::Woodcutter)) + else if(isBuildingOnNode(pt, BuildingType::Woodcutter)) return -40; - else if(IsBuildingOnNode(pt, BuildingType::Forester)) + else if(isBuildingOnNode(pt, BuildingType::Forester)) return 20; break; case AIResource::Stones: - if(GetSurfaceResource(pt) == AISurfaceResource::Stones) + if(getSurfaceResource(pt) == AISurfaceResource::Stones) return RES_RADIUS[res]; break; case AIResource::Plantspace: - if(GetSurfaceResource(pt) == AISurfaceResource::Nothing - && gwb.GetDescription().get(gwb.GetNode(pt).t1).IsVital()) + if(getSurfaceResource(pt) == AISurfaceResource::Nothing + && gwb.getDescription().get(gwb.getNode(pt).t1).isVital()) return RES_RADIUS[res]; - else if(IsBuildingOnNode(pt, BuildingType::Forester)) + else if(isBuildingOnNode(pt, BuildingType::Forester)) return -40; - else if(IsBuildingOnNode(pt, BuildingType::Farm)) + else if(isBuildingOnNode(pt, BuildingType::Farm)) return -20; break; case AIResource::Borderland: - if(IsOwnTerritory(pt) && !IsBorder(pt)) + if(isOwnTerritory(pt) && !isBorder(pt)) return 0; else { - const auto& desc = gwb.GetDescription(); - const auto& node = gwb.GetNode(pt); + const auto& desc = gwb.getDescription(); + const auto& node = gwb.getNode(pt); if(desc.get(node.t1).Is(ETerrain::Walkable) || desc.get(node.t2).Is(ETerrain::Walkable)) return RES_RADIUS[res]; } @@ -168,31 +168,31 @@ int AIInterface::GetResourceRating(const MapPoint pt, AIResource res) const case AIResource::Coal: case AIResource::Granite: { - const Resource subres = gwb.GetNode(pt).resources; - if(convertToNodeResource(GetSubsurfaceResource(pt)) == res) + const Resource subres = gwb.getNode(pt).resources; + if(convertToNodeResource(getSubsurfaceResource(pt)) == res) { const auto mineBuildingType = GetMineBuildingType(subres.getType()); if(mineBuildingType - && GetMineResourceBehavior(gwb.GetGGS(), *mineBuildingType) + && getMineResourceBehavior(gwb.getGGS(), *mineBuildingType) == MineResourceBehavior::S4LikeExhaustion) return GetS4LikeMineResourceRating(subres, RES_RADIUS[res]); return RES_RADIUS[res]; } - if(IsMineResourceWorkEverywhere(res) - && gwb.IsOfTerrain(pt, [](const TerrainDesc& desc) { return desc.Is(ETerrain::Mineable); })) + if(isMineResourceWorkEverywhere(res) + && gwb.isOfTerrain(pt, [](const TerrainDesc& desc) { return desc.Is(ETerrain::Mineable); })) return RES_RADIUS[res]; break; } case AIResource::Fish: - if(convertToNodeResource(GetSubsurfaceResource(pt)) == res) + if(convertToNodeResource(getSubsurfaceResource(pt)) == res) return RES_RADIUS[res]; break; } return 0; } -bool AIInterface::IsMineResourceWorkEverywhere(const AIResource res) const +bool AIInterface::isMineResourceWorkEverywhere(const AIResource res) const { const auto resourceType = convertToResourceType(res); if(!resourceType) @@ -200,7 +200,7 @@ bool AIInterface::IsMineResourceWorkEverywhere(const AIResource res) const const auto mineBuildingType = GetMineBuildingType(*resourceType); return mineBuildingType - && GetMineResourceBehavior(gwb.GetGGS(), *mineBuildingType) == MineResourceBehavior::WorkEverywhere; + && getMineResourceBehavior(gwb.getGGS(), *mineBuildingType) == MineResourceBehavior::WorkEverywhere; } int AIInterface::CalcResourceValue(const MapPoint pt, AIResource res, helpers::OptionalEnum direction, @@ -211,7 +211,7 @@ int AIInterface::CalcResourceValue(const MapPoint pt, AIResource res, helpers::O { std::vector pts = gwb.GetPointsInRadiusWithCenter(pt, resRadius); return std::accumulate(pts.begin(), pts.end(), 0, [this, res](int lhs, const auto& curPt) { - return lhs + this->GetResourceRating(curPt, res); + return lhs + this->getResourceRating(curPt, res); }); } else // calculate different nodes only (4n+2 ?anyways much faster) { @@ -221,7 +221,7 @@ int AIInterface::CalcResourceValue(const MapPoint pt, AIResource res, helpers::O // first: go radius steps towards direction-1 MapPoint tmpPt(pt); for(unsigned i = 0; i < resRadius; i++) - tmpPt = gwb.GetNeighbour(tmpPt, *direction - 1u); + tmpPt = gwb.getNeighbour(tmpPt, *direction - 1u); // then clockwise around at radius distance to get all new points for(unsigned i = iDirection + 1u; i < iDirection + 3u; ++i) { @@ -231,17 +231,17 @@ int AIInterface::CalcResourceValue(const MapPoint pt, AIResource res, helpers::O ++numSteps; for(MapCoord r2 = 0; r2 < numSteps; ++r2) { - returnVal += GetResourceRating(tmpPt, res); - tmpPt = gwb.GetNeighbour(tmpPt, convertToDirection(i)); + returnVal += getResourceRating(tmpPt, res); + tmpPt = gwb.getNeighbour(tmpPt, convertToDirection(i)); } } // now substract old points not in range of new point // go to old center point: tmpPt = pt; - tmpPt = gwb.GetNeighbour(tmpPt, *direction + 3u); + tmpPt = gwb.getNeighbour(tmpPt, *direction + 3u); // next: go to the first old point we have to substract for(unsigned i = 0; i < RES_RADIUS[res]; i++) - tmpPt = gwb.GetNeighbour(tmpPt, *direction + 2u); + tmpPt = gwb.getNeighbour(tmpPt, *direction + 2u); // now clockwise around at radius distance to remove all old points for(int i = iDirection + 4; i < iDirection + 6; ++i) { @@ -250,8 +250,8 @@ int AIInterface::CalcResourceValue(const MapPoint pt, AIResource res, helpers::O ++numSteps; for(MapCoord r2 = 0; r2 < numSteps; ++r2) { - returnVal -= GetResourceRating(tmpPt, res); - tmpPt = gwb.GetNeighbour(tmpPt, convertToDirection(i)); + returnVal -= getResourceRating(tmpPt, res); + tmpPt = gwb.getNeighbour(tmpPt, convertToDirection(i)); } } return returnVal; @@ -265,52 +265,52 @@ bool AIInterface::FindFreePathForNewRoad(MapPoint start, MapPoint target, std::v unsigned* length /*= nullptr*/) const { bool boat = false; - return gwb.GetFreePathFinder().FindPathAlternatingConditions(start, target, false, 100, route, length, nullptr, + return gwb.getFreePathFinder().FindPathAlternatingConditions(start, target, false, 100, route, length, nullptr, IsPointOK_RoadPath, IsPointOK_RoadPathEvenStep, nullptr, (void*)&boat); } bool AIInterface::CalcBQSumDifference(const MapPoint pt1, const MapPoint pt2) const { - return GetBuildingQuality(pt2) < GetBuildingQuality(pt1); + return getBuildingQuality(pt2) < getBuildingQuality(pt1); } -BuildingQuality AIInterface::GetBuildingQuality(const MapPoint pt) const +BuildingQuality AIInterface::getBuildingQuality(const MapPoint pt) const { return gwb.GetBQ(pt, playerID_); } -BuildingQuality AIInterface::GetBuildingQualityAnyOwner(const MapPoint pt) const +BuildingQuality AIInterface::getBuildingQualityAnyOwner(const MapPoint pt) const { - return gwb.GetNode(pt).bq; + return gwb.getNode(pt).bq; } bool AIInterface::FindPathOnRoads(const noRoadNode& start, const noRoadNode& target, unsigned* length) const { if(length) - return gwb.GetRoadPathFinder().FindPath(start, target, false, std::numeric_limits::max(), nullptr, + return gwb.getRoadPathFinder().FindPath(start, target, false, std::numeric_limits::max(), nullptr, length); else - return gwb.GetRoadPathFinder().PathExists(start, target, false); + return gwb.getRoadPathFinder().PathExists(start, target, false); } -const nobHQ* AIInterface::GetHeadquarter() const +const nobHQ* AIInterface::getHeadquarter() const { - return gwb.GetSpecObj(player_.GetHQPos()); + return gwb.getSpecObj(player_.getHQPos()); } bool AIInterface::isBuildingNearby(BuildingType bldType, const MapPoint pt, unsigned maxDistance) const { - for(const nobUsual* bld : GetBuildings(bldType)) + for(const nobUsual* bld : getBuildings(bldType)) { - if(gwb.CalcDistance(pt, bld->GetPos()) <= maxDistance) + if(gwb.CalcDistance(pt, bld->getPos()) <= maxDistance) return true; } - for(const noBuildingSite* bldSite : GetBuildingSites()) + for(const noBuildingSite* bldSite : getBuildingSites()) { - if(bldSite->GetBuildingType() == bldType) + if(bldSite->getBuildingType() == bldType) { - if(gwb.CalcDistance(pt, bldSite->GetPos()) <= maxDistance) + if(gwb.CalcDistance(pt, bldSite->getPos()) <= maxDistance) return true; } } @@ -319,53 +319,53 @@ bool AIInterface::isBuildingNearby(BuildingType bldType, const MapPoint pt, unsi bool AIInterface::isHarborPosClose(const MapPoint pt, unsigned maxDistance, bool onlyempty) const { - for(const auto id : helpers::idRange(gwb.GetNumHarborPoints())) + for(const auto id : helpers::idRange(gwb.getNumHarborPoints())) { - const MapPoint harborPoint = gwb.GetHarborPoint(id); + const MapPoint harborPoint = gwb.getHarborPoint(id); if(gwb.CalcDistance(pt, harborPoint) <= maxDistance && helpers::contains(usableHarbors_, id)) { - if(!onlyempty || !IsBuildingOnNode(harborPoint, BuildingType::HarborBuilding)) + if(!onlyempty || !isBuildingOnNode(harborPoint, BuildingType::HarborBuilding)) return true; } } return false; } -bool AIInterface::IsExplorationDirectionPossible(const MapPoint pt, const nobHarborBuilding* originHarbor, +bool AIInterface::isExplorationDirectionPossible(const MapPoint pt, const nobHarborBuilding* originHarbor, ShipDirection direction) const { - return IsExplorationDirectionPossible(pt, originHarbor->GetHarborPosID(), direction); + return isExplorationDirectionPossible(pt, originHarbor->getHarborPosID(), direction); } -bool AIInterface::IsExplorationDirectionPossible(const MapPoint pt, HarborId originHarborID, +bool AIInterface::isExplorationDirectionPossible(const MapPoint pt, HarborId originHarborID, ShipDirection direction) const { - return gwb.GetNextFreeHarborPoint(pt, originHarborID, direction, playerID_).isValid(); + return gwb.getNextFreeHarborPoint(pt, originHarborID, direction, playerID_).isValid(); } bool AIInterface::SetCoinsAllowed(const nobMilitary* building, const bool enabled) { - return SetCoinsAllowed(building->GetPos(), enabled); + return SetCoinsAllowed(building->getPos(), enabled); } bool AIInterface::StartStopExpedition(const nobHarborBuilding* hb, bool start) { - return StartStopExpedition(hb->GetPos(), start); + return StartStopExpedition(hb->getPos(), start); } bool AIInterface::SetShipYardMode(const nobShipYard* shipyard, bool buildShips) { - return SetShipYardMode(shipyard->GetPos(), buildShips); + return SetShipYardMode(shipyard->getPos(), buildShips); } bool AIInterface::DestroyBuilding(const noBuilding* building) { - return DestroyBuilding(building->GetPos()); + return DestroyBuilding(building->getPos()); } bool AIInterface::DestroyFlag(const noFlag* flag) { - return DestroyFlag(flag->GetPos()); + return DestroyFlag(flag->getPos()); } bool AIInterface::CallSpecialist(const noFlag* flag, Job job) { - return CallSpecialist(flag->GetPos(), job); + return CallSpecialist(flag->getPos(), job); } void AIInterface::Chat(const std::string& message, ChatDestination destination) diff --git a/libs/s25main/ai/AIInterface.h b/libs/s25main/ai/AIInterface.h index b727c85d96..7df520b2ec 100644 --- a/libs/s25main/ai/AIInterface.h +++ b/libs/s25main/ai/AIInterface.h @@ -37,66 +37,66 @@ class AIInterface : public GameCommandFactory AIInterface(const GameWorldBase& gwb, std::vector& gcs, unsigned char playerID); ~AIInterface(); - unsigned char GetPlayerId() const { return playerID_; } - unsigned GetNumPlayers() const { return gwb.GetNumPlayers(); } + unsigned char getPlayerId() const { return playerID_; } + unsigned getNumPlayers() const { return gwb.getNumPlayers(); } const std::vector& getUsableHarbors() const { return usableHarbors_; } bool IsDefeated() const { return player_.IsDefeated(); } /// Return the resource buried on a given spot (gold, coal, iron ore, granite (sub), fish, nothing) - AISubSurfaceResource GetSubsurfaceResource(MapPoint pt) const; + AISubSurfaceResource getSubsurfaceResource(MapPoint pt) const; /// Return the resource on top on a given spot (wood, stones, nothing) - AISurfaceResource GetSurfaceResource(MapPoint pt) const; + AISurfaceResource getSurfaceResource(MapPoint pt) const; /// Calculate the surface resource value on a given spot (wood/ stones/ farmland) /// when given a direction and lastvalue the calculation will be much faster O(n) vs O(n^2) int CalcResourceValue(MapPoint pt, AIResource res, helpers::OptionalEnum direction = std::nullopt, int lastval = 0xffff) const; /// Calculate the resource value for a given point - int GetResourceRating(MapPoint pt, AIResource res) const; + int getResourceRating(MapPoint pt, AIResource res) const; /// Check whether the given mine resource can be produced on otherwise empty mineable mountain. - bool IsMineResourceWorkEverywhere(AIResource res) const; + bool isMineResourceWorkEverywhere(AIResource res) const; /// Test whether a given point is part of the border or not - bool IsBorder(const MapPoint pt) const + bool isBorder(const MapPoint pt) const { - return gwb.GetNode(pt).boundary_stones[BorderStonePos::OnPoint] == (playerID_ + 1); + return gwb.getNode(pt).boundary_stones[BorderStonePos::OnPoint] == (playerID_ + 1); } /// Test whether a given point is part of own territory - bool IsOwnTerritory(const MapPoint pt) const { return gwb.GetNode(pt).owner == (playerID_ + 1); } + bool isOwnTerritory(const MapPoint pt) const { return gwb.getNode(pt).owner == (playerID_ + 1); } - bool IsRoad(const MapPoint pt, Direction dir) { return gwb.GetPointRoad(pt, dir) != PointRoad::None; } + bool isRoad(const MapPoint pt, Direction dir) { return gwb.getPointRoad(pt, dir) != PointRoad::None; } /// Test whether there is a object of a certain type on a spot - bool IsObjectTypeOnNode(const MapPoint pt, NodalObjectType objectType) const + bool isObjectTypeOnNode(const MapPoint pt, NodalObjectType objectType) const { - return gwb.GetNO(pt)->GetType() == objectType; + return gwb.getNO(pt)->getType() == objectType; } /// Test whether there is specific building on a spot - bool IsBuildingOnNode(const MapPoint pt, BuildingType bld) const + bool isBuildingOnNode(const MapPoint pt, BuildingType bld) const { - const noBase* no = gwb.GetNO(pt); - const NodalObjectType noType = no->GetType(); + const noBase* no = gwb.getNO(pt); + const NodalObjectType noType = no->getType(); return (noType == NodalObjectType::Building || noType == NodalObjectType::Buildingsite) - && (static_cast(no)->GetBuildingType() == bld); + && (static_cast(no)->getBuildingType() == bld); } /// Test whether the ai player can see a point - bool IsVisible(const MapPoint pt) const + bool isVisible(const MapPoint pt) const { return gwb.CalcVisiblityWithAllies(pt, playerID_) == Visibility::Visible; } /// Return true when the building quality at the 2nd point is lower than the bq on the first point bool CalcBQSumDifference(MapPoint pt1, MapPoint pt2) const; /// Return building quality on a given spot - BuildingQuality GetBuildingQuality(MapPoint pt) const; - BuildingQuality GetBuildingQualityAnyOwner(MapPoint pt) const; + BuildingQuality getBuildingQuality(MapPoint pt) const; + BuildingQuality getBuildingQualityAnyOwner(MapPoint pt) const; /// Tries to find a free path for a road and return length and the route bool FindFreePathForNewRoad(MapPoint start, MapPoint target, std::vector* route = nullptr, unsigned* length = nullptr) const; /// Tries to find a route from start to target, returning length of that route if it exists bool FindPathOnRoads(const noRoadNode& start, const noRoadNode& target, unsigned* length = nullptr) const; /// Checks if it is allowed to build catapults - bool CanBuildCatapult() const { return player_.CanBuildCatapult(); } + bool canBuildCatapult() const { return player_.canBuildCatapult(); } /// checks if the player is allowed to build the building type (lua maybe later addon?) - bool CanBuildBuildingtype(BuildingType bt) const { return player_.IsBuildingEnabled(bt); } + bool canBuildBuildingtype(BuildingType bt) const { return player_.isBuildingEnabled(bt); } /// Test whether a player is attackable or not (alliances, etc) - bool IsPlayerAttackable(unsigned char playerID) const { return player_.IsAttackable(playerID); } + bool isPlayerAttackable(unsigned char playerID) const { return player_.isAttackable(playerID); } /// player.FindWarehouse template nobBaseWarehouse* FindWarehouse(const noRoadNode& start, const T_IsWarehouseGood& isWarehouseGood, bool to_wh, @@ -106,36 +106,36 @@ class AIInterface : public GameCommandFactory return player_.FindWarehouse(start, isWarehouseGood, to_wh, use_boat_roads, length, forbidden); } /// Return the headquarter of the player (or null if destroyed) - const nobHQ* GetHeadquarter() const; + const nobHQ* getHeadquarter() const; /// Return reference to the list of building sites - const std::list& GetBuildingSites() const + const std::list& getBuildingSites() const { - return player_.GetBuildingRegister().GetBuildingSites(); + return player_.getBuildingRegister().getBuildingSites(); } - const std::list& GetPlayerBuildingSites(unsigned playerId) const + const std::list& getPlayerBuildingSites(unsigned playerId) const { - return gwb.GetPlayer(playerId).GetBuildingRegister().GetBuildingSites(); + return gwb.getPlayer(playerId).getBuildingRegister().getBuildingSites(); } /// Return a list to buildings of a given type - const std::list& GetBuildings(const BuildingType type) const + const std::list& getBuildings(const BuildingType type) const { - return player_.GetBuildingRegister().GetBuildings(type); + return player_.getBuildingRegister().getBuildings(type); } - const std::list& GetPlayerBuildings(const BuildingType type, unsigned playerId) const + const std::list& getPlayerBuildings(const BuildingType type, unsigned playerId) const { - return gwb.GetPlayer(playerId).GetBuildingRegister().GetBuildings(type); + return gwb.getPlayer(playerId).getBuildingRegister().getBuildings(type); } // Return a list containing all military buildings - const std::list& GetMilitaryBuildings() const + const std::list& getMilitaryBuildings() const { - return player_.GetBuildingRegister().GetMilitaryBuildings(); + return player_.getBuildingRegister().getMilitaryBuildings(); } /// Return a list containing all harbors - const std::list& GetHarbors() const { return player_.GetBuildingRegister().GetHarbors(); } + const std::list& getHarbors() const { return player_.getBuildingRegister().getHarbors(); } /// Return a list containing all storehouses and harbors and the hq - const std::list& GetStorehouses() const + const std::list& getStorehouses() const { - return player_.GetBuildingRegister().GetStorehouses(); + return player_.getBuildingRegister().getStorehouses(); } /// Check if there is a building of the given type in a radius of at most maxDistance @@ -145,21 +145,21 @@ class AIInterface : public GameCommandFactory bool isHarborPosClose(MapPoint pt, unsigned maxDistance, bool onlyEmpty = false) const; /// Return the inventory of the AI player - const Inventory& GetInventory() const { return player_.GetInventory(); } + const Inventory& getInventory() const { return player_.getInventory(); } /// Return the number of ships - unsigned GetNumShips() const { return player_.GetNumShips(); } + unsigned getNumShips() const { return player_.getNumShips(); } /// Return the list of ships - const std::vector& GetShips() const { return player_.GetShips(); } + const std::vector& getShips() const { return player_.getShips(); } /// Return the ID of a given ship - unsigned GetShipID(const noShip& ship) const { return player_.GetShipID(ship); } + unsigned getShipID(const noShip& ship) const { return player_.getShipID(ship); } /// Test whether there is a possibility to start a expedition in a given direction from a given position, assuming a /// given starting harbor - bool IsExplorationDirectionPossible(MapPoint pt, const nobHarborBuilding* originHarbor, + bool isExplorationDirectionPossible(MapPoint pt, const nobHarborBuilding* originHarbor, ShipDirection direction) const; /// Test whether there is a possibility to start a expedition in a given direction from a given position, assuming a /// given starting harbor - bool IsExplorationDirectionPossible(MapPoint pt, HarborId originHarborID, ShipDirection direction) const; - Nation GetNation() const { return player_.nation; } + bool isExplorationDirectionPossible(MapPoint pt, HarborId originHarborID, ShipDirection direction) const; + Nation getNation() const { return player_.nation; } bool SetCoinsAllowed(const nobMilitary* building, bool enabled); using GameCommandFactory::SetCoinsAllowed; @@ -167,16 +167,16 @@ class AIInterface : public GameCommandFactory bool StartStopExpedition(const nobHarborBuilding* hb, bool start); using GameCommandFactory::StartStopExpedition; - bool FoundColony(const noShip& ship) { return FoundColony(GetShipID(ship)); } + bool FoundColony(const noShip& ship) { return FoundColony(getShipID(ship)); } using GameCommandFactory::FoundColony; bool TravelToNextSpot(ShipDirection direction, const noShip& ship) { - return TravelToNextSpot(direction, GetShipID(ship)); + return TravelToNextSpot(direction, getShipID(ship)); } using GameCommandFactory::TravelToNextSpot; - bool CancelExpedition(const noShip& ship) { return CancelExpedition(GetShipID(ship)); } + bool CancelExpedition(const noShip& ship) { return CancelExpedition(getShipID(ship)); } using GameCommandFactory::CancelExpedition; bool SetShipYardMode(const nobShipYard* shipyard, bool buildShips); diff --git a/libs/s25main/ai/AIPlayer.h b/libs/s25main/ai/AIPlayer.h index 99f01fa2f3..e549657426 100644 --- a/libs/s25main/ai/AIPlayer.h +++ b/libs/s25main/ai/AIPlayer.h @@ -17,7 +17,7 @@ class AIPlayer { public: AIPlayer(unsigned char playerId, const GameWorldBase& gwb, const AI::Level level) - : playerId(playerId), player(gwb.GetPlayer(playerId)), gwb(gwb), ggs(gwb.GetGGS()), level(level), + : playerId(playerId), player(gwb.getPlayer(playerId)), gwb(gwb), ggs(gwb.getGGS()), level(level), aii(gwb, gcs, playerId) {} @@ -27,8 +27,8 @@ class AIPlayer virtual void RunGF(unsigned gf, bool gfisnwf) = 0; virtual void OnChatMessage(unsigned sendPlayerId, ChatDestination, const std::string& msg) = 0; - const std::string& GetPlayerName() const { return player.name; } - unsigned char GetPlayerId() const { return playerId; } + const std::string& getPlayerName() const { return player.name; } + unsigned char getPlayerId() const { return playerId; } /// Get the game commands and mark them as processed std::vector FetchGameCommands() diff --git a/libs/s25main/ai/aijh/AIConstruction.cpp b/libs/s25main/ai/aijh/AIConstruction.cpp index 2e42b2d4b3..aaa5345d13 100644 --- a/libs/s25main/ai/aijh/AIConstruction.cpp +++ b/libs/s25main/ai/aijh/AIConstruction.cpp @@ -36,7 +36,7 @@ namespace AIJH { AIConstruction::AIConstruction(AIPlayerJH& aijh) - : aijh(aijh), aii(aijh.GetInterface()), bldPlanner(aijh.GetBldPlanner()) + : aijh(aijh), aii(aijh.getInterface()), bldPlanner(aijh.getBldPlanner()) { std::fill(constructionorders.begin(), constructionorders.end(), 0u); } @@ -45,10 +45,10 @@ AIConstruction::~AIConstruction() = default; void AIConstruction::AddBuildJob(std::unique_ptr job, bool front) { - if(job->GetType() == BuildingType::Shipyard && aijh.IsInvalidShipyardPosition(job->GetAround())) + if(job->getType() == BuildingType::Shipyard && aijh.isInvalidShipyardPosition(job->getAround())) return; - if(BuildingProperties::IsMilitary( - job->GetType())) // non military buildings can only be added once to the contruction que for every location + if(BuildingProperties::isMilitary( + job->getType())) // non military buildings can only be added once to the contruction que for every location { if(front) buildJobs.push_front(std::move(job)); @@ -59,7 +59,7 @@ void AIConstruction::AddBuildJob(std::unique_ptr job, bool front) bool alreadyinlist = false; for(auto& buildJob : buildJobs) { - if(buildJob->GetType() == job->GetType() && buildJob->GetAround() == job->GetAround()) + if(buildJob->getType() == job->getType() && buildJob->getAround() == job->getAround()) { alreadyinlist = true; break; @@ -95,43 +95,43 @@ void AIConstruction::ExecuteJobs(unsigned limit) auto job = std::move(connectJobs.front()); connectJobs.pop_front(); job->ExecuteJob(); - if(job->GetState() != JobState::Finished - && job->GetState() != JobState::Failed) // couldnt do job? -> move to back of list + if(job->getState() != JobState::Finished + && job->getState() != JobState::Failed) // couldnt do job? -> move to back of list { connectJobs.push_back(std::move(job)); } } for(; i < limit && !buildJobs.empty() && i < (initconjobs + initbuildjobs); i++) { - auto job = GetBuildJob(); + auto job = getBuildJob(); job->ExecuteJob(); - if(job->GetState() != JobState::Finished - && job->GetState() != JobState::Failed) // couldnt do job? -> move to back of list + if(job->getState() != JobState::Finished + && job->getState() != JobState::Failed) // couldnt do job? -> move to back of list { buildJobs.push_back(std::move(job)); } } } -void AIConstruction::SetFlagsAlongRoad(const noRoadNode& roadNode, Direction dir) +void AIConstruction::setFlagsAlongRoad(const noRoadNode& roadNode, Direction dir) { // does the roadsegment still exist? - const RoadSegment& roadSeg = *roadNode.GetRoute(dir); - bool isBwdDir = roadSeg.GetNodeID(roadNode); - MapPoint curPos = roadNode.GetPos(); + const RoadSegment& roadSeg = *roadNode.getRoute(dir); + bool isBwdDir = roadSeg.getNodeID(roadNode); + MapPoint curPos = roadNode.getPos(); // Skip first - curPos = aii.gwb.GetNeighbour(curPos, roadSeg.GetDir(isBwdDir, 0)); + curPos = aii.gwb.getNeighbour(curPos, roadSeg.getDir(isBwdDir, 0)); // Start after getting first neighbor (min distance == 2) // and skip last 2 points (min distance and last is flag) for(unsigned i = 1; i + 2 < roadSeg.GetLength(); ++i) { - curPos = aii.gwb.GetNeighbour(curPos, roadSeg.GetDir(isBwdDir, i)); + curPos = aii.gwb.getNeighbour(curPos, roadSeg.getDir(isBwdDir, i)); aii.SetFlag(curPos); constructionlocations.push_back(curPos); } } -std::unique_ptr AIConstruction::GetBuildJob() +std::unique_ptr AIConstruction::getBuildJob() { if(buildJobs.empty()) return nullptr; @@ -146,14 +146,14 @@ void AIConstruction::AddConnectFlagJob(const noFlag* flag) // already in list? for(auto& connectJob : connectJobs) { - if(connectJob->getFlag() == flag->GetPos()) + if(connectJob->getFlag() == flag->getPos()) return; } // add to list - connectJobs.push_back(std::make_unique(aijh, flag->GetPos())); + connectJobs.push_back(std::make_unique(aijh, flag->getPos())); } -bool AIConstruction::CanStillConstructHere(const MapPoint pt) const +bool AIConstruction::canStillConstructHere(const MapPoint pt) const { for(const auto& constructionlocation : constructionlocations) { @@ -165,10 +165,10 @@ bool AIConstruction::CanStillConstructHere(const MapPoint pt) const void AIConstruction::ConstructionOrdered(const BuildJob& job) { - RTTR_Assert(job.GetTarget().isValid()); + RTTR_Assert(job.getTarget().isValid()); // add new construction area to the list of active orders in the current nwf - constructionlocations.push_back(job.GetTarget()); - constructionorders[job.GetType()]++; + constructionlocations.push_back(job.getTarget()); + constructionorders[job.getType()]++; } void AIConstruction::ConstructionsExecuted() @@ -182,28 +182,28 @@ namespace { { const GameWorldBase& world_; Point2FlagAI(const GameWorldBase& world) : world_(world) {} - const noFlag* operator()(const MapPoint pt, unsigned /*r*/) const { return world_.GetSpecObj(pt); } + const noFlag* operator()(const MapPoint pt, unsigned /*r*/) const { return world_.getSpecObj(pt); } }; struct IsValidFlag { const unsigned playerId_; IsValidFlag(const unsigned playerId) : playerId_(playerId) {} - bool operator()(const noFlag* const flag) const { return flag && flag->GetPlayer() == playerId_; } + bool operator()(const noFlag* const flag) const { return flag && flag->getPlayer() == playerId_; } }; } // namespace std::vector AIConstruction::FindFlags(const MapPoint pt, unsigned short radius) { std::vector flags = - aii.gwb.GetPointsInRadius<30>(pt, radius, Point2FlagAI(aii.gwb), IsValidFlag(aii.GetPlayerId())); + aii.gwb.getPointsInRadius<30>(pt, radius, Point2FlagAI(aii.gwb), IsValidFlag(aii.getPlayerId())); // When the radius is at least half the size of the map then we may have duplicates that need to be removed - if(radius >= std::min(aii.gwb.GetSize().x, aii.gwb.GetSize().y)) + if(radius >= std::min(aii.gwb.getSize().x, aii.gwb.getSize().y)) { helpers::makeUniqueStable(flags); // If at this pos is a flag, then it might be included due to wrapping. // This is wrong and needs to be removed - const auto* flag = aii.gwb.GetSpecObj(pt); + const auto* flag = aii.gwb.getSpecObj(pt); if(flag) { auto it = helpers::find(flags, flag); @@ -233,17 +233,17 @@ std::vector AIConstruction::FindFlags(const MapPoint pt, unsigned bool AIConstruction::MilitaryBuildingWantsRoad(const nobMilitary& milbld) { - if(milbld.GetFrontierDistance() != FrontierDistance::Far) // close to front or harbor? connect! + if(milbld.getFrontierDistance() != FrontierDistance::Far) // close to front or harbor? connect! return true; if(!aijh.UpgradeBldPos.isValid()) // no upgrade bld on last update -> connect all that want to connect return true; if(aijh.UpgradeBldPos - == milbld.GetPos()) // upgrade bld should have road already but just in case it doesnt -> get a road asap + == milbld.getPos()) // upgrade bld should have road already but just in case it doesnt -> get a road asap return true; // TODO: This probably does not do what is wanted... - const auto bldIdx = helpers::indexOf(aii.GetMilitaryBuildings(), &milbld); + const auto bldIdx = helpers::indexOf(aii.getMilitaryBuildings(), &milbld); return bldIdx - > static_cast(aii.GetMilitaryBuildings().size() - aijh.GetNumPlannedConnectedInlandMilitaryBlds()); + > static_cast(aii.getMilitaryBuildings().size() - aijh.getNumPlannedConnectedInlandMilitaryBlds()); } bool AIConstruction::ConnectFlagToRoadSytem(const noFlag* flag, std::vector& route, @@ -255,22 +255,22 @@ bool AIConstruction::ConnectFlagToRoadSytem(const noFlag* flag, std::vector check if we really want to connect this right now - const MapPoint bldPos = aii.gwb.GetNeighbour(flag->GetPos(), Direction::NorthWest); - if(const auto* milBld = aii.gwb.GetSpecObj(bldPos)) + const MapPoint bldPos = aii.gwb.getNeighbour(flag->getPos(), Direction::NorthWest); + if(const auto* milBld = aii.gwb.getSpecObj(bldPos)) { if(!MilitaryBuildingWantsRoad(*milBld)) return false; } // Ziel, das möglichst schnell erreichbar sein soll // noFlag *targetFlag = gwb->GetSpecObj(player->hqPos)->GetFlag(); - noFlag* targetFlag = FindTargetStoreHouseFlag(flag->GetPos()); + noFlag* targetFlag = FindTargetStoreHouseFlag(flag->getPos()); // Falls kein Lager mehr vorhanden ist, brauchen wir auch keinen Weg suchen if(!targetFlag) return false; // Flaggen in der Umgebung holen - std::vector flags = FindFlags(flag->GetPos(), maxSearchRadius); + std::vector flags = FindFlags(flag->getPos(), maxSearchRadius); #ifdef DEBUG_AI std::cout << "FindFlagsNum: " << flags.size() << std::endl; @@ -286,10 +286,10 @@ bool AIConstruction::ConnectFlagToRoadSytem(const noFlag* flag, std::vectorGetPos(), Direction::NorthWest), true)) + if(aii.gwb.isMilitaryBuildingOnNode(aii.gwb.getNeighbour(curFlag->getPos(), Direction::NorthWest), true)) continue; // Gibts überhaupt einen Pfad zu dieser Flagge - if(!aii.FindFreePathForNewRoad(flag->GetPos(), curFlag->GetPos(), &tmpRoute, &length)) + if(!aii.FindFreePathForNewRoad(flag->getPos(), curFlag->getPos(), &tmpRoute, &length)) continue; // Wenn ja, dann gucken ob dieser Pfad möglichst kurz zum "höheren" Ziel (allgemeines Lager im Moment) ist @@ -297,12 +297,12 @@ bool AIConstruction::ConnectFlagToRoadSytem(const noFlag* flag, std::vector not really valid // path unsigned curNonFlagPts = 0; - MapPoint tmpPos = flag->GetPos(); + MapPoint tmpPos = flag->getPos(); for(auto j : tmpRoute) { - tmpPos = aii.gwb.GetNeighbour(tmpPos, j); - RTTR_Assert(aii.GetBuildingQuality(tmpPos) == aijh.GetAINode(tmpPos).bq); - if(aii.GetBuildingQuality(tmpPos) == BuildingQuality::Nothing) + tmpPos = aii.gwb.getNeighbour(tmpPos, j); + RTTR_Assert(aii.getBuildingQuality(tmpPos) == aijh.getAINode(tmpPos).bq); + if(aii.getBuildingQuality(tmpPos) == BuildingQuality::Nothing) curNonFlagPts++; else { @@ -344,8 +344,8 @@ bool AIConstruction::ConnectFlagToRoadSytem(const noFlag* flag, std::vectorGetPos()); - constructionlocations.push_back(shortest->GetPos()); + constructionlocations.push_back(flag->getPos()); + constructionlocations.push_back(shortest->getPos()); return true; } return false; @@ -357,17 +357,17 @@ bool AIConstruction::MinorRoadImprovements(const noRoadNode* start, const noRoad return BuildRoad(start, target, route); // TODO: Enable later after checking for performance and correctness RTTR_IGNORE_UNREACHABLE_CODE - MapPoint pStart = start->GetPos(); //-V779 + MapPoint pStart = start->getPos(); //-V779 for(unsigned i = 0; i + 1 < route.size(); i++) { // switching current and next route element will result in the same position after building both if((route[i] + 1u == route[i + 1]) || (route[i] - 1u == route[i + 1])) { MapPoint t(pStart); - t = aii.gwb.GetNeighbour(t, route[i + 1]); - pStart = aii.gwb.GetNeighbour(pStart, route[i]); + t = aii.gwb.getNeighbour(t, route[i + 1]); + pStart = aii.gwb.getNeighbour(pStart, route[i]); // can the alternative road be build? - if(aii.gwb.IsRoadAvailable(false, t) && aii.IsOwnTerritory(t)) + if(aii.gwb.isRoadAvailable(false, t) && aii.isOwnTerritory(t)) { // does the alternative road block a lower buildingquality point than the normal planned route? if(aii.CalcBQSumDifference(pStart, t)) @@ -379,7 +379,7 @@ bool AIConstruction::MinorRoadImprovements(const noRoadNode* start, const noRoad } } } else - pStart = aii.gwb.GetNeighbour(pStart, route[i]); + pStart = aii.gwb.getNeighbour(pStart, route[i]); } return BuildRoad(start, target, route); RTTR_POP_DIAGNOSTIC @@ -392,7 +392,7 @@ bool AIConstruction::BuildRoad(const noRoadNode* start, const noRoadNode* target // Gucken obs einen Weg gibt if(route.empty()) { - foundPath = aii.FindFreePathForNewRoad(start->GetPos(), target->GetPos(), &route); + foundPath = aii.FindFreePathForNewRoad(start->getPos(), target->getPos(), &route); } else { // Wenn Route übergeben wurde, davon ausgehen dass diese auch existiert @@ -402,7 +402,7 @@ bool AIConstruction::BuildRoad(const noRoadNode* start, const noRoadNode* target // Wenn Pfad gefunden, Befehl zum Straße bauen und Flagen setzen geben if(foundPath) { - aii.BuildRoad(start->GetPos(), false, route); + aii.BuildRoad(start->getPos(), false, route); // set flags along the road just after contruction - todo: handle failed road construction by removing the // useless flags! /*MapCoord tx=x,ty=y; @@ -420,30 +420,30 @@ bool AIConstruction::BuildRoad(const noRoadNode* start, const noRoadNode* target return false; } -bool AIConstruction::IsConnectedToRoadSystem(const noFlag* flag) const +bool AIConstruction::isConnectedToRoadSystem(const noFlag* flag) const { - noFlag* targetFlag = FindTargetStoreHouseFlag(flag->GetPos()); + noFlag* targetFlag = FindTargetStoreHouseFlag(flag->getPos()); if(targetFlag) return (targetFlag == flag) || aii.FindPathOnRoads(*flag, *targetFlag); else return false; } -helpers::OptionalEnum AIConstruction::GetSmallestAllowedMilBuilding() const +helpers::OptionalEnum AIConstruction::getSmallestAllowedMilBuilding() const { for(BuildingType bld : BuildingProperties::militaryBldTypes) { - if(aii.CanBuildBuildingtype(bld)) + if(aii.canBuildBuildingtype(bld)) return bld; } return std::nullopt; } -helpers::OptionalEnum AIConstruction::GetBiggestAllowedMilBuilding() const +helpers::OptionalEnum AIConstruction::getBiggestAllowedMilBuilding() const { for(BuildingType bld : boost::adaptors::reverse(BuildingProperties::militaryBldTypes)) { - if(aii.CanBuildBuildingtype(bld)) + if(aii.canBuildBuildingtype(bld)) return bld; } return std::nullopt; @@ -458,54 +458,54 @@ helpers::OptionalEnum AIConstruction::ChooseMilitaryBuilding(const // to do: important location or an area with a very low amount of buildspace? -> try large buildings // buildings with requirement > small have a chance to be replaced with small buildings to avoid getting stuck if // there are no places for medium/large buildings - auto bld = GetSmallestAllowedMilBuilding(); + auto bld = getSmallestAllowedMilBuilding(); // If we are not allowed to build a military building, return early if(!bld) return std::nullopt; - const BuildingType biggestBld = GetBiggestAllowedMilBuilding().value(); + const BuildingType biggestBld = getBiggestAllowedMilBuilding().value(); - const Inventory& inventory = aii.GetInventory(); + const Inventory& inventory = aii.getInventory(); if((inventory.people[Job::Private] < 15 || AI::randomChance(3)) - && (inventory.goods[GoodType::Stones] > 6 || bldPlanner.GetNumBuildings(BuildingType::Quarry) > 0)) + && (inventory.goods[GoodType::Stones] > 6 || bldPlanner.getNumBuildings(BuildingType::Quarry) > 0)) bld = BuildingType::Guardhouse; if(aijh.getAIInterface().isHarborPosClose(pt, 19) && !AI::randomChance(10) && aijh.ggs.isEnabled(AddonId::SEA_ATTACK)) { - if(aii.CanBuildBuildingtype(BuildingType::Watchtower)) + if(aii.canBuildBuildingtype(BuildingType::Watchtower)) return BuildingType::Watchtower; - return GetBiggestAllowedMilBuilding(); + return getBiggestAllowedMilBuilding(); } if(biggestBld == BuildingType::Watchtower || biggestBld == BuildingType::Fortress) { - if(!aijh.UpdateUpgradeBuilding() && bldPlanner.GetNumBuildingSites(biggestBld) < 1 - && (inventory.goods[GoodType::Stones] > 20 || bldPlanner.GetNumBuildings(BuildingType::Quarry) > 0) + if(!aijh.UpdateUpgradeBuilding() && bldPlanner.getNumBuildingSites(biggestBld) < 1 + && (inventory.goods[GoodType::Stones] > 20 || bldPlanner.getNumBuildings(BuildingType::Quarry) > 0) && !AI::randomChance(10)) { return biggestBld; } } - uint8_t playerId = aii.GetPlayerId(); + uint8_t playerId = aii.getPlayerId(); sortedMilitaryBlds military = aii.gwb.LookForMilitaryBuildings(pt, 3); for(const nobBaseMilitary* milBld : military) { - const unsigned distance = aii.gwb.CalcDistance(milBld->GetPos(), pt); + const unsigned distance = aii.gwb.CalcDistance(milBld->getPos(), pt); // Check for close enemy - if(milBld->GetPlayer() != playerId && distance < 35) + if(milBld->getPlayer() != playerId && distance < 35) { - bool buildCatapult = AI::randomChance(8) && aii.CanBuildCatapult() - && bldPlanner.GetNumAdditionalBuildingsWanted(BuildingType::Catapult) > 0; + bool buildCatapult = AI::randomChance(8) && aii.canBuildCatapult() + && bldPlanner.getNumAdditionalBuildingsWanted(BuildingType::Catapult) > 0; // another catapult within this radius? ->dont build here! constexpr unsigned minCatapultDist = 16; - if(buildCatapult && aii.gwb.CalcDistance(pt, aii.GetStorehouses().front()->GetPos()) < minCatapultDist) + if(buildCatapult && aii.gwb.CalcDistance(pt, aii.getStorehouses().front()->getPos()) < minCatapultDist) buildCatapult = false; if(buildCatapult) { - for(const nobUsual* catapult : aii.GetBuildings(BuildingType::Catapult)) + for(const nobUsual* catapult : aii.getBuildings(BuildingType::Catapult)) { - if(aii.gwb.CalcDistance(pt, catapult->GetPos()) < minCatapultDist) + if(aii.gwb.CalcDistance(pt, catapult->getPos()) < minCatapultDist) { buildCatapult = false; break; @@ -514,10 +514,10 @@ helpers::OptionalEnum AIConstruction::ChooseMilitaryBuilding(const } if(buildCatapult) { - for(const noBuildingSite* bldSite : aii.GetBuildingSites()) + for(const noBuildingSite* bldSite : aii.getBuildingSites()) { - if(bldSite->GetBuildingType() == bld - && aii.gwb.CalcDistance(pt, bldSite->GetPos()) < minCatapultDist) + if(bldSite->getBuildingType() == bld + && aii.gwb.CalcDistance(pt, bldSite->getPos()) < minCatapultDist) { buildCatapult = false; break; @@ -532,13 +532,13 @@ helpers::OptionalEnum AIConstruction::ChooseMilitaryBuilding(const // there are no big building spots in that direction if(AI::randomChance(10)) { - if(aii.CanBuildBuildingtype(BuildingType::Guardhouse)) + if(aii.canBuildBuildingtype(BuildingType::Guardhouse)) bld = BuildingType::Guardhouse; else - bld = GetSmallestAllowedMilBuilding(); + bld = getSmallestAllowedMilBuilding(); } else { - if(aii.CanBuildBuildingtype(BuildingType::Watchtower) && AI::randomChance()) + if(aii.canBuildBuildingtype(BuildingType::Watchtower) && AI::randomChance()) bld = BuildingType::Watchtower; else bld = biggestBld; @@ -553,18 +553,18 @@ helpers::OptionalEnum AIConstruction::ChooseMilitaryBuilding(const bool AIConstruction::Wanted(BuildingType type) const { - if(!aii.CanBuildBuildingtype(type)) + if(!aii.canBuildBuildingtype(type)) return false; - if(type == BuildingType::Catapult && !aii.CanBuildCatapult()) + if(type == BuildingType::Catapult && !aii.canBuildCatapult()) return false; - if(BuildingProperties::IsMilitary(type) || type == BuildingType::Storehouse) + if(BuildingProperties::isMilitary(type) || type == BuildingType::Storehouse) return bldPlanner.WantMoreMilitaryBlds(aijh); - if(type == BuildingType::Sawmill && bldPlanner.GetNumBuildings(BuildingType::Sawmill) > 1) + if(type == BuildingType::Sawmill && bldPlanner.getNumBuildings(BuildingType::Sawmill) > 1) { - if(aijh.AmountInStorage(GoodType::Wood) < 15 * (bldPlanner.GetNumBuildingSites(BuildingType::Sawmill) + 1)) + if(aijh.AmountInStorage(GoodType::Wood) < 15 * (bldPlanner.getNumBuildingSites(BuildingType::Sawmill) + 1)) return false; } - return constructionorders[type] < bldPlanner.GetNumAdditionalBuildingsWanted(type); + return constructionorders[type] < bldPlanner.getNumAdditionalBuildingsWanted(type); } bool AIConstruction::BuildAlternativeRoad(const noFlag* flag, std::vector& route) @@ -576,15 +576,15 @@ bool AIConstruction::BuildAlternativeRoad(const noFlag* flag, std::vector flags = FindFlags(flag->GetPos(), maxRoadLength); + std::vector flags = FindFlags(flag->getPos(), maxRoadLength); std::vector mainroad = route; // targetflag for mainroad - MapPoint t = flag->GetPos(); + MapPoint t = flag->getPos(); for(auto i : mainroad) { - t = aii.gwb.GetNeighbour(t, i); + t = aii.gwb.getNeighbour(t, i); } - const auto* mainflag = aii.gwb.GetSpecObj(t); + const auto* mainflag = aii.gwb.getSpecObj(t); // Jede Flagge testen... for(const noFlag* i : flags) @@ -598,14 +598,14 @@ bool AIConstruction::BuildAlternativeRoad(const noFlag* flag, std::vectorGetPos(), curFlag.GetPos(), &route, &newLength)) + if(!aii.FindFreePathForNewRoad(flag->getPos(), curFlag.getPos(), &route, &newLength)) continue; // Wenn ja, dann gucken ob unser momentaner Weg zu dieser Flagge vielleicht voll weit ist und sich eine Straße @@ -624,23 +624,23 @@ bool AIConstruction::BuildAlternativeRoad(const noFlag* flag, std::vector not really valid path unsigned temp = 0; - t = flag->GetPos(); + t = flag->getPos(); for(auto j : route) { - t = aii.gwb.GetNeighbour(t, j); - MapPoint t2 = flag->GetPos(); + t = aii.gwb.getNeighbour(t, j); + MapPoint t2 = flag->getPos(); // check if we cross the planned main road for(auto k : mainroad) { - t2 = aii.gwb.GetNeighbour(t2, k); + t2 = aii.gwb.getNeighbour(t2, k); if(t2 == t) { crossmainpath = true; break; } } - RTTR_Assert(aii.GetBuildingQuality(t) == aijh.GetAINode(t).bq); - if(aii.GetBuildingQuality(t) == BuildingQuality::Nothing) + RTTR_Assert(aii.getBuildingQuality(t) == aijh.getAINode(t).bq); + if(aii.getBuildingQuality(t) == BuildingQuality::Nothing) temp++; else { @@ -657,7 +657,7 @@ bool AIConstruction::BuildAlternativeRoad(const noFlag* flag, std::vectorGetPos()); + constructionlocations.push_back(flag->getPos()); return true; } } @@ -668,16 +668,16 @@ bool AIConstruction::BuildAlternativeRoad(const noFlag* flag, std::vectorGetPos(), pt) < radius) + if(aii.gwb.CalcDistance(bld->getPos(), pt) < radius) return true; } - for(const noBuildingSite* bldSite : aii.GetBuildingSites()) + for(const noBuildingSite* bldSite : aii.getBuildingSites()) { - if(bldSite->GetBuildingType() == bt) + if(bldSite->getBuildingType() == bt) { - if(aii.gwb.CalcDistance(bldSite->GetPos(), pt) < radius) + if(aii.gwb.CalcDistance(bldSite->getPos(), pt) < radius) return true; } } @@ -686,16 +686,16 @@ bool AIConstruction::OtherUsualBuildingInRadius(MapPoint pt, unsigned radius, Bu bool AIConstruction::OtherStoreInRadius(MapPoint pt, unsigned radius) { - for(const nobBaseWarehouse* wh : aii.GetStorehouses()) + for(const nobBaseWarehouse* wh : aii.getStorehouses()) { - if(aii.gwb.CalcDistance(wh->GetPos(), pt) < radius) + if(aii.gwb.CalcDistance(wh->getPos(), pt) < radius) return true; } - for(const noBuildingSite* bldSite : aii.GetBuildingSites()) + for(const noBuildingSite* bldSite : aii.getBuildingSites()) { - if(BuildingProperties::IsWareHouse(bldSite->GetBuildingType())) + if(BuildingProperties::isWareHouse(bldSite->getBuildingType())) { - if(aii.gwb.CalcDistance(bldSite->GetPos(), pt) < radius) + if(aii.gwb.CalcDistance(bldSite->getPos(), pt) < radius) return true; } } @@ -706,9 +706,9 @@ noFlag* AIConstruction::FindTargetStoreHouseFlag(const MapPoint pt) const { unsigned minDistance = std::numeric_limits::max(); const nobBaseWarehouse* minTarget = nullptr; - for(const nobBaseWarehouse* wh : aii.GetStorehouses()) + for(const nobBaseWarehouse* wh : aii.getStorehouses()) { - unsigned dist = aii.gwb.CalcDistance(pt, wh->GetPos()); + unsigned dist = aii.gwb.CalcDistance(pt, wh->getPos()); if(dist < minDistance) { minDistance = dist; @@ -718,7 +718,7 @@ noFlag* AIConstruction::FindTargetStoreHouseFlag(const MapPoint pt) const if(!minTarget) return nullptr; else - return minTarget->GetFlag(); + return minTarget->getFlag(); } } // namespace AIJH diff --git a/libs/s25main/ai/aijh/AIConstruction.h b/libs/s25main/ai/aijh/AIConstruction.h index 74743e9504..2ecb41c933 100644 --- a/libs/s25main/ai/aijh/AIConstruction.h +++ b/libs/s25main/ai/aijh/AIConstruction.h @@ -37,9 +37,9 @@ class AIConstruction /// Adds a build job to the queue void AddBuildJob(std::unique_ptr job, bool front); - std::unique_ptr GetBuildJob(); - unsigned GetBuildJobNum() const { return buildJobs.size(); } - unsigned GetConnectJobNum() const { return connectJobs.size(); } + std::unique_ptr getBuildJob(); + unsigned getBuildJobNum() const { return buildJobs.size(); } + unsigned getConnectJobNum() const { return connectJobs.size(); } void AddConnectFlagJob(const noFlag* flag); @@ -57,10 +57,10 @@ class AIConstruction /// the lower bq is picked for the final path bool MinorRoadImprovements(const noRoadNode* start, const noRoadNode* target, std::vector& route); /// Checks whether a flag is connected to the road system or not (connected = has path to HQ) - bool IsConnectedToRoadSystem(const noFlag* flag) const; + bool isConnectedToRoadSystem(const noFlag* flag) const; - helpers::OptionalEnum GetSmallestAllowedMilBuilding() const; - helpers::OptionalEnum GetBiggestAllowedMilBuilding() const; + helpers::OptionalEnum getSmallestAllowedMilBuilding() const; + helpers::OptionalEnum getBiggestAllowedMilBuilding() const; /// Randomly chooses a military building, preferring bigger buildings if enemy nearby helpers::OptionalEnum ChooseMilitaryBuilding(MapPoint pt); /// Checks whether a building type is wanted atm @@ -74,11 +74,11 @@ class AIConstruction noFlag* FindTargetStoreHouseFlag(MapPoint pt) const; - bool CanStillConstructHere(MapPoint pt) const; + bool canStillConstructHere(MapPoint pt) const; void ExecuteJobs(unsigned limit); /// Set flags along the road starting at the given node in the given direction - void SetFlagsAlongRoad(const noRoadNode& roadNode, Direction dir); + void setFlagsAlongRoad(const noRoadNode& roadNode, Direction dir); /// To be called after a new construction site was added void ConstructionOrdered(const BuildJob& job); /// To be called when the current pending construction orders were processed (usually on NWF) diff --git a/libs/s25main/ai/aijh/AIPlayerJH.cpp b/libs/s25main/ai/aijh/AIPlayerJH.cpp index 10bb6806f2..df2b70fa04 100644 --- a/libs/s25main/ai/aijh/AIPlayerJH.cpp +++ b/libs/s25main/ai/aijh/AIPlayerJH.cpp @@ -123,7 +123,7 @@ Subscription recordBQsToUpdate(const GameWorldBase& gw, std::vector& b bqsToUpdate.push_back(pt); return false; }; - return gw.GetNotifications().subscribe([&gw, addToBqsToUpdate](const NodeNote& note) { + return gw.getNotifications().subscribe([&gw, addToBqsToUpdate](const NodeNote& note) { if(note.type == NodeNote::BQ) { // Need to check surrounding nodes for possible/impossible flags (e.g. near border) @@ -141,10 +141,10 @@ static bool isUnlimitedResource(const AIResource res, const GlobalGameSettings& { switch(res) { - case AIResource::Gold: return !IsMineResourceDepletable(ggs, BuildingType::GoldMine); - case AIResource::Ironore: return !IsMineResourceDepletable(ggs, BuildingType::IronMine); - case AIResource::Coal: return !IsMineResourceDepletable(ggs, BuildingType::CoalMine); - case AIResource::Granite: return !IsMineResourceDepletable(ggs, BuildingType::GraniteMine); + case AIResource::Gold: return !isMineResourceDepletable(ggs, BuildingType::GoldMine); + case AIResource::Ironore: return !isMineResourceDepletable(ggs, BuildingType::IronMine); + case AIResource::Coal: return !isMineResourceDepletable(ggs, BuildingType::CoalMine); + case AIResource::Granite: return !isMineResourceDepletable(ggs, BuildingType::GraniteMine); case AIResource::Fish: return ggs.isEnabled(AddonId::INEXHAUSTIBLE_FISH); default: return false; } @@ -155,7 +155,7 @@ template static auto createResourceMaps(const AIInterface& aii, const AIMap& aiMap, std::index_sequence) { return helpers::EnumArray{AIResourceMap( - static_cast(I), isUnlimitedResource(static_cast(I), aii.gwb.GetGGS()), aii, aiMap)...}; + static_cast(I), isUnlimitedResource(static_cast(I), aii.gwb.getGGS()), aii, aiMap)...}; } static auto createResourceMaps(const AIInterface& aii, const AIMap& aiMap) { @@ -190,7 +190,7 @@ AIPlayerJH::AIPlayerJH(const unsigned char playerId, const GameWorldBase& gwb, c default: throw std::invalid_argument("Invalid AI level!"); } // TODO: Maybe remove the AIEvents where possible and call the handler functions directly - NotificationManager& notifications = gwb.GetNotifications(); + NotificationManager& notifications = gwb.getNotifications(); subBuilding = notifications.subscribe([this, playerId](const BuildingNote& note) { if(note.player == playerId) HandleBuildingNote(eventManager, note); @@ -236,7 +236,7 @@ void AIPlayerJH::RunGF(const unsigned gf, bool gfisnwf) } if(gf == 100) { - if(aii.GetMilitaryBuildings().empty() && aii.GetStorehouses().size() < 2) + if(aii.getMilitaryBuildings().empty() && aii.getStorehouses().size() < 2) aii.Chat(_("Hi, I'm an artifical player and I'm not very good yet!")); } @@ -244,7 +244,7 @@ void AIPlayerJH::RunGF(const unsigned gf, bool gfisnwf) { helpers::makeUnique(nodesWithOutdatedBQ, MapPointLess()); for(const MapPoint pt : nodesWithOutdatedBQ) - aiMap[pt].bq = aii.GetBuildingQuality(pt); + aiMap[pt].bq = aii.getBuildingQuality(pt); nodesWithOutdatedBQ.clear(); } @@ -285,17 +285,17 @@ void AIPlayerJH::RunGF(const unsigned gf, bool gfisnwf) { AdjustSettings(); // check for useless sawmills - const std::list& sawMills = aii.GetBuildings(BuildingType::Sawmill); + const std::list& sawMills = aii.getBuildings(BuildingType::Sawmill); if(sawMills.size() > 3) { int burns = 0; for(const nobUsual* sawmill : sawMills) { - if(sawmill->GetProductivity() < 1 && sawmill->HasWorker() && sawmill->GetNumWares(0) < 1 + if(sawmill->getProductivity() < 1 && sawmill->hasWorker() && sawmill->getNumWares(0) < 1 && (sawMills.size() - burns) > 3 && !sawmill->AreThereAnyOrderedWares()) { aii.DestroyBuilding(sawmill); - RemoveUnusedRoad(*sawmill->GetFlag(), Direction::NorthWest, true); + RemoveUnusedRoad(*sawmill->getFlag(), Direction::NorthWest, true); burns++; } } @@ -331,15 +331,15 @@ void AIPlayerJH::PlanNewBuildings(const unsigned gf) // LOG.write(("new buildorders %i whs and %i mil for player %i // \n",aii.GetStorehouses().size(),aii.GetMilitaryBuildings().size(),playerId); - const std::list& storehouses = aii.GetStorehouses(); + const std::list& storehouses = aii.getStorehouses(); if(!storehouses.empty()) { // collect swords,shields,helpers,privates and beer in first storehouse or whatever is closest to the // upgradebuilding if we have one! - nobBaseWarehouse* wh = GetUpgradeBuildingWarehouse(); - SetGatheringForUpgradeWarehouse(wh); + nobBaseWarehouse* wh = getUpgradeBuildingWarehouse(); + setGatheringForUpgradeWarehouse(wh); - if(ggs.GetMaxMilitaryRank() > 0) // there is more than 1 rank available -> distribute + if(ggs.getMaxMilitaryRank() > 0) // there is more than 1 rank available -> distribute DistributeMaxRankSoldiersByBlocking(5, wh); // 30 boards amd 50 stones for each warehouse - block after that - should speed up expansion and limit losses in // case a warehouse is destroyed unlimited when every warehouse has at least that amount @@ -347,7 +347,7 @@ void AIPlayerJH::PlanNewBuildings(const unsigned gf) DistributeGoodsByBlocking(GoodType::Stones, 50); // go to the picked random warehouse and try to build around it const auto* storehouse = AI::randomElement(storehouses); - const MapPoint whPos = storehouse->GetPos(); + const MapPoint whPos = storehouse->getPos(); UpdateNodesAround(whPos, 15); // update the area we want to build in first for(const BuildingType i : bldToTest) { @@ -356,17 +356,17 @@ void AIPlayerJH::PlanNewBuildings(const unsigned gf) AddBuildJobAroundEveryWarehouse(i); // add a buildorder for the picked buildingtype at every warehouse } } - if(gf > 1500 || aii.GetInventory().goods[GoodType::Boards] > 11) + if(gf > 1500 || aii.getInventory().goods[GoodType::Boards] > 11) AddMilitaryBuildJob(whPos); } // end of construction around & orders for warehouses // now pick a random military building and try to build around that as well - const std::list& militaryBuildings = aii.GetMilitaryBuildings(); + const std::list& militaryBuildings = aii.getMilitaryBuildings(); if(militaryBuildings.empty()) return; const auto* randomMiliBld = AI::randomElement(militaryBuildings); - MapPoint bldPos = randomMiliBld->GetPos(); + MapPoint bldPos = randomMiliBld->getPos(); UpdateNodesAround(bldPos, 15); // resource gathering buildings only around military; processing only close to warehouses for(unsigned i = 0; i < numResGatherBlds; i++) @@ -377,7 +377,7 @@ void AIPlayerJH::PlanNewBuildings(const unsigned gf) } } AddMilitaryBuildJob(bldPos); - if(randomMiliBld->IsUseless() && randomMiliBld->IsDemolitionAllowed() && randomMiliBld != UpdateUpgradeBuilding()) + if(randomMiliBld->isUseless() && randomMiliBld->isDemolitionAllowed() && randomMiliBld != UpdateUpgradeBuilding()) { aii.DestroyBuilding(bldPos); } @@ -385,7 +385,7 @@ void AIPlayerJH::PlanNewBuildings(const unsigned gf) bool AIPlayerJH::TestDefeat() { - if(isInitGfCompleted >= 10 && aii.GetStorehouses().empty()) + if(isInitGfCompleted >= 10 && aii.getStorehouses().empty()) { // LOG.write(("ai defeated player %i \n",playerId); defeated = true; @@ -396,16 +396,16 @@ bool AIPlayerJH::TestDefeat() return false; } -unsigned AIPlayerJH::GetNumJobs() const +unsigned AIPlayerJH::getNumJobs() const { - return eventManager.GetEventNum() + construction->GetBuildJobNum() + construction->GetConnectJobNum(); + return eventManager.getEventNum() + construction->getBuildJobNum() + construction->getConnectJobNum(); } /// returns the warehouse closest to the upgrade building or if it cant find a way the first warehouse and if there is /// no warehouse left null -nobBaseWarehouse* AIPlayerJH::GetUpgradeBuildingWarehouse() +nobBaseWarehouse* AIPlayerJH::getUpgradeBuildingWarehouse() { - const std::list& storehouses = aii.GetStorehouses(); + const std::list& storehouses = aii.getStorehouses(); if(storehouses.empty()) return nullptr; const auto* upgradeBld = UpdateUpgradeBuilding(); @@ -436,69 +436,69 @@ void AIPlayerJH::AddBuildJob(BuildingType type, const MapPoint pt, bool front, b void AIPlayerJH::AddBuildJobAroundEveryWarehouse(BuildingType bt) { - for(const nobBaseWarehouse* wh : aii.GetStorehouses()) + for(const nobBaseWarehouse* wh : aii.getStorehouses()) { - AddBuildJob(bt, wh->GetPos(), false); + AddBuildJob(bt, wh->getPos(), false); } } void AIPlayerJH::AddBuildJobAroundEveryMilBld(BuildingType bt) { - for(const nobMilitary* milBld : aii.GetMilitaryBuildings()) + for(const nobMilitary* milBld : aii.getMilitaryBuildings()) { - AddBuildJob(bt, milBld->GetPos(), false); + AddBuildJob(bt, milBld->getPos(), false); } } -void AIPlayerJH::SetGatheringForUpgradeWarehouse(nobBaseWarehouse* upgradewarehouse) +void AIPlayerJH::setGatheringForUpgradeWarehouse(nobBaseWarehouse* upgradewarehouse) { - for(const nobBaseWarehouse* wh : aii.GetStorehouses()) + for(const nobBaseWarehouse* wh : aii.getStorehouses()) { // deactivate gathering for all warehouses that are NOT the one next to the upgradebuilding - const MapPoint whPos = wh->GetPos(); - if(upgradewarehouse->GetPos() != whPos) + const MapPoint whPos = wh->getPos(); + if(upgradewarehouse->getPos() != whPos) { - if(wh->IsInventorySetting(GoodType::Beer, EInventorySetting::Collect)) // collecting beer? -> stop it + if(wh->isInventorySetting(GoodType::Beer, EInventorySetting::Collect)) // collecting beer? -> stop it aii.SetInventorySetting(whPos, GoodType::Beer, InventorySetting()); - if(wh->IsInventorySetting(GoodType::Sword, EInventorySetting::Collect)) // collecting swords? -> stop it + if(wh->isInventorySetting(GoodType::Sword, EInventorySetting::Collect)) // collecting swords? -> stop it aii.SetInventorySetting(whPos, GoodType::Sword, InventorySetting()); - if(wh->IsInventorySetting(GoodType::ShieldRomans, + if(wh->isInventorySetting(GoodType::ShieldRomans, EInventorySetting::Collect)) // collecting shields? -> stop it aii.SetInventorySetting(whPos, GoodType::ShieldRomans, InventorySetting()); - if(wh->IsInventorySetting(Job::Private, EInventorySetting::Collect)) // collecting privates? -> stop it + if(wh->isInventorySetting(Job::Private, EInventorySetting::Collect)) // collecting privates? -> stop it aii.SetInventorySetting(whPos, Job::Private, InventorySetting()); - if(wh->IsInventorySetting(Job::Helper, EInventorySetting::Collect)) // collecting helpers? -> stop it + if(wh->isInventorySetting(Job::Helper, EInventorySetting::Collect)) // collecting helpers? -> stop it aii.SetInventorySetting(whPos, Job::Helper, InventorySetting()); } else // activate gathering in the closest warehouse { - if(!wh->IsInventorySetting(GoodType::Beer, EInventorySetting::Collect)) // not collecting beer? -> start it + if(!wh->isInventorySetting(GoodType::Beer, EInventorySetting::Collect)) // not collecting beer? -> start it aii.SetInventorySetting(whPos, GoodType::Beer, EInventorySetting::Collect); - if(!wh->IsInventorySetting(GoodType::Sword, + if(!wh->isInventorySetting(GoodType::Sword, EInventorySetting::Collect)) // not collecting swords? -> start it aii.SetInventorySetting(whPos, GoodType::Sword, EInventorySetting::Collect); - if(!wh->IsInventorySetting(GoodType::ShieldRomans, + if(!wh->isInventorySetting(GoodType::ShieldRomans, EInventorySetting::Collect)) // not collecting shields? -> start it aii.SetInventorySetting(whPos, GoodType::ShieldRomans, EInventorySetting::Collect); - if(!wh->IsInventorySetting(Job::Private, EInventorySetting::Collect) - && ggs.GetMaxMilitaryRank() + if(!wh->isInventorySetting(Job::Private, EInventorySetting::Collect) + && ggs.getMaxMilitaryRank() > 0) // not collecting privates AND we can actually upgrade soldiers? -> start it aii.SetInventorySetting(whPos, Job::Private, EInventorySetting::Collect); // less than 50 helpers - collect them: more than 50 stop collecting - if(wh->GetInventory().people[Job::Helper] < 50) + if(wh->getInventory().people[Job::Helper] < 50) { - if(!wh->IsInventorySetting(Job::Helper, EInventorySetting::Collect)) + if(!wh->isInventorySetting(Job::Helper, EInventorySetting::Collect)) aii.SetInventorySetting(whPos, Job::Helper, EInventorySetting::Collect); } else { - if(wh->IsInventorySetting(Job::Helper, EInventorySetting::Collect)) + if(wh->isInventorySetting(Job::Helper, EInventorySetting::Collect)) aii.SetInventorySetting(whPos, Job::Helper, InventorySetting()); } } @@ -507,8 +507,8 @@ void AIPlayerJH::SetGatheringForUpgradeWarehouse(nobBaseWarehouse* upgradewareho AINodeResource AIPlayerJH::CalcResource(MapPoint pt) { - const AISubSurfaceResource subRes = aii.GetSubsurfaceResource(pt); - const AISurfaceResource surfRes = aii.GetSurfaceResource(pt); + const AISubSurfaceResource subRes = aii.getSubsurfaceResource(pt); + const AISurfaceResource surfRes = aii.getSurfaceResource(pt); // no resources underground if(subRes == AISubSurfaceResource::Nothing) @@ -517,10 +517,10 @@ AINodeResource AIPlayerJH::CalcResource(MapPoint pt) if(surfRes == AISurfaceResource::Nothing) { // already road, really no resources here - if(gwb.IsOnRoad(pt)) + if(gwb.isOnRoad(pt)) return AINodeResource::Nothing; // check for vital plant space - if(!gwb.IsOfTerrain(pt, [](const TerrainDesc& desc) { return desc.IsVital(); })) + if(!gwb.isOfTerrain(pt, [](const TerrainDesc& desc) { return desc.isVital(); })) return AINodeResource::Nothing; return AINodeResource::Plantspace; } else @@ -543,13 +543,13 @@ void AIPlayerJH::InitReachableNodes() std::queue toCheck; // Alle auf not reachable setzen - RTTR_FOREACH_PT(MapPoint, aiMap.GetSize()) + RTTR_FOREACH_PT(MapPoint, aiMap.getSize()) { Node& node = aiMap[pt]; node.reachable = false; node.failed_penalty = 0; - const auto* myFlag = gwb.GetSpecObj(pt); - if(myFlag && myFlag->GetPlayer() == playerId) + const auto* myFlag = gwb.getSpecObj(pt); + if(myFlag && myFlag->getPlayer() == playerId) { node.reachable = true; toCheck.push(pt); @@ -570,7 +570,7 @@ void AIPlayerJH::IterativeReachableNodeChecker(std::queue toCheck) MapPoint curPt = toCheck.front(); // Coordinates to test around this reachable coordinate - for(const MapPoint curNeighbour : aiMap.GetNeighbours(curPt)) + for(const MapPoint curNeighbour : aiMap.getNeighbours(curPt)) { Node& node = aiMap[curNeighbour]; @@ -579,7 +579,7 @@ void AIPlayerJH::IterativeReachableNodeChecker(std::queue toCheck) continue; // Test whether point is reachable; yes->add to check list - if(roadPathChecker.IsNodeOk(curNeighbour)) + if(roadPathChecker.isNodeOk(curNeighbour)) { if(node.failed_penalty == 0) { @@ -601,8 +601,8 @@ void AIPlayerJH::UpdateReachableNodes(const std::vector& pts) for(const MapPoint& curPt : pts) { - const auto* flag = gwb.GetSpecObj(curPt); - if(flag && flag->GetPlayer() == playerId) + const auto* flag = gwb.getSpecObj(curPt); + if(flag && flag->getPlayer() == playerId) { aiMap[curPt].reachable = true; toCheck.push(curPt); @@ -614,33 +614,33 @@ void AIPlayerJH::UpdateReachableNodes(const std::vector& pts) void AIPlayerJH::InitNodes() { - aiMap.Resize(gwb.GetSize()); + aiMap.Resize(gwb.getSize()); InitReachableNodes(); - RTTR_FOREACH_PT(MapPoint, aiMap.GetSize()) + RTTR_FOREACH_PT(MapPoint, aiMap.getSize()) { Node& node = aiMap[pt]; - node.bq = aii.GetBuildingQuality(pt); + node.bq = aii.getBuildingQuality(pt); node.res = CalcResource(pt); - node.owned = aii.IsOwnTerritory(pt); - node.border = aii.IsBorder(pt); + node.owned = aii.isOwnTerritory(pt); + node.border = aii.isBorder(pt); node.farmed = false; } } void AIPlayerJH::UpdateNodesAround(const MapPoint pt, unsigned radius) { - std::vector pts = gwb.GetPointsInRadius(pt, radius); + std::vector pts = gwb.getPointsInRadius(pt, radius); UpdateReachableNodes(pts); for(const MapPoint& pt : pts) { Node& node = aiMap[pt]; // Change of ownership might change bq - node.bq = aii.GetBuildingQuality(pt); - node.owned = aii.IsOwnTerritory(pt); - node.border = aii.IsBorder(pt); + node.bq = aii.getBuildingQuality(pt); + node.owned = aii.isOwnTerritory(pt); + node.border = aii.isBorder(pt); } } @@ -650,13 +650,13 @@ void AIPlayerJH::InitResourceMaps() resMap.init(); } -void AIPlayerJH::SetFarmedNodes(const MapPoint pt, bool set) +void AIPlayerJH::setFarmedNodes(const MapPoint pt, bool set) { // Radius in dem Bauplatz für Felder blockiert wird const unsigned radius = 3; aiMap[pt].farmed = set; - std::vector pts = gwb.GetPointsInRadius(pt, radius); + std::vector pts = gwb.getPointsInRadius(pt, radius); for(const MapPoint& curPt : pts) aiMap[curPt].farmed = set; } @@ -696,12 +696,12 @@ void AIPlayerJH::ExecuteAIJob() && quota) // handle all new events - some will add new orders but they can all be handled instantly { quota--; - currentJob = std::make_unique(*this, eventManager.GetEvent()); + currentJob = std::make_unique(*this, eventManager.getEvent()); currentJob->ExecuteJob(); } // how many construction & connect jobs the ai will attempt every gf, the ai gets new orders from events and every // 200 gf - quota = (aii.GetStorehouses().size() + aii.GetMilitaryBuildings().size()) * 1; + quota = (aii.getStorehouses().size() + aii.getMilitaryBuildings().size()) * 1; if(quota > 40) quota = 40; @@ -723,16 +723,16 @@ void AIPlayerJH::ExecuteAIJob() void AIPlayerJH::DistributeGoodsByBlocking(const GoodType good, unsigned limit) { - const std::list& storehouses = aii.GetStorehouses(); - if(aii.GetHarbors().size() >= storehouses.size() / 2) + const std::list& storehouses = aii.getStorehouses(); + if(aii.getHarbors().size() >= storehouses.size() / 2) { // dont distribute on maps that are mostly sea maps - harbors are too difficult to defend and have to handle // quite a lot of traffic already So unblock everywhere for(nobBaseWarehouse* wh : storehouses) { - if(wh->IsInventorySetting(good, EInventorySetting::Stop)) // not unblocked then issue command to unblock - aii.SetInventorySetting(wh->GetPos(), good, - wh->GetInventorySetting(good).Toggle(EInventorySetting::Stop)); + if(wh->isInventorySetting(good, EInventorySetting::Stop)) // not unblocked then issue command to unblock + aii.SetInventorySetting(wh->getPos(), good, + wh->getInventorySetting(good).Toggle(EInventorySetting::Stop)); } return; } @@ -765,7 +765,7 @@ void AIPlayerJH::DistributeGoodsByBlocking(const GoodType good, unsigned limit) bool allWHsHaveLimit = true; for(const nobBaseWarehouse* wh : whGroup) { - if(wh->GetNumVisualWares(good) <= limit) + if(wh->getNumVisualWares(good) <= limit) { allWHsHaveLimit = false; break; @@ -776,27 +776,27 @@ void AIPlayerJH::DistributeGoodsByBlocking(const GoodType good, unsigned limit) // So unblock everywhere for(const nobBaseWarehouse* wh : whGroup) { - if(wh->IsInventorySetting(good, EInventorySetting::Stop)) // not unblocked then issue command to unblock - aii.SetInventorySetting(wh->GetPos(), good, - wh->GetInventorySetting(good).Toggle(EInventorySetting::Stop)); + if(wh->isInventorySetting(good, EInventorySetting::Stop)) // not unblocked then issue command to unblock + aii.SetInventorySetting(wh->getPos(), good, + wh->getInventorySetting(good).Toggle(EInventorySetting::Stop)); } } else { // At least 1 WH needs wares for(const nobBaseWarehouse* wh : whGroup) { - if(wh->GetNumVisualWares(good) <= limit) // not at limit - unblock it + if(wh->getNumVisualWares(good) <= limit) // not at limit - unblock it { - if(wh->IsInventorySetting(good, + if(wh->isInventorySetting(good, EInventorySetting::Stop)) // not unblocked then issue command to unblock - aii.SetInventorySetting(wh->GetPos(), good, - wh->GetInventorySetting(good).Toggle(EInventorySetting::Stop)); + aii.SetInventorySetting(wh->getPos(), good, + wh->getInventorySetting(good).Toggle(EInventorySetting::Stop)); } else // at limit - block it { - if(!wh->IsInventorySetting(good, + if(!wh->isInventorySetting(good, EInventorySetting::Stop)) // not blocked then issue command to block - aii.SetInventorySetting(wh->GetPos(), good, - wh->GetInventorySetting(good).Toggle(EInventorySetting::Stop)); + aii.SetInventorySetting(wh->getPos(), good, + wh->getInventorySetting(good).Toggle(EInventorySetting::Stop)); } } } @@ -805,27 +805,27 @@ void AIPlayerJH::DistributeGoodsByBlocking(const GoodType good, unsigned limit) void AIPlayerJH::DistributeMaxRankSoldiersByBlocking(unsigned limit, nobBaseWarehouse* upwh) { - const std::list& storehouses = aii.GetStorehouses(); + const std::list& storehouses = aii.getStorehouses(); unsigned numCompleteWh = storehouses.size(); if(numCompleteWh < 1) // no warehouses -> no job return; - ::Job maxRankJob = SOLDIER_JOBS[ggs.GetMaxMilitaryRank()]; + ::Job maxRankJob = SOLDIER_JOBS[ggs.getMaxMilitaryRank()]; if(numCompleteWh == 1) // only 1 warehouse? dont block max ranks here { nobBaseWarehouse& wh = *storehouses.front(); - if(wh.IsInventorySetting(maxRankJob, EInventorySetting::Stop)) - aii.SetInventorySetting(wh.GetPos(), maxRankJob, - wh.GetInventorySetting(maxRankJob).Toggle(EInventorySetting::Stop)); + if(wh.isInventorySetting(maxRankJob, EInventorySetting::Stop)) + aii.SetInventorySetting(wh.getPos(), maxRankJob, + wh.getInventorySetting(maxRankJob).Toggle(EInventorySetting::Stop)); return; } // rest applies for at least 2 complete warehouses! std::list frontierMils; // make a list containing frontier military buildings - for(const nobMilitary* wh : aii.GetMilitaryBuildings()) + for(const nobMilitary* wh : aii.getMilitaryBuildings()) { - if(wh->GetFrontierDistance() != FrontierDistance::Far && !wh->IsNewBuilt()) + if(wh->getFrontierDistance() != FrontierDistance::Far && !wh->isNewBuilt()) frontierMils.push_back(wh); } std::list @@ -834,7 +834,7 @@ void AIPlayerJH::DistributeMaxRankSoldiersByBlocking(unsigned limit, nobBaseWare { for(const nobMilitary* milBld : frontierMils) { - if(gwb.CalcDistance(wh->GetPos(), milBld->GetPos()) < 12) + if(gwb.CalcDistance(wh->getPos(), milBld->getPos()) < 12) { frontierWhs.push_back(wh); break; @@ -850,7 +850,7 @@ void AIPlayerJH::DistributeMaxRankSoldiersByBlocking(unsigned limit, nobBaseWare // check if there is at least one with less than limit first for(const nobBaseWarehouse* wh : frontierWhs) { - if(wh->GetInventory().people[maxRankJob] < limit) + if(wh->getInventory().people[maxRankJob] < limit) { hasUnderstaffedWh = true; break; @@ -860,10 +860,10 @@ void AIPlayerJH::DistributeMaxRankSoldiersByBlocking(unsigned limit, nobBaseWare for(const nobBaseWarehouse* wh : storehouses) { const bool shouldBlock = !helpers::contains(frontierWhs, wh) // Not a frontier wh or: - || (hasUnderstaffedWh && wh->GetInventory().people[maxRankJob] >= limit); - if(shouldBlock != wh->IsInventorySetting(maxRankJob, EInventorySetting::Stop)) - aii.SetInventorySetting(wh->GetPos(), maxRankJob, - wh->GetInventorySetting(maxRankJob).Toggle(EInventorySetting::Stop)); + || (hasUnderstaffedWh && wh->getInventory().people[maxRankJob] >= limit); + if(shouldBlock != wh->isInventorySetting(maxRankJob, EInventorySetting::Stop)) + aii.SetInventorySetting(wh->getPos(), maxRankJob, + wh->getInventorySetting(maxRankJob).Toggle(EInventorySetting::Stop)); } } else // there are no frontier whs! { @@ -873,8 +873,8 @@ void AIPlayerJH::DistributeMaxRankSoldiersByBlocking(unsigned limit, nobBaseWare // check if there is at least one with less than limit first for(const nobBaseWarehouse* wh : storehouses) { - if(wh->GetInventory().people[maxRankJob] < limit - && wh->GetPos() != upwh->GetPos()) // warehouse next to upgradebuilding is special case + if(wh->getInventory().people[maxRankJob] < limit + && wh->getPos() != upwh->getPos()) // warehouse next to upgradebuilding is special case { hasUnderstaffedWh = true; break; @@ -883,36 +883,36 @@ void AIPlayerJH::DistributeMaxRankSoldiersByBlocking(unsigned limit, nobBaseWare for(const nobBaseWarehouse* wh : storehouses) { bool shouldBlock; - if(wh->GetPos() - == upwh->GetPos()) // warehouse next to upgradebuilding should block when there is more than 1 wh + if(wh->getPos() + == upwh->getPos()) // warehouse next to upgradebuilding should block when there is more than 1 wh { // LOG.write(("distribute maxranks - got NO frontierwhs for player %i , block at hq \n",playerId); shouldBlock = true; } else if(hasUnderstaffedWh) { - shouldBlock = wh->GetInventory().people[maxRankJob] >= limit; + shouldBlock = wh->getInventory().people[maxRankJob] >= limit; } else // no understaffedwh shouldBlock = false; - if(shouldBlock != wh->IsInventorySetting(maxRankJob, EInventorySetting::Stop)) - aii.SetInventorySetting(wh->GetPos(), maxRankJob, - wh->GetInventorySetting(maxRankJob).Toggle(EInventorySetting::Stop)); + if(shouldBlock != wh->isInventorySetting(maxRankJob, EInventorySetting::Stop)) + aii.SetInventorySetting(wh->getPos(), maxRankJob, + wh->getInventorySetting(maxRankJob).Toggle(EInventorySetting::Stop)); } } } MapPoint AIPlayerJH::SimpleFindPosition(const MapPoint& pt, BuildingQuality size, unsigned radius) const { - std::vector pts = gwb.GetPointsInRadius(pt, radius); + std::vector pts = gwb.getPointsInRadius(pt, radius); for(const MapPoint& curPt : pts) { - if(!aiMap[curPt].reachable || aiMap[curPt].farmed || !aii.IsOwnTerritory(curPt)) + if(!aiMap[curPt].reachable || aiMap[curPt].farmed || !aii.isOwnTerritory(curPt)) continue; if(aii.isHarborPosClose(curPt, 2, true)) { if(size != BuildingQuality::Harbor) continue; } - RTTR_Assert(aii.GetBuildingQuality(curPt) == GetAINode(curPt).bq); - if(canUseBq(aii.GetBuildingQuality(curPt), size)) //(*nodes)[idx].bq; TODO: Update nodes BQ and use that + RTTR_Assert(aii.getBuildingQuality(curPt) == getAINode(curPt).bq); + if(canUseBq(aii.getBuildingQuality(curPt), size)) //(*nodes)[idx].bq; TODO: Update nodes BQ and use that return curPt; } @@ -933,19 +933,19 @@ MapPoint AIPlayerJH::FindPositionForBuildingAround(BuildingType type, const MapP case BuildingType::Forester: // ensure some distance to other foresters and an minimal amount of plantspace if(!construction->OtherUsualBuildingInRadius(around, 12, BuildingType::Forester) - && GetDensity(around, AIResource::Plantspace, 7) > 15) + && getDensity(around, AIResource::Plantspace, 7) > 15) foundPos = FindBestPosition(around, AIResource::Wood, BUILDING_SIZE[type], searchRadius, 0); break; case BuildingType::Hunter: { // check if there are any animals in range - if(HuntablesInRange(around, (2 << GetBldPlanner().GetNumBuildings(BuildingType::Hunter)))) + if(HuntablesInRange(around, (2 << getBldPlanner().getNumBuildings(BuildingType::Hunter)))) foundPos = SimpleFindPosition(around, BUILDING_SIZE[type], searchRadius); break; } case BuildingType::Quarry: { - unsigned numQuarries = GetBldPlanner().GetNumBuildings(BuildingType::Quarry); + unsigned numQuarries = getBldPlanner().getNumBuildings(BuildingType::Quarry); foundPos = FindBestPosition(around, AIResource::Stones, BUILDING_SIZE[type], searchRadius, std::min(40u, 1 + numQuarries * 10)); if(foundPos.isValid() && !ValidStoneinRange(foundPos)) @@ -988,12 +988,12 @@ MapPoint AIPlayerJH::FindPositionForBuildingAround(BuildingType type, const MapP case BuildingType::HarborBuilding: foundPos = SimpleFindPosition(around, BUILDING_SIZE[type], searchRadius); if(foundPos.isValid() - && !HarborPosRelevant(GetWorld().GetHarborPointID(foundPos))) // bad harborspot detected DO NOT USE + && !HarborPosRelevant(getWorld().getHarborPointID(foundPos))) // bad harborspot detected DO NOT USE foundPos = MapPoint::Invalid(); break; case BuildingType::Shipyard: foundPos = SimpleFindPosition(around, BUILDING_SIZE[type], searchRadius); - if(foundPos.isValid() && IsInvalidShipyardPosition(foundPos)) + if(foundPos.isValid() && isInvalidShipyardPosition(foundPos)) foundPos = MapPoint::Invalid(); break; case BuildingType::Farm: @@ -1011,11 +1011,11 @@ MapPoint AIPlayerJH::FindPositionForBuildingAround(BuildingType type, const MapP return foundPos; } -unsigned AIPlayerJH::GetDensity(MapPoint pt, AIResource res, int radius) +unsigned AIPlayerJH::getDensity(MapPoint pt, AIResource res, int radius) { - RTTR_Assert(pt.x < aiMap.GetWidth() && pt.y < aiMap.GetHeight()); + RTTR_Assert(pt.x < aiMap.getWidth() && pt.y < aiMap.getHeight()); - std::vector pts = gwb.GetPointsInRadius(pt, radius); + std::vector pts = gwb.getPointsInRadius(pt, radius); const unsigned numAllPTs = pts.size(); RTTR_Assert(numAllPTs > 0); @@ -1033,23 +1033,23 @@ void AIPlayerJH::HandleNewMilitaryBuildingOccupied(const MapPoint pt) // kill bad flags we find RemoveAllUnusedRoads(pt); bldPlanner->UpdateBuildingsWanted(*this); - const auto* mil = gwb.GetSpecObj(pt); + const auto* mil = gwb.getSpecObj(pt); if(!mil) return; // if near border and gold disabled (by addon): enable it - if(mil->GetFrontierDistance() != FrontierDistance::Far) + if(mil->getFrontierDistance() != FrontierDistance::Far) { - if(mil->IsGoldDisabled()) + if(mil->isGoldDisabled()) aii.SetCoinsAllowed(pt, true); - } else if((mil->GetBuildingType() == BuildingType::Barracks || mil->GetBuildingType() == BuildingType::Guardhouse) - && mil->GetBuildingType() != construction->GetBiggestAllowedMilBuilding()) + } else if((mil->getBuildingType() == BuildingType::Barracks || mil->getBuildingType() == BuildingType::Guardhouse) + && mil->getBuildingType() != construction->getBiggestAllowedMilBuilding()) { - if(!mil->IsGoldDisabled()) + if(!mil->isGoldDisabled()) aii.SetCoinsAllowed(pt, false); } AddBuildJob(BuildingType::HarborBuilding, pt); - if(!IsInvalidShipyardPosition(pt)) + if(!isInvalidShipyardPosition(pt)) AddBuildJob(BuildingType::Shipyard, pt); if(SoldierAvailable()) AddMilitaryBuildJob(pt); @@ -1062,20 +1062,20 @@ void AIPlayerJH::HandleNewMilitaryBuildingOccupied(const MapPoint pt) BuildingType::Farm, BuildingType::Hunter, BuildingType::Forester}; unsigned bldToTestStartIdx = 0; // remove the storehouse from the building test list if we are close to another storehouse already - for(const nobBaseWarehouse* bldSite : aii.GetStorehouses()) + for(const nobBaseWarehouse* bldSite : aii.getStorehouses()) { - if(gwb.CalcDistance(bldSite->GetPos(), pt) < 20) + if(gwb.CalcDistance(bldSite->getPos(), pt) < 20) { bldToTestStartIdx = 1; break; } } // same is true for warehouses which are still in production - for(const noBuildingSite* bldSite : aii.GetBuildingSites()) + for(const noBuildingSite* bldSite : aii.getBuildingSites()) { - if(BuildingProperties::IsWareHouse(bldSite->GetBuildingType())) + if(BuildingProperties::isWareHouse(bldSite->getBuildingType())) { - if(gwb.CalcDistance(bldSite->GetPos(), pt) < 20) + if(gwb.CalcDistance(bldSite->getPos(), pt) < 20) { bldToTestStartIdx = 1; break; @@ -1097,20 +1097,20 @@ void AIPlayerJH::HandleBuilingDestroyed(MapPoint pt, BuildingType bld) switch(bld) { case BuildingType::Charburner: - case BuildingType::Farm: SetFarmedNodes(pt, false); break; + case BuildingType::Farm: setFarmedNodes(pt, false); break; case BuildingType::HarborBuilding: { // destroy all other buildings around the harborspot in range 2 so we can rebuild the harbor ... - for(const MapPoint curPt : gwb.GetPointsInRadius(pt, 2)) + for(const MapPoint curPt : gwb.getPointsInRadius(pt, 2)) { - const auto* const bb = gwb.GetSpecObj(curPt); + const auto* const bb = gwb.getSpecObj(curPt); if(bb) aii.DestroyBuilding(curPt); else { - const auto* const bs = gwb.GetSpecObj(curPt); + const auto* const bs = gwb.getSpecObj(curPt); if(bs) - aii.DestroyFlag(gwb.GetNeighbour(curPt, Direction::SouthEast)); + aii.DestroyFlag(gwb.getNeighbour(curPt, Direction::SouthEast)); } } break; @@ -1122,37 +1122,37 @@ void AIPlayerJH::HandleBuilingDestroyed(MapPoint pt, BuildingType bld) void AIPlayerJH::HandleRoadConstructionComplete(MapPoint pt, Direction dir) { // todo: detect "bad" roads and handle them - const auto* flag = gwb.GetSpecObj(pt); + const auto* flag = gwb.getSpecObj(pt); // does the flag still exist? if(!flag) return; // does the roadsegment still exist? - const RoadSegment* const roadSeg = flag->GetRoute(dir); + const RoadSegment* const roadSeg = flag->getRoute(dir); if(!roadSeg || roadSeg->GetLength() < 4) // road too short to need flags return; // check if this road leads to a warehouseflag and if it does start setting flags from the warehouseflag else from // the new flag goal is to move roadsegments with a length of more than 2 away from the warehouse - const noFlag& otherFlag = roadSeg->GetOtherFlag(*flag); - MapPoint bldPos = gwb.GetNeighbour(otherFlag.GetPos(), Direction::NorthWest); - if(aii.IsBuildingOnNode(bldPos, BuildingType::Storehouse) - || aii.IsBuildingOnNode(bldPos, BuildingType::HarborBuilding) - || aii.IsBuildingOnNode(bldPos, BuildingType::Headquarters)) - construction->SetFlagsAlongRoad(otherFlag, roadSeg->GetOtherFlagDir(*flag) + 3u); + const noFlag& otherFlag = roadSeg->getOtherFlag(*flag); + MapPoint bldPos = gwb.getNeighbour(otherFlag.getPos(), Direction::NorthWest); + if(aii.isBuildingOnNode(bldPos, BuildingType::Storehouse) + || aii.isBuildingOnNode(bldPos, BuildingType::HarborBuilding) + || aii.isBuildingOnNode(bldPos, BuildingType::Headquarters)) + construction->setFlagsAlongRoad(otherFlag, roadSeg->getOtherFlagDir(*flag) + 3u); else { // set flags on our new road starting from the new flag - construction->SetFlagsAlongRoad(*flag, dir); + construction->setFlagsAlongRoad(*flag, dir); } } void AIPlayerJH::HandleRoadConstructionFailed(const MapPoint pt, Direction) { - const auto* flag = gwb.GetSpecObj(pt); + const auto* flag = gwb.getSpecObj(pt); // does the flag still exist? if(!flag) return; // is it our flag? - if(flag->GetPlayer() != playerId) + if(flag->getPlayer() != playerId) return; // if it isnt a useless flag AND it has no current road connection then retry to build a road. if(RemoveUnusedRoad(*flag, std::nullopt, true, false)) @@ -1176,7 +1176,7 @@ void AIPlayerJH::HandleBuildingFinished(const MapPoint pt, BuildingType bld) aii.ChangeReserve(pt, 0, 1); // order 1 defender to stay in the harborbuilding // if there are positions free start an expedition! - if(HarborPosRelevant(gwb.GetHarborPointID(pt), true)) + if(HarborPosRelevant(gwb.getHarborPointID(pt), true)) { aii.StartStopExpedition(pt, true); } @@ -1192,20 +1192,20 @@ void AIPlayerJH::HandleBuildingFinished(const MapPoint pt, BuildingType bld) void AIPlayerJH::HandleNewColonyFounded(const MapPoint pt) { - construction->AddConnectFlagJob(gwb.GetSpecObj(gwb.GetNeighbour(pt, Direction::SouthEast))); + construction->AddConnectFlagJob(gwb.getSpecObj(gwb.getNeighbour(pt, Direction::SouthEast))); } void AIPlayerJH::HandleExpedition(const noShip& ship) { - if(!ship.IsWaitingForExpeditionInstructions()) + if(!ship.isWaitingForExpeditionInstructions()) return; - if(ship.IsAbleToFoundColony()) + if(ship.isAbleToFoundColony()) aii.FoundColony(ship); else { for(auto dir : helpers::enumRange(AI::randomEnum())) { - if(aii.IsExplorationDirectionPossible(ship.GetPos(), ship.GetCurrentHarbor(), dir)) + if(aii.isExplorationDirectionPossible(ship.getPos(), ship.getCurrentHarbor(), dir)) { aii.TravelToNextSpot(dir, ship); return; @@ -1220,12 +1220,12 @@ void AIPlayerJH::HandleExpedition(const MapPoint pt) { const noShip* ship = nullptr; - for(const noBase& obj : gwb.GetFigures(pt)) + for(const noBase& obj : gwb.getFigures(pt)) { - if(obj.GetGOT() == GO_Type::Ship) + if(obj.getGOT() == GO_Type::Ship) { const auto& curShip = static_cast(obj); - if(curShip.GetPlayerId() == playerId && curShip.IsWaitingForExpeditionInstructions()) + if(curShip.getPlayerId() == playerId && curShip.isWaitingForExpeditionInstructions()) { ship = &curShip; break; @@ -1256,31 +1256,31 @@ void AIPlayerJH::HandleNoMoreResourcesReachable(const MapPoint pt, BuildingType { // Destroy old building (once) - if(!aii.IsObjectTypeOnNode(pt, NodalObjectType::Building)) + if(!aii.isObjectTypeOnNode(pt, NodalObjectType::Building)) return; // keep 2 woodcutters for each forester even if they sometimes run out of trees if(bld == BuildingType::Woodcutter) { - for(const nobUsual* forester : aii.GetBuildings(BuildingType::Forester)) + for(const nobUsual* forester : aii.getBuildings(BuildingType::Forester)) { // is the forester somewhat close? - if(gwb.CalcDistance(pt, forester->GetPos()) <= RES_RADIUS[AIResource::Wood]) + if(gwb.CalcDistance(pt, forester->getPos()) <= RES_RADIUS[AIResource::Wood]) { // then find it's 2 woodcutters - unsigned maxdist = gwb.CalcDistance(pt, forester->GetPos()); + unsigned maxdist = gwb.CalcDistance(pt, forester->getPos()); int betterwoodcutters = 0; - for(const nobUsual* woodcutter : aii.GetBuildings(BuildingType::Woodcutter)) + for(const nobUsual* woodcutter : aii.getBuildings(BuildingType::Woodcutter)) { // dont count the woodcutter in question - if(pt == woodcutter->GetPos()) + if(pt == woodcutter->getPos()) continue; // TODO: We currently don't take the distance to the forester into account when placing a woodcutter // This leads to points beeing equally good for placing but later it will be destroyed. Avoid that // by checking only close woddcutters - if(gwb.CalcDistance(woodcutter->GetPos(), pt) > RES_RADIUS[AIResource::Wood]) + if(gwb.CalcDistance(woodcutter->getPos(), pt) > RES_RADIUS[AIResource::Wood]) continue; // closer or equally close to forester than woodcutter in question? - if(gwb.CalcDistance(woodcutter->GetPos(), forester->GetPos()) <= maxdist) + if(gwb.CalcDistance(woodcutter->getPos(), forester->getPos()) <= maxdist) { betterwoodcutters++; if(betterwoodcutters >= 2) @@ -1300,7 +1300,7 @@ void AIPlayerJH::HandleNoMoreResourcesReachable(const MapPoint pt, BuildingType resourceMaps[AIResource::Fish].avoidPosition(pt); UpdateNodesAround(pt, 11); // todo: fix radius - RemoveUnusedRoad(*gwb.GetSpecObj(gwb.GetNeighbour(pt, Direction::SouthEast)), Direction::NorthWest, true); + RemoveUnusedRoad(*gwb.getSpecObj(gwb.getNeighbour(pt, Direction::SouthEast)), Direction::NorthWest, true); // try to expand, maybe res blocked a passage AddMilitaryBuildJob(pt); @@ -1316,17 +1316,17 @@ void AIPlayerJH::HandleNoMoreResourcesReachable(const MapPoint pt, BuildingType void AIPlayerJH::HandleShipBuilt(const MapPoint pt) { // Stop building ships if reached a maximum (TODO: make variable) - const std::list& shipyards = aii.GetBuildings(BuildingType::Shipyard); + const std::list& shipyards = aii.getBuildings(BuildingType::Shipyard); bool wantMoreShips; - unsigned numRelevantSeas = GetNumAIRelevantSeaIds(); + unsigned numRelevantSeas = getNumAIRelevantSeaIds(); if(numRelevantSeas == 0) wantMoreShips = false; else if(numRelevantSeas == 1) - wantMoreShips = aii.GetNumShips() <= gwb.GetNumHarborPoints(); + wantMoreShips = aii.getNumShips() <= gwb.getNumHarborPoints(); else { unsigned wantedShipCt = std::min(7, 3 * shipyards.size()); - wantMoreShips = aii.GetNumShips() < wantedShipCt; + wantMoreShips = aii.getNumShips() < wantedShipCt; } if(!wantMoreShips) { @@ -1335,7 +1335,7 @@ void AIPlayerJH::HandleShipBuilt(const MapPoint pt) const nobUsual* creatingShipyard = nullptr; for(const nobUsual* shipyard : shipyards) { - unsigned distance = gwb.CalcDistance(shipyard->GetPos(), pt); + unsigned distance = gwb.CalcDistance(shipyard->getPos(), pt); if(distance < mindist) { mindist = distance; @@ -1343,7 +1343,7 @@ void AIPlayerJH::HandleShipBuilt(const MapPoint pt) } } if(creatingShipyard) // might have been destroyed by now - aii.SetProductionEnabled(creatingShipyard->GetPos(), false); + aii.SetProductionEnabled(creatingShipyard->getPos(), false); } } @@ -1351,22 +1351,22 @@ void AIPlayerJH::HandleBorderChanged(const MapPoint pt) { UpdateNodesAround(pt, 11); // todo: fix radius - const auto* mil = gwb.GetSpecObj(pt); + const auto* mil = gwb.getSpecObj(pt); if(mil) { - if(mil->GetFrontierDistance() != FrontierDistance::Far) + if(mil->getFrontierDistance() != FrontierDistance::Far) { - if(mil->IsGoldDisabled()) + if(mil->isGoldDisabled()) aii.SetCoinsAllowed(pt, true); // Fill up with soldiers for(unsigned rank = 0; rank < NUM_SOLDIER_RANKS; ++rank) { - if(mil->GetTroopLimit(rank) != mil->GetMaxTroopsCt()) - aii.SetTroopLimit(mil->GetPos(), rank, mil->GetMaxTroopsCt()); + if(mil->getTroopLimit(rank) != mil->getMaxTroopsCt()) + aii.SetTroopLimit(mil->getPos(), rank, mil->getMaxTroopsCt()); } } - if(mil->GetBuildingType() != construction->GetBiggestAllowedMilBuilding()) + if(mil->getBuildingType() != construction->getBiggestAllowedMilBuilding()) { AddMilitaryBuildJob(pt); } @@ -1375,7 +1375,7 @@ void AIPlayerJH::HandleBorderChanged(const MapPoint pt) void AIPlayerJH::HandleLostLand(const MapPoint pt) { - if(aii.GetStorehouses() + if(aii.getStorehouses() .empty()) // check if we have a storehouse left - if we dont have one trying to find a path to one will crash { return; @@ -1386,67 +1386,67 @@ void AIPlayerJH::HandleLostLand(const MapPoint pt) void AIPlayerJH::MilUpgradeOptim() { const auto* upgradeBld = UpdateUpgradeBuilding(); - const std::list& militaryBuildings = aii.GetMilitaryBuildings(); - const auto numPlannedConnectedInlandMilitaryBlds = GetNumPlannedConnectedInlandMilitaryBlds(); + const std::list& militaryBuildings = aii.getMilitaryBuildings(); + const auto numPlannedConnectedInlandMilitaryBlds = getNumPlannedConnectedInlandMilitaryBlds(); unsigned count = 0; for(const nobMilitary* milBld : militaryBuildings) { if(!upgradeBld) { - if(milBld->IsGoldDisabled() && milBld->GetFrontierDistance() != FrontierDistance::Far) - aii.SetCoinsAllowed(milBld->GetPos(), true); + if(milBld->isGoldDisabled() && milBld->getFrontierDistance() != FrontierDistance::Far) + aii.SetCoinsAllowed(milBld->getPos(), true); } else if(milBld != upgradeBld) // not upgrade building { - if(!milBld->IsGoldDisabled()) // deactivate gold for all other buildings - aii.SetCoinsAllowed(milBld->GetPos(), false); + if(!milBld->isGoldDisabled()) // deactivate gold for all other buildings + aii.SetCoinsAllowed(milBld->getPos(), false); // For dedicated inland buildings send out troops until 1 private is left, then cancel road // Connect frontier buildings to road system. - if(milBld->GetFrontierDistance() != FrontierDistance::Far) - construction->AddConnectFlagJob(milBld->GetFlag()); + if(milBld->getFrontierDistance() != FrontierDistance::Far) + construction->AddConnectFlagJob(milBld->getFlag()); else if(count + numPlannedConnectedInlandMilitaryBlds < militaryBuildings.size()) { - if(milBld->GetNumTroops() > 1) // more than 1 soldier remaining? -> send out order + if(milBld->getNumTroops() > 1) // more than 1 soldier remaining? -> send out order { - aii.SetTroopLimit(milBld->GetPos(), 0, 1); + aii.SetTroopLimit(milBld->getPos(), 0, 1); for(unsigned rank = 1; rank < NUM_SOLDIER_RANKS; ++rank) - aii.SetTroopLimit(milBld->GetPos(), rank, 0); + aii.SetTroopLimit(milBld->getPos(), rank, 0); // TODO: Currently the AI still manages soldiers by disconnecting roads, if in the future it // uses only SetTroopLimit then this can be removed for(unsigned rank = 0; rank < NUM_SOLDIER_RANKS; ++rank) - aii.SetTroopLimit(milBld->GetPos(), rank, milBld->GetMaxTroopsCt()); - } else if(!milBld->IsNewBuilt()) + aii.SetTroopLimit(milBld->getPos(), rank, milBld->getMaxTroopsCt()); + } else if(!milBld->isNewBuilt()) { // 0-1 soldier remains and the building has had at least 1 soldier // at some point and the building is not new on the list // -> cancel road (and fix roadsystem if necessary) - RemoveUnusedRoad(*milBld->GetFlag(), Direction::NorthWest, true, true, true); + RemoveUnusedRoad(*milBld->getFlag(), Direction::NorthWest, true, true, true); } } } else // upgrade building { - if(!construction->IsConnectedToRoadSystem(milBld->GetFlag())) + if(!construction->isConnectedToRoadSystem(milBld->getFlag())) { - construction->AddConnectFlagJob(milBld->GetFlag()); + construction->AddConnectFlagJob(milBld->getFlag()); continue; } - if(milBld->IsGoldDisabled()) // activate gold - aii.SetCoinsAllowed(milBld->GetPos(), true); + if(milBld->isGoldDisabled()) // activate gold + aii.SetCoinsAllowed(milBld->getPos(), true); // Keep 0 max rank soldiers, 1 of each other rank and fill the rest with privates - aii.SetTroopLimit(milBld->GetPos(), 0, milBld->GetMaxTroopsCt()); - for(unsigned rank = 1; rank < ggs.GetMaxMilitaryRank(); ++rank) - aii.SetTroopLimit(milBld->GetPos(), rank, 1); - aii.SetTroopLimit(milBld->GetPos(), ggs.GetMaxMilitaryRank(), 0); + aii.SetTroopLimit(milBld->getPos(), 0, milBld->getMaxTroopsCt()); + for(unsigned rank = 1; rank < ggs.getMaxMilitaryRank(); ++rank) + aii.SetTroopLimit(milBld->getPos(), rank, 1); + aii.SetTroopLimit(milBld->getPos(), ggs.getMaxMilitaryRank(), 0); } count++; } } -bool AIPlayerJH::HasFrontierBuildings() +bool AIPlayerJH::hasFrontierBuildings() { - for(const nobMilitary* milBld : aii.GetMilitaryBuildings()) + for(const nobMilitary* milBld : aii.getMilitaryBuildings()) { - if(milBld->GetFrontierDistance() != FrontierDistance::Far) + if(milBld->getFrontierDistance() != FrontierDistance::Far) return true; } return false; @@ -1454,39 +1454,39 @@ bool AIPlayerJH::HasFrontierBuildings() void AIPlayerJH::CheckExpeditions() { - const std::list& harbors = aii.GetHarbors(); + const std::list& harbors = aii.getHarbors(); for(const nobHarborBuilding* harbor : harbors) { - bool isHarborRelevant = HarborPosRelevant(harbor->GetHarborPosID(), true); - if(harbor->IsExpeditionActive() != isHarborRelevant) // harbor is collecting for expedition and shouldn't + bool isHarborRelevant = HarborPosRelevant(harbor->getHarborPosID(), true); + if(harbor->isExpeditionActive() != isHarborRelevant) // harbor is collecting for expedition and shouldn't // OR not collecting and should -> toggle expedition { - aii.StartStopExpedition(harbor->GetPos(), isHarborRelevant); + aii.StartStopExpedition(harbor->getPos(), isHarborRelevant); } } // find lost expedition ships // AI should get a notice and catch them all but just in case some fell through the system - const std::vector& ships = aii.GetShips(); + const std::vector& ships = aii.getShips(); for(const noShip* ship : ships) { - if(ship->IsWaitingForExpeditionInstructions()) + if(ship->isWaitingForExpeditionInstructions()) HandleExpedition(*ship); } } void AIPlayerJH::CheckForester() { - const std::list& foresters = aii.GetBuildings(BuildingType::Forester); - if(!foresters.empty() && foresters.size() < 2 && aii.GetMilitaryBuildings().size() < 3 - && aii.GetBuildingSites().size() < 3) + const std::list& foresters = aii.getBuildings(BuildingType::Forester); + if(!foresters.empty() && foresters.size() < 2 && aii.getMilitaryBuildings().size() < 3 + && aii.getBuildingSites().size() < 3) // stop the forester { - if(!(*foresters.begin())->IsProductionDisabled()) - aii.SetProductionEnabled(foresters.front()->GetPos(), false); + if(!(*foresters.begin())->isProductionDisabled()) + aii.SetProductionEnabled(foresters.front()->getPos(), false); } else // activate the forester { - if(!foresters.empty() && (*foresters.begin())->IsProductionDisabled()) - aii.SetProductionEnabled(foresters.front()->GetPos(), true); + if(!foresters.empty() && (*foresters.begin())->isProductionDisabled()) + aii.SetProductionEnabled(foresters.front()->getPos(), true); } } @@ -1494,12 +1494,12 @@ void AIPlayerJH::CheckGranitMine() { // stop production in granite mines when the ai has many stones (100+ and at least 15 for each warehouse) bool enableProduction = - AmountInStorage(GoodType::Stones) < 100 || AmountInStorage(GoodType::Stones) < 15 * aii.GetStorehouses().size(); - for(const nobUsual* mine : aii.GetBuildings(BuildingType::GraniteMine)) + AmountInStorage(GoodType::Stones) < 100 || AmountInStorage(GoodType::Stones) < 15 * aii.getStorehouses().size(); + for(const nobUsual* mine : aii.getBuildings(BuildingType::GraniteMine)) { // !productionDisabled != enableProduction - if(mine->IsProductionDisabled() == enableProduction) - aii.SetProductionEnabled(mine->GetPos(), enableProduction); + if(mine->isProductionDisabled() == enableProduction) + aii.SetProductionEnabled(mine->getPos(), enableProduction); } } @@ -1509,7 +1509,7 @@ void AIPlayerJH::TryToAttack() std::vector potentialTargets; // use own military buildings (except inland buildings) to search for enemy military buildings - const std::list& militaryBuildings = aii.GetMilitaryBuildings(); + const std::list& militaryBuildings = aii.getMilitaryBuildings(); const unsigned numMilBlds = militaryBuildings.size(); // when the ai has many buildings the ai will not check the complete list every time constexpr unsigned limit = 40; @@ -1521,24 +1521,24 @@ void AIPlayerJH::TryToAttack() if(!AI::randomChance(numMilBlds, limit)) continue; - if(milBld->GetFrontierDistance() == FrontierDistance::Far) // inland building? -> skip it + if(milBld->getFrontierDistance() == FrontierDistance::Far) // inland building? -> skip it continue; // get nearby enemy buildings and store in set of potential attacking targets - MapPoint src = milBld->GetPos(); + MapPoint src = milBld->getPos(); sortedMilitaryBlds buildings = gwb.LookForMilitaryBuildings(src, 2); for(const nobBaseMilitary* target : buildings) { if(helpers::contains(potentialTargets, target)) continue; - if(target->GetGOT() == GO_Type::NobMilitary && static_cast(target)->IsNewBuilt()) + if(target->getGOT() == GO_Type::NobMilitary && static_cast(target)->isNewBuilt()) continue; - MapPoint dest = target->GetPos(); - if(gwb.CalcDistance(src, dest) < BASE_ATTACKING_DISTANCE && aii.IsPlayerAttackable(target->GetPlayer()) - && aii.IsVisible(dest)) + MapPoint dest = target->getPos(); + if(gwb.CalcDistance(src, dest) < BASE_ATTACKING_DISTANCE && aii.isPlayerAttackable(target->getPlayer()) + && aii.isVisible(dest)) { - if(target->GetGOT() != GO_Type::NobMilitary && !target->DefendersAvailable()) + if(target->getGOT() != GO_Type::NobMilitary && !target->DefendersAvailable()) { // headquarter or harbor without any troops :) hq_or_harbor_without_soldiers++; @@ -1556,7 +1556,7 @@ void AIPlayerJH::TryToAttack() // check for each potential attacking target the number of available attacking soldiers for(const nobBaseMilitary* target : potentialTargets) { - const MapPoint dest = target->GetPos(); + const MapPoint dest = target->getPos(); unsigned attackersCount = 0; unsigned attackersStrength = 0; @@ -1565,14 +1565,14 @@ void AIPlayerJH::TryToAttack() sortedMilitaryBlds myBuildings = gwb.LookForMilitaryBuildings(dest, 2); for(const nobBaseMilitary* otherMilBld : myBuildings) { - if(otherMilBld->GetPlayer() == playerId) + if(otherMilBld->getPlayer() == playerId) { const auto* myMil = dynamic_cast(otherMilBld); - if(!myMil || myMil->IsUnderAttack()) + if(!myMil || myMil->isUnderAttack()) continue; unsigned newAttackers; - attackersStrength += myMil->GetSoldiersStrengthForAttack(dest, newAttackers); + attackersStrength += myMil->getSoldiersStrengthForAttack(dest, newAttackers); attackersCount += newAttackers; } } @@ -1580,10 +1580,10 @@ void AIPlayerJH::TryToAttack() if(attackersCount == 0) continue; - if((level == AI::Level::Hard) && (target->GetGOT() == GO_Type::NobMilitary)) + if((level == AI::Level::Hard) && (target->getGOT() == GO_Type::NobMilitary)) { const auto* enemyTarget = static_cast(target); - if(attackersStrength <= enemyTarget->GetSoldiersStrength() || enemyTarget->GetNumTroops() == 0) + if(attackersStrength <= enemyTarget->getSoldiersStrength() || enemyTarget->getNumTroops() == 0) continue; } @@ -1594,9 +1594,9 @@ void AIPlayerJH::TryToAttack() void AIPlayerJH::TrySeaAttack() { - if(aii.GetNumShips() < 1) + if(aii.getNumShips() < 1) return; - if(aii.GetHarbors().empty()) + if(aii.getHarbors().empty()) return; std::vector seaidswithattackers; std::vector invalidseas; @@ -1604,19 +1604,19 @@ void AIPlayerJH::TrySeaAttack() std::deque undefendedTargets; std::vector searcharoundharborspots; // all seaids with at least 1 ship count available attackers for later checks - for(const noShip* ship : aii.GetShips()) + for(const noShip* ship : aii.getShips()) { // sea id not already listed as valid or invalid? - if(!helpers::contains(seaidswithattackers, ship->GetSeaID()) - && !helpers::contains(invalidseas, ship->GetSeaID())) + if(!helpers::contains(seaidswithattackers, ship->getSeaID()) + && !helpers::contains(invalidseas, ship->getSeaID())) { - unsigned attackercount = gwb.GetNumSoldiersForSeaAttackAtSea(playerId, ship->GetSeaID(), false); + unsigned attackercount = gwb.getNumSoldiersForSeaAttackAtSea(playerId, ship->getSeaID(), false); if(attackercount) // got attackers at this sea id? -> add to valid list { - seaidswithattackers.push_back(ship->GetSeaID()); + seaidswithattackers.push_back(ship->getSeaID()); } else // not listed but no attackers? ->invalid { - invalidseas.push_back(ship->GetSeaID()); + invalidseas.push_back(ship->getSeaID()); } } } @@ -1629,18 +1629,18 @@ void AIPlayerJH::TrySeaAttack() attackersatseaid[i]); }*/ // first check all harbors there might be some undefended ones - for(const auto i : helpers::idRange(gwb.GetNumHarborPoints())) + for(const auto i : helpers::idRange(gwb.getNumHarborPoints())) { const nobHarborBuilding* hb; - if((hb = gwb.GetSpecObj(gwb.GetHarborPoint(i)))) + if((hb = gwb.getSpecObj(gwb.getHarborPoint(i)))) { - if(aii.IsVisible(hb->GetPos())) + if(aii.isVisible(hb->getPos())) { - if(aii.IsPlayerAttackable(hb->GetPlayer())) + if(aii.isPlayerAttackable(hb->getPlayer())) { // attackers for this building? const std::vector testseaidswithattackers = - gwb.GetFilteredSeaIDsForAttack(gwb.GetHarborPoint(i), seaidswithattackers, playerId); + gwb.getFilteredSeaIDsForAttack(gwb.getHarborPoint(i), seaidswithattackers, playerId); if(!testseaidswithattackers.empty()) // harbor can be attacked? { if(!hb->DefendersAvailable()) // no defenders? @@ -1670,10 +1670,10 @@ void AIPlayerJH::TrySeaAttack() for(const nobBaseMilitary* targetMilBld : undefendedTargets) { std::vector attackers = - gwb.GetSoldiersForSeaAttack(playerId, targetMilBld->GetPos()); + gwb.getSoldiersForSeaAttack(playerId, targetMilBld->getPos()); if(!attackers.empty()) // try to attack it! { - aii.SeaAttack(targetMilBld->GetPos(), 1, true); + aii.SeaAttack(targetMilBld->getPos(), 1, true); return; } } @@ -1687,21 +1687,21 @@ void AIPlayerJH::TrySeaAttack() { limit--; // now add all military buildings around the harbor spot to our list of potential targets - sortedMilitaryBlds buildings = gwb.LookForMilitaryBuildings(gwb.GetHarborPoint(searcharoundharborspots[i]), 2); + sortedMilitaryBlds buildings = gwb.LookForMilitaryBuildings(gwb.getHarborPoint(searcharoundharborspots[i]), 2); for(const nobBaseMilitary* milBld : buildings) { - if(aii.IsPlayerAttackable(milBld->GetPlayer()) && aii.IsVisible(milBld->GetPos())) + if(aii.isPlayerAttackable(milBld->getPlayer()) && aii.isVisible(milBld->getPos())) { const auto* enemyTarget = dynamic_cast((milBld)); - if(enemyTarget && enemyTarget->IsNewBuilt()) + if(enemyTarget && enemyTarget->isNewBuilt()) continue; - if((milBld->GetGOT() != GO_Type::NobMilitary) + if((milBld->getGOT() != GO_Type::NobMilitary) && (!milBld->DefendersAvailable())) // undefended headquarter(or unlikely as it is a harbor...) - // priority list! { const std::vector testseaidswithattackers = - gwb.GetFilteredSeaIDsForAttack(milBld->GetPos(), seaidswithattackers, playerId); + gwb.getFilteredSeaIDsForAttack(milBld->getPos(), seaidswithattackers, playerId); if(!testseaidswithattackers.empty()) { undefendedTargets.push_back(milBld); @@ -1723,10 +1723,10 @@ void AIPlayerJH::TrySeaAttack() for(const nobBaseMilitary* targetMilBld : undefendedTargets) { std::vector attackers = - gwb.GetSoldiersForSeaAttack(playerId, targetMilBld->GetPos()); + gwb.getSoldiersForSeaAttack(playerId, targetMilBld->getPos()); if(!attackers.empty()) // try to attack it! { - aii.SeaAttack(targetMilBld->GetPos(), 1, true); + aii.SeaAttack(targetMilBld->getPos(), 1, true); return; } } @@ -1737,14 +1737,14 @@ void AIPlayerJH::TrySeaAttack() // TODO: decide if it is worth attacking the target and not just "possible" // test only if we should have attackers from one of our valid sea ids const std::vector testseaidswithattackers = - gwb.GetFilteredSeaIDsForAttack(ship->GetPos(), seaidswithattackers, playerId); + gwb.getFilteredSeaIDsForAttack(ship->getPos(), seaidswithattackers, playerId); if(!testseaidswithattackers.empty()) // only do the final check if it will probably be a good result { std::vector attackers = - gwb.GetSoldiersForSeaAttack(playerId, ship->GetPos()); // now get a final list of attackers and attack it + gwb.getSoldiersForSeaAttack(playerId, ship->getPos()); // now get a final list of attackers and attack it if(!attackers.empty()) { - aii.SeaAttack(ship->GetPos(), attackers.size(), true); + aii.SeaAttack(ship->getPos(), attackers.size(), true); return; } } @@ -1758,7 +1758,7 @@ void AIPlayerJH::RecalcGround(const MapPoint buildingPos, std::vector aiMap[buildingPos].res = AINodeResource::Nothing; // flag of building - const MapPoint flagPos = gwb.GetNeighbour(buildingPos, Direction::SouthEast); + const MapPoint flagPos = gwb.getNeighbour(buildingPos, Direction::SouthEast); if(aiMap[flagPos].res == AIResource::Plantspace) aiMap[flagPos].res = AINodeResource::Nothing; @@ -1766,7 +1766,7 @@ void AIPlayerJH::RecalcGround(const MapPoint buildingPos, std::vector MapPoint curPt = flagPos; for(auto i : route_road) { - curPt = gwb.GetNeighbour(curPt, i); + curPt = gwb.getNeighbour(curPt, i); if(aiMap[curPt].res == AIResource::Plantspace) aiMap[curPt].res = AINodeResource::Nothing; } @@ -1777,23 +1777,23 @@ void AIPlayerJH::SaveResourceMapsToFile() for(const auto res : helpers::enumRange()) { bfs::ofstream file("resmap-" + std::to_string(static_cast(res)) + ".log"); - for(unsigned y = 0; y < aiMap.GetHeight(); ++y) + for(unsigned y = 0; y < aiMap.getHeight(); ++y) { if(y % 2 == 1) file << " "; - for(unsigned x = 0; x < aiMap.GetWidth(); ++x) + for(unsigned x = 0; x < aiMap.getWidth(); ++x) file << resourceMaps[res][MapPoint(x, y)] << " "; file << "\n"; } } } -int AIPlayerJH::GetResMapValue(const MapPoint pt, AIResource res) const +int AIPlayerJH::getResMapValue(const MapPoint pt, AIResource res) const { - return GetResMap(res)[pt]; + return getResMap(res)[pt]; } -const AIResourceMap& AIPlayerJH::GetResMap(AIResource res) const +const AIResourceMap& AIPlayerJH::getResMap(AIResource res) const { return resourceMaps[res]; } @@ -1803,7 +1803,7 @@ void AIPlayerJH::SendAIEvent(std::unique_ptr ev) eventManager.AddAIEvent(std::move(ev)); } -bool AIPlayerJH::IsFlagPartofCircle(const noFlag& startFlag, unsigned maxlen, const noFlag& curFlag, +bool AIPlayerJH::isFlagPartofCircle(const noFlag& startFlag, unsigned maxlen, const noFlag& curFlag, helpers::OptionalEnum excludeDir, std::vector oldFlags) { // If oldFlags is empty we just started @@ -1816,22 +1816,22 @@ bool AIPlayerJH::IsFlagPartofCircle(const noFlag& startFlag, unsigned maxlen, co if(testDir == excludeDir) continue; if(testDir == Direction::NorthWest - && (aii.IsObjectTypeOnNode(gwb.GetNeighbour(curFlag.GetPos(), Direction::NorthWest), + && (aii.isObjectTypeOnNode(gwb.getNeighbour(curFlag.getPos(), Direction::NorthWest), NodalObjectType::Building) - || aii.IsObjectTypeOnNode(gwb.GetNeighbour(curFlag.GetPos(), Direction::NorthWest), + || aii.isObjectTypeOnNode(gwb.getNeighbour(curFlag.getPos(), Direction::NorthWest), NodalObjectType::Buildingsite))) { continue; } - const RoadSegment* route = curFlag.GetRoute(testDir); + const RoadSegment* route = curFlag.getRoute(testDir); if(route) { - const noFlag& flag = route->GetOtherFlag(curFlag); + const noFlag& flag = route->getOtherFlag(curFlag); if(!helpers::contains(oldFlags, &flag)) { oldFlags.push_back(&flag); - Direction revDir = route->GetOtherFlagDir(curFlag) + 3u; - if(IsFlagPartofCircle(startFlag, maxlen - 1, flag, revDir, oldFlags)) + Direction revDir = route->getOtherFlagDir(curFlag) + 3u; + if(isFlagPartofCircle(startFlag, maxlen - 1, flag, revDir, oldFlags)) return true; } } @@ -1856,17 +1856,17 @@ void AIPlayerJH::RemoveAllUnusedRoads(const MapPoint pt) void AIPlayerJH::CheckForUnconnectedBuildingSites() { - if(construction->GetConnectJobNum() > 0 || construction->GetBuildJobNum() > 0) + if(construction->getConnectJobNum() > 0 || construction->getBuildJobNum() > 0) return; - for(noBuildingSite* bldSite : player.GetBuildingRegister().GetBuildingSites()) //-V807 + for(noBuildingSite* bldSite : player.getBuildingRegister().getBuildingSites()) //-V807 { - noFlag* flag = bldSite->GetFlag(); + noFlag* flag = bldSite->getFlag(); bool foundRoute = false; for(const auto dir : helpers::EnumRange{}) { if(dir == Direction::NorthWest) continue; - if(flag->GetRoute(dir)) + if(flag->getRoute(dir)) { foundRoute = true; break; @@ -1889,16 +1889,16 @@ bool AIPlayerJH::RemoveUnusedRoad(const noFlag& startFlag, helpers::OptionalEnum if(dir == excludeDir) continue; if(dir == Direction::NorthWest - && (aii.IsObjectTypeOnNode(gwb.GetNeighbour(startFlag.GetPos(), Direction::NorthWest), + && (aii.isObjectTypeOnNode(gwb.getNeighbour(startFlag.getPos(), Direction::NorthWest), NodalObjectType::Building) - || aii.IsObjectTypeOnNode(gwb.GetNeighbour(startFlag.GetPos(), Direction::NorthWest), + || aii.isObjectTypeOnNode(gwb.getNeighbour(startFlag.getPos(), Direction::NorthWest), NodalObjectType::Buildingsite))) { // the flag belongs to a building - update the pathing map around us and try to reconnect it (if we cant // reconnect it -> burn it(burning takes place at the pathfinding job)) return true; } - if(startFlag.GetRoute(dir)) + if(startFlag.getRoute(dir)) { finds++; if(finds == 1) @@ -1914,7 +1914,7 @@ bool AIPlayerJH::RemoveUnusedRoad(const noFlag& startFlag, helpers::OptionalEnum { if(allowcircle) { - if(!IsFlagPartofCircle(startFlag, 10, startFlag, std::nullopt, {})) + if(!isFlagPartofCircle(startFlag, 10, startFlag, std::nullopt, {})) return false; if(!firstflag) return false; @@ -1926,7 +1926,7 @@ bool AIPlayerJH::RemoveUnusedRoad(const noFlag& startFlag, helpers::OptionalEnum if(keepstartflag) { if(foundDir) - aii.DestroyRoad(startFlag.GetPos(), *foundDir); + aii.DestroyRoad(startFlag.getPos(), *foundDir); } else aii.DestroyFlag(&startFlag); @@ -1934,13 +1934,13 @@ bool AIPlayerJH::RemoveUnusedRoad(const noFlag& startFlag, helpers::OptionalEnum if(!foundDir) return false; // at least 1 road exists - Direction revDir1 = startFlag.GetRoute(*foundDir)->GetOtherFlagDir(startFlag) + 3u; - RemoveUnusedRoad(startFlag.GetRoute(*foundDir)->GetOtherFlag(startFlag), revDir1, false); + Direction revDir1 = startFlag.getRoute(*foundDir)->getOtherFlagDir(startFlag) + 3u; + RemoveUnusedRoad(startFlag.getRoute(*foundDir)->getOtherFlag(startFlag), revDir1, false); // 2 roads exist if(foundDir2) { - Direction revDir2 = startFlag.GetRoute(*foundDir2)->GetOtherFlagDir(startFlag) + 3u; - RemoveUnusedRoad(startFlag.GetRoute(*foundDir2)->GetOtherFlag(startFlag), revDir2, false); + Direction revDir2 = startFlag.getRoute(*foundDir2)->getOtherFlagDir(startFlag) + 3u; + RemoveUnusedRoad(startFlag.getRoute(*foundDir2)->getOtherFlag(startFlag), revDir2, false); } return false; } @@ -1948,9 +1948,9 @@ bool AIPlayerJH::RemoveUnusedRoad(const noFlag& startFlag, helpers::OptionalEnum unsigned AIPlayerJH::SoldierAvailable(int rank) { unsigned freeSoldiers = 0; - for(const nobBaseWarehouse* wh : aii.GetStorehouses()) + for(const nobBaseWarehouse* wh : aii.getStorehouses()) { - const Inventory& inventory = wh->GetInventory(); + const Inventory& inventory = wh->getInventory(); if(rank < 0) { for(const Job job : SOLDIER_JOBS) @@ -1966,18 +1966,18 @@ bool AIPlayerJH::HuntablesInRange(const MapPoint pt, unsigned min) // check first if no other hunter (or hunter buildingsite) is nearby if(aii.isBuildingNearby(BuildingType::Hunter, pt, 14)) return false; - return nofHunter::GetHuntableAnimalsInRange(gwb, pt).size() >= min; + return nofHunter::getHuntableAnimalsInRange(gwb, pt).size() >= min; } void AIPlayerJH::InitStoreAndMilitarylists() { - for(const nobUsual* farm : aii.GetBuildings(BuildingType::Farm)) + for(const nobUsual* farm : aii.getBuildings(BuildingType::Farm)) { - SetFarmedNodes(farm->GetPos(), true); + setFarmedNodes(farm->getPos(), true); } - for(const nobUsual* charburner : aii.GetBuildings(BuildingType::Charburner)) + for(const nobUsual* charburner : aii.getBuildings(BuildingType::Charburner)) { - SetFarmedNodes(charburner->GetPos(), true); + setFarmedNodes(charburner->getPos(), true); } // find the upgrade building UpdateUpgradeBuilding(); @@ -1986,18 +1986,18 @@ void AIPlayerJH::InitStoreAndMilitarylists() const nobMilitary* AIPlayerJH::UpdateUpgradeBuilding() { std::vector backup; - if(!aii.GetStorehouses().empty()) + if(!aii.getStorehouses().empty()) { - for(const nobMilitary* milBld : aii.GetMilitaryBuildings()) + for(const nobMilitary* milBld : aii.getMilitaryBuildings()) { // inland building, tower or fortress - BuildingType bld = milBld->GetBuildingType(); + BuildingType bld = milBld->getBuildingType(); if((bld == BuildingType::Watchtower || bld == BuildingType::Fortress) - && milBld->GetFrontierDistance() == FrontierDistance::Far) + && milBld->getFrontierDistance() == FrontierDistance::Far) { - if(construction->IsConnectedToRoadSystem(milBld->GetFlag())) + if(construction->isConnectedToRoadSystem(milBld->getFlag())) { - UpgradeBldPos = milBld->GetPos(); + UpgradeBldPos = milBld->getPos(); return milBld; } backup.push_back(milBld); @@ -2007,7 +2007,7 @@ const nobMilitary* AIPlayerJH::UpdateUpgradeBuilding() // no valid upgrade building yet - try to reconnect correctly flagged buildings for(const nobMilitary* milBld : backup) { - construction->AddConnectFlagJob(milBld->GetFlag()); + construction->AddConnectFlagJob(milBld->getFlag()); } UpgradeBldPos = MapPoint::Invalid(); return nullptr; @@ -2059,19 +2059,19 @@ void AIPlayerJH::InitDistribution() bool AIPlayerJH::ValidTreeinRange(const MapPoint pt) { unsigned max_radius = 6; - for(MapCoord tx = gwb.GetXA(pt, Direction::West), r = 1; r <= max_radius; - tx = gwb.GetXA(MapPoint(tx, pt.y), Direction::West), ++r) + for(MapCoord tx = gwb.getXA(pt, Direction::West), r = 1; r <= max_radius; + tx = gwb.getXA(MapPoint(tx, pt.y), Direction::West), ++r) { MapPoint t2(tx, pt.y); for(unsigned i = 2; i < 8; ++i) { - for(MapCoord r2 = 0; r2 < r; t2 = gwb.GetNeighbour(t2, convertToDirection(i)), ++r2) + for(MapCoord r2 = 0; r2 < r; t2 = gwb.getNeighbour(t2, convertToDirection(i)), ++r2) { // point has tree & path is available? - if(gwb.GetNO(t2)->GetType() == NodalObjectType::Tree) + if(gwb.getNO(t2)->getType() == NodalObjectType::Tree) { // not already getting cut down or a freaking pineapple thingy? - if(!gwb.GetNode(t2).reserved && gwb.GetSpecObj(t2)->ProducesWood()) + if(!gwb.getNode(t2).reserved && gwb.getSpecObj(t2)->ProducesWood()) { if(gwb.FindHumanPath(pt, t2, 20)) return true; @@ -2086,16 +2086,16 @@ bool AIPlayerJH::ValidTreeinRange(const MapPoint pt) bool AIPlayerJH::ValidStoneinRange(const MapPoint pt) { unsigned max_radius = 8; - for(MapCoord tx = gwb.GetXA(pt, Direction::West), r = 1; r <= max_radius; - tx = gwb.GetXA(MapPoint(tx, pt.y), Direction::West), ++r) + for(MapCoord tx = gwb.getXA(pt, Direction::West), r = 1; r <= max_radius; + tx = gwb.getXA(MapPoint(tx, pt.y), Direction::West), ++r) { MapPoint t2(tx, pt.y); for(unsigned i = 2; i < 8; ++i) { - for(MapCoord r2 = 0; r2 < r; t2 = gwb.GetNeighbour(t2, convertToDirection(i)), ++r2) + for(MapCoord r2 = 0; r2 < r; t2 = gwb.getNeighbour(t2, convertToDirection(i)), ++r2) { // point has tree & path is available? - if(gwb.GetNO(t2)->GetType() == NodalObjectType::Granite) + if(gwb.getNO(t2)->getType() == NodalObjectType::Granite) { if(gwb.FindHumanPath(pt, t2, 20)) return true; @@ -2108,15 +2108,15 @@ bool AIPlayerJH::ValidStoneinRange(const MapPoint pt) void AIPlayerJH::ExecuteLuaConstructionOrder(const MapPoint pt, BuildingType bt, bool forced) { - if(!aii.CanBuildBuildingtype(bt)) // not allowed to build this buildingtype? -> do nothing! + if(!aii.canBuildBuildingtype(bt)) // not allowed to build this buildingtype? -> do nothing! return; if(forced) // fixed location - just a direct gamecommand to build buildingtype at location (no checks if this is a // valid & good location from the ai) { aii.SetBuildingSite(pt, bt); auto j = std::make_unique(*this, bt, pt); - j->SetState(JobState::ExecutingRoad1); - j->SetTarget(pt); + j->setState(JobState::ExecutingRoad1); + j->setTarget(pt); construction->AddBuildJob(std::move(j), true); // connects the buildingsite to roadsystem } else { @@ -2133,13 +2133,13 @@ unsigned AIPlayerJH::BQsurroundcheck(const MapPoint pt, unsigned range, bool inc { unsigned maxvalue = 6 * (2 << (range - 1)) - 5; // 1,7,19,43,91,... = 6*2^range -5 unsigned count = 0; - RTTR_Assert(aii.GetBuildingQuality(pt) == GetAINode(pt).bq); - if((aii.GetBuildingQuality(pt) >= BuildingQuality::Hut && aii.GetBuildingQuality(pt) <= BuildingQuality::Castle) - || aii.GetBuildingQuality(pt) == BuildingQuality::Harbor) + RTTR_Assert(aii.getBuildingQuality(pt) == getAINode(pt).bq); + if((aii.getBuildingQuality(pt) >= BuildingQuality::Hut && aii.getBuildingQuality(pt) <= BuildingQuality::Castle) + || aii.getBuildingQuality(pt) == BuildingQuality::Harbor) { count++; } - NodalObjectType nob = gwb.GetNO(pt)->GetType(); + NodalObjectType nob = gwb.getNO(pt)->getType(); if(includeexisting) { if(nob == NodalObjectType::Building || nob == NodalObjectType::Buildingsite || nob == NodalObjectType::Extension @@ -2147,27 +2147,27 @@ unsigned AIPlayerJH::BQsurroundcheck(const MapPoint pt, unsigned range, bool inc count++; } // first count all the possible building places - for(MapCoord tx = gwb.GetXA(pt, Direction::West), r = 1; r <= range; - tx = gwb.GetXA(MapPoint(tx, pt.y), Direction::West), ++r) + for(MapCoord tx = gwb.getXA(pt, Direction::West), r = 1; r <= range; + tx = gwb.getXA(MapPoint(tx, pt.y), Direction::West), ++r) { MapPoint t2(tx, pt.y); for(unsigned i = 2; i < 8; ++i) { - for(MapCoord r2 = 0; r2 < r; t2 = gwb.GetNeighbour(t2, convertToDirection(i)), ++r2) + for(MapCoord r2 = 0; r2 < r; t2 = gwb.getNeighbour(t2, convertToDirection(i)), ++r2) { if(limit && ((count * 100) / maxvalue) > limit) return ((count * 100) / maxvalue); // point can be used for a building - if((aii.GetBuildingQualityAnyOwner(t2) >= BuildingQuality::Hut - && aii.GetBuildingQualityAnyOwner(t2) <= BuildingQuality::Castle) - || aii.GetBuildingQualityAnyOwner(t2) == BuildingQuality::Harbor) + if((aii.getBuildingQualityAnyOwner(t2) >= BuildingQuality::Hut + && aii.getBuildingQualityAnyOwner(t2) <= BuildingQuality::Castle) + || aii.getBuildingQualityAnyOwner(t2) == BuildingQuality::Harbor) { count++; continue; } if(includeexisting) { - nob = gwb.GetNO(t2)->GetType(); + nob = gwb.getNO(t2)->getType(); if(nob == NodalObjectType::Building || nob == NodalObjectType::Buildingsite || nob == NodalObjectType::Extension || nob == NodalObjectType::Fire || nob == NodalObjectType::CharburnerPile) @@ -2182,7 +2182,7 @@ unsigned AIPlayerJH::BQsurroundcheck(const MapPoint pt, unsigned range, bool inc bool AIPlayerJH::HarborPosRelevant(HarborId harborId, bool onlyempty) const { - if(!harborId || harborId.value() > gwb.GetNumHarborPoints()) // not a real harbor - shouldnt happen... + if(!harborId || harborId.value() > gwb.getNumHarborPoints()) // not a real harbor - shouldnt happen... { RTTR_Assert(false); return false; @@ -2192,16 +2192,16 @@ bool AIPlayerJH::HarborPosRelevant(HarborId harborId, bool onlyempty) const for(const auto dir : helpers::EnumRange{}) { - const SeaId seaId = gwb.GetSeaId(harborId, dir); + const SeaId seaId = gwb.getSeaId(harborId, dir); if(!seaId) continue; - for(const auto curHarborId : helpers::idRange(gwb.GetNumHarborPoints())) + for(const auto curHarborId : helpers::idRange(gwb.getNumHarborPoints())) { - if(curHarborId != harborId && gwb.IsHarborAtSea(HarborId(curHarborId), seaId)) + if(curHarborId != harborId && gwb.isHarborAtSea(HarborId(curHarborId), seaId)) { // check if the spot is actually free for colonization? - if(gwb.IsHarborPointFree(HarborId(curHarborId), playerId)) + if(gwb.isHarborPointFree(HarborId(curHarborId), playerId)) return true; } } @@ -2211,10 +2211,10 @@ bool AIPlayerJH::HarborPosRelevant(HarborId harborId, bool onlyempty) const bool AIPlayerJH::NoEnemyHarbor() { - for(const auto i : helpers::idRange(gwb.GetNumHarborPoints())) + for(const auto i : helpers::idRange(gwb.getNumHarborPoints())) { - if(aii.IsBuildingOnNode(gwb.GetHarborPoint(i), BuildingType::HarborBuilding) - && !aii.IsOwnTerritory(gwb.GetHarborPoint(i))) + if(aii.isBuildingOnNode(gwb.getHarborPoint(i), BuildingType::HarborBuilding) + && !aii.isOwnTerritory(gwb.getHarborPoint(i))) { // LOG.write(("found a harbor at spot %i ",i); return false; @@ -2223,7 +2223,7 @@ bool AIPlayerJH::NoEnemyHarbor() return true; } -bool AIPlayerJH::IsInvalidShipyardPosition(const MapPoint pt) +bool AIPlayerJH::isInvalidShipyardPosition(const MapPoint pt) { return aii.isBuildingNearby(BuildingType::Shipyard, pt, 19) || !aii.isHarborPosClose(pt, 7); } @@ -2231,16 +2231,16 @@ bool AIPlayerJH::IsInvalidShipyardPosition(const MapPoint pt) unsigned AIPlayerJH::AmountInStorage(GoodType good) const { unsigned counter = 0; - for(const nobBaseWarehouse* wh : aii.GetStorehouses()) - counter += wh->GetInventory().goods[good]; + for(const nobBaseWarehouse* wh : aii.getStorehouses()) + counter += wh->getInventory().goods[good]; return counter; } unsigned AIPlayerJH::AmountInStorage(::Job job) const { unsigned counter = 0; - for(const nobBaseWarehouse* wh : aii.GetStorehouses()) - counter += wh->GetInventory().people[job]; + for(const nobBaseWarehouse* wh : aii.getStorehouses()) + counter += wh->getInventory().people[job]; return counter; } @@ -2250,10 +2250,10 @@ bool AIPlayerJH::ValidFishInRange(const MapPoint pt) return gwb.CheckPointsInRadius( pt, max_radius, [this, pt](const MapPoint curPt, unsigned) { - if(gwb.GetNode(curPt).resources.has(ResourceType::Fish)) // fish on current spot? + if(gwb.getNode(curPt).resources.has(ResourceType::Fish)) // fish on current spot? { // try to find a path to a neighboring node on the coast - for(const MapPoint nb : gwb.GetNeighbours(curPt)) + for(const MapPoint nb : gwb.getNeighbours(curPt)) { if(gwb.FindHumanPath(pt, nb, 10)) return true; @@ -2264,15 +2264,15 @@ bool AIPlayerJH::ValidFishInRange(const MapPoint pt) false); } -unsigned AIPlayerJH::GetNumAIRelevantSeaIds() const +unsigned AIPlayerJH::getNumAIRelevantSeaIds() const { std::vector validseaids; std::list onetimeuseseaids; - for(const auto i : helpers::idRange(gwb.GetNumHarborPoints())) + for(const auto i : helpers::idRange(gwb.getNumHarborPoints())) { for(const auto dir : helpers::EnumRange{}) { - const SeaId seaId = gwb.GetSeaId(i, dir); + const SeaId seaId = gwb.getSeaId(i, dir); if(!seaId) continue; // there is a sea id? -> check if it is already a validid or a once found id @@ -2294,9 +2294,9 @@ unsigned AIPlayerJH::GetNumAIRelevantSeaIds() const void AIPlayerJH::AdjustSettings() { - const Inventory& inventory = aii.GetInventory(); + const Inventory& inventory = aii.getInventory(); // update tool creation settings - if(bldPlanner->GetNumBuildings(BuildingType::Metalworks) > 0u) + if(bldPlanner->getNumBuildings(BuildingType::Metalworks) > 0u) { ToolSettings toolsettings{}; const auto calcToolPriority = [&](const Tool tool) { @@ -2311,7 +2311,7 @@ void AIPlayerJH::AdjustSettings() for(const auto bld : helpers::enumRange()) { if(BLD_WORK_DESC[bld].job == job) - numBuildingsRequiringWorker += bldPlanner->GetNumBuildings(bld); + numBuildingsRequiringWorker += bldPlanner->getNumBuildings(bld); } if(numBuildingsRequiringWorker > inventory[job]) { @@ -2361,7 +2361,7 @@ void AIPlayerJH::AdjustSettings() for(const auto tool : helpers::enumRange()) { - if(toolsettings[tool] != player.GetToolPriority(tool)) + if(toolsettings[tool] != player.getToolPriority(tool)) { aii.ChangeTools(toolsettings); break; @@ -2372,7 +2372,7 @@ void AIPlayerJH::AdjustSettings() // Set military settings to some currently required values MilitarySettings milSettings; milSettings[0] = 10; - milSettings[1] = HasFrontierBuildings() ? + milSettings[1] = hasFrontierBuildings() ? 5 : 0; // if we have a front send strong soldiers first else weak first to make upgrading easier milSettings[2] = 4; @@ -2381,16 +2381,16 @@ void AIPlayerJH::AdjustSettings() milSettings[4] = UpdateUpgradeBuilding() && (inventory[GoodType::Coins] > 0 || (inventory[GoodType::Gold] > 0 && inventory[GoodType::Coal] > 0 - && !aii.GetBuildings(BuildingType::Mint).empty())) ? + && !aii.getBuildings(BuildingType::Mint).empty())) ? 8 : 0; milSettings[6] = ggs.isEnabled(AddonId::SEA_ATTACK) ? 8 : 0; // harbor flag: no sea attacks?->no soldiers else 50% to 100% milSettings[5] = CalcMilSettings(); // inland 1bar min 50% max 100% depending on how many soldiers are available milSettings[7] = 8; // front: 100% - if(player.GetMilitarySetting(5) != milSettings[5] || player.GetMilitarySetting(6) != milSettings[6] - || player.GetMilitarySetting(4) != milSettings[4] - || player.GetMilitarySetting(1) != milSettings[1]) // only send the command if we want to change something + if(player.getMilitarySetting(5) != milSettings[5] || player.getMilitarySetting(6) != milSettings[6] + || player.getMilitarySetting(4) != milSettings[4] + || player.getMilitarySetting(1) != milSettings[1]) // only send the command if we want to change something aii.ChangeMilitary(milSettings); } @@ -2401,24 +2401,24 @@ unsigned AIPlayerJH::CalcMilSettings() /// first sum up all soldiers we have unsigned numSoldiers = 0; for(auto i : SOLDIER_JOBS) - numSoldiers += aii.GetInventory().people[i]; + numSoldiers += aii.getInventory().people[i]; // now add up all counts of soldiers that are fixed in use and those that depend on whatever we have as a result - const unsigned numShouldStayConnected = GetNumPlannedConnectedInlandMilitaryBlds(); + const unsigned numShouldStayConnected = getNumPlannedConnectedInlandMilitaryBlds(); unsigned count = 0; unsigned soldierInUseFixed = 0; const auto* upgradeBld = UpdateUpgradeBuilding(); - const std::list& militaryBuildings = aii.GetMilitaryBuildings(); + const std::list& militaryBuildings = aii.getMilitaryBuildings(); for(const nobMilitary* milBld : militaryBuildings) { - if(milBld->GetFrontierDistance() == FrontierDistance::Near - || milBld->GetFrontierDistance() == FrontierDistance::Harbor - || (milBld->GetFrontierDistance() == FrontierDistance::Far + if(milBld->getFrontierDistance() == FrontierDistance::Near + || milBld->getFrontierDistance() == FrontierDistance::Harbor + || (milBld->getFrontierDistance() == FrontierDistance::Far && (count + numShouldStayConnected > militaryBuildings.size() || milBld == upgradeBld))) // front or connected interior { soldierInUseFixed += milBld->CalcRequiredNumTroops(FrontierDistance::Mid, 8); - } else if(milBld->GetFrontierDistance() == FrontierDistance::Mid) // 1 bar (inland) + } else if(milBld->getFrontierDistance() == FrontierDistance::Mid) // 1 bar (inland) { for(int i = 0; i < 5; i++) InlandTroops[i] += milBld->CalcRequiredNumTroops(FrontierDistance::Mid, 4 + i); @@ -2435,7 +2435,7 @@ unsigned AIPlayerJH::CalcMilSettings() // have more than enough soldiers for this setting or just enough and this is the current setting? -> return it // else try the next lower setting down to 4 (50%) if(soldierInUseFixed + InlandTroops[returnValue - 4] < numSoldiers * 10 / 11 - || (player.GetMilitarySetting(5) >= returnValue + || (player.getMilitarySetting(5) >= returnValue && soldierInUseFixed + InlandTroops[returnValue - 4] < numSoldiers)) break; returnValue--; diff --git a/libs/s25main/ai/aijh/AIPlayerJH.h b/libs/s25main/ai/aijh/AIPlayerJH.h index b1d461bb50..b93dc482b2 100644 --- a/libs/s25main/ai/aijh/AIPlayerJH.h +++ b/libs/s25main/ai/aijh/AIPlayerJH.h @@ -38,14 +38,14 @@ class AIPlayerJH final : public AIPlayer AIPlayerJH(unsigned char playerId, const GameWorldBase& gwb, AI::Level level); ~AIPlayerJH() override; - AIInterface& GetInterface() { return aii; } - const AIInterface& GetInterface() const { return aii; } - const GameWorldBase& GetWorld() const { return gwb; } + AIInterface& getInterface() { return aii; } + const AIInterface& getInterface() const { return aii; } + const GameWorldBase& getWorld() const { return gwb; } // Required by the AIJobs: - AIConstruction& GetConstruction() { return *construction; } - const BuildingPlanner& GetBldPlanner() const { return *bldPlanner; } - const AIJob* GetCurrentJob() const { return currentJob.get(); } - unsigned GetNumJobs() const; + AIConstruction& getConstruction() { return *construction; } + const BuildingPlanner& getBldPlanner() const { return *bldPlanner; } + const AIJob* getCurrentJob() const { return currentJob.get(); } + unsigned getNumJobs() const; void RunGF(unsigned gf, bool gfisnwf) override; void OnChatMessage(unsigned sendPlayerId, ChatDestination, const std::string& msg) override; @@ -59,19 +59,19 @@ class AIPlayerJH final : public AIPlayer /// military & tool production settings void AdjustSettings(); /// return number of seaIds with at least 2 harbor spots - unsigned GetNumAIRelevantSeaIds() const; + unsigned getNumAIRelevantSeaIds() const; - bool IsInvalidShipyardPosition(MapPoint pt); + bool isInvalidShipyardPosition(MapPoint pt); - int GetResMapValue(MapPoint pt, AIResource res) const; - const AIResourceMap& GetResMap(AIResource res) const; + int getResMapValue(MapPoint pt, AIResource res) const; + const AIResourceMap& getResMap(AIResource res) const; - Node& GetAINode(const MapPoint pt) { return aiMap[pt]; } - const Node& GetAINode(const MapPoint pt) const { return aiMap[pt]; } + Node& getAINode(const MapPoint pt) { return aiMap[pt]; } + const Node& getAINode(const MapPoint pt) const { return aiMap[pt]; } - unsigned GetNumPlannedConnectedInlandMilitaryBlds() + unsigned getNumPlannedConnectedInlandMilitaryBlds() { - return std::max(6u, aii.GetMilitaryBuildings().size() / 5u); + return std::max(6u, aii.getMilitaryBuildings().size() / 5u); } /// returns the percentage*100 of possible normal building places unsigned BQsurroundcheck(MapPoint pt, unsigned range, bool includeexisting, unsigned limit = 0); @@ -104,12 +104,12 @@ class AIPlayerJH final : public AIPlayer /// there are no frontier warehouses just pick anything but 1 if there is just 1 then dont block void DistributeMaxRankSoldiersByBlocking(unsigned limit, nobBaseWarehouse* upwh); /// returns true if at least 1 military building has a flag > 0 - bool HasFrontierBuildings(); + bool hasFrontierBuildings(); /// returns the warehouse closest to the upgradebuilding or if it cant find a way the first warehouse and if there /// is no warehouse left null - nobBaseWarehouse* GetUpgradeBuildingWarehouse(); + nobBaseWarehouse* getUpgradeBuildingWarehouse(); /// activate gathering of swords,shields,beer,privates(if there is an upgrade building), helpers(if necessary) - void SetGatheringForUpgradeWarehouse(nobBaseWarehouse* upgradewarehouse); + void setGatheringForUpgradeWarehouse(nobBaseWarehouse* upgradewarehouse); /// Initializes the nodes on start of the game void InitNodes(); /// Updates the nodes around a position @@ -125,7 +125,7 @@ class AIPlayerJH final : public AIPlayer // set default start values for the ai for distribution void InitDistribution(); // returns true if we can get to the startflag in excludeDir, std::vector oldFlags); /// Finds the best position for a specific resource in an area using the resource maps, /// satisfying the minimum value, returns false if no such position is found @@ -136,7 +136,7 @@ class AIPlayerJH final : public AIPlayer /// Find a position for a specific building around a given point MapPoint FindPositionForBuildingAround(BuildingType type, const MapPoint& around); /// Density in percent (0-100) - unsigned GetDensity(MapPoint pt, AIResource res, int radius); + unsigned getDensity(MapPoint pt, AIResource res, int radius); /// Does some actions after a new military building is occupied void HandleNewMilitaryBuildingOccupied(MapPoint pt); /// Does some actions after a military building is lost @@ -190,7 +190,7 @@ class AIPlayerJH final : public AIPlayer /// upgrade building (order new private, kick out general) void MilUpgradeOptim(); - void SetFarmedNodes(MapPoint pt, bool set); + void setFarmedNodes(MapPoint pt, bool set); // removes a no longer used road(and its flags) returns true when there is a building at the flag that might need a // new connection bool RemoveUnusedRoad(const noFlag& startFlag, helpers::OptionalEnum excludeDir, bool firstflag = true, diff --git a/libs/s25main/ai/aijh/AIResourceMap.cpp b/libs/s25main/ai/aijh/AIResourceMap.cpp index 9b498f9fb6..79c3c62df3 100644 --- a/libs/s25main/ai/aijh/AIResourceMap.cpp +++ b/libs/s25main/ai/aijh/AIResourceMap.cpp @@ -38,7 +38,7 @@ AIResourceMap::~AIResourceMap() = default; void AIResourceMap::init() { - const MapExtent mapSize = aiMap.GetSize(); + const MapExtent mapSize = aiMap.getSize(); map.Resize(mapSize); // Calculate value for each point. @@ -60,7 +60,7 @@ void AIResourceMap::init() { // Calculate only if we can build there const bool isValid = - aii.gwb.IsOfTerrain(pt, [requiredTerrain](const TerrainDesc& desc) { return desc.Is(requiredTerrain); }); + aii.gwb.isOfTerrain(pt, [requiredTerrain](const TerrainDesc& desc) { return desc.Is(requiredTerrain); }); map[pt] = isValid ? aii.CalcResourceValue(pt, res) : 0; } } @@ -82,21 +82,21 @@ MapPoint AIResourceMap::findBestPosition(const MapPoint& pt, BuildingQuality siz std::vector pts = aii.gwb.GetPointsInRadiusWithCenter(pt, radius); for(const MapPoint& curPt : pts) { - const unsigned idx = map.GetIdx(curPt); + const unsigned idx = map.getIdx(curPt); if(map[idx] > best_value) { if(!aiMap[idx].reachable || !aiMap[idx].owned || aiMap[idx].farmed) continue; - RTTR_Assert(aii.GetBuildingQuality(curPt) + RTTR_Assert(aii.getBuildingQuality(curPt) == aiMap[curPt].bq); // Temporary, to check if aiMap is correctly update, see below - if(!canUseBq(aii.GetBuildingQuality(curPt), size)) // map[idx].bq; TODO: Update nodes BQ and use that + if(!canUseBq(aii.getBuildingQuality(curPt), size)) // map[idx].bq; TODO: Update nodes BQ and use that continue; // special case fish -> check for other fishery buildings if(res == AIResource::Fish && aii.isBuildingNearby(BuildingType::Fishery, curPt, 5)) continue; if(res == AIResource::Borderland - && (aii.gwb.IsOnRoad(aii.gwb.GetNeighbour(curPt, Direction::SouthEast)) - || aii.gwb.IsInsideComputerBarrier(curPt))) + && (aii.gwb.isOnRoad(aii.gwb.getNeighbour(curPt, Direction::SouthEast)) + || aii.gwb.isInsideComputerBarrier(curPt))) continue; // dont build next to empty harborspots if(aii.isHarborPosClose(curPt, 2, true)) @@ -126,13 +126,13 @@ void AIResourceMap::updateAroundDiminishable(const MapPoint& pt, const int radiu // variable to remember the first calculation we did in the circle. int circleStartValue = 0; - for(MapCoord tx = aii.gwb.GetXA(pt, Direction::West), r = 1; r <= radius; - tx = aii.gwb.GetXA(MapPoint(tx, pt.y), Direction::West), ++r) + for(MapCoord tx = aii.gwb.getXA(pt, Direction::West), r = 1; r <= radius; + tx = aii.gwb.getXA(MapPoint(tx, pt.y), Direction::West), ++r) { MapPoint curPt(tx, pt.y); for(const auto curDir : helpers::enumRange(Direction::NorthEast)) { - for(MapCoord step = 0; step < r; ++step, curPt = aiMap.GetNeighbour(curPt, curDir)) + for(MapCoord step = 0; step < r; ++step, curPt = aiMap.getNeighbour(curPt, curDir)) { int& resMapVal = map[curPt]; // only do a complete calculation for the first point or when moving outward and the last value is @@ -176,13 +176,13 @@ void AIResourceMap::updateAroundReplinishable(const MapPoint& pt, const int radi int circleStartValue = 0; int resValue = 0; - for(MapCoord tx = aii.gwb.GetXA(pt, Direction::West), r = 1; r <= radius; - tx = aii.gwb.GetXA(MapPoint(tx, pt.y), Direction::West), ++r) + for(MapCoord tx = aii.gwb.getXA(pt, Direction::West), r = 1; r <= radius; + tx = aii.gwb.getXA(MapPoint(tx, pt.y), Direction::West), ++r) { MapPoint curPt(tx, pt.y); for(const auto curDir : helpers::enumRange(Direction::NorthEast)) { - for(MapCoord step = 0; step < r; ++step, curPt = aii.gwb.GetNeighbour(curPt, curDir)) + for(MapCoord step = 0; step < r; ++step, curPt = aii.gwb.getNeighbour(curPt, curDir)) { if(r == 1 && step == 0 && curDir == Direction::NorthEast) { diff --git a/libs/s25main/ai/aijh/BuildingPlanner.cpp b/libs/s25main/ai/aijh/BuildingPlanner.cpp index 736ccfba9b..17334b6f3d 100644 --- a/libs/s25main/ai/aijh/BuildingPlanner.cpp +++ b/libs/s25main/ai/aijh/BuildingPlanner.cpp @@ -19,9 +19,9 @@ namespace AIJH { namespace { bool HasAnyInexhaustibleOreMine(const GlobalGameSettings& ggs) { - return !IsMineResourceDepletable(ggs, BuildingType::CoalMine) - || !IsMineResourceDepletable(ggs, BuildingType::IronMine) - || !IsMineResourceDepletable(ggs, BuildingType::GoldMine); + return !isMineResourceDepletable(ggs, BuildingType::CoalMine) + || !isMineResourceDepletable(ggs, BuildingType::IronMine) + || !isMineResourceDepletable(ggs, BuildingType::GoldMine); } } // namespace @@ -40,18 +40,18 @@ void BuildingPlanner::Update(unsigned gf, AIPlayerJH& aijh) void BuildingPlanner::RefreshBuildingNums(const AIPlayerJH& aijh) { - buildingNums = aijh.player.GetBuildingRegister().GetBuildingNums(); + buildingNums = aijh.player.getBuildingRegister().getBuildingNums(); } bool BuildingPlanner::CalcIsExpansionRequired(AIPlayerJH& aijh, bool recalc) const { if(!expansionRequired && !recalc) return false; - if(GetNumMilitaryBldSites() > 0 || GetNumMilitaryBlds() > 4) + if(getNumMilitaryBldSites() > 0 || getNumMilitaryBlds() > 4) return false; - bool hasWood = GetNumBuildings(BuildingType::Woodcutter) > 0; - bool hasBoards = GetNumBuildings(BuildingType::Sawmill) > 0; - bool hasStone = GetNumBuildings(BuildingType::Quarry) > 0; + bool hasWood = getNumBuildings(BuildingType::Woodcutter) > 0; + bool hasBoards = getNumBuildings(BuildingType::Sawmill) > 0; + bool hasStone = getNumBuildings(BuildingType::Quarry) > 0; if(expansionRequired) { if(hasWood && hasBoards && hasStone) @@ -59,47 +59,47 @@ bool BuildingPlanner::CalcIsExpansionRequired(AIPlayerJH& aijh, bool recalc) con } else { // Check if we could build the missing building around any military building or storehouse. If not, expand. - const BuildingRegister& buildingRegister = aijh.player.GetBuildingRegister(); - std::vector blds(buildingRegister.GetMilitaryBuildings().begin(), - buildingRegister.GetMilitaryBuildings().end()); - blds.insert(blds.end(), buildingRegister.GetStorehouses().begin(), buildingRegister.GetStorehouses().end()); + const BuildingRegister& buildingRegister = aijh.player.getBuildingRegister(); + std::vector blds(buildingRegister.getMilitaryBuildings().begin(), + buildingRegister.getMilitaryBuildings().end()); + blds.insert(blds.end(), buildingRegister.getStorehouses().begin(), buildingRegister.getStorehouses().end()); for(const noBuilding* bld : blds) { if(!hasWood) - hasWood = aijh.FindPositionForBuildingAround(BuildingType::Woodcutter, bld->GetPos()).isValid(); + hasWood = aijh.FindPositionForBuildingAround(BuildingType::Woodcutter, bld->getPos()).isValid(); if(!hasBoards) - hasBoards = aijh.FindPositionForBuildingAround(BuildingType::Sawmill, bld->GetPos()).isValid(); + hasBoards = aijh.FindPositionForBuildingAround(BuildingType::Sawmill, bld->getPos()).isValid(); if(!hasStone) - hasStone = aijh.FindPositionForBuildingAround(BuildingType::Quarry, bld->GetPos()).isValid(); + hasStone = aijh.FindPositionForBuildingAround(BuildingType::Quarry, bld->getPos()).isValid(); } return !(hasWood && hasBoards && hasStone); } return expansionRequired; } -unsigned BuildingPlanner::GetNumBuildings(BuildingType type) const +unsigned BuildingPlanner::getNumBuildings(BuildingType type) const { return buildingNums.buildings[type] + buildingNums.buildingSites[type]; } -unsigned BuildingPlanner::GetNumBuildingSites(BuildingType type) const +unsigned BuildingPlanner::getNumBuildingSites(BuildingType type) const { return buildingNums.buildingSites[type]; } -unsigned BuildingPlanner::GetNumMilitaryBlds() const +unsigned BuildingPlanner::getNumMilitaryBlds() const { unsigned result = 0; for(BuildingType bld : BuildingProperties::militaryBldTypes) - result += GetNumBuildings(bld); + result += getNumBuildings(bld); return result; } -unsigned BuildingPlanner::GetNumMilitaryBldSites() const +unsigned BuildingPlanner::getNumMilitaryBldSites() const { unsigned result = 0; for(BuildingType bld : BuildingProperties::militaryBldTypes) - result += GetNumBuildingSites(bld); + result += getNumBuildingSites(bld); return result; } @@ -118,9 +118,9 @@ void BuildingPlanner::InitBuildingsWanted(const AIPlayerJH& aijh) buildingsWanted[BuildingType::Quarry] = 6; buildingsWanted[BuildingType::Hunter] = 2; buildingsWanted[BuildingType::Farm] = - aijh.player.GetInventory().goods[GoodType::Scythe] + aijh.player.GetInventory().people[Job::Farmer]; + aijh.player.getInventory().goods[GoodType::Scythe] + aijh.player.getInventory().people[Job::Farmer]; - unsigned numAIRelevantSeaIds = aijh.GetNumAIRelevantSeaIds(); + unsigned numAIRelevantSeaIds = aijh.getNumAIRelevantSeaIds(); if(numAIRelevantSeaIds > 0) { buildingsWanted[BuildingType::HarborBuilding] = 99; @@ -131,9 +131,9 @@ void BuildingPlanner::InitBuildingsWanted(const AIPlayerJH& aijh) void BuildingPlanner::UpdateBuildingsWanted(const AIPlayerJH& aijh) { // no military buildings -> usually start only - const unsigned numMilitaryBlds = aijh.player.GetBuildingRegister().GetMilitaryBuildings().size(); + const unsigned numMilitaryBlds = aijh.player.getBuildingRegister().getMilitaryBuildings().size(); - if(numMilitaryBlds == 0 && aijh.player.GetBuildingRegister().GetStorehouses().size() < 2) + if(numMilitaryBlds == 0 && aijh.player.getBuildingRegister().getStorehouses().size() < 2) { buildingsWanted[BuildingType::Forester] = 1; // probably only has 1 saw+carpenter but if that is the case the ai will try to produce 1 additional saw very @@ -155,18 +155,18 @@ void BuildingPlanner::UpdateBuildingsWanted(const AIPlayerJH& aijh) // at least some expansion happened -> more buildings wanted // building wanted usually limited by profession workers+tool for profession with some arbitrary limit. Some // buildings which are linked to others in a chain / profession-tool-rivalry have additional limits. - const Inventory& inventory = aijh.player.GetInventory(); + const Inventory& inventory = aijh.player.getInventory(); // foresters unsigned max_available_forester = inventory[Job::Forester] + inventory[GoodType::Shovel]; - unsigned additional_forester = GetNumBuildings(BuildingType::Charburner); + unsigned additional_forester = getNumBuildings(BuildingType::Charburner); // 1 mil -> 1 forester, 2 mil -> 2 forester, 4 mil -> 3 forester, 8 mil -> 4 forester, 16 mil -> 5 forester, ... // wanted if(numMilitaryBlds > 0) buildingsWanted[BuildingType::Forester] = (unsigned)(1.45 * log(numMilitaryBlds) + 1); // If we are low on wood, we need more foresters - if(aijh.player.GetBuildingRegister().GetBuildingSites().size() + if(aijh.player.getBuildingRegister().getBuildingSites().size() > (inventory[GoodType::Boards] + inventory[GoodType::Wood]) * 2) additional_forester++; @@ -212,60 +212,60 @@ void BuildingPlanner::UpdateBuildingsWanted(const AIPlayerJH& aijh) } // sawmills limited by woodcutters and carpenter+saws reduced by char burners minimum of 3 int resourcelimit = inventory.people[Job::Carpenter] + inventory.goods[GoodType::Saw]; - int numSawmillsFed = (static_cast(GetNumBuildings(BuildingType::Woodcutter)) - - static_cast(GetNumBuildings(BuildingType::Charburner) * 2)) + int numSawmillsFed = (static_cast(getNumBuildings(BuildingType::Woodcutter)) + - static_cast(getNumBuildings(BuildingType::Charburner) * 2)) / 2; buildingsWanted[BuildingType::Sawmill] = std::max(std::min(numSawmillsFed, resourcelimit), 3); // min 3 // iron smelters limited by iron mines or crucibles buildingsWanted[BuildingType::Ironsmelter] = std::min(inventory.goods[GoodType::Crucible] + inventory.people[Job::IronFounder], - GetNumBuildings(BuildingType::IronMine)); + getNumBuildings(BuildingType::IronMine)); - buildingsWanted[BuildingType::Mint] = GetNumBuildings(BuildingType::GoldMine); + buildingsWanted[BuildingType::Mint] = getNumBuildings(BuildingType::GoldMine); // armory count = smelter -metalworks if there is more than 1 smelter or 1 if there is just 1. buildingsWanted[BuildingType::Armory] = - (GetNumBuildings(BuildingType::Ironsmelter) > 1) ? - std::max(0, static_cast(GetNumBuildings(BuildingType::Ironsmelter)) - - static_cast(GetNumBuildings(BuildingType::Metalworks))) : - GetNumBuildings(BuildingType::Ironsmelter); + (getNumBuildings(BuildingType::Ironsmelter) > 1) ? + std::max(0, static_cast(getNumBuildings(BuildingType::Ironsmelter)) + - static_cast(getNumBuildings(BuildingType::Metalworks))) : + getNumBuildings(BuildingType::Ironsmelter); if(aijh.ggs.isEnabled(AddonId::HALF_COST_MIL_EQUIP)) buildingsWanted[BuildingType::Armory] *= 2; // brewery count = 1+(armory/5) if there is at least 1 armory or armory /6 for exhaustible mines - if(GetNumBuildings(BuildingType::Armory) > 0 && GetNumBuildings(BuildingType::Farm) > 0) + if(getNumBuildings(BuildingType::Armory) > 0 && getNumBuildings(BuildingType::Farm) > 0) { if(HasAnyInexhaustibleOreMine(aijh.ggs)) - buildingsWanted[BuildingType::Brewery] = 1 + GetNumBuildings(BuildingType::Armory) / 5; + buildingsWanted[BuildingType::Brewery] = 1 + getNumBuildings(BuildingType::Armory) / 5; else - buildingsWanted[BuildingType::Brewery] = 1 + GetNumBuildings(BuildingType::Armory) / 6; + buildingsWanted[BuildingType::Brewery] = 1 + getNumBuildings(BuildingType::Armory) / 6; } else buildingsWanted[BuildingType::Brewery] = 0; // metalworks is 1 if there is at least 1 smelter, 2 if mines are inexhaustible and we have at least 4 iron // smelters - buildingsWanted[BuildingType::Metalworks] = (GetNumBuildings(BuildingType::Ironsmelter) > 0) ? 1 : 0; + buildingsWanted[BuildingType::Metalworks] = (getNumBuildings(BuildingType::Ironsmelter) > 0) ? 1 : 0; // max processing - unsigned foodusers = GetNumBuildings(BuildingType::Charburner) + GetNumBuildings(BuildingType::Mill) - + GetNumBuildings(BuildingType::Brewery) + GetNumBuildings(BuildingType::PigFarm) - + GetNumBuildings(BuildingType::DonkeyBreeder); + unsigned foodusers = getNumBuildings(BuildingType::Charburner) + getNumBuildings(BuildingType::Mill) + + getNumBuildings(BuildingType::Brewery) + getNumBuildings(BuildingType::PigFarm) + + getNumBuildings(BuildingType::DonkeyBreeder); - if(GetNumBuildings(BuildingType::Farm) >= foodusers - GetNumBuildings(BuildingType::Mill)) + if(getNumBuildings(BuildingType::Farm) >= foodusers - getNumBuildings(BuildingType::Mill)) buildingsWanted[BuildingType::Mill] = - std::min(GetNumBuildings(BuildingType::Farm) - (foodusers - GetNumBuildings(BuildingType::Mill)), - GetNumBuildings(BuildingType::Bakery) + 1); + std::min(getNumBuildings(BuildingType::Farm) - (foodusers - getNumBuildings(BuildingType::Mill)), + getNumBuildings(BuildingType::Bakery) + 1); else - buildingsWanted[BuildingType::Mill] = GetNumBuildings(BuildingType::Mill); + buildingsWanted[BuildingType::Mill] = getNumBuildings(BuildingType::Mill); resourcelimit = inventory.people[Job::Baker] + inventory.goods[GoodType::Rollingpin] + 1; - buildingsWanted[BuildingType::Bakery] = std::min(GetNumBuildings(BuildingType::Mill), resourcelimit); + buildingsWanted[BuildingType::Bakery] = std::min(getNumBuildings(BuildingType::Mill), resourcelimit); - buildingsWanted[BuildingType::PigFarm] = (GetNumBuildings(BuildingType::Farm) < 8) ? - GetNumBuildings(BuildingType::Farm) / 4 : - (GetNumBuildings(BuildingType::Farm) - 2) / 4; - if(buildingsWanted[BuildingType::PigFarm] > GetNumBuildings(BuildingType::Slaughterhouse) + 1) - buildingsWanted[BuildingType::PigFarm] = GetNumBuildings(BuildingType::Slaughterhouse) + 1; + buildingsWanted[BuildingType::PigFarm] = (getNumBuildings(BuildingType::Farm) < 8) ? + getNumBuildings(BuildingType::Farm) / 4 : + (getNumBuildings(BuildingType::Farm) - 2) / 4; + if(buildingsWanted[BuildingType::PigFarm] > getNumBuildings(BuildingType::Slaughterhouse) + 1) + buildingsWanted[BuildingType::PigFarm] = getNumBuildings(BuildingType::Slaughterhouse) + 1; buildingsWanted[BuildingType::Slaughterhouse] = std::min( - inventory.goods[GoodType::Cleaver] + inventory.people[Job::Butcher], GetNumBuildings(BuildingType::PigFarm)); + inventory.goods[GoodType::Cleaver] + inventory.people[Job::Butcher], getNumBuildings(BuildingType::PigFarm)); buildingsWanted[BuildingType::Well] = buildingsWanted[BuildingType::Bakery] + buildingsWanted[BuildingType::PigFarm] @@ -289,38 +289,38 @@ void BuildingPlanner::UpdateBuildingsWanted(const AIPlayerJH& aijh) { // coal mine count now depends on iron & gold not linked to food or material supply - might have to add a // material check if this makes problems - if(GetNumBuildings(BuildingType::IronMine) > 0) + if(getNumBuildings(BuildingType::IronMine) > 0) buildingsWanted[BuildingType::CoalMine] = - GetNumBuildings(BuildingType::IronMine) * 2 - 1 + GetNumBuildings(BuildingType::GoldMine); + getNumBuildings(BuildingType::IronMine) * 2 - 1 + getNumBuildings(BuildingType::GoldMine); else - buildingsWanted[BuildingType::CoalMine] = std::max(GetNumBuildings(BuildingType::GoldMine), 1u); + buildingsWanted[BuildingType::CoalMine] = std::max(getNumBuildings(BuildingType::GoldMine), 1u); // more mines planned than food available? -> limit mines if(buildingsWanted[BuildingType::CoalMine] > 2 && buildingsWanted[BuildingType::CoalMine] * 2 - > GetNumBuildings(BuildingType::Farm) + GetNumBuildings(BuildingType::Fishery) + 1) + > getNumBuildings(BuildingType::Farm) + getNumBuildings(BuildingType::Fishery) + 1) buildingsWanted[BuildingType::CoalMine] = - (GetNumBuildings(BuildingType::Farm) + GetNumBuildings(BuildingType::Fishery)) / 2 + 2; - if(GetNumBuildings(BuildingType::Farm) > 7) // quite the empire just scale mines with farms + (getNumBuildings(BuildingType::Farm) + getNumBuildings(BuildingType::Fishery)) / 2 + 2; + if(getNumBuildings(BuildingType::Farm) > 7) // quite the empire just scale mines with farms { if(HasAnyInexhaustibleOreMine(aijh.ggs)) // inexhaustible mines? -> more farms required for each mine - buildingsWanted[BuildingType::IronMine] = std::min(GetNumBuildings(BuildingType::Ironsmelter) + 1, - GetNumBuildings(BuildingType::Farm) * 2 / 5); + buildingsWanted[BuildingType::IronMine] = std::min(getNumBuildings(BuildingType::Ironsmelter) + 1, + getNumBuildings(BuildingType::Farm) * 2 / 5); else buildingsWanted[BuildingType::IronMine] = - std::min(GetNumBuildings(BuildingType::Farm) / 2, GetNumBuildings(BuildingType::Ironsmelter) + 1); + std::min(getNumBuildings(BuildingType::Farm) / 2, getNumBuildings(BuildingType::Ironsmelter) + 1); buildingsWanted[BuildingType::GoldMine] = - (GetNumBuildings(BuildingType::Mint) > 0) ? - GetNumBuildings(BuildingType::Ironsmelter) > 6 && GetNumBuildings(BuildingType::Mint) > 1 ? - GetNumBuildings(BuildingType::Ironsmelter) > 10 ? 4 : 3 : + (getNumBuildings(BuildingType::Mint) > 0) ? + getNumBuildings(BuildingType::Ironsmelter) > 6 && getNumBuildings(BuildingType::Mint) > 1 ? + getNumBuildings(BuildingType::Ironsmelter) > 10 ? 4 : 3 : 2 : 1; buildingsWanted[BuildingType::DonkeyBreeder] = 1; if(aijh.ggs.isEnabled(AddonId::CHARBURNER) - && (buildingsWanted[BuildingType::CoalMine] > GetNumBuildings(BuildingType::CoalMine) + 4)) + && (buildingsWanted[BuildingType::CoalMine] > getNumBuildings(BuildingType::CoalMine) + 4)) { resourcelimit = inventory.people[Job::CharBurner] + inventory.goods[GoodType::Shovel] + 1; buildingsWanted[BuildingType::Charburner] = std::min( - std::min(buildingsWanted[BuildingType::CoalMine] - (GetNumBuildings(BuildingType::CoalMine) + 1), + std::min(buildingsWanted[BuildingType::CoalMine] - (getNumBuildings(BuildingType::CoalMine) + 1), 3u), resourcelimit); } @@ -329,29 +329,29 @@ void BuildingPlanner::UpdateBuildingsWanted(const AIPlayerJH& aijh) // probably still limited in food supply go up to 4 coal 1 gold 2 iron (gold+coal->coin, // iron+coal->tool, iron+coal+coal->weapon) unsigned numFoodProducers = - GetNumBuildings(BuildingType::Bakery) + GetNumBuildings(BuildingType::Slaughterhouse) - + GetNumBuildings(BuildingType::Hunter) + GetNumBuildings(BuildingType::Fishery); + getNumBuildings(BuildingType::Bakery) + getNumBuildings(BuildingType::Slaughterhouse) + + getNumBuildings(BuildingType::Hunter) + getNumBuildings(BuildingType::Fishery); buildingsWanted[BuildingType::IronMine] = (inventory.people[Job::Miner] + inventory.goods[GoodType::PickAxe] - > GetNumBuildings(BuildingType::CoalMine) + GetNumBuildings(BuildingType::GoldMine) + 1 + > getNumBuildings(BuildingType::CoalMine) + getNumBuildings(BuildingType::GoldMine) + 1 && numFoodProducers > 4) ? 2 : 1; buildingsWanted[BuildingType::GoldMine] = (inventory.people[Job::Miner] > 2) ? 1 : 0; resourcelimit = inventory.people[Job::CharBurner] + inventory.goods[GoodType::Shovel]; if(aijh.ggs.isEnabled(AddonId::CHARBURNER) - && (GetNumBuildings(BuildingType::CoalMine) < 1 - && (GetNumBuildings(BuildingType::IronMine) + GetNumBuildings(BuildingType::GoldMine) > 0))) + && (getNumBuildings(BuildingType::CoalMine) < 1 + && (getNumBuildings(BuildingType::IronMine) + getNumBuildings(BuildingType::GoldMine) > 0))) buildingsWanted[BuildingType::Charburner] = std::min(1, resourcelimit); } - if(GetNumBuildings(BuildingType::Quarry) + 1 < buildingsWanted[BuildingType::Quarry] + if(getNumBuildings(BuildingType::Quarry) + 1 < buildingsWanted[BuildingType::Quarry] && aijh.AmountInStorage(GoodType::Stones) < 100) // no quarry and low stones -> try granitemines. { if(inventory.people[Job::Miner] > 6) { buildingsWanted[BuildingType::GraniteMine] = std::min( numMilitaryBlds / 15 + 1, // limit granite mines to military / 15 - std::max(buildingsWanted[BuildingType::Quarry] - GetNumBuildings(BuildingType::Quarry), 1)); + std::max(buildingsWanted[BuildingType::Quarry] - getNumBuildings(BuildingType::Quarry), 1)); } else buildingsWanted[BuildingType::GraniteMine] = 1; } else @@ -364,30 +364,30 @@ void BuildingPlanner::UpdateBuildingsWanted(const AIPlayerJH& aijh) buildingsWanted[BuildingType::Catapult] = numMilitaryBlds <= 5 || inventory.goods[GoodType::Stones] < 50 ? 0 : - std::min((inventory.goods[GoodType::Stones] - 50) / 4, GetNumBuildings(BuildingType::Catapult) + 4); + std::min((inventory.goods[GoodType::Stones] - 50) / 4, getNumBuildings(BuildingType::Catapult) + 4); } - if(aijh.ggs.GetMaxMilitaryRank() == 0) + if(aijh.ggs.getMaxMilitaryRank() == 0) { buildingsWanted[BuildingType::GoldMine] = 0; // max rank is 0 = private / recruit ==> gold is useless! } } -int BuildingPlanner::GetNumAdditionalBuildingsWanted(BuildingType type) const +int BuildingPlanner::getNumAdditionalBuildingsWanted(BuildingType type) const { - return static_cast(buildingsWanted[type]) - static_cast(GetNumBuildings(type)); + return static_cast(buildingsWanted[type]) - static_cast(getNumBuildings(type)); } bool BuildingPlanner::WantMoreMilitaryBlds(const AIPlayerJH& aijh) const { - if(GetNumMilitaryBldSites() >= GetNumMilitaryBlds() + 3) + if(getNumMilitaryBldSites() >= getNumMilitaryBlds() + 3) return false; if(expansionRequired) return true; - if(GetNumBuildings(BuildingType::Sawmill) > 0) + if(getNumBuildings(BuildingType::Sawmill) > 0) return true; - if(aijh.player.GetInventory().goods[GoodType::Boards] > 30 && GetNumBuildingSites(BuildingType::Sawmill) > 0) + if(aijh.player.getInventory().goods[GoodType::Boards] > 30 && getNumBuildingSites(BuildingType::Sawmill) > 0) return true; - return (GetNumMilitaryBlds() + GetNumMilitaryBldSites() > 0); + return (getNumMilitaryBlds() + getNumMilitaryBldSites() > 0); } } // namespace AIJH diff --git a/libs/s25main/ai/aijh/BuildingPlanner.h b/libs/s25main/ai/aijh/BuildingPlanner.h index ce69039cb5..9491d34dc8 100644 --- a/libs/s25main/ai/aijh/BuildingPlanner.h +++ b/libs/s25main/ai/aijh/BuildingPlanner.h @@ -20,22 +20,22 @@ class BuildingPlanner void Update(unsigned gf, AIPlayerJH& aijh); /// Return the number of buildings and buildingsites of a specific type (refresh with RefreshBuildingCount()) - unsigned GetNumBuildings(BuildingType type) const; + unsigned getNumBuildings(BuildingType type) const; /// Return the number of buildingsites of a specific type (refresh with RefreshBuildingCount()) - unsigned GetNumBuildingSites(BuildingType type) const; + unsigned getNumBuildingSites(BuildingType type) const; /// Get amount of (completed) military buildings - unsigned GetNumMilitaryBlds() const; + unsigned getNumMilitaryBlds() const; /// Get amount of construction sites of military buildings - unsigned GetNumMilitaryBldSites() const; + unsigned getNumMilitaryBldSites() const; void InitBuildingsWanted(const AIPlayerJH& aijh); void UpdateBuildingsWanted(const AIPlayerJH& aijh); /// Return the number of buildings that we want to build of the current type - int GetNumAdditionalBuildingsWanted(BuildingType type) const; + int getNumAdditionalBuildingsWanted(BuildingType type) const; /// Checks whether the ai wants to construct more mil buildings atm bool WantMoreMilitaryBlds(const AIPlayerJH& aijh) const; - bool IsExpansionRequired() const { return expansionRequired; } + bool isExpansionRequired() const { return expansionRequired; } private: /// Number of buildings and building sites of this player (refreshed by RefreshBuildingCount()) diff --git a/libs/s25main/ai/aijh/Jobs.cpp b/libs/s25main/ai/aijh/Jobs.cpp index 16753513a9..25d499511f 100644 --- a/libs/s25main/ai/aijh/Jobs.cpp +++ b/libs/s25main/ai/aijh/Jobs.cpp @@ -23,7 +23,7 @@ AIJob::AIJob(AIPlayerJH& aijh) : aijh(aijh), state(JobState::Waiting) {} void BuildJob::ExecuteJob() { // are we allowed to plan construction work in the area in this nwf? - if(!aijh.GetConstruction().CanStillConstructHere(around)) + if(!aijh.getConstruction().canStillConstructHere(around)) return; if(state == JobState::Waiting) @@ -49,12 +49,12 @@ void BuildJob::ExecuteJob() if(state == JobState::Failed || state == JobState::Finished) return; - if(BuildingProperties::IsMilitary(type) && target.isValid() - && aijh.GetWorld().IsMilitaryBuildingNearNode(target, aijh.GetPlayerId())) + if(BuildingProperties::isMilitary(type) && target.isValid() + && aijh.getWorld().isMilitaryBuildingNearNode(target, aijh.getPlayerId())) { state = JobState::Failed; #ifdef DEBUG_AI - std::cout << "Player " << (unsigned)aijh.GetPlayerId() << ", Job failed: Military building too near for " + std::cout << "Player " << (unsigned)aijh.getPlayerId() << ", Job failed: Military building too near for " << BUILDING_NAMES[type] << " at " << target.x << "/" << target.y << "." << std::endl; #endif return; @@ -63,9 +63,9 @@ void BuildJob::ExecuteJob() void BuildJob::TryToBuild() { - AIConstruction& aiConstruction = aijh.GetConstruction(); + AIConstruction& aiConstruction = aijh.getConstruction(); - if(aijh.GetInterface().GetBuildingSites().size() > 40) + if(aijh.getInterface().getBuildingSites().size() > 40) { return; } @@ -96,34 +96,34 @@ void BuildJob::TryToBuild() if(searchMode == SearchMode::Radius) { foundPos = aijh.FindPositionForBuildingAround(type, around); - if(BuildingProperties::IsMilitary(type)) + if(BuildingProperties::isMilitary(type)) { if(foundPos.isValid()) { // could we build a bigger military building? check if the location is surrounded by terrain that does // not allow normal buildings (probably important map part) - AIInterface& aiInterface = aijh.GetInterface(); - RTTR_Assert(aiInterface.GetBuildingQuality(foundPos) == aijh.GetAINode(foundPos).bq); - if(type != BuildingType::Fortress && aiInterface.GetBuildingQuality(foundPos) != BuildingQuality::Mine - && aiInterface.GetBuildingQuality(foundPos) > BUILDING_SIZE[type] + AIInterface& aiInterface = aijh.getInterface(); + RTTR_Assert(aiInterface.getBuildingQuality(foundPos) == aijh.getAINode(foundPos).bq); + if(type != BuildingType::Fortress && aiInterface.getBuildingQuality(foundPos) != BuildingQuality::Mine + && aiInterface.getBuildingQuality(foundPos) > BUILDING_SIZE[type] && aijh.BQsurroundcheck(foundPos, 6, true, 10) < 10) { // more than 80% is unbuildable in range 7 -> upgrade for(BuildingType bld : BuildingProperties::militaryBldTypes) { - if(BUILDING_SIZE[bld] > BUILDING_SIZE[type] && aiInterface.CanBuildBuildingtype(bld)) + if(BUILDING_SIZE[bld] > BUILDING_SIZE[type] && aiInterface.canBuildBuildingtype(bld)) { type = bld; break; } } } - } else if(aijh.GetBldPlanner().IsExpansionRequired() && BUILDING_SIZE[type] != BuildingQuality::Hut) + } else if(aijh.getBldPlanner().isExpansionRequired() && BUILDING_SIZE[type] != BuildingQuality::Hut) { // Downgrade to the next smaller building for(BuildingType bld : BuildingProperties::militaryBldTypes | boost::adaptors::reversed) { - if(BUILDING_SIZE[bld] < BUILDING_SIZE[type] && aijh.GetInterface().CanBuildBuildingtype(bld)) + if(BUILDING_SIZE[bld] < BUILDING_SIZE[type] && aijh.getInterface().canBuildBuildingtype(bld)) { aijh.AddBuildJob(bld, around); break; @@ -138,7 +138,7 @@ void BuildJob::TryToBuild() { state = JobState::Failed; #ifdef DEBUG_AI - std::cout << "Player " << (unsigned)aijh.GetPlayerId() << ", Job failed: No Position found for " + std::cout << "Player " << (unsigned)aijh.getPlayerId() << ", Job failed: No Position found for " << BUILDING_NAMES[type] << " around " << foundPos << "." << std::endl; #endif return; @@ -146,11 +146,11 @@ void BuildJob::TryToBuild() #ifdef DEBUG_AI if(type == BuildingType::Farm) - std::cout << " Player " << (unsigned)aijh.GetPlayerId() << " built farm at " << foundPos << " on value of " + std::cout << " Player " << (unsigned)aijh.getPlayerId() << " built farm at " << foundPos << " on value of " << aijh.resourceMaps[PLANTSPACE][foundPos] << std::endl; #endif - if(!aijh.GetInterface().SetBuildingSite(foundPos, type)) + if(!aijh.getInterface().SetBuildingSite(foundPos, type)) { state = JobState::Failed; return; @@ -162,55 +162,55 @@ void BuildJob::TryToBuild() void BuildJob::BuildMainRoad() { - AIInterface& aiInterface = aijh.GetInterface(); - const auto* bld = aiInterface.gwb.GetSpecObj(target); + AIInterface& aiInterface = aijh.getInterface(); + const auto* bld = aiInterface.gwb.getSpecObj(target); if(!bld) { // We don't have a building site where it should be. Maybe the BQ has changed due to another object next to it // If so, we update the BQ (TODO: Check if required, shouldn't be) and readd the build job // Note: If the BQ still allows construction it might as well be that the command was not executed yet - BuildingQuality bq = aiInterface.GetBuildingQuality(target); + BuildingQuality bq = aiInterface.getBuildingQuality(target); if(!canUseBq(bq, BUILDING_SIZE[type])) { state = JobState::Failed; #ifdef DEBUG_AI - std::cout << "Player " << (unsigned)aijh.GetPlayerId() << ", Job failed: BQ changed for " + std::cout << "Player " << (unsigned)aijh.getPlayerId() << ", Job failed: BQ changed for " << BUILDING_NAMES[type] << " at " << target.x << "/" << target.y << ". Retrying..." << std::endl; #endif - aijh.GetAINode(target).bq = bq; + aijh.getAINode(target).bq = bq; aijh.AddBuildJob(type, around); } return; } - if(bld->GetBuildingType() != type) + if(bld->getBuildingType() != type) { #ifdef DEBUG_AI - std::cout << "Player " << (unsigned)aijh.GetPlayerId() << ", Job failed: Wrong Builingsite found for " + std::cout << "Player " << (unsigned)aijh.getPlayerId() << ", Job failed: Wrong Builingsite found for " << BUILDING_NAMES[type] << " at " << target.x << "/" << target.y << "." << std::endl; #endif state = JobState::Failed; return; } - const noFlag* houseFlag = bld->GetFlag(); + const noFlag* houseFlag = bld->getFlag(); // Gucken noch nicht ans Wegnetz angeschlossen - AIConstruction& aiConstruction = aijh.GetConstruction(); - if(!aiConstruction.IsConnectedToRoadSystem(houseFlag)) + AIConstruction& aiConstruction = aijh.getConstruction(); + if(!aiConstruction.isConnectedToRoadSystem(houseFlag)) { // Bau unmöglich? if(!aiConstruction.ConnectFlagToRoadSytem(houseFlag, route)) { state = JobState::Failed; #ifdef DEBUG_AI - std::cout << "Player " << (unsigned)aijh.GetPlayerId() << ", Job failed: Cannot connect " + std::cout << "Player " << (unsigned)aijh.getPlayerId() << ", Job failed: Cannot connect " << BUILDING_NAMES[type] << " at " << target.x << "/" << target.y << ". Retrying..." << std::endl; #endif - aijh.GetAINode(target).reachable = false; + aijh.getAINode(target).reachable = false; // We thought this had be reachable, but it is not (might be blocked by building site itself): // It has to be reachable in a check for 20x times, to avoid retrying it too often. - aijh.GetAINode(target).failed_penalty = 20; + aijh.getAINode(target).failed_penalty = 20; aiInterface.DestroyBuilding(target); - aiInterface.DestroyFlag(houseFlag->GetPos()); + aiInterface.DestroyFlag(houseFlag->getPos()); aijh.AddBuildJob(type, around); return; } @@ -224,7 +224,7 @@ void BuildJob::BuildMainRoad() { case BuildingType::Forester: aijh.AddBuildJob(BuildingType::Woodcutter, target); break; case BuildingType::Charburner: - case BuildingType::Farm: aijh.SetFarmedNodes(target, true); break; + case BuildingType::Farm: aijh.setFarmedNodes(target, true); break; case BuildingType::Mill: aijh.AddBuildJob(BuildingType::Bakery, target); break; case BuildingType::PigFarm: aijh.AddBuildJob(BuildingType::Slaughterhouse, target); break; case BuildingType::Bakery: @@ -236,9 +236,9 @@ void BuildJob::BuildMainRoad() // Just 4 Fun Gelehrten rufen if(BUILDING_SIZE[type] == BuildingQuality::Mine) { - aiInterface.CallSpecialist(houseFlag->GetPos(), Job::Geologist); + aiInterface.CallSpecialist(houseFlag->getPos(), Job::Geologist); } - if(!BuildingProperties::IsMilitary(type)) // not a military building? -> build secondary road now + if(!BuildingProperties::isMilitary(type)) // not a military building? -> build secondary road now { state = JobState::ExecutingRoad2; return TryToBuildSecondaryRoad(); @@ -251,21 +251,21 @@ void BuildJob::BuildMainRoad() void BuildJob::TryToBuildSecondaryRoad() { const auto* houseFlag = - aijh.GetWorld().GetSpecObj(aijh.GetWorld().GetNeighbour(target, Direction::SouthEast)); + aijh.getWorld().getSpecObj(aijh.getWorld().getNeighbour(target, Direction::SouthEast)); if(!houseFlag) { // Baustelle wurde wohl zerstört, oh schreck! state = JobState::Failed; #ifdef DEBUG_AI - std::cout << "Player " << (unsigned)aijh.GetPlayerId() << ", Job failed: House flag is gone, " + std::cout << "Player " << (unsigned)aijh.getPlayerId() << ", Job failed: House flag is gone, " << BUILDING_NAMES[type] << " at " << target.x << "/" << target.y << ". Retrying..." << std::endl; #endif aijh.AddBuildJob(type, around); return; } - if(aijh.GetConstruction().BuildAlternativeRoad(houseFlag, route)) + if(aijh.getConstruction().BuildAlternativeRoad(houseFlag, route)) { state = JobState::ExecutingRoad2_2; } else @@ -280,26 +280,26 @@ void EventJob::ExecuteJob() { // for now it is assumed that all these will be finished or failed after execution (no wait or progress) using AIEvent::EventType; - switch(ev->GetType()) + switch(ev->getType()) { case EventType::BuildingConquered: { const auto& evb = *checkedCast(ev.get()); - aijh.HandleNewMilitaryBuildingOccupied(evb.GetPos()); + aijh.HandleNewMilitaryBuildingOccupied(evb.getPos()); state = JobState::Finished; } break; case EventType::BuildingLost: { const auto& evb = *checkedCast(ev.get()); - aijh.HandleMilitaryBuilingLost(evb.GetPos()); + aijh.HandleMilitaryBuilingLost(evb.getPos()); state = JobState::Finished; } break; case EventType::LostLand: { const auto& evb = *checkedCast(ev.get()); - aijh.HandleLostLand(evb.GetPos()); + aijh.HandleLostLand(evb.getPos()); state = JobState::Finished; } break; @@ -307,77 +307,77 @@ void EventJob::ExecuteJob() { // todo maybe do sth about it? const auto& evb = *checkedCast(ev.get()); - aijh.HandleBuilingDestroyed(evb.GetPos(), evb.GetBuildingType()); + aijh.HandleBuilingDestroyed(evb.getPos(), evb.getBuildingType()); state = JobState::Finished; } break; case EventType::NoMoreResourcesReachable: { const auto& evb = *checkedCast(ev.get()); - aijh.HandleNoMoreResourcesReachable(evb.GetPos(), evb.GetBuildingType()); + aijh.HandleNoMoreResourcesReachable(evb.getPos(), evb.getBuildingType()); state = JobState::Finished; } break; case EventType::BorderChanged: { const auto& evb = *checkedCast(ev.get()); - aijh.HandleBorderChanged(evb.GetPos()); + aijh.HandleBorderChanged(evb.getPos()); state = JobState::Finished; } break; case EventType::BuildingFinished: { const auto& evb = *checkedCast(ev.get()); - aijh.HandleBuildingFinished(evb.GetPos(), evb.GetBuildingType()); + aijh.HandleBuildingFinished(evb.getPos(), evb.getBuildingType()); state = JobState::Finished; } break; case EventType::ExpeditionWaiting: { const auto& lvb = *checkedCast(ev.get()); - aijh.HandleExpedition(lvb.GetPos()); + aijh.HandleExpedition(lvb.getPos()); state = JobState::Finished; } break; case EventType::TreeChopped: { const auto& lvb = *checkedCast(ev.get()); - aijh.HandleTreeChopped(lvb.GetPos()); + aijh.HandleTreeChopped(lvb.getPos()); state = JobState::Finished; } break; case EventType::NewColonyFounded: { const auto& lvb = *checkedCast(ev.get()); - aijh.HandleNewColonyFounded(lvb.GetPos()); + aijh.HandleNewColonyFounded(lvb.getPos()); state = JobState::Finished; } break; case EventType::ShipBuilt: { const auto& lvb = *checkedCast(ev.get()); - aijh.HandleShipBuilt(lvb.GetPos()); + aijh.HandleShipBuilt(lvb.getPos()); state = JobState::Finished; } break; case EventType::RoadConstructionComplete: { const auto& dvb = *checkedCast(ev.get()); - aijh.HandleRoadConstructionComplete(dvb.GetPos(), dvb.GetDirection()); + aijh.HandleRoadConstructionComplete(dvb.getPos(), dvb.getDirection()); state = JobState::Finished; } break; case EventType::RoadConstructionFailed: { const auto& dvb = *checkedCast(ev.get()); - aijh.HandleRoadConstructionFailed(dvb.GetPos(), dvb.GetDirection()); + aijh.HandleRoadConstructionFailed(dvb.getPos(), dvb.getDirection()); state = JobState::Finished; } break; case EventType::LuaConstructionOrder: { const auto& evb = *checkedCast(ev.get()); - aijh.ExecuteLuaConstructionOrder(evb.GetPos(), evb.GetBuildingType(), true); + aijh.ExecuteLuaConstructionOrder(evb.getPos(), evb.getBuildingType(), true); state = JobState::Finished; } break; @@ -393,16 +393,16 @@ void EventJob::ExecuteJob() void ConnectJob::ExecuteJob() { #ifdef DEBUG_AI - std::cout << "Player " << (unsigned)aijh.GetPlayerId() << ", ConnectJob executed..." << std::endl; + std::cout << "Player " << (unsigned)aijh.getPlayerId() << ", ConnectJob executed..." << std::endl; #endif // can the ai still construct here? else return and try again later - AIConstruction& construction = aijh.GetConstruction(); - if(!construction.CanStillConstructHere(flagPos)) + AIConstruction& construction = aijh.getConstruction(); + if(!construction.canStillConstructHere(flagPos)) return; - const GameWorldBase& world = aijh.GetWorld(); - const auto* flag = world.GetSpecObj(flagPos); + const GameWorldBase& world = aijh.getWorld(); + const auto* flag = world.getSpecObj(flagPos); if(!flag) { @@ -415,11 +415,11 @@ void ConnectJob::ExecuteJob() // is flag of a military building and has some road connection alraedy (not necessarily to a warehouse so this is // required to avoid multiple connections on mil buildings) - if(world.IsMilitaryBuildingOnNode(world.GetNeighbour(flag->GetPos(), Direction::NorthWest), true)) + if(world.isMilitaryBuildingOnNode(world.getNeighbour(flag->getPos(), Direction::NorthWest), true)) { for(unsigned dir = 2; dir < 7; dir++) { - if(flag->GetRoute(convertToDirection(dir))) + if(flag->getRoute(convertToDirection(dir))) { state = JobState::Finished; return; @@ -428,7 +428,7 @@ void ConnectJob::ExecuteJob() } // already connected? - if(!construction.IsConnectedToRoadSystem(flag)) + if(!construction.isConnectedToRoadSystem(flag)) { #ifdef DEBUG_AI std::cout << "Flag is not connected..." << std::endl; @@ -468,7 +468,7 @@ void SearchJob::ExecuteJob() else { state = JobState::Finished; - aijh.AddBuildJob(search->GetBld(), search->GetResultPt(), true, false); + aijh.AddBuildJob(search->getBld(), search->getResultPt(), true, false); } } diff --git a/libs/s25main/ai/aijh/Jobs.h b/libs/s25main/ai/aijh/Jobs.h index ab4d91d8db..e8ef057e88 100644 --- a/libs/s25main/ai/aijh/Jobs.h +++ b/libs/s25main/ai/aijh/Jobs.h @@ -45,8 +45,8 @@ class AIJob AIJob(AIPlayerJH& aijh); virtual ~AIJob() = default; virtual void ExecuteJob() = 0; - JobState GetState() const { return state; } - void SetState(JobState s) { state = s; } + JobState getState() const { return state; } + void setState(JobState s) { state = s; } protected: AIPlayerJH& aijh; @@ -57,8 +57,8 @@ class JobWithTarget { public: JobWithTarget() : target(MapPoint::Invalid()) {} - MapPoint GetTarget() const { return target; } - void SetTarget(MapPoint newTarget) { target = newTarget; } + MapPoint getTarget() const { return target; } + void setTarget(MapPoint newTarget) { target = newTarget; } protected: MapPoint target; @@ -72,8 +72,8 @@ class BuildJob : public AIJob, public JobWithTarget {} void ExecuteJob() override; - BuildingType GetType() const { return type; } - MapPoint GetAround() const { return around; } + BuildingType getType() const { return type; } + MapPoint getAround() const { return around; } private: BuildingType type; @@ -104,7 +104,7 @@ class EventJob : public AIJob EventJob(AIPlayerJH& aijh, std::unique_ptr ev); ~EventJob() override; void ExecuteJob() override; - const AIEvent::Base& GetEvent() const { return *ev; } + const AIEvent::Base& getEvent() const { return *ev; } private: std::unique_ptr ev; diff --git a/libs/s25main/ai/aijh/PositionSearch.cpp b/libs/s25main/ai/aijh/PositionSearch.cpp index bd1773ff06..3e98265d6d 100644 --- a/libs/s25main/ai/aijh/PositionSearch.cpp +++ b/libs/s25main/ai/aijh/PositionSearch.cpp @@ -12,16 +12,16 @@ AIJH::PositionSearch::PositionSearch(const AIPlayerJH& player, const MapPoint pt searchGlobalOptimum(searchGlobalOptimum), nodesPerStep(25), // TODO: Make it depend on something... resultPt(MapPoint::Invalid()), resultValue(0) { - tested.resize(prodOfComponents(player.GetWorld().GetSize())); + tested.resize(prodOfComponents(player.getWorld().getSize())); // insert start position as first node to test toTest.push(pt); - tested[player.GetWorld().GetIdx(pt)] = true; + tested[player.getWorld().getIdx(pt)] = true; } AIJH::PositionSearchState AIJH::PositionSearch::execute(const AIPlayerJH& player) { - const AIResourceMap& resMap = player.GetResMap(res); + const AIResourceMap& resMap = player.getResMap(res); // make nodesPerStep tests for(int i = 0; i < nodesPerStep; i++) { @@ -32,7 +32,7 @@ AIJH::PositionSearchState AIJH::PositionSearch::execute(const AIPlayerJH& player // get the node MapPoint pt = toTest.front(); toTest.pop(); - const Node& node = player.GetAINode(pt); + const Node& node = player.getAINode(pt); // and test it... TODO exception at res::borderland? if(resMap[pt] > resultValue // value better @@ -46,12 +46,12 @@ AIJH::PositionSearchState AIJH::PositionSearch::execute(const AIPlayerJH& player } // now insert neighbouring nodes... - for(const MapPoint neighbourPt : player.GetWorld().GetNeighbours(pt)) + for(const MapPoint neighbourPt : player.getWorld().getNeighbours(pt)) { - unsigned nIdx = player.GetWorld().GetIdx(neighbourPt); + unsigned nIdx = player.getWorld().getIdx(neighbourPt); // test if already tested or not in territory - if(!tested[nIdx] && player.GetAINode(neighbourPt).owned) + if(!tested[nIdx] && player.getAINode(neighbourPt).owned) { toTest.push(pt); tested[nIdx] = true; diff --git a/libs/s25main/ai/aijh/PositionSearch.h b/libs/s25main/ai/aijh/PositionSearch.h index 4f18c46d25..3ff77100ff 100644 --- a/libs/s25main/ai/aijh/PositionSearch.h +++ b/libs/s25main/ai/aijh/PositionSearch.h @@ -29,8 +29,8 @@ class PositionSearch bool searchGlobalOptimum = false); PositionSearchState execute(const AIPlayerJH& player); - BuildingType GetBld() const { return bld; } - MapPoint GetResultPt() const { return resultPt; } + BuildingType getBld() const { return bld; } + MapPoint getResultPt() const { return resultPt; } private: /// where did the search start? diff --git a/libs/s25main/animation/Animation.cpp b/libs/s25main/animation/Animation.cpp index 8fc50aafc9..789dd3a3e0 100644 --- a/libs/s25main/animation/Animation.cpp +++ b/libs/s25main/animation/Animation.cpp @@ -6,7 +6,7 @@ #include "Window.h" Animation::Animation(Window* element, unsigned numFrames, unsigned frameRate, RepeatType repeat) - : elementId_(element->GetID()), numFrames_(numFrames), frameRate_(frameRate), repeat_(repeat), lastTime_(0), + : elementId_(element->getID()), numFrames_(numFrames), frameRate_(frameRate), repeat_(repeat), lastTime_(0), curFrame_(0), countUp_(true), skipType_(SkipType::Frames), hasStarted_(false) { // We need at least 2 frames: current state and next state @@ -58,7 +58,7 @@ void Animation::execFrame(Window* parent, unsigned remainingTime) { RTTR_Assert(curFrame_ < numFrames_); RTTR_Assert(remainingTime < frameRate_); - auto* element = parent->GetCtrl(elementId_); + auto* element = parent->getCtrl(elementId_); // Element missing -> Done if(!element) { diff --git a/libs/s25main/animation/AnimationManager.cpp b/libs/s25main/animation/AnimationManager.cpp index f296fec1e9..3962590fb5 100644 --- a/libs/s25main/animation/AnimationManager.cpp +++ b/libs/s25main/animation/AnimationManager.cpp @@ -11,7 +11,7 @@ AnimationManager::AnimationManager(Window* parent) : parent_(parent) { // Use a start id based on the parent id to detect calls to wrong animation managers - nextId_ = parent->GetID() << 16; + nextId_ = parent->getID() << 16; } AnimationManager::~AnimationManager() @@ -42,7 +42,7 @@ unsigned AnimationManager::addAnimation(Animation* animation) if(getAnimationId(animation) != 0u) return 0u; // The element must be inside the parernt - RTTR_Assert(parent_->GetCtrl(animation->getElementId())); + RTTR_Assert(parent_->getCtrl(animation->getElementId())); // Make the id non-zero if(!nextId_) nextId_ = 1; diff --git a/libs/s25main/animation/BlinkButtonAnim.cpp b/libs/s25main/animation/BlinkButtonAnim.cpp index ed00453983..2ef77d327f 100644 --- a/libs/s25main/animation/BlinkButtonAnim.cpp +++ b/libs/s25main/animation/BlinkButtonAnim.cpp @@ -6,5 +6,5 @@ #include "controls/ctrlButton.h" BlinkButtonAnim::BlinkButtonAnim(ctrlButton* element, bool startValue, unsigned frameRate, RepeatType repeat) - : ToggleAnimation(element, &ctrlButton::SetIlluminated, startValue, frameRate, repeat) + : ToggleAnimation(element, &ctrlButton::setIlluminated, startValue, frameRate, repeat) {} diff --git a/libs/s25main/animation/MoveAnimation.cpp b/libs/s25main/animation/MoveAnimation.cpp index 2abe143fc6..70953b10b2 100644 --- a/libs/s25main/animation/MoveAnimation.cpp +++ b/libs/s25main/animation/MoveAnimation.cpp @@ -9,7 +9,7 @@ #include MoveAnimation::MoveAnimation(Window* element, DrawPoint newPos, unsigned animTime, RepeatType repeat) - : Animation(element, 2, animTime, repeat), origPos_(element->GetPos()), newPos_(newPos) + : Animation(element, 2, animTime, repeat), origPos_(element->getPos()), newPos_(newPos) { Point diff(newPos_ - origPos_); diff = elMax(Point::all(1), diff); // Avoid division by zero @@ -33,5 +33,5 @@ void MoveAnimation::doUpdate(Window* element, double nextFramepartTime) DrawPoint curDiffInt; curDiffInt.x = std::lround(curDiff.x); curDiffInt.y = std::lround(curDiff.y); - element->SetPos(curDiffInt + origPos_); + element->setPos(curDiffInt + origPos_); } diff --git a/libs/s25main/buildings/BurnedWarehouse.cpp b/libs/s25main/buildings/BurnedWarehouse.cpp index bc0603c29d..0f98a4ba38 100644 --- a/libs/s25main/buildings/BurnedWarehouse.cpp +++ b/libs/s25main/buildings/BurnedWarehouse.cpp @@ -23,14 +23,14 @@ BurnedWarehouse::BurnedWarehouse(const MapPoint pos, const unsigned char player, : noCoordBase(NodalObjectType::BurnedWarehouse, pos), player(player), go_out_phase(0), people(people) { // First event - GetEvMgr().AddEvent(this, PHASE_LENGTH, 0); + getEvMgr().AddEvent(this, PHASE_LENGTH, 0); } BurnedWarehouse::BurnedWarehouse(SerializedGameData& sgd, const unsigned obj_id) : noCoordBase(sgd, obj_id), player(sgd.PopUnsignedChar()), go_out_phase(sgd.PopUnsignedInt()) { helpers::popContainer(sgd, people.people); - if(sgd.GetGameDataVersion() >= 12) + if(sgd.getGameDataVersion() >= 12) helpers::popContainer(sgd, people.armoredSoldiers); else std::fill(people.armoredSoldiers.begin(), people.armoredSoldiers.end(), 0); @@ -62,15 +62,15 @@ void BurnedWarehouse::HandleEvent(const unsigned /*id*/) PathConditionHuman pathChecker(*world); for(const auto dir : helpers::EnumRange{}) { - if(pathChecker.IsNodeOk(world->GetNeighbour(pos, dir))) + if(pathChecker.isNodeOk(world->getNeighbour(pos, dir))) possibleDirs.push_back(dir); } if(possibleDirs.empty()) { // No way out for figures -> all die and we can remove this object - GetEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); - auto& currentPlayer = world->GetPlayer(player); + getEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); + auto& currentPlayer = world->getPlayer(player); for(const auto i : helpers::enumRange()) currentPlayer.DecreaseInventoryJob(i, people[i]); for(const auto i : helpers::enumRange()) @@ -114,11 +114,11 @@ void BurnedWarehouse::HandleEvent(const unsigned /*id*/) auto const armoredSoldier = jobEnumToAmoredSoldierEnum(job); if(people[armoredSoldier] > 0) { - figure.SetArmor(true); + figure.setArmor(true); people[armoredSoldier]--; } } - figure.StartWandering(GetObjId()); + figure.StartWandering(getObjId()); figure.StartWalking(curDir); } } @@ -129,12 +129,12 @@ void BurnedWarehouse::HandleEvent(const unsigned /*id*/) if(go_out_phase == GO_OUT_PHASES) { // All done - GetEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); + getEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); // There shouldn't be any more for(unsigned int num : people.people) RTTR_Assert(num == 0); for(unsigned int num : people.armoredSoldiers) RTTR_Assert(num == 0); } else // Not done yet - GetEvMgr().AddEvent(this, PHASE_LENGTH, 0); + getEvMgr().AddEvent(this, PHASE_LENGTH, 0); } diff --git a/libs/s25main/buildings/BurnedWarehouse.h b/libs/s25main/buildings/BurnedWarehouse.h index f83d93bd53..e897e96e87 100644 --- a/libs/s25main/buildings/BurnedWarehouse.h +++ b/libs/s25main/buildings/BurnedWarehouse.h @@ -20,7 +20,7 @@ class BurnedWarehouse : public noCoordBase void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Burnedwarehouse; } + GO_Type getGOT() const final { return GO_Type::Burnedwarehouse; } /// Benachrichtigen, wenn neuer GF erreicht wurde. void HandleEvent(unsigned id) override; diff --git a/libs/s25main/buildings/noBaseBuilding.cpp b/libs/s25main/buildings/noBaseBuilding.cpp index a184f2f17f..ab6646ae78 100644 --- a/libs/s25main/buildings/noBaseBuilding.cpp +++ b/libs/s25main/buildings/noBaseBuilding.cpp @@ -22,49 +22,49 @@ noBaseBuilding::noBaseBuilding(const NodalObjectType nop, const BuildingType type, const MapPoint pos, const unsigned char player) - : noRoadNode(nop, pos, player), bldType_(type), nation(world->GetPlayer(player).nation), door_point_x(1000000), - door_point_y(DOOR_CONSTS[world->GetPlayer(player).nation][type]) + : noRoadNode(nop, pos, player), bldType_(type), nation(world->getPlayer(player).nation), door_point_x(1000000), + door_point_y(DOOR_CONSTS[world->getPlayer(player).nation][type]) { - MapPoint flagPt = GetFlagPos(); + MapPoint flagPt = getFlagPos(); // Evtl Flagge setzen, wenn noch keine da ist - if(world->GetNO(flagPt)->GetType() != NodalObjectType::Flag) + if(world->getNO(flagPt)->getType() != NodalObjectType::Flag) { world->DestroyNO(flagPt, false); - world->SetNO(flagPt, new noFlag(flagPt, player)); + world->setNO(flagPt, new noFlag(flagPt, player)); } // Straßeneingang setzen (wenn nicht schon vorhanden z.b. durch vorherige Baustelle!) - if(world->GetPointRoad(pos, Direction::SouthEast) == PointRoad::None) + if(world->getPointRoad(pos, Direction::SouthEast) == PointRoad::None) { - world->SetPointRoad(pos, Direction::SouthEast, PointRoad::Normal); + world->setPointRoad(pos, Direction::SouthEast, PointRoad::Normal); // Straßenverbindung erstellen zwischen Flagge und Haus // immer von Flagge ZU Gebäude (!) std::vector route(1, Direction::NorthWest); // Straße zuweisen - auto* rs = new RoadSegment(RoadType::Normal, world->GetSpecObj(flagPt), this, route); - world->GetSpecObj(flagPt)->SetRoute(Direction::NorthWest, rs); // der Flagge - SetRoute(Direction::SouthEast, rs); // dem Gebäude + auto* rs = new RoadSegment(RoadType::Normal, world->getSpecObj(flagPt), this, route); + world->getSpecObj(flagPt)->setRoute(Direction::NorthWest, rs); // der Flagge + setRoute(Direction::SouthEast, rs); // dem Gebäude } else { // vorhandene Straße der Flagge nutzen - auto* flag = world->GetSpecObj(flagPt); + auto* flag = world->getSpecObj(flagPt); - RTTR_Assert(flag->GetRoute(Direction::NorthWest)); - SetRoute(Direction::SouthEast, flag->GetRoute(Direction::NorthWest)); - GetRoute(Direction::SouthEast)->SetF2(this); + RTTR_Assert(flag->getRoute(Direction::NorthWest)); + setRoute(Direction::SouthEast, flag->getRoute(Direction::NorthWest)); + getRoute(Direction::SouthEast)->setF2(this); } // Werde/Bin ich (mal) ein großes Schloss? Dann müssen die Anbauten gesetzt werden - if(GetSize() == BuildingQuality::Castle || GetSize() == BuildingQuality::Harbor) + if(getSize() == BuildingQuality::Castle || getSize() == BuildingQuality::Harbor) { for(const Direction i : {Direction::West, Direction::NorthWest, Direction::NorthEast}) { - const MapPoint neighbor = world->GetNeighbour(pos, i); + const MapPoint neighbor = world->getNeighbour(pos, i); if(type == BuildingType::Headquarters) { - const NodalObjectType neighborNoType = world->GetNO(neighbor)->GetType(); + const NodalObjectType neighborNoType = world->getNO(neighbor)->getType(); // Don't replace nearby static objects or trees. Needed for "build headquarters" cheat to work like in // the original. This situation shouldn't happen any other way (can't normally build big buildings right // next to static objects or trees). Trees which be remain because of this will be replaced by @@ -74,7 +74,7 @@ noBaseBuilding::noBaseBuilding(const NodalObjectType nop, const BuildingType typ } world->DestroyNO(neighbor, false); - world->SetNO(neighbor, new noExtension(this)); + world->setNO(neighbor, new noExtension(this)); } } } @@ -84,21 +84,21 @@ noBaseBuilding::~noBaseBuilding() = default; void noBaseBuilding::Destroy() { DestroyAllRoads(); - world->GetNotifications().publish(BuildingNote(BuildingNote::Destroyed, player, pos, bldType_)); + world->getNotifications().publish(BuildingNote(BuildingNote::Destroyed, player, pos, bldType_)); - if(world->GetGameInterface()) - world->GetGameInterface()->GI_UpdateMinimap(pos); + if(world->getGameInterface()) + world->getGameInterface()->GI_UpdateMinimap(pos); // evtl Anbauten wieder abreißen DestroyBuildingExtensions(); // Baukosten zurückerstatten (nicht bei Baustellen) - const GlobalGameSettings& settings = world->GetGGS(); - if((GetGOT() != GO_Type::Buildingsite) + const GlobalGameSettings& settings = world->getGGS(); + if((getGOT() != GO_Type::Buildingsite) && (settings.isEnabled(AddonId::REFUND_MATERIALS) || settings.isEnabled(AddonId::REFUND_ON_EMERGENCY))) { // lebt unsere Flagge noch? - noFlag* flag = GetFlag(); + noFlag* flag = getFlag(); if(flag) { unsigned percent_index = 0; @@ -107,7 +107,7 @@ void noBaseBuilding::Destroy() if(settings.isEnabled(AddonId::REFUND_MATERIALS)) percent_index = settings.getSelection(AddonId::REFUND_MATERIALS); // wenn Rückerstattung bei Notprogramm aktiv ist, 50% zurückerstatten - else if(world->GetPlayer(player).hasEmergency() && settings.isEnabled(AddonId::REFUND_ON_EMERGENCY)) + else if(world->getPlayer(player).hasEmergency() && settings.isEnabled(AddonId::REFUND_ON_EMERGENCY)) percent_index = 2; // wieviel kriegt man von jeder Ware wieder? @@ -120,7 +120,7 @@ void noBaseBuilding::Destroy() std::array goods = {GoodType::Boards, GoodType::Stones}; bool which = false; - while(flag->HasSpaceForWare() && (boards > 0 || stones > 0)) + while(flag->hasSpaceForWare() && (boards > 0 || stones > 0)) { if((!which && boards > 0) || (which && stones > 0)) { @@ -128,9 +128,9 @@ void noBaseBuilding::Destroy() auto ware = std::make_unique(goods[which], nullptr, flag); ware->WaitAtFlag(*flag); // Inventur anpassen - world->GetPlayer(player).IncreaseInventoryWare(goods[which], 1); + world->getPlayer(player).IncreaseInventoryWare(goods[which], 1); // Abnehmer für Ware finden - ware->SetGoal(world->GetPlayer(player).FindClientForWare(*ware)); + ware->setGoal(world->getPlayer(player).FindClientForWare(*ware)); // Ware soll ihren weiteren Weg berechnen ware->RecalcRoute(); // Ware ablegen @@ -165,7 +165,7 @@ noBaseBuilding::noBaseBuilding(SerializedGameData& sgd, const unsigned obj_id) door_point_x(sgd.PopSignedInt()), door_point_y(sgd.PopSignedInt()) {} -int noBaseBuilding::GetDoorPointX() +int noBaseBuilding::getDoorPointX() { // Did we calculate the door point yet? if(door_point_x == 1000000) @@ -173,14 +173,14 @@ int noBaseBuilding::GetDoorPointX() // The door is on the line between the building and flag point. The position of the line is set by the y-offset // this is why we need the x-offset here according to the equation x = m*y + n // with n=0 (as door point is relative to building pos) and m = dx/dy - const Position bldPos = world->GetNodePos(pos); - const Position flagPos = world->GetNodePos(GetFlagPos()); + const Position bldPos = world->getNodePos(pos); + const Position flagPos = world->getNodePos(getFlagPos()); Position diff = flagPos - bldPos; // We could have crossed the map border which results in unreasonable diffs // clamp the diff to [-w/2,w/2],[-h/2, h/2] (maximum diffs) - const int mapWidth = world->GetWidth() * TR_W; - const int mapHeight = world->GetHeight() * TR_H; + const int mapWidth = world->getWidth() * TR_W; + const int mapHeight = world->getHeight() * TR_H; if(diff.x < -mapWidth / 2) diff.x += mapWidth; @@ -197,23 +197,23 @@ int noBaseBuilding::GetDoorPointX() return door_point_x; } -noFlag* noBaseBuilding::GetFlag() const +noFlag* noBaseBuilding::getFlag() const { - return world->GetSpecObj(GetFlagPos()); + return world->getSpecObj(getFlagPos()); } -MapPoint noBaseBuilding::GetFlagPos() const +MapPoint noBaseBuilding::getFlagPos() const { - return world->GetNeighbour(pos, Direction::SouthEast); + return world->getNeighbour(pos, Direction::SouthEast); } -bool noBaseBuilding::IsConnected() const +bool noBaseBuilding::isConnected() const { // Harbors are always considered connected via sea - if(GetBuildingType() == BuildingType::HarborBuilding) + if(getBuildingType() == BuildingType::HarborBuilding) return true; - const helpers::EnumArray& routes = GetFlag()->getRoutes(); + const helpers::EnumArray& routes = getFlag()->getRoutes(); // Check paths in all directions except back to building for(const auto dir : helpers::EnumRange{}) { @@ -233,11 +233,11 @@ void noBaseBuilding::WareNotNeeded(Ware* ware) return; } - if(ware->IsWaitingInWarehouse()) + if(ware->isWaitingInWarehouse()) { // Bestellung im Lagerhaus stornieren - world->GetPlayer(player).RemoveWare(*ware); - static_cast(ware->GetLocation())->CancelWare(ware); + world->getPlayer(player).RemoveWare(*ware); + static_cast(ware->getLocation())->cancelWare(ware); } else ware->GoalDestroyed(); } @@ -245,40 +245,40 @@ void noBaseBuilding::WareNotNeeded(Ware* ware) void noBaseBuilding::DestroyBuildingExtensions() { // Nur bei großen Gebäuden gibts diese Anbauten - if(GetSize() == BuildingQuality::Castle || GetSize() == BuildingQuality::Harbor) + if(getSize() == BuildingQuality::Castle || getSize() == BuildingQuality::Harbor) { for(const Direction i : {Direction::West, Direction::NorthWest, Direction::NorthEast}) { - const MapPoint neighbor = world->GetNeighbour(pos, i); - if(world->GetNO(neighbor)->GetType() == NodalObjectType::Extension) + const MapPoint neighbor = world->getNeighbour(pos, i); + if(world->getNO(neighbor)->getType() == NodalObjectType::Extension) world->DestroyNO(neighbor); } } } -BuildingQuality noBaseBuilding::GetSize() const +BuildingQuality noBaseBuilding::getSize() const { return BUILDING_SIZE[bldType_]; } -BlockingManner noBaseBuilding::GetBM() const +BlockingManner noBaseBuilding::getBM() const { return BlockingManner::Building; } /// Gibt ein Bild zurück für das normale Gebäude -ITexture& noBaseBuilding::GetBuildingImage() const +ITexture& noBaseBuilding::getBuildingImage() const { - return GetBuildingImage(bldType_, nation); + return getBuildingImage(bldType_, nation); } -ITexture& noBaseBuilding::GetBuildingImage(BuildingType type, Nation nation) //-V688 +ITexture& noBaseBuilding::getBuildingImage(BuildingType type, Nation nation) //-V688 { return LOADER.building_cache[nation][type].building; } /// Gibt ein Bild zurück für die Tür des Gebäudes -ITexture& noBaseBuilding::GetDoorImage() const +ITexture& noBaseBuilding::getDoorImage() const { return LOADER.building_cache[nation][bldType_].door; } diff --git a/libs/s25main/buildings/noBaseBuilding.h b/libs/s25main/buildings/noBaseBuilding.h index d4323a591d..49f5013f38 100644 --- a/libs/s25main/buildings/noBaseBuilding.h +++ b/libs/s25main/buildings/noBaseBuilding.h @@ -45,26 +45,26 @@ class noBaseBuilding : public noRoadNode /// Eine bestellte Ware konnte doch nicht kommen virtual void WareLost(Ware& ware) = 0; - BuildingQuality GetSize() const; - BuildingType GetBuildingType() const { return bldType_; } - Nation GetNation() const { return nation; } - BlockingManner GetBM() const override; + BuildingQuality getSize() const; + BuildingType getBuildingType() const { return bldType_; } + Nation getNation() const { return nation; } + BlockingManner getBM() const override; /// Return the radius in which this building holds land - virtual unsigned GetMilitaryRadius() const = 0; + virtual unsigned getMilitaryRadius() const = 0; /// Ermittelt die Flagge, die vor dem Gebäude steht - noFlag* GetFlag() const; + noFlag* getFlag() const; /// Same as GetFlag()->GetPos() - MapPoint GetFlagPos() const; + MapPoint getFlagPos() const; /// Is the building (flag) connected to anything? - bool IsConnected() const; + bool isConnected() const; /// Return the offset of the door, which is also where people disappear into the building, the builder is building /// and the wares are lying - Position GetDoorPoint() { return Position(GetDoorPointX(), GetDoorPointY()); } - int GetDoorPointX(); - int GetDoorPointY() const { return door_point_y; } + Position getDoorPoint() { return Position(getDoorPointX(), getDoorPointY()); } + int getDoorPointX(); + int getDoorPointY() const { return door_point_y; } /*/// Gibt die Warenverteilungspunkte zurück (bei 0 wurde kein Weg gefunden) virtual unsigned CalcDistributionPoints(noRoadNode * start,const GoodType type) = 0;*/ @@ -74,8 +74,8 @@ class noBaseBuilding : public noRoadNode virtual void GotWorker(Job /*job*/, noFigure& /*worker*/){}; /// Gibt ein Bild zurück für das normale Gebäude - ITexture& GetBuildingImage() const; - static ITexture& GetBuildingImage(BuildingType type, Nation nation); + ITexture& getBuildingImage() const; + static ITexture& getBuildingImage(BuildingType type, Nation nation); /// Gibt ein Bild zurück für die Tür des Gebäudes - ITexture& GetDoorImage() const; + ITexture& getDoorImage() const; }; diff --git a/libs/s25main/buildings/noBuilding.cpp b/libs/s25main/buildings/noBuilding.cpp index fd19d45652..ab83f22379 100644 --- a/libs/s25main/buildings/noBuilding.cpp +++ b/libs/s25main/buildings/noBuilding.cpp @@ -20,8 +20,8 @@ void noBuilding::Destroy() { // First we have to remove the building from the map and the player // Replace by fire (huts and mines become small fire, rest big) - world->SetNO(pos, new noFire(pos, GetSize() != BuildingQuality::Hut && GetSize() != BuildingQuality::Mine), true); - world->GetPlayer(player).RemoveBuilding(this, bldType_); + world->setNO(pos, new noFire(pos, getSize() != BuildingQuality::Hut && getSize() != BuildingQuality::Mine), true); + world->getPlayer(player).RemoveBuilding(this, bldType_); // Destroy derived buildings DestroyBuilding(); // Then go further down the chain @@ -47,15 +47,15 @@ noBuilding::noBuilding(SerializedGameData& sgd, const unsigned obj_id) void noBuilding::DrawBaseBuilding(DrawPoint drawPt) const { - GetBuildingImage().DrawFull(drawPt); + getBuildingImage().DrawFull(drawPt); DrawDoor(drawPt); } void noBuilding::DrawDoor(DrawPoint drawPt) const { - if(!IsDoorOpen()) + if(!isDoorOpen()) return; - GetDoorImage().DrawFull(drawPt); + getDoorImage().DrawFull(drawPt); } void noBuilding::OpenDoor() @@ -65,7 +65,7 @@ void noBuilding::OpenDoor() void noBuilding::CloseDoor() { - RTTR_Assert(IsDoorOpen()); + RTTR_Assert(isDoorOpen()); --opendoor; } diff --git a/libs/s25main/buildings/noBuilding.h b/libs/s25main/buildings/noBuilding.h index 25066cac99..491ce2ffc6 100644 --- a/libs/s25main/buildings/noBuilding.h +++ b/libs/s25main/buildings/noBuilding.h @@ -31,7 +31,7 @@ class noBuilding : public noBaseBuilding void OpenDoor(); void CloseDoor(); - bool IsDoorOpen() const { return opendoor > 0; } + bool isDoorOpen() const { return opendoor > 0; } /// Wird aufgerufen, wenn von der Fahne vor dem Gebäude ein Rohstoff aufgenommen wurde virtual bool FreePlaceAtFlag() = 0; diff --git a/libs/s25main/buildings/noBuildingSite.cpp b/libs/s25main/buildings/noBuildingSite.cpp index 621a630008..9285a9eff8 100644 --- a/libs/s25main/buildings/noBuildingSite.cpp +++ b/libs/s25main/buildings/noBuildingSite.cpp @@ -25,11 +25,11 @@ noBuildingSite::noBuildingSite(const BuildingType type, const MapPoint pos, cons planer(nullptr), builder(nullptr), boards(0), stones(0), used_boards(0), used_stones(0), build_progress(0) { // Überprüfen, ob die Baustelle erst noch planiert werden muss (nur bei mittleren/großen Gebäuden) - if(GetSize() == BuildingQuality::House || GetSize() == BuildingQuality::Castle - || GetSize() == BuildingQuality::Harbor) + if(getSize() == BuildingQuality::House || getSize() == BuildingQuality::Castle + || getSize() == BuildingQuality::Harbor) { // Höhe auf dem Punkt, wo die Baustelle steht - int altitude = world->GetNode(pos).altitude; + int altitude = world->getNode(pos).altitude; for(const auto dir : helpers::EnumRange{}) { @@ -37,20 +37,20 @@ noBuildingSite::noBuildingSite(const BuildingType type, const MapPoint pos, cons if(dir != Direction::SouthEast) { // Gibt es da Differenzen? - if(altitude - world->GetNeighbourNode(pos, dir).altitude != 0) + if(altitude - world->getNeighbourNode(pos, dir).altitude != 0) state = BuildingSiteState::Planing; } } } // Wir hätten gerne einen Planierer/Bauarbeiter... - world->GetPlayer(player).AddJobWanted((state == BuildingSiteState::Planing) ? Job::Planer : Job::Builder, this); + world->getPlayer(player).AddJobWanted((state == BuildingSiteState::Planing) ? Job::Planer : Job::Builder, this); // Bauwaren anfordern OrderConstructionMaterial(); // Baustelle in den Index eintragen, damit die Wirtschaft auch Bescheid weiß - world->GetPlayer(player).AddBuildingSite(this); + world->getPlayer(player).AddBuildingSite(this); } /// Konstruktor für Hafenbaustellen vom Schiff aus @@ -59,7 +59,7 @@ noBuildingSite::noBuildingSite(const MapPoint pos, const unsigned char player) state(BuildingSiteState::Building), planer(nullptr), boards(BUILDING_COSTS[BuildingType::HarborBuilding].boards), stones(BUILDING_COSTS[BuildingType::HarborBuilding].stones), used_boards(0), used_stones(0), build_progress(0) { - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); // Baustelle in den Index eintragen, damit die Wirtschaft auch Bescheid weiß owner.AddBuildingSite(this); // Bauarbeiter auch auf der Karte auftragen @@ -84,7 +84,7 @@ void noBuildingSite::Destroy() planer->LostWork(); planer = nullptr; } else - world->GetPlayer(player).JobNotWanted(this); + world->getPlayer(player).JobNotWanted(this); RTTR_Assert(!builder); RTTR_Assert(!planer); @@ -98,11 +98,11 @@ void noBuildingSite::Destroy() ordered_stones.clear(); // und Feld wird leer - world->SetNO(pos, nullptr); + world->setNO(pos, nullptr); // Baustelle wieder aus der Liste entfernen - dont forget about expedition harbor status - bool expeditionharbor = IsHarborBuildingSiteFromSea(); - world->GetPlayer(player).RemoveBuildingSite(this); + bool expeditionharbor = isHarborBuildingSiteFromSea(); + world->getPlayer(player).RemoveBuildingSite(this); noBaseBuilding::Destroy(); @@ -149,11 +149,11 @@ void noBuildingSite::OrderConstructionMaterial() return; // Optimization: return early if building is isolated - if(!IsConnected()) + if(!isConnected()) return; // Bretter - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); for(int i = used_boards + boards + ordered_boards.size(); i < BUILDING_COSTS[bldType_].boards; ++i) { Ware* w = owner.OrderWare(GoodType::Boards, *this); @@ -171,7 +171,7 @@ void noBuildingSite::OrderConstructionMaterial() } } -unsigned noBuildingSite::GetMilitaryRadius() const +unsigned noBuildingSite::getMilitaryRadius() const { /// Note: This actually only applies to harbor buildings made from expeditions. We rely on the calling functions to /// only take those into account @@ -183,23 +183,23 @@ void noBuildingSite::Draw(DrawPoint drawPt) if(state == BuildingSiteState::Planing) { // Baustellenschild mit Schatten zeichnen - LOADER.GetNationImage(world->GetPlayer(player).nation, 450)->DrawFull(drawPt); - LOADER.GetNationImage(world->GetPlayer(player).nation, 451)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getNationImage(world->getPlayer(player).nation, 450)->DrawFull(drawPt); + LOADER.getNationImage(world->getPlayer(player).nation, 451)->DrawFull(drawPt, COLOR_SHADOW); } else { // Baustellenstein und -schatten zeichnen - LOADER.GetNationImage(world->GetPlayer(player).nation, 455)->DrawFull(drawPt); - LOADER.GetNationImage(world->GetPlayer(player).nation, 456)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getNationImage(world->getPlayer(player).nation, 455)->DrawFull(drawPt); + LOADER.getNationImage(world->getPlayer(player).nation, 456)->DrawFull(drawPt, COLOR_SHADOW); // Waren auf der Baustelle // Bretter - DrawPoint doorPos = drawPt + DrawPoint(GetDoorPointX(), GetDoorPointY()); + DrawPoint doorPos = drawPt + DrawPoint(getDoorPointX(), getDoorPointY()); for(unsigned char i = 0; i < boards; ++i) - LOADER.GetWareStackTex(GoodType::Boards)->DrawFull(doorPos - DrawPoint(5, 10 + i * 4)); + LOADER.getWareStackTex(GoodType::Boards)->DrawFull(doorPos - DrawPoint(5, 10 + i * 4)); // Steine for(unsigned char i = 0; i < stones; ++i) - LOADER.GetWareStackTex(GoodType::Stones)->DrawFull(doorPos + DrawPoint(8, -12 - i * 4)); + LOADER.getWareStackTex(GoodType::Stones)->DrawFull(doorPos + DrawPoint(8, -12 - i * 4)); // bis dahin gebautes Haus zeichnen @@ -238,11 +238,11 @@ void noBuildingSite::GotWorker(Job /*job*/, noFigure& worker) // Aha, wir haben nen Planierer/Bauarbeiter bekommen if(state == BuildingSiteState::Planing) { - RTTR_Assert(worker.GetGOT() == GO_Type::NofPlaner); + RTTR_Assert(worker.getGOT() == GO_Type::NofPlaner); planer = static_cast(&worker); } else { - RTTR_Assert(worker.GetGOT() == GO_Type::NofBuilder); + RTTR_Assert(worker.getGOT() == GO_Type::NofBuilder); builder = static_cast(&worker); } } @@ -252,7 +252,7 @@ void noBuildingSite::Abrogate() planer = nullptr; builder = nullptr; - world->GetPlayer(player).AddJobWanted((state == BuildingSiteState::Planing) ? Job::Planer : Job::Builder, this); + world->getPlayer(player).AddJobWanted((state == BuildingSiteState::Planing) ? Job::Planer : Job::Builder, this); } unsigned noBuildingSite::CalcDistributionPoints(const GoodType goodtype) @@ -285,7 +285,7 @@ unsigned noBuildingSite::CalcDistributionPoints(const GoodType goodtype) points -= (BUILDING_COSTS[bldType_].stones - curStones) * 20; // Baupriorität mit einberechnen (niedriger = höhere Priorität, daher - !) - const unsigned buildingSitePrio = world->GetPlayer(player).GetBuidingSitePriority(this) * 30; + const unsigned buildingSitePrio = world->getPlayer(player).getBuidingSitePriority(this) * 30; if(points > buildingSitePrio) points -= buildingSitePrio; @@ -315,8 +315,8 @@ void noBuildingSite::AddWare(std::unique_ptr ware) throw std::logic_error("Wrong ware type " + helpers::toString(ware->type)); // Inventur entsprechend verringern - world->GetPlayer(player).DecreaseInventoryWare(ware->type, 1); - world->GetPlayer(player).RemoveWare(*ware); + world->getPlayer(player).DecreaseInventoryWare(ware->type, 1); + world->getPlayer(player).RemoveWare(*ware); } void noBuildingSite::WareLost(Ware& ware) @@ -354,12 +354,12 @@ void noBuildingSite::TakeWare(Ware* ware) throw std::logic_error("Wrong ware type " + helpers::toString(ware->type)); } -bool noBuildingSite::IsBuildingComplete() +bool noBuildingSite::isBuildingComplete() { return (build_progress == BUILDING_COSTS[bldType_].boards * 8 + BUILDING_COSTS[bldType_].stones * 8); } -unsigned char noBuildingSite::GetBuildProgress(bool percent) const +unsigned char noBuildingSite::getBuildProgress(bool percent) const { if(!percent) return build_progress; @@ -378,17 +378,17 @@ void noBuildingSite::PlaningFinished() planer = nullptr; // Wir hätten gerne einen Bauarbeiter... - world->GetPlayer(player).AddJobWanted(Job::Builder, this); + world->getPlayer(player).AddJobWanted(Job::Builder, this); // Bauwaren anfordern OrderConstructionMaterial(); } /// Gibt zurück, ob eine bestimmte Baustellen eine Baustelle ist, die vom Schiff aus errichtet wurde -bool noBuildingSite::IsHarborBuildingSiteFromSea() const +bool noBuildingSite::isHarborBuildingSiteFromSea() const { if(this->bldType_ == BuildingType::HarborBuilding) - return world->IsHarborBuildingSiteFromSea(this); + return world->isHarborBuildingSiteFromSea(this); else return false; } diff --git a/libs/s25main/buildings/noBuildingSite.h b/libs/s25main/buildings/noBuildingSite.h index 2b98cd67a3..41512d21cc 100644 --- a/libs/s25main/buildings/noBuildingSite.h +++ b/libs/s25main/buildings/noBuildingSite.h @@ -59,8 +59,8 @@ class noBuildingSite : public noBaseBuilding void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Buildingsite; } - unsigned GetMilitaryRadius() const override; + GO_Type getGOT() const final { return GO_Type::Buildingsite; } + unsigned getMilitaryRadius() const override; void Draw(DrawPoint drawPt) override; @@ -77,17 +77,17 @@ class noBuildingSite : public noBaseBuilding /// Eine bestellte Ware konnte doch nicht kommen void WareLost(Ware& ware) override; /// Gibt den Bau-Fortschritt zurück - unsigned char GetBuildProgress(bool percent = true) const; + unsigned char getBuildProgress(bool percent = true) const; unsigned CalcDistributionPoints(GoodType goodtype); /// Wird aufgerufen, wenn eine neue Ware zum dem Gebäude geliefert wird (nicht wenn sie bestellt wurde vom Gebäude!) void TakeWare(Ware* ware) override; /// Gibt zurück, ob die Baustelle fertiggestellt ist - bool IsBuildingComplete(); + bool isBuildingComplete(); /// Aufgerufen, wenn Planierung beendet wurde void PlaningFinished(); /// Gibt zurück, ob eine bestimmte Baustellen eine Baustelle ist, die vom Schiff aus errichtet wurde - bool IsHarborBuildingSiteFromSea() const; + bool isHarborBuildingSiteFromSea() const; }; diff --git a/libs/s25main/buildings/nobBaseMilitary.cpp b/libs/s25main/buildings/nobBaseMilitary.cpp index 85ddec8343..8d701f54bb 100644 --- a/libs/s25main/buildings/nobBaseMilitary.cpp +++ b/libs/s25main/buildings/nobBaseMilitary.cpp @@ -55,7 +55,7 @@ void nobBaseMilitary::DestroyBuilding() defender_ = nullptr; } - GetEvMgr().RemoveEvent(leaving_event); + getEvMgr().RemoveEvent(leaving_event); // Put all leaving figures outside for(auto& fig : leave_house) @@ -64,7 +64,7 @@ void nobBaseMilitary::DestroyBuilding() // DoJobWorks implies ActiveSoldier or TradeDonkey // Notify the soldier - if(figRef.IsDoingJobWorks() && dynamic_cast(&figRef)) + if(figRef.isDoingJobWorks() && dynamic_cast(&figRef)) static_cast(figRef).HomeDestroyedAtBegin(); else { @@ -80,7 +80,7 @@ void nobBaseMilitary::DestroyBuilding() sortedMilitaryBlds buildings = world->LookForMilitaryBuildings(pos, 3); for(auto* building : buildings) { - if(building->GetPlayer() != player && BuildingProperties::IsMilitary(building->GetBuildingType())) + if(building->getPlayer() != player && BuildingProperties::isMilitary(building->getBuildingType())) static_cast(building)->LookForEnemyBuildings(this); } } @@ -103,7 +103,7 @@ nobBaseMilitary::nobBaseMilitary(SerializedGameData& sgd, const unsigned obj_id) sgd.PopObjectContainer(leave_house); leaving_event = sgd.PopEvent(); go_out = sgd.PopBool(); - if(sgd.GetGameDataVersion() < 14) + if(sgd.getGameDataVersion() < 14) sgd.PopUnsignedInt(); // former age sgd.PopObjectContainer(troops_on_mission); sgd.PopObjectContainer(aggressors, GO_Type::NofAttacker); @@ -115,7 +115,7 @@ void nobBaseMilitary::AddLeavingEvent() { if(!go_out) { - leaving_event = GetEvMgr().AddEvent(this, 20 + RANDOM_RAND(10)); + leaving_event = getEvMgr().AddEvent(this, 20 + RANDOM_RAND(10)); go_out = true; } } @@ -132,11 +132,11 @@ nofAttacker* nobBaseMilitary::FindAggressor(nofAggressiveDefender& defender) for(nofAttacker* aggressor : aggressors) { // The attacker must be ready to fight and must not already have another hunting defender - if(!aggressor->IsReadyForFight() || aggressor->GetHuntingDefender()) + if(!aggressor->isReadyForFight() || aggressor->getHuntingDefender()) continue; - const MapPoint attackerPos = aggressor->GetPos(); - const MapPoint defenderPos = defender.GetPos(); + const MapPoint attackerPos = aggressor->getPos(); + const MapPoint defenderPos = defender.getPos(); if(attackerPos == defenderPos) { // Both are at same pos --> Go! @@ -160,15 +160,15 @@ nofAttacker* nobBaseMilitary::FindAggressor(nofAggressiveDefender& defender) MapPoint nobBaseMilitary::FindAnAttackerPlace(unsigned short& ret_radius, const nofAttacker& soldier) { - const MapPoint flagPos = GetFlagPos(); - const MapPoint soldierPos = soldier.GetPos(); + const MapPoint flagPos = getFlagPos(); + const MapPoint soldierPos = soldier.getPos(); // Only consider the flag position for fighting if the building isn't currently being captured. // Only "real" military buildings can be captured const bool capturing = - BuildingProperties::IsMilitary(bldType_) && static_cast(this)->IsBeingCaptured(); + BuildingProperties::isMilitary(bldType_) && static_cast(this)->isBeingCaptured(); - if(!capturing && world->IsValidPointForFighting(flagPos, soldier, false)) + if(!capturing && world->isValidPointForFighting(flagPos, soldier, false)) { // Also check if we can reach this. // If not, still consider the other points as the flag could become reachable by then. @@ -185,7 +185,7 @@ MapPoint nobBaseMilitary::FindAnAttackerPlace(unsigned short& ret_radius, const MapPoint minPt = MapPoint::Invalid(); constexpr auto MAX_RADIUS = 3; ret_radius = MAX_RADIUS; - for(const auto& node : world->GetPointsInRadius(flagPos, MAX_RADIUS, ReturnMapPointWithRadius{})) + for(const auto& node : world->getPointsInRadius(flagPos, MAX_RADIUS, ReturnMapPointWithRadius{})) { // We found a point with a better radius if(node.second > ret_radius) @@ -228,7 +228,7 @@ bool nobBaseMilitary::CallDefender(nofAttacker& attacker) { auto soldier = boost::static_pointer_cast(std::move(*it)); // At this point there shouldn't be a defender leaving as we are just requesting one - RTTR_Assert(soldier->GetGOT() != GO_Type::NofDefender); + RTTR_Assert(soldier->getGOT() != GO_Type::NofDefender); it = leave_house.erase(it); FigureLeft(*soldier); @@ -238,7 +238,7 @@ bool nobBaseMilitary::CallDefender(nofAttacker& attacker) { // If a leaving active soldier is not on a mission he doesn't belong to this building. // E.g. soldiers in harbors could be about to go home. - RTTR_Assert(!sldPtr || sldPtr->GetHomeBld() != this); + RTTR_Assert(!sldPtr || sldPtr->getHomeBld() != this); ++it; } } @@ -269,12 +269,12 @@ nofAttacker* nobBaseMilitary::FindAttackerNearBuilding() for(auto* aggressor : aggressors) { // Only consider those waiting around the flag, otherwise the defender could go/stay inside - if(aggressor->IsAttackerReady()) + if(aggressor->isAttackerReady()) { - if(!best_attacker || aggressor->GetRadius() < best_radius) + if(!best_attacker || aggressor->getRadius() < best_radius) { best_attacker = aggressor; - best_radius = aggressor->GetRadius(); + best_radius = aggressor->getRadius(); } } } @@ -291,10 +291,10 @@ void nobBaseMilitary::CheckArrestedAttackers() for(nofAttacker* aggressor : aggressors) { // Ready, i.e. waiting around the flag? - if(aggressor->IsAttackerReady()) + if(aggressor->isAttackerReady()) { // Can he still reach the flag? Could be blocked by other soldiers - if(world->FindHumanPath(aggressor->GetPos(), world->GetNeighbour(pos, Direction::SouthEast), 5, false)) + if(world->FindHumanPath(aggressor->getPos(), world->getNeighbour(pos, Direction::SouthEast), 5, false)) { aggressor->AttackFlag(); return; @@ -307,12 +307,12 @@ bool nobBaseMilitary::SendSuccessor(const MapPoint pt, const unsigned short radi { for(nofAttacker* aggressor : aggressors) { - if(aggressor->IsAttackerReady()) + if(aggressor->isAttackerReady()) { // Only move closer - if(aggressor->GetRadius() > radius) + if(aggressor->getRadius() > radius) { - if(world->FindHumanPath(aggressor->GetPos(), pt, 50, false)) + if(world->FindHumanPath(aggressor->getPos(), pt, 50, false)) { aggressor->StartSucceeding(pt, radius); return true; @@ -324,30 +324,30 @@ bool nobBaseMilitary::SendSuccessor(const MapPoint pt, const unsigned short radi return false; } -bool nobBaseMilitary::IsAttackable(unsigned playerIdx) const +bool nobBaseMilitary::isAttackable(unsigned playerIdx) const { // If we are in peaceful mode -> not attackable - if(world->GetGGS().getSelection(AddonId::PEACEFULMODE)) + if(world->getGGS().getSelection(AddonId::PEACEFULMODE)) return false; // If we cannot be seen by the player -> not attackable if(world->CalcVisiblityWithAllies(pos, playerIdx) != Visibility::Visible) return false; // Else it depends on the team settings - return world->GetPlayer(player).IsAttackable(playerIdx); + return world->getPlayer(player).isAttackable(playerIdx); } -bool nobBaseMilitary::IsAggressor(const nofAttacker& attacker) const +bool nobBaseMilitary::isAggressor(const nofAttacker& attacker) const { return helpers::contains(aggressors, &attacker); } -bool nobBaseMilitary::IsAggressiveDefender(const nofAggressiveDefender& soldier) const +bool nobBaseMilitary::isAggressiveDefender(const nofAggressiveDefender& soldier) const { return helpers::contains(aggressive_defenders, &soldier); } -bool nobBaseMilitary::IsOnMission(const nofActiveSoldier& soldier) const +bool nobBaseMilitary::isOnMission(const nofActiveSoldier& soldier) const { return helpers::contains(troops_on_mission, &soldier); } diff --git a/libs/s25main/buildings/nobBaseMilitary.h b/libs/s25main/buildings/nobBaseMilitary.h index 0d4d6eb5e7..16994128e1 100644 --- a/libs/s25main/buildings/nobBaseMilitary.h +++ b/libs/s25main/buildings/nobBaseMilitary.h @@ -50,13 +50,13 @@ class nobBaseMilitary : public noBuilding public: void Serialize(SerializedGameData& sgd) const override; - auto GetLeavingFigures() const { return helpers::nonNullPtrSpan(leave_house); } + auto getLeavingFigures() const { return helpers::nonNullPtrSpan(leave_house); } /// Gibt Verteidiger zurück - const nofDefender* GetDefender() const { return defender_; } + const nofDefender* getDefender() const { return defender_; } /// Compares according to build time (Age): Bigger objIds are "younger" - bool operator<(const nobBaseMilitary& other) const noexcept { return GetObjId() > other.GetObjId(); } + bool operator<(const nobBaseMilitary& other) const noexcept { return getObjId() > other.getObjId(); } /// Meldet ein neues "Rausgeh"-Event an, falls gerade keiner rausgeht /// (damit nicht alle auf einmal rauskommen), für Lager- und Militärhäuser) @@ -72,7 +72,7 @@ class nobBaseMilitary : public noBuilding void LinkAggressor(nofAttacker& soldier) { aggressors.push_back(&soldier); } virtual void UnlinkAggressor(nofAttacker& soldier) { - RTTR_Assert(IsAggressor(soldier)); + RTTR_Assert(isAggressor(soldier)); aggressors.remove(&soldier); } @@ -80,7 +80,7 @@ class nobBaseMilitary : public noBuilding void LinkAggressiveDefender(nofAggressiveDefender& soldier) { aggressive_defenders.push_back(&soldier); } void UnlinkAggressiveDefender(nofAggressiveDefender& soldier) { - RTTR_Assert(IsAggressiveDefender(soldier)); + RTTR_Assert(isAggressiveDefender(soldier)); aggressive_defenders.remove(&soldier); } @@ -112,19 +112,19 @@ class nobBaseMilitary : public noBuilding virtual bool DefendersAvailable() const = 0; /// Return the list of all current aggressors, that is enemy soldiers currently attacking this military building. - const std::list& GetAggressors() const { return aggressors; } + const std::list& getAggressors() const { return aggressors; } /// Return true if the military building is under attack. - bool IsUnderAttack() const { return !aggressors.empty(); }; + bool isUnderAttack() const { return !aggressors.empty(); }; /// Return whether this building can be attacked by the given player. - virtual bool IsAttackable(unsigned playerIdx) const; + virtual bool isAttackable(unsigned playerIdx) const; /// Debugging - bool IsAggressor(const nofAttacker& attacker) const; - bool IsAggressiveDefender(const nofAggressiveDefender& soldier) const; - bool IsOnMission(const nofActiveSoldier& soldier) const; - const std::list& GetAggresiveDefenders() const { return aggressive_defenders; } + bool isAggressor(const nofAttacker& attacker) const; + bool isAggressiveDefender(const nofAggressiveDefender& soldier) const; + bool isOnMission(const nofActiveSoldier& soldier) const; + const std::list& getAggresiveDefenders() const { return aggressive_defenders; } // Vergleicht Gebäude anhand ihrer Bauzeit, um eine geordnete Reihenfolge hinzubekommen struct Comparer diff --git a/libs/s25main/buildings/nobBaseWarehouse.cpp b/libs/s25main/buildings/nobBaseWarehouse.cpp index b1dc5ccc69..5a5da957e7 100644 --- a/libs/s25main/buildings/nobBaseWarehouse.cpp +++ b/libs/s25main/buildings/nobBaseWarehouse.cpp @@ -55,7 +55,7 @@ nobBaseWarehouse::nobBaseWarehouse(const BuildingType type, const MapPoint pos, : nobBaseMilitary(type, pos, player, nation), fetch_double_protection(false), recruiting_event(nullptr), empty_event(nullptr), store_event(nullptr) { - producinghelpers_event = GetEvMgr().AddEvent(this, PRODUCE_HELPERS_GF + RANDOM_RAND(PRODUCE_HELPERS_RANDOM_GF), 1); + producinghelpers_event = getEvMgr().AddEvent(this, PRODUCE_HELPERS_GF + RANDOM_RAND(PRODUCE_HELPERS_RANDOM_GF), 1); // Reserve nullen reserve_soldiers_available.fill(0); reserve_soldiers_available_with_armor.fill(0); @@ -71,9 +71,9 @@ void nobBaseWarehouse::DestroyBuilding() for(noFigure* dependent_figure : dependent_figures) { // Only send figures home that are not already at this position. - if(dependent_figure->GetPos() == GetPos()) + if(dependent_figure->getPos() == getPos()) { - dependent_figure->SetGoalTonullptr(); + dependent_figure->setGoalTonullptr(); dependent_figure->CutCurrentRoad(); dependent_figure->StartWandering(); } else @@ -86,10 +86,10 @@ void nobBaseWarehouse::DestroyBuilding() dependent_wares.clear(); // ggf. Events abmelden - GetEvMgr().RemoveEvent(recruiting_event); - GetEvMgr().RemoveEvent(producinghelpers_event); - GetEvMgr().RemoveEvent(empty_event); - GetEvMgr().RemoveEvent(store_event); + getEvMgr().RemoveEvent(recruiting_event); + getEvMgr().RemoveEvent(producinghelpers_event); + getEvMgr().RemoveEvent(empty_event); + getEvMgr().RemoveEvent(store_event); // Waiting Wares löschen for(auto& waiting_ware : waiting_wares) @@ -101,10 +101,10 @@ void nobBaseWarehouse::DestroyBuilding() // restliche Warenbestände von der Inventur wieder abziehen for(const auto good : helpers::enumRange()) - world->GetPlayer(player).DecreaseInventoryWare(good, inventory[good]); + world->getPlayer(player).DecreaseInventoryWare(good, inventory[good]); // move soldiers from reserve to inventory. - for(unsigned rank = 0; rank < world->GetGGS().GetMaxMilitaryRank(); ++rank) + for(unsigned rank = 0; rank < world->getGGS().getMaxMilitaryRank(); ++rank) { if(reserve_soldiers_available[rank] > 0) { @@ -173,7 +173,7 @@ nobBaseWarehouse::nobBaseWarehouse(SerializedGameData& sgd, const unsigned obj_i for(unsigned i = 0; i < 5; ++i) { reserve_soldiers_available[i] = sgd.PopUnsignedInt(); - if(sgd.GetGameDataVersion() >= 12) + if(sgd.getGameDataVersion() >= 12) reserve_soldiers_available_with_armor[i] = sgd.PopUnsignedInt(); reserve_soldiers_claimed_visual[i] = reserve_soldiers_claimed_real[i] = sgd.PopUnsignedInt(); @@ -181,10 +181,10 @@ nobBaseWarehouse::nobBaseWarehouse(SerializedGameData& sgd, const unsigned obj_i for(const auto i : helpers::enumRange()) { - if(sgd.GetGameDataVersion() < 11 && wineaddon::isWineAddonGoodType(i)) + if(sgd.getGameDataVersion() < 11 && wineaddon::isWineAddonGoodType(i)) continue; - if(sgd.GetGameDataVersion() < 12 && leatheraddon::isLeatherAddonGoodType(i)) + if(sgd.getGameDataVersion() < 12 && leatheraddon::isLeatherAddonGoodType(i)) continue; inventory.visual.Add(i, sgd.PopUnsignedInt()); @@ -193,17 +193,17 @@ nobBaseWarehouse::nobBaseWarehouse(SerializedGameData& sgd, const unsigned obj_i } for(const auto i : helpers::enumRange()) { - if(sgd.GetGameDataVersion() < 11 && wineaddon::isWineAddonJobType(i)) + if(sgd.getGameDataVersion() < 11 && wineaddon::isWineAddonJobType(i)) continue; - if(sgd.GetGameDataVersion() < 12 && leatheraddon::isLeatherAddonJobType(i)) + if(sgd.getGameDataVersion() < 12 && leatheraddon::isLeatherAddonJobType(i)) continue; inventory.visual.Add(i, sgd.PopUnsignedInt()); inventory.real.Add(i, sgd.PopUnsignedInt()); inventorySettings[i] = inventorySettingsVisual[i] = static_cast(sgd.PopUnsignedChar()); } - if(sgd.GetGameDataVersion() >= 12) + if(sgd.getGameDataVersion() >= 12) { helpers::popContainer(sgd, inventory.visual.armoredSoldiers); helpers::popContainer(sgd, inventory.real.armoredSoldiers); @@ -221,7 +221,7 @@ void nobBaseWarehouse::Clear() reserve_soldiers_available.fill(0); reserve_soldiers_available_with_armor.fill(0); - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); for(const auto i : helpers::enumRange()) owner.DecreaseInventoryWare(i, inventory[i]); @@ -244,7 +244,7 @@ void nobBaseWarehouse::Clear() void nobBaseWarehouse::OrderCarrier(noRoadNode& goal, RoadSegment& workplace) { RTTR_Assert(workplace.getCarrier(0) == nullptr); - const bool isBoatRequired = workplace.GetRoadType() == RoadType::Water; + const bool isBoatRequired = workplace.getRoadType() == RoadType::Water; // We assume, that the caller already checked, if this is possible RTTR_Assert(inventory[Job::Helper]); @@ -276,17 +276,17 @@ bool nobBaseWarehouse::OrderJob(const Job job, noRoadNode& goal, const bool allo } std::unique_ptr fig = JobFactory::CreateJob(job, pos, player, goal); - if(isSoldier(fig->GetJobType())) + if(isSoldier(fig->getJobType())) { if(inventory.real[jobEnumToAmoredSoldierEnum(job)] > 0) { inventory.real.Remove(jobEnumToAmoredSoldierEnum(job)); - fig->SetArmor(true); + fig->setArmor(true); } } // Ziel Bescheid sagen, dass dortin ein neuer Arbeiter kommt (bei Flaggen als das anders machen) - if(goal.GetType() != NodalObjectType::Flag) + if(goal.getType() != NodalObjectType::Flag) checkedCast(goal).GotWorker(job, *fig); // Wenn Figur nicht sofort von abgeleiteter Klasse verwenet wird, fügen wir die zur Leave-Liste hinzu @@ -353,13 +353,13 @@ void nobBaseWarehouse::HandleCollectEvent() for(const auto i : helpers::enumRange()) { // Soll Ware eingeliefert werden? - if(!GetInventorySetting(i).IsSet(EInventorySetting::Collect)) + if(!getInventorySetting(i).isSet(EInventorySetting::Collect)) continue; storing_wanted = true; // Lagerhaus suchen, das diese Ware enthält - nobBaseWarehouse* wh = world->GetPlayer(player).FindWarehouse(*this, FW::HasWareButNoCollect(i), false, false); + nobBaseWarehouse* wh = world->getPlayer(player).FindWarehouse(*this, FW::HasWareButNoCollect(i), false, false); // Gefunden? if(wh) { @@ -367,7 +367,7 @@ void nobBaseWarehouse::HandleCollectEvent() Ware* ware = wh->OrderWare(i, *this); if(ware) { - RTTR_Assert(IsWareDependent(*ware)); + RTTR_Assert(isWareDependent(*ware)); storing_done = true; break; } @@ -380,14 +380,14 @@ void nobBaseWarehouse::HandleCollectEvent() for(const auto i : helpers::enumRange()) { // Soll dieser Typ von Mensch bestellt werden? - if(!GetInventorySetting(i).IsSet(EInventorySetting::Collect)) + if(!getInventorySetting(i).isSet(EInventorySetting::Collect)) continue; storing_wanted = true; // Lagerhaus suchen, das diesen Job enthält nobBaseWarehouse* wh = - world->GetPlayer(player).FindWarehouse(*this, FW::HasFigureButNoCollect(i, false), false, false); + world->getPlayer(player).FindWarehouse(*this, FW::HasFigureButNoCollect(i, false), false, false); // Gefunden? if(wh) { @@ -401,26 +401,26 @@ void nobBaseWarehouse::HandleCollectEvent() // Storing still wanted? // Then continue ordering new stuff if(storing_wanted) - store_event = GetEvMgr().AddEvent(this, STORE_INTERVAL, 4); + store_event = getEvMgr().AddEvent(this, STORE_INTERVAL, 4); } void nobBaseWarehouse::HandleSendoutEvent() { // Fight or something in front of the house? Try again later! - if(!world->IsRoadNodeForFigures(world->GetNeighbour(pos, Direction::SouthEast))) + if(!world->isRoadNodeForFigures(world->getNeighbour(pos, Direction::SouthEast))) { - empty_event = GetEvMgr().AddEvent(this, empty_INTERVAL, 3); + empty_event = getEvMgr().AddEvent(this, empty_INTERVAL, 3); return; } std::vector> possibleTypes; // Waren und Figuren zum Auslagern zusammensuchen // Wenn keine Platz an Flagge, dann keine Waren raus - if(GetFlag()->HasSpaceForWare()) + if(getFlag()->hasSpaceForWare()) { for(const auto i : helpers::enumRange()) { - if(GetInventorySetting(i).IsSet(EInventorySetting::Send) && inventory[i]) + if(getInventorySetting(i).isSet(EInventorySetting::Send) && inventory[i]) possibleTypes.push_back(i); } } @@ -428,7 +428,7 @@ void nobBaseWarehouse::HandleSendoutEvent() for(const auto i : helpers::enumRange()) { // Figuren, die noch nicht implementiert sind, nicht nehmen! - if(GetInventorySetting(i).IsSet(EInventorySetting::Send) && inventory[i]) + if(getInventorySetting(i).isSet(EInventorySetting::Send) && inventory[i]) possibleTypes.push_back(i); } @@ -445,10 +445,10 @@ void nobBaseWarehouse::HandleSendoutEvent() // Ware const auto goodType = get(selectedId); auto ware = std::make_unique(goodType, nullptr, this); - noBaseBuilding* wareGoal = world->GetPlayer(player).FindClientForWare(*ware); + noBaseBuilding* wareGoal = world->getPlayer(player).FindClientForWare(*ware); if(wareGoal != this) { - ware->SetGoal(wareGoal); + ware->setGoal(wareGoal); // Ware zur Liste hinzufügen, damit sie dann rausgetragen wird waiting_wares.push_back(std::move(ware)); @@ -461,19 +461,19 @@ void nobBaseWarehouse::HandleSendoutEvent() // Evtl. kein Schwert/Schild/Bier mehr da, sodass das Rekrutieren gestoppt werden muss TryStopRecruiting(); } else - world->GetPlayer(player).RemoveWare(*ware); + world->getPlayer(player).RemoveWare(*ware); } else { const auto jobType = get(selectedId); nobBaseWarehouse* wh = - world->GetPlayer(player).FindWarehouse(*this, FW::AcceptsFigureButNoSend(jobType), true, false); + world->getPlayer(player).FindWarehouse(*this, FW::AcceptsFigureButNoSend(jobType), true, false); if(wh != this) { auto fig = std::make_unique(jobType, pos, player, nullptr); if(isSoldier(jobType) && inventory.real[jobEnumToAmoredSoldierEnum(jobType)] > 0) { - fig->SetArmor(true); + fig->setArmor(true); inventory.real.Remove(jobEnumToAmoredSoldierEnum(jobType)); } @@ -495,7 +495,7 @@ void nobBaseWarehouse::HandleSendoutEvent() // Weitere Waren/Figuren zum Auslagern? if(AreWaresToEmpty()) // --> Nächstes Event - empty_event = GetEvMgr().AddEvent(this, empty_INTERVAL, 3); + empty_event = getEvMgr().AddEvent(this, empty_INTERVAL, 3); } void nobBaseWarehouse::HandleRecrutingEvent() @@ -509,8 +509,8 @@ void nobBaseWarehouse::HandleRecrutingEvent() max_recruits = std::min(inventory[GoodType::Beer], max_recruits); max_recruits = std::min(inventory[Job::Helper], max_recruits); - GamePlayer& owner = world->GetPlayer(player); - const unsigned recruiting_ratio = owner.GetMilitarySetting(0); + GamePlayer& owner = world->getPlayer(player); + const unsigned recruiting_ratio = owner.getMilitarySetting(0); unsigned real_recruits = max_recruits * recruiting_ratio / MILITARY_SETTINGS_SCALE[0]; // Wurde abgerundet? unsigned remainingRecruits = real_recruits * recruiting_ratio % MILITARY_SETTINGS_SCALE[0]; @@ -555,7 +555,7 @@ void nobBaseWarehouse::HandleProduceHelperEvent() { inventory.Add(Job::Helper); - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); owner.IncreaseInventoryJob(Job::Helper, 1); if(inventory[Job::Helper] == 1) @@ -571,10 +571,10 @@ void nobBaseWarehouse::HandleProduceHelperEvent() // Bei Überbevölkerung Träger vernichten inventory.Remove(Job::Helper); - world->GetPlayer(player).DecreaseInventoryJob(Job::Helper, 1); + world->getPlayer(player).DecreaseInventoryJob(Job::Helper, 1); } - producinghelpers_event = GetEvMgr().AddEvent(this, PRODUCE_HELPERS_GF + RANDOM_RAND(PRODUCE_HELPERS_RANDOM_GF), 1); + producinghelpers_event = getEvMgr().AddEvent(this, PRODUCE_HELPERS_GF + RANDOM_RAND(PRODUCE_HELPERS_RANDOM_GF), 1); // Evtl. genau der Gehilfe, der zum Rekrutieren notwendig ist TryRecruiting(); @@ -587,7 +587,7 @@ void nobBaseWarehouse::HandleLeaveEvent() { #if RTTR_ENABLE_ASSERTS // Harbors have more queues. Ignore for now - if(GetGOT() != GO_Type::NobHarborbuilding) + if(getGOT() != GO_Type::NobHarborbuilding) { Inventory should = inventory.real; for(auto& it : leave_house) @@ -595,10 +595,10 @@ void nobBaseWarehouse::HandleLeaveEvent() // Don't count warehouse workers if(!it->MemberOfWarehouse()) { - if(it->GetJobType() == Job::BoatCarrier) + if(it->getJobType() == Job::BoatCarrier) should.Add(Job::Helper); else - should.Add(it->GetJobType()); + should.Add(it->getJobType()); } } RTTR_Assert(should.people == inventory.visual.people); @@ -613,13 +613,13 @@ void nobBaseWarehouse::HandleLeaveEvent() } // Fight or something in front of the house and we are not defending? - if(!world->IsRoadNodeForFigures(world->GetNeighbour(pos, Direction::SouthEast))) + if(!world->isRoadNodeForFigures(world->getNeighbour(pos, Direction::SouthEast))) { // there's a fight // try to find a defender const auto it = helpers::find_if(leave_house, [](const auto& sld) { - return sld->GetGOT() == GO_Type::NofAggressivedefender || sld->GetGOT() == GO_Type::NofDefender; + return sld->getGOT() == GO_Type::NofAggressivedefender || sld->getGOT() == GO_Type::NofDefender; }); // no defender found? enqueue next leaving event if(it == leave_house.end()) @@ -640,20 +640,20 @@ void nobBaseWarehouse::HandleLeaveEvent() leave_house.pop_front(); // Init road walking for figures walking on roads - if(fig.IsWalkingOnRoad()) - fig.InitializeRoadWalking(GetRoute(Direction::SouthEast), 0, true); + if(fig.isWalkingOnRoad()) + fig.InitializeRoadWalking(getRoute(Direction::SouthEast), 0, true); fig.ActAtFirst(); FigureLeft(fig); } else { - if(GetFlag()->HasSpaceForWare()) + if(getFlag()->hasSpaceForWare()) { // Send first ware auto ware = std::move(waiting_wares.front()); waiting_wares.pop_front(); inventory.visual.Remove(ConvertShields(ware->type)); - ware->Carry(*GetFlag()); + ware->Carry(*getFlag()); world->AddFigure(pos, std::make_unique(pos, player, std::move(ware), false)) .WalkToGoal(); } else @@ -668,7 +668,7 @@ void nobBaseWarehouse::HandleLeaveEvent() go_out = false; if(go_out) - leaving_event = GetEvMgr().AddEvent(this, LEAVE_INTERVAL + RANDOM_RAND(LEAVE_INTERVAL_RAND)); + leaving_event = getEvMgr().AddEvent(this, LEAVE_INTERVAL + RANDOM_RAND(LEAVE_INTERVAL_RAND)); } void nobBaseWarehouse::FigureLeft(const noFigure& fig) @@ -678,10 +678,10 @@ void nobBaseWarehouse::FigureLeft(const noFigure& fig) return; RemoveFromVisualInventory(fig); - if(fig.GetGOT() == GO_Type::NofTradedonkey) + if(fig.getGOT() == GO_Type::NofTradedonkey) { // Trade donkey carrying wares? - const auto& carriedWare = static_cast(fig).GetCarriedWare(); + const auto& carriedWare = static_cast(fig).getCarriedWare(); if(carriedWare) inventory.visual.Remove(*carriedWare); } @@ -734,7 +734,7 @@ bool nobBaseWarehouse::FreePlaceAtFlag() // Weitere Waren/Figuren zum Auslagern und kein Event angemeldet? if(AreWaresToEmpty() && !empty_event) // --> Nächstes Event - empty_event = GetEvMgr().AddEvent(this, empty_INTERVAL, 3); + empty_event = getEvMgr().AddEvent(this, empty_INTERVAL, 3); return false; } @@ -743,17 +743,17 @@ bool nobBaseWarehouse::FreePlaceAtFlag() void nobBaseWarehouse::AddWare(std::unique_ptr ware) { // Ware not dependent anymore (only if we had a goal) - if(ware->GetGoal()) + if(ware->getGoal()) { - RTTR_Assert(ware->GetGoal() == this); // The goal should be here + RTTR_Assert(ware->getGoal() == this); // The goal should be here RemoveDependentWare(*ware); } else - RTTR_Assert(!IsWareDependent(*ware)); + RTTR_Assert(!isWareDependent(*ware)); // Die Schilde der verschiedenen Nation in eine "Schild-Sorte" (den der Römer) umwandeln! GoodType type = ConvertShields(ware->type); - world->GetPlayer(player).RemoveWare(*ware); + world->getPlayer(player).RemoveWare(*ware); inventory.Add(type); @@ -768,13 +768,13 @@ void nobBaseWarehouse::CheckUsesForNewWare(const GoodType gt) for(const auto job : helpers::EnumRange{}) { if(JOB_CONSTS[job].tool == gt) - world->GetPlayer(player).FindWarehouseForAllJobs(job); + world->getPlayer(player).FindWarehouseForAllJobs(job); } } // Wars Baumaterial? Dann den Baustellen Bescheid sagen if(gt == GoodType::Boards || gt == GoodType::Stones) - world->GetPlayer(player).FindMaterialForBuildingSites(); + world->getPlayer(player).FindMaterialForBuildingSites(); // Evtl wurden Bier oder Waffen reingetragen --> versuchen zu rekrutieren TryRecruiting(); @@ -796,7 +796,7 @@ void nobBaseWarehouse::CheckJobsForNewFigure(const Job job) if(inventory[job] > 0) { // Truppen prüfen in allen Häusern - world->GetPlayer(player).NewSoldiersAvailable(inventory[job]); + world->getPlayer(player).NewSoldiersAvailable(inventory[job]); } } else { @@ -804,12 +804,12 @@ void nobBaseWarehouse::CheckJobsForNewFigure(const Job job) { // Straße für Esel suchen noRoadNode* goal; - if(RoadSegment* road = world->GetPlayer(player).FindRoadForDonkey(*this, &goal)) + if(RoadSegment* road = world->getPlayer(player).FindRoadForDonkey(*this, &goal)) road->GotDonkey(OrderDonkey(*road, *goal)); } else { // Evtl. Abnehmer für die Figur wieder finden - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); owner.FindWarehouseForAllJobs(job); // Wenns ein Träger war, auch Wege prüfen if(job == Job::Helper && inventory[Job::Helper] == 1) @@ -838,16 +838,16 @@ void nobBaseWarehouse::AddFigure(std::unique_ptr figure, const bool in // Check if we were actually waiting for this figure or if it was just added (e.g. builder that constructed it) to // not confuse implementations of Remove... - if(IsDependentFigure(*figure)) + if(isDependentFigure(*figure)) RemoveDependentFigure(*figure); - CheckJobsForNewFigure(figure->GetJobType()); - GetEvMgr().AddToKillList(std::move(figure)); + CheckJobsForNewFigure(figure->getJobType()); + getEvMgr().AddToKillList(std::move(figure)); } void nobBaseWarehouse::RemoveFromVisualInventory(const noFigure& figure) { - const auto job = figure.GetJobType(); + const auto job = figure.getJobType(); if(job == Job::BoatCarrier) { // Remove helper and boat separately @@ -856,14 +856,14 @@ void nobBaseWarehouse::RemoveFromVisualInventory(const noFigure& figure) } else { inventory.visual.Remove(job); - if(isSoldier(job) && figure.HasArmor()) + if(isSoldier(job) && figure.hasArmor()) inventory.visual.Remove(jobEnumToAmoredSoldierEnum(job)); } } static void addToInventory(Inventory& inventory, const noFigure& figure) { - const auto job = figure.GetJobType(); + const auto job = figure.getJobType(); if(job == Job::BoatCarrier) { inventory.Add(Job::Helper); @@ -871,7 +871,7 @@ static void addToInventory(Inventory& inventory, const noFigure& figure) } else { inventory.Add(job); - if(isSoldier(job) && figure.HasArmor()) + if(isSoldier(job) && figure.hasArmor()) inventory.Add(jobEnumToAmoredSoldierEnum(job)); } } @@ -899,14 +899,14 @@ void nobBaseWarehouse::WareLost(Ware& ware) RemoveDependentWare(ware); } -void nobBaseWarehouse::CancelWare(Ware*& ware) +void nobBaseWarehouse::cancelWare(Ware*& ware) { inventory.real.Add(ConvertShields(ware->type)); helpers::extractPtr(waiting_wares, ware); ware = nullptr; } -void nobBaseWarehouse::CancelFigure(noFigure* figure) +void nobBaseWarehouse::cancelFigure(noFigure* figure) { auto it = helpers::findPtr(leave_house, figure); RTTR_Assert(it != leave_house.end()); @@ -928,7 +928,7 @@ void nobBaseWarehouse::OrderTroops(nobMilitary& goal, std::arrayGetPlayer(player).GetMilitarySetting(1) >= MILITARY_SETTINGS_SCALE[1] / 2) + if(world->getPlayer(player).getMilitarySetting(1) >= MILITARY_SETTINGS_SCALE[1] / 2) { // Ränge durchgehen, absteigend, starke zuerst start = SOLDIER_JOBS.size(); @@ -953,7 +953,7 @@ void nobBaseWarehouse::OrderTroops(nobMilitary& goal, std::array 0) { inventory.real.Remove(jobEnumToAmoredSoldierEnum(curRank)); - soldier->SetArmor(true); + soldier->setArmor(true); } goal.GotWorker(curRank, *soldier); AddLeavingFigure(std::move(soldier)); @@ -981,10 +981,10 @@ nofAggressiveDefender* nobBaseWarehouse::SendAggressiveDefender(nofAttacker& att auto soldier = std::make_unique(pos, player, *this, rank - 1, attacker); nofAggressiveDefender& soldierRef = *soldier; inventory.real.Remove(SOLDIER_JOBS[rank - 1]); - if(inventory.real[jobEnumToAmoredSoldierEnum(soldier->GetJobType())] > 0) + if(inventory.real[jobEnumToAmoredSoldierEnum(soldier->getJobType())] > 0) { - soldier->SetArmor(true); - inventory.real.Remove(jobEnumToAmoredSoldierEnum(soldier->GetJobType())); + soldier->setArmor(true); + inventory.real.Remove(jobEnumToAmoredSoldierEnum(soldier->getJobType())); } AddLeavingFigure(std::move(soldier)); @@ -1003,15 +1003,15 @@ void nobBaseWarehouse::SoldierLost(nofSoldier* soldier) void nobBaseWarehouse::AddActiveSoldier(std::unique_ptr soldier) { - inventory.Add(soldier->GetJobType()); - if(soldier->HasArmor()) - inventory.Add(jobEnumToAmoredSoldierEnum(soldier->GetJobType())); + inventory.Add(soldier->getJobType()); + if(soldier->hasArmor()) + inventory.Add(jobEnumToAmoredSoldierEnum(soldier->getJobType())); // Evtl. geht der Soldat wieder in die Reserve - RefreshReserve(soldier->GetRank()); + RefreshReserve(soldier->getRank()); // Truppen prüfen in allen Häusern - world->GetPlayer(player).RegulateAllTroops(); + world->getPlayer(player).RegulateAllTroops(); // Returned home if(soldier.get() == defender_) @@ -1025,7 +1025,7 @@ void nobBaseWarehouse::AddActiveSoldier(std::unique_ptr soldie // und Soldat vernichten soldier->ResetHome(); - GetEvMgr().AddToKillList(std::move(soldier)); + getEvMgr().AddToKillList(std::move(soldier)); } std::unique_ptr nobBaseWarehouse::ProvideDefender(nofAttacker& attacker) @@ -1042,7 +1042,7 @@ std::unique_ptr nobBaseWarehouse::ProvideDefender(nofAttacker& atta if(rank_count) { // Gewünschten Rang an Hand der Militäreinstellungen ausrechnen, je nachdem wie stark verteidigt werden soll - unsigned rank = (rank_count - 1) * world->GetPlayer(player).GetMilitarySetting(1) / MILITARY_SETTINGS_SCALE[1]; + unsigned rank = (rank_count - 1) * world->getPlayer(player).getMilitarySetting(1) / MILITARY_SETTINGS_SCALE[1]; // Gewünschten Rang suchen unsigned r = 0; @@ -1058,7 +1058,7 @@ std::unique_ptr nobBaseWarehouse::ProvideDefender(nofAttacker& atta inventory.real.Remove(SOLDIER_JOBS[i]); if(inventory.real[jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])] > 0) { - defender->SetArmor(true); + defender->setArmor(true); inventory.real.Remove(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])); } return defender; @@ -1076,7 +1076,7 @@ std::unique_ptr nobBaseWarehouse::ProvideDefender(nofAttacker& atta inventory.visual.Add(SOLDIER_JOBS[i]); if(reserve_soldiers_available_with_armor[i] > 0) { - defender->SetArmor(true); + defender->setArmor(true); --reserve_soldiers_available_with_armor[i]; inventory.visual.Add(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])); } @@ -1090,15 +1090,15 @@ std::unique_ptr nobBaseWarehouse::ProvideDefender(nofAttacker& atta // If no soldier was found take a soldier that is about to leave (to another building) for(auto it = leave_house.begin(); it != leave_house.end(); ++it) { - if((*it)->GetGOT() == GO_Type::NofPassivesoldier) + if((*it)->getGOT() == GO_Type::NofPassivesoldier) { std::unique_ptr soldier = boost::static_pointer_cast(std::move(*it)); leave_house.erase(it); // Only allowed in the loop as we return now soldier->Abrogate(); - auto defender = std::make_unique(pos, player, *this, soldier->GetRank(), attacker); - defender->SetArmor(soldier->HasArmor()); + auto defender = std::make_unique(pos, player, *this, soldier->getRank(), attacker); + defender->setArmor(soldier->hasArmor()); soldier->Destroy(); return defender; } @@ -1106,28 +1106,28 @@ std::unique_ptr nobBaseWarehouse::ProvideDefender(nofAttacker& atta return nullptr; } -bool nobBaseWarehouse::CanRecruitSoldiers() +bool nobBaseWarehouse::canRecruitSoldiers() { // Minimal number of helpers required according to current setting, at least 1 - const unsigned needed_helpers = std::max(1, 100 - 10 * world->GetPlayer(player).GetMilitarySetting(0)); + const unsigned needed_helpers = std::max(1, 100 - 10 * world->getPlayer(player).getMilitarySetting(0)); return (inventory[Job::Helper] >= needed_helpers && inventory[GoodType::Sword] && inventory[GoodType::ShieldRomans] && inventory[GoodType::Beer]); } void nobBaseWarehouse::TryRecruiting() { - if(!recruiting_event && CanRecruitSoldiers()) - recruiting_event = GetEvMgr().AddEvent(this, RECRUITE_GF + RANDOM_RAND(RECRUITE_RANDOM_GF), 2); + if(!recruiting_event && canRecruitSoldiers()) + recruiting_event = getEvMgr().AddEvent(this, RECRUITE_GF + RANDOM_RAND(RECRUITE_RANDOM_GF), 2); } void nobBaseWarehouse::TryStopRecruiting() { // Remove existing event if we have not enough recruits/wares - if(recruiting_event && !CanRecruitSoldiers()) - GetEvMgr().RemoveEvent(recruiting_event); + if(recruiting_event && !canRecruitSoldiers()) + getEvMgr().RemoveEvent(recruiting_event); } -const Inventory& nobBaseWarehouse::GetInventory() const +const Inventory& nobBaseWarehouse::getInventory() const { return inventory.visual; } @@ -1140,7 +1140,7 @@ void nobBaseWarehouse::AddToInventory(const GoodsAndPeopleCounts& what, bool add void nobBaseWarehouse::AddToInventory(const GoodCounts& goods, bool addToPlayer) { - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); for(const auto i : helpers::enumRange()) { if(!goods[i]) @@ -1157,7 +1157,7 @@ void nobBaseWarehouse::AddToInventory(const GoodCounts& goods, bool addToPlayer) void nobBaseWarehouse::AddToInventory(const PeopleCounts& people, bool addToPlayer) { - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); for(const auto i : helpers::enumRange()) { if(!people[i]) @@ -1183,7 +1183,7 @@ void nobBaseWarehouse::AddToInventory(const PeopleCounts& people, bool addToPlay } } -bool nobBaseWarehouse::CanRecruit(const Job job) const +bool nobBaseWarehouse::canRecruit(const Job job) const { if(const auto& requiredTool = JOB_CONSTS[job].tool) { @@ -1196,10 +1196,10 @@ bool nobBaseWarehouse::CanRecruit(const Job job) const bool nobBaseWarehouse::TryRecruitJob(const Job job) { RTTR_Assert(!helpers::contains(SOLDIER_JOBS, job) && job != Job::PackDonkey); - if(!CanRecruit(job)) + if(!canRecruit(job)) return false; - auto& owner = world->GetPlayer(player); + auto& owner = world->getPlayer(player); const GoodType requiredTool = *JOB_CONSTS[job].tool; // Validity checked in CanRecruit if(requiredTool != GoodType::Nothing) @@ -1216,27 +1216,27 @@ bool nobBaseWarehouse::TryRecruitJob(const Job job) return true; } -InventorySetting nobBaseWarehouse::GetInventorySettingVisual(const Job job) const +InventorySetting nobBaseWarehouse::getInventorySettingVisual(const Job job) const { return inventorySettingsVisual[(job == Job::BoatCarrier) ? Job::Helper : job]; } -InventorySetting nobBaseWarehouse::GetInventorySettingVisual(const GoodType ware) const +InventorySetting nobBaseWarehouse::getInventorySettingVisual(const GoodType ware) const { return inventorySettingsVisual[ConvertShields(ware)]; } -InventorySetting nobBaseWarehouse::GetInventorySetting(const Job job) const +InventorySetting nobBaseWarehouse::getInventorySetting(const Job job) const { return inventorySettings[(job == Job::BoatCarrier) ? Job::Helper : job]; } -InventorySetting nobBaseWarehouse::GetInventorySetting(const GoodType ware) const +InventorySetting nobBaseWarehouse::getInventorySetting(const GoodType ware) const { return inventorySettings[ConvertShields(ware)]; } -void nobBaseWarehouse::SetInventorySettingVisual(const boost_variant2& what, InventorySetting state) +void nobBaseWarehouse::setInventorySettingVisual(const boost_variant2& what, InventorySetting state) { state.MakeValid(); visit([this, state](auto type) { inventorySettingsVisual[type] = state; }, what); @@ -1255,27 +1255,27 @@ void nobBaseWarehouse::SetInventorySetting(const boost_variant2& // Bei anderen Spielern als dem lokalen, der das in Auftrag gegeben hat, müssen die visuellen ebenfalls // geändert werden oder auch bei Replays - if(GAMECLIENT.IsReplayModeOn() || GAMECLIENT.GetPlayerId() != player) - SetInventorySettingVisual(what, state); + if(GAMECLIENT.isReplayModeOn() || GAMECLIENT.getPlayerId() != player) + setInventorySettingVisual(what, state); - if(holds_alternative(what) && oldState.IsSet(EInventorySetting::Stop) - && !state.IsSet(EInventorySetting::Stop)) + if(holds_alternative(what) && oldState.isSet(EInventorySetting::Stop) + && !state.isSet(EInventorySetting::Stop)) { // Evtl gabs verlorene Waren, die jetzt in das HQ wieder reinkönnen - world->GetPlayer(player).FindClientForLostWares(); + world->getPlayer(player).FindClientForLostWares(); } // No else here! - if(!oldState.IsSet(EInventorySetting::Send) && state.IsSet(EInventorySetting::Send)) + if(!oldState.isSet(EInventorySetting::Send) && state.isSet(EInventorySetting::Send)) { // Sind Waren vorhanden, die ausgelagert werden müssen und ist noch kein Auslagerungsevent vorhanden --> neues // anmelden auto getWaresOrJobs = [this](auto type) { return inventory[type]; }; if(!empty_event && visit(getWaresOrJobs, what)) - empty_event = GetEvMgr().AddEvent(this, empty_INTERVAL, 3); - } else if(!oldState.IsSet(EInventorySetting::Collect) && state.IsSet(EInventorySetting::Collect)) + empty_event = getEvMgr().AddEvent(this, empty_INTERVAL, 3); + } else if(!oldState.isSet(EInventorySetting::Collect) && state.isSet(EInventorySetting::Collect)) { // Sollen Waren eingelagert werden? Dann müssen wir neue bestellen if(!store_event) - store_event = GetEvMgr().AddEvent(this, STORE_INTERVAL, 4); + store_event = getEvMgr().AddEvent(this, STORE_INTERVAL, 4); } NotifyListeners(1); } @@ -1293,24 +1293,24 @@ void nobBaseWarehouse::SetAllInventorySettings(const bool isJob, const std::vect { state.MakeValid(); *(settings++) = state; - isUnstopped |= !state.IsSet(EInventorySetting::Stop); - isCollectSet |= state.IsSet(EInventorySetting::Collect); + isUnstopped |= !state.isSet(EInventorySetting::Stop); + isCollectSet |= state.isSet(EInventorySetting::Collect); } // Evtl gabs verlorene Waren, die jetzt in das HQ wieder reinkönnen if(isUnstopped) - world->GetPlayer(player).FindClientForLostWares(); + world->getPlayer(player).FindClientForLostWares(); // no else! // Sind Waren vorhanden, die ausgelagert werden müssen und ist noch kein Auslagerungsevent vorhanden --> neues // anmelden if(AreWaresToEmpty() && !empty_event) - empty_event = GetEvMgr().AddEvent(this, empty_INTERVAL, 3); + empty_event = getEvMgr().AddEvent(this, empty_INTERVAL, 3); // Sollen Waren eingelagert werden? Dann müssen wir neue bestellen if(isCollectSet && !store_event) - store_event = GetEvMgr().AddEvent(this, STORE_INTERVAL, 4); + store_event = getEvMgr().AddEvent(this, STORE_INTERVAL, 4); } -bool nobBaseWarehouse::IsWareDependent(const Ware& ware) +bool nobBaseWarehouse::isWareDependent(const Ware& ware) { return helpers::contains(dependent_wares, &ware); } @@ -1321,14 +1321,14 @@ bool nobBaseWarehouse::AreWaresToEmpty() const // Waren überprüfen for(const auto i : helpers::enumRange()) { - if(GetInventorySetting(i).IsSet(EInventorySetting::Send) && inventory[i]) + if(getInventorySetting(i).isSet(EInventorySetting::Send) && inventory[i]) return true; } // Figuren überprüfen for(const auto i : helpers::enumRange()) { - if(GetInventorySetting(i).IsSet(EInventorySetting::Send) && inventory[i]) + if(getInventorySetting(i).isSet(EInventorySetting::Send) && inventory[i]) return true; } @@ -1349,17 +1349,17 @@ bool nobBaseWarehouse::DefendersAvailable() const return false; } -void nobBaseWarehouse::SetReserveVisual(const unsigned rank, const unsigned count) +void nobBaseWarehouse::setReserveVisual(const unsigned rank, const unsigned count) { reserve_soldiers_claimed_visual[rank] = count; } -void nobBaseWarehouse::SetRealReserve(const unsigned rank, const unsigned count) +void nobBaseWarehouse::setRealReserve(const unsigned rank, const unsigned count) { reserve_soldiers_claimed_real[rank] = count; // Replay oder anderer Spieler? Dann die visuellen auch erhöhen - if(GAMECLIENT.IsReplayModeOn() || GAMECLIENT.GetPlayerId() != player) + if(GAMECLIENT.isReplayModeOn() || GAMECLIENT.getPlayerId() != player) reserve_soldiers_claimed_visual[rank] = count; // Geforderte Soldaten ggf. einbeziehen @@ -1404,7 +1404,7 @@ void nobBaseWarehouse::RefreshReserve(unsigned rank) // if the rank is supposed to be send away, do it! CheckOuthousing(SOLDIER_JOBS[rank]); // Ggf. Truppen in die Militärgebäude schicken - world->GetPlayer(player).RegulateAllTroops(); + world->getPlayer(player).RegulateAllTroops(); } // ansonsten ists gleich und alles ist in Ordnung! } @@ -1419,21 +1419,21 @@ void nobBaseWarehouse::CheckOuthousing(const boost_variant2& what const InventorySetting setting = visit(composeVisitor( [this](Job job) { // Bootsträger in Träger umwandeln, der evtl dann raus soll - return GetInventorySetting((job == Job::BoatCarrier) ? Job::Helper : job); + return getInventorySetting((job == Job::BoatCarrier) ? Job::Helper : job); }, - [this](GoodType good) { return GetInventorySetting(good); }), + [this](GoodType good) { return getInventorySetting(good); }), what); - if(setting.IsSet(EInventorySetting::Send)) - empty_event = GetEvMgr().AddEvent(this, empty_INTERVAL, 3); + if(setting.isSet(EInventorySetting::Send)) + empty_event = getEvMgr().AddEvent(this, empty_INTERVAL, 3); } -bool nobBaseWarehouse::IsDependentFigure(const noFigure& fig) const +bool nobBaseWarehouse::isDependentFigure(const noFigure& fig) const { return helpers::contains(dependent_figures, &fig); } -unsigned nobBaseWarehouse::GetAvailableWaresForTrading(const GoodType gt) const +unsigned nobBaseWarehouse::getAvailableWaresForTrading(const GoodType gt) const { // We need a helper as leader if(!inventory[Job::Helper]) @@ -1442,7 +1442,7 @@ unsigned nobBaseWarehouse::GetAvailableWaresForTrading(const GoodType gt) const return std::min(inventory[gt], inventory[Job::PackDonkey]); } -unsigned nobBaseWarehouse::GetAvailableFiguresForTrading(const Job job) const +unsigned nobBaseWarehouse::getAvailableFiguresForTrading(const Job job) const { // We need a helper as leader if(!inventory[Job::Helper]) @@ -1457,11 +1457,11 @@ unsigned nobBaseWarehouse::GetAvailableFiguresForTrading(const Job job) const void nobBaseWarehouse::StartTradeCaravane(const boost_variant2& what, const unsigned count, const TradeRoute& tr, nobBaseWarehouse* goal) { - auto tlOwned = std::make_unique(pos, player, tr, this->GetPos(), goal->GetPos()); + auto tlOwned = std::make_unique(pos, player, tr, this->getPos(), goal->getPos()); auto& tl = *tlOwned; AddLeavingFigure(std::move(tlOwned)); - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); // Create the donkeys or other people const bool isSoldierType = holds_alternative(what) && isSoldier(get(what)); @@ -1474,16 +1474,16 @@ void nobBaseWarehouse::StartTradeCaravane(const boost_variant2& w auto const job = get(what); if(inventory.real[jobEnumToAmoredSoldierEnum(job)] > 0) { - next->SetArmor(true); + next->setArmor(true); inventory.real.Remove(jobEnumToAmoredSoldierEnum(job), 1); owner.DecreaseInventoryJob(jobEnumToAmoredSoldierEnum(job), 1); } } if(last) - last->SetSuccessor(next.get()); + last->setSuccessor(next.get()); else - tl.SetSuccessor(next.get()); + tl.setSuccessor(next.get()); last = next.get(); AddLeavingFigure(std::move(next)); diff --git a/libs/s25main/buildings/nobBaseWarehouse.h b/libs/s25main/buildings/nobBaseWarehouse.h index 75cda8f81f..299175d35e 100644 --- a/libs/s25main/buildings/nobBaseWarehouse.h +++ b/libs/s25main/buildings/nobBaseWarehouse.h @@ -82,7 +82,7 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable private: /// Check if soldiers can be recruited - bool CanRecruitSoldiers(); + bool canRecruitSoldiers(); /// Derived classes may use ordered wares immediately, e.g. for sending via ship instead of by road /// Return true if so and take ownership of the ware virtual bool UseWareAtOnce(std::unique_ptr& /*ware*/, noBaseBuilding& /*goal*/) { return false; } @@ -143,7 +143,7 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable public: void Serialize(SerializedGameData& sgd) const override; - const Inventory& GetInventory() const; + const Inventory& getInventory() const; /// Adds specified goods and people. If addToPlayer is true, /// then they are also added to the owners inventory (for newly created/arrived goods) @@ -153,37 +153,37 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable void AddToInventory(const GoodCounts& goods, bool addToPlayer); /// Gibt Anzahl der Waren bzw. Figuren zurück - unsigned GetNumRealWares(GoodType type) const { return inventory.real[type]; } - unsigned GetNumRealFigures(Job job) const { return inventory.real[job]; } - unsigned GetNumRealArmoredFigures(ArmoredSoldier job) const { return inventory.real[job]; } - unsigned GetNumVisualWares(GoodType type) const { return inventory.visual[type]; } - unsigned GetNumVisualFigures(Job job) const { return inventory.visual[job]; } - unsigned GetNumVisualArmoredFigures(ArmoredSoldier job) const { return inventory.visual[job]; } + unsigned getNumRealWares(GoodType type) const { return inventory.real[type]; } + unsigned getNumRealFigures(Job job) const { return inventory.real[job]; } + unsigned getNumRealArmoredFigures(ArmoredSoldier job) const { return inventory.real[job]; } + unsigned getNumVisualWares(GoodType type) const { return inventory.visual[type]; } + unsigned getNumVisualFigures(Job job) const { return inventory.visual[job]; } + unsigned getNumVisualArmoredFigures(ArmoredSoldier job) const { return inventory.visual[job]; } /// Gibt Ein/Auslagerungseinstellungen zurück - InventorySetting GetInventorySettingVisual(Job job) const; - InventorySetting GetInventorySettingVisual(GoodType ware) const; - InventorySetting GetInventorySetting(Job job) const; - InventorySetting GetInventorySetting(GoodType ware) const; + InventorySetting getInventorySettingVisual(Job job) const; + InventorySetting getInventorySettingVisual(GoodType ware) const; + InventorySetting getInventorySetting(Job job) const; + InventorySetting getInventorySetting(GoodType ware) const; // Convenience functions - bool IsInventorySettingVisual(const Job job, const EInventorySetting setting) const + bool isInventorySettingVisual(const Job job, const EInventorySetting setting) const { - return GetInventorySettingVisual(job).IsSet(setting); + return getInventorySettingVisual(job).isSet(setting); } - bool IsInventorySettingVisual(const GoodType ware, const EInventorySetting setting) const + bool isInventorySettingVisual(const GoodType ware, const EInventorySetting setting) const { - return GetInventorySettingVisual(ware).IsSet(setting); + return getInventorySettingVisual(ware).isSet(setting); } - bool IsInventorySetting(const Job job, const EInventorySetting setting) const + bool isInventorySetting(const Job job, const EInventorySetting setting) const { - return GetInventorySetting(job).IsSet(setting); + return getInventorySetting(job).isSet(setting); } - bool IsInventorySetting(const GoodType ware, const EInventorySetting setting) const + bool isInventorySetting(const GoodType ware, const EInventorySetting setting) const { - return GetInventorySetting(ware).IsSet(setting); + return getInventorySetting(ware).isSet(setting); } - void SetInventorySettingVisual(const boost_variant2& what, InventorySetting state); + void setInventorySettingVisual(const boost_variant2& what, InventorySetting state); /// Bestellt einen Träger void OrderCarrier(noRoadNode& goal, RoadSegment& workplace); @@ -194,7 +194,7 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable /// "Bestellt" eine Ware --> gibt den Pointer auf die Ware zurück Ware* OrderWare(GoodType good, noBaseBuilding& goal); /// Returns true, if the given job can be recruited. Excludes soldiers and carriers! - bool CanRecruit(Job job) const; + bool canRecruit(Job job) const; /// Wird von den Lagerhaus-Arbeitern aufgerufen, wenn sie ein Ware wieder zurückbringen, die sie vorne nicht ablegen /// konnten @@ -215,9 +215,9 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable /// Eine bestellte Ware konnte doch nicht kommen void WareLost(Ware& ware) override; /// Bestellte Ware, die sich noch hier drin befindet, storniert ihre Auslieferung - void CancelWare(Ware*& ware); + void cancelWare(Ware*& ware); /// Bestellte Figur, die sich noch ind er Warteschlange befindet, kommt nicht mehr und will rausgehauen werden - virtual void CancelFigure(noFigure* figure); + virtual void cancelFigure(noFigure* figure); /// Wird aufgerufen, wenn eine neue Ware zum dem Gebäude geliefert wird (nicht wenn sie bestellt wurde vom Gebäude!) void TakeWare(Ware* ware) override; @@ -225,30 +225,30 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable /// Fügt eine Figur hinzu, die auf dem Weg zum Lagerhaus ist void AddDependentFigure(noFigure& figure) { - RTTR_Assert(!IsDependentFigure(figure)); + RTTR_Assert(!isDependentFigure(figure)); dependent_figures.push_back(&figure); } //// Entfernt eine abhängige Figur wieder aus der Liste virtual void RemoveDependentFigure(noFigure& figure) { - RTTR_Assert(IsDependentFigure(figure)); + RTTR_Assert(isDependentFigure(figure)); dependent_figures.remove(&figure); } /// Wird aufgerufen, wenn ein Arbeiter hierher kommt void GotWorker(Job /*job*/, noFigure& worker) override { - RTTR_Assert(!IsDependentFigure(worker)); + RTTR_Assert(!isDependentFigure(worker)); dependent_figures.push_back(&worker); } //// Entfernt eine abhängige Ware wieder aus der Liste (wird mit TakeWare hinzugefügt) void RemoveDependentWare(Ware& ware) { - RTTR_Assert(IsWareDependent(ware)); + RTTR_Assert(isWareDependent(ware)); dependent_wares.remove(&ware); } /// Überprüft, ob Ware abhängig ist - bool IsWareDependent(const Ware& ware); + bool isWareDependent(const Ware& ware); /// Prüft, ob es Waren zum Auslagern gibt bool AreWaresToEmpty() const; @@ -256,10 +256,10 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable /// Fügt aktiven Soldaten (der aus von einer Mission) zum Militärgebäude hinzu void AddActiveSoldier(std::unique_ptr soldier) override; /// Gibt Gesamtanzahl aller im Lager befindlichen Soldaten zurück - unsigned GetNumSoldiers() const + unsigned getNumSoldiers() const { - return GetNumRealFigures(Job::Private) + GetNumRealFigures(Job::PrivateFirstClass) - + GetNumRealFigures(Job::Sergeant) + GetNumRealFigures(Job::Officer) + GetNumRealFigures(Job::General); + return getNumRealFigures(Job::Private) + getNumRealFigures(Job::PrivateFirstClass) + + getNumRealFigures(Job::Sergeant) + getNumRealFigures(Job::Officer) + getNumRealFigures(Job::General); } /// Order troops of each rank according to `counts` without exceeding `max` in total. The number of soldiers /// of each rank that is sent out is subtracted from the corresponding count in `counts` and from `max`. @@ -274,32 +274,32 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable bool DefendersAvailable() const override; /// Verändert Reserveeinstellung - void SetReserveVisual(unsigned rank, unsigned count); - void SetRealReserve(unsigned rank, unsigned count); + void setReserveVisual(unsigned rank, unsigned count); + void setRealReserve(unsigned rank, unsigned count); /// Versucht, die geforderten Reserve-Soldaten bereitzustellen void RefreshReserve(unsigned rank); /// Gibt Zeiger auf dir Reserve zurück für das GUI - const unsigned* GetReserveAvailablePointer(unsigned rank) const { return &reserve_soldiers_available[rank]; } - const unsigned* GetReserveArmoredAvailablePointer(unsigned rank) const + const unsigned* getReserveAvailablePointer(unsigned rank) const { return &reserve_soldiers_available[rank]; } + const unsigned* getReserveArmoredAvailablePointer(unsigned rank) const { return &reserve_soldiers_available_with_armor[rank]; } - const unsigned* GetReserveClaimedVisualPointer(unsigned rank) const + const unsigned* getReserveClaimedVisualPointer(unsigned rank) const { return &reserve_soldiers_claimed_visual[rank]; } - unsigned GetReserveClaimed(unsigned rank) const { return reserve_soldiers_claimed_real[rank]; } + unsigned getReserveClaimed(unsigned rank) const { return reserve_soldiers_claimed_real[rank]; } /// Available goods of a specific type that can be used for trading - unsigned GetAvailableWaresForTrading(GoodType gt) const; + unsigned getAvailableWaresForTrading(GoodType gt) const; /// Available figures of a specific type that can be used for trading - unsigned GetAvailableFiguresForTrading(Job job) const; + unsigned getAvailableFiguresForTrading(Job job) const; /// Starts a trade caravane from this warehouse void StartTradeCaravane(const boost_variant2& what, unsigned count, const TradeRoute& tr, nobBaseWarehouse* goal); /// For debug only - bool IsDependentFigure(const noFigure& fig) const; + bool isDependentFigure(const noFigure& fig) const; }; diff --git a/libs/s25main/buildings/nobHQ.cpp b/libs/s25main/buildings/nobHQ.cpp index ae395d1711..11682b2120 100644 --- a/libs/s25main/buildings/nobHQ.cpp +++ b/libs/s25main/buildings/nobHQ.cpp @@ -17,7 +17,7 @@ nobHQ::nobHQ(const MapPoint pos, const unsigned char player, const Nation nation : nobBaseWarehouse(BuildingType::Headquarters, pos, player, nation), isTent_(isTent) { // Take 1 as the reserve per rank - for(unsigned i = 0; i <= world->GetGGS().GetMaxMilitaryRank(); ++i) + for(unsigned i = 0; i <= world->getGGS().getMaxMilitaryRank(); ++i) { reserve_soldiers_claimed_visual[i] = reserve_soldiers_claimed_real[i] = 1; RefreshReserve(i); @@ -27,7 +27,7 @@ nobHQ::nobHQ(const MapPoint pos, const unsigned char player, const Nation nation TryRecruiting(); // ins Militärquadrat einfügen - world->GetMilitarySquares().Add(this); + world->getMilitarySquares().Add(this); world->RecalcTerritory(*this, TerritoryChangeReason::Build); } @@ -319,14 +319,14 @@ GoodsAndPeopleCounts nobHQ::getStartInventory(StartWares setting) void nobHQ::addStartWares() { - AddToInventory(getStartInventory(world->GetGGS().startWares), true); + AddToInventory(getStartInventory(world->getGGS().startWares), true); } void nobHQ::DestroyBuilding() { nobBaseWarehouse::DestroyBuilding(); // Wieder aus dem Militärquadrat rauswerfen - world->GetMilitarySquares().Remove(this); + world->getMilitarySquares().Remove(this); // Recalc territory. AFTER calling base destroy as otherwise figures might get stuck here world->RecalcTerritory(*this, TerritoryChangeReason::Destroyed); } @@ -339,7 +339,7 @@ void nobHQ::Serialize(SerializedGameData& sgd) const nobHQ::nobHQ(SerializedGameData& sgd, const unsigned obj_id) : nobBaseWarehouse(sgd, obj_id), isTent_(sgd.PopBool()) { - world->GetMilitarySquares().Add(this); + world->getMilitarySquares().Add(this); } void nobHQ::Draw(DrawPoint drawPt) @@ -352,14 +352,14 @@ void nobHQ::Draw(DrawPoint drawPt) // Draw at most 4 flags const unsigned numSoldiers = - std::accumulate(reserve_soldiers_available.begin(), reserve_soldiers_available.end(), GetNumSoldiers()); + std::accumulate(reserve_soldiers_available.begin(), reserve_soldiers_available.end(), getNumSoldiers()); DrawPoint flagsPos = drawPt + TROOPS_FLAG_HQ_OFFSET[nation]; for(auto i = std::min(numSoldiers, 4); i; --i) { glArchivItem_Bitmap_Player* bitmap = - LOADER.GetMapPlayerImage(3162 + GAMECLIENT.GetGlobalAnimation(8, 80, 40, GetX() * GetY() * i)); + LOADER.getMapPlayerImage(3162 + GAMECLIENT.getGlobalAnimation(8, 80, 40, getX() * getY() * i)); if(bitmap) - bitmap->drawForPlayer(flagsPos + DrawPoint(0, (i - 1) * 3), world->GetPlayer(player).color); + bitmap->drawForPlayer(flagsPos + DrawPoint(0, (i - 1) * 3), world->getPlayer(player).color); } } } diff --git a/libs/s25main/buildings/nobHQ.h b/libs/s25main/buildings/nobHQ.h index 26a8d7db08..6e11ab73fb 100644 --- a/libs/s25main/buildings/nobHQ.h +++ b/libs/s25main/buildings/nobHQ.h @@ -23,15 +23,15 @@ class nobHQ : public nobBaseWarehouse void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NobHq; } + GO_Type getGOT() const final { return GO_Type::NobHq; } void Draw(DrawPoint drawPt) override; - unsigned GetMilitaryRadius() const override { return HQ_RADIUS; } + unsigned getMilitaryRadius() const override { return HQ_RADIUS; } void HandleEvent(unsigned id) override; - bool IsTent() const { return isTent_; } - void SetIsTent(const bool isTent) { isTent_ = isTent; } + bool isTent() const { return isTent_; } + void setIsTent(const bool isTent) { isTent_ = isTent; } protected: void DestroyBuilding() override; diff --git a/libs/s25main/buildings/nobHarborBuilding.cpp b/libs/s25main/buildings/nobHarborBuilding.cpp index a100631ac4..e6d6bf48ca 100644 --- a/libs/s25main/buildings/nobHarborBuilding.cpp +++ b/libs/s25main/buildings/nobHarborBuilding.cpp @@ -56,11 +56,11 @@ nobHarborBuilding::nobHarborBuilding(const MapPoint pos, const unsigned char pla : nobBaseWarehouse(BuildingType::HarborBuilding, pos, player, nation), orderware_ev(nullptr) { // ins Militärquadrat einfügen - world->GetMilitarySquares().Add(this); + world->getMilitarySquares().Add(this); world->RecalcTerritory(*this, TerritoryChangeReason::Build); // Take 1 as the reserve per rank - for(unsigned i = 0; i <= world->GetGGS().GetMaxMilitaryRank(); ++i) + for(unsigned i = 0; i <= world->getGGS().getMaxMilitaryRank(); ++i) { reserve_soldiers_claimed_visual[i] = reserve_soldiers_claimed_real[i] = 1; RefreshReserve(i); @@ -68,20 +68,20 @@ nobHarborBuilding::nobHarborBuilding(const MapPoint pos, const unsigned char pla /// Die Meere herausfinden, an die dieser Hafen grenzt for(const auto dir : helpers::EnumRange{}) - seaIds[dir] = world->GetSeaFromCoastalPoint(world->GetNeighbour(pos, dir)); + seaIds[dir] = world->getSeaFromCoastalPoint(world->getNeighbour(pos, dir)); // Post versenden SendPostMessage(player, - std::make_unique(GetEvMgr().GetCurrentGF(), _("New harbor building finished"), + std::make_unique(getEvMgr().getCurrentGF(), _("New harbor building finished"), PostCategory::Economy, *this)); } void nobHarborBuilding::DestroyBuilding() { - GetEvMgr().RemoveEvent(orderware_ev); + getEvMgr().RemoveEvent(orderware_ev); // Der Wirtschaftsverwaltung Bescheid sagen - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); // Baumaterialien in der Inventur verbuchen if(expedition.active) @@ -99,7 +99,7 @@ void nobHarborBuilding::DestroyBuilding() if(exploration_expedition.active) { inventory.real.Add(Job::Scout, exploration_expedition.scouts); - for(unsigned i = exploration_expedition.scouts; i < world->GetGGS().GetNumScoutsExpedition(); i++) + for(unsigned i = exploration_expedition.scouts; i < world->getGGS().getNumScoutsExpedition(); i++) owner.OneJobNotWanted(Job::Scout, this); } // cancel all jobs wanted for this building @@ -127,10 +127,10 @@ void nobHarborBuilding::DestroyBuilding() { nofAttacker& soldier = world->AddFigure(pos, std::move(soldiers_for_ship.attacker)); - soldier.CancelSeaAttack(); - RTTR_Assert(!soldier.GetAttackedGoal()); - RTTR_Assert(!soldier.GetHomeBld()); - RTTR_Assert(!soldier.GetGoal()); + soldier.cancelSeaAttack(); + RTTR_Assert(!soldier.getAttackedGoal()); + RTTR_Assert(!soldier.getHomeBld()); + RTTR_Assert(!soldier.getGoal()); soldier.StartWandering(); soldier.StartWalking(RANDOM_ENUM(Direction)); } @@ -138,7 +138,7 @@ void nobHarborBuilding::DestroyBuilding() nobBaseWarehouse::DestroyBuilding(); - world->GetMilitarySquares().Remove(this); + world->getMilitarySquares().Remove(this); // Recalc territory. AFTER calling base destroy as otherwise figures might get stuck here world->RecalcTerritory(*this, TerritoryChangeReason::Destroyed); } @@ -169,7 +169,7 @@ nobHarborBuilding::nobHarborBuilding(SerializedGameData& sgd, const unsigned obj : nobBaseWarehouse(sgd, obj_id), expedition(sgd), exploration_expedition(sgd), orderware_ev(sgd.PopEvent()) { // ins Militärquadrat einfügen - world->GetMilitarySquares().Add(this); + world->getMilitarySquares().Add(this); helpers::popContainer(sgd, seaIds); @@ -216,18 +216,18 @@ void nobHarborBuilding::Draw(DrawPoint drawPt) // Hafenfeuer zeichnen // TODO auch für nicht-römer machen if(nation == Nation::Romans || nation == Nation::Japanese || nation == Nation::Babylonians) { - LOADER.GetNationImage(nation, 500 + 5 * GAMECLIENT.GetGlobalAnimation(8, 2, 1, GetObjId() + GetX() + GetY())) + LOADER.getNationImage(nation, 500 + 5 * GAMECLIENT.getGlobalAnimation(8, 2, 1, getObjId() + getX() + getY())) ->DrawFull(drawPt + FIRE_POS[nation]); } else if(nation == Nation::Africans || nation == Nation::Vikings) { - LOADER.GetMapTexture(740 + GAMECLIENT.GetGlobalAnimation(8, 5, 2, GetObjId() + GetX() + GetY())) + LOADER.getMapTexture(740 + GAMECLIENT.getGlobalAnimation(8, 5, 2, getObjId() + getX() + getY())) ->DrawFull(drawPt + FIRE_POS[nation]); } if(nation == Nation::Romans) { // Zusätzliches Feuer - LOADER.GetMapTexture(740 + GAMECLIENT.GetGlobalAnimation(8, 5, 2, GetObjId() + GetX() + GetY())) + LOADER.getMapTexture(740 + GAMECLIENT.getGlobalAnimation(8, 5, 2, getObjId() + getX() + getY())) ->DrawFull(drawPt + EXTRAFIRE_POS[nation]); } @@ -239,16 +239,16 @@ void nobHarborBuilding::Draw(DrawPoint drawPt) // Bretter DrawPoint boardsPos = drawPt + BOARDS_POS[nation]; for(unsigned char i = 0; i < expedition.boards; ++i) - LOADER.GetWareStackTex(GoodType::Boards)->DrawFull(boardsPos - DrawPoint(0, i * 4)); + LOADER.getWareStackTex(GoodType::Boards)->DrawFull(boardsPos - DrawPoint(0, i * 4)); DrawPoint stonesPos = drawPt + STONES_POS[nation]; // Steine for(unsigned char i = 0; i < expedition.stones; ++i) - LOADER.GetWareStackTex(GoodType::Stones)->DrawFull(stonesPos - DrawPoint(0, i * 4)); + LOADER.getWareStackTex(GoodType::Stones)->DrawFull(stonesPos - DrawPoint(0, i * 4)); // Und den Bauarbeiter, falls er schon da ist if(expedition.builder) { - unsigned id = GAMECLIENT.GetGlobalAnimation(1000, 7, 1, GetX() + GetY()); + unsigned id = GAMECLIENT.getGlobalAnimation(1000, 7, 1, getX() + getY()); const int WALKING_DISTANCE = 30; @@ -260,11 +260,11 @@ void nobHarborBuilding::Draw(DrawPoint drawPt) DrawPoint builderPos = drawPt + BUILDER_POS[nation]; if(id < 500) LOADER.getBobSprite(nation, Job::Builder, Direction::West, walking_id) - .draw(builderPos - DrawPoint(walking_distance, 0), COLOR_WHITE, world->GetPlayer(player).color); + .draw(builderPos - DrawPoint(walking_distance, 0), COLOR_WHITE, world->getPlayer(player).color); else LOADER.getBobSprite(nation, Job::Builder, Direction::East, walking_id) .draw(builderPos + DrawPoint(walking_distance - WALKING_DISTANCE, 0), COLOR_WHITE, - world->GetPlayer(player).color); + world->getPlayer(player).color); } } } @@ -311,10 +311,10 @@ void nobHarborBuilding::StartExpedition() bool convert = true; expedition.builder = false; // got a builder in ANY storehouse? - GamePlayer& owner = world->GetPlayer(player); - for(const nobBaseWarehouse* wh : owner.GetBuildingRegister().GetStorehouses()) //-V807 + GamePlayer& owner = world->getPlayer(player); + for(const nobBaseWarehouse* wh : owner.getBuildingRegister().getStorehouses()) //-V807 { - if(wh->GetNumRealFigures(Job::Builder)) + if(wh->getNumRealFigures(Job::Builder)) { convert = false; break; @@ -360,11 +360,11 @@ void nobHarborBuilding::StopExpedition() { inventory.Add(Job::Builder); // Evtl. Abnehmer für die Figur wieder finden - world->GetPlayer(player).FindWarehouseForAllJobs(Job::Builder); + world->getPlayer(player).FindWarehouseForAllJobs(Job::Builder); } else // todo falls noch nicht da - unterscheiden ob unterwegs oder nur bestellt - falls bestellt stornieren sonst // informieren damit kein ersatz geschickt wird falls was nicht klappt aufm weg { - world->GetPlayer(player).OneJobNotWanted(Job::Builder, this); + world->getPlayer(player).OneJobNotWanted(Job::Builder, this); } } @@ -380,15 +380,15 @@ void nobHarborBuilding::StartExplorationExpedition() exploration_expedition.scouts = 0; // Look for missing scouts - const unsigned numScoutsRequired = world->GetGGS().GetNumScoutsExpedition(); + const unsigned numScoutsRequired = world->getGGS().getNumScoutsExpedition(); if(inventory[Job::Scout] < numScoutsRequired) { unsigned missing = numScoutsRequired - inventory[Job::Scout]; // got scouts in ANY storehouse? - GamePlayer& owner = world->GetPlayer(player); - for(const nobBaseWarehouse* wh : owner.GetBuildingRegister().GetStorehouses()) //-V807 + GamePlayer& owner = world->getPlayer(player); + for(const nobBaseWarehouse* wh : owner.getBuildingRegister().getStorehouses()) //-V807 { - const unsigned numScouts = wh->GetNumRealFigures(Job::Scout); + const unsigned numScouts = wh->getNumRealFigures(Job::Scout); if(numScouts >= missing) { missing = 0; @@ -419,9 +419,9 @@ void nobHarborBuilding::StopExplorationExpedition() // Dann diese stoppen exploration_expedition.active = false; // cancel order for scouts - for(unsigned i = exploration_expedition.scouts; i < world->GetGGS().GetNumScoutsExpedition(); i++) + for(unsigned i = exploration_expedition.scouts; i < world->getGGS().getNumScoutsExpedition(); i++) { - world->GetPlayer(player).OneJobNotWanted(Job::Scout, this); + world->getPlayer(player).OneJobNotWanted(Job::Scout, this); } // Erkunder zurücktransferieren if(exploration_expedition.scouts) @@ -429,15 +429,15 @@ void nobHarborBuilding::StopExplorationExpedition() inventory.real.Add(Job::Scout, exploration_expedition.scouts); exploration_expedition.scouts = 0; // Evtl. Abnehmer für die Figur wieder finden - world->GetPlayer(player).FindWarehouseForAllJobs(Job::Scout); + world->getPlayer(player).FindWarehouseForAllJobs(Job::Scout); } } /// Bestellt die zusätzlichen erforderlichen Waren für eine Expedition void nobHarborBuilding::OrderExpeditionWares() { - RTTR_Assert(!IsBeingDestroyedNow()); // Wares should already be canceled! - if(this->IsBeingDestroyedNow()) // don't order new stuff if we are about to be destroyed + RTTR_Assert(!isBeingDestroyedNow()); // Wares should already be canceled! + if(this->isBeingDestroyedNow()) // don't order new stuff if we are about to be destroyed return; if(!expedition.active) // expedition no longer active? @@ -461,10 +461,10 @@ void nobHarborBuilding::OrderExpeditionWares() Ware* ware; do { - ware = world->GetPlayer(player).OrderWare(GoodType::Boards, *this); + ware = world->getPlayer(player).OrderWare(GoodType::Boards, *this); if(ware) { - RTTR_Assert(IsWareDependent(*ware)); + RTTR_Assert(isWareDependent(*ware)); --todo_boards; } } while(ware && todo_boards); @@ -477,10 +477,10 @@ void nobHarborBuilding::OrderExpeditionWares() Ware* ware; do { - ware = world->GetPlayer(player).OrderWare(GoodType::Stones, *this); + ware = world->getPlayer(player).OrderWare(GoodType::Stones, *this); if(ware) { - RTTR_Assert(IsWareDependent(*ware)); + RTTR_Assert(isWareDependent(*ware)); --todo_stones; } } while(ware && todo_stones); @@ -488,13 +488,13 @@ void nobHarborBuilding::OrderExpeditionWares() // Wenn immer noch nicht alles da ist, später noch einmal bestellen if(!orderware_ev) - orderware_ev = GetEvMgr().AddEvent(this, 210, 10); + orderware_ev = getEvMgr().AddEvent(this, 210, 10); } /// Eine bestellte Ware konnte doch nicht kommen void nobHarborBuilding::WareLost(Ware& ware) { - RTTR_Assert(!IsBeingDestroyedNow()); + RTTR_Assert(!isBeingDestroyedNow()); // ggf. neue Waren für Expedition bestellen if(expedition.active && (ware.type == GoodType::Boards || ware.type == GoodType::Stones)) OrderExpeditionWares(); @@ -523,7 +523,7 @@ void nobHarborBuilding::ShipArrived(noShip& ship) ++it; } - ship.PrepareSeaAttack(GetHarborPosID(), ship_dest, std::move(attackers)); + ship.PrepareSeaAttack(getHarborPosID(), ship_dest, std::move(attackers)); return; } // Expedition ready? @@ -534,16 +534,16 @@ void nobHarborBuilding::ShipArrived(noShip& ship) // Aufräumen am Hafen expedition.active = false; // Expedition starten - ship.StartExpedition(GetHarborPosID()); + ship.StartExpedition(getHarborPosID()); return; } // Exploration-Expedition ready? - if(IsExplorationExpeditionReady()) + if(isExplorationExpeditionReady()) { // Aufräumen am Hafen exploration_expedition.active = false; // Expedition starten - ship.StartExplorationExpedition(GetHarborPosID()); + ship.StartExplorationExpedition(getHarborPosID()); inventory.visual.Remove(Job::Scout, exploration_expedition.scouts); return; } @@ -558,9 +558,9 @@ void nobHarborBuilding::ShipArrived(noShip& ship) bool gotdest = false; for(const auto& figureForShip : figures_for_ships) { - noBase* nb = world->GetNO(figureForShip.dest); - if(nb->GetGOT() == GO_Type::NobHarborbuilding - && world->GetNode(figureForShip.dest).owner + noBase* nb = world->getNO(figureForShip.dest); + if(nb->getGOT() == GO_Type::NobHarborbuilding + && world->getNode(figureForShip.dest).owner == player + 1) // target is a harbor and owned by the same player { dest = figureForShip.dest; @@ -570,11 +570,11 @@ void nobHarborBuilding::ShipArrived(noShip& ship) } for(const auto& wareForShip : wares_for_ships) { - noBase* nb = world->GetNO(wareForShip->GetNextHarbor()); - if(nb->GetGOT() == GO_Type::NobHarborbuilding - && world->GetNode(wareForShip->GetNextHarbor()).owner == player + 1) + noBase* nb = world->getNO(wareForShip->getNextHarbor()); + if(nb->getGOT() == GO_Type::NobHarborbuilding + && world->getNode(wareForShip->getNextHarbor()).owner == player + 1) { - dest = wareForShip->GetNextHarbor(); + dest = wareForShip->getNextHarbor(); gotdest = true; break; } @@ -601,7 +601,7 @@ void nobHarborBuilding::ShipArrived(noShip& ship) for(auto it = wares_for_ships.begin(); it != wares_for_ships.end() && figures.size() + wares.size() < SHIP_CAPACITY;) { - if((*it)->GetNextHarbor() == dest) + if((*it)->getNextHarbor() == dest) { (*it)->StartShipJourney(); inventory.visual.Remove(ConvertShields((*it)->type)); @@ -612,35 +612,35 @@ void nobHarborBuilding::ShipArrived(noShip& ship) } // Und das Schiff starten lassen - ship.PrepareTransport(GetHarborPosID(), dest, std::move(figures), std::move(wares)); + ship.PrepareTransport(getHarborPosID(), dest, std::move(figures), std::move(wares)); } } } void nobHarborBuilding::AddWare(std::unique_ptr ware) { - if(ware->GetGoal() && ware->GetGoal() != this) + if(ware->getGoal() && ware->getGoal() != this) { // This is not the goal but we have one -> Get new route ware->RecalcRoute(); // Go by ship next? - if(ware->GetNextDir() == RoadPathDirection::Ship) + if(ware->getNextDir() == RoadPathDirection::Ship) { AddWareForShip(std::move(ware)); return; } - if(ware->GetNextDir() != RoadPathDirection::None) + if(ware->getNextDir() != RoadPathDirection::None) { // Travel on roads -> Carry out - RTTR_Assert(ware->GetGoal() != this); + RTTR_Assert(ware->getGoal() != this); AddWaitingWare(std::move(ware)); return; } // No next dir means the ware reached its goal, i.e. us, // or there is no valid, reachable goal // In both cases we take it as we initially would have. - if(ware->GetGoal() && ware->GetGoal() != this) + if(ware->getGoal() && ware->getGoal() != this) { // We have a goal but it isn't this and there is no next dir // This can only happen when the ware was redirected to a warehouse while being carried, @@ -650,12 +650,12 @@ void nobHarborBuilding::AddWare(std::unique_ptr ware) // and next_dir is None then goal will be NULL or us. // So the condition of this branch can never be true and the branch can be replaced by: // RTTR_Assert(!ware->GetGoal() || ware->GetGoal() == this) - RTTR_Assert(ware->IsCarried()); + RTTR_Assert(ware->isCarried()); // Explicitly calculate the route which now should set it. ware->RecalcRoute(); - RTTR_Assert(ware->GetGoal()); - RTTR_Assert(ware->GetNextDir() != RoadPathDirection::None); - if(ware->GetNextDir() == RoadPathDirection::Ship) + RTTR_Assert(ware->getGoal()); + RTTR_Assert(ware->getNextDir() != RoadPathDirection::None); + if(ware->getNextDir() == RoadPathDirection::Ship) AddWareForShip(std::move(ware)); else AddWaitingWare(std::move(ware)); @@ -673,10 +673,10 @@ void nobHarborBuilding::AddWare(std::unique_ptr ware) { // Don't wait for it any longer if it had a goal, i.e. us. // Without a goal it was a "lost" ware. - if(ware->GetGoal()) + if(ware->getGoal()) RemoveDependentWare(*ware); // Add to expedition - world->GetPlayer(player).RemoveWare(*ware); + world->getPlayer(player).RemoveWare(*ware); if(ware->type == GoodType::Boards) ++expedition.boards; else @@ -695,24 +695,24 @@ void nobHarborBuilding::AddWare(std::unique_ptr ware) void nobHarborBuilding::AddFigure(std::unique_ptr figure, const bool increase_visual_counts) { // Brauchen wir einen Bauarbeiter für die Expedition? - if(figure->GetJobType() == Job::Builder && expedition.active && !expedition.builder) + if(figure->getJobType() == Job::Builder && expedition.active && !expedition.builder) { // Make sure the figure came from outside and was not already here waiting for a ship - if(IsDependentFigure(*figure)) + if(isDependentFigure(*figure)) nobBaseWarehouse::RemoveDependentFigure(*figure); - GetEvMgr().AddToKillList(std::move(figure)); + getEvMgr().AddToKillList(std::move(figure)); expedition.builder = true; // Ggf. ist jetzt alles benötigte da CheckExpeditionReady(); } // Brauchen wir einen Spähter für die Expedition? - else if(figure->GetJobType() == Job::Scout && exploration_expedition.active && !IsExplorationExpeditionReady()) + else if(figure->getJobType() == Job::Scout && exploration_expedition.active && !isExplorationExpeditionReady()) { // Make sure the figure came from outside and was not already here waiting for a ship - if(IsDependentFigure(*figure)) + if(isDependentFigure(*figure)) nobBaseWarehouse::RemoveDependentFigure(*figure); - GetEvMgr().AddToKillList(std::move(figure)); + getEvMgr().AddToKillList(std::move(figure)); ++exploration_expedition.scouts; inventory.visual.Add(Job::Scout); @@ -724,7 +724,7 @@ void nobHarborBuilding::AddFigure(std::unique_ptr figure, const bool i } /// Gibt zurück, ob Expedition vollständig ist -bool nobHarborBuilding::IsExpeditionReady() const +bool nobHarborBuilding::isExpeditionReady() const { if(!expedition.active) return false; @@ -740,12 +740,12 @@ bool nobHarborBuilding::IsExpeditionReady() const } /// Gibt zurück, ob Expedition vollständig ist -bool nobHarborBuilding::IsExplorationExpeditionReady() const +bool nobHarborBuilding::isExplorationExpeditionReady() const { if(!exploration_expedition.active) return false; // Alles da? - if(exploration_expedition.scouts < world->GetGGS().GetNumScoutsExpedition()) + if(exploration_expedition.scouts < world->getGGS().getNumScoutsExpedition()) return false; return true; @@ -756,7 +756,7 @@ void nobHarborBuilding::CheckExpeditionReady() { // Alles da? // Dann bestellen wir mal das Schiff - if(IsExpeditionReady()) + if(isExpeditionReady()) OrderShip(); } @@ -765,7 +765,7 @@ void nobHarborBuilding::CheckExplorationExpeditionReady() { // Alles da? // Dann bestellen wir mal das Schiff - if(IsExplorationExpeditionReady()) + if(isExplorationExpeditionReady()) OrderShip(); } @@ -777,9 +777,9 @@ void nobHarborBuilding::ShipLost(noShip* /*ship*/) } /// Gibt die Hafenplatz-ID zurück, auf der der Hafen steht -HarborId nobHarborBuilding::GetHarborPosID() const +HarborId nobHarborBuilding::getHarborPosID() const { - return world->GetHarborPointID(pos); + return world->getHarborPointID(pos); } /// Abfangen, wenn ein Mann nicht mehr kommen kann --> könnte ein Bauarbeiter sein und @@ -788,63 +788,63 @@ void nobHarborBuilding::RemoveDependentFigure(noFigure& figure) { nobBaseWarehouse::RemoveDependentFigure(figure); // Ist das ein Bauarbeiter und brauchen wir noch einen - if(figure.GetJobType() == Job::Builder && expedition.active && !expedition.builder) + if(figure.getJobType() == Job::Builder && expedition.active && !expedition.builder) { // Alle Figuren durchkommen, die noch hierher kommen wollen und gucken, ob ein // Bauarbeiter dabei ist for(noFigure* dependent_figure : dependent_figures) { - if(dependent_figure->GetJobType() == Job::Builder) + if(dependent_figure->getJobType() == Job::Builder) // Brauchen keinen bestellen, also raus return; } // Keinen gefunden, also müssen wir noch einen bestellen - world->GetPlayer(player).AddJobWanted(Job::Builder, this); + world->getPlayer(player).AddJobWanted(Job::Builder, this); } // Ist das ein Erkunder und brauchen wir noch welche? - else if(figure.GetJobType() == Job::Scout && exploration_expedition.active) + else if(figure.getJobType() == Job::Scout && exploration_expedition.active) { unsigned scouts_coming = 0; for(noFigure* dependent_figure : dependent_figures) { - if(dependent_figure->GetJobType() == Job::Scout) + if(dependent_figure->getJobType() == Job::Scout) ++scouts_coming; } // Wenn nicht genug Erkunder mehr kommen, müssen wir einen neuen bestellen - if(exploration_expedition.scouts + scouts_coming < world->GetGGS().GetNumScoutsExpedition()) - world->GetPlayer(player).AddJobWanted(Job::Scout, this); + if(exploration_expedition.scouts + scouts_coming < world->getGGS().getNumScoutsExpedition()) + world->getPlayer(player).AddJobWanted(Job::Scout, this); } } /// Gibt eine Liste mit möglichen Verbindungen zurück -std::vector nobHarborBuilding::GetShipConnections() const +std::vector nobHarborBuilding::getShipConnections() const { std::vector connections; // Is the harbor being destroyed right now? Could happen due to pathfinding for wares that get notified about this // buildings destruction - if(IsBeingDestroyedNow()) + if(isBeingDestroyedNow()) return connections; // Should already be handled by the above check, but keep the runtime check for now (TODO: remove runtime check) - RTTR_Assert(world->GetGOT(pos) == GO_Type::NobHarborbuilding); + RTTR_Assert(world->getGOT(pos) == GO_Type::NobHarborbuilding); // Is there any harbor building at all? (could be destroyed)? - if(world->GetGOT(pos) != GO_Type::NobHarborbuilding) + if(world->getGOT(pos) != GO_Type::NobHarborbuilding) return connections; const auto getSharedSea = [&seaIds = this->seaIds, world = this->world](const nobHarborBuilding& harbor) { for(SeaId seaId : seaIds) { - if(seaId && world->IsHarborAtSea(harbor.GetHarborPosID(), seaId)) + if(seaId && world->isHarborAtSea(harbor.getHarborPosID(), seaId)) return seaId; } return SeaId::invalidValue(); }; - for(auto* harbor_building : world->GetPlayer(player).GetBuildingRegister().GetHarbors()) + for(auto* harbor_building : world->getPlayer(player).getBuildingRegister().getHarbors()) { if(harbor_building == this) continue; @@ -856,7 +856,7 @@ std::vector nobHarborBuilding::GetShipConnect // Use twice the distance as cost (ship might need to arrive first) and a fixed value to represent // loading&unloading sc.way_costs = - 2 * world->GetHarborDistance(GetHarborPosID(), harbor_building->GetHarborPosID(), seaId) + 10; + 2 * world->getHarborDistance(getHarborPosID(), harbor_building->getHarborPosID(), seaId) + 10; connections.push_back(sc); } } @@ -866,7 +866,7 @@ std::vector nobHarborBuilding::GetShipConnect /// Fügt einen Mensch hinzu, der mit dem Schiff irgendwo hin fahren will void nobHarborBuilding::AddFigureForShip(std::unique_ptr fig, MapPoint dest) { - RTTR_Assert(!world->HasFigureAt(fig->GetPos(), *fig)); // Figure is in the harbor, so it cannot be outside + RTTR_Assert(!world->hasFigureAt(fig->getPos(), *fig)); // Figure is in the harbor, so it cannot be outside AddToVisualInventory(*fig); figures_for_ships.emplace_back(FigureForShip{std::move(fig), dest}); OrderShip(); @@ -885,15 +885,15 @@ void nobHarborBuilding::AddWareForShip(std::unique_ptr ware) } /// Gibt Anzahl der Schiffe zurück, die noch für ausstehende Aufgaben benötigt werden -unsigned nobHarborBuilding::GetNumNeededShips() const +unsigned nobHarborBuilding::getNumNeededShips() const { unsigned count = 0; // Expedition -> 1 Schiff - if(IsExpeditionReady()) + if(isExpeditionReady()) ++count; // Erkundungs-Expedition -> noch ein Schiff - if(IsExplorationExpeditionReady()) + if(isExplorationExpeditionReady()) ++count; // Evtl. Waren und Figuren -> noch ein Schiff pro Ziel if(!figures_for_ships.empty() || !wares_for_ships.empty()) @@ -912,9 +912,9 @@ unsigned nobHarborBuilding::GetNumNeededShips() const for(const auto& wares_for_ship : wares_for_ships) { - if(!helpers::contains(destinations, wares_for_ship->GetNextHarbor())) + if(!helpers::contains(destinations, wares_for_ship->getNextHarbor())) { - destinations.push_back(wares_for_ship->GetNextHarbor()); + destinations.push_back(wares_for_ship->getNextHarbor()); ++count; } } @@ -938,19 +938,19 @@ unsigned nobHarborBuilding::GetNumNeededShips() const } /// Gibt die Wichtigkeit an, dass ein Schiff kommen muss (0 -> keine Bedürftigkeit) -int nobHarborBuilding::GetNeedForShip(unsigned ships_coming) const +int nobHarborBuilding::getNeedForShip(unsigned ships_coming) const { int points = 0; // Expedition -> 1 Schiff - if(IsExpeditionReady()) + if(isExpeditionReady()) { if(ships_coming == 0) points += 100; else --ships_coming; } - if(IsExplorationExpeditionReady()) + if(isExplorationExpeditionReady()) { if(ships_coming == 0) points += 100; @@ -974,11 +974,11 @@ int nobHarborBuilding::GetNeedForShip(unsigned ships_coming) const // try to order any ship that might be needed and is not ordered yet void nobHarborBuilding::OrderShip() { - unsigned needed = GetNumNeededShips(); - GamePlayer& owner = world->GetPlayer(player); + unsigned needed = getNumNeededShips(); + GamePlayer& owner = world->getPlayer(player); // Order (possibly) remaining ships - for(unsigned ordered = owner.GetShipsToHarbor(*this); ordered < needed; ++ordered) + for(unsigned ordered = owner.getShipsToHarbor(*this); ordered < needed; ++ordered) owner.OrderShip(*this); } @@ -992,10 +992,10 @@ bool nobHarborBuilding::UseWareAtOnce(std::unique_ptr& ware, noBaseBuildin // Evtl. muss die Ware gleich das Schiff nehmen -> dann zum Schiffsreservoir hinzufügen // Assert: This is a ware that got ordered. There MUST be a path to the goal // Otherwise the ware will notify the goal which will order a new ware resulting in an infinite loop - RTTR_Assert(world->GetRoadPathFinder().PathExists(*this, goal, true)); + RTTR_Assert(world->getRoadPathFinder().PathExists(*this, goal, true)); ware->RecalcRoute(); // Also sets nextHarbor! - RTTR_Assert(ware->GetNextDir() != RoadPathDirection::None); - if(ware->GetNextDir() == RoadPathDirection::Ship) + RTTR_Assert(ware->getNextDir() != RoadPathDirection::None); + if(ware->getNextDir() == RoadPathDirection::Ship) { // Dann fügen wir die mal bei uns hinzu AddWareForShip(std::move(ware)); @@ -1037,11 +1037,11 @@ void nobHarborBuilding::ReceiveGoodsFromShip(std::list figure->ArrivedByShip(pos); // Wenn es kein Ziel mehr hat, sprich keinen weiteren Weg, kann es direkt hier gelagert werden - if(figure->GetGoal() == this) + if(figure->getGoal() == this) { - figure->SetGoalTonullptr(); + figure->setGoalTonullptr(); AddFigure(std::move(figure), true); - } else if(!figure->GetGoal()) + } else if(!figure->getGoal()) { AddDependentFigure(*figure); // No goal? We take it AddFigure(std::move(figure), true); @@ -1061,7 +1061,7 @@ void nobHarborBuilding::ReceiveGoodsFromShip(std::list { // No or invalid path -> Store here RTTR_Assert(nextDir == RoadPathDirection::None); - figure->SetGoalTonullptr(); + figure->setGoalTonullptr(); AddDependentFigure(*figure); AddFigure(std::move(figure), true); } @@ -1094,7 +1094,7 @@ nofAggressiveDefender* nobHarborBuilding::SendAggressiveDefender(nofAttacker& at } /// Storniert die Bestellung für eine bestimmte Ware, die mit einem Schiff transportiert werden soll -std::unique_ptr nobHarborBuilding::CancelWareForShip(Ware* ware) +std::unique_ptr nobHarborBuilding::cancelWareForShip(Ware* ware) { // Ware zur Inventur hinzufügen inventory.real.Add(ConvertShields(ware->type)); @@ -1102,7 +1102,7 @@ std::unique_ptr nobHarborBuilding::CancelWareForShip(Ware* ware) } /// Bestellte Figur, die sich noch inder Warteschlange befindet, kommt nicht mehr und will rausgehauen werden -void nobHarborBuilding::CancelFigure(noFigure* figure) +void nobHarborBuilding::cancelFigure(noFigure* figure) { const auto it = helpers::find_if(figures_for_ships, [figure](const FigureForShip& it) { return it.fig.get() == figure; }); @@ -1116,23 +1116,23 @@ void nobHarborBuilding::CancelFigure(noFigure* figure) } // An Basisklasse weiterdelegieren else - nobBaseWarehouse::CancelFigure(figure); + nobBaseWarehouse::cancelFigure(figure); } /// Gibt verfügbare Angreifer zurück -std::vector nobHarborBuilding::GetAttackerBuildingsForSeaIdAttack() +std::vector nobHarborBuilding::getAttackerBuildingsForSeaIdAttack() { std::vector buildings; sortedMilitaryBlds all_buildings = world->LookForMilitaryBuildings(pos, 3); // Und zählen for(nobBaseMilitary* all_building : all_buildings) { - if(all_building->GetGOT() != GO_Type::NobMilitary) + if(all_building->getGOT() != GO_Type::NobMilitary) continue; // Liegt er auch im groben Raster und handelt es sich um den gleichen Besitzer? - if(all_building->GetPlayer() != player - || world->CalcDistance(all_building->GetPos(), pos) > BASE_ATTACKING_DISTANCE) + if(all_building->getPlayer() != player + || world->CalcDistance(all_building->getPos(), pos) > BASE_ATTACKING_DISTANCE) continue; // Gebäude suchen, vielleicht schon vorhanden? Dann können wir uns den pathfinding Aufwand sparen! if(helpers::contains(buildings, static_cast(all_building))) @@ -1141,7 +1141,7 @@ std::vector nobHarborBuilding::GetAttack continue; } // Weg vom Hafen zum Militärgebäude berechnen - if(!world->FindHumanPath(all_building->GetPos(), pos, MAX_ATTACKING_RUN_DISTANCE)) + if(!world->FindHumanPath(all_building->getPos(), pos, MAX_ATTACKING_RUN_DISTANCE)) continue; // neues Gebäude mit weg und allem -> in die Liste! SeaAttackerBuilding sab = {static_cast(all_building), this, 0}; @@ -1151,30 +1151,30 @@ std::vector nobHarborBuilding::GetAttack } std::vector -nobHarborBuilding::GetAttackerBuildingsForSeaAttack(const std::vector& defender_harbors) +nobHarborBuilding::getAttackerBuildingsForSeaAttack(const std::vector& defender_harbors) { std::vector buildings; sortedMilitaryBlds all_buildings = world->LookForMilitaryBuildings(pos, 3); // Und zählen for(nobBaseMilitary* all_building : all_buildings) { - if(all_building->GetGOT() != GO_Type::NobMilitary) + if(all_building->getGOT() != GO_Type::NobMilitary) continue; // Liegt er auch im groben Raster und handelt es sich um den gleichen Besitzer? - if(all_building->GetPlayer() != player - || world->CalcDistance(all_building->GetPos(), pos) > BASE_ATTACKING_DISTANCE) + if(all_building->getPlayer() != player + || world->CalcDistance(all_building->getPos(), pos) > BASE_ATTACKING_DISTANCE) continue; // Weg vom Hafen zum Militärgebäude berechnen - if(!world->FindHumanPath(all_building->GetPos(), pos, MAX_ATTACKING_RUN_DISTANCE)) + if(!world->FindHumanPath(all_building->getPos(), pos, MAX_ATTACKING_RUN_DISTANCE)) continue; // Entfernung zwischen Hafen und möglichen Zielhafenpunkt ausrechnen auto min_distance = std::numeric_limits::max(); for(HarborId defender_harbor : defender_harbors) { - min_distance = std::min(min_distance, world->GetMinHarborDistance(GetHarborPosID(), defender_harbor)); + min_distance = std::min(min_distance, world->getMinHarborDistance(getHarborPosID(), defender_harbor)); } // Gebäude suchen, vielleicht schon vorhanden? @@ -1202,12 +1202,12 @@ void nobHarborBuilding::AddSeaAttacker(std::unique_ptr attacker) { unsigned best_distance = 0xffffffff; HarborId best_harbor_point; - RTTR_Assert(attacker->GetAttackedGoal()); + RTTR_Assert(attacker->getAttackedGoal()); std::vector harbor_points = - world->GetHarborPointsAroundMilitaryBuilding(attacker->GetAttackedGoal()->GetPos()); + world->getHarborPointsAroundMilitaryBuilding(attacker->getAttackedGoal()->getPos()); for(HarborId harbor_point : harbor_points) { - unsigned tmp_distance = world->GetMinHarborDistance(this->GetHarborPosID(), harbor_point); + unsigned tmp_distance = world->getMinHarborDistance(this->getHarborPosID(), harbor_point); if(tmp_distance < best_distance) { best_distance = tmp_distance; @@ -1220,28 +1220,28 @@ void nobHarborBuilding::AddSeaAttacker(std::unique_ptr attacker) { // notify target about noShow, notify home that soldier wont return, add to inventory attacker->SeaAttackFailedBeforeLaunch(); // set state, remove target & home - RTTR_Assert(!attacker->GetAttackedGoal()); - RTTR_Assert(!attacker->GetHomeBld()); - RTTR_Assert(!attacker->GetGoal()); + RTTR_Assert(!attacker->getAttackedGoal()); + RTTR_Assert(!attacker->getHomeBld()); + RTTR_Assert(!attacker->getGoal()); AddFigure(std::move(attacker), true); return; } - inventory.visual.Add(attacker->GetJobType()); - if(attacker->HasArmor()) - inventory.visual.Add(jobEnumToAmoredSoldierEnum(attacker->GetJobType())); - soldiers_for_ships.emplace_back(SoldierForShip{std::move(attacker), world->GetHarborPoint(best_harbor_point)}); + inventory.visual.Add(attacker->getJobType()); + if(attacker->hasArmor()) + inventory.visual.Add(jobEnumToAmoredSoldierEnum(attacker->getJobType())); + soldiers_for_ships.emplace_back(SoldierForShip{std::move(attacker), world->getHarborPoint(best_harbor_point)}); OrderShip(); } -void nobHarborBuilding::CancelSeaAttacker(nofAttacker* attacker) +void nobHarborBuilding::cancelSeaAttacker(nofAttacker* attacker) { const auto it = helpers::find_if(soldiers_for_ships, [attacker](const auto& it) { return it.attacker.get() == attacker; }); RTTR_Assert(it != soldiers_for_ships.end()); - if(!attacker->GetGoal()) + if(!attacker->getGoal()) { // No goal? We take it AddDependentFigure(*attacker); @@ -1291,7 +1291,7 @@ unsigned nobHarborBuilding::CalcDistributionPoints(const GoodType type) const void nobHarborBuilding::WareDontWantToTravelByShip(Ware* ware) { // Maybe this building is already destroyed - if(world->GetGOT(pos) != GO_Type::NobHarborbuilding) + if(world->getGOT(pos) != GO_Type::NobHarborbuilding) return; // Move to waiting_wares @@ -1312,9 +1312,9 @@ std::unique_ptr nobHarborBuilding::ProvideDefender(nofAttacker& att { std::unique_ptr defender_attacker = std::move(soldiers_for_ships.begin()->attacker); soldiers_for_ships.pop_front(); - defender = std::make_unique(pos, player, *this, defender_attacker->GetRank(), attacker); - defender->SetArmor(defender_attacker->HasArmor()); - defender_attacker->CancelSeaAttack(); + defender = std::make_unique(pos, player, *this, defender_attacker->getRank(), attacker); + defender->setArmor(defender_attacker->hasArmor()); + defender_attacker->cancelSeaAttack(); defender_attacker->Destroy(); } @@ -1348,8 +1348,8 @@ void nobHarborBuilding::ExamineShipRouteOfPeople() } } -bool nobHarborBuilding::IsBeingDestroyedNow() const +bool nobHarborBuilding::isBeingDestroyedNow() const { // check if this harbor is in the known harbors. if not, it is probably being destroyed right now. - return !helpers::contains(world->GetPlayer(player).GetBuildingRegister().GetHarbors(), this); + return !helpers::contains(world->getPlayer(player).getBuildingRegister().getHarbors(), this); } diff --git a/libs/s25main/buildings/nobHarborBuilding.h b/libs/s25main/buildings/nobHarborBuilding.h index 7bb37bc4ff..ffb59fdb15 100644 --- a/libs/s25main/buildings/nobHarborBuilding.h +++ b/libs/s25main/buildings/nobHarborBuilding.h @@ -79,16 +79,16 @@ class nobHarborBuilding : public nobBaseWarehouse /// Prüft, ob eine Expedition von den Spähern her vollständig ist und ruft ggf. das Schiff void CheckExplorationExpeditionReady(); /// Gibt zurück, ob Expedition vollständig ist - bool IsExpeditionReady() const; + bool isExpeditionReady() const; /// Gibt zurück, ob Erkundungs-Expedition vollständig ist - bool IsExplorationExpeditionReady() const; + bool isExplorationExpeditionReady() const; /// Abgeleitete kann eine gerade erzeugte Ware ggf. sofort verwenden /// (muss in dem Fall true zurückgeben) bool UseWareAtOnce(std::unique_ptr& ware, noBaseBuilding& goal) override; /// Dasselbe für Menschen bool UseFigureAtOnce(std::unique_ptr& fig, noRoadNode& goal) override; /// Bestellte Figur, die sich noch inder Warteschlange befindet, kommt nicht mehr und will rausgehauen werden - void CancelFigure(noFigure* figure) override; + void cancelFigure(noFigure* figure) override; /// Bestellt ein Schiff zum Hafen, sofern dies nötig ist void OrderShip(); @@ -104,11 +104,11 @@ class nobHarborBuilding : public nobBaseWarehouse void DestroyBuilding() override; public: - unsigned GetMilitaryRadius() const override { return HARBOR_RADIUS; } + unsigned getMilitaryRadius() const override { return HARBOR_RADIUS; } /// Serialisierung void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NobHarborbuilding; } + GO_Type getGOT() const final { return GO_Type::NobHarborbuilding; } void Draw(DrawPoint drawPt) override; void HandleEvent(unsigned id) override; @@ -123,7 +123,7 @@ class nobHarborBuilding : public nobBaseWarehouse unsigned CalcDistributionPoints(GoodType type) const; /// Storniert die Bestellung für eine bestimmte Ware, die mit einem Schiff transportiert werden soll - std::unique_ptr CancelWareForShip(Ware* ware); + std::unique_ptr cancelWareForShip(Ware* ware); /// Startet eine Expedition void StartExpedition(); @@ -134,9 +134,9 @@ class nobHarborBuilding : public nobBaseWarehouse void StopExplorationExpedition(); /// Ist Expedition in Vorbereitung? - bool IsExpeditionActive() const { return expedition.active; } + bool isExpeditionActive() const { return expedition.active; } /// Ist Erkundungs-Expedition in Vorbereitung? - bool IsExplorationExpeditionActive() const { return exploration_expedition.active; } + bool isExplorationExpeditionActive() const { return exploration_expedition.active; } /// Schiff ist angekommen void ShipArrived(noShip& ship); /// Schiff konnte nicht mehr kommen @@ -147,7 +147,7 @@ class nobHarborBuilding : public nobBaseWarehouse void RemoveDependentFigure(noFigure& figure) override; /// Gibt die Hafenplatz-ID zurück, auf der der Hafen steht - HarborId GetHarborPosID() const; + HarborId getHarborPosID() const; struct ShipConnection { @@ -157,7 +157,7 @@ class nobHarborBuilding : public nobBaseWarehouse unsigned way_costs; }; /// Gibt eine Liste mit möglichen Verbindungen zurück - std::vector GetShipConnections() const; + std::vector getShipConnections() const; /// Fügt einen Mensch hinzu, der mit dem Schiff irgendwo hin fahren will void AddFigureForShip(std::unique_ptr fig, MapPoint dest); @@ -168,9 +168,9 @@ class nobHarborBuilding : public nobBaseWarehouse void WareDontWantToTravelByShip(Ware* ware); /// Gibt Anzahl der Schiffe zurück, die noch für ausstehende Aufgaben benötigt werden - unsigned GetNumNeededShips() const; + unsigned getNumNeededShips() const; /// Gibt die Wichtigkeit an, dass ein Schiff kommen muss (0 -> keine Bedürftigkeit) - int GetNeedForShip(unsigned ships_coming) const; + int getNeedForShip(unsigned ships_coming) const; /// Erhält die Waren von einem Schiff und nimmt diese in den Warenbestand auf void ReceiveGoodsFromShip(std::list>& figures, std::list>& wares); @@ -198,18 +198,18 @@ class nobHarborBuilding : public nobBaseWarehouse /// Gibt die Angreifer zurück, die dieser Hafen für einen Seeangriff zur Verfügung stellen kann /// defender_harbors sind dabei mögliche Zielhäfen - std::vector GetAttackerBuildingsForSeaAttack(const std::vector& defender_harbors); + std::vector getAttackerBuildingsForSeaAttack(const std::vector& defender_harbors); /// Gibt verfügbare Angreifer zurück - std::vector GetAttackerBuildingsForSeaIdAttack(); + std::vector getAttackerBuildingsForSeaIdAttack(); /// Fügt einen Schiffs-Angreifer zum Hafen hinzu void AddSeaAttacker(std::unique_ptr attacker); /// Attacker does not want to attack anymore - void CancelSeaAttacker(nofAttacker* attacker); + void cancelSeaAttacker(nofAttacker* attacker); /// People waiting for a ship have to examine their route if a road was destroyed void ExamineShipRouteOfPeople(); /// Is the harbor just being destroyed right now? - bool IsBeingDestroyedNow() const; + bool isBeingDestroyedNow() const; }; diff --git a/libs/s25main/buildings/nobMilitary.cpp b/libs/s25main/buildings/nobMilitary.cpp index 38722b5109..296737bfb9 100644 --- a/libs/s25main/buildings/nobMilitary.cpp +++ b/libs/s25main/buildings/nobMilitary.cpp @@ -46,7 +46,7 @@ nobMilitary::nobMilitary(const BuildingType type, const MapPoint pos, const unsi armor_upgrade_event(nullptr), is_regulating_troops(false) { // Gebäude entsprechend als Militärgebäude registrieren und in ein Militärquadrat eintragen - world->GetMilitarySquares().Add(this); + world->getMilitarySquares().Add(this); // Größe ermitteln switch(type) @@ -60,19 +60,19 @@ nobMilitary::nobMilitary(const BuildingType type, const MapPoint pos, const unsi size = 0xFF; break; } - troop_limits.fill(GetMaxTroopsCt()); + troop_limits.fill(getMaxTroopsCt()); // Tür aufmachen, bis Gebäude besetzt ist OpenDoor(); // Wenn kein Gold in neu gebaute Militärgebäude eingeliefert werden soll, wird die Goldzufuhr gestoppt - if(world->GetGGS().isEnabled(AddonId::NO_COINS_DEFAULT)) + if(world->getGGS().isEnabled(AddonId::NO_COINS_DEFAULT)) { coinsDisabled = true; coinsDisabledVirtual = true; } - if(world->GetGGS().isEnabled(AddonId::NO_ARMOR_DEFAULT)) + if(world->getGGS().isEnabled(AddonId::NO_ARMOR_DEFAULT)) { armorAllowed = false; armorAllowedVirtual = false; @@ -81,7 +81,7 @@ nobMilitary::nobMilitary(const BuildingType type, const MapPoint pos, const unsi nobMilitary::~nobMilitary() = default; -size_t nobMilitary::GetTotalSoldiers() const +size_t nobMilitary::getTotalSoldiers() const { size_t sum = troops.size() + ordered_troops.size() + troops_on_mission.size(); if(defender_) @@ -90,29 +90,29 @@ size_t nobMilitary::GetTotalSoldiers() const return sum; } -std::array nobMilitary::GetTotalSoldiersByRank() const +std::array nobMilitary::getTotalSoldiersByRank() const { std::array counts = {0}; for(const auto& troop : troops) - ++counts[troop->GetRank()]; + ++counts[troop->getRank()]; for(const auto& troop : ordered_troops) - ++counts[troop->GetRank()]; + ++counts[troop->getRank()]; for(const auto& troop : troops_on_mission) - ++counts[troop->GetRank()]; + ++counts[troop->getRank()]; if(defender_) - ++counts[defender_->GetRank()]; + ++counts[defender_->getRank()]; for(const auto& troop : far_away_capturers) - ++counts[troop->GetRank()]; + ++counts[troop->getRank()]; return counts; } void nobMilitary::DestroyBuilding() { // Remove from military square and buildings first, to avoid e.g. sending canceled soldiers back to this building - world->GetMilitarySquares().Remove(this); + world->getMilitarySquares().Remove(this); // Bestellungen stornieren - CancelOrders(); + cancelOrders(); // Soldaten rausschicken for(auto& troop : troops) @@ -130,21 +130,21 @@ void nobMilitary::DestroyBuilding() far_away_capturers.clear(); // Events ggf. entfernen - GetEvMgr().RemoveEvent(gold_order_event); - GetEvMgr().RemoveEvent(armor_order_event); - GetEvMgr().RemoveEvent(upgrade_event); - GetEvMgr().RemoveEvent(armor_upgrade_event); + getEvMgr().RemoveEvent(gold_order_event); + getEvMgr().RemoveEvent(armor_order_event); + getEvMgr().RemoveEvent(upgrade_event); + getEvMgr().RemoveEvent(armor_upgrade_event); // übriggebliebene Goldmünzen in der Inventur abmelden - world->GetPlayer(player).DecreaseInventoryWare(GoodType::Coins, numCoins); - world->GetPlayer(player).DecreaseInventoryWare(GoodType::Armor, numArmor); + world->getPlayer(player).DecreaseInventoryWare(GoodType::Coins, numCoins); + world->getPlayer(player).DecreaseInventoryWare(GoodType::Armor, numArmor); nobBaseMilitary::DestroyBuilding(); // If this was occupied, recalc territory. AFTER calling base destroy as otherwise figures might get stuck here if(!new_built) world->RecalcTerritory(*this, TerritoryChangeReason::Destroyed); - world->GetNotifications().publish(BuildingNote(BuildingNote::Lost, player, pos, bldType_)); + world->getNotifications().publish(BuildingNote(BuildingNote::Lost, player, pos, bldType_)); } void nobMilitary::Serialize(SerializedGameData& sgd) const @@ -184,12 +184,12 @@ nobMilitary::nobMilitary(SerializedGameData& sgd, const unsigned obj_id) sgd.PopObjectContainer(troops, GO_Type::NofPassivesoldier); sgd.PopObjectContainer(far_away_capturers, GO_Type::NofAttacker); - if(sgd.GetGameDataVersion() < 10) - troop_limits.fill(GetMaxTroopsCt()); + if(sgd.getGameDataVersion() < 10) + troop_limits.fill(getMaxTroopsCt()); else helpers::popContainer(sgd, troop_limits); - if(sgd.GetGameDataVersion() >= 12) + if(sgd.getGameDataVersion() >= 12) { numArmor = sgd.PopUnsignedChar(); armorAllowedVirtual = armorAllowed = sgd.PopBool(); @@ -205,7 +205,7 @@ nobMilitary::nobMilitary(SerializedGameData& sgd, const unsigned obj_id) } // ins Militärquadrat einfügen - world->GetMilitarySquares().Add(this); + world->getMilitarySquares().Add(this); if(capturing && capturing_soldiers == 0 && aggressors.empty()) { @@ -226,50 +226,50 @@ void nobMilitary::Draw(DrawPoint drawPt) for(unsigned i = 0; i < flags; ++i) { - const unsigned flagTexture = 3162 + GAMECLIENT.GetGlobalAnimation(8, 2, 1, pos.x * pos.y * i); - LOADER.GetMapPlayerImage(flagTexture) + const unsigned flagTexture = 3162 + GAMECLIENT.getGlobalAnimation(8, 2, 1, pos.x * pos.y * i); + LOADER.getMapPlayerImage(flagTexture) ->drawForPlayer(drawPt + TROOPS_FLAG_OFFSET[nation][size] + DrawPoint(0, i * 3), - world->GetPlayer(player).color); + world->getPlayer(player).color); } // Die Fahne, die anzeigt wie weit das Gebäude von der Grenze entfernt ist, zeichnen FrontierDistance frontier_distance_tmp = frontier_distance; ITexture* bitmap = nullptr; - unsigned animationFrame = GAMECLIENT.GetGlobalAnimation(4, 1, 1, pos.x * pos.y * GetObjId()); + unsigned animationFrame = GAMECLIENT.getGlobalAnimation(4, 1, 1, pos.x * pos.y * getObjId()); if(new_built) { // don't draw a flag for new buildings - fixes bug #215 } else if(frontier_distance_tmp == FrontierDistance::Harbor) { // todo Hafenflagge - bitmap = LOADER.GetTextureN("map_new", 3150 + animationFrame); + bitmap = LOADER.getTextureN("map_new", 3150 + animationFrame); } else { if(frontier_distance_tmp == FrontierDistance::Near) frontier_distance_tmp = FrontierDistance::Harbor; - bitmap = LOADER.GetMapTexture(3150 + rttr::enum_cast(frontier_distance_tmp) * 4 + animationFrame); + bitmap = LOADER.getMapTexture(3150 + rttr::enum_cast(frontier_distance_tmp) * 4 + animationFrame); } if(bitmap) bitmap->DrawFull(drawPt + BORDER_FLAG_OFFSET[nation][size]); // If coins or armor delivery disabled, show sign at building - if(leatheraddon::isAddonActive(world->GetPlayer(player).GetGameWorld())) + if(leatheraddon::isAddonActive(world->getPlayer(player).getGameWorld())) { if(coinsDisabledVirtual) { - LOADER.GetImageN("leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::StopCoinsXSignOverride]) + LOADER.getImageN("leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::StopCoinsXSignOverride]) ->DrawFull(drawPt + BUILDING_SIGN_CONSTS[nation][bldType_]); } if(!armorAllowedVirtual) { - LOADER.GetImageN("leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::StopArmorXSign]) + LOADER.getImageN("leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::StopArmorXSign]) ->DrawFull(drawPt + BUILDING_ARMOR_SIGN_CONSTS[nation][bldType_]); } } else // Without leather addon use original graphic { if(coinsDisabledVirtual) - LOADER.GetMapTexture(46)->DrawFull(drawPt + BUILDING_SIGN_CONSTS[nation][bldType_]); + LOADER.getMapTexture(46)->DrawFull(drawPt + BUILDING_SIGN_CONSTS[nation][bldType_]); } } @@ -294,7 +294,7 @@ void nobMilitary::HandleEvent(const unsigned id) // Wenn noch weitere drin sind, die müssen auch noch raus if(!leave_house.empty()) - leaving_event = GetEvMgr().AddEvent(this, 30 + RANDOM_RAND(10)); + leaving_event = getEvMgr().AddEvent(this, 30 + RANDOM_RAND(10)); else go_out = false; @@ -316,12 +316,12 @@ void nobMilitary::HandleEvent(const unsigned id) upgrade_event = nullptr; std::vector> soldiersToUpgrade; - const uint8_t maxRank = world->GetGGS().GetMaxMilitaryRank(); + const uint8_t maxRank = world->getGGS().getMaxMilitaryRank(); - if(world->GetGGS().isEnabled(AddonId::SINGLE_SOLDIER_COIN_TRAINING)) + if(world->getGGS().isEnabled(AddonId::SINGLE_SOLDIER_COIN_TRAINING)) { auto it = std::find_if(troops.begin(), troops.end(), - [maxRank](const auto& soldier) { return soldier->GetRank() < maxRank; }); + [maxRank](const auto& soldier) { return soldier->getRank() < maxRank; }); if(it != troops.end()) { soldiersToUpgrade.push_back(std::move(*it)); @@ -339,10 +339,10 @@ void nobMilitary::HandleEvent(const unsigned id) auto& soldier = *it; // Es wurde schon einer befördert, dieser Soldat muss nun einen niedrigeren Rang // als der letzte haben, damit er auch noch befördert werden kann - if(soldier->GetRank() < last_rank) + if(soldier->getRank() < last_rank) { // Rang merken - last_rank = soldier->GetRank(); + last_rank = soldier->getRank(); // Remove from sorted container as changing it breaks sorting soldiersToUpgrade.push_back(std::move(soldier)); it = helpers::erase_reverse(troops, it); @@ -363,7 +363,7 @@ void nobMilitary::HandleEvent(const unsigned id) // Goldmünze verbrauchen --numCoins; - world->GetPlayer(player).DecreaseInventoryWare(GoodType::Coins, 1); + world->getPlayer(player).DecreaseInventoryWare(GoodType::Coins, 1); RegulateTroops(); @@ -388,16 +388,16 @@ void nobMilitary::HandleEvent(const unsigned id) armor_upgrade_event = nullptr; auto candidate = std::find_if(troops.rbegin(), troops.rend(), - [](OwnedSortedTroops::value_type& troop) { return !troop->HasArmor(); }); + [](OwnedSortedTroops::value_type& troop) { return !troop->hasArmor(); }); if(candidate != troops.rend()) { auto& soldier = *candidate; - soldier->SetArmor(true); + soldier->setArmor(true); --numArmor; - world->GetPlayer(player).DecreaseInventoryWare(GoodType::Armor, 1); - world->GetPlayer(player).IncreaseInventoryJob(jobEnumToAmoredSoldierEnum(soldier->GetJobType()), 1); + world->getPlayer(player).DecreaseInventoryWare(GoodType::Armor, 1); + world->getPlayer(player).IncreaseInventoryJob(jobEnumToAmoredSoldierEnum(soldier->getJobType()), 1); PrepareArmorUpgrading(); SearchArmor(); @@ -407,22 +407,22 @@ void nobMilitary::HandleEvent(const unsigned id) } } -unsigned nobMilitary::GetMilitaryRadius() const +unsigned nobMilitary::getMilitaryRadius() const { return MILITARY_RADIUS[size]; } -unsigned nobMilitary::GetMaxCoinCt() const +unsigned nobMilitary::getMaxCoinCt() const { return NUM_GOLDS[nation][size]; } -unsigned nobMilitary::GetMaxArmorCt() const +unsigned nobMilitary::getMaxArmorCt() const { return NUM_ARMOR[nation][size]; } -unsigned nobMilitary::GetMaxTroopsCt() const +unsigned nobMilitary::getMaxTroopsCt() const { return NUM_TROOPS[nation][size]; } @@ -433,29 +433,29 @@ void nobMilitary::LookForEnemyBuildings(const nobBaseMilitary* const exception) sortedMilitaryBlds buildings = world->LookForMilitaryBuildings(pos, 3); frontier_distance = FrontierDistance::Far; - const bool frontierDistanceCheck = world->GetGGS().isEnabled(AddonId::FRONTIER_DISTANCE_REACHABLE); + const bool frontierDistanceCheck = world->getGGS().isEnabled(AddonId::FRONTIER_DISTANCE_REACHABLE); for(auto* building : buildings) { // feindliches Militärgebäude? - if(building != exception && building->GetPlayer() != player - && world->GetPlayer(building->GetPlayer()).IsAttackable(player)) + if(building != exception && building->getPlayer() != player + && world->getPlayer(building->getPlayer()).isAttackable(player)) { - unsigned distance = world->CalcDistance(pos, building->GetPos()); + unsigned distance = world->CalcDistance(pos, building->getPos()); FrontierDistance newFrontierDistance = FrontierDistance::Far; - if(distance <= GetMilitaryRadius() + building->GetMilitaryRadius()) + if(distance <= getMilitaryRadius() + building->getMilitaryRadius()) { newFrontierDistance = FrontierDistance::Near; } // in mittlerem Umkreis, also theoretisch angreifbar? - else if(distance < BASE_ATTACKING_DISTANCE + (GetMaxTroopsCt() - 1) * EXTENDED_ATTACKING_DISTANCE) + else if(distance < BASE_ATTACKING_DISTANCE + (getMaxTroopsCt() - 1) * EXTENDED_ATTACKING_DISTANCE) { newFrontierDistance = FrontierDistance::Mid; - } else if(building->GetGOT() == GO_Type::NobMilitary) + } else if(building->getGOT() == GO_Type::NobMilitary) { auto* mil = static_cast(building); - if(distance < BASE_ATTACKING_DISTANCE + (mil->GetMaxTroopsCt() - 1) * EXTENDED_ATTACKING_DISTANCE) + if(distance < BASE_ATTACKING_DISTANCE + (mil->getMaxTroopsCt() - 1) * EXTENDED_ATTACKING_DISTANCE) { newFrontierDistance = FrontierDistance::Mid; } @@ -463,7 +463,7 @@ void nobMilitary::LookForEnemyBuildings(const nobBaseMilitary* const exception) // if new frontier distance is in military range, check if its reachable. if(frontierDistanceCheck && newFrontierDistance >= FrontierDistance::Mid - && !DoesReachablePathExist(*world, building->GetPos(), pos, MAX_ATTACKING_RUN_DISTANCE)) + && !DoesReachablePathExist(*world, building->getPos(), pos, MAX_ATTACKING_RUN_DISTANCE)) { // building is not reachable, so its "far" away. newFrontierDistance = FrontierDistance::Far; @@ -474,12 +474,12 @@ void nobMilitary::LookForEnemyBuildings(const nobBaseMilitary* const exception) frontier_distance = newFrontierDistance; // set calculated frontier distance to checked building. - if(BuildingProperties::IsMilitary(building->GetBuildingType())) + if(BuildingProperties::isMilitary(building->getBuildingType())) static_cast(building)->NewEnemyMilitaryBuilding(newFrontierDistance); } } // check for harbor points - if(frontier_distance <= FrontierDistance::Mid && world->GetGGS().isEnabled(AddonId::SEA_ATTACK) + if(frontier_distance <= FrontierDistance::Mid && world->getGGS().isEnabled(AddonId::SEA_ATTACK) && world->CalcDistanceToNearestHarbor(pos) < SEAATTACK_DISTANCE + 2) frontier_distance = FrontierDistance::Harbor; @@ -507,11 +507,11 @@ void nobMilitary::NewEnemyMilitaryBuilding(const FrontierDistance distance) void nobMilitary::RegulateTroops() { - RTTR_Assert(helpers::contains(world->GetPlayer(player).GetBuildingRegister().GetMilitaryBuildings(), + RTTR_Assert(helpers::contains(world->getPlayer(player).getBuildingRegister().getMilitaryBuildings(), this)); // If this fails, the building is Being destroyed! // Wenn das Gebäude eingenommen wird, erstmal keine neuen Truppen und warten, wieviele noch reinkommen - if(IsBeingCaptured()) + if(isBeingCaptured()) return; // Already regulate its troops => Don't call this method again @@ -520,22 +520,22 @@ void nobMilitary::RegulateTroops() is_regulating_troops = true; - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); std::array hasReturnWarehouseByRank; hasReturnWarehouseByRank.fill(-1); auto canReturnHome = [&](const nofPassiveSoldier& soldier) { - const unsigned rank = soldier.GetRank(); + const unsigned rank = soldier.getRank(); int& hasReturnWarehouse = hasReturnWarehouseByRank[rank]; if(hasReturnWarehouse < 0) { hasReturnWarehouse = - owner.FindWarehouse(*this, FW::AcceptsFigure(soldier.GetJobType()), true, false) ? 1 : 0; + owner.FindWarehouse(*this, FW::AcceptsFigure(soldier.getJobType()), true, false) ? 1 : 0; } return hasReturnWarehouse != 0; }; // This only has an effect if the military control addon is in use and the troop limits have been lowered. - std::array counts = GetTotalSoldiersByRank(); + std::array counts = getTotalSoldiersByRank(); std::array lack; for(unsigned rank = 0; rank < NUM_SOLDIER_RANKS; rank++) { @@ -547,7 +547,7 @@ void nobMilitary::RegulateTroops() std::vector notNeededSoldiers; for(auto it = ordered_troops.begin(); excess && it != ordered_troops.end();) { - if((*it)->GetRank() == rank && canReturnHome(**it)) + if((*it)->getRank() == rank && canReturnHome(**it)) { notNeededSoldiers.push_back(*it); it = ordered_troops.erase(it); @@ -568,7 +568,7 @@ void nobMilitary::RegulateTroops() { for(auto it = troops.begin(); excess && it != troops.end() && troops.size() > 1;) { - if((*it)->GetRank() == rank && canReturnHome(**it)) + if((*it)->getRank() == rank && canReturnHome(**it)) { (*it)->LeaveBuilding(); AddLeavingFigure(std::move(*it)); @@ -583,14 +583,14 @@ void nobMilitary::RegulateTroops() } // Zu viele oder zu wenig Truppen? - int diff = static_cast(CalcRequiredNumTroops()) - static_cast(GetTotalSoldiers()); + int diff = static_cast(CalcRequiredNumTroops()) - static_cast(getTotalSoldiers()); if(diff < 0) { // Zu viel --> überflüssige Truppen nach Hause schicken // Zuerst die bestellten Soldaten wegschicken // Weak ones first std::vector notNeededSoldiers; - if(owner.GetMilitarySetting(1) > MILITARY_SETTINGS_SCALE[1] / 2) + if(owner.getMilitarySetting(1) > MILITARY_SETTINGS_SCALE[1] / 2) { for(auto it = ordered_troops.begin(); diff && it != ordered_troops.end();) { @@ -630,7 +630,7 @@ void nobMilitary::RegulateTroops() // Dann den Rest (einer muss immer noch drinbleiben!) // erst die schwachen Soldaten raus - if(owner.GetMilitarySetting(1) > MILITARY_SETTINGS_SCALE[1] / 2) + if(owner.getMilitarySetting(1) > MILITARY_SETTINGS_SCALE[1] / 2) { for(auto it = troops.begin(); diff && it != troops.end() && troops.size() > 1;) { @@ -669,9 +669,9 @@ void nobMilitary::RegulateTroops() // Gebäude wird angegriffen und // Addon aktiv, nur soviele Leute zum Nachbesetzen schicken wie Verteidiger eingestellt - if(IsUnderAttack() && world->GetGGS().getSelection(AddonId::DEFENDER_BEHAVIOR) == 2) + if(isUnderAttack() && world->getGGS().getSelection(AddonId::DEFENDER_BEHAVIOR) == 2) { - diff = (world->GetPlayer(player).GetMilitarySetting(2) * diff) / MILITARY_SETTINGS_SCALE[2]; + diff = (world->getPlayer(player).getMilitarySetting(2) * diff) / MILITARY_SETTINGS_SCALE[2]; } // only order new troops if there is a chance that there is a path - pathfinding from each warehouse with // soldiers to this mil building will start at the warehouse and cost time @@ -681,14 +681,14 @@ void nobMilitary::RegulateTroops() // every direction but 1 because 1 is the building connection so it doesn't count for this check if(dir == Direction::NorthWest) continue; - if(GetFlag()->GetRoute(dir)) + if(getFlag()->getRoute(dir)) { mightHaveRoad = true; break; } } if(mightHaveRoad) - world->GetPlayer(player).OrderTroops(*this, lack, diff); + world->getPlayer(player).OrderTroops(*this, lack, diff); } is_regulating_troops = false; @@ -697,12 +697,12 @@ void nobMilitary::RegulateTroops() unsigned nobMilitary::CalcRequiredNumTroops() const { return CalcRequiredNumTroops(frontier_distance, - world->GetPlayer(player).GetMilitarySetting(4 + rttr::enum_cast(frontier_distance))); + world->getPlayer(player).getMilitarySetting(4 + rttr::enum_cast(frontier_distance))); } unsigned nobMilitary::CalcRequiredNumTroops(FrontierDistance assumedFrontierDistance, unsigned settingValue) const { - return (GetMaxTroopsCt() - 1) * settingValue / MILITARY_SETTINGS_SCALE[4 + rttr::enum_cast(assumedFrontierDistance)] + return (getMaxTroopsCt() - 1) * settingValue / MILITARY_SETTINGS_SCALE[4 + rttr::enum_cast(assumedFrontierDistance)] + 1; } @@ -713,20 +713,20 @@ void nobMilitary::SetTroopLimit(const unsigned rank, const unsigned limit) RegulateTroops(); } -bool nobMilitary::IsUseless() const +bool nobMilitary::isUseless() const { if(frontier_distance != FrontierDistance::Far || new_built) return false; return !world->DoesDestructionChangeTerritory(*this); } -bool nobMilitary::IsAttackable(unsigned playerIdx) const +bool nobMilitary::isAttackable(unsigned playerIdx) const { // Cannot be attacked, if it is Being captured or not claimed yet (just built) - return nobBaseMilitary::IsAttackable(playerIdx) && !IsBeingCaptured() && !IsNewBuilt(); + return nobBaseMilitary::isAttackable(playerIdx) && !isBeingCaptured() && !isNewBuilt(); } -bool nobMilitary::IsInTroops(const nofPassiveSoldier& soldier) const +bool nobMilitary::isInTroops(const nofPassiveSoldier& soldier) const { return helpers::containsPtr(troops, &soldier); } @@ -757,7 +757,7 @@ void nobMilitary::AddWare(std::unique_ptr ware) ordered_coins.remove(ware.get()); // Ware vernichten - world->GetPlayer(player).RemoveWare(*ware); + world->getPlayer(player).RemoveWare(*ware); ware.reset(); // Evtl. Soldaten befördern @@ -768,7 +768,7 @@ void nobMilitary::AddWare(std::unique_ptr ware) RTTR_Assert(helpers::contains(ordered_armor, ware.get())); ordered_armor.remove(ware.get()); - world->GetPlayer(player).RemoveWare(*ware); + world->getPlayer(player).RemoveWare(*ware); ware.reset(); PrepareArmorUpgrading(); @@ -797,11 +797,11 @@ void nobMilitary::GotWorker(Job /*job*/, noFigure& worker) { RTTR_Assert(dynamic_cast(&worker)); auto& soldier = static_cast(worker); - RTTR_Assert(soldier.GetPlayer() == player); + RTTR_Assert(soldier.getPlayer() == player); ordered_troops.insert(&soldier); } -void nobMilitary::CancelOrders() +void nobMilitary::cancelOrders() { // Soldaten zurückschicken for(auto* ordered_troop : ordered_troops) @@ -829,7 +829,7 @@ void nobMilitary::AddActiveSoldier(std::unique_ptr soldier) soldier->ResetHome(); - RTTR_Assert(soldier->GetPlayer() == player); + RTTR_Assert(soldier->getPlayer() == player); // Returned home if(soldier.get() == defender_) @@ -840,21 +840,21 @@ void nobMilitary::AddActiveSoldier(std::unique_ptr soldier) } else { RTTR_Assert(dynamic_cast(soldier.get())); - if(IsBeingCaptured() || IsFarAwayCapturer(static_cast(*soldier))) + if(isBeingCaptured() || isFarAwayCapturer(static_cast(*soldier))) { - GetEvMgr().AddToKillList(std::move(soldier)); + getEvMgr().AddToKillList(std::move(soldier)); return; } } - GetEvMgr().AddToKillList(std::move(soldier)); + getEvMgr().AddToKillList(std::move(soldier)); // Do only if not capturing RegulateTroops(); } void nobMilitary::AddPassiveSoldier(std::unique_ptr soldier) { - RTTR_Assert(soldier->GetPlayer() == player); - RTTR_Assert(troops.size() < GetMaxTroopsCt()); + RTTR_Assert(soldier->getPlayer() == player); + RTTR_Assert(troops.size() < getMaxTroopsCt()); ordered_troops.erase(soldier.get()); troops.insert(std::move(soldier)); @@ -863,7 +863,7 @@ void nobMilitary::AddPassiveSoldier(std::unique_ptr soldier) if(new_built) { SendPostMessage( - player, std::make_unique(GetEvMgr().GetCurrentGF(), _("Military building occupied"), + player, std::make_unique(getEvMgr().getCurrentGF(), _("Military building occupied"), PostCategory::Military, *this, SoundEffect::Fanfare)); // Ist nun besetzt new_built = false; @@ -871,7 +871,7 @@ void nobMilitary::AddPassiveSoldier(std::unique_ptr soldier) world->RecalcTerritory(*this, TerritoryChangeReason::Build); // Tür zumachen CloseDoor(); - world->GetNotifications().publish(BuildingNote(BuildingNote::Captured, player, pos, bldType_)); + world->getNotifications().publish(BuildingNote(BuildingNote::Captured, player, pos, bldType_)); } else { // Evtl. Soldaten befördern @@ -887,7 +887,7 @@ void nobMilitary::AddPassiveSoldier(std::unique_ptr soldier) void nobMilitary::SoldierLost(nofSoldier* soldier) { // Soldat konnte nicht (mehr) kommen --> rauswerfen und ggf. neue Soldaten rufen - if(soldier->GetGOT() == GO_Type::NofPassivesoldier) + if(soldier->getGOT() == GO_Type::NofPassivesoldier) { RTTR_Assert(helpers::contains(ordered_troops, static_cast(soldier))); ordered_troops.erase(static_cast(soldier)); @@ -924,15 +924,15 @@ nofPassiveSoldier* nobMilitary::ChooseSoldier() for(auto& troop : troops) { - if(!candidates[troop->GetRank()]) + if(!candidates[troop->getRank()]) { ++rank_count; - candidates[troop->GetRank()] = troop.get(); + candidates[troop->getRank()] = troop.get(); } } // ID ausrechnen - unsigned rank = ((rank_count - 1) * world->GetPlayer(player).GetMilitarySetting(1)) / MILITARY_SETTINGS_SCALE[1]; + unsigned rank = ((rank_count - 1) * world->getPlayer(player).getMilitarySetting(1)) / MILITARY_SETTINGS_SCALE[1]; unsigned r = 0; @@ -955,7 +955,7 @@ nofPassiveSoldier* nobMilitary::ChooseSoldier() nofAggressiveDefender* nobMilitary::SendAggressiveDefender(nofAttacker& attacker) { // Don't send last soldier - if(GetNumTroops() <= 1) + if(getNumTroops() <= 1) return nullptr; nofPassiveSoldier* soldier = ChooseSoldier(); if(soldier) @@ -973,14 +973,14 @@ nofAggressiveDefender* nobMilitary::SendAggressiveDefender(nofAttacker& attacker } /// Gibt die Anzahl der Soldaten zurück, die für einen Angriff auf ein bestimmtes Ziel zur Verfügung stehen -unsigned nobMilitary::GetNumSoldiersForAttack(const MapPoint dest) const +unsigned nobMilitary::getNumSoldiersForAttack(const MapPoint dest) const { // Soldaten ausrechnen, wie viel man davon nehmen könnte, je nachdem wie viele in den // Militäreinstellungen zum Angriff eingestellt wurden unsigned short soldiers_count = - (GetNumTroops() > 1) ? - ((GetNumTroops() - 1) * world->GetPlayer(GetPlayer()).GetMilitarySetting(3) / MILITARY_SETTINGS_SCALE[3]) : + (getNumTroops() > 1) ? + ((getNumTroops() - 1) * world->getPlayer(getPlayer()).getMilitarySetting(3) / MILITARY_SETTINGS_SCALE[3]) : 0; unsigned distance = world->CalcDistance(pos, dest); @@ -1006,10 +1006,10 @@ unsigned nobMilitary::GetNumSoldiersForAttack(const MapPoint dest) const } /// Gibt die Soldaten zurück, die für einen Angriff auf ein bestimmtes Ziel zur Verfügung stehen -std::vector nobMilitary::GetSoldiersForAttack(const MapPoint dest) const +std::vector nobMilitary::getSoldiersForAttack(const MapPoint dest) const { std::vector soldiers; - unsigned soldiers_count = GetNumSoldiersForAttack(dest); + unsigned soldiers_count = getNumSoldiersForAttack(dest); for(const auto& sld : helpers::reverse(troops)) { if(soldiers_count--) @@ -1021,17 +1021,17 @@ std::vector nobMilitary::GetSoldiersForAttack(const MapPoint } /// Gibt die Stärke der Soldaten zurück, die für einen Angriff auf ein bestimmtes Ziel zur Verfügung stehen -unsigned nobMilitary::GetSoldiersStrengthForAttack(const MapPoint dest, unsigned& soldiers_count) const +unsigned nobMilitary::getSoldiersStrengthForAttack(const MapPoint dest, unsigned& soldiers_count) const { unsigned strength = 0; - soldiers_count = GetNumSoldiersForAttack(dest); + soldiers_count = getNumSoldiersForAttack(dest); unsigned numRemainingSoldiers = soldiers_count; for(const auto& sld : helpers::reverse(troops)) { if(numRemainingSoldiers--) - strength += HITPOINTS[sld->GetRank()]; + strength += HITPOINTS[sld->getRank()]; else break; } @@ -1040,21 +1040,21 @@ unsigned nobMilitary::GetSoldiersStrengthForAttack(const MapPoint dest, unsigned } /// Gibt die Stärke eines Militärgebäudes zurück -unsigned nobMilitary::GetSoldiersStrength() const +unsigned nobMilitary::getSoldiersStrength() const { unsigned strength = 0; for(const auto& troop : troops) - strength += HITPOINTS[troop->GetRank()]; + strength += HITPOINTS[troop->getRank()]; return strength; } /// is there a max rank soldier in the building? -bool nobMilitary::HasMaxRankSoldier() const +bool nobMilitary::hasMaxRankSoldier() const { - const unsigned maxRank = world->GetGGS().GetMaxMilitaryRank(); + const unsigned maxRank = world->getGGS().getMaxMilitaryRank(); return helpers::contains_if(helpers::reverse(troops), - [maxRank](const auto& it) { return it->GetRank() >= maxRank; }); + [maxRank](const auto& it) { return it->getRank() >= maxRank; }); } std::unique_ptr nobMilitary::ProvideDefender(nofAttacker& attacker) @@ -1074,24 +1074,24 @@ std::unique_ptr nobMilitary::ProvideDefender(nofAttacker& attacker) void nobMilitary::Capture(const unsigned char new_owner) { - RTTR_Assert(IsBeingCaptured()); + RTTR_Assert(isBeingCaptured()); // Goldmünzen in der Inventur vom alten Spieler abziehen und dem neuen hinzufügen - world->GetPlayer(player).DecreaseInventoryWare(GoodType::Coins, numCoins); - world->GetPlayer(new_owner).IncreaseInventoryWare(GoodType::Coins, numCoins); + world->getPlayer(player).DecreaseInventoryWare(GoodType::Coins, numCoins); + world->getPlayer(new_owner).IncreaseInventoryWare(GoodType::Coins, numCoins); - world->GetPlayer(player).DecreaseInventoryWare(GoodType::Armor, numArmor); - world->GetPlayer(new_owner).IncreaseInventoryWare(GoodType::Armor, numArmor); + world->getPlayer(player).DecreaseInventoryWare(GoodType::Armor, numArmor); + world->getPlayer(new_owner).IncreaseInventoryWare(GoodType::Armor, numArmor); // Reset desired troop setting - troop_limits.fill(GetMaxTroopsCt()); + troop_limits.fill(getMaxTroopsCt()); // Soldaten, die auf Mission sind, Bescheid sagen for(auto* it : troops_on_mission) it->HomeDestroyed(); // Bestellungen die hierher unterwegs sind canceln - CancelOrders(); + cancelOrders(); // Tell agressive defending soldiers and far away capturers that their goal is gone for(auto* soldier : aggressive_defenders) @@ -1105,20 +1105,20 @@ void nobMilitary::Capture(const unsigned char new_owner) // Alten Besitzer merken unsigned char old_player = player; - world->GetPlayer(old_player).RemoveBuilding(this, bldType_); + world->getPlayer(old_player).RemoveBuilding(this, bldType_); // neuer Spieler player = new_owner; // In der Wirtschaftsverwaltung dieses Gebäude jetzt zum neuen Spieler zählen und beim alten raushauen - world->GetPlayer(new_owner).AddBuilding(this, bldType_); + world->getPlayer(new_owner).AddBuilding(this, bldType_); // Flagge davor auch übernehmen - GetFlag()->Capture(new_owner); + getFlag()->Capture(new_owner); // Territorium neu berechnen world->RecalcTerritory(*this, TerritoryChangeReason::Captured); // Sichtbarkeiten berechnen für alten Spieler - world->RecalcVisibilitiesAroundPoint(pos, GetMilitaryRadius() + VISUALRANGE_MILITARY + 1, old_player, nullptr); + world->RecalcVisibilitiesAroundPoint(pos, getMilitaryRadius() + VISUALRANGE_MILITARY + 1, old_player, nullptr); // Grenzflagge entsprechend neu setzen von den Feinden LookForEnemyBuildings(); @@ -1127,22 +1127,22 @@ void nobMilitary::Capture(const unsigned char new_owner) for(auto* building : buildings) { // verbündetes Gebäude? - if(world->GetPlayer(building->GetPlayer()).IsAttackable(old_player) - && BuildingProperties::IsMilitary(building->GetBuildingType())) + if(world->getPlayer(building->getPlayer()).isAttackable(old_player) + && BuildingProperties::isMilitary(building->getBuildingType())) // Grenzflaggen von dem neu berechnen static_cast(building)->LookForEnemyBuildings(); } // ehemalige Leute dieses Gebäudes nach Hause schicken, die ggf. grad auf dem Weg rein/raus waren - std::array coords = {pos, world->GetNeighbour(pos, Direction::SouthEast)}; + std::array coords = {pos, world->getNeighbour(pos, Direction::SouthEast)}; for(const auto& coord : coords) { - for(noBase& baseFigure : world->GetFigures(coord)) + for(noBase& baseFigure : world->getFigures(coord)) { - if(baseFigure.GetType() == NodalObjectType::Figure) + if(baseFigure.getType() == NodalObjectType::Figure) { auto& figure = static_cast(baseFigure); - if(figure.GetCurrentRoad() == GetRoute(Direction::SouthEast) && figure.GetPlayer() != new_owner) + if(figure.getCurrentRoad() == getRoute(Direction::SouthEast) && figure.getPlayer() != new_owner) { figure.Abrogate(); figure.StartWandering(); @@ -1156,8 +1156,8 @@ void nobMilitary::Capture(const unsigned char new_owner) { nofAttacker* attacker = *it; // dont remove attackers owned by players not allied with the new owner! - unsigned char attPlayer = attacker->GetPlayer(); - if(attPlayer != player && !world->GetPlayer(attPlayer).IsAttackable(player)) + unsigned char attPlayer = attacker->getPlayer(); + if(attPlayer != player && !world->getPlayer(attPlayer).isAttackable(player)) { it = aggressors.erase(it); attacker->CapturedBuildingFull(); @@ -1167,18 +1167,18 @@ void nobMilitary::Capture(const unsigned char new_owner) // Post verschicken, an den alten Besitzer und an den neuen Besitzer SendPostMessage(old_player, - std::make_unique(GetEvMgr().GetCurrentGF(), _("Military building lost"), + std::make_unique(getEvMgr().getCurrentGF(), _("Military building lost"), PostCategory::Military, *this)); SendPostMessage(player, - std::make_unique(GetEvMgr().GetCurrentGF(), _("Military building captured"), + std::make_unique(getEvMgr().getCurrentGF(), _("Military building captured"), PostCategory::Military, *this)); - world->GetNotifications().publish(BuildingNote(BuildingNote::Captured, player, pos, bldType_)); - world->GetNotifications().publish(BuildingNote(BuildingNote::Lost, old_player, pos, bldType_)); + world->getNotifications().publish(BuildingNote(BuildingNote::Captured, player, pos, bldType_)); + world->getNotifications().publish(BuildingNote(BuildingNote::Lost, old_player, pos, bldType_)); // Check if we need to change the coin order - switch(world->GetGGS().getSelection(AddonId::COINS_CAPTURED_BLD)) + switch(world->getGGS().getSelection(AddonId::COINS_CAPTURED_BLD)) { case 1: // enable coin order coinsDisabled = false; @@ -1190,7 +1190,7 @@ void nobMilitary::Capture(const unsigned char new_owner) break; } - switch(world->GetGGS().getSelection(AddonId::ARMOR_CAPTURED_BLD)) + switch(world->getGGS().getSelection(AddonId::ARMOR_CAPTURED_BLD)) { case 1: // enable armor order armorAllowed = true; @@ -1205,7 +1205,7 @@ void nobMilitary::Capture(const unsigned char new_owner) void nobMilitary::NeedOccupyingTroops() { - RTTR_Assert(IsBeingCaptured()); // Only valid during capturing + RTTR_Assert(isBeingCaptured()); // Only valid during capturing // Check if we need more soldiers from the attacking soldiers // Choose the closest ones first to avoid having them walk a long way @@ -1221,18 +1221,18 @@ void nobMilitary::NeedOccupyingTroops() for(auto* aggressor : aggressors) { // Is the soldier standing around and owned by the player? - if(!aggressor->IsAttackerReady() || aggressor->GetPlayer() != player) + if(!aggressor->isAttackerReady() || aggressor->getPlayer() != player) continue; // Näher als der bisher beste? - if(aggressor->GetRadius() >= best_radius) + if(aggressor->getRadius() >= best_radius) continue; // Und kommt er überhaupt zur Flagge (könnte ja in der 2. Reihe stehen, sodass die vor ihm ihn den Weg // versperren)? - if(world->FindHumanPath(aggressor->GetPos(), world->GetNeighbour(pos, Direction::SouthEast), 10, false)) + if(world->FindHumanPath(aggressor->getPos(), world->getNeighbour(pos, Direction::SouthEast), 10, false)) { // Dann is das der bisher beste best_attacker = aggressor; - best_radius = best_attacker->GetRadius(); + best_radius = best_attacker->getRadius(); } } @@ -1252,10 +1252,10 @@ void nobMilitary::NeedOccupyingTroops() { nofAttacker* attacker = *it; - if(attacker->GetPlayer() == player) + if(attacker->getPlayer() == player) { // Ask attacker if this is possible - if(attacker->CanStartFarAwayCapturing(*this)) + if(attacker->canStartFarAwayCapturing(*this)) { it = aggressors.erase(it); far_away_capturers.push_back(attacker); @@ -1274,8 +1274,8 @@ void nobMilitary::NeedOccupyingTroops() nofAttacker* attacker = *it; // Nicht gerade Soldaten löschen, die das Gebäude noch einnehmen! // also: dont remove attackers owned by players not allied with the new owner! - if(attacker->GetState() != nofActiveSoldier::SoldierState::AttackingCapturingNext - && !world->GetPlayer(attacker->GetPlayer()).IsAttackable(player)) + if(attacker->getState() != nofActiveSoldier::SoldierState::AttackingCapturingNext + && !world->getPlayer(attacker->getPlayer()).isAttackable(player)) { it = aggressors.erase(it); attacker->CapturedBuildingFull(); @@ -1292,7 +1292,7 @@ void nobMilitary::SetCoinsAllowed(const bool enabled) // Umstellen coinsDisabled = !enabled; // Wenn das von einem fremden Spieler umgestellt wurde (oder vom Replay), muss auch das visuelle umgestellt werden - if(GAMECLIENT.GetPlayerId() != player || GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.getPlayerId() != player || GAMECLIENT.isReplayModeOn()) coinsDisabledVirtual = coinsDisabled; if(!coinsDisabled) @@ -1303,7 +1303,7 @@ void nobMilitary::SetCoinsAllowed(const bool enabled) for(auto it = ordered_coins.begin(); it != ordered_coins.end();) { // But only those, that are not just Being carried in - if((*it)->GetLocation() != this) + if((*it)->getLocation() != this) { WareNotNeeded(*it); it = ordered_coins.erase(it); @@ -1319,7 +1319,7 @@ void nobMilitary::SetArmorAllowed(const bool enabled) return; armorAllowed = enabled; - if(GAMECLIENT.GetPlayerId() != player || GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.getPlayerId() != player || GAMECLIENT.isReplayModeOn()) armorAllowedVirtual = armorAllowed; if(armorAllowed) @@ -1330,7 +1330,7 @@ void nobMilitary::SetArmorAllowed(const bool enabled) for(auto it = ordered_armor.begin(); it != ordered_armor.end();) { // But only those, that are not just Being carried in - if((*it)->GetLocation() != this) + if((*it)->getLocation() != this) { WareNotNeeded(*it); it = ordered_armor.erase(it); @@ -1353,12 +1353,12 @@ unsigned nobMilitary::CalcCoinsPoints() const // "Wichtigkeit" aus points -= (numCoins + ordered_coins.size()) * 30; - const unsigned maxRank = world->GetGGS().GetMaxMilitaryRank(); + const unsigned maxRank = world->getGGS().getMaxMilitaryRank(); // Beförderbare Soldaten zählen for(const auto& soldier : troops) { // Solange es kein Max Rank ist, kann der Soldat noch befördert werden - if(soldier->GetRank() < maxRank) + if(soldier->getRank() < maxRank) points += 20; } @@ -1380,7 +1380,7 @@ unsigned nobMilitary::CalcArmorPoints() const points -= (numArmor + ordered_armor.size()) * 30; auto numberOfUpgradeSoldier = - helpers::count_if(troops, [](OwnedSortedTroops::value_type const& troop) { return !troop->HasArmor(); }); + helpers::count_if(troops, [](OwnedSortedTroops::value_type const& troop) { return !troop->hasArmor(); }); points += static_cast(numberOfUpgradeSoldier * 20); @@ -1393,7 +1393,7 @@ unsigned nobMilitary::CalcArmorPoints() const bool nobMilitary::WantCoins() const { // Wenn die Goldzufuhr gestoppt wurde oder Münzvorrat voll ist, will ich gar keine Goldmünzen - return (!coinsDisabled && numCoins + ordered_coins.size() != GetMaxCoinCt() && !new_built); + return (!coinsDisabled && numCoins + ordered_coins.size() != getMaxCoinCt() && !new_built); } void nobMilitary::SearchCoins() @@ -1403,7 +1403,7 @@ void nobMilitary::SearchCoins() { // Lagerhaus mit Goldmünzen suchen nobBaseWarehouse* wh = - world->GetPlayer(player).FindWarehouse(*this, FW::HasMinWares(GoodType::Coins), false, false); + world->getPlayer(player).FindWarehouse(*this, FW::HasMinWares(GoodType::Coins), false, false); if(wh) { // Wenns eins gibt, dort eine Goldmünze bestellen @@ -1420,7 +1420,7 @@ void nobMilitary::SearchCoins() RTTR_Assert(helpers::contains(ordered_coins, ware)); // Nach einer Weile nochmal nach evtl neuen Goldmünzen gucken - gold_order_event = GetEvMgr().AddEvent(this, 200 + RANDOM_RAND(400), 1); + gold_order_event = getEvMgr().AddEvent(this, 200 + RANDOM_RAND(400), 1); } } } @@ -1428,18 +1428,18 @@ void nobMilitary::SearchCoins() bool nobMilitary::WantArmor() const { // If armor delivery stopped or stock already full, we do not want any armor - return (armorAllowed && numArmor + ordered_armor.size() < GetMaxArmorCt() && !new_built); + return (armorAllowed && numArmor + ordered_armor.size() < getMaxArmorCt() && !new_built); } void nobMilitary::SearchArmor() { - if(!leatheraddon::isAddonActive(world->GetPlayer(player).GetGameWorld())) + if(!leatheraddon::isAddonActive(world->getPlayer(player).getGameWorld())) return; if(WantArmor() && !armor_order_event) { nobBaseWarehouse* wh = - world->GetPlayer(player).FindWarehouse(*this, FW::HasMinWares(GoodType::Armor), false, false); + world->getPlayer(player).FindWarehouse(*this, FW::HasMinWares(GoodType::Armor), false, false); if(wh) { Ware* ware = wh->OrderWare(GoodType::Armor, *this); @@ -1454,7 +1454,7 @@ void nobMilitary::SearchArmor() RTTR_Assert(helpers::contains(ordered_armor, ware)); // After some time, try to order new armor - armor_order_event = GetEvMgr().AddEvent(this, 200 + RANDOM_RAND(400), 3); + armor_order_event = getEvMgr().AddEvent(this, 200 + RANDOM_RAND(400), 3); } } } @@ -1472,10 +1472,10 @@ void nobMilitary::PrepareUpgrading() // Noch Soldaten, die befördert werden können? bool soldiers_available = false; - const unsigned maxRank = world->GetGGS().GetMaxMilitaryRank(); + const unsigned maxRank = world->getGGS().getMaxMilitaryRank(); for(auto& troop : troops) { - if(troop->GetRank() < maxRank) + if(troop->getRank() < maxRank) { // es wurde ein Soldat gefunden, der befördert werden kann soldiers_available = true; @@ -1487,7 +1487,7 @@ void nobMilitary::PrepareUpgrading() return; // Alles da --> Beförderungsevent anmelden - upgrade_event = GetEvMgr().AddEvent(this, UPGRADE_TIME + RANDOM_RAND(UPGRADE_TIME_RANDOM), 2); + upgrade_event = getEvMgr().AddEvent(this, UPGRADE_TIME + RANDOM_RAND(UPGRADE_TIME_RANDOM), 2); } void nobMilitary::PrepareArmorUpgrading() @@ -1499,11 +1499,11 @@ void nobMilitary::PrepareArmorUpgrading() return; if(std::none_of(troops.begin(), troops.end(), - [](OwnedSortedTroops::value_type& troop) { return !troop->HasArmor(); })) + [](OwnedSortedTroops::value_type& troop) { return !troop->hasArmor(); })) return; // All here --> Trigger armor upgrade event - armor_upgrade_event = GetEvMgr().AddEvent(this, UPGRADE_TIME + RANDOM_RAND(UPGRADE_TIME_RANDOM), 4); + armor_upgrade_event = getEvMgr().AddEvent(this, UPGRADE_TIME + RANDOM_RAND(UPGRADE_TIME_RANDOM), 4); } void nobMilitary::HitOfCatapultStone() @@ -1515,7 +1515,7 @@ void nobMilitary::HitOfCatapultStone() helpers::pop_front(troops); // 30 percent chance to survive if the soldier has an armor - const bool survived = soldier->HasArmor() && (RANDOM_RAND(100) < 30); + const bool survived = soldier->hasArmor() && (RANDOM_RAND(100) < 30); if(!survived) { // Shortcut for Die(): No need to remove from world as it is inside and we can delete it right away @@ -1524,8 +1524,8 @@ void nobMilitary::HitOfCatapultStone() soldier->Destroy(); } else { - soldier->SetArmor(false); - world->GetPlayer(player).DecreaseInventoryJob(jobEnumToAmoredSoldierEnum(soldier->GetJobType()), 1); + soldier->setArmor(false); + world->getPlayer(player).DecreaseInventoryJob(jobEnumToAmoredSoldierEnum(soldier->getJobType()), 1); troops.insert(std::move(soldier)); } } @@ -1536,16 +1536,16 @@ void nobMilitary::HitOfCatapultStone() // Post verschicken SendPostMessage(player, - std::make_unique(GetEvMgr().GetCurrentGF(), _("A catapult is firing upon us!"), + std::make_unique(getEvMgr().getCurrentGF(), _("A catapult is firing upon us!"), PostCategory::Military, *this)); } /** * Darf das Militärgebäude abgerissen werden (Abriss-Verbot berücksichtigen)? */ -bool nobMilitary::IsDemolitionAllowed() const +bool nobMilitary::isDemolitionAllowed() const { - switch(world->GetGGS().getSelection(AddonId::DEMOLITION_PROHIBITION)) + switch(world->getGGS().getSelection(AddonId::DEMOLITION_PROHIBITION)) { default: // off break; @@ -1570,7 +1570,7 @@ bool nobMilitary::IsDemolitionAllowed() const void nobMilitary::UnlinkAggressor(nofAttacker& soldier) { - RTTR_Assert(IsAggressor(soldier) || IsFarAwayCapturer(soldier)); + RTTR_Assert(isAggressor(soldier) || isFarAwayCapturer(soldier)); aggressors.remove(&soldier); far_away_capturers.remove(&soldier); @@ -1580,7 +1580,7 @@ void nobMilitary::UnlinkAggressor(nofAttacker& soldier) void nobMilitary::CapturingSoldierArrived() { - RTTR_Assert(IsBeingCaptured()); + RTTR_Assert(isBeingCaptured()); RTTR_Assert(capturing_soldiers > 0); --capturing_soldiers; if(capturing_soldiers == 0) @@ -1598,8 +1598,8 @@ void nobMilitary::CapturingSoldierArrived() void nobMilitary::FarAwayCapturerReachedGoal(nofAttacker& attacker, bool walkingIntoBld) { - RTTR_Assert(IsFarAwayCapturer(attacker)); - if(IsBeingCaptured()) + RTTR_Assert(isFarAwayCapturer(attacker)); + if(isBeingCaptured()) { // If we are still capturing just re-add this soldier to the aggressors // one of the currently capturing soldiers will notify him @@ -1614,26 +1614,26 @@ void nobMilitary::FarAwayCapturerReachedGoal(nofAttacker& attacker, bool walking } } -bool nobMilitary::IsFarAwayCapturer(const nofAttacker& attacker) +bool nobMilitary::isFarAwayCapturer(const nofAttacker& attacker) { return helpers::contains(far_away_capturers, &attacker); } void nobMilitary::CallNextFarAwayCapturer(nofAttacker& attacker) { - const MapPoint flagPos = GetFlagPos(); + const MapPoint flagPos = getFlagPos(); unsigned minLength = std::numeric_limits::max(); nofAttacker* bestAttacker = nullptr; for(auto* far_away_capturer : far_away_capturers) { // Skip us and possible capturers at the building - if(far_away_capturer == &attacker || far_away_capturer->GetPos() == pos) + if(far_away_capturer == &attacker || far_away_capturer->getPos() == pos) continue; - if(!far_away_capturer->IsAttackerReady()) + if(!far_away_capturer->isAttackerReady()) continue; - RTTR_Assert(far_away_capturer->GetPos() != flagPos); // Impossible. This should be the current attacker + RTTR_Assert(far_away_capturer->getPos() != flagPos); // Impossible. This should be the current attacker unsigned length; - if(!world->FindHumanPath(far_away_capturer->GetPos(), flagPos, MAX_FAR_AWAY_CAPTURING_DISTANCE, false, &length)) + if(!world->FindHumanPath(far_away_capturer->getPos(), flagPos, MAX_FAR_AWAY_CAPTURING_DISTANCE, false, &length)) continue; if(length < minLength) { diff --git a/libs/s25main/buildings/nobMilitary.h b/libs/s25main/buildings/nobMilitary.h index e27bc87543..aca9acd190 100644 --- a/libs/s25main/buildings/nobMilitary.h +++ b/libs/s25main/buildings/nobMilitary.h @@ -79,7 +79,7 @@ class nobMilitary : public nobBaseMilitary std::array troop_limits; /// Bestellungen (sowohl Truppen als auch Goldmünzen) zurücknehmen - void CancelOrders(); + void cancelOrders(); /// Wählt je nach Militäreinstellungen (Verteidigerstärke) einen passenden Soldaten aus nofPassiveSoldier* ChooseSoldier(); /// Stellt Verteidiger zur Verfügung @@ -93,8 +93,8 @@ class nobMilitary : public nobBaseMilitary void PrepareUpgrading(); void PrepareArmorUpgrading(); /// Gets the total amount of soldiers (ordered, stationed, on mission) - size_t GetTotalSoldiers() const; - std::array GetTotalSoldiersByRank() const; + size_t getTotalSoldiers() const; + std::array getTotalSoldiersByRank() const; /// Looks for the next far-away-capturer waiting around and calls it to the flag void CallNextFarAwayCapturer(nofAttacker& attacker); @@ -112,19 +112,19 @@ class nobMilitary : public nobBaseMilitary public: void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NobMilitary; } + GO_Type getGOT() const final { return GO_Type::NobMilitary; } void Draw(DrawPoint drawPt) override; void HandleEvent(unsigned id) override; /// Wurde das Militärgebäude neu gebaut und noch nicht besetzt und kann somit abgerissen werden bei Land-verlust? - bool IsNewBuilt() const { return new_built; } + bool isNewBuilt() const { return new_built; } /// Liefert Militärradius des Gebäudes - unsigned GetMilitaryRadius() const override; - unsigned GetMaxCoinCt() const; - unsigned GetMaxArmorCt() const; - unsigned GetMaxTroopsCt() const; + unsigned getMilitaryRadius() const override; + unsigned getMaxCoinCt() const; + unsigned getMaxArmorCt() const; + unsigned getMaxTroopsCt() const; /// Sucht feindliche Miitärgebäude im Umkreis und setzt die frontier_distance entsprechend (sowohl selber als /// auch von den feindlichen Gebäuden) und bestellt somit ggf. neue Soldaten, exception wird nicht mit einbezogen @@ -133,10 +133,10 @@ class nobMilitary : public nobBaseMilitary /// Wird von gegnerischem Gebäude aufgerufen, wenn sie neu gebaut worden sind und es so ein neues Gebäude im Umkreis /// gibt setzt frontier_distance neu falls möglich und sendet ggf. Verstärkung void NewEnemyMilitaryBuilding(FrontierDistance distance); - bool IsUseless() const; - bool IsAttackable(unsigned playerIdx) const override; + bool isUseless() const; + bool isAttackable(unsigned playerIdx) const override; /// Gibt Distanz zurück - FrontierDistance GetFrontierDistance() const { return frontier_distance; } + FrontierDistance getFrontierDistance() const { return frontier_distance; } /// Berechnet die gewünschte Besatzung je nach Grenznähe unsigned CalcRequiredNumTroops() const; @@ -145,12 +145,12 @@ class nobMilitary : public nobBaseMilitary /// Reguliert die Besatzung des Gebäudes je nach Grenznähe, bestellt neue Soldaten und schickt überflüssige raus void RegulateTroops(); /// Gibt aktuelle Besetzung zurück - unsigned GetNumTroops() const { return troops.size(); } - auto GetTroops() const { return helpers::nonNullPtrSpan(troops); } - bool IsInTroops(const nofPassiveSoldier& soldier) const; + unsigned getNumTroops() const { return troops.size(); } + auto getTroops() const { return helpers::nonNullPtrSpan(troops); } + bool isInTroops(const nofPassiveSoldier& soldier) const; /// Get/Set the maximum number of soldiers of rank `rank` allowed in this building - unsigned GetTroopLimit(const unsigned rank) const { return troop_limits[rank]; } + unsigned getTroopLimit(const unsigned rank) const { return troop_limits[rank]; } void SetTroopLimit(unsigned rank, unsigned limit); /// Wird aufgerufen, wenn eine neue Ware zum dem Gebäude geliefert wird (in dem Fall nur Goldstücke) @@ -182,13 +182,13 @@ class nobMilitary : public nobBaseMilitary nofAggressiveDefender* SendAggressiveDefender(nofAttacker& attacker) override; /// Gibt die Anzahl der Soldaten zurück, die für einen Angriff auf ein bestimmtes Ziel zur Verfügung stehen - unsigned GetNumSoldiersForAttack(MapPoint dest) const; + unsigned getNumSoldiersForAttack(MapPoint dest) const; /// Gibt die Soldaten zurück, die für einen Angriff auf ein bestimmtes Ziel zur Verfügung stehen - std::vector GetSoldiersForAttack(MapPoint dest) const; + std::vector getSoldiersForAttack(MapPoint dest) const; /// Gibt die Stärke der Soldaten zurück, die für einen Angriff auf ein bestimmtes Ziel zur Verfügung stehen - unsigned GetSoldiersStrengthForAttack(MapPoint dest, unsigned& soldiers_count) const; + unsigned getSoldiersStrengthForAttack(MapPoint dest, unsigned& soldiers_count) const; /// Gibt die Stärke eines Militärgebäudes zurück - unsigned GetSoldiersStrength() const; + unsigned getSoldiersStrength() const; /// Gebäude wird vom Gegner eingenommen, player ist die neue Spieler-ID void Capture(unsigned char new_owner); @@ -199,13 +199,13 @@ class nobMilitary : public nobBaseMilitary /// (also noch bevor er drinnen ist!) - damit da nicht zusätzliche Soldaten reinlaufen void PrepareCapturing() { - RTTR_Assert(!IsBeingCaptured()); + RTTR_Assert(!isBeingCaptured()); capturing = true; ++capturing_soldiers; } /// Wird das Gebäude gerade eingenommen? - bool IsBeingCaptured() const { return capturing; } + bool isBeingCaptured() const { return capturing; } /// Gebäude wird nicht mehr eingenommen (falls anderer Soldat zuvor reingekommen ist beim Einnehmen) void StopCapturing() { @@ -217,26 +217,26 @@ class nobMilitary : public nobBaseMilitary /// A far-away capturer arrived at the flag and starts the capturing or is waiting around it void FarAwayCapturerReachedGoal(nofAttacker& attacker, bool walkingIntoBld); - bool IsFarAwayCapturer(const nofAttacker& attacker); + bool isFarAwayCapturer(const nofAttacker& attacker); /// Stoppt/Erlaubt Goldzufuhr (visuell) void ToggleCoinsVirtual() { coinsDisabledVirtual = !coinsDisabledVirtual; } /// Stoppt/Erlaubt Goldzufuhr (real) void SetCoinsAllowed(bool enabled); /// Fragt ab, ob Goldzufuhr ausgeschaltet ist (visuell) - bool IsGoldDisabledVirtual() const { return coinsDisabledVirtual; } + bool isGoldDisabledVirtual() const { return coinsDisabledVirtual; } /// Fragt ab, ob Goldzufuhr ausgeschaltet ist (real) - bool IsGoldDisabled() const { return coinsDisabled; } - unsigned char GetNumCoins() const { return numCoins; } + bool isGoldDisabled() const { return coinsDisabled; } + unsigned char getNumCoins() const { return numCoins; } void ToggleArmorVirtual() { armorAllowedVirtual = !armorAllowedVirtual; } void SetArmorAllowed(bool enabled); - bool IsArmorAllowedVirtual() const { return armorAllowedVirtual; } - bool IsArmorAllowed() const { return armorAllowed; } - unsigned char GetNumArmor() const { return numArmor; } + bool isArmorAllowedVirtual() const { return armorAllowedVirtual; } + bool isArmorAllowed() const { return armorAllowed; } + unsigned char getNumArmor() const { return numArmor; } /// is there a max rank soldier in the building? - bool HasMaxRankSoldier() const; + bool hasMaxRankSoldier() const; /// Sucht sämtliche Lagerhäuser nach Goldmünzen ab und bestellt ggf. eine, falls eine gebraucht wird void SearchCoins(); @@ -246,10 +246,10 @@ class nobMilitary : public nobBaseMilitary void HitOfCatapultStone(); /// Sind noch Truppen drinne, die dieses Gebäude verteidigen können - bool DefendersAvailable() const override { return GetNumTroops() > 0; } + bool DefendersAvailable() const override { return getNumTroops() > 0; } /// Darf das Militärgebäude abgerissen werden (Abriss-Verbot berücksichtigen)? - bool IsDemolitionAllowed() const; + bool isDemolitionAllowed() const; void UnlinkAggressor(nofAttacker& soldier) override; }; diff --git a/libs/s25main/buildings/nobShipYard.cpp b/libs/s25main/buildings/nobShipYard.cpp index bbd3af806f..f1491e8e33 100644 --- a/libs/s25main/buildings/nobShipYard.cpp +++ b/libs/s25main/buildings/nobShipYard.cpp @@ -22,7 +22,7 @@ void nobShipYard::Serialize(SerializedGameData& sgd) const } /// Schaltet Modus entsprechend um -void nobShipYard::SetMode(Mode newMode) +void nobShipYard::setMode(Mode newMode) { mode = newMode; } diff --git a/libs/s25main/buildings/nobShipYard.h b/libs/s25main/buildings/nobShipYard.h index c0d1b63dcf..65ed652c66 100644 --- a/libs/s25main/buildings/nobShipYard.h +++ b/libs/s25main/buildings/nobShipYard.h @@ -33,10 +33,10 @@ class nobShipYard : public nobUsual /// Serialisierungsfunktionen void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NobShipyard; } + GO_Type getGOT() const final { return GO_Type::NobShipyard; } /// Gibt aktuellen Modus zurück - Mode GetMode() const { return mode; } + Mode getMode() const { return mode; } /// Schaltet Modus entsprechend um - void SetMode(Mode newMode); + void setMode(Mode newMode); }; diff --git a/libs/s25main/buildings/nobStorehouse.cpp b/libs/s25main/buildings/nobStorehouse.cpp index 0bf81d8c1e..1a207b9e4f 100644 --- a/libs/s25main/buildings/nobStorehouse.cpp +++ b/libs/s25main/buildings/nobStorehouse.cpp @@ -11,7 +11,7 @@ nobStorehouse::nobStorehouse(const MapPoint pos, const unsigned char player, con { // Post versenden SendPostMessage(player, std::make_unique( - GetEvMgr().GetCurrentGF(), _("New storehouse finished"), PostCategory::Economy, *this)); + getEvMgr().getCurrentGF(), _("New storehouse finished"), PostCategory::Economy, *this)); } nobStorehouse::nobStorehouse(SerializedGameData& sgd, const unsigned obj_id) : nobBaseWarehouse(sgd, obj_id) {} diff --git a/libs/s25main/buildings/nobStorehouse.h b/libs/s25main/buildings/nobStorehouse.h index 0be4a644b3..ba7ce5a55c 100644 --- a/libs/s25main/buildings/nobStorehouse.h +++ b/libs/s25main/buildings/nobStorehouse.h @@ -15,9 +15,9 @@ class nobStorehouse : public nobBaseWarehouse nobStorehouse(SerializedGameData& sgd, unsigned obj_id); public: - GO_Type GetGOT() const final { return GO_Type::NobStorehouse; } - unsigned GetMilitaryRadius() const override { return 0; } - bool IsAttackable(unsigned /*playerIdx*/) const override { return false; } + GO_Type getGOT() const final { return GO_Type::NobStorehouse; } + unsigned getMilitaryRadius() const override { return 0; } + bool isAttackable(unsigned /*playerIdx*/) const override { return false; } void Draw(DrawPoint drawPt) override; diff --git a/libs/s25main/buildings/nobTemple.cpp b/libs/s25main/buildings/nobTemple.cpp index b25ca37b8e..2f9092ba40 100644 --- a/libs/s25main/buildings/nobTemple.cpp +++ b/libs/s25main/buildings/nobTemple.cpp @@ -24,7 +24,7 @@ void nobTemple::Serialize(SerializedGameData& sgd) const sgd.PushEnum(productionMode); } -void nobTemple::SetProductionMode(ProductionMode newProductionMode) +void nobTemple::setProductionMode(ProductionMode newProductionMode) { productionMode = newProductionMode; } diff --git a/libs/s25main/buildings/nobTemple.h b/libs/s25main/buildings/nobTemple.h index 7ffe905319..05f50bff7e 100644 --- a/libs/s25main/buildings/nobTemple.h +++ b/libs/s25main/buildings/nobTemple.h @@ -21,9 +21,9 @@ class nobTemple : public nobUsual public: void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NobTemple; } + GO_Type getGOT() const final { return GO_Type::NobTemple; } - ProductionMode GetProductionMode() const { return productionMode; } - void SetProductionMode(ProductionMode newProductionMode); + ProductionMode getProductionMode() const { return productionMode; } + void setProductionMode(ProductionMode newProductionMode); ProductionMode getNextProductionMode(); }; diff --git a/libs/s25main/buildings/nobUsual.cpp b/libs/s25main/buildings/nobUsual.cpp index f1f9140662..dc0eb82aa1 100644 --- a/libs/s25main/buildings/nobUsual.cpp +++ b/libs/s25main/buildings/nobUsual.cpp @@ -44,9 +44,9 @@ nobUsual::nobUsual(BuildingType type, MapPoint pos, unsigned char player, Nation // Tür aufmachen,bis Gebäude besetzt ist OpenDoor(); - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); // New building gets half the average productivity from all buildings of the same type - productivity = owner.GetBuildingRegister().CalcAverageProductivity(type) / 2u; + productivity = owner.getBuildingRegister().CalcAverageProductivity(type) / 2u; // Set last productivities to current to avoid resetting it on first recalculation event std::fill(lastProductivities.begin(), lastProductivities.end(), productivity); } @@ -98,7 +98,7 @@ void nobUsual::DestroyBuilding() worker->LostWork(); worker = nullptr; } else - world->GetPlayer(player).JobNotWanted(this); + world->getPlayer(player).JobNotWanted(this); // Bestellte Waren Bescheid sagen for(std::list& orderedWare : orderedWares) @@ -109,15 +109,15 @@ void nobUsual::DestroyBuilding() } // Events löschen - GetEvMgr().RemoveEvent(orderware_ev); - GetEvMgr().RemoveEvent(productivity_ev); + getEvMgr().RemoveEvent(orderware_ev); + getEvMgr().RemoveEvent(productivity_ev); // Inventur entsprechend verringern wegen den Waren, die vernichtetet werden for(unsigned i = 0; i < BLD_WORK_DESC[bldType_].waresNeeded.size(); ++i) { const GoodType ware = BLD_WORK_DESC[bldType_].waresNeeded[i]; RTTR_Assert(ware != GoodType::Nothing); - world->GetPlayer(player).DecreaseInventoryWare(ware, numWares[i]); + world->getPlayer(player).DecreaseInventoryWare(ware, numWares[i]); } } @@ -128,7 +128,7 @@ void nobUsual::Draw(DrawPoint drawPt) // Wenn Produktion gestoppt ist, Schild außen am Gebäude zeichnen zeichnen if(disableProductionVirtual) - LOADER.GetMapTexture(46)->DrawFull(drawPt + BUILDING_SIGN_CONSTS[nation][bldType_]); + LOADER.getMapTexture(46)->DrawFull(drawPt + BUILDING_SIGN_CONSTS[nation][bldType_]); // Rauch zeichnen @@ -137,8 +137,8 @@ void nobUsual::Draw(DrawPoint drawPt) { // Dann Qualm zeichnen (damit Qualm nicht synchron ist, x- und y- Koordinate als Unterscheidung LOADER - .GetMapTexture(692 + BUILDING_SMOKE_CONSTS[nation][bldType_].type * 8 - + GAMECLIENT.GetGlobalAnimation(8, 5, 2, (GetX() + GetY()) * 100)) + .getMapTexture(692 + BUILDING_SMOKE_CONSTS[nation][bldType_].type * 8 + + GAMECLIENT.getGlobalAnimation(8, 5, 2, (getX() + getY()) * 100)) ->DrawFull(drawPt + BUILDING_SMOKE_CONSTS[nation][bldType_].offset, 0x99EEEEEE); } @@ -148,9 +148,9 @@ void nobUsual::Draw(DrawPoint drawPt) if(bldType_ == BuildingType::Mill && !is_working) { // Flügel der Mühle - LOADER.GetNationImage(nation, 250 + 5 * 49)->DrawFull(drawPt); + LOADER.getNationImage(nation, 250 + 5 * 49)->DrawFull(drawPt); // Schatten der Flügel - LOADER.GetNationImage(nation, 250 + 5 * 49 + 1)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getNationImage(nation, 250 + 5 * 49 + 1)->DrawFull(drawPt, COLOR_SHADOW); } // Esel in den Kammer bei Eselzucht zeichnen else if(bldType_ == BuildingType::DonkeyBreeder) @@ -176,19 +176,19 @@ void nobUsual::Draw(DrawPoint drawPt) RTTR_Assert(productivity <= 100u); for(unsigned i = 0; i < productivity / 30u; i++) { - unsigned animationFrame = DONKEY_ANIMATION[GAMECLIENT.GetGlobalAnimation( - DONKEY_ANIMATION.size(), 5, 2, GetX() * (player + 2) + GetY() * i)]; - LOADER.GetMapTexture(2180 + animationFrame)->DrawFull(drawPt + DONKEY_OFFSETS[nation][i]); + unsigned animationFrame = DONKEY_ANIMATION[GAMECLIENT.getGlobalAnimation( + DONKEY_ANIMATION.size(), 5, 2, getX() * (player + 2) + getY() * i)]; + LOADER.getMapTexture(2180 + animationFrame)->DrawFull(drawPt + DONKEY_OFFSETS[nation][i]); } } // Bei Katapulthaus Katapult oben auf dem Dach zeichnen, falls er nicht "arbeitet" else if(bldType_ == BuildingType::Catapult && !is_working) { - LOADER.GetPlayerImage("rom_bobs", 1776)->DrawFull(drawPt - DrawPoint(7, 19)); + LOADER.getPlayerImage("rom_bobs", 1776)->DrawFull(drawPt - DrawPoint(7, 19)); } // Bei Schweinefarm Schweinchen auf dem Hof zeichnen - else if(bldType_ == BuildingType::PigFarm && this->HasWorker()) + else if(bldType_ == BuildingType::PigFarm && this->hasWorker()) { // Position der 5 Schweinchen für alle 4 Völker (1. ist das große Schwein) constexpr helpers::EnumArray, Nation> PIG_POSITIONS = {{ @@ -201,8 +201,8 @@ void nobUsual::Draw(DrawPoint drawPt) }}; /// Großes Schwein zeichnen - LOADER.GetMapTexture(2160)->DrawFull(drawPt + PIG_POSITIONS[nation][0], COLOR_SHADOW); - LOADER.GetMapTexture(2100 + GAMECLIENT.GetGlobalAnimation(12, 3, 1, GetX() + GetY() + GetObjId())) + LOADER.getMapTexture(2160)->DrawFull(drawPt + PIG_POSITIONS[nation][0], COLOR_SHADOW); + LOADER.getMapTexture(2100 + GAMECLIENT.getGlobalAnimation(12, 3, 1, getX() + getY() + getObjId())) ->DrawFull(drawPt + PIG_POSITIONS[nation][0]); // Die 4 kleinen Schweinchen, je nach Produktivität @@ -214,9 +214,9 @@ void nobUsual::Draw(DrawPoint drawPt) 0, 0, 3, 2, 0, 0, 1, 3, 0, 3, 1, 3, 2, 0, 0, 1, 0, 0, 1, 3, 2, 0, 1, 1, 0, 0, 2, 1, 0, 1, 0, 2, 2, 0, 0, 2, 2, 0, 1, 0, 3, 1, 2, 0, 1, 2, 2, 0, 0, 0, 3, 0, 2, 0, 3, 0, 3, 0, 1, 1, 0, 3, 0}; const unsigned short animpos = - GAMECLIENT.GetGlobalAnimation(63 * 12, 63 * 4 - i * 5, 1, 183 * i + GetX() * GetObjId() + GetY() * i); - LOADER.GetMapTexture(2160)->DrawFull(drawPt + PIG_POSITIONS[nation][i], COLOR_SHADOW); - LOADER.GetMapTexture(2112 + smallpig_animations[animpos / 12] * 12 + animpos % 12) + GAMECLIENT.getGlobalAnimation(63 * 12, 63 * 4 - i * 5, 1, 183 * i + getX() * getObjId() + getY() * i); + LOADER.getMapTexture(2160)->DrawFull(drawPt + PIG_POSITIONS[nation][i], COLOR_SHADOW); + LOADER.getMapTexture(2112 + smallpig_animations[animpos / 12] * 12 + animpos % 12) ->DrawFull(drawPt + PIG_POSITIONS[nation][i]); } @@ -224,7 +224,7 @@ void nobUsual::Draw(DrawPoint drawPt) dynamic_cast(worker)->MakePigSounds(); //-V522 } // Bei nubischen Bergwerken das Feuer vor dem Bergwerk zeichnen - else if(BuildingProperties::IsMine(bldType_) && worker && nation == Nation::Africans) + else if(BuildingProperties::isMine(bldType_) && worker && nation == Nation::Africans) { DrawPoint offset; switch(bldType_) @@ -235,7 +235,7 @@ void nobUsual::Draw(DrawPoint drawPt) case BuildingType::GoldMine: offset = NUBIAN_MINE_FIRE[3]; break; default: RTTR_Assert_Msg(false, "Not a mine"); } - LOADER.GetMapTexture(740 + GAMECLIENT.GetGlobalAnimation(8, 5, 2, GetObjId() + GetX() + GetY())) + LOADER.getMapTexture(740 + GAMECLIENT.getGlobalAnimation(8, 5, 2, getObjId() + getX() + getY())) ->DrawFull(drawPt + offset); } } @@ -255,7 +255,7 @@ void nobUsual::HandleEvent(const unsigned id) lastProductivities.front() = currentProductivity; // Add next event - productivity_ev = GetEvMgr().AddEvent(this, numProductivityGFs, 1); + productivity_ev = getEvMgr().AddEvent(this, numProductivityGFs, 1); } else { // Ware bestellen (falls noch Platz ist) und nicht an Betriebe, die stillgelegt wurden! @@ -268,7 +268,7 @@ void nobUsual::HandleEvent(const unsigned id) if(numWares[lastOrderedWare] + orderedWares[lastOrderedWare].size() < wareSpaces) { - Ware* w = world->GetPlayer(player).OrderWare(workDesc.waresNeeded[lastOrderedWare], *this); + Ware* w = world->getPlayer(player).OrderWare(workDesc.waresNeeded[lastOrderedWare], *this); if(w) RTTR_Assert(helpers::contains(orderedWares[lastOrderedWare], w)); } @@ -279,7 +279,7 @@ void nobUsual::HandleEvent(const unsigned id) } // Nach ner bestimmten Zeit dann nächste Ware holen - orderware_ev = GetEvMgr().AddEvent(this, 210); + orderware_ev = getEvMgr().AddEvent(this, 210); } } @@ -299,7 +299,7 @@ void nobUsual::AddWare(std::unique_ptr ware) } // Ware vernichten - world->GetPlayer(player).RemoveWare(*ware); + world->getPlayer(player).RemoveWare(*ware); // Arbeiter Bescheid sagen, dass es neue Waren gibt if(worker) @@ -342,7 +342,7 @@ void nobUsual::GotWorker(Job /*job*/, noFigure& worker) void nobUsual::WorkerLost() { // Check if worker is or was here (e.g. hunter could currently be outside) - if(HasWorker()) + if(hasWorker()) { // If we have a worker, we must be producing something RTTR_Assert(productivity_ev); @@ -350,14 +350,14 @@ void nobUsual::WorkerLost() OpenDoor(); } // Produktivitätsevent ggf. abmelden - GetEvMgr().RemoveEvent(productivity_ev); + getEvMgr().RemoveEvent(productivity_ev); // Waren-Bestell-Event abmelden - GetEvMgr().RemoveEvent(orderware_ev); + getEvMgr().RemoveEvent(orderware_ev); // neuen Arbeiter bestellen worker = nullptr; - world->GetPlayer(player).AddJobWanted(BLD_WORK_DESC[bldType_].job.value(), this); + world->getPlayer(player).AddJobWanted(BLD_WORK_DESC[bldType_].job.value(), this); } bool nobUsual::WaresAvailable() @@ -411,7 +411,7 @@ void nobUsual::ConsumeWares() numWaresNeeded = 1; } - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); for(unsigned i = 0; i < numWaresNeeded; i++) { RTTR_Assert(numWares[wareIdxToUse] != 0); @@ -423,7 +423,7 @@ void nobUsual::ConsumeWares() // try to get ware from warehouses if(numWares[wareIdxToUse] < 2) { - Ware* w = world->GetPlayer(player).OrderWare(workDesc.waresNeeded[wareIdxToUse], *this); + Ware* w = world->getPlayer(player).OrderWare(workDesc.waresNeeded[wareIdxToUse], *this); if(w) RTTR_Assert(helpers::contains(orderedWares[wareIdxToUse], w)); } @@ -490,7 +490,7 @@ bool nobUsual::AreThereAnyOrderedWares() const void nobUsual::WorkerArrived() { - productivity_ev = GetEvMgr().AddEvent(this, numProductivityGFs, 1); + productivity_ev = getEvMgr().AddEvent(this, numProductivityGFs, 1); } void nobUsual::SetProductionEnabled(const bool enabled) @@ -500,7 +500,7 @@ void nobUsual::SetProductionEnabled(const bool enabled) // Umstellen disableProduction = !enabled; // Wenn das von einem fremden Spieler umgestellt wurde (oder vom Replay), muss auch das visuelle umgestellt werden - if(GAMECLIENT.GetPlayerId() != player || GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.getPlayerId() != player || GAMECLIENT.isReplayModeOn()) disableProductionVirtual = disableProduction; if(disableProduction) @@ -517,20 +517,20 @@ void nobUsual::SetProductionEnabled(const bool enabled) } } -bool nobUsual::HasWorker() const +bool nobUsual::hasWorker() const { - return worker && worker->GetState() != nofBuildingWorker::State::FigureWork; + return worker && worker->getState() != nofBuildingWorker::State::FigureWork; } -unsigned short nobUsual::GetProductivity() const +unsigned short nobUsual::getProductivity() const { - if(!BuildingProperties::IsMine(bldType_) - || GetMineResourceBehavior(world->GetGGS(), bldType_) != MineResourceBehavior::S4LikeExhaustion) + if(!BuildingProperties::isMine(bldType_) + || getMineResourceBehavior(world->getGGS(), bldType_) != MineResourceBehavior::S4LikeExhaustion) return productivity; - const unsigned resourceAmount = GetRemainingMineResources(*world, pos, GetMineResourceType(bldType_)); + const unsigned resourceAmount = getRemainingMineResources(*world, pos, getMineResourceType(bldType_)); return static_cast( - (static_cast(productivity) * GetS4LikeMineProductionChance(resourceAmount)) / 100u); + (static_cast(productivity) * getS4LikeMineProductionChance(resourceAmount)) / 100u); } void nobUsual::OnOutOfResources() @@ -543,24 +543,24 @@ void nobUsual::OnOutOfResources() std::fill(lastProductivities.begin(), lastProductivities.end(), 0); const char* error; - if(GetBuildingType() == BuildingType::Well) + if(getBuildingType() == BuildingType::Well) error = _("This well has dried out"); - else if(BuildingProperties::IsMine(GetBuildingType())) + else if(BuildingProperties::isMine(getBuildingType())) error = _("This mine is exhausted"); - else if(GetBuildingType() == BuildingType::Quarry) + else if(getBuildingType() == BuildingType::Quarry) error = _("No more stones in range"); - else if(GetBuildingType() == BuildingType::Fishery) + else if(getBuildingType() == BuildingType::Fishery) error = _("No more fish in range"); else return; SendPostMessage( - player, std::make_unique(GetEvMgr().GetCurrentGF(), error, PostCategory::Economy, *this)); - world->GetNotifications().publish(BuildingNote(BuildingNote::NoRessources, player, GetPos(), GetBuildingType())); + player, std::make_unique(getEvMgr().getCurrentGF(), error, PostCategory::Economy, *this)); + world->getNotifications().publish(BuildingNote(BuildingNote::NoRessources, player, getPos(), getBuildingType())); - if(GAMECLIENT.GetPlayerId() == player && world->GetGGS().isEnabled(AddonId::DEMOLISH_BLD_WO_RES)) + if(GAMECLIENT.getPlayerId() == player && world->getGGS().isEnabled(AddonId::DEMOLISH_BLD_WO_RES)) { - GAMECLIENT.DestroyBuilding(GetPos()); + GAMECLIENT.DestroyBuilding(getPos()); } } @@ -568,7 +568,7 @@ void nobUsual::StartNotWorking() { // If we haven't stopped working already, then this is the GF since we are not working anymore if(sinceNotWorking == isWorkingMarker) - sinceNotWorking = GetEvMgr().GetCurrentGF(); + sinceNotWorking = getEvMgr().getCurrentGF(); } void nobUsual::StopNotWorking() @@ -576,7 +576,7 @@ void nobUsual::StopNotWorking() // Record the number of GFs we haven't worked, if any if(sinceNotWorking != isWorkingMarker) { - numGfNotWorking += static_cast(GetEvMgr().GetCurrentGF() - sinceNotWorking); + numGfNotWorking += static_cast(getEvMgr().getCurrentGF() - sinceNotWorking); sinceNotWorking = isWorkingMarker; } } @@ -588,7 +588,7 @@ unsigned short nobUsual::CalcCurrentProductivity() // Possibly add the number of GFs we haven't worked until now if(sinceNotWorking != isWorkingMarker) { - const auto currentGF = GetEvMgr().GetCurrentGF(); + const auto currentGF = getEvMgr().getCurrentGF(); numGfNotWorking += static_cast(currentGF - sinceNotWorking); // Reset marker sinceNotWorking = currentGF; diff --git a/libs/s25main/buildings/nobUsual.h b/libs/s25main/buildings/nobUsual.h index adb25ecdc1..e5a6ebe985 100644 --- a/libs/s25main/buildings/nobUsual.h +++ b/libs/s25main/buildings/nobUsual.h @@ -61,12 +61,12 @@ class nobUsual : public noBuilding void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const override { return GO_Type::NobUsual; } - unsigned GetMilitaryRadius() const override { return 0; } + GO_Type getGOT() const override { return GO_Type::NobUsual; } + unsigned getMilitaryRadius() const override { return 0; } void Draw(DrawPoint drawPt) override; - bool HasWorker() const; + bool hasWorker() const; /// Event-Handler void HandleEvent(unsigned id) override; @@ -84,7 +84,7 @@ class nobUsual : public noBuilding void WorkerLost(); /// Gibt den Warenbestand (eingehende Waren - Rohstoffe) zurück - unsigned char GetNumWares(unsigned id) const { return numWares[id]; } + unsigned char getNumWares(unsigned id) const { return numWares[id]; } /// Prüft, ob Waren für einen Arbeitsschritt vorhanden sind bool WaresAvailable(); /// Verbraucht Waren @@ -99,17 +99,17 @@ class nobUsual : public noBuilding /// Bestellte Waren bool AreThereAnyOrderedWares() const; - unsigned short GetProductivity() const; - const nofBuildingWorker* GetWorker() const { return worker; } + unsigned short getProductivity() const; + const nofBuildingWorker* getWorker() const { return worker; } /// Stoppt/Erlaubt Produktion (visuell) void ToggleProductionVirtual() { disableProductionVirtual = !disableProductionVirtual; } /// Stoppt/Erlaubt Produktion (real) void SetProductionEnabled(bool enabled); /// Fragt ab, ob Produktion ausgeschaltet ist (visuell) - bool IsProductionDisabledVirtual() const { return disableProductionVirtual; } + bool isProductionDisabledVirtual() const { return disableProductionVirtual; } /// Fragt ab, ob Produktion ausgeschaltet ist (real) - bool IsProductionDisabled() const { return disableProduction; } + bool isProductionDisabled() const { return disableProduction; } /// Called when there are no more resources void OnOutOfResources(); /// Fängt an NICHT zu arbeiten (wird gemessen fürs Ausrechnen der Produktivität) diff --git a/libs/s25main/controls/ctrlBaseColor.h b/libs/s25main/controls/ctrlBaseColor.h index 1347f7005b..7563d05555 100644 --- a/libs/s25main/controls/ctrlBaseColor.h +++ b/libs/s25main/controls/ctrlBaseColor.h @@ -10,8 +10,8 @@ class ctrlBaseColor public: ctrlBaseColor() : color_(0) {} ctrlBaseColor(unsigned color) : color_(color) {} - void SetColor(unsigned color) { color_ = color; } - unsigned GetColor() const { return color_; } + void setColor(unsigned color) { color_ = color; } + unsigned getColor() const { return color_; } protected: unsigned color_; diff --git a/libs/s25main/controls/ctrlBaseImage.cpp b/libs/s25main/controls/ctrlBaseImage.cpp index dc31e6db22..6df4512d30 100644 --- a/libs/s25main/controls/ctrlBaseImage.cpp +++ b/libs/s25main/controls/ctrlBaseImage.cpp @@ -13,11 +13,11 @@ void ctrlBaseImage::SwapImage(ctrlBaseImage& other) std::swap(img_, other.img_); } -Rect ctrlBaseImage::GetImageRect() const +Rect ctrlBaseImage::getImageRect() const { if(!img_) return Rect(); - return Rect(-img_->GetOrigin(), img_->GetSize()); + return Rect(-img_->getOrigin(), img_->getSize()); } void ctrlBaseImage::DrawImage(const Rect& dstArea) const @@ -31,7 +31,7 @@ void ctrlBaseImage::DrawImage(const Rect& dstArea, unsigned color) const return; auto dst = dstArea; - auto imageSize = img_->GetSize(); + auto imageSize = img_->getSize(); auto dstSize = dstArea.getSize(); Rect srcArea = Rect(DrawPoint::all(0), imageSize); diff --git a/libs/s25main/controls/ctrlBaseImage.h b/libs/s25main/controls/ctrlBaseImage.h index 29d1edfdf2..52e666aafb 100644 --- a/libs/s25main/controls/ctrlBaseImage.h +++ b/libs/s25main/controls/ctrlBaseImage.h @@ -15,15 +15,15 @@ class ctrlBaseImage public: ctrlBaseImage(ITexture* img = nullptr); - void SetImage(ITexture* image) { img_ = image; } - const ITexture* GetImage() const { return img_; } + void setImage(ITexture* image) { img_ = image; } + const ITexture* getImage() const { return img_; } /// Changes the color filter used for drawing - void SetModulationColor(unsigned modulationColor) { modulationColor_ = modulationColor; } - unsigned GetModulationColor() const { return modulationColor_; } + void setModulationColor(unsigned modulationColor) { modulationColor_ = modulationColor; } + unsigned getModulationColor() const { return modulationColor_; } /// Swap the images of those controls void SwapImage(ctrlBaseImage& other); - Rect GetImageRect() const; + Rect getImageRect() const; /// Draw the image on specified rectangular area. The image is centered inside dstArea and cropped to its size. void DrawImage(const Rect& dstArea) const; diff --git a/libs/s25main/controls/ctrlBaseText.h b/libs/s25main/controls/ctrlBaseText.h index 36725dd7a7..2ffa9285cf 100644 --- a/libs/s25main/controls/ctrlBaseText.h +++ b/libs/s25main/controls/ctrlBaseText.h @@ -14,12 +14,12 @@ class ctrlBaseText public: ctrlBaseText(std::string text, unsigned color, const glFont* font); - void SetText(const std::string& text); - const std::string& GetText() const { return text; } - void SetFont(glFont* font); - const glFont* GetFont() const { return font; } - void SetTextColor(unsigned color) { color_ = color; } - unsigned GetTextColor() const { return color_; } + void setText(const std::string& text); + const std::string& getText() const { return text; } + void setFont(glFont* font); + const glFont* getFont() const { return font; } + void setTextColor(unsigned color) { color_ = color; } + unsigned getTextColor() const { return color_; } protected: std::string text; diff --git a/libs/s25main/controls/ctrlBaseTooltip.cpp b/libs/s25main/controls/ctrlBaseTooltip.cpp index 9d75224741..23ead8f7ee 100644 --- a/libs/s25main/controls/ctrlBaseTooltip.cpp +++ b/libs/s25main/controls/ctrlBaseTooltip.cpp @@ -10,10 +10,10 @@ ctrlBaseTooltip::~ctrlBaseTooltip() HideTooltip(); } -void ctrlBaseTooltip::SetTooltip(const std::string& tooltip) +void ctrlBaseTooltip::setTooltip(const std::string& tooltip) { tooltip_ = tooltip; - WINDOWMANAGER.SetToolTip(this, tooltip_, true); + WINDOWMANAGER.setToolTip(this, tooltip_, true); } void ctrlBaseTooltip::SwapTooltip(ctrlBaseTooltip& other) @@ -28,10 +28,10 @@ void ctrlBaseTooltip::ShowTooltip() const void ctrlBaseTooltip::ShowTooltip(const std::string& tooltip) const { - WINDOWMANAGER.SetToolTip(this, tooltip); + WINDOWMANAGER.setToolTip(this, tooltip); } void ctrlBaseTooltip::HideTooltip() const { - WINDOWMANAGER.SetToolTip(this, ""); + WINDOWMANAGER.setToolTip(this, ""); } diff --git a/libs/s25main/controls/ctrlBaseTooltip.h b/libs/s25main/controls/ctrlBaseTooltip.h index 23330bcd51..0401d02b0c 100644 --- a/libs/s25main/controls/ctrlBaseTooltip.h +++ b/libs/s25main/controls/ctrlBaseTooltip.h @@ -15,8 +15,8 @@ class ctrlBaseTooltip virtual ~ctrlBaseTooltip(); /// Set the text to be shown, updates the tooltip if currently shown - void SetTooltip(const std::string& tooltip); - const std::string& GetTooltip() const { return tooltip_; } + void setTooltip(const std::string& tooltip); + const std::string& getTooltip() const { return tooltip_; } /// Swap the tooltips of those controls void SwapTooltip(ctrlBaseTooltip& other); diff --git a/libs/s25main/controls/ctrlBaseVarText.cpp b/libs/s25main/controls/ctrlBaseVarText.cpp index 1f15d4126a..0968ee8361 100644 --- a/libs/s25main/controls/ctrlBaseVarText.cpp +++ b/libs/s25main/controls/ctrlBaseVarText.cpp @@ -14,7 +14,7 @@ ctrlBaseVarText::ctrlBaseVarText(const std::string& fmtString, const unsigned co vars.push_back(va_arg(fmtArgs, void*)); } -std::string ctrlBaseVarText::GetFormatedText() const +std::string ctrlBaseVarText::getFormatedText() const { std::stringstream str; diff --git a/libs/s25main/controls/ctrlBaseVarText.h b/libs/s25main/controls/ctrlBaseVarText.h index 8910c592f0..0359f3b8f9 100644 --- a/libs/s25main/controls/ctrlBaseVarText.h +++ b/libs/s25main/controls/ctrlBaseVarText.h @@ -21,7 +21,7 @@ class ctrlBaseVarText : public ctrlBaseText protected: /// Returns the text with placeholders replaced by the actual vars - std::string GetFormatedText() const; + std::string getFormatedText() const; private: std::vector vars; diff --git a/libs/s25main/controls/ctrlBuildingIcon.cpp b/libs/s25main/controls/ctrlBuildingIcon.cpp index 26d3413e9d..7101901581 100644 --- a/libs/s25main/controls/ctrlBuildingIcon.cpp +++ b/libs/s25main/controls/ctrlBuildingIcon.cpp @@ -22,10 +22,10 @@ ctrlBuildingIcon::ctrlBuildingIcon(Window* const parent, const unsigned id, cons void ctrlBuildingIcon::Draw_() { if(state == ButtonState::Hover || state == ButtonState::Pressed) - LOADER.GetImageN("io", 0)->DrawPart(GetDrawRect()); - glArchivItem_Bitmap* image = LOADER.GetNationIcon(nation, type); + LOADER.getImageN("io", 0)->DrawPart(getDrawRect()); + glArchivItem_Bitmap* image = LOADER.getNationIcon(nation, type); if(image) - image->DrawFull(GetDrawPos() + GetSize() / 2, (state == ButtonState::Pressed ? COLOR_YELLOW : COLOR_WHITE)); + image->DrawFull(getDrawPos() + getSize() / 2, (state == ButtonState::Pressed ? COLOR_YELLOW : COLOR_WHITE)); } void ctrlBuildingIcon::DrawContent() const {} diff --git a/libs/s25main/controls/ctrlBuildingIcon.h b/libs/s25main/controls/ctrlBuildingIcon.h index 9ee0d67ec2..3e5815d871 100644 --- a/libs/s25main/controls/ctrlBuildingIcon.h +++ b/libs/s25main/controls/ctrlBuildingIcon.h @@ -16,10 +16,10 @@ class ctrlBuildingIcon : public ctrlButton ctrlBuildingIcon(Window* parent, unsigned id, const DrawPoint& pos, BuildingType type, Nation nation, unsigned short size = 36, const std::string& tooltip = ""); /// liefert den GebäudeTyp des Icons. - BuildingType GetType() const { return type; } + BuildingType getType() const { return type; } /// Set callback for hover-state changes (called with true when hovered, false when not) - void SetOnHoverChanged(std::function cb) { onHoverChanged_ = std::move(cb); } + void setOnHoverChanged(std::function cb) { onHoverChanged_ = std::move(cb); } protected: /// zeichnet das Fenster. diff --git a/libs/s25main/controls/ctrlButton.cpp b/libs/s25main/controls/ctrlButton.cpp index e46ea645ad..ce06921e49 100644 --- a/libs/s25main/controls/ctrlButton.cpp +++ b/libs/s25main/controls/ctrlButton.cpp @@ -15,24 +15,24 @@ ctrlButton::ctrlButton(Window* parent, unsigned id, const DrawPoint& pos, const ctrlButton::~ctrlButton() = default; -void ctrlButton::SetEnabled(bool enable /*= true*/) +void ctrlButton::setEnabled(bool enable /*= true*/) { isEnabled = enable; state = ButtonState::Up; } -void ctrlButton::SetActive(bool activate) +void ctrlButton::setActive(bool activate) { - Window::SetActive(activate); + Window::setActive(activate); if(!activate) state = ButtonState::Up; - else if(IsMouseOver()) + else if(isMouseOver()) state = ButtonState::Hover; } bool ctrlButton::msgMouseMove(const MouseCoords& mc) { - if(isEnabled && IsMouseOver(mc)) + if(isEnabled && isMouseOver(mc)) { if(state != ButtonState::Pressed) state = ButtonState::Hover; @@ -49,7 +49,7 @@ bool ctrlButton::msgMouseMove(const MouseCoords& mc) bool ctrlButton::msgLeftDown(const MouseCoords& mc) { - if(isEnabled && IsMouseOver(mc)) + if(isEnabled && isMouseOver(mc)) { state = ButtonState::Pressed; return true; @@ -62,10 +62,10 @@ bool ctrlButton::msgLeftUp(const MouseCoords& mc) { if(state == ButtonState::Pressed) { - if(isEnabled && IsMouseOver(mc)) + if(isEnabled && isMouseOver(mc)) { state = ButtonState::Hover; - GetParent()->msgButtonClick(GetID()); + getParent()->msgButtonClick(getID()); return true; } else state = ButtonState::Up; @@ -79,7 +79,7 @@ bool ctrlButton::msgLeftUp(const MouseCoords& mc) */ void ctrlButton::Draw_() { - if(GetSize().x == 0 || GetSize().y == 0) + if(getSize().x == 0 || getSize().y == 0) return; if(tc != TextureColor::Invisible) @@ -89,9 +89,9 @@ void ctrlButton::Draw_() bool isElevated = !isChecked && state != ButtonState::Pressed; bool isHighlighted = isEnabled && !isChecked && state == ButtonState::Hover; if(hasBorder) - Draw3D(GetDrawRect(), tc, isElevated, isHighlighted, isCurIlluminated, color); + Draw3D(getDrawRect(), tc, isElevated, isHighlighted, isCurIlluminated, color); else - Draw3DContent(GetDrawRect(), tc, isElevated, isHighlighted, isCurIlluminated, color); + Draw3DContent(getDrawRect(), tc, isElevated, isHighlighted, isCurIlluminated, color); } /// Inhalt malen (Text, Bilder usw.) diff --git a/libs/s25main/controls/ctrlButton.h b/libs/s25main/controls/ctrlButton.h index 9754a976f2..07da6b8f60 100644 --- a/libs/s25main/controls/ctrlButton.h +++ b/libs/s25main/controls/ctrlButton.h @@ -20,17 +20,17 @@ class ctrlButton : public Window, public ctrlBaseTooltip const std::string& tooltip); ~ctrlButton() override; - void SetEnabled(bool enable = true); - bool GetEnabled() const { return isEnabled; } - TextureColor GetTexture() const { return tc; } - void SetTexture(TextureColor tc) { this->tc = tc; } - void SetActive(bool activate = true) override; - - void SetChecked(bool checked) { this->isChecked = checked; } - bool GetCheck() const { return isChecked; } - void SetIlluminated(bool illuminated) { this->isIlluminated = illuminated; } - bool GetIlluminated() const { return isIlluminated; } - void SetBorder(bool hasBorder) { this->hasBorder = hasBorder; } + void setEnabled(bool enable = true); + bool getEnabled() const { return isEnabled; } + TextureColor getTexture() const { return tc; } + void setTexture(TextureColor tc) { this->tc = tc; } + void setActive(bool activate = true) override; + + void setChecked(bool checked) { this->isChecked = checked; } + bool getCheck() const { return isChecked; } + void setIlluminated(bool illuminated) { this->isIlluminated = illuminated; } + bool getIlluminated() const { return isIlluminated; } + void setBorder(bool hasBorder) { this->hasBorder = hasBorder; } bool msgMouseMove(const MouseCoords& mc) override; bool msgLeftDown(const MouseCoords& mc) override; diff --git a/libs/s25main/controls/ctrlChat.cpp b/libs/s25main/controls/ctrlChat.cpp index 5989b43a2d..c7105cd6a9 100644 --- a/libs/s25main/controls/ctrlChat.cpp +++ b/libs/s25main/controls/ctrlChat.cpp @@ -48,18 +48,18 @@ ctrlChat::~ctrlChat() = default; */ void ctrlChat::Resize(const Extent& newSize) { - const bool x_changed = (GetSize().x != newSize.x && !chat_lines.empty()); + const bool x_changed = (getSize().x != newSize.x && !chat_lines.empty()); Window::Resize(newSize); - auto* scroll = GetCtrl(0); - scroll->SetPos(DrawPoint(newSize.x - SCROLLBAR_WIDTH, 0)); + auto* scroll = getCtrl(0); + scroll->setPos(DrawPoint(newSize.x - SCROLLBAR_WIDTH, 0)); scroll->Resize(Extent(SCROLLBAR_WIDTH, newSize.y)); // Remember some things - const bool was_on_bottom = (scroll->GetScrollPos() + page_size == chat_lines.size()); + const bool was_on_bottom = (scroll->getScrollPos() + page_size == chat_lines.size()); unsigned short position = 0; // Remember the entry on top - for(unsigned short i = 1; i <= scroll->GetScrollPos(); ++i) + for(unsigned short i = 1; i <= scroll->getScrollPos(); ++i) if(holds_alternative(chat_lines[i])) ++position; @@ -74,27 +74,27 @@ void ctrlChat::Resize(const Extent& newSize) // Zeilen pro Seite festlegen errechnen page_size = (newSize.y - 4) / (font->getHeight() + 2); - scroll->SetPageSize(page_size); + scroll->setPageSize(page_size); // If we are were on the last line, keep if(was_on_bottom) { - scroll->SetScrollPos(((chat_lines.size() > page_size) ? chat_lines.size() - page_size : 0)); + scroll->setScrollPos(((chat_lines.size() > page_size) ? chat_lines.size() - page_size : 0)); } else if(x_changed) { unsigned short i; for(i = 0; position > 0; ++i) if(holds_alternative(chat_lines[i])) --position; - scroll->SetScrollPos(i); + scroll->setScrollPos(i); } // Don't display empty lines at the end if there are this is // not necessary because of a lack of lines in total if(chat_lines.size() < page_size) - scroll->SetScrollPos(0); - else if(scroll->GetScrollPos() + page_size > chat_lines.size()) - scroll->SetScrollPos(chat_lines.size() - page_size); + scroll->setScrollPos(0); + else if(scroll->getScrollPos() + page_size > chat_lines.size()) + scroll->setScrollPos(chat_lines.size() - page_size); } /** @@ -103,7 +103,7 @@ void ctrlChat::Resize(const Extent& newSize) void ctrlChat::Draw_() { // Box malen - Draw3D(Rect(GetDrawPos(), GetSize()), tc, false); + Draw3D(Rect(getDrawPos(), getSize()), tc, false); Window::Draw_(); @@ -112,8 +112,8 @@ void ctrlChat::Draw_() // Listeneinträge zeichnen // Add margin - DrawPoint textPos = GetDrawPos() + DrawPoint(2, 2); - unsigned pos = GetCtrl(0)->GetScrollPos(); + DrawPoint textPos = getDrawPos() + DrawPoint(2, 2); + unsigned pos = getCtrl(0)->getScrollPos(); for(unsigned i = 0; i < show_lines; ++i) { DrawPoint curTextPos = textPos; @@ -158,7 +158,7 @@ void ctrlChat::WrapLine(unsigned short i) + (!line.player.empty() ? (bracket1_size + bracket2_size + font->getWidth(line.player)) : 0); // Reicht die Breite des Textfeldes noch nichtmal dafür aus? - if(prefix_width > GetSize().x - 2 - SCROLLBAR_WIDTH) + if(prefix_width > getSize().x - 2 - SCROLLBAR_WIDTH) { // dann können wir das gleich vergessen return; @@ -166,7 +166,7 @@ void ctrlChat::WrapLine(unsigned short i) // Zeilen ggf. wrappen, falls der Platz nich reicht und die Zeilenanfanänge in wi speichern glFont::WrapInfo wi = - font->GetWrapInfo(line.msg, GetSize().x - prefix_width - 2 - SCROLLBAR_WIDTH, GetSize().x - 2 - SCROLLBAR_WIDTH); + font->getWrapInfo(line.msg, getSize().x - prefix_width - 2 - SCROLLBAR_WIDTH, getSize().x - 2 - SCROLLBAR_WIDTH); // Message-Strings erzeugen aus den WrapInfo std::vector strings = wi.CreateSingleStrings(line.msg); @@ -210,12 +210,12 @@ void ctrlChat::AddMessage(const std::string& time_string, const std::string& pla WrapLine(raw_chat_lines.size() - 1); // Scrollbar Bescheid sagen - auto* scrollbar = GetCtrl(0); - scrollbar->SetRange(unsigned(chat_lines.size())); + auto* scrollbar = getCtrl(0); + scrollbar->setRange(unsigned(chat_lines.size())); // Waren wir am Ende? Dann mit runterscrollen - if(scrollbar->GetScrollPos() + page_size == oldlength) - scrollbar->SetScrollPos(chat_lines.size() - page_size); + if(scrollbar->getScrollPos() + page_size == oldlength) + scrollbar->setScrollPos(chat_lines.size() - page_size); } bool ctrlChat::msgMouseMove(const MouseCoords& mc) @@ -235,9 +235,9 @@ bool ctrlChat::msgLeftUp(const MouseCoords& mc) bool ctrlChat::msgWheelUp(const MouseCoords& mc) { - if(IsPointInRect(mc.pos, Rect(GetDrawPos() + DrawPoint(2, 2), GetSize() - Extent(2, 4)))) + if(IsPointInRect(mc.pos, Rect(getDrawPos() + DrawPoint(2, 2), getSize() - Extent(2, 4)))) { - auto* scrollbar = GetCtrl(0); + auto* scrollbar = getCtrl(0); scrollbar->Scroll(-3); return true; } else @@ -246,9 +246,9 @@ bool ctrlChat::msgWheelUp(const MouseCoords& mc) bool ctrlChat::msgWheelDown(const MouseCoords& mc) { - if(IsPointInRect(mc.pos, Rect(GetDrawPos() + DrawPoint(2, 2), GetSize() - Extent(2, 4)))) + if(IsPointInRect(mc.pos, Rect(getDrawPos() + DrawPoint(2, 2), getSize() - Extent(2, 4)))) { - auto* scrollbar = GetCtrl(0); + auto* scrollbar = getCtrl(0); scrollbar->Scroll(+3); return true; } else diff --git a/libs/s25main/controls/ctrlChat.h b/libs/s25main/controls/ctrlChat.h index 9c4919b9fc..c57f395f23 100644 --- a/libs/s25main/controls/ctrlChat.h +++ b/libs/s25main/controls/ctrlChat.h @@ -24,7 +24,7 @@ class ctrlChat : public Window void AddMessage(const std::string& time_string, const std::string& player, unsigned player_color, const std::string& msg, unsigned msg_color); /// Setzt Farbe der Zeitangaben. - void SetTimeColor(unsigned color) { time_color = color; } + void setTimeColor(unsigned color) { time_color = color; } bool msgMouseMove(const MouseCoords& mc) override; bool msgLeftDown(const MouseCoords& mc) override; diff --git a/libs/s25main/controls/ctrlCheck.cpp b/libs/s25main/controls/ctrlCheck.cpp index 4abc0bc337..887d2a9d6a 100644 --- a/libs/s25main/controls/ctrlCheck.cpp +++ b/libs/s25main/controls/ctrlCheck.cpp @@ -19,10 +19,10 @@ ctrlCheck::ctrlCheck(Window* parent, unsigned id, const DrawPoint& pos, const Ex bool ctrlCheck::msgLeftDown(const MouseCoords& mc) { - if(!readonly && IsPointInRect(mc.pos, GetDrawRect())) + if(!readonly && IsPointInRect(mc.pos, getDrawRect())) { check = !check; - GetParent()->msgCheckboxChange(GetID(), check); + getParent()->msgCheckboxChange(getID(), check); return true; } @@ -31,7 +31,7 @@ bool ctrlCheck::msgLeftDown(const MouseCoords& mc) bool ctrlCheck::msgMouseMove(const MouseCoords& mc) { - if(IsMouseOver(mc.pos)) + if(isMouseOver(mc.pos)) { ShowTooltip(); return true; @@ -45,16 +45,16 @@ bool ctrlCheck::msgMouseMove(const MouseCoords& mc) void ctrlCheck::Draw_() { const unsigned short boxSize = 20; - short spacing = (GetSize().y - boxSize) / 2; + short spacing = (getSize().y - boxSize) / 2; if(spacing < 0) spacing = 0; - Rect drawRect = GetDrawRect(); + Rect drawRect = getDrawRect(); const bool drawText = font && !text.empty(); if(!drawText) { // If we draw only the check mark, draw surrounding box smaller and center checkbox drawRect.setSize(Extent(boxSize + 2 * spacing, drawRect.getSize().y)); - drawRect.move(DrawPoint((GetSize().x - drawRect.getSize().x) / 2, 0)); + drawRect.move(DrawPoint((getSize().x - drawRect.getSize().x) / 2, 0)); } short boxStartOffsetX = drawRect.getSize().x - spacing - boxSize; if(boxStartOffsetX < 0) @@ -67,7 +67,7 @@ void ctrlCheck::Draw_() int availableWidth = boxStartOffsetX - 4; if(availableWidth < 0) availableWidth = 0; - font->Draw(drawRect.getOrigin() + DrawPoint(4, GetSize().y / 2), text, FontStyle::VCENTER, + font->Draw(drawRect.getOrigin() + DrawPoint(4, getSize().y / 2), text, FontStyle::VCENTER, (check ? COLOR_YELLOW : 0xFFBBBBBB), availableWidth); } @@ -77,5 +77,5 @@ void ctrlCheck::Draw_() Draw3D(Rect(boxPos, Extent::all(boxSize)), tc, false); if(check) - LOADER.GetImageN("io", 32)->DrawFull(boxPos + DrawPoint(boxSize, boxSize) / 2); + LOADER.getImageN("io", 32)->DrawFull(boxPos + DrawPoint(boxSize, boxSize) / 2); } diff --git a/libs/s25main/controls/ctrlColorButton.cpp b/libs/s25main/controls/ctrlColorButton.cpp index bafe81802b..e115081329 100644 --- a/libs/s25main/controls/ctrlColorButton.cpp +++ b/libs/s25main/controls/ctrlColorButton.cpp @@ -11,6 +11,6 @@ ctrlColorButton::ctrlColorButton(Window* parent, unsigned id, const DrawPoint& p void ctrlColorButton::DrawContent() const { - Extent rectSize = GetSize() - Extent(6, 6); - DrawRectangle(Rect(GetDrawPos() + DrawPoint(3, 3), rectSize), color_); + Extent rectSize = getSize() - Extent(6, 6); + DrawRectangle(Rect(getDrawPos() + DrawPoint(3, 3), rectSize), color_); } diff --git a/libs/s25main/controls/ctrlColorDeepening.cpp b/libs/s25main/controls/ctrlColorDeepening.cpp index 70efff406a..dc67202bf3 100644 --- a/libs/s25main/controls/ctrlColorDeepening.cpp +++ b/libs/s25main/controls/ctrlColorDeepening.cpp @@ -11,5 +11,5 @@ ctrlColorDeepening::ctrlColorDeepening(Window* parent, unsigned id, DrawPoint po void ctrlColorDeepening::DrawContent() const { - DrawRectangle(Rect(GetDrawPos() + DrawPoint(3, 3), GetSize() - Extent(6, 6)), color_); + DrawRectangle(Rect(getDrawPos() + DrawPoint(3, 3), getSize() - Extent(6, 6)), color_); } diff --git a/libs/s25main/controls/ctrlComboBox.cpp b/libs/s25main/controls/ctrlComboBox.cpp index 98b666a3b9..06d44e9a7e 100644 --- a/libs/s25main/controls/ctrlComboBox.cpp +++ b/libs/s25main/controls/ctrlComboBox.cpp @@ -17,10 +17,10 @@ ctrlComboBox::ctrlComboBox(Window* parent, unsigned id, const DrawPoint& pos, co : Window(parent, id, pos, size), tc(tc), font(font), max_list_height(max_list_height), readonly(readonly), suppressSelectEvent(false) { - AddList(0, DrawPoint(0, size.y), Extent(size.x, 4), tc, font)->SetVisible(false); + AddList(0, DrawPoint(0, size.y), Extent(size.x, 4), tc, font)->setVisible(false); if(!readonly) - AddImageButton(1, DrawPoint(size.x - size.y, 0), Extent(size.y, size.y), tc, LOADER.GetImageN("io", 34)); + AddImageButton(1, DrawPoint(size.x - size.y, 0), Extent(size.y, size.y), tc, LOADER.getImageN("io", 34)); Resize(size); } @@ -29,19 +29,19 @@ void ctrlComboBox::Resize(const Extent& newSize) { Window::Resize(newSize); - auto* button = GetCtrl(1); + auto* button = getCtrl(1); if(button) { - button->SetPos(DrawPoint(newSize.x - newSize.y, 0)); + button->setPos(DrawPoint(newSize.x - newSize.y, 0)); button->Resize(Extent(newSize.y, newSize.y)); } - auto* list = GetCtrl(0); + auto* list = getCtrl(0); Extent listSize(newSize.x, 4); // Langsam die Höhe der maximalen annähern - for(unsigned i = 0; i < list->GetNumLines(); ++i) + for(unsigned i = 0; i < list->getNumLines(); ++i) { // zu große geworden? listSize.y += font->getHeight(); @@ -59,15 +59,15 @@ void ctrlComboBox::Resize(const Extent& newSize) } } - list->SetPos(DrawPoint(0, newSize.y)); + list->setPos(DrawPoint(0, newSize.y)); list->Resize(listSize); } -std::optional ctrlComboBox::GetSelectedText() const +std::optional ctrlComboBox::getSelectedText() const { - const std::optional& selection = GetSelection(); + const std::optional& selection = getSelection(); if(selection) - return GetText(*selection); + return getText(*selection); else return std::nullopt; } @@ -80,20 +80,20 @@ bool ctrlComboBox::msgMouseMove(const MouseCoords& mc) bool ctrlComboBox::msgLeftDown(const MouseCoords& mc) { - auto* list = GetCtrl(0); + auto* list = getCtrl(0); // Irgendwo anders hingeklickt --> Liste ausblenden - if(!readonly && !IsPointInRect(mc.pos, GetFullDrawRect(list))) + if(!readonly && !IsPointInRect(mc.pos, getFullDrawRect(list))) { // Liste wieder ausblenden ShowList(false); return false; } - if(!readonly && IsPointInRect(mc.pos, GetDrawRect())) + if(!readonly && IsPointInRect(mc.pos, getDrawRect())) { // Liste wieder ein/ausblenden - ShowList(!list->IsVisible()); + ShowList(!list->isVisible()); return true; } @@ -109,13 +109,13 @@ bool ctrlComboBox::msgLeftUp(const MouseCoords& mc) bool ctrlComboBox::msgRightDown(const MouseCoords& mc) { - auto* list = GetCtrl(0); + auto* list = getCtrl(0); // Für Button und Liste weiterleiten (und danach erst schließen) bool ret = RelayMouseMessage(&Window::msgRightDown, mc); // Clicked on list -> close it - if(!readonly && IsPointInRect(mc.pos, list->GetDrawRect())) + if(!readonly && IsPointInRect(mc.pos, list->getDrawRect())) { // Liste wieder ausblenden ShowList(false); @@ -129,15 +129,15 @@ bool ctrlComboBox::msgWheelUp(const MouseCoords& mc) if(readonly) return false; - auto* list = GetCtrl(0); - if(list->IsVisible() && IsPointInRect(mc.pos, list->GetDrawRect())) + auto* list = getCtrl(0); + if(list->isVisible() && IsPointInRect(mc.pos, list->getDrawRect())) return RelayMouseMessage(&Window::msgWheelUp, mc); - if(IsPointInRect(mc.pos, GetDrawRect())) + if(IsPointInRect(mc.pos, getDrawRect())) { // Don't scroll too far down - if(list->GetSelection().value_or(0u) > 0u) - list->SetSelection(*list->GetSelection() - 1u); + if(list->getSelection().value_or(0u) > 0u) + list->setSelection(*list->getSelection() - 1u); return true; } @@ -149,28 +149,28 @@ bool ctrlComboBox::msgWheelDown(const MouseCoords& mc) if(readonly) return false; - auto* list = GetCtrl(0); + auto* list = getCtrl(0); - if(list->IsVisible() && IsPointInRect(mc.pos, list->GetDrawRect())) + if(list->isVisible() && IsPointInRect(mc.pos, list->getDrawRect())) { // Scrolled in opened list -> return RelayMouseMessage(&Window::msgWheelDown, mc); } - if(IsPointInRect(mc.pos, GetDrawRect())) + if(IsPointInRect(mc.pos, getDrawRect())) { // Will be ignored by the list if to high - list->SetSelection(list->GetSelection() ? *list->GetSelection() + 1u : 0u); + list->setSelection(list->getSelection() ? *list->getSelection() + 1u : 0u); return true; } return false; } -Rect ctrlComboBox::GetFullDrawRect(const ctrlList* list) +Rect ctrlComboBox::getFullDrawRect(const ctrlList* list) { - Rect myRect = GetDrawRect(); - myRect.bottom = list->GetDrawRect().bottom; + Rect myRect = getDrawRect(); + myRect.bottom = list->getDrawRect().bottom; return myRect; } @@ -183,45 +183,45 @@ void ctrlComboBox::msgListSelectItem(unsigned, const int selection) if(selection >= 0 && !suppressSelectEvent) { // Nachricht an übergeordnetes Fenster verschicken - GetParent()->msgComboSelectItem(GetID(), selection); + getParent()->msgComboSelectItem(getID(), selection); } } void ctrlComboBox::AddItem(const std::string& text) { - GetCtrl(0)->AddItem(text); - Resize(GetSize()); + getCtrl(0)->AddItem(text); + Resize(getSize()); } void ctrlComboBox::DeleteAllItems() { - GetCtrl(0)->DeleteAllItems(); - Resize(GetSize()); + getCtrl(0)->DeleteAllItems(); + Resize(getSize()); } -void ctrlComboBox::SetSelection(unsigned selection) +void ctrlComboBox::setSelection(unsigned selection) { // Avoid sending the change method when this is invoked intentionally suppressSelectEvent = true; - GetCtrl(0)->SetSelection(selection); + getCtrl(0)->setSelection(selection); suppressSelectEvent = false; } void ctrlComboBox::Draw_() { - auto* liste = GetCtrl(0); + auto* liste = getCtrl(0); - Draw3D(Rect(GetDrawPos(), GetSize()), tc, false); + Draw3D(Rect(getDrawPos(), getSize()), tc, false); // Show selected item in the box - if(liste->GetNumLines() > 0) + if(liste->getNumLines() > 0) { - font->Draw(GetDrawPos() + DrawPoint(2, GetSize().y / 2), liste->GetSelItemText(), FontStyle::VCENTER, - COLOR_YELLOW, GetSize().x - 2 - GetSize().y, ""); + font->Draw(getDrawPos() + DrawPoint(2, getSize().y / 2), liste->getSelItemText(), FontStyle::VCENTER, + COLOR_YELLOW, getSize().x - 2 - getSize().y, ""); } // Draw button manually as we can't use DrawControls which would draw the list we do in Msg_PaintAfter - auto* button = GetCtrl(1); + auto* button = getCtrl(1); if(button) button->Draw(); } @@ -229,26 +229,26 @@ void ctrlComboBox::Draw_() void ctrlComboBox::msgPaintAfter() { // Draw list now so it is on top of everything - GetCtrl(0)->Draw(); + getCtrl(0)->Draw(); Window::msgPaintAfter(); } void ctrlComboBox::ShowList(bool show) { - auto* list = GetCtrl(0); - if(list->IsVisible() == show) + auto* list = getCtrl(0); + if(list->isVisible() == show) return; // list field - list->SetVisible(show); + list->setVisible(show); // Arrow button - GetCtrl(1)->SetChecked(show); + getCtrl(1)->setChecked(show); // Lock/unlock region of extended list if(show) - GetParent()->LockRegion(this, list->GetDrawRect()); + getParent()->LockRegion(this, list->getDrawRect()); else - GetParent()->FreeRegion(this); + getParent()->FreeRegion(this); - LOADER.GetSoundN("sound", 113)->Play(255, false); + LOADER.getSoundN("sound", 113)->Play(255, false); } diff --git a/libs/s25main/controls/ctrlComboBox.h b/libs/s25main/controls/ctrlComboBox.h index 63862132df..c30a6741b3 100644 --- a/libs/s25main/controls/ctrlComboBox.h +++ b/libs/s25main/controls/ctrlComboBox.h @@ -22,12 +22,12 @@ class ctrlComboBox final : public Window void AddItem(const std::string& text); void DeleteAllItems(); /// Set selection to an item if within bounds. Does not trigger a notification. - void SetSelection(unsigned selection); - const std::optional& GetSelection() const { return GetCtrl(0)->GetSelection(); }; - unsigned GetNumItems() const { return GetCtrl(0)->GetNumLines(); } - const std::string& GetText(unsigned item) const { return GetCtrl(0)->GetItemText(item); } - void SetText(unsigned item, const std::string& text) { GetCtrl(0)->SetItemText(item, text); } - std::optional GetSelectedText() const; + void setSelection(unsigned selection); + const std::optional& getSelection() const { return getCtrl(0)->getSelection(); }; + unsigned getNumItems() const { return getCtrl(0)->getNumLines(); } + const std::string& getText(unsigned item) const { return getCtrl(0)->getItemText(item); } + void setText(unsigned item, const std::string& text) { getCtrl(0)->setItemText(item, text); } + std::optional getSelectedText() const; void msgPaintAfter() override; bool msgMouseMove(const MouseCoords& mc) override; @@ -43,7 +43,7 @@ class ctrlComboBox final : public Window void Draw_() override; /// Show or hide the list. void ShowList(bool show); - Rect GetFullDrawRect(const ctrlList* list); + Rect getFullDrawRect(const ctrlList* list); private: TextureColor tc; diff --git a/libs/s25main/controls/ctrlDeepening.cpp b/libs/s25main/controls/ctrlDeepening.cpp index e9eeec1700..3c70e8660c 100644 --- a/libs/s25main/controls/ctrlDeepening.cpp +++ b/libs/s25main/controls/ctrlDeepening.cpp @@ -13,6 +13,6 @@ ctrlDeepening::ctrlDeepening(Window* parent, unsigned id, DrawPoint pos, const E */ void ctrlDeepening::Draw_() { - Draw3D(Rect(GetDrawPos(), GetSize()), tc, false); + Draw3D(Rect(getDrawPos(), getSize()), tc, false); DrawContent(); } diff --git a/libs/s25main/controls/ctrlEdit.cpp b/libs/s25main/controls/ctrlEdit.cpp index 7b1a5255f1..1f3fec3d9d 100644 --- a/libs/s25main/controls/ctrlEdit.cpp +++ b/libs/s25main/controls/ctrlEdit.cpp @@ -33,7 +33,7 @@ ctrlEdit::ctrlEdit(Window* parent, unsigned id, const DrawPoint& pos, const Exte * * @param[in] text Der Text. */ -void ctrlEdit::SetText(const std::string& text) +void ctrlEdit::setText(const std::string& text) { text_ = s25util::utf8to32(text); if(editType_ == EditType::Number) @@ -49,21 +49,21 @@ void ctrlEdit::SetText(const std::string& text) Notify(); } -void ctrlEdit::SetText(const unsigned text) +void ctrlEdit::setText(const unsigned text) { - SetText(s25util::toStringClassic(text)); + setText(s25util::toStringClassic(text)); } -std::string ctrlEdit::GetText() const +std::string ctrlEdit::getText() const { return s25util::utf32to8(text_); } -GetFileNameResult ctrlEdit::GetFileName(const std::string& ext) const +GetFileNameResult ctrlEdit::getFileName(const std::string& ext) const { RTTR_Assert(editType_ == EditType::Filename); - std::string name = GetText(); + std::string name = getText(); const auto isSpace = [](char c) { return c == ' '; }; boost::algorithm::trim_left_if(name, isSpace); if(ext.empty()) @@ -77,18 +77,18 @@ GetFileNameResult ctrlEdit::GetFileName(const std::string& ext) const return {FileNameStatus::Valid, std::move(name)}; } -void ctrlEdit::SetFocus(bool focus) +void ctrlEdit::setFocus(bool focus) { if(focus_ != focus) { focus_ = focus; - txtCtrl->SetTextColor(focus_ ? 0xFFFFA000 : COLOR_YELLOW); - if(focus && GetParent()) + txtCtrl->setTextColor(focus_ ? 0xFFFFA000 : COLOR_YELLOW); + if(focus && getParent()) { - for(auto* edit : GetParent()->GetCtrls()) + for(auto* edit : getParent()->getCtrls()) { if(edit != this) - edit->SetFocus(false); + edit->setFocus(false); } } } @@ -108,13 +108,13 @@ void ctrlEdit::UpdateInternalText() viewStart_ = 0; cursorPos_ = 0; cursorOffsetX_ = 0; - txtCtrl->SetText(""); + txtCtrl->setText(""); } else { std::u32string dtext = (isPassword_) ? std::u32string(text_.size(), '*') : text_; viewStart_ = std::min(viewStart_, dtext.length() - 1); - const auto* font = txtCtrl->GetFont(); - const unsigned max_width = GetSize().x - ctrlTextDeepening::borderSize.x * 2; + const auto* font = txtCtrl->getFont(); + const unsigned max_width = getSize().x - ctrlTextDeepening::borderSize.x * 2; unsigned max; std::string curText = s25util::utf32to8(dtext.substr(viewStart_)); font->getWidth(curText, max_width, &max); @@ -143,7 +143,7 @@ void ctrlEdit::UpdateInternalText() cursorOffsetX_ = font->getWidth(s25util::utf32to8(dtext.substr(viewStart_, cursorPos_ - viewStart_))); else cursorOffsetX_ = 0; - txtCtrl->SetText(curText); + txtCtrl->setText(curText); } } @@ -172,12 +172,12 @@ void ctrlEdit::Draw_() { Window::Draw_(); // Alle 500ms Cursor für 500ms anzeigen - if(focus_ && !isDisabled_ && VIDEODRIVER.GetTickCount() % 1000 < 500) + if(focus_ && !isDisabled_ && VIDEODRIVER.getTickCount() % 1000 < 500) { - const auto fontHeight = txtCtrl->GetFont()->getHeight(); - DrawPoint cursorDrawPos = GetDrawPos(); + const auto fontHeight = txtCtrl->getFont()->getHeight(); + DrawPoint cursorDrawPos = getDrawPos(); cursorDrawPos.x += cursorOffsetX_ + ctrlTextDeepening::borderSize.x; - cursorDrawPos.y += (GetSize().y - (fontHeight + 2)) / 2; + cursorDrawPos.y += (getSize().y - (fontHeight + 2)) / 2; DrawRectangle(Rect(cursorDrawPos, Extent(1, fontHeight + 2)), 0xFFFFA000); } @@ -226,10 +226,10 @@ void ctrlEdit::RemoveChar() */ void ctrlEdit::Notify() { - if(!notify_ || !GetParent()) + if(!notify_ || !getParent()) return; - GetParent()->msgEditChange(GetID()); + getParent()->msgEditChange(getID()); } void ctrlEdit::Resize(const Extent& newSize) @@ -243,7 +243,7 @@ void ctrlEdit::Resize(const Extent& newSize) */ bool ctrlEdit::msgLeftDown(const MouseCoords& mc) { - SetFocus(IsPointInRect(mc.pos, GetDrawRect())); + setFocus(IsPointInRect(mc.pos, getDrawRect())); return false; // "Unhandled" so other edits can handle this too and set their focus accordingly } @@ -309,7 +309,7 @@ bool ctrlEdit::msgKeyDown(const KeyEvent& ke) break; case KeyType::Char: // Zeichen eingegeben - if(!isDisabled_ && txtCtrl->GetFont()->CharExist(ke.c)) + if(!isDisabled_ && txtCtrl->getFont()->CharExist(ke.c)) AddChar(ke.c); break; @@ -327,8 +327,8 @@ bool ctrlEdit::msgKeyDown(const KeyEvent& ke) break; case KeyType::Return: // Enter gedrückt - if(!isDisabled_ && GetParent()) - GetParent()->msgEditEnter(GetID()); + if(!isDisabled_ && getParent()) + getParent()->msgEditEnter(getID()); break; case KeyType::Home: // Pos1 gedrückt diff --git a/libs/s25main/controls/ctrlEdit.h b/libs/s25main/controls/ctrlEdit.h index b309272ea6..7ad9afc98b 100644 --- a/libs/s25main/controls/ctrlEdit.h +++ b/libs/s25main/controls/ctrlEdit.h @@ -37,18 +37,18 @@ class ctrlEdit : public Window ctrlEdit(Window* parent, unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, unsigned short maxlength = 0, bool password = false, bool disabled = false, bool notify = false); /// setzt den Text. - void SetText(const std::string& text); - void SetText(unsigned text); + void setText(const std::string& text); + void setText(unsigned text); - std::string GetText() const; + std::string getText() const; /// Trims leading whitespace (and trailing whitespace only if ext is empty), appends a non-empty ext, /// validates; returns Empty/Invalid/Valid with filename. Requires EditType::Filename. - GetFileNameResult GetFileName(const std::string& ext = "") const; - void SetFocus(bool focus = true); - bool HasFocus() const { return focus_; } - void SetDisabled(bool disabled = true) { this->isDisabled_ = disabled; } - void SetNotify(bool notify = true) { this->notify_ = notify; } - void SetType(EditType type) { this->editType_ = type; } + GetFileNameResult getFileName(const std::string& ext = "") const; + void setFocus(bool focus = true); + bool hasFocus() const { return focus_; } + void setDisabled(bool disabled = true) { this->isDisabled_ = disabled; } + void setNotify(bool notify = true) { this->notify_ = notify; } + void setType(EditType type) { this->editType_ = type; } void Resize(const Extent& newSize) override; diff --git a/libs/s25main/controls/ctrlGroup.cpp b/libs/s25main/controls/ctrlGroup.cpp index 83d24aabcf..fa29b1689e 100644 --- a/libs/s25main/controls/ctrlGroup.cpp +++ b/libs/s25main/controls/ctrlGroup.cpp @@ -11,72 +11,72 @@ ctrlGroup::ctrlGroup(Window* parent, unsigned id) : Window(parent, id, DrawPoint void ctrlGroup::msgButtonClick(const unsigned ctrl_id) { - GetParent()->msgGroupButtonClick(this->GetID(), ctrl_id); + getParent()->msgGroupButtonClick(this->getID(), ctrl_id); } void ctrlGroup::msgEditEnter(const unsigned ctrl_id) { - GetParent()->msgGroupEditEnter(this->GetID(), ctrl_id); + getParent()->msgGroupEditEnter(this->getID(), ctrl_id); } void ctrlGroup::msgEditChange(const unsigned ctrl_id) { - GetParent()->msgGroupEditChange(this->GetID(), ctrl_id); + getParent()->msgGroupEditChange(this->getID(), ctrl_id); } void ctrlGroup::msgTabChange(const unsigned ctrl_id, const unsigned short tab_id) { - GetParent()->msgGroupTabChange(this->GetID(), ctrl_id, tab_id); + getParent()->msgGroupTabChange(this->getID(), ctrl_id, tab_id); } void ctrlGroup::msgListSelectItem(const unsigned ctrl_id, const int selection) { - GetParent()->msgGroupListSelectItem(this->GetID(), ctrl_id, selection); + getParent()->msgGroupListSelectItem(this->getID(), ctrl_id, selection); } void ctrlGroup::msgComboSelectItem(const unsigned ctrl_id, const unsigned selection) { - GetParent()->msgGroupComboSelectItem(this->GetID(), ctrl_id, selection); + getParent()->msgGroupComboSelectItem(this->getID(), ctrl_id, selection); } void ctrlGroup::msgCheckboxChange(const unsigned ctrl_id, const bool checked) { - GetParent()->msgGroupCheckboxChange(this->GetID(), ctrl_id, checked); + getParent()->msgGroupCheckboxChange(this->getID(), ctrl_id, checked); } void ctrlGroup::msgProgressChange(const unsigned ctrl_id, const unsigned short position) { - GetParent()->msgGroupProgressChange(this->GetID(), ctrl_id, position); + getParent()->msgGroupProgressChange(this->getID(), ctrl_id, position); } void ctrlGroup::msgScrollShow(const unsigned ctrl_id, const bool visible) { - GetParent()->msgGroupScrollShow(this->GetID(), ctrl_id, visible); + getParent()->msgGroupScrollShow(this->getID(), ctrl_id, visible); } void ctrlGroup::msgOptionGroupChange(const unsigned ctrl_id, const unsigned selection) { - GetParent()->msgGroupOptionGroupChange(this->GetID(), ctrl_id, selection); + getParent()->msgGroupOptionGroupChange(this->getID(), ctrl_id, selection); } void ctrlGroup::msgTimer(const unsigned ctrl_id) { - GetParent()->msgGroupTimer(this->GetID(), ctrl_id); + getParent()->msgGroupTimer(this->getID(), ctrl_id); } void ctrlGroup::msgTableSelectItem(const unsigned ctrl_id, const std::optional& selection) { - GetParent()->msgGroupTableSelectItem(this->GetID(), ctrl_id, selection); + getParent()->msgGroupTableSelectItem(this->getID(), ctrl_id, selection); } void ctrlGroup::msgTableRightButton(const unsigned ctrl_id, const std::optional& selection) { - GetParent()->msgGroupTableRightButton(this->GetID(), ctrl_id, selection); + getParent()->msgGroupTableRightButton(this->getID(), ctrl_id, selection); } void ctrlGroup::msgTableLeftButton(const unsigned ctrl_id, const std::optional& selection) { - GetParent()->msgGroupTableLeftButton(this->GetID(), ctrl_id, selection); + getParent()->msgGroupTableLeftButton(this->getID(), ctrl_id, selection); } bool ctrlGroup::msgLeftDown(const MouseCoords& mc) @@ -121,74 +121,74 @@ bool ctrlGroup::msgKeyDown(const KeyEvent& ke) void ctrlGroup::msgGroupButtonClick(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->msgGroupButtonClick(this->GetID(), ctrl_id); + getParent()->msgGroupButtonClick(this->getID(), ctrl_id); } void ctrlGroup::msgGroupEditEnter(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->msgGroupEditEnter(this->GetID(), ctrl_id); + getParent()->msgGroupEditEnter(this->getID(), ctrl_id); } void ctrlGroup::msgGroupEditChange(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->msgGroupEditChange(this->GetID(), ctrl_id); + getParent()->msgGroupEditChange(this->getID(), ctrl_id); } void ctrlGroup::msgGroupTabChange(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned short tab_id) { - GetParent()->msgGroupTabChange(this->GetID(), ctrl_id, tab_id); + getParent()->msgGroupTabChange(this->getID(), ctrl_id, tab_id); } void ctrlGroup::msgGroupListSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, const int selection) { - GetParent()->msgGroupListSelectItem(this->GetID(), ctrl_id, selection); + getParent()->msgGroupListSelectItem(this->getID(), ctrl_id, selection); } void ctrlGroup::msgGroupComboSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned selection) { - GetParent()->msgGroupComboSelectItem(this->GetID(), ctrl_id, selection); + getParent()->msgGroupComboSelectItem(this->getID(), ctrl_id, selection); } void ctrlGroup::msgGroupCheckboxChange(const unsigned /*group_id*/, const unsigned ctrl_id, const bool checked) { - GetParent()->msgGroupCheckboxChange(this->GetID(), ctrl_id, checked); + getParent()->msgGroupCheckboxChange(this->getID(), ctrl_id, checked); } void ctrlGroup::msgGroupProgressChange(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned short position) { - GetParent()->msgGroupProgressChange(this->GetID(), ctrl_id, position); + getParent()->msgGroupProgressChange(this->getID(), ctrl_id, position); } void ctrlGroup::msgGroupScrollShow(const unsigned /*group_id*/, const unsigned ctrl_id, const bool visible) { - GetParent()->msgGroupScrollShow(this->GetID(), ctrl_id, visible); + getParent()->msgGroupScrollShow(this->getID(), ctrl_id, visible); } void ctrlGroup::msgGroupOptionGroupChange(const unsigned /*group_id*/, const unsigned ctrl_id, unsigned selection) { - GetParent()->msgGroupOptionGroupChange(this->GetID(), ctrl_id, selection); + getParent()->msgGroupOptionGroupChange(this->getID(), ctrl_id, selection); } void ctrlGroup::msgGroupTimer(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->msgGroupTimer(this->GetID(), ctrl_id); + getParent()->msgGroupTimer(this->getID(), ctrl_id); } void ctrlGroup::msgGroupTableSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, const std::optional& selection) { - GetParent()->msgGroupTableSelectItem(this->GetID(), ctrl_id, selection); + getParent()->msgGroupTableSelectItem(this->getID(), ctrl_id, selection); } void ctrlGroup::msgGroupTableRightButton(const unsigned /*group_id*/, const unsigned ctrl_id, const std::optional& selection) { - GetParent()->msgGroupTableRightButton(this->GetID(), ctrl_id, selection); + getParent()->msgGroupTableRightButton(this->getID(), ctrl_id, selection); } void ctrlGroup::msgGroupTableLeftButton(const unsigned /*group_id*/, const unsigned ctrl_id, const std::optional& selection) { - GetParent()->msgGroupTableLeftButton(this->GetID(), ctrl_id, selection); + getParent()->msgGroupTableLeftButton(this->getID(), ctrl_id, selection); } diff --git a/libs/s25main/controls/ctrlImage.cpp b/libs/s25main/controls/ctrlImage.cpp index 6370b02869..ec441f6da7 100644 --- a/libs/s25main/controls/ctrlImage.cpp +++ b/libs/s25main/controls/ctrlImage.cpp @@ -14,14 +14,14 @@ ctrlImage::~ctrlImage() = default; void ctrlImage::Draw_() { - DrawImage(Rect(GetDrawPos(), GetImageRect().getSize())); + DrawImage(Rect(getDrawPos(), getImageRect().getSize())); } bool ctrlImage::msgMouseMove(const MouseCoords& mc) { - if(GetImage()) + if(getImage()) { - if(IsMouseOver(mc.pos)) + if(isMouseOver(mc.pos)) ShowTooltip(); else HideTooltip(); @@ -30,7 +30,7 @@ bool ctrlImage::msgMouseMove(const MouseCoords& mc) return false; } -Rect ctrlImage::GetBoundaryRect() const +Rect ctrlImage::getBoundaryRect() const { - return Rect::move(GetImageRect(), GetDrawPos()); + return Rect::move(getImageRect(), getDrawPos()); } diff --git a/libs/s25main/controls/ctrlImage.h b/libs/s25main/controls/ctrlImage.h index 60f70c061f..8e10d46600 100644 --- a/libs/s25main/controls/ctrlImage.h +++ b/libs/s25main/controls/ctrlImage.h @@ -18,7 +18,7 @@ class ctrlImage : public Window, public ctrlBaseTooltip, public ctrlBaseImage ~ctrlImage() override; bool msgMouseMove(const MouseCoords& mc) override; - Rect GetBoundaryRect() const override; + Rect getBoundaryRect() const override; protected: void Draw_() override; diff --git a/libs/s25main/controls/ctrlImageButton.cpp b/libs/s25main/controls/ctrlImageButton.cpp index 9094f4a09c..721305c285 100644 --- a/libs/s25main/controls/ctrlImageButton.cpp +++ b/libs/s25main/controls/ctrlImageButton.cpp @@ -13,8 +13,8 @@ ctrlImageButton::ctrlImageButton(Window* parent, unsigned id, const DrawPoint& p void ctrlImageButton::DrawContent() const { // Adding of origin compensates for its substraction inside ITexture::Draw() - auto pos = GetDrawPos() + GetImage()->GetOrigin(); - auto size = GetSize(); + auto pos = getDrawPos() + getImage()->getOrigin(); + auto size = getSize(); if(hasBorder) { @@ -31,7 +31,7 @@ void ctrlImageButton::DrawContent() const } Rect drawRect(pos, size); - if(!isEnabled && GetModulationColor() == COLOR_WHITE) + if(!isEnabled && getModulationColor() == COLOR_WHITE) DrawImage(drawRect, 0xFF555555); else DrawImage(drawRect); diff --git a/libs/s25main/controls/ctrlImageDeepening.cpp b/libs/s25main/controls/ctrlImageDeepening.cpp index 312e6fcdf1..77d6fa22de 100644 --- a/libs/s25main/controls/ctrlImageDeepening.cpp +++ b/libs/s25main/controls/ctrlImageDeepening.cpp @@ -13,5 +13,5 @@ ctrlImageDeepening::ctrlImageDeepening(Window* parent, unsigned id, DrawPoint po void ctrlImageDeepening::DrawContent() const { // Adding of origin compensates for its substraction inside ITexture::Draw() - DrawImage(Rect(GetDrawPos() + GetImage()->GetOrigin(), GetSize())); + DrawImage(Rect(getDrawPos() + getImage()->getOrigin(), getSize())); } diff --git a/libs/s25main/controls/ctrlIngameMinimap.cpp b/libs/s25main/controls/ctrlIngameMinimap.cpp index 3efde87cd5..889744b184 100644 --- a/libs/s25main/controls/ctrlIngameMinimap.cpp +++ b/libs/s25main/controls/ctrlIngameMinimap.cpp @@ -13,7 +13,7 @@ class Window; ctrlIngameMinimap::ctrlIngameMinimap(Window* parent, const unsigned id, const DrawPoint& pos, const Extent& size, const Extent& padding, IngameMinimap& minimap, GameWorldView& gwv) - : ctrlMinimap(parent, id, pos, size, padding, Extent(minimap.GetMapSize())), minimap(minimap), gwv(gwv) + : ctrlMinimap(parent, id, pos, size, padding, Extent(minimap.getMapSize())), minimap(minimap), gwv(gwv) {} /** @@ -24,22 +24,22 @@ void ctrlIngameMinimap::Draw_() DrawMap(minimap); // Mittleren Punkt berechnen und dort hinscrollen - Position middlePt = (gwv.GetLastPt() + gwv.GetFirstPt()) / 2; + Position middlePt = (gwv.getLastPt() + gwv.getFirstPt()) / 2; // Koordinaten korrigieren - DrawPoint middle_corrected(MakeMapPoint(middlePt, minimap.GetMapSize())); + DrawPoint middle_corrected(MakeMapPoint(middlePt, minimap.getMapSize())); // Scroll-Auswahl-Bild holen - glArchivItem_Bitmap* image = LOADER.GetMapImage(23); + glArchivItem_Bitmap* image = LOADER.getMapImage(23); // Position (relativ zum angezeigten Anfang der Karte) berechnen - DrawPoint pos = middle_corrected * DrawPoint(GetCurMapSize()) / DrawPoint(minimap.GetMapSize()) + DrawPoint(2, 2); + DrawPoint pos = middle_corrected * DrawPoint(getCurMapSize()) / DrawPoint(minimap.getMapSize()) + DrawPoint(2, 2); // Scroll-Auswahl-Bild an den Rändern verkleinern, damit es nicht über die Karte "überlappt" DrawPoint srcOffset(0, 0); Extent drawSize(image->getWidth(), image->getHeight()); - DrawPoint originOffset = pos - image->GetOrigin(); + DrawPoint originOffset = pos - image->getOrigin(); // überlappung am linken Rand? if(originOffset.x < 0) @@ -56,7 +56,7 @@ void ctrlIngameMinimap::Draw_() pos.y = image->getNy(); } // überlappung am rechten Rand? - DrawPoint overDrawSize = pos - image->GetOrigin() + DrawPoint(image->GetSize()) - DrawPoint(GetCurMapSize()); + DrawPoint overDrawSize = pos - image->getOrigin() + DrawPoint(image->getSize()) - DrawPoint(getCurMapSize()); if(overDrawSize.x >= 0) drawSize.x -= overDrawSize.x; // überlappung am unteren Rand? @@ -64,7 +64,7 @@ void ctrlIngameMinimap::Draw_() drawSize.y -= overDrawSize.y; // Zeichnen - image->DrawPart(Rect(GetMapDrawArea().getOrigin() + pos, drawSize), srcOffset); + image->DrawPart(Rect(getMapDrawArea().getOrigin() + pos, drawSize), srcOffset); } bool ctrlIngameMinimap::msgLeftDown(const MouseCoords& mc) @@ -77,11 +77,11 @@ bool ctrlIngameMinimap::msgMouseMove(const MouseCoords& mc) if(mc.ldown) { // Mauszeiger auf der Karte? - if(IsPointInRect(mc.pos, GetMapDrawArea())) + if(IsPointInRect(mc.pos, getMapDrawArea())) { // Koordinate feststellen - DrawPoint mapCoord = (mc.pos - DrawPoint(GetMapDrawArea().getOrigin())) * DrawPoint(minimap.GetMapSize()) - / DrawPoint(GetCurMapSize()); + DrawPoint mapCoord = (mc.pos - DrawPoint(getMapDrawArea().getOrigin())) * DrawPoint(minimap.getMapSize()) + / DrawPoint(getCurMapSize()); gwv.MoveToMapPt(MapPoint(mapCoord)); diff --git a/libs/s25main/controls/ctrlList.cpp b/libs/s25main/controls/ctrlList.cpp index 020fa17b71..e6e5a80323 100644 --- a/libs/s25main/controls/ctrlList.cpp +++ b/libs/s25main/controls/ctrlList.cpp @@ -12,9 +12,9 @@ ctrlList::ctrlList(Window* parent, unsigned id, const DrawPoint& pos, const Exte const glFont* font) : Window(parent, id, pos, elMax(size, Extent(22, 4))), tc(tc), font(font) { - pagesize = (GetSize().y - 4) / font->getHeight(); + pagesize = (getSize().y - 4) / font->getHeight(); - AddScrollBar(0, DrawPoint(GetSize().x - 20, 0), Extent(20, GetSize().y), 20, tc, pagesize); + AddScrollBar(0, DrawPoint(getSize().x - 20, 0), Extent(20, getSize().y), 20, tc, pagesize); } ctrlList::~ctrlList() @@ -22,26 +22,26 @@ ctrlList::~ctrlList() DeleteAllItems(); } -void ctrlList::SetSelection(const std::optional& selection) +void ctrlList::setSelection(const std::optional& selection) { if(selection != selection_ && (!selection || *selection < lines.size())) { selection_ = selection; - if(selection && GetParent()) - GetParent()->msgListSelectItem(GetID(), *selection); + if(selection && getParent()) + getParent()->msgListSelectItem(getID(), *selection); } } bool ctrlList::msgMouseMove(const MouseCoords& mc) { - auto* scrollbar = GetCtrl(0); + auto* scrollbar = getCtrl(0); - mouseover_ = GetItemFromPos(mc.pos); + mouseover_ = getItemFromPos(mc.pos); // Wenn Maus in der Liste if(mouseover_) { - const std::string itemTxt = GetItemText(*mouseover_); - tooltip_.ShowTooltip((font->getWidth(itemTxt) > GetListDrawArea().getSize().x) ? itemTxt : ""); + const std::string itemTxt = getItemText(*mouseover_); + tooltip_.ShowTooltip((font->getWidth(itemTxt) > getListDrawArea().getSize().x) ? itemTxt : ""); return true; } @@ -53,13 +53,13 @@ bool ctrlList::msgMouseMove(const MouseCoords& mc) bool ctrlList::msgLeftDown(const MouseCoords& mc) { - auto* scrollbar = GetCtrl(0); + auto* scrollbar = getCtrl(0); - const auto itemIdx = GetItemFromPos(mc.pos); + const auto itemIdx = getItemFromPos(mc.pos); if(itemIdx) { tooltip_.HideTooltip(); - SetSelection(*itemIdx); + setSelection(*itemIdx); return true; } @@ -69,13 +69,13 @@ bool ctrlList::msgLeftDown(const MouseCoords& mc) bool ctrlList::msgRightDown(const MouseCoords& mc) { - auto* scrollbar = GetCtrl(0); + auto* scrollbar = getCtrl(0); - auto itemIdx = GetItemFromPos(mc.pos); + auto itemIdx = getItemFromPos(mc.pos); if(itemIdx) { tooltip_.HideTooltip(); - SetSelection(*itemIdx); + setSelection(*itemIdx); return true; } @@ -85,14 +85,14 @@ bool ctrlList::msgRightDown(const MouseCoords& mc) bool ctrlList::msgLeftUp(const MouseCoords& mc) { - auto* scrollbar = GetCtrl(0); + auto* scrollbar = getCtrl(0); // Wenn Maus in der Liste - if(IsPointInRect(mc.pos, GetListDrawArea())) + if(IsPointInRect(mc.pos, getListDrawArea())) { // Doppelklick? Dann noch einen extra Eventhandler aufrufen - if(mc.dbl_click && GetParent() && selection_) - GetParent()->msgListChooseItem(GetID(), *selection_); + if(mc.dbl_click && getParent() && selection_) + getParent()->msgListChooseItem(getID(), *selection_); return true; } @@ -104,9 +104,9 @@ bool ctrlList::msgLeftUp(const MouseCoords& mc) bool ctrlList::msgWheelUp(const MouseCoords& mc) { // If mouse in list or scrollbar - if(IsPointInRect(mc.pos, GetFullDrawArea())) + if(IsPointInRect(mc.pos, getFullDrawArea())) { - auto* scrollbar = GetCtrl(0); + auto* scrollbar = getCtrl(0); scrollbar->Scroll(-1); return true; } @@ -117,9 +117,9 @@ bool ctrlList::msgWheelUp(const MouseCoords& mc) bool ctrlList::msgWheelDown(const MouseCoords& mc) { // If mouse in list - if(IsPointInRect(mc.pos, GetFullDrawArea())) + if(IsPointInRect(mc.pos, getFullDrawArea())) { - auto* scrollbar = GetCtrl(0); + auto* scrollbar = getCtrl(0); scrollbar->Scroll(+1); return true; } @@ -133,7 +133,7 @@ void ctrlList::Draw_() return; // Box malen - Draw3D(Rect(GetDrawPos(), GetSize()), tc, false); + Draw3D(Rect(getDrawPos(), getSize()), tc, false); // Scrolleiste zeichnen Window::Draw_(); @@ -141,18 +141,18 @@ void ctrlList::Draw_() // Wieviele Linien anzeigen? const unsigned show_lines = (pagesize > lines.size() ? unsigned(lines.size()) : pagesize); - const unsigned scrollbarPos = GetCtrl(0)->GetScrollPos(); - DrawPoint curPos = GetDrawPos() + DrawPoint(2, 2); + const unsigned scrollbarPos = getCtrl(0)->getScrollPos(); + DrawPoint curPos = getDrawPos() + DrawPoint(2, 2); // Listeneinträge zeichnen for(unsigned i = 0; i < show_lines; ++i) { // Schwarze Markierung, wenn die Maus drauf ist if(i + scrollbarPos == mouseover_) - DrawRectangle(Rect(curPos, Extent(GetSize().x - 22, font->getHeight())), 0x80000000); + DrawRectangle(Rect(curPos, Extent(getSize().x - 22, font->getHeight())), 0x80000000); // Text an sich font->Draw(curPos, lines[i + scrollbarPos], FontStyle{}, - (selection_ == i + scrollbarPos ? 0xFFFFAA00 : COLOR_YELLOW), GetSize().x - 22); + (selection_ == i + scrollbarPos ? 0xFFFFAA00 : COLOR_YELLOW), getSize().x - 22); curPos.y += font->getHeight(); } } @@ -162,10 +162,10 @@ void ctrlList::AddItem(const std::string& text) // lines-Array ggf vergrößern lines.push_back(text); - GetCtrl(0)->SetRange(static_cast(lines.size())); + getCtrl(0)->setRange(static_cast(lines.size())); } -void ctrlList::SetItemText(const unsigned id, const std::string& text) +void ctrlList::setItemText(const unsigned id, const std::string& text) { lines.at(id) = text; } @@ -176,36 +176,36 @@ void ctrlList::DeleteAllItems() selection_ = std::nullopt; } -const std::string& ctrlList::GetItemText(unsigned line) const +const std::string& ctrlList::getItemText(unsigned line) const { RTTR_Assert(line < lines.size()); return lines[line]; } -const std::string& ctrlList::GetSelItemText() const +const std::string& ctrlList::getSelItemText() const { static const std::string EMPTY; if(selection_) - return GetItemText(*selection_); + return getItemText(*selection_); else return EMPTY; } void ctrlList::Resize(const Extent& newSize) { - auto* scrollbar = GetCtrl(0); - scrollbar->SetPos(DrawPoint(newSize.x - 20, 0)); + auto* scrollbar = getCtrl(0); + scrollbar->setPos(DrawPoint(newSize.x - 20, 0)); scrollbar->Resize(Extent(20, newSize.y)); pagesize = (newSize.y - 4) / font->getHeight(); - scrollbar->SetPageSize(pagesize); + scrollbar->setPageSize(pagesize); // If the size was enlarged we have to check that we don't try to // display more lines than present - if(newSize.y > GetSize().y) - while(lines.size() - scrollbar->GetScrollPos() < pagesize && scrollbar->GetScrollPos() > 0) - scrollbar->SetScrollPos(scrollbar->GetScrollPos() - 1); + if(newSize.y > getSize().y) + while(lines.size() - scrollbar->getScrollPos() < pagesize && scrollbar->getScrollPos() > 0) + scrollbar->setScrollPos(scrollbar->getScrollPos() - 1); Window::Resize(newSize); } @@ -237,37 +237,37 @@ void ctrlList::Remove(const unsigned index) { // Current item deleted -> clear selection selection_ = std::nullopt; - if(index < GetNumLines()) - SetSelection(index); // select item now at deleted position + if(index < getNumLines()) + setSelection(index); // select item now at deleted position else if(index > 0u) - SetSelection(index - 1u); // or previous if item at end deleted + setSelection(index - 1u); // or previous if item at end deleted } } } -Rect ctrlList::GetListDrawArea() const +Rect ctrlList::getListDrawArea() const { // Full area minus scrollbar - Rect result = GetFullDrawArea(); + Rect result = getFullDrawArea(); Extent size = result.getSize(); size.x -= 20; result.setSize(size); return result; } -std::optional ctrlList::GetItemFromPos(const Position& pos) const +std::optional ctrlList::getItemFromPos(const Position& pos) const { - const Rect listDrawArea = GetListDrawArea(); + const Rect listDrawArea = getListDrawArea(); if(!IsPointInRect(pos, listDrawArea)) return std::nullopt; const unsigned itemIdx = - (pos.y - listDrawArea.getOrigin().y) / font->getHeight() + GetCtrl(0)->GetScrollPos(); - if(itemIdx >= GetNumLines()) + (pos.y - listDrawArea.getOrigin().y) / font->getHeight() + getCtrl(0)->getScrollPos(); + if(itemIdx >= getNumLines()) return std::nullopt; return itemIdx; } -Rect ctrlList::GetFullDrawArea() const +Rect ctrlList::getFullDrawArea() const { - return Rect(GetDrawPos() + DrawPoint(2, 2), GetSize() - Extent(2, 4)); + return Rect(getDrawPos() + DrawPoint(2, 2), getSize() - Extent(2, 4)); } diff --git a/libs/s25main/controls/ctrlList.h b/libs/s25main/controls/ctrlList.h index 824c951a9a..3a0423feb9 100644 --- a/libs/s25main/controls/ctrlList.h +++ b/libs/s25main/controls/ctrlList.h @@ -26,19 +26,19 @@ class ctrlList : public Window /// Add item to listbox. void AddItem(const std::string& text); /// Change text of an item. - void SetItemText(unsigned id, const std::string& text); + void setItemText(unsigned id, const std::string& text); void DeleteAllItems(); - const std::string& GetItemText(unsigned line) const; + const std::string& getItemText(unsigned line) const; /// Get the value of the currently selected item - const std::string& GetSelItemText() const; + const std::string& getSelItemText() const; /// Exchange the text of 2 items void Swap(unsigned first, unsigned second); /// Deletes an item. If the deleted item is selected then the selection is cleared. void Remove(unsigned index); - unsigned GetNumLines() const { return static_cast(lines.size()); } - const std::optional& GetSelection() const { return selection_; }; - void SetSelection(const std::optional& selection); + unsigned getNumLines() const { return static_cast(lines.size()); } + const std::optional& getSelection() const { return selection_; }; + void setSelection(const std::optional& selection); bool msgMouseMove(const MouseCoords& mc) override; bool msgLeftDown(const MouseCoords& mc) override; @@ -51,9 +51,9 @@ class ctrlList : public Window void Draw_() override; private: - std::optional GetItemFromPos(const Position& pos) const; - Rect GetFullDrawArea() const; - Rect GetListDrawArea() const; + std::optional getItemFromPos(const Position& pos) const; + Rect getFullDrawArea() const; + Rect getListDrawArea() const; TextureColor tc; const glFont* font; diff --git a/libs/s25main/controls/ctrlMapSelection.cpp b/libs/s25main/controls/ctrlMapSelection.cpp index 4edfa19086..107a7181ef 100644 --- a/libs/s25main/controls/ctrlMapSelection.cpp +++ b/libs/s25main/controls/ctrlMapSelection.cpp @@ -21,7 +21,7 @@ ctrlMapSelection::MapImages::MapImages(const SelectionMapInputData& data) { auto getImage = [](const ImageResource& res) { - auto* img = LOADER.GetImageN(ResourceId::fromPath(res.filePath), res.index); + auto* img = LOADER.getImageN(ResourceId::fromPath(res.filePath), res.index); if(!img) throw std::runtime_error( helpers::format(_("Loading of images %s for map selection failed."), res.filePath)); @@ -40,7 +40,7 @@ ctrlMapSelection::MapImages::MapImages(const SelectionMapInputData& data) missionMapMask = getImage(data.missionMapMask); marker = getImage(data.marker); conquered = getImage(data.conquered); - if(map->GetSize() != missionMapMask->GetSize()) + if(map->getSize() != missionMapMask->getSize()) throw std::runtime_error(_("Map and mission mask have different sizes.")); enabledMaskMemory = @@ -62,10 +62,10 @@ ctrlMapSelection::~ctrlMapSelection() = default; void ctrlMapSelection::updateEnabledMask() { - RTTR_Assert(mapImages.enabledMask->GetSize() == mapImages.missionMapMask->GetSize()); + RTTR_Assert(mapImages.enabledMask->getSize() == mapImages.missionMapMask->getSize()); const libsiedler2::ColorBGRA disabledColor(inputData.disabledColor); - RTTR_FOREACH_PT(Point, mapImages.enabledMask->GetSize()) + RTTR_FOREACH_PT(Point, mapImages.enabledMask->getSize()) { const auto pixelColor = mapImages.missionMapMask->getPixel(pt.x, pt.y).asValue(); const auto matchingMissionIdx = helpers::indexOf_if( @@ -119,13 +119,13 @@ void ctrlMapSelection::setPreview(bool previewOnly) bool ctrlMapSelection::msgLeftUp(const MouseCoords& mc) { - if(!preview && IsMouseOver(mc)) + if(!preview && isMouseOver(mc)) { const auto pickPos = invertScale(mc.pos - getMapPosition()); const auto pixelColor = mapImages.missionMapMask - ->getPixel(helpers::clamp(pickPos.x, 0u, mapImages.map->GetSize().x - 1), - helpers::clamp(pickPos.y, 0u, mapImages.map->GetSize().y - 1)) + ->getPixel(helpers::clamp(pickPos.x, 0u, mapImages.map->getSize().x - 1), + helpers::clamp(pickPos.y, 0u, mapImages.map->getSize().y - 1)) .asValue(); const auto matchingMissionIdx = helpers::indexOf_if( @@ -134,7 +134,7 @@ bool ctrlMapSelection::msgLeftUp(const MouseCoords& mc) if(matchingMissionIdx >= 0) { setSelection(matchingMissionIdx); - GetParent()->msgButtonClick(GetID()); + getParent()->msgButtonClick(getID()); } return true; } @@ -143,7 +143,7 @@ bool ctrlMapSelection::msgLeftUp(const MouseCoords& mc) float ctrlMapSelection::getScaleFactor() { - const auto ratio = PointF(GetSize()) / mapImages.background->GetSize(); + const auto ratio = PointF(getSize()) / mapImages.background->getSize(); return std::min(ratio.x, ratio.y); } @@ -154,7 +154,7 @@ DrawPoint ctrlMapSelection::invertScale(const DrawPoint& scaleIt) DrawPoint ctrlMapSelection::getBackgroundPosition() { - return GetDrawPos() + (GetSize() - scale(mapImages.background->GetSize())) / 2; + return getDrawPos() + (getSize() - scale(mapImages.background->getSize())) / 2; } DrawPoint ctrlMapSelection::getMapPosition() @@ -164,17 +164,17 @@ DrawPoint ctrlMapSelection::getMapPosition() void ctrlMapSelection::drawImageOnMap(glArchivItem_Bitmap* image, const Position& drawPos) { - const auto originCorrection = image->GetOrigin() - scale(image->GetOrigin()); - image->DrawFull(Rect(getMapPosition() + scale(drawPos) + originCorrection, scale(image->GetSize()))); + const auto originCorrection = image->getOrigin() - scale(image->getOrigin()); + image->DrawFull(Rect(getMapPosition() + scale(drawPos) + originCorrection, scale(image->getSize()))); } void ctrlMapSelection::Draw_() { Window::Draw_(); - mapImages.background->DrawFull(Rect(getBackgroundPosition(), scale(mapImages.background->GetSize()))); + mapImages.background->DrawFull(Rect(getBackgroundPosition(), scale(mapImages.background->getSize()))); - const Rect mapRect = Rect(getMapPosition(), scale(mapImages.map->GetSize())); + const Rect mapRect = Rect(getMapPosition(), scale(mapImages.map->getSize())); mapImages.map->DrawFull(mapRect); mapImages.enabledMask->DrawFull(mapRect); diff --git a/libs/s25main/controls/ctrlMinimap.cpp b/libs/s25main/controls/ctrlMinimap.cpp index 495dc428e9..55fe9299a8 100644 --- a/libs/s25main/controls/ctrlMinimap.cpp +++ b/libs/s25main/controls/ctrlMinimap.cpp @@ -10,44 +10,44 @@ ctrlMinimap::ctrlMinimap(Window* parent, const unsigned id, const DrawPoint& pos const Extent& padding, const Extent& mapSize) : Window(parent, id, pos, size), padding(padding), mapSize(mapSize) { - SetMapSize(mapSize); + setMapSize(mapSize); } -Rect ctrlMinimap::GetMapArea() const +Rect ctrlMinimap::getMapArea() const { - return Rect(DrawPoint(GetSize() - drawnMapSize) / 2, drawnMapSize); + return Rect(DrawPoint(getSize() - drawnMapSize) / 2, drawnMapSize); } -Rect ctrlMinimap::GetBoundaryRect() const +Rect ctrlMinimap::getBoundaryRect() const { - Rect mapArea = GetMapDrawArea(); + Rect mapArea = getMapDrawArea(); mapArea.setSize(mapArea.getSize() + padding); return mapArea; } -Rect ctrlMinimap::GetMapDrawArea() const +Rect ctrlMinimap::getMapDrawArea() const { - return Rect::move(GetMapArea(), GetDrawPos()); + return Rect::move(getMapArea(), getDrawPos()); } -void ctrlMinimap::SetPadding(const Extent& padding) +void ctrlMinimap::setPadding(const Extent& padding) { this->padding = padding; - SetMapSize(mapSize); + setMapSize(mapSize); } void ctrlMinimap::Resize(const Extent& newSize) { Window::Resize(newSize); - SetMapSize(mapSize); + setMapSize(mapSize); } -void ctrlMinimap::SetMapSize(const Extent& newMapSize) +void ctrlMinimap::setMapSize(const Extent& newMapSize) { mapSize = newMapSize; // Drawn map size is the full size reduced by the padding but >= 0 - drawnMapSize = Extent(elMax(GetSize() - 2 * Position(padding), Position::all(0))); + drawnMapSize = Extent(elMax(getSize() - 2 * Position(padding), Position::all(0))); // If any size is 0 -> no map if(prodOfComponents(mapSize) == 0 || prodOfComponents(drawnMapSize) == 0) drawnMapSize = Extent::all(0); @@ -73,7 +73,7 @@ void ctrlMinimap::SetMapSize(const Extent& newMapSize) DrawPoint ctrlMinimap::CalcMapCoord(MapPoint pt) const { - DrawPoint result = GetMapArea().getOrigin(); + DrawPoint result = getMapArea().getOrigin(); result += DrawPoint(drawnMapSize * Extent(pt) / mapSize); return result; } @@ -81,7 +81,7 @@ DrawPoint ctrlMinimap::CalcMapCoord(MapPoint pt) const void ctrlMinimap::DrawMap(Minimap& map) const { // Map an sich zeichnen - map.Draw(GetMapDrawArea()); + map.Draw(getMapDrawArea()); } void ctrlMinimap::RemoveBoundingBox(const Extent& minSize) diff --git a/libs/s25main/controls/ctrlMinimap.h b/libs/s25main/controls/ctrlMinimap.h index 22b8467400..45530b0b1a 100644 --- a/libs/s25main/controls/ctrlMinimap.h +++ b/libs/s25main/controls/ctrlMinimap.h @@ -16,17 +16,17 @@ class ctrlMinimap : public Window ctrlMinimap(Window* parent, unsigned id, const DrawPoint& pos, const Extent& size, const Extent& padding, const Extent& mapSize); - Extent GetCurMapSize() const { return drawnMapSize; } + Extent getCurMapSize() const { return drawnMapSize; } /// Get area the map covers (relative to control origin) - Rect GetMapArea() const; - Rect GetBoundaryRect() const override; - Rect GetMapDrawArea() const; + Rect getMapArea() const; + Rect getBoundaryRect() const override; + Rect getMapDrawArea() const; - void SetPadding(const Extent& padding); + void setPadding(const Extent& padding); /// Größe ändern void Resize(const Extent& newSize) override; - void SetMapSize(const Extent& newMapSize); + void setMapSize(const Extent& newMapSize); /// Liefert für einen gegebenen Map-Punkt die Pixel-Koordinaten relativ zur Bounding-Box DrawPoint CalcMapCoord(MapPoint pt) const; diff --git a/libs/s25main/controls/ctrlMultiSelectGroup.cpp b/libs/s25main/controls/ctrlMultiSelectGroup.cpp index c8f39209b8..9471a6923e 100644 --- a/libs/s25main/controls/ctrlMultiSelectGroup.cpp +++ b/libs/s25main/controls/ctrlMultiSelectGroup.cpp @@ -15,19 +15,19 @@ ctrlMultiSelectGroup::ctrlMultiSelectGroup(Window* parent, unsigned id, GroupSel void ctrlMultiSelectGroup::AddSelection(unsigned selection, bool notify) { // Neuen Button auswählen - auto* button = GetCtrl(selection); + auto* button = getCtrl(selection); RTTR_Assert(button); switch(select_type) { - case GroupSelectType::Illuminate: button->SetIlluminated(true); break; - case GroupSelectType::Check: button->SetChecked(true); break; - case GroupSelectType::Show: button->SetVisible(false); break; + case GroupSelectType::Illuminate: button->setIlluminated(true); break; + case GroupSelectType::Check: button->setChecked(true); break; + case GroupSelectType::Show: button->setVisible(false); break; } this->selectedItems_.insert(selection); - if(notify && GetParent()) - GetParent()->msgOptionGroupChange(GetID(), selection); + if(notify && getParent()) + getParent()->msgOptionGroupChange(getID(), selection); } /** @@ -36,19 +36,19 @@ void ctrlMultiSelectGroup::AddSelection(unsigned selection, bool notify) void ctrlMultiSelectGroup::RemoveSelection(unsigned selection, bool notify) { // Neuen Button auswählen - auto* button = GetCtrl(selection); + auto* button = getCtrl(selection); RTTR_Assert(button); switch(select_type) { - case GroupSelectType::Illuminate: button->SetIlluminated(false); break; - case GroupSelectType::Check: button->SetChecked(false); break; - case GroupSelectType::Show: button->SetVisible(true); break; + case GroupSelectType::Illuminate: button->setIlluminated(false); break; + case GroupSelectType::Check: button->setChecked(false); break; + case GroupSelectType::Show: button->setVisible(true); break; } this->selectedItems_.erase(selection); - if(notify && GetParent()) - GetParent()->msgOptionGroupChange(GetID(), selection); + if(notify && getParent()) + getParent()->msgOptionGroupChange(getID(), selection); } /** @@ -56,13 +56,13 @@ void ctrlMultiSelectGroup::RemoveSelection(unsigned selection, bool notify) */ void ctrlMultiSelectGroup::ToggleSelection(unsigned selection, bool notify) { - if(IsSelected(selection)) + if(isSelected(selection)) RemoveSelection(selection, notify); else AddSelection(selection, notify); } -bool ctrlMultiSelectGroup::IsSelected(unsigned selection) const +bool ctrlMultiSelectGroup::isSelected(unsigned selection) const { return (this->selectedItems_.count(selection) == 1); } diff --git a/libs/s25main/controls/ctrlMultiSelectGroup.h b/libs/s25main/controls/ctrlMultiSelectGroup.h index cbcb360baa..c02bcec22d 100644 --- a/libs/s25main/controls/ctrlMultiSelectGroup.h +++ b/libs/s25main/controls/ctrlMultiSelectGroup.h @@ -23,11 +23,11 @@ class ctrlMultiSelectGroup : public ctrlGroup /// Wechselt zwischen selektiert/nicht selektiert void ToggleSelection(unsigned selection, bool notify = false); /// Gibt Liste der aktuell selektierten Buttons zurück - const std::set& GetSelection() const { return selectedItems_; } + const std::set& getSelection() const { return selectedItems_; } /// Prüft ob ein Button ausgewählt ist - bool IsSelected(unsigned selection) const; + bool isSelected(unsigned selection) const; // Gibt einen Button aus der Gruppe zurück zum direkten Bearbeiten - ctrlButton* GetButton(unsigned id) { return GetCtrl(id); } + ctrlButton* getButton(unsigned id) { return getCtrl(id); } void msgButtonClick(unsigned ctrl_id) override; bool msgLeftDown(const MouseCoords& mc) override; diff --git a/libs/s25main/controls/ctrlMultiline.cpp b/libs/s25main/controls/ctrlMultiline.cpp index 2e51f7b1a2..27b712f1a1 100644 --- a/libs/s25main/controls/ctrlMultiline.cpp +++ b/libs/s25main/controls/ctrlMultiline.cpp @@ -27,9 +27,9 @@ void ctrlMultiline::AddString(const std::string& str, unsigned color, bool scrol lines.push_back(Line(str, color)); RecalcWrappedLines(); - auto* scrollbar = GetCtrl(0); - if(scroll && scrollbar->GetScrollPos() + 1 + maxNumVisibleLines == lines.size()) - scrollbar->SetScrollPos(scrollbar->GetScrollPos() + 1); + auto* scrollbar = getCtrl(0); + if(scroll && scrollbar->getScrollPos() + 1 + maxNumVisibleLines == lines.size()) + scrollbar->setScrollPos(scrollbar->getScrollPos() + 1); } void ctrlMultiline::Clear() @@ -44,14 +44,14 @@ void ctrlMultiline::Clear() void ctrlMultiline::Draw_() { if(showBackground_) - Draw3D(Rect(GetDrawPos(), GetSize()), tc_, false); + Draw3D(Rect(getDrawPos(), getSize()), tc_, false); Window::Draw_(); unsigned numVisibleLines = std::min(maxNumVisibleLines, drawLines.size()); - unsigned scrollbarPos = GetCtrl(0)->GetScrollPos(); - DrawPoint curPos = GetDrawPos() + DrawPoint(PADDING, PADDING); + unsigned scrollbarPos = getCtrl(0)->getScrollPos(); + DrawPoint curPos = getDrawPos() + DrawPoint(PADDING, PADDING); for(unsigned i = 0; i < numVisibleLines; ++i) { font->Draw(curPos, drawLines[i + scrollbarPos].str, format_, drawLines[i + scrollbarPos].color); @@ -61,10 +61,10 @@ void ctrlMultiline::Draw_() void ctrlMultiline::RecalcVisibleLines() { - if(GetSize().y < 2 * PADDING) + if(getSize().y < 2 * PADDING) maxNumVisibleLines = 0; else - maxNumVisibleLines = (GetSize().y - 2 * PADDING) / font->getHeight(); + maxNumVisibleLines = (getSize().y - 2 * PADDING) / font->getHeight(); } void ctrlMultiline::RecalcWrappedLines() @@ -72,9 +72,9 @@ void ctrlMultiline::RecalcWrappedLines() drawLines.clear(); cachedContentWidth = 0; // No space for a single line, or to narrow to even show the scrollbar -> Bail out - if(maxNumVisibleLines == 0 || GetSize().x < 2 * PADDING + SCROLLBAR_WIDTH) + if(maxNumVisibleLines == 0 || getSize().x < 2 * PADDING + SCROLLBAR_WIDTH) { - GetCtrl(0)->SetRange(0); + getCtrl(0)->setRange(0); return; } // Calculate the wrap info for each real line (2nd pass if we need a scrollbar after breaking into lines) @@ -85,12 +85,12 @@ void ctrlMultiline::RecalcWrappedLines() { wrapInfos.clear(); unsigned curNumLines = 0; - unsigned maxTextWidth = GetSize().x - 2 * PADDING; + unsigned maxTextWidth = getSize().x - 2 * PADDING; if(needScrollBar) maxTextWidth -= SCROLLBAR_WIDTH; for(unsigned i = 0; i < lines.size(); i++) { - wrapInfos.push_back(font->GetWrapInfo(lines[i].str, maxTextWidth, maxTextWidth)); + wrapInfos.push_back(font->getWrapInfo(lines[i].str, maxTextWidth, maxTextWidth)); if(!needScrollBar) { curNumLines += wrapInfos[i].lines.size(); @@ -123,10 +123,10 @@ void ctrlMultiline::RecalcWrappedLines() // If we don't have a scrollbar, restrict to maximum displayable lines if(!scrollbarAllowed_ && drawLines.size() > maxNumVisibleLines) drawLines.resize(maxNumVisibleLines); - GetCtrl(0)->SetRange(drawLines.size()); + getCtrl(0)->setRange(drawLines.size()); } -void ctrlMultiline::SetScrollBarAllowed(bool allowed) +void ctrlMultiline::setScrollBarAllowed(bool allowed) { if(scrollbarAllowed_ != allowed) { @@ -137,19 +137,19 @@ void ctrlMultiline::SetScrollBarAllowed(bool allowed) bool ctrlMultiline::msgLeftDown(const MouseCoords& mc) { - return GetCtrl(0)->msgLeftDown(mc); + return getCtrl(0)->msgLeftDown(mc); } bool ctrlMultiline::msgLeftUp(const MouseCoords& mc) { - return GetCtrl(0)->msgLeftUp(mc); + return getCtrl(0)->msgLeftUp(mc); } bool ctrlMultiline::msgWheelUp(const MouseCoords& mc) { const Extent padding(PADDING, PADDING); - if(IsPointInRect(mc.pos, Rect(GetDrawPos() + DrawPoint(padding), GetSize() - padding * 2u))) + if(IsPointInRect(mc.pos, Rect(getDrawPos() + DrawPoint(padding), getSize() - padding * 2u))) { - auto* scrollbar = GetCtrl(0); + auto* scrollbar = getCtrl(0); scrollbar->Scroll(-3); return true; } else @@ -159,9 +159,9 @@ bool ctrlMultiline::msgWheelUp(const MouseCoords& mc) bool ctrlMultiline::msgWheelDown(const MouseCoords& mc) { const Extent padding(PADDING, PADDING); - if(IsPointInRect(mc.pos, Rect(GetDrawPos() + DrawPoint(padding), GetSize() - padding * 2u))) + if(IsPointInRect(mc.pos, Rect(getDrawPos() + DrawPoint(padding), getSize() - padding * 2u))) { - auto* scrollbar = GetCtrl(0); + auto* scrollbar = getCtrl(0); scrollbar->Scroll(+3); return true; } else @@ -170,31 +170,31 @@ bool ctrlMultiline::msgWheelDown(const MouseCoords& mc) bool ctrlMultiline::msgMouseMove(const MouseCoords& mc) { - return GetCtrl(0)->msgMouseMove(mc); + return getCtrl(0)->msgMouseMove(mc); } void ctrlMultiline::Resize(const Extent& newSize) { - const Extent oldSize(GetSize()); + const Extent oldSize(getSize()); const unsigned oldMaxNumVisLines = maxNumVisibleLines; Window::Resize(newSize); RecalcVisibleLines(); - auto* scrollBar = GetCtrl(0); - scrollBar->SetPageSize(maxNumVisibleLines); - scrollBar->SetHeight(GetSize().y); - scrollBar->SetPos(DrawPoint(GetSize().x - SCROLLBAR_WIDTH, 0)); + auto* scrollBar = getCtrl(0); + scrollBar->setPageSize(maxNumVisibleLines); + scrollBar->setHeight(getSize().y); + scrollBar->setPos(DrawPoint(getSize().x - SCROLLBAR_WIDTH, 0)); // Recalc only if: // - we increased the size or decreased beyond content width // - scrollbar requirement has changed (e.g. now need one but did not need it before) const bool oldNeedScrollbar = oldMaxNumVisLines < drawLines.size(); const bool newNeedScrollbar = maxNumVisibleLines < drawLines.size(); - if(oldNeedScrollbar != newNeedScrollbar || GetSize().x > oldSize.x || GetSize().x < GetContentWidth()) + if(oldNeedScrollbar != newNeedScrollbar || getSize().x > oldSize.x || getSize().x < getContentWidth()) RecalcWrappedLines(); } /// Textzeile ersetzen. Klappt bestimmt nicht mit Scrollbar-Kram -void ctrlMultiline::SetLine(const unsigned index, const std::string& str, unsigned color) +void ctrlMultiline::setLine(const unsigned index, const std::string& str, unsigned color) { if(index < lines.size()) { @@ -203,18 +203,18 @@ void ctrlMultiline::SetLine(const unsigned index, const std::string& str, unsign } } -void ctrlMultiline::SetNumVisibleLines(unsigned numLines) +void ctrlMultiline::setNumVisibleLines(unsigned numLines) { - SetHeight(numLines * font->getHeight() + 2 * PADDING); + setHeight(numLines * font->getHeight() + 2 * PADDING); } -Extent ctrlMultiline::GetContentSize() const +Extent ctrlMultiline::getContentSize() const { - return Extent(GetContentWidth(), - std::min(GetSize().y, drawLines.size() * font->getHeight() + 2u * PADDING)); + return Extent(getContentWidth(), + std::min(getSize().y, drawLines.size() * font->getHeight() + 2u * PADDING)); } -unsigned ctrlMultiline::GetContentWidth() const +unsigned ctrlMultiline::getContentWidth() const { if(cachedContentWidth > 0) return cachedContentWidth; @@ -229,10 +229,10 @@ unsigned ctrlMultiline::GetContentWidth() const if(curWidth > maxWidth) { maxWidth = curWidth; - if(maxWidth >= GetSize().x) - return GetSize().x; + if(maxWidth >= getSize().x) + return getSize().x; } } - cachedContentWidth = std::min(GetSize().x, maxWidth); + cachedContentWidth = std::min(getSize().x, maxWidth); return cachedContentWidth; } diff --git a/libs/s25main/controls/ctrlMultiline.h b/libs/s25main/controls/ctrlMultiline.h index 8840efed0d..e894671c7f 100644 --- a/libs/s25main/controls/ctrlMultiline.h +++ b/libs/s25main/controls/ctrlMultiline.h @@ -28,20 +28,20 @@ class ctrlMultiline : public Window void AddString(const std::string& str, unsigned color, bool scroll = true); /// Deletes all lines void Clear(); - unsigned GetNumLines() const { return static_cast(lines.size()); } + unsigned getNumLines() const { return static_cast(lines.size()); } /// Gibt den index-ten Eintrag zurück - const std::string& GetLine(unsigned index) const { return lines[index].str; } - void SetLine(unsigned index, const std::string& str, unsigned color); + const std::string& getLine(unsigned index) const { return lines[index].str; } + void setLine(unsigned index, const std::string& str, unsigned color); /// Resizes the height such that the given number of lines can be shown - void SetNumVisibleLines(unsigned numLines); + void setNumVisibleLines(unsigned numLines); /// Return the currently used size including padding and the (possible) scrollbar (<=width, <= height) - Extent GetContentSize() const; + Extent getContentSize() const; /// Schaltet Box ein und aus void ShowBackground(bool showBackground) { showBackground_ = showBackground; } /// (Dis-)allows a scrollbar. If scrollbar is disabled, text will be restricted by the current height and succeeding /// lines won't be shown - void SetScrollBarAllowed(bool allowed); + void setScrollBarAllowed(bool allowed); bool msgLeftDown(const MouseCoords& mc) override; bool msgLeftUp(const MouseCoords& mc) override; @@ -61,7 +61,7 @@ class ctrlMultiline : public Window Line(std::string str, unsigned color) : str(std::move(str)), color(color) {} }; - unsigned GetContentWidth() const; + unsigned getContentWidth() const; TextureColor tc_; const glFont* font; diff --git a/libs/s25main/controls/ctrlOptionGroup.cpp b/libs/s25main/controls/ctrlOptionGroup.cpp index 5739e0b687..e9576c7235 100644 --- a/libs/s25main/controls/ctrlOptionGroup.cpp +++ b/libs/s25main/controls/ctrlOptionGroup.cpp @@ -11,38 +11,38 @@ ctrlOptionGroup::ctrlOptionGroup(Window* parent, unsigned id, GroupSelectType se /** * wählt einen Button aus der Gruppe aus. */ -void ctrlOptionGroup::SetSelection(unsigned selection, bool notify) +void ctrlOptionGroup::setSelection(unsigned selection, bool notify) { // Aktuellen ausgewählten Button wieder normal machen if(this->selection_) { - auto* button = GetCtrl(*this->selection_); + auto* button = getCtrl(*this->selection_); RTTR_Assert(button); switch(select_type) { - case GroupSelectType::Illuminate: button->SetIlluminated(false); break; - case GroupSelectType::Check: button->SetChecked(false); break; - case GroupSelectType::Show: button->SetVisible(true); break; + case GroupSelectType::Illuminate: button->setIlluminated(false); break; + case GroupSelectType::Check: button->setChecked(false); break; + case GroupSelectType::Show: button->setVisible(true); break; } } // Neuen Button auswählen - auto* button = GetCtrl(selection); + auto* button = getCtrl(selection); RTTR_Assert(button); switch(select_type) { - case GroupSelectType::Illuminate: button->SetIlluminated(true); break; - case GroupSelectType::Check: button->SetChecked(true); break; - case GroupSelectType::Show: button->SetVisible(false); break; + case GroupSelectType::Illuminate: button->setIlluminated(true); break; + case GroupSelectType::Check: button->setChecked(true); break; + case GroupSelectType::Show: button->setVisible(false); break; } this->selection_ = selection; - if(notify && GetParent()) - GetParent()->msgOptionGroupChange(GetID(), selection); + if(notify && getParent()) + getParent()->msgOptionGroupChange(getID(), selection); } -unsigned ctrlOptionGroup::GetSelection() const +unsigned ctrlOptionGroup::getSelection() const { if(!selection_) throw std::logic_error("No button selected in option group"); @@ -51,7 +51,7 @@ unsigned ctrlOptionGroup::GetSelection() const void ctrlOptionGroup::msgButtonClick(const unsigned ctrl_id) { - SetSelection(ctrl_id, true); + setSelection(ctrl_id, true); } bool ctrlOptionGroup::msgLeftDown(const MouseCoords& mc) diff --git a/libs/s25main/controls/ctrlOptionGroup.h b/libs/s25main/controls/ctrlOptionGroup.h index 7cedbe0929..76c207b5a4 100644 --- a/libs/s25main/controls/ctrlOptionGroup.h +++ b/libs/s25main/controls/ctrlOptionGroup.h @@ -17,11 +17,11 @@ class ctrlOptionGroup : public ctrlGroup ctrlOptionGroup(Window* parent, unsigned id, GroupSelectType select_type); /// Selektiert einen neuen Button - void SetSelection(unsigned selection, bool notify = false); + void setSelection(unsigned selection, bool notify = false); /// Gibt den aktuell selektierten Button zurück - unsigned GetSelection() const; + unsigned getSelection() const; // Gibt einen Button aus der Gruppe zurück zum direkten Bearbeiten - ctrlButton* GetButton(unsigned id) { return GetCtrl(id); } + ctrlButton* getButton(unsigned id) { return getCtrl(id); } void msgButtonClick(unsigned ctrl_id) override; bool msgLeftDown(const MouseCoords& mc) override; diff --git a/libs/s25main/controls/ctrlPercent.cpp b/libs/s25main/controls/ctrlPercent.cpp index feedd99c73..7f8c4d30dd 100644 --- a/libs/s25main/controls/ctrlPercent.cpp +++ b/libs/s25main/controls/ctrlPercent.cpp @@ -36,14 +36,14 @@ void ctrlPercent::Draw_() color = COLOR_0_PERCENT; // Box zeichnen - Draw3D(Rect(GetDrawPos(), GetSize()), tc, false); + Draw3D(Rect(getDrawPos(), getSize()), tc, false); // Fortschritt zeichnen - Extent progSize = GetSize() - Extent(8, 8); + Extent progSize = getSize() - Extent(8, 8); progSize.x = (progSize.x * percentage) / 100; - DrawRectangle(Rect(GetDrawPos() + DrawPoint(4, 4), progSize), color); + DrawRectangle(Rect(getDrawPos() + DrawPoint(4, 4), progSize), color); // Text zeichnen std::string caption = helpers::toString(percentage) + "%"; - font->Draw(GetDrawPos() + DrawPoint(GetSize()) / 2, caption, FontStyle::CENTER | FontStyle::VCENTER, text_color); + font->Draw(getDrawPos() + DrawPoint(getSize()) / 2, caption, FontStyle::CENTER | FontStyle::VCENTER, text_color); } diff --git a/libs/s25main/controls/ctrlPreviewMinimap.cpp b/libs/s25main/controls/ctrlPreviewMinimap.cpp index 93e5d19282..96d0dbce3d 100644 --- a/libs/s25main/controls/ctrlPreviewMinimap.cpp +++ b/libs/s25main/controls/ctrlPreviewMinimap.cpp @@ -12,7 +12,7 @@ ctrlPreviewMinimap::ctrlPreviewMinimap(Window* parent, const unsigned id, const libsiedler2::ArchivItem_Map* s2map) : ctrlMinimap(parent, id, pos, size, Extent(2, 2), Extent(0, 0)), minimap(nullptr) { - SetMap(s2map); + setMap(s2map); } /** @@ -24,13 +24,13 @@ void ctrlPreviewMinimap::Draw_() return; // Button drumrum zeichnen - Draw3DBorder(GetBoundaryRect(), TextureColor::Grey, true); + Draw3DBorder(getBoundaryRect(), TextureColor::Grey, true); // Map ansich zeichnen DrawMap(minimap); const Extent playerPxlSize(4, 4); - const DrawPoint basePos = GetDrawPos(); + const DrawPoint basePos = getDrawPos(); // Startpositionen zeichnen for(const Player& player : players) { @@ -40,27 +40,27 @@ void ctrlPreviewMinimap::Draw_() } } -Rect ctrlPreviewMinimap::GetBoundaryRect() const +Rect ctrlPreviewMinimap::getBoundaryRect() const { - Rect borderRect = Rect::move(GetMapDrawArea(), -DrawPoint(padding)); + Rect borderRect = Rect::move(getMapDrawArea(), -DrawPoint(padding)); borderRect.setSize(borderRect.getSize() + padding * 2u); return borderRect; } -void ctrlPreviewMinimap::SetMap(const libsiedler2::ArchivItem_Map* const s2map) +void ctrlPreviewMinimap::setMap(const libsiedler2::ArchivItem_Map* const s2map) { for(auto& player : players) player.pos = MapPoint::Invalid(); if(!s2map) { - SetMapSize(Extent::all(0)); + setMapSize(Extent::all(0)); return; } const unsigned short map_width = s2map->getHeader().getWidth(); const unsigned short map_height = s2map->getHeader().getHeight(); - SetMapSize(Extent(map_width, map_height)); - minimap.SetMap(*s2map); + setMapSize(Extent(map_width, map_height)); + minimap.setMap(*s2map); // Startpositionen merken for(unsigned short y = 0; y < map_height; ++y) diff --git a/libs/s25main/controls/ctrlPreviewMinimap.h b/libs/s25main/controls/ctrlPreviewMinimap.h index ed963c04bd..b487428e6f 100644 --- a/libs/s25main/controls/ctrlPreviewMinimap.h +++ b/libs/s25main/controls/ctrlPreviewMinimap.h @@ -33,10 +33,10 @@ class ctrlPreviewMinimap : public ctrlMinimap /// Zeichnet die MapPreview void Draw_() override; - Rect GetBoundaryRect() const override; + Rect getBoundaryRect() const override; /// Setzt die (Start-)Farbe eines Spielers bzw. löscht diesen (color = 0) - void SetPlayerColor(unsigned id, unsigned color) { players[id].color = color; } + void setPlayerColor(unsigned id, unsigned color) { players[id].color = color; } - void SetMap(const libsiedler2::ArchivItem_Map* s2map); + void setMap(const libsiedler2::ArchivItem_Map* s2map); }; diff --git a/libs/s25main/controls/ctrlProgress.cpp b/libs/s25main/controls/ctrlProgress.cpp index 0b106db6b5..98a1a0c5c5 100644 --- a/libs/s25main/controls/ctrlProgress.cpp +++ b/libs/s25main/controls/ctrlProgress.cpp @@ -31,9 +31,9 @@ ctrlProgress::ctrlProgress(Window* parent, const unsigned id, const DrawPoint& p } Extent btSize = Extent::all(size.y); - AddImageButton(0, DrawPoint(0, 0), btSize, tc, LOADER.GetImageN(btMinusRes, button_minus), + AddImageButton(0, DrawPoint(0, 0), btSize, tc, LOADER.getImageN(btMinusRes, button_minus), (!button_minus_tooltip.empty() ? button_minus_tooltip : _("Less"))); - AddImageButton(1, DrawPoint(size.x - btSize.x, 0), btSize, tc, LOADER.GetImageN(btPlusRes, button_plus), + AddImageButton(1, DrawPoint(size.x - btSize.x, 0), btSize, tc, LOADER.getImageN(btPlusRes, button_plus), (!button_plus_tooltip.empty() ? button_plus_tooltip : _("More"))); // Hide left and right 3D border by making the buttons overlap the bar @@ -43,7 +43,7 @@ ctrlProgress::ctrlProgress(Window* parent, const unsigned id, const DrawPoint& p /** * setzt die Position an den angegebenen Wert. */ -void ctrlProgress::SetPosition(unsigned short position) +void ctrlProgress::setPosition(unsigned short position) { this->position = std::min(position, maximum); } @@ -55,10 +55,10 @@ void ctrlProgress::SetPosition(unsigned short position) */ void ctrlProgress::Draw_() { - DrawPoint barPos = GetDrawPos() + DrawPoint(padding_); + DrawPoint barPos = getDrawPos() + DrawPoint(padding_); // Offset by button size - barPos.x += GetSize().y; - Extent barSize(CalcBarWidth(), GetSize().y - 2 * padding_.y); + barPos.x += getSize().y; + Extent barSize(CalcBarWidth(), getSize().y - 2 * padding_.y); Draw3D(Rect(barPos, barSize), tc, false); // Buttons @@ -86,10 +86,10 @@ void ctrlProgress::Draw_() } // Leiste - DrawRectangle(Rect(barPos + innerPadding, progress, GetSize().y - 2 * (innerPadding.y + padding_.y)), color); + DrawRectangle(Rect(barPos + innerPadding, progress, getSize().y - 2 * (innerPadding.y + padding_.y)), color); // Prozentzahlen zeichnen - SmallFont->Draw(GetDrawPos() + DrawPoint(GetSize()) / 2, std::to_string(percentage) + "%", + SmallFont->Draw(getDrawPos() + DrawPoint(getSize()) / 2, std::to_string(percentage) + "%", FontStyle::CENTER | FontStyle::VCENTER, COLOR_YELLOW); } @@ -97,17 +97,17 @@ void ctrlProgress::Resize(const Extent& newSize) { Window::Resize(newSize); - auto* lessBt = GetCtrl(0); - auto* moreBt = GetCtrl(1); + auto* lessBt = getCtrl(0); + auto* moreBt = getCtrl(1); Extent btSize(newSize.y, newSize.y); lessBt->Resize(btSize); moreBt->Resize(btSize); - moreBt->SetPos(DrawPoint(newSize.x - btSize.x, 0)); + moreBt->setPos(DrawPoint(newSize.x - btSize.x, 0)); } unsigned ctrlProgress::CalcBarWidth() const { - return GetSize().x - 2 * (padding_.x + GetSize().y); + return getSize().x - 2 * (padding_.x + getSize().y); } void ctrlProgress::msgButtonClick(const unsigned ctrl_id) @@ -118,16 +118,16 @@ void ctrlProgress::msgButtonClick(const unsigned ctrl_id) { if(position) --position; - if(GetParent()) - GetParent()->msgProgressChange(GetID(), position); + if(getParent()) + getParent()->msgProgressChange(getID(), position); } break; case 1: // Plus { if(position < maximum) ++position; - if(GetParent()) - GetParent()->msgProgressChange(GetID(), position); + if(getParent()) + getParent()->msgProgressChange(getID(), position); } break; } @@ -136,15 +136,15 @@ void ctrlProgress::msgButtonClick(const unsigned ctrl_id) bool ctrlProgress::msgLeftDown(const MouseCoords& mc) { // Test if clicked on progress bar - DrawPoint progressOrigin = GetDrawPos() + DrawPoint(padding_) + DrawPoint(GetSize().y + 2, 4); - Extent progressSize = GetSize() - Extent((GetSize().y + 1) * 2, 8) - padding_ * 2u; + DrawPoint progressOrigin = getDrawPos() + DrawPoint(padding_) + DrawPoint(getSize().y + 2, 4); + Extent progressSize = getSize() - Extent((getSize().y + 1) * 2, 8) - padding_ * 2u; if(IsPointInRect(mc.pos, Rect(progressOrigin, progressSize))) { position = helpers::iround(static_cast((mc.pos.x - progressOrigin.x) * maximum) / progressSize.x); - if(GetParent()) - GetParent()->msgProgressChange(GetID(), position); + if(getParent()) + getParent()->msgProgressChange(getID(), position); return true; } else return RelayMouseMessage(&Window::msgLeftDown, mc); @@ -158,7 +158,7 @@ bool ctrlProgress::msgLeftUp(const MouseCoords& mc) bool ctrlProgress::msgWheelUp(const MouseCoords& mc) { // If mouse is over the controls, simulate button click - if(IsPointInRect(mc.pos, GetDrawRect())) + if(IsPointInRect(mc.pos, getDrawRect())) { msgButtonClick(1); return true; @@ -169,7 +169,7 @@ bool ctrlProgress::msgWheelUp(const MouseCoords& mc) bool ctrlProgress::msgWheelDown(const MouseCoords& mc) { // If mouse is over the controls, simulate button click - if(IsPointInRect(mc.pos, GetDrawRect())) + if(IsPointInRect(mc.pos, getDrawRect())) { msgButtonClick(0); return true; @@ -182,16 +182,16 @@ bool ctrlProgress::msgMouseMove(const MouseCoords& mc) // an Buttons weiterleiten RelayMouseMessage(&Window::msgMouseMove, mc); - Extent offset(GetSize().y + padding_.x, 0); - DrawPoint rectOrig = GetDrawPos() + DrawPoint(offset); - Extent rectSize = GetSize() - offset * 2u; + Extent offset(getSize().y + padding_.x, 0); + DrawPoint rectOrig = getDrawPos() + DrawPoint(offset); + Extent rectSize = getSize() - offset * 2u; if(IsPointInRect(mc.pos, Rect(rectOrig, rectSize))) { - WINDOWMANAGER.SetToolTip(this, tooltip_); + WINDOWMANAGER.setToolTip(this, tooltip_); return true; } else { - WINDOWMANAGER.SetToolTip(this, ""); + WINDOWMANAGER.setToolTip(this, ""); return false; } } diff --git a/libs/s25main/controls/ctrlProgress.h b/libs/s25main/controls/ctrlProgress.h index 1d8bbda275..0102c597b3 100644 --- a/libs/s25main/controls/ctrlProgress.h +++ b/libs/s25main/controls/ctrlProgress.h @@ -17,8 +17,8 @@ class ctrlProgress : public Window, public ctrlBaseTooltip const std::string& button_plus_tooltip = "", unsigned short* write_val = nullptr); void Resize(const Extent& newSize) override; - void SetPosition(unsigned short position); - const unsigned short& GetPosition() const { return position; } + void setPosition(unsigned short position); + const unsigned short& getPosition() const { return position; } void msgButtonClick(unsigned ctrl_id) override; bool msgLeftDown(const MouseCoords& mc) override; diff --git a/libs/s25main/controls/ctrlScrollBar.cpp b/libs/s25main/controls/ctrlScrollBar.cpp index 2d8523078c..40ecbadeb8 100644 --- a/libs/s25main/controls/ctrlScrollBar.cpp +++ b/libs/s25main/controls/ctrlScrollBar.cpp @@ -13,11 +13,11 @@ ctrlScrollBar::ctrlScrollBar(Window* parent, unsigned id, const DrawPoint& pos, : Window(parent, id, pos, size), button_height(button_height), tc(tc), pagesize(pagesize), scroll_range(0), scroll_pos(0), scroll_height(0), sliderHeight(0), sliderPos(0), isMouseScrolling(false), last_y(0) { - SetVisible(false); + setVisible(false); - AddImageButton(0, DrawPoint(0, 0), Extent(size.x, button_height), tc, LOADER.GetImageN("io", 33)); + AddImageButton(0, DrawPoint(0, 0), Extent(size.x, button_height), tc, LOADER.getImageN("io", 33)); AddImageButton(1, DrawPoint(0, (size.y > button_height) ? size.y - button_height : 1), - Extent(size.x, button_height), tc, LOADER.GetImageN("io", 34)); + Extent(size.x, button_height), tc, LOADER.getImageN("io", 34)); Resize(size); } @@ -37,7 +37,7 @@ void ctrlScrollBar::Scroll(int distance) { scroll_pos = static_cast(newScrollPos); UpdateSliderFromPos(); - GetParent()->msgScrollChange(GetID(), scroll_pos); + getParent()->msgScrollChange(getID(), scroll_pos); } } @@ -52,12 +52,12 @@ bool ctrlScrollBar::msgLeftUp(const MouseCoords& mc) bool ctrlScrollBar::msgLeftDown(const MouseCoords& mc) { if(IsPointInRect(mc.pos, - Rect(GetDrawPos().x, GetDrawPos().y + button_height + sliderPos, GetSize().x, sliderHeight))) + Rect(getDrawPos().x, getDrawPos().y + button_height + sliderPos, getSize().x, sliderHeight))) { // Maus auf dem Scrollbutton isMouseScrolling = true; return true; - } else if(IsPointInRect(mc.pos, Rect(GetDrawPos().x, GetDrawPos().y + button_height, GetSize().x, sliderPos))) + } else if(IsPointInRect(mc.pos, Rect(getDrawPos().x, getDrawPos().y + button_height, getSize().x, sliderPos))) { // Clicked above slider -> Move half a slider height up if(sliderPos < sliderHeight / 2) @@ -71,8 +71,8 @@ bool ctrlScrollBar::msgLeftDown(const MouseCoords& mc) { unsigned short bottomSliderPos = button_height + sliderPos + sliderHeight; - if(IsPointInRect(mc.pos, Rect(GetDrawPos().x, GetDrawPos().y + bottomSliderPos, GetSize().x, - GetSize().y - (bottomSliderPos + button_height)))) + if(IsPointInRect(mc.pos, Rect(getDrawPos().x, getDrawPos().y + bottomSliderPos, getSize().x, + getSize().y - (bottomSliderPos + button_height)))) { // Clicked below slider -> Move half a slider height down sliderPos += sliderHeight / 2; @@ -124,7 +124,7 @@ void ctrlScrollBar::msgButtonClick(const unsigned ctrl_id) /** * setzt die Scroll-Position. */ -void ctrlScrollBar::SetScrollPos(unsigned short scroll_pos) +void ctrlScrollBar::setScrollPos(unsigned short scroll_pos) { if(this->scroll_pos != scroll_pos) { @@ -136,7 +136,7 @@ void ctrlScrollBar::SetScrollPos(unsigned short scroll_pos) /** * setzt die Scroll-Höhe. */ -void ctrlScrollBar::SetRange(unsigned short scroll_range) +void ctrlScrollBar::setRange(unsigned short scroll_range) { if(this->scroll_range != scroll_range) { @@ -148,7 +148,7 @@ void ctrlScrollBar::SetRange(unsigned short scroll_range) /** * setzt die Seiten-Höhe. */ -void ctrlScrollBar::SetPageSize(unsigned short pagesize) +void ctrlScrollBar::setPageSize(unsigned short pagesize) { if(this->pagesize != pagesize) { @@ -163,17 +163,17 @@ void ctrlScrollBar::Resize(const Extent& newSize) // Up button Extent btSize = Extent(newSize.x, button_height); - GetCtrl(0)->Resize(btSize); + getCtrl(0)->Resize(btSize); // Down button - auto* downButton = GetCtrl(1); + auto* downButton = getCtrl(1); downButton->Resize(btSize); if(newSize.y >= button_height) { - downButton->SetVisible(true); - downButton->SetPos(DrawPoint(0, newSize.y - button_height)); + downButton->setVisible(true); + downButton->setPos(DrawPoint(0, newSize.y - button_height)); } else - downButton->SetVisible(false); + downButton->setVisible(false); RecalculateSizes(); } @@ -188,15 +188,15 @@ void ctrlScrollBar::Draw_() RTTR_Assert(scroll_range > pagesize); // Don't show unneccessary scrollbars, otherwise invariants might be violated. if(scroll_height == 0) return; - DrawPoint pos = GetDrawPos(); + DrawPoint pos = getDrawPos(); // Leiste - Draw3D(Rect(pos + DrawPoint(0, button_height - 2), GetSize().x, GetSize().y - button_height * 2 + 4), tc, false); + Draw3D(Rect(pos + DrawPoint(0, button_height - 2), getSize().x, getSize().y - button_height * 2 + 4), tc, false); // Buttons Window::Draw_(); // Scrollbar - Draw3D(Rect(pos + DrawPoint(0, button_height + sliderPos), GetSize().x, sliderHeight), tc, true); + Draw3D(Rect(pos + DrawPoint(0, button_height + sliderPos), getSize().x, sliderHeight), tc, true); } void ctrlScrollBar::UpdatePosFromSlider() @@ -207,7 +207,7 @@ void ctrlScrollBar::UpdatePosFromSlider() { RTTR_Assert(newScrollPos + pagesize <= scroll_range); // Probably slider to small? scroll_pos = newScrollPos; - GetParent()->msgScrollChange(GetID(), scroll_pos); + getParent()->msgScrollChange(getID(), scroll_pos); } } @@ -224,7 +224,7 @@ void ctrlScrollBar::UpdateSliderFromPos() */ void ctrlScrollBar::RecalculateSizes() { - scroll_height = ((GetSize().y > 2u * button_height) ? GetSize().y - 2u * button_height : 0); + scroll_height = ((getSize().y > 2u * button_height) ? getSize().y - 2u * button_height : 0); if(scroll_range > pagesize) { @@ -232,20 +232,20 @@ void ctrlScrollBar::RecalculateSizes() UpdateSliderFromPos(); - if(!IsVisible()) + if(!isVisible()) { - SetVisible(true); - GetParent()->msgScrollShow(GetID(), IsVisible()); + setVisible(true); + getParent()->msgScrollShow(getID(), isVisible()); } } else { scroll_pos = 0; // nicht nötig, Scrollleiste kann weg - if(IsVisible()) + if(isVisible()) { - SetVisible(false); - GetParent()->msgScrollShow(GetID(), IsVisible()); + setVisible(false); + getParent()->msgScrollShow(getID(), isVisible()); } } } diff --git a/libs/s25main/controls/ctrlScrollBar.h b/libs/s25main/controls/ctrlScrollBar.h index c97663ed2b..95f8034437 100644 --- a/libs/s25main/controls/ctrlScrollBar.h +++ b/libs/s25main/controls/ctrlScrollBar.h @@ -13,12 +13,12 @@ class ctrlScrollBar final : public Window ctrlScrollBar(Window* parent, unsigned id, const DrawPoint& pos, const Extent& size, unsigned short button_height, TextureColor tc, unsigned short pagesize); void Resize(const Extent& newSize) override; - void SetScrollPos(unsigned short scroll_pos); - void SetRange(unsigned short scroll_range); - void SetPageSize(unsigned short pagesize); + void setScrollPos(unsigned short scroll_pos); + void setRange(unsigned short scroll_range); + void setPageSize(unsigned short pagesize); - unsigned short GetPageSize() const { return pagesize; } - unsigned short GetScrollPos() const { return scroll_pos; } + unsigned short getPageSize() const { return pagesize; } + unsigned short getScrollPos() const { return scroll_pos; } /// Scrolls by the given distance (less than 0 = up, else down) void Scroll(int distance); diff --git a/libs/s25main/controls/ctrlTab.cpp b/libs/s25main/controls/ctrlTab.cpp index ed7f539b37..37e9e3c420 100644 --- a/libs/s25main/controls/ctrlTab.cpp +++ b/libs/s25main/controls/ctrlTab.cpp @@ -15,7 +15,7 @@ ctrlTab::ctrlTab(Window* parent, unsigned id, const DrawPoint& pos, unsigned sho void ctrlTab::msgButtonClick(const unsigned ctrl_id) { - SetSelection(ctrl_id, true); + setSelection(ctrl_id, true); } bool ctrlTab::msgLeftDown(const MouseCoords& mc) @@ -54,7 +54,7 @@ ctrlGroup* ctrlTab::AddTab(glArchivItem_Bitmap* image, const std::string& toolti { tabs[tab_count++] = id; ctrlGroup* group = AddGroup(tabs.size() + 1 + id); - group->SetVisible(false); + group->setVisible(false); return group; } @@ -77,43 +77,43 @@ void ctrlTab::DeleteAllTabs() /** * aktiviert eine bestimmte Tabseite. */ -void ctrlTab::SetSelection(unsigned short nr, bool /*notify*/) +void ctrlTab::setSelection(unsigned short nr, bool /*notify*/) { if(nr >= tab_count) return; /// Eltern informieren, dass Tab geändert wurde - GetParent()->msgTabChange(GetID(), tabs[nr]); + getParent()->msgTabChange(getID(), tabs[nr]); // Farbe des alten Buttons ändern ctrlButton* button; - button = GetCtrl(tab_selection); + button = getCtrl(tab_selection); if(button) - button->SetTexture(TextureColor::Red1); + button->setTexture(TextureColor::Red1); // Steuerelemente auf der alten Tabseite ausblenden - GetCtrl(tabs[tab_selection] + tabs.size() + 1)->SetVisible(false); + getCtrl(tabs[tab_selection] + tabs.size() + 1)->setVisible(false); // Umwählen tab_selection = nr; // Farbe des neuen Buttons ändern - button = GetCtrl(tab_selection); + button = getCtrl(tab_selection); if(button) - button->SetTexture(TextureColor::Green1); + button->setTexture(TextureColor::Green1); // Steuerelemente auf der neuen Tabseite einblenden - GetCtrl(tabs[nr] + tabs.size() + 1)->SetVisible(true); + getCtrl(tabs[nr] + tabs.size() + 1)->setVisible(true); } /** * Gibt Tab-Group zurück, über die die Steuerelemente der Tab angesprochen * werden können */ -ctrlGroup* ctrlTab::GetGroup(const unsigned tab_id) +ctrlGroup* ctrlTab::getGroup(const unsigned tab_id) { - return GetCtrl(tabs.size() + 1 + tab_id); + return getCtrl(tabs.size() + 1 + tab_id); } /** @@ -127,85 +127,85 @@ void ctrlTab::Draw_() // TODO: What is this really? int headerSize = tab_count * 36; - LOADER.GetImageN("io", 3)->DrawPart( - Rect(GetDrawPos() + DrawPoint(headerSize, 0), Extent(GetSize().x - headerSize, 45))); + LOADER.getImageN("io", 3)->DrawPart( + Rect(getDrawPos() + DrawPoint(headerSize, 0), Extent(getSize().x - headerSize, 45))); - Draw3D(Rect(GetDrawPos() + DrawPoint(0, 32), Extent(GetSize().x, 13)), TextureColor::Green1, true); + Draw3D(Rect(getDrawPos() + DrawPoint(0, 32), Extent(getSize().x, 13)), TextureColor::Green1, true); - auto* button = GetCtrl(tab_selection); + auto* button = getCtrl(tab_selection); if(button) button->Draw(); } void ctrlTab::msgGroupButtonClick(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->msgGroupButtonClick(this->GetID(), ctrl_id); + getParent()->msgGroupButtonClick(this->getID(), ctrl_id); } void ctrlTab::msgGroupEditEnter(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->msgGroupEditEnter(this->GetID(), ctrl_id); + getParent()->msgGroupEditEnter(this->getID(), ctrl_id); } void ctrlTab::msgGroupEditChange(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->msgGroupEditChange(this->GetID(), ctrl_id); + getParent()->msgGroupEditChange(this->getID(), ctrl_id); } void ctrlTab::msgGroupTabChange(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned short tab_id) { - GetParent()->msgGroupTabChange(this->GetID(), ctrl_id, tab_id); + getParent()->msgGroupTabChange(this->getID(), ctrl_id, tab_id); } void ctrlTab::msgGroupListSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, const int selection) { - GetParent()->msgGroupListSelectItem(this->GetID(), ctrl_id, selection); + getParent()->msgGroupListSelectItem(this->getID(), ctrl_id, selection); } void ctrlTab::msgGroupComboSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned selection) { - GetParent()->msgGroupComboSelectItem(this->GetID(), ctrl_id, selection); + getParent()->msgGroupComboSelectItem(this->getID(), ctrl_id, selection); } void ctrlTab::msgGroupCheckboxChange(const unsigned /*group_id*/, const unsigned ctrl_id, const bool checked) { - GetParent()->msgGroupCheckboxChange(this->GetID(), ctrl_id, checked); + getParent()->msgGroupCheckboxChange(this->getID(), ctrl_id, checked); } void ctrlTab::msgGroupProgressChange(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned short position) { - GetParent()->msgGroupProgressChange(this->GetID(), ctrl_id, position); + getParent()->msgGroupProgressChange(this->getID(), ctrl_id, position); } void ctrlTab::msgGroupScrollShow(const unsigned /*group_id*/, const unsigned ctrl_id, const bool visible) { - GetParent()->msgGroupScrollShow(this->GetID(), ctrl_id, visible); + getParent()->msgGroupScrollShow(this->getID(), ctrl_id, visible); } void ctrlTab::msgGroupOptionGroupChange(const unsigned /*group_id*/, const unsigned ctrl_id, const unsigned selection) { - GetParent()->msgGroupOptionGroupChange(this->GetID(), ctrl_id, selection); + getParent()->msgGroupOptionGroupChange(this->getID(), ctrl_id, selection); } void ctrlTab::msgGroupTimer(const unsigned /*group_id*/, const unsigned ctrl_id) { - GetParent()->msgGroupTimer(this->GetID(), ctrl_id); + getParent()->msgGroupTimer(this->getID(), ctrl_id); } void ctrlTab::msgGroupTableSelectItem(const unsigned /*group_id*/, const unsigned ctrl_id, const std::optional& selection) { - GetParent()->msgGroupTableSelectItem(this->GetID(), ctrl_id, selection); + getParent()->msgGroupTableSelectItem(this->getID(), ctrl_id, selection); } void ctrlTab::msgGroupTableRightButton(const unsigned /*group_id*/, const unsigned ctrl_id, const std::optional& selection) { - GetParent()->msgGroupTableRightButton(this->GetID(), ctrl_id, selection); + getParent()->msgGroupTableRightButton(this->getID(), ctrl_id, selection); } void ctrlTab::msgGroupTableLeftButton(const unsigned /*group_id*/, const unsigned ctrl_id, const std::optional& selection) { - GetParent()->msgGroupTableLeftButton(this->GetID(), ctrl_id, selection); + getParent()->msgGroupTableLeftButton(this->getID(), ctrl_id, selection); } diff --git a/libs/s25main/controls/ctrlTab.h b/libs/s25main/controls/ctrlTab.h index 762a65fdd8..e8c0c125de 100644 --- a/libs/s25main/controls/ctrlTab.h +++ b/libs/s25main/controls/ctrlTab.h @@ -21,13 +21,13 @@ class ctrlTab : public Window /// löscht alle Tabs. void DeleteAllTabs(); /// aktiviert eine bestimmte Tabseite. - void SetSelection(unsigned short nr, bool notify = false); + void setSelection(unsigned short nr, bool notify = false); /// Gibt ID des aktuell gewählten Tabs zurück - unsigned GetCurrentTab() const { return tabs[tab_selection]; } + unsigned getCurrentTab() const { return tabs[tab_selection]; } /// Gibt Tab-Group zurück, über die die Steuerelemente der Tab angesprochen werden können - ctrlGroup* GetGroup(unsigned tab_id); + ctrlGroup* getGroup(unsigned tab_id); /// Gibt aktuell ausgewählte Tab-Gruppe zürck - ctrlGroup* GetCurrentGroup() { return GetGroup(GetCurrentTab()); } + ctrlGroup* getCurrentGroup() { return getGroup(getCurrentTab()); } void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; void msgGroupEditEnter(unsigned group_id, unsigned ctrl_id) override; diff --git a/libs/s25main/controls/ctrlTable.cpp b/libs/s25main/controls/ctrlTable.cpp index e2f2865d82..bc395f3402 100644 --- a/libs/s25main/controls/ctrlTable.cpp +++ b/libs/s25main/controls/ctrlTable.cpp @@ -134,10 +134,10 @@ ctrlTable::ctrlTable(Window* parent, unsigned id, const DrawPoint& pos, const Ex throw std::range_error("Maximum amount of columns exceeded"); header_height = font->getHeight() + 10; - line_count = (GetSize().y - header_height - 2) / font->getHeight(); + line_count = (getSize().y - header_height - 2) / font->getHeight(); // Scrollbar hinzufügen - AddScrollBar(0, DrawPoint(GetSize().x - 20, 0), Extent(20, GetSize().y), 20, tc, line_count); + AddScrollBar(0, DrawPoint(getSize().x - 20, 0), Extent(20, getSize().y), 20, tc, line_count); for(unsigned i = 0; i < columns_.size(); ++i) { @@ -152,32 +152,32 @@ ctrlTable::ctrlTable(Window* parent, unsigned id, const DrawPoint& pos, const Ex */ void ctrlTable::Resize(const Extent& newSize) { - const bool heightIncreased = newSize.y > GetSize().y; + const bool heightIncreased = newSize.y > getSize().y; Window::Resize(newSize); // Make header buttons keep their size for(unsigned i = 1; i <= columns_.size(); ++i) - GetCtrl(i)->SetHeight(header_height); + getCtrl(i)->setHeight(header_height); - auto* scrollbar = GetCtrl(0); + auto* scrollbar = getCtrl(0); // changed height scrollbar->Resize(Extent(20, newSize.y)); - scrollbar->SetPos(DrawPoint(newSize.x - scrollbar->GetSize().x, 0)); + scrollbar->setPos(DrawPoint(newSize.x - scrollbar->getSize().x, 0)); line_count = (newSize.y - header_height - 2) / font->getHeight(); - scrollbar->SetPageSize(line_count); + scrollbar->setPageSize(line_count); // If the size was enlarged we have to check that we don't try to // display more lines than present if(heightIncreased) - while(rows_.size() - scrollbar->GetScrollPos() < line_count && scrollbar->GetScrollPos() > 0) - scrollbar->SetScrollPos(scrollbar->GetScrollPos() - 1); + while(rows_.size() - scrollbar->getScrollPos() < line_count && scrollbar->getScrollPos() > 0) + scrollbar->setScrollPos(scrollbar->getScrollPos() - 1); // changed width ResetButtonWidths(); - if(scrollbar->IsVisible()) + if(scrollbar->isVisible()) msgScrollShow(0, true); } @@ -188,9 +188,9 @@ void ctrlTable::DeleteAllItems() { rows_.clear(); - GetCtrl(0)->SetRange(0); + getCtrl(0)->setRange(0); - SetSelection(std::nullopt); + setSelection(std::nullopt); sortColumn_ = -1; sortDir_ = TableSortDir::Ascending; } @@ -200,7 +200,7 @@ void ctrlTable::DeleteAllItems() * * @param[in] selection Der Auswahlindex */ -void ctrlTable::SetSelection(const std::optional& selection) +void ctrlTable::setSelection(const std::optional& selection) { if(!selection) selection_ = std::nullopt; @@ -210,15 +210,15 @@ void ctrlTable::SetSelection(const std::optional& selection) { selection_ = selection; // Scroll into view - auto* scrollbar = GetCtrl(0); - if(*selection_ < scrollbar->GetScrollPos()) - scrollbar->SetScrollPos(*selection_); - else if(*selection_ >= static_cast(scrollbar->GetScrollPos() + scrollbar->GetPageSize())) - scrollbar->SetScrollPos(*selection_ - scrollbar->GetPageSize() + 1); + auto* scrollbar = getCtrl(0); + if(*selection_ < scrollbar->getScrollPos()) + scrollbar->setScrollPos(*selection_); + else if(*selection_ >= static_cast(scrollbar->getScrollPos() + scrollbar->getPageSize())) + scrollbar->setScrollPos(*selection_ - scrollbar->getPageSize() + 1); } - if(GetParent()) - GetParent()->msgTableSelectItem(GetID(), selection_); + if(getParent()) + getParent()->msgTableSelectItem(getID(), selection_); } void ctrlTable::AddRow(std::vector row) @@ -226,15 +226,15 @@ void ctrlTable::AddRow(std::vector row) // We use unsigned short when handling the row count if(rows_.size() == std::numeric_limits::max()) throw std::range_error("Maximum amount of rows exceeded"); - if(row.size() > GetNumColumns()) + if(row.size() > getNumColumns()) throw std::logic_error("Invalid number of columns for added row"); - for(unsigned i = row.size(); i < GetNumColumns(); ++i) + for(unsigned i = row.size(); i < getNumColumns(); ++i) { row.push_back(""); } rows_.emplace_back(Row{std::move(row)}); - GetCtrl(0)->SetRange(GetNumRows()); + getCtrl(0)->setRange(getNumRows()); } void ctrlTable::RemoveRow(unsigned rowIdx) @@ -242,7 +242,7 @@ void ctrlTable::RemoveRow(unsigned rowIdx) if(rowIdx >= rows_.size()) return; rows_.erase(rows_.begin() + rowIdx); - GetCtrl(0)->SetRange(static_cast(rows_.size())); + getCtrl(0)->setRange(static_cast(rows_.size())); if(selection_ && *selection_ >= rows_.size()) { if(rows_.empty()) @@ -250,7 +250,7 @@ void ctrlTable::RemoveRow(unsigned rowIdx) else selection_ = rows_.size() - 1u; } - SetSelection(selection_); + setSelection(selection_); } /** @@ -261,7 +261,7 @@ void ctrlTable::RemoveRow(unsigned rowIdx) * * @return Text in Feld <@p column,@p row> */ -const std::string& ctrlTable::GetItemText(unsigned short row, unsigned short column) const +const std::string& ctrlTable::getItemText(unsigned short row, unsigned short column) const { static std::string empty; if(row >= rows_.size() || column >= columns_.size()) @@ -283,7 +283,7 @@ void ctrlTable::SortRows(unsigned column, const TableSortDir sortDir) sortDir_ = sortDir; sortColumn_ = column; - if(sortColumn_ >= GetNumColumns()) + if(sortColumn_ >= getNumColumns()) { sortColumn_ = -1; return; @@ -306,22 +306,22 @@ void ctrlTable::SortRows(unsigned column, const TableSortDir sortDir) */ void ctrlTable::Draw_() { - Draw3D(Rect(GetDrawPos(), GetSize()), tc, false); + Draw3D(Rect(getDrawPos(), getSize()), tc, false); Window::Draw_(); const auto lines = static_cast(line_count > rows_.size() ? rows_.size() : line_count); - const auto* scroll = GetCtrl(0); - DrawPoint curPos = GetDrawPos() + DrawPoint(2, 2 + header_height); + const auto* scroll = getCtrl(0); + DrawPoint curPos = getDrawPos() + DrawPoint(2, 2 + header_height); for(unsigned i = 0; i < lines; ++i) { - const unsigned curRow = i + scroll->GetScrollPos(); - RTTR_Assert(curRow < GetNumRows()); + const unsigned curRow = i + scroll->getScrollPos(); + RTTR_Assert(curRow < getNumRows()); const bool isSelected = selection_ == curRow; if(isSelected) { // durchsichtig schwarze Markierung malen - DrawRectangle(Rect(curPos, GetSize().x - 4 - (scroll->IsVisible() ? 24 : 0), font->getHeight()), + DrawRectangle(Rect(curPos, getSize().x - 4 - (scroll->isVisible() ? 24 : 0), font->getHeight()), 0x80000000); } @@ -331,10 +331,10 @@ void ctrlTable::Draw_() if(columns_[c].width == 0) continue; - const auto* bt = GetCtrl(c + 1); + const auto* bt = getCtrl(c + 1); font->Draw(colPos, rows_[curRow].columns[c], FontStyle{}, (isSelected ? 0xFFFFAA00 : COLOR_YELLOW), - bt->GetSize().x, ""); - colPos.x += bt->GetSize().x; + bt->getSize().x, ""); + colPos.x += bt->getSize().x; } curPos.y += font->getHeight(); } @@ -344,34 +344,34 @@ void ctrlTable::msgButtonClick(const unsigned ctrl_id) { RTTR_Assert(ctrl_id > 0); const int column = ctrl_id - 1; - SortRows(column, column == GetSortColumn() && GetSortDirection() == TableSortDir::Ascending ? + SortRows(column, column == getSortColumn() && getSortDirection() == TableSortDir::Ascending ? TableSortDir::Descending : TableSortDir::Ascending); - SetSelection(selection_); + setSelection(selection_); } -Rect ctrlTable::GetContentDrawArea() const +Rect ctrlTable::getContentDrawArea() const { - DrawPoint orig = GetDrawPos(); + DrawPoint orig = getDrawPos(); orig.y += header_height; - Extent size = GetSize() - Extent(20, header_height); + Extent size = getSize() - Extent(20, header_height); return Rect(orig, size); } -Rect ctrlTable::GetFullDrawArea() const +Rect ctrlTable::getFullDrawArea() const { - DrawPoint orig = GetDrawPos() + DrawPoint(2, 2); - Extent size = GetSize() - Extent(2, 4); + DrawPoint orig = getDrawPos() + DrawPoint(2, 2); + Extent size = getSize() - Extent(2, 4); return Rect(orig, size); } bool ctrlTable::msgLeftDown(const MouseCoords& mc) { - if(IsPointInRect(mc.pos, GetContentDrawArea())) + if(IsPointInRect(mc.pos, getContentDrawArea())) { - SetSelection(GetSelectionFromMouse(mc)); - if(GetParent()) - GetParent()->msgTableLeftButton(this->GetID(), selection_); + setSelection(getSelectionFromMouse(mc)); + if(getParent()) + getParent()->msgTableLeftButton(this->getID(), selection_); return true; } else @@ -380,24 +380,24 @@ bool ctrlTable::msgLeftDown(const MouseCoords& mc) bool ctrlTable::msgRightDown(const MouseCoords& mc) { - if(IsPointInRect(mc.pos, GetContentDrawArea())) + if(IsPointInRect(mc.pos, getContentDrawArea())) { - SetSelection(GetSelectionFromMouse(mc)); - if(GetParent()) - GetParent()->msgTableRightButton(this->GetID(), selection_); + setSelection(getSelectionFromMouse(mc)); + if(getParent()) + getParent()->msgTableRightButton(this->getID(), selection_); return true; } else return RelayMouseMessage(&Window::msgRightDown, mc); } -std::optional ctrlTable::GetSelectionFromMouse(const MouseCoords& mc) const +std::optional ctrlTable::getSelectionFromMouse(const MouseCoords& mc) const { - const int visibleItem = (mc.pos.y - GetContentDrawArea().top) / font->getHeight(); + const int visibleItem = (mc.pos.y - getContentDrawArea().top) / font->getHeight(); if(visibleItem < 0) return std::nullopt; - const unsigned itemIdx = static_cast(visibleItem) + GetCtrl(0)->GetScrollPos(); - if(itemIdx >= GetNumRows()) + const unsigned itemIdx = static_cast(visibleItem) + getCtrl(0)->getScrollPos(); + if(itemIdx >= getNumRows()) return std::nullopt; return itemIdx; } @@ -405,9 +405,9 @@ std::optional ctrlTable::GetSelectionFromMouse(const MouseCoords& mc) bool ctrlTable::msgWheelUp(const MouseCoords& mc) { // If mouse in list or scrollbar - if(IsPointInRect(mc.pos, GetFullDrawArea())) + if(IsPointInRect(mc.pos, getFullDrawArea())) { - auto* scrollbar = GetCtrl(0); + auto* scrollbar = getCtrl(0); scrollbar->Scroll(-1); return true; } else @@ -416,9 +416,9 @@ bool ctrlTable::msgWheelUp(const MouseCoords& mc) bool ctrlTable::msgWheelDown(const MouseCoords& mc) { - if(IsPointInRect(mc.pos, GetFullDrawArea())) + if(IsPointInRect(mc.pos, getFullDrawArea())) { - auto* scrollbar = GetCtrl(0); + auto* scrollbar = getCtrl(0); scrollbar->Scroll(+1); return true; } else @@ -427,15 +427,15 @@ bool ctrlTable::msgWheelDown(const MouseCoords& mc) bool ctrlTable::msgLeftUp(const MouseCoords& mc) { - if(IsPointInRect(mc.pos, GetContentDrawArea())) + if(IsPointInRect(mc.pos, getContentDrawArea())) { - if(mc.dbl_click && GetParent()) + if(mc.dbl_click && getParent()) { - const auto oldSelection = GetSelection(); - SetSelection(GetSelectionFromMouse(mc)); + const auto oldSelection = getSelection(); + setSelection(getSelectionFromMouse(mc)); if(selection_ && oldSelection == selection_) { - GetParent()->msgTableChooseItem(this->GetID(), *selection_); + getParent()->msgTableChooseItem(this->getID(), *selection_); return true; } } @@ -458,17 +458,17 @@ void ctrlTable::ResetButtonWidths() { auto addColumnWidth = [](unsigned cur, const Column& c) { return cur + c.width; }; const unsigned sumWidth = std::max(1u, std::accumulate(columns_.begin(), columns_.end(), 0u, addColumnWidth)); - const auto* scrollbar = GetCtrl(0); + const auto* scrollbar = getCtrl(0); const unsigned availableSize = - std::max(0, GetSize().x - (scrollbar->IsVisible() ? scrollbar->GetSize().x : 0)); + std::max(0, getSize().x - (scrollbar->isVisible() ? scrollbar->getSize().x : 0)); const double sizeFactor = static_cast(availableSize) / static_cast(sumWidth); DrawPoint btPos(0, 0); for(unsigned i = 0; i < columns_.size(); ++i) { - auto* button = GetCtrl(i + 1); - button->SetWidth(helpers::iround(columns_[i].width * sizeFactor)); - button->SetPos(btPos); - btPos.x += button->GetSize().x; + auto* button = getCtrl(i + 1); + button->setWidth(helpers::iround(columns_[i].width * sizeFactor)); + button->setPos(btPos); + btPos.x += button->getSize().x; } // Adjust last column size to cater for rounding error @@ -476,8 +476,8 @@ void ctrlTable::ResetButtonWidths() { if(columns_[i - 1].width) { - auto* bt = GetCtrl(i); - bt->SetWidth(std::max(0, static_cast(availableSize) - bt->GetPos().x)); + auto* bt = getCtrl(i); + bt->setWidth(std::max(0, static_cast(availableSize) - bt->getPos().x)); break; } } @@ -490,8 +490,8 @@ bool ctrlTable::msgKeyDown(const KeyEvent& ke) default: return false; case KeyType::Up: if(selection_.value_or(0u) > 0u) - SetSelection(*selection_ - 1); + setSelection(*selection_ - 1); return true; - case KeyType::Down: SetSelection(selection_.value_or(0u) + 1u); return true; + case KeyType::Down: setSelection(selection_.value_or(0u) + 1u); return true; } } diff --git a/libs/s25main/controls/ctrlTable.h b/libs/s25main/controls/ctrlTable.h index 0b0b0ea6bb..6c6413a100 100644 --- a/libs/s25main/controls/ctrlTable.h +++ b/libs/s25main/controls/ctrlTable.h @@ -53,15 +53,15 @@ class ctrlTable : public Window void AddRow(std::vector row); void RemoveRow(unsigned rowIdx); /// liefert den Wert eines Feldes. - const std::string& GetItemText(unsigned short row, unsigned short column) const; + const std::string& getItemText(unsigned short row, unsigned short column) const; /// sortiert die Zeilen. void SortRows(unsigned column, TableSortDir sortDir); - int GetSortColumn() const { return sortColumn_; } - TableSortDir GetSortDirection() const { return sortDir_; } - unsigned short GetNumRows() const { return static_cast(rows_.size()); } - unsigned short GetNumColumns() const { return static_cast(columns_.size()); } - const std::optional& GetSelection() const { return selection_; } - void SetSelection(const std::optional& selection); + int getSortColumn() const { return sortColumn_; } + TableSortDir getSortDirection() const { return sortDir_; } + unsigned short getNumRows() const { return static_cast(rows_.size()); } + unsigned short getNumColumns() const { return static_cast(columns_.size()); } + const std::optional& getSelection() const { return selection_; } + void setSelection(const std::optional& selection); bool msgLeftDown(const MouseCoords& mc) override; bool msgRightDown(const MouseCoords& mc) override; @@ -78,11 +78,11 @@ class ctrlTable : public Window /// Setzt die Breite und Position der Buttons ohne Scrolleiste void ResetButtonWidths(); - std::optional GetSelectionFromMouse(const MouseCoords& mc) const; + std::optional getSelectionFromMouse(const MouseCoords& mc) const; /// Get the area of the content (table itself w/o header) - Rect GetContentDrawArea() const; + Rect getContentDrawArea() const; /// Get the full area (element less spacing) - Rect GetFullDrawArea() const; + Rect getFullDrawArea() const; private: TextureColor tc; diff --git a/libs/s25main/controls/ctrlText.cpp b/libs/s25main/controls/ctrlText.cpp index 6a8e0f2d0d..8f5ce5b1a3 100644 --- a/libs/s25main/controls/ctrlText.cpp +++ b/libs/s25main/controls/ctrlText.cpp @@ -11,12 +11,12 @@ ctrlBaseText::ctrlBaseText(std::string text, const unsigned color, const glFont* : text(std::move(text)), color_(color), font(font) {} -void ctrlBaseText::SetText(const std::string& text) +void ctrlBaseText::setText(const std::string& text) { this->text = text; } -void ctrlBaseText::SetFont(glFont* font) +void ctrlBaseText::setFont(glFont* font) { this->font = font; } @@ -27,13 +27,13 @@ ctrlText::ctrlText(Window* parent, unsigned id, const DrawPoint& pos, const std: maxWidth_(static_cast(-1)) {} -Rect ctrlText::GetBoundaryRect() const +Rect ctrlText::getBoundaryRect() const { if(text.empty()) - return Rect(GetDrawPos(), 0, 0); + return Rect(getDrawPos(), 0, 0); else { - Rect bounds = font->getBounds(GetDrawPos(), text, format_); + Rect bounds = font->getBounds(getDrawPos(), text, format_); if(bounds.getSize().x > maxWidth_) bounds.setSize(Extent(maxWidth_, bounds.getSize().y)); return bounds; @@ -43,5 +43,5 @@ Rect ctrlText::GetBoundaryRect() const void ctrlText::Draw_() { if(!text.empty()) - font->Draw(GetDrawPos(), text, format_, color_, maxWidth_); + font->Draw(getDrawPos(), text, format_, color_, maxWidth_); } diff --git a/libs/s25main/controls/ctrlText.h b/libs/s25main/controls/ctrlText.h index 714aa218d5..a3e4773b3c 100644 --- a/libs/s25main/controls/ctrlText.h +++ b/libs/s25main/controls/ctrlText.h @@ -16,7 +16,7 @@ class ctrlText : public Window, public ctrlBaseText ctrlText(Window* parent, unsigned id, const DrawPoint& pos, const std::string& text, unsigned color, FontStyle format, const glFont* font); - Rect GetBoundaryRect() const override; + Rect getBoundaryRect() const override; void setMaxWidth(unsigned short maxWidth) { maxWidth_ = maxWidth; } protected: diff --git a/libs/s25main/controls/ctrlTextButton.cpp b/libs/s25main/controls/ctrlTextButton.cpp index 84f5957ea0..f0776e80b7 100644 --- a/libs/s25main/controls/ctrlTextButton.cpp +++ b/libs/s25main/controls/ctrlTextButton.cpp @@ -18,7 +18,7 @@ ctrlTextButton::ctrlTextButton(Window* parent, unsigned id, const DrawPoint& pos void ctrlTextButton::ResizeForMaxChars(unsigned numChars) { const auto maxTextWidth = font->getDx() * numChars; - Resize(Extent(maxTextWidth + contentOffset * 2, GetSize().y)); + Resize(Extent(maxTextWidth + contentOffset * 2, getSize().y)); } void ctrlTextButton::DrawContent() const @@ -32,9 +32,9 @@ void ctrlTextButton::DrawContent() const else color = this->color_; - const unsigned short maxTextWidth = GetSize().x - contentOffset * 2; // reduced by border + const unsigned short maxTextWidth = getSize().x - contentOffset * 2; // reduced by border - if(GetTooltip().empty() && state == ButtonState::Hover) + if(getTooltip().empty() && state == ButtonState::Hover) { unsigned maxNumChars; font->getWidth(text, maxTextWidth, &maxNumChars); @@ -43,6 +43,6 @@ void ctrlTextButton::DrawContent() const } const unsigned short offset = isPressed ? contentOffset : 0; - font->Draw(GetDrawPos() + GetSize() / 2u + DrawPoint(offset, offset), text, FontStyle::CENTER | FontStyle::VCENTER, + font->Draw(getDrawPos() + getSize() / 2u + DrawPoint(offset, offset), text, FontStyle::CENTER | FontStyle::VCENTER, color, maxTextWidth); } diff --git a/libs/s25main/controls/ctrlTextDeepening.cpp b/libs/s25main/controls/ctrlTextDeepening.cpp index dcac4f4062..de8e73172a 100644 --- a/libs/s25main/controls/ctrlTextDeepening.cpp +++ b/libs/s25main/controls/ctrlTextDeepening.cpp @@ -11,10 +11,10 @@ ctrlTextDeepening::ctrlTextDeepening(Window* parent, unsigned id, DrawPoint pos, : ctrlDeepening(parent, id, pos, size, tc), ctrlBaseText(text, color, font), style_(style) {} -Rect ctrlTextDeepening::GetBoundaryRect() const +Rect ctrlTextDeepening::getBoundaryRect() const { const Rect txtRect = font->getBounds(CalcTextPos(), text, style_); - const Rect parentRect = ctrlDeepening::GetBoundaryRect(); + const Rect parentRect = ctrlDeepening::getBoundaryRect(); Rect result; result.left = std::min(txtRect.left, parentRect.left); result.top = std::min(txtRect.top, parentRect.top); @@ -25,29 +25,29 @@ Rect ctrlTextDeepening::GetBoundaryRect() const DrawPoint ctrlTextDeepening::CalcTextPos() const { - DrawPoint pos = GetDrawPos(); + DrawPoint pos = getDrawPos(); if(style_.is(FontStyle::CENTER)) - pos.x += GetSize().x / 2; + pos.x += getSize().x / 2; else if(style_.is(FontStyle::LEFT)) pos.x += ctrlTextDeepening::borderSize.x; else - pos.x += GetSize().x - ctrlTextDeepening::borderSize.x; + pos.x += getSize().x - ctrlTextDeepening::borderSize.x; if(style_.is(FontStyle::VCENTER)) - pos.y += GetSize().y / 2; + pos.y += getSize().y / 2; else if(style_.is(FontStyle::TOP)) pos.y += ctrlTextDeepening::borderSize.y; else - pos.y += GetSize().y; + pos.y += getSize().y; return pos; } void ctrlTextDeepening::ResizeForMaxChars(unsigned numChars) { const auto maxTextWidth = font->getDx() * numChars; - Resize(Extent(maxTextWidth + borderSize.x * 2, GetSize().y)); + Resize(Extent(maxTextWidth + borderSize.x * 2, getSize().y)); } void ctrlTextDeepening::DrawContent() const { - font->Draw(CalcTextPos(), text, style_, color_, GetSize().x - 2 * ctrlTextDeepening::borderSize.x); + font->Draw(CalcTextPos(), text, style_, color_, getSize().x - 2 * ctrlTextDeepening::borderSize.x); } diff --git a/libs/s25main/controls/ctrlTextDeepening.h b/libs/s25main/controls/ctrlTextDeepening.h index 2a2d0d6064..d8ac1c7ec6 100644 --- a/libs/s25main/controls/ctrlTextDeepening.h +++ b/libs/s25main/controls/ctrlTextDeepening.h @@ -17,7 +17,7 @@ class ctrlTextDeepening : public ctrlDeepening, public ctrlBaseText const std::string& text, const glFont* font, unsigned color, FontStyle style = FontStyle::CENTER | FontStyle::VCENTER); - Rect GetBoundaryRect() const override; + Rect getBoundaryRect() const override; /// Changes width so at most this many chars can be shown void ResizeForMaxChars(unsigned numChars); diff --git a/libs/s25main/controls/ctrlTimer.cpp b/libs/s25main/controls/ctrlTimer.cpp index 8214323d5d..c7940a2215 100644 --- a/libs/s25main/controls/ctrlTimer.cpp +++ b/libs/s25main/controls/ctrlTimer.cpp @@ -42,6 +42,6 @@ void ctrlTimer::msgPaintBefore() if(timer_.getElapsed() >= timeout_) { timer_.restart(); // Do this first so parent can stop or change duration - GetParent()->msgTimer(GetID()); + getParent()->msgTimer(getID()); } } diff --git a/libs/s25main/controls/ctrlVarDeepening.cpp b/libs/s25main/controls/ctrlVarDeepening.cpp index e86b5f255f..7010577699 100644 --- a/libs/s25main/controls/ctrlVarDeepening.cpp +++ b/libs/s25main/controls/ctrlVarDeepening.cpp @@ -14,5 +14,5 @@ ctrlVarDeepening::ctrlVarDeepening(Window* parent, unsigned id, const DrawPoint& void ctrlVarDeepening::DrawContent() const { - font->Draw(GetDrawPos() + GetSize() / 2, GetFormatedText(), FontStyle::CENTER | FontStyle::VCENTER, color_); + font->Draw(getDrawPos() + getSize() / 2, getFormatedText(), FontStyle::CENTER | FontStyle::VCENTER, color_); } diff --git a/libs/s25main/controls/ctrlVarText.cpp b/libs/s25main/controls/ctrlVarText.cpp index f16a027254..8e74ebd11e 100644 --- a/libs/s25main/controls/ctrlVarText.cpp +++ b/libs/s25main/controls/ctrlVarText.cpp @@ -26,12 +26,12 @@ ctrlVarText::ctrlVarText(Window* parent, unsigned id, const DrawPoint& pos, cons ctrlVarText::~ctrlVarText() = default; -Rect ctrlVarText::GetBoundaryRect() const +Rect ctrlVarText::getBoundaryRect() const { - return font->getBounds(GetDrawPos(), GetFormatedText(), format_); + return font->getBounds(getDrawPos(), getFormatedText(), format_); } void ctrlVarText::Draw_() { - font->Draw(GetDrawPos(), GetFormatedText(), format_, color_); + font->Draw(getDrawPos(), getFormatedText(), format_, color_); } diff --git a/libs/s25main/controls/ctrlVarText.h b/libs/s25main/controls/ctrlVarText.h index c75075aa14..612fc00db8 100644 --- a/libs/s25main/controls/ctrlVarText.h +++ b/libs/s25main/controls/ctrlVarText.h @@ -20,7 +20,7 @@ class ctrlVarText : public Window, public ctrlBaseVarText FontStyle format, const glFont* font, unsigned count, va_list fmtArgs); ~ctrlVarText() override; - Rect GetBoundaryRect() const override; + Rect getBoundaryRect() const override; protected: void Draw_() override; diff --git a/libs/s25main/customborderbuilder.cpp b/libs/s25main/customborderbuilder.cpp index 0487a5746a..b87341ad24 100644 --- a/libs/s25main/customborderbuilder.cpp +++ b/libs/s25main/customborderbuilder.cpp @@ -222,7 +222,7 @@ int CustomBorderBuilder::buildBorder(const Extent& size, std::array::max(); constexpr DrawPoint fpsDisplayPos(800, 0); Desktop::Desktop(glArchivItem_Bitmap* background) - : Window(nullptr, 0, DrawPoint::all(0), VIDEODRIVER.GetRenderSize()), background(background), lastFPS_(0) + : Window(nullptr, 0, DrawPoint::all(0), VIDEODRIVER.getRenderSize()), background(background), lastFPS_(0) { - SetScale(true); - SetFpsDisplay(true); + setScale(true); + setFpsDisplay(true); // By default limit the maximum frame rate to 60 FPS - used for main menu if(SETTINGS.video.framerate < 0) VIDEODRIVER.setTargetFramerate(60); else VIDEODRIVER.setTargetFramerate(SETTINGS.video.framerate); - UpdateFps(VIDEODRIVER.GetFPS()); + UpdateFps(VIDEODRIVER.getFPS()); } Desktop::~Desktop() = default; void Desktop::Draw_() { - unsigned curFPS = VIDEODRIVER.GetFPS(); + unsigned curFPS = VIDEODRIVER.getFPS(); if(curFPS != lastFPS_) UpdateFps(curFPS); if(background) - background->DrawFull(GetDrawRect()); + background->DrawFull(getDrawRect()); Window::Draw_(); } @@ -50,16 +50,16 @@ void Desktop::msgScreenResize(const ScreenResizeEvent& sr) Window::msgScreenResize(sr); // Resize to new screen size Resize(sr.newSize); - auto* fpsDisplay = GetCtrl(fpsDisplayId); + auto* fpsDisplay = getCtrl(fpsDisplayId); if(fpsDisplay) - fpsDisplay->SetPos(Scale(fpsDisplayPos)); + fpsDisplay->setPos(Scale(fpsDisplayPos)); } -void Desktop::SetFpsDisplay(bool show) +void Desktop::setFpsDisplay(bool show) { if(!show) DeleteCtrl(fpsDisplayId); - else if(!GetCtrl(fpsDisplayId) && SmallFont) + else if(!getCtrl(fpsDisplayId) && SmallFont) { AddText(fpsDisplayId, fpsDisplayPos, helpers::toString(lastFPS_) + " fps", COLOR_YELLOW, FontStyle::RIGHT, SmallFont); @@ -68,8 +68,8 @@ void Desktop::SetFpsDisplay(bool show) void Desktop::UpdateFps(unsigned newFps) { - auto* fpsDisplay = GetCtrl(fpsDisplayId); + auto* fpsDisplay = getCtrl(fpsDisplayId); if(fpsDisplay) - fpsDisplay->SetText(helpers::toString(newFps) + " fps"); + fpsDisplay->setText(helpers::toString(newFps) + " fps"); lastFPS_ = newFps; } diff --git a/libs/s25main/desktops/Desktop.h b/libs/s25main/desktops/Desktop.h index 8a1f17b2f5..dee5c6b26f 100644 --- a/libs/s25main/desktops/Desktop.h +++ b/libs/s25main/desktops/Desktop.h @@ -20,7 +20,7 @@ class Desktop : public Window /// Callback when a window was closed virtual void msgWindowClosed(IngameWindow&){}; /// Show or hide the fps - void SetFpsDisplay(bool show); + void setFpsDisplay(bool show); /// ID of the fps display text static const unsigned fpsDisplayId; diff --git a/libs/s25main/desktops/dskBenchmark.cpp b/libs/s25main/desktops/dskBenchmark.cpp index d0b6a3333c..33d5611d4f 100644 --- a/libs/s25main/desktops/dskBenchmark.cpp +++ b/libs/s25main/desktops/dskBenchmark.cpp @@ -96,7 +96,7 @@ bool dskBenchmark::msgKeyDown(const KeyEvent& ke) numInstances_ = (ke.c - '0') * 100; if(numInstances_ == 0) numInstances_ = 1000; - GetCtrl(ID_txtAmount)->SetText("Instances: " + helpers::toString(numInstances_)); + getCtrl(ID_txtAmount)->setText("Instances: " + helpers::toString(numInstances_)); break; } else return dskMenuBase::msgKeyDown(ke); @@ -120,7 +120,7 @@ void dskBenchmark::msgPaintAfter() if(curTest_ != Benchmark::None) { if(frameCtr_.getCurNumFrames() + 1u >= numTestFrames) - VIDEODRIVER.GetRenderer()->synchronize(); + VIDEODRIVER.getRenderer()->synchronize(); frameCtr_.update(); if(frameCtr_.getCurNumFrames() >= numTestFrames) finishTest(); @@ -128,11 +128,11 @@ void dskBenchmark::msgPaintAfter() dskMenuBase::msgPaintAfter(); } -void dskBenchmark::SetActive(bool activate) +void dskBenchmark::setActive(bool activate) { if(!IsActive() && activate) VIDEODRIVER.ResizeScreen(VideoMode(1600, 900), DisplayMode::Windowed); - dskMenuBase::SetActive(activate); + dskMenuBase::setActive(activate); } void dskBenchmark::startTest(Benchmark test) @@ -170,7 +170,7 @@ void dskBenchmark::startTest(Benchmark test) } case Benchmark::Primitives: { - Extent screenSize = VIDEODRIVER.GetRenderSize(); + Extent screenSize = VIDEODRIVER.getRenderSize(); std::uniform_int_distribution distSize(5, 50); std::uniform_int_distribution distClr(0, 0xFF); std::uniform_int_distribution distrMove(10, 50); @@ -208,9 +208,9 @@ void dskBenchmark::startTest(Benchmark test) createGame(); if(!game_) return; - RTTR_FOREACH_PT(MapPoint, game_->world_.GetSize()) + RTTR_FOREACH_PT(MapPoint, game_->world_.getSize()) { - game_->world_.SetVisibility(pt, 0, Visibility::Visible); + game_->world_.setVisibility(pt, 0, Visibility::Visible); } break; case Benchmark::BasicGame: @@ -233,7 +233,7 @@ void dskBenchmark::startTest(Benchmark test) MapLoader::PlaceHQs(game_->world_, hqs); for(unsigned i = 0; i < hqs.size(); i++) { - std::vector pts = game_->world_.GetPointsInRadius(hqs[i], 15); + std::vector pts = game_->world_.getPointsInRadius(hqs[i], 15); std::bernoulli_distribution dist(numInstances_ / 1000.f); std::bernoulli_distribution distEqual; std::array blds = {{BuildingType::Barracks, BuildingType::Mill, BuildingType::IronMine, @@ -243,8 +243,8 @@ void dskBenchmark::startTest(Benchmark test) std::uniform_int_distribution getDir(0, helpers::MaxEnumValue_v); for(MapPoint pt : pts) { - MapPoint flagPt = game_->world_.GetNeighbour(pt, Direction::SouthEast); - if(game_->world_.GetNode(pt).obj || game_->world_.GetNode(flagPt).obj || !dist(rng)) + MapPoint flagPt = game_->world_.getNeighbour(pt, Direction::SouthEast); + if(game_->world_.getNode(pt).obj || game_->world_.getNode(flagPt).obj || !dist(rng)) continue; BuildingType bldType = blds[getBld(rng)]; noBuilding* bld = BuildingFactory::CreateBuilding( @@ -264,8 +264,8 @@ void dskBenchmark::startTest(Benchmark test) } } if(game_) - gameView_ = std::make_unique(game_->world_, VIDEODRIVER.GetRenderSize()); - VIDEODRIVER.GetRenderer()->synchronize(); + gameView_ = std::make_unique(game_->world_, VIDEODRIVER.getRenderSize()); + VIDEODRIVER.getRenderer()->synchronize(); VIDEODRIVER.setTargetFramerate(-1); curTest_ = test; frameCtr_ = FrameCounter(frameCtr_.getUpdateInterval()); @@ -284,17 +284,17 @@ void dskBenchmark::finishTest() testDurations_[curTest_] = duration_cast(testDurations_[curTest_] + frameCtr_.getCurIntervalLength()) / 2; - std::vector ctrls = GetCtrls(); + std::vector ctrls = getCtrls(); for(Window* ctrl : ctrls) { - if(ctrl->GetID() >= ID_first) - DeleteCtrl(ctrl->GetID()); + if(ctrl->getID() >= ID_first) + DeleteCtrl(ctrl->getID()); } rects_.clear(); lines_.clear(); gameView_.reset(); game_.reset(); - SetFpsDisplay(true); + setFpsDisplay(true); VIDEODRIVER.setTargetFramerate(0); if(!runAll_) curTest_ = Benchmark::None; @@ -326,18 +326,18 @@ void dskBenchmark::createGame() GameWorld& world = game_->world_; try { - loadGameData(world.GetDescriptionWriteable()); + loadGameData(world.getDescriptionWriteable()); world.Init(MapExtent(128, 128)); - const WorldDescription& desc = world.GetDescription(); + const WorldDescription& desc = world.getDescription(); DescIdx lastTerrain(0); int lastHeight = 10; std::mt19937 rng(42); using std::uniform_int_distribution; uniform_int_distribution percentage(0, 100); uniform_int_distribution randTerrain(0, desc.terrain.size() / 2); - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - MapNode& node = world.GetNodeWriteable(pt); + MapNode& node = world.getNodeWriteable(pt); DescIdx t; // 90% chance of using the same terrain if(percentage(rng) <= 90) @@ -357,7 +357,7 @@ void dskBenchmark::createGame() node.altitude = lastHeight; } MapLoader::InitShadows(world); - MapLoader::SetMapExplored(world); + MapLoader::setMapExplored(world); GameLoader loader(LOADER, game_); if(!loader.load()) diff --git a/libs/s25main/desktops/dskBenchmark.h b/libs/s25main/desktops/dskBenchmark.h index 61fd506cad..603d4a3b2d 100644 --- a/libs/s25main/desktops/dskBenchmark.h +++ b/libs/s25main/desktops/dskBenchmark.h @@ -49,7 +49,7 @@ class dskBenchmark : public dskMenuBase bool msgKeyDown(const KeyEvent& ke) override; void msgPaintAfter() override; - void SetActive(bool activate) override; + void setActive(bool activate) override; private: Benchmark curTest_; diff --git a/libs/s25main/desktops/dskCampaignMissionSelection.cpp b/libs/s25main/desktops/dskCampaignMissionSelection.cpp index 52a543148c..450b0f65e2 100644 --- a/libs/s25main/desktops/dskCampaignMissionSelection.cpp +++ b/libs/s25main/desktops/dskCampaignMissionSelection.cpp @@ -58,7 +58,7 @@ int getStartOffsetMissionButtonsY() } // namespace dskCampaignMissionSelection::dskCampaignMissionSelection(CreateServerInfo csi, const CampaignDescription& campaign) - : Desktop(LOADER.GetImageN("setup015", 0)), csi_(std::move(csi)), + : Desktop(LOADER.getImageN("setup015", 0)), csi_(std::move(csi)), campaign_(std::make_unique(campaign)), missionsPerPage_(10), currentPage_(0), lastPage_((campaign_->getNumMaps() - 1) / missionsPerPage_) { @@ -75,7 +75,7 @@ dskCampaignMissionSelection::dskCampaignMissionSelection(CreateServerInfo csi, c auto* mapSelection = AddMapSelection(ID_MapSelection, DrawPoint(0, 0), Extent(800, 508), *campaign_->selectionMapData); mapSelection->setMissionsStatus(std::vector(campaign_->getNumMaps(), {true, true})); - btStart->SetEnabled(static_cast(mapSelection->getSelection())); + btStart->setEnabled(static_cast(mapSelection->getSelection())); } else { constexpr Extent buttonSize(22, buttonHeight); @@ -92,16 +92,16 @@ dskCampaignMissionSelection::dskCampaignMissionSelection(CreateServerInfo csi, c // width of one button as space around the label center, 2 buttons per side // |bt|s|bt|s|(bt)|label|(bt)|s|bt|s|bt DrawPoint btPos(pageLabelPos.x - buttonSize.x * 3 - 2 * spacingBetweenButtons, btOffset); - AddImageButton(ID_btFirstPage, btPos, buttonSize, TextureColor::Green2, LOADER.GetImageN("io", 102)); + AddImageButton(ID_btFirstPage, btPos, buttonSize, TextureColor::Green2, LOADER.getImageN("io", 102)); btPos.x += buttonSize.x + spacingBetweenButtons; - AddImageButton(ID_btPrevPage, btPos, buttonSize, TextureColor::Green2, LOADER.GetImageN("io", 103)); + AddImageButton(ID_btPrevPage, btPos, buttonSize, TextureColor::Green2, LOADER.getImageN("io", 103)); AddText(ID_lblPage, pageLabelPos, "0/0", COLOR_YELLOW, FontStyle::CENTER | FontStyle::VCENTER, LargeFont); btPos.x = pageLabelPos.x + buttonSize.x + spacingBetweenButtons; - AddImageButton(ID_btNextPage, btPos, buttonSize, TextureColor::Green2, LOADER.GetImageN("io", 104)); + AddImageButton(ID_btNextPage, btPos, buttonSize, TextureColor::Green2, LOADER.getImageN("io", 104)); btPos.x += buttonSize.x + spacingBetweenButtons; - AddImageButton(ID_btLastPage, btPos, buttonSize, TextureColor::Green2, LOADER.GetImageN("io", 105)); + AddImageButton(ID_btLastPage, btPos, buttonSize, TextureColor::Green2, LOADER.getImageN("io", 105)); AddTextButton(ID_btBack, DrawPoint(300, 560), Extent(200, 22), TextureColor::Red1, _("Back"), NormalFont); @@ -115,14 +115,14 @@ void dskCampaignMissionSelection::UpdateMissionPage() // Hide all groups for(const auto i : helpers::range(lastPage_ + 1)) { - auto* group = GetCtrl(ID_FirstPageGrp + i); + auto* group = getCtrl(ID_FirstPageGrp + i); if(group) - group->SetVisible(false); + group->setVisible(false); } const auto grpIdCurrentPage = ID_FirstPageGrp + currentPage_; - auto* group = GetCtrl(grpIdCurrentPage); + auto* group = getCtrl(grpIdCurrentPage); if(group) - group->SetVisible(true); + group->setVisible(true); else { // Create group (once) @@ -152,7 +152,7 @@ void dskCampaignMissionSelection::UpdateMissionPage() curBtPos.y += missionBtSize.y + distanceBetweenMissionButtonsY; } } - GetCtrl(ID_lblPage)->SetText(std::to_string(currentPage_ + 1) + "/" + std::to_string(lastPage_ + 1)); + getCtrl(ID_lblPage)->setText(std::to_string(currentPage_ + 1) + "/" + std::to_string(lastPage_ + 1)); } void dskCampaignMissionSelection::StartServer(unsigned missionIdx) @@ -174,10 +174,10 @@ void dskCampaignMissionSelection::StartServer(unsigned missionIdx) void dskCampaignMissionSelection::UpdateStateOfNavigationButtons() { - GetCtrl(ID_btFirstPage)->SetEnabled(currentPage_ > 0); - GetCtrl(ID_btPrevPage)->SetEnabled(currentPage_ > 0); - GetCtrl(ID_btNextPage)->SetEnabled(currentPage_ < lastPage_); - GetCtrl(ID_btLastPage)->SetEnabled(currentPage_ < lastPage_); + getCtrl(ID_btFirstPage)->setEnabled(currentPage_ > 0); + getCtrl(ID_btPrevPage)->setEnabled(currentPage_ > 0); + getCtrl(ID_btNextPage)->setEnabled(currentPage_ < lastPage_); + getCtrl(ID_btLastPage)->setEnabled(currentPage_ < lastPage_); } void dskCampaignMissionSelection::msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) @@ -193,14 +193,14 @@ void dskCampaignMissionSelection::msgButtonClick(unsigned ctrl_id) WINDOWMANAGER.Switch(std::make_unique(csi_)); else if(ctrl_id == ID_btStart) { - const auto selectedMission = GetCtrl(ID_MapSelection)->getSelection(); + const auto selectedMission = getCtrl(ID_MapSelection)->getSelection(); if(selectedMission) StartServer(*selectedMission); } else if(ctrl_id == ID_MapSelection) { - auto* btStart = GetCtrl(ID_btStart); - const auto* mapSelection = GetCtrl(ID_MapSelection); - btStart->SetEnabled(static_cast(mapSelection->getSelection())); + auto* btStart = getCtrl(ID_btStart); + const auto* mapSelection = getCtrl(ID_MapSelection); + btStart->setEnabled(static_cast(mapSelection->getSelection())); } else if(ctrl_id >= ID_btFirstPage && ctrl_id <= ID_btLastPage) { switch(ctrl_id) diff --git a/libs/s25main/desktops/dskCampaignSelection.cpp b/libs/s25main/desktops/dskCampaignSelection.cpp index d87d1465ab..3cb9e0a7b5 100644 --- a/libs/s25main/desktops/dskCampaignSelection.cpp +++ b/libs/s25main/desktops/dskCampaignSelection.cpp @@ -62,7 +62,7 @@ int getColumnOffsetY() } // namespace dskCampaignSelection::dskCampaignSelection(CreateServerInfo csi) - : Desktop(LOADER.GetImageN("setup015", 0)), csi_(std::move(csi)) + : Desktop(LOADER.getImageN("setup015", 0)), csi_(std::move(csi)) { AddText(ID_Label, DrawPoint(250, startOffsetY), _("Campaigns"), COLOR_YELLOW, FontStyle::CENTER, LargeFont); @@ -87,7 +87,7 @@ dskCampaignSelection::dskCampaignSelection(CreateServerInfo csi) AddTextButton(ID_btBack, DrawPoint(380, 560), Extent(200, 22), TextureColor::Red1, _("Back"), NormalFont); AddTextButton(ID_Next, DrawPoint(590, 560), Extent(200, 22), TextureColor::Green2, _("Continue"), NormalFont) - ->SetEnabled(false); + ->setEnabled(false); showCampaignInfo(false); @@ -109,24 +109,24 @@ void dskCampaignSelection::msgTableSelectItem(const unsigned ctrl_id, const std: return; DeleteCtrl(ID_MapSelection); // Needs to be either hidden or recreated as it doesn't support updating - auto& btContinue = *GetCtrl(ID_Next); + auto& btContinue = *getCtrl(ID_Next); if(!selection) { - btContinue.SetEnabled(false); + btContinue.setEnabled(false); showCampaignInfo(false); } else { - btContinue.SetEnabled(true); + btContinue.setEnabled(true); showCampaignInfo(true); const auto& campaign = campaigns_.at(*selection); - auto& campaignDescription = *GetCtrl(ID_PreviewDescription); + auto& campaignDescription = *getCtrl(ID_PreviewDescription); campaignDescription.Clear(); campaignDescription.AddString(campaign.longDescription, COLOR_YELLOW); - auto& campaignTitle = *GetCtrl(ID_PreviewTitle); - campaignTitle.SetText(campaign.name); + auto& campaignTitle = *getCtrl(ID_PreviewTitle); + campaignTitle.setText(campaign.name); if(campaign.selectionMapData) { @@ -137,7 +137,7 @@ void dskCampaignSelection::msgTableSelectItem(const unsigned ctrl_id, const std: mapSelection->setMissionsStatus(std::vector(campaign.getNumMaps(), {true, true})); mapSelection->setPreview(true); } else if(campaign.image) - campaignImage_ = LOADER.GetImageN(ResourceId::fromPath(*campaign.image), 0); + campaignImage_ = LOADER.getImageN(ResourceId::fromPath(*campaign.image), 0); else campaignImage_ = nullptr; } @@ -145,15 +145,15 @@ void dskCampaignSelection::msgTableSelectItem(const unsigned ctrl_id, const std: void dskCampaignSelection::showCampaignInfo(const bool show) { - GetCtrl(ID_PreviewDescription)->SetVisible(show); - GetCtrl(ID_PreviewTitle)->SetVisible(show); + getCtrl(ID_PreviewDescription)->setVisible(show); + getCtrl(ID_PreviewTitle)->setVisible(show); if(!show) campaignImage_ = nullptr; } void dskCampaignSelection::showCampaignMissionSelectionScreen() { - const auto& campaign = campaigns_.at(GetCtrl(ID_Table)->GetSelection().value()); + const auto& campaign = campaigns_.at(getCtrl(ID_Table)->getSelection().value()); WINDOWMANAGER.Switch(std::make_unique(csi_, campaign)); } @@ -167,7 +167,7 @@ void dskCampaignSelection::msgButtonClick(unsigned ctrl_id) void dskCampaignSelection::msgTimer(unsigned ctrl_id) { - GetCtrl(ctrl_id)->Stop(); + getCtrl(ctrl_id)->Stop(); loadCampaigns(); std::set resourcesToLoad; for(const auto& campaign : campaigns_) @@ -181,7 +181,7 @@ void dskCampaignSelection::msgTimer(unsigned ctrl_id) void dskCampaignSelection::FillCampaignsTable() { - auto* table = GetCtrl(ID_Table); + auto* table = getCtrl(ID_Table); for(const auto& campaign : campaigns_) { table->AddRow({campaign.name, campaign.shortDescription, campaign.author, std::to_string(campaign.getNumMaps()), diff --git a/libs/s25main/desktops/dskCredits.cpp b/libs/s25main/desktops/dskCredits.cpp index ab36b96c94..dceeee8367 100644 --- a/libs/s25main/desktops/dskCredits.cpp +++ b/libs/s25main/desktops/dskCredits.cpp @@ -41,7 +41,7 @@ enum }; } -dskCredits::dskCredits() : Desktop(LOADER.GetImageN("setup013", 0)), itCurEntry(entries.end()) +dskCredits::dskCredits() : Desktop(LOADER.getImageN("setup013", 0)), itCurEntry(entries.end()) { AddTextButton(ID_btBack, DrawPoint(300, 550), Extent(200, 22), TextureColor::Red1, _("Back"), NormalFont); AddText(ID_txtRttr, DrawPoint(400, 10), _("Return To The Roots"), COLOR_YELLOW, FontStyle::CENTER, LargeFont); @@ -53,51 +53,51 @@ dskCredits::dskCredits() : Desktop(LOADER.GetImageN("setup013", 0)), itCurEntry( LOADER.Load(ResourceId("credits")); // Ignore failure // order by last name (alphabetical) - CreditsEntry entry = CreditsEntry("Alexander Grund (Flamefire):", GetCreditsImgOrDefault("flamefire")); + CreditsEntry entry = CreditsEntry("Alexander Grund (Flamefire):", getCreditsImgOrDefault("flamefire")); entry.lines.push_back(_("Programming")); entry.lines.push_back(_("Quality Assurance")); entries.push_back(entry); - entry = CreditsEntry("Patrick Haak (Demophobie):", GetCreditsImgOrDefault("demophobie")); + entry = CreditsEntry("Patrick Haak (Demophobie):", getCreditsImgOrDefault("demophobie")); entry.lines.push_back(_("Website Administration")); entry.lines.push_back(_("Quality Assurance")); entries.push_back(entry); - entry = CreditsEntry("Jan-Henrik Kluth (jh):", GetCreditsImgOrDefault("jh")); + entry = CreditsEntry("Jan-Henrik Kluth (jh):", getCreditsImgOrDefault("jh")); entry.lines.push_back(_("Programming")); entry.lines.push_back(_("Artificial Intelligence (AI)")); entries.push_back(entry); - entry = CreditsEntry("Christopher Kuehnel (Spikeone):", GetCreditsImgOrDefault("spikeone")); + entry = CreditsEntry("Christopher Kuehnel (Spikeone):", getCreditsImgOrDefault("spikeone")); entry.lines.push_back(_("Additional graphics")); entry.lines.push_back(_("Quality Assurance")); entry.lines.push_back(_("Mapping")); entries.push_back(entry); - entry = CreditsEntry("Stefan Schüchl (Z-Stef):", GetCreditsImgOrDefault("z-stef")); + entry = CreditsEntry("Stefan Schüchl (Z-Stef):", getCreditsImgOrDefault("z-stef")); entry.lines.push_back(_("Website Administration")); entry.lines.push_back(_("Website Programming")); entries.push_back(entry); - entry = CreditsEntry("Marcus Ströbel (Maqs):", GetCreditsImgOrDefault("maqs")); + entry = CreditsEntry("Marcus Ströbel (Maqs):", getCreditsImgOrDefault("maqs")); entry.lines.push_back(_("Programming")); entry.lines.push_back(_("Quality Assurance")); entries.push_back(entry); - entry = CreditsEntry("Jonas Trampe (NastX):", GetCreditsImgOrDefault("nastx")); + entry = CreditsEntry("Jonas Trampe (NastX):", getCreditsImgOrDefault("nastx")); entry.lines.push_back(_("Quality Assurance")); entry.lines.push_back(_("Mapping")); entries.push_back(entry); // founder members - entry = CreditsEntry("Oliver Siebert (Oliverr):", GetCreditsImgOrDefault("oliverr")); + entry = CreditsEntry("Oliver Siebert (Oliverr):", getCreditsImgOrDefault("oliverr")); entry.lines.push_back(_("Project founder")); entry.lines.push_back(_("Project management")); entry.lines.push_back(_("Programming")); entry.lines.push_back(_("Quality Assurance")); entries.push_back(entry); - entry = CreditsEntry("Florian Doersch (FloSoft):", GetCreditsImgOrDefault("flosoft")); + entry = CreditsEntry("Florian Doersch (FloSoft):", getCreditsImgOrDefault("flosoft")); entry.lines.push_back(_("Project founder")); entry.lines.push_back(_("Project management")); entry.lines.push_back(_("Server management")); @@ -351,7 +351,7 @@ void dskCredits::DrawCredit() SetAlpha(COLOR_RED, transparency)); if(itCurEntry->pic) - itCurEntry->pic->DrawFull(DrawPoint(VIDEODRIVER.GetRenderSize().x - 300, 70), + itCurEntry->pic->DrawFull(DrawPoint(VIDEODRIVER.getRenderSize().x - 300, 70), SetAlpha(COLOR_WHITE, transparency)); } @@ -366,14 +366,14 @@ void dskCredits::DrawBobs() using namespace std::chrono_literals; auto bobSpawnInterval = 200ms; - if(VIDEODRIVER.GetFPS() < 30) + if(VIDEODRIVER.getFPS() < 30) bobSpawnInterval = 0ms; - else if(VIDEODRIVER.GetFPS() < 60) + else if(VIDEODRIVER.getFPS() < 60) bobSpawnInterval = 1s; - else if(VIDEODRIVER.GetFPS() < 200) + else if(VIDEODRIVER.getFPS() < 200) bobSpawnInterval = 500ms; - const auto maxNumBos = 50 + VIDEODRIVER.GetRenderSize().x / 2; + const auto maxNumBos = 50 + VIDEODRIVER.getRenderSize().x / 2; // add new bob if(bobSpawnInterval != 0ms && bobSpawnTimer.getElapsed() >= bobSpawnInterval && bobs.size() < maxNumBos) @@ -391,7 +391,7 @@ void dskCredits::DrawBobs() b.direction = libsiedler2::ImgDir::E; } else { - b.pos.x = VIDEODRIVER.GetRenderSize().x; + b.pos.x = VIDEODRIVER.getRenderSize().x; b.direction = libsiedler2::ImgDir::W; } @@ -427,7 +427,7 @@ void dskCredits::DrawBobs() // only native nations are loaded b.id = JOB_SPRITE_CONSTS[job].getBobId(Nation(rand() % NUM_NATIVE_NATIONS)); b.hasWare = false; - b.pos.y = GetCtrl(0)->GetPos().y - 20 - rand() % 150; + b.pos.y = getCtrl(0)->getPos().y - 20 - rand() % 150; bobs.push_back(b); } else { @@ -437,7 +437,7 @@ void dskCredits::DrawBobs() // Japanese shield is missing b.id = rttr::enum_cast((ware == GoodType::ShieldJapanese) ? GoodType::ShieldRomans : ware); b.hasWare = true; - b.pos.y = GetCtrl(0)->GetPos().y - 20 - rand() % 150; + b.pos.y = getCtrl(0)->getPos().y - 20 - rand() % 150; bobs.push_back(b); } } @@ -447,9 +447,9 @@ void dskCredits::DrawBobs() for(const auto& bob : bobs) { if(!bob.hasWare) - LOADER.GetBob("jobs")->Draw(bob.id, bob.direction, bob.isFat, bob.animationStep, bob.pos, bob.color); + LOADER.getBob("jobs")->Draw(bob.id, bob.direction, bob.isFat, bob.animationStep, bob.pos, bob.color); else - LOADER.GetBob("carrier")->Draw(bob.id, bob.direction, bob.isFat, bob.animationStep, bob.pos, bob.color); + LOADER.getBob("carrier")->Draw(bob.id, bob.direction, bob.isFat, bob.animationStep, bob.pos, bob.color); } } @@ -457,7 +457,7 @@ void dskCredits::msgTimer(unsigned timerId) { if(timerId == ID_tmrBobAnim) { - const auto width = static_cast(VIDEODRIVER.GetRenderSize().x); + const auto width = static_cast(VIDEODRIVER.getRenderSize().x); for(auto& bob : bobs) { bob.animationStep++; @@ -487,11 +487,11 @@ bool dskCredits::Close() return true; } -glArchivItem_Bitmap* dskCredits::GetCreditsImgOrDefault(const std::string& name) +glArchivItem_Bitmap* dskCredits::getCreditsImgOrDefault(const std::string& name) { - glArchivItem_Bitmap* result = LOADER.GetImage("credits", name); + glArchivItem_Bitmap* result = LOADER.getImage("credits", name); if(!result) - result = LOADER.GetImage("credits", "default"); + result = LOADER.getImage("credits", "default"); return result; } @@ -524,9 +524,9 @@ void dskCredits::msgMsgBoxResult(unsigned, MsgboxResult) Close(); } -void dskCredits::SetActive(bool active) +void dskCredits::setActive(bool active) { - Desktop::SetActive(active); + Desktop::setActive(active); if(active && !pageTimer->isRunning()) { pageTimer->Start(); diff --git a/libs/s25main/desktops/dskCredits.h b/libs/s25main/desktops/dskCredits.h index f6bb423b25..748ac1c369 100644 --- a/libs/s25main/desktops/dskCredits.h +++ b/libs/s25main/desktops/dskCredits.h @@ -28,7 +28,7 @@ class dskCredits : public Desktop void Draw_() override; void msgButtonClick(unsigned ctrl_id) override; void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult) override; - void SetActive(bool active) override; + void setActive(bool active) override; static bool Close(); private: @@ -37,7 +37,7 @@ class dskCredits : public Desktop void DrawCredit(); void DrawBobs(); - static glArchivItem_Bitmap* GetCreditsImgOrDefault(const std::string& name); + static glArchivItem_Bitmap* getCreditsImgOrDefault(const std::string& name); struct CreditsEntry { diff --git a/libs/s25main/desktops/dskDirectIP.cpp b/libs/s25main/desktops/dskDirectIP.cpp index d833e2ffd3..8f3c83d881 100644 --- a/libs/s25main/desktops/dskDirectIP.cpp +++ b/libs/s25main/desktops/dskDirectIP.cpp @@ -30,7 +30,7 @@ dskDirectIP::dskDirectIP() AddTextButton(ID_btBack, DrawPoint(115, 250), Extent(220, 22), TextureColor::Red1, _("Back"), NormalFont); - AddImage(ID_imgLogo, DrawPoint(20, 20), LOADER.GetImageN("logo", 0)); + AddImage(ID_imgLogo, DrawPoint(20, 20), LOADER.getImageN("logo", 0)); } void dskDirectIP::msgButtonClick(const unsigned ctrl_id) diff --git a/libs/s25main/desktops/dskGameInterface.cpp b/libs/s25main/desktops/dskGameInterface.cpp index 659168ddd1..01fbf55a5a 100644 --- a/libs/s25main/desktops/dskGameInterface.cpp +++ b/libs/s25main/desktops/dskGameInterface.cpp @@ -125,7 +125,7 @@ dskGameInterface::dskGameInterface(std::shared_ptr game, std::shared_ptr(*game_).world_), - gwv(worldViewer, Position(0, 0), VIDEODRIVER.GetRenderSize()), cbb(*LOADER.GetPaletteN("pal5")), + gwv(worldViewer, Position(0, 0), VIDEODRIVER.getRenderSize()), cbb(*LOADER.getPaletteN("pal5")), actionwindow(nullptr), roadwindow(nullptr), minimap(worldViewer), isScrolling(false), cheats_(const_cast(*game_).world_, GAMECLIENT), cheatCommandTracker_(cheats_) { @@ -133,34 +133,34 @@ dskGameInterface::dskGameInterface(std::shared_ptr game, std::shared_ptrSetBorder(false); + AddImageButton(ID_btMap, barPos, btSize, TextureColor::Green1, LOADER.getImageN("io", 50), _("Map")) + ->setBorder(false); barPos.x += btSize.x; - AddImageButton(ID_btOptions, barPos, btSize, TextureColor::Green1, LOADER.GetImageN("io", 192), _("Main selection")) - ->SetBorder(false); + AddImageButton(ID_btOptions, barPos, btSize, TextureColor::Green1, LOADER.getImageN("io", 192), _("Main selection")) + ->setBorder(false); barPos.x += btSize.x; - AddImageButton(ID_btConstructionAid, barPos, btSize, TextureColor::Green1, LOADER.GetImageN("io", 83), + AddImageButton(ID_btConstructionAid, barPos, btSize, TextureColor::Green1, LOADER.getImageN("io", 83), _("Construction aid mode")) - ->SetBorder(false); + ->setBorder(false); barPos.x += btSize.x; - AddImageButton(ID_btPost, barPos, btSize, TextureColor::Green1, LOADER.GetImageN("io", 62), _("Post office")) - ->SetBorder(false); + AddImageButton(ID_btPost, barPos, btSize, TextureColor::Green1, LOADER.getImageN("io", 62), _("Post office")) + ->setBorder(false); barPos += DrawPoint(18, 24); AddText(ID_txtNumMsg, barPos, "", COLOR_YELLOW, FontStyle::CENTER | FontStyle::VCENTER, SmallFont); - const_cast(*game_).world_.SetGameInterface(this); + const_cast(*game_).world_.setGameInterface(this); std::fill(borders.begin(), borders.end(), (glArchivItem_Bitmap*)(nullptr)); - cbb.loadEdges(LOADER.GetArchive("resource")); - cbb.buildBorder(VIDEODRIVER.GetRenderSize(), borders); + cbb.loadEdges(LOADER.getArchive("resource")); + cbb.buildBorder(VIDEODRIVER.getRenderSize(), borders); InitPlayer(); if(initOGL) @@ -172,24 +172,24 @@ dskGameInterface::dskGameInterface(std::shared_ptr game, std::shared_ptr([this](const auto& note) { - if(note.player == worldViewer.GetPlayerId()) + evBld = worldViewer.getWorld().getNotifications().subscribe([this](const auto& note) { + if(note.player == worldViewer.getPlayerId()) this->OnBuildingNote(note); }); - PostBox& postBox = GetPostBox(); + PostBox& postBox = getPostBox(); postBox.ObserveNewMsg([this](const auto& msg, auto msgCt) { this->NewPostMessage(msg, msgCt); }); postBox.ObserveDeletedMsg([this](auto msgCt) { this->PostMessageDeleted(msgCt); }); - UpdatePostIcon(postBox.GetNumMsgs(), true); + UpdatePostIcon(postBox.getNumMsgs(), true); } -PostBox& dskGameInterface::GetPostBox() +PostBox& dskGameInterface::getPostBox() { - PostBox* postBox = worldViewer.GetWorld().GetPostMgr().GetPostBox(worldViewer.GetPlayerId()); + PostBox* postBox = worldViewer.getWorld().getPostMgr().getPostBox(worldViewer.getPlayerId()); if(!postBox) - postBox = &worldViewer.GetWorldNonConst().GetPostMgr().AddPostBox(worldViewer.GetPlayerId()); + postBox = &worldViewer.getWorldNonConst().getPostMgr().AddPostBox(worldViewer.getPlayerId()); RTTR_Assert(postBox != nullptr); return *postBox; } @@ -202,26 +202,26 @@ dskGameInterface::~dskGameInterface() LOBBYCLIENT.RemoveListener(this); } -void dskGameInterface::SetActive(bool activate) +void dskGameInterface::setActive(bool activate) { if(activate == IsActive()) return; if(!activate && isScrolling) { // Stay active if scrolling and no modal window is open - const IngameWindow* wnd = WINDOWMANAGER.GetTopMostWindow(); - if(wnd && wnd->IsModal()) + const IngameWindow* wnd = WINDOWMANAGER.getTopMostWindow(); + if(wnd && wnd->isModal()) StopScrolling(); else return; } - Desktop::SetActive(activate); + Desktop::setActive(activate); // Do this here to allow previous screen to keep control if(activate) { - GAMECLIENT.SetInterface(this); + GAMECLIENT.setInterface(this); LOBBYCLIENT.AddListener(this); - if(!game_->IsStarted()) + if(!game_->isStarted()) { GAMECLIENT.OnGameStart(); @@ -233,24 +233,24 @@ void dskGameInterface::SetActive(bool activate) void dskGameInterface::StopScrolling() { isScrolling = false; - WINDOWMANAGER.SetCursor(road.mode == RoadBuildMode::Disabled ? Cursor::Hand : Cursor::Remove); + WINDOWMANAGER.setCursor(road.mode == RoadBuildMode::Disabled ? Cursor::Hand : Cursor::Remove); } void dskGameInterface::StartScrolling(const Position& mousePos) { startScrollPt = mousePos; isScrolling = true; - WINDOWMANAGER.SetCursor(Cursor::Scroll); + WINDOWMANAGER.setCursor(Cursor::Scroll); } void dskGameInterface::ToggleFoW() { - DisableFoW(!GAMECLIENT.IsReplayFOWDisabled()); + DisableFoW(!GAMECLIENT.isReplayFOWDisabled()); } void dskGameInterface::DisableFoW(const bool hideFOW) { - GAMECLIENT.SetReplayFOW(hideFOW); + GAMECLIENT.setReplayFOW(hideFOW); // Notify viewer and minimap to recalculate the visibility worldViewer.RecalcAllColors(); minimap.UpdateAll(); @@ -263,38 +263,38 @@ void dskGameInterface::ShowPersistentWindowsAfterSwitch() if(windows[CGI_CHAT].isOpen) WINDOWMANAGER.ShowAfterSwitch(std::make_unique(this)); if(windows[CGI_POSTOFFICE].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv, GetPostBox())); + WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv, getPostBox())); if(windows[CGI_DISTRIBUTION].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.GetViewer(), GAMECLIENT)); - if(windows[CGI_BUILDORDER].isOpen && gwv.GetWorld().GetGGS().isEnabled(AddonId::CUSTOM_BUILD_SEQUENCE)) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.GetViewer())); + WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer(), GAMECLIENT)); + if(windows[CGI_BUILDORDER].isOpen && gwv.getWorld().getGGS().isEnabled(AddonId::CUSTOM_BUILD_SEQUENCE)) + WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer())); if(windows[CGI_TRANSPORT].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.GetViewer(), GAMECLIENT)); + WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer(), GAMECLIENT)); if(windows[CGI_MILITARY].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.GetViewer(), GAMECLIENT)); + WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer(), GAMECLIENT)); if(windows[CGI_TOOLS].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.GetViewer(), GAMECLIENT)); + WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer(), GAMECLIENT)); if(windows[CGI_INVENTORY].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.GetViewer().GetPlayer())); + WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer().getPlayer())); if(windows[CGI_MINIMAP].isOpen) WINDOWMANAGER.ShowAfterSwitch(std::make_unique(minimap, gwv)); if(windows[CGI_BUILDINGS].isOpen) WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv, GAMECLIENT)); if(windows[CGI_BUILDINGSPRODUCTIVITY].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.GetViewer().GetPlayer())); + WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer().getPlayer())); if(windows[CGI_MUSICPLAYER].isOpen) WINDOWMANAGER.ShowAfterSwitch(std::make_unique()); if(windows[CGI_STATISTICS].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.GetViewer())); - if(windows[CGI_ECONOMICPROGRESS].isOpen && gwv.GetWorld().getEconHandler()) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.GetViewer())); + WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer())); + if(windows[CGI_ECONOMICPROGRESS].isOpen && gwv.getWorld().getEconHandler()) + WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer())); if(windows[CGI_DIPLOMACY].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.GetViewer(), GAMECLIENT)); + WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer(), GAMECLIENT)); if(windows[CGI_SHIP].isOpen) WINDOWMANAGER.ShowAfterSwitch( - std::make_unique(gwv, GAMECLIENT, gwv.GetViewer().GetPlayer().GetShipByID(0))); + std::make_unique(gwv, GAMECLIENT, gwv.getViewer().getPlayer().getShipByID(0))); if(windows[CGI_MERCHANDISE_STATISTICS].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.GetViewer().GetPlayer())); + WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer().getPlayer())); } void dskGameInterface::Resize(const Extent& newSize) @@ -308,29 +308,29 @@ void dskGameInterface::Resize(const Extent& newSize) // move buttons // Get real renderer size as newSize may get capped but we want to keep the manually drawn borders intact - const Extent realNewSize = VIDEODRIVER.GetRenderSize(); - const glArchivItem_Bitmap& imgButtonBar = *LOADER.GetImageN("resource", 29); + const Extent realNewSize = VIDEODRIVER.getRenderSize(); + const glArchivItem_Bitmap& imgButtonBar = *LOADER.getImageN("resource", 29); DrawPoint barPos = DrawPoint((realNewSize.x - imgButtonBar.getWidth()) / 2, realNewSize.y - imgButtonBar.getHeight()) + btOffset; - auto* button = GetCtrl(ID_btMap); - button->SetPos(barPos); + auto* button = getCtrl(ID_btMap); + button->setPos(barPos); - barPos.x += button->GetSize().x; - button = GetCtrl(ID_btOptions); - button->SetPos(barPos); + barPos.x += button->getSize().x; + button = getCtrl(ID_btOptions); + button->setPos(barPos); - barPos.x += button->GetSize().x; - button = GetCtrl(ID_btConstructionAid); - button->SetPos(barPos); + barPos.x += button->getSize().x; + button = getCtrl(ID_btConstructionAid); + button->setPos(barPos); - barPos.x += button->GetSize().x; - button = GetCtrl(ID_btPost); - button->SetPos(barPos); + barPos.x += button->getSize().x; + button = getCtrl(ID_btPost); + button->setPos(barPos); barPos += DrawPoint(18, 24); - auto* text = GetCtrl(ID_txtNumMsg); - text->SetPos(barPos); + auto* text = getCtrl(ID_txtNumMsg); + text->setPos(barPos); gwv.Resize(newSize); } @@ -342,12 +342,12 @@ void dskGameInterface::msgButtonClick(const unsigned ctrl_id) case ID_btMap: WINDOWMANAGER.ToggleWindow(std::make_unique(minimap, gwv)); break; case ID_btOptions: WINDOWMANAGER.ToggleWindow(std::make_unique(gwv, GAMECLIENT)); break; case ID_btConstructionAid: - if(WINDOWMANAGER.IsDesktopActive()) + if(WINDOWMANAGER.isDesktopActive()) gwv.ToggleShowBQ(); break; case ID_btPost: - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv, GetPostBox())); - UpdatePostIcon(GetPostBox().GetNumMsgs(), false); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv, getPostBox())); + UpdatePostIcon(getPostBox().getNumMsgs(), false); break; } } @@ -361,7 +361,7 @@ void dskGameInterface::msgPaintBefore() /// Padding of the figures const DrawPoint figPadding(12, 12); - const DrawPoint screenSize(VIDEODRIVER.GetRenderSize()); + const DrawPoint screenSize(VIDEODRIVER.getRenderSize()); // Rahmen zeichnen borders[0]->DrawFull(DrawPoint(0, 0)); // oben (mit Ecken) borders[1]->DrawFull(DrawPoint(0, screenSize.y - figPadding.y)); // unten (mit Ecken) @@ -369,16 +369,16 @@ void dskGameInterface::msgPaintBefore() borders[3]->DrawFull(DrawPoint(screenSize.x - figPadding.x, figPadding.y)); // rechts // The figure/statues and the button bar - glArchivItem_Bitmap& imgFigLeftTop = *LOADER.GetImageN("resource", 17); - glArchivItem_Bitmap& imgFigRightTop = *LOADER.GetImageN("resource", 18); - glArchivItem_Bitmap& imgFigLeftBot = *LOADER.GetImageN("resource", 19); - glArchivItem_Bitmap& imgFigRightBot = *LOADER.GetImageN("resource", 20); + glArchivItem_Bitmap& imgFigLeftTop = *LOADER.getImageN("resource", 17); + glArchivItem_Bitmap& imgFigRightTop = *LOADER.getImageN("resource", 18); + glArchivItem_Bitmap& imgFigLeftBot = *LOADER.getImageN("resource", 19); + glArchivItem_Bitmap& imgFigRightBot = *LOADER.getImageN("resource", 20); imgFigLeftTop.DrawFull(figPadding); imgFigRightTop.DrawFull(DrawPoint(screenSize.x - figPadding.x - imgFigRightTop.getWidth(), figPadding.y)); imgFigLeftBot.DrawFull(DrawPoint(figPadding.x, screenSize.y - figPadding.y - imgFigLeftBot.getHeight())); - imgFigRightBot.DrawFull(screenSize - figPadding - imgFigRightBot.GetSize()); + imgFigRightBot.DrawFull(screenSize - figPadding - imgFigRightBot.getSize()); - glArchivItem_Bitmap& imgButtonBar = *LOADER.GetImageN("resource", 29); + glArchivItem_Bitmap& imgButtonBar = *LOADER.getImageN("resource", 29); imgButtonBar.DrawFull( DrawPoint((screenSize.x - imgButtonBar.getWidth()) / 2, screenSize.y - imgButtonBar.getHeight())); } @@ -387,34 +387,34 @@ void dskGameInterface::msgPaintAfter() { Desktop::msgPaintAfter(); - const GameWorldBase& world = worldViewer.GetWorld(); + const GameWorldBase& world = worldViewer.getWorld(); if(SETTINGS.global.showGFInfo) { std::array nwf_string; - const auto gfLenMs = static_cast(GAMECLIENT.GetGFLength() / 1ms); - const auto nwfLenMs = static_cast((GAMECLIENT.GetNWFLength() * GAMECLIENT.GetGFLength()) / 1ms); - if(GAMECLIENT.IsReplayModeOn()) + const auto gfLenMs = static_cast(GAMECLIENT.getGFLength() / 1ms); + const auto nwfLenMs = static_cast((GAMECLIENT.getNWFLength() * GAMECLIENT.getGFLength()) / 1ms); + if(GAMECLIENT.isReplayModeOn()) { snprintf(nwf_string.data(), nwf_string.size(), _("(Replay-Mode) Current GF: %u (End at: %u) / GF length: %u ms / NWF length: %u gf (%u ms)"), - world.GetEvMgr().GetCurrentGF(), GAMECLIENT.GetLastReplayGF(), gfLenMs, GAMECLIENT.GetNWFLength(), + world.getEvMgr().getCurrentGF(), GAMECLIENT.getLastReplayGF(), gfLenMs, GAMECLIENT.getNWFLength(), nwfLenMs); } else { snprintf(nwf_string.data(), nwf_string.size(), _("Current GF: %u / GF length: %u ms / NWF length: %u gf (%u ms) / Ping: %u ms"), - world.GetEvMgr().GetCurrentGF(), gfLenMs, GAMECLIENT.GetNWFLength(), nwfLenMs, - worldViewer.GetPlayer().ping); + world.getEvMgr().getCurrentGF(), gfLenMs, GAMECLIENT.getNWFLength(), nwfLenMs, + worldViewer.getPlayer().ping); } NormalFont->Draw(DrawPoint(30, 1), nwf_string.data(), FontStyle{}, COLOR_YELLOW); } // tournament mode? - const unsigned tournamentDuration = GAMECLIENT.GetTournamentModeDuration(); + const unsigned tournamentDuration = GAMECLIENT.getTournamentModeDuration(); if(tournamentDuration) { - unsigned curGF = world.GetEvMgr().GetCurrentGF(); + unsigned curGF = world.getEvMgr().getCurrentGF(); std::string tournamentNotice; if(curGF >= tournamentDuration) tournamentNotice = _("Tournament finished"); @@ -423,68 +423,68 @@ void dskGameInterface::msgPaintAfter() tournamentNotice = helpers::format("Tournament mode: %1% remaining", GAMECLIENT.FormatGFTime(tournamentDuration - curGF)); } - NormalFont->Draw(DrawPoint(VIDEODRIVER.GetRenderSize().x - 30, 1), tournamentNotice, FontStyle::AlignH::RIGHT, + NormalFont->Draw(DrawPoint(VIDEODRIVER.getRenderSize().x - 30, 1), tournamentNotice, FontStyle::AlignH::RIGHT, COLOR_YELLOW); } // Replaydateianzeige in der linken unteren Ecke - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) { - NormalFont->Draw(DrawPoint(0, VIDEODRIVER.GetRenderSize().y), GAMECLIENT.GetReplayFilename().string(), + NormalFont->Draw(DrawPoint(0, VIDEODRIVER.getRenderSize().y), GAMECLIENT.getReplayFilename().string(), FontStyle::BOTTOM, COLOR_YELLOW); } else { // Laggende Spieler anzeigen in Form von Schnecken - DrawPoint snailPos(VIDEODRIVER.GetRenderSize().x - 70, 35); + DrawPoint snailPos(VIDEODRIVER.getRenderSize().x - 70, 35); for(const NWFPlayerInfo& player : nwfInfo_->getPlayerInfos()) { if(player.isLagging) { - LOADER.GetPlayerImage("rttr", 0)->DrawFull(Rect(snailPos, 30, 30), COLOR_WHITE, - game_->world_.GetPlayer(player.id).color); + LOADER.getPlayerImage("rttr", 0)->DrawFull(Rect(snailPos, 30, 30), COLOR_WHITE, + game_->world_.getPlayer(player.id).color); snailPos.x -= 40; } } } // Show icons in the upper right corner of the game interface - DrawPoint iconPos(VIDEODRIVER.GetRenderSize().x - 56, 32); + DrawPoint iconPos(VIDEODRIVER.getRenderSize().x - 56, 32); // Draw cheating indicator icon (WINTER) if(cheats_.isCheatModeOn()) { - glArchivItem_Bitmap* cheatingImg = LOADER.GetImageN("io", 75); + glArchivItem_Bitmap* cheatingImg = LOADER.getImageN("io", 75); cheatingImg->DrawFull(iconPos); iconPos -= DrawPoint(cheatingImg->getWidth() + 6, 0); } // Draw speed indicator icon - const int speedStep = static_cast(REFERENCE_SPEED / 10ms) - static_cast(GAMECLIENT.GetGFLength() / 10ms); + const int speedStep = static_cast(REFERENCE_SPEED / 10ms) - static_cast(GAMECLIENT.getGFLength() / 10ms); if(speedStep != 0) { - glArchivItem_Bitmap* runnerImg = LOADER.GetImageN("io", 164); + glArchivItem_Bitmap* runnerImg = LOADER.getImageN("io", 164); runnerImg->DrawFull(iconPos); if(speedStep != 1) { std::string multiplier = helpers::toString(std::abs(speedStep)); - NormalFont->Draw(iconPos - runnerImg->GetOrigin() + DrawPoint(19, 6), multiplier, FontStyle::LEFT, + NormalFont->Draw(iconPos - runnerImg->getOrigin() + DrawPoint(19, 6), multiplier, FontStyle::LEFT, speedStep > 0 ? COLOR_YELLOW : COLOR_RED); } iconPos -= DrawPoint(runnerImg->getWidth() + 4, 0); } // Draw zoom level indicator icon - if(gwv.GetCurrentTargetZoomFactor() != 1.f) //-V550 + if(gwv.getCurrentTargetZoomFactor() != 1.f) //-V550 { - glArchivItem_Bitmap* magnifierImg = LOADER.GetImageN("io", 36); + glArchivItem_Bitmap* magnifierImg = LOADER.getImageN("io", 36); magnifierImg->DrawFull(iconPos); - std::string zoom_percent = helpers::toString((int)(gwv.GetCurrentTargetZoomFactor() * 100)) + "%"; - NormalFont->Draw(iconPos - magnifierImg->GetOrigin() + DrawPoint(9, 7), zoom_percent, FontStyle::CENTER, + std::string zoom_percent = helpers::toString((int)(gwv.getCurrentTargetZoomFactor() * 100)) + "%"; + NormalFont->Draw(iconPos - magnifierImg->getOrigin() + DrawPoint(9, 7), zoom_percent, FontStyle::CENTER, COLOR_YELLOW); iconPos -= DrawPoint(magnifierImg->getWidth() + 4, 0); } @@ -496,7 +496,7 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) if(road.mode != RoadBuildMode::Disabled) { // in "richtige" Map-Koordinaten Konvertieren, den aktuellen selektierten Punkt - const MapPoint selPt = gwv.GetSelectedPt(); + const MapPoint selPt = gwv.getSelectedPt(); if(selPt == road.point) { @@ -508,8 +508,8 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) WINDOWMANAGER.Close((unsigned)CGI_ROADWINDOW); // Ist das ein gültiger neuer Wegpunkt? - if(worldViewer.IsRoadAvailable(road.mode == RoadBuildMode::Boat, selPt) - && worldViewer.IsPlayerTerritory(selPt)) + if(worldViewer.isRoadAvailable(road.mode == RoadBuildMode::Boat, selPt) + && worldViewer.isPlayerTerritory(selPt)) { MapPoint targetPt = selPt; if(!BuildRoadPart(targetPt)) @@ -517,7 +517,7 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) } else if(worldViewer.GetBQ(selPt) != BuildingQuality::Nothing) { // Wurde bereits auf das gebaute Stück geklickt? - unsigned idOnRoad = GetIdInCurBuildRoad(selPt); + unsigned idOnRoad = getIdInCurBuildRoad(selPt); if(idOnRoad) DemolishRoad(idOnRoad); else @@ -533,7 +533,7 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) } } // Wurde auf eine Flagge geklickt und ist diese Flagge nicht der Weganfangspunkt? - else if(worldViewer.GetWorld().GetNO(selPt)->GetType() == NodalObjectType::Flag && selPt != road.start) + else if(worldViewer.getWorld().getNO(selPt)->getType() == NodalObjectType::Flag && selPt != road.start) { MapPoint targetPt = selPt; if(BuildRoadPart(targetPt)) @@ -544,7 +544,7 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) ShowRoadWindow(mc.pos); } else { - unsigned tbr = GetIdInCurBuildRoad(selPt); + unsigned tbr = getIdInCurBuildRoad(selPt); // Wurde bereits auf das gebaute Stück geklickt? if(tbr) DemolishRoad(tbr); @@ -558,61 +558,61 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) iwAction::Tabs action_tabs; - const MapPoint cSel = gwv.GetSelectedPt(); + const MapPoint cSel = gwv.getSelectedPt(); // Vielleicht steht hier auch ein Schiff? - if(const noShip* ship = worldViewer.GetShip(cSel)) + if(const noShip* ship = worldViewer.getShip(cSel)) { WINDOWMANAGER.Show(std::make_unique(gwv, GAMECLIENT, ship)); return true; } // Evtl ists nen Haus? (unser Haus) - const noBase& selObj = *worldViewer.GetWorld().GetNO(cSel); - if(selObj.GetType() == NodalObjectType::Building && worldViewer.IsOwner(cSel)) + const noBase& selObj = *worldViewer.getWorld().getNO(cSel); + if(selObj.getType() == NodalObjectType::Building && worldViewer.isOwner(cSel)) { if(auto* wnd = WINDOWMANAGER.FindNonModalWindow(CGI_BUILDING + MapBase::CreateGUIID(cSel))) { - WINDOWMANAGER.SetActiveWindow(*wnd); + WINDOWMANAGER.setActiveWindow(*wnd); return true; } - BuildingType bt = static_cast(selObj).GetBuildingType(); + BuildingType bt = static_cast(selObj).getBuildingType(); // HQ if(bt == BuildingType::Headquarters) WINDOWMANAGER.Show( - std::make_unique(gwv, GAMECLIENT, worldViewer.GetWorldNonConst().GetSpecObj(cSel))); + std::make_unique(gwv, GAMECLIENT, worldViewer.getWorldNonConst().getSpecObj(cSel))); // Lagerhäuser else if(bt == BuildingType::Storehouse) WINDOWMANAGER.Show(std::make_unique( - gwv, GAMECLIENT, worldViewer.GetWorldNonConst().GetSpecObj(cSel))); + gwv, GAMECLIENT, worldViewer.getWorldNonConst().getSpecObj(cSel))); // Hafengebäude else if(bt == BuildingType::HarborBuilding) WINDOWMANAGER.Show(std::make_unique( - gwv, GAMECLIENT, worldViewer.GetWorldNonConst().GetSpecObj(cSel))); + gwv, GAMECLIENT, worldViewer.getWorldNonConst().getSpecObj(cSel))); // Militärgebäude - else if(BuildingProperties::IsMilitary(bt)) + else if(BuildingProperties::isMilitary(bt)) WINDOWMANAGER.Show(std::make_unique( - gwv, GAMECLIENT, worldViewer.GetWorldNonConst().GetSpecObj(cSel))); + gwv, GAMECLIENT, worldViewer.getWorldNonConst().getSpecObj(cSel))); else if(bt == BuildingType::Temple) WINDOWMANAGER.Show(std::make_unique( - gwv, GAMECLIENT, worldViewer.GetWorldNonConst().GetSpecObj(cSel))); + gwv, GAMECLIENT, worldViewer.getWorldNonConst().getSpecObj(cSel))); else WINDOWMANAGER.Show(std::make_unique( - gwv, GAMECLIENT, worldViewer.GetWorldNonConst().GetSpecObj(cSel))); + gwv, GAMECLIENT, worldViewer.getWorldNonConst().getSpecObj(cSel))); return true; } // oder vielleicht eine Baustelle? - else if(selObj.GetType() == NodalObjectType::Buildingsite && worldViewer.IsOwner(cSel)) + else if(selObj.getType() == NodalObjectType::Buildingsite && worldViewer.isOwner(cSel)) { if(!WINDOWMANAGER.FindNonModalWindow(CGI_BUILDING + MapBase::CreateGUIID(cSel))) WINDOWMANAGER.Show( - std::make_unique(gwv, worldViewer.GetWorld().GetSpecObj(cSel))); + std::make_unique(gwv, worldViewer.getWorld().getSpecObj(cSel))); return true; } action_tabs.watch = true; // Unser Land - if(worldViewer.IsOwner(cSel)) + if(worldViewer.isOwner(cSel)) { const BuildingQuality bq = worldViewer.GetBQ(cSel); // Kann hier was gebaut werden? @@ -631,24 +631,24 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) default: break; } - if(!worldViewer.GetWorld().IsFlagAround(cSel)) + if(!worldViewer.getWorld().isFlagAround(cSel)) action_tabs.setflag = true; // Prüfen, ob sich Militärgebäude in der Nähe befinden, wenn nein, können auch eigene // Militärgebäude gebaut werden enable_military_buildings = - !worldViewer.GetWorld().IsMilitaryBuildingNearNode(cSel, worldViewer.GetPlayerId()); + !worldViewer.getWorld().isMilitaryBuildingNearNode(cSel, worldViewer.getPlayerId()); } else if(bq == BuildingQuality::Flag) action_tabs.setflag = true; - else if(selObj.GetType() == NodalObjectType::Flag) + else if(selObj.getType() == NodalObjectType::Flag) action_tabs.flag = true; - if(selObj.GetType() != NodalObjectType::Flag && selObj.GetType() != NodalObjectType::Building) + if(selObj.getType() != NodalObjectType::Flag && selObj.getType() != NodalObjectType::Building) { // Check if there are roads for(const Direction dir : helpers::EnumRange{}) { - const PointRoad curRoad = worldViewer.GetVisiblePointRoad(cSel, dir); + const PointRoad curRoad = worldViewer.getVisiblePointRoad(cSel, dir); if(curRoad != PointRoad::None) { action_tabs.cutroad = true; @@ -658,18 +658,18 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) } } // evtl ists ein feindliches Militärgebäude, welches NICHT im Nebel liegt? - else if(worldViewer.GetVisibility(cSel) == Visibility::Visible) + else if(worldViewer.getVisibility(cSel) == Visibility::Visible) { - if(selObj.GetType() == NodalObjectType::Building) + if(selObj.getType() == NodalObjectType::Building) { - const auto* building = worldViewer.GetWorld().GetSpecObj(cSel); //-V807 - BuildingType bt = building->GetBuildingType(); + const auto* building = worldViewer.getWorld().getSpecObj(cSel); //-V807 + BuildingType bt = building->getBuildingType(); // Only if trade is enabled - if(worldViewer.GetWorld().GetGGS().isEnabled(AddonId::TRADE)) + if(worldViewer.getWorld().getGGS().isEnabled(AddonId::TRADE)) { // Allied warehouse? -> Show trade window - if(BuildingProperties::IsWareHouse(bt) && worldViewer.GetPlayer().IsAlly(building->GetPlayer())) + if(BuildingProperties::isWareHouse(bt) && worldViewer.getPlayer().isAlly(building->getPlayer())) { WINDOWMANAGER.Show(std::make_unique(*static_cast(building), worldViewer, GAMECLIENT)); @@ -678,17 +678,17 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) } // Ist es ein gewöhnliches Militärgebäude? - if(BuildingProperties::IsMilitary(bt)) + if(BuildingProperties::isMilitary(bt)) { // Dann darf es nicht neu gebaut sein! - if(!static_cast(building)->IsNewBuilt()) + if(!static_cast(building)->isNewBuilt()) action_tabs.attack = true; } // oder ein HQ oder Hafen? else if(bt == BuildingType::Headquarters || bt == BuildingType::HarborBuilding) action_tabs.attack = true; action_tabs.sea_attack = - action_tabs.attack && worldViewer.GetWorld().GetGGS().isEnabled(AddonId::SEA_ATTACK); + action_tabs.attack && worldViewer.getWorld().getGGS().isEnabled(AddonId::SEA_ATTACK); } } @@ -696,7 +696,7 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) // aktuelle Mausposition merken, da diese durch das Schließen verändert werden kann if(actionwindow) actionwindow->Close(); - VIDEODRIVER.SetMousePos(mc.pos); + VIDEODRIVER.setMousePos(mc.pos); ShowActionWindow(action_tabs, cSel, mc.pos, enable_military_buildings); } @@ -706,17 +706,17 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) bool dskGameInterface::msgLeftDown(const MouseCoords& mc) { - const glArchivItem_Bitmap& imgButtonBar = *LOADER.GetImageN("resource", 29); - const auto btOrig = DrawPoint(VIDEODRIVER.GetRenderSize().x / 2 - imgButtonBar.getWidth() / 2, - VIDEODRIVER.GetRenderSize().y - imgButtonBar.getHeight()) + const glArchivItem_Bitmap& imgButtonBar = *LOADER.getImageN("resource", 29); + const auto btOrig = DrawPoint(VIDEODRIVER.getRenderSize().x / 2 - imgButtonBar.getWidth() / 2, + VIDEODRIVER.getRenderSize().y - imgButtonBar.getHeight()) + btOffset; if(IsPointInRect(mc.pos, Rect(btOrig, btSize * 4u))) return false; - if(!VIDEODRIVER.IsTouch()) + if(!VIDEODRIVER.isTouch()) { // Start scrolling also on Ctrl + left click - if(VIDEODRIVER.GetModKeyState().ctrl) + if(VIDEODRIVER.getModKeyState().ctrl) { msgRightDown(mc); return true; @@ -726,7 +726,7 @@ bool dskGameInterface::msgLeftDown(const MouseCoords& mc) return ContextClick(mc); } else if(mc.num_tfingers < 2) - touchDuration = VIDEODRIVER.GetTickCount(); + touchDuration = VIDEODRIVER.getTickCount(); else if(isScrolling) // 2 fingers down -> zoom mode. Do not click or scroll map StopScrolling(); @@ -743,7 +743,7 @@ bool dskGameInterface::msgLeftUp(const MouseCoords& mc) // num_tfingers is reduced after this function to check if it's still a touch event // Was touch duration short enough to trigger conext click? - if(mc.num_tfingers == 1 && (VIDEODRIVER.GetTickCount() - touchDuration) < TOUCH_MAX_CLICK_INTERVAL) + if(mc.num_tfingers == 1 && (VIDEODRIVER.getTickCount() - touchDuration) < TOUCH_MAX_CLICK_INTERVAL) return ContextClick(mc); return false; @@ -772,7 +772,7 @@ bool dskGameInterface::msgMouseMove(const MouseCoords& mc) acceleration = -acceleration; gwv.MoveBy((mc.pos - startScrollPt) * acceleration); - VIDEODRIVER.SetMousePos(startScrollPt); + VIDEODRIVER.setMousePos(startScrollPt); if(!SETTINGS.global.smartCursor) startScrollPt = mc.pos; @@ -826,10 +826,10 @@ bool dskGameInterface::msgKeyDown(const KeyEvent& ke) return true; case KeyType::F3: // Map debug window { - const bool replayMode = GAMECLIENT.IsReplayModeOn(); + const bool replayMode = GAMECLIENT.isReplayModeOn(); if(replayMode) DisableFoW(true); - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv, game_->world_.IsSinglePlayer() || replayMode)); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv, game_->world_.isSinglePlayer() || replayMode)); return true; } case KeyType::F8: @@ -843,18 +843,18 @@ bool dskGameInterface::msgKeyDown(const KeyEvent& ke) WINDOWMANAGER.ToggleWindow(std::make_unique()); return true; case KeyType::F12: // Ingame options - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.GetSoundMgr())); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getSoundMgr())); return true; } switch(ke.c) { case '+': - if(GAMECLIENT.IsReplayModeOn() || game_->world_.IsSinglePlayer()) + if(GAMECLIENT.isReplayModeOn() || game_->world_.isSinglePlayer()) GAMECLIENT.IncreaseSpeed(); return true; case '-': - if(GAMECLIENT.IsReplayModeOn() || game_->world_.IsSinglePlayer()) + if(GAMECLIENT.isReplayModeOn() || game_->world_.isSinglePlayer()) GAMECLIENT.DecreaseSpeed(); return true; @@ -869,18 +869,18 @@ bool dskGameInterface::msgKeyDown(const KeyEvent& ke) case '8': { unsigned playerIdx = ke.c - '1'; - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) { - unsigned oldPlayerId = worldViewer.GetPlayerId(); - GAMECLIENT.ChangePlayerIngame(worldViewer.GetPlayerId(), playerIdx); - RTTR_Assert(worldViewer.GetPlayerId() == oldPlayerId || worldViewer.GetPlayerId() == playerIdx); - } else if(playerIdx < worldViewer.GetWorld().GetNumPlayers()) + unsigned oldPlayerId = worldViewer.getPlayerId(); + GAMECLIENT.ChangePlayerIngame(worldViewer.getPlayerId(), playerIdx); + RTTR_Assert(worldViewer.getPlayerId() == oldPlayerId || worldViewer.getPlayerId() == playerIdx); + } else if(playerIdx < worldViewer.getWorld().getNumPlayers()) { // On multiplayer this currently asyncs, but as this is a debug feature anyway just disable it. // If this should be enabled again, look into the handling/clearing of accumulated GCs - if(game_->world_.IsSinglePlayer()) + if(game_->world_.isSinglePlayer()) { - const GamePlayer& player = worldViewer.GetWorld().GetPlayer(playerIdx); + const GamePlayer& player = worldViewer.getWorld().getPlayer(playerIdx); if(player.ps == PlayerState::AI && player.aiInfo.type == AI::Type::Dummy) GAMECLIENT.RequestSwapToPlayer(playerIdx); } @@ -890,7 +890,7 @@ bool dskGameInterface::msgKeyDown(const KeyEvent& ke) case 'b': gwv.MoveToLastPosition(); return true; case 'v': - if(game_->world_.IsSinglePlayer()) + if(game_->world_.isSinglePlayer()) GAMECLIENT.IncreaseSpeed(true); return true; case 'c': // Show/hide building names @@ -901,17 +901,17 @@ bool dskGameInterface::msgKeyDown(const KeyEvent& ke) return true; case 'h': // Go to HQ { - const GamePlayer& player = worldViewer.GetPlayer(); + const GamePlayer& player = worldViewer.getPlayer(); // HQ might not exist anymore - if(player.GetHQPos().isValid()) - gwv.MoveToMapPt(player.GetHQPos()); + if(player.getHQPos().isValid()) + gwv.MoveToMapPt(player.getHQPos()); } return true; case 'i': // Show inventory - WINDOWMANAGER.ToggleWindow(std::make_unique(worldViewer.GetPlayer())); + WINDOWMANAGER.ToggleWindow(std::make_unique(worldViewer.getPlayer())); return true; case 'j': // Skip GFs (fast forward) - if(game_->world_.IsSinglePlayer() || GAMECLIENT.IsReplayModeOn()) + if(game_->world_.isSinglePlayer() || GAMECLIENT.isReplayModeOn()) WINDOWMANAGER.ToggleWindow(std::make_unique(gwv)); return true; case 'l': // Show minimap @@ -921,8 +921,8 @@ bool dskGameInterface::msgKeyDown(const KeyEvent& ke) WINDOWMANAGER.ToggleWindow(std::make_unique(gwv, GAMECLIENT)); return true; case 'n': // Show message window - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv, GetPostBox())); - UpdatePostIcon(GetPostBox().GetNumMsgs(), false); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv, getPostBox())); + UpdatePostIcon(getPostBox().getNumMsgs(), false); return true; case 'p': // Pause GAMECLIENT.TogglePause(); @@ -939,16 +939,16 @@ bool dskGameInterface::msgKeyDown(const KeyEvent& ke) gwv.ToggleShowBQ(); return true; case 26: // ctrl+z - gwv.SetZoomFactor(ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); + gwv.setZoomFactor(ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); return true; case 'z': if(ke.ctrl) // Reset zoom - gwv.SetZoomFactor(ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); + gwv.setZoomFactor(ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); else // zoom in - gwv.SetZoomFactor(getNextZoomLevel(gwv.GetCurrentTargetZoomFactor())); + gwv.setZoomFactor(getNextZoomLevel(gwv.getCurrentTargetZoomFactor())); return true; case 'Z': // shift-z, zoom out - gwv.SetZoomFactor(getPreviousZoomLevel(gwv.GetCurrentTargetZoomFactor())); + gwv.setZoomFactor(getPreviousZoomLevel(gwv.getCurrentTargetZoomFactor())); return true; } @@ -968,12 +968,12 @@ bool dskGameInterface::msgWheelDown(const MouseCoords&) void dskGameInterface::WheelZoom(const float step) { - auto targetZoomFactor = gwv.GetCurrentTargetZoomFactor() * (1 + step); + auto targetZoomFactor = gwv.getCurrentTargetZoomFactor() * (1 + step); targetZoomFactor = std::clamp(targetZoomFactor, ZOOM_FACTORS.front(), ZOOM_FACTORS.back()); if(targetZoomFactor > 1 - ZOOM_WHEEL_INCREMENT && targetZoomFactor < 1 + ZOOM_WHEEL_INCREMENT) targetZoomFactor = 1.f; // Snap to 100% - gwv.SetZoomFactor(targetZoomFactor); + gwv.setZoomFactor(targetZoomFactor); } void dskGameInterface::OnBuildingNote(const BuildingNote& note) @@ -998,18 +998,18 @@ void dskGameInterface::Run() unsigned water_percent; // Draw mouse only if not on window - bool drawMouse = WINDOWMANAGER.FindWindowAtPos(VIDEODRIVER.GetMousePos()) == nullptr; - gwv.Draw(road, actionwindow != nullptr ? actionwindow->GetSelectedPt() : MapPoint::Invalid(), drawMouse, + bool drawMouse = WINDOWMANAGER.FindWindowAtPos(VIDEODRIVER.getMousePos()) == nullptr; + gwv.Draw(road, actionwindow != nullptr ? actionwindow->getSelectedPt() : MapPoint::Invalid(), drawMouse, &water_percent); // Indicate that the game is paused by darkening the screen (dark semi-transparent overlay) - if(GAMECLIENT.IsPaused()) - DrawRectangle(Rect(DrawPoint(0, 0), VIDEODRIVER.GetRenderSize()), COLOR_SHADOW); + if(GAMECLIENT.isPaused()) + DrawRectangle(Rect(DrawPoint(0, 0), VIDEODRIVER.getRenderSize()), COLOR_SHADOW); else { // Play ambient sounds if game is not paused - worldViewer.GetSoundMgr().playOceanBrawling(water_percent); - worldViewer.GetSoundMgr().playBirdSounds(noTree::QueryDrawCounter()); + worldViewer.getSoundMgr().playOceanBrawling(water_percent); + worldViewer.getSoundMgr().playBirdSounds(noTree::QueryDrawCounter()); } messenger.Draw(); @@ -1018,13 +1018,13 @@ void dskGameInterface::Run() void dskGameInterface::GI_StartRoadBuilding(const MapPoint startPt, bool waterRoad) { // Im Replay keine Straßen bauen - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) return; road.mode = waterRoad ? RoadBuildMode::Boat : RoadBuildMode::Normal; road.route.clear(); road.start = road.point = startPt; - WINDOWMANAGER.SetCursor(Cursor::Remove); + WINDOWMANAGER.setCursor(Cursor::Remove); } void dskGameInterface::GI_CancelRoadBuilding() @@ -1033,7 +1033,7 @@ void dskGameInterface::GI_CancelRoadBuilding() return; road.mode = RoadBuildMode::Disabled; worldViewer.RemoveVisualRoad(road.start, road.route); - WINDOWMANAGER.SetCursor(isScrolling ? Cursor::Scroll : Cursor::Hand); + WINDOWMANAGER.setCursor(isScrolling ? Cursor::Scroll : Cursor::Hand); } bool dskGameInterface::BuildRoadPart(MapPoint& cSel) @@ -1047,7 +1047,7 @@ bool dskGameInterface::BuildRoadPart(MapPoint& cSel) // Test on water way length if(road.mode == RoadBuildMode::Boat) { - unsigned char index = worldViewer.GetWorld().GetGGS().getSelection(AddonId::MAX_WATERWAY_LENGTH); + unsigned char index = worldViewer.getWorld().getGGS().getSelection(AddonId::MAX_WATERWAY_LENGTH); RTTR_Assert(index < waterwayLengths.size()); const unsigned max_length = waterwayLengths[index]; @@ -1069,10 +1069,10 @@ bool dskGameInterface::BuildRoadPart(MapPoint& cSel) // Weg (visuell) bauen for(const auto dir : new_route) { - worldViewer.SetVisiblePointRoad(road.point, dir, + worldViewer.setVisiblePointRoad(road.point, dir, (road.mode == RoadBuildMode::Boat) ? PointRoad::Boat : PointRoad::Normal); worldViewer.RecalcBQForRoad(road.point); - road.point = worldViewer.GetWorld().GetNeighbour(road.point, dir); + road.point = worldViewer.getWorld().getNeighbour(road.point, dir); } worldViewer.RecalcBQForRoad(road.point); @@ -1084,7 +1084,7 @@ bool dskGameInterface::BuildRoadPart(MapPoint& cSel) return true; } -unsigned dskGameInterface::GetIdInCurBuildRoad(const MapPoint pt) +unsigned dskGameInterface::getIdInCurBuildRoad(const MapPoint pt) { MapPoint curPt = road.start; for(unsigned i = 0; i < road.route.size(); ++i) @@ -1092,7 +1092,7 @@ unsigned dskGameInterface::GetIdInCurBuildRoad(const MapPoint pt) if(curPt == pt) return i + 1; - curPt = worldViewer.GetNeighbour(curPt, road.route[i]); + curPt = worldViewer.getNeighbour(curPt, road.route[i]); } return 0; } @@ -1106,7 +1106,7 @@ void dskGameInterface::ShowRoadWindow(const Position& mousePos) void dskGameInterface::ShowActionWindow(const iwAction::Tabs& action_tabs, MapPoint cSel, const DrawPoint& mousePos, const bool enable_military_buildings) { - const GameWorldBase& world = worldViewer.GetWorld(); + const GameWorldBase& world = worldViewer.getWorld(); iwAction::Params params; @@ -1114,18 +1114,18 @@ void dskGameInterface::ShowActionWindow(const iwAction::Tabs& action_tabs, MapPo if(action_tabs.setflag) { auto isWater = [](const auto& desc) { return desc.kind == TerrainKind::Water; }; - if(world.HasTerrain(cSel, isWater)) + if(world.hasTerrain(cSel, isWater)) params = iwAction::FlagType::WaterFlag; } // Wenn es einen Flaggen-Tab gibt, dann den Flaggentyp herausfinden und die Art des Fensters entsprechende setzen if(action_tabs.flag) { - if(world.GetNO(world.GetNeighbour(cSel, Direction::NorthWest))->GetGOT() == GO_Type::NobHq) + if(world.getNO(world.getNeighbour(cSel, Direction::NorthWest))->getGOT() == GO_Type::NobHq) params = iwAction::FlagType::HQ; - else if(world.GetNO(cSel)->GetType() == NodalObjectType::Flag) + else if(world.getNO(cSel)->getType() == NodalObjectType::Flag) { - if(world.GetSpecObj(cSel)->GetFlagType() == FlagType::Water) + if(world.getSpecObj(cSel)->getFlagType() == FlagType::Water) params = iwAction::FlagType::WaterFlag; } } @@ -1133,7 +1133,7 @@ void dskGameInterface::ShowActionWindow(const iwAction::Tabs& action_tabs, MapPo // Angriffstab muss wissen, wieviel Soldaten maximal entsendet werden können if(action_tabs.attack) { - params = worldViewer.GetNumSoldiersForAttack(cSel); + params = worldViewer.getNumSoldiersForAttack(cSel); } actionwindow = &WINDOWMANAGER.Show( @@ -1158,7 +1158,7 @@ void dskGameInterface::OnChatCommand(const std::string& cmd) GameDataLoader gdLoader(newDesc); if(gdLoader.Load()) { - const_cast(game_->world_).GetDescriptionWriteable() = newDesc; + const_cast(game_->world_).getDescriptionWriteable() = newDesc; worldViewer.InitTerrainRenderer(); } } @@ -1169,7 +1169,7 @@ void dskGameInterface::GI_BuildRoad() if(GAMECLIENT.BuildRoad(road.start, road.mode == RoadBuildMode::Boat, road.route)) { road.mode = RoadBuildMode::Disabled; - WINDOWMANAGER.SetCursor(Cursor::Hand); + WINDOWMANAGER.setCursor(Cursor::Hand); } } @@ -1192,7 +1192,7 @@ void dskGameInterface::GI_FlagDestroyed(const MapPoint pt) // Evtl Actionfenster schließen, da sich das ja auch auf diese Flagge bezieht if(actionwindow) { - if(actionwindow->GetSelectedPt() == pt) + if(actionwindow->getSelectedPt() == pt) actionwindow->Close(); } } @@ -1201,7 +1201,7 @@ void dskGameInterface::CI_PlayerLeft(const unsigned playerId) { // Info-Meldung ausgeben std::string text = - helpers::format(_("Player '%s' left the game!"), worldViewer.GetWorld().GetPlayer(playerId).name); + helpers::format(_("Player '%s' left the game!"), worldViewer.getWorld().getPlayer(playerId).name); messenger.AddMessage("", 0, ChatDestination::System, text, COLOR_RED); // Im Spiel anzeigen, dass die KI das Spiel betreten hat text = helpers::format(_("Player '%s' joined the game!"), "KI"); @@ -1217,8 +1217,8 @@ void dskGameInterface::CI_GGSChanged(const GlobalGameSettings& /*ggs*/) void dskGameInterface::CI_Chat(const unsigned playerId, const ChatDestination cd, const std::string& msg) { - messenger.AddMessage(worldViewer.GetWorld().GetPlayer(playerId).name, - worldViewer.GetWorld().GetPlayer(playerId).color, cd, msg); + messenger.AddMessage(worldViewer.getWorld().getPlayer(playerId).name, + worldViewer.getWorld().getPlayer(playerId).color, cd, msg); } void dskGameInterface::CI_Async(const std::string& checksums_list) @@ -1252,7 +1252,7 @@ void dskGameInterface::CI_GameResumed() void dskGameInterface::CI_Error(const ClientError ce) { messenger.AddMessage("", 0, ChatDestination::System, ClientErrorToStr(ce), COLOR_RED); - GAMECLIENT.SetPause(true); + GAMECLIENT.setPause(true); } /** @@ -1274,12 +1274,12 @@ void dskGameInterface::LC_Status_Error(const std::string& error) void dskGameInterface::CI_PlayersSwapped(const unsigned player1, const unsigned player2) { // Meldung anzeigen - std::string text = "Player '" + worldViewer.GetWorld().GetPlayer(player1).name + "' switched to player '" - + worldViewer.GetWorld().GetPlayer(player2).name + "'"; + std::string text = "Player '" + worldViewer.getWorld().getPlayer(player1).name + "' switched to player '" + + worldViewer.getWorld().getPlayer(player2).name + "'"; messenger.AddMessage("", 0, ChatDestination::System, text, COLOR_YELLOW); // Sichtbarkeiten und Minimap neu berechnen, wenn wir ein von den beiden Spielern sind - const unsigned localPlayerId = worldViewer.GetPlayerId(); + const unsigned localPlayerId = worldViewer.getPlayerId(); if(player1 == localPlayerId || player2 == localPlayerId) { worldViewer.ChangePlayer(player1 == localPlayerId ? player2 : player1); @@ -1296,11 +1296,11 @@ void dskGameInterface::CI_PlayersSwapped(const unsigned player1, const unsigned void dskGameInterface::GI_PlayerDefeated(const unsigned playerId) { const std::string text = - helpers::format(_("Player '%s' was defeated!"), worldViewer.GetWorld().GetPlayer(playerId).name); + helpers::format(_("Player '%s' was defeated!"), worldViewer.getWorld().getPlayer(playerId).name); messenger.AddMessage("", 0, ChatDestination::System, text, COLOR_ORANGE); /// Lokaler Spieler? - if(playerId == worldViewer.GetPlayerId()) + if(playerId == worldViewer.getPlayerId()) { /// Sichtbarkeiten neu berechnen worldViewer.RecalcAllColors(); @@ -1329,7 +1329,7 @@ void dskGameInterface::GI_UpdateMapVisibility() void dskGameInterface::GI_TreatyOfAllianceChanged(unsigned playerId) { // Nur wenn Team-Sicht aktiviert ist, können sihc die Sichtbarkeiten auch ändern - if(playerId == worldViewer.GetPlayerId() && worldViewer.GetWorld().GetGGS().teamView) + if(playerId == worldViewer.getPlayerId() && worldViewer.getWorld().getGGS().teamView) { /// Sichtbarkeiten neu berechnen worldViewer.RecalcAllColors(); @@ -1347,8 +1347,8 @@ void dskGameInterface::DemolishRoad(const unsigned start_id) for(unsigned i = road.route.size(); i >= start_id; --i) { MapPoint t = road.point; - road.point = worldViewer.GetWorld().GetNeighbour(road.point, road.route[i - 1] + 3u); - worldViewer.SetVisiblePointRoad(road.point, road.route[i - 1], PointRoad::None); + road.point = worldViewer.getWorld().getNeighbour(road.point, road.route[i - 1] + 3u); + worldViewer.setVisiblePointRoad(road.point, road.route[i - 1], PointRoad::None); worldViewer.RecalcBQForRoad(t); } @@ -1362,16 +1362,16 @@ void dskGameInterface::UpdatePostIcon(const unsigned postmessages_count, bool sh { // Taube setzen oder nicht (Post) if(postmessages_count == 0 || !showPigeon) - GetCtrl(3)->SetImage(LOADER.GetImageN("io", 62)); + getCtrl(3)->setImage(LOADER.getImageN("io", 62)); else - GetCtrl(3)->SetImage(LOADER.GetImageN("io", 59)); + getCtrl(3)->setImage(LOADER.getImageN("io", 59)); // und Anzahl der Postnachrichten aktualisieren if(postmessages_count > 0) { - GetCtrl(ID_txtNumMsg)->SetText(std::to_string(postmessages_count)); + getCtrl(ID_txtNumMsg)->setText(std::to_string(postmessages_count)); } else - GetCtrl(ID_txtNumMsg)->SetText(""); + getCtrl(ID_txtNumMsg)->setText(""); } /** @@ -1380,11 +1380,11 @@ void dskGameInterface::UpdatePostIcon(const unsigned postmessages_count, bool sh void dskGameInterface::NewPostMessage(const PostMsg& msg, const unsigned msgCt) { UpdatePostIcon(msgCt, true); - SoundEffect soundEffect = msg.GetSoundEffect(); + SoundEffect soundEffect = msg.getSoundEffect(); switch(soundEffect) { - case SoundEffect::Pidgeon: LOADER.GetSoundN("sound", 114)->Play(100, false); break; - case SoundEffect::Fanfare: LOADER.GetSoundN("sound", 110)->Play(100, false); + case SoundEffect::Pidgeon: LOADER.getSoundN("sound", 114)->Play(100, false); break; + case SoundEffect::Fanfare: LOADER.getSoundN("sound", 110)->Play(100, false); } } @@ -1401,7 +1401,7 @@ void dskGameInterface::PostMessageDeleted(const unsigned msgCt) */ void dskGameInterface::GI_Winner(const unsigned playerId) { - const std::string name = worldViewer.GetWorld().GetPlayer(playerId).name; + const std::string name = worldViewer.getWorld().getPlayer(playerId).name; const std::string text = (boost::format(_("Player '%s' is the winner!")) % name).str(); messenger.AddMessage("", 0, ChatDestination::System, text, COLOR_ORANGE); WINDOWMANAGER.Show(std::make_unique(std::vector(1, name))); @@ -1413,11 +1413,11 @@ void dskGameInterface::GI_Winner(const unsigned playerId) void dskGameInterface::GI_TeamWinner(const unsigned playerMask) { std::vector winners; - const GameWorldBase& world = worldViewer.GetWorld(); - for(unsigned i = 0; i < world.GetNumPlayers(); i++) + const GameWorldBase& world = worldViewer.getWorld(); + for(unsigned i = 0; i < world.getNumPlayers(); i++) { if(playerMask & (1 << i)) - winners.push_back(world.GetPlayer(i).name); + winners.push_back(world.getPlayer(i).name); } const std::string text = (boost::format(_("%1% are the winners!")) % helpers::join(winners, ", ", _(" and "))).str(); diff --git a/libs/s25main/desktops/dskGameInterface.h b/libs/s25main/desktops/dskGameInterface.h index 572e59739f..d87d15c104 100644 --- a/libs/s25main/desktops/dskGameInterface.h +++ b/libs/s25main/desktops/dskGameInterface.h @@ -45,12 +45,12 @@ class dskGameInterface : ~dskGameInterface() override; void Resize(const Extent& newSize) override; - void SetActive(bool activate = true) override; + void setActive(bool activate = true) override; void LC_Status_ConnectionLost() override; void LC_Status_Error(const std::string& error) override; - RoadBuildMode GetRoadMode() const { return road.mode; } + RoadBuildMode getRoadMode() const { return road.mode; } void CI_PlayerLeft(unsigned playerId) override; void CI_GGSChanged(const GlobalGameSettings& ggs) override; @@ -93,7 +93,7 @@ class dskGameInterface : bool BuildRoadPart(MapPoint& cSel); // Return the id (index + 1) of the point in the currently build road (1 = startPt) // If pt is not on the road, return 0 - unsigned GetIdInCurBuildRoad(MapPoint pt); + unsigned getIdInCurBuildRoad(MapPoint pt); /// Baut Weg zurück von Ende bis zu start_id void DemolishRoad(unsigned start_id); // Zeigt das Straäcnfenster an und entscheidet selbststäcdig, ob man eine Flagge an road_point_x/y bauen kann, @@ -103,7 +103,7 @@ class dskGameInterface : void ShowActionWindow(const iwAction::Tabs& action_tabs, MapPoint cSel, const DrawPoint& mousePos, bool enable_military_buildings); - const GameWorldView& GetView() const { return gwv; } + const GameWorldView& getView() const { return gwv; } void OnChatCommand(const std::string& cmd) override; @@ -144,7 +144,7 @@ class dskGameInterface : void DisableFoW(bool hideFOW); // Set Fog of War mode if possible void ShowPersistentWindowsAfterSwitch(); - PostBox& GetPostBox(); + PostBox& getPostBox(); std::shared_ptr game_; std::shared_ptr nwfInfo_; GameWorldViewer worldViewer; diff --git a/libs/s25main/desktops/dskGameLoader.cpp b/libs/s25main/desktops/dskGameLoader.cpp index 297306b1fc..108f535eb1 100644 --- a/libs/s25main/desktops/dskGameLoader.cpp +++ b/libs/s25main/desktops/dskGameLoader.cpp @@ -25,10 +25,10 @@ * Startet das Spiel und lädt alles Notwendige. */ dskGameLoader::dskGameLoader(std::shared_ptr game) - : Desktop(LOADER.GetImageN(ResourceId(LOAD_SCREENS[rand() % LOAD_SCREENS.size()]), 0)), position(0), + : Desktop(LOADER.getImageN(ResourceId(LOAD_SCREENS[rand() % LOAD_SCREENS.size()]), 0)), position(0), loader_(LOADER, std::move(game)) { - WINDOWMANAGER.SetCursor(Cursor::None); + WINDOWMANAGER.setCursor(Cursor::None); using namespace std::chrono_literals; AddTimer(1, 50ms); @@ -39,12 +39,12 @@ dskGameLoader::dskGameLoader(std::shared_ptr game) AddText(11 + i, DrawPoint(30, 30 + i * 20), "", COLOR_GREEN, FontStyle{}, LargeFont); LOBBYCLIENT.AddListener(this); - GAMECLIENT.SetInterface(this); + GAMECLIENT.setInterface(this); } dskGameLoader::~dskGameLoader() { - WINDOWMANAGER.SetCursor(); + WINDOWMANAGER.setCursor(); LOBBYCLIENT.RemoveListener(this); GAMECLIENT.RemoveInterface(this); } @@ -57,7 +57,7 @@ void dskGameLoader::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult if(LOBBYCLIENT.IsLoggedIn()) // steht die Lobbyverbindung noch? WINDOWMANAGER.Switch(std::make_unique()); - else if(loader_.getGame()->world_.IsSinglePlayer()) + else if(loader_.getGame()->world_.isSinglePlayer()) WINDOWMANAGER.Switch(std::make_unique()); else WINDOWMANAGER.Switch(std::make_unique()); @@ -66,8 +66,8 @@ void dskGameLoader::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult void dskGameLoader::msgTimer(const unsigned /*ctrl_id*/) { - auto* timer = GetCtrl(1); - auto* text = GetCtrl(10 + position); + auto* timer = getCtrl(1); + auto* text = getCtrl(10 + position); using namespace std::chrono_literals; const auto interval = 50ms; @@ -76,17 +76,17 @@ void dskGameLoader::msgTimer(const unsigned /*ctrl_id*/) switch(position) { case 0: // Kartename anzeigen - text->SetText(GAMECLIENT.GetMapTitle()); + text->setText(GAMECLIENT.getMapTitle()); break; case 1: // Karte geladen - text->SetText(_("Map was loaded and pinned at the wall...")); + text->setText(_("Map was loaded and pinned at the wall...")); break; case 2: // Nationen ermitteln loader_.initNations(); - text->SetText(_("Tribal chiefs assembled around the table...")); + text->setText(_("Tribal chiefs assembled around the table...")); break; case 3: // Objekte laden @@ -98,15 +98,15 @@ void dskGameLoader::msgTimer(const unsigned /*ctrl_id*/) return; // Don't restart timer! } - text->SetText(_("Game crate was picked and spread out...")); + text->setText(_("Game crate was picked and spread out...")); break; } case 4: // Welt erstellen try { // Do this here as it will init OGL - gameInterface = std::make_unique(loader_.getGame(), GAMECLIENT.GetNWFInfo(), - GAMECLIENT.GetPlayerId()); + gameInterface = std::make_unique(loader_.getGame(), GAMECLIENT.getNWFInfo(), + GAMECLIENT.getPlayerId()); } catch(const std::runtime_error& e) { ShowErrorMsg(std::string(_("Failed to init GUI: ")) + e.what()); @@ -117,12 +117,12 @@ void dskGameLoader::msgTimer(const unsigned /*ctrl_id*/) // We are done, wait for others GAMECLIENT.GameLoaded(); - text->SetText(_("World was put together and glued...")); + text->setText(_("World was put together and glued...")); break; case 5: // nochmal text anzeigen - text->SetText(_("And let's go!")); - text->SetTextColor(COLOR_RED); + text->setText(_("And let's go!")); + text->setTextColor(COLOR_RED); return; } @@ -137,7 +137,7 @@ void dskGameLoader::ShowErrorMsg(const std::string& error) WINDOWMANAGER.Show(std::move(wnd)); else WINDOWMANAGER.ShowAfterSwitch(std::move(wnd)); - GetCtrl(1)->Stop(); + getCtrl(1)->Stop(); } /** diff --git a/libs/s25main/desktops/dskGameLobby.cpp b/libs/s25main/desktops/dskGameLobby.cpp index b466d3d0db..27716b62ac 100644 --- a/libs/s25main/desktops/dskGameLobby.cpp +++ b/libs/s25main/desktops/dskGameLobby.cpp @@ -127,7 +127,7 @@ Nation nextNation(const Nation value) dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gameLobby, unsigned playerId, std::unique_ptr lobbyClient) - : Desktop(LOADER.GetImageN("setup015", 0)), serverType(serverType), gameLobby_(std::move(gameLobby)), + : Desktop(LOADER.getImageN("setup015", 0)), serverType(serverType), gameLobby_(std::move(gameLobby)), localPlayerId_(playerId), lobbyClient_(std::move(lobbyClient)), hasCountdown_(false), wasActivated(false), gameChat(nullptr), lobbyChat(nullptr), lobbyChatTabAnimId(0), localChatTabAnimId(0) { @@ -135,16 +135,16 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam if(!gameLobby_) return; - const bool loadLua = !GAMECLIENT.GetLuaFilePath().empty(); + const bool loadLua = !GAMECLIENT.getLuaFilePath().empty(); // The lobby controller for clients is only used by lua if(gameLobby_->isHost() || loadLua) - lobbyController = std::make_unique(gameLobby_, GAMECLIENT.GetMainPlayer()); + lobbyController = std::make_unique(gameLobby_, GAMECLIENT.getMainPlayer()); if(loadLua) { lua = std::make_unique(*lobbyController, GAMECLIENT); - if(!lua->loadScript(GAMECLIENT.GetLuaFilePath())) + if(!lua->loadScript(GAMECLIENT.getLuaFilePath())) { WINDOWMANAGER.ShowAfterSwitch(std::make_unique( _("Error"), _("Lua script was found but failed to load. Map might not work as expected!"), this, @@ -167,18 +167,18 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam lobbyController->RemoveLuaScript(); } - const bool readonlySettings = !gameLobby_->isHost() || gameLobby_->isSavegame() || !IsChangeAllowed("general"); + const bool readonlySettings = !gameLobby_->isHost() || gameLobby_->isSavegame() || !isChangeAllowed("general"); allowAddonChange = gameLobby_->isHost() && !gameLobby_->isSavegame() - && (IsChangeAllowed("addonsAll") || IsChangeAllowed("addonsSome")); + && (isChangeAllowed("addonsAll") || isChangeAllowed("addonsSome")); - AddText(ID_txtGameName, DrawPoint(400, 5), GAMECLIENT.GetGameName(), COLOR_YELLOW, FontStyle::CENTER, LargeFont); + AddText(ID_txtGameName, DrawPoint(400, 5), GAMECLIENT.getGameName(), COLOR_YELLOW, FontStyle::CENTER, LargeFont); AddText(ID_txtColName, DrawPoint(125, 40), _("Player Name"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); AddText(ID_txtColRace, DrawPoint(262, 40), _("Race"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); AddText(ID_txtColColor, DrawPoint(369, 40), _("Color"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); AddText(ID_txtColTeam, DrawPoint(419, 40), _("Team"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); - if(!IsSinglePlayer()) + if(!isSinglePlayer()) { AddText(ID_txtColReady, DrawPoint(479, 40), _("Ready?"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); AddText(ID_txtColPing, DrawPoint(530, 40), _("Ping"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); @@ -188,7 +188,7 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam if(gameLobby_->isSavegame()) AddText(ID_txtColPastPlayer, DrawPoint(645, 40), _("Past player"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); - if(!IsSinglePlayer()) + if(!isSinglePlayer()) { // Enable lobby chat when we are logged in if(lobbyClient_ && lobbyClient_->IsLoggedIn()) @@ -202,7 +202,7 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam AddChatCtrl(ID_chatGame, DrawPoint(20, 345), Extent(360, 218 - 25), TextureColor::Grey, NormalFont); lobbyChat = AddChatCtrl(ID_chatLobby, DrawPoint(20, 345), Extent(360, 218 - 25), TextureColor::Grey, NormalFont); - chatTab->SetSelection(ID_btChatGame, true); + chatTab->setSelection(ID_btChatGame, true); } else { gameChat = AddChatCtrl(ID_chatGame, DrawPoint(20, 320), Extent(360, 218), TextureColor::Grey, NormalFont); @@ -274,19 +274,19 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam // Karte laden, um Kartenvorschau anzuzeigen if(!gameLobby_->isSavegame()) { - const bool isMapPreviewEnabled = !lua || lua->IsMapPreviewEnabled(); + const bool isMapPreviewEnabled = !lua || lua->isMapPreviewEnabled(); if(!isMapPreviewEnabled) { AddTextDeepening(ID_txtNoPreview, DrawPoint(560, 40), Extent(220, 220), TextureColor::Grey, _("No preview"), LargeFont, COLOR_YELLOW); - AddText(ID_txtMapName, DrawPoint(670, 40 + 220 + 10), _("Map: ") + GAMECLIENT.GetMapTitle(), COLOR_YELLOW, + AddText(ID_txtMapName, DrawPoint(670, 40 + 220 + 10), _("Map: ") + GAMECLIENT.getMapTitle(), COLOR_YELLOW, FontStyle::CENTER, NormalFont); } else { // Map laden libsiedler2::Archiv mapArchiv; // Karteninformationen laden - if(int ec = libsiedler2::loader::LoadMAP(GAMECLIENT.GetMapPath(), mapArchiv)) + if(int ec = libsiedler2::loader::LoadMAP(GAMECLIENT.getMapPath(), mapArchiv)) { WINDOWMANAGER.ShowAfterSwitch( std::make_unique(_("Error"), _("Could not load map:\n") + libsiedler2::getErrorString(ec), @@ -298,37 +298,37 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam // Titel der Karte, Y-Position relativ je nach Höhe der Minimap festlegen, daher nochmals danach // verschieben, da diese Position sonst skaliert wird! - ctrlText* text = AddText(ID_txtMapName, DrawPoint(670, 0), _("Map: ") + GAMECLIENT.GetMapTitle(), + ctrlText* text = AddText(ID_txtMapName, DrawPoint(670, 0), _("Map: ") + GAMECLIENT.getMapTitle(), COLOR_YELLOW, FontStyle::CENTER, NormalFont); - text->SetPos(DrawPoint(text->GetPos().x, preview->GetPos().y + preview->GetMapArea().bottom + 10)); + text->setPos(DrawPoint(text->getPos().x, preview->getPos().y + preview->getMapArea().bottom + 10)); } } } - if(GAMECLIENT.IsAIBattleModeOn()) + if(GAMECLIENT.isAIBattleModeOn()) { - const auto& aiBattlePlayers = GAMECLIENT.GetAIBattlePlayers(); + const auto& aiBattlePlayers = GAMECLIENT.getAIBattlePlayers(); // Initialize AI battle players for(unsigned i = 0; i < gameLobby_->getNumPlayers(); i++) { if(i < aiBattlePlayers.size()) - lobbyController->SetPlayerState(i, PlayerState::AI, aiBattlePlayers[i]); + lobbyController->setPlayerState(i, PlayerState::AI, aiBattlePlayers[i]); else lobbyController->CloseSlot(i); // Close remaining slots } // Set name of host to the corresponding AI for local player if(localPlayerId_ < aiBattlePlayers.size()) - lobbyController->SetName(localPlayerId_, + lobbyController->setName(localPlayerId_, JoinPlayerInfo::MakeAIName(aiBattlePlayers[localPlayerId_], localPlayerId_)); - } else if(IsSinglePlayer() && !gameLobby_->isSavegame()) + } else if(isSinglePlayer() && !gameLobby_->isSavegame()) { // Setze initial auf KI for(unsigned i = 0; i < gameLobby_->getNumPlayers(); i++) { if(!gameLobby_->getPlayer(i).isHost) - lobbyController->SetPlayerState(i, PlayerState::AI, AI::Info(AI::Type::Default, AI::Level::Easy)); + lobbyController->setPlayerState(i, PlayerState::AI, AI::Info(AI::Type::Default, AI::Level::Easy)); } } @@ -336,14 +336,14 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam for(unsigned i = 0; i < gameLobby_->getNumPlayers(); i++) UpdatePlayerRow(i); // swap buttons erstellen - if(gameLobby_->isHost() && !gameLobby_->isSavegame() && IsChangeAllowed("swapping")) + if(gameLobby_->isHost() && !gameLobby_->isSavegame() && isChangeAllowed("swapping")) { for(unsigned i = 0; i < gameLobby_->getNumPlayers(); i++) { - int rowPos = GetCtrl(ID_grpPlayerStart + i)->GetCtrl(ID_btPlayerState)->GetPos().y; + int rowPos = getCtrl(ID_grpPlayerStart + i)->getCtrl(ID_btPlayerState)->getPos().y; ctrlButton* bt = AddTextButton(ID_btSwap + i, DrawPoint(5, 0), Extent(22, 22), TextureColor::Red1, _("-"), NormalFont); - bt->SetPos(DrawPoint(bt->GetPos().x, rowPos)); + bt->setPos(DrawPoint(bt->getPos().x, rowPos)); } } CI_GGSChanged(gameLobby_->getSettings()); @@ -354,7 +354,7 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam lobbyClient_->SendServerJoinRequest(); } - GAMECLIENT.SetInterface(this); + GAMECLIENT.setInterface(this); } dskGameLobby::~dskGameLobby() @@ -373,19 +373,19 @@ void dskGameLobby::Resize(const Extent& newSize) // Text unter der PreviewMinimap verschieben, dessen Höhe von der Höhe der // PreviewMinimap abhängt, welche sich gerade geändert hat. - auto* preview = GetCtrl(ID_miniMap); - auto* text = GetCtrl(ID_txtMapName); + auto* preview = getCtrl(ID_miniMap); + auto* text = getCtrl(ID_txtMapName); if(preview && text) { - DrawPoint txtPos = text->GetPos(); - txtPos.y = preview->GetPos().y + preview->GetMapArea().bottom + 10; - text->SetPos(txtPos); + DrawPoint txtPos = text->getPos(); + txtPos.y = preview->getPos().y + preview->getMapArea().bottom + 10; + text->setPos(txtPos); } } -void dskGameLobby::SetActive(bool activate /*= true*/) +void dskGameLobby::setActive(bool activate /*= true*/) { - Desktop::SetActive(activate); + Desktop::setActive(activate); if(activate && !wasActivated && lua && gameLobby_->isHost()) { wasActivated = true; @@ -424,27 +424,27 @@ void dskGameLobby::UpdatePlayerRow(const unsigned row) case PlayerState::Locked: name = _("Closed"); break; } - if(GetCtrl(ID_miniMap)) + if(getCtrl(ID_miniMap)) { if(player.isUsed()) // Nur KIs und richtige Spieler haben eine Farbe auf der Karte - GetCtrl(ID_miniMap)->SetPlayerColor(row, player.color); + getCtrl(ID_miniMap)->setPlayerColor(row, player.color); else // Keine richtigen Spieler --> Startposition auf der Karte ausblenden - GetCtrl(ID_miniMap)->SetPlayerColor(row, 0); + getCtrl(ID_miniMap)->setPlayerColor(row, 0); } // Spielername, beim Hosts Spielerbuttons, aber nich beim ihm selber, er kann sich ja nich selber kicken! - if(gameLobby_->isHost() && !player.isHost && IsChangeAllowed("playerState")) + if(gameLobby_->isHost() && !player.isHost && isChangeAllowed("playerState")) group->AddTextButton(ID_btPlayerState, DrawPoint(30, cy), Extent(180, 22), tc, name, NormalFont); else group->AddTextDeepening(ID_btPlayerState, DrawPoint(30, cy), Extent(180, 22), tc, name, NormalFont, COLOR_YELLOW); - auto* text = group->GetCtrl(ID_btPlayerState); + auto* text = group->getCtrl(ID_btPlayerState); // Is das der Host? Dann farblich markieren if(player.isHost) - text->SetTextColor(0xFF00FF00); + text->setTextColor(0xFF00FF00); // Bei geschlossenem nicht sichtbar if(player.isUsed()) @@ -460,16 +460,16 @@ void dskGameLobby::UpdatePlayerRow(const unsigned row) { if(localPlayerId_ == row) { - allowNationChange &= lua->IsChangeAllowed("ownNation", true); - allowColorChange &= lua->IsChangeAllowed("ownColor", true); - allowTeamChange &= lua->IsChangeAllowed("ownTeam", true); - allowPortraitChange &= lua->IsChangeAllowed("ownPortrait", true); + allowNationChange &= lua->isChangeAllowed("ownNation", true); + allowColorChange &= lua->isChangeAllowed("ownColor", true); + allowTeamChange &= lua->isChangeAllowed("ownTeam", true); + allowPortraitChange &= lua->isChangeAllowed("ownPortrait", true); } else { - allowNationChange &= lua->IsChangeAllowed("aiNation", true); - allowColorChange &= lua->IsChangeAllowed("aiColor", true); - allowTeamChange &= lua->IsChangeAllowed("aiTeam", true); - allowPortraitChange &= lua->IsChangeAllowed("aiPortrait", true); + allowNationChange &= lua->isChangeAllowed("aiNation", true); + allowColorChange &= lua->isChangeAllowed("aiColor", true); + allowTeamChange &= lua->isChangeAllowed("aiTeam", true); + allowPortraitChange &= lua->isChangeAllowed("aiPortrait", true); } } @@ -483,10 +483,10 @@ void dskGameLobby::UpdatePlayerRow(const unsigned row) const auto& portrait = Portraits[player.portraitIndex]; if(allowPortraitChange) group->AddImageButton(ID_btPortrait, DrawPoint(315, cy), Extent(34, 22), tc, - LOADER.GetImageN(portrait.resourceId, portrait.resourceIndex), _(portrait.name)); + LOADER.getImageN(portrait.resourceId, portrait.resourceIndex), _(portrait.name)); else group->AddImageDeepening(ID_btPortrait, DrawPoint(315, cy), Extent(34, 22), tc, - LOADER.GetImageN(portrait.resourceId, portrait.resourceIndex)); + LOADER.getImageN(portrait.resourceId, portrait.resourceIndex)); if(allowColorChange) group->AddColorButton(ID_btColor, DrawPoint(354, cy), Extent(30, 22), tc, 0); @@ -520,14 +520,14 @@ void dskGameLobby::UpdatePlayerRow(const unsigned row) { combo->AddItem(gameLobby_->getPlayer(i).originName); if(i == row) - combo->SetSelection(combo->GetNumItems() - 1u); + combo->setSelection(combo->getNumItems() - 1u); } } } // Hide ping for AIs or on single player games - if(player.ps == PlayerState::AI || IsSinglePlayer()) - ping->SetVisible(false); + if(player.ps == PlayerState::AI || isSinglePlayer()) + ping->setVisible(false); // Fill fields ChangeNation(row, player.nation); @@ -537,7 +537,7 @@ void dskGameLobby::UpdatePlayerRow(const unsigned row) ChangeReady(row, player.isReady); ChangeColor(row, player.color); } - group->SetActive(IsActive()); + group->setActive(IsActive()); } /** @@ -547,8 +547,8 @@ void dskGameLobby::msgPaintBefore() { Desktop::msgPaintBefore(); // Chatfenster Fokus geben - if(!IsSinglePlayer()) - GetCtrl(ID_edtChatMsg)->SetFocus(); + if(!isSinglePlayer()) + getCtrl(ID_edtChatMsg)->setFocus(); } void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned ctrl_id) @@ -566,14 +566,14 @@ void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned c case ID_btNation: { - SetPlayerReady(playerId, false); + setPlayerReady(playerId, false); if(playerId == localPlayerId_ || gameLobby_->isHost()) { JoinPlayerInfo& player = gameLobby_->getPlayer(playerId); player.nation = nextNation(player.nation); if(gameLobby_->isHost()) - lobbyController->SetNation(playerId, player.nation); + lobbyController->setNation(playerId, player.nation); else GAMECLIENT.commandSetNation(player.nation); ChangeNation(playerId, player.nation); @@ -583,14 +583,14 @@ void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned c case ID_btPortrait: { - SetPlayerReady(playerId, false); + setPlayerReady(playerId, false); if(playerId == localPlayerId_ || gameLobby_->isHost()) { JoinPlayerInfo& player = gameLobby_->getPlayer(playerId); player.portraitIndex = (player.portraitIndex + 1) % Portraits.size(); if(gameLobby_->isHost()) - lobbyController->SetPortrait(playerId, player.portraitIndex); + lobbyController->setPortrait(playerId, player.portraitIndex); else GAMECLIENT.commandSetPortrait(player.portraitIndex); ChangePortrait(playerId, player.portraitIndex); @@ -600,7 +600,7 @@ void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned c case ID_btColor: { - SetPlayerReady(playerId, false); + setPlayerReady(playerId, false); if(playerId == localPlayerId_ || gameLobby_->isHost()) { @@ -619,14 +619,14 @@ void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned c // Look for a unique color JoinPlayerInfo& player = gameLobby_->getPlayer(playerId); - int newColorIdx = JoinPlayerInfo::GetColorIdx(player.color); + int newColorIdx = JoinPlayerInfo::getColorIdx(player.color); do { player.color = PLAYER_COLORS[(++newColorIdx) % PLAYER_COLORS.size()]; } while(helpers::contains(takenColors, player.color)); if(gameLobby_->isHost()) - lobbyController->SetColor(playerId, player.color); + lobbyController->setColor(playerId, player.color); else GAMECLIENT.commandSetColor(player.color); ChangeColor(playerId, player.color); @@ -638,14 +638,14 @@ void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned c case ID_btTeam: { - SetPlayerReady(playerId, false); + setPlayerReady(playerId, false); if(playerId == localPlayerId_ || gameLobby_->isHost()) { JoinPlayerInfo& player = gameLobby_->getPlayer(playerId); player.team = nextEnumValue(player.team); if(gameLobby_->isHost()) - lobbyController->SetTeam(playerId, player.team); + lobbyController->setTeam(playerId, player.team); else GAMECLIENT.commandSetTeam(player.team); ChangeTeam(playerId, player.team); @@ -661,7 +661,7 @@ void dskGameLobby::msgGroupCheckboxChange(const unsigned group_id, const unsigne // Bereit if(playerId < MAX_PLAYERS) - SetPlayerReady(playerId, checked); + setPlayerReady(playerId, checked); } void dskGameLobby::msgGroupComboSelectItem(const unsigned group_id, const unsigned /*ctrl_id*/, @@ -690,7 +690,7 @@ void dskGameLobby::msgGroupComboSelectItem(const unsigned group_id, const unsign void dskGameLobby::GoBack() { - if(IsSinglePlayer()) + if(isSinglePlayer()) WINDOWMANAGER.Switch(std::make_unique()); else if(serverType == ServerType::LAN) WINDOWMANAGER.Switch(std::make_unique()); @@ -700,9 +700,9 @@ void dskGameLobby::GoBack() WINDOWMANAGER.Switch(std::make_unique()); } -bool dskGameLobby::IsChangeAllowed(const std::string& setting) const +bool dskGameLobby::isChangeAllowed(const std::string& setting) const { - return !lua || lua->IsChangeAllowed(setting); + return !lua || lua->isChangeAllowed(setting); } void dskGameLobby::msgButtonClick(const unsigned ctrl_id) @@ -723,25 +723,25 @@ void dskGameLobby::msgButtonClick(const unsigned ctrl_id) case ID_btStartGame: { - auto* ready = GetCtrl(ID_btStartGame); + auto* ready = getCtrl(ID_btStartGame); if(gameLobby_->isHost()) { if(!checkOptions()) return; - SetPlayerReady(localPlayerId_, true); + setPlayerReady(localPlayerId_, true); if(lua) lua->EventPlayerReady(localPlayerId_); - if(ready->GetText() == _("Start game")) + if(ready->getText() == _("Start game")) lobbyController->StartCountdown(5); else - lobbyController->CancelCountdown(); + lobbyController->cancelCountdown(); } else { - if(ready->GetText() == _("Ready")) - SetPlayerReady(localPlayerId_, true); + if(ready->getText() == _("Ready")) + setPlayerReady(localPlayerId_, true); else - SetPlayerReady(localPlayerId_, false); + setPlayerReady(localPlayerId_, false); } } break; @@ -754,13 +754,13 @@ void dskGameLobby::msgButtonClick(const unsigned ctrl_id) std::unique_ptr w; if(!allowAddonChange) w = std::make_unique(gameLobby_->getSettings(), this, AddonChangeAllowed::None); - else if(IsChangeAllowed("addonsAll")) + else if(isChangeAllowed("addonsAll")) w = std::make_unique(gameLobby_->getSettings(), this, AddonChangeAllowed::All); else { RTTR_Assert(lua); // Otherwise all changes would be allowed w = std::make_unique(gameLobby_->getSettings(), this, AddonChangeAllowed::WhitelistOnly, - lua->GetAllowedAddons()); + lua->getAllowedAddons()); } WINDOWMANAGER.Show(std::move(w)); } @@ -773,18 +773,18 @@ void dskGameLobby::msgEditEnter(const unsigned ctrl_id) { if(ctrl_id != ID_edtChatMsg) return; - auto* edit = GetCtrl(ctrl_id); - const std::string msg = edit->GetText(); - edit->SetText(""); - if(gameChat->IsVisible()) + auto* edit = getCtrl(ctrl_id); + const std::string msg = edit->getText(); + edit->setText(""); + if(gameChat->isVisible()) GAMECLIENT.commandChat(msg, ChatDestination::All); - else if(lobbyClient_ && lobbyClient_->IsLoggedIn() && lobbyChat->IsVisible()) + else if(lobbyClient_ && lobbyClient_->IsLoggedIn() && lobbyChat->isVisible()) lobbyClient_->SendChat(msg); } void dskGameLobby::CI_Countdown(unsigned remainingTimeInSec) { - if(IsSinglePlayer()) + if(isSinglePlayer()) return; if(!hasCountdown_) @@ -828,12 +828,12 @@ void dskGameLobby::CI_CancelCountdown(bool error) void dskGameLobby::FlashGameChat() { - if(!gameChat->IsVisible()) + if(!gameChat->isVisible()) { - auto* tab = GetCtrl(ID_optChatTab); - auto* bt = tab->GetCtrl(ID_btChatGame); + auto* tab = getCtrl(ID_optChatTab); + auto* bt = tab->getCtrl(ID_btChatGame); if(!localChatTabAnimId) - localChatTabAnimId = tab->GetAnimationManager().addAnimation(new BlinkButtonAnim(bt)); + localChatTabAnimId = tab->getAnimationManager().addAnimation(new BlinkButtonAnim(bt)); } } @@ -924,17 +924,17 @@ void dskGameLobby::msgOptionGroupChange(const unsigned ctrl_id, const unsigned s { if(ctrl_id == ID_optChatTab) { - gameChat->SetVisible(selection == ID_btChatGame); - lobbyChat->SetVisible(selection == ID_btChatLobby); - auto* tab = GetCtrl(ID_optChatTab); - tab->GetCtrl(selection)->SetTexture(TextureColor::Green2); + gameChat->setVisible(selection == ID_btChatGame); + lobbyChat->setVisible(selection == ID_btChatLobby); + auto* tab = getCtrl(ID_optChatTab); + tab->getCtrl(selection)->setTexture(TextureColor::Green2); if(selection == ID_btChatGame) { - tab->GetAnimationManager().finishAnimation(localChatTabAnimId, false); + tab->getAnimationManager().finishAnimation(localChatTabAnimId, false); localChatTabAnimId = 0; } else { - tab->GetAnimationManager().finishAnimation(lobbyChatTabAnimId, false); + tab->getAnimationManager().finishAnimation(lobbyChatTabAnimId, false); lobbyChatTabAnimId = 0; } } @@ -946,13 +946,13 @@ void dskGameLobby::UpdateGGS() GlobalGameSettings& ggs = gameLobby_->getSettings(); - ggs.speed = static_cast(GetCtrl(ID_cbSpeed)->GetSelection().value()); - ggs.objective = static_cast(GetCtrl(ID_cbGoals)->GetSelection().value()); - ggs.startWares = static_cast(GetCtrl(ID_cbGoods)->GetSelection().value()); - ggs.exploration = static_cast(GetCtrl(ID_cbExploration)->GetSelection().value()); - ggs.lockedTeams = GetCtrl(ID_chkLockTeams)->isChecked(); - ggs.teamView = GetCtrl(ID_chkSharedView)->isChecked(); - ggs.randomStartPosition = GetCtrl(ID_chkRandomSpawn)->isChecked(); + ggs.speed = static_cast(getCtrl(ID_cbSpeed)->getSelection().value()); + ggs.objective = static_cast(getCtrl(ID_cbGoals)->getSelection().value()); + ggs.startWares = static_cast(getCtrl(ID_cbGoods)->getSelection().value()); + ggs.exploration = static_cast(getCtrl(ID_cbExploration)->getSelection().value()); + ggs.lockedTeams = getCtrl(ID_chkLockTeams)->isChecked(); + ggs.teamView = getCtrl(ID_chkSharedView)->isChecked(); + ggs.randomStartPosition = getCtrl(ID_chkRandomSpawn)->isChecked(); // An Server übermitteln lobbyController->ChangeGlobalGameSettings(ggs); @@ -962,39 +962,39 @@ void dskGameLobby::ChangeTeam(const unsigned player, const Team team) { constexpr helpers::EnumArray teams = {"-", "?", "1", "2", "3", "4", "1-2", "1-3", "1-4"}; - GetCtrl(ID_grpPlayerStart + player)->GetCtrl(ID_btTeam)->SetText(teams[team]); + getCtrl(ID_grpPlayerStart + player)->getCtrl(ID_btTeam)->setText(teams[team]); } void dskGameLobby::ChangeReady(const unsigned player, const bool ready) { - auto* check = GetCtrl(ID_grpPlayerStart + player)->GetCtrl(ID_chkReady); + auto* check = getCtrl(ID_grpPlayerStart + player)->getCtrl(ID_chkReady); if(check) check->setChecked(ready); if(player == localPlayerId_) { - auto* start = GetCtrl(ID_btStartGame); + auto* start = getCtrl(ID_btStartGame); if(gameLobby_->isHost()) - start->SetText(hasCountdown_ ? _("Cancel start") : _("Start game")); + start->setText(hasCountdown_ ? _("Cancel start") : _("Start game")); else - start->SetText(ready ? _("Not Ready") : _("Ready")); + start->setText(ready ? _("Not Ready") : _("Ready")); } } void dskGameLobby::ChangeNation(const unsigned player, const Nation nation) { - GetCtrl(ID_grpPlayerStart + player)->GetCtrl(ID_btNation)->SetText(_(NationNames[nation])); + getCtrl(ID_grpPlayerStart + player)->getCtrl(ID_btNation)->setText(_(NationNames[nation])); } void dskGameLobby::ChangePortrait(const unsigned player, const unsigned portraitIndex) { RTTR_Assert(portraitIndex < Portraits.size()); const auto& portrait = Portraits[portraitIndex]; - auto* ctrl = GetCtrl(ID_grpPlayerStart + player)->GetCtrl(ID_btPortrait); - ctrl->SetImage(LOADER.GetImageN(portrait.resourceId, portrait.resourceIndex)); - auto* ctrlButton = GetCtrl(ID_grpPlayerStart + player)->GetCtrl(ID_btPortrait); + auto* ctrl = getCtrl(ID_grpPlayerStart + player)->getCtrl(ID_btPortrait); + ctrl->setImage(LOADER.getImageN(portrait.resourceId, portrait.resourceIndex)); + auto* ctrlButton = getCtrl(ID_grpPlayerStart + player)->getCtrl(ID_btPortrait); if(ctrlButton) - ctrlButton->SetTooltip(_(portrait.name)); + ctrlButton->setTooltip(_(portrait.name)); } void dskGameLobby::ChangePing(unsigned playerId) @@ -1008,19 +1008,19 @@ void dskGameLobby::ChangePing(unsigned playerId) color = COLOR_YELLOW; // und setzen - GetCtrl(ID_grpPlayerStart + playerId)->GetCtrl(ID_txtPing)->SetTextColor(color); + getCtrl(ID_grpPlayerStart + playerId)->getCtrl(ID_txtPing)->setTextColor(color); } void dskGameLobby::ChangeColor(const unsigned player, const unsigned color) { - GetCtrl(ID_grpPlayerStart + player)->GetCtrl(ID_btColor)->SetColor(color); + getCtrl(ID_grpPlayerStart + player)->getCtrl(ID_btColor)->setColor(color); // Minimap-Startfarbe ändern - if(GetCtrl(ID_miniMap)) - GetCtrl(ID_miniMap)->SetPlayerColor(player, color); + if(getCtrl(ID_miniMap)) + getCtrl(ID_miniMap)->setPlayerColor(player, color); } -void dskGameLobby::SetPlayerReady(unsigned char player, bool ready) +void dskGameLobby::setPlayerReady(unsigned char player, bool ready) { if(player != localPlayerId_) return; @@ -1088,20 +1088,20 @@ void dskGameLobby::CI_GGSChanged(const GlobalGameSettings& /*ggs*/) { const GlobalGameSettings& ggs = gameLobby_->getSettings(); - GetCtrl(ID_cbSpeed)->SetSelection(static_cast(ggs.speed)); - GetCtrl(ID_cbGoals)->SetSelection(static_cast(ggs.objective)); - GetCtrl(ID_cbGoods)->SetSelection(static_cast(ggs.startWares)); - GetCtrl(ID_cbExploration)->SetSelection(static_cast(ggs.exploration)); - GetCtrl(ID_chkLockTeams)->setChecked(ggs.lockedTeams); - GetCtrl(ID_chkSharedView)->setChecked(ggs.teamView); - GetCtrl(ID_chkRandomSpawn)->setChecked(ggs.randomStartPosition); + getCtrl(ID_cbSpeed)->setSelection(static_cast(ggs.speed)); + getCtrl(ID_cbGoals)->setSelection(static_cast(ggs.objective)); + getCtrl(ID_cbGoods)->setSelection(static_cast(ggs.startWares)); + getCtrl(ID_cbExploration)->setSelection(static_cast(ggs.exploration)); + getCtrl(ID_chkLockTeams)->setChecked(ggs.lockedTeams); + getCtrl(ID_chkSharedView)->setChecked(ggs.teamView); + getCtrl(ID_chkRandomSpawn)->setChecked(ggs.randomStartPosition); - SetPlayerReady(localPlayerId_, false); + setPlayerReady(localPlayerId_, false); } void dskGameLobby::CI_Chat(const unsigned playerId, const ChatDestination /*cd*/, const std::string& msg) { - if((playerId != 0xFFFFFFFF) && !IsSinglePlayer()) + if((playerId != 0xFFFFFFFF) && !isSinglePlayer()) { std::string time = s25util::Time::FormatTime("(%H:%i:%s)"); @@ -1131,12 +1131,12 @@ void dskGameLobby::LC_Chat(const std::string& player, const std::string& text) if(!lobbyChat) return; lobbyChat->AddMessage("", player, ctrlChat::CalcUniqueColor(player), text, COLOR_YELLOW); - if(!lobbyChat->IsVisible()) + if(!lobbyChat->isVisible()) { - auto* tab = GetCtrl(ID_optChatTab); - auto* bt = tab->GetCtrl(ID_btChatLobby); + auto* tab = getCtrl(ID_optChatTab); + auto* bt = tab->getCtrl(ID_btChatLobby); if(!lobbyChatTabAnimId) - lobbyChatTabAnimId = tab->GetAnimationManager().addAnimation(new BlinkButtonAnim(bt)); + lobbyChatTabAnimId = tab->getAnimationManager().addAnimation(new BlinkButtonAnim(bt)); } } diff --git a/libs/s25main/desktops/dskGameLobby.h b/libs/s25main/desktops/dskGameLobby.h index 50c22fca97..0be5dba16c 100644 --- a/libs/s25main/desktops/dskGameLobby.h +++ b/libs/s25main/desktops/dskGameLobby.h @@ -28,10 +28,10 @@ class dskGameLobby final : public Desktop, public ClientInterface, public LobbyI /// Größe ändern-Reaktionen die nicht vom Skaling-Mechanismus erfasst werden. void Resize(const Extent& newSize) override; - void SetActive(bool activate = true) override; + void setActive(bool activate = true) override; private: - void SetPlayerReady(unsigned char player, bool ready); + void setPlayerReady(unsigned char player, bool ready); // GGS von den Controls auslesen void UpdateGGS(); /// Aktualisiert eine Spielerreihe (löscht Controls und legt neue an) @@ -83,9 +83,9 @@ class dskGameLobby final : public Desktop, public ClientInterface, public LobbyI bool checkOptions(); void GoBack(); - bool IsSinglePlayer() const { return serverType == ServerType::Local; } + bool isSinglePlayer() const { return serverType == ServerType::Local; } /// Check whether the given setting can be changed, i.e. is not disabled by lua - bool IsChangeAllowed(const std::string& setting) const; + bool isChangeAllowed(const std::string& setting) const; const ServerType serverType; std::shared_ptr gameLobby_; diff --git a/libs/s25main/desktops/dskIntro.cpp b/libs/s25main/desktops/dskIntro.cpp index 433af6ebd2..60eb2d970f 100644 --- a/libs/s25main/desktops/dskIntro.cpp +++ b/libs/s25main/desktops/dskIntro.cpp @@ -14,12 +14,12 @@ * Klasse des Intro Desktops. */ -dskIntro::dskIntro() : Desktop(LOADER.GetImageN("menu", 0)) +dskIntro::dskIntro() : Desktop(LOADER.getImageN("menu", 0)) { // "Zurück" AddTextButton(0, DrawPoint(300, 550), Extent(200, 22), TextureColor::Red1, _("Back"), NormalFont); - AddImage(11, DrawPoint(20, 20), LOADER.GetImageN("logo", 0)); + AddImage(11, DrawPoint(20, 20), LOADER.getImageN("logo", 0)); } void dskIntro::msgButtonClick(const unsigned ctrl_id) diff --git a/libs/s25main/desktops/dskLAN.cpp b/libs/s25main/desktops/dskLAN.cpp index 5cc2423b68..28eac5bf93 100644 --- a/libs/s25main/desktops/dskLAN.cpp +++ b/libs/s25main/desktops/dskLAN.cpp @@ -29,7 +29,7 @@ enum }; } -dskLAN::dskLAN() : dskMenuBase(LOADER.GetImageN("setup013", 0)), discovery(LAN_DISCOVERY_CFG) +dskLAN::dskLAN() : dskMenuBase(LOADER.getImageN("setup013", 0)), discovery(LAN_DISCOVERY_CFG) { // "Server hinzufügen" AddTextButton(ID_btAddServer, DrawPoint(530, 250), Extent(250, 22), TextureColor::Green2, _("Add Server"), @@ -114,13 +114,13 @@ void dskLAN::UpdateServerList() { ReadOpenGames(); - auto* servertable = GetCtrl(ID_tblServer); + auto* servertable = getCtrl(ID_tblServer); - const unsigned selection = servertable->GetSelection().value_or(0u); - int sortColumn = servertable->GetSortColumn(); + const unsigned selection = servertable->getSelection().value_or(0u); + int sortColumn = servertable->getSortColumn(); if(sortColumn == -1) sortColumn = 0; - const auto direction = servertable->GetSortDirection(); + const auto direction = servertable->getSortDirection(); servertable->DeleteAllItems(); unsigned curId = 0; @@ -135,7 +135,7 @@ void dskLAN::UpdateServerList() if(sortColumn >= 0) servertable->SortRows(sortColumn, direction); - servertable->SetSelection(selection); + servertable->setSelection(selection); } bool dskLAN::ConnectToSelectedGame() @@ -143,17 +143,17 @@ bool dskLAN::ConnectToSelectedGame() if(openGames.empty()) return false; - const auto* table = GetCtrl(ID_tblServer); - const auto& selectedRow = table->GetSelection(); + const auto* table = getCtrl(ID_tblServer); + const auto& selectedRow = table->getSelection(); if(!selectedRow) return false; - const auto selectedId = boost::lexical_cast(table->GetItemText(*selectedRow, 0)); + const auto selectedId = boost::lexical_cast(table->getItemText(*selectedRow, 0)); if(selectedId >= openGames.size()) return false; const GameInfo& game = openGames[selectedId]; - if(game.info.revision == rttr::version::GetRevision()) + if(game.info.revision == rttr::version::getRevision()) { auto connect = std::make_unique(ServerType::LAN); connect->Connect(game.ip, game.info.port, game.info.isIPv6, game.info.hasPwd); diff --git a/libs/s25main/desktops/dskLobby.cpp b/libs/s25main/desktops/dskLobby.cpp index 34f5ba9846..b2fdbdfbb5 100644 --- a/libs/s25main/desktops/dskLobby.cpp +++ b/libs/s25main/desktops/dskLobby.cpp @@ -40,7 +40,7 @@ enum }; } -dskLobby::dskLobby() : dskMenuBase(LOADER.GetImageN("setup013", 0)), serverInfoWnd(nullptr), createServerWnd(nullptr) +dskLobby::dskLobby() : dskMenuBase(LOADER.getImageN("setup013", 0)), serverInfoWnd(nullptr), createServerWnd(nullptr) { AddTextButton(ID_btBack, DrawPoint(530, 530), Extent(250, 22), TextureColor::Red1, _("Back"), NormalFont); AddTextButton(ID_btConnect, DrawPoint(530, 470), Extent(250, 22), TextureColor::Green2, _("Connect"), NormalFont); @@ -94,7 +94,7 @@ void dskLobby::msgPaintBefore() dskMenuBase::msgPaintBefore(); UpdateServerList(); UpdatePlayerList(); - GetCtrl(ID_edtChat)->SetFocus(); + getCtrl(ID_edtChat)->setFocus(); } void dskLobby::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult /*mbr*/) @@ -135,9 +135,9 @@ void dskLobby::msgEditEnter(const unsigned ctrl_id) { if(ctrl_id == ID_edtChat) { - auto* edit = GetCtrl(ID_edtChat); - LOBBYCLIENT.SendChat(edit->GetText()); - edit->SetText(""); + auto* edit = getCtrl(ID_edtChat); + LOBBYCLIENT.SendChat(edit->getText()); + edit->setText(""); } } @@ -145,21 +145,21 @@ void dskLobby::msgTableRightButton(const unsigned ctrl_id, const std::optional(ctrl_id); + auto* table = getCtrl(ctrl_id); switch(ctrl_id) { case ID_tblGames: // Server list { - const std::string& item = table->GetItemText(*selection, 0); + const std::string& item = table->getItemText(*selection, 0); if(boost::lexical_cast(item.c_str()) != 0) { - if(serverInfoWnd && serverInfoWnd->GetServerId() == boost::lexical_cast(item)) + if(serverInfoWnd && serverInfoWnd->getServerId() == boost::lexical_cast(item)) return; // Already open -> Nothing to do serverInfoWnd = &WINDOWMANAGER.ReplaceWindow( std::make_unique(boost::lexical_cast(item))); - serverInfoWnd->SetTitle(table->GetItemText(*selection, 1)); + serverInfoWnd->setTitle(table->getItemText(*selection, 1)); } } break; @@ -197,13 +197,13 @@ void dskLobby::msgWindowClosed(IngameWindow& wnd) bool isServerVersionValid(const LobbyServerInfo& serverInfo) { // The server version is/should be rttr::version::GetReadableVersion() - if(serverInfo.getVersion() == rttr::version::GetReadableVersion()) + if(serverInfo.getVersion() == rttr::version::getReadableVersion()) return true; // If we don't have an exact match we allow at least the same revision. // The short revision is the part after " - " const auto pos = serverInfo.getVersion().rfind(" - "); if(pos != std::string::npos) - return serverInfo.getVersion().substr(pos + 3) == rttr::version::GetShortRevision(); + return serverInfo.getVersion().substr(pos + 3) == rttr::version::getShortRevision(); else { LOG.writeToFile("Can't get server revision from version %1%") % serverInfo.getVersion(); @@ -213,11 +213,11 @@ bool isServerVersionValid(const LobbyServerInfo& serverInfo) bool dskLobby::ConnectToSelectedGame() { - const auto* table = GetCtrl(ID_tblGames); - const auto& selectedRow = table->GetSelection(); + const auto* table = getCtrl(ID_tblGames); + const auto& selectedRow = table->getSelection(); if(!selectedRow) return false; - const auto selectedId = boost::lexical_cast(table->GetItemText(*selectedRow, 0)); + const auto selectedId = boost::lexical_cast(table->getItemText(*selectedRow, 0)); const auto serverList = LOBBYCLIENT.GetServerList(); const auto itServer = helpers::find_if( serverList, [selectedId](const LobbyServerInfo& server) { return server.getId() == selectedId; }); @@ -292,7 +292,7 @@ void dskLobby::LC_Chat(const std::string& player, const std::string& text) MsgboxButton::Ok, MsgboxIcon::ExclamationGreen, 2)); } else if(text.substr(self.length() + 1, 2) == ", ") { - GetCtrl(ID_Chat)->AddMessage(time, player, playerColor, text.substr(self.length() + 3), + getCtrl(ID_Chat)->AddMessage(time, player, playerColor, text.substr(self.length() + 3), COLOR_YELLOW); } } @@ -301,19 +301,19 @@ void dskLobby::LC_Chat(const std::string& player, const std::string& text) } } - GetCtrl(ID_Chat)->AddMessage(time, player, playerColor, text, COLOR_YELLOW); + getCtrl(ID_Chat)->AddMessage(time, player, playerColor, text, COLOR_YELLOW); } void dskLobby::LC_ServerList(const LobbyServerList& servers) { - auto* servertable = GetCtrl(ID_tblGames); - bool first = servertable->GetNumRows() == 0; + auto* servertable = getCtrl(ID_tblGames); + bool first = servertable->getNumRows() == 0; - const unsigned selection = servertable->GetSelection().value_or(0u); - int sortColumn = servertable->GetSortColumn(); + const unsigned selection = servertable->getSelection().value_or(0u); + int sortColumn = servertable->getSortColumn(); if(sortColumn == -1) sortColumn = 0; - const auto direction = servertable->GetSortDirection(); + const auto direction = servertable->getSortDirection(); servertable->DeleteAllItems(); std::set ids; @@ -339,24 +339,24 @@ void dskLobby::LC_ServerList(const LobbyServerList& servers) servertable->SortRows(0, TableSortDir::Ascending); else servertable->SortRows(sortColumn, direction); - servertable->SetSelection(selection); + servertable->setSelection(selection); } void dskLobby::LC_PlayerList(const LobbyPlayerList& players) { - auto* playertable = GetCtrl(ID_tblPlayers); - bool first = playertable->GetNumRows() == 0; + auto* playertable = getCtrl(ID_tblPlayers); + bool first = playertable->getNumRows() == 0; - if((playertable->GetNumRows() > 0) && (playertable->GetNumRows() < players.size())) + if((playertable->getNumRows() > 0) && (playertable->getNumRows() < players.size())) { - LOADER.GetSoundN("sound", 114)->Play(255, false); + LOADER.getSoundN("sound", 114)->Play(255, false); } - const unsigned selection = playertable->GetSelection().value_or(0u); - int sortColumn = playertable->GetSortColumn(); + const unsigned selection = playertable->getSelection().value_or(0u); + int sortColumn = playertable->getSortColumn(); if(sortColumn == -1) sortColumn = 0; - const auto direction = playertable->GetSortDirection(); + const auto direction = playertable->getSortDirection(); playertable->DeleteAllItems(); for(const LobbyPlayerInfo& player : players) @@ -373,7 +373,7 @@ void dskLobby::LC_PlayerList(const LobbyPlayerList& players) playertable->SortRows(0, TableSortDir::Ascending); else playertable->SortRows(sortColumn, direction); - playertable->SetSelection(selection); + playertable->setSelection(selection); } void dskLobby::LC_ServerInfo(const LobbyServerInfo&) diff --git a/libs/s25main/desktops/dskMainMenu.cpp b/libs/s25main/desktops/dskMainMenu.cpp index 07a19e3696..4544037c90 100644 --- a/libs/s25main/desktops/dskMainMenu.cpp +++ b/libs/s25main/desktops/dskMainMenu.cpp @@ -42,12 +42,12 @@ dskMainMenu::dskMainMenu() NormalFont); AddTextButton(ID_btOptions, DrawPoint(115, 250), Extent(220, 22), TextureColor::Green2, _("Options"), NormalFont); AddTextButton(ID_btIntro, DrawPoint(115, 280), Extent(220, 22), TextureColor::Green2, _("Intro"), NormalFont) - ->SetEnabled(false); + ->setEnabled(false); AddTextButton(ID_btReadme, DrawPoint(115, 310), Extent(220, 22), TextureColor::Green2, _("Readme"), NormalFont); AddTextButton(ID_btCredits, DrawPoint(115, 340), Extent(220, 22), TextureColor::Green2, _("Credits"), NormalFont); AddTextButton(ID_btQuit, DrawPoint(115, 390), Extent(220, 22), TextureColor::Red1, _("Quit program"), NormalFont); - AddImage(ID_logo, DrawPoint(20, 20), LOADER.GetImageN("logo", 0)); + AddImage(ID_logo, DrawPoint(20, 20), LOADER.getImageN("logo", 0)); using namespace std::chrono_literals; if(SETTINGS.global.submitDebugData == SubmitDebugData::AskAtStart) @@ -61,7 +61,7 @@ dskMainMenu::dskMainMenu() void dskMainMenu::msgTimer(const unsigned ctrl_id) { - GetCtrl(ctrl_id)->Stop(); + getCtrl(ctrl_id)->Stop(); WINDOWMANAGER.Show(std::make_unique( _("Submit debug data?"), _("RttR now supports sending debug data. Would you like to help us improving this game by sending debug data?"), @@ -83,8 +83,8 @@ void dskMainMenu::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult m bool dskMainMenu::msgLeftUp(const MouseCoords& mc) { - auto* txtVersion = GetCtrl(dskMenuBase::ID_txtVersion); - if(mc.dbl_click && IsPointInRect(mc.pos, txtVersion->GetBoundaryRect())) + auto* txtVersion = getCtrl(dskMenuBase::ID_txtVersion); + if(mc.dbl_click && IsPointInRect(mc.pos, txtVersion->getBoundaryRect())) { WINDOWMANAGER.Switch(std::make_unique()); return true; diff --git a/libs/s25main/desktops/dskMenuBase.cpp b/libs/s25main/desktops/dskMenuBase.cpp index b0e4920c9b..01f1583a12 100644 --- a/libs/s25main/desktops/dskMenuBase.cpp +++ b/libs/s25main/desktops/dskMenuBase.cpp @@ -8,7 +8,7 @@ #include "ogl/FontStyle.h" #include "s25util/colors.h" -dskMenuBase::dskMenuBase() : Desktop(LOADER.GetImageN("menu", 0)) +dskMenuBase::dskMenuBase() : Desktop(LOADER.getImageN("menu", 0)) { AddBottomTexts(); } @@ -22,12 +22,12 @@ void dskMenuBase::AddBottomTexts() { AddFormattedText(ID_txtVersion, DrawPoint(0, 600), "Return To The Roots - %1%", COLOR_YELLOW, FontStyle::LEFT | FontStyle::BOTTOM, NormalFont) - % rttr::version::GetReadableVersion(); + % rttr::version::getReadableVersion(); AddText(ID_txtURL, DrawPoint(400, 600), "http://www.siedler25.org", COLOR_GREEN, FontStyle::CENTER | FontStyle::BOTTOM, NormalFont); AddFormattedText(ID_txtCopyright, DrawPoint(800, 600), "\xC2\xA9" " 2005 - %s Settlers Freaks", COLOR_YELLOW, FontStyle::RIGHT | FontStyle::BOTTOM, NormalFont) - % rttr::version::GetYear(); + % rttr::version::getYear(); } diff --git a/libs/s25main/desktops/dskMultiPlayer.cpp b/libs/s25main/desktops/dskMultiPlayer.cpp index 9b1a746569..a922988ac5 100644 --- a/libs/s25main/desktops/dskMultiPlayer.cpp +++ b/libs/s25main/desktops/dskMultiPlayer.cpp @@ -30,7 +30,7 @@ dskMultiPlayer::dskMultiPlayer() // "Zurück" AddTextButton(6, DrawPoint(115, 290), Extent(220, 22), TextureColor::Red1, _("Back"), NormalFont); - AddImage(11, DrawPoint(20, 20), LOADER.GetImageN("logo", 0)); + AddImage(11, DrawPoint(20, 20), LOADER.getImageN("logo", 0)); } void dskMultiPlayer::msgButtonClick(const unsigned ctrl_id) diff --git a/libs/s25main/desktops/dskOptions.cpp b/libs/s25main/desktops/dskOptions.cpp index 329bb57777..f64a05e4c3 100644 --- a/libs/s25main/desktops/dskOptions.cpp +++ b/libs/s25main/desktops/dskOptions.cpp @@ -161,13 +161,13 @@ ctrlOptionGroup& addOnOffOption(ctrlGroup& parentGroup, DrawPoint pos, unsigned option->AddTextButton(ID_btOn, pos, size, TextureColor::Grey, _("On"), NormalFont); pos.x += size.x + spacing; option->AddTextButton(ID_btOff, pos, size, TextureColor::Grey, _("Off"), NormalFont); - option->SetSelection(value); + option->setSelection(value); return *option; } } // namespace -dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) +dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) { AddText(ID_txtOptions, DrawPoint(400, 10), _("Options"), COLOR_YELLOW, FontStyle::CENTER, LargeFont); @@ -200,12 +200,12 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) groupCommon->AddText(ID_txtName, curPos, _("Name in Game:"), COLOR_YELLOW, FontStyle{}, NormalFont); ctrlEdit* name = groupCommon->AddEdit(ID_edtName, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 15); - name->SetText(SETTINGS.lobby.name); + name->setText(SETTINGS.lobby.name); const auto& currentPortrait = Portraits[SETTINGS.lobby.portraitIndex]; groupCommon->AddImageButton(ID_btCommonPortrait, DrawPoint(500, curPos.y + ctrlOffset.y), Extent(40, rowHeight * 2), TextureColor::Grey, - LOADER.GetImageN(currentPortrait.resourceId, currentPortrait.resourceIndex)); + LOADER.getImageN(currentPortrait.resourceId, currentPortrait.resourceIndex)); curPos.y += rowHeight; groupCommon->AddText(ID_txtCommonPortrait, curPos, _("Portrait:"), COLOR_YELLOW, FontStyle{}, NormalFont); @@ -216,7 +216,7 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) { combo->AddItem(_(Portraits[i].name)); if(SETTINGS.lobby.portraitIndex == i) - combo->SetSelection(i); + combo->setSelection(i); } curPos.y += rowHeight; @@ -231,12 +231,12 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) combo->AddItem(_(l.name)); if(SETTINGS.language.language == l.code) { - combo->SetSelection(static_cast(i)); + combo->setSelection(static_cast(i)); selected = true; } } if(!selected) - combo->SetSelection(0); + combo->setSelection(0); curPos.y += rowHeight; groupCommon->AddTextButton(ID_btKeyboardLayout, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey, @@ -247,27 +247,27 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) groupCommon->AddText(ID_txtPort, curPos, _("Local Port:"), COLOR_YELLOW, FontStyle{}, NormalFont); ctrlEdit* edtPort = groupCommon->AddEdit(ID_edtPort, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 15); - edtPort->SetType(EditType::Number); - edtPort->SetText(SETTINGS.server.localPort); + edtPort->setType(EditType::Number); + edtPort->setText(SETTINGS.server.localPort); curPos.y += rowHeight; // IPv4/6 auto& grpIPv6 = addOnOffOption(*groupCommon, curPos, ID_grpIpv6, _("Use IPv6:"), SETTINGS.server.ipv6); - grpIPv6.GetCtrl(ID_btOn)->SetText(_("IPv6")); - grpIPv6.GetCtrl(ID_btOff)->SetText(_("IPv4")); + grpIPv6.getCtrl(ID_btOn)->setText(_("IPv6")); + grpIPv6.getCtrl(ID_btOff)->setText(_("IPv4")); // Enable/disable the IPv6 field if necessary - grpIPv6.GetCtrl(ID_btOn)->SetEnabled(SETTINGS.proxy.type != ProxyType::Socks5); //-V807 + grpIPv6.getCtrl(ID_btOn)->setEnabled(SETTINGS.proxy.type != ProxyType::Socks5); //-V807 curPos.y += rowHeight; curPos.y += sectionSpacingCommon; // Proxy server groupCommon->AddText(ID_txtProxy, curPos, _("Proxyserver:"), COLOR_YELLOW, FontStyle{}, NormalFont); ctrlEdit* proxy = groupCommon->AddEdit(ID_edtProxy, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont); - proxy->SetText(SETTINGS.proxy.hostname); + proxy->setText(SETTINGS.proxy.hostname); proxy = groupCommon->AddEdit(ID_edtProxyPort, curPos + ctrlOffset2, Extent(50, 22), TextureColor::Grey, NormalFont, 5); - proxy->SetType(EditType::Number); - proxy->SetText(SETTINGS.proxy.port); + proxy->setType(EditType::Number); + proxy->setText(SETTINGS.proxy.port); curPos.y += rowHeight; addOnOffOption(*groupCommon, curPos, ID_grpUPNP, _("Use UPnP"), SETTINGS.global.useUPNP); @@ -284,9 +284,9 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) switch(SETTINGS.proxy.type) { - default: combo->SetSelection(0); break; - case ProxyType::Socks4: combo->SetSelection(1); break; - case ProxyType::Socks5: combo->SetSelection(2); break; + default: combo->setSelection(0); break; + case ProxyType::Socks4: combo->setSelection(1); break; + case ProxyType::Socks5: combo->setSelection(2); break; } curPos.y += rowHeight; @@ -298,20 +298,20 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) combo->AddItem( _("Scroll opposite (Map moves in the opposite direction the mouse is moved when scrolling/panning.)")); combo->AddItem(_("Grab and drag (Map moves with your cursor when scrolling/panning.)")); - combo->SetSelection(static_cast(SETTINGS.interface.mapScrollMode)); + combo->setSelection(static_cast(SETTINGS.interface.mapScrollMode)); curPos.y += rowHeight; auto& grpSmartCursor = addOnOffOption(*groupCommon, curPos, ID_grpSmartCursor, _("Smart Cursor"), SETTINGS.global.smartCursor); - grpSmartCursor.GetCtrl(ID_btOn)->SetTooltip( + grpSmartCursor.getCtrl(ID_btOn)->setTooltip( _("Place cursor on default button for new dialogs / action windows (default)")); - grpSmartCursor.GetCtrl(ID_btOff)->SetTooltip( + grpSmartCursor.getCtrl(ID_btOff)->setTooltip( _("Don't move cursor automatically\nUseful e.g. for split-screen / dual-mice multiplayer (see wiki)")); curPos.y += rowHeight; auto& grpWindowPinning = addOnOffOption(*groupCommon, curPos, ID_grpWindowPinning, _("Window pinning"), SETTINGS.interface.enableWindowPinning); - grpWindowPinning.GetCtrl(ID_btOn)->SetTooltip( + grpWindowPinning.getCtrl(ID_btOn)->setTooltip( _("Replace minimize button on windows by pin button avoiding closing the window with " "ESC.\nMinimize by double-clicking the title bar.")); curPos.y += rowHeight; @@ -324,7 +324,7 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) mainGroup->AddTextButton(ID_btSubmitDebugAsk, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, _("Ask always"), NormalFont); - mainGroup->SetSelection((SETTINGS.global.submitDebugData == SubmitDebugData::Yes) ? ID_btSubmitDebugOn : + mainGroup->setSelection((SETTINGS.global.submitDebugData == SubmitDebugData::Yes) ? ID_btSubmitDebugOn : ID_btSubmitDebugAsk); //-V807 curPos.y += rowHeight; @@ -338,7 +338,7 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) cbDisplayMode->AddItem(_("Windowed")); cbDisplayMode->AddItem(_("Fullscreen")); cbDisplayMode->AddItem(_("Borderless window")); - cbDisplayMode->SetSelection(rttr::enum_cast(SETTINGS.video.displayMode.type)); + cbDisplayMode->setSelection(rttr::enum_cast(SETTINGS.video.displayMode.type)); curPos.y += rowHeight; auto* grpResolution = groupGraphics->AddGroup(ID_grpResolution); @@ -372,9 +372,9 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) for(const auto& video_driver : video_drivers) { - combo->AddItem(video_driver.GetName()); - if(video_driver.GetName() == SETTINGS.driver.video) - combo->SetSelection(combo->GetNumItems() - 1); + combo->AddItem(video_driver.getName()); + if(video_driver.getName() == SETTINGS.driver.video) + combo->setSelection(combo->getNumItems() - 1); } curPos.y += rowHeight; @@ -393,7 +393,7 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) ctrlProgress* FXvolume = groupSound->AddProgress(ID_pgEffectsVol, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, 139, 138, 100); - FXvolume->SetPosition((SETTINGS.sound.effectsVolume * 100) / 255); + FXvolume->setPosition((SETTINGS.sound.effectsVolume * 100) / 255); curPos.y += rowHeight; curPos.y += sectionSpacing; @@ -406,7 +406,7 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) ctrlProgress* Mvolume = groupSound->AddProgress(ID_pgMusicVol, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, 139, 138, 100); - Mvolume->SetPosition((SETTINGS.sound.musicVolume * 100) / 255); //-V807 + Mvolume->setPosition((SETTINGS.sound.musicVolume * 100) / 255); //-V807 curPos.y += rowHeight; curPos.y += sectionSpacing; @@ -423,14 +423,14 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) for(const auto& audio_driver : audio_drivers) { - combo->AddItem(audio_driver.GetName()); - if(audio_driver.GetName() == SETTINGS.driver.audio) - combo->SetSelection(combo->GetNumItems() - 1); + combo->AddItem(audio_driver.getName()); + if(audio_driver.getName() == SETTINGS.driver.audio) + combo->setSelection(combo->getNumItems() - 1); } // Select "General" - mainGroup = GetCtrl(ID_grpOptions); - mainGroup->SetSelection(ID_btCommon, true); + mainGroup = getCtrl(ID_grpOptions); + mainGroup->setSelection(ID_btCommon, true); // Graphics // { @@ -438,7 +438,7 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) loadVideoModes(); // and add to the combo box - ctrlComboBox& cbVideoModes = *grpResolution->GetCtrl(ID_cbResolution); + ctrlComboBox& cbVideoModes = *grpResolution->getCtrl(ID_cbResolution); for(const auto& videoMode : videoModes_) { VideoMode ratio = getAspectRatio(videoMode); @@ -454,9 +454,9 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) // Select, if this is the current resolution if(videoMode == SETTINGS.video.fullscreenSize) //-V807 - cbVideoModes.SetSelection(cbVideoModes.GetNumItems() - 1); + cbVideoModes.setSelection(cbVideoModes.getNumItems() - 1); } - ctrlComboBox& cbWindowSize = *grpWindowSize->GetCtrl(ID_cbWindowSize); + ctrlComboBox& cbWindowSize = *grpWindowSize->getCtrl(ID_cbWindowSize); cbWindowSize.AddItem(""); // Placeholder for current window size for(const auto& size : windowSizes_) { @@ -468,8 +468,8 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) updateResolutionGroups(); // Fill "Limit Framerate" - auto* cbFrameRate = groupGraphics->GetCtrl(ID_cbFramerate); - if(VIDEODRIVER.HasVSync()) + auto* cbFrameRate = groupGraphics->getCtrl(ID_cbFramerate); + if(VIDEODRIVER.hasVSync()) cbFrameRate->AddItem(_("Dynamic (Limits to display refresh rate, works with most drivers)")); for(int framerate : Settings::SCREEN_REFRESH_RATES) { @@ -478,19 +478,19 @@ dskOptions::dskOptions() : Desktop(LOADER.GetImageN("setup013", 0)) else cbFrameRate->AddItem(helpers::toString(framerate) + " FPS"); if(SETTINGS.video.framerate == framerate) - cbFrameRate->SetSelection(cbFrameRate->GetNumItems() - 1); + cbFrameRate->setSelection(cbFrameRate->getNumItems() - 1); } - if(!cbFrameRate->GetSelection()) - cbFrameRate->SetSelection(0); + if(!cbFrameRate->getSelection()) + cbFrameRate->setSelection(0); // } // Sound // { - groupSound->GetCtrl(ID_grpEffects)->SetSelection(SETTINGS.sound.effectsEnabled); - groupSound->GetCtrl(ID_grpBirdSounds)->SetSelection(SETTINGS.sound.birdsEnabled); - groupSound->GetCtrl(ID_grpMusic)->SetSelection(SETTINGS.sound.musicEnabled); + groupSound->getCtrl(ID_grpEffects)->setSelection(SETTINGS.sound.effectsEnabled); + groupSound->getCtrl(ID_grpBirdSounds)->setSelection(SETTINGS.sound.birdsEnabled); + groupSound->getCtrl(ID_grpMusic)->setSelection(SETTINGS.sound.musicEnabled); // } @@ -511,19 +511,19 @@ void dskOptions::msgGroupProgressChange(const unsigned /*group_id*/, const unsig { case ID_pgEffectsVol: SETTINGS.sound.effectsVolume = static_cast((position * 255) / 100); - AUDIODRIVER.SetMasterEffectVolume(SETTINGS.sound.effectsVolume); + AUDIODRIVER.setMasterEffectVolume(SETTINGS.sound.effectsVolume); break; case ID_pgMusicVol: SETTINGS.sound.musicVolume = static_cast((position * 255) / 100); - AUDIODRIVER.SetMusicVolume(SETTINGS.sound.musicVolume); + AUDIODRIVER.setMusicVolume(SETTINGS.sound.musicVolume); break; } } void dskOptions::msgGroupComboSelectItem(const unsigned group_id, const unsigned ctrl_id, const unsigned selection) { - auto* group = GetCtrl(group_id); - auto* combo = group->GetCtrl(ctrl_id); + auto* group = getCtrl(group_id); + auto* combo = group->getCtrl(ctrl_id); switch(ctrl_id) { @@ -551,19 +551,19 @@ void dskOptions::msgGroupComboSelectItem(const unsigned group_id, const unsigned // Disable IPv6 visually if(SETTINGS.proxy.type == ProxyType::Socks4 && SETTINGS.server.ipv6) { - GetCtrl(ID_grpCommon)->GetCtrl(ID_grpIpv6)->SetSelection(0); - GetCtrl(ID_grpCommon) - ->GetCtrl(ID_grpIpv6) - ->GetCtrl(1) - ->SetEnabled(false); + getCtrl(ID_grpCommon)->getCtrl(ID_grpIpv6)->setSelection(0); + getCtrl(ID_grpCommon) + ->getCtrl(ID_grpIpv6) + ->getCtrl(1) + ->setEnabled(false); SETTINGS.server.ipv6 = false; } if(SETTINGS.proxy.type != ProxyType::Socks4) - GetCtrl(ID_grpCommon) - ->GetCtrl(ID_grpIpv6) - ->GetCtrl(1) - ->SetEnabled(true); + getCtrl(ID_grpCommon) + ->getCtrl(ID_grpIpv6) + ->getCtrl(1) + ->setEnabled(true); break; case ID_cbMapScrollMode: SETTINGS.interface.mapScrollMode = static_cast(selection); break; case ID_cbResolution: SETTINGS.video.fullscreenSize = videoModes_[selection]; break; @@ -572,12 +572,12 @@ void dskOptions::msgGroupComboSelectItem(const unsigned group_id, const unsigned { SETTINGS.video.windowedSize = windowSizes_[selection - 1]; if(SETTINGS.video.displayMode == DisplayMode::Windowed - && VIDEODRIVER.GetDisplayMode() == DisplayMode::Windowed) + && VIDEODRIVER.getDisplayMode() == DisplayMode::Windowed) VIDEODRIVER.ResizeScreen(SETTINGS.video.windowedSize, DisplayMode::Windowed); } break; case ID_cbFramerate: - if(VIDEODRIVER.HasVSync()) + if(VIDEODRIVER.hasVSync()) { if(selection == 0) SETTINGS.video.framerate = 0; @@ -588,12 +588,12 @@ void dskOptions::msgGroupComboSelectItem(const unsigned group_id, const unsigned VIDEODRIVER.setTargetFramerate(SETTINGS.video.framerate); break; - case ID_cbVideoDriver: SETTINGS.driver.video = combo->GetText(selection); break; + case ID_cbVideoDriver: SETTINGS.driver.video = combo->getText(selection); break; case ID_cbGuiScale: SETTINGS.video.guiScale = guiScales_[selection]; VIDEODRIVER.setGuiScalePercent(SETTINGS.video.guiScale); break; - case ID_cbAudioDriver: SETTINGS.driver.audio = combo->GetText(selection); break; + case ID_cbAudioDriver: SETTINGS.driver.audio = combo->getText(selection); break; case ID_cbDisplayMode: SETTINGS.video.displayMode = DisplayMode(selection); updateResolutionGroups(); @@ -612,8 +612,8 @@ void dskOptions::msgGroupOptionGroupChange(const unsigned /*group_id*/, const un { SETTINGS.video.displayMode.resizeable = !enabled; const auto newDisplayMode = SETTINGS.video.displayMode; - if(newDisplayMode == DisplayMode::Windowed && VIDEODRIVER.GetDisplayMode() == DisplayMode::Windowed) - VIDEODRIVER.ResizeScreen(VIDEODRIVER.GetWindowSize(), newDisplayMode); + if(newDisplayMode == DisplayMode::Windowed && VIDEODRIVER.getDisplayMode() == DisplayMode::Windowed) + VIDEODRIVER.ResizeScreen(VIDEODRIVER.getWindowSize(), newDisplayMode); } break; case ID_grpVBO: SETTINGS.video.vbo = enabled; break; @@ -634,7 +634,7 @@ void dskOptions::msgGroupOptionGroupChange(const unsigned /*group_id*/, const un case ID_grpUPNP: SETTINGS.global.useUPNP = enabled; break; case ID_grpSmartCursor: SETTINGS.global.smartCursor = enabled; - VIDEODRIVER.SetMouseWarping(enabled); + VIDEODRIVER.setMouseWarping(enabled); break; case ID_grpWindowPinning: SETTINGS.interface.enableWindowPinning = enabled; break; case ID_grpGFInfo: SETTINGS.global.showGFInfo = enabled; break; @@ -648,7 +648,7 @@ void dskOptions::msgOptionGroupChange(const unsigned ctrl_id, const unsigned sel { const auto visGrp = selection + ID_grpCommon - ID_btCommon; for(const unsigned id : {ID_grpCommon, ID_grpGraphics, ID_grpSound}) - GetCtrl(id)->SetVisible(id == visGrp); + getCtrl(id)->setVisible(id == visGrp); } } @@ -673,15 +673,15 @@ void dskOptions::msgButtonClick(const unsigned ctrl_id) { case ID_btBack: { - auto* groupCommon = GetCtrl(ID_grpCommon); + auto* groupCommon = getCtrl(ID_grpCommon); // Save the name - SETTINGS.lobby.name = groupCommon->GetCtrl(ID_edtName)->GetText(); - if(!validatePort(groupCommon->GetCtrl(ID_edtPort)->GetText(), SETTINGS.server.localPort)) + SETTINGS.lobby.name = groupCommon->getCtrl(ID_edtName)->getText(); + if(!validatePort(groupCommon->getCtrl(ID_edtPort)->getText(), SETTINGS.server.localPort)) return; - SETTINGS.proxy.hostname = groupCommon->GetCtrl(ID_edtProxy)->GetText(); - if(!validatePort(groupCommon->GetCtrl(ID_edtProxyPort)->GetText(), SETTINGS.proxy.port)) + SETTINGS.proxy.hostname = groupCommon->getCtrl(ID_edtProxy)->getText(); + if(!validatePort(groupCommon->getCtrl(ID_edtProxyPort)->getText(), SETTINGS.proxy.port)) return; SETTINGS.Save(); @@ -701,8 +701,8 @@ void dskOptions::msgButtonClick(const unsigned ctrl_id) } const auto fullscreen = SETTINGS.video.displayMode == DisplayMode::Fullscreen; - if((fullscreen && SETTINGS.video.fullscreenSize != VIDEODRIVER.GetWindowSize()) //-V807 - || VIDEODRIVER.GetDisplayMode() != SETTINGS.video.displayMode) + if((fullscreen && SETTINGS.video.fullscreenSize != VIDEODRIVER.getWindowSize()) //-V807 + || VIDEODRIVER.getDisplayMode() != SETTINGS.video.displayMode) { const auto screenSize = fullscreen ? SETTINGS.video.fullscreenSize : SETTINGS.video.windowedSize; if(!VIDEODRIVER.ResizeScreen(screenSize, SETTINGS.video.displayMode)) @@ -713,7 +713,7 @@ void dskOptions::msgButtonClick(const unsigned ctrl_id) return; } } - if(SETTINGS.driver.video != VIDEODRIVER.GetName() || SETTINGS.driver.audio != AUDIODRIVER.GetName()) + if(SETTINGS.driver.video != VIDEODRIVER.getName() || SETTINGS.driver.audio != AUDIODRIVER.getName()) { WINDOWMANAGER.Show(std::make_unique( _("Sorry!"), _("You need to restart your game to change the video or audio driver!"), this, @@ -761,7 +761,7 @@ void dskOptions::loadVideoModes() const auto videoModes = VIDEODRIVER.ListVideoModes(); // random access is need for selection videoModes_.assign(videoModes.begin(), videoModes.end()); - const auto windowSizes = VIDEODRIVER.GetDefaultWindowSizes(); + const auto windowSizes = VIDEODRIVER.getDefaultWindowSizes(); windowSizes_.assign(windowSizes.begin(), windowSizes.end()); } @@ -774,7 +774,7 @@ void dskOptions::msgScreenResize(const ScreenResizeEvent& sr) bool dskOptions::msgWheelUp(const MouseCoords& mc) { - if(VIDEODRIVER.GetModKeyState().ctrl) + if(VIDEODRIVER.getModKeyState().ctrl) { scrollGuiScale(true); return true; @@ -784,7 +784,7 @@ bool dskOptions::msgWheelUp(const MouseCoords& mc) bool dskOptions::msgWheelDown(const MouseCoords& mc) { - if(VIDEODRIVER.GetModKeyState().ctrl) + if(VIDEODRIVER.getModKeyState().ctrl) { scrollGuiScale(false); return true; @@ -802,7 +802,7 @@ void dskOptions::updateGuiScale() const auto range = VIDEODRIVER.getGuiScaleRange(); const auto recommendedPercentRounded = roundGuiScale(range.recommendedPercent); - auto* combo = GetCtrl(ID_grpGraphics)->GetCtrl(ID_cbGuiScale); + auto* combo = getCtrl(ID_grpGraphics)->getCtrl(ID_cbGuiScale); guiScales_.clear(); combo->DeleteAllItems(); @@ -810,7 +810,7 @@ void dskOptions::updateGuiScale() guiScales_.push_back(0); combo->AddItem(helpers::format(_("Auto (%u%%)"), range.recommendedPercent)); if(SETTINGS.video.guiScale == 0) - combo->SetSelection(0); + combo->setSelection(0); for(unsigned percent = roundGuiScale(range.minPercent); percent <= range.maxPercent; percent += stepSize) { @@ -820,13 +820,13 @@ void dskOptions::updateGuiScale() combo->AddItem(helpers::toString(percent) + "%"); if(percent == SETTINGS.video.guiScale) - combo->SetSelection(combo->GetNumItems() - 1); + combo->setSelection(combo->getNumItems() - 1); } // if GUI scale exceeds maximum, lower it to keep UI elements on screen if(SETTINGS.video.guiScale > guiScales_.back()) { - combo->SetSelection(combo->GetNumItems() - 1); + combo->setSelection(combo->getNumItems() - 1); SETTINGS.video.guiScale = guiScales_.back(); VIDEODRIVER.setGuiScalePercent(SETTINGS.video.guiScale); } @@ -834,17 +834,17 @@ void dskOptions::updateGuiScale() void dskOptions::scrollGuiScale(bool up) { - auto* combo = GetCtrl(ID_grpGraphics)->GetCtrl(ID_cbGuiScale); - const auto& selection = combo->GetSelection(); + auto* combo = getCtrl(ID_grpGraphics)->getCtrl(ID_cbGuiScale); + const auto& selection = combo->getSelection(); unsigned newSelection = 0; if(!selection || *selection == 0) // No selection or "Auto" item selected newSelection = recommendedGuiScaleIndex_; else - newSelection = std::clamp(*selection + (up ? 1 : -1), 1, combo->GetNumItems() - 1); + newSelection = std::clamp(*selection + (up ? 1 : -1), 1, combo->getNumItems() - 1); if(newSelection != selection) { - combo->SetSelection(newSelection); + combo->setSelection(newSelection); SETTINGS.video.guiScale = guiScales_[newSelection]; VIDEODRIVER.setGuiScalePercent(SETTINGS.video.guiScale); } @@ -853,34 +853,34 @@ void dskOptions::scrollGuiScale(bool up) void dskOptions::updatePortraitControls() { const auto& newPortrait = Portraits[SETTINGS.lobby.portraitIndex]; - auto* groupCommon = GetCtrl(ID_grpCommon); + auto* groupCommon = getCtrl(ID_grpCommon); - auto* portraitButton = groupCommon->GetCtrl(ID_btCommonPortrait); - auto* newPortraitTexture = LOADER.GetTextureN(newPortrait.resourceId, newPortrait.resourceIndex); - portraitButton->SetImage(newPortraitTexture); + auto* portraitButton = groupCommon->getCtrl(ID_btCommonPortrait); + auto* newPortraitTexture = LOADER.getTextureN(newPortrait.resourceId, newPortrait.resourceIndex); + portraitButton->setImage(newPortraitTexture); - auto* portraitCombo = groupCommon->GetCtrl(ID_cbCommonPortrait); - portraitCombo->SetSelection(SETTINGS.lobby.portraitIndex); + auto* portraitCombo = groupCommon->getCtrl(ID_cbCommonPortrait); + portraitCombo->setSelection(SETTINGS.lobby.portraitIndex); } void dskOptions::updateWindowSizeComboBox() { auto* cbWindowSize = - GetCtrl(ID_grpGraphics)->GetCtrl(ID_grpWindowSize)->GetCtrl(ID_cbWindowSize); + getCtrl(ID_grpGraphics)->getCtrl(ID_grpWindowSize)->getCtrl(ID_cbWindowSize); const VideoMode currentSize = - VIDEODRIVER.GetDisplayMode() == DisplayMode::Windowed ? VIDEODRIVER.GetWindowSize() : SETTINGS.video.windowedSize; + VIDEODRIVER.getDisplayMode() == DisplayMode::Windowed ? VIDEODRIVER.getWindowSize() : SETTINGS.video.windowedSize; s25util::ClassicImbuedStream curStr; curStr << currentSize.width << "x" << currentSize.height; - cbWindowSize->SetText(0, curStr.str()); + cbWindowSize->setText(0, curStr.str()); // Not found == -1 -> First entry selected - cbWindowSize->SetSelection(static_cast(helpers::indexOf(windowSizes_, currentSize) + 1)); + cbWindowSize->setSelection(static_cast(helpers::indexOf(windowSizes_, currentSize) + 1)); } void dskOptions::updateResolutionGroups() { const auto currentDisplayMode = SETTINGS.video.displayMode; - auto& grpGraphics = *GetCtrl(ID_grpGraphics); - grpGraphics.GetCtrl(ID_grpResolution)->SetVisible(currentDisplayMode == DisplayMode::Fullscreen); - grpGraphics.GetCtrl(ID_grpWindowSize)->SetVisible(currentDisplayMode == DisplayMode::Windowed); + auto& grpGraphics = *getCtrl(ID_grpGraphics); + grpGraphics.getCtrl(ID_grpResolution)->setVisible(currentDisplayMode == DisplayMode::Fullscreen); + grpGraphics.getCtrl(ID_grpWindowSize)->setVisible(currentDisplayMode == DisplayMode::Windowed); } diff --git a/libs/s25main/desktops/dskSelectMap.cpp b/libs/s25main/desktops/dskSelectMap.cpp index 1657a3d72e..255d4a9131 100644 --- a/libs/s25main/desktops/dskSelectMap.cpp +++ b/libs/s25main/desktops/dskSelectMap.cpp @@ -56,7 +56,7 @@ constexpr unsigned ID_msgBoxError = 0; * @param[in] pass Server-Passwort */ dskSelectMap::dskSelectMap(CreateServerInfo csi) - : Desktop(LOADER.GetImageN("setup015", 0)), csi(std::move(csi)), mapGenThread(nullptr), waitWnd(nullptr) + : Desktop(LOADER.getImageN("setup015", 0)), csi(std::move(csi)), mapGenThread(nullptr), waitWnd(nullptr) { WorldDescription desc; GameDataLoader gdLoader(desc); @@ -128,7 +128,7 @@ dskSelectMap::dskSelectMap(CreateServerInfo csi) AddText(13, DrawPoint(260, 490), _("Mapfile: "), COLOR_YELLOW, FontStyle::LEFT, NormalFont); // "Eigene" auswählen - optiongroup->SetSelection(5, true); + optiongroup->setSelection(5, true); LOBBYCLIENT.AddListener(this); } @@ -142,7 +142,7 @@ dskSelectMap::~dskSelectMap() void dskSelectMap::msgOptionGroupChange(const unsigned /*ctrl_id*/, unsigned selection) { - auto* table = GetCtrl(1); + auto* table = getCtrl(1); // Tabelle leeren table->DeleteAllItems(); @@ -177,7 +177,7 @@ void dskSelectMap::msgOptionGroupChange(const unsigned /*ctrl_id*/, unsigned sel table->SortRows(0, TableSortDir::Ascending); // und Auswahl zurücksetzen - table->SetSelection(std::nullopt); + table->setSelection(std::nullopt); } /// Load a map, throw on error @@ -204,30 +204,30 @@ void dskSelectMap::msgTableSelectItem(const unsigned ctrl_id, const std::optiona if(ctrl_id != 1) return; - ctrlPreviewMinimap& preview = *GetCtrl(11); - ctrlText& txtMapName = *GetCtrl(12); - ctrlText& txtMapPath = *GetCtrl(13); - ctrlButton& btContinue = *GetCtrl(5); - preview.SetMap(nullptr); - txtMapName.SetText(""); - txtMapPath.SetText(""); - btContinue.SetEnabled(false); + ctrlPreviewMinimap& preview = *getCtrl(11); + ctrlText& txtMapName = *getCtrl(12); + ctrlText& txtMapPath = *getCtrl(13); + ctrlButton& btContinue = *getCtrl(5); + preview.setMap(nullptr); + txtMapName.setText(""); + txtMapPath.setText(""); + btContinue.setEnabled(false); // is the selection valid? if(selection) { - ctrlTable& table = *GetCtrl(1); - const std::string& path = table.GetItemText(*selection, 5); + ctrlTable& table = *getCtrl(1); + const std::string& path = table.getItemText(*selection, 5); if(!path.empty()) { try { std::unique_ptr map = loadAndVerifyMap(path); RTTR_Assert(map); - preview.SetMap(map.get()); - txtMapName.SetText(s25util::ansiToUTF8(map->getHeader().getName())); - txtMapPath.SetText(path); - btContinue.SetEnabled(true); + preview.setMap(map.get()); + txtMapName.setText(s25util::ansiToUTF8(map->getHeader().getName())); + txtMapPath.setText(path); + btContinue.setEnabled(true); } catch(const std::runtime_error& e) { const std::string errorTxt = helpers::format(_("Could not load map:\n%1%\n%2%"), path, e.what()); @@ -239,9 +239,9 @@ void dskSelectMap::msgTableSelectItem(const unsigned ctrl_id, const std::optiona } } } - const unsigned txtXPos = preview.GetPos().x + preview.GetSize().x + 10; - txtMapName.SetPos(DrawPoint(txtXPos, txtMapName.GetPos().y)); - txtMapPath.SetPos(DrawPoint(txtXPos, txtMapPath.GetPos().y)); + const unsigned txtXPos = preview.getPos().x + preview.getSize().x + 10; + txtMapName.setPos(DrawPoint(txtXPos, txtMapName.getPos().y)); + txtMapPath.setPos(DrawPoint(txtXPos, txtMapPath.getPos().y)); } void dskSelectMap::GoBack() const @@ -321,17 +321,17 @@ void dskSelectMap::CreateRandomMap() void dskSelectMap::OnMapCreated(const boost::filesystem::path& mapPath) { // select the "played maps" entry - auto* optionGroup = GetCtrl(10); - optionGroup->SetSelection(8, true); + auto* optionGroup = getCtrl(10); + optionGroup->setSelection(8, true); // search for the random map entry and select it in the table - auto* table = GetCtrl(1); + auto* table = getCtrl(1); const auto& mapPathString = mapPath.string(); - for(int i = 0; i < table->GetNumRows(); i++) + for(int i = 0; i < table->getNumRows(); i++) { - if(table->GetItemText(i, 5) == mapPathString) + if(table->getItemText(i, 5) == mapPathString) { - table->SetSelection(i); + table->setSelection(i); break; } } @@ -340,14 +340,14 @@ void dskSelectMap::OnMapCreated(const boost::filesystem::path& mapPath) /// Startet das Spiel mit einer bestimmten Auswahl in der Tabelle void dskSelectMap::StartServer() { - auto* table = GetCtrl(1); - const auto& selection = table->GetSelection(); + auto* table = getCtrl(1); + const auto& selection = table->getSelection(); // Ist die Auswahl gültig? if(selection) { // Kartenpfad aus Tabelle holen - const std::string& mapPath = table->GetItemText(*selection, 5); + const std::string& mapPath = table->getItemText(*selection, 5); // Server starten if(!GAMECLIENT.HostGame(csi, {mapPath, MapType::OldMap})) @@ -417,7 +417,7 @@ void dskSelectMap::Draw_() void dskSelectMap::FillTable(const std::vector& files) { - auto* table = GetCtrl(1); + auto* table = getCtrl(1); for(const bfs::path& filePath : files) { diff --git a/libs/s25main/desktops/dskSinglePlayer.cpp b/libs/s25main/desktops/dskSinglePlayer.cpp index e9fbadacd7..8b47020432 100644 --- a/libs/s25main/desktops/dskSinglePlayer.cpp +++ b/libs/s25main/desktops/dskSinglePlayer.cpp @@ -48,7 +48,7 @@ dskSinglePlayer::dskSinglePlayer() AddTextButton(8, DrawPoint(115, 390), Extent(220, 22), TextureColor::Red1, _("Back"), NormalFont); - AddImage(11, DrawPoint(20, 20), LOADER.GetImageN("logo", 0)); + AddImage(11, DrawPoint(20, 20), LOADER.getImageN("logo", 0)); } void dskSinglePlayer::msgButtonClick(const unsigned ctrl_id) @@ -69,9 +69,9 @@ void dskSinglePlayer::msgButtonClick(const unsigned ctrl_id) if(!save.Load(savFile, SaveGameDataToLoad::Header)) continue; - if(save.GetSaveTime() > recent) + if(save.getSaveTime() > recent) { - recent = save.GetSaveTime(); + recent = save.getSaveTime(); mostRecentFilepath = savFile; } } diff --git a/libs/s25main/desktops/dskSplash.cpp b/libs/s25main/desktops/dskSplash.cpp index 154ac2c50b..e1622d44c6 100644 --- a/libs/s25main/desktops/dskSplash.cpp +++ b/libs/s25main/desktops/dskSplash.cpp @@ -27,24 +27,24 @@ dskSplash::dskSplash(std::unique_ptr splashImg) : Desktop(splashImg.get()), splashImg(std::move(splashImg)), isLoading(false), isLoaded(false) { background->setInterpolateTexture(false); - WINDOWMANAGER.SetCursor(Cursor::None); + WINDOWMANAGER.setCursor(Cursor::None); } dskSplash::~dskSplash() { - WINDOWMANAGER.SetCursor(); + WINDOWMANAGER.setCursor(); } -void dskSplash::SetActive(bool activate) +void dskSplash::setActive(bool activate) { - Desktop::SetActive(activate); - if(activate && !GetCtrl(0)) + Desktop::setActive(activate); + if(activate && !getCtrl(0)) AddTimer(0, 1ms); } void dskSplash::msgTimer(const unsigned ctrl_id) { - GetCtrl(ctrl_id)->Stop(); + getCtrl(ctrl_id)->Stop(); if(ctrl_id == 0) AddTimer(1, 1ms); else if(ctrl_id == 1 && !isLoaded && !isLoading) @@ -70,9 +70,9 @@ void dskSplash::LoadFiles() { isLoaded = true; AddTimer(2, 5s); - SetFpsDisplay(true); + setFpsDisplay(true); if(loader.getPlaylist()) - MUSICPLAYER.SetPlaylist(std::move(*loader.getPlaylist())); + MUSICPLAYER.setPlaylist(std::move(*loader.getPlaylist())); if(SETTINGS.sound.musicEnabled) MUSICPLAYER.Play(); diff --git a/libs/s25main/desktops/dskSplash.h b/libs/s25main/desktops/dskSplash.h index c01d7d3213..8624ec8d04 100644 --- a/libs/s25main/desktops/dskSplash.h +++ b/libs/s25main/desktops/dskSplash.h @@ -15,7 +15,7 @@ class dskSplash : public Desktop dskSplash(std::unique_ptr splashImg); ~dskSplash() override; - void SetActive(bool activate) override; + void setActive(bool activate) override; private: void msgTimer(unsigned ctrl_id) override; diff --git a/libs/s25main/desktops/dskTest.cpp b/libs/s25main/desktops/dskTest.cpp index c4dec96516..018fff8df5 100644 --- a/libs/s25main/desktops/dskTest.cpp +++ b/libs/s25main/desktops/dskTest.cpp @@ -54,17 +54,17 @@ dskTest::dskTest() : curBGIdx(LOAD_SCREENS.size()) AddText(curId, DrawPoint(10, yPos + 3), labels.at(i), COLOR_YELLOW, FontStyle::LEFT, NormalFont); ctrlButton* bt; bt = AddTextButton(curId + 1, DrawPoint(120, yPos), Extent(95, 22), textures[i], "Nothing", NormalFont); - bt->SetIlluminated(false); - bt->SetBorder(false); + bt->setIlluminated(false); + bt->setBorder(false); bt = AddTextButton(curId + 2, DrawPoint(220, yPos), Extent(95, 22), textures[i], "Illuminated", NormalFont); - bt->SetIlluminated(true); - bt->SetBorder(false); + bt->setIlluminated(true); + bt->setBorder(false); bt = AddTextButton(curId + 3, DrawPoint(320, yPos), Extent(95, 22), textures[i], "Border", NormalFont); - bt->SetIlluminated(false); - bt->SetBorder(true); + bt->setIlluminated(false); + bt->setBorder(true); bt = AddTextButton(curId + 4, DrawPoint(420, yPos), Extent(95, 22), textures[i], "Both", NormalFont); - bt->SetIlluminated(true); - bt->SetBorder(true); + bt->setIlluminated(true); + bt->setBorder(true); curId += 5; yPos += 30; } @@ -72,12 +72,12 @@ dskTest::dskTest() : curBGIdx(LOAD_SCREENS.size()) DrawPoint btPos(10, yPos); ctrlButton* bt = AddTextButton(ID_btAniBg, btPos, Extent(700, 40), TextureColor::Green2, "", NormalFont); - bt->SetBorder(false); - bt->SetEnabled(false); + bt->setBorder(false); + bt->setEnabled(false); bt = AddTextButton(ID_btAni, btPos + DrawPoint(0, 5), Extent(30, 30), TextureColor::Red1, "", NormalFont); - bt->SetBorder(false); - bt->SetEnabled(false); - bt->SetIlluminated(true); + bt->setBorder(false); + bt->setEnabled(false); + bt->setIlluminated(true); btPos.y += 45; AddEdit(ID_edtTest, btPos, Extent(150, 22), TextureColor::Green2, NormalFont, 0, false, false, true); @@ -86,7 +86,7 @@ dskTest::dskTest() : curBGIdx(LOAD_SCREENS.size()) cb->AddItem("Small Font"); cb->AddItem("Medium Font"); cb->AddItem("Large Font"); - cb->SetSelection(0); + cb->setSelection(0); btPos.x += 110; btPos.y += 11; AddText(ID_txtTest, btPos, "Enter something", COLOR_YELLOW, FontStyle::VCENTER, SmallFont); @@ -109,7 +109,7 @@ dskTest::dskTest() : curBGIdx(LOAD_SCREENS.size()) void dskTest::msgEditChange(const unsigned ctrl_id) { if(ctrl_id == ID_edtTest) - GetCtrl(ID_txtTest)->SetText(GetCtrl(ID_edtTest)->GetText()); + getCtrl(ID_txtTest)->setText(getCtrl(ID_edtTest)->getText()); } void dskTest::msgComboSelectItem(const unsigned ctrl_id, const unsigned selection) @@ -117,11 +117,11 @@ void dskTest::msgComboSelectItem(const unsigned ctrl_id, const unsigned selectio if(ctrl_id == ID_cbTxtSize) { if(selection == 0) - GetCtrl(ID_txtTest)->SetFont(SmallFont); + getCtrl(ID_txtTest)->setFont(SmallFont); else if(selection == 1) - GetCtrl(ID_txtTest)->SetFont(NormalFont); + getCtrl(ID_txtTest)->setFont(NormalFont); else - GetCtrl(ID_txtTest)->SetFont(LargeFont); + getCtrl(ID_txtTest)->setFont(LargeFont); } } @@ -134,34 +134,34 @@ void dskTest::msgButtonClick(const unsigned ctrl_id) case ID_btDisable: for(unsigned i = ID_grpBtStart; i < ID_grpBtEnd; i++) { - auto* bt = GetCtrl(i); + auto* bt = getCtrl(i); if(bt) - bt->SetEnabled(!bt->GetEnabled()); + bt->setEnabled(!bt->getEnabled()); } break; case ID_btAnimate: case ID_btAnimateOscillate: case ID_btAnimateRepeat: { - auto* btAniBg = GetCtrl(ID_btAniBg); - auto* btAni = GetCtrl(ID_btAni); + auto* btAniBg = getCtrl(ID_btAniBg); + auto* btAni = getCtrl(ID_btAni); // Stop all - GetAnimationManager().removeElementAnimations(btAni->GetID()); - GetAnimationManager().finishElementAnimations(ID_btAnimate, false); - GetAnimationManager().finishElementAnimations(ID_btAnimateOscillate, false); - GetAnimationManager().finishElementAnimations(ID_btAnimateRepeat, false); - DrawPoint startPos(btAniBg->GetPos()); + getAnimationManager().removeElementAnimations(btAni->getID()); + getAnimationManager().finishElementAnimations(ID_btAnimate, false); + getAnimationManager().finishElementAnimations(ID_btAnimateOscillate, false); + getAnimationManager().finishElementAnimations(ID_btAnimateRepeat, false); + DrawPoint startPos(btAniBg->getPos()); startPos.y += 5; - btAni->SetPos(startPos); + btAni->setPos(startPos); DrawPoint endPos(startPos); - endPos.x += btAniBg->GetSize().x - btAni->GetSize().x; + endPos.x += btAniBg->getSize().x - btAni->getSize().x; Animation::RepeatType repeat = Animation::RepeatType::None; if(ctrl_id == ID_btAnimateOscillate) repeat = Animation::RepeatType::Oscillate; else if(ctrl_id == ID_btAnimateRepeat) repeat = Animation::RepeatType::Repeat; - GetAnimationManager().addAnimation(new MoveAnimation(btAni, endPos, 4000, repeat)); - GetAnimationManager().addAnimation(new BlinkButtonAnim(GetCtrl(ctrl_id))); + getAnimationManager().addAnimation(new MoveAnimation(btAni, endPos, 4000, repeat)); + getAnimationManager().addAnimation(new BlinkButtonAnim(getCtrl(ctrl_id))); break; } case ID_btHideCtrls: ToggleCtrlVisibility(); @@ -170,12 +170,12 @@ void dskTest::msgButtonClick(const unsigned ctrl_id) bool dskTest::msgRightUp(const MouseCoords& mc) { - std::vector bts = GetCtrls(); + std::vector bts = getCtrls(); for(ctrlButton* bt : bts) { - if(IsPointInRect(mc.pos, bt->GetDrawRect())) + if(IsPointInRect(mc.pos, bt->getDrawRect())) { - bt->SetChecked(!bt->GetCheck()); + bt->setChecked(!bt->getCheck()); return true; } } @@ -186,9 +186,9 @@ void dskTest::ToggleCtrlVisibility() { for(int i = ID_txtTitle; i <= ID_btHideCtrls; i++) { - auto* ctrl = GetCtrl(i); + auto* ctrl = getCtrl(i); if(ctrl) - ctrl->SetVisible(!ctrl->IsVisible()); + ctrl->setVisible(!ctrl->isVisible()); } } @@ -199,11 +199,11 @@ bool dskTest::msgKeyDown(const KeyEvent& ke) else if(ke.kt == KeyType::Left) { curBGIdx = (curBGIdx > 0) ? curBGIdx - 1 : LOAD_SCREENS.size() - 1; - background = LOADER.GetImageN(ResourceId(LOAD_SCREENS[curBGIdx]), 0); + background = LOADER.getImageN(ResourceId(LOAD_SCREENS[curBGIdx]), 0); } else if(ke.kt == KeyType::Right) { curBGIdx = (curBGIdx < LOAD_SCREENS.size() - 1) ? curBGIdx + 1 : 0; - background = LOADER.GetImageN(ResourceId(LOAD_SCREENS[curBGIdx]), 0); + background = LOADER.getImageN(ResourceId(LOAD_SCREENS[curBGIdx]), 0); } else if(ke.kt == KeyType::Escape) WINDOWMANAGER.Switch(std::make_unique()); else diff --git a/libs/s25main/desktops/dskTextureTest.cpp b/libs/s25main/desktops/dskTextureTest.cpp index f495a6a0a6..f9ad6b7840 100644 --- a/libs/s25main/desktops/dskTextureTest.cpp +++ b/libs/s25main/desktops/dskTextureTest.cpp @@ -49,24 +49,24 @@ void dskTextureTest::Load() } desc = newDesc; - auto* cb = GetCtrl(ID_cbTexture); - const unsigned selection = cb->GetSelection().value_or(0); + auto* cb = getCtrl(ID_cbTexture); + const unsigned selection = cb->getSelection().value_or(0); cb->DeleteAllItems(); for(const auto& t : desc.terrain) cb->AddItem(t.name); - cb->SetSelection(selection); + cb->setSelection(selection); msgComboSelectItem(ID_cbTexture, selection); } void dskTextureTest::msgComboSelectItem(const unsigned ctrl_id, const unsigned selection) { - curTerrainIdx = desc.terrain.getIndex(GetCtrl(ctrl_id)->GetText(selection)); + curTerrainIdx = desc.terrain.getIndex(getCtrl(ctrl_id)->getText(selection)); if(!curTerrainIdx) return; const TerrainDesc& cur = desc.get(curTerrainIdx); LOADER.Load(RTTRCONFIG.ExpandPath(cur.texturePath)); const auto textureName = ResourceId::make(bfs::path(cur.texturePath)); - glArchivItem_Bitmap* texBmp = LOADER.GetImageN(textureName, 0); + glArchivItem_Bitmap* texBmp = LOADER.getImageN(textureName, 0); curTexture = LOADER.ExtractTexture(*texBmp, cur.posInTexture); } @@ -84,12 +84,12 @@ void dskTextureTest::msgPaintAfter() if(!curTexture) return; DrawRectangle(Rect(0, 50, 800, 550), COLOR_BLACK); - VIDEODRIVER.BindTexture(curTexture->GetTexture()); + VIDEODRIVER.BindTexture(curTexture->getTexture()); const TerrainDesc& cur = desc.get(curTerrainIdx); Position texOrigin = cur.posInTexture.getOrigin(); - PointF texSize(curTexture->GetTexSize()); + PointF texSize(curTexture->getTexSize()); - TerrainDesc::Triangle trianglePos = cur.GetRSUTriangle(); + TerrainDesc::Triangle trianglePos = cur.getRSUTriangle(); std::array texCoords; Triangle& rsuCoord = texCoords[0]; @@ -101,7 +101,7 @@ void dskTextureTest::msgPaintAfter() rsuCoord[i] /= texSize; Triangle& usdCoord = texCoords[1]; - trianglePos = cur.GetUSDTriangle(); + trianglePos = cur.getUSDTriangle(); usdCoord[0] = PointF(trianglePos.left - texOrigin); usdCoord[1] = PointF(trianglePos.tip - texOrigin); usdCoord[2] = PointF(trianglePos.right - texOrigin); diff --git a/libs/s25main/drivers/AudioDriverWrapper.cpp b/libs/s25main/drivers/AudioDriverWrapper.cpp index 0de6859ad0..4febcdd708 100644 --- a/libs/s25main/drivers/AudioDriverWrapper.cpp +++ b/libs/s25main/drivers/AudioDriverWrapper.cpp @@ -38,10 +38,10 @@ void AudioDriverWrapper::StopMusic() } /// Wird ein Sound (noch) abgespielt? -bool AudioDriverWrapper::IsEffectPlaying(EffectPlayId play_id) +bool AudioDriverWrapper::isEffectPlaying(EffectPlayId play_id) { if(audiodriver_) - return audiodriver_->IsEffectPlaying(play_id); + return audiodriver_->isEffectPlaying(play_id); else return false; } @@ -53,21 +53,21 @@ void AudioDriverWrapper::ChangeVolume(EffectPlayId play_id, uint8_t volume) audiodriver_->ChangeVolume(play_id, volume); } -void AudioDriverWrapper::SetMasterEffectVolume(uint8_t volume) +void AudioDriverWrapper::setMasterEffectVolume(uint8_t volume) { if(audiodriver_) - audiodriver_->SetMasterEffectVolume(volume); + audiodriver_->setMasterEffectVolume(volume); } -void AudioDriverWrapper::SetMusicVolume(uint8_t volume) +void AudioDriverWrapper::setMusicVolume(uint8_t volume) { if(audiodriver_) - audiodriver_->SetMusicVolume(volume); + audiodriver_->setMusicVolume(volume); } -std::string AudioDriverWrapper::GetName() const +std::string AudioDriverWrapper::getName() const { - const char* name = (audiodriver_) ? audiodriver_->GetName() : nullptr; + const char* name = (audiodriver_) ? audiodriver_->getName() : nullptr; return (name) ? name : ""; } @@ -79,7 +79,7 @@ bool AudioDriverWrapper::Init() return false; } - LOG.write(_("Loaded audio driver \"%1%\"\n")) % GetName(); + LOG.write(_("Loaded audio driver \"%1%\"\n")) % getName(); return true; } @@ -97,12 +97,12 @@ bool AudioDriverWrapper::LoadDriver(std::string& preference) if(!driver_wrapper.Load(drivers::DriverType::Audio, preference)) return false; - auto createAudioInstance = driver_wrapper.GetFunction("CreateAudioInstance"); - auto freeAudioInstance = driver_wrapper.GetFunction("FreeAudioInstance"); + auto createAudioInstance = driver_wrapper.getFunction("CreateAudioInstance"); + auto freeAudioInstance = driver_wrapper.getFunction("FreeAudioInstance"); RTTR_Assert(createAudioInstance && freeAudioInstance); // Instanz erzeugen - audiodriver_ = Handle(createAudioInstance(this, VIDEODRIVER.GetMapPointer()), freeAudioInstance); + audiodriver_ = Handle(createAudioInstance(this, VIDEODRIVER.getMapPointer()), freeAudioInstance); return Init(); } diff --git a/libs/s25main/drivers/AudioDriverWrapper.h b/libs/s25main/drivers/AudioDriverWrapper.h index fae53f4eb5..8490edb20e 100644 --- a/libs/s25main/drivers/AudioDriverWrapper.h +++ b/libs/s25main/drivers/AudioDriverWrapper.h @@ -57,15 +57,15 @@ class AudioDriverWrapper : void StopMusic(); /// Wird ein Sound (noch) abgespielt? - bool IsEffectPlaying(EffectPlayId play_id); + bool isEffectPlaying(EffectPlayId play_id); /// Verändert die Lautstärke von einem abgespielten Sound (falls er noch abgespielt wird) void ChangeVolume(EffectPlayId play_id, uint8_t volume); - void SetMasterEffectVolume(uint8_t volume); - void SetMusicVolume(uint8_t volume); + void setMasterEffectVolume(uint8_t volume); + void setMusicVolume(uint8_t volume); - std::string GetName() const; + std::string getName() const; private: using Handle = std::unique_ptr; diff --git a/libs/s25main/drivers/DriverWrapper.cpp b/libs/s25main/drivers/DriverWrapper.cpp index 743e758ed7..e71ff35d11 100644 --- a/libs/s25main/drivers/DriverWrapper.cpp +++ b/libs/s25main/drivers/DriverWrapper.cpp @@ -55,19 +55,19 @@ bool DriverWrapper::Load(const DriverType dt, std::string& preference) return false; /// Suche, ob der Treiber dabei ist, den wir wünschen - const auto it = helpers::find_if(drivers, [preference](const auto& it) { return it.GetName() == preference; }); + const auto it = helpers::find_if(drivers, [preference](const auto& it) { return it.getName() == preference; }); if(it != drivers.end()) { // Dann den gleich nehmen - dll = tryLoadLibrary(it->GetFile()); + dll = tryLoadLibrary(it->getFile()); } // ersten Treiber laden if(!dll) { - dll = tryLoadLibrary(drivers.front().GetFile()); + dll = tryLoadLibrary(drivers.front().getFile()); // Standardwert zuweisen - preference = drivers.front().GetName(); + preference = drivers.front().getName(); } if(!dll) @@ -79,7 +79,7 @@ bool DriverWrapper::Load(const DriverType dt, std::string& preference) return true; } -bool DriverWrapper::IsLoaded() const +bool DriverWrapper::isLoaded() const { return dll.is_loaded(); } diff --git a/libs/s25main/drivers/DriverWrapper.h b/libs/s25main/drivers/DriverWrapper.h index 21b15b92d0..62d9496724 100644 --- a/libs/s25main/drivers/DriverWrapper.h +++ b/libs/s25main/drivers/DriverWrapper.h @@ -28,8 +28,8 @@ class DriverWrapper { public: DriverItem(bfs::path file, std::string name) : file(std::move(file)), name(std::move(name)) {} - const bfs::path& GetFile() const { return file; } - const std::string& GetName() const { return name; } + const bfs::path& getFile() const { return file; } + const std::string& getName() const { return name; } private: bfs::path file; @@ -42,9 +42,9 @@ class DriverWrapper bool Load(DriverType dt, std::string& preference); /// Gibt eine Treiber-Handle wieder frei void Unload(); - bool IsLoaded() const; + bool isLoaded() const; template - T* GetFunction(const std::string& name) + T* getFunction(const std::string& name) { return dll.get(name); } diff --git a/libs/s25main/drivers/VideoDriverWrapper.cpp b/libs/s25main/drivers/VideoDriverWrapper.cpp index 5c7c295669..3e26bb090d 100644 --- a/libs/s25main/drivers/VideoDriverWrapper.cpp +++ b/libs/s25main/drivers/VideoDriverWrapper.cpp @@ -48,7 +48,7 @@ bool VideoDriverWrapper::Initialize() return false; } - LOG.write(_("Loaded video driver \"%1%\"\n")) % GetName(); + LOG.write(_("Loaded video driver \"%1%\"\n")) % getName(); frameCtr_ = std::make_unique(); frameLimiter_ = std::make_unique(); @@ -70,8 +70,8 @@ bool VideoDriverWrapper::LoadDriver(std::string& preference) if(!driver_wrapper.Load(drivers::DriverType::Video, preference)) return false; - auto createVideoInstance = driver_wrapper.GetFunction("CreateVideoInstance"); - auto freeVideoInstance = driver_wrapper.GetFunction("FreeVideoInstance"); + auto createVideoInstance = driver_wrapper.getFunction("CreateVideoInstance"); + auto freeVideoInstance = driver_wrapper.getFunction("FreeVideoInstance"); RTTR_Assert(createVideoInstance && freeVideoInstance); videodriver = Handle(createVideoInstance(&WINDOWMANAGER), freeVideoInstance); @@ -93,7 +93,7 @@ bool VideoDriverWrapper::CreateScreen(const VideoMode size, const DisplayMode di return false; } - if(!videodriver->CreateScreen(rttr::version::GetTitle(), size, displayMode)) + if(!videodriver->CreateScreen(rttr::version::getTitle(), size, displayMode)) { s25util::fatal_error("Could not create window!"); return false; @@ -113,7 +113,7 @@ bool VideoDriverWrapper::CreateScreen(const VideoMode size, const DisplayMode di SwapBuffers(); // WindowManager informieren - WINDOWMANAGER.msgScreenResize(GetRenderSize()); + WINDOWMANAGER.msgScreenResize(getRenderSize()); return true; } @@ -128,14 +128,14 @@ bool VideoDriverWrapper::ResizeScreen(const VideoMode size, const DisplayMode di const bool result = videodriver->ResizeScreen(size, displayMode); #ifdef _WIN32 - if(videodriver->GetDisplayMode() != DisplayMode::Fullscreen) + if(videodriver->getDisplayMode() != DisplayMode::Fullscreen) { // We cannot change the size of a maximized window. So restore it here WINDOWPLACEMENT wp; wp.length = sizeof(WINDOWPLACEMENT); - if(GetWindowPlacement((HWND)GetMapPointer(), &wp) && ((wp.showCmd & SW_MAXIMIZE) == SW_MAXIMIZE)) - ShowWindow((HWND)GetMapPointer(), SW_RESTORE); + if(GetWindowPlacement((HWND)getMapPointer(), &wp) && ((wp.showCmd & SW_MAXIMIZE) == SW_MAXIMIZE)) + ShowWindow((HWND)getMapPointer(), SW_RESTORE); } #endif WINDOWMANAGER.WindowResized(); @@ -151,9 +151,9 @@ bool VideoDriverWrapper::DestroyScreen() } LOG.write("Clearing textures: "); - unsigned ladezeit = GetTickCount(); + unsigned ladezeit = getTickCount(); CleanUp(); - LOG.write("Finished in %dms\n") % (GetTickCount() - ladezeit); + LOG.write("Finished in %dms\n") % (getTickCount() - ladezeit); // Videotreiber zurücksetzen videodriver->DestroyScreen(); @@ -174,7 +174,7 @@ void VideoDriverWrapper::setTargetFramerate(int target) frameLimiter_->setTargetFramerate(60); } -unsigned VideoDriverWrapper::GetFPS() const +unsigned VideoDriverWrapper::getFPS() const { return frameCtr_->getFrameRate(); } @@ -225,10 +225,10 @@ void VideoDriverWrapper::DeleteTexture(unsigned t) } } -KeyEvent VideoDriverWrapper::GetModKeyState() const +KeyEvent VideoDriverWrapper::getModKeyState() const { if(videodriver) - return videodriver->GetModKeyState(); + return videodriver->getModKeyState(); return KeyEvent(); } @@ -276,11 +276,11 @@ bool VideoDriverWrapper::setHwVSync(bool enabled) void VideoDriverWrapper::RenewViewport() { - if(!videodriver->IsOpenGL() || !renderer_) + if(!videodriver->isOpenGL() || !renderer_) return; - const Extent renderSize = videodriver->GetRenderSize(); - const VideoMode windowSize = videodriver->GetWindowSize(); + const Extent renderSize = videodriver->getRenderSize(); + const VideoMode windowSize = videodriver->getWindowSize(); // Set the viewport and scissor area to the entire window glViewport(0, 0, windowSize.width, windowSize.height); @@ -333,11 +333,11 @@ void VideoDriverWrapper::RenewViewport() bool VideoDriverWrapper::LoadAllExtensions() { - if(videodriver->IsOpenGL()) + if(videodriver->isOpenGL()) renderer_ = std::make_unique(); else renderer_ = std::make_unique(); - if(!renderer_->initOpenGL(videodriver->GetLoaderFunction())) + if(!renderer_->initOpenGL(videodriver->getLoaderFunction())) return false; LOG.write(_("OpenGL %1%.%2% supported\n")) % GLVersion.major % GLVersion.minor; if(GLVersion.major < RTTR_OGL_MAJOR || (GLVersion.major == RTTR_OGL_MAJOR && GLVersion.minor < RTTR_OGL_MINOR)) @@ -357,17 +357,17 @@ bool VideoDriverWrapper::LoadAllExtensions() return true; } -unsigned VideoDriverWrapper::GetTickCount() +unsigned VideoDriverWrapper::getTickCount() { if(!videodriver) return (unsigned)time(nullptr); - return (unsigned)videodriver->GetTickCount(); + return (unsigned)videodriver->getTickCount(); } -std::string VideoDriverWrapper::GetName() const +std::string VideoDriverWrapper::getName() const { - const char* name = (videodriver) ? videodriver->GetName() : nullptr; + const char* name = (videodriver) ? videodriver->getName() : nullptr; return (name) ? name : ""; } @@ -386,46 +386,46 @@ void* VideoDriverWrapper::loadExtension(const std::string& extension) return (nullptr); } - return videodriver->GetLoaderFunction()(extension.c_str()); + return videodriver->getLoaderFunction()(extension.c_str()); } -Position VideoDriverWrapper::GetMousePos() const +Position VideoDriverWrapper::getMousePos() const { if(!videodriver) return Position::Invalid(); - return videodriver->GetMousePos(); + return videodriver->getMousePos(); } -bool VideoDriverWrapper::IsLeftDown() +bool VideoDriverWrapper::isLeftDown() { if(!videodriver) return false; - return videodriver->GetMouseStateL(); + return videodriver->getMouseStateL(); } -bool VideoDriverWrapper::IsRightDown() +bool VideoDriverWrapper::isRightDown() { if(!videodriver) return false; - return videodriver->GetMouseStateR(); + return videodriver->getMouseStateR(); } -bool VideoDriverWrapper::IsTouch() +bool VideoDriverWrapper::isTouch() { if(!videodriver) return false; - return videodriver->IsTouchEvent(); + return videodriver->isTouchEvent(); } -void VideoDriverWrapper::SetMousePos(const Position& newPos) +void VideoDriverWrapper::setMousePos(const Position& newPos) { if(!videodriver || !enableMouseWarping) return; - videodriver->SetMousePos(newPos); + videodriver->setMousePos(newPos); } std::set VideoDriverWrapper::ListVideoModes() const @@ -441,7 +441,7 @@ std::set VideoDriverWrapper::ListVideoModes() const return result; } -std::set VideoDriverWrapper::GetDefaultWindowSizes() const +std::set VideoDriverWrapper::getDefaultWindowSizes() const { // clang-format off std::array defaultWindowSizes = { @@ -462,36 +462,36 @@ std::set VideoDriverWrapper::GetDefaultWindowSizes() const return windowSizes; } -bool VideoDriverWrapper::HasVSync() const +bool VideoDriverWrapper::hasVSync() const { return wglSwapIntervalEXT != nullptr; } -void* VideoDriverWrapper::GetMapPointer() const +void* VideoDriverWrapper::getMapPointer() const { if(!videodriver) return nullptr; - return videodriver->GetMapPointer(); + return videodriver->getMapPointer(); } -VideoMode VideoDriverWrapper::GetWindowSize() const +VideoMode VideoDriverWrapper::getWindowSize() const { // Always return at least MinWindowSize even if real window is smaller - VideoMode windowSize = videodriver->GetWindowSize(); + VideoMode windowSize = videodriver->getWindowSize(); windowSize.width = std::max(MinWindowSize.width, windowSize.width); windowSize.height = std::max(MinWindowSize.height, windowSize.height); return windowSize; } -Extent VideoDriverWrapper::GetRenderSize() const +Extent VideoDriverWrapper::getRenderSize() const { - return videodriver->GetRenderSize(); + return videodriver->getRenderSize(); } -DisplayMode VideoDriverWrapper::GetDisplayMode() const +DisplayMode VideoDriverWrapper::getDisplayMode() const { - return videodriver->GetDisplayMode(); + return videodriver->getDisplayMode(); } float VideoDriverWrapper::getDpiScale() const diff --git a/libs/s25main/drivers/VideoDriverWrapper.h b/libs/s25main/drivers/VideoDriverWrapper.h index a1ed2468a7..f3222501f7 100644 --- a/libs/s25main/drivers/VideoDriverWrapper.h +++ b/libs/s25main/drivers/VideoDriverWrapper.h @@ -36,7 +36,7 @@ class VideoDriverWrapper : public Singleton ListVideoModes() const; - std::set GetDefaultWindowSizes() const; - bool HasVSync() const; + std::set getDefaultWindowSizes() const; + bool hasVSync() const; /// Gibt Pointer auf ein Fenster zurück (device-dependent!), HWND unter Windows - void* GetMapPointer() const; + void* getMapPointer() const; /// Get the size/resolution of the window in screen coordinates - VideoMode GetWindowSize() const; + VideoMode getWindowSize() const; /// Get the renderer size in pixels - Extent GetRenderSize() const; - DisplayMode GetDisplayMode() const; + Extent getRenderSize() const; + DisplayMode getDisplayMode() const; /// Get the factor required to scale "normal" DPI to the display DPI float getDpiScale() const; @@ -87,28 +87,28 @@ class VideoDriverWrapper : public Singleton JobFactory::CreateJob(const Job job_id, const MapPoint pt, const unsigned char player, noRoadNode& goal) { - if(nobBaseWarehouse::isStorehouseGOT(goal.GetGOT())) + if(nobBaseWarehouse::isStorehouseGOT(goal.getGOT())) return std::make_unique(job_id, pt, player, &goal); switch(job_id) { case Job::Builder: - if(goal.GetGOT() != GO_Type::Buildingsite) + if(goal.getGOT() != GO_Type::Buildingsite) return std::make_unique(Job::Builder, pt, player, &goal); else return std::make_unique(pt, player, &checkedCast(goal)); @@ -76,25 +76,25 @@ std::unique_ptr JobFactory::CreateJob(const Job job_id, const MapPoint case Job::Metalworker: return std::make_unique(pt, player, &checkedCast(goal)); case Job::Baker: return std::make_unique(pt, player, &checkedCast(goal)); case Job::Helper: - if(goal.GetGOT() == GO_Type::NobUsual) + if(goal.getGOT() == GO_Type::NobUsual) { auto* goalBld = &checkedCast(goal); - if(goalBld->GetBuildingType() == BuildingType::Well) + if(goalBld->getBuildingType() == BuildingType::Well) return std::make_unique(pt, player, goalBld); - else if(goalBld->GetBuildingType() == BuildingType::Catapult) + else if(goalBld->getBuildingType() == BuildingType::Catapult) return std::make_unique(pt, player, goalBld); } - throw std::runtime_error("Invalid goal type: " + helpers::toString(goal.GetGOT()) + " for job " + throw std::runtime_error("Invalid goal type: " + helpers::toString(goal.getGOT()) + " for job " + helpers::toString(job_id)); case Job::Geologist: return std::make_unique(pt, player, &checkedCast(goal)); case Job::Scout: // Different scout for lookout towers and free scouts - if(goal.GetGOT() == GO_Type::NobUsual) + if(goal.getGOT() == GO_Type::NobUsual) { return std::make_unique(pt, player, &checkedCast(goal)); - } else if(goal.GetGOT() == GO_Type::Flag) + } else if(goal.getGOT() == GO_Type::Flag) return std::make_unique(pt, player, &goal); - throw std::runtime_error("Invalid goal type: " + helpers::toString(goal.GetGOT()) + " for job " + throw std::runtime_error("Invalid goal type: " + helpers::toString(goal.getGOT()) + " for job " + helpers::toString(job_id)); case Job::Miner: return std::make_unique(pt, player, &checkedCast(goal)); case Job::Farmer: return std::make_unique(pt, player, &checkedCast(goal)); diff --git a/libs/s25main/figures/noFigure.cpp b/libs/s25main/figures/noFigure.cpp index 8f6a08c33c..d0e461a958 100644 --- a/libs/s25main/figures/noFigure.cpp +++ b/libs/s25main/figures/noFigure.cpp @@ -54,7 +54,7 @@ noFigure::noFigure(const Job job, const MapPoint pos, const unsigned char player hasArmor_(false) { // If the goal is a storehouse we won't work there but go to the new home - if(goal && nobBaseWarehouse::isStorehouseGOT(goal->GetGOT())) + if(goal && nobBaseWarehouse::isStorehouseGOT(goal->getGOT())) fs = FigureState::GoHome; } @@ -71,7 +71,7 @@ void noFigure::Destroy() RTTR_Assert(!cur_rs); noMovable::Destroy(); - RTTR_Assert(!world->GetPlayer(player).IsDependentFigure(*this)); + RTTR_Assert(!world->getPlayer(player).isDependentFigure(*this)); } void noFigure::Serialize(SerializedGameData& sgd) const @@ -105,7 +105,7 @@ void noFigure::Serialize(SerializedGameData& sgd) const noFigure::noFigure(SerializedGameData& sgd, const unsigned obj_id) : noMovable(sgd, obj_id), fs(sgd.Pop()), job_(sgd.Pop()), player(sgd.PopUnsignedChar()), cur_rs(sgd.PopObject(GO_Type::Roadsegment)), rs_pos(sgd.PopUnsignedShort()), rs_dir(sgd.PopBool()), - on_ship(sgd.PopBool()), last_id(0xFFFFFFFF), hasArmor_(sgd.GetGameDataVersion() >= 12 ? sgd.PopBool() : false) + on_ship(sgd.PopBool()), last_id(0xFFFFFFFF), hasArmor_(sgd.getGameDataVersion() >= 12 ? sgd.PopBool() : false) { if(fs == FigureState::GotToGoal || fs == FigureState::GoHome) goal_ = sgd.PopObject(); @@ -143,7 +143,7 @@ void noFigure::ActAtFirst() { // Wenn ich gleich wieder nach Hause geschickt wurde und aus einem Lagerhaus rauskomme, gar nicht erst // rausgehen! - if(goal_->GetPos() == pos) + if(goal_->getPos() == pos) { // Reset goal before re-adding to wh auto* wh = checkedCast(goal_); @@ -162,7 +162,7 @@ void noFigure::ActAtFirst() } /// Gibt den Sichtradius dieser Figur zurück (0, falls nicht-spähend) -unsigned noFigure::GetVisualRange() const +unsigned noFigure::getVisualRange() const { return 0; } @@ -177,25 +177,25 @@ void noFigure::InitializeRoadWalking(const RoadSegment* const road, const unsign DrawPoint noFigure::CalcFigurRelative() const { - MapPoint targetPt = world->GetNeighbour(pos, GetCurMoveDir()); - Position curPt = world->GetNodePos(pos); - Position nextPt = world->GetNodePos(targetPt); + MapPoint targetPt = world->getNeighbour(pos, getCurMoveDir()); + Position curPt = world->getNodePos(pos); + Position nextPt = world->getNodePos(targetPt); Position offset(0, 0); - if(GetCurMoveDir() == Direction::NorthWest - && (world->GetNO(targetPt)->GetType() == NodalObjectType::Buildingsite - || world->GetNO(targetPt)->GetType() == NodalObjectType::Building)) + if(getCurMoveDir() == Direction::NorthWest + && (world->getNO(targetPt)->getType() == NodalObjectType::Buildingsite + || world->getNO(targetPt)->getType() == NodalObjectType::Building)) { - auto* const bld = world->GetSpecObj(targetPt); - nextPt += bld->GetDoorPoint(); - } else if(GetCurMoveDir() == Direction::SouthEast - && (world->GetNO(pos)->GetType() == NodalObjectType::Buildingsite - || world->GetNO(pos)->GetType() == NodalObjectType::Building)) + auto* const bld = world->getSpecObj(targetPt); + nextPt += bld->getDoorPoint(); + } else if(getCurMoveDir() == Direction::SouthEast + && (world->getNO(pos)->getType() == NodalObjectType::Buildingsite + || world->getNO(pos)->getType() == NodalObjectType::Building)) { - auto* const bld = world->GetSpecObj(pos); - curPt += bld->GetDoorPoint(); - offset = bld->GetDoorPoint(); + auto* const bld = world->getSpecObj(pos); + curPt += bld->getDoorPoint(); + offset = bld->getDoorPoint(); } return offset + CalcRelative(curPt, nextPt); @@ -203,19 +203,19 @@ DrawPoint noFigure::CalcFigurRelative() const void noFigure::StartWalking(const Direction dir) { - RTTR_Assert(!(GetGOT() == GO_Type::NofPassivesoldier && fs == FigureState::Job)); + RTTR_Assert(!(getGOT() == GO_Type::NofPassivesoldier && fs == FigureState::Job)); // Gehen wir in ein Gebäude? if(dir == Direction::NorthWest - && world->GetNO(world->GetNeighbour(pos, Direction::NorthWest))->GetType() == NodalObjectType::Building) - world->GetSpecObj(world->GetNeighbour(pos, Direction::NorthWest)) + && world->getNO(world->getNeighbour(pos, Direction::NorthWest))->getType() == NodalObjectType::Building) + world->getSpecObj(world->getNeighbour(pos, Direction::NorthWest)) ->OpenDoor(); // Dann die Tür aufmachen // oder aus einem raus? - else if(dir == Direction::SouthEast && world->GetNO(pos)->GetType() == NodalObjectType::Building) - world->GetSpecObj(pos)->OpenDoor(); // Dann die Tür aufmachen + else if(dir == Direction::SouthEast && world->getNO(pos)->getType() == NodalObjectType::Building) + world->getSpecObj(pos)->OpenDoor(); // Dann die Tür aufmachen // Ist der Platz schon besetzt, wo wir hinlaufen wollen und laufen wir auf Straßen? - if(!world->IsRoadNodeForFigures(world->GetNeighbour(pos, dir)) && cur_rs) + if(!world->isRoadNodeForFigures(world->getNeighbour(pos, dir)) && cur_rs) { // Dann stehen bleiben! FaceDir(dir); @@ -231,7 +231,7 @@ void noFigure::StartWalking(const Direction dir) void noFigure::DrawShadow(DrawPoint drawPt, const unsigned char anistep, Direction dir) { - auto* bitmap = LOADER.GetMapTexture(calcWalkFrameIndex(900, dir, anistep)); + auto* bitmap = LOADER.getMapTexture(calcWalkFrameIndex(900, dir, anistep)); if(bitmap) bitmap->DrawFull(drawPt, COLOR_SHADOW); } @@ -239,8 +239,8 @@ void noFigure::DrawShadow(DrawPoint drawPt, const unsigned char anistep, Directi void noFigure::WalkFigure() { // Tür hinter sich zumachen, wenn wir aus einem Gebäude kommen - if(GetCurMoveDir() == Direction::SouthEast && world->GetNO(pos)->GetType() == NodalObjectType::Building) - world->GetSpecObj(pos)->CloseDoor(); + if(getCurMoveDir() == Direction::SouthEast && world->getNO(pos)->getType() == NodalObjectType::Building) + world->getSpecObj(pos)->CloseDoor(); Walk(); @@ -248,8 +248,8 @@ void noFigure::WalkFigure() ++rs_pos; // oder in eins reingegangen sind - if(GetCurMoveDir() == Direction::NorthWest && world->GetNO(pos)->GetType() == NodalObjectType::Building) - world->GetSpecObj(pos)->CloseDoor(); + if(getCurMoveDir() == Direction::NorthWest && world->getNO(pos)->getType() == NodalObjectType::Building) + world->getSpecObj(pos)->CloseDoor(); } void noFigure::WalkToGoal() @@ -268,21 +268,21 @@ void noFigure::WalkToGoal() // Ziel erreicht? // Bei dem Träger können das beide Flaggen sein! bool reachedGoal; - if(GetGOT() == GO_Type::NofCarrier && fs == FigureState::GotToGoal) + if(getGOT() == GO_Type::NofCarrier && fs == FigureState::GotToGoal) { RTTR_Assert(dynamic_cast(this)); auto* carrier = static_cast(this); - noRoadNode* flag = carrier->GetFirstFlag(); - if(flag && flag->GetPos() == pos) + noRoadNode* flag = carrier->getFirstFlag(); + if(flag && flag->getPos() == pos) reachedGoal = true; else { - flag = carrier->GetSecondFlag(); - reachedGoal = flag && flag->GetPos() == pos; + flag = carrier->getSecondFlag(); + reachedGoal = flag && flag->getPos() == pos; } } else { - reachedGoal = goal_->GetPos() == pos; + reachedGoal = goal_->getPos() == pos; } if(reachedGoal) @@ -308,7 +308,7 @@ void noFigure::WalkToGoal() { MapPoint next_harbor; // Neuen Weg berechnen - auto* const curRoadNode = world->GetSpecObj(pos); + auto* const curRoadNode = world->getSpecObj(pos); RoadPathDirection route = curRoadNode ? world->FindHumanPathOnRoads(*curRoadNode, *goal_, nullptr, &next_harbor) : RoadPathDirection::None; @@ -329,8 +329,8 @@ void noFigure::WalkToGoal() else if(route == RoadPathDirection::Ship) { // Uns in den Hafen einquartieren - noBase* hb = world->GetNO(pos); - if(hb->GetGOT() != GO_Type::NobHarborbuilding) + noBase* hb = world->getNO(pos); + if(hb->getGOT() != GO_Type::NobHarborbuilding) { // Es gibt keinen Hafen mehr -> nach Hause gehen @@ -353,16 +353,16 @@ void noFigure::WalkToGoal() { // Get next street we are walking on const Direction walkDir = toDirection(route); - cur_rs = curRoadNode->GetRoute(walkDir); + cur_rs = curRoadNode->getRoute(walkDir); StartWalking(walkDir); rs_pos = 0; - rs_dir = curRoadNode != cur_rs->GetF1(); + rs_dir = curRoadNode != cur_rs->getF1(); } } } else { - StartWalking(cur_rs->GetDir(rs_dir, rs_pos)); + StartWalking(cur_rs->getDir(rs_dir, rs_pos)); } } @@ -378,7 +378,7 @@ void noFigure::HandleEvent(const unsigned id) WalkFigure(); // Alte Richtung und Position für die Berechnung der Sichtbarkeiten merken - const Direction old_dir = GetCurMoveDir(); + const Direction old_dir = getCurMoveDir(); const MapPoint old_pos(pos); @@ -392,7 +392,7 @@ void noFigure::HandleEvent(const unsigned id) } // Ggf. Sichtbereich testen - const unsigned visualRange = GetVisualRange(); + const unsigned visualRange = getVisualRange(); if(visualRange) { // Use old position (don't use this->pos because it might be different now @@ -401,7 +401,7 @@ void noFigure::HandleEvent(const unsigned id) // Wenn Figur verschwunden ist, muss ihr ehemaliger gesamter Sichtbereich noch einmal // neue berechnet werden - if(!world->HasFigureAt(old_pos, *this)) + if(!world->hasFigureAt(old_pos, *this)) CalcVisibilities(old_pos); } } @@ -421,12 +421,12 @@ void noFigure::GoHome(noRoadNode* goal) // Wenn wir cur_rs == 0, dann hängen wir wahrscheinlich noch im Lagerhaus in der Warteschlange if(cur_rs == nullptr) { - RTTR_Assert(nobBaseWarehouse::isStorehouseGOT(world->GetNO(pos)->GetGOT())); + RTTR_Assert(nobBaseWarehouse::isStorehouseGOT(world->getNO(pos)->getGOT())); goal_ = nullptr; - world->GetSpecObj(pos)->CancelFigure(this); + world->getSpecObj(pos)->cancelFigure(this); return; } else - this->goal_ = world->GetPlayer(player).FindWarehouse((rs_dir) ? *cur_rs->GetF1() : *cur_rs->GetF2(), + this->goal_ = world->getPlayer(player).FindWarehouse((rs_dir) ? *cur_rs->getF1() : *cur_rs->getF2(), FW::AcceptsFigure(job_), true, false); } else this->goal_ = goal; @@ -464,15 +464,15 @@ void noFigure::StartWandering(const unsigned burned_wh_id) // 3x rumirren und eine Flagge suchen, wenn dann keine gefunden wurde, stirbt die Figur wander_way = WANDER_WAY_MIN + RANDOM_RAND(WANDER_WAY_MAX - WANDER_WAY_MIN); // Soldaten sind härter im Nehmen - wander_tryings = IsSoldier() ? GetStrandedSoldierReturnSearchTryings(world->GetGGS()) : WANDER_TRYINGS; + wander_tryings = IsSoldier() ? getStrandedSoldierReturnSearchTryings(world->getGGS()) : WANDER_TRYINGS; // Wenn wir stehen, zusätzlich noch loslaufen! if(waiting_for_free_node) { waiting_for_free_node = false; // We should be paused, so just continue moving now - if(IsStoppedBetweenNodes()) - StartMoving(GetCurMoveDir(), GetPausedEvent().length); + if(isStoppedBetweenNodes()) + StartMoving(getCurMoveDir(), getPausedEvent().length); else Wander(); } @@ -483,14 +483,14 @@ struct Point2Flag { World& gwb; Point2Flag(World& gwb) : gwb(gwb) {} - noFlag* operator()(const MapPoint pt, unsigned /*r*/) const { return gwb.GetSpecObj(pt); } + noFlag* operator()(const MapPoint pt, unsigned /*r*/) const { return gwb.getSpecObj(pt); } }; struct IsValidFlag { const unsigned playerId_; IsValidFlag(const unsigned playerId) : playerId_(playerId) {} - bool operator()(const noFlag* const flag) const { return flag && flag->GetPlayer() == playerId_; } + bool operator()(const noFlag* const flag) const { return flag && flag->getPlayer() == playerId_; } }; enum class StrandedSoldierReturnSearchSelection @@ -502,7 +502,7 @@ enum class StrandedSoldierReturnSearchSelection } // namespace -unsigned short GetStrandedSoldierReturnSearchTryings(const GlobalGameSettings& ggs) +unsigned short getStrandedSoldierReturnSearchTryings(const GlobalGameSettings& ggs) { switch(static_cast(ggs.getSelection(AddonId::STRANDED_SOLDIER_RETURN_SEARCH))) { @@ -512,7 +512,7 @@ unsigned short GetStrandedSoldierReturnSearchTryings(const GlobalGameSettings& g } } -unsigned short GetStrandedSoldierReturnSearchRadius(const GlobalGameSettings& ggs, const unsigned short wanderTriesLeft) +unsigned short getStrandedSoldierReturnSearchRadius(const GlobalGameSettings& ggs, const unsigned short wanderTriesLeft) { switch(static_cast(ggs.getSelection(AddonId::STRANDED_SOLDIER_RETURN_SEARCH))) { @@ -546,11 +546,11 @@ void noFigure::Wander() { // Soldaten sind härter im Nehmen const unsigned short wander_radius = - IsSoldier() ? GetStrandedSoldierReturnSearchRadius(world->GetGGS(), wander_tryings) : WANDER_RADIUS; + IsSoldier() ? getStrandedSoldierReturnSearchRadius(world->getGGS(), wander_tryings) : WANDER_RADIUS; // Flaggen sammeln und dann zufällig eine auswählen const std::vector flags = - world->GetPointsInRadius(pos, wander_radius, Point2Flag(*world), IsValidFlag(player)); + world->getPointsInRadius(pos, wander_radius, Point2Flag(*world), IsValidFlag(player)); unsigned best_way = 0xFFFFFFFF; const noFlag* best_flag = nullptr; @@ -561,7 +561,7 @@ void noFigure::Wander() if(burned_wh_id != 0xFFFFFFFF) { // Dann evtl gucken, ob anderen Mitglieder schon gesagt haben, dass die Flagge nicht zugänglich ist - if(flag->IsImpossibleForBWU(burned_wh_id)) + if(flag->isImpossibleForBWU(burned_wh_id)) { // Dann können wir die Flagge überspringen continue; @@ -569,14 +569,14 @@ void noFigure::Wander() } // würde die die bisher beste an Weg unterbieten? - unsigned way = world->CalcDistance(pos, flag->GetPos()); + unsigned way = world->CalcDistance(pos, flag->getPos()); if(way < best_way) { // Are we at that flag or is there a path to it? - if(way == 0 || world->FindHumanPath(pos, flag->GetPos(), wander_radius, false, &way)) + if(way == 0 || world->FindHumanPath(pos, flag->getPos(), wander_radius, false, &way)) { // gucken, ob ein Weg zu einem Warenhaus führt - if(world->GetPlayer(player).FindWarehouse(*flag, FW::AcceptsFigure(job_), true, false)) + if(world->getPlayer(player).FindWarehouse(*flag, FW::AcceptsFigure(job_), true, false)) { // dann nehmen wir die doch glatt best_way = way; @@ -601,8 +601,8 @@ void noFigure::Wander() { // bestmögliche schließlich nehmen wander_way = 0xFFFF; - flagPos_ = best_flag->GetPos(); - flag_obj_id = best_flag->GetObjId(); + flagPos_ = best_flag->getPos(); + flag_obj_id = best_flag->getObjId(); WanderToFlag(); return; } @@ -640,7 +640,7 @@ bool noFigure::WalkInRandomDir() // Check all dirs starting with a random one and taking the first possible for(const Direction dir : helpers::enumRange(RANDOM_ENUM(Direction))) { - if(pathChecker.IsNodeOk(world->GetNeighbour(pos, dir)) && pathChecker.IsEdgeOk(pos, dir)) + if(pathChecker.isNodeOk(world->getNeighbour(pos, dir)) && pathChecker.isEdgeOk(pos, dir)) { StartWalking(dir); return true; @@ -657,8 +657,8 @@ void noFigure::WanderFailedTrade() void noFigure::WanderToFlag() { // Existiert die Flagge überhaupt noch? - noBase* no = world->GetNO(flagPos_); - if(no->GetObjId() != flag_obj_id) + noBase* no = world->getNO(flagPos_); + if(no->getObjId() != flag_obj_id) { // Wenn nicht, wieder normal weiter rumirren StartWandering(); @@ -670,8 +670,8 @@ void noFigure::WanderToFlag() if(pos == flagPos_) { // Gibts noch nen Weg zu einem Lagerhaus? - RTTR_Assert(world->GetSpecObj(pos)); - if(nobBaseWarehouse* wh = world->GetPlayer(player).FindWarehouse(*world->GetSpecObj(pos), + RTTR_Assert(world->getSpecObj(pos)); + if(nobBaseWarehouse* wh = world->getPlayer(player).FindWarehouse(*world->getSpecObj(pos), FW::AcceptsFigure(job_), true, false)) { // ja, dann können wir ja hingehen @@ -731,13 +731,13 @@ void noFigure::CorrectSplitData(const RoadSegment* const rs2) { // wir stehen genau in der Mitte // abhängig von der Richtung machen, in die man gerade läuft - if(GetCurMoveDir() == rs2->GetRoute(0)) + if(getCurMoveDir() == rs2->getRoute(0)) { // wir laufen auf dem 2. Teilstück cur_rs = rs2; // und wir sind da noch am Anfang rs_pos = 0; - } else if(GetCurMoveDir() == cur_rs->GetRoute(cur_rs->GetLength() - 1) + 3u) + } else if(getCurMoveDir() == cur_rs->getRoute(cur_rs->GetLength() - 1) + 3u) { // wir laufen auf dem 1. Teilstück @@ -762,7 +762,7 @@ void noFigure::correctSplitDataDerived() {} unsigned noFigure::CalcWalkAnimationFrame() const { // If we are waiting for a free node use the 2nd frame, else interpolate - return waiting_for_free_node ? 2 : GAMECLIENT.Interpolate(ASCENT_ANIMATION_STEPS[GetAscent()], current_ev) % 8; + return waiting_for_free_node ? 2 : GAMECLIENT.Interpolate(ASCENT_ANIMATION_STEPS[getAscent()], current_ev) % 8; } /// Calculate the index of the current frame for a figure walking in the given direction @@ -778,7 +778,7 @@ DrawPoint noFigure::InterpolateWalkDrawPos(DrawPoint drawPt) const { // Add an offset relative to the starting point calculated by how far we already walked // Don't if we are waiting on our starting node - if(!waiting_for_free_node || IsStoppedBetweenNodes()) + if(!waiting_for_free_node || isStoppedBetweenNodes()) drawPt += CalcFigurRelative(); return drawPt; } @@ -786,17 +786,17 @@ DrawPoint noFigure::InterpolateWalkDrawPos(DrawPoint drawPt) const void noFigure::DrawWalkingCarrier(DrawPoint drawPt, helpers::OptionalEnum ware, bool fat) { const unsigned ani_step = CalcWalkAnimationFrame(); - const GamePlayer& owner = world->GetPlayer(player); - auto& sprite = ware ? LOADER.getCarrierSprite(*ware, fat, GetCurMoveDir(), ani_step) : - LOADER.getCarrierBobSprite(owner.nation, fat, GetCurMoveDir(), ani_step); + const GamePlayer& owner = world->getPlayer(player); + auto& sprite = ware ? LOADER.getCarrierSprite(*ware, fat, getCurMoveDir(), ani_step) : + LOADER.getCarrierBobSprite(owner.nation, fat, getCurMoveDir(), ani_step); sprite.drawForPlayer(InterpolateWalkDrawPos(drawPt), owner.color); } void noFigure::DrawWalkingBobJobs(DrawPoint drawPt, Job job) { const unsigned ani_step = CalcWalkAnimationFrame(); - const GamePlayer& owner = world->GetPlayer(player); - LOADER.getBobSprite(owner.nation, job, GetCurMoveDir(), ani_step) + const GamePlayer& owner = world->getPlayer(player); + LOADER.getBobSprite(owner.nation, job, getCurMoveDir(), ani_step) .drawForPlayer(InterpolateWalkDrawPos(drawPt), owner.color); if(hasArmor_) @@ -809,8 +809,8 @@ void noFigure::DrawWalking(DrawPoint drawPt, glArchivItem_Bob* file, unsigned id drawPt = InterpolateWalkDrawPos(drawPt); if(file) - file->Draw(id, toImgDir(GetCurMoveDir()), fat, ani_step, drawPt, world->GetPlayer(player).color); - DrawShadow(drawPt, ani_step, GetCurMoveDir()); + file->Draw(id, toImgDir(getCurMoveDir()), fat, ani_step, drawPt, world->getPlayer(player).color); + DrawShadow(drawPt, ani_step, getCurMoveDir()); } void noFigure::DrawWalking(DrawPoint drawPt, const ResourceId& file, unsigned id) @@ -818,9 +818,9 @@ void noFigure::DrawWalking(DrawPoint drawPt, const ResourceId& file, unsigned id const unsigned ani_step = CalcWalkAnimationFrame(); drawPt = InterpolateWalkDrawPos(drawPt); - LOADER.GetPlayerImage(file, calcWalkFrameIndex(id, GetCurMoveDir(), ani_step)) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); - DrawShadow(drawPt, ani_step, GetCurMoveDir()); + LOADER.getPlayerImage(file, calcWalkFrameIndex(id, getCurMoveDir(), ani_step)) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + DrawShadow(drawPt, ani_step, getCurMoveDir()); } void noFigure::DrawWalking(DrawPoint drawPt) @@ -832,9 +832,9 @@ void noFigure::DrawWalking(DrawPoint drawPt) const unsigned ani_step = CalcWalkAnimationFrame(); drawPt = InterpolateWalkDrawPos(drawPt); - LOADER.GetMapTexture(calcWalkFrameIndex(2000, GetCurMoveDir(), ani_step))->DrawFull(drawPt); + LOADER.getMapTexture(calcWalkFrameIndex(2000, getCurMoveDir(), ani_step))->DrawFull(drawPt); // donkey shadow - LOADER.GetMapTexture(2048 + rttr::enum_cast(GetCurMoveDir()) % 3)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getMapTexture(2048 + rttr::enum_cast(getCurMoveDir()) % 3)->DrawFull(drawPt, COLOR_SHADOW); } break; case Job::CharBurner: DrawWalking(drawPt, "charburner_bobs", 53); break; @@ -862,23 +862,23 @@ void noFigure::DrawWalking(DrawPoint drawPt) void noFigure::DrawArmor(DrawPoint drawPt) { - if(world->GetGGS().isEnabled(AddonId::MILITARY_HITPOINTS)) + if(world->getGGS().isEnabled(AddonId::MILITARY_HITPOINTS)) { SmallFont->Draw(drawPt + DrawPoint(7, -20), "+", FontStyle::CENTER, COLOR_RED); SmallFont->Draw(drawPt + DrawPoint(10, -20), "1", FontStyle::CENTER, COLOR_RED); } - LOADER.GetImageN("leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::ArmorIconAboveArmoredSoldier]) + LOADER.getImageN("leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::ArmorIconAboveArmoredSoldier]) ->DrawFull(drawPt + DrawPoint(0, -22)); } void noFigure::Die() { // Weg mit mir - GetEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); + getEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); // ggf. Leiche hinlegen, falls da nix ist - if(!world->GetSpecObj(pos)) - world->SetNO(pos, new noSkeleton(pos)); + if(!world->getSpecObj(pos)) + world->setNO(pos, new noSkeleton(pos)); RemoveFromInventory(); @@ -891,44 +891,44 @@ void noFigure::RemoveFromInventory() // Wars ein Bootmann? Dann Boot und Träger abziehen if(job_ == Job::BoatCarrier) { - world->GetPlayer(player).DecreaseInventoryJob(Job::Helper, 1); - world->GetPlayer(player).DecreaseInventoryWare(GoodType::Boat, 1); + world->getPlayer(player).DecreaseInventoryJob(Job::Helper, 1); + world->getPlayer(player).DecreaseInventoryWare(GoodType::Boat, 1); } else { - world->GetPlayer(player).DecreaseInventoryJob(job_, 1); - if(isSoldier(GetJobType()) && hasArmor_) - world->GetPlayer(player).DecreaseInventoryJob(jobEnumToAmoredSoldierEnum(GetJobType()), 1); + world->getPlayer(player).DecreaseInventoryJob(job_, 1); + if(isSoldier(getJobType()) && hasArmor_) + world->getPlayer(player).DecreaseInventoryJob(jobEnumToAmoredSoldierEnum(getJobType()), 1); } } void noFigure::DieFailedTrade() { // Weg mit mir - GetEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); + getEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); // ggf. Leiche hinlegen, falls da nix ist - if(!world->GetSpecObj(pos)) - world->SetNO(pos, new noSkeleton(pos)); + if(!world->getSpecObj(pos)) + world->setNO(pos, new noSkeleton(pos)); } void noFigure::NodeFreed(const MapPoint pt) { // Stehen wir gerade aus diesem Grund? - if(!waiting_for_free_node || pt != world->GetNeighbour(this->pos, GetCurMoveDir())) + if(!waiting_for_free_node || pt != world->getNeighbour(this->pos, getCurMoveDir())) return; // Gehen wir in ein Gebäude? Dann wieder ausgleichen, weil wir die Türen sonst doppelt aufmachen! - if(GetCurMoveDir() == Direction::NorthWest - && world->GetNO(world->GetNeighbour(this->pos, Direction::NorthWest))->GetType() == NodalObjectType::Building) - world->GetSpecObj(world->GetNeighbour(this->pos, Direction::NorthWest))->CloseDoor(); + if(getCurMoveDir() == Direction::NorthWest + && world->getNO(world->getNeighbour(this->pos, Direction::NorthWest))->getType() == NodalObjectType::Building) + world->getSpecObj(world->getNeighbour(this->pos, Direction::NorthWest))->CloseDoor(); // oder aus einem raus? - if(GetCurMoveDir() == Direction::SouthEast && world->GetNO(this->pos)->GetType() == NodalObjectType::Building) - world->GetSpecObj(this->pos)->CloseDoor(); + if(getCurMoveDir() == Direction::SouthEast && world->getNO(this->pos)->getType() == NodalObjectType::Building) + world->getSpecObj(this->pos)->CloseDoor(); // Wir stehen nun nicht mehr waiting_for_free_node = false; // Dann loslaufen - StartWalking(GetCurMoveDir()); + StartWalking(getCurMoveDir()); // anderen Leuten noch ggf Bescheid sagen world->RoadNodeAvailable(this->pos); @@ -965,15 +965,15 @@ void noFigure::StopIfNecessary(const MapPoint pt) { // Lauf ich auf Wegen --> wenn man zum Ziel oder Weg läuft oder die Träger, die natürlich auch auf Wegen arbeiten if(fs == FigureState::GoHome || fs == FigureState::GotToGoal - || (fs == FigureState::Job && GetGOT() == GO_Type::NofCarrier)) + || (fs == FigureState::Job && getGOT() == GO_Type::NofCarrier)) { // Laufe ich zu diesem Punkt? - if(current_ev && !waiting_for_free_node && world->GetNeighbour(this->pos, GetCurMoveDir()) == pt) + if(current_ev && !waiting_for_free_node && world->getNeighbour(this->pos, getCurMoveDir()) == pt) { // Dann stehenbleiben PauseWalking(); waiting_for_free_node = true; - world->StopOnRoads(this->pos, GetCurMoveDir()); + world->StopOnRoads(this->pos, getCurMoveDir()); } } } @@ -981,7 +981,7 @@ void noFigure::StopIfNecessary(const MapPoint pt) /// Sichtbarkeiten berechnen für Figuren mit Sichtradius (Soldaten, Erkunder) vor dem Laufen void noFigure::CalcVisibilities(const MapPoint pt) { - const unsigned visualRange = GetVisualRange(); + const unsigned visualRange = getVisualRange(); if(visualRange) // An alter Position neu berechnen world->RecalcVisibilitiesAroundPoint(pt, visualRange, player, nullptr); @@ -991,7 +991,7 @@ void noFigure::CalcVisibilities(const MapPoint pt) void noFigure::StartShipJourney() { // We should not be in the world, as we start the journey from a harbor -> We are in that harbor - RTTR_Assert(!world->HasFigureAt(pos, *this)); + RTTR_Assert(!world->hasFigureAt(pos, *this)); RTTR_Assert(!on_ship); pos = MapPoint::Invalid(); @@ -1010,7 +1010,7 @@ MapPoint noFigure::ExamineRouteBeforeShipping(RoadPathDirection& newDir) { MapPoint next_harbor; // Calc new route - const noRoadNode* roadNode = world->GetSpecObj(pos); + const noRoadNode* roadNode = world->getSpecObj(pos); if(!roadNode || !goal_) newDir = RoadPathDirection::None; else diff --git a/libs/s25main/figures/noFigure.h b/libs/s25main/figures/noFigure.h index 36a8cb82d6..6579ae417d 100644 --- a/libs/s25main/figures/noFigure.h +++ b/libs/s25main/figures/noFigure.h @@ -33,10 +33,10 @@ class SerializedGameData; class GlobalGameSettings; /// Number of flag-search attempts for stranded soldiers looking for a return path to an own warehouse. -unsigned short GetStrandedSoldierReturnSearchTryings(const GlobalGameSettings& ggs); +unsigned short getStrandedSoldierReturnSearchTryings(const GlobalGameSettings& ggs); /// Radius used only for stranded soldiers looking for a return path to an own warehouse. /// Normal worker wandering keeps using WANDER_RADIUS and is not affected by this addon. -unsigned short GetStrandedSoldierReturnSearchRadius(const GlobalGameSettings& ggs, unsigned short wanderTriesLeft); +unsigned short getStrandedSoldierReturnSearchRadius(const GlobalGameSettings& ggs, unsigned short wanderTriesLeft); // Stellt einen Menschen dar class noFigure : public noMovable @@ -118,7 +118,7 @@ class noFigure : public noMovable virtual void HandleDerivedEvent(unsigned id) = 0; /// Gibt den Sichtradius dieser Figur zurück (0, falls nicht-spähend) - virtual unsigned GetVisualRange() const; + virtual unsigned getVisualRange() const; /// Unterfunktion von Wander --> zur Flagge irren void WanderToFlag(); @@ -156,23 +156,23 @@ class noFigure : public noMovable void HandleEvent(unsigned id) override; /// Ziel setzen - void SetGoalTonullptr() { goal_ = nullptr; } + void setGoalTonullptr() { goal_ = nullptr; } /// Ziel zurückgeben - noRoadNode* GetGoal() const { return goal_; } + noRoadNode* getGoal() const { return goal_; } - bool HasArmor() const { return hasArmor_; }; - void SetArmor(bool armor) { hasArmor_ = armor; }; + bool hasArmor() const { return hasArmor_; }; + void setArmor(bool armor) { hasArmor_ = armor; }; /// Getter - bool GetRoadDir() const { return rs_dir; } - const RoadSegment* GetCurrentRoad() const { return cur_rs; } - bool IsWandering() const { return fs == FigureState::Wander; } + bool getRoadDir() const { return rs_dir; } + const RoadSegment* getCurrentRoad() const { return cur_rs; } + bool isWandering() const { return fs == FigureState::Wander; } /// Tut was, nachdem er rausgehen soll void ActAtFirst(); /// Legt die Anfangsdaten für das Laufen auf Wegen fest void InitializeRoadWalking(const RoadSegment* road, unsigned short rs_pos, bool rs_dir); /// Gibt Job-Typ zurück - Job GetJobType() const { return job_; } + Job getJobType() const { return job_; } /// Returns true if this is a soldier (they get some special handling at some points) bool IsSoldier() const; @@ -206,7 +206,7 @@ class noFigure : public noMovable /// Auf Straßen zur Zielflagge laufen void WalkToGoal(); /// Gibt die Straße zurück, auf der man gerade läuft - const RoadSegment* GetCurrentRoad() { return cur_rs; } + const RoadSegment* getCurrentRoad() { return cur_rs; } /// Wird aufgerufen, wenn die Straße unter der Figur geteilt wurde, setzt vorraus, dass die Figur auf der geteilten /// Straße läuft! void CorrectSplitData(const RoadSegment* rs2); @@ -228,13 +228,13 @@ class noFigure : public noMovable void NodeFreed(MapPoint pt); /// Wartet sie auf einen freien Platz? - bool IsWaitingForFreeNode() const { return waiting_for_free_node; } + bool isWaitingForFreeNode() const { return waiting_for_free_node; } /// Stoppt, wenn er auf diesen Punkt zuläuft void StopIfNecessary(MapPoint pt); - unsigned char GetPlayer() const { return player; } + unsigned char getPlayer() const { return player; } - bool IsDoingJobWorks() const { return fs == FigureState::Job; } + bool isDoingJobWorks() const { return fs == FigureState::Job; } void Abrogate(); // beim Arbeitsplatz "kündigen" soll, man das Laufen zum Ziel unterbrechen muss (warum auch immer) @@ -243,11 +243,11 @@ class noFigure : public noMovable /// Tells the figure it arrived at a harbor at the given position void ArrivedByShip(MapPoint harborPos); /// Gibt zurück, ob die Figur auf Straßen läuft zu ihrem Arbeitsplatz o.Ä. - bool IsWalkingOnRoad() const + bool isWalkingOnRoad() const { // Nur Träger arbeiten richtig auf Straßen if(fs == FigureState::Job) - return (GetGOT() == GO_Type::NofCarrier); + return (getGOT() == GO_Type::NofCarrier); else if(fs == FigureState::GoHome || fs == FigureState::GotToGoal) return true; else diff --git a/libs/s25main/figures/nofActiveSoldier.cpp b/libs/s25main/figures/nofActiveSoldier.cpp index bcfed86d3f..f46b1c36a7 100644 --- a/libs/s25main/figures/nofActiveSoldier.cpp +++ b/libs/s25main/figures/nofActiveSoldier.cpp @@ -46,16 +46,16 @@ void nofActiveSoldier::GoalReached() if(!homeBld) { RTTR_Assert(false); - homeBld = world->GetSpecObj(this->GetPos()); + homeBld = world->getSpecObj(this->getPos()); if(homeBld) LOG.write("nofActiveSoldier::GoalRoached() - no valid 'building' but found one at soldier's position " "(%i,%i) (gf: %u)\n") - % pos.x % pos.y % GetEvMgr().GetCurrentGF(); + % pos.x % pos.y % getEvMgr().getCurrentGF(); else { LOG.write("nofActiveSoldier::GoalRoached() - no valid 'building' also didn't find one at soldier's " "position (%i,%i) (gf: %u)\n") - % pos.x % pos.y % GetEvMgr().GetCurrentGF(); + % pos.x % pos.y % getEvMgr().getCurrentGF(); throw std::runtime_error("No building found for soldier"); } } @@ -83,13 +83,13 @@ void nofActiveSoldier::WalkingHome() // Walking home to our military building - if(GetPos() == homeBld->GetFlagPos()) // Are we already at the flag? + if(getPos() == homeBld->getFlagPos()) // Are we already at the flag? StartWalking(Direction::NorthWest); // Enter via the door - else if(GetPos() == homeBld->GetPos()) // or are we at the building + else if(getPos() == homeBld->getPos()) // or are we at the building homeBld->AddActiveSoldier(world->RemoveFigure(pos, *this)); else { - const auto dir = world->FindHumanPath(pos, homeBld->GetFlagPos(), 100); + const auto dir = world->FindHumanPath(pos, homeBld->getFlagPos(), 100); if(dir) { @@ -144,7 +144,7 @@ void nofActiveSoldier::Draw(DrawPoint drawPt) } } -unsigned nofActiveSoldier::GetVisualRange() const +unsigned nofActiveSoldier::getVisualRange() const { return VISUALRANGE_SOLDIER; } @@ -155,39 +155,39 @@ void nofActiveSoldier::ExpelEnemies() const std::vector figures; // At the position of the soldier - for(noBase& fieldFigure : world->GetFigures(pos)) + for(noBase& fieldFigure : world->getFigures(pos)) { - if(fieldFigure.GetType() == NodalObjectType::Figure) + if(fieldFigure.getType() == NodalObjectType::Figure) figures.push_back(static_cast(&fieldFigure)); } // And around this point - for(const MapPoint nb : world->GetNeighbours(pos)) + for(const MapPoint nb : world->getNeighbours(pos)) { - for(noBase& fieldFigure : world->GetFigures(nb)) + for(noBase& fieldFigure : world->getFigures(nb)) { // Normal settler? // Don't disturb hedgehogs and rabbits! - if(fieldFigure.GetType() == NodalObjectType::Figure) + if(fieldFigure.getType() == NodalObjectType::Figure) { auto& fig = static_cast(fieldFigure); // The people have to be either on the point itself or they have to walk there - if(fig.GetPos() == pos || fig.GetDestinationForCurrentMove() == pos) + if(fig.getPos() == pos || fig.getDestinationForCurrentMove() == pos) figures.push_back(&fig); } } } - const GamePlayer& owner = world->GetPlayer(player); + const GamePlayer& owner = world->getPlayer(player); for(auto* fig : figures) { // Enemy of us but no soldier, and walking on the road (i.e. no free workers like woodcutters etc.) - if(!owner.IsAlly(fig->GetPlayer()) && !fig->IsSoldier() && fig->IsWalkingOnRoad()) + if(!owner.isAlly(fig->getPlayer()) && !fig->IsSoldier() && fig->isWalkingOnRoad()) { // Then he should start wandering around fig->Abrogate(); fig->StartWandering(); // Not walking? (Could be carriers who are waiting for wares on roads) - if(!fig->IsMoving() && !fig->WalkInRandomDir()) + if(!fig->isMoving() && !fig->WalkInRandomDir()) { // No possible way found (unlikely but just in case) fig->Die(); @@ -211,16 +211,16 @@ bool nofActiveSoldier::TryFightingNearbyEnemy(const std::optional RTTR_Assert(enemy == nullptr); enemy = nullptr; - const GamePlayer& owner = world->GetPlayer(player); + const GamePlayer& owner = world->getPlayer(player); // Check all close points for(const auto& curPos : world->GetPointsInRadiusWithCenter(pos, 2)) { - for(noBase& object : world->GetFigures(curPos)) + for(noBase& object : world->getFigures(curPos)) { auto* soldier = dynamic_cast(&object); - if(!soldier || soldier->GetPlayer() == excludedOwner) + if(!soldier || soldier->getPlayer() == excludedOwner) continue; - if(soldier->IsReadyForFight() && !owner.IsAlly(soldier->GetPlayer())) + if(soldier->isReadyForFight() && !owner.isAlly(soldier->getPlayer())) { enemy = soldier; break; @@ -240,7 +240,7 @@ bool nofActiveSoldier::TryFightingNearbyEnemy(const std::optional // we have an excluded owner for our new enemy and that only happens in ffa situations when we won against // the last defender so our fight spot is the exact location we have right now fightSpot_ = pos; - } else if(const auto fightSpot = GetFightSpotNear(*enemy)) + } else if(const auto fightSpot = getFightSpotNear(*enemy)) fightSpot_ = *fightSpot; else { @@ -261,12 +261,12 @@ bool nofActiveSoldier::TryFightingNearbyEnemy(const std::optional void nofActiveSoldier::IncreaseRank() { - if(GetRank() < world->GetGGS().GetMaxMilitaryRank()) + if(getRank() < world->getGGS().getMaxMilitaryRank()) { // Promote and adjust inventory accordingly - world->GetPlayer(player).DecreaseInventoryJob(job_, 1); + world->getPlayer(player).DecreaseInventoryJob(job_, 1); job_ = Job(rttr::enum_cast(job_) + 1); - world->GetPlayer(player).IncreaseInventoryJob(job_, 1); + world->getPlayer(player).IncreaseInventoryJob(job_, 1); } } @@ -276,12 +276,12 @@ void nofActiveSoldier::MeetingEnemy() RTTR_Assert(enemy); // Reached the fighting place? - if(GetPos() == fightSpot_) + if(getPos() == fightSpot_) { // Enemy already there? - if(enemy->GetState() == SoldierState::WaitingForFight) + if(enemy->getState() == SoldierState::WaitingForFight) { - RTTR_Assert(enemy->GetPos() == fightSpot_); + RTTR_Assert(enemy->getPos() == fightSpot_); // Start fighting world->AddFigure(pos, std::make_unique(*enemy, *this)); @@ -290,11 +290,11 @@ void nofActiveSoldier::MeetingEnemy() } else { // Is fighting point still valid (there could e.g. be another fight already) - if(world->IsValidPointForFighting(pos, *this, false)) + if(world->isValidPointForFighting(pos, *this, false)) { // Enemy should be on the way, so wait here RTTR_Assert(enemy->enemy == this); - RTTR_Assert(enemy->GetState() == SoldierState::MeetEnemy); + RTTR_Assert(enemy->getState() == SoldierState::MeetEnemy); state = SoldierState::WaitingForFight; } else { @@ -335,7 +335,7 @@ void nofActiveSoldier::AbortFreeFight() if(enemyWasWaiting) { // Act as-if the enemy just arrived at his position so he'll start moving again if required - RTTR_Assert(!old_enemy->IsMoving()); + RTTR_Assert(!old_enemy->isMoving()); old_enemy->Walked(); } } @@ -351,7 +351,7 @@ void nofActiveSoldier::TakeHit() if(hasArmor_) { hasArmor_ = false; - world->GetPlayer(player).DecreaseInventoryJob(jobEnumToAmoredSoldierEnum(GetJobType()), 1); + world->getPlayer(player).DecreaseInventoryJob(jobEnumToAmoredSoldierEnum(getJobType()), 1); } else { RTTR_Assert(hitpoints > 0u); @@ -359,7 +359,7 @@ void nofActiveSoldier::TakeHit() } } -bool nofActiveSoldier::IsReadyForFight() const +bool nofActiveSoldier::isReadyForFight() const { switch(state) { @@ -384,10 +384,10 @@ void nofActiveSoldier::MeetEnemy(nofActiveSoldier& other, const MapPoint figh_sp MeetingEnemy(); } -std::optional nofActiveSoldier::GetFightSpotNear(const nofActiveSoldier& other) +std::optional nofActiveSoldier::getFightSpotNear(const nofActiveSoldier& other) { // Calc middle between the two soldiers and use this as origin spot for the search of more fight spots - MapPoint otherPos = world->GetNeighbour(other.GetPos(), other.GetCurMoveDir()); + MapPoint otherPos = world->getNeighbour(other.getPos(), other.getCurMoveDir()); MapPoint middle((pos + otherPos) / 2u); // The point is supposed to be in the middle between the 2 soldiers (and guaranteed to be inside the map) @@ -395,8 +395,8 @@ std::optional nofActiveSoldier::GetFightSpotNear(const nofActiveSoldie // --> maximum distance between each point and the middle is mapSize/4 // So if we see, that this is not the case, we take the "middle" point on the other half of the map - const unsigned short mapWidth = world->GetWidth(); - const unsigned short mapHeight = world->GetHeight(); + const unsigned short mapWidth = world->getWidth(); + const unsigned short mapHeight = world->getHeight(); if(std::abs(otherPos.x - middle.x) > mapWidth / 4) { @@ -417,10 +417,10 @@ std::optional nofActiveSoldier::GetFightSpotNear(const nofActiveSoldie RTTR_Assert(world->CalcDistance(otherPos, middle) <= std::max(mapWidth, mapHeight) / 4u); const auto isGoodFightingSpot = [world = this->world, pos = this->pos, this, &other](MapPoint pt) { - return world->IsValidPointForFighting(pt, *this, true) + return world->isValidPointForFighting(pt, *this, true) && (pos == pt || world->FindHumanPath(pos, pt, MEET_FOR_FIGHT_DISTANCE * 2, false)) - && (other.GetPos() == pt - || world->FindHumanPath(other.GetPos(), pt, MEET_FOR_FIGHT_DISTANCE * 2, false)); + && (other.getPos() == pt + || world->FindHumanPath(other.getPos(), pt, MEET_FOR_FIGHT_DISTANCE * 2, false)); }; const std::vector pts = world->GetMatchingPointsInRadius<1>(middle, MEET_FOR_FIGHT_DISTANCE, isGoodFightingSpot, true); diff --git a/libs/s25main/figures/nofActiveSoldier.h b/libs/s25main/figures/nofActiveSoldier.h index 469826d7ee..27deda498f 100644 --- a/libs/s25main/figures/nofActiveSoldier.h +++ b/libs/s25main/figures/nofActiveSoldier.h @@ -78,7 +78,7 @@ class nofActiveSoldier : public nofSoldier void MeetingEnemy(); /// Look for an appropriate fighting spot between the two soldiers /// Return true on success - std::optional GetFightSpotNear(const nofActiveSoldier& other); + std::optional getFightSpotNear(const nofActiveSoldier& other); /// increase rank if possible void IncreaseRank(); /// Notify that a free fight (somewhere at the map, not the one at the building flag) cannot be started @@ -90,7 +90,7 @@ class nofActiveSoldier : public nofSoldier void GoalReached() override; /// Get how much of the map/FoW the soldier discovers - unsigned GetVisualRange() const override; + unsigned getVisualRange() const override; /// Abort a free fight (somewhere at the map, not the one at the building flag) that cannot be started void AbortFreeFight(); @@ -125,17 +125,17 @@ class nofActiveSoldier : public nofSoldier virtual void LostFighting() = 0; /// Determine if this soldier is ready for a spontaneous fight - bool IsReadyForFight() const; + bool isReadyForFight() const; /// Inform a waiting soldier about the start of a fight void FightingStarted(); /// Get the current state - SoldierState GetState() const { return state; } + SoldierState getState() const { return state; } /// Set the home (building) to nullptr /// e.g. after the soldier was removed from the homes list but it was not destroyed void ResetHome() { homeBld = nullptr; } void FightVsDefenderStarted() { state = SoldierState::AttackingFightingVsDefender; } // For debugging - const nofActiveSoldier* GetEnemy() const { return enemy; } + const nofActiveSoldier* getEnemy() const { return enemy; } }; diff --git a/libs/s25main/figures/nofAggressiveDefender.cpp b/libs/s25main/figures/nofAggressiveDefender.cpp index ddffc771f3..e738c9cefd 100644 --- a/libs/s25main/figures/nofAggressiveDefender.cpp +++ b/libs/s25main/figures/nofAggressiveDefender.cpp @@ -14,7 +14,7 @@ nofAggressiveDefender::nofAggressiveDefender(const MapPoint pos, const unsigned char player, nobBaseMilitary& home, const unsigned char rank, nofAttacker& attacker) : nofActiveSoldier(pos, player, home, rank, SoldierState::AggressivedefendingWalkingToAggressor), - attacker(&attacker), attacked_goal(attacker.GetAttackedGoal()) + attacker(&attacker), attacked_goal(attacker.getAttackedGoal()) { // Notify building to protect attacked_goal->LinkAggressiveDefender(*this); @@ -22,7 +22,7 @@ nofAggressiveDefender::nofAggressiveDefender(const MapPoint pos, const unsigned nofAggressiveDefender::nofAggressiveDefender(const nofPassiveSoldier& other, nofAttacker& attacker) : nofActiveSoldier(other, SoldierState::AggressivedefendingWalkingToAggressor), attacker(&attacker), - attacked_goal(attacker.GetAttackedGoal()) + attacked_goal(attacker.getAttackedGoal()) { // Notify building to protect attacked_goal->LinkAggressiveDefender(*this); @@ -89,7 +89,7 @@ void nofAggressiveDefender::HomeDestroyedAtBegin() StartWalking(RANDOM_ENUM(Direction)); } -void nofAggressiveDefender::CancelAtAttackedBld() +void nofAggressiveDefender::cancelAtAttackedBld() { if(attacked_goal) { @@ -101,7 +101,7 @@ void nofAggressiveDefender::CancelAtAttackedBld() void nofAggressiveDefender::WonFighting() { // addon BattlefieldPromotion active? -> increase rank! - if(world->GetGGS().isEnabled(AddonId::BATTLEFIELD_PROMOTION)) + if(world->getGGS().isEnabled(AddonId::BATTLEFIELD_PROMOTION)) IncreaseRank(); // Ist evtl. unser Heimatgebäude zerstört? @@ -161,7 +161,7 @@ void nofAggressiveDefender::MissionAggressiveDefendingLookForNewAggressor() void nofAggressiveDefender::AttackedGoalDestroyed() { - CancelAtAttacker(); + cancelAtAttacker(); attacked_goal = nullptr; /*// Stehen wir? Dann losgehen @@ -202,10 +202,10 @@ void nofAggressiveDefender::MissAggressiveDefendingWalk() } // Does he still want to fight? - if(!attacker->IsReadyForFight()) + if(!attacker->isReadyForFight()) { // Look for a new one - CancelAtAttacker(); + cancelAtAttacker(); MissionAggressiveDefendingLookForNewAggressor(); return; } @@ -220,10 +220,10 @@ void nofAggressiveDefender::MissAggressiveDefendingWalk() return; } - RTTR_Assert(pos != attacker->GetPos()); // If so, why was it not found? + RTTR_Assert(pos != attacker->getPos()); // If so, why was it not found? // Calc next walking direction - const auto dir = world->FindHumanPath(pos, attacker->GetPos(), 100, true); + const auto dir = world->FindHumanPath(pos, attacker->getPos(), 100, true); if(dir) { @@ -233,7 +233,7 @@ void nofAggressiveDefender::MissAggressiveDefendingWalk() { // No route found // Look for new attacker - CancelAtAttacker(); + cancelAtAttacker(); MissionAggressiveDefendingLookForNewAggressor(); } } @@ -254,15 +254,15 @@ void nofAggressiveDefender::AttackerLost() void nofAggressiveDefender::InformTargetsAboutCancelling() { nofActiveSoldier::InformTargetsAboutCancelling(); - CancelAtAttacker(); - CancelAtAttackedBld(); + cancelAtAttacker(); + cancelAtAttackedBld(); } -void nofAggressiveDefender::CancelAtAttacker() +void nofAggressiveDefender::cancelAtAttacker() { if(attacker) { - RTTR_Assert(attacker->GetHuntingDefender() == this); + RTTR_Assert(attacker->getHuntingDefender() == this); attacker->AggressiveDefenderLost(); attacker = nullptr; } diff --git a/libs/s25main/figures/nofAggressiveDefender.h b/libs/s25main/figures/nofAggressiveDefender.h index eb9a12b824..fd73a78a51 100644 --- a/libs/s25main/figures/nofAggressiveDefender.h +++ b/libs/s25main/figures/nofAggressiveDefender.h @@ -31,7 +31,7 @@ class nofAggressiveDefender : public nofActiveSoldier /// Sagt den verschiedenen Zielen Bescheid, dass wir doch nicht mehr kommen können void InformTargetsAboutCancelling() override; - void CancelAtAttacker(); + void cancelAtAttacker(); protected: SoldierState FreeFightAborted() override; @@ -49,14 +49,14 @@ class nofAggressiveDefender : public nofActiveSoldier void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofAggressivedefender; } + GO_Type getGOT() const final { return GO_Type::NofAggressivedefender; } /// Wenn ein Heimat-Militärgebäude bei Missionseinsätzen zerstört wurde void HomeDestroyed() override; /// Wenn er noch in der Warteschleife vom Ausgangsgebäude hängt und dieses zerstört wurde void HomeDestroyedAtBegin() override; - void CancelAtAttackedBld(); + void cancelAtAttackedBld(); /// Wenn ein Kampf gewonnen wurde void WonFighting() override; @@ -72,5 +72,5 @@ class nofAggressiveDefender : public nofActiveSoldier void AttackerLost(); // Debugging - const nofAttacker* GetAttacker() const { return attacker; } + const nofAttacker* getAttacker() const { return attacker; } }; diff --git a/libs/s25main/figures/nofArmorer.cpp b/libs/s25main/figures/nofArmorer.cpp index 659d134433..b34cd98216 100644 --- a/libs/s25main/figures/nofArmorer.cpp +++ b/libs/s25main/figures/nofArmorer.cpp @@ -40,28 +40,28 @@ void nofArmorer::DrawWorking(DrawPoint drawPt) const unsigned now_id = GAMECLIENT.Interpolate(max_id, current_ev); if(now_id < 200) { - const Nation wpNation = workplace->GetNation(); - const unsigned plColor = world->GetPlayer(player).color; + const Nation wpNation = workplace->getNation(); + const unsigned plColor = world->getPlayer(player).color; - LOADER.GetPlayerImage("rom_bobs", 16 + (now_id % 8)) + LOADER.getPlayerImage("rom_bobs", 16 + (now_id % 8)) ->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); if((now_id % 8) == 5) { - world->GetSoundMgr().playNOSound(52, *this, now_id / 8); + world->getSoundMgr().playNOSound(52, *this, now_id / 8); was_sounding = true; } } } -unsigned short nofArmorer::GetCarryID() const +unsigned short nofArmorer::getCarryID() const { if(sword_shield) return 56; else { // Je nach Nation einen bestimmtem Schild fertigen - switch(world->GetPlayer(player).nation) + switch(world->getPlayer(player).nation) { case Nation::Africans: return 60; //-V525 case Nation::Japanese: return 58; @@ -80,14 +80,14 @@ void nofArmorer::HandleDerivedEvent(const unsigned /*id*/) { case State::Waiting1: { - if(!world->GetGGS().isEnabled(AddonId::HALF_COST_MIL_EQUIP) || !sword_shield) + if(!world->getGGS().isEnabled(AddonId::HALF_COST_MIL_EQUIP) || !sword_shield) { // LOG.write(("armorer handlewait1 - consume wares %i \n",player); nofWorkman::HandleStateWaiting1(); } else { // Nach 1. Warten wird gearbeitet - current_ev = GetEvMgr().AddEvent(this, JOB_CONSTS[job_].work_length, 1); + current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].work_length, 1); state = State::Work; workplace->is_working = true; // LOG.write(("armorer handlewait1 - no consume wares %i \n",player); @@ -110,7 +110,7 @@ void nofArmorer::HandleDerivedEvent(const unsigned /*id*/) bool nofArmorer::AreWaresAvailable() const { - return workplace->WaresAvailable() || (world->GetGGS().isEnabled(AddonId::HALF_COST_MIL_EQUIP) && sword_shield); + return workplace->WaresAvailable() || (world->getGGS().isEnabled(AddonId::HALF_COST_MIL_EQUIP) && sword_shield); } helpers::OptionalEnum nofArmorer::ProduceWare() @@ -120,5 +120,5 @@ helpers::OptionalEnum nofArmorer::ProduceWare() if(sword_shield) return GoodType::Sword; else - return SHIELD_TYPES[world->GetPlayer(player).nation]; + return SHIELD_TYPES[world->getPlayer(player).nation]; } diff --git a/libs/s25main/figures/nofArmorer.h b/libs/s25main/figures/nofArmorer.h index 2552dafe8c..2342e10154 100644 --- a/libs/s25main/figures/nofArmorer.h +++ b/libs/s25main/figures/nofArmorer.h @@ -19,7 +19,7 @@ class nofArmorer : public nofWorkman protected: void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override; + unsigned short getCarryID() const override; /// Der Arbeiter erzeugt eine Ware helpers::OptionalEnum ProduceWare() override; void HandleDerivedEvent(unsigned id) override; @@ -32,5 +32,5 @@ class nofArmorer : public nofWorkman void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofArmorer; } + GO_Type getGOT() const final { return GO_Type::NofArmorer; } }; diff --git a/libs/s25main/figures/nofAttacker.cpp b/libs/s25main/figures/nofAttacker.cpp index 0ecf1021c7..1c970aaec1 100644 --- a/libs/s25main/figures/nofAttacker.cpp +++ b/libs/s25main/figures/nofAttacker.cpp @@ -30,8 +30,8 @@ nofAttacker::nofAttacker(const nofPassiveSoldier& other, nobBaseMilitary& attack const nobHarborBuilding* const harbor) : nofActiveSoldier(other, harbor ? SoldierState::SeaattackingGoToHarbor : SoldierState::AttackingWalkingToGoal), attacked_goal(&attacked_goal), mayBeHunted(true), - canPlayerSendAggDefender(world->GetNumPlayers(), SendDefender::Undecided), huntingDefender(nullptr), radius(0), - blocking_event(nullptr), harborPos(harbor ? harbor->GetPos() : MapPoint::Invalid()), shipPos(MapPoint::Invalid()), + canPlayerSendAggDefender(world->getNumPlayers(), SendDefender::Undecided), huntingDefender(nullptr), radius(0), + blocking_event(nullptr), harborPos(harbor ? harbor->getPos() : MapPoint::Invalid()), shipPos(MapPoint::Invalid()), ship_obj_id(0) { attacked_goal.LinkAggressor(*this); @@ -83,7 +83,7 @@ nofAttacker::nofAttacker(SerializedGameData& sgd, const unsigned obj_id) : nofAc attacked_goal = sgd.PopObject(); mayBeHunted = sgd.PopBool(); sgd.PopContainer(canPlayerSendAggDefender); - RTTR_Assert(canPlayerSendAggDefender.size() == world->GetNumPlayers()); + RTTR_Assert(canPlayerSendAggDefender.size() == world->getNumPlayers()); huntingDefender = sgd.PopObject(GO_Type::NofAggressivedefender); radius = sgd.PopUnsignedShort(); @@ -100,7 +100,7 @@ nofAttacker::nofAttacker(SerializedGameData& sgd, const unsigned obj_id) : nofAc { attacked_goal = nullptr; mayBeHunted = false; - canPlayerSendAggDefender.resize(world->GetNumPlayers(), SendDefender::Undecided); + canPlayerSendAggDefender.resize(world->getNumPlayers(), SendDefender::Undecided); huntingDefender = nullptr; radius = 0; blocking_event = nullptr; @@ -127,17 +127,17 @@ void nofAttacker::Walked() return; } - const MapPoint goalFlagPos = attacked_goal->GetFlagPos(); + const MapPoint goalFlagPos = attacked_goal->getFlagPos(); nofDefender* defender = nullptr; // Look for defenders at this position - for(auto& figure : world->GetFigures(goalFlagPos)) + for(auto& figure : world->getFigures(goalFlagPos)) { - if(figure.GetGOT() == GO_Type::NofDefender) + if(figure.getGOT() == GO_Type::NofDefender) { // Is the defender waiting at the flag? // (could be wandering around or something) - if(static_cast(figure).IsWaitingAtFlag()) + if(static_cast(figure).isWaitingAtFlag()) { defender = &static_cast(figure); break; @@ -190,7 +190,7 @@ void nofAttacker::Walked() if(attacked_goal->DefendersAvailable()) { // Go back out - if(attacked_goal->GetGOT() == GO_Type::NobMilitary) + if(attacked_goal->getGOT() == GO_Type::NobMilitary) static_cast(attacked_goal)->StopCapturing(); state = SoldierState::AttackingWalkingToGoal; @@ -198,15 +198,15 @@ void nofAttacker::Walked() } else { // Did we just conquer a "regular" military building? - if(BuildingProperties::IsMilitary(attacked_goal->GetBuildingType())) + if(BuildingProperties::isMilitary(attacked_goal->getBuildingType())) { RTTR_Assert(dynamic_cast(attacked_goal)); // We will now have this building as the new home, so inform old home, hunting soldier and ship if(homeBld) homeBld->SoldierLost(this); - CancelAtHuntingDefender(); + cancelAtHuntingDefender(); if(ship_obj_id) - CancelAtShip(); + cancelAtShip(); // Store the goal in a temporary as attacked_goal will be reset auto* goal = static_cast(attacked_goal); goal->Capture(player); @@ -218,11 +218,11 @@ void nofAttacker::Walked() } else // Something like HQ or harbor { // Inform the owner of the building and destroy it - const std::string msg = (attacked_goal->GetGOT() == GO_Type::NobHq) ? + const std::string msg = (attacked_goal->getGOT() == GO_Type::NobHq) ? _("Our headquarters was destroyed!") : _("This harbor building was destroyed"); - SendPostMessage(attacked_goal->GetPlayer(), - std::make_unique(GetEvMgr().GetCurrentGF(), msg, + SendPostMessage(attacked_goal->getPlayer(), + std::make_unique(getEvMgr().getCurrentGF(), msg, PostCategory::Military, *attacked_goal)); nobBaseMilitary* tmp_goal = attacked_goal; // Store in a temporary in case it gets reset by Destroy @@ -239,9 +239,9 @@ void nofAttacker::Walked() case SoldierState::SeaattackingGoToHarbor: { // Abort if the harbor doesn't exist, belongs to another player or the attacked building is gone - const noBase* hb = world->GetNO(harborPos); - const bool valid_harbor = hb->GetGOT() == GO_Type::NobHarborbuilding - && static_cast(hb)->GetPlayer() == player; + const noBase* hb = world->getNO(harborPos); + const bool valid_harbor = hb->getGOT() == GO_Type::NobHarborbuilding + && static_cast(hb)->getPlayer() == player; if(!valid_harbor || !attacked_goal) { @@ -252,10 +252,10 @@ void nofAttacker::Walked() if(pos == harborPos) // When we arrived add to harbor { state = SoldierState::SeaattackingWaitInHarbor; - world->GetSpecObj(pos)->AddSeaAttacker(world->RemoveFigure(pos, *this)); + world->getSpecObj(pos)->AddSeaAttacker(world->RemoveFigure(pos, *this)); } else // Go to flag then walk inside the building { - const MapPoint harborFlagPos = world->GetNeighbour(harborPos, Direction::SouthEast); + const MapPoint harborFlagPos = world->getNeighbour(harborPos, Direction::SouthEast); if(pos == harborFlagPos) StartWalking(Direction::NorthWest); @@ -290,7 +290,7 @@ void nofAttacker::HomeDestroyed() nobBaseMilitary* curGoal = attacked_goal; // attacked_goal gets reset InformTargetsAboutCancelling(); if(ship_obj_id) - CancelAtShip(); + cancelAtShip(); homeBld = nullptr; state = SoldierState::FigureWork; @@ -323,7 +323,7 @@ void nofAttacker::HomeDestroyedAtBegin() void nofAttacker::WonFighting() { - if(world->GetGGS().isEnabled(AddonId::BATTLEFIELD_PROMOTION)) + if(world->getGGS().isEnabled(AddonId::BATTLEFIELD_PROMOTION)) IncreaseRank(); // If our home was destroyed then we are lost // unless we are currently fighting at the flag so that building can become our new home @@ -332,7 +332,7 @@ void nofAttacker::WonFighting() // Lost -> Tell all dependents InformTargetsAboutCancelling(); if(ship_obj_id) - CancelAtShip(); + cancelAtShip(); state = SoldierState::FigureWork; StartWandering(); @@ -351,11 +351,11 @@ void nofAttacker::ContinueAtFlag() // If we were fighting at the flag of the goal then call a new defender // or capture the building if there isn't one anymore if(state == SoldierState::AttackingFightingVsDefender - || (state == SoldierState::Fighting && attacked_goal->GetFlagPos() == pos)) + || (state == SoldierState::Fighting && attacked_goal->getFlagPos() == pos)) { if(attacked_goal->CallDefender(*this)) //-V522 SwitchStateAttackingWaitingForDefender(); - else if(!TryFightingNearbyEnemy(attacked_goal->GetPlayer())) + else if(!TryFightingNearbyEnemy(attacked_goal->getPlayer())) { // No defender or soldiers of other non-friendly non-owner players to fight // -> Enter building @@ -363,7 +363,7 @@ void nofAttacker::ContinueAtFlag() StartWalking(Direction::NorthWest); // Regular military buildings will be captured - if(attacked_goal->GetGOT() == GO_Type::NobMilitary) + if(attacked_goal->getGOT() == GO_Type::NobMilitary) static_cast(attacked_goal)->PrepareCapturing(); } } else @@ -380,7 +380,7 @@ void nofAttacker::LostFighting() AbrogateWorkplace(); InformTargetsAboutCancelling(); if(ship_obj_id) - this->CancelAtShip(); + this->cancelAtShip(); } void nofAttacker::ReturnHomeMissionAttacking() @@ -401,7 +401,7 @@ void nofAttacker::MissAttackingWalk() { InformTargetsAboutCancelling(); if(ship_obj_id) - CancelAtShip(); + cancelAtShip(); state = SoldierState::FigureWork; StartWandering(); @@ -442,17 +442,17 @@ void nofAttacker::MissAttackingWalk() void nofAttacker::ReachedDestination() { // Are we at the flag of the target? - const MapPoint attFlagPos = attacked_goal->GetFlagPos(); + const MapPoint attFlagPos = attacked_goal->getFlagPos(); if(pos == attFlagPos) { // If building is already captured continue capturing // (This can only be a far away attacker) - if(attacked_goal->GetPlayer() == player) + if(attacked_goal->getPlayer() == player) { state = SoldierState::AttackingCapturingNext; RTTR_Assert(dynamic_cast(attacked_goal)); auto* goal = static_cast(attacked_goal); - RTTR_Assert(goal->IsFarAwayCapturer(*this)); + RTTR_Assert(goal->isFarAwayCapturer(*this)); // Start walking first so the flag is free StartWalking(Direction::NorthWest); // Then tell the building @@ -461,8 +461,8 @@ void nofAttacker::ReachedDestination() { // Notify player // TODO: Possibly improve that not every attacker does that - SendPostMessage(attacked_goal->GetPlayer(), - std::make_unique(GetEvMgr().GetCurrentGF(), _("We are under attack!"), + SendPostMessage(attacked_goal->getPlayer(), + std::make_unique(getEvMgr().getCurrentGF(), _("We are under attack!"), PostCategory::Military, *attacked_goal)); // Get a defender or walk into the building @@ -473,7 +473,7 @@ void nofAttacker::ReachedDestination() state = SoldierState::AttackingCapturingFirst; StartWalking(Direction::NorthWest); // Regular military buildings will be captured - if(attacked_goal->GetGOT() == GO_Type::NobMilitary) + if(attacked_goal->getGOT() == GO_Type::NobMilitary) static_cast(attacked_goal)->PrepareCapturing(); } } @@ -504,13 +504,13 @@ void nofAttacker::ReachedDestination() else // pos.y > attFlagPos.y dir = (pos.x < attFlagPos.x) ? Direction::NorthEast : Direction::NorthWest; FaceDir(dir); - if(attacked_goal->GetPlayer() == player) + if(attacked_goal->getPlayer() == player) { // Building already captured? -> Then we might be a far-away-capturer // -> Tell the building, that we are here RTTR_Assert(dynamic_cast(attacked_goal)); auto* goal = static_cast(attacked_goal); - if(goal->IsFarAwayCapturer(*this)) + if(goal->isFarAwayCapturer(*this)) goal->FarAwayCapturerReachedGoal(*this, false); } } @@ -535,18 +535,18 @@ void nofAttacker::OrderAggressiveDefender() for(nobBaseMilitary* bld : buildings) { // Exclude HQs unless the one being attacked - if(bld->GetBuildingType() == BuildingType::Headquarters && bld != attacked_goal) + if(bld->getBuildingType() == BuildingType::Headquarters && bld != attacked_goal) continue; - if(world->CalcDistance(pos, bld->GetPos()) > maxDistance) + if(world->CalcDistance(pos, bld->getPos()) > maxDistance) continue; - const unsigned bldOwnerId = bld->GetPlayer(); + const unsigned bldOwnerId = bld->getPlayer(); if(canPlayerSendAggDefender[bldOwnerId] == SendDefender::No) continue; // Only allies of the attacked player send defenders and only if we can attack them - GamePlayer& bldOwner = world->GetPlayer(bldOwnerId); - if(!bldOwner.IsAlly(attacked_goal->GetPlayer())) + GamePlayer& bldOwner = world->getPlayer(bldOwnerId); + if(!bldOwner.isAlly(attacked_goal->getPlayer())) continue; - if(!bldOwner.IsAttackable(player)) + if(!bldOwner.isAttackable(player)) continue; // If player did not decide on sending do it now. // Doing this as late as here reduces chances, @@ -578,13 +578,13 @@ void nofAttacker::AttackedGoalDestroyed() if(state == SoldierState::SeaattackingWaitInHarbor) { // We don't need to wait anymore, target was destroyed - auto* harbor = world->GetSpecObj(harborPos); + auto* harbor = world->getSpecObj(harborPos); RTTR_Assert(harbor); // go home goal_ = homeBld; state = SoldierState::FigureWork; fs = FigureState::GotToGoal; - harbor->CancelSeaAttacker(this); + harbor->cancelSeaAttacker(this); } else { const bool was_waiting_for_defender = (state == SoldierState::AttackingWaitingForDefender); @@ -595,7 +595,7 @@ void nofAttacker::AttackedGoalDestroyed() ReturnHomeMissionAttacking(); if(was_waiting_for_defender) { - GetEvMgr().RemoveEvent(blocking_event); + getEvMgr().RemoveEvent(blocking_event); world->RoadNodeAvailable(pos); } } @@ -604,7 +604,7 @@ void nofAttacker::AttackedGoalDestroyed() bool nofAttacker::AttackDefenderAtFlag() { // Walk to flag if possible - const auto dir = world->FindHumanPath(pos, attacked_goal->GetFlagPos(), 3, true); + const auto dir = world->FindHumanPath(pos, attacked_goal->getFlagPos(), 3, true); if(dir) { const bool waiting_around_building = (state == SoldierState::AttackingWaitingAroundBuilding); @@ -646,33 +646,33 @@ void nofAttacker::CapturingWalking() } RTTR_Assert(dynamic_cast(attacked_goal)); - const MapPoint attFlagPos = attacked_goal->GetFlagPos(); + const MapPoint attFlagPos = attacked_goal->getFlagPos(); // 3 cases: // 1. We arrived in the building -> Capture // 2. We arrived at flag -> Go into the building // 3. Otherwise walk to the flag if our home building still exists, else wander around - if(pos == attacked_goal->GetPos()) + if(pos == attacked_goal->getPos()) { // We switch buildings if(homeBld) homeBld->SoldierLost(this); - CancelAtHuntingDefender(); + cancelAtHuntingDefender(); if(ship_obj_id) - CancelAtShip(); + cancelAtShip(); homeBld = attacked_goal; attacked_goal->AddActiveSoldier(world->RemoveFigure(pos, *this)); // No longer attacking - if(BuildingProperties::IsMilitary(attacked_goal->GetBuildingType())) + if(BuildingProperties::isMilitary(attacked_goal->getBuildingType())) { RTTR_Assert(dynamic_cast(attacked_goal)); auto* goal = static_cast(attacked_goal); // If we are still a far-away-capturer at this point, // then the building belongs to us and capturing was already finished - if(goal->IsFarAwayCapturer(*this)) + if(goal->isFarAwayCapturer(*this)) { - RTTR_Assert(goal->GetPlayer() == player); + RTTR_Assert(goal->getPlayer() == player); RemoveFromAttackedGoal(); } else { @@ -685,7 +685,7 @@ void nofAttacker::CapturingWalking() { // Go into the building and call next one for reinforcement StartWalking(Direction::NorthWest); - RTTR_Assert(attacked_goal->GetPlayer() == player); // Assumed by the call below + RTTR_Assert(attacked_goal->getPlayer() == player); // Assumed by the call below static_cast(attacked_goal)->NeedOccupyingTroops(); } else if(!homeBld) { @@ -696,12 +696,12 @@ void nofAttacker::CapturingWalking() auto* attackedBld = static_cast(attacked_goal); RemoveFromAttackedGoal(); // Reinforce building (should be already ours) - RTTR_Assert(attackedBld->GetPlayer() == player); + RTTR_Assert(attackedBld->getPlayer() == player); attackedBld->NeedOccupyingTroops(); } if(ship_obj_id) - CancelAtShip(); + cancelAtShip(); state = SoldierState::FigureWork; StartWandering(); @@ -715,7 +715,7 @@ void nofAttacker::CapturingWalking() else { // Call other troops to occupy the building instead and go home - RTTR_Assert(attacked_goal->GetPlayer() == player); // Assumed by the call below + RTTR_Assert(attacked_goal->getPlayer() == player); // Assumed by the call below static_cast(attacked_goal)->NeedOccupyingTroops(); ReturnHomeMissionAttacking(); } @@ -742,7 +742,7 @@ void nofAttacker::StartSucceeding(const MapPoint /*pt*/, unsigned short /*new_ra MissAttackingWalk(); - if(IsMoving()) + if(isMoving()) attacked_goal->SendSuccessor(oldPos, oldRadius); } @@ -763,7 +763,7 @@ void nofAttacker::AggressiveDefenderLost() void nofAttacker::SwitchStateAttackingWaitingForDefender() { state = SoldierState::AttackingWaitingForDefender; - blocking_event = GetEvMgr().AddEvent(this, BLOCK_OFFSET, 5); + blocking_event = getEvMgr().AddEvent(this, BLOCK_OFFSET, 5); } void nofAttacker::HandleDerivedEvent(const unsigned /*id*/) @@ -778,7 +778,7 @@ void nofAttacker::HandleDerivedEvent(const unsigned /*id*/) } } -bool nofAttacker::IsBlockingRoads() const +bool nofAttacker::isBlockingRoads() const { if(state != SoldierState::AttackingWaitingForDefender) return false; @@ -790,7 +790,7 @@ bool nofAttacker::IsBlockingRoads() const void nofAttacker::InformTargetsAboutCancelling() { nofActiveSoldier::InformTargetsAboutCancelling(); - CancelAtHuntingDefender(); + cancelAtHuntingDefender(); if(attacked_goal) RemoveFromAttackedGoal(); @@ -802,11 +802,11 @@ void nofAttacker::RemoveFromAttackedGoal() // If state == AttackingFightingVsDefender then we probably just lost the fight against the defender, // otherwise there must either be no defender or he is not waiting for us RTTR_Assert( - state == SoldierState::AttackingFightingVsDefender || !attacked_goal->GetDefender() - || (attacked_goal->GetDefender()->GetAttacker() != this && attacked_goal->GetDefender()->GetEnemy() != this)); + state == SoldierState::AttackingFightingVsDefender || !attacked_goal->getDefender() + || (attacked_goal->getDefender()->getAttacker() != this && attacked_goal->getDefender()->getEnemy() != this)); // No defender should be chasing us at this point - for(auto* it : attacked_goal->GetAggresiveDefenders()) - RTTR_Assert(it->GetAttacker() != this); + for(auto* it : attacked_goal->getAggresiveDefenders()) + RTTR_Assert(it->getAttacker() != this); attacked_goal->UnlinkAggressor(*this); attacked_goal = nullptr; } @@ -841,7 +841,7 @@ void nofAttacker::StartReturnViaShip(noShip& ship) // If pos is not valid, then we are still on the ship! // This can happen, if the ship cannot reach its target RTTR_Assert(state == SoldierState::SeaattackingOnShip); - RTTR_Assert(ship.IsOnBoard(*this)); + RTTR_Assert(ship.isOnBoard(*this)); InformTargetsAboutCancelling(); } @@ -858,11 +858,11 @@ void nofAttacker::HomeHarborLost() goal_ = nullptr; } -void nofAttacker::CancelAtShip() +void nofAttacker::cancelAtShip() { - for(noBase& figure : world->GetFigures(shipPos)) + for(noBase& figure : world->getFigures(shipPos)) { - if(figure.GetObjId() == ship_obj_id) + if(figure.getObjId() == ship_obj_id) { static_cast(figure).SeaAttackerWishesNoReturn(); break; @@ -871,11 +871,11 @@ void nofAttacker::CancelAtShip() ship_obj_id = 0; } -void nofAttacker::CancelAtHuntingDefender() +void nofAttacker::cancelAtHuntingDefender() { if(huntingDefender) { - RTTR_Assert(huntingDefender->GetAttacker() == this); + RTTR_Assert(huntingDefender->getAttacker() == this); huntingDefender->AttackerLost(); huntingDefender = nullptr; } @@ -890,12 +890,12 @@ void nofAttacker::handleStateSeaAttackReturnToShip() StartWandering(); Wander(); - CancelAtShip(); + cancelAtShip(); } else if(pos == shipPos) // Arrived at ship { - for(noBase& figure : world->GetFigures(pos)) + for(noBase& figure : world->getFigures(pos)) { - if(figure.GetObjId() == ship_obj_id) + if(figure.getObjId() == ship_obj_id) { StartReturnViaShip(static_cast(figure)); return; @@ -922,12 +922,12 @@ void nofAttacker::handleStateSeaAttackReturnToShip() // Notify home and ship homeBld->SoldierLost(this); - CancelAtShip(); + cancelAtShip(); } } } -void nofAttacker::CancelSeaAttack() +void nofAttacker::cancelSeaAttack() { InformTargetsAboutCancelling(); RTTR_Assert(!huntingDefender); @@ -940,14 +940,14 @@ nofActiveSoldier::SoldierState nofAttacker::FreeFightAborted() return SoldierState::AttackingWalkingToGoal; } -bool nofAttacker::CanStartFarAwayCapturing(const nobMilitary& dest) const +bool nofAttacker::canStartFarAwayCapturing(const nobMilitary& dest) const { // Are we already walking to the destination? if(state == SoldierState::AttackingWalkingToGoal || state == SoldierState::MeetEnemy || state == SoldierState::WaitingForFight || state == SoldierState::Fighting) { // Not too far away? - if(world->CalcDistance(pos, dest.GetPos()) < MAX_FAR_AWAY_CAPTURING_DISTANCE) + if(world->CalcDistance(pos, dest.getPos()) < MAX_FAR_AWAY_CAPTURING_DISTANCE) return true; } diff --git a/libs/s25main/figures/nofAttacker.h b/libs/s25main/figures/nofAttacker.h index feeb18a5ce..98ea852284 100644 --- a/libs/s25main/figures/nofAttacker.h +++ b/libs/s25main/figures/nofAttacker.h @@ -70,8 +70,8 @@ class nofAttacker : public nofActiveSoldier void SwitchStateAttackingWaitingForDefender(); /// Sea attackers: Notify ship that this soldier is not coming any more - void CancelAtShip(); - void CancelAtHuntingDefender(); + void cancelAtShip(); + void cancelAtHuntingDefender(); /// Handle walking back to ship void handleStateSeaAttackReturnToShip(); @@ -93,12 +93,12 @@ class nofAttacker : public nofActiveSoldier void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofAttacker; } - const nofAggressiveDefender* GetHuntingDefender() const { return huntingDefender; } + GO_Type getGOT() const final { return GO_Type::NofAttacker; } + const nofAggressiveDefender* getHuntingDefender() const { return huntingDefender; } void HandleDerivedEvent(unsigned id) override; /// Return whether the roads to the position of this soldier cannot be used - bool IsBlockingRoads() const; + bool isBlockingRoads() const; /// Notify the soldier about the destruction of the home building void HomeDestroyed() override; @@ -123,20 +123,20 @@ class nofAttacker : public nofActiveSoldier /// Notification that the captured building is full void CapturedBuildingFull(); /// Return the distance to the flag at which the soldier is waiting - unsigned GetRadius() const { return radius; } + unsigned getRadius() const { return radius; } /// A waiting soldier should move closer to the flag to fill gaps void StartSucceeding(MapPoint pt, unsigned short new_radius); /// Return if this soldier is available to occupy the captured building - bool CanStartFarAwayCapturing(const nobMilitary& dest) const; + bool canStartFarAwayCapturing(const nobMilitary& dest) const; /// The aggressive defender is going to fight with this soldier void LetsFight(nofAggressiveDefender& other); /// Return if this attacker waits around the building for a fight - bool IsAttackerReady() const { return (state == SoldierState::AttackingWaitingAroundBuilding); } + bool isAttackerReady() const { return (state == SoldierState::AttackingWaitingAroundBuilding); } /// Return target building being attacked - nobBaseMilitary* GetAttackedGoal() const { return attacked_goal; } + nobBaseMilitary* getAttackedGoal() const { return attacked_goal; } /// Start attack from anchor point of the ship void StartAttackOnOtherIsland(MapPoint shipPos, unsigned ship_id); @@ -146,11 +146,11 @@ class nofAttacker : public nofActiveSoldier /// target void SeaAttackFailedBeforeLaunch(); /// Tell soldier the sea attack failed and they can't go home either - void CancelSeaAttack(); + void cancelSeaAttack(); /// notify sea attackers that they wont return home void HomeHarborLost(); /// Notification that the attacker is now on a ship void SeaAttackStarted() { state = SoldierState::SeaattackingOnShip; } /// Return whether the soldier is on a ship waiting to attack, i.e. not already back from a fight - bool IsSeaAttackCompleted() const { return (state != SoldierState::SeaattackingOnShip); } + bool isSeaAttackCompleted() const { return (state != SoldierState::SeaattackingOnShip); } }; diff --git a/libs/s25main/figures/nofBaker.cpp b/libs/s25main/figures/nofBaker.cpp index df368d8d62..3c28690136 100644 --- a/libs/s25main/figures/nofBaker.cpp +++ b/libs/s25main/figures/nofBaker.cpp @@ -43,8 +43,8 @@ void nofBaker::DrawWorking(DrawPoint drawPt) unsigned max_id = 120; unsigned now_id = GAMECLIENT.Interpolate(max_id, current_ev); - const Nation wpNation = workplace->GetNation(); - unsigned plColor = world->GetPlayer(player).color; + const Nation wpNation = workplace->getNation(); + unsigned plColor = world->getPlayer(player).color; // position zum rauslaufen berechnen DrawPoint walkOutPos = drawPt + walkOffsets[wpNation][now_id % 8]; @@ -70,29 +70,29 @@ void nofBaker::DrawWorking(DrawPoint drawPt) } if((now_id >= 8) && (now_id < 16)) // brot in den ofen schieben { - LOADER.GetPlayerImage("rom_bobs", 182 + (now_id - 8)) + LOADER.getPlayerImage("rom_bobs", 182 + (now_id - 8)) ->DrawFull(drawPt + workOffset[wpNation], COLOR_WHITE, plColor); // "Brot-rein/raus"-Sound if((now_id % 8) == 4) { - world->GetSoundMgr().playNOSound(68, *this, now_id); + world->getSoundMgr().playNOSound(68, *this, now_id); was_sounding = true; } } if((now_id >= 16) && (now_id < max_id - 16)) // warten { - LOADER.GetPlayerImage("rom_bobs", 189)->DrawFull(drawPt + workOffset[wpNation], COLOR_WHITE, plColor); + LOADER.getPlayerImage("rom_bobs", 189)->DrawFull(drawPt + workOffset[wpNation], COLOR_WHITE, plColor); } if((now_id >= max_id - 16) && (now_id < max_id - 8)) // brot aus dem ofen holen { - LOADER.GetPlayerImage("rom_bobs", 182 + 7 - (now_id % 8)) + LOADER.getPlayerImage("rom_bobs", 182 + 7 - (now_id % 8)) ->DrawFull(drawPt + workOffset[wpNation], COLOR_WHITE, plColor); // "Brot-rein/raus"-Sound if((now_id % 8) == 4) { - world->GetSoundMgr().playNOSound(68, *this, now_id); + world->getSoundMgr().playNOSound(68, *this, now_id); was_sounding = true; } } diff --git a/libs/s25main/figures/nofBaker.h b/libs/s25main/figures/nofBaker.h index 87640c608f..a71f896e94 100644 --- a/libs/s25main/figures/nofBaker.h +++ b/libs/s25main/figures/nofBaker.h @@ -15,7 +15,7 @@ class nofBaker : public nofWorkman /// Zeichnet ihn beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override { return 76; } + unsigned short getCarryID() const override { return 76; } /// Der Arbeiter erzeugt eine Ware helpers::OptionalEnum ProduceWare() override; @@ -23,5 +23,5 @@ class nofBaker : public nofWorkman nofBaker(MapPoint pos, unsigned char player, nobUsual* workplace); nofBaker(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofBaker; } + GO_Type getGOT() const final { return GO_Type::NofBaker; } }; diff --git a/libs/s25main/figures/nofBrewer.cpp b/libs/s25main/figures/nofBrewer.cpp index f8dfb917b8..64349dffc7 100644 --- a/libs/s25main/figures/nofBrewer.cpp +++ b/libs/s25main/figures/nofBrewer.cpp @@ -25,13 +25,13 @@ void nofBrewer::DrawWorking(DrawPoint drawPt) unsigned now_id = GAMECLIENT.Interpolate(128, current_ev); if(now_id < 16) - LOADER.GetPlayerImage("rom_bobs", now_id) - ->DrawFull(drawPt + offsets[workplace->GetNation()], COLOR_WHITE, - world->GetPlayer(workplace->GetPlayer()).color); + LOADER.getPlayerImage("rom_bobs", now_id) + ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, + world->getPlayer(workplace->getPlayer()).color); if(now_id == 5) { - world->GetSoundMgr().playNOSound(51, *this, 0); + world->getSoundMgr().playNOSound(51, *this, 0); was_sounding = true; } last_id = now_id; diff --git a/libs/s25main/figures/nofBrewer.h b/libs/s25main/figures/nofBrewer.h index 98bcb143f8..1996535347 100644 --- a/libs/s25main/figures/nofBrewer.h +++ b/libs/s25main/figures/nofBrewer.h @@ -15,7 +15,7 @@ class nofBrewer : public nofWorkman /// Zeichnet ihn beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override { return 54; } + unsigned short getCarryID() const override { return 54; } /// Der Arbeiter erzeugt eine Ware helpers::OptionalEnum ProduceWare() override; @@ -23,5 +23,5 @@ class nofBrewer : public nofWorkman nofBrewer(MapPoint pos, unsigned char player, nobUsual* workplace); nofBrewer(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofBrewer; } + GO_Type getGOT() const final { return GO_Type::NofBrewer; } }; diff --git a/libs/s25main/figures/nofBuilder.cpp b/libs/s25main/figures/nofBuilder.cpp index 78cc648cec..e31f6c02f2 100644 --- a/libs/s25main/figures/nofBuilder.cpp +++ b/libs/s25main/figures/nofBuilder.cpp @@ -28,7 +28,7 @@ nofBuilder::nofBuilder(const MapPoint pos, const unsigned char player, noBuildin // Sind wir schon an unsere Baustelle gleich hingesetzt worden (bei Häfen)? if(building_site) { - if(pos == building_site->GetPos()) + if(pos == building_site->getPos()) { // Dann gleich mit dem Bauprozess beginnen fs = FigureState::Job; @@ -89,7 +89,7 @@ void nofBuilder::LostWork() else { // Event abmelden - GetEvMgr().RemoveEvent(current_ev); + getEvMgr().RemoveEvent(current_ev); StartWandering(); Wander(); @@ -124,9 +124,9 @@ void nofBuilder::HandleDerivedEvent(const unsigned id) if(building_steps_available) { // dann mal schön bauen - current_ev = GetEvMgr().AddEvent(this, 40, 1); + current_ev = getEvMgr().AddEvent(this, 40, 1); state = BuilderState::Build; - } else if(building_site->IsBuildingComplete()) + } else if(building_site->isBuildingComplete()) { // fertig mit Bauen! current_ev = nullptr; @@ -134,26 +134,26 @@ void nofBuilder::HandleDerivedEvent(const unsigned id) // Baustelle abreißen und Gebäude hinsetzen // Gebäudetyp merken und das Volk des Gebäudes - BuildingType building_type = building_site->GetBuildingType(); - Nation building_nation = building_site->GetNation(); + BuildingType building_type = building_site->getBuildingType(); + Nation building_nation = building_site->getNation(); state = BuilderState::FigureWork; // Baustelle abmelden - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); owner.RemoveBuildingSite(building_site); - if(world->IsHarborBuildingSiteFromSea(building_site)) + if(world->isHarborBuildingSiteFromSea(building_site)) world->RemoveHarborBuildingSiteFromSea(building_site); // Remove buildingsite, but don't destroy! - world->SetNO(building_site->GetPos(), nullptr); + world->setNO(building_site->getPos(), nullptr); deletePtr(building_site); noBuilding* bld = BuildingFactory::CreateBuilding(*world, building_type, pos, player, building_nation); - world->GetNotifications().publish(BuildingNote(BuildingNote::Constructed, player, pos, building_type)); + world->getNotifications().publish(BuildingNote(BuildingNote::Constructed, player, pos, building_type)); // Special handling for warehouses - if(BuildingProperties::IsWareHouse(building_type)) + if(BuildingProperties::isWareHouse(building_type)) { auto* wh = static_cast(bld); // Mich dort gleich einquartieren und nicht erst zurücklaufen @@ -171,7 +171,7 @@ void nofBuilder::HandleDerivedEvent(const unsigned id) // Nach Hause laufen bzw. auch rumirren rs_pos = 0; rs_dir = true; - cur_rs = world->GetSpecObj(pos)->GetRoute(Direction::SouthEast); + cur_rs = world->getSpecObj(pos)->getRoute(Direction::SouthEast); GoHome(); StartWalking(Direction::SouthEast); @@ -191,7 +191,7 @@ void nofBuilder::HandleDerivedEvent(const unsigned id) case BuilderState::Build: { // Sounds abmelden - world->GetSoundMgr().stopSounds(*this); + world->getSoundMgr().stopSounds(*this); // ein Bauschritt weniger, Haus um eins höher --building_steps_available; @@ -245,12 +245,12 @@ void nofBuilder::StartFreewalk() FaceDir(RANDOM_ELEMENT(possible_directions)); // Und dort auch hinlaufen - current_ev = GetEvMgr().AddEvent(this, (state == BuilderState::WaitingFreewalk) ? 24 : 17, 1); + current_ev = getEvMgr().AddEvent(this, (state == BuilderState::WaitingFreewalk) ? 24 : 17, 1); // Zukünftigen Platz berechnen nextOffsetSite = offsetSite; - switch(GetCurMoveDir()) + switch(getCurMoveDir()) { case Direction::West: nextOffsetSite.x -= FREEWALK_LENGTH[waiting_walk]; break; case Direction::NorthWest: @@ -288,12 +288,12 @@ void nofBuilder::Draw(DrawPoint drawPt) // Interpolieren und Door-Point von Baustelle draufaddieren drawPt.x += GAMECLIENT.Interpolate(offsetSite.x, nextOffsetSite.x, current_ev); drawPt.y += GAMECLIENT.Interpolate(offsetSite.y, nextOffsetSite.y, current_ev); - drawPt += building_site->GetDoorPoint(); + drawPt += building_site->getDoorPoint(); LOADER - .getBobSprite(building_site->GetNation(), Job::Builder, GetCurMoveDir(), + .getBobSprite(building_site->getNation(), Job::Builder, getCurMoveDir(), GAMECLIENT.Interpolate(12, current_ev) % 8u) - .draw(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + .draw(drawPt, COLOR_WHITE, world->getPlayer(player).color); } break; case BuilderState::Build: @@ -327,11 +327,11 @@ void nofBuilder::Draw(DrawPoint drawPt) // in der Mitte mit "Händen" texture = 287 + (index / 2) % 4; } - drawPt += building_site->GetDoorPoint() + DrawPoint(offsetSite); - LOADER.GetPlayerImage("rom_bobs", texture) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(building_site->GetPlayer()).color); + drawPt += building_site->getDoorPoint() + DrawPoint(offsetSite); + LOADER.getPlayerImage("rom_bobs", texture) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(building_site->getPlayer()).color); if(soundId && index % 4 == 2) - world->GetSoundMgr().playNOSound(soundId, *this, index, 160 - rand() % 60); + world->getSoundMgr().playNOSound(soundId, *this, index, 160 - rand() % 60); } break; } @@ -340,8 +340,8 @@ void nofBuilder::Draw(DrawPoint drawPt) bool nofBuilder::ChooseWare() { // Brauch ich ein Brett(Rohbau und wenn kein Stein benötigt wird) oder Stein? - const BuildingCost costs = BUILDING_COSTS[building_site->GetBuildingType()]; - if(building_site->GetBuildProgress(false) < costs.boards * 8 || !costs.stones) + const BuildingCost costs = BUILDING_COSTS[building_site->getBuildingType()]; + if(building_site->getBuildProgress(false) < costs.boards * 8 || !costs.stones) { // Brett if(building_site->boards) diff --git a/libs/s25main/figures/nofBuilder.h b/libs/s25main/figures/nofBuilder.h index c32fcc54e2..bd8322452d 100644 --- a/libs/s25main/figures/nofBuilder.h +++ b/libs/s25main/figures/nofBuilder.h @@ -63,7 +63,7 @@ class nofBuilder final : public noFigure void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofBuilder; } + GO_Type getGOT() const final { return GO_Type::NofBuilder; } void Draw(DrawPoint drawPt) override; diff --git a/libs/s25main/figures/nofBuildingWorker.cpp b/libs/s25main/figures/nofBuildingWorker.cpp index 9a523be8a6..fde4d0fd31 100644 --- a/libs/s25main/figures/nofBuildingWorker.cpp +++ b/libs/s25main/figures/nofBuildingWorker.cpp @@ -45,7 +45,7 @@ nofBuildingWorker::nofBuildingWorker(SerializedGameData& sgd, const unsigned obj if(fs != FigureState::GoHome && fs != FigureState::Wander) { workplace = sgd.PopObject(); - if(sgd.GetGameDataVersion() < 5) + if(sgd.getGameDataVersion() < 5) { const auto iWare = sgd.PopUnsignedChar(); // GoodType::Nothing is moved because of adding new wares due addons @@ -114,7 +114,7 @@ void nofBuildingWorker::Walked() { // dann war draußen kein Platz --> ist jetzt evtl Platz? state = State::WaitForWareSpace; - if(workplace->GetFlag()->HasSpaceForWare()) + if(workplace->getFlag()->hasSpaceForWare()) FreePlaceAtFlag(); // Ab jetzt warten, d.h. nicht mehr arbeiten --> schlecht für die Produktivität workplace->StartNotWorking(); @@ -143,24 +143,24 @@ void nofBuildingWorker::WorkingReady() // Trage ich eine Ware? if(ware) { - noFlag* flag = workplace->GetFlag(); + noFlag* flag = workplace->getFlag(); // Ist noch Platz an der Fahne? - if(flag->HasSpaceForWare()) + if(flag->hasSpaceForWare()) { // Ware erzeugen auto real_ware = std::make_unique(*ware, nullptr, flag); real_ware->WaitAtFlag(*flag); // Inventur entsprechend erhöhen, dabei Schilder unterscheiden! GoodType ware_type = ConvertShields(real_ware->type); - world->GetPlayer(player).IncreaseInventoryWare(ware_type, 1); + world->getPlayer(player).IncreaseInventoryWare(ware_type, 1); // Abnehmer für Ware finden - real_ware->SetGoal(world->GetPlayer(player).FindClientForWare(*real_ware)); + real_ware->setGoal(world->getPlayer(player).FindClientForWare(*real_ware)); // Ware soll ihren weiteren Weg berechnen real_ware->RecalcRoute(); // Ware ablegen flag->AddWare(std::move(real_ware)); // Warenstatistik erhöhen - world->GetPlayer(this->player).IncreaseMerchandiseStatistic(ware_type); + world->getPlayer(this->player).IncreaseMerchandiseStatistic(ware_type); // Tragen nun keine Ware mehr ware = std::nullopt; } @@ -173,11 +173,11 @@ void nofBuildingWorker::WorkingReady() void nofBuildingWorker::TryToWork() { - if(!workplace->IsProductionDisabled() && AreWaresAvailable()) + if(!workplace->isProductionDisabled() && AreWaresAvailable()) { state = State::Waiting1; - current_ev = GetEvMgr().AddEvent( - this, (GetGOT() == GO_Type::NofCatapultman) ? CATAPULT_WAIT1_LENGTH : JOB_CONSTS[job_].wait1_length, 1); + current_ev = getEvMgr().AddEvent( + this, (getGOT() == GO_Type::NofCatapultman) ? CATAPULT_WAIT1_LENGTH : JOB_CONSTS[job_].wait1_length, 1); workplace->StopNotWorking(); } else { @@ -250,7 +250,7 @@ void nofBuildingWorker::LostWork() case State::CatapultBackoff: { // Bisheriges Event abmelden, da die Arbeit unterbrochen wird - GetEvMgr().RemoveEvent(current_ev); + getEvMgr().RemoveEvent(current_ev); // Bescheid sagen, dass Arbeit abgebrochen wurde WorkAborted(); @@ -260,7 +260,7 @@ void nofBuildingWorker::LostWork() Wander(); // Evtl. Sounds löschen - world->GetSoundMgr().stopSounds(*this); + world->getSoundMgr().stopSounds(*this); state = State::FigureWork; } @@ -283,7 +283,7 @@ void nofBuildingWorker::LostWork() StartWandering(); // Evtl. Sounds löschen - world->GetSoundMgr().stopSounds(*this); + world->getSoundMgr().stopSounds(*this); state = State::FigureWork; } @@ -298,7 +298,7 @@ void nofBuildingWorker::ProductionStopped() // Wenn ich gerade warte und schon ein Arbeitsevent angemeldet habe, muss das wieder abgemeldet werden if(state == State::Waiting1) { - GetEvMgr().RemoveEvent(current_ev); + getEvMgr().RemoveEvent(current_ev); current_ev = nullptr; state = State::WaitingForWaresOrProductionStopped; workplace->StartNotWorking(); @@ -315,7 +315,7 @@ void nofBuildingWorker::DrawOtherStates(DrawPoint) {} /// Zeichnet Figur beim Hereinlaufen/nach Hause laufen mit evtl. getragenen Waren void nofBuildingWorker::DrawWalkingWithWare(DrawPoint drawPt) { - unsigned short id = GetCarryID(); + unsigned short id = getCarryID(); // >=CARRY_ID_CARRIER_OFFSET -> carrier.bob else jobs.bob! if(id >= CARRY_ID_CARRIER_OFFSET) { @@ -323,5 +323,5 @@ void nofBuildingWorker::DrawWalkingWithWare(DrawPoint drawPt) RTTR_Assert(id <= helpers::MaxEnumValue_v); DrawWalkingCarrier(drawPt, GoodType(id), JOB_SPRITE_CONSTS[job_].isFat()); } else - DrawWalking(drawPt, LOADER.GetBob("jobs"), id, JOB_SPRITE_CONSTS[job_].isFat()); + DrawWalking(drawPt, LOADER.getBob("jobs"), id, JOB_SPRITE_CONSTS[job_].isFat()); } diff --git a/libs/s25main/figures/nofBuildingWorker.h b/libs/s25main/figures/nofBuildingWorker.h index 0411cbdd3e..5a8fee6028 100644 --- a/libs/s25main/figures/nofBuildingWorker.h +++ b/libs/s25main/figures/nofBuildingWorker.h @@ -77,7 +77,7 @@ class nofBuildingWorker : public noFigure static constexpr unsigned short CARRY_ID_CARRIER_OFFSET = 100; /// Ask derived class for an ID into JOBS.BOB when the figure is carrying a ware /// Use GD_* + CARRY_ID_CARRIER_OFFSET for using carrier graphics - virtual unsigned short GetCarryID() const = 0; + virtual unsigned short getCarryID() const = 0; /// Laufen an abgeleitete Klassen weiterleiten virtual void WalkedDerived() = 0; /// Arbeit musste wegen Arbeitsplatzverlust abgebrochen werden @@ -91,7 +91,7 @@ class nofBuildingWorker : public noFigure virtual void DrawOtherStates(DrawPoint drawPt); public: - State GetState() const { return state; } + State getState() const { return state; } nofBuildingWorker(Job job, MapPoint pos, unsigned char player, nobUsual* workplace); nofBuildingWorker(SerializedGameData& sgd, unsigned obj_id); diff --git a/libs/s25main/figures/nofButcher.cpp b/libs/s25main/figures/nofButcher.cpp index 6878565b46..47eb67e8fd 100644 --- a/libs/s25main/figures/nofButcher.cpp +++ b/libs/s25main/figures/nofButcher.cpp @@ -23,12 +23,12 @@ void nofButcher::DrawWorking(DrawPoint drawPt) unsigned now_id; - LOADER.GetPlayerImage("rom_bobs", 160 + (now_id = GAMECLIENT.Interpolate(136, current_ev)) % 6) - ->DrawFull(drawPt + offsets[workplace->GetNation()], COLOR_WHITE, world->GetPlayer(workplace->GetPlayer()).color); + LOADER.getPlayerImage("rom_bobs", 160 + (now_id = GAMECLIENT.Interpolate(136, current_ev)) % 6) + ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); if(now_id % 6 == 5) { - world->GetSoundMgr().playNOSound(66, *this, now_id / 6); + world->getSoundMgr().playNOSound(66, *this, now_id / 6); was_sounding = true; } diff --git a/libs/s25main/figures/nofButcher.h b/libs/s25main/figures/nofButcher.h index b44032ab30..15529c76b2 100644 --- a/libs/s25main/figures/nofButcher.h +++ b/libs/s25main/figures/nofButcher.h @@ -15,7 +15,7 @@ class nofButcher : public nofWorkman /// Zeichnet ihn beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override { return 74; } + unsigned short getCarryID() const override { return 74; } /// Der Arbeiter erzeugt eine Ware helpers::OptionalEnum ProduceWare() override; @@ -23,5 +23,5 @@ class nofButcher : public nofWorkman nofButcher(MapPoint pos, unsigned char player, nobUsual* workplace); nofButcher(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofButcher; } + GO_Type getGOT() const final { return GO_Type::NofButcher; } }; diff --git a/libs/s25main/figures/nofCarpenter.cpp b/libs/s25main/figures/nofCarpenter.cpp index 5476d5e3c7..8c94a52443 100644 --- a/libs/s25main/figures/nofCarpenter.cpp +++ b/libs/s25main/figures/nofCarpenter.cpp @@ -23,13 +23,13 @@ void nofCarpenter::DrawWorking(DrawPoint drawPt) unsigned now_id; - LOADER.GetPlayerImage("rom_bobs", 32 + ((now_id = GAMECLIENT.Interpolate(136, current_ev)) % 8)) - ->DrawFull(drawPt + offsets[workplace->GetNation()], COLOR_WHITE, world->GetPlayer(workplace->GetPlayer()).color); + LOADER.getPlayerImage("rom_bobs", 32 + ((now_id = GAMECLIENT.Interpolate(136, current_ev)) % 8)) + ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); // Evtl Sound abspielen if(now_id % 8 == 3 || now_id % 8 == 7) { - world->GetSoundMgr().playNOSound(54 + ((now_id) % 8) / 4, *this, now_id / 4); + world->getSoundMgr().playNOSound(54 + ((now_id) % 8) / 4, *this, now_id / 4); was_sounding = true; } diff --git a/libs/s25main/figures/nofCarpenter.h b/libs/s25main/figures/nofCarpenter.h index 99dfd7a7a8..170f0ff5f7 100644 --- a/libs/s25main/figures/nofCarpenter.h +++ b/libs/s25main/figures/nofCarpenter.h @@ -15,7 +15,7 @@ class nofCarpenter : public nofWorkman /// Zeichnet ihn beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override { return 62; } + unsigned short getCarryID() const override { return 62; } /// Der Arbeiter erzeugt eine Ware helpers::OptionalEnum ProduceWare() override; @@ -23,5 +23,5 @@ class nofCarpenter : public nofWorkman nofCarpenter(MapPoint pos, unsigned char player, nobUsual* workplace); nofCarpenter(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofCarpenter; } + GO_Type getGOT() const final { return GO_Type::NofCarpenter; } }; diff --git a/libs/s25main/figures/nofCarrier.cpp b/libs/s25main/figures/nofCarrier.cpp index 1b90149bda..4e67c098e3 100644 --- a/libs/s25main/figures/nofCarrier.cpp +++ b/libs/s25main/figures/nofCarrier.cpp @@ -87,7 +87,7 @@ nofCarrier::nofCarrier(SerializedGameData& sgd, unsigned obj_id) { if(state == CarrierState::BoatcarrierWanderOnWater) { - if(sgd.GetGameDataVersion() < 7) + if(sgd.getGameDataVersion() < 7) { shore_path.resize(sgd.PopUnsignedInt()); helpers::popContainer(sgd, shore_path, true); @@ -124,7 +124,7 @@ void nofCarrier::Destroy() // Ware vernichten (abmelden) RTTR_Assert(!carried_ware); // TODO: Check if this is ok so keep the LooseWare call below LooseWare(); - GetEvMgr().RemoveEvent(productivity_ev); + getEvMgr().RemoveEvent(productivity_ev); noFigure::Destroy(); } @@ -137,12 +137,12 @@ void nofCarrier::Draw(DrawPoint drawPt) case CarrierType::Normal: { if(state == CarrierState::WaitForWare - || (waiting_for_free_node && !IsStoppedBetweenNodes() && !carried_ware)) + || (waiting_for_free_node && !isStoppedBetweenNodes() && !carried_ware)) { bool animation = false; // Ist es schon Zeit für eine Animation? - unsigned current_gf = GetEvMgr().GetCurrentGF(); + unsigned current_gf = getEvMgr().getCurrentGF(); if(current_gf >= next_animation) { @@ -168,7 +168,7 @@ void nofCarrier::Draw(DrawPoint drawPt) || (useNewyearsEgg && (current_gf >= next_animation + 32 * 3))) { // Neuen nächsten Animationszeitpunkt bestimmen - SetNewAnimationMoment(); + setNewAnimationMoment(); } else { animation = true; @@ -177,20 +177,20 @@ void nofCarrier::Draw(DrawPoint drawPt) { // Nein, dann Animation abspielen LOADER - .GetPlayerImage( + .getPlayerImage( "rom_bobs", ANIMATIONS[fat ? 1 : 0][animation_id][(current_gf - next_animation) / FRAME_GF]) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } else // Silvesteregg { glArchivItem_Bitmap_Player* bmp = - LOADER.GetPlayerImage("firework", (current_gf - next_animation) / 3 + 1); + LOADER.getPlayerImage("firework", (current_gf - next_animation) / 3 + 1); if(bmp) - bmp->DrawFull(drawPt - DrawPoint(26, 104), COLOR_WHITE, world->GetPlayer(player).color); + bmp->DrawFull(drawPt - DrawPoint(26, 104), COLOR_WHITE, world->getPlayer(player).color); else { - SetNewAnimationMoment(); + setNewAnimationMoment(); animation = false; } } @@ -199,17 +199,17 @@ void nofCarrier::Draw(DrawPoint drawPt) if(!animation) { - LOADER.getCarrierBobSprite(world->GetPlayer(player).nation, fat, GetCurMoveDir(), 2) - .draw(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getCarrierBobSprite(world->getPlayer(player).nation, fat, getCurMoveDir(), 2) + .draw(drawPt, COLOR_WHITE, world->getPlayer(player).color); } else // Steht und wartet (ohne Ware) - DrawShadow(drawPt, 0, GetCurMoveDir()); + DrawShadow(drawPt, 0, getCurMoveDir()); } else if(state == CarrierState::WaitForWareSpace - || (waiting_for_free_node && !IsStoppedBetweenNodes() && carried_ware)) + || (waiting_for_free_node && !isStoppedBetweenNodes() && carried_ware)) { // Steht und wartet (mit Ware) - LOADER.getCarrierSprite(carried_ware->type, fat, GetCurMoveDir(), 2) - .draw(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getCarrierSprite(carried_ware->type, fat, getCurMoveDir(), 2) + .draw(drawPt, COLOR_WHITE, world->getPlayer(player).color); } else { // Läuft normal mit oder ohne Ware @@ -223,22 +223,22 @@ void nofCarrier::Draw(DrawPoint drawPt) case CarrierType::Donkey: { if(state == CarrierState::WaitForWare - || (waiting_for_free_node && !IsStoppedBetweenNodes() && !carried_ware)) + || (waiting_for_free_node && !isStoppedBetweenNodes() && !carried_ware)) { // Steht und wartet (ohne Ware) // Esel - LOADER.getDonkeySprite(GetCurMoveDir(), 0).draw(drawPt); + LOADER.getDonkeySprite(getCurMoveDir(), 0).draw(drawPt); } else if(state == CarrierState::WaitForWareSpace - || (waiting_for_free_node && !IsStoppedBetweenNodes() && carried_ware)) + || (waiting_for_free_node && !isStoppedBetweenNodes() && carried_ware)) { //// Steht und wartet (mit Ware) // Esel - LOADER.getDonkeySprite(GetCurMoveDir(), 0).draw(drawPt); + LOADER.getDonkeySprite(getCurMoveDir(), 0).draw(drawPt); // Ware im Korb zeichnen - LOADER.GetWareDonkeyTex(carried_ware->type)->DrawFull(drawPt + WARE_POS_DONKEY[GetCurMoveDir()][0]); + LOADER.getWareDonkeyTex(carried_ware->type)->DrawFull(drawPt + WARE_POS_DONKEY[getCurMoveDir()][0]); } else { const unsigned ani_step = CalcWalkAnimationFrame(); @@ -248,13 +248,13 @@ void nofCarrier::Draw(DrawPoint drawPt) // Läuft normal mit oder ohne Ware // Esel - LOADER.getDonkeySprite(GetCurMoveDir(), ani_step).draw(drawPt); + LOADER.getDonkeySprite(getCurMoveDir(), ani_step).draw(drawPt); if(carried_ware) { // Ware im Korb zeichnen - LOADER.GetWareDonkeyTex(carried_ware->type) - ->DrawFull(drawPt + WARE_POS_DONKEY[GetCurMoveDir()][ani_step]); + LOADER.getWareDonkeyTex(carried_ware->type) + ->DrawFull(drawPt + WARE_POS_DONKEY[getCurMoveDir()][ani_step]); } } } @@ -266,18 +266,18 @@ void nofCarrier::Draw(DrawPoint drawPt) // Beim normalen Laufen Träger mit Boot über den Schultern zeichnen DrawWalkingCarrier(drawPt, GoodType::Boat, fat); } else if(state == CarrierState::WaitForWare - || (waiting_for_free_node && !IsStoppedBetweenNodes() && !carried_ware)) + || (waiting_for_free_node && !isStoppedBetweenNodes() && !carried_ware)) { - LOADER.getBoatCarrierSprite(GetCurMoveDir(), 0) - .draw(drawPt, 0xFFFFFFFF, world->GetPlayer(player).color); + LOADER.getBoatCarrierSprite(getCurMoveDir(), 0) + .draw(drawPt, 0xFFFFFFFF, world->getPlayer(player).color); } else if(state == CarrierState::WaitForWareSpace - || (waiting_for_free_node && !IsStoppedBetweenNodes() && carried_ware)) + || (waiting_for_free_node && !isStoppedBetweenNodes() && carried_ware)) { - LOADER.getBoatCarrierSprite(GetCurMoveDir(), 0) - .draw(drawPt, 0xFFFFFFFF, world->GetPlayer(player).color); + LOADER.getBoatCarrierSprite(getCurMoveDir(), 0) + .draw(drawPt, 0xFFFFFFFF, world->getPlayer(player).color); // Ware im Boot zeichnen - LOADER.GetWareDonkeyTex(carried_ware->type)->DrawFull(drawPt + WARE_POS_BOAT[GetCurMoveDir()]); + LOADER.getWareDonkeyTex(carried_ware->type)->DrawFull(drawPt + WARE_POS_BOAT[getCurMoveDir()]); } else { const unsigned ani_step = CalcWalkAnimationFrame(); @@ -285,17 +285,17 @@ void nofCarrier::Draw(DrawPoint drawPt) drawPt += CalcFigurRelative(); // ruderndes Boot zeichnen - LOADER.getBoatCarrierSprite(GetCurMoveDir(), ani_step) - .draw(drawPt, 0xFFFFFFFF, world->GetPlayer(player).color); + LOADER.getBoatCarrierSprite(getCurMoveDir(), ani_step) + .draw(drawPt, 0xFFFFFFFF, world->getPlayer(player).color); // Läuft normal mit oder ohne Ware if(carried_ware) // Ware im Boot zeichnen - LOADER.GetWareDonkeyTex(carried_ware->type)->DrawFull(drawPt + WARE_POS_BOAT[GetCurMoveDir()]); + LOADER.getWareDonkeyTex(carried_ware->type)->DrawFull(drawPt + WARE_POS_BOAT[getCurMoveDir()]); // Sound ggf. abspielen if(ani_step == 2) - world->GetSoundMgr().playNOSound(84, *this, 0); + world->getSoundMgr().playNOSound(84, *this, 0); last_id = ani_step; } @@ -305,16 +305,16 @@ void nofCarrier::Draw(DrawPoint drawPt) } /// Bestimmt neuen Animationszeitpunkt -void nofCarrier::SetNewAnimationMoment() +void nofCarrier::setNewAnimationMoment() { - next_animation = GetEvMgr().GetCurrentGF() + NEXT_ANIMATION + rand() % NEXT_ANIMATION_RANDOM; + next_animation = getEvMgr().getCurrentGF() + NEXT_ANIMATION + rand() % NEXT_ANIMATION_RANDOM; } void nofCarrier::Walked() { // Bootssounds ggf. löschen if(ct == CarrierType::Boat && state != CarrierState::FigureWork) - world->GetSoundMgr().stopSounds(*this); + world->getSoundMgr().stopSounds(*this); switch(state) { @@ -330,13 +330,13 @@ void nofCarrier::Walked() rs_pos = workplace->GetLength() - rs_pos; state = CarrierState::FetchWare; - StartWalking(cur_rs->GetDir(rs_dir, rs_pos)); + StartWalking(cur_rs->getDir(rs_dir, rs_pos)); } else if(rs_pos == cur_rs->GetLength() / 2 || rs_pos == cur_rs->GetLength() / 2 + cur_rs->GetLength() % 2) { // Wir sind in der Mitte angekommen state = CarrierState::WaitForWare; - if(GetCurMoveDir() == Direction::West || GetCurMoveDir() == Direction::NorthWest - || GetCurMoveDir() == Direction::SouthWest) + if(getCurMoveDir() == Direction::West || getCurMoveDir() == Direction::NorthWest + || getCurMoveDir() == Direction::SouthWest) FaceDir(Direction::SouthWest); else FaceDir(Direction::SouthEast); @@ -347,7 +347,7 @@ void nofCarrier::Walked() StopWorking(); // Animation auf später verschieben, damit die nicht mittendrin startet - SetNewAnimationMoment(); + setNewAnimationMoment(); } else { // Eventuell laufen wir in die falsche Richtung? @@ -357,7 +357,7 @@ void nofCarrier::Walked() rs_pos = cur_rs->GetLength() - rs_pos; } - StartWalking(cur_rs->GetDir(rs_dir, rs_pos)); + StartWalking(cur_rs->getDir(rs_dir, rs_pos)); } } break; @@ -370,7 +370,7 @@ void nofCarrier::Walked() // Dann Ware aufnehmnen FetchWare(false); else - StartWalking(cur_rs->GetDir(rs_dir, rs_pos)); + StartWalking(cur_rs->getDir(rs_dir, rs_pos)); } break; case CarrierState::CarryWare: @@ -379,7 +379,7 @@ void nofCarrier::Walked() if(rs_pos == cur_rs->GetLength()) { // Flag just reached - auto& this_flag = assertNonNull(((rs_dir) ? workplace->GetF1() : workplace->GetF2())); + auto& this_flag = assertNonNull(((rs_dir) ? workplace->getF1() : workplace->getF2())); bool calculated = false; @@ -389,15 +389,15 @@ void nofCarrier::Walked() // Walk to building or building site state = CarrierState::CarryWareToBuilding; StartWalking(Direction::NorthWest); - cur_rs = this_flag.GetRoute(Direction::NorthWest); + cur_rs = this_flag.getRoute(Direction::NorthWest); // Set location to next road node, i.e. building carried_ware->Carry( - assertNonNull((cur_rs->GetF1() == &this_flag) ? cur_rs->GetF2() : cur_rs->GetF1())); + assertNonNull((cur_rs->getF1() == &this_flag) ? cur_rs->getF2() : cur_rs->getF1())); } else { // Put ware at flag if there is space. // If not try swapping it with another ware at that flag - if(this_flag.HasSpaceForWare()) + if(this_flag.hasSpaceForWare()) { carried_ware->WaitAtFlag(this_flag); @@ -429,34 +429,34 @@ void nofCarrier::Walked() state = CarrierState::GoBackFromFlag; rs_dir = !rs_dir; rs_pos = cur_rs->GetLength() - rs_pos; - StartWalking(GetCurMoveDir() + 3u); + StartWalking(getCurMoveDir() + 3u); } } } else if(rs_pos == cur_rs->GetLength() - 1) { // If we are one step before the flag, check if we have to wait for space - auto* this_flag = static_cast(((rs_dir) ? workplace->GetF1() : workplace->GetF2())); + auto* this_flag = static_cast(((rs_dir) ? workplace->getF1() : workplace->getF2())); // If there is space at the flag, or we can carry it directly to the building or swap it with another // ware continue to the flag - if(this_flag->HasSpaceForWare() || WantInBuilding(nullptr) || cur_rs->AreWareJobs(!rs_dir, ct, true)) + if(this_flag->hasSpaceForWare() || WantInBuilding(nullptr) || cur_rs->AreWareJobs(!rs_dir, ct, true)) { - StartWalking(cur_rs->GetDir(rs_dir, rs_pos)); + StartWalking(cur_rs->getDir(rs_dir, rs_pos)); } else { // No space at flag, wait here state = CarrierState::WaitForWareSpace; - FaceDir(cur_rs->GetDir(rs_dir, rs_pos)); + FaceDir(cur_rs->getDir(rs_dir, rs_pos)); } } else { - StartWalking(cur_rs->GetDir(rs_dir, rs_pos)); + StartWalking(cur_rs->getDir(rs_dir, rs_pos)); } } break; case CarrierState::CarryWareToBuilding: { // Ware ablegen - world->GetSpecObj(pos)->AddWare(std::move(carried_ware)); + world->getSpecObj(pos)->AddWare(std::move(carried_ware)); RTTR_Assert(carried_ware == nullptr); // Wieder zurück zu meinem Weg laufen state = CarrierState::LeaveBuilding; @@ -467,7 +467,7 @@ void nofCarrier::Walked() { // So tun, als ob der Träger gerade vom anderen Ende des Weges kommt, damit alles korrekt funktioniert cur_rs = workplace; - FaceDir(workplace->GetDir(rs_dir, workplace->GetLength() - 1)); + FaceDir(workplace->getDir(rs_dir, workplace->GetLength() - 1)); LookForWares(); } break; @@ -501,35 +501,35 @@ void nofCarrier::LookForWares() state = CarrierState::FetchWare; rs_dir = !rs_dir; rs_pos = 0; - StartWalking(cur_rs->GetDir(rs_dir, rs_pos)); + StartWalking(cur_rs->getDir(rs_dir, rs_pos)); } else { // Wieder zurück in die Mitte gehen state = CarrierState::GotoMiddleOfRoad; rs_dir = !rs_dir; rs_pos = 0; - StartWalking(cur_rs->GetDir(rs_dir, rs_pos)); + StartWalking(cur_rs->getDir(rs_dir, rs_pos)); } } void nofCarrier::GoalReached() { // Erstes Produktivitätsevent anmelden - productivity_ev = GetEvMgr().AddEvent(this, PRODUCTIVITY_GF, 1); + productivity_ev = getEvMgr().AddEvent(this, PRODUCTIVITY_GF, 1); // Wir arbeiten schonmal StartWorking(); - auto* rn = world->GetSpecObj(pos); + auto* rn = world->getSpecObj(pos); for(const auto dir : helpers::EnumRange{}) { // noRoadNode * rn = world->GetSpecObj(x,y); - if(rn->GetRoute(dir) == workplace) + if(rn->getRoute(dir) == workplace) { // Am neuen Arbeitsplatz angekommen StartWalking(dir); cur_rs = workplace; rs_pos = 0; - rs_dir = rn != cur_rs->GetF1(); + rs_dir = rn != cur_rs->getF1(); state = CarrierState::GotoMiddleOfRoad; @@ -537,11 +537,11 @@ void nofCarrier::GoalReached() if(workplace->AreWareJobs(rs_dir, ct, true)) { // Ware aufnehmen - carried_ware = static_cast(rn)->SelectWare(GetCurMoveDir(), false, this); + carried_ware = static_cast(rn)->SelectWare(getCurMoveDir(), false, this); if(carried_ware) { - carried_ware->Carry(assertNonNull(rs_dir ? workplace->GetF1() : workplace->GetF2())); + carried_ware->Carry(assertNonNull(rs_dir ? workplace->getF1() : workplace->getF2())); state = CarrierState::CarryWare; } } @@ -552,14 +552,14 @@ void nofCarrier::GoalReached() } } - LOG.write("nofCarrier::GoalReached: ERROR: Road of carrier (id: %u) not found!\n") % GetObjId(); + LOG.write("nofCarrier::GoalReached: ERROR: Road of carrier (id: %u) not found!\n") % getObjId(); } void nofCarrier::AbrogateWorkplace() { if(workplace) { - GetEvMgr().RemoveEvent(productivity_ev); + getEvMgr().RemoveEvent(productivity_ev); // anderen Träger herausfinden unsigned other = (ct == CarrierType::Donkey) ? 0 : 1; @@ -570,9 +570,9 @@ void nofCarrier::AbrogateWorkplace() && workplace->hasCarrier(other)) { if(workplace->AreWareJobs(false, ct, true)) - workplace->getCarrier(other)->AddWareJob(workplace->GetF1()); + workplace->getCarrier(other)->AddWareJob(workplace->getF1()); else if(workplace->AreWareJobs(true, ct, true)) - workplace->getCarrier(other)->AddWareJob(workplace->GetF2()); + workplace->getCarrier(other)->AddWareJob(workplace->getF2()); } workplace->CarrierAbrogated(this); @@ -601,7 +601,7 @@ struct IsCoastalAndForFigs bool operator()(const MapPoint& pt) const { - return world.GetSeaFromCoastalPoint(pt) && PathConditionHuman(world).IsNodeOk(pt); + return world.getSeaFromCoastalPoint(pt) && PathConditionHuman(world).isNodeOk(pt); } }; } // namespace @@ -609,7 +609,7 @@ struct IsCoastalAndForFigs void nofCarrier::LostWork() { workplace = nullptr; - GetEvMgr().RemoveEvent(productivity_ev); + getEvMgr().RemoveEvent(productivity_ev); if(state == CarrierState::FigureWork) GoHome(); @@ -626,7 +626,7 @@ void nofCarrier::LostWork() { // If we are walking choose the destination point as start point // for the pathfinding! - tmpPos = world->GetNeighbour(tmpPos, GetCurMoveDir()); + tmpPos = world->getNeighbour(tmpPos, getCurMoveDir()); } // Look for the shore @@ -666,14 +666,14 @@ void nofCarrier::RoadSplitted(RoadSegment* rs1, RoadSegment* rs2) { // ich gehe erst noch hin, also gucken, welche Flagge ich anvisiert habe und das jeweilige Teilstück dann als // Arbeitsstraße - if(GetGoal() == rs1->GetF1()) + if(getGoal() == rs1->getF1()) workplace = rs1; else workplace = rs2; } else if(state == CarrierState::CarryWareToBuilding || state == CarrierState::LeaveBuilding) { // Wenn ich in ein Gebäude gehen oder rauskomme, auf den Weg gehen, der an dieses Gebäude grenzt - if(cur_rs->GetF1() == rs1->GetF1() || cur_rs->GetF1() == rs1->GetF2()) + if(cur_rs->getF1() == rs1->getF1() || cur_rs->getF1() == rs1->getF2()) workplace = rs1; else workplace = rs2; @@ -718,9 +718,9 @@ void nofCarrier::RoadSplitted(RoadSegment* rs1, RoadSegment* rs2) RTTR_Assert(otherRoad->getCarrier(carrierNr) == nullptr); // No carrier expected if(ct == CarrierType::Normal) - world->GetPlayer(player).FindCarrierForRoad(*otherRoad); + world->getPlayer(player).FindCarrierForRoad(*otherRoad); else if(ct == CarrierType::Donkey) - otherRoad->setCarrier(1, world->GetPlayer(player).OrderDonkey(*otherRoad)); + otherRoad->setCarrier(1, world->getPlayer(player).OrderDonkey(*otherRoad)); } void nofCarrier::HandleDerivedEvent(const unsigned id) @@ -736,9 +736,9 @@ void nofCarrier::HandleDerivedEvent(const unsigned id) if(since_working_gf != 0xFFFFFFFF) { // Es wurde bis jetzt nicht mehr gearbeitet, das also noch dazuzählen - worked_gf += static_cast(GetEvMgr().GetCurrentGF() - since_working_gf); + worked_gf += static_cast(getEvMgr().getCurrentGF() - since_working_gf); // Zähler zurücksetzen - since_working_gf = GetEvMgr().GetCurrentGF(); + since_working_gf = getEvMgr().getCurrentGF(); } // Produktivität ausrechnen @@ -748,7 +748,7 @@ void nofCarrier::HandleDerivedEvent(const unsigned id) worked_gf = 0; // Nächstes Event anmelden - productivity_ev = GetEvMgr().AddEvent(this, PRODUCTIVITY_GF, 1); + productivity_ev = getEvMgr().AddEvent(this, PRODUCTIVITY_GF, 1); // Reif für einen Esel? if(productivity >= DONKEY_PRODUCTIVITY && ct == CarrierType::Normal) @@ -764,19 +764,19 @@ bool nofCarrier::AddWareJob(const noRoadNode* rn) if(state == CarrierState::WaitForWare || state == CarrierState::GotoMiddleOfRoad) { // Stimmt die Richtung nicht? Dann umdrehen (geht aber nur, wenn wir stehen!) - if(rs_dir == workplace->GetNodeID(*rn) && state == CarrierState::WaitForWare) + if(rs_dir == workplace->getNodeID(*rn) && state == CarrierState::WaitForWare) { rs_dir = !rs_dir; rs_pos = cur_rs->GetLength() - rs_pos; } // beim Gehen in die Mitte nicht sofort umdrehen! - else if(rs_dir == workplace->GetNodeID(*rn)) + else if(rs_dir == workplace->getNodeID(*rn)) return false; // Und loslaufen, wenn wir stehen if(state == CarrierState::WaitForWare) { - StartWalking(cur_rs->GetDir(rs_dir, rs_pos)); + StartWalking(cur_rs->getDir(rs_dir, rs_pos)); // Endlich wird wieder ordentlich gearbeitet! StartWorking(); } @@ -785,10 +785,10 @@ bool nofCarrier::AddWareJob(const noRoadNode* rn) // Wir übernehmen den Job return true; - } else if(state == CarrierState::WaitForWareSpace && rs_dir == !workplace->GetNodeID(*rn)) + } else if(state == CarrierState::WaitForWareSpace && rs_dir == !workplace->getNodeID(*rn)) { // Wenn wir auf einen freien Platz warten, können wir nun losgehen, da wir ja die Waren dann "tauschen" können - StartWalking(cur_rs->GetDir(rs_dir, rs_pos)); + StartWalking(cur_rs->getDir(rs_dir, rs_pos)); state = CarrierState::CarryWare; // Wir übernehmen den Job @@ -826,17 +826,17 @@ void nofCarrier::RemoveWareJob() void nofCarrier::FetchWare(const bool swap_wares) { // Ware aufnehmnen - carried_ware = world->GetSpecObj(pos)->SelectWare(GetCurMoveDir() + 3u, swap_wares, this); + carried_ware = world->getSpecObj(pos)->SelectWare(getCurMoveDir() + 3u, swap_wares, this); if(carried_ware) { - carried_ware->Carry(assertNonNull(rs_dir ? workplace->GetF2() : workplace->GetF1())); + carried_ware->Carry(assertNonNull(rs_dir ? workplace->getF2() : workplace->getF1())); // Und zum anderen Ende laufen state = CarrierState::CarryWare; rs_dir = !rs_dir; rs_pos = 0; - StartWalking(cur_rs->GetDir(rs_dir, rs_pos)); + StartWalking(cur_rs->getDir(rs_dir, rs_pos)); } else // zurücklaufen lassen state = CarrierState::GotoMiddleOfRoad; } @@ -847,7 +847,7 @@ bool nofCarrier::SpaceAtFlag(const bool flag) if(state == CarrierState::WaitForWareSpace && rs_dir == !flag) { // In Richtung Flagge laufen, um Ware dort abzulegen - StartWalking(cur_rs->GetDir(rs_dir, rs_pos)); + StartWalking(cur_rs->getDir(rs_dir, rs_pos)); state = CarrierState::CarryWare; return true; } else @@ -857,7 +857,7 @@ bool nofCarrier::SpaceAtFlag(const bool flag) bool nofCarrier::WantInBuilding(bool* calculated) { RoadSegment* rs = - static_cast((rs_dir ? cur_rs->GetF1() : cur_rs->GetF2()))->GetRoute(Direction::NorthWest); + static_cast((rs_dir ? cur_rs->getF1() : cur_rs->getF2()))->getRoute(Direction::NorthWest); if(!rs) return false; @@ -870,7 +870,7 @@ bool nofCarrier::WantInBuilding(bool* calculated) } carried_ware->RecalcRoute(); - return carried_ware->GetNextDir() == RoadPathDirection::NorthWest; + return carried_ware->getNextDir() == RoadPathDirection::NorthWest; } /// Für Produktivitätsmessungen: fängt an zu arbeiten @@ -878,7 +878,7 @@ void nofCarrier::StartWorking() { // Wenn noch kein Zeitpunkt festgesetzt wurde, jetzt merken if(since_working_gf == 0xFFFFFFFF) - since_working_gf = GetEvMgr().GetCurrentGF(); + since_working_gf = getEvMgr().getCurrentGF(); } /// Für Produktivitätsmessungen: hört auf zu arbeiten @@ -887,7 +887,7 @@ void nofCarrier::StopWorking() // Falls wir vorher nicht gearbeitet haben, diese Zeit merken für die Produktivität if(since_working_gf != 0xFFFFFFFF) { - worked_gf += static_cast(GetEvMgr().GetCurrentGF() - since_working_gf); + worked_gf += static_cast(getEvMgr().getCurrentGF() - since_working_gf); since_working_gf = 0xFFFFFFFF; } } @@ -900,19 +900,19 @@ void nofCarrier::correctSplitDataDerived() { // Dann die Location von der Ware aktualisieren if(!rs_dir) - carried_ware->Carry(assertNonNull(cur_rs->GetF2())); + carried_ware->Carry(assertNonNull(cur_rs->getF2())); else - carried_ware->Carry(assertNonNull(cur_rs->GetF1())); + carried_ware->Carry(assertNonNull(cur_rs->getF1())); } } -noRoadNode* nofCarrier::GetFirstFlag() const +noRoadNode* nofCarrier::getFirstFlag() const { - return workplace ? workplace->GetF1() : nullptr; + return workplace ? workplace->getF1() : nullptr; } -noRoadNode* nofCarrier::GetSecondFlag() const +noRoadNode* nofCarrier::getSecondFlag() const { - return workplace ? workplace->GetF2() : nullptr; + return workplace ? workplace->getF2() : nullptr; } /// Boat carrier paddles to the coast after his road was destroyed diff --git a/libs/s25main/figures/nofCarrier.h b/libs/s25main/figures/nofCarrier.h index 5ed05e1fcb..ebf643c169 100644 --- a/libs/s25main/figures/nofCarrier.h +++ b/libs/s25main/figures/nofCarrier.h @@ -93,7 +93,7 @@ class nofCarrier : public noFigure void StopWorking(); /// Bestimmt neuen Animationszeitpunkt - void SetNewAnimationMoment(); + void setNewAnimationMoment(); /// Boat carrier paddles to the coast after his road was destroyed void WanderOnWater(); @@ -109,14 +109,14 @@ class nofCarrier : public noFigure void Destroy() override; - GO_Type GetGOT() const final { return GO_Type::NofCarrier; } + GO_Type getGOT() const final { return GO_Type::NofCarrier; } /// Gibt Träger-Typ zurück - CarrierType GetCarrierType() const { return ct; } + CarrierType getCarrierType() const { return ct; } /// Was macht der Träger gerade? - CarrierState GetCarrierState() const { return state; } + CarrierState getCarrierState() const { return state; } /// Gibt Träger-Produktivität in % zurück - unsigned GetProductivity() const { return productivity; } + unsigned getProductivity() const { return productivity; } void Draw(DrawPoint drawPt) override; @@ -139,8 +139,8 @@ class nofCarrier : public noFigure bool SpaceAtFlag(bool flag); /// Gibt erste Flagge des Arbeitsweges zurück, falls solch einer existiert - noRoadNode* GetFirstFlag() const; - noRoadNode* GetSecondFlag() const; + noRoadNode* getFirstFlag() const; + noRoadNode* getSecondFlag() const; /// Wird aufgerufen, wenn die Straße unter der Figur geteilt wurde (für abgeleitete Klassen) void correctSplitDataDerived() override; diff --git a/libs/s25main/figures/nofCatapultMan.cpp b/libs/s25main/figures/nofCatapultMan.cpp index 065d3fd536..99a3028db7 100644 --- a/libs/s25main/figures/nofCatapultMan.cpp +++ b/libs/s25main/figures/nofCatapultMan.cpp @@ -65,7 +65,7 @@ void nofCatapultMan::DrawWorking(DrawPoint drawPt) step = -step; // Katapult auf dem Dach mit Stein drehend zeichnen - LOADER.GetPlayerImage("rom_bobs", 1781 + (7 + step) % 6)->DrawFull(drawPt); + LOADER.getPlayerImage("rom_bobs", 1781 + (7 + step) % 6)->DrawFull(drawPt); } // else // // Katapult schießend zeichnen @@ -78,7 +78,7 @@ void nofCatapultMan::DrawWorking(DrawPoint drawPt) if(step < 2 * 3) // Katapult nach Schießen zeichnen (hin und her wippen - LOADER.GetPlayerImage("rom_bobs", 1787 + (step % 2) * 6 + (7 + wheel_steps) % 6)->DrawFull(drawPt); + LOADER.getPlayerImage("rom_bobs", 1787 + (step % 2) * 6 + (7 + wheel_steps) % 6)->DrawFull(drawPt); else { step = (step - 6) / 2; @@ -87,7 +87,7 @@ void nofCatapultMan::DrawWorking(DrawPoint drawPt) step = -(step); // Katapult auf dem Dach mit Stein drehend zeichnen (zurück in Ausgangsposition: Richtung 4) - LOADER.GetPlayerImage("rom_bobs", 1775 + (7 + wheel_steps - step) % 6)->DrawFull(drawPt); + LOADER.getPlayerImage("rom_bobs", 1775 + (7 + wheel_steps - step) % 6)->DrawFull(drawPt); } } break; @@ -110,21 +110,21 @@ void nofCatapultMan::HandleDerivedEvent(const unsigned /*id*/) for(auto* building : buildings) { // Auch ein richtiges Militärgebäude (kein HQ usw.), - if(building->GetGOT() == GO_Type::NobMilitary - && world->GetPlayer(player).IsAttackable(building->GetPlayer())) + if(building->getGOT() == GO_Type::NobMilitary + && world->getPlayer(player).isAttackable(building->getPlayer())) { // Was nicht im Nebel liegt und auch schon besetzt wurde (nicht neu gebaut)? - if(world->GetNode(building->GetPos()).fow[player].visibility == Visibility::Visible - && !static_cast(building)->IsNewBuilt()) + if(world->getNode(building->getPos()).fow[player].visibility == Visibility::Visible + && !static_cast(building)->isNewBuilt()) { // Entfernung ausrechnen - unsigned distance = world->CalcDistance(pos, building->GetPos()); + unsigned distance = world->CalcDistance(pos, building->getPos()); // Entfernung nicht zu hoch? if(distance <= CATAPULT_MAX_TARGET_RANGE) { // Mit in die Liste aufnehmen - possibleTargets.push_back(PossibleTarget(building->GetPos(), distance)); + possibleTargets.push_back(PossibleTarget(building->getPos(), distance)); } } } @@ -134,7 +134,7 @@ void nofCatapultMan::HandleDerivedEvent(const unsigned /*id*/) if(possibleTargets.empty()) { // Weiter warten, vielleicht gibts ja später wieder mal was - current_ev = GetEvMgr().AddEvent(this, CATAPULT_WAIT1_LENGTH, 1); + current_ev = getEvMgr().AddEvent(this, CATAPULT_WAIT1_LENGTH, 1); workplace->StartNotWorking(); return; } @@ -158,9 +158,9 @@ void nofCatapultMan::HandleDerivedEvent(const unsigned /*id*/) targetIsRight = false; } // Distance over map border is closer (max distance is size/2 due to wrap around) - if(distX > world->GetWidth() / 2) + if(distX > world->getWidth() / 2) { - distX -= world->GetWidth() / 2; + distX -= world->getWidth() / 2; targetIsRight = !targetIsRight; // Reverse direction } @@ -177,9 +177,9 @@ void nofCatapultMan::HandleDerivedEvent(const unsigned /*id*/) targetIsDown = false; } // Distance over map border is closer (max distance is size/2 due to wrap around) - if(distY > world->GetHeight() / 2) + if(distY > world->getHeight() / 2) { - distY -= world->GetHeight() / 2; + distY -= world->getHeight() / 2; targetIsDown = !targetIsDown; // Reverse direction } @@ -203,7 +203,7 @@ void nofCatapultMan::HandleDerivedEvent(const unsigned /*id*/) if(wheel_steps < -3) wheel_steps = 6 + wheel_steps; - current_ev = GetEvMgr().AddEvent(this, 15 * (std::abs(wheel_steps) + 1), 1); + current_ev = getEvMgr().AddEvent(this, 15 * (std::abs(wheel_steps) + 1), 1); state = State::CatapultTargetBuilding; @@ -231,19 +231,19 @@ void nofCatapultMan::HandleDerivedEvent(const unsigned /*id*/) } else { // Ansonsten zufälligen Punkt rundrum heraussuchen - destMap = world->GetNeighbour(target.pos, RANDOM_ENUM(Direction)); + destMap = world->getNeighbour(target.pos, RANDOM_ENUM(Direction)); } unsigned shooting_dir = (7 + wheel_steps) % 6; // Größe der Welt in Pixeln bestimmen - int worldWidth = world->GetWidth() * TR_W; - int worldHeight = world->GetHeight() * TR_H; + int worldWidth = world->getWidth() * TR_W; + int worldHeight = world->getHeight() * TR_H; // Startpunkt bestimmen - Position start = world->GetNodePos(pos) + STONE_STARTS[shooting_dir]; //-V557 + Position start = world->getNodePos(pos) + STONE_STARTS[shooting_dir]; //-V557 // (Visuellen) Aufschlagpunkt bestimmen - Position dest = world->GetNodePos(destMap); + Position dest = world->getNodePos(destMap); // Kartenränder beachten // Wenn Abstand kleiner is, den kürzeren Abstand über den Kartenrand wählen @@ -269,7 +269,7 @@ void nofCatapultMan::HandleDerivedEvent(const unsigned /*id*/) world->AddCatapultStone(new CatapultStone(target.pos, destMap, start, dest, 80)); // Katapult wieder in Ausgangslage zurückdrehen - current_ev = GetEvMgr().AddEvent(this, 15 * (std::abs(wheel_steps) + 3), 1); + current_ev = getEvMgr().AddEvent(this, 15 * (std::abs(wheel_steps) + 3), 1); state = State::CatapultBackoff; } diff --git a/libs/s25main/figures/nofCatapultMan.h b/libs/s25main/figures/nofCatapultMan.h index 40a8776f4d..2e54058f7f 100644 --- a/libs/s25main/figures/nofCatapultMan.h +++ b/libs/s25main/figures/nofCatapultMan.h @@ -38,7 +38,7 @@ class nofCatapultMan : public nofBuildingWorker /// Malt den Arbeiter beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override { return 0; } + unsigned short getCarryID() const override { return 0; } public: nofCatapultMan(MapPoint pos, unsigned char player, nobUsual* workplace); @@ -46,7 +46,7 @@ class nofCatapultMan : public nofBuildingWorker void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofCatapultman; } + GO_Type getGOT() const final { return GO_Type::NofCatapultman; } void HandleDerivedEvent(unsigned id) override; diff --git a/libs/s25main/figures/nofCharburner.cpp b/libs/s25main/figures/nofCharburner.cpp index 10eb3ef307..93123ca9d8 100644 --- a/libs/s25main/figures/nofCharburner.cpp +++ b/libs/s25main/figures/nofCharburner.cpp @@ -42,7 +42,7 @@ void nofCharburner::DrawWorking(DrawPoint drawPt) // Schaufel-Sound if(now_id == 6 || now_id == 18 || now_id == 30) { - world->GetSoundMgr().playNOSound(76, *this, now_id / 12, 200); + world->getSoundMgr().playNOSound(76, *this, now_id / 12, 200); was_sounding = true; } @@ -52,11 +52,11 @@ void nofCharburner::DrawWorking(DrawPoint drawPt) else draw_id = 9 + 12 + (now_id - 36); - LOADER.GetPlayerImage("charburner_bobs", draw_id) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("charburner_bobs", draw_id) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } else - LOADER.GetPlayerImage("charburner_bobs", 1 + GAMECLIENT.Interpolate(18, current_ev) % 6) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("charburner_bobs", 1 + GAMECLIENT.Interpolate(18, current_ev) % 6) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } #ifdef _MSC_VER @@ -64,7 +64,7 @@ void nofCharburner::DrawWorking(DrawPoint drawPt) # pragma warning(disable : 4646) // function declared with [[noreturn]] has non-void return type #endif -unsigned short nofCharburner::GetCarryID() const +unsigned short nofCharburner::getCarryID() const { throw std::logic_error("Must not be called. Handled by custom DrawWalkingWithWare"); } @@ -79,13 +79,13 @@ void nofCharburner::WorkStarted() {} /// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten void nofCharburner::WorkFinished() { - noBase* no = world->GetNO(pos); + noBase* no = world->getNO(pos); // Is a charburner pile is already there? - if(no->GetGOT() == GO_Type::Charburnerpile) + if(no->getGOT() == GO_Type::Charburnerpile) { // Is Pile already in the normal "coal harvest mode"? - if(static_cast(no)->GetState() == noCharburnerPile::State::Harvest) + if(static_cast(no)->getState() == noCharburnerPile::State::Harvest) // Then let's bring a coal to our house ware = GoodType::Coal; // One step further @@ -94,18 +94,18 @@ void nofCharburner::WorkFinished() } // Point still good? - if(GetPointQuality(pos) != PointQuality::NotPossible) + if(getPointQuality(pos) != PointQuality::NotPossible) { // Delete previous elements // Only environ objects and signs are allowed to be removed by the worker! // Otherwise just do nothing - NodalObjectType noType = no->GetType(); + NodalObjectType noType = no->getType(); if(noType == NodalObjectType::Environment || noType == NodalObjectType::Nothing) { world->DestroyNO(pos, false); // Plant charburner pile - world->SetNO(pos, new noCharburnerPile(pos)); + world->setNO(pos, new noCharburnerPile(pos)); // BQ drumrum neu berechnen world->RecalcBQAroundPointBig(pos); @@ -114,14 +114,14 @@ void nofCharburner::WorkFinished() } /// Fragt abgeleitete Klasse, ob hier Platz bzw ob hier ein Baum etc steht, den z.B. der Holzfäller braucht -nofFarmhand::PointQuality nofCharburner::GetPointQuality(const MapPoint pt, const bool isBeforeWork) const +nofFarmhand::PointQuality nofCharburner::getPointQuality(const MapPoint pt, const bool isBeforeWork) const { - noBase* no = world->GetNO(pt); + noBase* no = world->getNO(pt); // Is a charburner pile already here? - if(no->GetGOT() == GO_Type::Charburnerpile) + if(no->getGOT() == GO_Type::Charburnerpile) { - noCharburnerPile::State pileState = static_cast(no)->GetState(); + noCharburnerPile::State pileState = static_cast(no)->getState(); // Can't it be harvested? if(pileState == noCharburnerPile::State::Smoldering) return PointQuality::NotPossible; @@ -148,31 +148,31 @@ nofFarmhand::PointQuality nofCharburner::GetPointQuality(const MapPoint pt, cons return PointQuality::NotPossible; // Der Platz muss frei sein - BlockingManner bm = world->GetNO(pt)->GetBM(); + BlockingManner bm = world->getNO(pt)->getBM(); if(bm != BlockingManner::None) return PointQuality::NotPossible; // Kein Grenzstein darf da stehen - if(world->GetNode(pt).boundary_stones[BorderStonePos::OnPoint]) + if(world->getNode(pt).boundary_stones[BorderStonePos::OnPoint]) return PointQuality::NotPossible; - for(const MapPoint nb : world->GetNeighbours(pt)) + for(const MapPoint nb : world->getNeighbours(pt)) { // Don't set it next to buildings and other charburner piles and grain fields - BlockingManner bm = world->GetNO(nb)->GetBM(); + BlockingManner bm = world->getNO(nb)->getBM(); if(bm != BlockingManner::None) return PointQuality::NotPossible; // darf außerdem nicht neben einer Straße liegen for(const auto dir2 : helpers::EnumRange{}) { - if(world->GetPointRoad(nb, dir2) != PointRoad::None) + if(world->getPointRoad(nb, dir2) != PointRoad::None) return PointQuality::NotPossible; } } // Terrain untersuchen (need walkable land) - if(world->IsOfTerrain( + if(world->isOfTerrain( pt, [](const auto& desc) { return desc.Is(ETerrain::Walkable) && desc.kind == TerrainKind::Land; })) return PointQuality::Class3; else @@ -182,9 +182,9 @@ nofFarmhand::PointQuality nofCharburner::GetPointQuality(const MapPoint pt, cons /// Inform derived class about the start of the whole working process (at the beginning when walking out of the house) void nofCharburner::WalkingStarted() { - noBase* nob = world->GetNO(dest); - if(nob->GetGOT() == GO_Type::Charburnerpile) - harvest = !(static_cast(nob)->GetState() == noCharburnerPile::State::Wood); + noBase* nob = world->getNO(dest); + if(nob->getGOT() == GO_Type::Charburnerpile) + harvest = !(static_cast(nob)->getState() == noCharburnerPile::State::Wood); else harvest = false; @@ -193,10 +193,10 @@ void nofCharburner::WalkingStarted() { workplace->ConsumeWares(); // Dertermine ware which we should carry to the pile - if(nob->GetGOT() != GO_Type::Charburnerpile) + if(nob->getGOT() != GO_Type::Charburnerpile) wt = WareType::Wood; else - wt = WareType(static_cast(nob)->GetNeededWareType()); + wt = WareType(static_cast(nob)->getNeededWareType()); } } diff --git a/libs/s25main/figures/nofCharburner.h b/libs/s25main/figures/nofCharburner.h index 9cab053757..32915027c8 100644 --- a/libs/s25main/figures/nofCharburner.h +++ b/libs/s25main/figures/nofCharburner.h @@ -25,14 +25,14 @@ class nofCharburner : public nofFarmhand private: void DrawWorking(DrawPoint drawPt) override; /// Has no ID in jobs.bob or carrier.bob - [[noreturn]] unsigned short GetCarryID() const override; + [[noreturn]] unsigned short getCarryID() const override; void WorkStarted() override; void WorkFinished() override; /// Returns the quality of this working point or determines if the worker can work here at all - PointQuality GetPointQuality(MapPoint pt, bool isBeforeWork) const override; - using nofFarmhand::GetPointQuality; + PointQuality getPointQuality(MapPoint pt, bool isBeforeWork) const override; + using nofFarmhand::getPointQuality; /// Inform derived class about the start of the whole working process (at the beginning when walking out of the /// house) @@ -53,5 +53,5 @@ class nofCharburner : public nofFarmhand void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofCharburner; } + GO_Type getGOT() const final { return GO_Type::NofCharburner; } }; diff --git a/libs/s25main/figures/nofDefender.cpp b/libs/s25main/figures/nofDefender.cpp index cdb67e0647..b55e6a07d4 100644 --- a/libs/s25main/figures/nofDefender.cpp +++ b/libs/s25main/figures/nofDefender.cpp @@ -69,9 +69,9 @@ void nofDefender::Walked() } else { nobBaseMilitary* bld = homeBld; - RTTR_Assert(bld->GetDefender() == this); // I should be the defender + RTTR_Assert(bld->getDefender() == this); // I should be the defender bld->AddActiveSoldier(world->RemoveFigure(pos, *this)); - RTTR_Assert(!bld->GetDefender()); // No defender anymore + RTTR_Assert(!bld->getDefender()); // No defender anymore } } break; @@ -117,7 +117,7 @@ void nofDefender::HomeDestroyedAtBegin() void nofDefender::WonFighting() { // addon BattlefieldPromotion active? -> increase rank! - if(world->GetGGS().isEnabled(AddonId::BATTLEFIELD_PROMOTION)) + if(world->getGGS().isEnabled(AddonId::BATTLEFIELD_PROMOTION)) IncreaseRank(); // Attacker is dead attacker = nullptr; @@ -154,10 +154,10 @@ void nofDefender::LostFighting() { homeBld->ResetDefender(); // A military building potentially needs to get new soldiers if this wasn't the last one - if(BuildingProperties::IsMilitary(homeBld->GetBuildingType())) + if(BuildingProperties::isMilitary(homeBld->getBuildingType())) { RTTR_Assert(dynamic_cast(homeBld)); - if(static_cast(homeBld)->GetNumTroops()) + if(static_cast(homeBld)->getNumTroops()) static_cast(homeBld)->RegulateTroops(); } homeBld = nullptr; diff --git a/libs/s25main/figures/nofDefender.h b/libs/s25main/figures/nofDefender.h index e209a78ea0..cd55355997 100644 --- a/libs/s25main/figures/nofDefender.h +++ b/libs/s25main/figures/nofDefender.h @@ -42,7 +42,7 @@ class nofDefender : public nofActiveSoldier } void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofDefender; } + GO_Type getGOT() const final { return GO_Type::NofDefender; } /// Inform that a new attacker arrived at the flag while we are going in such that we can come right back void NewAttacker(nofAttacker& attacker) { this->attacker = &attacker; } @@ -59,11 +59,11 @@ class nofDefender : public nofActiveSoldier void LostFighting() override; /// Is the defender waiting at the flag for an attacker? - bool IsWaitingAtFlag() const { return (state == SoldierState::DefendingWaiting); } - bool IsFightingAtFlag() const { return (state == SoldierState::Fighting); } + bool isWaitingAtFlag() const { return (state == SoldierState::DefendingWaiting); } + bool isFightingAtFlag() const { return (state == SoldierState::Fighting); } /// Inform the defender that a fight between him and an attacker has started void FightStarted() { state = SoldierState::Fighting; } // For debugging - const nofAttacker* GetAttacker() const { return attacker; } + const nofAttacker* getAttacker() const { return attacker; } }; diff --git a/libs/s25main/figures/nofDonkeybreeder.cpp b/libs/s25main/figures/nofDonkeybreeder.cpp index b2534bb327..7a5d49c080 100644 --- a/libs/s25main/figures/nofDonkeybreeder.cpp +++ b/libs/s25main/figures/nofDonkeybreeder.cpp @@ -25,10 +25,10 @@ nofDonkeybreeder::nofDonkeybreeder(SerializedGameData& sgd, unsigned obj_id) : n */ void nofDonkeybreeder::DrawWorking(DrawPoint drawPt) { - const Nation nation = workplace->GetNation(); + const Nation nation = workplace->getNation(); constexpr helpers::EnumArray walk_start = {{{2, 2}, {-6, -6}, {-7, -7}, {-7, -7}, {-6, -6}}}; const helpers::EnumArray walk_length = {22, 19, 19, 23, 19}; - const unsigned color = world->GetPlayer(player).color; + const unsigned color = world->getPlayer(player).color; unsigned now_id = GAMECLIENT.Interpolate(9600, current_ev); DrawPoint walkBasePos = drawPt + walk_start[nation]; @@ -42,7 +42,7 @@ void nofDonkeybreeder::DrawWorking(DrawPoint drawPt) LOADER.getBobSprite(nation, Job::DonkeyBreeder, Direction::East, ((now_id - 400) / 70) % 8) .draw(walkBasePos + DrawPoint((now_id - 400) / 800, 4), COLOR_WHITE, color); else if(now_id < 2000) - LOADER.GetPlayerImage("rom_bobs", 291 + (now_id - 1200) / 100) + LOADER.getPlayerImage("rom_bobs", 291 + (now_id - 1200) / 100) ->DrawFull(walkBasePos + DrawPoint(walk_length[nation] + 4, 4), COLOR_WHITE, color); else if(now_id < 2800) LOADER.getBobSprite(nation, Job::DonkeyBreeder, Direction::West, ((now_id - 2000) / 70) % 8) @@ -68,12 +68,12 @@ void nofDonkeybreeder::WorkFinished() { // Straße und Zielflagge für Esel suchen noRoadNode* flag_goal; - RoadSegment* road = world->GetPlayer(player).FindRoadForDonkey(*workplace, &flag_goal); + RoadSegment* road = world->getPlayer(player).FindRoadForDonkey(*workplace, &flag_goal); // Esel erzeugen und zum Ziel beordern auto donkey = std::make_unique(CarrierType::Donkey, pos, player, road, flag_goal); - world->GetPlayer(player).IncreaseInventoryJob(Job::PackDonkey, 1); - donkey->InitializeRoadWalking(world->GetSpecObj(pos)->GetRoute(Direction::SouthEast), 0, true); + world->getPlayer(player).IncreaseInventoryJob(Job::PackDonkey, 1); + donkey->InitializeRoadWalking(world->getSpecObj(pos)->getRoute(Direction::SouthEast), 0, true); // Wenn keine Straße gefunden wurde, muss er nach Hause gehen if(!road) diff --git a/libs/s25main/figures/nofDonkeybreeder.h b/libs/s25main/figures/nofDonkeybreeder.h index e4e48dc5d0..3a0fe95ccf 100644 --- a/libs/s25main/figures/nofDonkeybreeder.h +++ b/libs/s25main/figures/nofDonkeybreeder.h @@ -16,7 +16,7 @@ class nofDonkeybreeder : public nofWorkman nofDonkeybreeder(MapPoint pos, unsigned char player, nobUsual* workplace); nofDonkeybreeder(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofDonkeybreeder; } + GO_Type getGOT() const final { return GO_Type::NofDonkeybreeder; } private: /// Zeichnet ihn beim Arbeiten. @@ -27,5 +27,5 @@ class nofDonkeybreeder : public nofWorkman void WorkFinished() override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override { return 0; } + unsigned short getCarryID() const override { return 0; } }; diff --git a/libs/s25main/figures/nofFarmer.cpp b/libs/s25main/figures/nofFarmer.cpp index 613782020d..b0e4f63c8f 100644 --- a/libs/s25main/figures/nofFarmer.cpp +++ b/libs/s25main/figures/nofFarmer.cpp @@ -35,50 +35,50 @@ void nofFarmer::DrawWorking(DrawPoint drawPt) if(harvest) { - LOADER.GetPlayerImage("rom_bobs", 140 + (now_id = GAMECLIENT.Interpolate(88, current_ev)) % 8) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 140 + (now_id = GAMECLIENT.Interpolate(88, current_ev)) % 8) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); // Evtl Sound abspielen if(now_id % 8 == 3) { - world->GetSoundMgr().playNOSound(64, *this, now_id / 8); + world->getSoundMgr().playNOSound(64, *this, now_id / 8); was_sounding = true; } } else { - LOADER.GetPlayerImage("rom_bobs", 132 + GAMECLIENT.Interpolate(88, current_ev) % 8) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 132 + GAMECLIENT.Interpolate(88, current_ev) % 8) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } } -unsigned short nofFarmer::GetCarryID() const +unsigned short nofFarmer::getCarryID() const { return 71; } -nofFarmhand::PointQuality nofFarmer::GetNewFieldPointQuality(const GameWorld& world, const MapPoint pt) +nofFarmhand::PointQuality nofFarmer::getNewFieldPointQuality(const GameWorld& world, const MapPoint pt) { // Nicht auf Straßen bauen! for(const auto dir : helpers::EnumRange{}) { - if(world.GetPointRoad(pt, dir) != PointRoad::None) + if(world.getPointRoad(pt, dir) != PointRoad::None) return PointQuality::NotPossible; } // Terrain untersuchen - if(!world.IsOfTerrain(pt, [](const auto& desc) { return desc.IsVital(); })) + if(!world.isOfTerrain(pt, [](const auto& desc) { return desc.isVital(); })) return PointQuality::NotPossible; // Ist Platz frei? - NodalObjectType noType = world.GetNO(pt)->GetType(); + NodalObjectType noType = world.getNO(pt)->getType(); if(noType != NodalObjectType::Environment && noType != NodalObjectType::Nothing) return PointQuality::NotPossible; - for(const MapPoint nb : world.GetNeighbours(pt)) + for(const MapPoint nb : world.getNeighbours(pt)) { // Nicht direkt neben andere Getreidefelder und Gebäude setzen! - noType = world.GetNO(nb)->GetType(); + noType = world.getNO(nb)->getType(); if(noType == NodalObjectType::Grainfield || noType == NodalObjectType::Grapefield || noType == NodalObjectType::Building || noType == NodalObjectType::Buildingsite) return PointQuality::NotPossible; @@ -91,11 +91,11 @@ nofFarmhand::PointQuality nofFarmer::GetNewFieldPointQuality(const GameWorld& wo void nofFarmer::WorkStarted() { // Wenn ich zu einem Getreidefeld gehe, ernte ich es ab, ansonsten sähe ich - harvest = (world->GetNO(pos)->GetType() == NodalObjectType::Grainfield); + harvest = (world->getNO(pos)->getType() == NodalObjectType::Grainfield); // Getreidefeld Bescheid sagen, damits nicht plötzlich verschwindet, während wir arbeiten if(harvest) - world->GetSpecObj(pos)->BeginHarvesting(); + world->getSpecObj(pos)->BeginHarvesting(); } /// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten @@ -105,31 +105,31 @@ void nofFarmer::WorkFinished() { // Getreidefeld vernichten und vorher noch die ID von dem abgeernteten Feld holen, was dann als // normales Zierobjekt gesetzt wird - noBase* nob = world->GetNO(pos); + noBase* nob = world->getNO(pos); // Check if there is still a grain field at this position - if(nob->GetGOT() != GO_Type::Grainfield) + if(nob->getGOT() != GO_Type::Grainfield) return; - unsigned mapLstId = static_cast(nob)->GetHarvestMapLstID(); + unsigned mapLstId = static_cast(nob)->getHarvestMapLstID(); world->DestroyNO(pos); - world->SetNO(pos, new noEnvObject(pos, mapLstId)); + world->setNO(pos, new noEnvObject(pos, mapLstId)); // Getreide, was wir geerntet haben, in die Hand nehmen ware = GoodType::Grain; } else { // If the point got bad (e.g. something was build), abort work - if(GetPointQuality(pos) == PointQuality::NotPossible) + if(getPointQuality(pos) == PointQuality::NotPossible) return; // Was stand hier vorher? - NodalObjectType noType = world->GetNO(pos)->GetType(); + NodalObjectType noType = world->getNO(pos)->getType(); // Nur Zierobjekte und Schilder dürfen weggerissen werden if(noType == NodalObjectType::Environment || noType == NodalObjectType::Nothing) { world->DestroyNO(pos, false); // neues Getreidefeld setzen - world->SetNO(pos, new noGrainfield(pos)); + world->setNO(pos, new noGrainfield(pos)); } // Wir haben nur gesäht (gar nichts in die Hand nehmen) @@ -141,19 +141,19 @@ void nofFarmer::WorkFinished() } /// Returns the quality of this working point or determines if the worker can work here at all -nofFarmhand::PointQuality nofFarmer::GetPointQuality(const MapPoint pt, bool /* isBeforeWork */) const +nofFarmhand::PointQuality nofFarmer::getPointQuality(const MapPoint pt, bool /* isBeforeWork */) const { // Entweder gibts ein Getreidefeld, das wir abernten können... - if(world->GetNO(pt)->GetType() == NodalObjectType::Grainfield) + if(world->getNO(pt)->getType() == NodalObjectType::Grainfield) { - if(world->GetSpecObj(pt)->IsHarvestable()) + if(world->getSpecObj(pt)->isHarvestable()) return PointQuality::Class1; else return PointQuality::NotPossible; } // oder einen freien Platz, wo wir ein neues sähen können else - return GetNewFieldPointQuality(*world, pt); + return getNewFieldPointQuality(*world, pt); } void nofFarmer::WorkAborted() @@ -161,5 +161,5 @@ void nofFarmer::WorkAborted() nofFarmhand::WorkAborted(); // dem Getreidefeld Bescheid sagen, damit es wieder verdorren kann, wenn wir abernten if(harvest && state == State::Work) - world->GetSpecObj(pos)->EndHarvesting(); + world->getSpecObj(pos)->EndHarvesting(); } diff --git a/libs/s25main/figures/nofFarmer.h b/libs/s25main/figures/nofFarmer.h index 24d3faad38..ecc88e3b1d 100644 --- a/libs/s25main/figures/nofFarmer.h +++ b/libs/s25main/figures/nofFarmer.h @@ -18,7 +18,7 @@ class nofFarmer : public nofFarmhand /// Malt den Arbeiter beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override; + unsigned short getCarryID() const override; /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) void WorkStarted() override; @@ -28,16 +28,16 @@ class nofFarmer : public nofFarmhand void WorkAborted() override; /// Returns the quality of this working point or determines if the worker can work here at all - PointQuality GetPointQuality(MapPoint pt, bool isBeforeWork) const override; - using nofFarmhand::GetPointQuality; + PointQuality getPointQuality(MapPoint pt, bool isBeforeWork) const override; + using nofFarmhand::getPointQuality; public: nofFarmer(MapPoint pos, unsigned char player, nobUsual* workplace); nofFarmer(SerializedGameData& sgd, unsigned obj_id); - static nofFarmhand::PointQuality GetNewFieldPointQuality(const GameWorld& world, MapPoint pt); + static nofFarmhand::PointQuality getNewFieldPointQuality(const GameWorld& world, MapPoint pt); void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofFarmer; } + GO_Type getGOT() const final { return GO_Type::NofFarmer; } }; diff --git a/libs/s25main/figures/nofFarmhand.cpp b/libs/s25main/figures/nofFarmhand.cpp index cbd1b12772..91878b710e 100644 --- a/libs/s25main/figures/nofFarmhand.cpp +++ b/libs/s25main/figures/nofFarmhand.cpp @@ -32,12 +32,12 @@ nofFarmhand::nofFarmhand(SerializedGameData& sgd, const unsigned obj_id) : nofBuildingWorker(sgd, obj_id), dest(sgd.PopMapPoint()) {} -unsigned nofFarmhand::GetWorkRadius(const Job job) +unsigned nofFarmhand::getWorkRadius(const Job job) { - return GetWorkRadius(world->GetGGS(), job); + return getWorkRadius(world->getGGS(), job); } -unsigned nofFarmhand::GetWorkRadius(const GlobalGameSettings& ggs, const Job job) +unsigned nofFarmhand::getWorkRadius(const GlobalGameSettings& ggs, const Job job) { switch(job) { @@ -82,12 +82,12 @@ void nofFarmhand::HandleDerivedEvent(const unsigned /*id*/) { // Done working -> Handle results of the work (step) WorkFinished(); - world->SetReserved(pos, false); + world->setReserved(pos, false); StartWalkingHome(); if(was_sounding) { - world->GetSoundMgr().stopSounds(*this); + world->getSoundMgr().stopSounds(*this); was_sounding = false; } } @@ -96,7 +96,7 @@ void nofFarmhand::HandleDerivedEvent(const unsigned /*id*/) { // Start working after the initial wait period // Work radius - const unsigned max_radius = GetWorkRadius(job_); + const unsigned max_radius = getWorkRadius(job_); // Number of additional radii in which points should be found // I.e. 0 => Don't search for points further away than ones already found const unsigned additionalRadiiToFind = [](Job job) { @@ -121,20 +121,20 @@ void nofFarmhand::HandleDerivedEvent(const unsigned /*id*/) helpers::EnumArray, PointQuality> available_points; - for(MapCoord tx = world->GetXA(pos, Direction::West), r = 1; r <= max_radius; - tx = world->GetXA(MapPoint(tx, pos.y), Direction::West), ++r) + for(MapCoord tx = world->getXA(pos, Direction::West), r = 1; r <= max_radius; + tx = world->getXA(MapPoint(tx, pos.y), Direction::West), ++r) { bool pointFound = false; MapPoint pt(tx, pos.y); for(const auto dir : helpers::enumRange(Direction::NorthEast)) { - for(MapCoord r2 = 0; r2 < r; pt = world->GetNeighbour(pt, dir), ++r2) + for(MapCoord r2 = 0; r2 < r; pt = world->getNeighbour(pt, dir), ++r2) { - const auto quality = GetPointQuality(pt, true); + const auto quality = getPointQuality(pt, true); if(quality != PointQuality::NotPossible && world->FindHumanPath(this->pos, pt, 20)) { - if(!world->GetNode(pt).reserved) + if(!world->getNode(pt).reserved) { available_points[quality].push_back(pt); pointFound = true; @@ -169,7 +169,7 @@ void nofFarmhand::HandleDerivedEvent(const unsigned /*id*/) workplace->StopNotWorking(); // Avoid others taking this point too - world->SetReserved(dest, true); + world->setReserved(dest, true); // Walk out of the building first state = State::WalkToWorkpoint; @@ -184,15 +184,15 @@ void nofFarmhand::HandleDerivedEvent(const unsigned /*id*/) case Job::Stonemason: case Job::Fisher: workplace->OnOutOfResources(); break; case Job::Woodcutter: - world->GetNotifications().publish(BuildingNote( - BuildingNote::NoRessources, player, workplace->GetPos(), workplace->GetBuildingType())); + world->getNotifications().publish(BuildingNote( + BuildingNote::NoRessources, player, workplace->getPos(), workplace->getBuildingType())); break; default: break; } } // Try to find something later - current_ev = GetEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); + current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); workplace->StartNotWorking(); } } @@ -203,7 +203,7 @@ void nofFarmhand::HandleDerivedEvent(const unsigned /*id*/) void nofFarmhand::WalkToWorkpoint() { - if(GetPointQuality(dest) == PointQuality::NotPossible) + if(getPointQuality(dest) == PointQuality::NotPossible) { // Point became invalid -> Abort and go home WorkAborted(); @@ -212,7 +212,7 @@ void nofFarmhand::WalkToWorkpoint() { // Arrived at target -> Start working state = State::Work; - current_ev = GetEvMgr().AddEvent(this, JOB_CONSTS[job_].work_length, 1); + current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].work_length, 1); WorkStarted(); } else { @@ -233,7 +233,7 @@ void nofFarmhand::StartWalkingHome() { state = State::WalkingHome; // Fahne vor dem Gebäude anpeilen - dest = world->GetNeighbour(workplace->GetPos(), Direction::SouthEast); + dest = world->getNeighbour(workplace->getPos(), Direction::SouthEast); // Zu Laufen anfangen WalkHome(); @@ -268,7 +268,7 @@ void nofFarmhand::WorkAborted() { // Platz freigeben, falls man gerade arbeitet if(state == State::Work || state == State::WalkToWorkpoint) - world->SetReserved(dest, false); + world->setReserved(dest, false); } /// Zeichnen der Figur in sonstigen Arbeitslagen diff --git a/libs/s25main/figures/nofFarmhand.h b/libs/s25main/figures/nofFarmhand.h index a9e35590f0..6031aae46f 100644 --- a/libs/s25main/figures/nofFarmhand.h +++ b/libs/s25main/figures/nofFarmhand.h @@ -55,14 +55,14 @@ class nofFarmhand : public nofBuildingWorker nofFarmhand(Job job, MapPoint pos, unsigned char player, nobUsual* workplace); nofFarmhand(SerializedGameData& sgd, unsigned obj_id); - static unsigned GetWorkRadius(const GlobalGameSettings& ggs, Job job); - unsigned GetWorkRadius(Job job); + static unsigned getWorkRadius(const GlobalGameSettings& ggs, Job job); + unsigned getWorkRadius(Job job); void Serialize(SerializedGameData& sgd) const override; void HandleDerivedEvent(unsigned id) override; /// Return the quality of this working point (including if the worker can work here at all) /// isBeforeWork determines whether the evaluation happens before leaving for work or afterwards - virtual PointQuality GetPointQuality(MapPoint pt, bool isBeforeWork) const = 0; - PointQuality GetPointQuality(MapPoint pt) const { return GetPointQuality(pt, false); } + virtual PointQuality getPointQuality(MapPoint pt, bool isBeforeWork) const = 0; + PointQuality getPointQuality(MapPoint pt) const { return getPointQuality(pt, false); } }; diff --git a/libs/s25main/figures/nofFisher.cpp b/libs/s25main/figures/nofFisher.cpp index 528af59df9..d6e6f25aae 100644 --- a/libs/s25main/figures/nofFisher.cpp +++ b/libs/s25main/figures/nofFisher.cpp @@ -50,7 +50,7 @@ void nofFisher::DrawWorking(DrawPoint drawPt) if(id / 2 == 1) { - world->GetSoundMgr().playNOSound(62, *this, 0); + world->getSoundMgr().playNOSound(62, *this, 0); was_sounding = true; } } else if(id < 216) @@ -75,16 +75,16 @@ void nofFisher::DrawWorking(DrawPoint drawPt) if((id - 216) / 2 == 1) { - world->GetSoundMgr().playNOSound(62, *this, 1); + world->getSoundMgr().playNOSound(62, *this, 1); was_sounding = true; } } - LOADER.GetPlayerImage("rom_bobs", draw_id)->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", draw_id)->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); DrawShadow(drawPt, 0, Direction(fishing_dir)); } -unsigned short nofFisher::GetCarryID() const +unsigned short nofFisher::getCarryID() const { return 70; } @@ -95,7 +95,7 @@ void nofFisher::WorkStarted() unsigned fishAmount = 0; for(Direction dir : helpers::enumRange(RANDOM_ENUM(Direction))) { - const Resource neighbourRes = world->GetNode(world->GetNeighbour(pos, dir)).resources; + const Resource neighbourRes = world->getNode(world->getNeighbour(pos, dir)).resources; if(neighbourRes.has(ResourceType::Fish)) { fishing_dir = dir; @@ -108,8 +108,8 @@ void nofFisher::WorkStarted() const int probability = (fishAmount == 0) ? 0 : 40 + fishAmount * 10; successful = RANDOM_RAND(100) < probability; // On success remove the fish now to make it unavailable to others - if(successful && !world->GetGGS().isEnabled(AddonId::INEXHAUSTIBLE_FISH)) - world->ReduceResource(world->GetNeighbour(pos, fishing_dir)); + if(successful && !world->getGGS().isEnabled(AddonId::INEXHAUSTIBLE_FISH)) + world->ReduceResource(world->getNeighbour(pos, fishing_dir)); } void nofFisher::WorkFinished() @@ -121,16 +121,16 @@ void nofFisher::WorkFinished() } /// Returns the quality of this working point or determines if the worker can work here at all -nofFarmhand::PointQuality nofFisher::GetPointQuality(const MapPoint pt, bool /* isBeforeWork */) const +nofFarmhand::PointQuality nofFisher::getPointQuality(const MapPoint pt, bool /* isBeforeWork */) const { // Der Punkt muss passierbar sein für Figuren - if(!PathConditionHuman(*world).IsNodeOk(pt)) + if(!PathConditionHuman(*world).isNodeOk(pt)) return PointQuality::NotPossible; // irgendwo drumherum muss es Fisch geben - for(const MapPoint nb : world->GetNeighbours(pt)) + for(const MapPoint nb : world->getNeighbours(pt)) { - if(world->GetNode(nb).resources.has(ResourceType::Fish)) + if(world->getNode(nb).resources.has(ResourceType::Fish)) return PointQuality::Class1; } diff --git a/libs/s25main/figures/nofFisher.h b/libs/s25main/figures/nofFisher.h index 8b9712710a..be4a9fbe7b 100644 --- a/libs/s25main/figures/nofFisher.h +++ b/libs/s25main/figures/nofFisher.h @@ -19,7 +19,7 @@ class nofFisher : public nofFarmhand /// Malt den Arbeiter beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override; + unsigned short getCarryID() const override; /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) void WorkStarted() override; @@ -34,8 +34,8 @@ class nofFisher : public nofFarmhand void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofFisher; } + GO_Type getGOT() const final { return GO_Type::NofFisher; } /// Returns the quality of this working point or determines if the worker can work here at all - PointQuality GetPointQuality(MapPoint pt, bool isBeforeWork) const override; + PointQuality getPointQuality(MapPoint pt, bool isBeforeWork) const override; }; diff --git a/libs/s25main/figures/nofFlagWorker.cpp b/libs/s25main/figures/nofFlagWorker.cpp index 3f44b49d2f..d7a3f49706 100644 --- a/libs/s25main/figures/nofFlagWorker.cpp +++ b/libs/s25main/figures/nofFlagWorker.cpp @@ -17,10 +17,10 @@ nofFlagWorker::nofFlagWorker(const Job job, const MapPoint pos, const unsigned c // Lagerhaus abgerissen wurde oder ausgelagert wurde etc., dann auch den nicht als Flag-Worker registrieren if(goal) { - if(goal->GetGOT() == GO_Type::Flag) + if(goal->getGOT() == GO_Type::Flag) { this->flag = static_cast(goal); - world->GetPlayer(player).RegisterFlagWorker(this); + world->getPlayer(player).RegisterFlagWorker(this); } else this->flag = nullptr; } else @@ -42,7 +42,7 @@ void nofFlagWorker::Serialize(SerializedGameData& sgd) const void nofFlagWorker::Destroy() { RTTR_Assert(!flag); - RTTR_Assert(!world->GetPlayer(player).IsFlagWorker(this)); + RTTR_Assert(!world->getPlayer(player).isFlagWorker(this)); noFigure::Destroy(); } @@ -51,10 +51,10 @@ void nofFlagWorker::AbrogateWorkplace() if(flag) { /// uns entfernen, da wir wieder umdrehen müssen - world->GetPlayer(player).RemoveFlagWorker(this); + world->getPlayer(player).RemoveFlagWorker(this); flag = nullptr; } else - RTTR_Assert(!world->GetPlayer(player).IsFlagWorker(this)); + RTTR_Assert(!world->getPlayer(player).isFlagWorker(this)); } /// Geht wieder zurück zur Flagge und dann nach Hause @@ -63,10 +63,10 @@ void nofFlagWorker::GoToFlag() // Zur Flagge zurücklaufen // Bin ich an der Fahne? - if(pos == flag->GetPos()) + if(pos == flag->getPos()) { // nach Hause gehen - nobBaseWarehouse* wh = world->GetPlayer(player).FindWarehouse(*flag, FW::AcceptsFigure(job_), true, false); + nobBaseWarehouse* wh = world->getPlayer(player).FindWarehouse(*flag, FW::AcceptsFigure(job_), true, false); if(wh) { GoHome(wh); @@ -84,13 +84,13 @@ void nofFlagWorker::GoToFlag() // Da wir quasi "freiwillig" nach Hause gegangen sind ohne das Abreißen der Flagge, auch manuell wieder // "abmelden" - world->GetPlayer(player).RemoveFlagWorker(this); + world->getPlayer(player).RemoveFlagWorker(this); state = State::FigureWork; flag = nullptr; } else { // Weg suchen - const auto dir = world->FindHumanPath(pos, flag->GetPos(), 40); + const auto dir = world->FindHumanPath(pos, flag->getPos(), 40); // Wenns keinen gibt, rumirren, ansonsten hinlaufen if(dir) diff --git a/libs/s25main/figures/nofFlagWorker.h b/libs/s25main/figures/nofFlagWorker.h index f5fabd4b10..2acd824dbc 100644 --- a/libs/s25main/figures/nofFlagWorker.h +++ b/libs/s25main/figures/nofFlagWorker.h @@ -47,5 +47,5 @@ class nofFlagWorker : public noFigure virtual void LostWork() = 0; /// Gibt Flagge zurück - noFlag* GetFlag() const { return flag; } + noFlag* getFlag() const { return flag; } }; diff --git a/libs/s25main/figures/nofForester.cpp b/libs/s25main/figures/nofForester.cpp index 62ea5d4897..a58b696924 100644 --- a/libs/s25main/figures/nofForester.cpp +++ b/libs/s25main/figures/nofForester.cpp @@ -22,17 +22,17 @@ namespace { bool IsPotentialNewFieldForOwnFarm(GameWorld& world, const MapPoint pt, const unsigned char player) { - if(nofFarmer::GetNewFieldPointQuality(world, pt) == nofFarmhand::PointQuality::NotPossible) + if(nofFarmer::getNewFieldPointQuality(world, pt) == nofFarmhand::PointQuality::NotPossible) return false; return world.CheckPointsInRadius( - pt, nofFarmhand::GetWorkRadius(world.GetGGS(), Job::Farmer), + pt, nofFarmhand::getWorkRadius(world.getGGS(), Job::Farmer), [&world, player](const MapPoint farmPt, unsigned) { - if(world.GetNO(farmPt)->GetType() != NodalObjectType::Building) + if(world.getNO(farmPt)->getType() != NodalObjectType::Building) return false; - const auto* building = world.GetSpecObj(farmPt); - return building && building->GetPlayer() == player && building->GetBuildingType() == BuildingType::Farm; + const auto* building = world.getSpecObj(farmPt); + return building && building->getPlayer() == player && building->getBuildingType() == BuildingType::Farm; }, false); } @@ -49,23 +49,23 @@ void nofForester::DrawWorking(DrawPoint drawPt) { unsigned short now_id = GAMECLIENT.Interpolate(36, current_ev); // Baum pflanzen - LOADER.GetPlayerImage("rom_bobs", 48 + now_id)->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 48 + now_id)->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); // Schaufel-Sound if(now_id == 7 || now_id == 18) { - world->GetSoundMgr().playNOSound(76, *this, (now_id == 7) ? 0 : 1, 200); + world->getSoundMgr().playNOSound(76, *this, (now_id == 7) ? 0 : 1, 200); was_sounding = true; } // Baum-Einpflanz-Sound else if(now_id == 35) { - world->GetSoundMgr().playNOSound(57, *this, 2); + world->getSoundMgr().playNOSound(57, *this, 2); was_sounding = true; } } -unsigned short nofForester::GetCarryID() const +unsigned short nofForester::getCarryID() const { return 0; } @@ -79,11 +79,11 @@ void nofForester::WorkFinished() // Wenn irgendwo ne Straße schon ist, NICHT einsetzen! for(const auto dir : helpers::EnumRange{}) { - if(world->GetPointRoad(pos, dir) != PointRoad::None) + if(world->getPointRoad(pos, dir) != PointRoad::None) return; } - NodalObjectType noType = world->GetNO(pos)->GetType(); + NodalObjectType noType = world->getNO(pos)->getType(); // Wenn Objekt ein Zierobjekt ist, dann löschen, ansonsten den Baum NICHT einsetzen! if(noType == NodalObjectType::Environment || noType == NodalObjectType::Nothing) { @@ -95,50 +95,50 @@ void nofForester::WorkFinished() uint8_t landscapeType = std::min(world->GetLandscapeType().value, AVAILABLE_TREES.size() - 1); // jungen Baum einsetzen - world->SetNO(pos, new noTree(pos, RANDOM_ELEMENT(AVAILABLE_TREES[landscapeType]), 0)); + world->setNO(pos, new noTree(pos, RANDOM_ELEMENT(AVAILABLE_TREES[landscapeType]), 0)); // BQ drumherum neu berechnen world->RecalcBQAroundPoint(pos); // Minimap Bescheid geben (neuer Baum) - if(world->GetGameInterface()) - world->GetGameInterface()->GI_UpdateMinimap(pos); + if(world->getGameInterface()) + world->getGameInterface()->GI_UpdateMinimap(pos); } } /// Returns the quality of this working point or determines if the worker can work here at all -nofFarmhand::PointQuality nofForester::GetPointQuality(const MapPoint pt, bool /* isBeforeWork */) const +nofFarmhand::PointQuality nofForester::getPointQuality(const MapPoint pt, bool /* isBeforeWork */) const { // Der Platz muss frei sein - BlockingManner bm = world->GetNO(pt)->GetBM(); + BlockingManner bm = world->getNO(pt)->getBM(); if(bm != BlockingManner::None) return PointQuality::NotPossible; // Kein Grenzstein darf da stehen - if(world->GetNode(pt).boundary_stones[BorderStonePos::OnPoint]) + if(world->getNode(pt).boundary_stones[BorderStonePos::OnPoint]) return PointQuality::NotPossible; // darf außerdem nich auf einer Straße liegen for(const auto dir : helpers::EnumRange{}) { - if(world->GetPointRoad(pt, dir) != PointRoad::None) + if(world->getPointRoad(pt, dir) != PointRoad::None) return PointQuality::NotPossible; } // es dürfen außerdem keine Gebäude rund um den Baum stehen - for(const MapPoint nb : world->GetNeighbours(pt)) + for(const MapPoint nb : world->getNeighbours(pt)) { - if(world->GetNO(nb)->GetType() == NodalObjectType::Building) + if(world->getNO(nb)->getType() == NodalObjectType::Building) return PointQuality::NotPossible; } - if(world->GetGGS().isEnabled(AddonId::FORESTER_FARM_FIELD_AVOIDANCE) + if(world->getGGS().isEnabled(AddonId::FORESTER_FARM_FIELD_AVOIDANCE) && IsPotentialNewFieldForOwnFarm(*world, pt, player)) return PointQuality::NotPossible; // Terrain untersuchen - if(world->IsOfTerrain(pt, [](const auto& desc) { return desc.IsVital(); })) + if(world->isOfTerrain(pt, [](const auto& desc) { return desc.isVital(); })) return PointQuality::Class1; else return PointQuality::NotPossible; diff --git a/libs/s25main/figures/nofForester.h b/libs/s25main/figures/nofForester.h index 8ee13295fa..ddfea34801 100644 --- a/libs/s25main/figures/nofForester.h +++ b/libs/s25main/figures/nofForester.h @@ -14,7 +14,7 @@ class nofForester : public nofFarmhand /// Malt den Arbeiter beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override; + unsigned short getCarryID() const override; /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) void WorkStarted() override; @@ -22,11 +22,11 @@ class nofForester : public nofFarmhand void WorkFinished() override; /// Returns the quality of this working point or determines if the worker can work here at all - PointQuality GetPointQuality(MapPoint pt, bool isBeforeWork) const override; + PointQuality getPointQuality(MapPoint pt, bool isBeforeWork) const override; public: nofForester(MapPoint pos, unsigned char player, nobUsual* workplace); nofForester(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofForester; } + GO_Type getGOT() const final { return GO_Type::NofForester; } }; diff --git a/libs/s25main/figures/nofGeologist.cpp b/libs/s25main/figures/nofGeologist.cpp index 9ee97eddd9..9a5e55754b 100644 --- a/libs/s25main/figures/nofGeologist.cpp +++ b/libs/s25main/figures/nofGeologist.cpp @@ -57,7 +57,7 @@ nofGeologist::nofGeologist(SerializedGameData& sgd, const unsigned obj_id) node_goal = sgd.PopMapPoint(); - if(sgd.GetGameDataVersion() < 6) + if(sgd.getGameDataVersion() < 6) { for(const auto res : helpers::enumRange()) { @@ -89,8 +89,8 @@ void nofGeologist::Draw(DrawPoint drawPt) if(i < 6) { - LOADER.GetPlayerImage("rom_bobs", 324 + i) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 324 + i) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(i == 4) { sound = 1; @@ -98,8 +98,8 @@ void nofGeologist::Draw(DrawPoint drawPt) } } else if(i < 16) { - LOADER.GetPlayerImage("rom_bobs", 314 + i - 6) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 314 + i - 6) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(i == 14) { sound = 2; @@ -107,8 +107,8 @@ void nofGeologist::Draw(DrawPoint drawPt) } } else if(i < 28) { - LOADER.GetPlayerImage("rom_bobs", 324 + (i - 16) % 6) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 324 + (i - 16) % 6) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(i == 20) { sound = 1; @@ -120,8 +120,8 @@ void nofGeologist::Draw(DrawPoint drawPt) } } else if(i < 38) { - LOADER.GetPlayerImage("rom_bobs", 314 + i - 28) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 314 + i - 28) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(i == 36) { sound = 2; @@ -129,8 +129,8 @@ void nofGeologist::Draw(DrawPoint drawPt) } } else if(i < 50) { - LOADER.GetPlayerImage("rom_bobs", 324 + (i - 38) % 6) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 324 + (i - 38) % 6) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(i == 42) { sound = 1; @@ -142,8 +142,8 @@ void nofGeologist::Draw(DrawPoint drawPt) } } else if(i < 60) { - LOADER.GetPlayerImage("rom_bobs", 314 + i - 50) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 314 + i - 50) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(i == 58) { sound = 2; @@ -151,8 +151,8 @@ void nofGeologist::Draw(DrawPoint drawPt) } } else { - LOADER.GetPlayerImage("rom_bobs", 324 + (i - 60) % 6) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 324 + (i - 60) % 6) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(i == 64) { sound = 1; @@ -173,7 +173,7 @@ void nofGeologist::Draw(DrawPoint drawPt) } if(sound) - world->GetSoundMgr().playNOSound((sound == 1) ? 81 : 56, *this, sound_id); + world->getSoundMgr().playNOSound((sound == 1) ? 81 : 56, *this, sound_id); } break; case State::GeologistCheer: @@ -182,17 +182,17 @@ void nofGeologist::Draw(DrawPoint drawPt) if(i < 7) { - LOADER.GetPlayerImage("rom_bobs", 357 + i) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 357 + i) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } else { std::array ids = {1, 0, 1, 2, 1, 0, 1, 2, 1}; - LOADER.GetPlayerImage("rom_bobs", 361 + ids[i - 7]) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 361 + ids[i - 7]) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } if(i == 4) - world->GetSoundMgr().playNOSound(107, *this, 12); // yippy + world->getSoundMgr().playNOSound(107, *this, 12); // yippy } break; } @@ -222,10 +222,10 @@ void nofGeologist::Walked() { // Check if the flag still exists (not destroyed) and the goal node is still available (something could be build // there) - if(!flag || !IsNodeGood(node_goal)) + if(!flag || !isNodeGood(node_goal)) { // alten Punkt wieder freigeben - world->SetReserved(node_goal, false); + world->setReserved(node_goal, false); // wenn nicht, dann zu einem neuen Punkt gehen GoToNextNode(); return; @@ -235,7 +235,7 @@ void nofGeologist::Walked() if(pos == node_goal) { // anfangen zu graben - current_ev = GetEvMgr().AddEvent(this, 100, 1); + current_ev = getEvMgr().AddEvent(this, 100, 1); state = State::GeologistDig; } else { @@ -262,7 +262,7 @@ void nofGeologist::HandleDerivedEvent(const unsigned /*id*/) case State::GeologistDig: { // Check what is here - Resource foundRes = world->GetNode(pos).resources; + Resource foundRes = world->getNode(pos).resources; // We don't care for fish (and most likely never find it) if(foundRes.getType() == ResourceType::Fish) foundRes.setType(ResourceType::Nothing); @@ -271,13 +271,13 @@ void nofGeologist::HandleDerivedEvent(const unsigned /*id*/) { // Es wurde was gefunden, erstmal Jubeln state = State::GeologistCheer; - current_ev = GetEvMgr().AddEvent(this, 15, 1); + current_ev = getEvMgr().AddEvent(this, 15, 1); } else { // leeres Schild hinstecken und ohne Jubel weiterziehen - SetSign(foundRes); + setSign(foundRes); /// Punkt wieder freigeben - world->SetReserved(pos, false); + world->setReserved(pos, false); GoToNextNode(); } } @@ -285,11 +285,11 @@ void nofGeologist::HandleDerivedEvent(const unsigned /*id*/) case State::GeologistCheer: { // Schild reinstecken - SetSign(world->GetNode(pos).resources); + setSign(world->getNode(pos).resources); /// Punkt wieder freigeben - world->SetReserved(pos, false); + world->setReserved(pos, false); /// Sounds evtl löschen - world->GetSoundMgr().stopSounds(*this); + world->getSoundMgr().stopSounds(*this); // Und weiterlaufen GoToNextNode(); } @@ -297,24 +297,24 @@ void nofGeologist::HandleDerivedEvent(const unsigned /*id*/) } } -bool nofGeologist::IsNodeGood(const MapPoint pt) const +bool nofGeologist::isNodeGood(const MapPoint pt) const { // Es dürfen auch keine bestimmten Objekte darauf stehen und auch keine Schilder !! - const noBase& obj = *world->GetNO(pt); - return PathConditionHuman(*world).IsNodeOk(pt) && obj.GetGOT() != GO_Type::Sign - && obj.GetType() != NodalObjectType::Flag && obj.GetType() != NodalObjectType::Tree; + const noBase& obj = *world->getNO(pt); + return PathConditionHuman(*world).isNodeOk(pt) && obj.getGOT() != GO_Type::Sign + && obj.getType() != NodalObjectType::Flag && obj.getType() != NodalObjectType::Tree; } void nofGeologist::LookForNewNodes() { - const auto pts = world->GetPointsInRadius(flag->GetPos(), 15, ReturnMapPointWithRadius{}); + const auto pts = world->getPointsInRadius(flag->getPos(), 15, ReturnMapPointWithRadius{}); unsigned curMaxRadius = 15; bool found = false; for(const auto& it : pts) { if(it.second > curMaxRadius) break; - if(IsValidTargetNode(it.first)) + if(isValidTargetNode(it.first)) { available_nodes.push_back(it.first); if(!found) @@ -327,12 +327,12 @@ void nofGeologist::LookForNewNodes() } } -bool nofGeologist::IsValidTargetNode(const MapPoint pt) const +bool nofGeologist::isValidTargetNode(const MapPoint pt) const { - return (IsNodeGood(pt) && !world->GetNode(pt).reserved && (pos == pt || world->FindHumanPath(pos, pt, 20))); + return (isNodeGood(pt) && !world->getNode(pt).reserved && (pos == pt || world->FindHumanPath(pos, pt, 20))); } -helpers::OptionalEnum nofGeologist::GetNextNode() +helpers::OptionalEnum nofGeologist::getNextNode() { // Überhaupt noch Schilder zum Aufstellen if(!signs) @@ -352,7 +352,7 @@ helpers::OptionalEnum nofGeologist::GetNextNode() // und aus der Liste entfernen available_nodes.erase(available_nodes.begin() + randNode); // Gucken, ob er gut ist und ob man hingehen kann und ob er noch nicht reserviert wurde! - if(!IsNodeGood(node_goal) || world->GetNode(node_goal).reserved) + if(!isNodeGood(node_goal) || world->getNode(node_goal).reserved) continue; helpers::OptionalEnum ret_dir; @@ -363,7 +363,7 @@ helpers::OptionalEnum nofGeologist::GetNextNode() continue; } // Reservieren - world->SetReserved(node_goal, true); + world->setReserved(node_goal, true); return ret_dir; } @@ -387,7 +387,7 @@ void nofGeologist::GoToNextNode() } // ersten Punkt suchen - const auto dir = GetNextNode(); + const auto dir = getNextNode(); if(dir) { @@ -409,24 +409,24 @@ void nofGeologist::GoToNextNode() } } -void nofGeologist::SetSign(Resource resources) +void nofGeologist::setSign(Resource resources) { RTTR_Assert(resources.getType() != ResourceType::Fish); // Shall never happen // Bestimmte Objekte können gelöscht werden - NodalObjectType noType = world->GetNO(pos)->GetType(); + NodalObjectType noType = world->getNO(pos)->getType(); if(noType != NodalObjectType::Nothing && noType != NodalObjectType::Environment) return; world->DestroyNO(pos, false); // Schild setzen - world->SetNO(pos, new noSign(pos, resources)); + world->setNO(pos, new noSign(pos, resources)); // If nothing found, there is nothing left to do if(resources.getAmount() == 0u) return; - if(!resAlreadyFound[resources.getType()] && !IsSignInArea(resources.getType())) + if(!resAlreadyFound[resources.getType()] && !isSignInArea(resources.getType())) { const char* msg; switch(resources.getType()) @@ -439,15 +439,15 @@ void nofGeologist::SetSign(Resource resources) default: RTTR_Assert(false); return; } - if(resources.getType() != ResourceType::Water || world->GetGGS().getSelection(AddonId::EXHAUSTIBLE_WATER) != 1) + if(resources.getType() != ResourceType::Water || world->getGGS().getSelection(AddonId::EXHAUSTIBLE_WATER) != 1) { SendPostMessage(player, - std::make_unique(GetEvMgr().GetCurrentGF(), msg, PostCategory::Geologist, pos)); + std::make_unique(getEvMgr().getCurrentGF(), msg, PostCategory::Geologist, pos)); } - world->GetNotifications().publish(ResourceNote(player, pos, resources)); - if(world->HasLua()) - world->GetLua().EventResourceFound(this->player, pos, resources.getType(), resources.getAmount()); + world->getNotifications().publish(ResourceNote(player, pos, resources)); + if(world->hasLua()) + world->getLua().EventResourceFound(this->player, pos, resources.getType(), resources.getAmount()); } resAlreadyFound[resources.getType()] = true; } @@ -478,12 +478,12 @@ struct IsSignOfType bool operator()(const MapPoint& pt, unsigned /*distance*/) { - const auto* sign = gwb.GetSpecObj(pt); - return sign && sign->GetResource().getType() == type; + const auto* sign = gwb.getSpecObj(pt); + return sign && sign->getResource().getType() == type; } }; -bool nofGeologist::IsSignInArea(ResourceType type) const +bool nofGeologist::isSignInArea(ResourceType type) const { return world->CheckPointsInRadius(pos, 7, IsSignOfType(type, *world), false); } diff --git a/libs/s25main/figures/nofGeologist.h b/libs/s25main/figures/nofGeologist.h index 7ff4703009..9e0170f9ca 100644 --- a/libs/s25main/figures/nofGeologist.h +++ b/libs/s25main/figures/nofGeologist.h @@ -34,21 +34,21 @@ class nofGeologist : public nofFlagWorker void HandleDerivedEvent(unsigned id) override; /// Kann man an diesem Punkt ein Schild aufstellen? - bool IsNodeGood(MapPoint pt) const; + bool isNodeGood(MapPoint pt) const; /// Sucht im Umkreis von der Flagge neue Punkte wo man graben könnte void LookForNewNodes(); /// Checks if the node is valid as a new target - inline bool IsValidTargetNode(MapPoint pt) const; + inline bool isValidTargetNode(MapPoint pt) const; /// Searches for a new point to go to. Returns the direction to walk in if any point was found, else sets node_goal /// to invalid - helpers::OptionalEnum GetNextNode(); + helpers::OptionalEnum getNextNode(); /// Sucht sich einen neuen Punkt und geht dorthin oder geht wieder nach Hause wenn alle Schilder aufgestellt wurden /// oder es keinen Punkt mehr gibt void GoToNextNode(); /// Setzt das Schild, wenn noch was frei ist - void SetSign(Resource resources); + void setSign(Resource resources); - bool IsSignInArea(ResourceType type) const; + bool isSignInArea(ResourceType type) const; public: nofGeologist(MapPoint pos, unsigned char player, noRoadNode* goal); @@ -56,7 +56,7 @@ class nofGeologist : public nofFlagWorker void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofGeologist; } + GO_Type getGOT() const final { return GO_Type::NofGeologist; } void Draw(DrawPoint drawPt) override; diff --git a/libs/s25main/figures/nofHunter.cpp b/libs/s25main/figures/nofHunter.cpp index 2608b0074a..73b3656970 100644 --- a/libs/s25main/figures/nofHunter.cpp +++ b/libs/s25main/figures/nofHunter.cpp @@ -50,7 +50,7 @@ nofHunter::nofHunter(SerializedGameData& sgd, const unsigned obj_id) : nofBuildi shootingPos = sgd.PopMapPoint(); shooting_dir = sgd.Pop(); // https://github.com/Return-To-The-Roots/s25client/issues/1126 - if(sgd.GetGameDataVersion() < 4 && state == State::HunterFindingShootingpoint && pos == shootingPos) + if(sgd.getGameDataVersion() < 4 && state == State::HunterFindingShootingpoint && pos == shootingPos) state = State::HunterWaitingForAnimalReady; } else { @@ -62,7 +62,7 @@ nofHunter::nofHunter(SerializedGameData& sgd, const unsigned obj_id) : nofBuildi void nofHunter::DrawWorking(DrawPoint drawPt) { - const GamePlayer& owner = world->GetPlayer(player); + const GamePlayer& owner = world->getPlayer(player); switch(state) { default: break; @@ -75,22 +75,22 @@ void nofHunter::DrawWorking(DrawPoint drawPt) { // die Animation in dieser Richtung ist etwas anders als die in den restlichen unsigned short id = GAMECLIENT.Interpolate(13, current_ev); - LOADER.GetPlayerImage("rom_bobs", 219 + id)->drawForPlayer(drawPt, owner.color); + LOADER.getPlayerImage("rom_bobs", 219 + id)->drawForPlayer(drawPt, owner.color); if(id == 12) { - world->GetSoundMgr().playNOSound(74, *this, 0); + world->getSoundMgr().playNOSound(74, *this, 0); was_sounding = true; } } else { unsigned short id = GAMECLIENT.Interpolate(8, current_ev); - LOADER.GetPlayerImage("rom_bobs", 1686 + rttr::enum_cast(shooting_dir + 2u) * 8 + id) + LOADER.getPlayerImage("rom_bobs", 1686 + rttr::enum_cast(shooting_dir + 2u) * 8 + id) ->drawForPlayer(drawPt, owner.color); if(id == 7) { - world->GetSoundMgr().playNOSound(74, *this, 0); + world->getSoundMgr().playNOSound(74, *this, 0); was_sounding = true; } } @@ -110,7 +110,7 @@ void nofHunter::DrawWorking(DrawPoint drawPt) else draw_id = 244 + id - 36; - LOADER.GetPlayerImage("rom_bobs", draw_id)->drawForPlayer(drawPt, owner.color); + LOADER.getPlayerImage("rom_bobs", draw_id)->drawForPlayer(drawPt, owner.color); } break; } @@ -128,13 +128,13 @@ void nofHunter::HandleDerivedEvent(unsigned /*id*/) } } -std::vector nofHunter::GetAnimalsInRange(const GameWorldBase& world, const MapPoint pos, unsigned radius, +std::vector nofHunter::getAnimalsInRange(const GameWorldBase& world, const MapPoint pos, unsigned radius, unsigned maxDistance, bool (*isValidAnimal)(const noAnimal*)) { const auto pointToAnimal = [&world](const MapPoint pt, unsigned) -> noAnimal* { - for(auto& figure : world.GetFigures(pt)) + for(auto& figure : world.getFigures(pt)) { - if(figure.GetType() == NodalObjectType::Animal) + if(figure.getType() == NodalObjectType::Animal) return static_cast(&figure); } return nullptr; @@ -142,24 +142,24 @@ std::vector nofHunter::GetAnimalsInRange(const GameWorldBase& world, const auto canAnimalBeUsed = [pos, maxDistance, &world, isValidAnimal](const noAnimal* const animal) { return animal && isValidAnimal(animal) - && (pos == animal->GetPos() || world.FindHumanPath(pos, animal->GetPos(), maxDistance)); + && (pos == animal->getPos() || world.FindHumanPath(pos, animal->getPos(), maxDistance)); }; - return world.GetPointsInRadius(pos, radius, pointToAnimal, canAnimalBeUsed, true); + return world.getPointsInRadius(pos, radius, pointToAnimal, canAnimalBeUsed, true); } -std::vector nofHunter::GetHuntableAnimalsInRange(const GameWorldBase& world, MapPoint pos) +std::vector nofHunter::getHuntableAnimalsInRange(const GameWorldBase& world, MapPoint pos) { - return GetAnimalsInRange(world, pos, ANIMAL_RADIUS, MAX_HUNTING_DISTANCE, - [](const noAnimal* a) { return a->CanHunted(); }); + return getAnimalsInRange(world, pos, ANIMAL_RADIUS, MAX_HUNTING_DISTANCE, + [](const noAnimal* a) { return a->canHunted(); }); } void nofHunter::TryStartHunting() { std::vector available_animals; - if(world->GetReplayCompatVersion() >= 4) - available_animals = GetHuntableAnimalsInRange(*world, pos); + if(world->getReplayCompatVersion() >= 4) + available_animals = getHuntableAnimalsInRange(*world, pos); else { // Legacy square search for replays recorded with old code @@ -170,14 +170,14 @@ void nofHunter::TryStartHunting() for(curPos.x = pos.x - SQUARE_SIZE; curPos.x <= pos.x + SQUARE_SIZE; ++curPos.x) { MapPoint curMapPos = world->MakeMapPoint(curPos); - for(auto& figure : world->GetFigures(curMapPos)) + for(auto& figure : world->getFigures(curMapPos)) { - if(figure.GetType() != NodalObjectType::Animal) + if(figure.getType() != NodalObjectType::Animal) continue; auto& animal = static_cast(figure); - if(!animal.CanHunted()) + if(!animal.canHunted()) continue; - if(pos == animal.GetPos() || world->FindHumanPath(pos, animal.GetPos(), MAX_HUNTING_DISTANCE)) + if(pos == animal.getPos() || world->FindHumanPath(pos, animal.getPos(), MAX_HUNTING_DISTANCE)) { available_animals.push_back(&animal); } @@ -208,9 +208,9 @@ void nofHunter::TryStartHunting() } else { // Weiter warten, vielleicht gibts ja später wieder mal was - current_ev = GetEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); - world->GetNotifications().publish( - BuildingNote(BuildingNote::NoRessources, player, workplace->GetPos(), workplace->GetBuildingType())); + current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); + world->getNotifications().publish( + BuildingNote(BuildingNote::NoRessources, player, workplace->getPos(), workplace->getBuildingType())); workplace->StartNotWorking(); } @@ -229,16 +229,16 @@ void nofHunter::WalkedDerived() } } -bool nofHunter::IsShootingPointGood(const MapPoint pt) +bool nofHunter::isShootingPointGood(const MapPoint pt) { // Punkt muss betretbar sein und man muss ihn erreichen können - return PathConditionHuman(*world).IsNodeOk(pt) && world->FindHumanPath(this->pos, pt, 6).has_value(); + return PathConditionHuman(*world).isNodeOk(pt) && world->FindHumanPath(this->pos, pt, 6).has_value(); } void nofHunter::HandleStateChasing() { // Sind wir in der Nähe des Tieres? - if(world->CalcDistance(pos, animal->GetPos()) < 7) + if(world->CalcDistance(pos, animal->getPos()) < 7) { // Dann bitten wir es mal, schonmal anzuhalten und bekommen seine Koordinaten, wo es dann steht Position animalPos(animal->HunterIsNear()); @@ -303,7 +303,7 @@ void nofHunter::HandleStateChasing() } else { // Weg dorthin suchen - const auto dir = world->FindHumanPath(pos, animal->GetPos(), MAX_HUNTING_DISTANCE); + const auto dir = world->FindHumanPath(pos, animal->getPos(), MAX_HUNTING_DISTANCE); if(dir) { // Weg gefunden, dann hinlaufen @@ -342,13 +342,13 @@ void nofHunter::HandleStateFindingShootingPoint() void nofHunter::HandleStateWaitingForAnimalReady() { // Is the animal ready? - if(animal->IsReadyForShooting()) + if(animal->isReadyForShooting()) { // fire! state = State::HunterShooting; - current_ev = GetEvMgr().AddEvent(this, 16, 1); - } else if(animal->IsGettingReadyForShooting()) - current_ev = GetEvMgr().AddEvent(this, 15, 2); // Give the animal some time for getting ready + current_ev = getEvMgr().AddEvent(this, 16, 1); + } else if(animal->isGettingReadyForShooting()) + current_ev = getEvMgr().AddEvent(this, 15, 2); // Give the animal some time for getting ready else { // Something went wrong, animal is doing something else? @@ -368,15 +368,15 @@ void nofHunter::HandleStateShooting() void nofHunter::HandleStateWalkingToCadaver() { // Sind wir schon da? - if(animal->GetPos() == pos) + if(animal->getPos() == pos) { // dann ausnehmen state = State::HunterEviscerating; - current_ev = GetEvMgr().AddEvent(this, 80, 1); + current_ev = getEvMgr().AddEvent(this, 80, 1); } else { // Weg dorthin suchen - const auto dir = world->FindHumanPath(pos, animal->GetPos(), 6); + const auto dir = world->FindHumanPath(pos, animal->getPos(), 6); if(dir) { // Weg gefunden, dann hinlaufen @@ -394,13 +394,13 @@ void nofHunter::HandleStateEviscerating() // Evtl. Sounds löschen if(was_sounding) { - world->GetSoundMgr().stopSounds(*this); + world->getSoundMgr().stopSounds(*this); was_sounding = false; } // see comment at noAnimal::HandleEvent for explanation of ownership of animal animal->Eviscerated(); - if(!animal->IsGettingSkinned()) + if(!animal->isGettingSkinned()) { // Tier verschwinden lassen auto ownedAnimal = world->RemoveFigure(pos, *animal); @@ -420,14 +420,14 @@ void nofHunter::StartWalkingHome() WorkAborted(); state = State::WalkingHome; // We may be still walking in which case we delay finding a path home until we reached the next node - if(!IsMoving()) + if(!isMoving()) HandleStateWalkingHome(); } void nofHunter::HandleStateWalkingHome() { // Sind wir zu Hause angekommen? (genauer an der Flagge !!) - MapPoint homeFlagPos = world->GetNeighbour(workplace->GetPos(), Direction::SouthEast); + MapPoint homeFlagPos = world->getNeighbour(workplace->getPos(), Direction::SouthEast); if(pos == homeFlagPos) { // Weiteres übernimmt nofBuildingWorker @@ -465,7 +465,7 @@ void nofHunter::AnimalLost() case State::HunterEviscerating: case State::HunterWaitingForAnimalReady: // Arbeits-Event abmelden - GetEvMgr().RemoveEvent(current_ev); + getEvMgr().RemoveEvent(current_ev); // Nach Hause laufen StartWalkingHome(); break; diff --git a/libs/s25main/figures/nofHunter.h b/libs/s25main/figures/nofHunter.h index 11b6dd5e7e..1354e9d9cf 100644 --- a/libs/s25main/figures/nofHunter.h +++ b/libs/s25main/figures/nofHunter.h @@ -29,7 +29,7 @@ class nofHunter : public nofBuildingWorker /// Malt den Arbeiter beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override { return 89; } + unsigned short getCarryID() const override { return 89; } /// Trifft Vorbereitungen fürs nach Hause - Laufen void StartWalkingHome(); @@ -37,7 +37,7 @@ class nofHunter : public nofBuildingWorker void HandleStateWalkingHome(); /// Prüft, ob der Schießpunkt geeignet ist - bool IsShootingPointGood(MapPoint pt); + bool isShootingPointGood(MapPoint pt); /// Wenn jeweils gelaufen wurde oder ein Event abgelaufen ist, je nach aktuellem Status folgende Funktionen /// ausführen @@ -60,16 +60,16 @@ class nofHunter : public nofBuildingWorker void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofHunter; } + GO_Type getGOT() const final { return GO_Type::NofHunter; } void HandleDerivedEvent(unsigned id) override; void TryStartHunting(); /// Find animals in a radius around a position that satisfy a predicate and are reachable - static std::vector GetAnimalsInRange(const GameWorldBase& world, MapPoint pos, unsigned radius, + static std::vector getAnimalsInRange(const GameWorldBase& world, MapPoint pos, unsigned radius, unsigned maxDistance, bool (*isValidAnimal)(const noAnimal*)); - static std::vector GetHuntableAnimalsInRange(const GameWorldBase& world, MapPoint pos); + static std::vector getHuntableAnimalsInRange(const GameWorldBase& world, MapPoint pos); /// das Tier ist nicht mehr verfügbar (von selbst gestorben o.Ä.) void AnimalLost(); diff --git a/libs/s25main/figures/nofIronfounder.cpp b/libs/s25main/figures/nofIronfounder.cpp index 2116fb49cc..8023b052b6 100644 --- a/libs/s25main/figures/nofIronfounder.cpp +++ b/libs/s25main/figures/nofIronfounder.cpp @@ -26,14 +26,14 @@ void nofIronfounder::DrawWorking(DrawPoint drawPt) if(now_id < 182) { - LOADER.GetPlayerImage("rom_bobs", 100 + (now_id % 8)) - ->DrawFull(drawPt + offsets[workplace->GetNation()], COLOR_WHITE, - world->GetPlayer(workplace->GetPlayer()).color); + LOADER.getPlayerImage("rom_bobs", 100 + (now_id % 8)) + ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, + world->getPlayer(workplace->getPlayer()).color); // Evtl Sound abspielen if(now_id % 16 == 3) { - world->GetSoundMgr().playNOSound(58, *this, now_id / 16); + world->getSoundMgr().playNOSound(58, *this, now_id / 16); was_sounding = true; } } diff --git a/libs/s25main/figures/nofIronfounder.h b/libs/s25main/figures/nofIronfounder.h index e020a550cb..7555812cd9 100644 --- a/libs/s25main/figures/nofIronfounder.h +++ b/libs/s25main/figures/nofIronfounder.h @@ -15,7 +15,7 @@ class nofIronfounder : public nofWorkman /// Zeichnet ihn beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override { return 69; } + unsigned short getCarryID() const override { return 69; } /// Der Arbeiter erzeugt eine Ware helpers::OptionalEnum ProduceWare() override; @@ -23,5 +23,5 @@ class nofIronfounder : public nofWorkman nofIronfounder(MapPoint pos, unsigned char player, nobUsual* workplace); nofIronfounder(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofIronfounder; } + GO_Type getGOT() const final { return GO_Type::NofIronfounder; } }; diff --git a/libs/s25main/figures/nofLeatherWorker.cpp b/libs/s25main/figures/nofLeatherWorker.cpp index 18548b610d..bc7bb9bf1e 100644 --- a/libs/s25main/figures/nofLeatherWorker.cpp +++ b/libs/s25main/figures/nofLeatherWorker.cpp @@ -26,21 +26,21 @@ void nofLeatherWorker::DrawWorking(DrawPoint drawPt) const unsigned now_id = GAMECLIENT.Interpolate(230, current_ev); - LOADER.GetPlayerImage("leather_bobs", bobIndex[BobType::LeatherworksWorkWindowAnimation] + (now_id % 23)) - ->DrawFull(drawPt + offsets[workplace->GetNation()], COLOR_WHITE, world->GetPlayer(workplace->GetPlayer()).color); + LOADER.getPlayerImage("leather_bobs", bobIndex[BobType::LeatherworksWorkWindowAnimation] + (now_id % 23)) + ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); // hammer sound if(now_id % 23 == 3 || now_id % 23 == 7) { - world->GetSoundMgr().playNOSound(72, *this, now_id, 100); + world->getSoundMgr().playNOSound(72, *this, now_id, 100); was_sounding = true; } else if(now_id % 23 == 9) // saw sound 1 { - world->GetSoundMgr().playNOSound(54, *this, now_id); + world->getSoundMgr().playNOSound(54, *this, now_id); was_sounding = true; } else if(now_id % 23 == 17) // saw sound 2 { - world->GetSoundMgr().playNOSound(55, *this, now_id); + world->getSoundMgr().playNOSound(55, *this, now_id); was_sounding = true; } @@ -52,7 +52,7 @@ void nofLeatherWorker::DrawWorking(DrawPoint drawPt) # pragma warning(disable : 4646) // function declared with [[noreturn]] has non-void return type #endif -unsigned short nofLeatherWorker::GetCarryID() const +unsigned short nofLeatherWorker::getCarryID() const { throw std::logic_error("Must not be called. Handled by custom DrawWalkingWithWare"); } diff --git a/libs/s25main/figures/nofLeatherWorker.h b/libs/s25main/figures/nofLeatherWorker.h index c7d16b2d71..a0be3d528c 100644 --- a/libs/s25main/figures/nofLeatherWorker.h +++ b/libs/s25main/figures/nofLeatherWorker.h @@ -14,7 +14,7 @@ class nofLeatherWorker : public nofWorkman /// Draw worker at work void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - [[noreturn]] unsigned short GetCarryID() const override; + [[noreturn]] unsigned short getCarryID() const override; helpers::OptionalEnum ProduceWare() override; /// Draws the figure while returning home / entering the building (often carrying wares) @@ -24,5 +24,5 @@ class nofLeatherWorker : public nofWorkman nofLeatherWorker(MapPoint pos, unsigned char player, nobUsual* workplace); nofLeatherWorker(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofLeatherWorker; } + GO_Type getGOT() const final { return GO_Type::NofLeatherWorker; } }; diff --git a/libs/s25main/figures/nofMetalworker.cpp b/libs/s25main/figures/nofMetalworker.cpp index b680f5e691..6413071353 100644 --- a/libs/s25main/figures/nofMetalworker.cpp +++ b/libs/s25main/figures/nofMetalworker.cpp @@ -25,7 +25,7 @@ nofMetalworker::nofMetalworker(const MapPoint pos, const unsigned char player, nobUsual* workplace) : nofWorkman(Job::Metalworker, pos, player, workplace) { - toolOrderSub = world->GetNotifications().subscribe([this](const ToolNote& note) { + toolOrderSub = world->getNotifications().subscribe([this](const ToolNote& note) { if((note.type == ToolNote::OrderPlaced || note.type == ToolNote::SettingsChanged) && note.player == this->player) CheckForOrders(); @@ -34,7 +34,7 @@ nofMetalworker::nofMetalworker(const MapPoint pos, const unsigned char player, n nofMetalworker::nofMetalworker(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id) { - if(sgd.GetGameDataVersion() < 5) + if(sgd.getGameDataVersion() < 5) { const auto iWare = sgd.PopUnsignedChar(); // GoodType::Nothing is moved because of adding new wares due addons @@ -52,9 +52,9 @@ nofMetalworker::nofMetalworker(SerializedGameData& sgd, const unsigned obj_id) : "report this!"); RTTR_Assert(false); state = State::WaitingForWaresOrProductionStopped; - current_ev = GetEvMgr().AddEvent(this, 1000, 2); + current_ev = getEvMgr().AddEvent(this, 1000, 2); } - toolOrderSub = world->GetNotifications().subscribe([this](const ToolNote& note) { + toolOrderSub = world->getNotifications().subscribe([this](const ToolNote& note) { if((note.type == ToolNote::OrderPlaced || note.type == ToolNote::SettingsChanged) && note.player == this->player) CheckForOrders(); @@ -73,23 +73,23 @@ void nofMetalworker::DrawWorking(DrawPoint drawPt) const unsigned now_id = GAMECLIENT.Interpolate(230, current_ev); - LOADER.GetPlayerImage("rom_bobs", 190 + (now_id % 23)) - ->DrawFull(drawPt + offsets[workplace->GetNation()], COLOR_WHITE, world->GetPlayer(workplace->GetPlayer()).color); + LOADER.getPlayerImage("rom_bobs", 190 + (now_id % 23)) + ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); // Hämmer-Sound if(now_id % 23 == 3 || now_id % 23 == 7) { - world->GetSoundMgr().playNOSound(72, *this, now_id, 100); + world->getSoundMgr().playNOSound(72, *this, now_id, 100); was_sounding = true; } // Säge-Sound 1 else if(now_id % 23 == 9) { - world->GetSoundMgr().playNOSound(54, *this, now_id); + world->getSoundMgr().playNOSound(54, *this, now_id); was_sounding = true; } else if(now_id % 23 == 17) { - world->GetSoundMgr().playNOSound(55, *this, now_id); + world->getSoundMgr().playNOSound(55, *this, now_id); was_sounding = true; } @@ -99,18 +99,18 @@ void nofMetalworker::DrawWorking(DrawPoint drawPt) // Mapping of indices in TOOLS to IDs in JOBS.BOB constexpr helpers::EnumArray CARRYTOOLS_IDS = {78, 79, 80, 91, 81, 82, 83, 84, 85, 87, 88, 86}; -unsigned short nofMetalworker::GetCarryID() const +unsigned short nofMetalworker::getCarryID() const { const auto toolIdx = helpers::indexOf(TOOL_TO_GOOD, ware); return (toolIdx >= 0) ? CARRYTOOLS_IDS[static_cast(toolIdx)] : 0; } -bool nofMetalworker::HasToolOrder() const +bool nofMetalworker::hasToolOrder() const { - const GamePlayer& owner = world->GetPlayer(player); + const GamePlayer& owner = world->getPlayer(player); for(const auto tool : helpers::enumRange()) { - if(owner.GetToolsOrdered(tool) > 0u) + if(owner.getToolsOrdered(tool) > 0u) return true; } return false; @@ -121,16 +121,16 @@ bool nofMetalworker::AreWaresAvailable() const if(!nofWorkman::AreWaresAvailable()) return false; // If produce nothing on zero is disabled we will always produce something ->OK - if(world->GetGGS().getSelection(AddonId::METALWORKSBEHAVIORONZERO) == 0) + if(world->getGGS().getSelection(AddonId::METALWORKSBEHAVIORONZERO) == 0) return true; // Any tool order? - if(HasToolOrder()) + if(hasToolOrder()) return true; // Any non-zero priority? - const GamePlayer& owner = world->GetPlayer(player); + const GamePlayer& owner = world->getPlayer(player); for(const auto tool : helpers::enumRange()) { - if(owner.GetToolPriority(tool) > 0u) + if(owner.getToolPriority(tool) > 0u) return true; } return false; @@ -138,9 +138,9 @@ bool nofMetalworker::AreWaresAvailable() const bool nofMetalworker::StartWorking() { - nextProducedTool = GetOrderedTool(); + nextProducedTool = getOrderedTool(); if(!nextProducedTool) - nextProducedTool = GetRandomTool(); + nextProducedTool = getRandomTool(); return nextProducedTool && nofWorkman::StartWorking(); } @@ -152,15 +152,15 @@ void nofMetalworker::CheckForOrders() TryToWork(); } -helpers::OptionalEnum nofMetalworker::GetOrderedTool() +helpers::OptionalEnum nofMetalworker::getOrderedTool() { - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); std::vector random_array; for(const auto tool : helpers::enumRange()) { - if(owner.GetToolsOrdered(tool) == 0) + if(owner.getToolsOrdered(tool) == 0) continue; - unsigned toolPriority = std::max(owner.GetToolPriority(tool), 1u); + unsigned toolPriority = std::max(owner.getToolPriority(tool), 1u); random_array.insert(random_array.end(), toolPriority, tool); } if(random_array.empty()) @@ -170,19 +170,19 @@ helpers::OptionalEnum nofMetalworker::GetOrderedTool() owner.ToolOrderProcessed(tool); - if(!HasToolOrder()) + if(!hasToolOrder()) { SendPostMessage(player, - std::make_unique(GetEvMgr().GetCurrentGF(), + std::make_unique(getEvMgr().getCurrentGF(), _("Completed the ordered amount of tools."), PostCategory::Economy)); } return TOOL_TO_GOOD[tool]; } -helpers::OptionalEnum nofMetalworker::GetRandomTool() +helpers::OptionalEnum nofMetalworker::getRandomTool() { - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); // Fill array where the # of occurrences of a tool is its priority // Drawing a random entry will make higher priority items more likely @@ -190,14 +190,14 @@ helpers::OptionalEnum nofMetalworker::GetRandomTool() random_array.reserve(helpers::NumEnumValues_v); for(const auto tool : helpers::enumRange()) { - random_array.insert(random_array.end(), owner.GetToolPriority(tool), tool); + random_array.insert(random_array.end(), owner.getToolPriority(tool), tool); } // if they're all zero if(random_array.empty()) { // do nothing if addon is enabled, otherwise produce random ware (orig S2 behavior) - if(world->GetGGS().getSelection(AddonId::METALWORKSBEHAVIORONZERO) == 1) + if(world->getGGS().getSelection(AddonId::METALWORKSBEHAVIORONZERO) == 1) return std::nullopt; else return RANDOM_ELEMENT(TOOL_TO_GOOD); diff --git a/libs/s25main/figures/nofMetalworker.h b/libs/s25main/figures/nofMetalworker.h index 27e93274d0..de974b533b 100644 --- a/libs/s25main/figures/nofMetalworker.h +++ b/libs/s25main/figures/nofMetalworker.h @@ -20,15 +20,15 @@ class nofMetalworker : public nofWorkman /// Zeichnet ihn beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override; + unsigned short getCarryID() const override; /// Der Arbeiter erzeugt eine Ware helpers::OptionalEnum ProduceWare() override; /// Returns the next tool to be produced according to the orders - helpers::OptionalEnum GetOrderedTool(); + helpers::OptionalEnum getOrderedTool(); /// Returns a random tool according to the priorities - helpers::OptionalEnum GetRandomTool(); + helpers::OptionalEnum getRandomTool(); - bool HasToolOrder() const; + bool hasToolOrder() const; bool AreWaresAvailable() const override; bool StartWorking() override; @@ -39,5 +39,5 @@ class nofMetalworker : public nofWorkman nofMetalworker(SerializedGameData& sgd, unsigned obj_id); void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofMetalworker; } + GO_Type getGOT() const final { return GO_Type::NofMetalworker; } }; diff --git a/libs/s25main/figures/nofMiller.cpp b/libs/s25main/figures/nofMiller.cpp index 851b6da19e..5691fcd265 100644 --- a/libs/s25main/figures/nofMiller.cpp +++ b/libs/s25main/figures/nofMiller.cpp @@ -32,70 +32,70 @@ void nofMiller::DrawWorking(DrawPoint drawPt) unsigned max_id = 120; unsigned now_id = GAMECLIENT.Interpolate(max_id, current_ev); bool rotate_sails = true; - const Nation nation = workplace->GetNation(); + const Nation nation = workplace->getNation(); if(now_id < 4) // hinauslaufen teil 1 { LOADER.building_cache[nation][BuildingType::Mill].door.DrawFull(drawPt); LOADER.getBobSprite(nation, Job::Miller, Direction::SouthEast, now_id % 8) - .draw(drawPt + walkoffsets[now_id], COLOR_WHITE, world->GetPlayer(player).color); + .draw(drawPt + walkoffsets[now_id], COLOR_WHITE, world->getPlayer(player).color); rotate_sails = false; } if((now_id >= 4) && (now_id < 8)) // hinauslaufen teil 2 { LOADER.getBobSprite(nation, Job::Miller, Direction::East, now_id % 8) - .draw(drawPt + walkoffsets[now_id], COLOR_WHITE, world->GetPlayer(player).color); + .draw(drawPt + walkoffsets[now_id], COLOR_WHITE, world->getPlayer(player).color); } if((now_id >= 8) && (now_id < 16)) // hinsetzen { - LOADER.GetPlayerImage("rom_bobs", 166 + (now_id % 8)) - ->DrawFull(drawPt + offsets_sitdown[nation], COLOR_WHITE, world->GetPlayer(workplace->GetPlayer()).color); + LOADER.getPlayerImage("rom_bobs", 166 + (now_id % 8)) + ->DrawFull(drawPt + offsets_sitdown[nation], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); } if((now_id >= 16) && (now_id < max_id - 16)) // schlafen { - LOADER.GetPlayerImage("rom_bobs", 174 + (now_id % 8)) - ->DrawFull(drawPt + offsets[nation], COLOR_WHITE, world->GetPlayer(workplace->GetPlayer()).color); + LOADER.getPlayerImage("rom_bobs", 174 + (now_id % 8)) + ->DrawFull(drawPt + offsets[nation], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); } if((now_id >= max_id - 16) && (now_id < max_id - 8)) // aufstehn { - LOADER.GetPlayerImage("rom_bobs", 166 + 7 - (now_id % 8)) - ->DrawFull(drawPt + offsets_sitdown[nation], COLOR_WHITE, world->GetPlayer(workplace->GetPlayer()).color); + LOADER.getPlayerImage("rom_bobs", 166 + 7 - (now_id % 8)) + ->DrawFull(drawPt + offsets_sitdown[nation], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); } if((now_id >= max_id - 8) && (now_id < max_id - 4)) // zurücklaufen teil 1 { LOADER.getBobSprite(nation, Job::Miller, Direction::West, now_id % 8) - .draw(drawPt + walkoffsets[7 - (now_id % 8)], COLOR_WHITE, world->GetPlayer(player).color); + .draw(drawPt + walkoffsets[7 - (now_id % 8)], COLOR_WHITE, world->getPlayer(player).color); } if((now_id >= max_id - 4) && (now_id < max_id)) // zurücklaufen teil 2 { LOADER.building_cache[nation][BuildingType::Mill].door.DrawFull(drawPt); LOADER.getBobSprite(nation, Job::Miller, Direction::NorthWest, now_id % 8) - .draw(drawPt + walkoffsets[7 - (now_id % 8)], COLOR_WHITE, world->GetPlayer(player).color); + .draw(drawPt + walkoffsets[7 - (now_id % 8)], COLOR_WHITE, world->getPlayer(player).color); rotate_sails = false; } if(rotate_sails) { // Flügel der Mühle - LOADER.GetNationImage(nation, 250 + 5 * (42 + ((now_id + 4) % 8)))->DrawFull(drawPt); + LOADER.getNationImage(nation, 250 + 5 * (42 + ((now_id + 4) % 8)))->DrawFull(drawPt); // Schatten der Flügel - LOADER.GetNationImage(nation, 250 + (5 * (42 + ((now_id + 4) % 8))) + 1)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getNationImage(nation, 250 + (5 * (42 + ((now_id + 4) % 8))) + 1)->DrawFull(drawPt, COLOR_SHADOW); // Mühlensound abspielen in zufälligen Intervallen - if(VIDEODRIVER.GetTickCount() - last_sound > next_interval) + if(VIDEODRIVER.getTickCount() - last_sound > next_interval) { - world->GetSoundMgr().playNOSound(77, *this, now_id); + world->getSoundMgr().playNOSound(77, *this, now_id); was_sounding = true; - last_sound = VIDEODRIVER.GetTickCount(); + last_sound = VIDEODRIVER.getTickCount(); next_interval = 500 + rand() % 1400; } } else { // Flügel der Mühle - LOADER.GetNationImage(nation, 250 + 5 * 49)->DrawFull(drawPt); + LOADER.getNationImage(nation, 250 + 5 * 49)->DrawFull(drawPt); // Schatten der Flügel - LOADER.GetNationImage(nation, 250 + 5 * 49 + 1)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getNationImage(nation, 250 + 5 * 49 + 1)->DrawFull(drawPt, COLOR_SHADOW); } } diff --git a/libs/s25main/figures/nofMiller.h b/libs/s25main/figures/nofMiller.h index 522b3f340d..b9cc303498 100644 --- a/libs/s25main/figures/nofMiller.h +++ b/libs/s25main/figures/nofMiller.h @@ -21,7 +21,7 @@ class nofMiller : public nofWorkman /// Zeichnet ihn beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override { return 75; } + unsigned short getCarryID() const override { return 75; } /// Der Arbeiter erzeugt eine Ware helpers::OptionalEnum ProduceWare() override; @@ -29,5 +29,5 @@ class nofMiller : public nofWorkman nofMiller(MapPoint pos, unsigned char player, nobUsual* workplace); nofMiller(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofMiller; } + GO_Type getGOT() const final { return GO_Type::NofMiller; } }; diff --git a/libs/s25main/figures/nofMiner.cpp b/libs/s25main/figures/nofMiner.cpp index 2429750f48..d2f8a360b4 100644 --- a/libs/s25main/figures/nofMiner.cpp +++ b/libs/s25main/figures/nofMiner.cpp @@ -79,14 +79,14 @@ helpers::OptionalEnum GetNoOutputFallbackGood(const GlobalGameSettings std::vector GetPointsWithResource(const GameWorld& world, const MapPoint pos, const ResourceType type) { return world.GetMatchingPointsInRadius( - pos, MINER_RADIUS, [&world, type](const MapPoint pt) { return world.GetNode(pt).resources.has(type); }, true); + pos, MINER_RADIUS, [&world, type](const MapPoint pt) { return world.getNode(pt).resources.has(type); }, true); } void ReduceS4LikeResource(GameWorld& world, const std::vector& resourcePts) { for(const MapPoint pt : resourcePts) { - if(world.GetNode(pt).resources.getAmount() > S4LIKE_MIN_RESOURCE_AMOUNT) + if(world.getNode(pt).resources.getAmount() > S4LIKE_MIN_RESOURCE_AMOUNT) { world.ReduceResource(pt); return; @@ -112,27 +112,27 @@ void nofMiner::DrawWorking(DrawPoint drawPt) {{{10, 3}, {10, 3}, {10, 3}, {10, 3}}}, // vikings {{{8, 3}, {8, 3}, {8, 3}, {8, 3}}} // babylonians }}; - const unsigned mineIdx = rttr::enum_cast(workplace->GetBuildingType()) - rttr::enum_cast(BuildingType::GraniteMine); + const unsigned mineIdx = rttr::enum_cast(workplace->getBuildingType()) - rttr::enum_cast(BuildingType::GraniteMine); RTTR_Assert(mineIdx < offsets.size()); unsigned now_id = GAMECLIENT.Interpolate(160, current_ev); unsigned texture; - if(workplace->GetNation() == Nation::Romans) + if(workplace->getNation() == Nation::Romans) texture = 92 + now_id % 8; else texture = 1799 + now_id % 4; - LOADER.GetPlayerImage("rom_bobs", texture)->DrawFull(drawPt + offsets[workplace->GetNation()][mineIdx]); + LOADER.getPlayerImage("rom_bobs", texture)->DrawFull(drawPt + offsets[workplace->getNation()][mineIdx]); if(now_id % 8 == 3) { - world->GetSoundMgr().playNOSound(59, *this, now_id); + world->getSoundMgr().playNOSound(59, *this, now_id); was_sounding = true; } } -unsigned short nofMiner::GetCarryID() const +unsigned short nofMiner::getCarryID() const { - switch(workplace->GetBuildingType()) + switch(workplace->getBuildingType()) { case BuildingType::GoldMine: return 65; case BuildingType::IronMine: return 66; @@ -143,24 +143,24 @@ unsigned short nofMiner::GetCarryID() const helpers::OptionalEnum nofMiner::ProduceWare() { - const GlobalGameSettings& settings = world->GetGGS(); - const MineResourceBehavior behavior = GetMineResourceBehavior(settings, workplace->GetBuildingType()); + const GlobalGameSettings& settings = world->getGGS(); + const MineResourceBehavior behavior = getMineResourceBehavior(settings, workplace->getBuildingType()); if(behavior == MineResourceBehavior::S4LikeExhaustion) { - const std::vector resourcePts = GetPointsWithResource(*world, pos, GetRequiredResType()); + const std::vector resourcePts = GetPointsWithResource(*world, pos, getRequiredResType()); const auto productionRoll = static_cast(RANDOM_RAND(MAX_PRODUCTION_PERCENT)); const bool produceNothingThisCycle = resourcePts.empty() - || productionRoll >= GetS4LikeMineProductionChance( - GetRemainingMineResources(*world, pos, GetRequiredResType())); + || productionRoll >= getS4LikeMineProductionChance( + getRemainingMineResources(*world, pos, getRequiredResType())); if(produceNothingThisCycle) - return GetNoOutputFallbackGood(settings, workplace->GetBuildingType(), GetObjId()); + return GetNoOutputFallbackGood(settings, workplace->getBuildingType(), getObjId()); // S4-like exhaustion always depletes, but only down to the minimum amount ReduceS4LikeResource(*world, resourcePts); } - return GetMineOutput(workplace->GetBuildingType()); + return getMineOutput(workplace->getBuildingType()); } bool nofMiner::AreWaresAvailable() const @@ -168,11 +168,11 @@ bool nofMiner::AreWaresAvailable() const if(!nofWorkman::AreWaresAvailable()) return false; - const MineResourceBehavior behavior = GetMineResourceBehavior(world->GetGGS(), workplace->GetBuildingType()); + const MineResourceBehavior behavior = getMineResourceBehavior(world->getGGS(), workplace->getBuildingType()); if(behavior == MineResourceBehavior::WorkEverywhere) return true; - const bool hasResources = FindPointWithResource(GetRequiredResType()).isValid(); + const bool hasResources = FindPointWithResource(getRequiredResType()).isValid(); if(!hasResources) workplace->OnOutOfResources(); return hasResources; @@ -180,12 +180,12 @@ bool nofMiner::AreWaresAvailable() const bool nofMiner::StartWorking() { - const GlobalGameSettings& settings = world->GetGGS(); - const MineResourceBehavior behavior = GetMineResourceBehavior(settings, workplace->GetBuildingType()); + const GlobalGameSettings& settings = world->getGGS(); + const MineResourceBehavior behavior = getMineResourceBehavior(settings, workplace->getBuildingType()); if(behavior == MineResourceBehavior::WorkEverywhere) return nofWorkman::StartWorking(); - const MapPoint resPt = FindPointWithResource(GetRequiredResType()); + const MapPoint resPt = FindPointWithResource(getRequiredResType()); if(!resPt.isValid()) { workplace->OnOutOfResources(); @@ -193,13 +193,13 @@ bool nofMiner::StartWorking() } if(behavior != MineResourceBehavior::S4LikeExhaustion - && IsMineResourceDepletable(settings, workplace->GetBuildingType())) + && isMineResourceDepletable(settings, workplace->getBuildingType())) world->ReduceResource(resPt); return nofWorkman::StartWorking(); } -ResourceType nofMiner::GetRequiredResType() const +ResourceType nofMiner::getRequiredResType() const { - return GetMineResourceType(workplace->GetBuildingType()); + return getMineResourceType(workplace->getBuildingType()); } diff --git a/libs/s25main/figures/nofMiner.h b/libs/s25main/figures/nofMiner.h index c3fdc810ad..37af2b6af8 100644 --- a/libs/s25main/figures/nofMiner.h +++ b/libs/s25main/figures/nofMiner.h @@ -16,17 +16,17 @@ class nofMiner : public nofWorkman /// Zeichnet ihn beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override; + unsigned short getCarryID() const override; /// Der Arbeiter erzeugt eine Ware helpers::OptionalEnum ProduceWare() override; bool AreWaresAvailable() const override; bool StartWorking() override; - ResourceType GetRequiredResType() const; + ResourceType getRequiredResType() const; public: nofMiner(MapPoint pos, unsigned char player, nobUsual* workplace); nofMiner(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofMiner; } + GO_Type getGOT() const final { return GO_Type::NofMiner; } }; diff --git a/libs/s25main/figures/nofMinter.cpp b/libs/s25main/figures/nofMinter.cpp index d23e075c28..8e1670f344 100644 --- a/libs/s25main/figures/nofMinter.cpp +++ b/libs/s25main/figures/nofMinter.cpp @@ -25,14 +25,14 @@ void nofMinter::DrawWorking(DrawPoint drawPt) if(now_id < 91) { - LOADER.GetPlayerImage("rom_bobs", 84 + (now_id) % 8) - ->DrawFull(drawPt + offsets[workplace->GetNation()], COLOR_WHITE, - world->GetPlayer(workplace->GetPlayer()).color); + LOADER.getPlayerImage("rom_bobs", 84 + (now_id) % 8) + ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, + world->getPlayer(workplace->getPlayer()).color); // Evtl Sound abspielen if(now_id % 8 == 3) { - world->GetSoundMgr().playNOSound(58, *this, now_id); + world->getSoundMgr().playNOSound(58, *this, now_id); was_sounding = true; } } @@ -42,6 +42,6 @@ void nofMinter::DrawWorking(DrawPoint drawPt) helpers::OptionalEnum nofMinter::ProduceWare() { - world->GetPlayer(player).ChangeStatisticValue(StatisticType::Gold, 1); + world->getPlayer(player).ChangeStatisticValue(StatisticType::Gold, 1); return GoodType::Coins; } diff --git a/libs/s25main/figures/nofMinter.h b/libs/s25main/figures/nofMinter.h index 55a2029194..e3712bdf01 100644 --- a/libs/s25main/figures/nofMinter.h +++ b/libs/s25main/figures/nofMinter.h @@ -14,7 +14,7 @@ class nofMinter : public nofWorkman /// Zeichnet ihn beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override { return 64; } + unsigned short getCarryID() const override { return 64; } /// Der Arbeiter erzeugt eine Ware helpers::OptionalEnum ProduceWare() override; @@ -22,5 +22,5 @@ class nofMinter : public nofWorkman nofMinter(MapPoint pos, unsigned char player, nobUsual* workplace); nofMinter(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofMinter; } + GO_Type getGOT() const final { return GO_Type::NofMinter; } }; diff --git a/libs/s25main/figures/nofPassiveSoldier.cpp b/libs/s25main/figures/nofPassiveSoldier.cpp index fff9cb9d4d..86fae1a852 100644 --- a/libs/s25main/figures/nofPassiveSoldier.cpp +++ b/libs/s25main/figures/nofPassiveSoldier.cpp @@ -30,7 +30,7 @@ nofPassiveSoldier::~nofPassiveSoldier() = default; void nofPassiveSoldier::Destroy() { - GetEvMgr().RemoveEvent(healing_event); + getEvMgr().RemoveEvent(healing_event); nofSoldier::Destroy(); } @@ -64,14 +64,14 @@ void nofPassiveSoldier::HandleDerivedEvent(const unsigned id) if(fs == FigureState::Job) { // Dann uns heilen, wenn wir nicht schon gesund sind - if(hitpoints < HITPOINTS[GetRank()]) + if(hitpoints < HITPOINTS[getRank()]) { ++hitpoints; // Sind wir immer noch nicht gesund? Dann neues Event anmelden! - if(hitpoints < HITPOINTS[GetRank()]) + if(hitpoints < HITPOINTS[getRank()]) healing_event = - GetEvMgr().AddEvent(this, CONVALESCE_TIME + RANDOM_RAND(CONVALESCE_TIME_RANDOM), 1); + getEvMgr().AddEvent(this, CONVALESCE_TIME + RANDOM_RAND(CONVALESCE_TIME_RANDOM), 1); } } } @@ -85,14 +85,14 @@ void nofPassiveSoldier::Heal() // Dann muss dieses entfernt werden, wahrscheinlich war er zuvor draußen gewesen if(healing_event) { - GetEvMgr().RemoveEvent(healing_event); + getEvMgr().RemoveEvent(healing_event); healing_event = nullptr; } // Ist er verletzt? // Dann muss er geheilt werden - if(hitpoints < HITPOINTS[GetRank()]) - healing_event = GetEvMgr().AddEvent(this, CONVALESCE_TIME + RANDOM_RAND(CONVALESCE_TIME_RANDOM), 1); + if(hitpoints < HITPOINTS[getRank()]) + healing_event = getEvMgr().AddEvent(this, CONVALESCE_TIME + RANDOM_RAND(CONVALESCE_TIME_RANDOM), 1); } void nofPassiveSoldier::GoalReached() @@ -105,7 +105,7 @@ void nofPassiveSoldier::LeaveBuilding() // Nach Hause in ein Lagerhaus gehen rs_dir = true; rs_pos = 1; - cur_rs = homeBld->GetRoute(Direction::SouthEast); + cur_rs = homeBld->getRoute(Direction::SouthEast); GoHome(); homeBld = nullptr; @@ -114,13 +114,13 @@ void nofPassiveSoldier::LeaveBuilding() void nofPassiveSoldier::Upgrade() { // We must not be in the buildings list while upgrading. This would destroy the ordered list - RTTR_Assert(!homeBld || !static_cast(homeBld)->IsInTroops(*this)); + RTTR_Assert(!homeBld || !static_cast(homeBld)->isInTroops(*this)); // Einen Rang höher job_ = Job(unsigned(job_) + 1); // wieder heilen bzw. Hitpoints anpasen - GamePlayer& owner = world->GetPlayer(player); - hitpoints = HITPOINTS[GetRank()]; + GamePlayer& owner = world->getPlayer(player); + hitpoints = HITPOINTS[getRank()]; // Inventur entsprechend erhöhen und verringern owner.IncreaseInventoryJob(job_, 1); diff --git a/libs/s25main/figures/nofPassiveSoldier.h b/libs/s25main/figures/nofPassiveSoldier.h index 4239c012f5..9dcdf35339 100644 --- a/libs/s25main/figures/nofPassiveSoldier.h +++ b/libs/s25main/figures/nofPassiveSoldier.h @@ -39,7 +39,7 @@ class nofPassiveSoldier : public nofSoldier void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofPassivesoldier; } + GO_Type getGOT() const final { return GO_Type::NofPassivesoldier; } // Zeichnet den Soldaten void Draw(DrawPoint drawPt) override; diff --git a/libs/s25main/figures/nofPassiveWorker.cpp b/libs/s25main/figures/nofPassiveWorker.cpp index 2a4824b683..0a17b5f47d 100644 --- a/libs/s25main/figures/nofPassiveWorker.cpp +++ b/libs/s25main/figures/nofPassiveWorker.cpp @@ -22,7 +22,7 @@ void nofPassiveWorker::Walked() {} void nofPassiveWorker::GoalReached() { // Mich hier einquartieren - auto* wh = world->GetSpecObj(pos); + auto* wh = world->getSpecObj(pos); RTTR_Assert(wh); wh->AddFigure(world->RemoveFigure(pos, *this)); } diff --git a/libs/s25main/figures/nofPassiveWorker.h b/libs/s25main/figures/nofPassiveWorker.h index 17f82ea0a4..05f02f88fc 100644 --- a/libs/s25main/figures/nofPassiveWorker.h +++ b/libs/s25main/figures/nofPassiveWorker.h @@ -29,5 +29,5 @@ class nofPassiveWorker : public noFigure /// Zeichnen void Draw(DrawPoint drawPt) override; - GO_Type GetGOT() const final { return GO_Type::NofPassiveworker; } + GO_Type getGOT() const final { return GO_Type::NofPassiveworker; } }; diff --git a/libs/s25main/figures/nofPigbreeder.cpp b/libs/s25main/figures/nofPigbreeder.cpp index 033c5c5665..f316b919d1 100644 --- a/libs/s25main/figures/nofPigbreeder.cpp +++ b/libs/s25main/figures/nofPigbreeder.cpp @@ -27,8 +27,8 @@ void nofPigbreeder::DrawWorking(DrawPoint drawPt) unsigned max_id = 240; int now_id = GAMECLIENT.Interpolate(max_id, current_ev); - const Nation wpNation = workplace->GetNation(); - unsigned plColor = world->GetPlayer(player).color; + const Nation wpNation = workplace->getNation(); + unsigned plColor = world->getPlayer(player).color; int walksteps = 16; if(now_id < 16) @@ -43,13 +43,13 @@ void nofPigbreeder::DrawWorking(DrawPoint drawPt) .draw(walkPos, COLOR_WHITE, plColor); } else if(now_id < 40) { - LOADER.GetPlayerImage("rom_bobs", 148 + (now_id - 16) / 2) + LOADER.getPlayerImage("rom_bobs", 148 + (now_id - 16) / 2) ->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); // Evtl Sound abspielen if((now_id - 16) == 10) { - world->GetSoundMgr().playNOSound(65, *this, 0); + world->getSoundMgr().playNOSound(65, *this, 0); was_sounding = true; } } else if(now_id < 56) @@ -72,11 +72,11 @@ helpers::OptionalEnum nofPigbreeder::ProduceWare() void nofPigbreeder::MakePigSounds() { /// Ist es wieder Zeit für einen Schweine-Sound? - unsigned timeDiffSound = 600 + unsigned(rand() % 200) - workplace->GetProductivity() * 5u; - if(GetEvMgr().GetCurrentGF() - last_id > timeDiffSound) + unsigned timeDiffSound = 600 + unsigned(rand() % 200) - workplace->getProductivity() * 5u; + if(getEvMgr().getCurrentGF() - last_id > timeDiffSound) { // "Oink" - world->GetSoundMgr().playNOSound(86, *this, 1); - last_id = GetEvMgr().GetCurrentGF(); + world->getSoundMgr().playNOSound(86, *this, 1); + last_id = getEvMgr().getCurrentGF(); } } diff --git a/libs/s25main/figures/nofPigbreeder.h b/libs/s25main/figures/nofPigbreeder.h index a8270b70e4..31447d8758 100644 --- a/libs/s25main/figures/nofPigbreeder.h +++ b/libs/s25main/figures/nofPigbreeder.h @@ -15,7 +15,7 @@ class nofPigbreeder : public nofWorkman /// Zeichnet ihn beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override { return 73; } + unsigned short getCarryID() const override { return 73; } /// Der Arbeiter erzeugt eine Ware helpers::OptionalEnum ProduceWare() override; @@ -23,7 +23,7 @@ class nofPigbreeder : public nofWorkman nofPigbreeder(MapPoint pos, unsigned char player, nobUsual* workplace); nofPigbreeder(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofPigbreeder; } + GO_Type getGOT() const final { return GO_Type::NofPigbreeder; } /// Ggf. Schweinesounds abspielen void MakePigSounds(); diff --git a/libs/s25main/figures/nofPlaner.cpp b/libs/s25main/figures/nofPlaner.cpp index 2b047b7edb..49bf1cfb74 100644 --- a/libs/s25main/figures/nofPlaner.cpp +++ b/libs/s25main/figures/nofPlaner.cpp @@ -50,7 +50,7 @@ void nofPlaner::GoalReached() void nofPlaner::Walked() { /// Zur Baustelle zurückgelaufen? (=fertig) - if(pos == building_site->GetPos()) + if(pos == building_site->getPos()) { // Baustelle Bescheid sagen building_site->PlaningFinished(); @@ -60,7 +60,7 @@ void nofPlaner::Walked() // Nach Hause laufen bzw. auch rumirren rs_pos = 0; rs_dir = true; - cur_rs = world->GetSpecObj(pos)->GetRoute(Direction::SouthEast); + cur_rs = world->getSpecObj(pos)->getRoute(Direction::SouthEast); building_site = nullptr; GoHome(); @@ -68,7 +68,7 @@ void nofPlaner::Walked() } else { /// Anfangen zu arbeiten - current_ev = GetEvMgr().AddEvent(this, JOB_CONSTS[Job::Planer].work_length, 1); + current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[Job::Planer].work_length, 1); state = PlanerState::Planing; } } @@ -94,9 +94,9 @@ void nofPlaner::LostWork() // Event ggf. abmelden if(state == PlanerState::Planing) { - GetEvMgr().RemoveEvent(current_ev); + getEvMgr().RemoveEvent(current_ev); /// Sounds abmelden - world->GetSoundMgr().stopSounds(*this); + world->getSoundMgr().stopSounds(*this); } StartWandering(); @@ -138,15 +138,15 @@ void nofPlaner::Draw(DrawPoint drawPt) bobId = 253 + now_id - 41; else bobId = 253 + now_id - 55; - LOADER.GetPlayerImage("rom_bobs", bobId) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(building_site->GetPlayer()).color); + LOADER.getPlayerImage("rom_bobs", bobId) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(building_site->getPlayer()).color); // Schaufel-Sound if(now_id == 5 || now_id == 46 || now_id == 60) - world->GetSoundMgr().playNOSound(76, *this, now_id, 200); + world->getSoundMgr().playNOSound(76, *this, now_id, 200); // Tret-Sound else if(now_id == 20 || now_id == 28) - world->GetSoundMgr().playNOSound(66, *this, now_id, 200); + world->getSoundMgr().playNOSound(66, *this, now_id, 200); } break; } @@ -158,14 +158,14 @@ void nofPlaner::HandleDerivedEvent(const unsigned id) { // Planieren (falls Baustelle noch existiert) if(building_site) - world->ChangeAltitude(pos, world->GetNode(building_site->GetPos()).altitude); + world->ChangeAltitude(pos, world->getNode(building_site->getPos()).altitude); /// Sounds abmelden - world->GetSoundMgr().stopSounds(*this); + world->getSoundMgr().stopSounds(*this); state = PlanerState::Walking; // Planierung fertig --> weiterlaufen - Direction curDir = GetCurMoveDir(); + Direction curDir = getCurMoveDir(); // Das erste Mal gelaufen? if((pd == PlaningDir::Clockwise && curDir == Direction::SouthWest) diff --git a/libs/s25main/figures/nofPlaner.h b/libs/s25main/figures/nofPlaner.h index aa86d8ea30..b5b04718d4 100644 --- a/libs/s25main/figures/nofPlaner.h +++ b/libs/s25main/figures/nofPlaner.h @@ -46,7 +46,7 @@ class nofPlaner : public noFigure void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofPlaner; } + GO_Type getGOT() const final { return GO_Type::NofPlaner; } void Draw(DrawPoint drawPt) override; diff --git a/libs/s25main/figures/nofScout_Free.cpp b/libs/s25main/figures/nofScout_Free.cpp index a65fec802b..46521e492f 100644 --- a/libs/s25main/figures/nofScout_Free.cpp +++ b/libs/s25main/figures/nofScout_Free.cpp @@ -127,7 +127,7 @@ struct IsScoutable { // Liegt Punkt im Nebel und für Figuren begehbar? return world.CalcVisiblityWithAllies(pt, player) != Visibility::Visible - && PathConditionHuman(world).IsNodeOk(pt); + && PathConditionHuman(world).isNodeOk(pt); } }; } // namespace @@ -135,14 +135,14 @@ struct IsScoutable void nofScout_Free::GoToNewNode() { std::vector available_points = - world->GetMatchingPointsInRadius<-1>(flag->GetPos(), SCOUT_RANGE, IsScoutable(player, *world)); + world->GetMatchingPointsInRadius<-1>(flag->getPos(), SCOUT_RANGE, IsScoutable(player, *world)); RANDOM_SHUFFLE(available_points); for(MapPoint pt : available_points) { // Is there a path to this point and is the point also not to far away from the flag? // (Second check avoids running around mountains with a very far way back) if(world->FindHumanPath(pos, pt, SCOUT_RANGE * 2) - && world->FindHumanPath(flag->GetPos(), pt, SCOUT_RANGE + SCOUT_RANGE / 4)) + && world->FindHumanPath(flag->getPos(), pt, SCOUT_RANGE + SCOUT_RANGE / 4)) { // Take it nextPos = pt; @@ -157,7 +157,7 @@ void nofScout_Free::GoToNewNode() } /// Gibt den Sichtradius dieser Figur zurück (0, falls nicht-spähend) -unsigned nofScout_Free::GetVisualRange() const +unsigned nofScout_Free::getVisualRange() const { return VISUALRANGE_SCOUT; } diff --git a/libs/s25main/figures/nofScout_Free.h b/libs/s25main/figures/nofScout_Free.h index d83198c7d8..0d549700b7 100644 --- a/libs/s25main/figures/nofScout_Free.h +++ b/libs/s25main/figures/nofScout_Free.h @@ -29,7 +29,7 @@ class nofScout_Free : public nofFlagWorker void GoToNewNode(); /// Gibt den Sichtradius dieser Figur zurück (0, falls nicht-spähend) - unsigned GetVisualRange() const override; + unsigned getVisualRange() const override; public: nofScout_Free(MapPoint pos, unsigned char player, noRoadNode* goal); @@ -37,7 +37,7 @@ class nofScout_Free : public nofFlagWorker void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofScoutFree; } + GO_Type getGOT() const final { return GO_Type::NofScoutFree; } void Draw(DrawPoint drawPt) override; diff --git a/libs/s25main/figures/nofScout_LookoutTower.cpp b/libs/s25main/figures/nofScout_LookoutTower.cpp index 81b210026c..0705db6930 100644 --- a/libs/s25main/figures/nofScout_LookoutTower.cpp +++ b/libs/s25main/figures/nofScout_LookoutTower.cpp @@ -38,7 +38,7 @@ void nofScout_LookoutTower::WorkplaceReached() // Und Post versenden SendPostMessage(player, - std::make_unique(GetEvMgr().GetCurrentGF(), _("Lookout-tower occupied"), + std::make_unique(getEvMgr().getCurrentGF(), _("Lookout-tower occupied"), PostCategory::Military, *workplace)); } diff --git a/libs/s25main/figures/nofScout_LookoutTower.h b/libs/s25main/figures/nofScout_LookoutTower.h index ac3068ad83..9287d8f50a 100644 --- a/libs/s25main/figures/nofScout_LookoutTower.h +++ b/libs/s25main/figures/nofScout_LookoutTower.h @@ -18,7 +18,7 @@ class nofScout_LookoutTower : public nofBuildingWorker /// Malt den Arbeiter beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override { return 0; } + unsigned short getCarryID() const override { return 0; } /// Arbeit musste wegen Arbeitsplatzverlust abgebrochen werden void WorkAborted() override; /// Arbeitsplatz wurde erreicht @@ -30,7 +30,7 @@ class nofScout_LookoutTower : public nofBuildingWorker nofScout_LookoutTower(MapPoint pos, unsigned char player, nobUsual* workplace); nofScout_LookoutTower(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofScoutLookouttower; } + GO_Type getGOT() const final { return GO_Type::NofScoutLookouttower; } void HandleDerivedEvent(unsigned id) override; }; diff --git a/libs/s25main/figures/nofShipWright.cpp b/libs/s25main/figures/nofShipWright.cpp index abe4dd55b7..ec1c6da7e5 100644 --- a/libs/s25main/figures/nofShipWright.cpp +++ b/libs/s25main/figures/nofShipWright.cpp @@ -35,7 +35,7 @@ struct IsNotReserved const World& world; IsNotReserved(const World& world) : world(world) {} - bool operator()(const MapPoint& pt) const { return !world.GetNode(pt).reserved; } + bool operator()(const MapPoint& pt) const { return !world.getNode(pt).reserved; } }; } // namespace @@ -46,13 +46,13 @@ void nofShipWright::HandleDerivedEvent(const unsigned /*id*/) case State::Waiting1: { // Herausfinden, was der Schiffsbauer als nächstes bauen soll - if(static_cast(workplace)->GetMode() == nobShipYard::Mode::Boats) + if(static_cast(workplace)->getMode() == nobShipYard::Mode::Boats) // in Handwerksmanier Boote herstellen nofWorkman::HandleStateWaiting1(); else { // Wege müssen immer von der Flagge aus berechnet werden - MapPoint flagPos = world->GetNeighbour(pos, Direction::SouthEast); + MapPoint flagPos = world->getNeighbour(pos, Direction::SouthEast); const std::vector possiblePts = world->GetMatchingPointsInRadius(flagPos, SHIPWRIGHT_RADIUS, IsNotReserved(*world)); @@ -62,14 +62,14 @@ void nofShipWright::HandleDerivedEvent(const unsigned /*id*/) // Besitze ich noch ein Schiff, was gebaut werden muss? for(const auto& pt : possiblePts) { - noBase* obj = world->GetNode(pt).obj; + noBase* obj = world->getNode(pt).obj; if(!obj) continue; // Our ship - if(obj->GetGOT() == GO_Type::Shipbuildingsite - && static_cast(obj)->GetPlayer() == player) + if(obj->getGOT() == GO_Type::Shipbuildingsite + && static_cast(obj)->getPlayer() == player) { if(world->FindHumanPath(flagPos, pt, SHIPWRIGHT_WALKING_DISTANCE)) available_points.push_back(pt); @@ -82,7 +82,7 @@ void nofShipWright::HandleDerivedEvent(const unsigned /*id*/) for(const auto& pt : possiblePts) { // Dieser Punkt geeignet? - if(IsPointGood(pt) && world->FindHumanPath(flagPos, pt, SHIPWRIGHT_WALKING_DISTANCE)) + if(isPointGood(pt) && world->FindHumanPath(flagPos, pt, SHIPWRIGHT_WALKING_DISTANCE)) available_points.push_back(pt); } } @@ -98,7 +98,7 @@ void nofShipWright::HandleDerivedEvent(const unsigned /*id*/) // Nichts zu arbeiten gefunden workplace->StartNotWorking(); // Weiter warten, vielleicht gibts ja später wieder mal was - current_ev = GetEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); + current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); } } } @@ -107,7 +107,7 @@ void nofShipWright::HandleDerivedEvent(const unsigned /*id*/) { // Sind wir an unserem Arbeitsplatz (dem Gebäude), wenn wir die Arbeit beendet haben, bauen wir nur Boote, // ansonsten sind wir an unserem Schiff und bauen große Schiffe - if(workplace->GetPos() == pos) + if(workplace->getPos() == pos) // Boote bauen nofWorkman::HandleStateWork(); else @@ -115,14 +115,14 @@ void nofShipWright::HandleDerivedEvent(const unsigned /*id*/) // fertig mit Arbeiten --> dann müssen die "Folgen des Arbeitens" ausgeführt werden WorkFinished(); // Objekt wieder freigeben - world->SetReserved(pos, false); + world->setReserved(pos, false); // Wieder nach Hause gehen StartWalkingHome(); // Evtl. Sounds löschen if(was_sounding) { - world->GetSoundMgr().stopSounds(*this); + world->getSoundMgr().stopSounds(*this); was_sounding = false; } } @@ -158,7 +158,7 @@ void nofShipWright::StartWalkingToShip() // Waren verbrauchen workplace->ConsumeWares(); // Punkt für uns reservieren - world->SetReserved(curShipBuildPos, true); + world->setReserved(curShipBuildPos, true); // Anfangen zu laufen (erstmal aus dem Haus raus!) StartWalking(Direction::SouthEast); @@ -168,18 +168,18 @@ void nofShipWright::StartWalkingToShip() /// Ist ein bestimmter Punkt auf der Karte für den Schiffsbau geeignet /// poc: differene to original game: points at a sea which cant have a harbor are invalid (original as long as there is /// 1 harborpoint at any sea on the map any sea is valid) -bool nofShipWright::IsPointGood(const MapPoint pt) const +bool nofShipWright::isPointGood(const MapPoint pt) const { // Auf Wegen nicht bauen for(const auto dir : helpers::EnumRange{}) { - if(world->GetPointRoad(pt, dir) != PointRoad::None) + if(world->getPointRoad(pt, dir) != PointRoad::None) return false; } - return (world->IsPlayerTerritory(pt) && world->IsCoastalPointToSeaWithHarbor(pt) - && (world->GetNO(pt)->GetType() == NodalObjectType::Environment - || world->GetNO(pt)->GetType() == NodalObjectType::Nothing)); + return (world->isPlayerTerritory(pt) && world->isCoastalPointToSeaWithHarbor(pt) + && (world->getNO(pt)->getType() == NodalObjectType::Environment + || world->getNO(pt)->getType() == NodalObjectType::Nothing)); } void nofShipWright::WalkToWorkpoint() @@ -189,15 +189,15 @@ void nofShipWright::WalkToWorkpoint() { // Anfangen zu arbeiten state = State::Work; - current_ev = GetEvMgr().AddEvent(this, WORKING_TIME_SHIPS, 1); + current_ev = getEvMgr().AddEvent(this, WORKING_TIME_SHIPS, 1); return; } const auto dir = world->FindHumanPath(pos, curShipBuildPos, 20); // Weg suchen und gucken ob der Punkt noch in Ordnung ist - if(!dir || (!IsPointGood(curShipBuildPos) && world->GetGOT(curShipBuildPos) != GO_Type::Shipbuildingsite)) + if(!dir || (!isPointGood(curShipBuildPos) && world->getGOT(curShipBuildPos) != GO_Type::Shipbuildingsite)) { // Punkt freigeben - world->SetReserved(curShipBuildPos, false); + world->setReserved(curShipBuildPos, false); // Kein Weg führt mehr zum Ziel oder Punkt ist nich mehr in Ordnung --> wieder nach Hause gehen StartWalkingHome(); } else @@ -211,7 +211,7 @@ void nofShipWright::StartWalkingHome() { state = State::WalkingHome; // Fahne vor dem Gebäude anpeilen - curShipBuildPos = world->GetNeighbour(workplace->GetPos(), Direction::SouthEast); + curShipBuildPos = world->getNeighbour(workplace->getPos(), Direction::SouthEast); // Zu Laufen anfangen WalkHome(); @@ -244,22 +244,22 @@ void nofShipWright::WalkHome() void nofShipWright::WorkAborted() { // Platz freigeben, falls man gerade arbeitet - if((state == State::Work && workplace->GetPos() != pos) + if((state == State::Work && workplace->getPos() != pos) || state == State::WalkToWorkpoint) //&& static_cast(workplace)->GetMode() == nobShipYard::SHIPS) - world->SetReserved(curShipBuildPos, false); + world->setReserved(curShipBuildPos, false); } /// Der Schiffsbauer hat einen Bauschritt bewältigt und geht wieder zurück zum Haus void nofShipWright::WorkFinished() { // Befindet sich an dieser Stelle schon ein Schiff oder müssen wir es erst noch hinsetzen? - if(world->GetGOT(pos) != GO_Type::Shipbuildingsite) + if(world->getGOT(pos) != GO_Type::Shipbuildingsite) { // Ggf Zierobjekte löschen - auto* obj = world->GetSpecObj(pos); + auto* obj = world->getSpecObj(pos); if(obj) { - if(obj->GetType() != NodalObjectType::Environment) + if(obj->getType() != NodalObjectType::Environment) // Mittlerweile wurde anderes Objekt hierhin gesetzt --> können kein Schiff mehr bauen return; @@ -267,13 +267,13 @@ void nofShipWright::WorkFinished() } // Baustelle setzen - world->SetNO(pos, new noShipBuildingSite(pos, player)); + world->setNO(pos, new noShipBuildingSite(pos, player)); // Bauplätze drumrum neu berechnen world->RecalcBQAroundPointBig(pos); } // Schiff weiterbauen - world->GetSpecObj(pos)->MakeBuildStep(); + world->getSpecObj(pos)->MakeBuildStep(); } void nofShipWright::WalkedDerived() @@ -293,7 +293,7 @@ const std::array ANIMATION = {299, 300, 301, 302, 299, 300, 301, 3 void nofShipWright::DrawWorking(DrawPoint drawPt) { // Nicht mich zeichnen wenn ich im Haus arbeite - if(this->pos == workplace->GetPos()) + if(this->pos == workplace->getPos()) return; switch(state) @@ -303,17 +303,17 @@ void nofShipWright::DrawWorking(DrawPoint drawPt) { unsigned id = GAMECLIENT.Interpolate(42, current_ev); unsigned graphics_id = ANIMATION[id]; - LOADER.GetPlayerImage("rom_bobs", graphics_id) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", graphics_id) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); // Steh-Hammer-Sound if(graphics_id == 300) { - world->GetSoundMgr().playNOSound(78, *this, id, 160 - rand() % 60); + world->getSoundMgr().playNOSound(78, *this, id, 160 - rand() % 60); was_sounding = true; } else if(graphics_id == 303 || graphics_id == 307) { - world->GetSoundMgr().playNOSound(72, *this, id - id % 2, 160 - rand() % 60); + world->getSoundMgr().playNOSound(72, *this, id - id % 2, 160 - rand() % 60); was_sounding = true; } } @@ -329,7 +329,7 @@ void nofShipWright::DrawOtherStates(DrawPoint drawPt) case State::WalkToWorkpoint: { // Schiffsbauer mit Brett zeichnen - DrawWalking(drawPt, LOADER.GetBob("jobs"), 92, false); + DrawWalking(drawPt, LOADER.getBob("jobs"), 92, false); } break; default: return; diff --git a/libs/s25main/figures/nofShipWright.h b/libs/s25main/figures/nofShipWright.h index 92a88811e0..9dcf06f2a0 100644 --- a/libs/s25main/figures/nofShipWright.h +++ b/libs/s25main/figures/nofShipWright.h @@ -18,7 +18,7 @@ class nofShipWright : public nofWorkman /// Zeichnet ihn beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override { return 90; } + unsigned short getCarryID() const override { return 90; } /// Der Arbeiter erzeugt eine Ware helpers::OptionalEnum ProduceWare() override { return GoodType::Boat; } @@ -26,7 +26,7 @@ class nofShipWright : public nofWorkman void StartWalkingToShip(); /// Ist ein bestimmter Punkt auf der Karte für den Schiffsbau geeignet - bool IsPointGood(MapPoint pt) const; + bool isPointGood(MapPoint pt) const; /// Der Schiffsbauer hat einen Bauschritt bewältigt und geht wieder zurück zum Haus void WorkFinished() override; @@ -43,7 +43,7 @@ class nofShipWright : public nofWorkman public: nofShipWright(MapPoint pos, unsigned char player, nobUsual* workplace); nofShipWright(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofShipwright; } + GO_Type getGOT() const final { return GO_Type::NofShipwright; } void HandleDerivedEvent(unsigned id) override; void Serialize(SerializedGameData& sgd) const override; }; diff --git a/libs/s25main/figures/nofSkinner.cpp b/libs/s25main/figures/nofSkinner.cpp index 13769c3bac..56e5248f31 100644 --- a/libs/s25main/figures/nofSkinner.cpp +++ b/libs/s25main/figures/nofSkinner.cpp @@ -63,7 +63,7 @@ void nofSkinner::AnimalLost() case State::SkinnerWalkingToCarcass: StartWalkingHome(); break; case State::SkinnerSkinningCarcass: // Remove Working-Event - GetEvMgr().RemoveEvent(current_ev); + getEvMgr().RemoveEvent(current_ev); StartWalkingHome(); break; } @@ -74,7 +74,7 @@ void nofSkinner::AnimalLost() # pragma warning(disable : 4646) // function declared with [[noreturn]] has non-void return type #endif -unsigned short nofSkinner::GetCarryID() const +unsigned short nofSkinner::getCarryID() const { throw std::logic_error("Must not be called. Handled by custom DrawWalkingWithWare"); } @@ -102,7 +102,7 @@ void nofSkinner::HandleDerivedEvent(unsigned) void nofSkinner::DrawWorking(DrawPoint drawPt) { - const GamePlayer& owner = world->GetPlayer(player); + const GamePlayer& owner = world->getPlayer(player); switch(state) { default: break; @@ -119,7 +119,7 @@ void nofSkinner::DrawWorking(DrawPoint drawPt) else draw_id = (draw_id + 12) + id - 36; - LOADER.GetPlayerImage("leather_bobs", draw_id)->drawForPlayer(drawPt, owner.color); + LOADER.getPlayerImage("leather_bobs", draw_id)->drawForPlayer(drawPt, owner.color); } break; } @@ -129,7 +129,7 @@ void nofSkinner::HandleStateSkinningCarcass() { // see comment at noAnimal::HandleEvent for explanation of ownership of animal animal->Skinned(); - if(!animal->IsHunted()) + if(!animal->isHunted()) { // Tier verschwinden lassen auto ownedAnimal = world->RemoveFigure(pos, *animal); @@ -147,14 +147,14 @@ void nofSkinner::StartWalkingHome() WorkAborted(); state = State::WalkingHome; // We may be still walking in which case we delay finding a path home until we reached the next node - if(!IsMoving()) + if(!isMoving()) HandleStateWalkingHome(); } void nofSkinner::HandleStateWalkingHome() { // We reached our home? (exactly at the flag !!) - MapPoint homeFlagPos = world->GetNeighbour(workplace->GetPos(), Direction::SouthEast); + MapPoint homeFlagPos = world->getNeighbour(workplace->getPos(), Direction::SouthEast); if(pos == homeFlagPos) { // Redirect to nofBuildingWorker @@ -177,9 +177,9 @@ void nofSkinner::HandleStateWalkingHome() void nofSkinner::TryStartSkinning() { - if(workplace->IsProductionDisabled()) + if(workplace->isProductionDisabled()) { - current_ev = GetEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); + current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); workplace->StartNotWorking(); return; } @@ -189,8 +189,8 @@ void nofSkinner::TryStartSkinning() HandleStateWaiting1(); else { - const auto available_animals = nofHunter::GetAnimalsInRange( - *world, pos, ANIMAL_RADIUS, MAX_SKINNING_DISTANCE, [](const noAnimal* a) { return a->CanBeSkinned(); }); + const auto available_animals = nofHunter::getAnimalsInRange( + *world, pos, ANIMAL_RADIUS, MAX_SKINNING_DISTANCE, [](const noAnimal* a) { return a->canBeSkinned(); }); if(!available_animals.empty()) { @@ -202,7 +202,7 @@ void nofSkinner::TryStartSkinning() workplace->StopNotWorking(); } else { - current_ev = GetEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); + current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); workplace->StartNotWorking(); } } @@ -215,7 +215,7 @@ void nofSkinner::TryToWork() else { state = State::Waiting1; - current_ev = GetEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); + current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); workplace->StartNotWorking(); } } @@ -227,13 +227,13 @@ void nofSkinner::WalkedDerived() default: break; case State::SkinnerWalkingToCarcass: { - if(pos == animal->GetPos()) + if(pos == animal->getPos()) { state = State::SkinnerSkinningCarcass; - current_ev = GetEvMgr().AddEvent(this, 80, 1); + current_ev = getEvMgr().AddEvent(this, 80, 1); } else { - const auto dir = world->FindHumanPath(pos, animal->GetPos(), MAX_SKINNING_DISTANCE); + const auto dir = world->FindHumanPath(pos, animal->getPos(), MAX_SKINNING_DISTANCE); if(dir) StartWalking(*dir); else diff --git a/libs/s25main/figures/nofSkinner.h b/libs/s25main/figures/nofSkinner.h index b2bb5339c0..8478c0c603 100644 --- a/libs/s25main/figures/nofSkinner.h +++ b/libs/s25main/figures/nofSkinner.h @@ -18,7 +18,7 @@ class nofSkinner : public nofWorkman /// Draw worker at work void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - [[noreturn]] unsigned short GetCarryID() const override; + [[noreturn]] unsigned short getCarryID() const override; helpers::OptionalEnum ProduceWare() override; /// Draws the figure while returning home / entering the building (often carrying wares) @@ -39,7 +39,7 @@ class nofSkinner : public nofWorkman void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofSkinner; } + GO_Type getGOT() const final { return GO_Type::NofSkinner; } void WorkAborted() override; void AnimalLost(); diff --git a/libs/s25main/figures/nofSoldier.cpp b/libs/s25main/figures/nofSoldier.cpp index 65866f08b5..30d2b3f43f 100644 --- a/libs/s25main/figures/nofSoldier.cpp +++ b/libs/s25main/figures/nofSoldier.cpp @@ -50,8 +50,8 @@ nofSoldier::nofSoldier(SerializedGameData& sgd, const unsigned obj_id) : noFigur void nofSoldier::DrawSoldierWaiting(DrawPoint drawPt) { - const GamePlayer& owner = world->GetPlayer(player); - LOADER.getBobSprite(owner.nation, job_, GetCurMoveDir(), 2).drawForPlayer(drawPt, owner.color); + const GamePlayer& owner = world->getPlayer(player); + LOADER.getBobSprite(owner.nation, job_, getCurMoveDir(), 2).drawForPlayer(drawPt, owner.color); if(hasArmor_) this->DrawArmor(drawPt); } @@ -65,12 +65,12 @@ void nofSoldier::AbrogateWorkplace() } } -unsigned char nofSoldier::GetRank() const +unsigned char nofSoldier::getRank() const { return getSoldierRank(job_); } -unsigned char nofSoldier::GetHitpoints() const +unsigned char nofSoldier::getHitpoints() const { return hitpoints; } diff --git a/libs/s25main/figures/nofSoldier.h b/libs/s25main/figures/nofSoldier.h index de77dc405e..7289b0256e 100644 --- a/libs/s25main/figures/nofSoldier.h +++ b/libs/s25main/figures/nofSoldier.h @@ -33,14 +33,14 @@ class nofSoldier : public noFigure void Destroy() override { - RTTR_Assert(!GetHomeBld()); + RTTR_Assert(!getHomeBld()); noFigure::Destroy(); } void Serialize(SerializedGameData& sgd) const override; - unsigned char GetRank() const; - unsigned char GetHitpoints() const; - const nobBaseMilitary* GetHomeBld() const { return homeBld; } + unsigned char getRank() const; + unsigned char getHitpoints() const; + const nobBaseMilitary* getHomeBld() const { return homeBld; } }; /// Comparator to sort soldiers by rank and armor (and ID for ties), weak ones first @@ -49,13 +49,13 @@ struct ComparatorSoldiersByRank template bool operator()(const TSoldierPtr& left, const TSoldierPtr& right) const { - if(left->GetRank() == right->GetRank()) + if(left->getRank() == right->getRank()) { - if(left->HasArmor() == right->HasArmor()) - return left->GetObjId() < right->GetObjId(); + if(left->hasArmor() == right->hasArmor()) + return left->getObjId() < right->getObjId(); else - return left->HasArmor() < right->HasArmor(); + return left->hasArmor() < right->hasArmor(); } else - return left->GetRank() < right->GetRank(); + return left->getRank() < right->getRank(); } }; diff --git a/libs/s25main/figures/nofStonemason.cpp b/libs/s25main/figures/nofStonemason.cpp index 9f6521e042..82d11db13f 100644 --- a/libs/s25main/figures/nofStonemason.cpp +++ b/libs/s25main/figures/nofStonemason.cpp @@ -25,17 +25,17 @@ void nofStonemason::DrawWorking(DrawPoint drawPt) unsigned now_id; // Stein hauen - LOADER.GetPlayerImage("rom_bobs", 40 + (now_id = GAMECLIENT.Interpolate(64, current_ev)) % 8) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 40 + (now_id = GAMECLIENT.Interpolate(64, current_ev)) % 8) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(now_id % 8 == 5) { - world->GetSoundMgr().playNOSound(56, *this, now_id); + world->getSoundMgr().playNOSound(56, *this, now_id); was_sounding = true; } } -unsigned short nofStonemason::GetCarryID() const +unsigned short nofStonemason::getCarryID() const { return 63; } @@ -47,29 +47,29 @@ void nofStonemason::WorkStarted() {} void nofStonemason::WorkFinished() { // Stein abhauen (wenn er nur noch ganz klein ist, dann wird er von der Landkarte getilgt) - if(world->GetSpecObj(pos)->IsSmall()) + if(world->getSpecObj(pos)->isSmall()) { // Granitklötzchen löschen world->DestroyNO(pos); // Minimap Bescheid geben (Granitglötzchen muss weg) - if(world->GetGameInterface()) - world->GetGameInterface()->GI_UpdateMinimap(pos); + if(world->getGameInterface()) + world->getGameInterface()->GI_UpdateMinimap(pos); // Drumherum BQ neu berechnen, da diese sich ja jetzt hätten ändern können world->RecalcBQAroundPoint(pos); } else // ansonsten wird er um 1 kleiner - world->GetSpecObj(pos)->Hew(); + world->getSpecObj(pos)->Hew(); // Stein in die Hand nehmen ware = GoodType::Stones; } /// Returns the quality of this working point or determines if the worker can work here at all -nofFarmhand::PointQuality nofStonemason::GetPointQuality(const MapPoint pt, bool /* isBeforeWork */) const +nofFarmhand::PointQuality nofStonemason::getPointQuality(const MapPoint pt, bool /* isBeforeWork */) const { // An dieser Position muss es nur Stein geben - return ((world->GetNO(pt)->GetType() == NodalObjectType::Granite) ? PointQuality::Class1 : + return ((world->getNO(pt)->getType() == NodalObjectType::Granite) ? PointQuality::Class1 : PointQuality::NotPossible); } diff --git a/libs/s25main/figures/nofStonemason.h b/libs/s25main/figures/nofStonemason.h index 8de19a4c30..359f8be7c2 100644 --- a/libs/s25main/figures/nofStonemason.h +++ b/libs/s25main/figures/nofStonemason.h @@ -14,7 +14,7 @@ class nofStonemason : public nofFarmhand /// Malt den Arbeiter beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override; + unsigned short getCarryID() const override; /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) void WorkStarted() override; @@ -22,11 +22,11 @@ class nofStonemason : public nofFarmhand void WorkFinished() override; /// Returns the quality of this working point or determines if the worker can work here at all - PointQuality GetPointQuality(MapPoint pt, bool isBeforeWork) const override; + PointQuality getPointQuality(MapPoint pt, bool isBeforeWork) const override; public: nofStonemason(MapPoint pos, unsigned char player, nobUsual* workplace); nofStonemason(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofStonemason; } + GO_Type getGOT() const final { return GO_Type::NofStonemason; } }; diff --git a/libs/s25main/figures/nofTanner.cpp b/libs/s25main/figures/nofTanner.cpp index 6dc5592a2f..f6aa4ecbd8 100644 --- a/libs/s25main/figures/nofTanner.cpp +++ b/libs/s25main/figures/nofTanner.cpp @@ -25,9 +25,9 @@ void nofTanner::DrawWorking(DrawPoint drawPt) const unsigned now_id = GAMECLIENT.Interpolate(136, current_ev); LOADER - .GetPlayerImage("leather_bobs", + .getPlayerImage("leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::TanneryWorkWindowAnimation] + (now_id) % 8) - ->DrawFull(drawPt + offsets[workplace->GetNation()], COLOR_WHITE, world->GetPlayer(workplace->GetPlayer()).color); + ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); last_id = now_id; } @@ -37,7 +37,7 @@ void nofTanner::DrawWorking(DrawPoint drawPt) # pragma warning(disable : 4646) // function declared with [[noreturn]] has non-void return type #endif -unsigned short nofTanner::GetCarryID() const +unsigned short nofTanner::getCarryID() const { throw std::logic_error("Must not be called. Handled by custom DrawWalkingWithWare"); } diff --git a/libs/s25main/figures/nofTanner.h b/libs/s25main/figures/nofTanner.h index e661c829c6..065492b903 100644 --- a/libs/s25main/figures/nofTanner.h +++ b/libs/s25main/figures/nofTanner.h @@ -14,7 +14,7 @@ class nofTanner : public nofWorkman /// Draw worker at work void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - [[noreturn]] unsigned short GetCarryID() const override; + [[noreturn]] unsigned short getCarryID() const override; /// Der Arbeiter erzeugt eine Ware helpers::OptionalEnum ProduceWare() override; @@ -25,5 +25,5 @@ class nofTanner : public nofWorkman nofTanner(MapPoint pos, unsigned char player, nobUsual* workplace); nofTanner(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofTanner; } + GO_Type getGOT() const final { return GO_Type::NofTanner; } }; diff --git a/libs/s25main/figures/nofTempleServant.cpp b/libs/s25main/figures/nofTempleServant.cpp index 734e3fab29..87a434a90a 100644 --- a/libs/s25main/figures/nofTempleServant.cpp +++ b/libs/s25main/figures/nofTempleServant.cpp @@ -39,26 +39,26 @@ void nofTempleServant::DrawWorking(DrawPoint drawPt) if(now_id < 11) // servant pours wine into crucible(play once at start) { - LOADER.GetPlayerImage("wine_bobs", bobIndex[BobTypes::TEMPLE_WORK_WINDOW_START_ANIMATION] + now_id) - ->DrawFull(drawPt + offsets[workplace->GetNation()], COLOR_WHITE, - world->GetPlayer(workplace->GetPlayer()).color); + LOADER.getPlayerImage("wine_bobs", bobIndex[BobTypes::TEMPLE_WORK_WINDOW_START_ANIMATION] + now_id) + ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, + world->getPlayer(workplace->getPlayer()).color); } else if(now_id < 77) // wine and food is burned (loop for duration) { - LOADER.GetPlayerImage("wine_bobs", bobIndex[BobTypes::TEMPLE_WORK_WINDOW_MAIN_ANIMATION] + (now_id + 1) % 6) - ->DrawFull(drawPt + offsets[workplace->GetNation()], COLOR_WHITE, - world->GetPlayer(workplace->GetPlayer()).color); + LOADER.getPlayerImage("wine_bobs", bobIndex[BobTypes::TEMPLE_WORK_WINDOW_MAIN_ANIMATION] + (now_id + 1) % 6) + ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, + world->getPlayer(workplace->getPlayer()).color); // Play sound burning if((now_id + 1) % 6 == 3) { - world->GetSoundMgr().playNOSound(93, *this, now_id); + world->getSoundMgr().playNOSound(93, *this, now_id); was_sounding = true; } } else // last loop of animation (play once at end) { - LOADER.GetPlayerImage("wine_bobs", bobIndex[BobTypes::TEMPLE_WORK_WINDOW_END_ANIMATION] + now_id - 77) - ->DrawFull(drawPt + offsets[workplace->GetNation()], COLOR_WHITE, - world->GetPlayer(workplace->GetPlayer()).color); + LOADER.getPlayerImage("wine_bobs", bobIndex[BobTypes::TEMPLE_WORK_WINDOW_END_ANIMATION] + now_id - 77) + ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, + world->getPlayer(workplace->getPlayer()).color); } last_id = now_id; @@ -69,7 +69,7 @@ void nofTempleServant::DrawWorking(DrawPoint drawPt) # pragma warning(disable : 4646) // function declared with [[noreturn]] has non-void return type #endif -unsigned short nofTempleServant::GetCarryID() const +unsigned short nofTempleServant::getCarryID() const { throw std::logic_error("Must not be called. Handled by custom DrawWalkingWithWare"); } @@ -90,7 +90,7 @@ void nofTempleServant::DrawWalkingWithWare(DrawPoint drawPt) helpers::OptionalEnum nofTempleServant::ProduceWare() { - const auto productionMode = static_cast(workplace)->GetProductionMode(); + const auto productionMode = static_cast(workplace)->getProductionMode(); switch(productionMode) { case ProductionMode::IronOre: currentProduction = GoodType::IronOre; break; diff --git a/libs/s25main/figures/nofTempleServant.h b/libs/s25main/figures/nofTempleServant.h index 4dc10bef4f..04f8e19260 100644 --- a/libs/s25main/figures/nofTempleServant.h +++ b/libs/s25main/figures/nofTempleServant.h @@ -14,7 +14,7 @@ class nofTempleServant : public nofWorkman /// Draw worker at work void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - [[noreturn]] unsigned short GetCarryID() const override; + [[noreturn]] unsigned short getCarryID() const override; /// The worker produces a ware helpers::OptionalEnum ProduceWare() override; @@ -28,5 +28,5 @@ class nofTempleServant : public nofWorkman nofTempleServant(SerializedGameData& sgd, unsigned obj_id); void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofTempleservant; } + GO_Type getGOT() const final { return GO_Type::NofTempleservant; } }; diff --git a/libs/s25main/figures/nofTradeDonkey.cpp b/libs/s25main/figures/nofTradeDonkey.cpp index 7dc95910c4..7e75109194 100644 --- a/libs/s25main/figures/nofTradeDonkey.cpp +++ b/libs/s25main/figures/nofTradeDonkey.cpp @@ -25,7 +25,7 @@ nofTradeDonkey::nofTradeDonkey(SerializedGameData& sgd, const unsigned obj_id) : noFigure(sgd, obj_id), successor(sgd.PopObject(GO_Type::NofTradedonkey)), gt(sgd.PopOptionalEnum()) { - if(sgd.GetGameDataVersion() < 6) + if(sgd.getGameDataVersion() < 6) { std::vector next_dirs_raw; sgd.PopContainer(next_dirs_raw); @@ -46,17 +46,17 @@ void nofTradeDonkey::Serialize(SerializedGameData& sgd) const void nofTradeDonkey::GoalReached() { - RTTR_Assert(dynamic_cast(world->GetNO(pos))); + RTTR_Assert(dynamic_cast(world->getNO(pos))); successor = nullptr; - auto* wh = static_cast(world->GetNO(pos)); - GamePlayer& whOwner = world->GetPlayer(wh->GetPlayer()); + auto* wh = static_cast(world->getNO(pos)); + GamePlayer& whOwner = world->getPlayer(wh->getPlayer()); if(gt) wh->AddToInventory(GoodCounts::make(*gt, 1), true); - whOwner.IncreaseInventoryJob(this->GetJobType(), 1); + whOwner.IncreaseInventoryJob(this->getJobType(), 1); if(hasArmor_) - whOwner.IncreaseInventoryJob(jobEnumToAmoredSoldierEnum(this->GetJobType()), 1); + whOwner.IncreaseInventoryJob(jobEnumToAmoredSoldierEnum(this->getJobType()), 1); wh->AddFigure(world->RemoveFigure(pos, *this)); } @@ -64,25 +64,25 @@ void nofTradeDonkey::Walked() { if(next_dirs.empty()) { - CancelTradeCaravane(); + cancelTradeCaravane(); WanderFailedTrade(); return; } - TradeDirection nextDir = GetNextDir(); + TradeDirection nextDir = getNextDir(); if(successor) successor->AddNextDir(nextDir); // Are we now at the goal? if(nextDir == TradeDirection::ReachedGoal) { // Does target still exist? - noBase* nob = world->GetNO(pos); - if(nob->GetType() == NodalObjectType::Building - && BuildingProperties::IsWareHouse(static_cast(nob)->GetBuildingType())) + noBase* nob = world->getNO(pos); + if(nob->getType() == NodalObjectType::Building + && BuildingProperties::isWareHouse(static_cast(nob)->getBuildingType())) GoalReached(); else { - CancelTradeCaravane(); + cancelTradeCaravane(); WanderFailedTrade(); } } else @@ -103,12 +103,12 @@ void nofTradeDonkey::Draw(DrawPoint drawPt) // Läuft normal mit oder ohne Ware // Esel - LOADER.getDonkeySprite(GetCurMoveDir(), ani_step).draw(drawPt); + LOADER.getDonkeySprite(getCurMoveDir(), ani_step).draw(drawPt); if(gt) { // Ware im Korb zeichnen - LOADER.GetWareDonkeyTex(*gt)->DrawFull(drawPt + WARE_POS_DONKEY[GetCurMoveDir()][ani_step]); + LOADER.getWareDonkeyTex(*gt)->DrawFull(drawPt + WARE_POS_DONKEY[getCurMoveDir()][ani_step]); } } else DrawWalking(drawPt); @@ -116,12 +116,12 @@ void nofTradeDonkey::Draw(DrawPoint drawPt) void nofTradeDonkey::LostWork() {} -void nofTradeDonkey::CancelTradeCaravane() +void nofTradeDonkey::cancelTradeCaravane() { next_dirs.clear(); if(successor) { - successor->CancelTradeCaravane(); + successor->cancelTradeCaravane(); successor = nullptr; } } diff --git a/libs/s25main/figures/nofTradeDonkey.h b/libs/s25main/figures/nofTradeDonkey.h index 24f5330eb8..91fb95321b 100644 --- a/libs/s25main/figures/nofTradeDonkey.h +++ b/libs/s25main/figures/nofTradeDonkey.h @@ -30,7 +30,7 @@ class nofTradeDonkey : public noFigure void AbrogateWorkplace() override; /// Returns next direction - TradeDirection GetNextDir() + TradeDirection getNextDir() { TradeDirection dir = next_dirs.front(); next_dirs.pop_front(); @@ -49,7 +49,7 @@ class nofTradeDonkey : public noFigure void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofTradedonkey; } + GO_Type getGOT() const final { return GO_Type::NofTradedonkey; } void Draw(DrawPoint drawPt) override; @@ -60,14 +60,14 @@ class nofTradeDonkey : public noFigure void AddNextDir(TradeDirection dir) { next_dirs.push_back(dir); } /// Gets the type of ware this donkey is carrying - const auto& GetCarriedWare() const { return gt; } + const auto& getCarriedWare() const { return gt; } /// Sets the successor in the caravane - void SetSuccessor(nofTradeDonkey* const successor) { this->successor = successor; } + void setSuccessor(nofTradeDonkey* const successor) { this->successor = successor; } // get the successor in the caravane - nofTradeDonkey* GetSuccessor() { return successor; } + nofTradeDonkey* getSuccessor() { return successor; } /// Inform successor that the caravane is canceled - void CancelTradeCaravane(); + void cancelTradeCaravane(); }; diff --git a/libs/s25main/figures/nofTradeLeader.cpp b/libs/s25main/figures/nofTradeLeader.cpp index 18bd6c96c9..41ca34b112 100644 --- a/libs/s25main/figures/nofTradeLeader.cpp +++ b/libs/s25main/figures/nofTradeLeader.cpp @@ -43,62 +43,62 @@ void nofTradeLeader::Serialize(SerializedGameData& sgd) const void nofTradeLeader::GoalReached() { - noBase* nob = world->GetNO(goalPos); + noBase* nob = world->getNO(goalPos); auto* targetWarehouse = checkedCast(nob); if(successor) { unsigned amountWares = 0; - Job jobType = successor->GetJobType(); - const auto goodType = successor->GetCarriedWare(); + Job jobType = successor->getJobType(); + const auto goodType = successor->getCarriedWare(); nofTradeDonkey* successorDonkey = successor; while(successorDonkey != nullptr) { amountWares++; - successorDonkey = successorDonkey->GetSuccessor(); + successorDonkey = successorDonkey->getSuccessor(); } - GamePlayer& owner = world->GetPlayer(player); + GamePlayer& owner = world->getPlayer(player); std::string waresName = _(!goodType ? JOB_NAMES[jobType] : WARE_NAMES[*goodType]); std::string text = str(boost::format(_("Trade caravan with %s %s arrives from player '%s'.")) % amountWares % waresName % owner.name); - SendPostMessage(targetWarehouse->GetPlayer(), - std::make_unique(GetEvMgr().GetCurrentGF(), text, PostCategory::Economy, + SendPostMessage(targetWarehouse->getPlayer(), + std::make_unique(getEvMgr().getCurrentGF(), text, PostCategory::Economy, *targetWarehouse)); successor->AddNextDir(TradeDirection::ReachedGoal); successor = nullptr; } - world->GetPlayer(targetWarehouse->GetPlayer()).IncreaseInventoryJob(this->GetJobType(), 1); + world->getPlayer(targetWarehouse->getPlayer()).IncreaseInventoryJob(this->getJobType(), 1); targetWarehouse->AddFigure(world->RemoveFigure(pos, *this)); } void nofTradeLeader::Walked() { - noBase* nob = world->GetNO(goalPos); + noBase* nob = world->getNO(goalPos); // Does target still exist? - if(nob->GetType() != NodalObjectType::Building - || !BuildingProperties::IsWareHouse(static_cast(nob)->GetBuildingType())) + if(nob->getType() != NodalObjectType::Building + || !BuildingProperties::isWareHouse(static_cast(nob)->getBuildingType())) { if(TryToGoHome()) Walked(); else { - CancelTradeCaravane(); + cancelTradeCaravane(); WanderFailedTrade(); } } else if(pos == goalPos) GoalReached(); else { - RTTR_Assert(pos == tr.GetCurPos()); - auto next_dir = tr.GetNextDir(); + RTTR_Assert(pos == tr.getCurPos()); + auto next_dir = tr.getNextDir(); if(!next_dir) { if(TryToGoHome()) Walked(); else { - CancelTradeCaravane(); + cancelTradeCaravane(); WanderFailedTrade(); } } else @@ -130,23 +130,23 @@ bool nofTradeLeader::TryToGoHome() goalPos = homePos; - noBase* homeWh = world->GetNO(goalPos); + noBase* homeWh = world->getNO(goalPos); // Does target still exist? - if(homeWh->GetType() != NodalObjectType::Building - || !BuildingProperties::IsWareHouse(static_cast(homeWh)->GetBuildingType())) + if(homeWh->getType() != NodalObjectType::Building + || !BuildingProperties::isWareHouse(static_cast(homeWh)->getBuildingType())) return false; // Find a way back home - MapPoint homeFlagPos = world->GetNeighbour(homePos, Direction::SouthEast); - tr.AssignNewGoal(this->GetPos(), homeFlagPos); - return tr.IsValid(); + MapPoint homeFlagPos = world->getNeighbour(homePos, Direction::SouthEast); + tr.AssignNewGoal(this->getPos(), homeFlagPos); + return tr.isValid(); } -void nofTradeLeader::CancelTradeCaravane() +void nofTradeLeader::cancelTradeCaravane() { if(successor) { - successor->CancelTradeCaravane(); + successor->cancelTradeCaravane(); successor = nullptr; } } diff --git a/libs/s25main/figures/nofTradeLeader.h b/libs/s25main/figures/nofTradeLeader.h index d25db1a5c5..5f952541fc 100644 --- a/libs/s25main/figures/nofTradeLeader.h +++ b/libs/s25main/figures/nofTradeLeader.h @@ -29,7 +29,7 @@ class nofTradeLeader : public noFigure /// Tries to go to the home ware house and returns whether this is possible bool TryToGoHome(); /// Inform successor that the caravane is canceled - void CancelTradeCaravane(); + void cancelTradeCaravane(); public: nofTradeLeader(MapPoint pos, unsigned char player, TradeRoute tr, MapPoint homePos, MapPoint goalPos); @@ -44,7 +44,7 @@ class nofTradeLeader : public noFigure void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofTradeleader; } + GO_Type getGOT() const final { return GO_Type::NofTradeleader; } void Draw(DrawPoint drawPt) override; @@ -52,5 +52,5 @@ class nofTradeLeader : public noFigure void LostWork(); /// Sets the sucessor in the caravane - void SetSuccessor(nofTradeDonkey* const successor) { this->successor = successor; } + void setSuccessor(nofTradeDonkey* const successor) { this->successor = successor; } }; diff --git a/libs/s25main/figures/nofVintner.cpp b/libs/s25main/figures/nofVintner.cpp index a791def028..e4b11f5238 100644 --- a/libs/s25main/figures/nofVintner.cpp +++ b/libs/s25main/figures/nofVintner.cpp @@ -28,14 +28,14 @@ void nofVintner::DrawWorking(DrawPoint drawPt) if(now_id < 91) { - LOADER.GetPlayerImage("wine_bobs", bobIndex[BobTypes::VINTNER_WORK_WINDOW] + (now_id) % 8) - ->DrawFull(drawPt + offsets[workplace->GetNation()], COLOR_WHITE, - world->GetPlayer(workplace->GetPlayer()).color); + LOADER.getPlayerImage("wine_bobs", bobIndex[BobTypes::VINTNER_WORK_WINDOW] + (now_id) % 8) + ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, + world->getPlayer(workplace->getPlayer()).color); // Play rowing boat sound if(now_id % 8 == 3) { - world->GetSoundMgr().playNOSound(81, *this, now_id); + world->getSoundMgr().playNOSound(81, *this, now_id); was_sounding = true; } } @@ -48,7 +48,7 @@ void nofVintner::DrawWorking(DrawPoint drawPt) # pragma warning(disable : 4646) // function declared with [[noreturn]] has non-void return type #endif -unsigned short nofVintner::GetCarryID() const +unsigned short nofVintner::getCarryID() const { throw std::logic_error("Must not be called. Handled by custom DrawWalkingWithWare"); } diff --git a/libs/s25main/figures/nofVintner.h b/libs/s25main/figures/nofVintner.h index 707429c9bc..6836b1f30c 100644 --- a/libs/s25main/figures/nofVintner.h +++ b/libs/s25main/figures/nofVintner.h @@ -14,7 +14,7 @@ class nofVintner : public nofWorkman /// Draw worker at work void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - [[noreturn]] unsigned short GetCarryID() const override; + [[noreturn]] unsigned short getCarryID() const override; /// Der Arbeiter erzeugt eine Ware helpers::OptionalEnum ProduceWare() override; @@ -25,5 +25,5 @@ class nofVintner : public nofWorkman nofVintner(MapPoint pos, unsigned char player, nobUsual* workplace); nofVintner(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofVintner; } + GO_Type getGOT() const final { return GO_Type::NofVintner; } }; diff --git a/libs/s25main/figures/nofWarehouseWorker.cpp b/libs/s25main/figures/nofWarehouseWorker.cpp index 36eba31dba..4a36b1747e 100644 --- a/libs/s25main/figures/nofWarehouseWorker.cpp +++ b/libs/s25main/figures/nofWarehouseWorker.cpp @@ -15,14 +15,14 @@ nofWarehouseWorker::nofWarehouseWorker(const MapPoint pos, const unsigned char player, std::unique_ptr ware, const bool task) - : noFigure(Job::Helper, pos, player, world->GetSpecObj(world->GetNeighbour(pos, Direction::SouthEast))), + : noFigure(Job::Helper, pos, player, world->getSpecObj(world->getNeighbour(pos, Direction::SouthEast))), carried_ware(std::move(ware)), shouldBringWareIn(task), fat((RANDOM_RAND(2)) != 0) { // New figure - world->GetPlayer(player).IncreaseInventoryJob(Job::Helper, 1); + world->getPlayer(player).IncreaseInventoryJob(Job::Helper, 1); /// Set the road to building flag (1-piece) - cur_rs = static_cast(GetGoal())->GetRoute(Direction::NorthWest); + cur_rs = static_cast(getGoal())->getRoute(Direction::NorthWest); RTTR_Assert(cur_rs->GetLength() == 1); rs_dir = true; } @@ -60,16 +60,16 @@ void nofWarehouseWorker::Draw(DrawPoint drawPt) void nofWarehouseWorker::GoalReached() { // When worker is still working, the warehouse (and its flag) exists - auto& wh = assertNonNull(world->GetSpecObj(world->GetNeighbour(pos, Direction::NorthWest))); - auto& flag = assertNonNull(wh.GetFlag()); + auto& wh = assertNonNull(world->getSpecObj(world->getNeighbour(pos, Direction::NorthWest))); + auto& flag = assertNonNull(wh.getFlag()); if(!shouldBringWareIn) { // Put ware down at flag if enough space. // Might need to take it back in if goal was destroyed or changed to the warehouse - if(flag.HasSpaceForWare() && carried_ware->GetGoal() && carried_ware->GetGoal() != &wh) + if(flag.hasSpaceForWare() && carried_ware->getGoal() && carried_ware->getGoal() != &wh) { // TODO: Remove assert. Was added to verify prior condition - RTTR_Assert(carried_ware->GetGoal() != carried_ware->GetLocation()); + RTTR_Assert(carried_ware->getGoal() != carried_ware->getLocation()); carried_ware->WaitAtFlag(flag); carried_ware->RecalcRoute(); @@ -89,7 +89,7 @@ void nofWarehouseWorker::GoalReached() // Start walking back StartWalking(Direction::NorthWest); - InitializeRoadWalking(wh.GetRoute(Direction::SouthEast), 0, false); + InitializeRoadWalking(wh.getRoute(Direction::SouthEast), 0, false); } void nofWarehouseWorker::Walked() @@ -102,15 +102,15 @@ void nofWarehouseWorker::Walked() if(carried_ware) { // Add to warehouse inventory (if it still exists and was not burnt down) - if(world->GetNO(pos)->GetType() == NodalObjectType::Building) + if(world->getNO(pos)->getType() == NodalObjectType::Building) { - auto* wh = world->GetSpecObj(pos); + auto* wh = world->getSpecObj(pos); // Store the ware if its goal is this warehouse or it has no goal (anymore) // Else it wants to go somewhere else, so add to waiting wares - if(!carried_ware->GetGoal() || carried_ware->GetGoal() == wh) + if(!carried_ware->getGoal() || carried_ware->getGoal() == wh) { // TODO: Remove assert. Was added to verify prior condition - RTTR_Assert(!carried_ware->GetGoal() || carried_ware->GetGoal() == carried_ware->GetLocation()); + RTTR_Assert(!carried_ware->getGoal() || carried_ware->getGoal() == carried_ware->getLocation()); wh->AddWare(std::move(carried_ware)); } else wh->AddWaitingWare(std::move(carried_ware)); @@ -123,8 +123,8 @@ void nofWarehouseWorker::Walked() if(carried_ware) { // Add ware to warehouse if it still exists - if(world->GetNO(pos)->GetType() == NodalObjectType::Building) - world->GetSpecObj(pos)->AddWare(std::move(carried_ware)); + if(world->getNO(pos)->getType() == NodalObjectType::Building) + world->getSpecObj(pos)->AddWare(std::move(carried_ware)); else LooseWare(); // Warehouse is missing --> destroy ware RTTR_Assert(carried_ware == nullptr); @@ -132,8 +132,8 @@ void nofWarehouseWorker::Walked() } // Remove myself - GetEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); - world->GetPlayer(player).DecreaseInventoryJob(Job::Helper, 1); + getEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); + world->getPlayer(player).DecreaseInventoryJob(Job::Helper, 1); } void nofWarehouseWorker::AbrogateWorkplace() diff --git a/libs/s25main/figures/nofWarehouseWorker.h b/libs/s25main/figures/nofWarehouseWorker.h index dfc7dc6baa..2286a57e4b 100644 --- a/libs/s25main/figures/nofWarehouseWorker.h +++ b/libs/s25main/figures/nofWarehouseWorker.h @@ -45,7 +45,7 @@ class nofWarehouseWorker : public noFigure void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofWarehouseworker; } + GO_Type getGOT() const final { return GO_Type::NofWarehouseworker; } void Draw(DrawPoint drawPt) override; diff --git a/libs/s25main/figures/nofWellguy.cpp b/libs/s25main/figures/nofWellguy.cpp index af76f1f6bd..0e0d386bdf 100644 --- a/libs/s25main/figures/nofWellguy.cpp +++ b/libs/s25main/figures/nofWellguy.cpp @@ -46,8 +46,8 @@ void nofWellguy::DrawWorking(DrawPoint drawPt) unsigned max_id = 112; unsigned now_id = GAMECLIENT.Interpolate(max_id, current_ev); - const Nation wpNation = workplace->GetNation(); - unsigned plColor = world->GetPlayer(player).color; + const Nation wpNation = workplace->getNation(); + unsigned plColor = world->getPlayer(player).color; // position zum rauslaufen berechnen DrawPoint walkOutPos = drawPt + walkoffsets[wpNation][now_id % 8]; @@ -73,17 +73,17 @@ void nofWellguy::DrawWorking(DrawPoint drawPt) } else if(now_id < 16) // eimer runter lassen { if(now_id == 8) - LOADER.GetPlayerImage("rom_bobs", 346)->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); + LOADER.getPlayerImage("rom_bobs", 346)->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); else - LOADER.GetPlayerImage("rom_bobs", 346 + (now_id % 8) - 1) + LOADER.getPlayerImage("rom_bobs", 346 + (now_id % 8) - 1) ->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); } else if(now_id < max_id - 16) // kurbeln { - LOADER.GetPlayerImage("rom_bobs", 330 + (now_id % 8)) + LOADER.getPlayerImage("rom_bobs", 330 + (now_id % 8)) ->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); } else if(now_id < max_id - 8) // eimer rauf kurbeln { - LOADER.GetPlayerImage("rom_bobs", 338 + (now_id % 8)) + LOADER.getPlayerImage("rom_bobs", 338 + (now_id % 8)) ->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); } else if(now_id < max_id - 4) // laufen 3 { @@ -105,7 +105,7 @@ void nofWellguy::DrawWorking(DrawPoint drawPt) if((now_id >= 8) && (now_id < max_id - 8) && now_id % 8 == 4) { - world->GetSoundMgr().playNOSound(82, *this, now_id); + world->getSoundMgr().playNOSound(82, *this, now_id); was_sounding = true; } } @@ -132,7 +132,7 @@ bool nofWellguy::StartWorking() workplace->OnOutOfResources(); return false; } - if(world->GetGGS().getSelection(AddonId::EXHAUSTIBLE_WATER) == 2) + if(world->getGGS().getSelection(AddonId::EXHAUSTIBLE_WATER) == 2) world->ReduceResource(resPt); return nofWorkman::StartWorking(); } diff --git a/libs/s25main/figures/nofWellguy.h b/libs/s25main/figures/nofWellguy.h index 69543d20d7..8a48bd92fa 100644 --- a/libs/s25main/figures/nofWellguy.h +++ b/libs/s25main/figures/nofWellguy.h @@ -18,7 +18,7 @@ class nofWellguy : public nofWorkman /// Zeichnet ihn beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override { return CARRY_ID_CARRIER_OFFSET + rttr::enum_cast(GoodType::Water); } + unsigned short getCarryID() const override { return CARRY_ID_CARRIER_OFFSET + rttr::enum_cast(GoodType::Water); } /// Der Arbeiter erzeugt eine Ware helpers::OptionalEnum ProduceWare() override; @@ -29,5 +29,5 @@ class nofWellguy : public nofWorkman nofWellguy(MapPoint pos, unsigned char player, nobUsual* workplace); nofWellguy(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofWellguy; } + GO_Type getGOT() const final { return GO_Type::NofWellguy; } }; diff --git a/libs/s25main/figures/nofWinegrower.cpp b/libs/s25main/figures/nofWinegrower.cpp index a2700cc51e..bfe32818f5 100644 --- a/libs/s25main/figures/nofWinegrower.cpp +++ b/libs/s25main/figures/nofWinegrower.cpp @@ -38,8 +38,8 @@ void nofWinegrower::DrawWorking(DrawPoint drawPt) if(harvest) { const unsigned now_id = GAMECLIENT.Interpolate(44, current_ev); - LOADER.GetPlayerImage("wine_bobs", bobIndex[BobTypes::WINEGROWER_PICKING_GRAPES_ANIMATION] + now_id % 4) - ->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("wine_bobs", bobIndex[BobTypes::WINEGROWER_PICKING_GRAPES_ANIMATION] + now_id % 4) + ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } else { const unsigned now_id = GAMECLIENT.Interpolate(3 * 16 + 8 * 4, current_ev); @@ -51,13 +51,13 @@ void nofWinegrower::DrawWorking(DrawPoint drawPt) // Shovel-Sound if(now_id % 16 == 5) { - world->GetSoundMgr().playNOSound(76, *this, now_id, 200); + world->getSoundMgr().playNOSound(76, *this, now_id, 200); was_sounding = true; } } else draw_id = bobIndex[BobTypes::WINEGROWER_PLANTING_ANIMATION] + now_id % 4; - LOADER.GetPlayerImage("wine_bobs", draw_id)->DrawFull(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("wine_bobs", draw_id)->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } } @@ -66,7 +66,7 @@ void nofWinegrower::DrawWorking(DrawPoint drawPt) # pragma warning(disable : 4646) // function declared with [[noreturn]] has non-void return type #endif -unsigned short nofWinegrower::GetCarryID() const +unsigned short nofWinegrower::getCarryID() const { throw std::logic_error("Must not be called. Handled by custom DrawWalkingWithWare"); } @@ -79,7 +79,7 @@ void nofWinegrower::WorkStarted() { // Inform grapefield to not disappear during harvesting if(harvest) - world->GetSpecObj(pos)->BeginHarvesting(); + world->getSpecObj(pos)->BeginHarvesting(); } void nofWinegrower::WorkFinished() @@ -88,31 +88,31 @@ void nofWinegrower::WorkFinished() { // Destroy grapefield, and take before the ID of the harvested grapefield, which will be set as normal // ornamental object - noBase* nob = world->GetNO(pos); + noBase* nob = world->getNO(pos); // Check if there is still a grapes field at this position - if(nob->GetGOT() != GO_Type::Grapefield) + if(nob->getGOT() != GO_Type::Grapefield) return; - const unsigned wine_bobs = static_cast(nob)->GetHarvestID(); + const unsigned wine_bobs = static_cast(nob)->getHarvestID(); world->DestroyNO(pos); - world->SetNO(pos, new noEnvObject(pos, wine_bobs, 7)); + world->setNO(pos, new noEnvObject(pos, wine_bobs, 7)); // Take harvested grapes into hands ware = GoodType::Grapes; } else { // If the point got bad (e.g. something was build), abort work - if(GetPointQuality(pos) == PointQuality::NotPossible) + if(getPointQuality(pos) == PointQuality::NotPossible) return; // What is currently here - const NodalObjectType noType = world->GetNO(pos)->GetType(); + const NodalObjectType noType = world->getNO(pos)->getType(); // Only demolish ornamental objects and signs if(noType == NodalObjectType::Environment || noType == NodalObjectType::Nothing) { world->DestroyNO(pos, false); // place new grapefield - world->SetNO(pos, new noGrapefield(pos)); + world->setNO(pos, new noGrapefield(pos)); } // We have only planted (take nothing into hand) @@ -123,12 +123,12 @@ void nofWinegrower::WorkFinished() world->RecalcBQAroundPoint(pos); } -nofFarmhand::PointQuality nofWinegrower::GetPointQuality(const MapPoint pt, const bool isBeforeWork) const +nofFarmhand::PointQuality nofWinegrower::getPointQuality(const MapPoint pt, const bool isBeforeWork) const { // Either a grapefield exists we can harvest... - if(world->GetNO(pt)->GetType() == NodalObjectType::Grapefield) + if(world->getNO(pt)->getType() == NodalObjectType::Grapefield) { - if(world->GetSpecObj(pt)->IsHarvestable()) + if(world->getSpecObj(pt)->isHarvestable()) return PointQuality::Class1; else return PointQuality::NotPossible; @@ -142,23 +142,23 @@ nofFarmhand::PointQuality nofWinegrower::GetPointQuality(const MapPoint pt, cons // Do not build on road for(const auto dir : helpers::EnumRange{}) { - if(world->GetPointRoad(pt, dir) != PointRoad::None) + if(world->getPointRoad(pt, dir) != PointRoad::None) return PointQuality::NotPossible; } // Investigate terrain - if(!world->IsOfTerrain(pt, [](const auto& desc) { return desc.IsVital(); })) + if(!world->isOfTerrain(pt, [](const auto& desc) { return desc.isVital(); })) return PointQuality::NotPossible; // Is space free? - NodalObjectType noType = world->GetNO(pt)->GetType(); + NodalObjectType noType = world->getNO(pt)->getType(); if(noType != NodalObjectType::Environment && noType != NodalObjectType::Nothing) return PointQuality::NotPossible; - for(const MapPoint nb : world->GetNeighbours(pt)) + for(const MapPoint nb : world->getNeighbours(pt)) { // Do not build near to other grapefields and buildings! - noType = world->GetNO(nb)->GetType(); + noType = world->getNO(nb)->getType(); if(noType == NodalObjectType::Grapefield || noType == NodalObjectType::Grainfield || noType == NodalObjectType::Building || noType == NodalObjectType::Buildingsite) return PointQuality::NotPossible; @@ -173,13 +173,13 @@ void nofWinegrower::WorkAborted() nofFarmhand::WorkAborted(); // inform the grapefield, so it can wither, when we harvest it if(harvest && state == State::Work) - world->GetSpecObj(pos)->AbortHarvesting(); + world->getSpecObj(pos)->AbortHarvesting(); } void nofWinegrower::WalkingStarted() { // When walking to a grapefield, harvest it or plant a new one - harvest = (world->GetNO(dest)->GetType() == NodalObjectType::Grapefield); + harvest = (world->getNO(dest)->getType() == NodalObjectType::Grapefield); if(!harvest) workplace->ConsumeWares(); diff --git a/libs/s25main/figures/nofWinegrower.h b/libs/s25main/figures/nofWinegrower.h index 167d97fcdc..6ad95ed7cf 100644 --- a/libs/s25main/figures/nofWinegrower.h +++ b/libs/s25main/figures/nofWinegrower.h @@ -18,7 +18,7 @@ class nofWinegrower : public nofFarmhand /// Draw worker at work void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - [[noreturn]] unsigned short GetCarryID() const override; + [[noreturn]] unsigned short getCarryID() const override; /// Inform derived class, when working starts (preparing) void WorkStarted() override; @@ -28,8 +28,8 @@ class nofWinegrower : public nofFarmhand void WorkAborted() override; /// Returns the quality of this working point or determines if the worker can work here at all - PointQuality GetPointQuality(MapPoint pt, bool isBeforeWork) const override; - using nofFarmhand::GetPointQuality; + PointQuality getPointQuality(MapPoint pt, bool isBeforeWork) const override; + using nofFarmhand::getPointQuality; /// Inform derived class about the start of the whole working process (at the beginning when walking out of the /// house) @@ -48,5 +48,5 @@ class nofWinegrower : public nofFarmhand void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::NofWinegrower; } + GO_Type getGOT() const final { return GO_Type::NofWinegrower; } }; diff --git a/libs/s25main/figures/nofWoodcutter.cpp b/libs/s25main/figures/nofWoodcutter.cpp index 2d4adf4c04..540ec5e1f3 100644 --- a/libs/s25main/figures/nofWoodcutter.cpp +++ b/libs/s25main/figures/nofWoodcutter.cpp @@ -27,45 +27,45 @@ void nofWoodcutter::DrawWorking(DrawPoint drawPt) if(nowId < 10) { // 1. Ein Stück vom Baum nach links laufen - LOADER.getBobSprite(world->GetPlayer(player).nation, Job::Woodcutter, Direction::West, nowId % 8) - .draw(drawPt - DrawPoint(nowId, 0), COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getBobSprite(world->getPlayer(player).nation, Job::Woodcutter, Direction::West, nowId % 8) + .draw(drawPt - DrawPoint(nowId, 0), COLOR_WHITE, world->getPlayer(player).color); } else if(nowId < 82) { // 2. Hacken - LOADER.GetPlayerImage("rom_bobs", 24 + (nowId - 10) % 8) - ->DrawFull(drawPt - DrawPoint(9, 0), COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 24 + (nowId - 10) % 8) + ->DrawFull(drawPt - DrawPoint(9, 0), COLOR_WHITE, world->getPlayer(player).color); if((nowId - 10) % 8 == 3) { - world->GetSoundMgr().playNOSound(53, *this, nowId); + world->getSoundMgr().playNOSound(53, *this, nowId); was_sounding = true; } } else if(nowId < 105) { // 3. Warten bis Baum umfällt - LOADER.GetPlayerImage("rom_bobs", 24) - ->DrawFull(drawPt - DrawPoint(9, 0), COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 24) + ->DrawFull(drawPt - DrawPoint(9, 0), COLOR_WHITE, world->getPlayer(player).color); if(nowId == 90) { - world->GetSoundMgr().playNOSound(85, *this, nowId); + world->getSoundMgr().playNOSound(85, *this, nowId); was_sounding = true; } } else if(nowId < 115) { // 4. Wieder zurückgehen nach rechts - LOADER.getBobSprite(world->GetPlayer(player).nation, Job::Woodcutter, Direction::East, (nowId - 105) % 8) - .draw(drawPt - DrawPoint(9 - (nowId - 105), 0), COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getBobSprite(world->getPlayer(player).nation, Job::Woodcutter, Direction::East, (nowId - 105) % 8) + .draw(drawPt - DrawPoint(9 - (nowId - 105), 0), COLOR_WHITE, world->getPlayer(player).color); } else { // 5. kurz am Baum warten (quasi Baumstamm in die Hand nehmen) - LOADER.getBobSprite(world->GetPlayer(player).nation, Job::Woodcutter, Direction::East, 1) - .draw(drawPt, COLOR_WHITE, world->GetPlayer(player).color); + LOADER.getBobSprite(world->getPlayer(player).nation, Job::Woodcutter, Direction::East, 1) + .draw(drawPt, COLOR_WHITE, world->getPlayer(player).color); } } -unsigned short nofWoodcutter::GetCarryID() const +unsigned short nofWoodcutter::getCarryID() const { return 61; } @@ -73,9 +73,9 @@ unsigned short nofWoodcutter::GetCarryID() const /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) void nofWoodcutter::WorkStarted() { - RTTR_Assert(world->GetSpecObj(dest)->GetType() == NodalObjectType::Tree); + RTTR_Assert(world->getSpecObj(dest)->getType() == NodalObjectType::Tree); - world->GetSpecObj(dest)->FallSoon(); + world->getSpecObj(dest)->FallSoon(); } /// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten @@ -86,14 +86,14 @@ void nofWoodcutter::WorkFinished() } /// Returns the quality of this working point or determines if the worker can work here at all -nofFarmhand::PointQuality nofWoodcutter::GetPointQuality(const MapPoint pt, bool /* isBeforeWork */) const +nofFarmhand::PointQuality nofWoodcutter::getPointQuality(const MapPoint pt, bool /* isBeforeWork */) const { // Gibt es hier an dieser Position einen Baum und ist dieser ausgewachsen? // außerdem keine Ananas fällen! - const noBase* no = world->GetNO(pt); - if(no->GetType() == NodalObjectType::Tree) + const noBase* no = world->getNO(pt); + if(no->getType() == NodalObjectType::Tree) { - if(static_cast(no)->IsFullyGrown() && static_cast(no)->ProducesWood()) + if(static_cast(no)->isFullyGrown() && static_cast(no)->ProducesWood()) return PointQuality::Class1; } @@ -105,5 +105,5 @@ void nofWoodcutter::WorkAborted() nofFarmhand::WorkAborted(); // Dem Baum Bescheid sagen if(state == State::Work) - world->GetSpecObj(pos)->DontFall(); + world->getSpecObj(pos)->DontFall(); } diff --git a/libs/s25main/figures/nofWoodcutter.h b/libs/s25main/figures/nofWoodcutter.h index 9549303985..1e9ef08e56 100644 --- a/libs/s25main/figures/nofWoodcutter.h +++ b/libs/s25main/figures/nofWoodcutter.h @@ -14,7 +14,7 @@ class nofWoodcutter : public nofFarmhand /// Malt den Arbeiter beim Arbeiten void DrawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware - unsigned short GetCarryID() const override; + unsigned short getCarryID() const override; /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) void WorkStarted() override; @@ -22,7 +22,7 @@ class nofWoodcutter : public nofFarmhand void WorkFinished() override; /// Returns the quality of this working point or determines if the worker can work here at all - PointQuality GetPointQuality(MapPoint pt, bool isBeforeWork) const override; + PointQuality getPointQuality(MapPoint pt, bool isBeforeWork) const override; /// wird aufgerufen, wenn die Arbeit abgebrochen wird (von nofBuildingWorker aufgerufen) void WorkAborted() override; @@ -31,5 +31,5 @@ class nofWoodcutter : public nofFarmhand nofWoodcutter(MapPoint pos, unsigned char player, nobUsual* workplace); nofWoodcutter(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::NofWoodcutter; } + GO_Type getGOT() const final { return GO_Type::NofWoodcutter; } }; diff --git a/libs/s25main/figures/nofWorkman.cpp b/libs/s25main/figures/nofWorkman.cpp index 1def798a94..9e0370a781 100644 --- a/libs/s25main/figures/nofWorkman.cpp +++ b/libs/s25main/figures/nofWorkman.cpp @@ -28,7 +28,7 @@ void nofWorkman::HandleDerivedEvent(const unsigned /*id*/) bool nofWorkman::StartWorking() { - current_ev = GetEvMgr().AddEvent(this, JOB_CONSTS[job_].work_length, 1); + current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].work_length, 1); state = State::Work; workplace->is_working = true; // Waren verbrauchen @@ -69,7 +69,7 @@ void nofWorkman::HandleStateWork() { // Nach Arbeiten wird noch ein bisschen gewartet, bevor das Produkt herausgetragen wird // Bei 0 mind. 1 GF - current_ev = GetEvMgr().AddEvent(this, JOB_CONSTS[job_].wait2_length ? JOB_CONSTS[job_].wait2_length : 1, 1); + current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].wait2_length ? JOB_CONSTS[job_].wait2_length : 1, 1); state = State::Waiting2; // wir arbeiten nicht mehr workplace->is_working = false; @@ -77,7 +77,7 @@ void nofWorkman::HandleStateWork() // Evtl. Sounds löschen if(was_sounding) { - world->GetSoundMgr().stopSounds(*this); + world->getSoundMgr().stopSounds(*this); was_sounding = false; } } @@ -89,7 +89,7 @@ struct NodeHasResource const ResourceType res; NodeHasResource(const GameWorld& world, const ResourceType res) : world(world), res(res) {} - bool operator()(const MapPoint pt) { return world.GetNode(pt).resources.has(res); } + bool operator()(const MapPoint pt) { return world.getNode(pt).resources.has(res); } }; } // namespace diff --git a/libs/s25main/gameData/BuildingProperties.cpp b/libs/s25main/gameData/BuildingProperties.cpp index 6a35a26a1d..ec3fbb8f23 100644 --- a/libs/s25main/gameData/BuildingProperties.cpp +++ b/libs/s25main/gameData/BuildingProperties.cpp @@ -10,7 +10,7 @@ const std::array BuildingProperties::militaryBldTypes = []() { unsigned cur = 0; for(const auto bld : helpers::enumRange()) { - if(BuildingProperties::IsMilitary(bld)) + if(BuildingProperties::isMilitary(bld)) result[cur++] = bld; } if(cur != result.size()) @@ -18,7 +18,7 @@ const std::array BuildingProperties::militaryBldTypes = []() { return result; }(); -bool BuildingProperties::IsMilitary(BuildingType bld) +bool BuildingProperties::isMilitary(BuildingType bld) { switch(bld) { @@ -30,7 +30,7 @@ bool BuildingProperties::IsMilitary(BuildingType bld) } } -bool BuildingProperties::IsMine(BuildingType bld) +bool BuildingProperties::isMine(BuildingType bld) { switch(bld) { @@ -42,7 +42,7 @@ bool BuildingProperties::IsMine(BuildingType bld) } } -bool BuildingProperties::IsWareHouse(BuildingType bld) +bool BuildingProperties::isWareHouse(BuildingType bld) { switch(bld) { @@ -53,12 +53,12 @@ bool BuildingProperties::IsWareHouse(BuildingType bld) } } -bool BuildingProperties::IsUsual(BuildingType bld) +bool BuildingProperties::isUsual(BuildingType bld) { - return IsValid(bld) && !IsMilitary(bld) && !IsWareHouse(bld); + return isValid(bld) && !isMilitary(bld) && !isWareHouse(bld); } -bool BuildingProperties::IsValid(BuildingType bld) +bool BuildingProperties::isValid(BuildingType bld) { switch(bld) { diff --git a/libs/s25main/gameData/BuildingProperties.h b/libs/s25main/gameData/BuildingProperties.h index 4c0081d6e7..be457d41f8 100644 --- a/libs/s25main/gameData/BuildingProperties.h +++ b/libs/s25main/gameData/BuildingProperties.h @@ -18,13 +18,13 @@ class BuildingProperties static const std::array militaryBldTypes; /// True iff the building type is used (not nothing) - static bool IsValid(BuildingType bld); + static bool isValid(BuildingType bld); /// True iff this is a regular military building - static bool IsMilitary(BuildingType bld); + static bool isMilitary(BuildingType bld); /// True iff this is a mine - static bool IsMine(BuildingType bld); + static bool isMine(BuildingType bld); /// True iff wares can be stored in this building - static bool IsWareHouse(BuildingType bld); + static bool isWareHouse(BuildingType bld); /// True iff this is a "usual" building, i.e. production. - static bool IsUsual(BuildingType bld); + static bool isUsual(BuildingType bld); }; diff --git a/libs/s25main/gameData/GameLoader.cpp b/libs/s25main/gameData/GameLoader.cpp index cf005f22b0..f79cd1d075 100644 --- a/libs/s25main/gameData/GameLoader.cpp +++ b/libs/s25main/gameData/GameLoader.cpp @@ -21,8 +21,8 @@ void GameLoader::initNations() { // Use set to filter duplicates std::set tmpUsedNations; - for(unsigned i = 0; i < game->world_.GetNumPlayers(); ++i) - tmpUsedNations.insert(game->world_.GetPlayer(i).nation); + for(unsigned i = 0; i < game->world_.getNumPlayers(); ++i) + tmpUsedNations.insert(game->world_.getPlayer(i).nation); usedNations.assign(tmpUsedNations.begin(), tmpUsedNations.end()); } @@ -30,9 +30,9 @@ void GameLoader::initTextures() { textures.clear(); std::set> usedTerrains; - RTTR_FOREACH_PT(MapPoint, game->world_.GetSize()) + RTTR_FOREACH_PT(MapPoint, game->world_.getSize()) { - const MapNode& node = game->world_.GetNode(pt); + const MapNode& node = game->world_.getNode(pt); usedTerrains.insert(node.t1); usedTerrains.insert(node.t2); } @@ -41,7 +41,7 @@ void GameLoader::initTextures() for(DescIdx tIdx : usedTerrains) { - const TerrainDesc& t = game->world_.GetDescription().get(tIdx); + const TerrainDesc& t = game->world_.getDescription().get(tIdx); if(!helpers::contains(textures, t.texturePath)) textures.push_back(t.texturePath); usedEdges.insert(t.edgeType); @@ -51,13 +51,13 @@ void GameLoader::initTextures() { if(!eIdx) continue; - const EdgeDesc& e = game->world_.GetDescription().get(eIdx); + const EdgeDesc& e = game->world_.getDescription().get(eIdx); if(!helpers::contains(textures, e.texturePath)) textures.push_back(e.texturePath); } for(DescIdx lIdx : usedLandscapes) { - const LandscapeDesc& e = game->world_.GetDescription().get(lIdx); + const LandscapeDesc& e = game->world_.getDescription().get(lIdx); for(const RoadTextureDesc& r : e.roadTexDesc) { if(!helpers::contains(textures, r.texturePath)) @@ -75,7 +75,7 @@ bool GameLoader::loadTextures() enabledAddons.push_back(id); } - const LandscapeDesc& lt = game->world_.GetDescription().get(game->world_.GetLandscapeType()); + const LandscapeDesc& lt = game->world_.getDescription().get(game->world_.GetLandscapeType()); if(!loader.LoadFilesAtGame(lt.mapGfxPath, lt.isWinter, usedNations, enabledAddons) || !loader.LoadFiles(textures)) return false; diff --git a/libs/s25main/gameData/SettingTypeConv.cpp b/libs/s25main/gameData/SettingTypeConv.cpp index 9440b5f322..6d3df6e149 100644 --- a/libs/s25main/gameData/SettingTypeConv.cpp +++ b/libs/s25main/gameData/SettingTypeConv.cpp @@ -14,7 +14,7 @@ const TransportPriorities STD_TRANSPORT_PRIO = {{2, 13, 13, 13, 13, 13, 13, 13, 13, 14, 1, 3, 12, 12, 12, 1, 10, 8, 9, 1, 1, 12, 0, 4, 5, 6, 12, 12, 1, 12, 12, 7, 7, 1}}; -unsigned GetTransportPrioFromOrdering(const TransportOrders& ordering, GoodType good) +unsigned getTransportPrioFromOrdering(const TransportOrders& ordering, GoodType good) { // The priority is the index into the ordering -> 0 = highest, first entry for(unsigned prio = 0; prio < ordering.size(); ++prio) @@ -28,7 +28,7 @@ unsigned GetTransportPrioFromOrdering(const TransportOrders& ordering, GoodType throw std::logic_error("Invalid ordering or ware"); } -TransportOrders GetOrderingFromTransportPrio(const TransportPriorities& priorities) +TransportOrders getOrderingFromTransportPrio(const TransportPriorities& priorities) { TransportOrders result; // Map prio of each ware to STD prio diff --git a/libs/s25main/gameData/SettingTypeConv.h b/libs/s25main/gameData/SettingTypeConv.h index 59de6606d6..39b194ce67 100644 --- a/libs/s25main/gameData/SettingTypeConv.h +++ b/libs/s25main/gameData/SettingTypeConv.h @@ -14,6 +14,6 @@ extern const MilitarySettings MILITARY_SETTINGS_SCALE; extern const TransportPriorities STD_TRANSPORT_PRIO; /// Get the priority of a given good from the ordering of goods (good categories) -unsigned GetTransportPrioFromOrdering(const TransportOrders& ordering, GoodType good); +unsigned getTransportPrioFromOrdering(const TransportOrders& ordering, GoodType good); /// Converts the transport priorities to an odering of goods (good categories) -TransportOrders GetOrderingFromTransportPrio(const TransportPriorities& priorities); +TransportOrders getOrderingFromTransportPrio(const TransportPriorities& priorities); diff --git a/libs/s25main/gameTypes/InventorySetting.h b/libs/s25main/gameTypes/InventorySetting.h index 51e095899b..69a07c0bff 100644 --- a/libs/s25main/gameTypes/InventorySetting.h +++ b/libs/s25main/gameTypes/InventorySetting.h @@ -19,7 +19,7 @@ struct InventorySetting constexpr InventorySetting() noexcept = default; constexpr InventorySetting(const EInventorySetting setting) noexcept : state(MakeBitField(setting)) {} constexpr explicit InventorySetting(uint8_t state) noexcept : state(state) { MakeValid(); } - constexpr bool IsSet(EInventorySetting setting) const noexcept; + constexpr bool isSet(EInventorySetting setting) const noexcept; constexpr InventorySetting Toggle(EInventorySetting setting) noexcept; constexpr void MakeValid() noexcept; constexpr explicit operator uint8_t() const noexcept { return state; } @@ -35,7 +35,7 @@ struct InventorySetting // Implementation ////////////////////////////////////////////////////////////////////////// -constexpr bool InventorySetting::IsSet(const EInventorySetting setting) const noexcept +constexpr bool InventorySetting::isSet(const EInventorySetting setting) const noexcept { return (state & MakeBitField(setting)) != 0; } diff --git a/libs/s25main/gameTypes/MapNode.cpp b/libs/s25main/gameTypes/MapNode.cpp index 2763dd2328..178eb5df19 100644 --- a/libs/s25main/gameTypes/MapNode.cpp +++ b/libs/s25main/gameTypes/MapNode.cpp @@ -45,7 +45,7 @@ void MapNode::Deserialize(SerializedGameData& sgd, const unsigned numPlayers, co altitude = sgd.PopUnsignedChar(); shadow = sgd.PopUnsignedChar(); - if(sgd.GetGameDataVersion() < 3) + if(sgd.getGameDataVersion() < 3) { // TODO: Remove this and lt param t1 = landscapeTerrains[sgd.PopUnsignedChar()]; @@ -65,7 +65,7 @@ void MapNode::Deserialize(SerializedGameData& sgd, const unsigned numPlayers, co reserved = sgd.PopBool(); owner = sgd.PopUnsignedChar(); helpers::popContainer(sgd, boundary_stones); - if(sgd.GetGameDataVersion() < 9) + if(sgd.getGameDataVersion() < 9) bq = sgd.Pop(); RTTR_Assert(numPlayers <= fow.size()); for(unsigned z = 0; z < numPlayers; ++z) diff --git a/libs/s25main/gameTypes/MineResourceBehavior.cpp b/libs/s25main/gameTypes/MineResourceBehavior.cpp index f2ea65b182..68e1767f1e 100644 --- a/libs/s25main/gameTypes/MineResourceBehavior.cpp +++ b/libs/s25main/gameTypes/MineResourceBehavior.cpp @@ -20,7 +20,7 @@ constexpr unsigned MAX_PRODUCTION_PERCENT = 100; constexpr unsigned S4LIKE_FULL_PRODUCTIVITY_RESOURCE_AMOUNT = 20; } // namespace -AddonId GetMineResourceBehaviorAddonId(const BuildingType buildingType) +AddonId getMineResourceBehaviorAddonId(const BuildingType buildingType) { switch(buildingType) { @@ -31,7 +31,7 @@ AddonId GetMineResourceBehaviorAddonId(const BuildingType buildingType) } } -ResourceType GetMineResourceType(const BuildingType buildingType) +ResourceType getMineResourceType(const BuildingType buildingType) { switch(buildingType) { @@ -42,7 +42,7 @@ ResourceType GetMineResourceType(const BuildingType buildingType) } } -GoodType GetMineOutput(const BuildingType buildingType) +GoodType getMineOutput(const BuildingType buildingType) { switch(buildingType) { @@ -65,34 +65,34 @@ helpers::OptionalEnum GetMineBuildingType(const ResourceType resou } } -unsigned GetRemainingMineResources(const GameWorld& world, const MapPoint pos, const ResourceType resourceType) +unsigned getRemainingMineResources(const GameWorld& world, const MapPoint pos, const ResourceType resourceType) { unsigned resourceAmount = 0; const auto resourcePts = world.GetMatchingPointsInRadius( pos, MINER_RADIUS, - [&world, resourceType](const MapPoint pt) { return world.GetNode(pt).resources.has(resourceType); }, true); + [&world, resourceType](const MapPoint pt) { return world.getNode(pt).resources.has(resourceType); }, true); for(const MapPoint pt : resourcePts) - resourceAmount += world.GetNode(pt).resources.getAmount(); + resourceAmount += world.getNode(pt).resources.getAmount(); return resourceAmount; } -unsigned GetS4LikeMineProductionChance(const unsigned remainingMatchingResources) +unsigned getS4LikeMineProductionChance(const unsigned remainingMatchingResources) { const unsigned chancePercent = remainingMatchingResources * MAX_PRODUCTION_PERCENT / S4LIKE_FULL_PRODUCTIVITY_RESOURCE_AMOUNT; return std::min(MAX_PRODUCTION_PERCENT, chancePercent); } -MineResourceBehavior GetMineResourceBehavior(const GlobalGameSettings& settings, const BuildingType buildingType) +MineResourceBehavior getMineResourceBehavior(const GlobalGameSettings& settings, const BuildingType buildingType) { - const unsigned selection = settings.getSelection(GetMineResourceBehaviorAddonId(buildingType)); + const unsigned selection = settings.getSelection(getMineResourceBehaviorAddonId(buildingType)); if(!helpers::isValidEnumValue(selection)) return MineResourceBehavior::Default; return static_cast(selection); } -bool IsMineResourceDepletable(const GlobalGameSettings& settings, const BuildingType buildingType) +bool isMineResourceDepletable(const GlobalGameSettings& settings, const BuildingType buildingType) { - const MineResourceBehavior behavior = GetMineResourceBehavior(settings, buildingType); + const MineResourceBehavior behavior = getMineResourceBehavior(settings, buildingType); return behavior == MineResourceBehavior::Default || behavior == MineResourceBehavior::S4LikeExhaustion; } diff --git a/libs/s25main/gameTypes/MineResourceBehavior.h b/libs/s25main/gameTypes/MineResourceBehavior.h index cf2193664a..1b660bd5c1 100644 --- a/libs/s25main/gameTypes/MineResourceBehavior.h +++ b/libs/s25main/gameTypes/MineResourceBehavior.h @@ -27,12 +27,12 @@ constexpr auto maxEnumValue(MineResourceBehavior) return MineResourceBehavior::WorkEverywhere; } -AddonId GetMineResourceBehaviorAddonId(BuildingType buildingType); -ResourceType GetMineResourceType(BuildingType buildingType); +AddonId getMineResourceBehaviorAddonId(BuildingType buildingType); +ResourceType getMineResourceType(BuildingType buildingType); /// The ware a mine of the given type produces (granite/stones for any non-mineral mine) -GoodType GetMineOutput(BuildingType buildingType); +GoodType getMineOutput(BuildingType buildingType); helpers::OptionalEnum GetMineBuildingType(ResourceType resourceType); -unsigned GetRemainingMineResources(const GameWorld& world, MapPoint pos, ResourceType resourceType); -unsigned GetS4LikeMineProductionChance(unsigned remainingMatchingResources); -MineResourceBehavior GetMineResourceBehavior(const GlobalGameSettings& settings, BuildingType buildingType); -bool IsMineResourceDepletable(const GlobalGameSettings& settings, BuildingType buildingType); +unsigned getRemainingMineResources(const GameWorld& world, MapPoint pos, ResourceType resourceType); +unsigned getS4LikeMineProductionChance(unsigned remainingMatchingResources); +MineResourceBehavior getMineResourceBehavior(const GlobalGameSettings& settings, BuildingType buildingType); +bool isMineResourceDepletable(const GlobalGameSettings& settings, BuildingType buildingType); diff --git a/libs/s25main/ingameWindows/IngameWindow.cpp b/libs/s25main/ingameWindows/IngameWindow.cpp index d441341f27..312c20349f 100644 --- a/libs/s25main/ingameWindows/IngameWindow.cpp +++ b/libs/s25main/ingameWindows/IngameWindow.cpp @@ -40,18 +40,18 @@ IngameWindow::IngameWindow(unsigned id, const DrawPoint& pos, const Extent& size isMoving(false) { std::fill(buttonStates_.begin(), buttonStates_.end(), ButtonState::Up); - contentOffset.x = LOADER.GetImageN("resource", 38)->getWidth(); // left border - contentOffset.y = LOADER.GetImageN("resource", 42)->getHeight(); // title bar - contentOffsetEnd.x = LOADER.GetImageN("resource", 39)->getWidth(); // right border - contentOffsetEnd.y = LOADER.GetImageN("resource", 40)->getHeight(); // bottom bar + contentOffset.x = LOADER.getImageN("resource", 38)->getWidth(); // left border + contentOffset.y = LOADER.getImageN("resource", 42)->getHeight(); // title bar + contentOffsetEnd.x = LOADER.getImageN("resource", 39)->getWidth(); // right border + contentOffsetEnd.y = LOADER.getImageN("resource", 40)->getHeight(); // bottom bar - const auto it = SETTINGS.windows.persistentSettings.find(GetGUIID()); + const auto it = SETTINGS.windows.persistentSettings.find(getGUIID()); windowSettings_ = (it == SETTINGS.windows.persistentSettings.cend() ? nullptr : &it->second); // For compatibility we treat the given height as the window height, not the content height // First we have to make sure the size is not to small - Window::Resize(elMax(contentOffset + contentOffsetEnd, GetSize())); - iwHeight = GetSize().y - contentOffset.y - contentOffsetEnd.y; + Window::Resize(elMax(contentOffset + contentOffsetEnd, getSize())); + iwHeight = getSize().y - contentOffset.y - contentOffsetEnd.y; // Save to settings that window is open SaveOpenStatus(true); @@ -62,7 +62,7 @@ IngameWindow::IngameWindow(unsigned id, const DrawPoint& pos, const Extent& size if(windowSettings_->isMinimized) { isMinimized_ = true; - Extent minimizedSize(GetSize().x, contentOffset.y + contentOffsetEnd.y); + Extent minimizedSize(getSize().x, contentOffset.y + contentOffsetEnd.y); Window::Resize(minimizedSize); } isPinned_ = windowSettings_->isPinned; // Restore pinned state @@ -73,7 +73,7 @@ IngameWindow::IngameWindow(unsigned id, const DrawPoint& pos, const Extent& size if(pos == posLastOrCenter) { if(windowSettings_ && windowSettings_->lastPos.isValid()) - SetPos(windowSettings_->lastPos, !restorePos_.isValid()); + setPos(windowSettings_->lastPos, !restorePos_.isValid()); else MoveToCenter(); } else if(pos == posCenter) @@ -81,20 +81,20 @@ IngameWindow::IngameWindow(unsigned id, const DrawPoint& pos, const Extent& size else if(pos == posAtMouse) MoveNextToMouse(); else - SetPos(pos); // always call SetPos() to update restorePos + setPos(pos); // always call SetPos() to update restorePos } void IngameWindow::Resize(const Extent& newSize) { DrawPoint iSize(newSize); iSize = elMax(DrawPoint(0, 0), iSize - DrawPoint(contentOffset + contentOffsetEnd)); - SetIwSize(Extent(iSize)); + setIwSize(Extent(iSize)); } -void IngameWindow::SetIwSize(const Extent& newSize) +void IngameWindow::setIwSize(const Extent& newSize) { // Is the window connecting with the bottom screen edge? - const auto atBottom = (GetPos().y + GetSize().y) >= VIDEODRIVER.GetRenderSize().y; + const auto atBottom = (getPos().y + getSize().y) >= VIDEODRIVER.getRenderSize().y; iwHeight = newSize.y; Extent wndSize = newSize; @@ -109,43 +109,43 @@ void IngameWindow::SetIwSize(const Extent& newSize) // Reset the position // 1) to check if parts of the window are out of the visible area // 2) to re-connect the window with the bottom screen edge, if needed - SetPos(pos, false); + setPos(pos, false); } -Extent IngameWindow::GetIwSize() const +Extent IngameWindow::getIwSize() const { - return Extent(GetSize().x - contentOffset.x - contentOffsetEnd.x, iwHeight); + return Extent(getSize().x - contentOffset.x - contentOffsetEnd.x, iwHeight); } -Extent IngameWindow::GetFullSize() const +Extent IngameWindow::getFullSize() const { - return Extent(GetSize().x, contentOffset.y + contentOffsetEnd.y + iwHeight); + return Extent(getSize().x, contentOffset.y + contentOffsetEnd.y + iwHeight); } -DrawPoint IngameWindow::GetRightBottomBoundary() +DrawPoint IngameWindow::getRightBottomBoundary() { - return DrawPoint(GetSize() - contentOffsetEnd); + return DrawPoint(getSize() - contentOffsetEnd); } -void IngameWindow::SetPos(DrawPoint newPos, bool saveRestorePos) +void IngameWindow::setPos(DrawPoint newPos, bool saveRestorePos) { - const Extent screenSize = VIDEODRIVER.GetRenderSize(); + const Extent screenSize = VIDEODRIVER.getRenderSize(); DrawPoint newRestorePos = newPos; // Too far left or right? if(newPos.x < 0) newRestorePos.x = newPos.x = 0; - else if(newPos.x + GetSize().x >= screenSize.x) + else if(newPos.x + getSize().x >= screenSize.x) { - newPos.x = screenSize.x - GetSize().x; + newPos.x = screenSize.x - getSize().x; newRestorePos.x = DrawPoint::MaxElementValue; // make window stick to the right } // Too high or low? if(newPos.y < 0) newRestorePos.y = newPos.y = 0; - else if(newPos.y + GetSize().y >= screenSize.y) + else if(newPos.y + getSize().y >= screenSize.y) { - newPos.y = screenSize.y - GetSize().y; + newPos.y = screenSize.y - getSize().y; newRestorePos.y = DrawPoint::MaxElementValue; // make window stick to the bottom } @@ -160,7 +160,7 @@ void IngameWindow::SetPos(DrawPoint newPos, bool saveRestorePos) windowSettings_->restorePos = newRestorePos; } - Window::SetPos(newPos); + Window::setPos(newPos); } void IngameWindow::Close() @@ -169,9 +169,9 @@ void IngameWindow::Close() closeme = true; } -void IngameWindow::SetMinimized(bool minimized) +void IngameWindow::setMinimized(bool minimized) { - Extent fullSize = GetSize(); + Extent fullSize = getSize(); if(isMinimized_) fullSize.y = iwHeight + contentOffset.y + contentOffsetEnd.y; this->isMinimized_ = minimized; @@ -182,7 +182,7 @@ void IngameWindow::SetMinimized(bool minimized) windowSettings_->isMinimized = isMinimized_; } -void IngameWindow::SetPinned(bool pinned) +void IngameWindow::setPinned(bool pinned) { isPinned_ = pinned; @@ -195,7 +195,7 @@ bool IngameWindow::msgLeftDown(const MouseCoords& mc) { for(const auto btn : helpers::enumRange()) { - if(IsPointInRect(mc.pos, GetButtonBounds(btn))) + if(IsPointInRect(mc.pos, getButtonBounds(btn))) { buttonStates_[btn] = ButtonState::Pressed; if(btn == IwButton::Title) @@ -225,7 +225,7 @@ bool IngameWindow::msgLeftUp(const MouseCoords& mc) && (btn == IwButton::Title || btn == IwButton::PinOrMinimize))) continue; - if(IsPointInRect(mc.pos, GetButtonBounds(btn))) + if(IsPointInRect(mc.pos, getButtonBounds(btn))) { switch(btn) { @@ -233,20 +233,20 @@ bool IngameWindow::msgLeftUp(const MouseCoords& mc) case IwButton::Title: if(SETTINGS.interface.enableWindowPinning && mc.dbl_click) { - SetMinimized(!IsMinimized()); - LOADER.GetSoundN("sound", 113)->Play(255, false); + setMinimized(!isMinimized()); + LOADER.getSoundN("sound", 113)->Play(255, false); return true; } break; case IwButton::PinOrMinimize: if(SETTINGS.interface.enableWindowPinning) { - SetPinned(!IsPinned()); - LOADER.GetSoundN("sound", 111)->Play(255, false); + setPinned(!isPinned()); + LOADER.getSoundN("sound", 111)->Play(255, false); } else { - SetMinimized(!IsMinimized()); - LOADER.GetSoundN("sound", 113)->Play(255, false); + setMinimized(!isMinimized()); + LOADER.getSoundN("sound", 113)->Play(255, false); } return true; } @@ -254,7 +254,7 @@ bool IngameWindow::msgLeftUp(const MouseCoords& mc) } // On touch devices dblclick closes window - if(VIDEODRIVER.IsTouch() && mc.dbl_click && closeBehavior_ != CloseBehavior::Custom) + if(VIDEODRIVER.isTouch() && mc.dbl_click && closeBehavior_ != CloseBehavior::Custom) { Close(); return true; @@ -279,8 +279,8 @@ bool IngameWindow::msgMouseMove(const MouseCoords& mc) { // Calculate new window boundary rectangle without snapping DrawPoint delta = mc.pos - lastMousePos; - Rect wndRect = GetBoundaryRect(); - RTTR_Assert(wndRect.getOrigin() == GetPos()); // The rest of the code assumes this to be true + Rect wndRect = getBoundaryRect(); + RTTR_Assert(wndRect.getOrigin() == getPos()); // The rest of the code assumes this to be true wndRect.move(delta - snapOffset_); // Try to snap this window to any other @@ -290,14 +290,14 @@ bool IngameWindow::msgMouseMove(const MouseCoords& mc) // window position to the screen… DrawPoint newPos = wndRect.getOrigin(); DrawPoint newPosBounded = - elMin(elMax(newPos, DrawPoint::all(0)), DrawPoint(VIDEODRIVER.GetRenderSize() - wndRect.getSize())); + elMin(elMax(newPos, DrawPoint::all(0)), DrawPoint(VIDEODRIVER.getRenderSize() - wndRect.getSize())); // …and use it to fix the mouse position if moved too far if(newPosBounded != newPos) - VIDEODRIVER.SetMousePos(newPosBounded - wndRect.getOrigin() + mc.pos); + VIDEODRIVER.setMousePos(newPosBounded - wndRect.getOrigin() + mc.pos); // Set new position and re-calculate snap offset (window position may have been out of bounds) - SetPos(newPos + snapOffset_); - snapOffset_ = GetPos() - newPosBounded; + setPos(newPos + snapOffset_); + snapOffset_ = getPos() - newPosBounded; lastMousePos = mc.pos; return true; @@ -306,7 +306,7 @@ bool IngameWindow::msgMouseMove(const MouseCoords& mc) // Check the buttons for(const auto btn : helpers::enumRange()) { - if(IsPointInRect(mc.pos, GetButtonBounds(btn))) + if(IsPointInRect(mc.pos, getButtonBounds(btn))) { if(!mc.ldown) buttonStates_[btn] = ButtonState::Hover; @@ -320,7 +320,7 @@ bool IngameWindow::msgMouseMove(const MouseCoords& mc) void IngameWindow::Draw_() { if(isModal_ && !IsActive()) - SetActive(true); + setActive(true); if(!isMinimized_) DrawBackground(); // Black border @@ -333,7 +333,7 @@ void IngameWindow::Draw_() // This needs a change in GetDrawPos to add this offset and also change all control-add-calls but would be much // cleaner (no more hard coded offsets and we could restyle the ingame windows easily) // - const Rect drawRect = GetDrawRect(); + const Rect drawRect = getDrawRect(); const Rect fullWndRect(drawRect.getOrigin() - borderSize, drawRect.getSize() + borderSize * 2u); // Top DrawRectangle(Rect(fullWndRect.getOrigin(), fullWndRect.getSize().x, borderSize.y), COLOR_BLACK); @@ -347,10 +347,10 @@ void IngameWindow::Draw_() COLOR_BLACK); // Upper parts - glArchivItem_Bitmap* leftUpperImg = LOADER.GetImageN("resource", 36); - leftUpperImg->DrawFull(GetPos()); - glArchivItem_Bitmap* rightUpperImg = LOADER.GetImageN("resource", 37); - rightUpperImg->DrawFull(GetPos() + DrawPoint(GetSize().x - rightUpperImg->getWidth(), 0)); + glArchivItem_Bitmap* leftUpperImg = LOADER.getImageN("resource", 36); + leftUpperImg->DrawFull(getPos()); + glArchivItem_Bitmap* rightUpperImg = LOADER.getImageN("resource", 37); + rightUpperImg->DrawFull(getPos() + DrawPoint(getSize().x - rightUpperImg->getWidth(), 0)); // The buttons using ButtonStateResIds = helpers::EnumArray; @@ -360,21 +360,21 @@ void IngameWindow::Draw_() constexpr ButtonStateResIds pinOverlayResIds = {15, 16, 17}; constexpr ButtonStateResIds unpinOverlayResIds = {18, 19, 20}; if(closeBehavior_ != CloseBehavior::Custom) - LOADER.GetImageN("resource", closeResIds[buttonStates_[IwButton::Close]]) - ->DrawFull(GetButtonBounds(IwButton::Close)); - if(!IsModal()) + LOADER.getImageN("resource", closeResIds[buttonStates_[IwButton::Close]]) + ->DrawFull(getButtonBounds(IwButton::Close)); + if(!isModal()) { const auto buttonState = buttonStates_[IwButton::PinOrMinimize]; - const auto bounds = GetButtonBounds(IwButton::PinOrMinimize); + const auto bounds = getButtonBounds(IwButton::PinOrMinimize); if(SETTINGS.interface.enableWindowPinning) { - LOADER.GetImageN("resource", pinBaseResIds[buttonState])->DrawFull(bounds); + LOADER.getImageN("resource", pinBaseResIds[buttonState])->DrawFull(bounds); if(isPinned_) - LOADER.GetImageN("io_new", unpinOverlayResIds[buttonState])->DrawFull(bounds); + LOADER.getImageN("io_new", unpinOverlayResIds[buttonState])->DrawFull(bounds); else - LOADER.GetImageN("io_new", pinOverlayResIds[buttonState])->DrawFull(bounds); + LOADER.getImageN("io_new", pinOverlayResIds[buttonState])->DrawFull(bounds); } else - LOADER.GetImageN("resource", minimizeResIds[buttonState])->DrawFull(bounds); + LOADER.getImageN("resource", minimizeResIds[buttonState])->DrawFull(bounds); } // The title bar @@ -384,9 +384,9 @@ void IngameWindow::Draw_() else titleIndex = 42; - glArchivItem_Bitmap& titleImg = *LOADER.GetImageN("resource", titleIndex); - DrawPoint titleImgPos = GetPos() + DrawPoint(leftUpperImg->getWidth(), 0); - const unsigned titleWidth = GetSize().x - leftUpperImg->getWidth() - rightUpperImg->getWidth(); + glArchivItem_Bitmap& titleImg = *LOADER.getImageN("resource", titleIndex); + DrawPoint titleImgPos = getPos() + DrawPoint(leftUpperImg->getWidth(), 0); + const unsigned titleWidth = getSize().x - leftUpperImg->getWidth() - rightUpperImg->getWidth(); // How often should the image be drawn to get the full width unsigned tileCount = titleWidth / titleImg.getWidth(); for(unsigned i = 0; i < tileCount; ++i) @@ -401,22 +401,22 @@ void IngameWindow::Draw_() titleImg.DrawPart(Rect(titleImgPos, remainingTileSize, titleImg.getHeight())); // Text on the title bar - NormalFont->Draw(GetPos() + DrawPoint(GetSize().x, titleImg.getHeight()) / 2, title_, + NormalFont->Draw(getPos() + DrawPoint(getSize().x, titleImg.getHeight()) / 2, title_, FontStyle::CENTER | FontStyle::VCENTER, COLOR_YELLOW); - glArchivItem_Bitmap* bottomBorderSideImg = LOADER.GetImageN("resource", 45); - glArchivItem_Bitmap* bottomBarImg = LOADER.GetImageN("resource", 40); + glArchivItem_Bitmap* bottomBorderSideImg = LOADER.getImageN("resource", 45); + glArchivItem_Bitmap* bottomBarImg = LOADER.getImageN("resource", 40); // Side bars if(!isMinimized_) { - unsigned sideHeight = GetSize().y - leftUpperImg->getHeight() - bottomBorderSideImg->getHeight(); + unsigned sideHeight = getSize().y - leftUpperImg->getHeight() - bottomBorderSideImg->getHeight(); - glArchivItem_Bitmap* leftSideImg = LOADER.GetImageN("resource", 38); - glArchivItem_Bitmap* rightSideImg = LOADER.GetImageN("resource", 39); + glArchivItem_Bitmap* leftSideImg = LOADER.getImageN("resource", 38); + glArchivItem_Bitmap* rightSideImg = LOADER.getImageN("resource", 39); tileCount = sideHeight / leftSideImg->getHeight(); - DrawPoint leftImgPos = GetPos() + DrawPoint(0, leftUpperImg->getHeight()); - DrawPoint rightImgPos = leftImgPos + DrawPoint(GetSize().x - leftSideImg->getWidth(), 0); + DrawPoint leftImgPos = getPos() + DrawPoint(0, leftUpperImg->getHeight()); + DrawPoint rightImgPos = leftImgPos + DrawPoint(getSize().x - leftSideImg->getWidth(), 0); for(unsigned i = 0; i < tileCount; ++i) { leftSideImg->DrawFull(leftImgPos); @@ -434,9 +434,9 @@ void IngameWindow::Draw_() } // Lower bar - const unsigned bottomBarWidth = GetSize().x - bottomBorderSideImg->getWidth() * 2; + const unsigned bottomBarWidth = getSize().x - bottomBorderSideImg->getWidth() * 2; tileCount = bottomBarWidth / bottomBarImg->getWidth(); - DrawPoint bottomImgPos = GetPos() + DrawPoint(bottomBorderSideImg->getWidth(), GetRightBottomBoundary().y); + DrawPoint bottomImgPos = getPos() + DrawPoint(bottomBorderSideImg->getWidth(), getRightBottomBoundary().y); for(unsigned i = 0; i < tileCount; ++i) { bottomBarImg->DrawFull(bottomImgPos); @@ -455,29 +455,29 @@ void IngameWindow::Draw_() } // The 2 rects on the bottom left and right - bottomBorderSideImg->DrawFull(GetPos() + DrawPoint(0, GetSize().y - bottomBorderSideImg->getHeight())); - bottomBorderSideImg->DrawFull(GetPos() + GetSize() - bottomBorderSideImg->GetSize()); + bottomBorderSideImg->DrawFull(getPos() + DrawPoint(0, getSize().y - bottomBorderSideImg->getHeight())); + bottomBorderSideImg->DrawFull(getPos() + getSize() - bottomBorderSideImg->getSize()); } void IngameWindow::DrawBackground() { if(background) - background->DrawPart(Rect(GetPos() + DrawPoint(contentOffset), GetIwSize())); + background->DrawPart(Rect(getPos() + DrawPoint(contentOffset), getIwSize())); } void IngameWindow::MoveToCenter() { - SetPos(DrawPoint(VIDEODRIVER.GetRenderSize() - GetSize()) / 2); + setPos(DrawPoint(VIDEODRIVER.getRenderSize() - getSize()) / 2); } void IngameWindow::MoveNextToMouse() { // Center vertically and move slightly right - DrawPoint newPos = VIDEODRIVER.GetMousePos() - DrawPoint(-20, GetSize().y / 2); - SetPos(newPos); + DrawPoint newPos = VIDEODRIVER.getMousePos() - DrawPoint(-20, getSize().y / 2); + setPos(newPos); } -bool IngameWindow::IsMessageRelayAllowed() const +bool IngameWindow::isMessageRelayAllowed() const { return !isMinimized_ && !isMoving; } @@ -488,18 +488,18 @@ void IngameWindow::SaveOpenStatus(bool isOpen) const windowSettings_->isOpen = isOpen; } -Rect IngameWindow::GetButtonBounds(IwButton btn) const +Rect IngameWindow::getButtonBounds(IwButton btn) const { - auto pos = GetPos(); + auto pos = getPos(); auto size = ButtonSize; switch(btn) { case IwButton::Close: break; case IwButton::Title: pos.x += TitleMargin; - size.x = GetSize().x - TitleMargin * 2; + size.x = getSize().x - TitleMargin * 2; break; - case IwButton::PinOrMinimize: pos.x += GetSize().x - ButtonSize.x; break; + case IwButton::PinOrMinimize: pos.x += getSize().x - ButtonSize.x; break; } return Rect(pos, size); } diff --git a/libs/s25main/ingameWindows/IngameWindow.h b/libs/s25main/ingameWindows/IngameWindow.h index ddcc672c05..d498fa49e7 100644 --- a/libs/s25main/ingameWindows/IngameWindow.h +++ b/libs/s25main/ingameWindows/IngameWindow.h @@ -57,27 +57,27 @@ class IngameWindow : public Window CloseBehavior closeBehavior = CloseBehavior::Regular, Window* parent = nullptr); /// Set background image - void SetBackground(glArchivItem_Bitmap* background) { this->background = background; } + void setBackground(glArchivItem_Bitmap* background) { this->background = background; } /// Get background image - glArchivItem_Bitmap* GetBackground() const { return background; } + glArchivItem_Bitmap* getBackground() const { return background; } /// Set window title - void SetTitle(const std::string& title) { this->title_ = title; } + void setTitle(const std::string& title) { this->title_ = title; } /// Get window title - const std::string& GetTitle() const { return title_; } + const std::string& getTitle() const { return title_; } void Resize(const Extent& newSize) override; /// Set the size of the (expanded) content area - void SetIwSize(const Extent& newSize); + void setIwSize(const Extent& newSize); /// Get the size of the (expanded) content area - Extent GetIwSize() const; + Extent getIwSize() const; /// Get the full size of the window, even when minimized - Extent GetFullSize() const; + Extent getFullSize() const; /// Get the current lower right corner of the content area - DrawPoint GetRightBottomBoundary(); + DrawPoint getRightBottomBoundary(); /// Set the position for the window after adjusting newPos so the window is in the visible area - void SetPos(DrawPoint newPos, bool saveRestorePos = true); + void setPos(DrawPoint newPos, bool saveRestorePos = true); /// Queue the window for closing, will be done in next draw cycle virtual void Close(); @@ -85,19 +85,19 @@ class IngameWindow : public Window bool ShouldBeClosed() const { return closeme; } /// Minimize window (only title bar and bottom border remains) - void SetMinimized(bool minimized = true); + void setMinimized(bool minimized = true); /// Return whether the window is minimized - bool IsMinimized() const { return isMinimized_; } + bool isMinimized() const { return isMinimized_; } - void SetPinned(bool pinned = true); - bool IsPinned() const { return isPinned_; } + void setPinned(bool pinned = true); + bool isPinned() const { return isPinned_; } CloseBehavior getCloseBehavior() const { return closeBehavior_; } /// Modal windows cannot be minimized, are always active and stay on top of non-modal ones - bool IsModal() const { return isModal_; } + bool isModal() const { return isModal_; } - GUI_ID GetGUIID() const { return static_cast(Window::GetID()); } + GUI_ID getGUIID() const { return static_cast(Window::getID()); } bool msgLeftDown(const MouseCoords&) override; bool msgLeftUp(const MouseCoords&) override; @@ -118,7 +118,7 @@ class IngameWindow : public Window void MoveNextToMouse(); /// Return if events (mouse move...) should be passed to controls of the window - bool IsMessageRelayAllowed() const override; + bool isMessageRelayAllowed() const override; void SaveOpenStatus(bool isOpen) const; @@ -140,7 +140,7 @@ class IngameWindow : public Window private: /// Get bounds of given button - Rect GetButtonBounds(IwButton btn) const; + Rect getButtonBounds(IwButton btn) const; bool isModal_; bool closeme; diff --git a/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.cpp b/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.cpp index 57803c5285..521ab5d4ef 100644 --- a/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.cpp +++ b/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.cpp @@ -27,7 +27,7 @@ void TransmitSettingsIgwAdapter::Close() IngameWindow::Close(); } else { - WINDOWMANAGER.Show(std::make_unique(GetTitle(), + WINDOWMANAGER.Show(std::make_unique(getTitle(), _("The changes could not be applied and will be discarded. A " "potential reason for this is that the game is paused."), this, MsgboxButton::OkCancel, MsgboxIcon::ExclamationRed, @@ -43,7 +43,7 @@ void TransmitSettingsIgwAdapter::msgMsgBoxResult(unsigned msgbox_id, MsgboxResul void TransmitSettingsIgwAdapter::msgTimer(const unsigned /*ctrl_id*/) { - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) UpdateSettings(); else TransmitSettings(); diff --git a/libs/s25main/ingameWindows/iwAIDebug.cpp b/libs/s25main/ingameWindows/iwAIDebug.cpp index cc821d9d14..34caa6ae82 100644 --- a/libs/s25main/ingameWindows/iwAIDebug.cpp +++ b/libs/s25main/ingameWindows/iwAIDebug.cpp @@ -41,10 +41,10 @@ class iwAIDebug::DebugPrinter : public IDrawNodeCallback // Cache images for(const auto i : helpers::enumRange()) { - bqImgs[i] = LOADER.GetMapTexture(49 + rttr::enum_cast(i)); + bqImgs[i] = LOADER.getMapTexture(49 + rttr::enum_cast(i)); } - ticks[0] = LOADER.GetTextureN("io", 40); - ticks[1] = LOADER.GetTextureN("io", 32); + ticks[0] = LOADER.getTextureN("io", 40); + ticks[1] = LOADER.getTextureN("io", 32); bqImgs[BuildingQuality::Nothing] = nullptr; bqImgs[BuildingQuality::Harbor] = ticks[0]; // Invalid marker } @@ -58,22 +58,22 @@ class iwAIDebug::DebugPrinter : public IDrawNodeCallback return; if(overlay == 1) { - auto* img = bqImgs[ai->GetAINode(pt).bq]; + auto* img = bqImgs[ai->getAINode(pt).bq]; if(img) img->DrawFull(curPos); } else if(overlay == 2) - ticks[ai->GetAINode(pt).reachable]->DrawFull(curPos); + ticks[ai->getAINode(pt).reachable]->DrawFull(curPos); else if(overlay == 3) - ticks[ai->GetAINode(pt).farmed]->DrawFull(curPos); + ticks[ai->getAINode(pt).farmed]->DrawFull(curPos); else if(overlay < 13) - font.Draw(curPos, helpers::toString(ai->GetResMapValue(pt, AIResource(overlay - 4))), FontStyle{}, + font.Draw(curPos, helpers::toString(ai->getResMapValue(pt, AIResource(overlay - 4))), FontStyle{}, COLOR_YELLOW); } }; iwAIDebug::iwAIDebug(GameWorldView& gwv, const std::vector& ais) : IngameWindow(CGI_AI_DEBUG, IngameWindow::posLastOrCenter, Extent(280, 515), _("AI Debug"), - LOADER.GetImageN("resource", 41)), + LOADER.getImageN("resource", 41)), gwv(gwv), text(nullptr), printer(nullptr) { for(const AIPlayer* ai : ais) @@ -93,7 +93,7 @@ iwAIDebug::iwAIDebug(GameWorldView& gwv, const std::vector& ais AddComboBox(ID_CbPlayer, DrawPoint(15, 30), Extent(250, 20), TextureColor::Grey, NormalFont, 100); for(const AIJH::AIPlayerJH* ai : ais_) { - players->AddItem(ai->GetPlayerName()); + players->AddItem(ai->getPlayerName()); } ctrlComboBox* overlays = @@ -116,10 +116,10 @@ iwAIDebug::iwAIDebug(GameWorldView& gwv, const std::vector& ais text = AddMultiline(ID_Text, DrawPoint(15, 120), Extent(250, 8 * NormalFont->getHeight()), TextureColor::Grey, NormalFont, FontStyle::NO_OUTLINE); - SetIwSize(Extent(GetIwSize().x, text->GetPos().y + text->GetSize().y)); + setIwSize(Extent(getIwSize().x, text->getPos().y + text->getSize().y)); - players->SetSelection(0); - overlays->SetSelection(0); + players->setSelection(0); + overlays->setSelection(0); printer = new DebugPrinter(ais_[0], 0); gwv.AddDrawNodeCallback(printer); } @@ -147,7 +147,7 @@ void iwAIDebug::msgPaintBefore() IngameWindow::msgPaintBefore(); std::stringstream ss; - const AIJH::AIJob* currentJob = printer->ai->GetCurrentJob(); + const AIJH::AIJob* currentJob = printer->ai->getCurrentJob(); if(!currentJob) { text->Clear(); @@ -155,7 +155,7 @@ void iwAIDebug::msgPaintBefore() return; } - ss << "Jobs to do: " << printer->ai->GetNumJobs() << std::endl << std::endl; + ss << "Jobs to do: " << printer->ai->getNumJobs() << std::endl << std::endl; const auto* bj = dynamic_cast(currentJob); const auto* ej = dynamic_cast(currentJob); @@ -163,13 +163,13 @@ void iwAIDebug::msgPaintBefore() if(bj) { ss << "BuildJob:" << std::endl; - ss << BUILDING_NAMES[bj->GetType()] << std::endl; - ss << bj->GetTarget().x << " / " << bj->GetTarget().y << std::endl; + ss << BUILDING_NAMES[bj->getType()] << std::endl; + ss << bj->getTarget().x << " / " << bj->getTarget().y << std::endl; } else if(ej) { #define RTTR_PRINT_EV(ev) \ case AIEvent::EventType::ev: ss << #ev << std::endl; break - switch(ej->GetEvent().GetType()) + switch(ej->getEvent().getType()) { RTTR_PRINT_EV(BuildingDestroyed); RTTR_PRINT_EV(BuildingConquered); @@ -191,17 +191,17 @@ void iwAIDebug::msgPaintBefore() } #undef RTTR_PRINT_EV - const auto* evb = dynamic_cast(&ej->GetEvent()); + const auto* evb = dynamic_cast(&ej->getEvent()); if(evb) { - ss << evb->GetX() << " / " << evb->GetY() << std::endl; - ss << BUILDING_NAMES[evb->GetBuildingType()] << std::endl; + ss << evb->getX() << " / " << evb->getY() << std::endl; + ss << BUILDING_NAMES[evb->getBuildingType()] << std::endl; } } #define RTTR_PRINT_STATUS(state) \ case AIJH::state: ss << #state << std::endl; break - switch(currentJob->GetState()) + switch(currentJob->getState()) { RTTR_PRINT_STATUS(JobState::Waiting); RTTR_PRINT_STATUS(JobState::Start); diff --git a/libs/s25main/ingameWindows/iwAction.cpp b/libs/s25main/ingameWindows/iwAction.cpp index ce4706162b..a987c0417c 100644 --- a/libs/s25main/ingameWindows/iwAction.cpp +++ b/libs/s25main/ingameWindows/iwAction.cpp @@ -46,7 +46,7 @@ enum TabID iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapPoint selectedPt, const DrawPoint& mousePos, Params params, bool military_buildings) - : IngameWindow(CGI_ACTION, mousePos, Extent(200, 254), _("Activity window"), LOADER.GetImageN("io", 1)), gi(gi), + : IngameWindow(CGI_ACTION, mousePos, Extent(200, 254), _("Activity window"), LOADER.getImageN("io", 1)), gi(gi), gwv(gwv), selectedPt(selectedPt), mousePosAtOpen_(mousePos), activeHoveredIcon_(nullptr) { /* @@ -76,7 +76,7 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP TAB_CHEAT 1 = Place cheat building */ - const GamePlayer& player = gwv.GetViewer().GetPlayer(); + const GamePlayer& player = gwv.getViewer().getPlayer(); /// Haupttab ctrlTab* main_tab = AddTabCtrl(0, DrawPoint(10, 20), 180); @@ -84,20 +84,20 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP // Bau-main_tab if(tabs.build) { - ctrlGroup* group = main_tab->AddTab(LOADER.GetImageN("io", 18), _("-> Build house"), TAB_BUILD); + ctrlGroup* group = main_tab->AddTab(LOADER.getImageN("io", 18), _("-> Build house"), TAB_BUILD); ctrlTab* build_tab = group->AddTabCtrl(1, DrawPoint(0, 45), 180); // Building tabs if(tabs.build_tabs == BuildTab::Mine) // mines - build_tab->AddTab(LOADER.GetImageN("io", 76), _("-> Dig mines"), int(BuildTab::Mine)); + build_tab->AddTab(LOADER.getImageN("io", 76), _("-> Dig mines"), int(BuildTab::Mine)); else { - build_tab->AddTab(LOADER.GetImageN("io", 67), _("-> Build hut"), int(BuildTab::Hut)); + build_tab->AddTab(LOADER.getImageN("io", 67), _("-> Build hut"), int(BuildTab::Hut)); if(tabs.build_tabs >= BuildTab::House) - build_tab->AddTab(LOADER.GetImageN("io", 68), _("-> Build house"), int(BuildTab::House)); + build_tab->AddTab(LOADER.getImageN("io", 68), _("-> Build house"), int(BuildTab::House)); if(tabs.build_tabs >= BuildTab::Castle) // castle & harbor - build_tab->AddTab(LOADER.GetImageN("io", 69), _("-> Build castle"), int(BuildTab::Castle)); + build_tab->AddTab(LOADER.getImageN("io", 69), _("-> Build castle"), int(BuildTab::Castle)); } // add building icons to TabCtrl. Note: None for BuildTab::Harbor (last) @@ -119,7 +119,7 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP // First enable all buildings for(const auto bld : helpers::enumRange()) - building_available[bld] = player.IsBuildingEnabled(bld); + building_available[bld] = player.isBuildingEnabled(bld); // Now deactivate those we don't want @@ -134,33 +134,33 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP building_available[BuildingType::Fortress] = false; } - if(gwv.GetWorld().GetGGS().isEnabled(AddonId::CHANGE_GOLD_DEPOSITS)) + if(gwv.getWorld().getGGS().isEnabled(AddonId::CHANGE_GOLD_DEPOSITS)) { building_available[BuildingType::GoldMine] = false; building_available[BuildingType::Mint] = false; } - if(!player.CanBuildCatapult()) + if(!player.canBuildCatapult()) building_available[BuildingType::Catapult] = false; - if(!gwv.GetWorld().GetGGS().isEnabled(AddonId::CHARBURNER)) + if(!gwv.getWorld().getGGS().isEnabled(AddonId::CHARBURNER)) building_available[BuildingType::Charburner] = false; - if(!gwv.GetWorld().GetGGS().isEnabled(AddonId::WINE)) + if(!gwv.getWorld().getGGS().isEnabled(AddonId::WINE)) { building_available[BuildingType::Vineyard] = false; building_available[BuildingType::Winery] = false; building_available[BuildingType::Temple] = false; } - if(!gwv.GetWorld().GetGGS().isEnabled(AddonId::LEATHER)) + if(!gwv.getWorld().getGGS().isEnabled(AddonId::LEATHER)) { building_available[BuildingType::Skinner] = false; building_available[BuildingType::Tannery] = false; building_available[BuildingType::LeatherWorks] = false; } - const bool showBuildingRadius = gwv.GetWorld().GetGGS().isEnabled(AddonId::BUILDING_RADIUS); + const bool showBuildingRadius = gwv.getWorld().getGGS().isEnabled(AddonId::BUILDING_RADIUS); constexpr helpers::EnumArray NUM_TABS = {1, 2, 3, 1, 3}; for(unsigned char i = 0; i < NUM_TABS[tabs.build_tabs]; ++i) @@ -178,7 +178,7 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP tooltip << _(BUILDING_NAMES[bld]); // Show radius if any - const unsigned radius = showBuildingRadius ? gwv.GetBuildingRadius(bld) : 0; + const unsigned radius = showBuildingRadius ? gwv.getBuildingRadius(bld) : 0; if(radius > 0) tooltip << boost::format(_("\nRange: %1% tiles")) % radius; @@ -193,12 +193,12 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP } DrawPoint iconPos((k % 5) * 36, (k / 5) * 36 + 45); - ctrlBuildingIcon* icon = build_tab->GetGroup(static_cast(bt)) + ctrlBuildingIcon* icon = build_tab->getGroup(static_cast(bt)) ->AddBuildingIcon(k, iconPos, bld, player.nation, 36, tooltip.str()); if(radius > 0) { - icon->SetOnHoverChanged([this, icon, radius](bool hovered) noexcept { + icon->setOnHoverChanged([this, icon, radius](bool hovered) noexcept { if(hovered && !ShouldBeClosed()) { this->activeHoveredIcon_ = icon; @@ -218,54 +218,54 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP building_tab_heights[static_cast(bt)] = (k / 5 + ((k % 5 != 0) ? 1 : 0)) * 36 + 150; } - build_tab->SetSelection(0, true); + build_tab->setSelection(0, true); } // Wenn es einen Flaggen-main_tab gibt, dann entsprechend die Buttons anordnen, wie sie gebraucht werden if(tabs.flag) { - ctrlGroup* group = main_tab->AddTab(LOADER.GetImageN("io", 70), _("Erect flag"), TAB_FLAG); + ctrlGroup* group = main_tab->AddTab(LOADER.getImageN("io", 70), _("Erect flag"), TAB_FLAG); switch(get(params)) { case FlagType::Normal: { group->AddImageButton(1, DrawPoint(0, 45), Extent(45, 36), TextureColor::Grey, - LOADER.GetImageN("io", 65), _("Build road")); + LOADER.getImageN("io", 65), _("Build road")); group->AddImageButton(3, DrawPoint(45, 45), Extent(45, 36), TextureColor::Grey, - LOADER.GetImageN("io", 118), _("Pull down flag")); + LOADER.getImageN("io", 118), _("Pull down flag")); group->AddImageButton(4, DrawPoint(90, 45), Extent(45, 36), TextureColor::Grey, - LOADER.GetImageN("io", 20), _("Call in geologist")); + LOADER.getImageN("io", 20), _("Call in geologist")); group->AddImageButton(5, DrawPoint(135, 45), Extent(45, 36), TextureColor::Grey, - LOADER.GetImageN("io", 96), _("Send out scout")); + LOADER.getImageN("io", 96), _("Send out scout")); } break; case FlagType::WaterFlag: { group->AddImageButton(1, DrawPoint(0, 45), Extent(36, 36), TextureColor::Grey, - LOADER.GetImageN("io", 65), _("Build road")); + LOADER.getImageN("io", 65), _("Build road")); group->AddImageButton(2, DrawPoint(36, 45), Extent(36, 36), TextureColor::Grey, - LOADER.GetImageN("io", 95), _("Build waterway")); + LOADER.getImageN("io", 95), _("Build waterway")); group->AddImageButton(3, DrawPoint(72, 45), Extent(36, 36), TextureColor::Grey, - LOADER.GetImageN("io", 118), _("Pull down flag")); + LOADER.getImageN("io", 118), _("Pull down flag")); group->AddImageButton(4, DrawPoint(108, 45), Extent(36, 36), TextureColor::Grey, - LOADER.GetImageN("io", 20), _("Call in geologist")); + LOADER.getImageN("io", 20), _("Call in geologist")); group->AddImageButton(5, DrawPoint(144, 45), Extent(36, 36), TextureColor::Grey, - LOADER.GetImageN("io", 96), _("Send out scout")); + LOADER.getImageN("io", 96), _("Send out scout")); } break; case FlagType::HQ: { group->AddImageButton(1, DrawPoint(0, 45), Extent(180, 36), TextureColor::Grey, - LOADER.GetImageN("io", 65), _("Build road")); + LOADER.getImageN("io", 65), _("Build road")); } break; case FlagType::Storehouse: { group->AddImageButton(1, DrawPoint(0, 45), Extent(90, 36), TextureColor::Grey, - LOADER.GetImageN("io", 65), _("Build road")); + LOADER.getImageN("io", 65), _("Build road")); group->AddImageButton(3, DrawPoint(90, 45), Extent(90, 36), TextureColor::Grey, - LOADER.GetImageN("io", 118), _("Demolish house")); + LOADER.getImageN("io", 118), _("Demolish house")); } break; } @@ -274,7 +274,7 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP // Flagge Setzen-main_tab if(tabs.setflag) { - ctrlGroup* group = main_tab->AddTab(LOADER.GetImageN("io", 45), _("Erect flag"), TAB_SETFLAG); + ctrlGroup* group = main_tab->AddTab(LOADER.getImageN("io", 45), _("Erect flag"), TAB_SETFLAG); unsigned nr = 70; if(get(params) == FlagType::WaterFlag) @@ -285,14 +285,14 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP unsigned btPosX = 90; AddUpgradeRoad(group, btPosX, btSize.x); - group->AddImageButton(1, DrawPoint(0, 45), btSize, TextureColor::Grey, LOADER.GetImageN("io", nr), + group->AddImageButton(1, DrawPoint(0, 45), btSize, TextureColor::Grey, LOADER.getImageN("io", nr), _("Erect flag")); } // Cut-main_tab if(tabs.cutroad) { - ctrlGroup* group = main_tab->AddTab(LOADER.GetImageN("io", 19), _("Dig up road"), TAB_CUTROAD); + ctrlGroup* group = main_tab->AddTab(LOADER.getImageN("io", 19), _("Dig up road"), TAB_CUTROAD); // Straße aufwerten ggf anzeigen Extent btSize(180, 36); @@ -300,13 +300,13 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP if(tabs.upgradeRoad) AddUpgradeRoad(group, btPosX, btSize.x); - group->AddImageButton(1, DrawPoint(btPosX, 45), btSize, TextureColor::Grey, LOADER.GetImageN("io", 32), + group->AddImageButton(1, DrawPoint(btPosX, 45), btSize, TextureColor::Grey, LOADER.getImageN("io", 32), _("Dig up road")); } if(tabs.attack) { - ctrlGroup* group = main_tab->AddTab(LOADER.GetImageN("io", 98), _("Attack options"), TAB_ATTACK); + ctrlGroup* group = main_tab->AddTab(LOADER.getImageN("io", 98), _("Attack options"), TAB_ATTACK); available_soldiers_count = get(params); AddAttackControls(group, available_soldiers_count); selected_soldiers_count = 1; @@ -314,10 +314,10 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP if(tabs.sea_attack) { - ctrlGroup* group = main_tab->AddTab(LOADER.GetImageN("io", 177), _("Attack options"), TAB_SEAATTACK); + ctrlGroup* group = main_tab->AddTab(LOADER.getImageN("io", 177), _("Attack options"), TAB_SEAATTACK); selected_soldiers_count_sea = 1; - available_soldiers_count_sea = gwv.GetViewer().GetNumSoldiersForSeaAttack(selectedPt); + available_soldiers_count_sea = gwv.getViewer().getNumSoldiersForSeaAttack(selectedPt); AddAttackControls(group, available_soldiers_count_sea); } @@ -328,49 +328,49 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP if(gi.GI_GetCheats().canPlaceCheatBuilding(selectedPt)) { constexpr auto buildImgId = 18; - auto* buildImg = LOADER.GetImageN("io", buildImgId); + auto* buildImg = LOADER.getImageN("io", buildImgId); ctrlGroup* group = main_tab->AddTab(buildImg, _("Build headquarters"), TAB_CHEAT); group->AddImageButton(1, DrawPoint{0, 45}, Extent{180, 36}, TextureColor::Grey, buildImg, _("Build headquarters")); } - ctrlGroup* group = main_tab->AddTab(LOADER.GetImageN("io", 36), _("Display options"), TAB_WATCH); + ctrlGroup* group = main_tab->AddTab(LOADER.getImageN("io", 36), _("Display options"), TAB_WATCH); const Extent btSize(45, 36); DrawPoint curPos(0, 45); - group->AddImageButton(1, curPos, btSize, TextureColor::Grey, LOADER.GetImageN("io", 108), + group->AddImageButton(1, curPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 108), _("Observation window")); curPos.x += btSize.x; - group->AddImageButton(2, curPos, btSize, TextureColor::Grey, LOADER.GetImageN("io", 179), _("House names")); + group->AddImageButton(2, curPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 179), _("House names")); curPos.x += btSize.x; - group->AddImageButton(3, curPos, btSize, TextureColor::Grey, LOADER.GetImageN("io", 180), + group->AddImageButton(3, curPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 180), _("Go to headquarters")); curPos.x += btSize.x; - group->AddImageButton(4, curPos, btSize, TextureColor::Grey, LOADER.GetImageN("io", 107), + group->AddImageButton(4, curPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 107), _("Notify allies of this location")); } - main_tab->SetSelection(0, true); + main_tab->setSelection(0, true); - DrawPoint adjPos = GetPos(); - DrawPoint outerPt = GetPos() + GetSize(); - if(outerPt.x > static_cast(VIDEODRIVER.GetRenderSize().x)) - adjPos.x = mousePos.x - GetSize().x - 40; - if(outerPt.y > static_cast(VIDEODRIVER.GetRenderSize().y)) - adjPos.y = mousePos.y - GetSize().y - 40; - if(adjPos != GetPos()) - SetPos(adjPos); + DrawPoint adjPos = getPos(); + DrawPoint outerPt = getPos() + getSize(); + if(outerPt.x > static_cast(VIDEODRIVER.getRenderSize().x)) + adjPos.x = mousePos.x - getSize().x - 40; + if(outerPt.y > static_cast(VIDEODRIVER.getRenderSize().y)) + adjPos.y = mousePos.y - getSize().y - 40; + if(adjPos != getPos()) + setPos(adjPos); - VIDEODRIVER.SetMousePos(GetDrawPos() + DrawPoint(20, 75)); + VIDEODRIVER.setMousePos(getDrawPos() + DrawPoint(20, 75)); } void iwAction::AddUpgradeRoad(ctrlGroup* group, unsigned& /*x*/, unsigned& width) { RTTR_Assert(group); - if(gwv.GetWorld().GetGGS().isEnabled(AddonId::MANUAL_ROAD_ENLARGEMENT)) + if(gwv.getWorld().getGGS().isEnabled(AddonId::MANUAL_ROAD_ENLARGEMENT)) { width = 90; - group->AddImageButton(2, DrawPoint(90, 45), Extent(width, 36), TextureColor::Grey, LOADER.GetImageN("io", 44), + group->AddImageButton(2, DrawPoint(90, 45), Extent(width, 36), TextureColor::Grey, LOADER.getImageN("io", 44), _("Upgrade to donkey road")); } } @@ -378,9 +378,9 @@ void iwAction::AddUpgradeRoad(ctrlGroup* group, unsigned& /*x*/, unsigned& width bool iwAction::DoUpgradeRoad() { Direction flag_dir; - const noFlag* flag = gwv.GetWorld().GetRoadFlag(selectedPt, flag_dir); + const noFlag* flag = gwv.getWorld().getRoadFlag(selectedPt, flag_dir); if(flag) - return GAMECLIENT.UpgradeRoad(flag->GetPos(), flag_dir); + return GAMECLIENT.UpgradeRoad(flag->getPos(), flag_dir); else return true; } @@ -398,19 +398,19 @@ void iwAction::AddAttackControls(ctrlGroup* group, const unsigned attackers_coun selected_soldiers_count = 1; // Minus und Plus - Button - group->AddImageButton(1, DrawPoint(3, 49), Extent(26, 32), TextureColor::Grey, LOADER.GetImageN("io", 139), + group->AddImageButton(1, DrawPoint(3, 49), Extent(26, 32), TextureColor::Grey, LOADER.getImageN("io", 139), _("Less attackers")); - group->AddImageButton(2, DrawPoint(89, 49), Extent(26, 32), TextureColor::Grey, LOADER.GetImageN("io", 138), + group->AddImageButton(2, DrawPoint(89, 49), Extent(26, 32), TextureColor::Grey, LOADER.getImageN("io", 138), _("More attackers")); // Starke/Schwache Soldaten ctrlOptionGroup* ogroup = group->AddOptionGroup(3, GroupSelectType::Illuminate); - ogroup->AddImageButton(0, DrawPoint(146, 49), Extent(30, 33), TextureColor::Grey, LOADER.GetImageN("io", 31), + ogroup->AddImageButton(0, DrawPoint(146, 49), Extent(30, 33), TextureColor::Grey, LOADER.getImageN("io", 31), _("Weak attackers")); - ogroup->AddImageButton(1, DrawPoint(117, 49), Extent(30, 33), TextureColor::Grey, LOADER.GetImageN("io", 30), + ogroup->AddImageButton(1, DrawPoint(117, 49), Extent(30, 33), TextureColor::Grey, LOADER.getImageN("io", 30), _("Strong attackers")); // standardmäßig starke Soldaten - ogroup->SetSelection(1); + ogroup->setSelection(1); // Schnellauswahl-Buttons unsigned buttons_count = (attackers_count > 3) ? 4 : attackers_count; @@ -418,10 +418,10 @@ void iwAction::AddAttackControls(ctrlGroup* group, const unsigned attackers_coun for(unsigned i = 0; i < buttons_count; ++i) group->AddImageButton(10 + i, DrawPoint(3 + i * button_width, 83), Extent(button_width, 32), - TextureColor::Grey, LOADER.GetImageN("io", 204 + i), _("Number of attackers")); + TextureColor::Grey, LOADER.getImageN("io", 204 + i), _("Number of attackers")); // Angriffsbutton - group->AddImageButton(4, DrawPoint(117, 83), Extent(59, 32), TextureColor::Red1, LOADER.GetImageN("io", 25), + group->AddImageButton(4, DrawPoint(117, 83), Extent(59, 32), TextureColor::Red1, LOADER.getImageN("io", 25), _("Attack!")); } } @@ -434,12 +434,12 @@ void iwAction::Close() gwv.HideRadiusPreview(); IngameWindow::Close(); if(mousePosAtOpen_.isValid()) - VIDEODRIVER.SetMousePos(mousePosAtOpen_); + VIDEODRIVER.setMousePos(mousePosAtOpen_); } void iwAction::msgGroupButtonClick(const unsigned /*group_id*/, const unsigned ctrl_id) { - switch(GetCtrl(0)->GetCurrentTab()) + switch(getCtrl(0)->getCurrentTab()) { default: break; @@ -509,7 +509,7 @@ void iwAction::msgTabChange(const unsigned ctrl_id, const unsigned short tab_id) case TAB_BUILD: { height = building_tab_heights - [GetCtrl(0)->GetGroup(TAB_BUILD)->GetCtrl(1)->GetCurrentTab()]; + [getCtrl(0)->getGroup(TAB_BUILD)->getCtrl(1)->getCurrentTab()]; } break; case TAB_ATTACK: @@ -530,7 +530,7 @@ void iwAction::msgTabChange(const unsigned ctrl_id, const unsigned short tab_id) break; } - SetHeight(height); + setHeight(height); } break; } @@ -542,7 +542,7 @@ void iwAction::msgGroupTabChange(const unsigned /*group_id*/, const unsigned ctr { case 1: // Gebäudetabs { - SetHeight(building_tab_heights[tab_id]); + setHeight(building_tab_heights[tab_id]); } break; } @@ -552,19 +552,19 @@ void iwAction::msgPaintAfter() { IngameWindow::msgPaintAfter(); - auto* tab = GetCtrl(0); + auto* tab = getCtrl(0); if(tab) { static boost::format fmt("%u/%u"); // Anzeige Soldaten/mögliche Soldatenanzahl bei Angriffstab - if(tab->GetCurrentTab() == TAB_ATTACK && available_soldiers_count > 0) + if(tab->getCurrentTab() == TAB_ATTACK && available_soldiers_count > 0) { fmt % selected_soldiers_count % available_soldiers_count; - LargeFont->Draw(GetDrawPos() + DrawPoint(67, 79), fmt.str(), FontStyle::CENTER, COLOR_YELLOW); - } else if(tab->GetCurrentTab() == TAB_SEAATTACK && available_soldiers_count_sea > 0) + LargeFont->Draw(getDrawPos() + DrawPoint(67, 79), fmt.str(), FontStyle::CENTER, COLOR_YELLOW); + } else if(tab->getCurrentTab() == TAB_SEAATTACK && available_soldiers_count_sea > 0) { fmt % selected_soldiers_count_sea % available_soldiers_count_sea; - LargeFont->Draw(GetDrawPos() + DrawPoint(67, 79), fmt.str(), FontStyle::CENTER, COLOR_YELLOW); + LargeFont->Draw(getDrawPos() + DrawPoint(67, 79), fmt.str(), FontStyle::CENTER, COLOR_YELLOW); } } } @@ -598,8 +598,8 @@ void iwAction::msgButtonClickTabAttack(const unsigned ctrl_id) break; case 4: // Angriff! { - auto* ogroup = GetCtrl(0)->GetGroup(TAB_ATTACK)->GetCtrl(3); - if(GAMECLIENT.Attack(selectedPt, selected_soldiers_count, (ogroup->GetSelection() == 1))) + auto* ogroup = getCtrl(0)->getGroup(TAB_ATTACK)->getCtrl(3); + if(GAMECLIENT.Attack(selectedPt, selected_soldiers_count, (ogroup->getSelection() == 1))) Close(); } break; @@ -635,8 +635,8 @@ void iwAction::msgButtonClickTabSeaAttack(const unsigned ctrl_id) break; case 4: // Angriff! { - auto* ogroup = GetCtrl(0)->GetGroup(TAB_SEAATTACK)->GetCtrl(3); - if(GAMECLIENT.SeaAttack(selectedPt, selected_soldiers_count_sea, (ogroup->GetSelection() == 1))) + auto* ogroup = getCtrl(0)->getGroup(TAB_SEAATTACK)->getCtrl(3); + if(GAMECLIENT.SeaAttack(selectedPt, selected_soldiers_count_sea, (ogroup->getSelection() == 1))) Close(); } break; @@ -661,23 +661,23 @@ void iwAction::msgButtonClickTabFlag(const unsigned ctrl_id) break; case 3: // Flagge abreißen { - const GameWorldBase& world = gwv.GetWorld(); - NodalObjectType nop = (world.GetNO(world.GetNeighbour(selectedPt, Direction::NorthWest)))->GetType(); + const GameWorldBase& world = gwv.getWorld(); + NodalObjectType nop = (world.getNO(world.getNeighbour(selectedPt, Direction::NorthWest)))->getType(); // Haben wir ne Baustelle/Gebäude dran? if(nop == NodalObjectType::Building || nop == NodalObjectType::Buildingsite) { // Abreißen? const auto* building = - world.GetSpecObj(world.GetNeighbour(selectedPt, Direction::NorthWest)); + world.getSpecObj(world.getNeighbour(selectedPt, Direction::NorthWest)); // Militärgebäude? - if(building->GetGOT() == GO_Type::NobMilitary) + if(building->getGOT() == GO_Type::NobMilitary) { // Darf das Gebäude abgerissen werden? - if(!static_cast(building)->IsDemolitionAllowed()) + if(!static_cast(building)->isDemolitionAllowed()) { // Nein, dann Messagebox anzeigen - iwMilitaryBuilding::DemolitionNotAllowed(world.GetGGS()); + iwMilitaryBuilding::DemolitionNotAllowed(world.getGGS()); break; } } @@ -710,12 +710,12 @@ void iwAction::msgButtonClickTabFlag(const unsigned ctrl_id) void iwAction::msgButtonClickTabBuild(const unsigned ctrl_id) { // Klick auf Gebäudebauicon - if(GAMECLIENT.SetBuildingSite(selectedPt, GetCtrl(0) - ->GetGroup(TAB_BUILD) - ->GetCtrl(1) - ->GetCurrentGroup() - ->GetCtrl(ctrl_id) - ->GetType())) + if(GAMECLIENT.SetBuildingSite(selectedPt, getCtrl(0) + ->getGroup(TAB_BUILD) + ->getCtrl(1) + ->getCurrentGroup() + ->getCtrl(ctrl_id) + ->getType())) { // Fenster schließen Close(); @@ -747,9 +747,9 @@ void iwAction::msgButtonClickTabCutRoad(const unsigned ctrl_id) case 1: // Straße abreißen { Direction flag_dir; - const noFlag* flag = gwv.GetWorld().GetRoadFlag(selectedPt, flag_dir); + const noFlag* flag = gwv.getWorld().getRoadFlag(selectedPt, flag_dir); if(flag) - success = GAMECLIENT.DestroyRoad(flag->GetPos(), flag_dir); + success = GAMECLIENT.DestroyRoad(flag->getPos(), flag_dir); } break; case 2: // Straße aufwerten @@ -776,7 +776,7 @@ void iwAction::msgButtonClickTabWatch(const unsigned ctrl_id) Close(); break; case 3: // zum HQ - gwv.MoveToMapPt(gwv.GetViewer().GetPlayer().GetHQPos()); + gwv.MoveToMapPt(gwv.getViewer().getPlayer().getHQPos()); DisableMousePosResetOnClose(); Close(); break; @@ -792,7 +792,7 @@ void iwAction::msgButtonClickTabCheat(const unsigned ctrl_id) switch(ctrl_id) { case 1: - gi.GI_GetCheats().placeCheatBuilding(selectedPt, gwv.GetViewer().GetPlayer()); + gi.GI_GetCheats().placeCheatBuilding(selectedPt, gwv.getViewer().getPlayer()); Close(); break; } diff --git a/libs/s25main/ingameWindows/iwAction.h b/libs/s25main/ingameWindows/iwAction.h index 719af53c10..947a3d10c6 100644 --- a/libs/s25main/ingameWindows/iwAction.h +++ b/libs/s25main/ingameWindows/iwAction.h @@ -80,7 +80,7 @@ class iwAction : public IngameWindow void Close() override; /// Gibt zurück, auf welchen Punkt es sich bezieht - const MapPoint& GetSelectedPt() const { return selectedPt; } + const MapPoint& getSelectedPt() const { return selectedPt; } private: void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; diff --git a/libs/s25main/ingameWindows/iwAddonPresets.cpp b/libs/s25main/ingameWindows/iwAddonPresets.cpp index e5a504ceb7..e7be3af0c8 100644 --- a/libs/s25main/ingameWindows/iwAddonPresets.cpp +++ b/libs/s25main/ingameWindows/iwAddonPresets.cpp @@ -88,7 +88,7 @@ iwAddonPresetsBase::iwAddonPresetsBase(const std::string& title, const std::stri const unsigned additionalHeight) : IngameWindow(CGI_ADDON_PRESETS, IngameWindow::posLastOrCenter, Extent(440, contentStartY + additionalHeight + ctrlHeight + bottomMargin), title, - LOADER.GetImageN("resource", 41), true) + LOADER.getImageN("resource", 41), true) { using SRT = ctrlTable::SortType; AddTable(ID_tblPresets, DrawPoint(contentX, tableY), Extent(contentWidth, tableHeight), TextureColor::Green2, @@ -101,17 +101,17 @@ iwAddonPresetsBase::iwAddonPresetsBase(const std::string& title, const std::stri const unsigned buttonY = contentStartY + additionalHeight; AddTextButton(ID_btAction, DrawPoint(rightColumnX, buttonY), Extent(halfWidth, ctrlHeight), TextureColor::Green2, actionLabel, NormalFont) - ->SetEnabled(false); + ->setEnabled(false); AddTextButton(ID_btDelete, DrawPoint(contentX, buttonY), Extent(halfWidth, ctrlHeight), TextureColor::Red1, _("Delete"), NormalFont) - ->SetEnabled(false); + ->setEnabled(false); RefreshTable(); } void iwAddonPresetsBase::RefreshTable() { - auto& table = assertNonNull(GetCtrl(ID_tblPresets)); + auto& table = assertNonNull(getCtrl(ID_tblPresets)); table.DeleteAllItems(); for(const auto& file : ListDir(GetPresetsDir(), "ini")) @@ -120,29 +120,29 @@ void iwAddonPresetsBase::RefreshTable() table.SortRows(0, TableSortDir::Ascending); } -bfs::path iwAddonPresetsBase::GetSelectedFilePath() const +bfs::path iwAddonPresetsBase::getSelectedFilePath() const { - const auto& table = assertNonNull(GetCtrl(ID_tblPresets)); - const auto& selection = table.GetSelection(); + const auto& table = assertNonNull(getCtrl(ID_tblPresets)); + const auto& selection = table.getSelection(); if(!selection) return {}; - return table.GetItemText(*selection, 1); + return table.getItemText(*selection, 1); } -bool iwAddonPresetsBase::IsPresetSelected() const +bool iwAddonPresetsBase::isPresetSelected() const { - return assertNonNull(GetCtrl(ID_tblPresets)).GetSelection().has_value(); + return assertNonNull(getCtrl(ID_tblPresets)).getSelection().has_value(); } void iwAddonPresetsBase::UpdateButtons() { - GetCtrl(ID_btDelete)->SetEnabled(IsPresetSelected()); - GetCtrl(ID_btAction)->SetEnabled(CanDoAction()); + getCtrl(ID_btDelete)->setEnabled(isPresetSelected()); + getCtrl(ID_btAction)->setEnabled(canDoAction()); } -bool iwAddonPresetsBase::CanDoAction() const +bool iwAddonPresetsBase::canDoAction() const { - return IsPresetSelected(); + return isPresetSelected(); } void iwAddonPresetsBase::msgButtonClick(const unsigned ctrl_id) @@ -168,7 +168,7 @@ void iwAddonPresetsBase::msgTableChooseItem(const unsigned /*ctrl_id*/, const un void iwAddonPresetsBase::ConfirmDelete() { - const bfs::path filePath = GetSelectedFilePath(); + const bfs::path filePath = getSelectedFilePath(); if(filePath.empty()) return; WINDOWMANAGER.Show(std::make_unique( @@ -181,7 +181,7 @@ void iwAddonPresetsBase::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxR if(msgbox_id != ID_mbDelete || mbr != MsgboxResult::Yes) return; - const bfs::path filePath = GetSelectedFilePath(); + const bfs::path filePath = getSelectedFilePath(); if(filePath.empty()) return; @@ -205,7 +205,7 @@ iwSaveAddonPreset::iwSaveAddonPreset(std::map states) // input, isValidFileName() may still reject it since it counts bytes, not codepoints. AddEdit(ID_edtName, DrawPoint(contentX, contentStartY), Extent(contentWidth, ctrlHeight), TextureColor::Green2, NormalFont, 251, false, false, true) - ->SetType(EditType::Filename); + ->setType(EditType::Filename); } void iwSaveAddonPreset::msgEditEnter(const unsigned /*ctrl_id*/) @@ -216,33 +216,33 @@ void iwSaveAddonPreset::msgEditEnter(const unsigned /*ctrl_id*/) void iwSaveAddonPreset::msgEditChange(const unsigned /*ctrl_id*/) { // Editing makes the selected preset ambiguous, so drop the selection instead of guessing which one is meant - assertNonNull(GetCtrl(ID_tblPresets)).SetSelection(std::nullopt); + assertNonNull(getCtrl(ID_tblPresets)).setSelection(std::nullopt); } void iwSaveAddonPreset::msgTableSelectItem(const unsigned ctrl_id, const std::optional& selection) { if(selection) { - const auto& table = assertNonNull(GetCtrl(ID_tblPresets)); - auto& edit = assertNonNull(GetCtrl(ID_edtName)); + const auto& table = assertNonNull(getCtrl(ID_tblPresets)); + auto& edit = assertNonNull(getCtrl(ID_edtName)); // Suppress the change event so Msg_EditChange won't deselect the row just selected - edit.SetNotify(false); - edit.SetText(table.GetItemText(*selection, 0)); - edit.SetNotify(true); + edit.setNotify(false); + edit.setText(table.getItemText(*selection, 0)); + edit.setNotify(true); } // The name must be filled first, as it decides whether saving is possible iwAddonPresetsBase::msgTableSelectItem(ctrl_id, selection); } -bool iwSaveAddonPreset::CanDoAction() const +bool iwSaveAddonPreset::canDoAction() const { // An invalid name still allows saving, which then tells the user what is wrong with it - return GetCtrl(ID_edtName)->GetFileName(".ini").status != FileNameStatus::Empty; + return getCtrl(ID_edtName)->getFileName(".ini").status != FileNameStatus::Empty; } void iwSaveAddonPreset::DoAction() { - const auto fileNameResult = GetCtrl(ID_edtName)->GetFileName(".ini"); + const auto fileNameResult = getCtrl(ID_edtName)->getFileName(".ini"); switch(fileNameResult.status) { case FileNameStatus::Empty: @@ -303,7 +303,7 @@ void iwSaveAddonPreset::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxRe if(mbr != MsgboxResult::Yes) return; - const auto fileNameResult = GetCtrl(ID_edtName)->GetFileName(".ini"); + const auto fileNameResult = getCtrl(ID_edtName)->getFileName(".ini"); if(fileNameResult.status == FileNameStatus::Valid) SaveToPath(GetPresetsDir() / fileNameResult.name); } @@ -314,7 +314,7 @@ iwLoadAddonPreset::iwLoadAddonPreset(std::function& selection) override; @@ -40,9 +40,9 @@ class iwAddonPresetsBase : public IngameWindow void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; private: - bool IsPresetSelected() const; + bool isPresetSelected() const; void UpdateButtons(); - virtual bool CanDoAction() const; + virtual bool canDoAction() const; virtual void DoAction() = 0; void ConfirmDelete(); }; @@ -55,7 +55,7 @@ class iwSaveAddonPreset : public iwAddonPresetsBase private: const std::map states_; void SaveToPath(const boost::filesystem::path& filePath); - bool CanDoAction() const override; + bool canDoAction() const override; void DoAction() override; void msgEditEnter(unsigned ctrl_id) override; void msgEditChange(unsigned ctrl_id) override; diff --git a/libs/s25main/ingameWindows/iwAddons.cpp b/libs/s25main/ingameWindows/iwAddons.cpp index c95c44f031..6307b5a110 100644 --- a/libs/s25main/ingameWindows/iwAddons.cpp +++ b/libs/s25main/ingameWindows/iwAddons.cpp @@ -38,7 +38,7 @@ constexpr unsigned AddonGuiLineHeight = 30; iwAddons::iwAddons(GlobalGameSettings& ggs, Window* parent, AddonChangeAllowed policy, std::vector whitelistedAddons) : IngameWindow(CGI_ADDONS, IngameWindow::posLastOrCenter, Extent(700, 530), _("Addon Settings"), - LOADER.GetImageN("resource", 41), true, CloseBehavior::Custom, parent), + LOADER.getImageN("resource", 41), true, CloseBehavior::Custom, parent), ggs(ggs), policy_(policy), whitelistedAddons_(std::move(whitelistedAddons)) { AddText(ID_txtAddFeatures, DrawPoint(20, 30), _("Additional features:"), COLOR_YELLOW, FontStyle{}, NormalFont); @@ -46,17 +46,17 @@ iwAddons::iwAddons(GlobalGameSettings& ggs, Window* parent, AddonChangeAllowed p Extent btSize(200, 22); if(policy != AddonChangeAllowed::None) { - AddTextButton(ID_btSavePreset, DrawPoint(20, GetSize().y - 70), btSize, TextureColor::Green2, _("Save"), + AddTextButton(ID_btSavePreset, DrawPoint(20, getSize().y - 70), btSize, TextureColor::Green2, _("Save"), NormalFont, _("Save Addon Preset")); - AddTextButton(ID_btLoadPreset, DrawPoint(250, GetSize().y - 70), btSize, TextureColor::Green2, _("Load"), + AddTextButton(ID_btLoadPreset, DrawPoint(250, getSize().y - 70), btSize, TextureColor::Green2, _("Load"), NormalFont, _("Load Addon Preset")); - AddTextButton(ID_btS2Defaults, DrawPoint(480, GetSize().y - 70), btSize, TextureColor::Grey, _("Default"), + AddTextButton(ID_btS2Defaults, DrawPoint(480, getSize().y - 70), btSize, TextureColor::Grey, _("Default"), NormalFont, _("Use S2 Defaults")); - AddTextButton(ID_btApply, DrawPoint(20, GetSize().y - 40), btSize, TextureColor::Green2, _("Apply"), NormalFont, + AddTextButton(ID_btApply, DrawPoint(20, getSize().y - 40), btSize, TextureColor::Green2, _("Apply"), NormalFont, _("Apply Changes")); } - AddTextButton(ID_btAbort, DrawPoint(250, GetSize().y - 40), btSize, TextureColor::Red1, _("Abort"), NormalFont, + AddTextButton(ID_btAbort, DrawPoint(250, getSize().y - 40), btSize, TextureColor::Red1, _("Abort"), NormalFont, _("Close Without Saving")); // Kategorien @@ -79,9 +79,9 @@ iwAddons::iwAddons(GlobalGameSettings& ggs, Window* parent, AddonChangeAllowed p TextureColor::Green2, _("Other"), NormalFont); ctrlScrollBar* scrollbar = - AddScrollBar(ID_scroll, DrawPoint(GetSize().x - SCROLLBAR_WIDTH - 20, 90), - Extent(SCROLLBAR_WIDTH, GetSize().y - 170), SCROLLBAR_WIDTH, TextureColor::Green2, 1); - scrollbar->SetPageSize(scrollbar->GetSize().y / AddonGuiLineHeight); + AddScrollBar(ID_scroll, DrawPoint(getSize().x - SCROLLBAR_WIDTH - 20, 90), + Extent(SCROLLBAR_WIDTH, getSize().y - 170), SCROLLBAR_WIDTH, TextureColor::Green2, 1); + scrollbar->setPageSize(scrollbar->getSize().y / AddonGuiLineHeight); for(unsigned i = 0; i < ggs.getNumAddons(); ++i) { @@ -91,7 +91,7 @@ iwAddons::iwAddons(GlobalGameSettings& ggs, Window* parent, AddonChangeAllowed p addonGuis_.back()->setStatus(ggs.getSelection(addon.getId())); } - optiongroup->SetSelection(static_cast(AddonGroup::All), true); + optiongroup->setSelection(static_cast(AddonGroup::All), true); } iwAddons::~iwAddons() = default; @@ -124,7 +124,7 @@ void iwAddons::msgButtonClick(const unsigned ctrl_id) case AddonChangeAllowed::All: case AddonChangeAllowed::WhitelistOnly: // send message via msgboxresult - GetParent()->msgMsgBoxResult(GetID(), MsgboxResult::Yes); + getParent()->msgMsgBoxResult(getID(), MsgboxResult::Yes); break; } } @@ -163,9 +163,9 @@ void iwAddons::msgButtonClick(const unsigned ctrl_id) void iwAddons::UpdateView(const AddonGroup selection) { - auto* scrollbar = GetCtrl(ID_scroll); - const unsigned scrollPos = scrollbar->GetScrollPos(); - const unsigned scrollPosEnd = scrollPos + scrollbar->GetPageSize(); + auto* scrollbar = getCtrl(ID_scroll); + const unsigned scrollPos = scrollbar->getScrollPos(); + const unsigned scrollPosEnd = scrollPos + scrollbar->getPageSize(); unsigned short y = 90; unsigned short numAddonsInCurCategory = 0; for(const auto& gui : addonGuis_) @@ -176,15 +176,15 @@ void iwAddons::UpdateView(const AddonGroup selection) // Don't show addon's gui if addon is beyond selected group or is beyond current page scope if(isVisible && numAddonsInCurCategory >= scrollPos && numAddonsInCurCategory < scrollPosEnd) { - group.SetVisible(true); - group.SetPos({group.GetPos().x, y}); + group.setVisible(true); + group.setPos({group.getPos().x, y}); y += AddonGuiLineHeight; } else - group.SetVisible(false); + group.setVisible(false); if(isVisible) ++numAddonsInCurCategory; } - scrollbar->SetRange(numAddonsInCurCategory); + scrollbar->setRange(numAddonsInCurCategory); } void iwAddons::applyAddonStates(const std::map& states) @@ -214,7 +214,7 @@ void iwAddons::msgOptionGroupChange(const unsigned ctrl_id, const unsigned selec { case ID_grpAddonGroup: // richtige Kategorie anzeigen { - GetCtrl(ID_scroll)->SetScrollPos(0); + getCtrl(ID_scroll)->setScrollPos(0); UpdateView(static_cast(selection)); } break; @@ -226,18 +226,18 @@ void iwAddons::msgOptionGroupChange(const unsigned ctrl_id, const unsigned selec */ void iwAddons::msgScrollChange(const unsigned /*ctrl_id*/, const unsigned short /*position*/) { - auto* optiongroup = GetCtrl(ID_grpAddonGroup); - UpdateView(static_cast(optiongroup->GetSelection())); + auto* optiongroup = getCtrl(ID_grpAddonGroup); + UpdateView(static_cast(optiongroup->getSelection())); } bool iwAddons::msgWheelUp(const MouseCoords& /*mc*/) { - GetCtrl(ID_scroll)->Scroll(-2); + getCtrl(ID_scroll)->Scroll(-2); return true; } bool iwAddons::msgWheelDown(const MouseCoords& /*mc*/) { - GetCtrl(ID_scroll)->Scroll(+2); + getCtrl(ID_scroll)->Scroll(+2); return true; } diff --git a/libs/s25main/ingameWindows/iwBaseWarehouse.cpp b/libs/s25main/ingameWindows/iwBaseWarehouse.cpp index 6ed1b51377..a7afd5d03b 100644 --- a/libs/s25main/ingameWindows/iwBaseWarehouse.cpp +++ b/libs/s25main/ingameWindows/iwBaseWarehouse.cpp @@ -44,51 +44,51 @@ enum } iwBaseWarehouse::iwBaseWarehouse(GameWorldView& gwv, GameCommandFactory& gcFactory, nobBaseWarehouse* wh) - : iwWares(CGI_BUILDING + MapBase::CreateGUIID(wh->GetPos()), IngameWindow::posAtMouse, 40, - _(BUILDING_NAMES[wh->GetBuildingType()]), true, NormalFont, wh->GetInventory(), - gwv.GetWorld().GetPlayer(wh->GetPlayer())), + : iwWares(CGI_BUILDING + MapBase::CreateGUIID(wh->getPos()), IngameWindow::posAtMouse, 40, + _(BUILDING_NAMES[wh->getBuildingType()]), true, NormalFont, wh->getInventory(), + gwv.getWorld().getPlayer(wh->getPlayer())), gwv(gwv), gcFactory(gcFactory), wh(wh) { wh->AddListener(this); // Basisinitialisierungsänderungen - background = LOADER.GetImageN("resource", 41); + background = LOADER.getImageN("resource", 41); // Auswahl für Auslagern/Einlagern Verbieten-Knöpfe ctrlOptionGroup* group = AddOptionGroup(ID_STORE_SETTINGS_GROUP, GroupSelectType::Check); // Einlagern - group->AddImageButton(ID_COLLECT, DrawPoint(16, GetFullSize().y - 81), Extent(32, 32), TextureColor::Grey, - LOADER.GetImageN("io_new", 4), _("Collect")); + group->AddImageButton(ID_COLLECT, DrawPoint(16, getFullSize().y - 81), Extent(32, 32), TextureColor::Grey, + LOADER.getImageN("io_new", 4), _("Collect")); // Auslagern - group->AddImageButton(ID_TAKEOUT, DrawPoint(52, GetFullSize().y - 81), Extent(32, 32), TextureColor::Grey, - LOADER.GetImageN("io", 211), _("Take out of store")); + group->AddImageButton(ID_TAKEOUT, DrawPoint(52, getFullSize().y - 81), Extent(32, 32), TextureColor::Grey, + LOADER.getImageN("io", 211), _("Take out of store")); // Einlagern verbieten - group->AddImageButton(ID_STOP, DrawPoint(86, GetFullSize().y - 81), Extent(32, 32), TextureColor::Grey, - LOADER.GetImageN("io", 212), _("Stop storage")); + group->AddImageButton(ID_STOP, DrawPoint(86, getFullSize().y - 81), Extent(32, 32), TextureColor::Grey, + LOADER.getImageN("io", 212), _("Stop storage")); // nix tun auswählen - group->SetSelection(ID_COLLECT); + group->setSelection(ID_COLLECT); // Alle auswählen bzw setzen! - AddImageButton(ID_SELECT_ALL, DrawPoint(122, GetFullSize().y - 81), Extent(32, 32), TextureColor::Grey, - LOADER.GetImageN("io", 223), _("Select all")); + AddImageButton(ID_SELECT_ALL, DrawPoint(122, getFullSize().y - 81), Extent(32, 32), TextureColor::Grey, + LOADER.getImageN("io", 223), _("Select all")); // "Gehe Zu Ort" - AddImageButton(ID_GOTO, DrawPoint(122, GetFullSize().y - 47), Extent(15, 32), TextureColor::Grey, - LOADER.GetImageN("io_new", 10), _("Go to place")); + AddImageButton(ID_GOTO, DrawPoint(122, getFullSize().y - 47), Extent(15, 32), TextureColor::Grey, + LOADER.getImageN("io_new", 10), _("Go to place")); // Go to next warehouse - AddImageButton(ID_GOTO_NEXT, DrawPoint(139, GetFullSize().y - 47), Extent(15, 32), TextureColor::Grey, - LOADER.GetImageN("io_new", 13), _("Go to next warehouse")); + AddImageButton(ID_GOTO_NEXT, DrawPoint(139, getFullSize().y - 47), Extent(15, 32), TextureColor::Grey, + LOADER.getImageN("io_new", 13), _("Go to next warehouse")); UpdateOverlays(); // Add demolish button if not HQ - if(wh->GetGOT() != GO_Type::NobHq) + if(wh->getGOT() != GO_Type::NobHq) { // Make paginate button smaller and move to make space for demolish button - GetCtrl(ID_PAGINATE)->SetWidth(32); - GetCtrl(ID_PAGINATE)->SetPos(DrawPoint(86, GetFullSize().y - 47)); + getCtrl(ID_PAGINATE)->setWidth(32); + getCtrl(ID_PAGINATE)->setPos(DrawPoint(86, getFullSize().y - 47)); - AddImageButton(ID_DEMOLISH, DrawPoint(52, GetFullSize().y - 47), Extent(32, 32), TextureColor::Grey, - LOADER.GetImageN("io", 23), _("Demolish house")); + AddImageButton(ID_DEMOLISH, DrawPoint(52, getFullSize().y - 47), Extent(32, 32), TextureColor::Grey, + LOADER.getImageN("io", 23), _("Demolish house")); } } @@ -104,13 +104,13 @@ void iwBaseWarehouse::msgGroupButtonClick(const unsigned group_id, const unsigne iwWares::msgGroupButtonClick(group_id, ctrl_id); else { - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) return; - RTTR_Assert(GetCurPage() == peoplePageID || GetCurPage() == warePageID); - auto* optiongroup = GetCtrl(ID_STORE_SETTINGS_GROUP); + RTTR_Assert(getCurPage() == peoplePageID || getCurPage() == warePageID); + auto* optiongroup = getCtrl(ID_STORE_SETTINGS_GROUP); EInventorySetting setting; - switch(optiongroup->GetSelection()) + switch(optiongroup->getSelection()) { case ID_COLLECT: setting = EInventorySetting::Collect; break; case ID_TAKEOUT: setting = EInventorySetting::Send; break; @@ -118,16 +118,16 @@ void iwBaseWarehouse::msgGroupButtonClick(const unsigned group_id, const unsigne default: throw std::invalid_argument("iwBaseWarehouse::Optiongroup"); } auto setSetting = [this](auto what, EInventorySetting setting) { - InventorySetting state = wh->GetInventorySettingVisual(what); + InventorySetting state = wh->getInventorySettingVisual(what); state.Toggle(setting); - if(gcFactory.SetInventorySetting(wh->GetPos(), what, state)) + if(gcFactory.SetInventorySetting(wh->getPos(), what, state)) { // optisch schonmal setzen - wh->SetInventorySettingVisual(what, state); + wh->setInventorySettingVisual(what, state); UpdateOverlay(rttr::enum_cast(what)); } }; - if(GetCurPage() == warePageID) + if(getCurPage() == warePageID) setSetting(GoodType(ctrl_id - 100), setting); else setSetting(Job(ctrl_id - 100), setting); @@ -147,13 +147,13 @@ void iwBaseWarehouse::msgButtonClick(const unsigned ctrl_id) break; case ID_SELECT_ALL: // "Alle auswählen" { - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) return; - if(GetCurPage() != warePageID && GetCurPage() != peoplePageID) + if(getCurPage() != warePageID && getCurPage() != peoplePageID) return; - auto* optiongroup = GetCtrl(ID_STORE_SETTINGS_GROUP); + auto* optiongroup = getCtrl(ID_STORE_SETTINGS_GROUP); EInventorySetting data; - switch(optiongroup->GetSelection()) + switch(optiongroup->getSelection()) { case ID_COLLECT: data = EInventorySetting::Collect; break; case ID_TAKEOUT: data = EInventorySetting::Send; break; @@ -161,24 +161,24 @@ void iwBaseWarehouse::msgButtonClick(const unsigned ctrl_id) default: throw std::invalid_argument("iwBaseWarehouse::Optiongroup"); } const unsigned count = - (GetCurPage() == warePageID) ? helpers::NumEnumValues_v : helpers::NumEnumValues_v; + (getCurPage() == warePageID) ? helpers::NumEnumValues_v : helpers::NumEnumValues_v; std::vector states; states.reserve(count); - if(GetCurPage() == warePageID) + if(getCurPage() == warePageID) { for(const auto i : helpers::enumRange()) - states.push_back(wh->GetInventorySettingVisual(i == GoodType::WaterEmpty ? GoodType::Water : i)); + states.push_back(wh->getInventorySettingVisual(i == GoodType::WaterEmpty ? GoodType::Water : i)); } else { for(const auto i : helpers::enumRange()) - states.push_back(wh->GetInventorySettingVisual(i)); + states.push_back(wh->getInventorySettingVisual(i)); } // Check if we need to enable all or disable all // If at least 1 disabled is found, enable all bool enable = false; for(unsigned i = 0; i < count; i++) { - if(!states[i].IsSet(data)) + if(!states[i].isSet(data)) { enable = true; break; @@ -186,21 +186,21 @@ void iwBaseWarehouse::msgButtonClick(const unsigned ctrl_id) } for(unsigned i = 0; i < count; i++) { - if(states[i].IsSet(data) != enable) + if(states[i].isSet(data) != enable) states[i].Toggle(data); } - if(gcFactory.SetAllInventorySettings(wh->GetPos(), GetCurPage() == peoplePageID, states)) + if(gcFactory.SetAllInventorySettings(wh->getPos(), getCurPage() == peoplePageID, states)) { // optisch setzen - if(GetCurPage() == warePageID) + if(getCurPage() == warePageID) { for(const auto i : helpers::enumRange()) - wh->SetInventorySettingVisual(i, states[rttr::enum_cast(i)]); + wh->setInventorySettingVisual(i, states[rttr::enum_cast(i)]); } else { for(const auto i : helpers::enumRange()) - wh->SetInventorySettingVisual(i, states[rttr::enum_cast(i)]); + wh->setInventorySettingVisual(i, states[rttr::enum_cast(i)]); } UpdateOverlays(); } @@ -208,22 +208,22 @@ void iwBaseWarehouse::msgButtonClick(const unsigned ctrl_id) break; case ID_HELP: // "Hilfe" { - WINDOWMANAGER.ReplaceWindow(std::make_unique(_(BUILDING_HELP_STRINGS[wh->GetBuildingType()]))); + WINDOWMANAGER.ReplaceWindow(std::make_unique(_(BUILDING_HELP_STRINGS[wh->getBuildingType()]))); } break; case ID_GOTO: // "Gehe Zu Ort" { - gwv.MoveToMapPt(wh->GetPos()); + gwv.MoveToMapPt(wh->getPos()); } break; case ID_GOTO_NEXT: // go to next of same type { // is there at least 1 other building of the same type? const std::list& storehouses = - gwv.GetWorld().GetPlayer(wh->GetPlayer()).GetBuildingRegister().GetStorehouses(); + gwv.getWorld().getPlayer(wh->getPlayer()).getBuildingRegister().getStorehouses(); // go through list once we get to current building -> open window for the next one and go to next location auto it = - helpers::find_if(storehouses, [whPos = wh->GetPos()](const auto* it) { return it->GetPos() == whPos; }); + helpers::find_if(storehouses, [whPos = wh->getPos()](const auto* it) { return it->getPos() == whPos; }); if(it != storehouses.end()) // got to current building in the list? { // close old window, open new window (todo: only open if it isnt already open), move to location of next @@ -232,22 +232,22 @@ void iwBaseWarehouse::msgButtonClick(const unsigned ctrl_id) ++it; if(it == storehouses.end()) // was last entry in list -> goto first it = storehouses.begin(); - gwv.MoveToMapPt((*it)->GetPos()); - if((*it)->GetBuildingType() == BuildingType::Headquarters) + gwv.MoveToMapPt((*it)->getPos()); + if((*it)->getBuildingType() == BuildingType::Headquarters) { - WINDOWMANAGER.ReplaceWindow(std::make_unique(gwv, gcFactory, *it)).SetPos(GetPos()); - } else if((*it)->GetBuildingType() == BuildingType::HarborBuilding) + WINDOWMANAGER.ReplaceWindow(std::make_unique(gwv, gcFactory, *it)).setPos(getPos()); + } else if((*it)->getBuildingType() == BuildingType::HarborBuilding) { WINDOWMANAGER .ReplaceWindow( std::make_unique(gwv, gcFactory, dynamic_cast(*it))) - .SetPos(GetPos()); - } else if((*it)->GetBuildingType() == BuildingType::Storehouse) + .setPos(getPos()); + } else if((*it)->getBuildingType() == BuildingType::Storehouse) { WINDOWMANAGER .ReplaceWindow( std::make_unique(gwv, gcFactory, dynamic_cast(*it))) - .SetPos(GetPos()); + .setPos(getPos()); } break; } @@ -261,41 +261,41 @@ void iwBaseWarehouse::msgButtonClick(const unsigned ctrl_id) } } -void iwBaseWarehouse::SetPage(unsigned page) +void iwBaseWarehouse::setPage(unsigned page) { - iwWares::SetPage(page); - const bool showStorageSettings = GetCurPage() == warePageID || GetCurPage() == peoplePageID; - GetCtrl(ID_STORE_SETTINGS_GROUP)->GetButton(ID_COLLECT)->SetEnabled(showStorageSettings); - GetCtrl(ID_STORE_SETTINGS_GROUP)->GetButton(ID_STOP)->SetEnabled(showStorageSettings); - GetCtrl(ID_STORE_SETTINGS_GROUP)->GetButton(ID_TAKEOUT)->SetEnabled(showStorageSettings); - GetCtrl(ID_SELECT_ALL)->SetEnabled(showStorageSettings); + iwWares::setPage(page); + const bool showStorageSettings = getCurPage() == warePageID || getCurPage() == peoplePageID; + getCtrl(ID_STORE_SETTINGS_GROUP)->getButton(ID_COLLECT)->setEnabled(showStorageSettings); + getCtrl(ID_STORE_SETTINGS_GROUP)->getButton(ID_STOP)->setEnabled(showStorageSettings); + getCtrl(ID_STORE_SETTINGS_GROUP)->getButton(ID_TAKEOUT)->setEnabled(showStorageSettings); + getCtrl(ID_SELECT_ALL)->setEnabled(showStorageSettings); } void iwBaseWarehouse::UpdateOverlay(unsigned i) { - UpdateOverlay(i, GetCurPage() == warePageID); + UpdateOverlay(i, getCurPage() == warePageID); } void iwBaseWarehouse::UpdateOverlay(unsigned i, bool isWare) { - auto* group = GetCtrl(isWare ? warePageID : peoplePageID); + auto* group = getCtrl(isWare ? warePageID : peoplePageID); // Einlagern verbieten-Bild (de)aktivieren - auto* image = group->GetCtrl(400 + i); + auto* image = group->getCtrl(400 + i); if(image) - image->SetVisible(isWare ? wh->IsInventorySettingVisual(GoodType(i), EInventorySetting::Stop) : - wh->IsInventorySettingVisual(Job(i), EInventorySetting::Stop)); + image->setVisible(isWare ? wh->isInventorySettingVisual(GoodType(i), EInventorySetting::Stop) : + wh->isInventorySettingVisual(Job(i), EInventorySetting::Stop)); // Auslagern-Bild (de)aktivieren - image = group->GetCtrl(500 + i); + image = group->getCtrl(500 + i); if(image) - image->SetVisible(isWare ? wh->IsInventorySettingVisual(GoodType(i), EInventorySetting::Send) : - wh->IsInventorySettingVisual(Job(i), EInventorySetting::Send)); + image->setVisible(isWare ? wh->isInventorySettingVisual(GoodType(i), EInventorySetting::Send) : + wh->isInventorySettingVisual(Job(i), EInventorySetting::Send)); // Einlagern-Bild (de)aktivieren - image = group->GetCtrl(700 + i); + image = group->getCtrl(700 + i); if(image) - image->SetVisible(isWare ? wh->IsInventorySettingVisual(GoodType(i), EInventorySetting::Collect) : - wh->IsInventorySettingVisual(Job(i), EInventorySetting::Collect)); + image->setVisible(isWare ? wh->isInventorySettingVisual(GoodType(i), EInventorySetting::Collect) : + wh->isInventorySettingVisual(Job(i), EInventorySetting::Collect)); } void iwBaseWarehouse::UpdateOverlays() diff --git a/libs/s25main/ingameWindows/iwBaseWarehouse.h b/libs/s25main/ingameWindows/iwBaseWarehouse.h index 92c2a503c8..e7d780c2ba 100644 --- a/libs/s25main/ingameWindows/iwBaseWarehouse.h +++ b/libs/s25main/ingameWindows/iwBaseWarehouse.h @@ -36,5 +36,5 @@ class iwBaseWarehouse : public iwWares, public IDataChangedListener void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; void msgButtonClick(unsigned ctrl_id) override; - void SetPage(unsigned page) override; + void setPage(unsigned page) override; }; diff --git a/libs/s25main/ingameWindows/iwBuildOrder.cpp b/libs/s25main/ingameWindows/iwBuildOrder.cpp index f1598eba3d..d32bb0bc2d 100644 --- a/libs/s25main/ingameWindows/iwBuildOrder.cpp +++ b/libs/s25main/ingameWindows/iwBuildOrder.cpp @@ -23,12 +23,12 @@ void iwBuildOrder::fillBuildOrder(const BuildOrders& build_order) { pendingBuildOrder.assign(build_order.begin(), build_order.end()); - helpers::erase_if(pendingBuildOrder, makeIsUnusedBuilding(gwv.GetWorld().GetGGS())); + helpers::erase_if(pendingBuildOrder, makeIsUnusedBuilding(gwv.getWorld().getGGS())); } iwBuildOrder::iwBuildOrder(const GameWorldViewer& gwv) : TransmitSettingsIgwAdapter(CGI_BUILDORDER, IngameWindow::posLastOrCenter, Extent(320, 300), - _("Building sequence"), LOADER.GetImageN("io", 5)), + _("Building sequence"), LOADER.getImageN("io", 5)), gwv(gwv) { ctrlList* list = AddList(0, DrawPoint(15, 60), Extent(150, 220), TextureColor::Grey, NormalFont); @@ -39,17 +39,17 @@ iwBuildOrder::iwBuildOrder(const GameWorldViewer& gwv) list->AddItem(_(BUILDING_NAMES[buildOrder])); //-V807 // Nach ganz oben - AddImageButton(1, DrawPoint(250, 194), Extent(48, 20), TextureColor::Grey, LOADER.GetImageN("io", 215), _("Top")); + AddImageButton(1, DrawPoint(250, 194), Extent(48, 20), TextureColor::Grey, LOADER.getImageN("io", 215), _("Top")); // Hoch - AddImageButton(2, DrawPoint(250, 216), Extent(48, 20), TextureColor::Grey, LOADER.GetImageN("io", 33), _("Up")); + AddImageButton(2, DrawPoint(250, 216), Extent(48, 20), TextureColor::Grey, LOADER.getImageN("io", 33), _("Up")); // Runter - AddImageButton(3, DrawPoint(250, 238), Extent(48, 20), TextureColor::Grey, LOADER.GetImageN("io", 34), _("Down")); + AddImageButton(3, DrawPoint(250, 238), Extent(48, 20), TextureColor::Grey, LOADER.getImageN("io", 34), _("Down")); // Nach ganz unten - AddImageButton(4, DrawPoint(250, 260), Extent(48, 20), TextureColor::Grey, LOADER.GetImageN("io", 216), + AddImageButton(4, DrawPoint(250, 260), Extent(48, 20), TextureColor::Grey, LOADER.getImageN("io", 216), _("Bottom")); // Bild der Auswahl - AddImage(5, DrawPoint(240, 150), LOADER.GetBuildingTex(gwv.GetPlayer().nation, pendingBuildOrder[0])); + AddImage(5, DrawPoint(240, 150), LOADER.getBuildingTex(gwv.getPlayer().nation, pendingBuildOrder[0])); ctrlComboBox* combo = AddComboBox(6, DrawPoint(15, 30), Extent(290, 20), TextureColor::Grey, NormalFont, 100); combo->AddItem(_("Sequence of given order")); // "Reihenfolge der Auftraggebung" @@ -57,30 +57,30 @@ iwBuildOrder::iwBuildOrder(const GameWorldViewer& gwv) // Eintrag in Combobox auswählen useCustomBuildOrder = GAMECLIENT.visual_settings.useCustomBuildOrder; - combo->SetSelection(useCustomBuildOrder ? 1 : 0); + combo->setSelection(useCustomBuildOrder ? 1 : 0); // Standard - AddImageButton(10, DrawPoint(200, 250), Extent(48, 30), TextureColor::Grey, LOADER.GetImageN("io", 191), + AddImageButton(10, DrawPoint(200, 250), Extent(48, 30), TextureColor::Grey, LOADER.getImageN("io", 191), _("Default")); - list->SetSelection(0); + list->setSelection(0); } void iwBuildOrder::TransmitSettings() { - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) return; // Wurden Einstellungen geändert? if(settings_changed) { // Einstellungen speichern - useCustomBuildOrder = GetCtrl(6)->GetSelection() != 0u; + useCustomBuildOrder = getCtrl(6)->getSelection() != 0u; BuildOrders transmitPendingBuildOrder; unsigned int i = 0; for(; i < pendingBuildOrder.size(); i++) transmitPendingBuildOrder[i] = pendingBuildOrder[i]; - if(!wineaddon::isAddonActive(gwv.GetWorld())) + if(!wineaddon::isAddonActive(gwv.getWorld())) { transmitPendingBuildOrder[i++] = BuildingType::Vineyard; transmitPendingBuildOrder[i++] = BuildingType::Winery; @@ -90,10 +90,10 @@ void iwBuildOrder::TransmitSettings() // This is not an OBB write because pendingBuildOrder does not contain the leather/wine building // entries when the addon is inactive. So the pendingBuildOrder list is shorter then // the transmitPendingBuildOrder list. See fillBuildOrder at the top of this file. - if(!gwv.GetWorld().GetGGS().isEnabled(AddonId::CHARBURNER)) + if(!gwv.getWorld().getGGS().isEnabled(AddonId::CHARBURNER)) transmitPendingBuildOrder[i++] = BuildingType::Charburner; - if(!leatheraddon::isAddonActive(gwv.GetWorld())) + if(!leatheraddon::isAddonActive(gwv.getWorld())) { transmitPendingBuildOrder[i++] = BuildingType::Skinner; transmitPendingBuildOrder[i++] = BuildingType::Tannery; @@ -111,7 +111,7 @@ void iwBuildOrder::TransmitSettings() void iwBuildOrder::msgListSelectItem(const unsigned ctrl_id, const int selection) { - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) return; switch(ctrl_id) { @@ -119,8 +119,8 @@ void iwBuildOrder::msgListSelectItem(const unsigned ctrl_id, const int selection case 0: { - GetCtrl(5)->SetImage( - LOADER.GetBuildingTex(gwv.GetPlayer().nation, pendingBuildOrder[selection])); + getCtrl(5)->setImage( + LOADER.getBuildingTex(gwv.getPlayer().nation, pendingBuildOrder[selection])); } break; } @@ -137,15 +137,15 @@ void iwBuildOrder::msgComboSelectItem(unsigned ctrl_id, unsigned selection) void iwBuildOrder::msgButtonClick(const unsigned ctrl_id) { - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) return; - auto* list = GetCtrl(0); + auto* list = getCtrl(0); - if(!list->GetSelection()) + if(!list->getSelection()) return; - unsigned selection = *list->GetSelection(); - unsigned numOptions = list->GetNumLines(); + unsigned selection = *list->getSelection(); + unsigned numOptions = list->getNumLines(); // Auswahl gültig? @@ -200,15 +200,15 @@ void iwBuildOrder::msgButtonClick(const unsigned ctrl_id) // Baureihenfolge vom Spieler kopieren fillBuildOrder(GAMECLIENT.default_settings.build_order); - auto* list = GetCtrl(0); + auto* list = getCtrl(0); list->DeleteAllItems(); // Liste füllen for(unsigned char i = 0; i < 31; ++i) list->AddItem(_(BUILDING_NAMES[pendingBuildOrder[i]])); - list->SetSelection(0); + list->setSelection(0); - GetCtrl(5)->SetImage(LOADER.GetBuildingTex(gwv.GetPlayer().nation, pendingBuildOrder[0])); + getCtrl(5)->setImage(LOADER.getBuildingTex(gwv.getPlayer().nation, pendingBuildOrder[0])); settings_changed = true; } @@ -218,13 +218,13 @@ void iwBuildOrder::msgButtonClick(const unsigned ctrl_id) void iwBuildOrder::UpdateSettings() { - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) { - gwv.GetPlayer().FillVisualSettings(GAMECLIENT.visual_settings); + gwv.getPlayer().FillVisualSettings(GAMECLIENT.visual_settings); fillBuildOrder(GAMECLIENT.visual_settings.build_order); useCustomBuildOrder = GAMECLIENT.visual_settings.useCustomBuildOrder; } - GetCtrl(6)->SetSelection(useCustomBuildOrder ? 1 : 0); + getCtrl(6)->setSelection(useCustomBuildOrder ? 1 : 0); for(unsigned char i = 0; i < pendingBuildOrder.size(); ++i) - GetCtrl(0)->SetItemText(i, _(BUILDING_NAMES[pendingBuildOrder[i]])); + getCtrl(0)->setItemText(i, _(BUILDING_NAMES[pendingBuildOrder[i]])); } diff --git a/libs/s25main/ingameWindows/iwBuilding.cpp b/libs/s25main/ingameWindows/iwBuilding.cpp index e59fcf14e3..b7c777b0e8 100644 --- a/libs/s25main/ingameWindows/iwBuilding.cpp +++ b/libs/s25main/ingameWindows/iwBuilding.cpp @@ -30,104 +30,104 @@ const unsigned IODAT_BOAT_ID = 219; const unsigned IODAT_SHIP_ID = 218; iwBuilding::iwBuilding(GameWorldView& gwv, GameCommandFactory& gcFactory, nobUsual* const building, Extent extent) - : IngameWindow(CGI_BUILDING + MapBase::CreateGUIID(building->GetPos()), IngameWindow::posAtMouse, extent, - _(BUILDING_NAMES[building->GetBuildingType()]), LOADER.GetImageN("resource", 41)), - gwv(gwv), gcFactory(gcFactory), building(building), productivity(building->GetProductivity()) + : IngameWindow(CGI_BUILDING + MapBase::CreateGUIID(building->getPos()), IngameWindow::posAtMouse, extent, + _(BUILDING_NAMES[building->getBuildingType()]), LOADER.getImageN("resource", 41)), + gwv(gwv), gcFactory(gcFactory), building(building), productivity(building->getProductivity()) { // Arbeitersymbol - AddImage(0, DrawPoint(28, 39), LOADER.GetMapTexture(2298)); + AddImage(0, DrawPoint(28, 39), LOADER.getMapTexture(2298)); - if(const auto job = BLD_WORK_DESC[building->GetBuildingType()].job) - AddImage(13, DrawPoint(28, 39), LOADER.GetJobTex(*job)); + if(const auto job = BLD_WORK_DESC[building->getBuildingType()].job) + AddImage(13, DrawPoint(28, 39), LOADER.getJobTex(*job)); // Gebäudesymbol - AddImage(1, DrawPoint(117, 114), &building->GetBuildingImage()); + AddImage(1, DrawPoint(117, 114), &building->getBuildingImage()); // Symbol der produzierten Ware (falls hier was produziert wird) - const auto& producedWare = BLD_WORK_DESC[building->GetBuildingType()].producedWare; + const auto& producedWare = BLD_WORK_DESC[building->getBuildingType()].producedWare; ITexture* tex = visit( - composeVisitor([](GoodType gt) -> ITexture* { return gt != GoodType::Nothing ? LOADER.GetWareTex(gt) : nullptr; }, - [](Job job) -> ITexture* { return LOADER.GetJobTex(job); }, + composeVisitor([](GoodType gt) -> ITexture* { return gt != GoodType::Nothing ? LOADER.getWareTex(gt) : nullptr; }, + [](Job job) -> ITexture* { return LOADER.getJobTex(job); }, [](std::nullopt_t) -> ITexture* { return nullptr; }), producedWare); if(tex) { - AddImage(2, DrawPoint(196, 39), LOADER.GetMapTexture(2298)); + AddImage(2, DrawPoint(196, 39), LOADER.getMapTexture(2298)); AddImage(3, DrawPoint(196, 39), tex); } // Info - AddImageButton(4, DrawPoint(16, extent.y - 47), Extent(30, 32), TextureColor::Grey, LOADER.GetImageN("io", 225), + AddImageButton(4, DrawPoint(16, extent.y - 47), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); // Abreißen - AddImageButton(5, DrawPoint(50, extent.y - 47), Extent(34, 32), TextureColor::Grey, LOADER.GetImageN("io", 23), + AddImageButton(5, DrawPoint(50, extent.y - 47), Extent(34, 32), TextureColor::Grey, LOADER.getImageN("io", 23), _("Demolish house")); // Produktivität einstellen (196,197) (bei Spähturm ausblenden) Window* enable_productivity = AddImageButton( 6, DrawPoint(90, extent.y - 47), Extent(34, 32), TextureColor::Grey, - LOADER.GetImageN("io", ((building->IsProductionDisabledVirtual()) ? 197 : 196)), _("Production on/off")); - if(building->GetBuildingType() == BuildingType::LookoutTower) - enable_productivity->SetVisible(false); + LOADER.getImageN("io", ((building->isProductionDisabledVirtual()) ? 197 : 196)), _("Production on/off")); + if(building->getBuildingType() == BuildingType::LookoutTower) + enable_productivity->setVisible(false); // Bei Bootsbauer Button zum Umwählen von Booten und Schiffen - if(building->GetBuildingType() == BuildingType::Shipyard) + if(building->getBuildingType() == BuildingType::Shipyard) { // Jenachdem Boot oder Schiff anzeigen unsigned io_dat_id = - (static_cast(building)->GetMode() == nobShipYard::Mode::Boats) ? IODAT_BOAT_ID : IODAT_SHIP_ID; + (static_cast(building)->getMode() == nobShipYard::Mode::Boats) ? IODAT_BOAT_ID : IODAT_SHIP_ID; AddImageButton(11, DrawPoint(130, extent.y - 47), Extent(43, 32), TextureColor::Grey, - LOADER.GetImageN("io", io_dat_id), _("Ships/Boats")); + LOADER.getImageN("io", io_dat_id), _("Ships/Boats")); } // "Gehe Zum Ort" - AddImageButton(7, DrawPoint(179, extent.y - 47), Extent(30, 32), TextureColor::Grey, LOADER.GetImageN("io", 107), + AddImageButton(7, DrawPoint(179, extent.y - 47), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 107), _("Go to place")); // Produktivitätsanzeige (bei Katapulten und Spähtürmen ausblenden) Window* productivity = AddPercent(9, DrawPoint(59, 31), Extent(106, 16), TextureColor::Grey, 0xFFFFFF00, SmallFont, &this->productivity); - if(building->GetBuildingType() == BuildingType::Catapult - || building->GetBuildingType() == BuildingType::LookoutTower) - productivity->SetVisible(false); + if(building->getBuildingType() == BuildingType::Catapult + || building->getBuildingType() == BuildingType::LookoutTower) + productivity->setVisible(false); AddText(10, DrawPoint(113, 50), _("(House unoccupied)"), COLOR_RED, FontStyle::CENTER, NormalFont); // "Go to next" (building of same type) AddImageButton(12, DrawPoint(179, extent.y - 79), Extent(30, 32), TextureColor::Grey, - LOADER.GetImageN("io_new", 11), _("Go to next building of same type")); + LOADER.getImageN("io_new", 11), _("Go to next building of same type")); } void iwBuilding::msgPaintBefore() { IngameWindow::msgPaintBefore(); - productivity = building->GetProductivity(); + productivity = building->getProductivity(); // Haus unbesetzt ggf ausblenden - GetCtrl(10)->SetVisible(!building->HasWorker()); + getCtrl(10)->setVisible(!building->hasWorker()); } void iwBuilding::msgPaintAfter() { IngameWindow::msgPaintAfter(); - const auto& bldWorkDesk = BLD_WORK_DESC[building->GetBuildingType()]; - if(BuildingProperties::IsMine(building->GetBuildingType())) + const auto& bldWorkDesk = BLD_WORK_DESC[building->getBuildingType()]; + if(BuildingProperties::isMine(building->getBuildingType())) { // Bei Bergwerken sieht die Nahrungsanzeige ein wenig anders aus (3x 2) // "Schwarzer Rahmen" - DrawRectangle(Rect(GetDrawPos() + DrawPoint(40, 60), Extent(144, 24)), 0x80000000); - DrawPoint curPos = GetDrawPos() + DrawPoint(52, 72); + DrawRectangle(Rect(getDrawPos() + DrawPoint(40, 60), Extent(144, 24)), 0x80000000); + DrawPoint curPos = getDrawPos() + DrawPoint(52, 72); for(unsigned char i = 0; i < bldWorkDesk.waresNeeded.size(); ++i) { for(unsigned char z = 0; z < bldWorkDesk.numSpacesPerWare; ++z) { - LOADER.GetWareTex(bldWorkDesk.waresNeeded[i]) - ->DrawFull(curPos, (z < building->GetNumWares(i) ? 0xFFFFFFFF : 0xFF404040)); + LOADER.getWareTex(bldWorkDesk.waresNeeded[i]) + ->DrawFull(curPos, (z < building->getNumWares(i) ? 0xFFFFFFFF : 0xFF404040)); curPos.x += 24; } } } else { - DrawPoint curPos = GetDrawPos() + DrawPoint(GetSize().x / 2, 60); + DrawPoint curPos = getDrawPos() + DrawPoint(getSize().x / 2, 60); for(unsigned char i = 0; i < bldWorkDesk.waresNeeded.size(); ++i) { const unsigned wares_count = bldWorkDesk.numSpacesPerWare; @@ -139,13 +139,13 @@ void iwBuilding::msgPaintAfter() for(unsigned char z = 0; z < wares_count; ++z) { - LOADER.GetWareTex(bldWorkDesk.waresNeeded[i]) - ->DrawFull(waresPos, (z < building->GetNumWares(i) ? COLOR_WHITE : 0xFF404040)); + LOADER.getWareTex(bldWorkDesk.waresNeeded[i]) + ->DrawFull(waresPos, (z < building->getNumWares(i) ? COLOR_WHITE : 0xFF404040)); waresPos.x += 24; } std::stringstream text; - text << (unsigned)building->GetNumWares(i) << "/" << wares_count; + text << (unsigned)building->getNumWares(i) << "/" << wares_count; NormalFont->Draw(curPos + DrawPoint(0, 12), text.str(), FontStyle::CENTER | FontStyle::VCENTER); curPos.y += 29; } @@ -159,7 +159,7 @@ void iwBuilding::msgButtonClick(const unsigned ctrl_id) case 4: // Hilfe { WINDOWMANAGER.ReplaceWindow( - std::make_unique(_(BUILDING_HELP_STRINGS[building->GetBuildingType()]))); + std::make_unique(_(BUILDING_HELP_STRINGS[building->getBuildingType()]))); } break; case 5: // Gebäude abbrennen @@ -173,53 +173,53 @@ void iwBuilding::msgButtonClick(const unsigned ctrl_id) { // Produktion einstellen/fortführen // NC senden - if(gcFactory.SetProductionEnabled(building->GetPos(), building->IsProductionDisabledVirtual())) + if(gcFactory.SetProductionEnabled(building->getPos(), building->isProductionDisabledVirtual())) { // visuell anzeigen, falls erfolgreich building->ToggleProductionVirtual(); // anderes Bild auf dem Button - if(building->IsProductionDisabledVirtual()) - GetCtrl(6)->SetImage(LOADER.GetImageN("io", 197)); + if(building->isProductionDisabledVirtual()) + getCtrl(6)->setImage(LOADER.getImageN("io", 197)); else - GetCtrl(6)->SetImage(LOADER.GetImageN("io", 196)); + getCtrl(6)->setImage(LOADER.getImageN("io", 196)); - auto* text = GetCtrl(10); - if(building->IsProductionDisabledVirtual() && building->HasWorker()) - text->SetText(_("(House unoccupied)")); - else if(building->HasWorker()) - text->SetVisible(false); + auto* text = getCtrl(10); + if(building->isProductionDisabledVirtual() && building->hasWorker()) + text->setText(_("(House unoccupied)")); + else if(building->hasWorker()) + text->setVisible(false); } } break; case 7: // "Gehe Zum Ort" { - gwv.MoveToMapPt(building->GetPos()); + gwv.MoveToMapPt(building->getPos()); } break; case 11: // Schiff/Boot umstellen bei Schiffsbauer { - if(gcFactory.SetShipYardMode(building->GetPos(), static_cast(building)->GetMode() + if(gcFactory.SetShipYardMode(building->getPos(), static_cast(building)->getMode() == nobShipYard::Mode::Boats)) { // Auch optisch den Button umstellen - auto* button = GetCtrl(11); - if(button->GetImage() == LOADER.GetImageN("io", IODAT_BOAT_ID)) - button->SetImage(LOADER.GetImageN("io", IODAT_SHIP_ID)); + auto* button = getCtrl(11); + if(button->getImage() == LOADER.getImageN("io", IODAT_BOAT_ID)) + button->setImage(LOADER.getImageN("io", IODAT_SHIP_ID)); else - button->SetImage(LOADER.GetImageN("io", IODAT_BOAT_ID)); + button->setImage(LOADER.getImageN("io", IODAT_BOAT_ID)); } } break; case 12: // go to next of same type { - const std::list& buildings = gwv.GetWorld() - .GetPlayer(building->GetPlayer()) - .GetBuildingRegister() - .GetBuildings(building->GetBuildingType()); + const std::list& buildings = gwv.getWorld() + .getPlayer(building->getPlayer()) + .getBuildingRegister() + .getBuildings(building->getBuildingType()); // go through list once we get to current building -> open window for the next one and go to next location auto it = helpers::find_if( - buildings, [bldPos = building->GetPos()](const auto* it) { return it->GetPos() == bldPos; }); + buildings, [bldPos = building->getPos()](const auto* it) { return it->getPos() == bldPos; }); if(it != buildings.end()) // got to current building in the list? { // close old window, open new window (todo: only open if it isnt already open), move to location of next @@ -228,12 +228,12 @@ void iwBuilding::msgButtonClick(const unsigned ctrl_id) ++it; if(it == buildings.end()) // was last entry in list -> goto first it = buildings.begin(); - gwv.MoveToMapPt((*it)->GetPos()); - if(building->GetBuildingType() == BuildingType::Temple) + gwv.MoveToMapPt((*it)->getPos()); + if(building->getBuildingType() == BuildingType::Temple) WINDOWMANAGER.ReplaceWindow(std::make_unique(gwv, gcFactory, *it)) - .SetPos(GetPos()); + .setPos(getPos()); else - WINDOWMANAGER.ReplaceWindow(std::make_unique(gwv, gcFactory, *it)).SetPos(GetPos()); + WINDOWMANAGER.ReplaceWindow(std::make_unique(gwv, gcFactory, *it)).setPos(getPos()); break; } } diff --git a/libs/s25main/ingameWindows/iwBuildingProductivities.cpp b/libs/s25main/ingameWindows/iwBuildingProductivities.cpp index d245dcaa4b..4b79057d11 100644 --- a/libs/s25main/ingameWindows/iwBuildingProductivities.cpp +++ b/libs/s25main/ingameWindows/iwBuildingProductivities.cpp @@ -40,7 +40,7 @@ const std::array iwBuildingProductivities::allIcons = { void iwBuildingProductivities::setBuildingOrder() { usedIcons.assign(allIcons.begin(), allIcons.end()); - helpers::erase_if(usedIcons, makeIsUnusedBuilding(player.GetGameWorld().GetGGS())); + helpers::erase_if(usedIcons, makeIsUnusedBuilding(player.getGameWorld().getGGS())); } /// Abstand vom linken, oberen Fensterrand @@ -59,7 +59,7 @@ constexpr Extent cellSize(percent_image_x + percentSize.x + image_percent_x, dis iwBuildingProductivities::iwBuildingProductivities(const GamePlayer& player) : IngameWindow(CGI_BUILDINGSPRODUCTIVITY, IngameWindow::posLastOrCenter, cellSize * Extent(2, helpers::divCeil(allIcons.size(), 2) + 1) + bldProdContentOffset, - _("Productivity"), LOADER.GetImageN("resource", 41)), + _("Productivity"), LOADER.getImageN("resource", 41)), player(player), percents() { setBuildingOrder(); @@ -77,15 +77,15 @@ iwBuildingProductivities::iwBuildingProductivities(const GamePlayer& player) const DrawPoint curPos = cellSize * DrawPoint(x, y) + bldProdContentOffset; const DrawPoint imgPos = curPos + DrawPoint(0, percentSize.y / 2); const unsigned imgId = curIdx * 2; - if(player.IsBuildingEnabled(usedIcons[curIdx])) + if(player.isBuildingEnabled(usedIcons[curIdx])) { - AddImage(imgId, imgPos, LOADER.GetNationIcon(playerNation, usedIcons[curIdx]), + AddImage(imgId, imgPos, LOADER.getNationIcon(playerNation, usedIcons[curIdx]), _(BUILDING_NAMES[usedIcons[curIdx]])); DrawPoint percentPos = curPos + DrawPoint(image_percent_x, 0); AddPercent(imgId + 1, percentPos, percentSize, TextureColor::Grey, COLOR_YELLOW, SmallFont, &percents[usedIcons[curIdx]]); } else - AddImage(imgId, imgPos, LOADER.GetImageN("io", 188)); + AddImage(imgId, imgPos, LOADER.getImageN("io", 188)); } } @@ -100,7 +100,7 @@ iwBuildingProductivities::iwBuildingProductivities(const GamePlayer& player) void iwBuildingProductivities::UpdatePercents() { - percents = player.GetBuildingRegister().CalcProductivities(); + percents = player.getBuildingRegister().CalcProductivities(); } void iwBuildingProductivities::msgPaintAfter() diff --git a/libs/s25main/ingameWindows/iwBuildingSite.cpp b/libs/s25main/ingameWindows/iwBuildingSite.cpp index 1f74472b45..d0336275ff 100644 --- a/libs/s25main/ingameWindows/iwBuildingSite.cpp +++ b/libs/s25main/ingameWindows/iwBuildingSite.cpp @@ -16,24 +16,24 @@ #include "gameData/const_gui_ids.h" iwBuildingSite::iwBuildingSite(GameWorldView& gwv, const noBuildingSite* const buildingsite) - : IngameWindow(CGI_BUILDING + MapBase::CreateGUIID(buildingsite->GetPos()), IngameWindow::posAtMouse, - Extent(226, 194), _(BUILDING_NAMES[buildingsite->GetBuildingType()]), - LOADER.GetImageN("resource", 41)), + : IngameWindow(CGI_BUILDING + MapBase::CreateGUIID(buildingsite->getPos()), IngameWindow::posAtMouse, + Extent(226, 194), _(BUILDING_NAMES[buildingsite->getBuildingType()]), + LOADER.getImageN("resource", 41)), gwv(gwv), buildingsite(buildingsite) { // Bild des Gebäudes - AddImage(0, DrawPoint(113, 130), &buildingsite->GetBuildingImage()); + AddImage(0, DrawPoint(113, 130), &buildingsite->getBuildingImage()); // Gebäudename AddText(1, DrawPoint(113, 44), _("Order of building site"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); // Hilfe - AddImageButton(2, DrawPoint(16, 147), Extent(30, 32), TextureColor::Grey, LOADER.GetImageN("io", 225), _("Help")); + AddImageButton(2, DrawPoint(16, 147), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); // Gebäude abbrennen - AddImageButton(3, DrawPoint(50, 147), Extent(34, 32), TextureColor::Grey, LOADER.GetImageN("io", 23), + AddImageButton(3, DrawPoint(50, 147), Extent(34, 32), TextureColor::Grey, LOADER.getImageN("io", 23), _("Demolish house")); // "Gehe Zu Ort" - AddImageButton(4, DrawPoint(179, 147), Extent(30, 32), TextureColor::Grey, LOADER.GetImageN("io", 107), + AddImageButton(4, DrawPoint(179, 147), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 107), _("Go to place")); } @@ -44,7 +44,7 @@ void iwBuildingSite::msgButtonClick(const unsigned ctrl_id) case 2: // Hilfe { WINDOWMANAGER.ReplaceWindow( - std::make_unique(_(BUILDING_HELP_STRINGS[buildingsite->GetBuildingType()]))); + std::make_unique(_(BUILDING_HELP_STRINGS[buildingsite->getBuildingType()]))); } break; case 3: // Gebäude abbrennen @@ -56,7 +56,7 @@ void iwBuildingSite::msgButtonClick(const unsigned ctrl_id) break; case 4: // "Gehe Zu Ort" { - gwv.MoveToMapPt(buildingsite->GetPos()); + gwv.MoveToMapPt(buildingsite->getPos()); } break; } @@ -66,7 +66,7 @@ void iwBuildingSite::msgPaintAfter() { IngameWindow::msgPaintAfter(); // Baukosten zeichnen - DrawPoint curPos = GetDrawPos() + DrawPoint(GetSize().x / 2, 60); + DrawPoint curPos = getDrawPos() + DrawPoint(getSize().x / 2, 60); for(unsigned char i = 0; i < 2; ++i) { unsigned wares_count = 0; @@ -75,12 +75,12 @@ void iwBuildingSite::msgPaintAfter() if(i == 0) { - wares_count = BUILDING_COSTS[buildingsite->GetBuildingType()].boards; + wares_count = BUILDING_COSTS[buildingsite->getBuildingType()].boards; wares_used = buildingsite->getUsedBoards(); wares_delivered = buildingsite->getBoards() + wares_used; } else { - wares_count = BUILDING_COSTS[buildingsite->GetBuildingType()].stones; + wares_count = BUILDING_COSTS[buildingsite->getBuildingType()].stones; wares_used = buildingsite->getUsedStones(); wares_delivered = buildingsite->getStones() + wares_used; } @@ -96,12 +96,12 @@ void iwBuildingSite::msgPaintAfter() // Die Waren for(unsigned char z = 0; z < wares_count; ++z) { - LOADER.GetWareTex(i == 0 ? GoodType::Boards : GoodType::Stones) + LOADER.getWareTex(i == 0 ? GoodType::Boards : GoodType::Stones) ->DrawFull(waresPos, (z < wares_delivered ? 0xFFFFFFFF : 0xFF404040)); // Hammer wenn Ware verbaut if(z < wares_used) - LOADER.GetWareTex(GoodType::Hammer)->DrawFull(waresPos); + LOADER.getWareTex(GoodType::Hammer)->DrawFull(waresPos); waresPos.x += 24; } curPos.y += 29; diff --git a/libs/s25main/ingameWindows/iwBuildings.cpp b/libs/s25main/ingameWindows/iwBuildings.cpp index 0d4b9cfb56..1314638fa5 100644 --- a/libs/s25main/ingameWindows/iwBuildings.cpp +++ b/libs/s25main/ingameWindows/iwBuildings.cpp @@ -51,7 +51,7 @@ void iwBuildings::setBuildingOrder() BuildingType::Skinner, BuildingType::Tannery, BuildingType::LeatherWorks, // entry 37 }; - helpers::erase_if(bts, makeIsUnusedBuilding(gwv.GetWorld().GetGGS())); + helpers::erase_if(bts, makeIsUnusedBuilding(gwv.getWorld().getGGS())); } // Abstand des ersten Icons vom linken oberen Fensterrand @@ -71,13 +71,13 @@ enum iwBuildings::iwBuildings(GameWorldView& gwv, GameCommandFactory& gcFactory) : IngameWindow(CGI_BUILDINGS, IngameWindow::posLastOrCenter, Extent(185, 480), _("Buildings"), - LOADER.GetImageN("resource", 41)), + LOADER.getImageN("resource", 41)), gwv(gwv), gcFactory(gcFactory) { setBuildingOrder(); Resize(iconSpacing * Extent(4, helpers::divCeil(bts.size(), 4) + 1) + bldContentOffset); - const Nation playerNation = gwv.GetViewer().GetPlayer().nation; + const Nation playerNation = gwv.getViewer().getPlayer().nation; // Symbole für die einzelnen Gebäude erstellen for(unsigned y = 0; y < bts.size() / 4 + (bts.size() % 4 > 0 ? 1 : 0); ++y) { @@ -89,14 +89,14 @@ iwBuildings::iwBuildings(GameWorldView& gwv, GameCommandFactory& gcFactory) Extent btSize = Extent(32, 32); DrawPoint btPos = bldContentOffset - btSize / 2 + iconSpacing * DrawPoint(x, y); AddImageButton(ID_BuildingsStart + y * 4 + x, btPos, btSize, TextureColor::Grey, - LOADER.GetNationIcon(playerNation, bts[y * 4 + x]), _(BUILDING_NAMES[bts[y * 4 + x]])); + LOADER.getNationIcon(playerNation, bts[y * 4 + x]), _(BUILDING_NAMES[bts[y * 4 + x]])); } } // "Help" button Extent btSize = Extent(30, 32); - AddImageButton(ID_Help, GetFullSize() - DrawPoint(14, 20) - btSize, btSize, TextureColor::Grey, - LOADER.GetImageN("io", 225), _("Help")); + AddImageButton(ID_Help, getFullSize() - DrawPoint(14, 20) - btSize, btSize, TextureColor::Grey, + LOADER.getImageN("io", 225), _("Help")); } /// Anzahlen der Gebäude zeichnen @@ -105,10 +105,10 @@ void iwBuildings::msgPaintAfter() static boost::format fmt("%1%/%2%"); IngameWindow::msgPaintAfter(); // Anzahlen herausfinden - BuildingCount bc = gwv.GetViewer().GetPlayer().GetBuildingRegister().GetBuildingNums(); + BuildingCount bc = gwv.getViewer().getPlayer().getBuildingRegister().getBuildingNums(); // Anzahlen unter die Gebäude schreiben - DrawPoint rowPos = GetDrawPos() + bldContentOffset + DrawPoint(0, font_distance_y); + DrawPoint rowPos = getDrawPos() + bldContentOffset + DrawPoint(0, font_distance_y); for(unsigned y = 0; y < helpers::divCeil(bts.size(), 4); ++y) { DrawPoint curPos = rowPos; @@ -139,20 +139,20 @@ void iwBuildings::msgButtonClick(const unsigned ctrl_id) } // no buildings of type complete? -> do nothing - const GamePlayer& localPlayer = gwv.GetViewer().GetPlayer(); - const BuildingRegister& buildingRegister = localPlayer.GetBuildingRegister(); + const GamePlayer& localPlayer = gwv.getViewer().getPlayer(); + const BuildingRegister& buildingRegister = localPlayer.getBuildingRegister(); BuildingType bldType = bts[ctrl_id - ID_BuildingsStart]; - if(BuildingProperties::IsMilitary(bldType)) - GoToFirstMatching(bldType, buildingRegister.GetMilitaryBuildings()); + if(BuildingProperties::isMilitary(bldType)) + GoToFirstMatching(bldType, buildingRegister.getMilitaryBuildings()); else if(bldType == BuildingType::HarborBuilding) - GoToFirstMatching(bldType, buildingRegister.GetHarbors()); - else if(BuildingProperties::IsWareHouse(bldType)) - GoToFirstMatching(bldType, buildingRegister.GetStorehouses()); + GoToFirstMatching(bldType, buildingRegister.getHarbors()); + else if(BuildingProperties::isWareHouse(bldType)) + GoToFirstMatching(bldType, buildingRegister.getStorehouses()); else if(bldType == BuildingType::Temple) - GoToFirstMatching(bldType, buildingRegister.GetBuildings(bldType)); + GoToFirstMatching(bldType, buildingRegister.getBuildings(bldType)); else - GoToFirstMatching(bldType, buildingRegister.GetBuildings(bldType)); + GoToFirstMatching(bldType, buildingRegister.getBuildings(bldType)); } template @@ -160,11 +160,11 @@ void iwBuildings::GoToFirstMatching(BuildingType bldType, const std::listGetBuildingType() == bldType) + if(bld->getBuildingType() == bldType) { - gwv.MoveToMapPt(bld->GetPos()); + gwv.MoveToMapPt(bld->getPos()); auto nextscrn = std::make_unique(gwv, gcFactory, static_cast(bld)); - nextscrn->SetPos(GetPos()); + nextscrn->setPos(getPos()); WINDOWMANAGER.ReplaceWindow(std::move(nextscrn)); return; } diff --git a/libs/s25main/ingameWindows/iwChat.cpp b/libs/s25main/ingameWindows/iwChat.cpp index d9b702df68..1c98ce07ce 100644 --- a/libs/s25main/ingameWindows/iwChat.cpp +++ b/libs/s25main/ingameWindows/iwChat.cpp @@ -16,7 +16,7 @@ ChatDestination lastChatDestination = ChatDestination::All; iwChat::iwChat(Window* parent) : IngameWindow(CGI_CHAT, IngameWindow::posLastOrCenter, Extent(300, 150), _("Chat Window"), - LOADER.GetImageN("resource", 41), false, CloseBehavior::Regular, parent) + LOADER.getImageN("resource", 41), false, CloseBehavior::Regular, parent) { // Eingabefeld für Chattext AddEdit(0, DrawPoint(20, 30), Extent(260, 22), TextureColor::Grey, NormalFont); @@ -33,33 +33,33 @@ iwChat::iwChat(Window* parent) TextureColor::Red1, _("Enemies"), NormalFont); // Entspr. vom letzten Mal auswählen auswählen - group->SetSelection(rttr::enum_cast(lastChatDestination)); + group->setSelection(rttr::enum_cast(lastChatDestination)); } void iwChat::msgPaintBefore() { IngameWindow::msgPaintBefore(); - GetCtrl(0)->SetFocus(); + getCtrl(0)->setFocus(); } void iwChat::msgOptionGroupChange(const unsigned /*ctrl_id*/, unsigned selection) { RTTR_Assert(selection <= helpers::MaxEnumValue_v); lastChatDestination = static_cast(selection); - GetCtrl(0)->SetFocus(); + getCtrl(0)->setFocus(); } void iwChat::msgEditEnter(const unsigned /*ctrl_id*/) { Close(); - auto* edit = GetCtrl(0); - std::string text = edit->GetText(); - edit->SetText(""); + auto* edit = getCtrl(0); + std::string text = edit->getText(); + edit->setText(""); if(text.size() > 3u && text[0] == '!') { - auto* listener = dynamic_cast(GetParent()); + auto* listener = dynamic_cast(getParent()); if(listener) listener->OnChatCommand(text.substr(1)); } else diff --git a/libs/s25main/ingameWindows/iwConnecting.cpp b/libs/s25main/ingameWindows/iwConnecting.cpp index 5c1898d4ab..4836d3e005 100644 --- a/libs/s25main/ingameWindows/iwConnecting.cpp +++ b/libs/s25main/ingameWindows/iwConnecting.cpp @@ -25,24 +25,24 @@ enum iwConnecting::iwConnecting(ServerType serverType, std::unique_ptr lobbyClient) : IngameWindow(CGI_CONNECTING, IngameWindow::posCenter, Extent(300, 120), _("Connecting"), - LOADER.GetImageN("resource", 41), true, CloseBehavior::Custom), + LOADER.getImageN("resource", 41), true, CloseBehavior::Custom), serverType_(serverType), lobbyClient_(std::move(lobbyClient)) { - WINDOWMANAGER.SetCursor(Cursor::Moon); + WINDOWMANAGER.setCursor(Cursor::Moon); AddText(ID_txtStatus, DrawPoint(150, 30), _("Please wait..."), COLOR_YELLOW, FontStyle::CENTER, NormalFont); AddPercent(ID_prgLoad, DrawPoint(20, 50), Extent(260, 26), TextureColor::Grey, COLOR_YELLOW, SmallFont, &downloadProgress_) - ->SetVisible(false); + ->setVisible(false); AddTextButton(ID_btAbort, DrawPoint(87, 80), Extent(125, 22), TextureColor::Red1, _("Abort"), NormalFont); - GAMECLIENT.SetInterface(this); + GAMECLIENT.setInterface(this); } void iwConnecting::Close() { IngameWindow::Close(); - WINDOWMANAGER.SetCursor(); + WINDOWMANAGER.setCursor(); GAMECLIENT.RemoveInterface(this); } @@ -66,8 +66,8 @@ void iwConnecting::CI_Error(const ClientError ce) void iwConnecting::CI_NextConnectState(const ConnectState cs) { - auto* prgLoad = GetCtrl(ID_prgLoad); - prgLoad->SetVisible(false); + auto* prgLoad = getCtrl(ID_prgLoad); + prgLoad->setVisible(false); switch(cs) { case ConnectState::Initiated: setStatus(_("Waiting for Reply...")); break; @@ -76,15 +76,15 @@ void iwConnecting::CI_NextConnectState(const ConnectState cs) case ConnectState::QueryMapInfo: setStatus(_("Checking Map...")); break; case ConnectState::ReceiveMap: setStatus(_("Receiving Map...")); - prgLoad->SetVisible(true); + prgLoad->setVisible(true); break; case ConnectState::VerifyMap: setStatus(_("Checking Map...")); break; case ConnectState::QueryServerName: setStatus(_("Waiting for server info...")); break; case ConnectState::QueryPlayerList: setStatus(_("Waiting for Playerinfo...")); break; case ConnectState::QuerySettings: setStatus(_("Waiting for server info...")); break; case ConnectState::Finished: - WINDOWMANAGER.Switch(std::make_unique(serverType_, GAMECLIENT.GetGameLobby(), - GAMECLIENT.GetPlayerId(), std::move(lobbyClient_))); + WINDOWMANAGER.Switch(std::make_unique(serverType_, GAMECLIENT.getGameLobby(), + GAMECLIENT.getPlayerId(), std::move(lobbyClient_))); Close(); break; } @@ -97,5 +97,5 @@ void iwConnecting::CI_MapPartReceived(uint32_t bytesReceived, uint32_t bytesTota void iwConnecting::setStatus(const std::string& status) { - GetCtrl(ID_txtStatus)->SetText(status); + getCtrl(ID_txtStatus)->setText(status); } diff --git a/libs/s25main/ingameWindows/iwDemolishBuilding.cpp b/libs/s25main/ingameWindows/iwDemolishBuilding.cpp index 5ac736c7a8..857f0296bf 100644 --- a/libs/s25main/ingameWindows/iwDemolishBuilding.cpp +++ b/libs/s25main/ingameWindows/iwDemolishBuilding.cpp @@ -14,22 +14,22 @@ #include "gameData/const_gui_ids.h" iwDemolishBuilding::iwDemolishBuilding(GameWorldView& gwv, const noBaseBuilding* building, const bool flag) - : IngameWindow(CGI_BUILDING + MapBase::CreateGUIID(building->GetPos()), IngameWindow::posAtMouse, Extent(200, 200), - _("Demolish?"), LOADER.GetImageN("resource", 41)), + : IngameWindow(CGI_BUILDING + MapBase::CreateGUIID(building->getPos()), IngameWindow::posAtMouse, Extent(200, 200), + _("Demolish?"), LOADER.getImageN("resource", 41)), gwv(gwv), building(building), flag(flag) { // Ja - AddImageButton(0, DrawPoint(14, 140), Extent(66, 40), TextureColor::Red1, LOADER.GetImageN("io", 32), + AddImageButton(0, DrawPoint(14, 140), Extent(66, 40), TextureColor::Red1, LOADER.getImageN("io", 32), _("Yes")); //-V525 // Nein - AddImageButton(1, DrawPoint(82, 140), Extent(66, 40), TextureColor::Grey, LOADER.GetImageN("io", 40), _("No")); + AddImageButton(1, DrawPoint(82, 140), Extent(66, 40), TextureColor::Grey, LOADER.getImageN("io", 40), _("No")); // Gehe zum Standort - AddImageButton(2, DrawPoint(150, 140), Extent(36, 40), TextureColor::Grey, LOADER.GetImageN("io", 107), + AddImageButton(2, DrawPoint(150, 140), Extent(36, 40), TextureColor::Grey, LOADER.getImageN("io", 107), _("Go to place")); // Gebäudebild - AddImage(3, DrawPoint(104, 109), &building->GetBuildingImage()); + AddImage(3, DrawPoint(104, 109), &building->getBuildingImage()); // Gebäudename - AddText(4, DrawPoint(100, 125), _(BUILDING_NAMES[building->GetBuildingType()]), 0xFFFFFF00, FontStyle::CENTER, + AddText(4, DrawPoint(100, 125), _(BUILDING_NAMES[building->getBuildingType()]), 0xFFFFFF00, FontStyle::CENTER, NormalFont); } @@ -44,10 +44,10 @@ void iwDemolishBuilding::msgButtonClick(const unsigned ctrl_id) { // Flagge (mitsamt Gebäude) wegreißen success = - GAMECLIENT.DestroyFlag(gwv.GetViewer().GetNeighbour(building->GetPos(), Direction::SouthEast)); + GAMECLIENT.DestroyFlag(gwv.getViewer().getNeighbour(building->getPos(), Direction::SouthEast)); } else { - success = GAMECLIENT.DestroyBuilding(building->GetPos()); + success = GAMECLIENT.DestroyBuilding(building->getPos()); } if(success) @@ -63,7 +63,7 @@ void iwDemolishBuilding::msgButtonClick(const unsigned ctrl_id) case 2: { // Zum Ort gehen - gwv.MoveToMapPt(building->GetPos()); + gwv.MoveToMapPt(building->getPos()); } break; } diff --git a/libs/s25main/ingameWindows/iwDiplomacy.cpp b/libs/s25main/ingameWindows/iwDiplomacy.cpp index 6b20a7ac5b..3bbecd0f9d 100644 --- a/libs/s25main/ingameWindows/iwDiplomacy.cpp +++ b/libs/s25main/ingameWindows/iwDiplomacy.cpp @@ -42,8 +42,8 @@ const unsigned short TREATIE_BUTTON_SPACE = 20; iwDiplomacy::iwDiplomacy(const GameWorldViewer& gwv, GameCommandFactory& gcFactory) : IngameWindow(CGI_DIPLOMACY, IngameWindow::posLastOrCenter, - Extent(500, FIRST_LINE_Y + gwv.GetWorld().GetNumPlayers() * (CELL_HEIGHT + SPACE_HEIGHT) + 20), - _("Diplomacy"), LOADER.GetImageN("resource", 41)), + Extent(500, FIRST_LINE_Y + gwv.getWorld().getNumPlayers() * (CELL_HEIGHT + SPACE_HEIGHT) + 20), + _("Diplomacy"), LOADER.getImageN("resource", 41)), gwv(gwv), gcFactory(gcFactory) { // "Header" der Tabelle @@ -53,9 +53,9 @@ iwDiplomacy::iwDiplomacy(const GameWorldViewer& gwv, GameCommandFactory& gcFacto FontStyle::CENTER, NormalFont); DrawPoint curTxtPos(LINE_DISTANCE_TO_MARGINS + 10, FIRST_LINE_Y + CELL_HEIGHT / 2 - CELL_HEIGHT - SPACE_HEIGHT); - for(unsigned i = 0; i < gwv.GetWorld().GetNumPlayers(); ++i) + for(unsigned i = 0; i < gwv.getWorld().getNumPlayers(); ++i) { - const GamePlayer& player = gwv.GetWorld().GetPlayer(i); + const GamePlayer& player = gwv.getWorld().getPlayer(i); curTxtPos.y += CELL_HEIGHT + SPACE_HEIGHT; if(!player.isUsed()) continue; @@ -70,26 +70,26 @@ iwDiplomacy::iwDiplomacy(const GameWorldViewer& gwv, GameCommandFactory& gcFacto } // An sich selber braucht man keine Bündnisse zu schließen - if(gwv.GetPlayerId() == i) + if(gwv.getPlayerId() == i) continue; // Bündnisvertrag-Button - glArchivItem_Bitmap* image = LOADER.GetImageN("io", 61); + glArchivItem_Bitmap* image = LOADER.getImageN("io", 61); Extent btSize(40, 40); DrawPoint btPos(LINE_DISTANCE_TO_MARGINS + TREATIES_POS - TREATIE_BUTTON_SPACE / 2 - (image->getWidth() + 8), curTxtPos.y - btSize.y / 2); ctrlButton* button = AddImageButton(300 + i, btPos, btSize, TextureColor::Grey, image, _("Treaty of alliance")); // Verbleibende Zeit unter dem Button - DrawPoint remainingTimePos = button->GetPos() + DrawPoint(btSize.x / 2, btSize.y + 4); + DrawPoint remainingTimePos = button->getPos() + DrawPoint(btSize.x / 2, btSize.y + 4); AddText(500 + i, remainingTimePos, "", COLOR_YELLOW, FontStyle::CENTER, SmallFont); // Nichtangriffspakt - image = LOADER.GetImageN("io", 100); + image = LOADER.getImageN("io", 100); btPos.x = LINE_DISTANCE_TO_MARGINS + TREATIES_POS + TREATIE_BUTTON_SPACE / 2; button = AddImageButton(400 + i, btPos, btSize, TextureColor::Grey, image, _("Non-aggression pact")); // Verbleibende Zeit unter dem Button - remainingTimePos = button->GetPos() + DrawPoint(btSize.x / 2, btSize.y + 4); + remainingTimePos = button->getPos() + DrawPoint(btSize.x / 2, btSize.y + 4); AddText(600 + i, remainingTimePos, "", COLOR_YELLOW, FontStyle::CENTER, SmallFont); } // Farben festlegen @@ -103,45 +103,45 @@ void iwDiplomacy::msgPaintBefore() IngameWindow::msgPaintBefore(); // Die farbigen Zeilen malen - DrawPoint curPos = GetDrawPos() + DrawPoint(LINE_DISTANCE_TO_MARGINS, FIRST_LINE_Y); - Rect curRect(curPos, Extent(GetSize().x - 2 * LINE_DISTANCE_TO_MARGINS, CELL_HEIGHT)); - for(unsigned i = 0; i < gwv.GetWorld().GetNumPlayers(); ++i) + DrawPoint curPos = getDrawPos() + DrawPoint(LINE_DISTANCE_TO_MARGINS, FIRST_LINE_Y); + Rect curRect(curPos, Extent(getSize().x - 2 * LINE_DISTANCE_TO_MARGINS, CELL_HEIGHT)); + for(unsigned i = 0; i < gwv.getWorld().getNumPlayers(); ++i) { // Rechtecke in Spielerfarbe malen mit entsprechender Transparenz - DrawRectangle(curRect, SetAlpha(gwv.GetWorld().GetPlayer(i).color, 0x40)); + DrawRectangle(curRect, SetAlpha(gwv.getWorld().getPlayer(i).color, 0x40)); curRect.move(DrawPoint(0, CELL_HEIGHT + SPACE_HEIGHT)); // Farben der Bündnis-Buttons setzen, je nachdem wie der Status ist // Existiert der Button auch? - auto* button = GetCtrl(300 + i); + auto* button = getCtrl(300 + i); // Bündnisvertrag if(button) // Farbe je nach Bündnisstatus setzen - button->SetModulationColor(PACT_COLORS[gwv.GetPlayer().GetPactState(PactType::TreatyOfAlliance, i)]); + button->setModulationColor(PACT_COLORS[gwv.getPlayer().getPactState(PactType::TreatyOfAlliance, i)]); // Nicht-Angriffspakt - button = GetCtrl(400 + i); + button = getCtrl(400 + i); if(button) // Farbe je nach Bündnisstatus setzen - button->SetModulationColor(PACT_COLORS[gwv.GetPlayer().GetPactState(PactType::NonAgressionPact, i)]); + button->setModulationColor(PACT_COLORS[gwv.getPlayer().getPactState(PactType::NonAgressionPact, i)]); // Ggf. Ping aktualisieren - if(auto* pingfield = GetCtrl(200 + i)) - pingfield->SetText(helpers::toString(gwv.GetWorld().GetPlayer(i).ping)); + if(auto* pingfield = getCtrl(200 + i)) + pingfield->setText(helpers::toString(gwv.getWorld().getPlayer(i).ping)); // Verbleibende Zeit der Bündnisse in den Text-Ctrls anzeigen - if(GetCtrl(500 + i)) + if(getCtrl(500 + i)) { for(unsigned z = 0; z < 2; ++z) { - unsigned duration = gwv.GetPlayer().GetRemainingPactTime(PactType(z), i); + unsigned duration = gwv.getPlayer().getRemainingPactTime(PactType(z), i); // Überhaupt ein Bündnis abgeschlossen und Bündnis nicht für die Ewigkeit? if(duration > 0 && duration != DURATION_INFINITE) // Dann entsprechende Zeit setzen - GetCtrl(500 + z * 100 + i)->SetText(GAMECLIENT.FormatGFTime(duration)); + getCtrl(500 + z * 100 + i)->setText(GAMECLIENT.FormatGFTime(duration)); else // Ansonsten leer - GetCtrl(500 + z * 100 + i)->SetText(""); + getCtrl(500 + z * 100 + i)->setText(""); } } } @@ -149,7 +149,7 @@ void iwDiplomacy::msgPaintBefore() void iwDiplomacy::msgButtonClick(const unsigned ctrl_id) { - if(gwv.GetWorld().GetGGS().lockedTeams) + if(gwv.getWorld().getGGS().lockedTeams) { WINDOWMANAGER.Show(std::make_unique( _("Teams locked"), _("As the teams are locked, you cannot make treaties of any kind."), nullptr, @@ -162,10 +162,10 @@ void iwDiplomacy::msgButtonClick(const unsigned ctrl_id) { auto playerId = static_cast(ctrl_id - 300); // Noch kein Bündnis abgeschlossen? - if(gwv.GetPlayer().GetPactState(PactType::TreatyOfAlliance, playerId) == PactState::None) + if(gwv.getPlayer().getPactState(PactType::TreatyOfAlliance, playerId) == PactState::None) // Dann neues Bündnis vorschlagen WINDOWMANAGER.ReplaceWindow(std::make_unique(PactType::TreatyOfAlliance, - gwv.GetWorld().GetPlayer(playerId), gcFactory)); + gwv.getWorld().getPlayer(playerId), gcFactory)); else // ansonsten Vertrag versuchen abzubrechen gcFactory.CancelPact(PactType::TreatyOfAlliance, playerId); @@ -175,10 +175,10 @@ void iwDiplomacy::msgButtonClick(const unsigned ctrl_id) { auto playerId = static_cast(ctrl_id - 400); // Noch kein Bündnis abgeschlossen? - if(gwv.GetPlayer().GetPactState(PactType::NonAgressionPact, playerId) == PactState::None) + if(gwv.getPlayer().getPactState(PactType::NonAgressionPact, playerId) == PactState::None) // Dann neues Bündnis vorschlagen WINDOWMANAGER.ReplaceWindow(std::make_unique(PactType::NonAgressionPact, - gwv.GetWorld().GetPlayer(playerId), gcFactory)); + gwv.getWorld().getPlayer(playerId), gcFactory)); else // ansonsten Vertrag versuchen abzubrechen gcFactory.CancelPact(PactType::NonAgressionPact, playerId); @@ -204,15 +204,15 @@ const std::array DURATION_NAMES = {gettext_noop("Sho iwSuggestPact::iwSuggestPact(const PactType pt, const GamePlayer& player, GameCommandFactory& gcFactory) : IngameWindow(CGI_SUGGESTPACT, IngameWindow::posLastOrCenter, Extent(320, 215), _(PACT_TITLES[pt]), - LOADER.GetImageN("resource", 41)), + LOADER.getImageN("resource", 41)), pt(pt), player(player), gcFactory(gcFactory) { glArchivItem_Bitmap* image = nullptr; switch(pt) { - case PactType::TreatyOfAlliance: image = LOADER.GetImageN("io", 61); break; - case PactType::NonAgressionPact: image = LOADER.GetImageN("io", 100); break; + case PactType::TreatyOfAlliance: image = LOADER.getImageN("io", 61); break; + case PactType::NonAgressionPact: image = LOADER.getImageN("io", 100); break; } // Bild als Orientierung, welchen Vertrag wir gerade bearbeiten @@ -232,7 +232,7 @@ iwSuggestPact::iwSuggestPact(const PactType pt, const GamePlayer& player, GameCo combo->AddItem(helpers::format("%s (%s)", DURATION_NAMES[i], GAMECLIENT.FormatGFTime(DURATIONS[i]))); } // Erstes Item in der Combobox vorerst auswählen - combo->SetSelection(0); + combo->setSelection(0); // Option "ewig" noch hinzufügen combo->AddItem(_("Eternal")); @@ -243,8 +243,8 @@ iwSuggestPact::iwSuggestPact(const PactType pt, const GamePlayer& player, GameCo void iwSuggestPact::msgButtonClick(const unsigned /*ctrl_id*/) { /// Dauer auswählen (wenn id == NUM_DURATIONS, dann "für alle Ewigkeit" ausgewählt) - const unsigned selected_id = GetCtrl(6)->GetSelection().value(); + const unsigned selected_id = getCtrl(6)->getSelection().value(); const unsigned duration = (selected_id == NUM_DURATIONS) ? DURATION_INFINITE : DURATIONS[selected_id]; - if(gcFactory.SuggestPact(player.GetPlayerId(), this->pt, duration)) + if(gcFactory.SuggestPact(player.getPlayerId(), this->pt, duration)) Close(); } diff --git a/libs/s25main/ingameWindows/iwDirectIPConnect.cpp b/libs/s25main/ingameWindows/iwDirectIPConnect.cpp index afc62a22af..bb362c2d33 100644 --- a/libs/s25main/ingameWindows/iwDirectIPConnect.cpp +++ b/libs/s25main/ingameWindows/iwDirectIPConnect.cpp @@ -39,7 +39,7 @@ enum : unsigned iwDirectIPConnect::iwDirectIPConnect(ServerType serverType) : IngameWindow(CGI_DIRECTIPCONNECT, IngameWindow::posLastOrCenter, Extent(300, 285), _("Join Game"), - LOADER.GetImageN("resource", 41), true), + LOADER.getImageN("resource", 41), true), serverType_(serverType) { AddText(ID_txtIp, DrawPoint(20, 30), _("IP Address of Host:"), COLOR_YELLOW, FontStyle{}, NormalFont); @@ -58,30 +58,30 @@ iwDirectIPConnect::iwDirectIPConnect(ServerType serverType) ctrlOptionGroup* ipv6 = AddOptionGroup(ID_grpIpv6, GroupSelectType::Check); ipv6->AddTextButton(0, DrawPoint(120, 180), Extent(75, 22), TextureColor::Green2, _("IPv4"), NormalFont); ipv6->AddTextButton(1, DrawPoint(205, 180), Extent(75, 22), TextureColor::Green2, _("IPv6"), NormalFont); - ipv6->SetSelection((SETTINGS.server.ipv6 ? 1 : 0)); + ipv6->setSelection((SETTINGS.server.ipv6 ? 1 : 0)); AddText(ID_txtStatus, DrawPoint(150, 215), "", COLOR_RED, FontStyle::CENTER, NormalFont); AddTextButton(ID_btConnect, DrawPoint(20, 240), Extent(125, 22), TextureColor::Green2, _("Connect"), NormalFont); AddTextButton(ID_btBack, DrawPoint(155, 240), Extent(125, 22), TextureColor::Red1, _("Back"), NormalFont); - host->SetFocus(); - host->SetText(SETTINGS.server.lastIP); - port->SetText(SETTINGS.server.localPort); + host->setFocus(); + host->setText(SETTINGS.server.lastIP); + port->setText(SETTINGS.server.localPort); } void iwDirectIPConnect::msgEditChange(const unsigned /*ctrl_id*/) { // Reset status - SetStatus("", COLOR_RED); + setStatus("", COLOR_RED); } void iwDirectIPConnect::msgEditEnter(const unsigned ctrl_id) { switch(ctrl_id) { - case ID_edtIp: GetCtrl(ID_edtPort)->SetFocus(true); break; - case ID_edtPort: GetCtrl(ID_edtPw)->SetFocus(true); break; - case ID_edtPw: GetCtrl(ID_btConnect)->SetFocus(true); break; + case ID_edtIp: getCtrl(ID_edtPort)->setFocus(true); break; + case ID_edtPort: getCtrl(ID_edtPw)->setFocus(true); break; + case ID_edtPw: getCtrl(ID_btConnect)->setFocus(true); break; } } @@ -91,38 +91,38 @@ void iwDirectIPConnect::msgButtonClick(const unsigned ctrl_id) { case ID_btConnect: { - auto* edtHost = GetCtrl(ID_edtIp); - auto* edtPort = GetCtrl(ID_edtPort); - auto* edtPw = GetCtrl(ID_edtPw); - std::optional port = validate::checkPort(edtPort->GetText()); + auto* edtHost = getCtrl(ID_edtIp); + auto* edtPort = getCtrl(ID_edtPort); + auto* edtPw = getCtrl(ID_edtPw); + std::optional port = validate::checkPort(edtPort->getText()); if(!port) { - SetStatus(_("Invalid port. The valid port-range is 1 to 65535!"), COLOR_RED); - edtHost->SetFocus(false); - edtPort->SetFocus(true); - edtPw->SetFocus(false); + setStatus(_("Invalid port. The valid port-range is 1 to 65535!"), COLOR_RED); + edtHost->setFocus(false); + edtPort->setFocus(true); + edtPw->setFocus(false); break; } // save settings - SETTINGS.server.lastIP = edtHost->GetText(); + SETTINGS.server.lastIP = edtHost->getText(); - if(!GAMECLIENT.Connect(edtHost->GetText(), edtPw->GetText(), serverType_, *port, false, + if(!GAMECLIENT.Connect(edtHost->getText(), edtPw->getText(), serverType_, *port, false, SETTINGS.server.ipv6)) { - SetStatus(_("Connection failed!"), COLOR_RED); + setStatus(_("Connection failed!"), COLOR_RED); } else { - SetStatus(_("Connecting with Host..."), COLOR_YELLOW); - GetCtrl(ID_btConnect)->SetEnabled(false); + setStatus(_("Connecting with Host..."), COLOR_YELLOW); + getCtrl(ID_btConnect)->setEnabled(false); std::unique_ptr lobbyClient; if(serverType_ == ServerType::Lobby) lobbyClient = std::make_unique(LOBBYCLIENT); iwConnecting& wnd = WINDOWMANAGER.Show(std::make_unique(serverType_, std::move(lobbyClient))); onErrorConnection_ = wnd.onError.connect([this](ClientError error) { - SetStatus(ClientErrorToStr(error), COLOR_RED); - this->GetCtrl(ID_btConnect)->SetEnabled(); + setStatus(ClientErrorToStr(error), COLOR_RED); + this->getCtrl(ID_btConnect)->setEnabled(); }); } } @@ -137,23 +137,23 @@ void iwDirectIPConnect::msgOptionGroupChange(const unsigned ctrl_id, const unsig SETTINGS.server.ipv6 = (selection == 1); } -void iwDirectIPConnect::SetStatus(const std::string& text, unsigned color) +void iwDirectIPConnect::setStatus(const std::string& text, unsigned color) { - auto* txtStatus = GetCtrl(ID_txtStatus); - txtStatus->SetTextColor(color); - txtStatus->SetText(text); + auto* txtStatus = getCtrl(ID_txtStatus); + txtStatus->setTextColor(color); + txtStatus->setText(text); } void iwDirectIPConnect::Connect(const std::string& hostOrIp, const unsigned short port, const bool isIPv6, const bool hasPwd) { - GetCtrl(ID_edtIp)->SetText(hostOrIp); - GetCtrl(ID_edtPort)->SetText(s25util::toStringClassic(port)); - GetCtrl(ID_grpIpv6)->SetSelection(isIPv6 ? 1 : 0, true); - auto* btConnect = GetCtrl(ID_btConnect); - VIDEODRIVER.SetMousePos(btConnect->GetDrawPos() + DrawPoint(btConnect->GetSize()) / 2); + getCtrl(ID_edtIp)->setText(hostOrIp); + getCtrl(ID_edtPort)->setText(s25util::toStringClassic(port)); + getCtrl(ID_grpIpv6)->setSelection(isIPv6 ? 1 : 0, true); + auto* btConnect = getCtrl(ID_btConnect); + VIDEODRIVER.setMousePos(btConnect->getDrawPos() + DrawPoint(btConnect->getSize()) / 2); if(hasPwd) - GetCtrl(ID_edtPw)->SetFocus(true); + getCtrl(ID_edtPw)->setFocus(true); else msgButtonClick(ID_btConnect); } diff --git a/libs/s25main/ingameWindows/iwDirectIPConnect.h b/libs/s25main/ingameWindows/iwDirectIPConnect.h index b0421c7137..5ac483fa6c 100644 --- a/libs/s25main/ingameWindows/iwDirectIPConnect.h +++ b/libs/s25main/ingameWindows/iwDirectIPConnect.h @@ -20,7 +20,7 @@ class iwDirectIPConnect : public IngameWindow void Connect(const std::string& hostOrIp, unsigned short port, bool isIPv6, bool hasPwd); private: - void SetStatus(const std::string& text, unsigned color); + void setStatus(const std::string& text, unsigned color); void msgEditChange(unsigned ctrl_id) override; void msgEditEnter(unsigned ctrl_id) override; diff --git a/libs/s25main/ingameWindows/iwDirectIPCreate.cpp b/libs/s25main/ingameWindows/iwDirectIPCreate.cpp index 870b9307e4..41923858e4 100644 --- a/libs/s25main/ingameWindows/iwDirectIPCreate.cpp +++ b/libs/s25main/ingameWindows/iwDirectIPCreate.cpp @@ -17,7 +17,7 @@ iwDirectIPCreate::iwDirectIPCreate(ServerType server_type) : IngameWindow(CGI_DIRECTIPCREATE, IngameWindow::posLastOrCenter, Extent(300, 285), _("Create Game"), - LOADER.GetImageN("resource", 41), true, CloseBehavior::Custom), + LOADER.getImageN("resource", 41), true, CloseBehavior::Custom), server_type(server_type) { ctrlEdit *name, *port; @@ -40,7 +40,7 @@ iwDirectIPCreate::iwDirectIPCreate(ServerType server_type) ctrlOptionGroup* ipv6 = AddOptionGroup(12, GroupSelectType::Check); ipv6->AddTextButton(0, DrawPoint(120, 180), Extent(75, 22), TextureColor::Green2, _("IPv4"), NormalFont); ipv6->AddTextButton(1, DrawPoint(205, 180), Extent(75, 22), TextureColor::Green2, _("IPv6"), NormalFont); - ipv6->SetSelection((SETTINGS.server.ipv6 ? 1 : 0)); + ipv6->setSelection((SETTINGS.server.ipv6 ? 1 : 0)); // Status AddText(6, DrawPoint(150, 215), "", COLOR_RED, FontStyle::CENTER, NormalFont); @@ -51,9 +51,9 @@ iwDirectIPCreate::iwDirectIPCreate(ServerType server_type) // "Zurück" AddTextButton(8, DrawPoint(155, 240), Extent(125, 22), TextureColor::Red1, _("Back"), NormalFont); - name->SetText(SETTINGS.lobby.name + _("'s Game")); - name->SetFocus(); - port->SetText(SETTINGS.server.localPort); + name->setText(SETTINGS.lobby.name + _("'s Game")); + name->setFocus(); + port->setText(SETTINGS.server.localPort); } /** @@ -62,7 +62,7 @@ iwDirectIPCreate::iwDirectIPCreate(ServerType server_type) void iwDirectIPCreate::msgEditChange(const unsigned /*ctrl_id*/) { // Statustext resetten - SetText("", COLOR_RED, true); + setText("", COLOR_RED, true); } /** @@ -70,24 +70,24 @@ void iwDirectIPCreate::msgEditChange(const unsigned /*ctrl_id*/) */ void iwDirectIPCreate::msgEditEnter(const unsigned ctrl_id) { - auto* name = GetCtrl(1); - auto* port = GetCtrl(3); - auto* pass = GetCtrl(5); + auto* name = getCtrl(1); + auto* port = getCtrl(3); + auto* pass = getCtrl(5); switch(ctrl_id) { case 1: { - name->SetFocus(false); - port->SetFocus(true); - pass->SetFocus(false); + name->setFocus(false); + port->setFocus(true); + pass->setFocus(false); } break; case 3: { - name->SetFocus(false); - port->SetFocus(false); - pass->SetFocus(false); + name->setFocus(false); + port->setFocus(false); + pass->setFocus(false); } break; case 5: @@ -120,29 +120,29 @@ void iwDirectIPCreate::msgButtonClick(const unsigned ctrl_id) { case 7: // "Starten" { - auto* edtName = GetCtrl(1); - auto* edtPort = GetCtrl(3); - auto* edtPw = GetCtrl(5); + auto* edtName = getCtrl(1); + auto* edtPort = getCtrl(3); + auto* edtPw = getCtrl(5); - if(edtName->GetText().empty()) + if(edtName->getText().empty()) { - SetText(_("Please enter a name for the game"), COLOR_RED, false); - edtName->SetFocus(true); - edtPort->SetFocus(false); - edtPw->SetFocus(false); + setText(_("Please enter a name for the game"), COLOR_RED, false); + edtName->setFocus(true); + edtPort->setFocus(false); + edtPw->setFocus(false); break; } - std::optional port = validate::checkPort(edtPort->GetText()); + std::optional port = validate::checkPort(edtPort->getText()); if(!port) { - SetText(_("Invalid port. The valid port-range is 1 to 65535!"), COLOR_RED, false); - edtName->SetFocus(false); - edtPort->SetFocus(true); - edtPw->SetFocus(false); + setText(_("Invalid port. The valid port-range is 1 to 65535!"), COLOR_RED, false); + edtName->setFocus(false); + edtPort->setFocus(true); + edtPw->setFocus(false); break; } - CreateServerInfo csi(server_type, *port, edtName->GetText(), edtPw->GetText(), SETTINGS.server.ipv6, + CreateServerInfo csi(server_type, *port, edtName->getText(), edtPw->getText(), SETTINGS.server.ipv6, SETTINGS.global.useUPNP); // Map auswählen @@ -161,14 +161,14 @@ void iwDirectIPCreate::msgButtonClick(const unsigned ctrl_id) * Setzt den Text und Schriftfarbe vom Textfeld und den Status des * Buttons. */ -void iwDirectIPCreate::SetText(const std::string& text, unsigned color, bool button) +void iwDirectIPCreate::setText(const std::string& text, unsigned color, bool button) { // Text setzen - GetCtrl(6)->SetTextColor(color); - GetCtrl(6)->SetText(text); + getCtrl(6)->setTextColor(color); + getCtrl(6)->setText(text); // Button (de)aktivieren - GetCtrl(7)->SetEnabled(button); + getCtrl(7)->setEnabled(button); } /** @@ -176,17 +176,17 @@ void iwDirectIPCreate::SetText(const std::string& text, unsigned color, bool but */ void iwDirectIPCreate::LC_Status_Error(const std::string& error) { - auto* name = GetCtrl(1); - auto* port = GetCtrl(3); - auto* pass = GetCtrl(5); + auto* name = getCtrl(1); + auto* port = getCtrl(3); + auto* pass = getCtrl(5); - name->SetFocus(true); - port->SetFocus(false); - pass->SetFocus(false); + name->setFocus(true); + port->setFocus(false); + pass->setFocus(false); - name->SetDisabled(false); - port->SetDisabled(false); - pass->SetDisabled(false); + name->setDisabled(false); + port->setDisabled(false); + pass->setDisabled(false); - SetText(error, COLOR_RED, true); + setText(error, COLOR_RED, true); } diff --git a/libs/s25main/ingameWindows/iwDirectIPCreate.h b/libs/s25main/ingameWindows/iwDirectIPCreate.h index fb17d0b05c..0ea8f295d0 100644 --- a/libs/s25main/ingameWindows/iwDirectIPCreate.h +++ b/libs/s25main/ingameWindows/iwDirectIPCreate.h @@ -21,7 +21,7 @@ class iwDirectIPCreate : public IngameWindow void msgOptionGroupChange(unsigned ctrl_id, unsigned selection) override; private: - void SetText(const std::string& text, unsigned color, bool button); + void setText(const std::string& text, unsigned color, bool button); ServerType server_type; }; diff --git a/libs/s25main/ingameWindows/iwDistribution.cpp b/libs/s25main/ingameWindows/iwDistribution.cpp index dd1dd560aa..5217cdfee5 100644 --- a/libs/s25main/ingameWindows/iwDistribution.cpp +++ b/libs/s25main/ingameWindows/iwDistribution.cpp @@ -30,7 +30,7 @@ const unsigned TAB_ICON_SIZE = 36; iwDistribution::iwDistribution(const GameWorldViewer& gwv, GameCommandFactory& gcFactory) : TransmitSettingsIgwAdapter(CGI_DISTRIBUTION, IngameWindow::posLastOrCenter, Extent(290, 312), - _("Distribution of goods"), LOADER.GetImageN("resource", 41)), + _("Distribution of goods"), LOADER.getImageN("resource", 41)), gwv(gwv), gcFactory(gcFactory) { CreateGroups(); @@ -39,9 +39,9 @@ iwDistribution::iwDistribution(const GameWorldViewer& gwv, GameCommandFactory& g // Tab Control ctrlTab* tab = AddTabCtrl(0, DrawPoint(10, 20), groups.size() * TAB_ICON_SIZE + TAB_ICON_SIZE / 2); - DrawPoint txtPos(GetSize().x / 2, 60); - DrawPoint progPos(PROGRESS_BORDER_DISTANCE - tab->GetPos().x, txtPos.y); - const Extent progSize(GetSize().x - 2 * PROGRESS_BORDER_DISTANCE, 20); + DrawPoint txtPos(getSize().x / 2, 60); + DrawPoint progPos(PROGRESS_BORDER_DISTANCE - tab->getPos().x, txtPos.y); + const Extent progSize(getSize().x - 2 * PROGRESS_BORDER_DISTANCE, 20); for(unsigned groupId = 0; groupId < groups.size(); groupId++) { @@ -60,22 +60,22 @@ iwDistribution::iwDistribution(const GameWorldViewer& gwv, GameCommandFactory& g } // Gruppe auswählen - tab->SetSelection(0); + tab->setSelection(0); const Extent btSize(32, 32); // "Help" button - AddImageButton(2, DrawPoint(15, GetFullSize().y - 15 - btSize.y), btSize, TextureColor::Grey, - LOADER.GetImageN("io", 225), _("Help")); + AddImageButton(2, DrawPoint(15, getFullSize().y - 15 - btSize.y), btSize, TextureColor::Grey, + LOADER.getImageN("io", 225), _("Help")); // "Default" button - AddImageButton(10, GetFullSize() - DrawPoint::all(15) - btSize, btSize, TextureColor::Grey, - LOADER.GetImageN("io", 191), _("Default")); + AddImageButton(10, getFullSize() - DrawPoint::all(15) - btSize, btSize, TextureColor::Grey, + LOADER.getImageN("io", 191), _("Default")); iwDistribution::UpdateSettings(); } void iwDistribution::TransmitSettings() { - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) return; if(settings_changed) { @@ -87,12 +87,12 @@ void iwDistribution::TransmitSettings() for(unsigned i = 0; i < groups.size(); ++i) { - ctrlGroup* tab = GetCtrl(0)->GetGroup(i); + ctrlGroup* tab = getCtrl(0)->getGroup(i); const DistributionGroup& group = groups[i]; // Werte der Gruppen auslesen for(unsigned j = 0; j < group.entries.size(); ++j) { - auto value = static_cast(tab->GetCtrl(j)->GetPosition()); + auto value = static_cast(tab->getCtrl(j)->getPosition()); newDistribution[std::get<1>(group.entries[j])] = value; } } @@ -114,17 +114,17 @@ void iwDistribution::msgGroupProgressChange(const unsigned /*group_id*/, const u void iwDistribution::UpdateSettings(const Distributions& distribution) { - if(GAMECLIENT.IsReplayModeOn()) - gwv.GetPlayer().FillVisualSettings(GAMECLIENT.visual_settings); + if(GAMECLIENT.isReplayModeOn()) + gwv.getPlayer().FillVisualSettings(GAMECLIENT.visual_settings); for(unsigned g = 0; g < groups.size(); ++g) { // Look for correct group const DistributionGroup& group = groups[g]; - ctrlGroup* tab = GetCtrl(0)->GetGroup(g); + ctrlGroup* tab = getCtrl(0)->getGroup(g); // And correct entry for(unsigned i = 0; i < group.entries.size(); ++i) - tab->GetCtrl(i)->SetPosition(distribution[std::get<1>(group.entries[i])]); + tab->getCtrl(i)->setPosition(distribution[std::get<1>(group.entries[i])]); } } @@ -135,7 +135,7 @@ void iwDistribution::UpdateSettings() void iwDistribution::msgButtonClick(const unsigned ctrl_id) { - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) return; switch(ctrl_id) { @@ -177,15 +177,15 @@ void iwDistribution::CreateGroups() glArchivItem_Bitmap* img = nullptr; switch(lastGood) { - case GoodType::Fish: img = LOADER.GetImageN("io", 80); break; - case GoodType::Grain: img = LOADER.GetImageN("io", 90); break; - case GoodType::Iron: img = LOADER.GetImageN("io", 81); break; - case GoodType::Coal: img = LOADER.GetImageN("io", 91); break; - case GoodType::Wood: img = LOADER.GetImageN("io", 89); break; - case GoodType::Boards: img = LOADER.GetImageN("io", 82); break; - case GoodType::Water: img = LOADER.GetImageN("io", 92); break; + case GoodType::Fish: img = LOADER.getImageN("io", 80); break; + case GoodType::Grain: img = LOADER.getImageN("io", 90); break; + case GoodType::Iron: img = LOADER.getImageN("io", 81); break; + case GoodType::Coal: img = LOADER.getImageN("io", 91); break; + case GoodType::Wood: img = LOADER.getImageN("io", 89); break; + case GoodType::Boards: img = LOADER.getImageN("io", 82); break; + case GoodType::Water: img = LOADER.getImageN("io", 92); break; case GoodType::Ham: - img = LOADER.GetImageN("leather_bobs", + img = LOADER.getImageN("leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::DistributionOfPigsIcon]); break; default: break; @@ -204,7 +204,7 @@ void iwDistribution::CreateGroups() auto isUnused = [&](std::tuple const& bts) { const BuildingType buildingType = std::get<1>(distributionMap[std::get<1>(bts)]); - return makeIsUnusedBuilding(gwv.GetWorld().GetGGS())(buildingType); + return makeIsUnusedBuilding(gwv.getWorld().getGGS())(buildingType); }; for(auto& group : groups) helpers::erase_if(group.entries, isUnused); diff --git a/libs/s25main/ingameWindows/iwEconomicProgress.cpp b/libs/s25main/ingameWindows/iwEconomicProgress.cpp index 1e0aa43659..60df51b911 100644 --- a/libs/s25main/ingameWindows/iwEconomicProgress.cpp +++ b/libs/s25main/ingameWindows/iwEconomicProgress.cpp @@ -32,16 +32,16 @@ constexpr unsigned extraSpacing = 2; iwEconomicProgress::iwEconomicProgress(const GameWorldViewer& gwv) : IngameWindow(CGI_ECONOMICPROGRESS, IngameWindow::posLastOrCenter, Extent(0, 0) /*will be resized inside the constructor*/, _("Economic progress"), - LOADER.GetImageN("resource", 41)), + LOADER.getImageN("resource", 41)), gwv(gwv) { const unsigned textcolor[] = {COLOR_GREEN, COLOR_YELLOW, COLOR_RED}; - const GameWorldBase& world = gwv.GetWorld(); + const GameWorldBase& world = gwv.getWorld(); const EconomyModeHandler* eH = world.getEconHandler(); // resize window - Extent size(padding1.x + wareIconSize.x + (std::max((int)eH->GetTeams().size(), 2) + 1) * txtBoxWidth + padding2.x, - padding1.y + teamRectHeight + ((int)eH->GetGoodTypesToCollect().size() + 1) * wareIconSize.y + Extent size(padding1.x + wareIconSize.x + (std::max((int)eH->getTeams().size(), 2) + 1) * txtBoxWidth + padding2.x, + padding1.y + teamRectHeight + ((int)eH->getGoodTypesToCollect().size() + 1) * wareIconSize.y + extraSpacing * 2 + padding2.y); this->Resize(size); @@ -49,15 +49,15 @@ iwEconomicProgress::iwEconomicProgress(const GameWorldViewer& gwv) FontStyle::LEFT | FontStyle::BOTTOM, NormalFont); // determine team display order (main player team first) - for(const auto& curTeam : eH->GetTeams()) + for(const auto& curTeam : eH->getTeams()) { - if(curTeam.containsPlayer(gwv.GetPlayer().GetPlayerId())) + if(curTeam.containsPlayer(gwv.getPlayer().getPlayerId())) { teamOrder.push_back(&curTeam); break; } } - for(const auto& curTeam : eH->GetTeams()) + for(const auto& curTeam : eH->getTeams()) { if(&curTeam != teamOrder[0]) { @@ -66,18 +66,18 @@ iwEconomicProgress::iwEconomicProgress(const GameWorldViewer& gwv) } // the goods table - const std::vector& goodsToCollect = eH->GetGoodTypesToCollect(); + const std::vector& goodsToCollect = eH->getGoodTypesToCollect(); DrawPoint curBoxPos(padding1.x, padding1.y + teamRectHeight + extraSpacing); for(unsigned i = 0; i < goodsToCollect.size(); i++) { GoodType good = goodsToCollect[i]; - AddImage(100 + i, curBoxPos + wareIconSize / 2, LOADER.GetMapTexture(2298), _(WARE_NAMES[good])); + AddImage(100 + i, curBoxPos + wareIconSize / 2, LOADER.getMapTexture(2298), _(WARE_NAMES[good])); const DrawPoint warePos = curBoxPos + wareIconSize / 2; - AddImage(200 + i, warePos, LOADER.GetWareTex(good)); + AddImage(200 + i, warePos, LOADER.getWareTex(good)); DrawPoint curTxtPos = curBoxPos + DrawPoint(wareIconSize.x, 0); - for(unsigned j = 0; j < 1 + eH->GetTeams().size(); j++) + for(unsigned j = 0; j < 1 + eH->getTeams().size(); j++) { AddTextDeepening(300 + (MAX_PLAYERS + 2) * j + i, curTxtPos, Extent(txtBoxWidth, wareIconSize.y), TextureColor::Grey, "?", NormalFont, textcolor[j < 2 ? j : 2]); @@ -89,16 +89,16 @@ iwEconomicProgress::iwEconomicProgress(const GameWorldViewer& gwv) if(!eH->isInfinite()) { // game progress display - AddText(2, DrawPoint(wareIconSize.x + extraSpacing + padding1.x, this->GetSize().y - padding2.y), + AddText(2, DrawPoint(wareIconSize.x + extraSpacing + padding1.x, this->getSize().y - padding2.y), _("Time remaining:"), COLOR_ORANGE, FontStyle::LEFT | FontStyle::BOTTOM, NormalFont); txtRemainingTime = - AddText(3, DrawPoint(wareIconSize.x + extraSpacing + txtBoxWidth * 3, this->GetSize().y - padding2.y), "%", + AddText(3, DrawPoint(wareIconSize.x + extraSpacing + txtBoxWidth * 3, this->getSize().y - padding2.y), "%", COLOR_ORANGE, FontStyle::RIGHT | FontStyle::BOTTOM, NormalFont); } // help button - AddImageButton(25, DrawPoint(padding1.x, this->GetSize().y - wareIconSize.y - padding2.y), wareIconSize, - TextureColor::Grey, LOADER.GetImageN("io", 225), _("Help")); + AddImageButton(25, DrawPoint(padding1.x, this->getSize().y - wareIconSize.y - padding2.y), wareIconSize, + TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); } iwEconomicProgress::~iwEconomicProgress() = default; @@ -106,19 +106,19 @@ iwEconomicProgress::~iwEconomicProgress() = default; void iwEconomicProgress::DrawContent() { // draw team colors - DrawPoint curTeamRectPos = GetDrawPos() + DrawPoint(padding1.x + wareIconSize.x + txtBoxWidth, padding1.y); + DrawPoint curTeamRectPos = getDrawPos() + DrawPoint(padding1.x + wareIconSize.x + txtBoxWidth, padding1.y); for(auto& team : teamOrder) { unsigned ystep = teamRectHeight / team->playersInTeam.count(); unsigned ypos = 0; - for(unsigned i = 0; i < gwv.GetWorld().GetNumPlayers(); ++i) + for(unsigned i = 0; i < gwv.getWorld().getNumPlayers(); ++i) { if(team->containsPlayer(i)) { if(teamRectHeight - ypos < 2 * ystep) ystep = teamRectHeight - ypos; DrawRectangle(Rect(curTeamRectPos + DrawPoint(0, ypos), Extent(txtBoxWidth - 1, ystep)), - gwv.GetWorld().GetPlayer(i).color); + gwv.getWorld().getPlayer(i).color); ypos += ystep; } } @@ -147,10 +147,10 @@ void iwEconomicProgress::msgPaintBefore() { IngameWindow::msgPaintBefore(); - const GameWorldBase& world = gwv.GetWorld(); + const GameWorldBase& world = gwv.getWorld(); EconomyModeHandler* eH = world.getEconHandler(); - const std::vector& economyModeTeams = eH->GetTeams(); - const GamePlayer& mainPlayer = gwv.GetPlayer(); + const std::vector& economyModeTeams = eH->getTeams(); + const GamePlayer& mainPlayer = gwv.getPlayer(); RTTR_Assert(economyModeTeams.size() == teamOrder.size()); @@ -158,32 +158,32 @@ void iwEconomicProgress::msgPaintBefore() eH->UpdateAmounts(); // update table elements - for(unsigned i = 0; i < eH->GetGoodTypesToCollect().size(); i++) + for(unsigned i = 0; i < eH->getGoodTypesToCollect().size(); i++) { for(unsigned j = 0; j < 1 + economyModeTeams.size(); j++) { - auto* text = GetCtrl(300 + (MAX_PLAYERS + 2) * j + i); + auto* text = getCtrl(300 + (MAX_PLAYERS + 2) * j + i); if(j == 0) { - text->SetText(std::to_string(eH->GetAmount(i, mainPlayer.GetPlayerId()))); + text->setText(std::to_string(eH->getAmount(i, mainPlayer.getPlayerId()))); } else if(j == 1 || eH->showAllTeamAmounts()) { - text->SetText(std::to_string(teamOrder[j - 1]->amountsTheTeamCollected[i])); + text->setText(std::to_string(teamOrder[j - 1]->amountsTheTeamCollected[i])); // White color when all teams are shown to mark good types that the team has won or is leading in - if(eH->showAllTeamAmounts() && teamOrder[j - 1]->amountsTheTeamCollected[i] >= eH->GetMaxTeamAmount(i)) + if(eH->showAllTeamAmounts() && teamOrder[j - 1]->amountsTheTeamCollected[i] >= eH->getMaxTeamAmount(i)) { - text->SetTextColor(COLOR_WHITE); + text->setTextColor(COLOR_WHITE); } else { if(j == 1) - text->SetTextColor(COLOR_YELLOW); + text->setTextColor(COLOR_YELLOW); else - text->SetTextColor(COLOR_RED); + text->setTextColor(COLOR_RED); } } else { - text->SetText("???"); + text->setText("???"); } } } @@ -193,10 +193,10 @@ void iwEconomicProgress::msgPaintBefore() // Refresh game progress tracker if(!eH->isOver()) { - txtRemainingTime->SetText(GAMECLIENT.FormatGFTime(eH->GetEndFrame() - world.GetEvMgr().GetCurrentGF())); + txtRemainingTime->setText(GAMECLIENT.FormatGFTime(eH->getEndFrame() - world.getEvMgr().getCurrentGF())); } else { - txtRemainingTime->SetText(GAMECLIENT.FormatGFTime(0)); + txtRemainingTime->setText(GAMECLIENT.FormatGFTime(0)); } } } diff --git a/libs/s25main/ingameWindows/iwEndgame.cpp b/libs/s25main/ingameWindows/iwEndgame.cpp index b9e4c2dc8a..0792c7f79b 100644 --- a/libs/s25main/ingameWindows/iwEndgame.cpp +++ b/libs/s25main/ingameWindows/iwEndgame.cpp @@ -11,14 +11,14 @@ iwEndgame::iwEndgame() : IngameWindow(CGI_ENDGAME, IngameWindow::posLastOrCenter, Extent(240, 100), _("End game?"), - LOADER.GetImageN("resource", 41)) + LOADER.getImageN("resource", 41)) { // Ok - AddImageButton(0, DrawPoint(16, 24), Extent(71, 57), TextureColor::Green2, LOADER.GetImageN("io", 32)); //-V525 + AddImageButton(0, DrawPoint(16, 24), Extent(71, 57), TextureColor::Green2, LOADER.getImageN("io", 32)); //-V525 // Abbrechen - AddImageButton(1, DrawPoint(88, 24), Extent(71, 57), TextureColor::Red1, LOADER.GetImageN("io", 40)); + AddImageButton(1, DrawPoint(88, 24), Extent(71, 57), TextureColor::Red1, LOADER.getImageN("io", 40)); // Ok + Speichern - AddImageButton(2, DrawPoint(160, 24), Extent(65, 57), TextureColor::Grey, LOADER.GetImageN("io", 47)); + AddImageButton(2, DrawPoint(160, 24), Extent(65, 57), TextureColor::Grey, LOADER.getImageN("io", 47)); } void iwEndgame::msgButtonClick(const unsigned ctrl_id) diff --git a/libs/s25main/ingameWindows/iwHQ.cpp b/libs/s25main/ingameWindows/iwHQ.cpp index fd6c632c83..4e07b61880 100644 --- a/libs/s25main/ingameWindows/iwHQ.cpp +++ b/libs/s25main/ingameWindows/iwHQ.cpp @@ -12,11 +12,11 @@ iwHQ::iwHQ(GameWorldView& gwv, GameCommandFactory& gcFactory, nobBaseWarehouse* wh) : iwBaseWarehouse(gwv, gcFactory, wh) { - SetTitle(_("Headquarters")); + setTitle(_("Headquarters")); // Soldaten Reservierungsseite ctrlGroup& reserve = AddPage(); - grpIdReserve = reserve.GetID(); + grpIdReserve = reserve.getID(); // "Reserve"-Überschrift reserve.AddText(0, DrawPoint(83, 87), _("Reserve"), 0xFFFFFF00, FontStyle::CENTER, NormalFont); @@ -27,18 +27,18 @@ iwHQ::iwHQ(GameWorldView& gwv, GameCommandFactory& gcFactory, nobBaseWarehouse* for(unsigned i = 0; i < 5; ++i) { // Bildhintergrund - reserve.AddImage(1 + i, DrawPoint(34, 124 + Y_DISTANCE * i), LOADER.GetMapTexture(2298)); + reserve.AddImage(1 + i, DrawPoint(34, 124 + Y_DISTANCE * i), LOADER.getMapTexture(2298)); // Rang-Bild - reserve.AddImage(6 + i, DrawPoint(34, 124 + Y_DISTANCE * i), LOADER.GetMapTexture(2321 + i)); + reserve.AddImage(6 + i, DrawPoint(34, 124 + Y_DISTANCE * i), LOADER.getMapTexture(2321 + i)); // Minus-Button reserve.AddImageButton(11 + i, DrawPoint(54, 112 + Y_DISTANCE * i), Extent(24, 24), TextureColor::Red1, - LOADER.GetImageN("io", 139), _("Less")); + LOADER.getImageN("io", 139), _("Less")); // Plus-Button reserve.AddImageButton(16 + i, DrawPoint(118, 112 + Y_DISTANCE * i), Extent(24, 24), TextureColor::Green2, - LOADER.GetImageN("io", 138), _("More")); + LOADER.getImageN("io", 138), _("More")); // Anzahl-Text reserve.AddVarText(21 + i, DrawPoint(100, 117 + Y_DISTANCE * i), _("%u/%u"), 0xFFFFFF00, FontStyle::CENTER, - NormalFont, 2, wh->GetReserveAvailablePointer(i), wh->GetReserveClaimedVisualPointer(i)); + NormalFont, 2, wh->getReserveAvailablePointer(i), wh->getReserveClaimedVisualPointer(i)); } } @@ -53,20 +53,20 @@ void iwHQ::msgGroupButtonClick(const unsigned group_id, const unsigned ctrl_id) if(ctrl_id >= 11 && ctrl_id < 16) { rank = ctrl_id - 11; - oldReserve = *(wh->GetReserveClaimedVisualPointer(rank)); + oldReserve = *(wh->getReserveClaimedVisualPointer(rank)); newReserve = oldReserve > 0 ? oldReserve - 1 : oldReserve; } // Plus-Button else if(ctrl_id >= 16 && ctrl_id < 21) { rank = ctrl_id - 16; - oldReserve = *(wh->GetReserveClaimedVisualPointer(rank)); + oldReserve = *(wh->getReserveClaimedVisualPointer(rank)); newReserve = oldReserve + 1; } // Netzwerk-Nachricht generieren - if(newReserve != oldReserve && GAMECLIENT.ChangeReserve(wh->GetPos(), rank, newReserve)) - wh->SetReserveVisual(rank, newReserve); + if(newReserve != oldReserve && GAMECLIENT.ChangeReserve(wh->getPos(), rank, newReserve)) + wh->setReserveVisual(rank, newReserve); } // an Basis weiterleiten diff --git a/libs/s25main/ingameWindows/iwHarborBuilding.cpp b/libs/s25main/ingameWindows/iwHarborBuilding.cpp index da2154ee15..243cbd913a 100644 --- a/libs/s25main/ingameWindows/iwHarborBuilding.cpp +++ b/libs/s25main/ingameWindows/iwHarborBuilding.cpp @@ -13,17 +13,17 @@ iwHarborBuilding::iwHarborBuilding(GameWorldView& gwv, GameCommandFactory& gcFactory, nobHarborBuilding* hb) : iwHQ(gwv, gcFactory, hb) { - SetTitle(_("Harbor building")); + setTitle(_("Harbor building")); // Zusätzliche Hafenseite ctrlGroup& harbor_page = AddPage(); - grpIdExpedition = harbor_page.GetID(); + grpIdExpedition = harbor_page.getID(); // "Expedition"-Überschrift harbor_page.AddText(0, DrawPoint(83, 70), _("Expedition"), 0xFFFFFF00, FontStyle::CENTER, NormalFont); // Button zum Expedition starten - harbor_page.AddImageButton(1, DrawPoint(65, 100), Extent(30, 30), TextureColor::Grey, LOADER.GetImageN("io", 176), + harbor_page.AddImageButton(1, DrawPoint(65, 100), Extent(30, 30), TextureColor::Grey, LOADER.getImageN("io", 176), _("Start expedition")); AdjustExpeditionButton(false); @@ -31,7 +31,7 @@ iwHarborBuilding::iwHarborBuilding(GameWorldView& gwv, GameCommandFactory& gcFac harbor_page.AddText(2, DrawPoint(83, 140), _("Exploration expedition"), 0xFFFFFF00, FontStyle::CENTER, NormalFont); // Button zum Expedition starten - harbor_page.AddImageButton(3, DrawPoint(65, 170), Extent(30, 30), TextureColor::Grey, LOADER.GetImageN("io", 176), + harbor_page.AddImageButton(3, DrawPoint(65, 170), Extent(30, 30), TextureColor::Grey, LOADER.getImageN("io", 176), _("Start exporation expedition")); AdjustExplorationExpeditionButton(false); } @@ -43,23 +43,23 @@ iwHarborBuilding::iwHarborBuilding(GameWorldView& gwv, GameCommandFactory& gcFac */ void iwHarborBuilding::AdjustExpeditionButton(bool flip) { - auto* button = GetCtrl(grpIdExpedition)->GetCtrl(1); + auto* button = getCtrl(grpIdExpedition)->getCtrl(1); // Visuelle Rückmeldung, grün einfärben, wenn Expedition gestartet wurde // Jeweils umgekehrte Farbe nehmen, da die änderung ja spielerisch noch nicht // in Kraft getreten ist! - bool exp = static_cast(wh)->IsExpeditionActive(); + bool exp = static_cast(wh)->isExpeditionActive(); // "flip xor exp", damit korrekt geswitcht wird, falls expedition abgebrochen werden soll // und dies direkt dargestellt werden soll (flip) if((flip || exp) && !(flip && exp)) { - button->SetModulationColor(COLOR_WHITE); - button->SetTooltip(_("Cancel expedition")); + button->setModulationColor(COLOR_WHITE); + button->setTooltip(_("Cancel expedition")); } else { - button->SetModulationColor(COLOR_RED); - button->SetTooltip(_("Start expedition")); + button->setModulationColor(COLOR_RED); + button->setTooltip(_("Start expedition")); } } @@ -70,23 +70,23 @@ void iwHarborBuilding::AdjustExpeditionButton(bool flip) */ void iwHarborBuilding::AdjustExplorationExpeditionButton(bool flip) { - auto* button = GetCtrl(grpIdExpedition)->GetCtrl(3); + auto* button = getCtrl(grpIdExpedition)->getCtrl(3); // Visuelle Rückmeldung, grün einfärben, wenn Expedition gestartet wurde // Jeweils umgekehrte Farbe nehmen, da die änderung ja spielerisch noch nicht // in Kraft getreten ist! - bool exp = static_cast(wh)->IsExplorationExpeditionActive(); + bool exp = static_cast(wh)->isExplorationExpeditionActive(); // "flip xor exp", damit korrekt geswitcht wird, falls expedition abgebrochen werden soll // und dies direkt dargestellt werden soll (flip) if((flip || exp) && !(flip && exp)) { - button->SetModulationColor(COLOR_WHITE); - button->SetTooltip(_("Cancel expedition")); + button->setModulationColor(COLOR_WHITE); + button->setTooltip(_("Cancel expedition")); } else { - button->SetModulationColor(COLOR_RED); - button->SetTooltip(_("Start expedition")); + button->setModulationColor(COLOR_RED); + button->setTooltip(_("Start expedition")); } } @@ -98,14 +98,14 @@ void iwHarborBuilding::msgGroupButtonClick(const unsigned group_id, const unsign { case 1: // Expedition starten // Entsprechenden GC senden - if(GAMECLIENT.StartStopExpedition(wh->GetPos(), - !static_cast(wh)->IsExpeditionActive())) + if(GAMECLIENT.StartStopExpedition(wh->getPos(), + !static_cast(wh)->isExpeditionActive())) AdjustExpeditionButton(true); break; case 3: // Expedition starten // Entsprechenden GC senden if(GAMECLIENT.StartStopExplorationExpedition( - wh->GetPos(), !static_cast(wh)->IsExplorationExpeditionActive())) + wh->getPos(), !static_cast(wh)->isExplorationExpeditionActive())) AdjustExplorationExpeditionButton(true); break; } diff --git a/libs/s25main/ingameWindows/iwHelp.cpp b/libs/s25main/ingameWindows/iwHelp.cpp index 4762b68215..7b99feb701 100644 --- a/libs/s25main/ingameWindows/iwHelp.cpp +++ b/libs/s25main/ingameWindows/iwHelp.cpp @@ -15,15 +15,15 @@ const unsigned MAX_LINES = 15; iwHelp::iwHelp(const std::string& content) : IngameWindow(CGI_HELP, IngameWindow::posAtMouse, Extent(HELP_WINDOW_WIDTH, 480), _("What is this?"), - LOADER.GetImageN("io", 1)) + LOADER.getImageN("io", 1)) { // Größe des Fensters und des Controls nach der Anzahl der Zeilen - ctrlMultiline* text = AddMultiline(2, DrawPoint(contentOffset), GetIwSize(), TextureColor::Green1, NormalFont); - text->SetNumVisibleLines(MAX_LINES); + ctrlMultiline* text = AddMultiline(2, DrawPoint(contentOffset), getIwSize(), TextureColor::Green1, NormalFont); + text->setNumVisibleLines(MAX_LINES); text->ShowBackground(false); text->AddString(content, COLOR_YELLOW, false); // Shrink to content - text->Resize(text->GetContentSize()); - SetIwSize(text->GetSize()); + text->Resize(text->getContentSize()); + setIwSize(text->getSize()); MoveNextToMouse(); } diff --git a/libs/s25main/ingameWindows/iwInventory.cpp b/libs/s25main/ingameWindows/iwInventory.cpp index b93d0e30eb..402d846c69 100644 --- a/libs/s25main/ingameWindows/iwInventory.cpp +++ b/libs/s25main/ingameWindows/iwInventory.cpp @@ -8,6 +8,6 @@ #include "gameData/const_gui_ids.h" iwInventory::iwInventory(const GamePlayer& player) - : iwWares(CGI_INVENTORY, IngameWindow::posLastOrCenter, 0, _("Stock"), false, SmallFont, player.GetInventory(), + : iwWares(CGI_INVENTORY, IngameWindow::posLastOrCenter, 0, _("Stock"), false, SmallFont, player.getInventory(), player) {} diff --git a/libs/s25main/ingameWindows/iwLobbyConnect.cpp b/libs/s25main/ingameWindows/iwLobbyConnect.cpp index 5af53528b7..5b0bf70631 100644 --- a/libs/s25main/ingameWindows/iwLobbyConnect.cpp +++ b/libs/s25main/ingameWindows/iwLobbyConnect.cpp @@ -47,7 +47,7 @@ bool isStoredPasswordHash(const std::string& storedPw, const std::string& pwToCh iwLobbyConnect::iwLobbyConnect() : IngameWindow(CGI_LOBBYCONNECT, IngameWindow::posLastOrCenter, Extent(500, 260), _("Connecting to Lobby"), - LOADER.GetImageN("resource", 41)) + LOADER.getImageN("resource", 41)) { DrawPoint curLblPos(20, 40); constexpr Extent edtSize(220, 22); @@ -58,14 +58,14 @@ iwLobbyConnect::iwLobbyConnect() AddText(ID_txtUser, curLblPos, _("Username:"), COLOR_YELLOW, FontStyle{}, NormalFont); ctrlEdit* user = AddEdit(ID_edtUser, DrawPoint(ctrlStartPos, curLblPos.y), edtSize, TextureColor::Green2, NormalFont, 30); - user->SetFocus(); - user->SetText(SETTINGS.lobby.name); //-V807 + user->setFocus(); + user->setText(SETTINGS.lobby.name); //-V807 curLblPos.y += 30; AddText(ID_txtPw, curLblPos, _("Password:"), COLOR_YELLOW, FontStyle{}, NormalFont); ctrlEdit* pass = AddEdit(ID_edtPw, DrawPoint(ctrlStartPos, curLblPos.y), edtSize, TextureColor::Green2, NormalFont, 0, true); - pass->SetText(isStoredPasswordHash(SETTINGS.lobby.password) ? SETTINGS.lobby.password.substr(4) : + pass->setText(isStoredPasswordHash(SETTINGS.lobby.password) ? SETTINGS.lobby.password.substr(4) : SETTINGS.lobby.password); curLblPos.y += 30; @@ -75,7 +75,7 @@ iwLobbyConnect::iwLobbyConnect() NormalFont); savepassword->AddTextButton(1, DrawPoint(secCtrlStartPos, curLblPos.y), btSize, TextureColor::Green2, _("Yes"), NormalFont); - savepassword->SetSelection((SETTINGS.lobby.savePassword ? 1 : 0)); + savepassword->setSelection((SETTINGS.lobby.savePassword ? 1 : 0)); curLblPos.y += 30; AddText(ID_txtProtocol, curLblPos, _("Use IPv6:"), COLOR_YELLOW, FontStyle{}, NormalFont); @@ -83,17 +83,17 @@ iwLobbyConnect::iwLobbyConnect() ipv6->AddTextButton(0, DrawPoint(ctrlStartPos, curLblPos.y), btSize, TextureColor::Green2, _("IPv4"), NormalFont); ipv6->AddTextButton(1, DrawPoint(secCtrlStartPos, curLblPos.y), btSize, TextureColor::Green2, _("IPv6"), NormalFont); - ipv6->SetSelection((SETTINGS.server.ipv6 ? 1 : 0)); + ipv6->setSelection((SETTINGS.server.ipv6 ? 1 : 0)); auto curYPos = curLblPos.y + 35; - AddText(ID_txtStatus, DrawPoint(GetSize().x / 2, curYPos), "", COLOR_RED, FontStyle::CENTER, NormalFont); + AddText(ID_txtStatus, DrawPoint(getSize().x / 2, curYPos), "", COLOR_RED, FontStyle::CENTER, NormalFont); curYPos += 25; AddTextButton(ID_btConnect, DrawPoint(curLblPos.x, curYPos), edtSize, TextureColor::Red1, _("Connect"), NormalFont); AddTextButton(ID_btRegister, DrawPoint(ctrlStartPos, curYPos), edtSize, TextureColor::Green2, _("Register"), NormalFont); - LOBBYCLIENT.SetProgramVersion(rttr::version::GetReadableVersion()); + LOBBYCLIENT.SetProgramVersion(rttr::version::getReadableVersion()); LOBBYCLIENT.AddListener(this); } @@ -113,8 +113,8 @@ iwLobbyConnect::~iwLobbyConnect() /// Get entered data and save to settings void iwLobbyConnect::ReadFromEditAndSaveLobbyData(std::string& user, std::string& pass) { - user = GetCtrl(ID_edtUser)->GetText(); - pass = GetCtrl(ID_edtPw)->GetText(); + user = getCtrl(ID_edtUser)->getText(); + pass = getCtrl(ID_edtPw)->getText(); // Potential false positive: User uses new password which is equal to the hash of the old one. // HIGHLY unlikely, so ignore @@ -132,18 +132,18 @@ void iwLobbyConnect::ReadFromEditAndSaveLobbyData(std::string& user, std::string void iwLobbyConnect::msgEditChange(const unsigned /*ctrl_id*/) { // Reset status text - SetText("", COLOR_RED, true); + setText("", COLOR_RED, true); } void iwLobbyConnect::msgEditEnter(const unsigned ctrl_id) { - auto* user = GetCtrl(ID_edtUser); - auto* pass = GetCtrl(ID_edtPw); + auto* user = getCtrl(ID_edtUser); + auto* pass = getCtrl(ID_edtPw); switch(ctrl_id) { case ID_edtUser: - user->SetFocus(false); - pass->SetFocus(true); + user->setFocus(false); + pass->setFocus(true); break; case ID_edtPw: msgButtonClick(ID_btConnect); break; } @@ -156,16 +156,16 @@ void iwLobbyConnect::msgButtonClick(const unsigned ctrl_id) case ID_btConnect: { // Update text and disable button - SetText(_("Connecting with Host..."), COLOR_RED, false); + setText(_("Connecting with Host..."), COLOR_RED, false); std::string user, pass; ReadFromEditAndSaveLobbyData(user, pass); - if(!LOBBYCLIENT.Login(LOADER.GetTextN("client", 0), - s25util::fromStringClassic(LOADER.GetTextN("client", 1)), user, pass, + if(!LOBBYCLIENT.Login(LOADER.getTextN("client", 0), + s25util::fromStringClassic(LOADER.getTextN("client", 1)), user, pass, SETTINGS.server.ipv6)) { - SetText(_("Connection failed!"), COLOR_RED, true); + setText(_("Connection failed!"), COLOR_RED, true); break; } } @@ -194,46 +194,46 @@ bool iwLobbyConnect::msgKeyDown(const KeyEvent& ev) { if(ev.kt != KeyType::Tab) return false; - auto* user = GetCtrl(ID_edtUser); - auto* pass = GetCtrl(ID_edtPw); - if(user->HasFocus()) + auto* user = getCtrl(ID_edtUser); + auto* pass = getCtrl(ID_edtPw); + if(user->hasFocus()) { - user->SetFocus(false); - pass->SetFocus(); - } else if(pass->HasFocus()) + user->setFocus(false); + pass->setFocus(); + } else if(pass->hasFocus()) { - pass->SetFocus(false); - user->SetFocus(); + pass->setFocus(false); + user->setFocus(); } else return false; return true; } /// Set status text with given color and enables/disables buttons -void iwLobbyConnect::SetText(const std::string& text, unsigned color, bool button) +void iwLobbyConnect::setText(const std::string& text, unsigned color, bool button) { - auto* t = GetCtrl(ID_txtStatus); - t->SetTextColor(color); - t->SetText(text); + auto* t = getCtrl(ID_txtStatus); + t->setTextColor(color); + t->setText(text); - GetCtrl(ID_btConnect)->SetEnabled(button); - GetCtrl(ID_btRegister)->SetEnabled(button); + getCtrl(ID_btConnect)->setEnabled(button); + getCtrl(ID_btRegister)->setEnabled(button); } void iwLobbyConnect::LC_LoggedIn(const std::string& /*email*/) { - GetCtrl(ID_btRegister)->SetEnabled(false); + getCtrl(ID_btRegister)->setEnabled(false); WINDOWMANAGER.Switch(std::make_unique()); } void iwLobbyConnect::LC_Status_Waiting() { - SetText(_("Waiting for Reply..."), COLOR_YELLOW, false); + setText(_("Waiting for Reply..."), COLOR_YELLOW, false); } /// User defined error (e.g. connection reset) void iwLobbyConnect::LC_Status_Error(const std::string& error) { - SetText(error, COLOR_RED, true); + setText(error, COLOR_RED, true); } diff --git a/libs/s25main/ingameWindows/iwLobbyConnect.h b/libs/s25main/ingameWindows/iwLobbyConnect.h index fee82c5699..caae18079b 100644 --- a/libs/s25main/ingameWindows/iwLobbyConnect.h +++ b/libs/s25main/ingameWindows/iwLobbyConnect.h @@ -26,6 +26,6 @@ class iwLobbyConnect : public IngameWindow, public LobbyInterface bool msgKeyDown(const KeyEvent&) override; private: - void SetText(const std::string& text, unsigned color, bool button); + void setText(const std::string& text, unsigned color, bool button); void ReadFromEditAndSaveLobbyData(std::string& user, std::string& pass); }; diff --git a/libs/s25main/ingameWindows/iwLobbyServerInfo.cpp b/libs/s25main/ingameWindows/iwLobbyServerInfo.cpp index ac9b5904ef..ce3adfbea6 100644 --- a/libs/s25main/ingameWindows/iwLobbyServerInfo.cpp +++ b/libs/s25main/ingameWindows/iwLobbyServerInfo.cpp @@ -17,17 +17,17 @@ void iwLobbyServerInfo::UpdateServerInfo() { const LobbyServerInfo& serverinfo = LOBBYCLIENT.GetServerInfo(); - SetTitle(serverinfo.getName()); + setTitle(serverinfo.getName()); - GetCtrl(1)->SetText(serverinfo.getMap()); - GetCtrl(4)->SetText(serverinfo.getName()); - GetCtrl(6)->SetText(serverinfo.getHost() + ":" + helpers::toString(serverinfo.getPort())); - GetCtrl(8)->SetText(serverinfo.getVersion()); + getCtrl(1)->setText(serverinfo.getMap()); + getCtrl(4)->setText(serverinfo.getName()); + getCtrl(6)->setText(serverinfo.getHost() + ":" + helpers::toString(serverinfo.getPort())); + getCtrl(8)->setText(serverinfo.getVersion()); } iwLobbyServerInfo::iwLobbyServerInfo(unsigned serverId) : IngameWindow(CGI_LOBBYSERVERINFO, IngameWindow::posLastOrCenter, Extent(260, 260), _("Server Information"), - LOADER.GetImageN("resource", 41)), + LOADER.getImageN("resource", 41)), serverId_(serverId) { AddText(0, DrawPoint(30, 40), _("Map Name:"), COLOR_YELLOW, FontStyle{}, NormalFont); @@ -57,7 +57,7 @@ void iwLobbyServerInfo::msgTimer(const unsigned ctrl_id) /** * setzt Serverinfo und ServerNummer. */ -void iwLobbyServerInfo::SetServerId(unsigned serverId) +void iwLobbyServerInfo::setServerId(unsigned serverId) { serverId_ = serverId; } diff --git a/libs/s25main/ingameWindows/iwLobbyServerInfo.h b/libs/s25main/ingameWindows/iwLobbyServerInfo.h index ef656acfa2..c0c75e0454 100644 --- a/libs/s25main/ingameWindows/iwLobbyServerInfo.h +++ b/libs/s25main/ingameWindows/iwLobbyServerInfo.h @@ -14,8 +14,8 @@ class iwLobbyServerInfo : public IngameWindow public: iwLobbyServerInfo(unsigned serverId); - void SetServerId(unsigned serverId); - unsigned GetServerId() const { return serverId_; } + void setServerId(unsigned serverId); + unsigned getServerId() const { return serverId_; } void UpdateServerInfo(); protected: diff --git a/libs/s25main/ingameWindows/iwMainMenu.cpp b/libs/s25main/ingameWindows/iwMainMenu.cpp index 6a63066695..341e24ecf7 100644 --- a/libs/s25main/ingameWindows/iwMainMenu.cpp +++ b/libs/s25main/ingameWindows/iwMainMenu.cpp @@ -32,70 +32,70 @@ iwMainMenu::iwMainMenu(GameWorldView& gwv, GameCommandFactory& gcFactory) : IngameWindow(CGI_MAINSELECTION, IngameWindow::posLastOrCenter, Extent(190, 286), _("Main selection"), - LOADER.GetImageN("io", 5)), + LOADER.getImageN("io", 5)), gwv(gwv), gcFactory(gcFactory) { // Verteilung - AddImageButton(0, DrawPoint(12, 22), Extent(53, 44), TextureColor::Grey, LOADER.GetImageN("io", 134), + AddImageButton(0, DrawPoint(12, 22), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 134), _("Distribution of goods")); // Transport - AddImageButton(1, DrawPoint(68, 22), Extent(53, 44), TextureColor::Grey, LOADER.GetImageN("io", 198), + AddImageButton(1, DrawPoint(68, 22), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 198), _("Transport")); // Werkzeugproduktion - AddImageButton(2, DrawPoint(124, 22), Extent(53, 44), TextureColor::Grey, LOADER.GetImageN("io", 137), _("Tools")); + AddImageButton(2, DrawPoint(124, 22), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 137), _("Tools")); // Statistiken - AddImageButton(3, DrawPoint(12, 70), Extent(39, 44), TextureColor::Grey, LOADER.GetImageN("io", 166), + AddImageButton(3, DrawPoint(12, 70), Extent(39, 44), TextureColor::Grey, LOADER.getImageN("io", 166), _("General statistics")); - AddImageButton(4, DrawPoint(54, 70), Extent(39, 44), TextureColor::Grey, LOADER.GetImageN("io", 135), + AddImageButton(4, DrawPoint(54, 70), Extent(39, 44), TextureColor::Grey, LOADER.getImageN("io", 135), _("Merchandise statistics")); - AddImageButton(5, DrawPoint(96, 70), Extent(39, 44), TextureColor::Grey, LOADER.GetImageN("io", 132), + AddImageButton(5, DrawPoint(96, 70), Extent(39, 44), TextureColor::Grey, LOADER.getImageN("io", 132), _("Buildings")); // Inventur - AddImageButton(6, DrawPoint(138, 70), Extent(39, 44), TextureColor::Grey, LOADER.GetImageN("io", 214), _("Stock")); + AddImageButton(6, DrawPoint(138, 70), Extent(39, 44), TextureColor::Grey, LOADER.getImageN("io", 214), _("Stock")); // Gebäude - AddImageButton(7, DrawPoint(12, 118), Extent(53, 44), TextureColor::Grey, LOADER.GetImageN("io", 136), + AddImageButton(7, DrawPoint(12, 118), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 136), _("Productivity")); // Militär - AddImageButton(8, DrawPoint(68, 118), Extent(53, 44), TextureColor::Grey, LOADER.GetImageN("io", 133), + AddImageButton(8, DrawPoint(68, 118), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 133), _("Military")); // Schiffe - AddImageButton(9, DrawPoint(124, 118), Extent(53, 44), TextureColor::Grey, LOADER.GetImageN("io", 175), + AddImageButton(9, DrawPoint(124, 118), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 175), _("Ship register")); // Baureihenfolge - if(gwv.GetWorld().GetGGS().isEnabled(AddonId::CUSTOM_BUILD_SEQUENCE)) - AddImageButton(10, DrawPoint(12, 166), Extent(53, 44), TextureColor::Grey, LOADER.GetImageN("io", 24), + if(gwv.getWorld().getGGS().isEnabled(AddonId::CUSTOM_BUILD_SEQUENCE)) + AddImageButton(10, DrawPoint(12, 166), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 24), _("Building sequence")); // Diplomatie (todo: besseres Bild suchen) - AddImageButton(11, DrawPoint(68, 166), Extent(53, 44), TextureColor::Grey, LOADER.GetImageN("io", 190), + AddImageButton(11, DrawPoint(68, 166), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 190), _("Diplomacy")); - if(gwv.GetWorld().getEconHandler()) + if(gwv.getWorld().getEconHandler()) { // Economy Mode - AddImageButton(12, DrawPoint(124, 166), Extent(53, 44), TextureColor::Grey, LOADER.GetImageN("io", 196), + AddImageButton(12, DrawPoint(124, 166), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 196), _("Economic Progress")); } // AI-Debug #ifdef NDEBUG - bool enableAIDebug = gwv.GetWorld().GetGGS().isEnabled(AddonId::AI_DEBUG_WINDOW); + bool enableAIDebug = gwv.getWorld().getGGS().isEnabled(AddonId::AI_DEBUG_WINDOW); #else bool enableAIDebug = true; #endif - if(gwv.GetViewer().GetPlayer().isHost && enableAIDebug) + if(gwv.getViewer().getPlayer().isHost && enableAIDebug) { auto* bt = static_cast(AddTextButton(13, DrawPoint(80, 210), Extent(0, 22), TextureColor::Grey, _("AI"), NormalFont, _("AI Debug Window"))); - bt->ResizeForMaxChars(bt->GetText().size()); + bt->ResizeForMaxChars(bt->getText().size()); } // Optionen - AddImageButton(30, DrawPoint(12, 231), Extent(165, 32), TextureColor::Grey, LOADER.GetImageN("io", 37), + AddImageButton(30, DrawPoint(12, 231), Extent(165, 32), TextureColor::Grey, LOADER.getImageN("io", 37), _("Options")); } @@ -108,27 +108,27 @@ void iwMainMenu::msgButtonClick(const unsigned ctrl_id) { case 0: // Verteilung { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.GetViewer(), gcFactory)); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer(), gcFactory)); } break; case 1: // Transport { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.GetViewer(), gcFactory)); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer(), gcFactory)); } break; case 2: // Werkzeugproduktion { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.GetViewer(), gcFactory)); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer(), gcFactory)); } break; case 3: // Statistik { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.GetViewer())); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer())); } break; case 4: // Warenstatistik { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.GetViewer().GetPlayer())); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer().getPlayer())); } break; case 5: // Gebäudestatistik @@ -138,50 +138,50 @@ void iwMainMenu::msgButtonClick(const unsigned ctrl_id) break; case 6: // Inventur { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.GetViewer().GetPlayer())); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer().getPlayer())); } break; case 7: // Produktivitäten { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.GetViewer().GetPlayer())); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer().getPlayer())); } break; case 8: // Militär { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.GetViewer(), gcFactory)); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer(), gcFactory)); } break; case 9: // Schiffe { WINDOWMANAGER.ToggleWindow(std::make_unique( - gwv, gcFactory, gwv.GetViewer().GetPlayer().GetShipByID(0), IngameWindow::posCenter)); + gwv, gcFactory, gwv.getViewer().getPlayer().getShipByID(0), IngameWindow::posCenter)); } break; case 10: // Baureihenfolge { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.GetViewer())); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer())); } break; case 11: // Diplomatie { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.GetViewer(), gcFactory)); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer(), gcFactory)); } break; case 12: // Wirtschaftsmodusfortschritt { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.GetViewer())); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer())); } break; case 13: // AI Debug { if(auto* wnd = WINDOWMANAGER.FindNonModalWindow(CGI_AI_DEBUG)) wnd->Close(); - else if(gwv.GetViewer().GetPlayer().isHost) + else if(gwv.getViewer().getPlayer().isHost) { std::vector ais; - for(unsigned i = 0; i < gwv.GetViewer().GetNumPlayers(); ++i) + for(unsigned i = 0; i < gwv.getViewer().getNumPlayers(); ++i) { - const AIPlayer* ai = GAMECLIENT.GetAIPlayer(i); + const AIPlayer* ai = GAMECLIENT.getAIPlayer(i); if(ai) ais.push_back(ai); } @@ -191,7 +191,7 @@ void iwMainMenu::msgButtonClick(const unsigned ctrl_id) break; case 30: // Optionen { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.GetSoundMgr())); + WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getSoundMgr())); } break; } diff --git a/libs/s25main/ingameWindows/iwMapDebug.cpp b/libs/s25main/ingameWindows/iwMapDebug.cpp index 80cb63189f..f1c0980036 100644 --- a/libs/s25main/ingameWindows/iwMapDebug.cpp +++ b/libs/s25main/ingameWindows/iwMapDebug.cpp @@ -52,7 +52,7 @@ class iwMapDebug::DebugPrinter : public IDrawNodeCallback std::string data; unsigned coordsColor = 0xFFFFFF00; unsigned dataColor = 0xFFFF0000; - const MapNode& node = gw.GetNode(pt); + const MapNode& node = gw.getNode(pt); switch(showDataIdx) { case 1: @@ -64,14 +64,14 @@ class iwMapDebug::DebugPrinter : public IDrawNodeCallback case 4: if(node.seaId) data = helpers::toString(node.seaId); - else if(gw.GetSeaFromCoastalPoint(pt)) + else if(gw.getSeaFromCoastalPoint(pt)) data = "C"; break; case 5: data = helpers::toString(node.owner); break; case 6: { bool isAllowed = - TerritoryRegion::IsPointValid(gw.GetSize(), gw.GetPlayer(playerIdx).GetRestrictedArea(), pt); + TerritoryRegion::isPointValid(gw.getSize(), gw.getPlayer(playerIdx).getRestrictedArea(), pt); coordsColor = dataColor = isAllowed ? 0xFF00FF00 : 0xFFFF0000; if(!showCoords) data = isAllowed ? "y" : "n"; @@ -100,13 +100,13 @@ class iwMapDebug::EventChecker public: EventChecker(const GameWorldBase& gw) : gw(gw) { - bqMap.Resize(gw.GetSize()); - for(unsigned i = 0; i < gw.GetNumPlayers(); i++) + bqMap.Resize(gw.getSize()); + for(unsigned i = 0; i < gw.getNumPlayers(); i++) { - if(gw.GetPlayer(i).isUsed()) + if(gw.getPlayer(i).isUsed()) usedPlayerIdxs.push_back(i); } - RTTR_FOREACH_PT(MapPoint, bqMap.GetSize()) + RTTR_FOREACH_PT(MapPoint, bqMap.getSize()) { for(const unsigned playerIdx : usedPlayerIdxs) bqMap[pt][playerIdx] = gw.GetBQ(pt, playerIdx); @@ -118,7 +118,7 @@ class iwMapDebug::EventChecker for(const MapPoint pt : pointsToUpdate) updateBq(pt); pointsToUpdate.clear(); - RTTR_FOREACH_PT(MapPoint, bqMap.GetSize()) + RTTR_FOREACH_PT(MapPoint, bqMap.getSize()) { for(const unsigned playerIdx : usedPlayerIdxs) { @@ -150,8 +150,8 @@ static const std::array BQ_CHECK_INTERVALS = {10s, iwMapDebug::iwMapDebug(GameWorldView& gwv, bool allowCheating) : IngameWindow(CGI_MAP_DEBUG, IngameWindow::posLastOrCenter, Extent(230, 160), _("Map Debug"), - LOADER.GetImageN("resource", 41)), - gwv(gwv), printer(std::make_unique(gwv.GetWorld())) + LOADER.getImageN("resource", 41)), + gwv(gwv), printer(std::make_unique(gwv.getWorld())) { gwv.AddDrawNodeCallback(printer.get()); @@ -179,7 +179,7 @@ iwMapDebug::iwMapDebug(GameWorldView& gwv, bool allowCheating) { cbCheckEvents->AddItem((boost::format(_("BQ check every %1%ms")) % ms.count()).str()); } - cbCheckEvents->SetSelection(0); + cbCheckEvents->setSelection(0); using namespace std::chrono_literals; AddTimer(ID_tmrCheckEvents, 500ms)->Stop(); @@ -194,27 +194,27 @@ iwMapDebug::iwMapDebug(GameWorldView& gwv, bool allowCheating) data->AddItem(_("Sea Id")); data->AddItem(_("Owner")); data->AddItem(_("Restricted area")); - data->SetSelection(1); + data->setSelection(1); ctrlComboBox* players = AddComboBox(ID_cbShowForPlayer, curPos, ctrlSize, TextureColor::Grey, NormalFont, 100); curPos.y += spaceY; - for(unsigned pIdx = 0; pIdx < gwv.GetWorld().GetNumPlayers(); pIdx++) + for(unsigned pIdx = 0; pIdx < gwv.getWorld().getNumPlayers(); pIdx++) { - const GamePlayer& p = gwv.GetWorld().GetPlayer(pIdx); + const GamePlayer& p = gwv.getWorld().getPlayer(pIdx); if(!p.isUsed()) players->AddItem((boost::format(_("Player %1%")) % pIdx).str()); else players->AddItem(p.name); } - players->SetSelection(0); - printer->showDataIdx = *data->GetSelection(); - printer->playerIdx = *players->GetSelection(); + players->setSelection(0); + printer->showDataIdx = *data->getSelection(); + printer->playerIdx = *players->getSelection(); } else { printer->showDataIdx = 0; printer->playerIdx = 0; - Extent iwSize = GetIwSize(); + Extent iwSize = getIwSize(); iwSize.y -= 40 + 10; - SetIwSize(iwSize); + setIwSize(iwSize); } printer->showCoords = cbShowCoords->isChecked(); @@ -236,11 +236,11 @@ void iwMapDebug::msgComboSelectItem(const unsigned ctrl_id, const unsigned selec if(select == 0) { eventChecker.reset(); - GetCtrl(ID_tmrCheckEvents)->Stop(); + getCtrl(ID_tmrCheckEvents)->Stop(); } else { - eventChecker = std::make_unique(gwv.GetWorld()); - GetCtrl(ID_tmrCheckEvents)->Start(BQ_CHECK_INTERVALS[select - 1]); + eventChecker = std::make_unique(gwv.getWorld()); + getCtrl(ID_tmrCheckEvents)->Start(BQ_CHECK_INTERVALS[select - 1]); } } } @@ -261,10 +261,10 @@ void iwMapDebug::msgEditEnter(unsigned ctrl_id) { RTTR_Assert(ctrl_id == ID_edtJumpX || ctrl_id == ID_edtJumpY); Position pos; - if(s25util::tryFromStringClassic(GetCtrl(ID_edtJumpX)->GetText(), pos.x) - && s25util::tryFromStringClassic(GetCtrl(ID_edtJumpY)->GetText(), pos.y)) + if(s25util::tryFromStringClassic(getCtrl(ID_edtJumpX)->getText(), pos.x) + && s25util::tryFromStringClassic(getCtrl(ID_edtJumpY)->getText(), pos.y)) { - gwv.MoveToMapPt(gwv.GetWorld().MakeMapPoint(pos)); + gwv.MoveToMapPt(gwv.getWorld().MakeMapPoint(pos)); } } @@ -275,11 +275,11 @@ bool iwMapDebug::msgKeyDown(const KeyEvent& ke) case KeyType::Return: msgEditEnter(ID_edtJumpY); break; case KeyType::Tab: { - auto* edtNewFocus = GetCtrl(ID_edtJumpX); - if(edtNewFocus->HasFocus()) - edtNewFocus = GetCtrl(ID_edtJumpY); - edtNewFocus->SetFocus(); - edtNewFocus->SetText(""); + auto* edtNewFocus = getCtrl(ID_edtJumpX); + if(edtNewFocus->hasFocus()) + edtNewFocus = getCtrl(ID_edtJumpY); + edtNewFocus->setFocus(); + edtNewFocus->setText(""); }; break; default: return IngameWindow::msgKeyDown(ke); @@ -287,9 +287,9 @@ bool iwMapDebug::msgKeyDown(const KeyEvent& ke) return true; } -void iwMapDebug::SetActive(bool activate) +void iwMapDebug::setActive(bool activate) { - IngameWindow::SetActive(activate); + IngameWindow::setActive(activate); if(activate) - GetCtrl(ID_edtJumpX)->SetFocus(); + getCtrl(ID_edtJumpX)->setFocus(); } diff --git a/libs/s25main/ingameWindows/iwMapDebug.h b/libs/s25main/ingameWindows/iwMapDebug.h index 3a6a2e10a9..749e08b82c 100644 --- a/libs/s25main/ingameWindows/iwMapDebug.h +++ b/libs/s25main/ingameWindows/iwMapDebug.h @@ -25,7 +25,7 @@ class iwMapDebug : public IngameWindow void msgEditEnter(unsigned ctrl_id) override; bool msgKeyDown(const KeyEvent& ke) override; - void SetActive(bool activate) override; + void setActive(bool activate) override; GameWorldView& gwv; std::unique_ptr printer; diff --git a/libs/s25main/ingameWindows/iwMapGenerator.cpp b/libs/s25main/ingameWindows/iwMapGenerator.cpp index 944ceae7aa..a0173750bb 100644 --- a/libs/s25main/ingameWindows/iwMapGenerator.cpp +++ b/libs/s25main/ingameWindows/iwMapGenerator.cpp @@ -20,7 +20,7 @@ using namespace rttr::mapGenerator; iwMapGenerator::iwMapGenerator(MapSettings& settings) : IngameWindow(CGI_MAP_GENERATOR, IngameWindow::posLastOrCenter, Extent(270, 520), _("Map Generator"), - LOADER.GetImageN("resource", 41), true, CloseBehavior::Custom), + LOADER.getImageN("resource", 41), true, CloseBehavior::Custom), mapSettings(settings) { WorldDescription desc; @@ -133,94 +133,94 @@ void iwMapGenerator::msgButtonClick(const unsigned ctrl_id) void iwMapGenerator::Apply() { - mapSettings.numPlayers = GetCtrl(ID_cbNumPlayers)->GetSelection().value() + 2; - mapSettings.ratioGold = GetCtrl(ID_pgGoldRatio)->GetPosition(); - mapSettings.ratioIron = GetCtrl(ID_pgIronRatio)->GetPosition(); - mapSettings.ratioCoal = GetCtrl(ID_pgCoalRatio)->GetPosition(); - mapSettings.ratioGranite = GetCtrl(ID_pgGraniteRatio)->GetPosition(); - mapSettings.rivers = GetCtrl(ID_pgRivers)->GetPosition(); - mapSettings.trees = GetCtrl(ID_pgTrees)->GetPosition(); - mapSettings.stonePiles = GetCtrl(ID_pgStonePiles)->GetPosition(); - - switch(GetCtrl(ID_cbMountainDist)->GetSelection().value()) + mapSettings.numPlayers = getCtrl(ID_cbNumPlayers)->getSelection().value() + 2; + mapSettings.ratioGold = getCtrl(ID_pgGoldRatio)->getPosition(); + mapSettings.ratioIron = getCtrl(ID_pgIronRatio)->getPosition(); + mapSettings.ratioCoal = getCtrl(ID_pgCoalRatio)->getPosition(); + mapSettings.ratioGranite = getCtrl(ID_pgGraniteRatio)->getPosition(); + mapSettings.rivers = getCtrl(ID_pgRivers)->getPosition(); + mapSettings.trees = getCtrl(ID_pgTrees)->getPosition(); + mapSettings.stonePiles = getCtrl(ID_pgStonePiles)->getPosition(); + + switch(getCtrl(ID_cbMountainDist)->getSelection().value()) { case 0: mapSettings.mountainDistance = MountainDistance::Close; break; case 1: mapSettings.mountainDistance = MountainDistance::Normal; break; case 2: mapSettings.mountainDistance = MountainDistance::Far; break; case 3: mapSettings.mountainDistance = MountainDistance::VeryFar; break; } - switch(GetCtrl(ID_cbMapStyle)->GetSelection().value()) + switch(getCtrl(ID_cbMapStyle)->getSelection().value()) { case 0: mapSettings.style = MapStyle::Water; break; case 1: mapSettings.style = MapStyle::Land; break; case 2: mapSettings.style = MapStyle::Mixed; break; } mapSettings.size.x = - s25util::fromStringClassic(GetCtrl(ID_cbMapSizeX)->GetSelectedText().value_or("128")); + s25util::fromStringClassic(getCtrl(ID_cbMapSizeX)->getSelectedText().value_or("128")); mapSettings.size.y = - s25util::fromStringClassic(GetCtrl(ID_cbMapSizeY)->GetSelectedText().value_or("128")); - switch(GetCtrl(ID_cbIslands)->GetSelection().value()) + s25util::fromStringClassic(getCtrl(ID_cbMapSizeY)->getSelectedText().value_or("128")); + switch(getCtrl(ID_cbIslands)->getSelection().value()) { case 0: mapSettings.islands = IslandAmount::Few; break; case 1: mapSettings.islands = IslandAmount::Normal; break; case 2: mapSettings.islands = IslandAmount::Many; break; } - const auto& mapType = GetCtrl(ID_cbMapType)->GetSelection(); + const auto& mapType = getCtrl(ID_cbMapType)->getSelection(); if(mapType) mapSettings.type = DescIdx(*mapType); } void iwMapGenerator::Reset() { - GetCtrl(ID_cbNumPlayers) - ->SetSelection(std::min(mapSettings.numPlayers, MAX_PLAYERS) - 2); // List starts at 2 players - - GetCtrl(ID_pgGoldRatio)->SetPosition(mapSettings.ratioGold); - GetCtrl(ID_pgIronRatio)->SetPosition(mapSettings.ratioIron); - GetCtrl(ID_pgCoalRatio)->SetPosition(mapSettings.ratioCoal); - GetCtrl(ID_pgGraniteRatio)->SetPosition(mapSettings.ratioGranite); - GetCtrl(ID_pgRivers)->SetPosition(mapSettings.rivers); - GetCtrl(ID_pgTrees)->SetPosition(mapSettings.trees); - GetCtrl(ID_pgStonePiles)->SetPosition(mapSettings.stonePiles); - - auto* combo = GetCtrl(ID_cbMountainDist); + getCtrl(ID_cbNumPlayers) + ->setSelection(std::min(mapSettings.numPlayers, MAX_PLAYERS) - 2); // List starts at 2 players + + getCtrl(ID_pgGoldRatio)->setPosition(mapSettings.ratioGold); + getCtrl(ID_pgIronRatio)->setPosition(mapSettings.ratioIron); + getCtrl(ID_pgCoalRatio)->setPosition(mapSettings.ratioCoal); + getCtrl(ID_pgGraniteRatio)->setPosition(mapSettings.ratioGranite); + getCtrl(ID_pgRivers)->setPosition(mapSettings.rivers); + getCtrl(ID_pgTrees)->setPosition(mapSettings.trees); + getCtrl(ID_pgStonePiles)->setPosition(mapSettings.stonePiles); + + auto* combo = getCtrl(ID_cbMountainDist); switch(mapSettings.mountainDistance) { - case MountainDistance::Close: combo->SetSelection(0); break; - case MountainDistance::Normal: combo->SetSelection(1); break; - case MountainDistance::Far: combo->SetSelection(2); break; - case MountainDistance::VeryFar: combo->SetSelection(3); break; + case MountainDistance::Close: combo->setSelection(0); break; + case MountainDistance::Normal: combo->setSelection(1); break; + case MountainDistance::Far: combo->setSelection(2); break; + case MountainDistance::VeryFar: combo->setSelection(3); break; } - combo = GetCtrl(ID_cbMapStyle); + combo = getCtrl(ID_cbMapStyle); switch(mapSettings.style) { - case MapStyle::Water: combo->SetSelection(0); break; - case MapStyle::Land: combo->SetSelection(1); break; - case MapStyle::Mixed: combo->SetSelection(2); break; + case MapStyle::Water: combo->setSelection(0); break; + case MapStyle::Land: combo->setSelection(1); break; + case MapStyle::Mixed: combo->setSelection(2); break; } const auto strSizeX = s25util::toStringClassic(mapSettings.size.x); const auto strSizeY = s25util::toStringClassic(mapSettings.size.y); - auto* cbSizeX = GetCtrl(ID_cbMapSizeX); - auto* cbSizeY = GetCtrl(ID_cbMapSizeY); - const auto numSizes = cbSizeX->GetNumItems(); - RTTR_Assert(numSizes == cbSizeY->GetNumItems()); + auto* cbSizeX = getCtrl(ID_cbMapSizeX); + auto* cbSizeY = getCtrl(ID_cbMapSizeY); + const auto numSizes = cbSizeX->getNumItems(); + RTTR_Assert(numSizes == cbSizeY->getNumItems()); for(unsigned i = 0; i < numSizes; ++i) { - if(cbSizeX->GetText(i) == strSizeX) - cbSizeX->SetSelection(i); - if(cbSizeY->GetText(i) == strSizeY) - cbSizeY->SetSelection(i); + if(cbSizeX->getText(i) == strSizeX) + cbSizeX->setSelection(i); + if(cbSizeY->getText(i) == strSizeY) + cbSizeY->setSelection(i); } - combo = GetCtrl(ID_cbIslands); + combo = getCtrl(ID_cbIslands); switch(mapSettings.islands) { - case IslandAmount::Few: combo->SetSelection(0); break; - case IslandAmount::Normal: combo->SetSelection(1); break; - case IslandAmount::Many: combo->SetSelection(2); break; + case IslandAmount::Few: combo->setSelection(0); break; + case IslandAmount::Normal: combo->setSelection(1); break; + case IslandAmount::Many: combo->setSelection(2); break; } - GetCtrl(ID_cbMapType)->SetSelection(mapSettings.type.value); + getCtrl(ID_cbMapType)->setSelection(mapSettings.type.value); } diff --git a/libs/s25main/ingameWindows/iwMerchandiseStatistics.cpp b/libs/s25main/ingameWindows/iwMerchandiseStatistics.cpp index 54d78a2145..bd729918ae 100644 --- a/libs/s25main/ingameWindows/iwMerchandiseStatistics.cpp +++ b/libs/s25main/ingameWindows/iwMerchandiseStatistics.cpp @@ -33,51 +33,51 @@ const std::array iwMerchandiseStatistics::BarColors = { iwMerchandiseStatistics::iwMerchandiseStatistics(const GamePlayer& player) : IngameWindow(CGI_MERCHANDISE_STATISTICS, IngameWindow::posLastOrCenter, Extent(252, 310), _("Merchandise"), - LOADER.GetImageN("resource", 41)), + LOADER.getImageN("resource", 41)), player(player), currentTime(StatisticTime::T1Hour) { // Statistikfeld - AddImage(0, DrawPoint(10 + 115, 23 + 81), LOADER.GetImageN("io", 228)); + AddImage(0, DrawPoint(10 + 115, 23 + 81), LOADER.getImageN("io", 228)); // Waren-Buttons // obere Reihe ctrlMultiSelectGroup* types = AddMultiSelectGroup(22, GroupSelectType::Illuminate); - types->AddImageButton(1, DrawPoint(17, 192), Extent(30, 30), TextureColor::Grey, LOADER.GetWareTex(GoodType::Wood), + types->AddImageButton(1, DrawPoint(17, 192), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Wood), _("Wood")); types->AddImageButton(2, DrawPoint(48, 192), Extent(30, 30), TextureColor::Grey, - LOADER.GetWareTex(GoodType::Boards), _("Boards")); + LOADER.getWareTex(GoodType::Boards), _("Boards")); types->AddImageButton(3, DrawPoint(79, 192), Extent(30, 30), TextureColor::Grey, - LOADER.GetWareTex(GoodType::Stones), _("Stones")); - types->AddImageButton(4, DrawPoint(110, 192), Extent(30, 30), TextureColor::Grey, LOADER.GetImageN("io", 80), + LOADER.getWareTex(GoodType::Stones), _("Stones")); + types->AddImageButton(4, DrawPoint(110, 192), Extent(30, 30), TextureColor::Grey, LOADER.getImageN("io", 80), _("Food")); types->AddImageButton(5, DrawPoint(141, 192), Extent(30, 30), TextureColor::Grey, - LOADER.GetWareTex(GoodType::Water), _("Water")); - types->AddImageButton(6, DrawPoint(172, 192), Extent(30, 30), TextureColor::Grey, LOADER.GetWareTex(GoodType::Beer), + LOADER.getWareTex(GoodType::Water), _("Water")); + types->AddImageButton(6, DrawPoint(172, 192), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Beer), _("Beer")); - types->AddImageButton(7, DrawPoint(203, 192), Extent(30, 30), TextureColor::Grey, LOADER.GetWareTex(GoodType::Coal), + types->AddImageButton(7, DrawPoint(203, 192), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Coal), _("Coal")); // untere Reihe types->AddImageButton(8, DrawPoint(17, 227), Extent(30, 30), TextureColor::Grey, - LOADER.GetWareTex(GoodType::IronOre), _("Ironore")); - types->AddImageButton(9, DrawPoint(48, 227), Extent(30, 30), TextureColor::Grey, LOADER.GetWareTex(GoodType::Gold), + LOADER.getWareTex(GoodType::IronOre), _("Ironore")); + types->AddImageButton(9, DrawPoint(48, 227), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Gold), _("Gold")); - types->AddImageButton(10, DrawPoint(79, 227), Extent(30, 30), TextureColor::Grey, LOADER.GetWareTex(GoodType::Iron), + types->AddImageButton(10, DrawPoint(79, 227), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Iron), _("Iron")); types->AddImageButton(11, DrawPoint(110, 227), Extent(30, 30), TextureColor::Grey, - LOADER.GetWareTex(GoodType::Coins), _("Coins")); + LOADER.getWareTex(GoodType::Coins), _("Coins")); types->AddImageButton(12, DrawPoint(141, 227), Extent(30, 30), TextureColor::Grey, - LOADER.GetWareTex(GoodType::Hammer), _("Tools")); - types->AddImageButton(13, DrawPoint(172, 227), Extent(30, 30), TextureColor::Grey, LOADER.GetImageN("io", 111), + LOADER.getWareTex(GoodType::Hammer), _("Tools")); + types->AddImageButton(13, DrawPoint(172, 227), Extent(30, 30), TextureColor::Grey, LOADER.getImageN("io", 111), _("Weapons")); types->AddImageButton(14, DrawPoint(203, 227), Extent(30, 30), TextureColor::Grey, - LOADER.GetWareTex(GoodType::Boat), _("Boats")); + LOADER.getWareTex(GoodType::Boat), _("Boats")); // Hilfe - AddImageButton(16, DrawPoint(17, 261), Extent(30, 32), TextureColor::Grey, LOADER.GetImageN("io", 225), _("Help")); + AddImageButton(16, DrawPoint(17, 261), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); // Mülleimer - AddImageButton(17, DrawPoint(49, 263), Extent(30, 28), TextureColor::Grey, LOADER.GetImageN("io", 106), + AddImageButton(17, DrawPoint(49, 263), Extent(30, 28), TextureColor::Grey, LOADER.getImageN("io", 106), _("Delete all")); // Zeiten @@ -86,7 +86,7 @@ iwMerchandiseStatistics::iwMerchandiseStatistics(const GamePlayer& player) times->AddTextButton(19, DrawPoint(119, 263), Extent(36, 28), TextureColor::Grey, _("1 h"), NormalFont); times->AddTextButton(20, DrawPoint(155, 263), Extent(36, 28), TextureColor::Grey, _("4 h"), NormalFont); times->AddTextButton(21, DrawPoint(191, 263), Extent(36, 28), TextureColor::Grey, _("16 h"), NormalFont); - times->SetSelection(19); + times->setSelection(19); // Zeit-Werte an der x-Achse timeAnnotations = std::vector(7); @@ -118,9 +118,9 @@ void iwMerchandiseStatistics::msgButtonClick(const unsigned ctrl_id) break; case 17: // Alle abwählen { - const std::set active = GetCtrl(22)->GetSelection(); + const std::set active = getCtrl(22)->getSelection(); for(unsigned sel : active) - GetCtrl(22)->RemoveSelection(sel); + getCtrl(22)->RemoveSelection(sel); } break; } @@ -155,14 +155,14 @@ void iwMerchandiseStatistics::DrawStatistic() // Ein paar benötigte Werte... const int sizeX = 180; const int sizeY = 80; - const DrawPoint topLeft = GetPos() + DrawPoint(34, 64); + const DrawPoint topLeft = getPos() + DrawPoint(34, 64); const int stepX = sizeX / NUM_STAT_STEPS; // 6 // Aktive Buttons holen (Achtung ID == BarColor + 1) - const std::set& active = GetCtrl(22)->GetSelection(); + const std::set& active = getCtrl(22)->getSelection(); // Statistik holen - const GamePlayer::Statistic stat = player.GetStatistic(currentTime); + const GamePlayer::Statistic stat = player.getStatistic(currentTime); // Maximalwert suchen unsigned short max = 1; @@ -178,7 +178,7 @@ void iwMerchandiseStatistics::DrawStatistic() } // Maximalen Wert an die Achse schreiben - maxValue->SetText(std::to_string(max)); + maxValue->setText(std::to_string(max)); DrawPoint previous(0, 0); unsigned short currentIndex = stat.currentIndex; @@ -212,7 +212,7 @@ void iwMerchandiseStatistics::DrawRectangles() const Extent size(30, 4); const DrawPoint step(31, 35); - const DrawPoint pos = GetDrawPos(); + const DrawPoint pos = getDrawPos(); DrawPoint curOffset(17, 187); for(unsigned i = 0; i < 14; ++i) @@ -232,7 +232,7 @@ void iwMerchandiseStatistics::DrawAxis() // Ein paar benötigte Werte... const int sizeX = 180; const int sizeY = 80; - const DrawPoint topLeft = GetPos() + DrawPoint(34, 64); + const DrawPoint topLeft = getPos() + DrawPoint(34, 64); const DrawPoint topLeftRel(37, 64); // X-Achse, horizontal, war irgendwie zu lang links :S @@ -249,9 +249,9 @@ void iwMerchandiseStatistics::DrawAxis() // Striche an der X-Achse + Beschriftung // Zunächst die 0, die haben alle - timeAnnotations[6]->SetPos(topLeftRel + DrawPoint(180, sizeY + 6)); - timeAnnotations[6]->SetText("0"); - timeAnnotations[6]->SetVisible(true); + timeAnnotations[6]->setPos(topLeftRel + DrawPoint(180, sizeY + 6)); + timeAnnotations[6]->setText("0"); + timeAnnotations[6]->setVisible(true); switch(currentTime) { @@ -259,146 +259,146 @@ void iwMerchandiseStatistics::DrawAxis() // -15 DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[0]->SetPos(topLeftRel + DrawPoint(6, sizeY + 6)); - timeAnnotations[0]->SetText("-15"); - timeAnnotations[0]->SetVisible(true); + timeAnnotations[0]->setPos(topLeftRel + DrawPoint(6, sizeY + 6)); + timeAnnotations[0]->setText("-15"); + timeAnnotations[0]->setVisible(true); // -12 DrawLine(topLeft + DrawPoint(40, sizeY + 2), topLeft + DrawPoint(40, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[1]->SetPos(topLeftRel + DrawPoint(40, sizeY + 6)); - timeAnnotations[1]->SetText("-12"); - timeAnnotations[1]->SetVisible(true); + timeAnnotations[1]->setPos(topLeftRel + DrawPoint(40, sizeY + 6)); + timeAnnotations[1]->setText("-12"); + timeAnnotations[1]->setVisible(true); // -9 DrawLine(topLeft + DrawPoint(75, sizeY + 2), topLeft + DrawPoint(75, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[2]->SetPos(topLeftRel + DrawPoint(75, sizeY + 6)); - timeAnnotations[2]->SetText("-9"); - timeAnnotations[2]->SetVisible(true); + timeAnnotations[2]->setPos(topLeftRel + DrawPoint(75, sizeY + 6)); + timeAnnotations[2]->setText("-9"); + timeAnnotations[2]->setVisible(true); // -6 DrawLine(topLeft + DrawPoint(110, sizeY + 2), topLeft + DrawPoint(110, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[3]->SetPos(topLeftRel + DrawPoint(110, sizeY + 6)); - timeAnnotations[3]->SetText("-6"); - timeAnnotations[3]->SetVisible(true); + timeAnnotations[3]->setPos(topLeftRel + DrawPoint(110, sizeY + 6)); + timeAnnotations[3]->setText("-6"); + timeAnnotations[3]->setVisible(true); // -3 DrawLine(topLeft + DrawPoint(145, sizeY + 2), topLeft + DrawPoint(145, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[4]->SetPos(topLeftRel + DrawPoint(145, sizeY + 6)); - timeAnnotations[4]->SetText("-3"); - timeAnnotations[4]->SetVisible(true); + timeAnnotations[4]->setPos(topLeftRel + DrawPoint(145, sizeY + 6)); + timeAnnotations[4]->setText("-3"); + timeAnnotations[4]->setVisible(true); - timeAnnotations[5]->SetVisible(false); + timeAnnotations[5]->setVisible(false); break; case StatisticTime::T1Hour: // -60 DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[0]->SetPos(topLeftRel + DrawPoint(6, sizeY + 6)); - timeAnnotations[0]->SetText("-60"); - timeAnnotations[0]->SetVisible(true); + timeAnnotations[0]->setPos(topLeftRel + DrawPoint(6, sizeY + 6)); + timeAnnotations[0]->setText("-60"); + timeAnnotations[0]->setVisible(true); // -50 DrawLine(topLeft + DrawPoint(35, sizeY + 2), topLeft + DrawPoint(35, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[1]->SetPos(topLeftRel + DrawPoint(35, sizeY + 6)); - timeAnnotations[1]->SetText("-50"); - timeAnnotations[1]->SetVisible(true); + timeAnnotations[1]->setPos(topLeftRel + DrawPoint(35, sizeY + 6)); + timeAnnotations[1]->setText("-50"); + timeAnnotations[1]->setVisible(true); // -40 DrawLine(topLeft + DrawPoint(64, sizeY + 2), topLeft + DrawPoint(64, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[2]->SetPos(topLeftRel + DrawPoint(64, sizeY + 6)); - timeAnnotations[2]->SetText("-40"); - timeAnnotations[2]->SetVisible(true); + timeAnnotations[2]->setPos(topLeftRel + DrawPoint(64, sizeY + 6)); + timeAnnotations[2]->setText("-40"); + timeAnnotations[2]->setVisible(true); // -30 DrawLine(topLeft + DrawPoint(93, sizeY + 2), topLeft + DrawPoint(93, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[3]->SetPos(topLeftRel + DrawPoint(93, sizeY + 6)); - timeAnnotations[3]->SetText("-30"); - timeAnnotations[3]->SetVisible(true); + timeAnnotations[3]->setPos(topLeftRel + DrawPoint(93, sizeY + 6)); + timeAnnotations[3]->setText("-30"); + timeAnnotations[3]->setVisible(true); // -20 DrawLine(topLeft + DrawPoint(122, sizeY + 2), topLeft + DrawPoint(122, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[4]->SetPos(topLeftRel + DrawPoint(122, sizeY + 6)); - timeAnnotations[4]->SetText("-20"); - timeAnnotations[4]->SetVisible(true); + timeAnnotations[4]->setPos(topLeftRel + DrawPoint(122, sizeY + 6)); + timeAnnotations[4]->setText("-20"); + timeAnnotations[4]->setVisible(true); // -10 DrawLine(topLeft + DrawPoint(151, sizeY + 2), topLeft + DrawPoint(151, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[5]->SetPos(topLeftRel + DrawPoint(151, sizeY + 6)); - timeAnnotations[5]->SetText("-10"); - timeAnnotations[5]->SetVisible(true); + timeAnnotations[5]->setPos(topLeftRel + DrawPoint(151, sizeY + 6)); + timeAnnotations[5]->setText("-10"); + timeAnnotations[5]->setVisible(true); break; case StatisticTime::T4Hours: // -240 DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[0]->SetPos(topLeftRel + DrawPoint(6, sizeY + 6)); - timeAnnotations[0]->SetText("-240"); - timeAnnotations[0]->SetVisible(true); + timeAnnotations[0]->setPos(topLeftRel + DrawPoint(6, sizeY + 6)); + timeAnnotations[0]->setText("-240"); + timeAnnotations[0]->setVisible(true); // -180 DrawLine(topLeft + DrawPoint(49, sizeY + 2), topLeft + DrawPoint(49, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[1]->SetPos(topLeftRel + DrawPoint(49, sizeY + 6)); - timeAnnotations[1]->SetText("-180"); - timeAnnotations[1]->SetVisible(true); + timeAnnotations[1]->setPos(topLeftRel + DrawPoint(49, sizeY + 6)); + timeAnnotations[1]->setText("-180"); + timeAnnotations[1]->setVisible(true); // -120 DrawLine(topLeft + DrawPoint(93, sizeY + 2), topLeft + DrawPoint(93, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[2]->SetPos(topLeftRel + DrawPoint(93, sizeY + 6)); - timeAnnotations[2]->SetText("-120"); - timeAnnotations[2]->SetVisible(true); + timeAnnotations[2]->setPos(topLeftRel + DrawPoint(93, sizeY + 6)); + timeAnnotations[2]->setText("-120"); + timeAnnotations[2]->setVisible(true); // -60 DrawLine(topLeft + DrawPoint(136, sizeY + 2), topLeft + DrawPoint(136, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[3]->SetPos(topLeftRel + DrawPoint(136, sizeY + 6)); - timeAnnotations[3]->SetText("-60"); - timeAnnotations[3]->SetVisible(true); + timeAnnotations[3]->setPos(topLeftRel + DrawPoint(136, sizeY + 6)); + timeAnnotations[3]->setText("-60"); + timeAnnotations[3]->setVisible(true); - timeAnnotations[4]->SetVisible(false); - timeAnnotations[5]->SetVisible(false); + timeAnnotations[4]->setVisible(false); + timeAnnotations[5]->setVisible(false); break; case StatisticTime::T16Hours: // -960 DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[0]->SetPos(topLeftRel + DrawPoint(6, sizeY + 6)); - timeAnnotations[0]->SetText("-960"); - timeAnnotations[0]->SetVisible(true); + timeAnnotations[0]->setPos(topLeftRel + DrawPoint(6, sizeY + 6)); + timeAnnotations[0]->setText("-960"); + timeAnnotations[0]->setVisible(true); // -720 DrawLine(topLeft + DrawPoint(49, sizeY + 2), topLeft + DrawPoint(49, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[1]->SetPos(topLeftRel + DrawPoint(49, sizeY + 6)); - timeAnnotations[1]->SetText("-720"); - timeAnnotations[1]->SetVisible(true); + timeAnnotations[1]->setPos(topLeftRel + DrawPoint(49, sizeY + 6)); + timeAnnotations[1]->setText("-720"); + timeAnnotations[1]->setVisible(true); // -480 DrawLine(topLeft + DrawPoint(93, sizeY + 2), topLeft + DrawPoint(93, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[2]->SetPos(topLeftRel + DrawPoint(93, sizeY + 6)); - timeAnnotations[2]->SetText("-480"); - timeAnnotations[2]->SetVisible(true); + timeAnnotations[2]->setPos(topLeftRel + DrawPoint(93, sizeY + 6)); + timeAnnotations[2]->setText("-480"); + timeAnnotations[2]->setVisible(true); // -240 DrawLine(topLeft + DrawPoint(136, sizeY + 2), topLeft + DrawPoint(136, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); - timeAnnotations[3]->SetPos(topLeftRel + DrawPoint(136, sizeY + 6)); - timeAnnotations[3]->SetText("-240"); - timeAnnotations[3]->SetVisible(true); + timeAnnotations[3]->setPos(topLeftRel + DrawPoint(136, sizeY + 6)); + timeAnnotations[3]->setText("-240"); + timeAnnotations[3]->setVisible(true); - timeAnnotations[4]->SetVisible(false); - timeAnnotations[5]->SetVisible(false); + timeAnnotations[4]->setVisible(false); + timeAnnotations[5]->setVisible(false); break; } } diff --git a/libs/s25main/ingameWindows/iwMilitary.cpp b/libs/s25main/ingameWindows/iwMilitary.cpp index 4cc2a4e991..12fe869222 100644 --- a/libs/s25main/ingameWindows/iwMilitary.cpp +++ b/libs/s25main/ingameWindows/iwMilitary.cpp @@ -27,14 +27,14 @@ enum iwMilitary::iwMilitary(const GameWorldViewer& gwv, GameCommandFactory& gcFactory) : TransmitSettingsIgwAdapter(CGI_MILITARY, IngameWindow::posLastOrCenter, Extent(168, 330), _("Military"), - LOADER.GetImageN("io", 5)), + LOADER.getImageN("io", 5)), gcFactory(gcFactory) { // Setting bars constexpr Extent progSize(132, 26); constexpr Extent progPadding(4, 4); constexpr unsigned progSpacing = 6; - DrawPoint curPos((GetSize().x - progSize.x) / 2, 25); // Same space left and right + DrawPoint curPos((getSize().x - progSize.x) / 2, 25); // Same space left and right AddProgress(ID_Offset, curPos, progSize, TextureColor::Grey, 119, 120, MILITARY_SETTINGS_SCALE[0], "", progPadding, 0, _("Fewer recruits"), _("More recruits")); /* pitch: progPadding */ curPos.y += progSize.y + progSpacing; @@ -44,8 +44,8 @@ iwMilitary::iwMilitary(const GameWorldViewer& gwv, GameCommandFactory& gcFactory auto* ctrl = AddProgress(ID_Offset + 2, curPos, progSize, TextureColor::Grey, 123, 124, MILITARY_SETTINGS_SCALE[2], "", progPadding, 0, _("Fewer defenders"), _("More defenders")); // Hide defender setting if changing defender behavior is disabled - if(gwv.GetWorld().GetGGS().getSelection(AddonId::DEFENDER_BEHAVIOR) == 1) - ctrl->SetVisible(false); + if(gwv.getWorld().getGGS().getSelection(AddonId::DEFENDER_BEHAVIOR) == 1) + ctrl->setVisible(false); else curPos.y += progSize.y + progSpacing; AddProgress(ID_Offset + 3, curPos, progSize, TextureColor::Grey, 209, 210, MILITARY_SETTINGS_SCALE[3], "", @@ -60,8 +60,8 @@ iwMilitary::iwMilitary(const GameWorldViewer& gwv, GameCommandFactory& gcFactory ctrl = AddProgress(ID_Offset + 6, curPos, progSize, TextureColor::Grey, 1000, 1001, MILITARY_SETTINGS_SCALE[6], "", progPadding, 0, _("Near harbor points"), _("Near harbor points")); // Hide changing harbor area if sea attacks are disabled - if(!gwv.GetWorld().GetGGS().isEnabled(AddonId::SEA_ATTACK)) - ctrl->SetVisible(false); + if(!gwv.getWorld().getGGS().isEnabled(AddonId::SEA_ATTACK)) + ctrl->setVisible(false); else curPos.y += progSize.y + progSpacing; AddProgress(ID_Offset + 7, curPos, progSize, TextureColor::Grey, 125, 126, MILITARY_SETTINGS_SCALE[7], "", @@ -69,17 +69,17 @@ iwMilitary::iwMilitary(const GameWorldViewer& gwv, GameCommandFactory& gcFactory // Buttons at bottom constexpr Extent buttonSize(30, 32); - curPos.y = GetRightBottomBoundary().y - buttonSize.y - 5; - AddImageButton(ID_btHelp, curPos, buttonSize, TextureColor::Grey, LOADER.GetImageN("io", 225), _("Help")); + curPos.y = getRightBottomBoundary().y - buttonSize.y - 5; + AddImageButton(ID_btHelp, curPos, buttonSize, TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); curPos.x += progSize.x - buttonSize.x; - AddImageButton(ID_btDefault, curPos, buttonSize, TextureColor::Grey, LOADER.GetImageN("io", 191), _("Default")); + AddImageButton(ID_btDefault, curPos, buttonSize, TextureColor::Grey, LOADER.getImageN("io", 191), _("Default")); iwMilitary::UpdateSettings(); } void iwMilitary::TransmitSettings() { - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) return; if(settings_changed) @@ -87,7 +87,7 @@ void iwMilitary::TransmitSettings() // Save settings MilitarySettings milSettings = GAMECLIENT.visual_settings.military_settings; for(unsigned char i = 0; i < milSettings.size(); ++i) - milSettings[i] = (unsigned char)GetCtrl(ID_Offset + i)->GetPosition(); + milSettings[i] = (unsigned char)getCtrl(ID_Offset + i)->getPosition(); if(gcFactory.ChangeMilitary(milSettings)) { @@ -104,10 +104,10 @@ void iwMilitary::msgProgressChange(const unsigned /*ctrl_id*/, const unsigned sh void iwMilitary::UpdateSettings(const MilitarySettings& military_settings) { - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) GAMECLIENT.ResetVisualSettings(); for(unsigned i = 0; i < military_settings.size(); ++i) - GetCtrl(ID_Offset + i)->SetPosition(military_settings[i]); + getCtrl(ID_Offset + i)->setPosition(military_settings[i]); } void iwMilitary::UpdateSettings() diff --git a/libs/s25main/ingameWindows/iwMilitaryBuilding.cpp b/libs/s25main/ingameWindows/iwMilitaryBuilding.cpp index a804cd8e62..8bd2bab51d 100644 --- a/libs/s25main/ingameWindows/iwMilitaryBuilding.cpp +++ b/libs/s25main/ingameWindows/iwMilitaryBuilding.cpp @@ -31,18 +31,18 @@ constexpr unsigned ARMOR_ENABLE_BUTTON_ID = 10 + NUM_SOLDIER_RANKS * 4 + 1; constexpr unsigned HEIGHT_OF_ROW = 38; iwMilitaryBuilding::iwMilitaryBuilding(GameWorldView& gwv, GameCommandFactory& gcFactory, nobMilitary* const building) - : IngameWindow(CGI_BUILDING + MapBase::CreateGUIID(building->GetPos()), IngameWindow::posAtMouse, Extent(226, 194), - _(BUILDING_NAMES[building->GetBuildingType()]), LOADER.GetImageN("resource", 41)), + : IngameWindow(CGI_BUILDING + MapBase::CreateGUIID(building->getPos()), IngameWindow::posAtMouse, Extent(226, 194), + _(BUILDING_NAMES[building->getBuildingType()]), LOADER.getImageN("resource", 41)), gwv(gwv), gcFactory(gcFactory), building(building) { - const auto addonStatusMilitaryControl = gwv.GetWorld().GetGGS().getSelection(AddonId::MILITARY_CONTROL); + const auto addonStatusMilitaryControl = gwv.getWorld().getGGS().getSelection(AddonId::MILITARY_CONTROL); DrawPoint btOffset(0, 0); if(addonStatusMilitaryControl == 2) btOffset.y += 154; DrawPoint btOffsetLeatherAddon(0, 0); - if(leatheraddon::isAddonActive(gwv.GetWorld())) + if(leatheraddon::isAddonActive(gwv.getWorld())) { btOffsetLeatherAddon = DrawPoint(addonStatusMilitaryControl == 0 ? 0 : 36, HEIGHT_OF_ROW); btOffset += btOffsetLeatherAddon; @@ -51,38 +51,38 @@ iwMilitaryBuilding::iwMilitaryBuilding(GameWorldView& gwv, GameCommandFactory& g Resize(Extent(226 + btOffset.x, 194 + btOffset.y)); // Schwert - AddImage(0, DrawPoint(28, 39), LOADER.GetMapTexture(2298)); - AddImage(1, DrawPoint(28, 39), LOADER.GetWareTex(GoodType::Sword)); + AddImage(0, DrawPoint(28, 39), LOADER.getMapTexture(2298)); + AddImage(1, DrawPoint(28, 39), LOADER.getWareTex(GoodType::Sword)); // Schild - AddImage(2, DrawPoint(196 + btOffset.x, 39), LOADER.GetMapTexture(2298)); - AddImage(3, DrawPoint(196 + btOffset.x, 39), LOADER.GetWareTex(GoodType::ShieldRomans)); + AddImage(2, DrawPoint(196 + btOffset.x, 39), LOADER.getMapTexture(2298)); + AddImage(3, DrawPoint(196 + btOffset.x, 39), LOADER.getWareTex(GoodType::ShieldRomans)); // Hilfe - AddImageButton(4, DrawPoint(16, btOffset.y + 147), Extent(30, 32), TextureColor::Grey, LOADER.GetImageN("io", 225), + AddImageButton(4, DrawPoint(16, btOffset.y + 147), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); // Abreißen - AddImageButton(5, DrawPoint(50, btOffset.y + 147), Extent(34, 32), TextureColor::Grey, LOADER.GetImageN("io", 23), + AddImageButton(5, DrawPoint(50, btOffset.y + 147), Extent(34, 32), TextureColor::Grey, LOADER.getImageN("io", 23), _("Demolish house")); // Gold an/aus (227,226) AddImageButton(6, DrawPoint(90, btOffset.y + 147), Extent(32, 32), TextureColor::Grey, - LOADER.GetImageN("io", ((building->IsGoldDisabledVirtual()) ? 226 : 227)), _("Gold delivery")); + LOADER.getImageN("io", ((building->isGoldDisabledVirtual()) ? 226 : 227)), _("Gold delivery")); // "Gehe Zu Ort" AddImageButton(7, DrawPoint(179 + btOffset.x, btOffset.y + 147), Extent(30, 32), TextureColor::Grey, - LOADER.GetImageN("io", 107), _("Go to place")); + LOADER.getImageN("io", 107), _("Go to place")); // Gebäudebild - AddImage(8, DrawPoint(117 + btOffset.x / 2, 114), &building->GetBuildingImage()); + AddImage(8, DrawPoint(117 + btOffset.x / 2, 114), &building->getBuildingImage()); // "Go to next" (building of same type) AddImageButton(9, DrawPoint(179 + btOffset.x, btOffset.y + 115), Extent(30, 32), TextureColor::Grey, - LOADER.GetImageN("io_new", 11), _("Go to next military building")); + LOADER.getImageN("io_new", 11), _("Go to next military building")); - if(leatheraddon::isAddonActive(gwv.GetWorld())) + if(leatheraddon::isAddonActive(gwv.getWorld())) { AddImageButton( ARMOR_ENABLE_BUTTON_ID, DrawPoint(126 + btOffsetLeatherAddon.x, btOffset.y + 147), Extent(32, 32), TextureColor::Grey, - LOADER.GetImageN("leather_bobs", leatheraddon::bobIndex[building->IsArmorAllowedVirtual() ? + LOADER.getImageN("leather_bobs", leatheraddon::bobIndex[building->isArmorAllowedVirtual() ? leatheraddon::BobType::ArmorDeliverIcon : leatheraddon::BobType::DisableDeliveryArmorIcon]), _("Armor delivery")); @@ -92,28 +92,28 @@ iwMilitaryBuilding::iwMilitaryBuilding(GameWorldView& gwv, GameCommandFactory& g { // Minimal troop controls AddImageButton(10, DrawPoint(126, btOffset.y + 147), Extent(32, 32), TextureColor::Grey, - LOADER.GetImageN("io_new", 12), _("Send max rank soldiers to a warehouse")); + LOADER.getImageN("io_new", 12), _("Send max rank soldiers to a warehouse")); } else if(addonStatusMilitaryControl == 2) { // Full troop controls AddImageButton(10, DrawPoint(126, btOffset.y + 147), Extent(32, 32), TextureColor::Grey, - LOADER.GetImageN("io_new", 12), _("Send soldiers home")); + LOADER.getImageN("io_new", 12), _("Send soldiers home")); const unsigned Y_SPACING = 30; for(unsigned i = 0; i < NUM_SOLDIER_RANKS; ++i) { // Minus AddImageButton(11 + (4 * i), DrawPoint(69 + btOffset.x / 2, 136 + btOffsetLeatherAddon.y + Y_SPACING * i), - Extent(24, 24), TextureColor::Red1, LOADER.GetImageN("io", 139), _("Fewer")); + Extent(24, 24), TextureColor::Red1, LOADER.getImageN("io", 139), _("Fewer")); // Background AddImage(12 + (4 * i), DrawPoint(113 + btOffset.x / 2, 148 + btOffsetLeatherAddon.y + Y_SPACING * i), - LOADER.GetMapTexture(2298)); + LOADER.getMapTexture(2298)); // Rank image AddImage(13 + (4 * i), DrawPoint(113 + btOffset.x / 2, 148 + btOffsetLeatherAddon.y + Y_SPACING * i), - LOADER.GetMapTexture(2321 + i)); + LOADER.getMapTexture(2321 + i)); // Plus AddImageButton(14 + (4 * i), DrawPoint(133 + btOffset.x / 2, 136 + btOffsetLeatherAddon.y + Y_SPACING * i), - Extent(24, 24), TextureColor::Green2, LOADER.GetImageN("io", 138), _("More")); + Extent(24, 24), TextureColor::Green2, LOADER.getImageN("io", 138), _("More")); } } } @@ -123,32 +123,32 @@ void iwMilitaryBuilding::DrawContent() unsigned btOffsetY = 60; // Schwarzer Untergrund für Goldanzeige - const unsigned maxCoinCt = building->GetMaxCoinCt(); - DrawPoint goldPos = GetDrawPos() + DrawPoint((GetSize().x - 22 * maxCoinCt) / 2, btOffsetY); + const unsigned maxCoinCt = building->getMaxCoinCt(); + DrawPoint goldPos = getDrawPos() + DrawPoint((getSize().x - 22 * maxCoinCt) / 2, btOffsetY); DrawRectangle(Rect(goldPos, Extent(22 * maxCoinCt, 24)), 0x96000000); // Gold goldPos += DrawPoint(12, 12); for(unsigned short i = 0; i < maxCoinCt; ++i) { - LOADER.GetMapTexture(2278)->DrawFull(goldPos, (i >= building->GetNumCoins() ? 0xFFA0A0A0 : 0xFFFFFFFF)); + LOADER.getMapTexture(2278)->DrawFull(goldPos, (i >= building->getNumCoins() ? 0xFFA0A0A0 : 0xFFFFFFFF)); goldPos.x += 22; } btOffsetY += HEIGHT_OF_ROW; auto* armorWareIcon = - LOADER.GetImageN("leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::ArmorWareIcon]); + LOADER.getImageN("leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::ArmorWareIcon]); - if(leatheraddon::isAddonActive(gwv.GetWorld())) + if(leatheraddon::isAddonActive(gwv.getWorld())) { // Black background for armor display - const unsigned maxArmorCt = building->GetMaxArmorCt(); - DrawPoint armorPos = GetDrawPos() + DrawPoint((GetSize().x - 22 * maxArmorCt) / 2, btOffsetY); + const unsigned maxArmorCt = building->getMaxArmorCt(); + DrawPoint armorPos = getDrawPos() + DrawPoint((getSize().x - 22 * maxArmorCt) / 2, btOffsetY); DrawRectangle(Rect(armorPos, Extent(22 * maxArmorCt, 24)), 0x96000000); // Armor armorPos += DrawPoint(12, 12); for(unsigned short i = 0; i < maxArmorCt; ++i) { - armorWareIcon->DrawFull(armorPos, (i >= building->GetNumArmor() ? 0xFFA0A0A0 : 0xFFFFFFFF)); + armorWareIcon->DrawFull(armorPos, (i >= building->getNumArmor() ? 0xFFA0A0A0 : 0xFFFFFFFF)); armorPos.x += 22; } btOffsetY += HEIGHT_OF_ROW; @@ -156,11 +156,11 @@ void iwMilitaryBuilding::DrawContent() // Sammeln aus der Rausgeh-Liste und denen, die wirklich noch drinne sind boost::container::flat_set soldiers; - for(const auto& soldier : building->GetTroops()) + for(const auto& soldier : building->getTroops()) soldiers.insert(&soldier); - for(const noFigure& fig : building->GetLeavingFigures()) + for(const noFigure& fig : building->getLeavingFigures()) { - const GO_Type figType = fig.GetGOT(); + const GO_Type figType = fig.getGOT(); if(figType == GO_Type::NofAttacker || figType == GO_Type::NofAggressivedefender || figType == GO_Type::NofDefender || figType == GO_Type::NofPassivesoldier) { @@ -168,8 +168,8 @@ void iwMilitaryBuilding::DrawContent() } } - const unsigned maxSoldierCt = building->GetMaxTroopsCt(); - DrawPoint troopsPos = GetDrawPos() + DrawPoint((GetSize().x - 22 * maxSoldierCt) / 2, btOffsetY); + const unsigned maxSoldierCt = building->getMaxTroopsCt(); + DrawPoint troopsPos = getDrawPos() + DrawPoint((getSize().x - 22 * maxSoldierCt) / 2, btOffsetY); // Schwarzer Untergrund für Soldatenanzeige DrawRectangle(Rect(troopsPos, Extent(22 * maxSoldierCt, 24)), 0x96000000); @@ -177,14 +177,14 @@ void iwMilitaryBuilding::DrawContent() DrawPoint curTroopsPos = troopsPos + DrawPoint(12, 12); for(const auto* soldier : soldiers) { - if(leatheraddon::isAddonActive(gwv.GetWorld()) && soldier->HasArmor()) + if(leatheraddon::isAddonActive(gwv.getWorld()) && soldier->hasArmor()) armorWareIcon->DrawFull(curTroopsPos, 0xFFA0A0A0); - LOADER.GetMapTexture(2321 + soldier->GetRank())->DrawFull(curTroopsPos); + LOADER.getMapTexture(2321 + soldier->getRank())->DrawFull(curTroopsPos); curTroopsPos.x += 22; } // Draw health above soldiers - if(gwv.GetWorld().GetGGS().isEnabled(AddonId::MILITARY_HITPOINTS)) + if(gwv.getWorld().getGGS().isEnabled(AddonId::MILITARY_HITPOINTS)) { DrawPoint healthPos = troopsPos - DrawPoint(0, 14); @@ -194,8 +194,8 @@ void iwMilitaryBuilding::DrawContent() healthPos += DrawPoint(12, 2); for(const auto* soldier : soldiers) { - auto hitpoints = static_cast(soldier->GetHitpoints()); - auto maxHitpoints = static_cast(HITPOINTS[soldier->GetRank()]); + auto hitpoints = static_cast(soldier->getHitpoints()); + auto maxHitpoints = static_cast(HITPOINTS[soldier->getRank()]); unsigned hitpointsColour; if(hitpoints <= maxHitpoints / 2) hitpointsColour = COLOR_RED; @@ -207,7 +207,7 @@ void iwMilitaryBuilding::DrawContent() hitpointsColour = COLOR_ORANGE; } NormalFont->Draw(healthPos, std::to_string(hitpoints), FontStyle::CENTER, hitpointsColour); - if(leatheraddon::isAddonActive(gwv.GetWorld()) && soldier->HasArmor()) + if(leatheraddon::isAddonActive(gwv.getWorld()) && soldier->hasArmor()) { SmallFont->Draw(healthPos + DrawPoint(7, 0), "+", FontStyle::CENTER, hitpointsColour); SmallFont->Draw(healthPos + DrawPoint(10, 0), "1", FontStyle::CENTER, hitpointsColour); @@ -217,12 +217,12 @@ void iwMilitaryBuilding::DrawContent() } btOffsetY += HEIGHT_OF_ROW; - if(gwv.GetWorld().GetGGS().getSelection(AddonId::MILITARY_CONTROL) == 2) + if(gwv.getWorld().getGGS().getSelection(AddonId::MILITARY_CONTROL) == 2) { const unsigned Y_SPACING = 30; for(unsigned i = 0; i < NUM_SOLDIER_RANKS; ++i) - NormalFont->Draw(GetDrawPos() + DrawPoint(GetSize().x / 2 - 12, btOffsetY + Y_SPACING * i), - std::to_string(building->GetTroopLimit(i)), FontStyle::LEFT, COLOR_YELLOW); + NormalFont->Draw(getDrawPos() + DrawPoint(getSize().x / 2 - 12, btOffsetY + Y_SPACING * i), + std::to_string(building->getTroopLimit(i)), FontStyle::LEFT, COLOR_YELLOW); } } @@ -233,16 +233,16 @@ void iwMilitaryBuilding::msgButtonClick(const unsigned ctrl_id) case 4: // Hilfe { WINDOWMANAGER.ReplaceWindow( - std::make_unique(_(BUILDING_HELP_STRINGS[building->GetBuildingType()]))); + std::make_unique(_(BUILDING_HELP_STRINGS[building->getBuildingType()]))); } break; case 5: // Gebäude abbrennen { // Darf das Gebäude abgerissen werden? - if(!building->IsDemolitionAllowed()) + if(!building->isDemolitionAllowed()) { // Messagebox anzeigen - DemolitionNotAllowed(gwv.GetWorld().GetGGS()); + DemolitionNotAllowed(gwv.getWorld().getGGS()); } else { // Abreißen? @@ -253,34 +253,34 @@ void iwMilitaryBuilding::msgButtonClick(const unsigned ctrl_id) break; case 6: // Gold einstellen/erlauben { - if(!GAMECLIENT.IsReplayModeOn()) + if(!GAMECLIENT.isReplayModeOn()) { // NC senden - if(gcFactory.SetCoinsAllowed(building->GetPos(), building->IsGoldDisabledVirtual())) + if(gcFactory.SetCoinsAllowed(building->getPos(), building->isGoldDisabledVirtual())) { // visuell anzeigen building->ToggleCoinsVirtual(); // anderes Bild auf dem Button - if(building->IsGoldDisabledVirtual()) - GetCtrl(6)->SetImage(LOADER.GetImageN("io", 226)); + if(building->isGoldDisabledVirtual()) + getCtrl(6)->setImage(LOADER.getImageN("io", 226)); else - GetCtrl(6)->SetImage(LOADER.GetImageN("io", 227)); + getCtrl(6)->setImage(LOADER.getImageN("io", 227)); } } } break; case 7: // "Gehe Zu Ort" { - gwv.MoveToMapPt(building->GetPos()); + gwv.MoveToMapPt(building->getPos()); } break; case 9: // go to next of same type { const std::list& militaryBuildings = - gwv.GetWorld().GetPlayer(building->GetPlayer()).GetBuildingRegister().GetMilitaryBuildings(); + gwv.getWorld().getPlayer(building->getPlayer()).getBuildingRegister().getMilitaryBuildings(); // go through list once we get to current building -> open window for the next one and go to next location auto it = helpers::find_if( - militaryBuildings, [bldPos = building->GetPos()](const auto* it) { return it->GetPos() == bldPos; }); + militaryBuildings, [bldPos = building->getPos()](const auto* it) { return it->getPos() == bldPos; }); if(it != militaryBuildings.end()) // got to current building in the list? { // close old window, open new window (todo: only open if it isnt already open), move to location of next @@ -289,41 +289,41 @@ void iwMilitaryBuilding::msgButtonClick(const unsigned ctrl_id) ++it; if(it == militaryBuildings.end()) // was last entry in list -> goto first it = militaryBuildings.begin(); - gwv.MoveToMapPt((*it)->GetPos()); - WINDOWMANAGER.ReplaceWindow(std::make_unique(gwv, gcFactory, *it)).SetPos(GetPos()); + gwv.MoveToMapPt((*it)->getPos()); + WINDOWMANAGER.ReplaceWindow(std::make_unique(gwv, gcFactory, *it)).setPos(getPos()); break; } } break; case 10: { - if(gwv.GetWorld().GetGGS().getSelection(AddonId::MILITARY_CONTROL) == 1) + if(gwv.getWorld().getGGS().getSelection(AddonId::MILITARY_CONTROL) == 1) { // Send the highest rank soldiers in this building home and get new soldiers - if(building->GetNumTroops() > 1) + if(building->getNumTroops() > 1) { - auto maxRank = building->GetTroops().back().GetRank(); - gcFactory.SetTroopLimit(building->GetPos(), maxRank, 0); - gcFactory.SetTroopLimit(building->GetPos(), maxRank, building->GetMaxTroopsCt()); + auto maxRank = building->getTroops().back().getRank(); + gcFactory.SetTroopLimit(building->getPos(), maxRank, 0); + gcFactory.SetTroopLimit(building->getPos(), maxRank, building->getMaxTroopsCt()); } } else { // Send all soldiers home except one - gcFactory.SetTroopLimit(building->GetPos(), 0, 1); + gcFactory.SetTroopLimit(building->getPos(), 0, 1); for(unsigned rank = 1; rank < NUM_SOLDIER_RANKS; ++rank) - gcFactory.SetTroopLimit(building->GetPos(), rank, 0); + gcFactory.SetTroopLimit(building->getPos(), rank, 0); } } break; case ARMOR_ENABLE_BUTTON_ID: { - if(!GAMECLIENT.IsReplayModeOn()) + if(!GAMECLIENT.isReplayModeOn()) { - if(gcFactory.SetArmorAllowed(building->GetPos(), !building->IsArmorAllowedVirtual())) + if(gcFactory.SetArmorAllowed(building->getPos(), !building->isArmorAllowedVirtual())) { building->ToggleArmorVirtual(); - GetCtrl(ctrl_id)->SetImage(LOADER.GetImageN( - "leather_bobs", leatheraddon::bobIndex[building->IsArmorAllowedVirtual() ? + getCtrl(ctrl_id)->setImage(LOADER.getImageN( + "leather_bobs", leatheraddon::bobIndex[building->isArmorAllowedVirtual() ? leatheraddon::BobType::ArmorDeliverIcon : leatheraddon::BobType::DisableDeliveryArmorIcon])); } @@ -338,16 +338,16 @@ void iwMilitaryBuilding::msgButtonClick(const unsigned ctrl_id) if(id % 4 == 3) { const unsigned rank = (id - 3) / 4; - const unsigned count = building->GetTroopLimit(rank); - if(count < building->GetMaxTroopsCt()) - gcFactory.SetTroopLimit(building->GetPos(), rank, count + 1); + const unsigned count = building->getTroopLimit(rank); + if(count < building->getMaxTroopsCt()) + gcFactory.SetTroopLimit(building->getPos(), rank, count + 1); } else { RTTR_Assert(id % 4 == 0); const unsigned rank = id / 4; - const unsigned count = building->GetTroopLimit(rank); + const unsigned count = building->getTroopLimit(rank); if(count > 0) - gcFactory.SetTroopLimit(building->GetPos(), rank, count - 1); + gcFactory.SetTroopLimit(building->getPos(), rank, count - 1); } } } diff --git a/libs/s25main/ingameWindows/iwMinimap.cpp b/libs/s25main/ingameWindows/iwMinimap.cpp index 4b9caa02e8..cb92bb474d 100644 --- a/libs/s25main/ingameWindows/iwMinimap.cpp +++ b/libs/s25main/ingameWindows/iwMinimap.cpp @@ -27,7 +27,7 @@ const unsigned short BUTTON_WINDOW_SPACE = 5; iwMinimap::iwMinimap(IngameMinimap& minimap, GameWorldView& gwv) : IngameWindow(CGI_MINIMAP, IngameWindow::posLastOrCenter, MINIMAP_SIZE, _("Outline map"), - LOADER.GetImageN("resource", 41)), + LOADER.getImageN("resource", 41)), extended(SETTINGS.ingame.minimapExtended) { AddCtrl(std::make_unique(this, 0, DrawPoint(contentOffset), Extent::all(WINDOW_MAP_SPACE), @@ -37,12 +37,12 @@ iwMinimap::iwMinimap(IngameMinimap& minimap, GameWorldView& gwv) DrawPoint curPos(contentOffset.x + WINDOW_MAP_SPACE, 0); for(unsigned i = 0; i < 3; ++i) { - AddImageButton(i + 1, curPos, BUTTON_SIZE, TextureColor::Grey, LOADER.GetImageN("io", 85 + i)); + AddImageButton(i + 1, curPos, BUTTON_SIZE, TextureColor::Grey, LOADER.getImageN("io", 85 + i)); curPos.x += BUTTON_SIZE.x; } // Fenster vergrößern/verkleinern - AddImageButton(4, DrawPoint(0, 0), BUTTON_SIZE, TextureColor::Grey, LOADER.GetImageN("io", 109)); + AddImageButton(4, DrawPoint(0, 0), BUTTON_SIZE, TextureColor::Grey, LOADER.getImageN("io", 109)); Resize(extended ? MINIMAP_SIZE_BIG : MINIMAP_SIZE); } @@ -51,7 +51,7 @@ iwMinimap::iwMinimap(IngameMinimap& minimap, GameWorldView& gwv) void iwMinimap::Resize(const Extent& newSize) { IngameWindow::Resize(newSize); - auto* im = GetCtrl(0); + auto* im = getCtrl(0); im->Resize(newSize - contentOffset - contentOffsetEnd); @@ -59,32 +59,32 @@ void iwMinimap::Resize(const Extent& newSize) im->RemoveBoundingBox(Extent(BUTTON_SIZE.x * 4 + WINDOW_MAP_SPACE * 2, 0)); // Fensterbreite anpassen - SetIwSize(im->GetSize() + Extent(0, WINDOW_MAP_SPACE + BUTTON_MAP_SPACE + BUTTON_SIZE.y + BUTTON_WINDOW_SPACE)); + setIwSize(im->getSize() + Extent(0, WINDOW_MAP_SPACE + BUTTON_MAP_SPACE + BUTTON_SIZE.y + BUTTON_WINDOW_SPACE)); // Buttonpositionen anpassen, nach unten verschieben for(unsigned i = 1; i < 4; ++i) { - auto* ctrl = GetCtrl(i); - DrawPoint ctrlPos = ctrl->GetPos(); - ctrlPos.y = GetRightBottomBoundary().y - BUTTON_SIZE.y - BUTTON_WINDOW_SPACE; - ctrl->SetPos(ctrlPos); + auto* ctrl = getCtrl(i); + DrawPoint ctrlPos = ctrl->getPos(); + ctrlPos.y = getRightBottomBoundary().y - BUTTON_SIZE.y - BUTTON_WINDOW_SPACE; + ctrl->setPos(ctrlPos); } // Vergrößern/Verkleinern-Button nach unten rechts verschieben - GetCtrl(4)->SetPos(GetRightBottomBoundary() - BUTTON_SIZE + getCtrl(4)->setPos(getRightBottomBoundary() - BUTTON_SIZE - DrawPoint(WINDOW_MAP_SPACE, BUTTON_WINDOW_SPACE)); // Bild vom Vergrößern/Verkleinern-Button anpassen - GetCtrl(4)->SetImage(LOADER.GetTextureN("io", extended ? 108 : 109)); + getCtrl(4)->setImage(LOADER.getTextureN("io", extended ? 108 : 109)); } void iwMinimap::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { - case 1: GetCtrl(0)->ToggleTerritory(); break; - case 2: GetCtrl(0)->ToggleHouses(); break; - case 3: GetCtrl(0)->ToggleRoads(); break; + case 1: getCtrl(0)->ToggleTerritory(); break; + case 2: getCtrl(0)->ToggleHouses(); break; + case 3: getCtrl(0)->ToggleRoads(); break; case 4: { // Fenster vergrößern/verkleinern diff --git a/libs/s25main/ingameWindows/iwMissionStatement.cpp b/libs/s25main/ingameWindows/iwMissionStatement.cpp index 91db5d548f..1992d7c4f9 100644 --- a/libs/s25main/ingameWindows/iwMissionStatement.cpp +++ b/libs/s25main/ingameWindows/iwMissionStatement.cpp @@ -12,11 +12,11 @@ iwMissionStatement::iwMissionStatement(const std::string& title, const std::string& content, bool pauseGame, HelpImage image) : IngameWindow(CGI_MISSION_STATEMENT, IngameWindow::posLastOrCenter, Extent(640, 480), title, - LOADER.GetImageN("io", 5), true, CloseBehavior::Custom), - pauseGame_(pauseGame && !GAMECLIENT.IsReplayModeOn()) + LOADER.getImageN("io", 5), true, CloseBehavior::Custom), + pauseGame_(pauseGame && !GAMECLIENT.isReplayModeOn()) { - glArchivItem_Bitmap* img = (image == IM_NONE) ? nullptr : LOADER.GetImageN("io", image); - const Extent imgSize(img ? img->GetSize() : Extent::all(0)); + glArchivItem_Bitmap* img = (image == IM_NONE) ? nullptr : LOADER.getImageN("io", image); + const Extent imgSize(img ? img->getSize() : Extent::all(0)); const unsigned minImgSpaceTop = img ? 60u : 0u; const unsigned imgSpaceRight = img ? 20u : 0u; const unsigned imgSpaceLeft = img ? 10u : 0u; @@ -25,40 +25,40 @@ iwMissionStatement::iwMissionStatement(const std::string& title, const std::stri const unsigned buttonSpace = 12u; const Extent buttonSize(100, 22); - const unsigned short maxTextWidth = GetIwSize().x - imgSize.x - textSpace - imgSpace; + const unsigned short maxTextWidth = getIwSize().x - imgSize.x - textSpace - imgSpace; ctrlMultiline* text = AddMultiline(0, contentOffset + DrawPoint::all(textSpace), - Extent(maxTextWidth, GetIwSize().y), TextureColor::Green2, NormalFont); + Extent(maxTextWidth, getIwSize().y), TextureColor::Green2, NormalFont); text->ShowBackground(false); text->AddString(content, COLOR_YELLOW, false); - text->Resize(text->GetContentSize()); + text->Resize(text->getContentSize()); // set window width to our determined max width - Extent newIwSize = text->GetSize() + Extent::all(textSpace) + Extent(imgSize.x + imgSpace, buttonSize.y + 2); + Extent newIwSize = text->getSize() + Extent::all(textSpace) + Extent(imgSize.x + imgSpace, buttonSize.y + 2); newIwSize = elMax(newIwSize, buttonSize); newIwSize.y = std::max(newIwSize.y, imgSize.y + minImgSpaceTop) + buttonSpace; - SetIwSize(newIwSize); + setIwSize(newIwSize); AddTextButton(1, - DrawPoint((GetSize().x - buttonSize.x) / 2, GetRightBottomBoundary().y - buttonSpace - buttonSize.y), + DrawPoint((getSize().x - buttonSize.x) / 2, getRightBottomBoundary().y - buttonSpace - buttonSize.y), buttonSize, TextureColor::Grey, _("Continue"), NormalFont); if(img) { DrawPoint imgPos = - GetRightBottomBoundary() + img->GetOrigin() - DrawPoint(imgSize) - DrawPoint(imgSpaceRight, buttonSpace); + getRightBottomBoundary() + img->getOrigin() - DrawPoint(imgSize) - DrawPoint(imgSpaceRight, buttonSpace); AddImage(2, imgPos, img); } } void iwMissionStatement::msgButtonClick(const unsigned /*ctrl_id*/) { - if(pauseGame_ && GAMECLIENT.GetState() != ClientState::Stopped) - GAMECLIENT.SetPause(false); + if(pauseGame_ && GAMECLIENT.getState() != ClientState::Stopped) + GAMECLIENT.setPause(false); Close(); } -void iwMissionStatement::SetActive(bool activate) +void iwMissionStatement::setActive(bool activate) { - IngameWindow::SetActive(activate); - if(IsActive() && pauseGame_ && GAMECLIENT.GetState() != ClientState::Stopped) - GAMECLIENT.SetPause(true); + IngameWindow::setActive(activate); + if(IsActive() && pauseGame_ && GAMECLIENT.getState() != ClientState::Stopped) + GAMECLIENT.setPause(true); } diff --git a/libs/s25main/ingameWindows/iwMissionStatement.h b/libs/s25main/ingameWindows/iwMissionStatement.h index db08a407ec..08fde880ad 100644 --- a/libs/s25main/ingameWindows/iwMissionStatement.h +++ b/libs/s25main/ingameWindows/iwMissionStatement.h @@ -39,7 +39,7 @@ class iwMissionStatement : public IngameWindow iwMissionStatement(const std::string& title, const std::string& content, bool pauseGame, HelpImage image = IM_SWORDSMAN); void msgButtonClick(unsigned ctrl_id) override; - void SetActive(bool activate) override; + void setActive(bool activate) override; private: bool pauseGame_; diff --git a/libs/s25main/ingameWindows/iwMsgbox.cpp b/libs/s25main/ingameWindows/iwMsgbox.cpp index 3458c64a30..95a472b016 100644 --- a/libs/s25main/ingameWindows/iwMsgbox.cpp +++ b/libs/s25main/ingameWindows/iwMsgbox.cpp @@ -33,7 +33,7 @@ iwMsgbox::iwMsgbox(const std::string& title, const std::string& text, Window* ms iwMsgbox::iwMsgbox(const std::string& title, const std::string& text, Window* msgHandler, MsgboxButton button, const ResourceId& iconFile, unsigned iconIdx, unsigned msgboxid /* = 0 */) - : IngameWindow(CGI_MSGBOX, IngameWindow::posLastOrCenter, Extent(420, 140), title, LOADER.GetImageN("resource", 41), + : IngameWindow(CGI_MSGBOX, IngameWindow::posLastOrCenter, Extent(420, 140), title, LOADER.getImageN("resource", 41), true, CloseBehavior::Custom), button(button), msgboxid(msgboxid), msgHandler_(msgHandler) { @@ -42,72 +42,72 @@ iwMsgbox::iwMsgbox(const std::string& title, const std::string& text, Window* ms void iwMsgbox::Init(const std::string& text, const ResourceId& iconFile, unsigned iconIdx) { - glArchivItem_Bitmap* icon = LOADER.GetImageN(iconFile, iconIdx); + glArchivItem_Bitmap* icon = LOADER.getImageN(iconFile, iconIdx); if(icon) AddImage(ID_ICON, contentOffset + DrawPoint(30, 20), icon); - int textX = icon ? icon->getWidth() - icon->getNx() + GetCtrl(ID_ICON)->GetPos().x : contentOffset.x; + int textX = icon ? icon->getWidth() - icon->getNx() + getCtrl(ID_ICON)->getPos().x : contentOffset.x; textX += paddingX; - Extent txtSize = Extent(std::max(minTextWidth, GetRightBottomBoundary().x - textX - paddingX), maxTextHeight); + Extent txtSize = Extent(std::max(minTextWidth, getRightBottomBoundary().x - textX - paddingX), maxTextHeight); ctrlMultiline* multiline = AddMultiline(ID_TEXT, DrawPoint(textX, contentOffset.y + 5), txtSize, TextureColor::Green2, NormalFont); multiline->ShowBackground(false); multiline->AddString(text, COLOR_YELLOW); - multiline->Resize(multiline->GetContentSize()); + multiline->Resize(multiline->getContentSize()); // 10 padding, button/button padding - Extent newIwSize(multiline->GetPos() + multiline->GetSize() + Extent(paddingX, 10 + btSize.y * 2)); + Extent newIwSize(multiline->getPos() + multiline->getSize() + Extent(paddingX, 10 + btSize.y * 2)); // Increase window size if required - SetIwSize(elMax(GetIwSize(), newIwSize)); + setIwSize(elMax(getIwSize(), newIwSize)); unsigned defaultBt = 0; // Buttons erstellen switch(button) { case MsgboxButton::Ok: - AddButton(ID_BT_0, GetSize().x / 2 - 45, _("OK"), TextureColor::Green2); + AddButton(ID_BT_0, getSize().x / 2 - 45, _("OK"), TextureColor::Green2); defaultBt = 0; break; case MsgboxButton::OkCancel: - AddButton(ID_BT_0, GetSize().x / 2 - 3 - 90, _("OK"), TextureColor::Green2); - AddButton(ID_BT_0 + 1, GetSize().x / 2 + 3, _("Cancel"), TextureColor::Red1); + AddButton(ID_BT_0, getSize().x / 2 - 3 - 90, _("OK"), TextureColor::Green2); + AddButton(ID_BT_0 + 1, getSize().x / 2 + 3, _("Cancel"), TextureColor::Red1); defaultBt = 1; break; case MsgboxButton::YesNo: - AddButton(ID_BT_0, GetSize().x / 2 - 3 - 90, _("Yes"), TextureColor::Green2); - AddButton(ID_BT_0 + 1, GetSize().x / 2 + 3, _("No"), TextureColor::Red1); + AddButton(ID_BT_0, getSize().x / 2 - 3 - 90, _("Yes"), TextureColor::Green2); + AddButton(ID_BT_0 + 1, getSize().x / 2 + 3, _("No"), TextureColor::Red1); defaultBt = 1; break; case MsgboxButton::YesNoCancel: - AddButton(ID_BT_0, GetSize().x / 2 - 45 - 6 - 90, _("Yes"), TextureColor::Green2); - AddButton(ID_BT_0 + 1, GetSize().x / 2 - 45, _("No"), TextureColor::Red1); - AddButton(ID_BT_0 + 2, GetSize().x / 2 + 45 + 6, _("Cancel"), TextureColor::Grey); + AddButton(ID_BT_0, getSize().x / 2 - 45 - 6 - 90, _("Yes"), TextureColor::Green2); + AddButton(ID_BT_0 + 1, getSize().x / 2 - 45, _("No"), TextureColor::Red1); + AddButton(ID_BT_0 + 2, getSize().x / 2 + 45 + 6, _("Cancel"), TextureColor::Grey); defaultBt = 2; break; } - const Window* defBt = GetCtrl(defaultBt + ID_BT_0); + const Window* defBt = getCtrl(defaultBt + ID_BT_0); if(defBt) - VIDEODRIVER.SetMousePos(defBt->GetDrawPos() + DrawPoint(defBt->GetSize()) / 2); - WINDOWMANAGER.SetCursor(); + VIDEODRIVER.setMousePos(defBt->getDrawPos() + DrawPoint(defBt->getSize()) / 2); + WINDOWMANAGER.setCursor(); } iwMsgbox::~iwMsgbox() = default; void iwMsgbox::MoveIcon(const DrawPoint& pos) { - auto* icon = GetCtrl(ID_ICON); + auto* icon = getCtrl(ID_ICON); if(icon) { - icon->SetPos(elMax(pos, DrawPoint(0, 0))); - const ITexture* iconImg = icon->GetImage(); - DrawPoint iconPos(icon->GetPos() - iconImg->GetOrigin()); + icon->setPos(elMax(pos, DrawPoint(0, 0))); + const ITexture* iconImg = icon->getImage(); + DrawPoint iconPos(icon->getPos() - iconImg->getOrigin()); DrawPoint textPos = contentOffset + DrawPoint(paddingX, 5); Extent textMaxSize; if(iconPos.x < 100) { // icon left - textPos.x = iconPos.x + iconImg->GetSize().x + paddingX; + textPos.x = iconPos.x + iconImg->getSize().x + paddingX; textMaxSize.x = std::max(minTextWidth, 400 - textPos.x - paddingX); textMaxSize.y = maxTextHeight; } else if(iconPos.x > 300) @@ -115,10 +115,10 @@ void iwMsgbox::MoveIcon(const DrawPoint& pos) // icon right textMaxSize.x = iconPos.x - 2 * paddingX; textMaxSize.y = maxTextHeight; - } else if(iconPos.y + iconImg->GetSize().y < 50) + } else if(iconPos.y + iconImg->getSize().y < 50) { // icon top - textPos.y = iconPos.y + iconImg->GetSize().x + paddingX; + textPos.y = iconPos.y + iconImg->getSize().x + paddingX; textMaxSize.x = 400 - 2 * paddingX; textMaxSize.y = maxTextHeight; } else if(iconPos.y > 150) @@ -132,21 +132,21 @@ void iwMsgbox::MoveIcon(const DrawPoint& pos) textMaxSize.x = 400 - 2 * paddingX; textMaxSize.y = maxTextHeight; } - auto* multiline = GetCtrl(ID_TEXT); - multiline->SetPos(textPos); + auto* multiline = getCtrl(ID_TEXT); + multiline->setPos(textPos); multiline->Resize(textMaxSize); - multiline->Resize(multiline->GetContentSize()); + multiline->Resize(multiline->getContentSize()); - DrawPoint newSize = iconPos + DrawPoint(iconImg->GetSize()); - newSize = elMax(newSize, multiline->GetPos() + DrawPoint(multiline->GetSize()) + DrawPoint::all(paddingX)); + DrawPoint newSize = iconPos + DrawPoint(iconImg->getSize()); + newSize = elMax(newSize, multiline->getPos() + DrawPoint(multiline->getSize()) + DrawPoint::all(paddingX)); newSize += DrawPoint(0, 10 + btSize.y * 2) + DrawPoint(contentOffsetEnd); - DrawPoint btMoveDelta(newSize - GetSize()); + DrawPoint btMoveDelta(newSize - getSize()); btMoveDelta.x /= 2; for(unsigned i = 0; i < 3; i++) { - auto* bt = GetCtrl(i + ID_BT_0); + auto* bt = getCtrl(i + ID_BT_0); if(bt) - bt->SetPos(bt->GetPos() + btMoveDelta); + bt->setPos(bt->getPos() + btMoveDelta); } Resize(Extent(newSize)); } @@ -167,5 +167,5 @@ void iwMsgbox::msgButtonClick(const unsigned ctrl_id) void iwMsgbox::AddButton(unsigned short id, int x, const std::string& text, const TextureColor tc) { - AddTextButton(id, DrawPoint(x, GetRightBottomBoundary().y - btSize.y * 2), btSize, tc, text, NormalFont); + AddTextButton(id, DrawPoint(x, getRightBottomBoundary().y - btSize.y * 2), btSize, tc, text, NormalFont); } diff --git a/libs/s25main/ingameWindows/iwMusicPlayer.cpp b/libs/s25main/ingameWindows/iwMusicPlayer.cpp index 992a650dda..87ee821b13 100644 --- a/libs/s25main/ingameWindows/iwMusicPlayer.cpp +++ b/libs/s25main/ingameWindows/iwMusicPlayer.cpp @@ -56,11 +56,11 @@ enum } iwMusicPlayer::InputWindow::InputWindow(iwMusicPlayer& playerWnd, const unsigned win_id, const std::string& title) - : IngameWindow(CGI_INPUTWINDOW, IngameWindow::posCenter, Extent(300, 100), title, LOADER.GetImageN("resource", 41), + : IngameWindow(CGI_INPUTWINDOW, IngameWindow::posCenter, Extent(300, 100), title, LOADER.getImageN("resource", 41), true), win_id(win_id), playerWnd_(playerWnd) { - AddEdit(ID_edtName, DrawPoint(20, 30), Extent(GetSize().x - 40, 22), TextureColor::Green2, NormalFont)->SetFocus(); + AddEdit(ID_edtName, DrawPoint(20, 30), Extent(getSize().x - 40, 22), TextureColor::Green2, NormalFont)->setFocus(); AddTextButton(ID_btOk, DrawPoint(20, 60), Extent(100, 22), TextureColor::Green1, _("OK"), NormalFont); AddTextButton(ID_btAbort, DrawPoint(130, 60), Extent(100, 22), TextureColor::Red1, _("Abort"), NormalFont); } @@ -68,7 +68,7 @@ iwMusicPlayer::InputWindow::InputWindow(iwMusicPlayer& playerWnd, const unsigned void iwMusicPlayer::InputWindow::msgButtonClick(const unsigned ctrl_id) { if(ctrl_id == ID_btOk) - playerWnd_.msgInput(win_id, GetCtrl(ID_edtName)->GetText()); + playerWnd_.msgInput(win_id, getCtrl(ID_edtName)->getText()); Close(); } @@ -80,7 +80,7 @@ void iwMusicPlayer::InputWindow::msgEditEnter(const unsigned /*ctrl_id*/) iwMusicPlayer::iwMusicPlayer() : IngameWindow(CGI_MUSICPLAYER, IngameWindow::posLastOrCenter, Extent(440, 330), _("Music player"), - LOADER.GetImageN("resource", 41)), + LOADER.getImageN("resource", 41)), changed(false) { AddList(ID_lstSongs, DrawPoint(20, 30), Extent(330, 200), TextureColor::Green1, NormalFont); @@ -92,38 +92,38 @@ iwMusicPlayer::iwMusicPlayer() const Extent buttonSize((330 - button_distance) / 2, 22); ctrlButton* b1 = AddTextButton(ID_btAddPlaylist, DrawPoint(20, 288), buttonSize, TextureColor::Green2, _("Add"), NormalFont); - AddTextButton(ID_btRemovePlaylist, b1->GetPos() + DrawPoint(buttonSize.x + button_distance, 0), buttonSize, + AddTextButton(ID_btRemovePlaylist, b1->getPos() + DrawPoint(buttonSize.x + button_distance, 0), buttonSize, TextureColor::Green2, _("Remove"), NormalFont); // Track buttons - AddImageButton(ID_btAddTrack, DrawPoint(360, 30), Extent(30, 40), TextureColor::Grey, LOADER.GetImageN("io", 138), + AddImageButton(ID_btAddTrack, DrawPoint(360, 30), Extent(30, 40), TextureColor::Grey, LOADER.getImageN("io", 138), _("Add track")); AddImageButton(ID_btAddTrackDir, DrawPoint(390, 30), Extent(30, 40), TextureColor::Grey, - LOADER.GetImageN("io_new", 2), _("Add directory of tracks")); + LOADER.getImageN("io_new", 2), _("Add directory of tracks")); AddImageButton(ID_btRemoveTrack, DrawPoint(370, 80), Extent(40, 40), TextureColor::Red1, - LOADER.GetImageN("io", 220), _("Remove track")); - AddImageButton(ID_btUp, DrawPoint(370, 130), Extent(40, 15), TextureColor::Grey, LOADER.GetImageN("io", 33), + LOADER.getImageN("io", 220), _("Remove track")); + AddImageButton(ID_btUp, DrawPoint(370, 130), Extent(40, 15), TextureColor::Grey, LOADER.getImageN("io", 33), _("Upwards")); - AddImageButton(ID_btDown, DrawPoint(370, 145), Extent(40, 15), TextureColor::Grey, LOADER.GetImageN("io", 34), + AddImageButton(ID_btDown, DrawPoint(370, 145), Extent(40, 15), TextureColor::Grey, LOADER.getImageN("io", 34), _("Downwards")); AddTextDeepening(ID_txtRepeat, DrawPoint(370, 170), Extent(40, 20), TextureColor::Grey, "1", NormalFont, COLOR_YELLOW); - AddImageButton(ID_btDecRepeat, DrawPoint(370, 190), Extent(20, 20), TextureColor::Red1, LOADER.GetImageN("io", 139), + AddImageButton(ID_btDecRepeat, DrawPoint(370, 190), Extent(20, 20), TextureColor::Red1, LOADER.getImageN("io", 139), _("Less repeats")); - AddImageButton(ID_btIncRepeat, DrawPoint(390, 190), Extent(20, 20), TextureColor::Grey, LOADER.GetImageN("io", 138), + AddImageButton(ID_btIncRepeat, DrawPoint(390, 190), Extent(20, 20), TextureColor::Grey, LOADER.getImageN("io", 138), _("More repeats")); - AddImageButton(ID_btRandom, DrawPoint(370, 220), Extent(40, 40), TextureColor::Grey, LOADER.GetImageN("io", 107), + AddImageButton(ID_btRandom, DrawPoint(370, 220), Extent(40, 40), TextureColor::Grey, LOADER.getImageN("io", 107), _("Playback in this order")); - AddImageButton(ID_btSave, DrawPoint(370, 270), Extent(40, 40), TextureColor::Grey, LOADER.GetImageN("io", 37), + AddImageButton(ID_btSave, DrawPoint(370, 270), Extent(40, 40), TextureColor::Grey, LOADER.getImageN("io", 37), _("Save playlist")); // Fill values for current playlist - UpdateFromPlaylist(MUSICPLAYER.GetPlaylist()); + UpdateFromPlaylist(MUSICPLAYER.getPlaylist()); UpdatePlaylistCombo(SETTINGS.sound.playlist); - auto* cbPlayList = GetCtrl(ID_cbPlaylist); - if(!cbPlayList->GetSelection() && cbPlayList->GetNumItems() > 0u) + auto* cbPlayList = getCtrl(ID_cbPlaylist); + if(!cbPlayList->getSelection() && cbPlayList->getNumItems() > 0u) { - cbPlayList->SetSelection(0u); + cbPlayList->setSelection(0u); msgComboSelectItem(ID_cbPlaylist, 0u); } } @@ -140,18 +140,18 @@ void iwMusicPlayer::Close() if(SaveCurrentPlaylist()) { - const auto& selection = GetCtrl(ID_cbPlaylist)->GetSelection(); + const auto& selection = getCtrl(ID_cbPlaylist)->getSelection(); if(selection) { SETTINGS.sound.playlist = - GetFullPlaylistPath(GetCtrl(ID_cbPlaylist)->GetText(*selection)).string(); + getFullPlaylistPath(getCtrl(ID_cbPlaylist)->getText(*selection)).string(); } } // Update the player if anything has changed if(changed) { - MUSICPLAYER.SetPlaylist(MakePlaylist()); + MUSICPLAYER.setPlaylist(MakePlaylist()); MUSICPLAYER.Play(); changed = false; } @@ -161,8 +161,8 @@ void iwMusicPlayer::msgComboSelectItem(const unsigned ctrl_id, const unsigned se { RTTR_Assert(ctrl_id == ID_cbPlaylist); Playlist pl; - const std::string playlistName = GetCtrl(ID_cbPlaylist)->GetText(selection); - if(pl.Load(LOG, GetFullPlaylistPath(playlistName))) + const std::string playlistName = getCtrl(ID_cbPlaylist)->getText(selection); + if(pl.Load(LOG, getFullPlaylistPath(playlistName))) { UpdateFromPlaylist(pl); changed = true; @@ -178,15 +178,15 @@ void iwMusicPlayer::msgListChooseItem(const unsigned /*ctrl_id*/, const unsigned { // (Re)create playlist with selected song as start song set in musicplayer Playlist pl = MakePlaylist(); - pl.SetStartSong(selection); - MUSICPLAYER.SetPlaylist(std::move(pl)); + pl.setStartSong(selection); + MUSICPLAYER.setPlaylist(std::move(pl)); MUSICPLAYER.Play(); // No changes anymore changed = false; } -boost::filesystem::path iwMusicPlayer::GetFullPlaylistPath(const std::string& name) +boost::filesystem::path iwMusicPlayer::getFullPlaylistPath(const std::string& name) { const boost::filesystem::path folder = RTTRCONFIG.ExpandPath(isReadonlyPlaylist(name) ? s25::folders::music : s25::folders::playlists); @@ -195,13 +195,13 @@ boost::filesystem::path iwMusicPlayer::GetFullPlaylistPath(const std::string& na bool iwMusicPlayer::SaveCurrentPlaylist() { - const auto playlistName = GetCtrl(ID_cbPlaylist)->GetSelectedText(); + const auto playlistName = getCtrl(ID_cbPlaylist)->getSelectedText(); if(!playlistName) return false; const Playlist pl = MakePlaylist(); - const auto fullPlaylistPath = GetFullPlaylistPath(*playlistName); + const auto fullPlaylistPath = getFullPlaylistPath(*playlistName); if(isReadonlyPlaylist(*playlistName)) return false; @@ -211,7 +211,7 @@ bool iwMusicPlayer::SaveCurrentPlaylist() void iwMusicPlayer::UpdateFromPlaylist(const Playlist& playlist) { - auto* lstSongs = GetCtrl(ID_lstSongs); + auto* lstSongs = getCtrl(ID_lstSongs); lstSongs->DeleteAllItems(); for(const auto& song : playlist.getSongs()) @@ -220,36 +220,36 @@ void iwMusicPlayer::UpdateFromPlaylist(const Playlist& playlist) const auto& currentSong = playlist.getCurrentSong(); if(!currentSong.empty()) { - for(const auto i : helpers::range(lstSongs->GetNumLines())) + for(const auto i : helpers::range(lstSongs->getNumLines())) { - if(currentSong == lstSongs->GetItemText(i)) + if(currentSong == lstSongs->getItemText(i)) { - lstSongs->SetSelection(i); + lstSongs->setSelection(i); break; } } } - SetRepeats(playlist.getNumRepeats()); - SetRandomPlayback(playlist.isRandomized()); + setRepeats(playlist.getNumRepeats()); + setRandomPlayback(playlist.isRandomized()); } void iwMusicPlayer::UpdateSaveChangeButtonsState() { - const auto playlistName = GetCtrl(ID_cbPlaylist)->GetSelectedText(); + const auto playlistName = getCtrl(ID_cbPlaylist)->getSelectedText(); const bool isReadOnly = !playlistName || isReadonlyPlaylist(*playlistName); for(const auto id : {ID_btRemovePlaylist, ID_btSave}) - GetCtrl(id)->SetEnabled(!isReadOnly); + getCtrl(id)->setEnabled(!isReadOnly); } Playlist iwMusicPlayer::MakePlaylist() { - const auto* lstSongs = GetCtrl(ID_lstSongs); + const auto* lstSongs = getCtrl(ID_lstSongs); std::vector songs; - for(const auto i : helpers::range(lstSongs->GetNumLines())) - songs.push_back(lstSongs->GetItemText(i)); + for(const auto i : helpers::range(lstSongs->getNumLines())) + songs.push_back(lstSongs->getItemText(i)); - return Playlist(std::move(songs), GetRepeats(), GetRandomPlayback()); + return Playlist(std::move(songs), getRepeats(), getRandomPlayback()); } void iwMusicPlayer::msgButtonClick(const unsigned ctrl_id) @@ -261,7 +261,7 @@ void iwMusicPlayer::msgButtonClick(const unsigned ctrl_id) break; case ID_btRemovePlaylist: { - const auto& playlistName = GetCtrl(ID_cbPlaylist)->GetSelectedText(); + const auto& playlistName = getCtrl(ID_cbPlaylist)->getSelectedText(); if(playlistName) { // RTTR-playlists must not be deleted @@ -274,7 +274,7 @@ void iwMusicPlayer::msgButtonClick(const unsigned ctrl_id) } boost::system::error_code ec; - boost::filesystem::remove(GetFullPlaylistPath(*playlistName), ec); + boost::filesystem::remove(getFullPlaylistPath(*playlistName), ec); SETTINGS.sound.playlist = RTTRCONFIG.ExpandPath(s25::files::defaultPlaylist).string(); UpdatePlaylistCombo(SETTINGS.sound.playlist); } @@ -291,48 +291,48 @@ void iwMusicPlayer::msgButtonClick(const unsigned ctrl_id) break; case ID_btRemoveTrack: { - const auto& selection = GetCtrl(ID_lstSongs)->GetSelection(); + const auto& selection = getCtrl(ID_lstSongs)->getSelection(); if(selection) { - GetCtrl(ID_lstSongs)->Remove(*selection); + getCtrl(ID_lstSongs)->Remove(*selection); changed = true; } } break; case ID_btUp: { - const auto& selection = GetCtrl(ID_lstSongs)->GetSelection(); + const auto& selection = getCtrl(ID_lstSongs)->getSelection(); if(selection && *selection > 0u) - GetCtrl(ID_lstSongs)->Swap(*selection - 1u, *selection); + getCtrl(ID_lstSongs)->Swap(*selection - 1u, *selection); } break; case ID_btDown: { - const auto& selection = GetCtrl(ID_lstSongs)->GetSelection(); + const auto& selection = getCtrl(ID_lstSongs)->getSelection(); - if(selection && *selection < GetCtrl(ID_lstSongs)->GetNumLines() - 1u) - GetCtrl(ID_lstSongs)->Swap(*selection + 1u, *selection); + if(selection && *selection < getCtrl(ID_lstSongs)->getNumLines() - 1u) + getCtrl(ID_lstSongs)->Swap(*selection + 1u, *selection); } break; case ID_btDecRepeat: { - unsigned repeats = GetRepeats(); + unsigned repeats = getRepeats(); if(repeats > 0u) { --repeats; - SetRepeats(repeats); + setRepeats(repeats); changed = true; } } break; case ID_btIncRepeat: - SetRepeats(GetRepeats() + 1); + setRepeats(getRepeats() + 1); changed = true; break; case ID_btRandom: - SetRandomPlayback(!GetRandomPlayback()); + setRandomPlayback(!getRandomPlayback()); changed = true; break; case ID_btSave: @@ -370,7 +370,7 @@ void iwMusicPlayer::msgInput(const unsigned win_id, const std::string& msg) if(valid) { - GetCtrl(ID_lstSongs)->AddItem(msg); + getCtrl(ID_lstSongs)->AddItem(msg); changed = true; } else WINDOWMANAGER.Show(std::make_unique(_("Error"), _("The specified file couldn't be opened!"), @@ -381,7 +381,7 @@ void iwMusicPlayer::msgInput(const unsigned win_id, const std::string& msg) { // Playlist name must start with a letter const auto isLetter = [](const char c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); }; - const boost::filesystem::path fullPlaylistPath = GetFullPlaylistPath(msg); + const boost::filesystem::path fullPlaylistPath = getFullPlaylistPath(msg); if(!msg.empty() && isLetter(msg.front()) && Playlist().SaveAs(fullPlaylistPath)) { UpdatePlaylistCombo(fullPlaylistPath.string()); @@ -398,7 +398,7 @@ void iwMusicPlayer::msgInput(const unsigned win_id, const std::string& msg) std::vector oggFiles = ListDir(msg, "ogg"); for(const auto& oggFile : oggFiles) - GetCtrl(ID_lstSongs)->AddItem(oggFile.string()); + getCtrl(ID_lstSongs)->AddItem(oggFile.string()); changed = true; } @@ -406,32 +406,32 @@ void iwMusicPlayer::msgInput(const unsigned win_id, const std::string& msg) } } -unsigned iwMusicPlayer::GetRepeats() const +unsigned iwMusicPlayer::getRepeats() const { - return boost::lexical_cast(GetCtrl(ID_txtRepeat)->GetText()); + return boost::lexical_cast(getCtrl(ID_txtRepeat)->getText()); } -void iwMusicPlayer::SetRepeats(unsigned repeats) +void iwMusicPlayer::setRepeats(unsigned repeats) { - GetCtrl(ID_txtRepeat)->SetText(helpers::toString(repeats)); + getCtrl(ID_txtRepeat)->setText(helpers::toString(repeats)); } -bool iwMusicPlayer::GetRandomPlayback() const +bool iwMusicPlayer::getRandomPlayback() const { - return GetCtrl(ID_btRandom)->GetImage() != LOADER.GetTextureN("io", 107); + return getCtrl(ID_btRandom)->getImage() != LOADER.getTextureN("io", 107); } -void iwMusicPlayer::SetRandomPlayback(const bool random_playback) +void iwMusicPlayer::setRandomPlayback(const bool random_playback) { - GetCtrl(ID_btRandom) - ->SetImage(random_playback ? LOADER.GetTextureN("io", 225) : LOADER.GetTextureN("io", 107)); - GetCtrl(ID_btRandom) - ->SetTooltip(random_playback ? _("Playback in this order") : _("Random playback")); + getCtrl(ID_btRandom) + ->setImage(random_playback ? LOADER.getTextureN("io", 225) : LOADER.getTextureN("io", 107)); + getCtrl(ID_btRandom) + ->setTooltip(random_playback ? _("Playback in this order") : _("Random playback")); } void iwMusicPlayer::UpdatePlaylistCombo(const std::string& highlight_entry) { - auto* cbPlaylist = GetCtrl(ID_cbPlaylist); + auto* cbPlaylist = getCtrl(ID_cbPlaylist); cbPlaylist->DeleteAllItems(); std::vector playlists = ListDir(RTTRCONFIG.ExpandPath(s25::folders::playlists), "pll"); @@ -444,7 +444,7 @@ void iwMusicPlayer::UpdatePlaylistCombo(const std::string& highlight_entry) // Reduce to pure filename cbPlaylist->AddItem(playlistPath.stem().string()); if(playlistPath == currentPath) - cbPlaylist->SetSelection(i); + cbPlaylist->setSelection(i); ++i; } UpdateSaveChangeButtonsState(); diff --git a/libs/s25main/ingameWindows/iwMusicPlayer.h b/libs/s25main/ingameWindows/iwMusicPlayer.h index 88f279d648..e7a81f4cf4 100644 --- a/libs/s25main/ingameWindows/iwMusicPlayer.h +++ b/libs/s25main/ingameWindows/iwMusicPlayer.h @@ -34,12 +34,12 @@ class iwMusicPlayer final : public IngameWindow private: /// Get the full path to a playlist by its name - static boost::filesystem::path GetFullPlaylistPath(const std::string& name); + static boost::filesystem::path getFullPlaylistPath(const std::string& name); - unsigned GetRepeats() const; - void SetRepeats(unsigned repeats); - bool GetRandomPlayback() const; - void SetRandomPlayback(bool random_playback); + unsigned getRepeats() const; + void setRepeats(unsigned repeats); + bool getRandomPlayback() const; + void setRandomPlayback(bool random_playback); /// Fill combobox with all playlists and selects given entry if present void UpdatePlaylistCombo(const std::string& highlight_entry); diff --git a/libs/s25main/ingameWindows/iwObservate.cpp b/libs/s25main/ingameWindows/iwObservate.cpp index 6c4da67d51..fac3396a38 100644 --- a/libs/s25main/ingameWindows/iwObservate.cpp +++ b/libs/s25main/ingameWindows/iwObservate.cpp @@ -33,27 +33,27 @@ iwObservate::iwObservate(GameWorldView& gwv, const MapPoint selectedPt) : IngameWindow(CGI_OBSERVATION, IngameWindow::posAtMouse, SmallWndSize, _("Observation window"), nullptr, false, CloseBehavior::NoRightClick), parentView(gwv), - view(new GameWorldView(gwv.GetViewer(), Position(GetDrawPos() * DrawPoint(10, 15)), GetSize() - Extent::all(20))), + view(new GameWorldView(gwv.getViewer(), Position(getDrawPos() * DrawPoint(10, 15)), getSize() - Extent::all(20))), selectedPt(selectedPt), lastWindowPos(Point::Invalid()), isScrolling(false), zoomLvl(0), followMovableId(0) { view->MoveToMapPt(selectedPt); - view->SetZoomFactor(1.9f, false); + view->setZoomFactor(1.9f, false); const Extent btSize(36, 36); - DrawPoint btPos(GetSize().x / 2, GetSize().y); + DrawPoint btPos(getSize().x / 2, getSize().y); btPos -= DrawPoint(btSize.x * 2, 50); // Lupe: 36 - AddImageButton(1, btPos, btSize, TextureColor::Grey, LOADER.GetImageN("io", 36), _("Zoom")); + AddImageButton(1, btPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 36), _("Zoom")); // Kamera (Folgen): 43 btPos.x += btSize.x; - AddImageButton(2, btPos, btSize, TextureColor::Grey, LOADER.GetImageN("io", 43), _("Follow object")); + AddImageButton(2, btPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 43), _("Follow object")); // Zum Ort btPos.x += btSize.x; - AddImageButton(3, btPos, btSize, TextureColor::Grey, LOADER.GetImageN("io", 107), _("Go to place")); + AddImageButton(3, btPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 107), _("Go to place")); // Fenster vergroessern/verkleinern btPos.x += btSize.x; - AddImageButton(4, btPos, btSize, TextureColor::Grey, LOADER.GetImageN("io", 109), _("Resize window")); + AddImageButton(4, btPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 109), _("Resize window")); // Synchronize visibility of HUD elements with parentView parentView.CopyHudSettingsTo(*view, false); @@ -73,41 +73,41 @@ void iwObservate::msgButtonClick(const unsigned ctrl_id) if(++zoomLvl > 4) zoomLvl = 0; if(zoomLvl == 0) - view->SetZoomFactor(1.f); + view->setZoomFactor(1.f); else if(zoomLvl == 1) - view->SetZoomFactor(1.3f); + view->setZoomFactor(1.3f); else if(zoomLvl == 2) - view->SetZoomFactor(1.6f); + view->setZoomFactor(1.6f); else if(zoomLvl == 3) - view->SetZoomFactor(1.9f); + view->setZoomFactor(1.9f); else - view->SetZoomFactor(2.3f); + view->setZoomFactor(2.3f); break; case 2: { if(followMovableId) { followMovableId = 0; - GetCtrl(ID_tmrUpdateFollow)->Stop(); + getCtrl(ID_tmrUpdateFollow)->Stop(); } else { - const DrawPoint centerDrawPt = DrawPoint(view->GetSize() / 2u); + const DrawPoint centerDrawPt = DrawPoint(view->getSize() / 2u); double minDistance = std::numeric_limits::max(); - for(int y = view->GetFirstPt().y; y <= view->GetLastPt().y; ++y) + for(int y = view->getFirstPt().y; y <= view->getLastPt().y; ++y) { - for(int x = view->GetFirstPt().x; x <= view->GetLastPt().x; ++x) + for(int x = view->getFirstPt().x; x <= view->getLastPt().x; ++x) { Position curOffset; const MapPoint curPt = - view->GetViewer().GetTerrainRenderer().ConvertCoords(Position(x, y), &curOffset); - DrawPoint curDrawPt = view->GetWorld().GetNodePos(curPt) - view->GetOffset() + curOffset; + view->getViewer().getTerrainRenderer().ConvertCoords(Position(x, y), &curOffset); + DrawPoint curDrawPt = view->getWorld().getNodePos(curPt) - view->getOffset() + curOffset; - if(view->GetViewer().GetVisibility(curPt) != Visibility::Visible) + if(view->getViewer().getVisibility(curPt) != Visibility::Visible) continue; - for(const noBase& obj : view->GetWorld().GetFigures(curPt)) + for(const noBase& obj : view->getWorld().getFigures(curPt)) { const auto* movable = dynamic_cast(&obj); if(!movable) @@ -115,7 +115,7 @@ void iwObservate::msgButtonClick(const unsigned ctrl_id) DrawPoint objDrawPt = curDrawPt; - if(movable->IsMoving()) + if(movable->isMoving()) objDrawPt += movable->CalcWalkingRelative(); DrawPoint diffToCenter = objDrawPt - centerDrawPt; @@ -123,45 +123,45 @@ void iwObservate::msgButtonClick(const unsigned ctrl_id) if(distance < minDistance) { - followMovableId = movable->GetObjId(); + followMovableId = movable->getObjId(); minDistance = distance; } } } } if(followMovableId) - GetCtrl(ID_tmrUpdateFollow)->Start(); + getCtrl(ID_tmrUpdateFollow)->Start(); } break; } case 3: - parentView.MoveToMapPt(MapPoint(view->GetLastPt() - (view->GetLastPt() - view->GetFirstPt()) / 2)); + parentView.MoveToMapPt(MapPoint(view->getLastPt() - (view->getLastPt() - view->getFirstPt()) / 2)); break; case 4: - int diff = GetSize().x; + int diff = getSize().x; - if(GetSize() == SmallWndSize) + if(getSize() == SmallWndSize) { Resize(MediumWndSize); - } else if(GetSize() == MediumWndSize) + } else if(getSize() == MediumWndSize) { Resize(BigWndSize); - GetCtrl(4)->SetImage(LOADER.GetImageN("io", 108)); + getCtrl(4)->setImage(LOADER.getImageN("io", 108)); } else { Resize(SmallWndSize); - GetCtrl(4)->SetImage(LOADER.GetImageN("io", 109)); + getCtrl(4)->setImage(LOADER.getImageN("io", 109)); } - diff -= GetSize().x; + diff -= getSize().x; diff /= 2; - view->Resize(GetSize() - Extent::all(20)); + view->Resize(getSize() - Extent::all(20)); for(unsigned i = 1; i <= 4; ++i) - GetCtrl(i)->SetPos( - DrawPoint(GetCtrl(i)->GetPos().x - diff, GetSize().y - 50)); + getCtrl(i)->setPos( + DrawPoint(getCtrl(i)->getPos().x - diff, getSize().y - 50)); } } @@ -173,7 +173,7 @@ void iwObservate::msgTimer(const unsigned ctrl_id) if(followMovableId && !MoveToFollowedObj()) { followMovableId = 0; - GetCtrl(ID_tmrUpdateFollow)->Stop(); + getCtrl(ID_tmrUpdateFollow)->Stop(); } break; } @@ -181,26 +181,26 @@ void iwObservate::msgTimer(const unsigned ctrl_id) void iwObservate::DrawBackground() { - if(GetPos() != lastWindowPos) + if(getPos() != lastWindowPos) { - view->SetPos(GetPos() + DrawPoint(10, 15)); - lastWindowPos = GetPos(); + view->setPos(getPos() + DrawPoint(10, 15)); + lastWindowPos = getPos(); } RoadBuildState road; road.mode = RoadBuildMode::Disabled; - view->Draw(road, parentView.GetSelectedPt(), false); + view->Draw(road, parentView.getSelectedPt(), false); // Draw indicator for center point if(!followMovableId) - LOADER.GetMapTexture(23)->DrawFull(view->GetPos() + view->GetSize() / 2u); + LOADER.getMapTexture(23)->DrawFull(view->getPos() + view->getSize() / 2u); } bool iwObservate::MoveToFollowedObj() { // First look around the center (figure is normally still there) - const GameWorldBase& world = view->GetWorld(); - const MapPoint centerPt = world.MakeMapPoint((view->GetFirstPt() + view->GetLastPt()) / 2); + const GameWorldBase& world = view->getWorld(); + const MapPoint centerPt = world.MakeMapPoint((view->getFirstPt() + view->getLastPt()) / 2); const std::vector centerPts = world.GetPointsInRadiusWithCenter(centerPt, 2); for(const MapPoint& curPt : centerPts) { @@ -209,9 +209,9 @@ bool iwObservate::MoveToFollowedObj() } // Not at the center (normally due to lags) -> Check full area - for(int y = view->GetFirstPt().y; y <= view->GetLastPt().y; ++y) + for(int y = view->getFirstPt().y; y <= view->getLastPt().y; ++y) { - for(int x = view->GetFirstPt().x; x <= view->GetLastPt().x; ++x) + for(int x = view->getFirstPt().x; x <= view->getLastPt().x; ++x) { const MapPoint curPt = world.MakeMapPoint(Position(x, y)); if(MoveToFollowedObj(curPt)) @@ -223,19 +223,19 @@ bool iwObservate::MoveToFollowedObj() bool iwObservate::MoveToFollowedObj(const MapPoint ptToCheck) { - if(view->GetViewer().GetVisibility(ptToCheck) != Visibility::Visible) + if(view->getViewer().getVisibility(ptToCheck) != Visibility::Visible) return false; - for(const noBase& obj : view->GetWorld().GetFigures(ptToCheck)) + for(const noBase& obj : view->getWorld().getFigures(ptToCheck)) { - if(obj.GetObjId() == followMovableId) + if(obj.getObjId() == followMovableId) { const auto& followMovable = static_cast(obj); - DrawPoint drawPt = view->GetWorld().GetNodePos(ptToCheck); + DrawPoint drawPt = view->getWorld().getNodePos(ptToCheck); - if(followMovable.IsMoving()) + if(followMovable.isMoving()) drawPt += followMovable.CalcWalkingRelative(); - view->MoveTo(drawPt - view->GetSize() / 2u); + view->MoveTo(drawPt - view->getSize() / 2u); return true; } } @@ -252,7 +252,7 @@ bool iwObservate::msgMouseMove(const MouseCoords& mc) acceleration = -acceleration; view->MoveBy((mc.pos - scrollOrigin) * acceleration); - VIDEODRIVER.SetMousePos(scrollOrigin); + VIDEODRIVER.setMousePos(scrollOrigin); return true; } else return IngameWindow::msgMouseMove(mc); @@ -260,17 +260,17 @@ bool iwObservate::msgMouseMove(const MouseCoords& mc) bool iwObservate::msgRightDown(const MouseCoords& mc) { - if(IsPointInRect(mc.pos, Rect(view->GetPos(), view->GetSize())) - && !IsPointInRect(mc.pos, GetCtrl(1)->GetDrawRect()) - && !IsPointInRect(mc.pos, GetCtrl(2)->GetDrawRect()) - && !IsPointInRect(mc.pos, GetCtrl(3)->GetDrawRect()) - && !IsPointInRect(mc.pos, GetCtrl(4)->GetDrawRect())) + if(IsPointInRect(mc.pos, Rect(view->getPos(), view->getSize())) + && !IsPointInRect(mc.pos, getCtrl(1)->getDrawRect()) + && !IsPointInRect(mc.pos, getCtrl(2)->getDrawRect()) + && !IsPointInRect(mc.pos, getCtrl(3)->getDrawRect()) + && !IsPointInRect(mc.pos, getCtrl(4)->getDrawRect())) { scrollOrigin = mc.pos; isScrolling = true; followMovableId = 0; - WINDOWMANAGER.SetCursor(Cursor::Scroll); + WINDOWMANAGER.setCursor(Cursor::Scroll); } else { Close(); @@ -282,7 +282,7 @@ bool iwObservate::msgRightDown(const MouseCoords& mc) bool iwObservate::msgRightUp(const MouseCoords& /*mc*/) { if(isScrolling) - WINDOWMANAGER.SetCursor(Cursor::Hand); + WINDOWMANAGER.setCursor(Cursor::Hand); isScrolling = false; return true; diff --git a/libs/s25main/ingameWindows/iwOptionsWindow.cpp b/libs/s25main/ingameWindows/iwOptionsWindow.cpp index cab7621c11..cb4bd1e20c 100644 --- a/libs/s25main/ingameWindows/iwOptionsWindow.cpp +++ b/libs/s25main/ingameWindows/iwOptionsWindow.cpp @@ -63,36 +63,36 @@ constexpr auto leftMargin = 35; iwOptionsWindow::iwOptionsWindow(SoundManager& soundManager) : IngameWindow(CGI_OPTIONSWINDOW, IngameWindow::posLastOrCenter, windowSize, _("Game menu"), - LOADER.GetImageN("resource", 41)), + LOADER.getImageN("resource", 41)), soundManager(soundManager) { DrawPoint curPos = DrawPoint(centerPosition, 10); // The soldier on top constexpr Offset soldierOffset(0, 26); - AddImage(ID_imgSoldier, curPos + soldierOffset, LOADER.GetImageN("io", 30)); + AddImage(ID_imgSoldier, curPos + soldierOffset, LOADER.getImageN("io", 30)); curPos.y += textSpacing + soldierOffset.y; AddText(ID_txtRttr, curPos, "Return To The Roots", COLOR_YELLOW, FontStyle::CENTER, NormalFont); curPos.y += textSpacing; - AddText(ID_txtVersion, curPos, rttr::version::GetReadableVersion(), COLOR_YELLOW, FontStyle::CENTER, NormalFont); + AddText(ID_txtVersion, curPos, rttr::version::getReadableVersion(), COLOR_YELLOW, FontStyle::CENTER, NormalFont); curPos.y += textSpacing; AddFormattedText(ID_txtCopyright, curPos, "\xC2\xA9" "2005 - %s Settlers Freaks", COLOR_YELLOW, FontStyle::CENTER, NormalFont) - % rttr::version::GetYear(); + % rttr::version::getYear(); curPos.y += textSpacing * 2; curPos.x = leftMargin; - AddImageButton(ID_btKeyboardLayout, curPos, imageButtonSize, TextureColor::Green2, LOADER.GetImageN("io", 79)); + AddImageButton(ID_btKeyboardLayout, curPos, imageButtonSize, TextureColor::Green2, LOADER.getImageN("io", 79)); AddText(ID_txtKeyboardLayout, curPos + textOffset, _("Keyboard layout"), COLOR_YELLOW, FontStyle::BOTTOM, NormalFont); curPos.y += imageButtonSize.y + generalSpacing; - AddImageButton(ID_btReadme, curPos, imageButtonSize, TextureColor::Green2, LOADER.GetImageN("io", 79)); + AddImageButton(ID_btReadme, curPos, imageButtonSize, TextureColor::Green2, LOADER.getImageN("io", 79)); AddText(ID_txtReadme, curPos + textOffset, _("Load 'ReadMe' file"), COLOR_YELLOW, FontStyle::BOTTOM, NormalFont); curPos.y += imageButtonSize.y + generalSpacing; @@ -102,16 +102,16 @@ iwOptionsWindow::iwOptionsWindow(SoundManager& soundManager) // curPos.y += imageButtonSize.y + generalSpacing; curPos.y += 3 + imageButtonSize.y / 2; // TODO: Delete this row, if the Load button is implemented - AddImageButton(ID_btSave, curPos, imageButtonSize, TextureColor::Green2, LOADER.GetImageN("io", 47)); + AddImageButton(ID_btSave, curPos, imageButtonSize, TextureColor::Green2, LOADER.getImageN("io", 47)); AddText(ID_txtSave, curPos + textOffset, _("Save game!"), COLOR_YELLOW, FontStyle::BOTTOM, NormalFont); curPos.y += 3 + imageButtonSize.y / 2; // TODO: Delete this row, if the Load button is implemented curPos.y += imageButtonSize.y + generalSpacing; // Sound on/off + volume AddImageButton(ID_btSoundEffects, curPos, imageButtonSize, TextureColor::Green2, - LOADER.GetImageN("io", 114 + !SETTINGS.sound.effectsEnabled)); //-V807 + LOADER.getImageN("io", 114 + !SETTINGS.sound.effectsEnabled)); //-V807 AddProgress(ID_pgEffectVol, curPos + optionOffset, optionSizeSmall, TextureColor::Green2, 139, 138, 100) - ->SetPosition((SETTINGS.sound.effectsVolume * 100) / 255); + ->setPosition((SETTINGS.sound.effectsVolume * 100) / 255); curPos.y += imageButtonSize.y; curPos.x += optionOffset.x; @@ -122,9 +122,9 @@ iwOptionsWindow::iwOptionsWindow(SoundManager& soundManager) // Music on/off + volume AddImageButton(ID_btMusic, curPos, imageButtonSize, TextureColor::Green2, - LOADER.GetImageN("io", 116 + !SETTINGS.sound.musicEnabled)); + LOADER.getImageN("io", 116 + !SETTINGS.sound.musicEnabled)); AddProgress(ID_pgMusicVol, curPos + optionOffset, optionSizeSmall, TextureColor::Green2, 139, 138, 100) - ->SetPosition((SETTINGS.sound.musicVolume * 100) / 255); + ->setPosition((SETTINGS.sound.musicVolume * 100) / 255); curPos.y += imageButtonSize.y; curPos.x += optionOffset.x; @@ -157,8 +157,8 @@ void iwOptionsWindow::msgButtonClick(const unsigned ctrl_id) case ID_btSoundEffects: SETTINGS.sound.effectsEnabled = !SETTINGS.sound.effectsEnabled; //-V807 - GetCtrl(ID_btSoundEffects) - ->SetImage(LOADER.GetTextureN("io", 114 + !SETTINGS.sound.effectsEnabled)); + getCtrl(ID_btSoundEffects) + ->setImage(LOADER.getTextureN("io", 114 + !SETTINGS.sound.effectsEnabled)); if(!SETTINGS.sound.effectsEnabled) soundManager.stopAll(); @@ -166,8 +166,8 @@ void iwOptionsWindow::msgButtonClick(const unsigned ctrl_id) case ID_btMusic: SETTINGS.sound.musicEnabled = !SETTINGS.sound.musicEnabled; - GetCtrl(ID_btMusic) - ->SetImage(LOADER.GetTextureN("io", 116 + !SETTINGS.sound.musicEnabled)); + getCtrl(ID_btMusic) + ->setImage(LOADER.getTextureN("io", 116 + !SETTINGS.sound.musicEnabled)); if(SETTINGS.sound.musicEnabled) MUSICPLAYER.Play(); else @@ -191,11 +191,11 @@ void iwOptionsWindow::msgProgressChange(const unsigned ctrl_id, const unsigned s { case ID_pgEffectVol: SETTINGS.sound.effectsVolume = static_cast((position * 255) / 100); - AUDIODRIVER.SetMasterEffectVolume(SETTINGS.sound.effectsVolume); + AUDIODRIVER.setMasterEffectVolume(SETTINGS.sound.effectsVolume); break; case ID_pgMusicVol: SETTINGS.sound.musicVolume = static_cast((position * 255) / 100); - AUDIODRIVER.SetMusicVolume(SETTINGS.sound.musicVolume); + AUDIODRIVER.setMusicVolume(SETTINGS.sound.musicVolume); break; } } diff --git a/libs/s25main/ingameWindows/iwPlayReplay.cpp b/libs/s25main/ingameWindows/iwPlayReplay.cpp index 90d2d08c90..4fe3bcb906 100644 --- a/libs/s25main/ingameWindows/iwPlayReplay.cpp +++ b/libs/s25main/ingameWindows/iwPlayReplay.cpp @@ -27,7 +27,7 @@ namespace { class SwitchOnStart : public ClientInterface { public: - SwitchOnStart() { GAMECLIENT.SetInterface(this); } + SwitchOnStart() { GAMECLIENT.setInterface(this); } ~SwitchOnStart() override { GAMECLIENT.RemoveInterface(this); } void CI_GameLoading(std::shared_ptr game) override @@ -44,7 +44,7 @@ std::vector GetReplays() iwPlayReplay::iwPlayReplay() : IngameWindow(CGI_PLAYREPLAY, IngameWindow::posLastOrCenter, Extent(600, 330), _("Play Replay"), - LOADER.GetImageN("resource", 41)) + LOADER.getImageN("resource", 41)) { using SRT = ctrlTable::SortType; AddTable(0, DrawPoint(20, 30), Extent(560, 220), TextureColor::Green2, NormalFont, @@ -64,18 +64,18 @@ iwPlayReplay::iwPlayReplay() PopulateTable(); // Nach Zeit Sortieren - GetCtrl(0)->SortRows(1, TableSortDir::Descending); + getCtrl(0)->SortRows(1, TableSortDir::Descending); } void iwPlayReplay::PopulateTable() { static bool loadedOnce = false; - auto* table = GetCtrl(0); - int sortCol = table->GetSortColumn(); + auto* table = getCtrl(0); + int sortCol = table->getSortColumn(); if(sortCol == -1) sortCol = 0; - const auto sortDir = table->GetSortDirection(); + const auto sortDir = table->getSortDirection(); table->DeleteAllItems(); unsigned numInvalid = 0; @@ -92,18 +92,18 @@ void iwPlayReplay::PopulateTable() if(!loadedOnce) { LOG.write(_("Invalid Replay %1%! Reason: %2%\n")) % path - % (replay.GetLastErrorMsg().empty() ? _("Unknown") : replay.GetLastErrorMsg()); + % (replay.getLastErrorMsg().empty() ? _("Unknown") : replay.getLastErrorMsg()); } numInvalid++; continue; } // Zeitstamp benutzen - std::string dateStr = s25util::Time::FormatTime("%d.%m.%Y - %H:%i", replay.GetSaveTime()); + std::string dateStr = s25util::Time::FormatTime("%d.%m.%Y - %H:%i", replay.getSaveTime()); // Spielernamen auslesen std::string tmp_players; - for(const std::string& playerName : replay.GetPlayerNames()) + for(const std::string& playerName : replay.getPlayerNames()) { if(!tmp_players.empty()) tmp_players += ", "; @@ -115,7 +115,7 @@ void iwPlayReplay::PopulateTable() if(!path.has_filename()) continue; std::string fileName = path.filename().string(); - std::string length = GAMECLIENT.FormatGFTime(replay.GetLastGF()); + std::string length = GAMECLIENT.FormatGFTime(replay.getLastGF()); // Und das Zeug zur Tabelle hinzufügen table->AddRow({fileName, dateStr, tmp_players, length, path.string()}); @@ -124,13 +124,13 @@ void iwPlayReplay::PopulateTable() // Erst einmal nach Dateiname sortieren table->SortRows(sortCol, sortDir); - auto* btDelInvalid = GetCtrl(5); + auto* btDelInvalid = getCtrl(5); if(numInvalid == 0) - btDelInvalid->SetVisible(false); + btDelInvalid->setVisible(false); else { - btDelInvalid->SetVisible(true); - btDelInvalid->SetText((boost::format(_("Delete Invalid (%u)")) % numInvalid).str()); + btDelInvalid->setVisible(true); + btDelInvalid->setText((boost::format(_("Delete Invalid (%u)")) % numInvalid).str()); } loadedOnce = true; } @@ -147,8 +147,8 @@ void iwPlayReplay::msgButtonClick(const unsigned ctrl_id) break; case 3: { - auto* table = GetCtrl(0); - if(table->GetSelection()) + auto* table = getCtrl(0); + if(table->getSelection()) WINDOWMANAGER.Show(std::make_unique(_("Delete selected"), _("Are you sure you want to remove the selected replay?"), this, MsgboxButton::YesNo, MsgboxIcon::QuestionRed, 2)); @@ -171,14 +171,14 @@ void iwPlayReplay::msgTableChooseItem(const unsigned /*ctrl_id*/, const unsigned void iwPlayReplay::StartReplay() { // Mond malen - LOADER.GetImageN("resource", 33)->DrawFull(VIDEODRIVER.GetMousePos() - DrawPoint(0, 40)); + LOADER.getImageN("resource", 33)->DrawFull(VIDEODRIVER.getMousePos() - DrawPoint(0, 40)); VIDEODRIVER.SwapBuffers(); - auto* table = GetCtrl(0); - if(table->GetSelection()) + auto* table = getCtrl(0); + if(table->getSelection()) { SwitchOnStart switchOnStart; - if(!GAMECLIENT.StartReplay(table->GetItemText(*table->GetSelection(), 4))) + if(!GAMECLIENT.StartReplay(table->getItemText(*table->getSelection(), 4))) WINDOWMANAGER.Show(std::make_unique(_("Error while playing replay!"), _("Invalid Replay!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); } @@ -197,7 +197,7 @@ void iwPlayReplay::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult } // Tabelle leeren - GetCtrl(0)->DeleteAllItems(); + getCtrl(0)->DeleteAllItems(); } else if(msgbox_id == 3 && mbr == MsgboxResult::Yes) { const std::vector replays = GetReplays(); @@ -215,11 +215,11 @@ void iwPlayReplay::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult PopulateTable(); } else if(msgbox_id == 2 && mbr == MsgboxResult::Yes) { - auto* table = GetCtrl(0); - if(table->GetSelection()) + auto* table = getCtrl(0); + if(table->getSelection()) { boost::system::error_code ec; - bfs::remove(table->GetItemText(*table->GetSelection(), 4), ec); + bfs::remove(table->getItemText(*table->getSelection(), 4), ec); PopulateTable(); } } diff --git a/libs/s25main/ingameWindows/iwPleaseWait.cpp b/libs/s25main/ingameWindows/iwPleaseWait.cpp index 10c383b3f2..863e66271e 100644 --- a/libs/s25main/ingameWindows/iwPleaseWait.cpp +++ b/libs/s25main/ingameWindows/iwPleaseWait.cpp @@ -16,13 +16,13 @@ */ iwPleaseWait::iwPleaseWait() : IngameWindow(CGI_PLEASEWAIT, IngameWindow::posLastOrCenter, Extent(300, 60), _("Please wait..."), - LOADER.GetImageN("resource", 41), true, CloseBehavior::Custom) + LOADER.getImageN("resource", 41), true, CloseBehavior::Custom) { - WINDOWMANAGER.SetCursor(Cursor::Moon); - AddText(0, GetSize() / 2, _("Please wait..."), COLOR_YELLOW, FontStyle::CENTER | FontStyle::VCENTER, NormalFont); + WINDOWMANAGER.setCursor(Cursor::Moon); + AddText(0, getSize() / 2, _("Please wait..."), COLOR_YELLOW, FontStyle::CENTER | FontStyle::VCENTER, NormalFont); } iwPleaseWait::~iwPleaseWait() { - WINDOWMANAGER.SetCursor(); + WINDOWMANAGER.setCursor(); } diff --git a/libs/s25main/ingameWindows/iwPostWindow.cpp b/libs/s25main/ingameWindows/iwPostWindow.cpp index 22b4cfd040..f020643326 100644 --- a/libs/s25main/ingameWindows/iwPostWindow.cpp +++ b/libs/s25main/ingameWindows/iwPostWindow.cpp @@ -51,58 +51,58 @@ enum ButtonIds iwPostWindow::iwPostWindow(GameWorldView& gwv, PostBox& postBox) : IngameWindow(CGI_POSTOFFICE, IngameWindow::posLastOrCenter, Extent(254, 295), _("Post office"), - LOADER.GetImageN("resource", 41)), + LOADER.getImageN("resource", 41)), gwv(gwv), postBox(postBox), showAll(true), curCategory(PostCategory::General), curMsg(nullptr), lastHasMissionGoal(true) { AddImageButton(ID_SHOW_ALL, DrawPoint(18, 25), Extent(35, 35), TextureColor::Grey, - LOADER.GetImageN("io", 190)); // Viewer: 191 - Papier + LOADER.getImageN("io", 190)); // Viewer: 191 - Papier AddImageButton(ID_SHOW_MIL, DrawPoint(56, 25), Extent(35, 35), TextureColor::Grey, - LOADER.GetImageN("io", 30)); // Viewer: 31 - Soldat + LOADER.getImageN("io", 30)); // Viewer: 31 - Soldat AddImageButton(ID_SHOW_GEO, DrawPoint(91, 25), Extent(35, 35), TextureColor::Grey, - LOADER.GetImageN("io", 20)); // Viewer: 21 - Geologe + LOADER.getImageN("io", 20)); // Viewer: 21 - Geologe AddImageButton(ID_SHOW_ECO, DrawPoint(126, 25), Extent(35, 35), TextureColor::Grey, - LOADER.GetImageN("io", 28)); // Viewer: 29 - Wage + LOADER.getImageN("io", 28)); // Viewer: 29 - Wage AddImageButton(ID_SHOW_GEN, DrawPoint(161, 25), Extent(35, 35), TextureColor::Grey, - LOADER.GetImageN("io", 189)); // Viewer: 190 - Neue Nachricht + LOADER.getImageN("io", 189)); // Viewer: 190 - Neue Nachricht AddImageButton(ID_SHOW_GOAL, DrawPoint(199, 25), Extent(35, 35), TextureColor::Grey, - LOADER.GetImageN("io", 79)); // Viewer: 80 - Notiz - AddImage(0, DrawPoint(126, 151), LOADER.GetImageN("io", 228)); + LOADER.getImageN("io", 79)); // Viewer: 80 - Notiz + AddImage(0, DrawPoint(126, 151), LOADER.getImageN("io", 228)); AddImageButton(ID_HELP, DrawPoint(18, 242), Extent(30, 35), TextureColor::Grey, - LOADER.GetImageN("io", 225)); // Viewer: 226 - Hilfe + LOADER.getImageN("io", 225)); // Viewer: 226 - Hilfe AddImageButton(ID_GO_START, DrawPoint(51, 246), Extent(30, 26), TextureColor::Grey, - LOADER.GetImageN("io", 102)); // Viewer: 103 - Schnell zurück + LOADER.getImageN("io", 102)); // Viewer: 103 - Schnell zurück AddImageButton(ID_GO_BACK, DrawPoint(81, 246), Extent(30, 26), TextureColor::Grey, - LOADER.GetImageN("io", 103)); // Viewer: 104 - Zurück + LOADER.getImageN("io", 103)); // Viewer: 104 - Zurück AddImageButton(ID_GO_FWD, DrawPoint(111, 246), Extent(30, 26), TextureColor::Grey, - LOADER.GetImageN("io", 104)); // Viewer: 105 - Vor + LOADER.getImageN("io", 104)); // Viewer: 105 - Vor AddImageButton(ID_GO_END, DrawPoint(141, 246), Extent(30, 26), TextureColor::Grey, - LOADER.GetImageN("io", 105)); // Viewer: 106 - Schnell vor + LOADER.getImageN("io", 105)); // Viewer: 106 - Schnell vor // Goto, nur sichtbar wenn Nachricht mit Koordinaten da - AddImageButton(ID_GOTO, DrawPoint(181, 246), Extent(30, 26), TextureColor::Grey, LOADER.GetImageN("io", 107)) - ->SetVisible(false); + AddImageButton(ID_GOTO, DrawPoint(181, 246), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 107)) + ->setVisible(false); // Mülleimer, nur sichtbar, wenn Nachricht da - AddImageButton(ID_DELETE, DrawPoint(211, 246), Extent(30, 26), TextureColor::Grey, LOADER.GetImageN("io", 106)) - ->SetVisible(false); + AddImageButton(ID_DELETE, DrawPoint(211, 246), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 106)) + ->setVisible(false); AddText(ID_INFO, DrawPoint(127, 228), "", MakeColor(255, 188, 100, 88), FontStyle::CENTER | FontStyle::BOTTOM, SmallFont) - ->SetVisible(false); + ->setVisible(false); - AddImage(ID_IMG, DrawPoint(127, 155), LOADER.GetImageN("io", 225)); + AddImage(ID_IMG, DrawPoint(127, 155), LOADER.getImageN("io", 225)); // Multiline-Teil mit drei leeren Zeilen erzeugen ctrlMultiline* text = AddMultiline(ID_TEXT, DrawPoint(126, 141), Extent(200, 0), TextureColor::Invisible, NormalFont, FontStyle::CENTER | FontStyle::BOTTOM | FontStyle::NO_OUTLINE); - text->SetNumVisibleLines(4); + text->setNumVisibleLines(4); text->ShowBackground(false); // Button with OK and deny sign (tick and cross) for contracts - AddImageButton(ID_ACCEPT, DrawPoint(87, 185), Extent(30, 26), TextureColor::Green1, LOADER.GetImageN("io", 32)) - ->SetVisible(false); - AddImageButton(ID_DENY, DrawPoint(137, 185), Extent(30, 26), TextureColor::Red1, LOADER.GetImageN("io", 40)) - ->SetVisible(false); + AddImageButton(ID_ACCEPT, DrawPoint(87, 185), Extent(30, 26), TextureColor::Green1, LOADER.getImageN("io", 32)) + ->setVisible(false); + AddImageButton(ID_DENY, DrawPoint(137, 185), Extent(30, 26), TextureColor::Red1, LOADER.getImageN("io", 40)) + ->setVisible(false); FilterMessages(); curMsgId = curMsgIdxs.size(); @@ -126,8 +126,8 @@ void iwPostWindow::msgButtonClick(const unsigned ctrl_id) DisplayPostMessage(); break; case ID_SHOW_GOAL: - if(!postBox.GetCurrentMissionGoal().empty()) - WINDOWMANAGER.Show(std::make_unique(_("Diary"), postBox.GetCurrentMissionGoal(), + if(!postBox.getCurrentMissionGoal().empty()) + WINDOWMANAGER.Show(std::make_unique(_("Diary"), postBox.getCurrentMissionGoal(), false, iwMissionStatement::IM_AVATAR9)); break; case ID_SHOW_MIL: SwitchCategory(PostCategory::Military); break; @@ -151,7 +151,7 @@ void iwPostWindow::msgButtonClick(const unsigned ctrl_id) break; case ID_GO_END: // To newest - curMsgId = postBox.GetNumMsgs(); + curMsgId = postBox.getNumMsgs(); DisplayPostMessage(); break; case ID_GOTO: @@ -159,8 +159,8 @@ void iwPostWindow::msgButtonClick(const unsigned ctrl_id) // Goto if(!ValidateMessages()) return; - if(curMsg && curMsg->GetPos().isValid()) - gwv.MoveToMapPt(curMsg->GetPos()); + if(curMsg && curMsg->getPos().isValid()) + gwv.MoveToMapPt(curMsg->getPos()); } break; @@ -179,8 +179,8 @@ void iwPostWindow::msgButtonClick(const unsigned ctrl_id) if(dcurMsg) { // If it is a question about a new contract, tell the other player we denied it - if(dcurMsg->IsAccept()) - if(GAMECLIENT.CancelPact(dcurMsg->GetPactType(), dcurMsg->GetPlayerId())) + if(dcurMsg->isAccept()) + if(GAMECLIENT.CancelPact(dcurMsg->getPactType(), dcurMsg->getPlayerId())) postBox.DeleteMsg(curMsg); } } @@ -191,16 +191,16 @@ void iwPostWindow::msgButtonClick(const unsigned ctrl_id) { if(!ValidateMessages()) return; - const auto* dcurMsg = dynamic_cast(GetMsg(curMsgId)); + const auto* dcurMsg = dynamic_cast(getMsg(curMsgId)); if(dcurMsg) { bool success = false; // New contract? - if(dcurMsg->IsAccept()) + if(dcurMsg->isAccept()) success = - GAMECLIENT.AcceptPact(dcurMsg->GetPactId(), dcurMsg->GetPactType(), dcurMsg->GetPlayerId()); + GAMECLIENT.AcceptPact(dcurMsg->getPactId(), dcurMsg->getPactType(), dcurMsg->getPlayerId()); else - success = GAMECLIENT.CancelPact(dcurMsg->GetPactType(), dcurMsg->GetPlayerId()); + success = GAMECLIENT.CancelPact(dcurMsg->getPactType(), dcurMsg->getPlayerId()); if(success) postBox.DeleteMsg(dcurMsg); } @@ -213,10 +213,10 @@ void iwPostWindow::msgPaintBefore() { IngameWindow::msgPaintBefore(); ValidateMessages(); - if(lastHasMissionGoal != !postBox.GetCurrentMissionGoal().empty()) + if(lastHasMissionGoal != !postBox.getCurrentMissionGoal().empty()) { - lastHasMissionGoal = !postBox.GetCurrentMissionGoal().empty(); - GetCtrl(ID_SHOW_GOAL)->SetVisible(lastHasMissionGoal); + lastHasMissionGoal = !postBox.getCurrentMissionGoal().empty(); + getCtrl(ID_SHOW_GOAL)->setVisible(lastHasMissionGoal); } } @@ -261,20 +261,20 @@ void iwPostWindow::DisplayPostMessage() const DrawPoint textCenter(126, 151); // Hide everything - GetCtrl(ID_IMG)->SetVisible(false); - GetCtrl(ID_DELETE)->SetVisible(false); - GetCtrl(ID_GOTO)->SetVisible(false); - GetCtrl(ID_ACCEPT)->SetVisible(false); - GetCtrl(ID_DENY)->SetVisible(false); - GetCtrl(ID_INFO)->SetVisible(false); + getCtrl(ID_IMG)->setVisible(false); + getCtrl(ID_DELETE)->setVisible(false); + getCtrl(ID_GOTO)->setVisible(false); + getCtrl(ID_ACCEPT)->setVisible(false); + getCtrl(ID_DENY)->setVisible(false); + getCtrl(ID_INFO)->setVisible(false); unsigned size = curMsgIdxs.size(); // Keine Nachrichten, alles ausblenden, bis auf zentrierten Text if(size == 0) { - SetMessageText(_("No letters!")); - GetCtrl(ID_TEXT)->SetPos(textCenter); + setMessageText(_("No letters!")); + getCtrl(ID_TEXT)->setPos(textCenter); curMsg = nullptr; return; } @@ -283,46 +283,46 @@ void iwPostWindow::DisplayPostMessage() if(curMsgId >= size) curMsgId = size - 1; - curMsg = GetMsg(curMsgId); + curMsg = getMsg(curMsgId); // We have a message, display its status... std::stringstream ss; ss << _("Message") << " " << curMsgId + 1 << "/" << size << " - " << _("Time") << ": " - << GAMECLIENT.FormatGFTime(curMsg->GetSendFrame()); - GetCtrl(ID_INFO)->SetText(ss.str()); - GetCtrl(ID_INFO)->SetVisible(true); + << GAMECLIENT.FormatGFTime(curMsg->getSendFrame()); + getCtrl(ID_INFO)->setText(ss.str()); + getCtrl(ID_INFO)->setVisible(true); // ...and delete button - GetCtrl(ID_DELETE)->SetVisible(true); + getCtrl(ID_DELETE)->setVisible(true); - SetMessageText(curMsg->GetText()); - ITexture* const img = curMsg->GetImage_(); + setMessageText(curMsg->getText()); + ITexture* const img = curMsg->getImage(); if(img) { // We have an image, show it centered - GetCtrl(ID_IMG)->SetImage(img); - GetCtrl(ID_IMG)->SetPos(imgBottomCenter + img->GetOrigin() - - DrawPoint(img->GetSize().x / 2, img->GetSize().y)); + getCtrl(ID_IMG)->setImage(img); + getCtrl(ID_IMG)->setPos(imgBottomCenter + img->getOrigin() + - DrawPoint(img->getSize().x / 2, img->getSize().y)); - GetCtrl(ID_IMG)->SetVisible(true); + getCtrl(ID_IMG)->setVisible(true); } if(dynamic_cast(curMsg)) { - GetCtrl(ID_ACCEPT)->SetVisible(true); - GetCtrl(ID_DENY)->SetVisible(true); + getCtrl(ID_ACCEPT)->setVisible(true); + getCtrl(ID_DENY)->setVisible(true); } // Place text at top or center depending on whether we have an img or the acceptButton - if(img || GetCtrl(ID_ACCEPT)->IsVisible()) - GetCtrl(ID_TEXT)->SetPos(textTopCenter); + if(img || getCtrl(ID_ACCEPT)->isVisible()) + getCtrl(ID_TEXT)->setPos(textTopCenter); else - GetCtrl(ID_TEXT)->SetPos(textCenter); + getCtrl(ID_TEXT)->setPos(textCenter); // If message contains valid position, allow going to it - if(curMsg->GetPos().isValid()) - GetCtrl(ID_GOTO)->SetVisible(true); + if(curMsg->getPos().isValid()) + getCtrl(ID_GOTO)->setVisible(true); } -void iwPostWindow::SetMessageText(const std::string& message) +void iwPostWindow::setMessageText(const std::string& message) { - auto* text = GetCtrl(ID_TEXT); + auto* text = getCtrl(ID_TEXT); text->Clear(); text->AddString(message, COLOR_WINDOWBROWN); } @@ -330,14 +330,14 @@ void iwPostWindow::SetMessageText(const std::string& message) void iwPostWindow::FilterMessages() { curMsgIdxs.clear(); - lastMsgCt = postBox.GetNumMsgs(); + lastMsgCt = postBox.getNumMsgs(); for(unsigned i = 0; i < lastMsgCt; i++) { if(showAll) curMsgIdxs.push_back(i); else { - const PostCategory msgCat = postBox.GetMsg(i)->GetCategory(); + const PostCategory msgCat = postBox.getMsg(i)->getCategory(); // We sort diplomacy messages to general messages as we don't have another button if(msgCat == curCategory || (curCategory == PostCategory::General && msgCat == PostCategory::Diplomacy)) curMsgIdxs.push_back(i); @@ -347,7 +347,7 @@ void iwPostWindow::FilterMessages() bool iwPostWindow::ValidateMessages() { - if(lastMsgCt == postBox.GetNumMsgs() && GetMsg(curMsgId) == curMsg) + if(lastMsgCt == postBox.getNumMsgs() && getMsg(curMsgId) == curMsg) return true; // Messages have changed -> Update filter FilterMessages(); @@ -363,7 +363,7 @@ bool iwPostWindow::ValidateMessages() // So first search it, if not found we will display the next (newer) message for(unsigned i = curMsgId; i > 0; i--) { - if(postBox.GetMsg(i - 1) == curMsg) + if(postBox.getMsg(i - 1) == curMsg) { curMsgId = i - 1; DisplayPostMessage(); @@ -376,10 +376,10 @@ bool iwPostWindow::ValidateMessages() } } -const PostMsg* iwPostWindow::GetMsg(unsigned id) const +const PostMsg* iwPostWindow::getMsg(unsigned id) const { if(id < curMsgIdxs.size()) - return postBox.GetMsg(curMsgIdxs[id]); + return postBox.getMsg(curMsgIdxs[id]); else return nullptr; } diff --git a/libs/s25main/ingameWindows/iwPostWindow.h b/libs/s25main/ingameWindows/iwPostWindow.h index 98eb85d8ab..09353cdd89 100644 --- a/libs/s25main/ingameWindows/iwPostWindow.h +++ b/libs/s25main/ingameWindows/iwPostWindow.h @@ -35,9 +35,9 @@ class iwPostWindow : public IngameWindow /// Passt Steuerelemente an, setzt Einstellung für diverse Controls passend für die aktuelle PostMessage void DisplayPostMessage(); /// Setzt den Text mehrzeilig in das Postfenster - void SetMessageText(const std::string& message); + void setMessageText(const std::string& message); void FilterMessages(); bool ValidateMessages(); - const PostMsg* GetMsg(unsigned id) const; + const PostMsg* getMsg(unsigned id) const; void SwitchCategory(PostCategory cat); }; diff --git a/libs/s25main/ingameWindows/iwRoadWindow.cpp b/libs/s25main/ingameWindows/iwRoadWindow.cpp index 69d1eed1e7..3dc1945015 100644 --- a/libs/s25main/ingameWindows/iwRoadWindow.cpp +++ b/libs/s25main/ingameWindows/iwRoadWindow.cpp @@ -12,24 +12,24 @@ iwRoadWindow::iwRoadWindow(GameInterface& gi, bool flagpossible, const Position& mousePos) : IngameWindow(CGI_ROADWINDOW, IngameWindow::posAtMouse, Extent(200, 100), _("Activity window"), - LOADER.GetImageN("io", 1)), + LOADER.getImageN("io", 1)), gi(gi), mousePosAtOpen_(mousePos) { // Bau abbrechen ctrlButton* cancel = AddImageButton(1, DrawPoint(10, 20), Extent(36, 36), TextureColor::Grey, - LOADER.GetImageN("io", 110), _("Interrupt road building")); + LOADER.getImageN("io", 110), _("Interrupt road building")); ctrlButton* defaultBt = cancel; if(flagpossible) { // Flagge platzieren - defaultBt = AddImageButton(0, DrawPoint(10, 20), Extent(36, 36), TextureColor::Grey, LOADER.GetImageN("io", 70), + defaultBt = AddImageButton(0, DrawPoint(10, 20), Extent(36, 36), TextureColor::Grey, LOADER.getImageN("io", 70), _("Erect flag")); // Abbrechen button daneben schieben - cancel->SetPos(DrawPoint(46, 20)); + cancel->setPos(DrawPoint(46, 20)); } - VIDEODRIVER.SetMousePos(defaultBt->GetDrawPos() + DrawPoint(defaultBt->GetSize()) / 2); + VIDEODRIVER.setMousePos(defaultBt->getDrawPos() + DrawPoint(defaultBt->getSize()) / 2); } void iwRoadWindow::msgButtonClick(const unsigned ctrl_id) @@ -49,7 +49,7 @@ void iwRoadWindow::msgButtonClick(const unsigned ctrl_id) } // Maus an vorherige Stelle setzen - VIDEODRIVER.SetMousePos(mousePosAtOpen_); + VIDEODRIVER.setMousePos(mousePosAtOpen_); // und fenster schließen Close(); diff --git a/libs/s25main/ingameWindows/iwSave.cpp b/libs/s25main/ingameWindows/iwSave.cpp index a59646f5b3..c47643efeb 100644 --- a/libs/s25main/ingameWindows/iwSave.cpp +++ b/libs/s25main/ingameWindows/iwSave.cpp @@ -45,7 +45,7 @@ constexpr std::array AUTO_SAVE_INTERVALS{1min, 5min, 10min, 15min, 30min, 60min, iwSaveLoad::iwSaveLoad(const std::string& window_title, ITexture* btImg, const unsigned addHeight) : IngameWindow(CGI_SAVE, IngameWindow::posLastOrCenter, Extent(700, 400 + addHeight), window_title, - LOADER.GetImageN("resource", 41)) + LOADER.getImageN("resource", 41)) { using SRT = ctrlTable::SortType; AddTable(ID_tblSaveGames, DrawPoint(20, 30), Extent(660, 300), TextureColor::Green2, NormalFont, @@ -80,15 +80,15 @@ void iwSaveLoad::msgButtonClick(const unsigned ctrl_id) void iwSaveLoad::msgTableSelectItem(const unsigned /*ctrl_id*/, const std::optional& selection) { // On selecting a table entry put the filename into the edit control - GetCtrl(ID_edtFilename) - ->SetText(selection ? GetCtrl(ID_tblSaveGames)->GetItemText(*selection, 0) : ""); + getCtrl(ID_edtFilename) + ->setText(selection ? getCtrl(ID_tblSaveGames)->getItemText(*selection, 0) : ""); } void iwSaveLoad::RefreshTable() { static bool loadedOnce = false; - auto* table = GetCtrl(ID_tblSaveGames); + auto* table = getCtrl(ID_tblSaveGames); table->DeleteAllItems(); @@ -102,16 +102,16 @@ void iwSaveLoad::RefreshTable() if(!loadedOnce) { LOG.write(_("Invalid Savegame %1%! Reason: %2%\n")) % saveFile - % (save.GetLastErrorMsg().empty() ? _("Unknown") : save.GetLastErrorMsg()); + % (save.getLastErrorMsg().empty() ? _("Unknown") : save.getLastErrorMsg()); } continue; } const auto fileName = saveFile.stem().string(); - const std::string dateStr = s25util::Time::FormatTime("%d.%m.%Y - %H:%i", save.GetSaveTime()); + const std::string dateStr = s25util::Time::FormatTime("%d.%m.%Y - %H:%i", save.getSaveTime()); const std::string gameTime = GAMECLIENT.FormatGFTime(save.start_gf); - table->AddRow({fileName, save.GetMapName(), dateStr, gameTime, saveFile.string()}); + table->AddRow({fileName, save.getMapName(), dateStr, gameTime, saveFile.string()}); } // Sort by time @@ -121,7 +121,7 @@ void iwSaveLoad::RefreshTable() void iwSave::SaveLoad() { - const auto fileNameResult = GetCtrl(ID_edtFilename)->GetFileName(".sav"); + const auto fileNameResult = getCtrl(ID_edtFilename)->getFileName(".sav"); switch(fileNameResult.status) { case FileNameStatus::Empty: @@ -137,14 +137,14 @@ void iwSave::SaveLoad() GAMECLIENT.SaveToFile(RTTRCONFIG.ExpandPath(s25::folders::save) / fileNameResult.name); RefreshTable(); - GetCtrl(ID_edtFilename)->SetText(""); + getCtrl(ID_edtFilename)->setText(""); } -iwSave::iwSave() : iwSaveLoad(_("Save game!"), LOADER.GetTextureN("io", 47), 30) +iwSave::iwSave() : iwSaveLoad(_("Save game!"), LOADER.getTextureN("io", 47), 30) { - auto* fileNameEdit = GetCtrl(ID_edtFilename); - fileNameEdit->SetType(EditType::Filename); - DrawPoint pos(GetSize().x / 2, fileNameEdit->GetPos().y + fileNameEdit->GetSize().y + 10); + auto* fileNameEdit = getCtrl(ID_edtFilename); + fileNameEdit->setType(EditType::Filename); + DrawPoint pos(getSize().x / 2, fileNameEdit->getPos().y + fileNameEdit->getSize().y + 10); ctrlComboBox* combo = AddComboBox(ID_cbAutoSaveInterval, pos, Extent(130, 22), TextureColor::Green2, NormalFont, 100); @@ -160,9 +160,9 @@ iwSave::iwSave() : iwSaveLoad(_("Save game!"), LOADER.GetTextureN("io", 47), 30) combo->AddItem(_("Every GF")); // Select interval - combo->SetSelection(0); // Use disabled by default and change if possible + combo->setSelection(0); // Use disabled by default and change if possible if(SETTINGS.interface.autosaveInterval == 1) - combo->SetSelection(AUTO_SAVE_INTERVALS.size() + 1); + combo->setSelection(AUTO_SAVE_INTERVALS.size() + 1); else { // Start selection index at 1, 0 is "disabled" @@ -170,7 +170,7 @@ iwSave::iwSave() : iwSaveLoad(_("Save game!"), LOADER.GetTextureN("io", 47), 30) { if(SETTINGS.interface.autosaveInterval == duration_to_gfs(i.value())) { - combo->SetSelection(static_cast(i.index())); + combo->setSelection(static_cast(i.index())); break; } } @@ -191,15 +191,15 @@ void iwSave::msgComboSelectItem(const unsigned /*ctrl_id*/, const unsigned selec } } -iwLoad::iwLoad(CreateServerInfo csi) : iwSaveLoad(_("Load game!"), LOADER.GetTextureN("io", 48)), csi(std::move(csi)) {} +iwLoad::iwLoad(CreateServerInfo csi) : iwSaveLoad(_("Load game!"), LOADER.getTextureN("io", 48)), csi(std::move(csi)) {} void iwLoad::SaveLoad() { - const auto* table = GetCtrl(ID_tblSaveGames); - if(!table->GetSelection()) + const auto* table = getCtrl(ID_tblSaveGames); + if(!table->getSelection()) return; - if(GAMECLIENT.HostGame(csi, {table->GetItemText(*table->GetSelection(), 4), MapType::Savegame})) + if(GAMECLIENT.HostGame(csi, {table->getItemText(*table->getSelection(), 4), MapType::Savegame})) { std::unique_ptr lobbyClient; if(csi.type == ServerType::Lobby) diff --git a/libs/s25main/ingameWindows/iwSettings.cpp b/libs/s25main/ingameWindows/iwSettings.cpp index 522ade2b3d..d1f42b2c1f 100644 --- a/libs/s25main/ingameWindows/iwSettings.cpp +++ b/libs/s25main/ingameWindows/iwSettings.cpp @@ -41,7 +41,7 @@ enum iwSettings::iwSettings() : IngameWindow(CGI_SETTINGS, IngameWindow::posLastOrCenter, Extent(370, 254), _("Settings"), - LOADER.GetImageN("resource", 41), false) + LOADER.getImageN("resource", 41), false) { // Controls are in 2 columns, the left might be the label for the control on the right constexpr auto rowWidth = 350; @@ -60,7 +60,7 @@ iwSettings::iwSettings() cbDisplayMode->AddItem(_("Windowed")); cbDisplayMode->AddItem(_("Fullscreen")); cbDisplayMode->AddItem(_("Borderless window")); - cbDisplayMode->SetSelection(rttr::enum_cast(SETTINGS.video.displayMode.type)); + cbDisplayMode->setSelection(rttr::enum_cast(SETTINGS.video.displayMode.type)); curPos.y += ctrlSize.y + 5; auto* grpResolution = AddGroup(ID_grpResolution); @@ -83,9 +83,9 @@ iwSettings::iwSettings() { cbResolution->AddItem(helpers::format("%ux%u", videoMode.width, videoMode.height)); if(videoMode == SETTINGS.video.fullscreenSize) - cbResolution->SetSelection(cbResolution->GetNumItems() - 1); + cbResolution->setSelection(cbResolution->getNumItems() - 1); } - const auto windowSizes = VIDEODRIVER.GetDefaultWindowSizes(); + const auto windowSizes = VIDEODRIVER.getDefaultWindowSizes(); windowSizes_.assign(windowSizes.begin(), windowSizes.end()); cbWindowSize.AddItem(""); // Placeholder for current window size for(const auto& size : windowSizes_) @@ -101,17 +101,17 @@ iwSettings::iwSettings() cbMapScrollMode->AddItem( _("Scroll opposite (Map moves in the opposite direction the mouse is moved when scrolling/panning.)")); cbMapScrollMode->AddItem(_("Grab and drag (Map moves with your cursor when scrolling/panning.)")); - cbMapScrollMode->SetSelection(static_cast(SETTINGS.interface.mapScrollMode)); + cbMapScrollMode->setSelection(static_cast(SETTINGS.interface.mapScrollMode)); curPos.y += ctrlSize.y + 10; AddCheckBox(ID_cbSmartCursor, curPos, cbSize, TextureColor::Grey, _("Smart Cursor"), NormalFont, false) ->setChecked(SETTINGS.global.smartCursor) - ->SetTooltip(_("Place cursor on default button for new dialogs / action windows (default)")); + ->setTooltip(_("Place cursor on default button for new dialogs / action windows (default)")); curPos.y += cbSize.y + 3; AddCheckBox(ID_cbStatisticScale, curPos, cbSize, TextureColor::Grey, _("Statistics Scale"), NormalFont, false) ->setChecked(SETTINGS.ingame.scaleStatistics); - curPos = DrawPoint(leftColOffset + btSpacing, GetSize().y - 40); + curPos = DrawPoint(leftColOffset + btSpacing, getSize().y - 40); AddTextButton(ID_btApply, curPos, btSize, TextureColor::Green2, _("Apply"), NormalFont, _("Apply Changes")); curPos.x += btSize.x + btSpacing; AddTextButton(ID_btAbort, curPos, btSize, TextureColor::Red1, _("Abort"), NormalFont, _("Close Without Saving")); @@ -126,30 +126,30 @@ void iwSettings::msgButtonClick(unsigned ctrl_id) { case ID_btApply: { - auto& grpWindowSize = *GetCtrl(ID_grpWindowSize); - SETTINGS.global.smartCursor = GetCtrl(ID_cbSmartCursor)->isChecked(); - VIDEODRIVER.SetMouseWarping(SETTINGS.global.smartCursor); - SETTINGS.ingame.scaleStatistics = GetCtrl(ID_cbStatisticScale)->isChecked(); - SETTINGS.video.displayMode = DisplayMode(GetCtrl(ID_cbDisplayMode)->GetSelection().value()); - SETTINGS.video.displayMode.resizeable = !grpWindowSize.GetCtrl(ID_cbLockWindowSize)->isChecked(); + auto& grpWindowSize = *getCtrl(ID_grpWindowSize); + SETTINGS.global.smartCursor = getCtrl(ID_cbSmartCursor)->isChecked(); + VIDEODRIVER.setMouseWarping(SETTINGS.global.smartCursor); + SETTINGS.ingame.scaleStatistics = getCtrl(ID_cbStatisticScale)->isChecked(); + SETTINGS.video.displayMode = DisplayMode(getCtrl(ID_cbDisplayMode)->getSelection().value()); + SETTINGS.video.displayMode.resizeable = !grpWindowSize.getCtrl(ID_cbLockWindowSize)->isChecked(); SETTINGS.interface.mapScrollMode = - static_cast(GetCtrl(ID_cbMapScrollMode)->GetSelection().value()); + static_cast(getCtrl(ID_cbMapScrollMode)->getSelection().value()); SETTINGS.video.fullscreenSize = supportedResolutions_ - [GetCtrl(ID_grpResolution)->GetCtrl(ID_cbResolution)->GetSelection().value()]; + [getCtrl(ID_grpResolution)->getCtrl(ID_cbResolution)->getSelection().value()]; const unsigned windowSizeSelection = - grpWindowSize.GetCtrl(ID_cbWindowSize)->GetSelection().value(); + grpWindowSize.getCtrl(ID_cbWindowSize)->getSelection().value(); if(windowSizeSelection > 0) SETTINGS.video.windowedSize = windowSizes_[windowSizeSelection - 1]; - else if(VIDEODRIVER.GetDisplayMode() == DisplayMode::Windowed) - SETTINGS.video.windowedSize = VIDEODRIVER.GetWindowSize(); + else if(VIDEODRIVER.getDisplayMode() == DisplayMode::Windowed) + SETTINGS.video.windowedSize = VIDEODRIVER.getWindowSize(); closeBehavior_ = CloseBehavior::Regular; const auto screenSize = SETTINGS.video.displayMode == DisplayMode::Fullscreen ? SETTINGS.video.fullscreenSize : SETTINGS.video.windowedSize; if((SETTINGS.video.displayMode != DisplayMode::BorderlessWindow - && VIDEODRIVER.GetWindowSize() != screenSize) - || SETTINGS.video.displayMode != VIDEODRIVER.GetDisplayMode()) + && VIDEODRIVER.getWindowSize() != screenSize) + || SETTINGS.video.displayMode != VIDEODRIVER.getDisplayMode()) { if(!VIDEODRIVER.ResizeScreen(screenSize, SETTINGS.video.displayMode)) { @@ -186,7 +186,7 @@ void iwSettings::msgGroupComboSelectItem(unsigned /*group_id*/, unsigned ctrl_id { const DisplayMode currentDisplayMode = getDisplayModeSelection(); // Directly apply new window size - if(currentDisplayMode == DisplayMode::Windowed && VIDEODRIVER.GetDisplayMode() == DisplayMode::Windowed) + if(currentDisplayMode == DisplayMode::Windowed && VIDEODRIVER.getDisplayMode() == DisplayMode::Windowed) { VIDEODRIVER.ResizeScreen(windowSizes_[selection - 1], DisplayMode::Windowed); } else @@ -203,23 +203,23 @@ void iwSettings::msgScreenResize(const ScreenResizeEvent& sr) void iwSettings::updateWindowSizeComboBox() { - auto* cbWindowSize = GetCtrl(ID_grpWindowSize)->GetCtrl(ID_cbWindowSize); + auto* cbWindowSize = getCtrl(ID_grpWindowSize)->getCtrl(ID_cbWindowSize); const VideoMode currentSize = - VIDEODRIVER.GetDisplayMode() == DisplayMode::Windowed ? VIDEODRIVER.GetWindowSize() : SETTINGS.video.windowedSize; - cbWindowSize->SetText(0, helpers::format("%ux%u", currentSize.width, currentSize.height)); + VIDEODRIVER.getDisplayMode() == DisplayMode::Windowed ? VIDEODRIVER.getWindowSize() : SETTINGS.video.windowedSize; + cbWindowSize->setText(0, helpers::format("%ux%u", currentSize.width, currentSize.height)); // Not found == -1 -> First entry selected - cbWindowSize->SetSelection(static_cast(helpers::indexOf(windowSizes_, currentSize) + 1)); + cbWindowSize->setSelection(static_cast(helpers::indexOf(windowSizes_, currentSize) + 1)); } void iwSettings::updateResolutionGroups() { const DisplayMode currentDisplayMode = getDisplayModeSelection(); - GetCtrl(ID_grpResolution)->SetVisible(currentDisplayMode == DisplayMode::Fullscreen); - GetCtrl(ID_grpWindowSize)->SetVisible(currentDisplayMode == DisplayMode::Windowed); + getCtrl(ID_grpResolution)->setVisible(currentDisplayMode == DisplayMode::Fullscreen); + getCtrl(ID_grpWindowSize)->setVisible(currentDisplayMode == DisplayMode::Windowed); } DisplayMode iwSettings::getDisplayModeSelection() const { - return static_cast(GetCtrl(ID_cbDisplayMode)->GetSelection().value()); + return static_cast(getCtrl(ID_cbDisplayMode)->getSelection().value()); } diff --git a/libs/s25main/ingameWindows/iwShip.cpp b/libs/s25main/ingameWindows/iwShip.cpp index 72b0cb0090..b5d9535c69 100644 --- a/libs/s25main/ingameWindows/iwShip.cpp +++ b/libs/s25main/ingameWindows/iwShip.cpp @@ -33,52 +33,52 @@ #include "gameData/const_gui_ids.h" iwShip::iwShip(GameWorldView& gwv, GameCommandFactory& gcFactory, const noShip* const ship, const DrawPoint& pos) - : IngameWindow(CGI_SHIP, pos, Extent(252, 238), _("Ship register"), LOADER.GetImageN("resource", 41)), gwv(gwv), - gcFactory(gcFactory), player(ship ? ship->GetPlayerId() : gwv.GetViewer().GetPlayerId()), - ship_id(ship ? gwv.GetWorld().GetPlayer(player).GetShipID(*ship) : 0) + : IngameWindow(CGI_SHIP, pos, Extent(252, 238), _("Ship register"), LOADER.getImageN("resource", 41)), gwv(gwv), + gcFactory(gcFactory), player(ship ? ship->getPlayerId() : gwv.getViewer().getPlayerId()), + ship_id(ship ? gwv.getWorld().getPlayer(player).getShipID(*ship) : 0) { - AddImage(0, DrawPoint(126, 101), LOADER.GetImageN("io", 228)); + AddImage(0, DrawPoint(126, 101), LOADER.getImageN("io", 228)); AddImageButton(2, DrawPoint(18, 192), Extent(30, 35), TextureColor::Grey, - LOADER.GetImageN("io", 225)); // Viewer: 226 - Hilfe + LOADER.getImageN("io", 225)); // Viewer: 226 - Hilfe AddImageButton(3, DrawPoint(51, 196), Extent(30, 26), TextureColor::Grey, - LOADER.GetImageN("io", 102)); // Viewer: 103 - Schnell zurück + LOADER.getImageN("io", 102)); // Viewer: 103 - Schnell zurück AddImageButton(4, DrawPoint(81, 196), Extent(30, 26), TextureColor::Grey, - LOADER.GetImageN("io", 103)); // Viewer: 104 - Zurück + LOADER.getImageN("io", 103)); // Viewer: 104 - Zurück AddImageButton(5, DrawPoint(111, 196), Extent(30, 26), TextureColor::Grey, - LOADER.GetImageN("io", 104)); // Viewer: 105 - Vor + LOADER.getImageN("io", 104)); // Viewer: 105 - Vor AddImageButton(6, DrawPoint(141, 196), Extent(30, 26), TextureColor::Grey, - LOADER.GetImageN("io", 105)); // Viewer: 106 - Schnell vor - AddImageButton(7, DrawPoint(181, 196), Extent(30, 26), TextureColor::Grey, LOADER.GetImageN("io", 107), + LOADER.getImageN("io", 105)); // Viewer: 106 - Schnell vor + AddImageButton(7, DrawPoint(181, 196), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 107), _("Go to place")); // "Gehe Zu Ort" // Die Expeditionsweiterfahrbuttons - AddImageButton(10, DrawPoint(60, 81), Extent(18, 18), TextureColor::Grey, LOADER.GetImageN("io", 187), + AddImageButton(10, DrawPoint(60, 81), Extent(18, 18), TextureColor::Grey, LOADER.getImageN("io", 187), _("Found colony")) - ->SetVisible(false); + ->setVisible(false); constexpr helpers::EnumArray BUTTON_POS = { {{60, 61}, {80, 70}, {80, 90}, {60, 101}, {40, 90}, {40, 70}}}; constexpr helpers::EnumArray BUTTON_IDs = {{185, 186, 181, 182, 183, 184}}; // Expedition abbrechen - AddImageButton(11, DrawPoint(200, 143), Extent(18, 18), TextureColor::Red1, LOADER.GetImageN("io", 40), + AddImageButton(11, DrawPoint(200, 143), Extent(18, 18), TextureColor::Red1, LOADER.getImageN("io", 40), _("Return to harbor")) - ->SetVisible(false); + ->setVisible(false); // Die 6 Richtungen for(const auto dir : helpers::EnumRange{}) AddImageButton(12 + rttr::enum_cast(dir), BUTTON_POS[dir], Extent(18, 18), TextureColor::Grey, - LOADER.GetImageN("io", BUTTON_IDs[dir])) - ->SetVisible(false); + LOADER.getImageN("io", BUTTON_IDs[dir])) + ->setVisible(false); } void iwShip::DrawContent() { static boost::format valByValFmt{"%1%/%2%"}; - const GamePlayer& owner = gwv.GetWorld().GetPlayer(player); + const GamePlayer& owner = gwv.getWorld().getPlayer(player); // Schiff holen - noShip* ship = (player == 0xff) ? nullptr : owner.GetShipByID(ship_id); + noShip* ship = (player == 0xff) ? nullptr : owner.getShipByID(ship_id); // Kein Schiff gefunden? Dann erstes Schiff holen if(!ship) @@ -86,43 +86,43 @@ void iwShip::DrawContent() ship_id = 0; // Nochmal probieren if(player != 0xff) - ship = owner.GetShipByID(ship_id); + ship = owner.getShipByID(ship_id); // Immer noch nicht? Dann gibt es keine Schiffe mehr und wir zeigen eine entsprechende Meldung an if(!ship) { - NormalFont->Draw(GetDrawPos() + DrawPoint(GetSize().x / 2, 60), _("No ships available"), + NormalFont->Draw(getDrawPos() + DrawPoint(getSize().x / 2, 60), _("No ships available"), FontStyle::CENTER | FontStyle::NO_OUTLINE, COLOR_WINDOWBROWN); return; } } // Schiffsname - NormalFont->Draw(GetDrawPos() + DrawPoint(42, 42), ship->GetName(), FontStyle::NO_OUTLINE, COLOR_WINDOWBROWN); + NormalFont->Draw(getDrawPos() + DrawPoint(42, 42), ship->getName(), FontStyle::NO_OUTLINE, COLOR_WINDOWBROWN); // Schiffs-Nr. - valByValFmt % (ship_id + 1) % owner.GetNumShips(); - NormalFont->Draw(GetDrawPos() + DrawPoint(208, 42), valByValFmt.str(), FontStyle::RIGHT | FontStyle::NO_OUTLINE, + valByValFmt % (ship_id + 1) % owner.getNumShips(); + NormalFont->Draw(getDrawPos() + DrawPoint(208, 42), valByValFmt.str(), FontStyle::RIGHT | FontStyle::NO_OUTLINE, COLOR_WINDOWBROWN); // Das Schiffs-Bild - LOADER.GetImageN("boot_z", 12)->DrawFull(GetDrawPos() + DrawPoint(138, 117)); + LOADER.getImageN("boot_z", 12)->DrawFull(getDrawPos() + DrawPoint(138, 117)); // Expeditions-Buttons malen? - if(ship->IsWaitingForExpeditionInstructions()) + if(ship->isWaitingForExpeditionInstructions()) { - GetCtrl(10)->SetVisible(ship->IsAbleToFoundColony()); - GetCtrl(11)->SetVisible(true); + getCtrl(10)->setVisible(ship->isAbleToFoundColony()); + getCtrl(11)->setVisible(true); for(const auto dir : helpers::EnumRange{}) { - GetCtrl(12 + rttr::enum_cast(dir)) - ->SetVisible(gwv.GetWorld() - .GetNextFreeHarborPoint(ship->GetPos(), ship->GetCurrentHarbor(), dir, ship->GetPlayerId()) + getCtrl(12 + rttr::enum_cast(dir)) + ->setVisible(gwv.getWorld() + .getNextFreeHarborPoint(ship->getPos(), ship->getCurrentHarbor(), dir, ship->getPlayerId()) .isValid()); } } else { // Alle Buttons inklusive Anker in der Mitte ausblenden for(unsigned i = 0; i < 8; ++i) - GetCtrl(10 + i)->SetVisible(false); + getCtrl(10 + i)->setVisible(false); } DrawCargo(); @@ -139,7 +139,7 @@ void iwShip::msgButtonClick(const unsigned ctrl_id) return; } - noShip* ship = gwv.GetWorld().GetPlayer(player).GetShipByID(ship_id); + noShip* ship = gwv.getWorld().getPlayer(player).getShipByID(ship_id); if(!ship) return; @@ -172,7 +172,7 @@ void iwShip::msgButtonClick(const unsigned ctrl_id) case 4: { if(ship_id == 0) - ship_id = gwv.GetWorld().GetPlayer(ship->GetPlayerId()).GetNumShips() - 1; + ship_id = gwv.getWorld().getPlayer(ship->getPlayerId()).getNumShips() - 1; else --ship_id; } @@ -181,19 +181,19 @@ void iwShip::msgButtonClick(const unsigned ctrl_id) case 5: { ++ship_id; - if(ship_id == gwv.GetWorld().GetPlayer(ship->GetPlayerId()).GetNumShips()) + if(ship_id == gwv.getWorld().getPlayer(ship->getPlayerId()).getNumShips()) ship_id = 0; } break; // Letztes Schiff case 6: { - ship_id = gwv.GetWorld().GetPlayer(ship->GetPlayerId()).GetNumShips() - 1; + ship_id = gwv.getWorld().getPlayer(ship->getPlayerId()).getNumShips() - 1; } break; case 7: // "Gehe Zu Ort" { - gwv.MoveToMapPt(ship->GetPos()); + gwv.MoveToMapPt(ship->getPos()); } break; } @@ -201,38 +201,38 @@ void iwShip::msgButtonClick(const unsigned ctrl_id) void iwShip::DrawCargo() { - const GamePlayer& owner = gwv.GetWorld().GetPlayer(player); - const noShip* ship = owner.GetShipByID(ship_id); + const GamePlayer& owner = gwv.getWorld().getPlayer(player); + const noShip* ship = owner.getShipByID(ship_id); // Count figures by type helpers::EnumArray orderedFigures{}; helpers::EnumArray armoredFigures{}; - for(const noFigure& figure : ship->GetFigures()) + for(const noFigure& figure : ship->getFigures()) { - orderedFigures[figure.GetJobType()]++; + orderedFigures[figure.getJobType()]++; - if(isSoldier(figure.GetJobType()) && figure.HasArmor()) - armoredFigures[jobEnumToAmoredSoldierEnum(figure.GetJobType())]++; + if(isSoldier(figure.getJobType()) && figure.hasArmor()) + armoredFigures[jobEnumToAmoredSoldierEnum(figure.getJobType())]++; } // Count wares by type helpers::EnumArray orderedWares{}; - for(const Ware& ware : ship->GetWares()) + for(const Ware& ware : ship->getWares()) orderedWares[ware.type]++; // Special cases: expeditions - if(ship->IsOnExpedition()) + if(ship->isOnExpedition()) { orderedFigures[Job::Builder] = 1; orderedWares[GoodType::Boards] = BUILDING_COSTS[BuildingType::HarborBuilding].boards; orderedWares[GoodType::Stones] = BUILDING_COSTS[BuildingType::HarborBuilding].stones; - } else if(ship->IsOnExplorationExpedition()) + } else if(ship->isOnExplorationExpedition()) { - orderedFigures[Job::Scout] = gwv.GetWorld().GetGGS().GetNumScoutsExpedition(); + orderedFigures[Job::Scout] = gwv.getWorld().getGGS().getNumScoutsExpedition(); } // Start Offset zum malen - const DrawPoint startPt = GetDrawPos() + DrawPoint(40, 130); + const DrawPoint startPt = getDrawPos() + DrawPoint(40, 130); // Step pro Ware/Figur const int xStep = 10; @@ -260,9 +260,9 @@ void iwShip::DrawCargo() orderedFigures[job]--; if(job == Job::PackDonkey) - LOADER.GetMapTexture(2016)->DrawFull(drawPt); + LOADER.getMapTexture(2016)->DrawFull(drawPt); else if(job == Job::BoatCarrier) - LOADER.GetBob("carrier")->Draw(rttr::enum_cast(GoodType::Boat), libsiedler2::ImgDir::SW, false, 0, + LOADER.getBob("carrier")->Draw(rttr::enum_cast(GoodType::Boat), libsiedler2::ImgDir::SW, false, 0, drawPt, owner.color); else if(wineaddon::isWineAddonJobType(job)) { @@ -273,7 +273,7 @@ void iwShip::DrawCargo() type = wineaddon::BobTypes::TEMPLESERVANT_WALKING; LOADER - .GetPlayerImage("wine_bobs", + .getPlayerImage("wine_bobs", wineaddon::bobIndex[type] + static_cast(libsiedler2::ImgDir::SW) * 8) ->DrawFull(drawPt, COLOR_WHITE, owner.color); } else if(leatheraddon::isLeatherAddonJobType(job)) @@ -285,20 +285,20 @@ void iwShip::DrawCargo() type = leatheraddon::BobType::LeatherworkerWalking; LOADER - .GetPlayerImage("leather_bobs", + .getPlayerImage("leather_bobs", leatheraddon::bobIndex[type] + static_cast(libsiedler2::ImgDir::SW) * 8) ->DrawFull(drawPt, COLOR_WHITE, owner.color); } else { const auto& spriteData = JOB_SPRITE_CONSTS[job]; - LOADER.GetBob("jobs")->Draw(spriteData.getBobId(owner.nation), libsiedler2::ImgDir::SW, + LOADER.getBob("jobs")->Draw(spriteData.getBobId(owner.nation), libsiedler2::ImgDir::SW, spriteData.isFat(), 0, drawPt, owner.color); } if(isSoldier(job) && armoredFigures[jobEnumToAmoredSoldierEnum(job)] > 0) { armoredFigures[jobEnumToAmoredSoldierEnum(job)]--; - if(gwv.GetWorld().GetGGS().isEnabled(AddonId::MILITARY_HITPOINTS)) + if(gwv.getWorld().getGGS().isEnabled(AddonId::MILITARY_HITPOINTS)) { SmallFont->Draw(drawPt + DrawPoint(-2, -25), "+", FontStyle::CENTER, COLOR_RED); SmallFont->Draw(drawPt + DrawPoint(1, -25), "1", FontStyle::CENTER, COLOR_RED); @@ -325,7 +325,7 @@ void iwShip::DrawCargo() const auto draw_id = convertShieldToNation(ware, owner.nation); - LOADER.GetWareStackTex(draw_id)->DrawFull(drawPt); + LOADER.getWareStackTex(draw_id)->DrawFull(drawPt); drawPt.x += xStep; lineCounter++; } diff --git a/libs/s25main/ingameWindows/iwSkipGFs.cpp b/libs/s25main/ingameWindows/iwSkipGFs.cpp index 24017bdf75..98e16f524d 100644 --- a/libs/s25main/ingameWindows/iwSkipGFs.cpp +++ b/libs/s25main/ingameWindows/iwSkipGFs.cpp @@ -32,18 +32,18 @@ constexpr std::array jumpPresets = { iwSkipGFs::iwSkipGFs(GameWorldView& gwv) : IngameWindow(CGI_SKIPGFS, IngameWindow::posLastOrCenter, Extent(300, 120), _("Skip GameFrames"), - LOADER.GetImageN("resource", 41)), + LOADER.getImageN("resource", 41)), gwv(gwv) { constexpr auto lblWidth = 135; const auto edtOffset = contentOffset.x + lblWidth; constexpr auto spacing = 5; constexpr Extent edtSize(100, 20); - Extent btSize(GetIwSize().x - edtOffset - edtSize.x - spacing, edtSize.y); + Extent btSize(getIwSize().x - edtOffset - edtSize.x - spacing, edtSize.y); DrawPoint curPos(edtOffset, 28); ctrlEdit* edit = AddEdit(ID_edtToGf, curPos, edtSize, TextureColor::Grey, NormalFont); - edit->SetFocus(); + edit->setFocus(); curPos.x -= spacing; AddText(ID_lblToGf, curPos + DrawPoint(0, 4), _("to GameFrame:"), COLOR_YELLOW, FontStyle::RIGHT, NormalFont); curPos.x += edtSize.x + spacing * 2; @@ -60,7 +60,7 @@ iwSkipGFs::iwSkipGFs(GameWorldView& gwv) curPos.x = contentOffset.x + spacing; curPos.y += edtSize.y + 5; - const auto availWidth = GetIwSize().x - spacing * 2; + const auto availWidth = getIwSize().x - spacing * 2; btSize.x = (availWidth - spacing * (jumpPresets.size() - 1)) / jumpPresets.size(); for(auto i : jumpPresets) { @@ -72,9 +72,9 @@ iwSkipGFs::iwSkipGFs(GameWorldView& gwv) void iwSkipGFs::SkipGFs(const unsigned edtCtrlId) { - int targetGF = s25util::fromStringClassicDef(GetCtrl(edtCtrlId)->GetText(), 0); + int targetGF = s25util::fromStringClassicDef(getCtrl(edtCtrlId)->getText(), 0); if(edtCtrlId == ID_edtByGf) - targetGF += GAMECLIENT.GetGFNumber(); + targetGF += GAMECLIENT.getGFNumber(); GAMECLIENT.SkipGF(targetGF, gwv); } @@ -84,7 +84,7 @@ void iwSkipGFs::msgButtonClick(const unsigned ctrlId) SkipGFs((ctrlId == ID_btByGf) ? ID_edtByGf : ID_edtToGf); else { - const unsigned targetGF = GAMECLIENT.GetGFNumber() + ctrlId - ID_btJumpPresetStart; + const unsigned targetGF = GAMECLIENT.getGFNumber() + ctrlId - ID_btJumpPresetStart; GAMECLIENT.SkipGF(targetGF, gwv); } } diff --git a/libs/s25main/ingameWindows/iwStatistics.cpp b/libs/s25main/ingameWindows/iwStatistics.cpp index 60cb74595b..d8aaff7f66 100644 --- a/libs/s25main/ingameWindows/iwStatistics.cpp +++ b/libs/s25main/ingameWindows/iwStatistics.cpp @@ -42,7 +42,7 @@ std::string getPlayerStatus(const GamePlayer& player) if(player.IsDefeated()) return "---"; else if(player.isHuman()) - return "#" + std::to_string(player.GetPlayerId() + 1); + return "#" + std::to_string(player.getPlayerId() + 1); else return _("COMP"); } @@ -76,12 +76,12 @@ enum iwStatistics::iwStatistics(const GameWorldViewer& gwv) : IngameWindow(CGI_STATISTICS, IngameWindow::posLastOrCenter, Extent(252, 336), _("Statistics"), - LOADER.GetImageN("resource", 41)), + LOADER.getImageN("resource", 41)), gwv(gwv), showStatistic(MAX_PLAYERS) { // Count active players numPlayingPlayers = 0; - const GameWorldBase& world = gwv.GetWorld(); + const GameWorldBase& world = gwv.getWorld(); for(const auto& player : world.getPlayers()) { if(player.isUsed()) @@ -90,15 +90,15 @@ iwStatistics::iwStatistics(const GameWorldViewer& gwv) DrawPoint curBtPos = playerButtonsCenterPos - DrawPoint(numPlayingPlayers * playerBtSize.x / 2, 0); - for(const auto i : helpers::range(world.GetNumPlayers())) + for(const auto i : helpers::range(world.getNumPlayers())) { // Ignore unused players - const GamePlayer& curPlayer = world.GetPlayer(i); + const GamePlayer& curPlayer = world.getPlayer(i); if(!curPlayer.isUsed()) continue; // Set visibility based on addon setting - switch(GAMECLIENT.IsReplayModeOn() ? 0 : world.GetGGS().getSelection(AddonId::STATISTICS_VISIBILITY)) + switch(GAMECLIENT.isReplayModeOn() ? 0 : world.getGGS().getSelection(AddonId::STATISTICS_VISIBILITY)) { default: RTTR_Assert_Msg(false, "Invalid Addon Setting"); @@ -108,10 +108,10 @@ iwStatistics::iwStatistics(const GameWorldViewer& gwv) showStatistic[i] = true; break; case 1: // Only for allies - showStatistic[i] = gwv.GetPlayer().IsAlly(i); + showStatistic[i] = gwv.getPlayer().isAlly(i); break; case 2: // Only own statistic - showStatistic[i] = (gwv.GetPlayerId() == i); + showStatistic[i] = (gwv.getPlayerId() == i); break; } @@ -119,32 +119,32 @@ iwStatistics::iwStatistics(const GameWorldViewer& gwv) const auto& portrait = Portraits[curPlayer.portraitIndex]; auto* btPortrait = AddImageButton(ID_btPlayer_Start + i, curBtPos, playerBtSize, TextureColor::Green1, - LOADER.GetImageN(portrait.resourceId, portrait.resourceIndex), curPlayer.name); + LOADER.getImageN(portrait.resourceId, portrait.resourceIndex), curPlayer.name); curBtPos.x += playerBtSize.x; - btPortrait->SetBorder(false); - btPortrait->SetEnabled(showStatistic[i]); + btPortrait->setBorder(false); + btPortrait->setEnabled(showStatistic[i]); } - AddImage(ID_imgStatistic, DrawPoint(126, 165), LOADER.GetImageN("io", 228)); + AddImage(ID_imgStatistic, DrawPoint(126, 165), LOADER.getImageN("io", 228)); // Buttons for changing the statistic type shown ctrlOptionGroup* statChanger = AddOptionGroup(ID_grpStatType, GroupSelectType::Illuminate); statChanger->AddImageButton(ID_btTypeSize, DrawPoint(18, 250), Extent(26, 30), TextureColor::Grey, - LOADER.GetImageN("io", 167), _("Size of country")); + LOADER.getImageN("io", 167), _("Size of country")); statChanger->AddImageButton(ID_btTypeBuildings, DrawPoint(45, 250), Extent(26, 30), TextureColor::Grey, - LOADER.GetImageN("io", 168), _("Buildings")); + LOADER.getImageN("io", 168), _("Buildings")); statChanger->AddImageButton(ID_btTypeInhabitants, DrawPoint(72, 250), Extent(26, 30), TextureColor::Grey, - LOADER.GetImageN("io", 169), _("Inhabitants")); + LOADER.getImageN("io", 169), _("Inhabitants")); statChanger->AddImageButton(ID_btTypeMerchandise, DrawPoint(99, 250), Extent(26, 30), TextureColor::Grey, - LOADER.GetImageN("io", 170), _("Merchandise")); + LOADER.getImageN("io", 170), _("Merchandise")); statChanger->AddImageButton(ID_btTypeMilitary, DrawPoint(126, 250), Extent(26, 30), TextureColor::Grey, - LOADER.GetImageN("io", 171), _("Military strength")); + LOADER.getImageN("io", 171), _("Military strength")); statChanger->AddImageButton(ID_btTypeGold, DrawPoint(153, 250), Extent(26, 30), TextureColor::Grey, - LOADER.GetImageN("io", 172), _("Gold")); + LOADER.getImageN("io", 172), _("Gold")); statChanger->AddImageButton(ID_btTypeProductivity, DrawPoint(180, 250), Extent(26, 30), TextureColor::Grey, - LOADER.GetImageN("io", 173), _("Productivity")); + LOADER.getImageN("io", 173), _("Productivity")); statChanger->AddImageButton(ID_btTypeVanquishedEnemies, DrawPoint(207, 250), Extent(26, 30), TextureColor::Grey, - LOADER.GetImageN("io", 217), _("Vanquished enemies")); + LOADER.getImageN("io", 217), _("Vanquished enemies")); // Buttons for duration constexpr Extent timeBtSize(43, 28); @@ -154,7 +154,7 @@ iwStatistics::iwStatistics(const GameWorldViewer& gwv) timeChanger->AddTextButton(ID_time4h, DrawPoint(141, 288), timeBtSize, TextureColor::Grey, _("4 h"), NormalFont); timeChanger->AddTextButton(ID_time16h, DrawPoint(186, 288), timeBtSize, TextureColor::Grey, _("16 h"), NormalFont); - AddImageButton(ID_btHelp, DrawPoint(18, 288), Extent(30, 32), TextureColor::Grey, LOADER.GetImageN("io", 225), + AddImageButton(ID_btHelp, DrawPoint(18, 288), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); const auto labelColor = MakeColor(255, 136, 96, 52); @@ -178,13 +178,13 @@ iwStatistics::iwStatistics(const GameWorldViewer& gwv) } // Default values: - statChanger->SetSelection(ID_btTypeSize); + statChanger->setSelection(ID_btTypeSize); currentView = StatisticType::Country; - timeChanger->SetSelection(ID_time15m, true); + timeChanger->setSelection(ID_time15m, true); currentTime = StatisticTime::T15Minutes; if(!SETTINGS.ingame.scaleStatistics) - txtMinValueY->SetVisible(false); + txtMinValueY->setVisible(false); } iwStatistics::~iwStatistics() = default; @@ -213,35 +213,35 @@ void iwStatistics::msgOptionGroupChange(const unsigned ctrl_id, const unsigned s { case ID_btTypeSize: currentView = StatisticType::Country; - headline->SetText(_("Size of country")); + headline->setText(_("Size of country")); break; case ID_btTypeBuildings: currentView = StatisticType::Buildings; - headline->SetText(_("Buildings")); + headline->setText(_("Buildings")); break; case ID_btTypeInhabitants: currentView = StatisticType::Inhabitants; - headline->SetText(_("Inhabitants")); + headline->setText(_("Inhabitants")); break; case ID_btTypeMerchandise: currentView = StatisticType::Merchandise; - headline->SetText(_("Merchandise")); + headline->setText(_("Merchandise")); break; case ID_btTypeMilitary: currentView = StatisticType::Military; - headline->SetText(_("Military strength")); + headline->setText(_("Military strength")); break; case ID_btTypeGold: currentView = StatisticType::Gold; - headline->SetText(_("Gold")); + headline->setText(_("Gold")); break; case ID_btTypeProductivity: currentView = StatisticType::Productivity; - headline->SetText(_("Productivity")); + headline->setText(_("Productivity")); break; case ID_btTypeVanquishedEnemies: currentView = StatisticType::Vanquished; - headline->SetText(_("Vanquished enemies")); + headline->setText(_("Vanquished enemies")); break; } break; @@ -271,11 +271,11 @@ void iwStatistics::DrawContent() void iwStatistics::DrawPlayerOverlays() { - DrawPoint drawPt = GetDrawPos() + playerButtonsCenterPos - DrawPoint(numPlayingPlayers * playerBtSize.x / 2, 0); + DrawPoint drawPt = getDrawPos() + playerButtonsCenterPos - DrawPoint(numPlayingPlayers * playerBtSize.x / 2, 0); - for(const auto i : helpers::range(gwv.GetWorld().GetNumPlayers())) + for(const auto i : helpers::range(gwv.getWorld().getNumPlayers())) { - const GamePlayer& player = gwv.GetWorld().GetPlayer(i); + const GamePlayer& player = gwv.getWorld().getPlayer(i); if(!player.isUsed()) continue; @@ -307,11 +307,11 @@ void iwStatistics::DrawPlayerAlliances(DrawPoint const& drawPt, const GamePlayer constexpr unsigned allianceRectOffset = allianceRectExtent.x + spacingAllianceRects; auto pactPos = drawPt + DrawPoint::all(spacingAllianceRects); - for(auto idxOther : helpers::range(gwv.GetWorld().GetNumPlayers())) + for(auto idxOther : helpers::range(gwv.getWorld().getNumPlayers())) { - if(idxOther != player.GetPlayerId() && player.IsAlly(idxOther)) + if(idxOther != player.getPlayerId() && player.isAlly(idxOther)) { - DrawRectangle(Rect(pactPos, allianceRectExtent), gwv.GetWorld().GetPlayer(idxOther).color); + DrawRectangle(Rect(pactPos, allianceRectExtent), gwv.getWorld().getPlayer(idxOther).color); pactPos.x += allianceRectOffset; } } @@ -322,12 +322,12 @@ void iwStatistics::DrawStatistic(StatisticType type) // Find min and max value unsigned max = 1; auto min = std::numeric_limits::max(); - const GameWorldBase& world = gwv.GetWorld(); - for(const auto p : helpers::range(world.GetNumPlayers())) + const GameWorldBase& world = gwv.getWorld(); + for(const auto p : helpers::range(world.getNumPlayers())) { if(!showStatistic[p]) continue; - const GamePlayer::Statistic& stat = world.GetPlayer(p).GetStatistic(currentTime); + const GamePlayer::Statistic& stat = world.getPlayer(p).getStatistic(currentTime); const auto currentIndex = stat.currentIndex; for(const auto i : helpers::range(NUM_STAT_STEPS)) @@ -345,20 +345,20 @@ void iwStatistics::DrawStatistic(StatisticType type) ++max; } // Add values to axis - txtMaxValueY->SetText(std::to_string(max)); + txtMaxValueY->setText(std::to_string(max)); if(SETTINGS.ingame.scaleStatistics) - txtMinValueY->SetText(std::to_string(min)); + txtMinValueY->setText(std::to_string(min)); // Draw the line diagram - const DrawPoint topLeft = GetPos() + topLeftRel; + const DrawPoint topLeft = getPos() + topLeftRel; DrawPoint previousPos; - for(const auto p : helpers::range(world.GetNumPlayers())) + for(const auto p : helpers::range(world.getNumPlayers())) { if(!showStatistic[p]) continue; - const GamePlayer::Statistic& stat = world.GetPlayer(p).GetStatistic(currentTime); - const auto playerColor = world.GetPlayer(p).color; + const GamePlayer::Statistic& stat = world.getPlayer(p).getStatistic(currentTime); + const auto playerColor = world.getPlayer(p).color; const auto currentIndex = stat.currentIndex; for(const auto i : helpers::range(NUM_STAT_STEPS)) @@ -379,7 +379,7 @@ void iwStatistics::DrawStatistic(StatisticType type) void iwStatistics::DrawAxis() { - const DrawPoint topLeft = GetPos() + topLeftRel; + const DrawPoint topLeft = getPos() + topLeftRel; const auto axisColor = MakeColor(255, 88, 44, 16); // X-axis, horizontal @@ -398,9 +398,9 @@ void iwStatistics::DrawAxis() // Marks on x-axis for(const auto* lbl : timeAnnotations) { - if(lbl->IsVisible()) + if(lbl->isVisible()) { - const auto lblPos = lbl->GetDrawPos(); + const auto lblPos = lbl->getDrawPos(); DrawLine(lblPos - DrawPoint(0, 4), lblPos - DrawPoint(0, 2), 1, axisColor); } } @@ -414,34 +414,34 @@ void iwStatistics::updateTimeAxisLabels() switch(currentTime) { case StatisticTime::T15Minutes: - timeAnnotations[1]->SetText("-15"); - timeAnnotations[2]->SetText("-12"); - timeAnnotations[3]->SetText("-9"); - timeAnnotations[4]->SetText("-6"); - timeAnnotations[5]->SetText("-3"); + timeAnnotations[1]->setText("-15"); + timeAnnotations[2]->setText("-12"); + timeAnnotations[3]->setText("-9"); + timeAnnotations[4]->setText("-6"); + timeAnnotations[5]->setText("-3"); numMarks = 6; break; case StatisticTime::T1Hour: - timeAnnotations[1]->SetText("-60"); - timeAnnotations[2]->SetText("-50"); - timeAnnotations[3]->SetText("-40"); - timeAnnotations[4]->SetText("-30"); - timeAnnotations[5]->SetText("-20"); - timeAnnotations[6]->SetText("-10"); + timeAnnotations[1]->setText("-60"); + timeAnnotations[2]->setText("-50"); + timeAnnotations[3]->setText("-40"); + timeAnnotations[4]->setText("-30"); + timeAnnotations[5]->setText("-20"); + timeAnnotations[6]->setText("-10"); numMarks = 7; break; case StatisticTime::T4Hours: - timeAnnotations[1]->SetText("-240"); - timeAnnotations[2]->SetText("-180"); - timeAnnotations[3]->SetText("-120"); - timeAnnotations[4]->SetText("-60"); + timeAnnotations[1]->setText("-240"); + timeAnnotations[2]->setText("-180"); + timeAnnotations[3]->setText("-120"); + timeAnnotations[4]->setText("-60"); numMarks = 5; break; case StatisticTime::T16Hours: - timeAnnotations[1]->SetText("-960"); - timeAnnotations[2]->SetText("-720"); - timeAnnotations[3]->SetText("-480"); - timeAnnotations[4]->SetText("-240"); + timeAnnotations[1]->setText("-960"); + timeAnnotations[2]->setText("-720"); + timeAnnotations[3]->setText("-480"); + timeAnnotations[4]->setText("-240"); numMarks = 5; break; } @@ -449,14 +449,14 @@ void iwStatistics::updateTimeAxisLabels() DrawPoint curPos = topLeftRel + offset + DrawPoint(0, diagramSize.y); for(const auto i : helpers::range(1, numMarks)) { - timeAnnotations[i]->SetPos(curPos); - timeAnnotations[i]->SetVisible(true); + timeAnnotations[i]->setPos(curPos); + timeAnnotations[i]->setVisible(true); curPos.x += (diagramSize.x - offset.x) / (numMarks - 1); } for(const auto i : helpers::range(numMarks, timeAnnotations.size())) - timeAnnotations[i]->SetVisible(false); + timeAnnotations[i]->setVisible(false); // Zero is used for all time periods - timeAnnotations[0]->SetPos(topLeftRel + diagramSize + DrawPoint(0, offset.y)); // Exactly at the end of the x-axis - timeAnnotations[0]->SetText("0"); + timeAnnotations[0]->setPos(topLeftRel + diagramSize + DrawPoint(0, offset.y)); // Exactly at the end of the x-axis + timeAnnotations[0]->setText("0"); } diff --git a/libs/s25main/ingameWindows/iwSurrender.cpp b/libs/s25main/ingameWindows/iwSurrender.cpp index 87c892b1ff..92abda3ce8 100644 --- a/libs/s25main/ingameWindows/iwSurrender.cpp +++ b/libs/s25main/ingameWindows/iwSurrender.cpp @@ -9,16 +9,16 @@ iwSurrender::iwSurrender() : IngameWindow(CGI_ENDGAME, IngameWindow::posLastOrCenter, Extent(240, 100), _("Surrender game?"), - LOADER.GetImageN("resource", 41)) + LOADER.getImageN("resource", 41)) { // Ok - AddImageButton(0, DrawPoint(85, 24), Extent(68, 57), TextureColor::Green2, LOADER.GetImageN("io", 32), + AddImageButton(0, DrawPoint(85, 24), Extent(68, 57), TextureColor::Green2, LOADER.getImageN("io", 32), _("Surrender")); // Ok + Abbrennen - AddImageButton(2, DrawPoint(16, 24), Extent(68, 57), TextureColor::Green2, LOADER.GetImageN("io", 23), + AddImageButton(2, DrawPoint(16, 24), Extent(68, 57), TextureColor::Green2, LOADER.getImageN("io", 23), _("Destroy all buildings and surrender")); // Abbrechen - AddImageButton(1, DrawPoint(158, 24), Extent(68, 57), TextureColor::Red1, LOADER.GetImageN("io", 40), + AddImageButton(1, DrawPoint(158, 24), Extent(68, 57), TextureColor::Red1, LOADER.getImageN("io", 40), _("Don't surrender")); } diff --git a/libs/s25main/ingameWindows/iwTempleBuilding.cpp b/libs/s25main/ingameWindows/iwTempleBuilding.cpp index e5fec22d70..f656717848 100644 --- a/libs/s25main/ingameWindows/iwTempleBuilding.cpp +++ b/libs/s25main/ingameWindows/iwTempleBuilding.cpp @@ -13,10 +13,10 @@ iwTempleBuilding::iwTempleBuilding(GameWorldView& gwv, GameCommandFactory& gcFactory, nobUsual* const building) : iwBuilding(gwv, gcFactory, building, Extent(226, 223)) { - GetCtrl(1)->SetPos(DrawPoint(117, 160)); - GetCtrl(3)->SetImage(wineaddon::GetTempleProductionModeTex(ProductionMode::Default)); + getCtrl(1)->setPos(DrawPoint(117, 160)); + getCtrl(3)->setImage(wineaddon::getTempleProductionModeTex(ProductionMode::Default)); AddImageButton(8, DrawPoint(130, 176), Extent(34, 32), TextureColor::Grey, - wineaddon::GetTempleProductionModeTex(static_cast(building)->GetProductionMode()), + wineaddon::getTempleProductionModeTex(static_cast(building)->getProductionMode()), _("Output mineral")); } @@ -25,10 +25,10 @@ void iwTempleBuilding::msgButtonClick(const unsigned ctrl_id) if(ctrl_id == 8) { const auto nextProductionMode = static_cast(building)->getNextProductionMode(); - if(gcFactory.SetTempleProductionMode(building->GetPos(), nextProductionMode)) + if(gcFactory.SetTempleProductionMode(building->getPos(), nextProductionMode)) { - GetCtrl(8)->SetImage(wineaddon::GetTempleProductionModeTex(nextProductionMode)); - static_cast(building)->SetProductionMode(nextProductionMode); + getCtrl(8)->setImage(wineaddon::getTempleProductionModeTex(nextProductionMode)); + static_cast(building)->setProductionMode(nextProductionMode); } } else iwBuilding::msgButtonClick(ctrl_id); diff --git a/libs/s25main/ingameWindows/iwTextfile.cpp b/libs/s25main/ingameWindows/iwTextfile.cpp index d347a9cfae..a4778f5f58 100644 --- a/libs/s25main/ingameWindows/iwTextfile.cpp +++ b/libs/s25main/ingameWindows/iwTextfile.cpp @@ -26,10 +26,10 @@ namespace bfs = boost::filesystem; * schlecht. */ iwTextfile::iwTextfile(const std::string& filename, const std::string& title) - : IngameWindow(CGI_README, IngameWindow::posLastOrCenter, Extent(640, 480), title, LOADER.GetImageN("resource", 41)) + : IngameWindow(CGI_README, IngameWindow::posLastOrCenter, Extent(640, 480), title, LOADER.getImageN("resource", 41)) { ctrlMultiline* text = - AddMultiline(2, DrawPoint(10, 20), Extent(GetSize().x - 20, 450), TextureColor::Green1, NormalFont); + AddMultiline(2, DrawPoint(10, 20), Extent(getSize().x - 20, 450), TextureColor::Green1, NormalFont); // Pfad mit gewählter Sprache auswählen std::vector paths; @@ -52,6 +52,6 @@ iwTextfile::iwTextfile(const std::string& filename, const std::string& title) text->AddString(stream.str(), COLOR_YELLOW, false); } - text->SetWidth(text->GetContentSize().x); - SetIwSize(Extent(text->GetSize().x, GetIwSize().y)); + text->setWidth(text->getContentSize().x); + setIwSize(Extent(text->getSize().x, getIwSize().y)); } diff --git a/libs/s25main/ingameWindows/iwTools.cpp b/libs/s25main/ingameWindows/iwTools.cpp index dd661a2734..acecd533a5 100644 --- a/libs/s25main/ingameWindows/iwTools.cpp +++ b/libs/s25main/ingameWindows/iwTools.cpp @@ -28,16 +28,16 @@ iwTools::iwTools(const GameWorldViewer& gwv, GameCommandFactory& gcFactory) : TransmitSettingsIgwAdapter( CGI_TOOLS, IngameWindow::posLastOrCenter, - Extent(166 + (gwv.GetWorld().GetGGS().isEnabled(AddonId::TOOL_ORDERING) ? 46 : 0), 432), _("Tools"), - LOADER.GetImageN("io", 5)), + Extent(166 + (gwv.getWorld().getGGS().isEnabled(AddonId::TOOL_ORDERING) ? 46 : 0), 432), _("Tools"), + LOADER.getImageN("io", 5)), gwv(gwv), gcFactory(gcFactory), ordersChanged(false), shouldUpdateTexts(false), - isReplay(GAMECLIENT.IsReplayModeOn()) + isReplay(GAMECLIENT.isReplayModeOn()) { // Einzelne Balken for(const auto tool : helpers::enumRange()) AddToolSettingSlider(rttr::enum_cast(tool), TOOL_TO_GOOD[tool]); - const GlobalGameSettings& settings = gwv.GetWorld().GetGGS(); + const GlobalGameSettings& settings = gwv.getWorld().getGGS(); if(settings.isEnabled(AddonId::TOOL_ORDERING)) { // qx:tools @@ -49,30 +49,30 @@ iwTools::iwTools(const GameWorldViewer& gwv, GameCommandFactory& gcFactory) AddTextDeepening(200 + toolIdx, DrawPoint(151, 31 + toolIdx * 28), Extent(22, 18), TextureColor::Grey, "", NormalFont, COLOR_YELLOW)); txt->ResizeForMaxChars(2); - const auto txtSize = txt->GetSize(); - ctrlButton* bt = AddImageButton(100 + toolIdx * 2, txt->GetPos() + DrawPoint(txtSize.x + 1, -4), btSize, - TextureColor::Grey, LOADER.GetImageN("io", 33), "+1"); - AddImageButton(101 + toolIdx * 2, bt->GetPos() + DrawPoint(0, btSize.y), btSize, TextureColor::Grey, - LOADER.GetImageN("io", 34), "-1"); + const auto txtSize = txt->getSize(); + ctrlButton* bt = AddImageButton(100 + toolIdx * 2, txt->getPos() + DrawPoint(txtSize.x + 1, -4), btSize, + TextureColor::Grey, LOADER.getImageN("io", 33), "+1"); + AddImageButton(101 + toolIdx * 2, bt->getPos() + DrawPoint(0, btSize.y), btSize, TextureColor::Grey, + LOADER.getImageN("io", 34), "-1"); } std::fill(pendingOrderChanges.begin(), pendingOrderChanges.end(), 0); UpdateTexts(); } // Info - AddImageButton(12, DrawPoint(18, 384), Extent(30, 32), TextureColor::Grey, LOADER.GetImageN("io", 225), _("Help")); + AddImageButton(12, DrawPoint(18, 384), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); if(settings.isEnabled(AddonId::TOOL_ORDERING)) - AddImageButton(15, DrawPoint(130, 384), Extent(30, 32), TextureColor::Grey, LOADER.GetImageN("io", 216), + AddImageButton(15, DrawPoint(130, 384), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 216), _("Zero all production")); // Standard AddImageButton(13, DrawPoint(118 + (settings.isEnabled(AddonId::TOOL_ORDERING) ? 46 : 0), 384), Extent(30, 32), - TextureColor::Grey, LOADER.GetImageN("io", 191), _("Default")); + TextureColor::Grey, LOADER.getImageN("io", 191), _("Default")); // Einstellungen festlegen UpdateSettings(); toolSubscription = - gwv.GetWorld().GetNotifications().subscribe([this](auto) noexcept { this->shouldUpdateTexts = true; }); + gwv.getWorld().getNotifications().subscribe([this](auto) noexcept { this->shouldUpdateTexts = true; }); } void iwTools::AddToolSettingSlider(unsigned id, GoodType ware) @@ -95,16 +95,16 @@ void iwTools::TransmitSettings() // Einstellungen speichern ToolSettings newSettings; for(const auto tool : helpers::enumRange()) - newSettings[tool] = static_cast(GetCtrl(rttr::enum_cast(tool))->GetPosition()); + newSettings[tool] = static_cast(getCtrl(rttr::enum_cast(tool))->getPosition()); int8_t* orderDelta = nullptr; if(ordersChanged) { orderDelta = pendingOrderChanges.data(); - const GamePlayer& localPlayer = gwv.GetPlayer(); + const GamePlayer& localPlayer = gwv.getPlayer(); for(const auto tool : helpers::enumRange()) { - auto curOrder = static_cast(localPlayer.GetToolsOrderedVisual(tool)); + auto curOrder = static_cast(localPlayer.getToolsOrderedVisual(tool)); pendingOrderChanges[tool] = helpers::clamp(pendingOrderChanges[tool], -curOrder, 100 - curOrder); } } @@ -114,7 +114,7 @@ void iwTools::TransmitSettings() GAMECLIENT.visual_settings.tools_settings = newSettings; if(ordersChanged) { - const GamePlayer& localPlayer = gwv.GetPlayer(); + const GamePlayer& localPlayer = gwv.getPlayer(); for(const auto tool : helpers::enumRange()) localPlayer.ChangeToolOrderVisual(tool, pendingOrderChanges[tool]); std::fill(pendingOrderChanges.begin(), pendingOrderChanges.end(), 0); @@ -127,15 +127,15 @@ void iwTools::TransmitSettings() void iwTools::UpdateTexts() { - if(gwv.GetWorld().GetGGS().isEnabled(AddonId::TOOL_ORDERING)) + if(gwv.getWorld().getGGS().isEnabled(AddonId::TOOL_ORDERING)) { - const GamePlayer& localPlayer = gwv.GetPlayer(); + const GamePlayer& localPlayer = gwv.getPlayer(); for(const auto tool : helpers::enumRange()) { - auto* field = GetCtrl(200 + rttr::enum_cast(tool)); - int curOrders = isReplay ? localPlayer.GetToolsOrdered(tool) : - localPlayer.GetToolsOrderedVisual(tool) + pendingOrderChanges[tool]; - field->SetText(helpers::toString(curOrders)); + auto* field = getCtrl(200 + rttr::enum_cast(tool)); + int curOrders = isReplay ? localPlayer.getToolsOrdered(tool) : + localPlayer.getToolsOrderedVisual(tool) + pendingOrderChanges[tool]; + field->setText(helpers::toString(curOrders)); } } } @@ -159,7 +159,7 @@ void iwTools::msgButtonClick(const unsigned ctrl_id) if(ctrl_id >= 100 && ctrl_id < (100 + 2 * helpers::NumEnumValues_v)) { const auto tool = static_cast((ctrl_id - 100) / 2); - int curOrders = gwv.GetPlayer().GetToolsOrderedVisual(tool) + pendingOrderChanges[tool]; + int curOrders = gwv.getPlayer().getToolsOrderedVisual(tool) + pendingOrderChanges[tool]; if(ctrl_id & 0x1) { @@ -175,7 +175,7 @@ void iwTools::msgButtonClick(const unsigned ctrl_id) ++curOrders; } ordersChanged = true; - GetCtrl(200 + rttr::enum_cast(tool))->SetText(helpers::toString(curOrders)); + getCtrl(200 + rttr::enum_cast(tool))->setText(helpers::toString(curOrders)); } else switch(ctrl_id) { @@ -208,7 +208,7 @@ void iwTools::UpdateSettings(const ToolSettings& tool_settings) if(isReplay) GAMECLIENT.ResetVisualSettings(); for(const auto tool : helpers::enumRange()) - GetCtrl(rttr::enum_cast(tool))->SetPosition(tool_settings[tool]); + getCtrl(rttr::enum_cast(tool))->setPosition(tool_settings[tool]); } void iwTools::UpdateSettings() diff --git a/libs/s25main/ingameWindows/iwTrade.cpp b/libs/s25main/ingameWindows/iwTrade.cpp index 0f8aaea035..6836f2b30f 100644 --- a/libs/s25main/ingameWindows/iwTrade.cpp +++ b/libs/s25main/ingameWindows/iwTrade.cpp @@ -24,14 +24,14 @@ #include "gameData/const_gui_ids.h" iwTrade::iwTrade(const nobBaseWarehouse& wh, const GameWorldViewer& gwv, GameCommandFactory& gcFactory) - : IngameWindow(CGI_BUILDING + MapBase::CreateGUIID(wh.GetPos()), IngameWindow::posAtMouse, Extent(400, 194), - _("Trade"), LOADER.GetImageN("resource", 41)), - wh(wh), gwv(gwv), gcFactory(gcFactory), possibleSrcWarehouses(gwv.GetPlayer().GetWarehousesForTrading(wh)) + : IngameWindow(CGI_BUILDING + MapBase::CreateGUIID(wh.getPos()), IngameWindow::posAtMouse, Extent(400, 194), + _("Trade"), LOADER.getImageN("resource", 41)), + wh(wh), gwv(gwv), gcFactory(gcFactory), possibleSrcWarehouses(gwv.getPlayer().getWarehousesForTrading(wh)) { // Get title of the player - SetTitle((boost::format(_("Trade with %s")) % gwv.GetWorld().GetPlayer(wh.GetPlayer()).name).str()); + setTitle((boost::format(_("Trade with %s")) % gwv.getWorld().getPlayer(wh.getPlayer()).name).str()); // Gebäudebild und dessen Schatten - AddImage(0, DrawPoint(100, 144), &wh.GetBuildingImage()); + AddImage(0, DrawPoint(100, 144), &wh.getBuildingImage()); const unsigned left_column = 200; @@ -65,33 +65,33 @@ iwTrade::iwTrade(const nobBaseWarehouse& wh, const GameWorldViewer& gwv, GameCom AddImage(5, DrawPoint(left_column + 20, 130), static_cast(nullptr), _("Ware you like to trade")); AddEdit(6, DrawPoint(left_column + 34, 120), Extent(39, 20), TextureColor::Grey, NormalFont) - ->SetType(EditType::Number); + ->setType(EditType::Number); AddText(7, DrawPoint(left_column + 75, 125), "/ 20", COLOR_YELLOW, FontStyle::LEFT, NormalFont); AddTextButton(8, DrawPoint(left_column, 150), Extent(150, 22), TextureColor::Green2, _("Send"), NormalFont); // Choose wares at first - box->SetSelection(0); + box->setSelection(0); msgComboSelectItem(2, 0); } void iwTrade::msgButtonClick(const unsigned /*ctrl_id*/) { // pressed the send button - const unsigned ware_figure_selection = GetCtrl(4)->GetSelection().value(); - const bool isJob = this->GetCtrl(2)->GetSelection() == 1u; + const unsigned ware_figure_selection = getCtrl(4)->getSelection().value(); + const bool isJob = this->getCtrl(2)->getSelection() == 1u; boost_variant2 what; if(isJob) what = jobs[ware_figure_selection]; else what = wares[ware_figure_selection]; - const std::string number_str = GetCtrl(6)->GetText(); + const std::string number_str = getCtrl(6)->getText(); // Start trading - if(!GetCtrl(4)->GetCtrl(0)->IsVisible() && helpers::fromString(number_str, 0) > 0) + if(!getCtrl(4)->getCtrl(0)->isVisible() && helpers::fromString(number_str, 0) > 0) { - if(gcFactory.TradeOverLand(wh.GetPos(), what, helpers::fromString(number_str, 0))) + if(gcFactory.TradeOverLand(wh.getPos(), what, helpers::fromString(number_str, 0))) this->Close(); } } @@ -103,7 +103,7 @@ void iwTrade::msgComboSelectItem(const unsigned ctrl_id, const unsigned selectio // Change ware/figure mode case 2: { - auto* names = this->GetCtrl(4); + auto* names = this->getCtrl(4); names->DeleteAllItems(); if(selection == 0) { @@ -117,56 +117,56 @@ void iwTrade::msgComboSelectItem(const unsigned ctrl_id, const unsigned selectio for(Job job : jobs) names->AddItem(_(JOB_NAMES[job])); } - names->SetSelection(0); + names->setSelection(0); msgComboSelectItem(4, 0); } break; case 4: { unsigned number; - if(this->GetCtrl(2)->GetSelection() == 0u) + if(this->getCtrl(2)->getSelection() == 0u) { // Wares // Set the new image of the ware which was selected - GetCtrl(5)->SetImage(LOADER.GetWareTex(wares[selection])); + getCtrl(5)->setImage(LOADER.getWareTex(wares[selection])); // Get the number of available wares - number = GetPossibleTradeAmount(wares[selection]); + number = getPossibleTradeAmount(wares[selection]); } else { - GetCtrl(5)->SetImage(LOADER.GetJobTex(jobs[selection])); + getCtrl(5)->setImage(LOADER.getJobTex(jobs[selection])); // Get the number of available figures - number = GetPossibleTradeAmount(jobs[selection]); + number = getPossibleTradeAmount(jobs[selection]); } - GetCtrl(7)->SetText("/ " + helpers::toString(number)); + getCtrl(7)->setText("/ " + helpers::toString(number)); } break; } } -unsigned iwTrade::GetPossibleTradeAmount(const Job job) const +unsigned iwTrade::getPossibleTradeAmount(const Job job) const { - const GamePlayer& player = gwv.GetPlayer(); + const GamePlayer& player = gwv.getPlayer(); unsigned amount = 0; for(auto* possibleSrcWarehouse : possibleSrcWarehouses) { - if(player.IsWarehouseValid(possibleSrcWarehouse)) - amount += possibleSrcWarehouse->GetAvailableFiguresForTrading(job); + if(player.isWarehouseValid(possibleSrcWarehouse)) + amount += possibleSrcWarehouse->getAvailableFiguresForTrading(job); } return amount; } -unsigned iwTrade::GetPossibleTradeAmount(const GoodType good) const +unsigned iwTrade::getPossibleTradeAmount(const GoodType good) const { - const GamePlayer& player = gwv.GetPlayer(); + const GamePlayer& player = gwv.getPlayer(); unsigned amount = 0; for(auto* possibleSrcWarehouse : possibleSrcWarehouses) { - if(player.IsWarehouseValid(possibleSrcWarehouse)) - amount += possibleSrcWarehouse->GetAvailableWaresForTrading(good); + if(player.isWarehouseValid(possibleSrcWarehouse)) + amount += possibleSrcWarehouse->getAvailableWaresForTrading(good); } return amount; } diff --git a/libs/s25main/ingameWindows/iwTrade.h b/libs/s25main/ingameWindows/iwTrade.h index 90a14a83f6..0c1077ab95 100644 --- a/libs/s25main/ingameWindows/iwTrade.h +++ b/libs/s25main/ingameWindows/iwTrade.h @@ -30,6 +30,6 @@ class iwTrade final : public IngameWindow private: void msgButtonClick(unsigned ctrl_id) override; void msgComboSelectItem(unsigned ctrl_id, unsigned selection) override; - unsigned GetPossibleTradeAmount(Job job) const; - unsigned GetPossibleTradeAmount(GoodType good) const; + unsigned getPossibleTradeAmount(Job job) const; + unsigned getPossibleTradeAmount(GoodType good) const; }; diff --git a/libs/s25main/ingameWindows/iwTransport.cpp b/libs/s25main/ingameWindows/iwTransport.cpp index 21376d01fa..a5dd9ff7c4 100644 --- a/libs/s25main/ingameWindows/iwTransport.cpp +++ b/libs/s25main/ingameWindows/iwTransport.cpp @@ -22,47 +22,47 @@ void iwTransport::fillTransportOrder(const TransportOrders& transport_order) { pendingOrder.assign(transport_order.begin(), transport_order.end()); - if(!leatheraddon::isAddonActive(gwv.GetWorld())) + if(!leatheraddon::isAddonActive(gwv.getWorld())) helpers::erase(pendingOrder, STD_TRANSPORT_PRIO[GoodType::Leather]); } iwTransport::iwTransport(const GameWorldViewer& gwv, GameCommandFactory& gcFactory) : TransmitSettingsIgwAdapter(CGI_TRANSPORT, IngameWindow::posLastOrCenter, Extent(166, 333), _("Transport"), - LOADER.GetImageN("io", 5)), + LOADER.getImageN("io", 5)), gwv(gwv), gcFactory(gcFactory) { unsigned btOffsetY = 0; - if(leatheraddon::isAddonActive(gwv.GetWorld())) + if(leatheraddon::isAddonActive(gwv.getWorld())) { btOffsetY = 17; Resize(Extent(166, 333 + btOffsetY)); } - AddImageButton(0, DrawPoint(18, 285 + btOffsetY), Extent(30, 30), TextureColor::Grey, LOADER.GetImageN("io", 225), + AddImageButton(0, DrawPoint(18, 285 + btOffsetY), Extent(30, 30), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); // Standard - AddImageButton(1, DrawPoint(60, 285 + btOffsetY), Extent(48, 30), TextureColor::Grey, LOADER.GetImageN("io", 191), + AddImageButton(1, DrawPoint(60, 285 + btOffsetY), Extent(48, 30), TextureColor::Grey, LOADER.getImageN("io", 191), _("Default")); // ganz hoch - AddImageButton(2, DrawPoint(118, 235 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.GetImageN("io", 215), + AddImageButton(2, DrawPoint(118, 235 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.getImageN("io", 215), _("Top")); // hoch - AddImageButton(3, DrawPoint(118, 255 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.GetImageN("io", 33), + AddImageButton(3, DrawPoint(118, 255 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.getImageN("io", 33), _("Up")); // runter - AddImageButton(4, DrawPoint(118, 275 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.GetImageN("io", 34), + AddImageButton(4, DrawPoint(118, 275 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.getImageN("io", 34), _("Down")); // ganz runter - AddImageButton(5, DrawPoint(118, 295 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.GetImageN("io", 216), + AddImageButton(5, DrawPoint(118, 295 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.getImageN("io", 216), _("Bottom")); // Buttons der einzelnen Waren anlegen ctrlOptionGroup* group = AddOptionGroup(6, GroupSelectType::Illuminate); - auto getGoodTex = [](GoodType good) { return LOADER.GetWareTex(good); }; + auto getGoodTex = [](GoodType good) { return LOADER.getWareTex(good); }; buttonData = {{{getGoodTex(GoodType::Coins), WARE_NAMES[GoodType::Coins]}, - {LOADER.GetTextureN("io", 111), gettext_noop("Weapons")}, + {LOADER.getTextureN("io", 111), gettext_noop("Weapons")}, {getGoodTex(GoodType::Beer), WARE_NAMES[GoodType::Beer]}, {getGoodTex(GoodType::Iron), WARE_NAMES[GoodType::Iron]}, {getGoodTex(GoodType::Gold), WARE_NAMES[GoodType::Gold]}, @@ -73,7 +73,7 @@ iwTransport::iwTransport(const GameWorldViewer& gwv, GameCommandFactory& gcFacto {getGoodTex(GoodType::Stones), WARE_NAMES[GoodType::Stones]}, {getGoodTex(GoodType::Wood), WARE_NAMES[GoodType::Wood]}, {getGoodTex(GoodType::Water), WARE_NAMES[GoodType::Water]}, - {LOADER.GetTextureN("io", 80), gettext_noop("Food")}, + {LOADER.getTextureN("io", 80), gettext_noop("Food")}, {getGoodTex(GoodType::Hammer), gettext_noop("Tools")}, {getGoodTex(GoodType::Boat), WARE_NAMES[GoodType::Boat]}}}; @@ -103,12 +103,12 @@ iwTransport::iwTransport(const GameWorldViewer& gwv, GameCommandFactory& gcFacto group->AddImageButton(i, BUTTON_POS[i], Extent(30, 30), TextureColor::Grey, buttonData[pendingOrder[i]].sprite, _(buttonData[pendingOrder[i]].tooltip)); } - group->SetSelection(0); + group->setSelection(0); } void iwTransport::TransmitSettings() { - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) return; if(settings_changed) { @@ -117,7 +117,7 @@ void iwTransport::TransmitSettings() for(; i < pendingOrder.size(); i++) transmitPendingTransportOrder[i] = pendingOrder[i]; - if(!leatheraddon::isAddonActive(gwv.GetWorld())) + if(!leatheraddon::isAddonActive(gwv.getWorld())) { // This is not an OBB write because pendingOrder does not contain the leather entry // when the addon is inactive. So the pendingOrder list is one entry shorter then @@ -136,7 +136,7 @@ void iwTransport::TransmitSettings() void iwTransport::msgButtonClick(const unsigned ctrl_id) { - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) return; switch(ctrl_id) { @@ -150,14 +150,14 @@ void iwTransport::msgButtonClick(const unsigned ctrl_id) break; case 1: // Standardbelegung { - auto* group = GetCtrl(6); + auto* group = getCtrl(6); fillTransportOrder(GAMECLIENT.default_settings.transport_order); for(unsigned char i = 0; i < pendingOrder.size(); ++i) { const auto& data = buttonData[pendingOrder[i]]; - group->GetCtrl(i)->SetImage(data.sprite); - group->GetCtrl(i)->SetTooltip(_(data.tooltip)); + group->getCtrl(i)->setImage(data.sprite); + group->getCtrl(i)->setTooltip(_(data.tooltip)); } settings_changed = true; @@ -165,17 +165,17 @@ void iwTransport::msgButtonClick(const unsigned ctrl_id) break; case 2: // ganz hoch { - auto* group = GetCtrl(6); + auto* group = getCtrl(6); // Wenn wir schon ganz oben sind, gehts nicht weiter höher - while(group->GetSelection() > 0) + while(group->getSelection() > 0) { - std::swap(pendingOrder[group->GetSelection()], pendingOrder[group->GetSelection() - 1]); - ctrlImageButton& btPrev = *group->GetCtrl(group->GetSelection() - 1); - ctrlImageButton& btNext = *group->GetCtrl(group->GetSelection()); + std::swap(pendingOrder[group->getSelection()], pendingOrder[group->getSelection() - 1]); + ctrlImageButton& btPrev = *group->getCtrl(group->getSelection() - 1); + ctrlImageButton& btNext = *group->getCtrl(group->getSelection()); btPrev.SwapImage(btNext); btPrev.SwapTooltip(btNext); - group->SetSelection(group->GetSelection() - 1); + group->setSelection(group->getSelection() - 1); } settings_changed = true; @@ -183,17 +183,17 @@ void iwTransport::msgButtonClick(const unsigned ctrl_id) break; case 3: // hoch { - auto* group = GetCtrl(6); + auto* group = getCtrl(6); // Wenn wir schon ganz oben sind, gehts nicht weiter höher - if(group->GetSelection() > 0) + if(group->getSelection() > 0) { - std::swap(pendingOrder[group->GetSelection()], pendingOrder[group->GetSelection() - 1]); - ctrlImageButton& btPrev = *group->GetCtrl(group->GetSelection() - 1); - ctrlImageButton& btNext = *group->GetCtrl(group->GetSelection()); + std::swap(pendingOrder[group->getSelection()], pendingOrder[group->getSelection() - 1]); + ctrlImageButton& btPrev = *group->getCtrl(group->getSelection() - 1); + ctrlImageButton& btNext = *group->getCtrl(group->getSelection()); btPrev.SwapImage(btNext); btPrev.SwapTooltip(btNext); - group->SetSelection(group->GetSelection() - 1); + group->setSelection(group->getSelection() - 1); } settings_changed = true; @@ -201,17 +201,17 @@ void iwTransport::msgButtonClick(const unsigned ctrl_id) break; case 4: // runter { - auto* group = GetCtrl(6); + auto* group = getCtrl(6); // Wenn wir schon ganz unten sind, gehts nicht weiter runter - if(group->GetSelection() + 1 < pendingOrder.size()) + if(group->getSelection() + 1 < pendingOrder.size()) { - std::swap(pendingOrder[group->GetSelection()], pendingOrder[group->GetSelection() + 1]); - ctrlImageButton& btPrev = *group->GetCtrl(group->GetSelection()); - ctrlImageButton& btNext = *group->GetCtrl(group->GetSelection() + 1); + std::swap(pendingOrder[group->getSelection()], pendingOrder[group->getSelection() + 1]); + ctrlImageButton& btPrev = *group->getCtrl(group->getSelection()); + ctrlImageButton& btNext = *group->getCtrl(group->getSelection() + 1); btPrev.SwapImage(btNext); btPrev.SwapTooltip(btNext); - group->SetSelection(group->GetSelection() + 1); + group->setSelection(group->getSelection() + 1); } settings_changed = true; @@ -219,17 +219,17 @@ void iwTransport::msgButtonClick(const unsigned ctrl_id) break; case 5: // ganz runter { - auto* group = GetCtrl(6); + auto* group = getCtrl(6); // Wenn wir schon ganz unten sind, gehts nicht weiter runter - while(group->GetSelection() + 1 < pendingOrder.size()) + while(group->getSelection() + 1 < pendingOrder.size()) { - std::swap(pendingOrder[group->GetSelection()], pendingOrder[group->GetSelection() + 1]); - ctrlImageButton& btPrev = *group->GetCtrl(group->GetSelection()); - ctrlImageButton& btNext = *group->GetCtrl(group->GetSelection() + 1); + std::swap(pendingOrder[group->getSelection()], pendingOrder[group->getSelection() + 1]); + ctrlImageButton& btPrev = *group->getCtrl(group->getSelection()); + ctrlImageButton& btNext = *group->getCtrl(group->getSelection() + 1); btPrev.SwapImage(btNext); btPrev.SwapTooltip(btNext); - group->SetSelection(group->GetSelection() + 1); + group->setSelection(group->getSelection() + 1); } settings_changed = true; @@ -240,18 +240,18 @@ void iwTransport::msgButtonClick(const unsigned ctrl_id) void iwTransport::UpdateSettings() { - if(GAMECLIENT.IsReplayModeOn()) + if(GAMECLIENT.isReplayModeOn()) { - gwv.GetPlayer().FillVisualSettings(GAMECLIENT.visual_settings); + gwv.getPlayer().FillVisualSettings(GAMECLIENT.visual_settings); fillTransportOrder(GAMECLIENT.visual_settings.transport_order); } - auto* group = GetCtrl(6); + auto* group = getCtrl(6); // Einstellungen festlegen for(unsigned char i = 0; i < pendingOrder.size(); ++i) { const auto& data = buttonData[pendingOrder[i]]; - group->GetCtrl(i)->SetImage(data.sprite); - group->GetCtrl(i)->SetTooltip(_(data.tooltip)); + group->getCtrl(i)->setImage(data.sprite); + group->getCtrl(i)->setTooltip(_(data.tooltip)); } } diff --git a/libs/s25main/ingameWindows/iwVictory.cpp b/libs/s25main/ingameWindows/iwVictory.cpp index bb66f77fc5..4142313ac5 100644 --- a/libs/s25main/ingameWindows/iwVictory.cpp +++ b/libs/s25main/ingameWindows/iwVictory.cpp @@ -22,25 +22,25 @@ enum iwVictory::iwVictory(const std::vector& winnerNames) : IngameWindow(CGI_VICTORY, IngameWindow::posLastOrCenter, Extent(240, 240), _("End of game"), - LOADER.GetImageN("io", 5)) + LOADER.getImageN("io", 5)) { AddText(ID_TITLE, DrawPoint(120, 40), winnerNames.size() > 1u ? _("The winners:") : _("The winner:"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); auto* names = AddMultiline(ID_NAMES, DrawPoint(0, 70), Extent(800, 600), TextureColor::Invisible, NormalFont); - names->SetNumVisibleLines(winnerNames.size()); + names->setNumVisibleLines(winnerNames.size()); names->ShowBackground(false); - names->SetScrollBarAllowed(false); + names->setScrollBarAllowed(false); for(const auto& name : winnerNames) names->AddString(name, COLOR_YELLOW); - const auto txtBounds = Rect(names->GetPos(), names->GetContentSize()); - Extent iwSize = GetIwSize(); + const auto txtBounds = Rect(names->getPos(), names->getContentSize()); + Extent iwSize = getIwSize(); if(iwSize.x + 20u < txtBounds.getSize().x) iwSize.x = txtBounds.getSize().x + 20u; if(static_cast(iwSize.y + 60) < txtBounds.bottom) iwSize.y = txtBounds.bottom + 60u; - if(iwSize != GetIwSize()) - SetIwSize(iwSize); - names->SetPos(DrawPoint((GetSize().x - txtBounds.getSize().x) / 2, names->GetPos().y)); + if(iwSize != getIwSize()) + setIwSize(iwSize); + names->setPos(DrawPoint((getSize().x - txtBounds.getSize().x) / 2, names->getPos().y)); int btPosY = std::max(170, txtBounds.bottom + 20); AddTextButton(ID_CONTINUE, DrawPoint(50, btPosY), Extent(140, 20), TextureColor::Grey, _("Continue game"), NormalFont); diff --git a/libs/s25main/ingameWindows/iwWares.cpp b/libs/s25main/ingameWindows/iwWares.cpp index 5732e57002..a00bec30f0 100644 --- a/libs/s25main/ingameWindows/iwWares.cpp +++ b/libs/s25main/ingameWindows/iwWares.cpp @@ -38,14 +38,14 @@ static void addElement(ctrlGroup& page, const glFont* font, const DrawPoint btPo if(allow_outhousing) { ctrlButton* b = - page.AddImageButton(100 + idOffset, btPos, btSize, TextureColor::Grey, LOADER.GetMapTexture(2298), name); - b->SetBorder(false); + page.AddImageButton(100 + idOffset, btPos, btSize, TextureColor::Grey, LOADER.getMapTexture(2298), name); + b->setBorder(false); } else - page.AddImage(100 + idOffset, btPos + btSize / 2, LOADER.GetMapTexture(2298), name); + page.AddImage(100 + idOffset, btPos + btSize / 2, LOADER.getMapTexture(2298), name); // Background image for the amount const DrawPoint bgCtPos = btPos + DrawPoint(btSize.x / 2, 32); - page.AddImage(200 + idOffset, bgCtPos, LOADER.GetMapTexture(2299)); + page.AddImage(200 + idOffset, bgCtPos, LOADER.getMapTexture(2299)); // The actual image for the element const DrawPoint warePos = btPos + btSize / 2; @@ -53,17 +53,17 @@ static void addElement(ctrlGroup& page, const glFont* font, const DrawPoint btPo // Overlay for "don't collect" DrawPoint overlayPos = warePos - DrawPoint(0, 4); - ctrlImage* image = page.AddImage(400 + idOffset, overlayPos, LOADER.GetImageN("io", 222)); - image->SetVisible(false); + ctrlImage* image = page.AddImage(400 + idOffset, overlayPos, LOADER.getImageN("io", 222)); + image->setVisible(false); // Overlay for "send out" overlayPos = warePos + DrawPoint(0, 10); - image = page.AddImage(500 + idOffset, overlayPos, LOADER.GetImageN("io", 221)); - image->SetVisible(false); + image = page.AddImage(500 + idOffset, overlayPos, LOADER.getImageN("io", 221)); + image->setVisible(false); // Overlay for "collect" - image = page.AddImage(700 + idOffset, overlayPos, LOADER.GetImageN("io_new", 3)); - image->SetVisible(false); + image = page.AddImage(700 + idOffset, overlayPos, LOADER.getImageN("io_new", 3)); + image->setVisible(false); // Amount of the element const DrawPoint txtPos = btPos + DrawPoint(btSize.x, 40); @@ -72,7 +72,7 @@ static void addElement(ctrlGroup& page, const glFont* font, const DrawPoint btPo iwWares::iwWares(unsigned id, const DrawPoint& pos, unsigned additionalYSpace, const std::string& title, bool allow_outhousing, const glFont* font, const Inventory& inventory, const GamePlayer& player) - : IngameWindow(id, pos, Extent(167, 416), title, LOADER.GetImageN("io", 5)), inventory(inventory), player(player), + : IngameWindow(id, pos, Extent(167, 416), title, LOADER.getImageN("io", 5)), inventory(inventory), player(player), numPages(0) { if(!font) @@ -114,15 +114,15 @@ iwWares::iwWares(unsigned id, const DrawPoint& pos, unsigned additionalYSpace, c Job::Sergeant, Job::Officer, Job::General}; - helpers::erase_if(WARE_DISPLAY_ORDER, makeIsUnusedWare(player.GetGameWorld().GetGGS())); - helpers::erase_if(JOB_DISPLAY_ORDER, makeIsUnusedJob(player.GetGameWorld().GetGGS())); + helpers::erase_if(WARE_DISPLAY_ORDER, makeIsUnusedWare(player.getGameWorld().getGGS())); + helpers::erase_if(JOB_DISPLAY_ORDER, makeIsUnusedJob(player.getGameWorld().getGGS())); // Warenseite hinzufügen ctrlGroup& waresPage = AddPage(); - warePageID = waresPage.GetID(); + warePageID = waresPage.getID(); // Figurenseite hinzufügen ctrlGroup& figuresPage = AddPage(); - peoplePageID = figuresPage.GetID(); + peoplePageID = figuresPage.getID(); bool isRowWithFourElemens = true; const unsigned numElements = std::max(WARE_DISPLAY_ORDER.size(), JOB_DISPLAY_ORDER.size()); @@ -146,29 +146,29 @@ iwWares::iwWares(unsigned id, const DrawPoint& pos, unsigned additionalYSpace, c const GoodType rawWare = WARE_DISPLAY_ORDER[idx]; const GoodType ware = convertShieldToNation(rawWare, player.nation); addElement(waresPage, font, btPos, btSize, rttr::enum_cast(rawWare), _(WARE_NAMES[rawWare]), - LOADER.GetWareTex(ware), allow_outhousing); + LOADER.getWareTex(ware), allow_outhousing); } if(idx < JOB_DISPLAY_ORDER.size()) { const Job job = JOB_DISPLAY_ORDER[idx]; - addElement(figuresPage, font, btPos, btSize, rttr::enum_cast(job), _(JOB_NAMES[job]), LOADER.GetJobTex(job), + addElement(figuresPage, font, btPos, btSize, rttr::enum_cast(job), _(JOB_NAMES[job]), LOADER.getJobTex(job), allow_outhousing); } } // compute the final window size - Resize(Extent(GetSize().x, topMargin + (y + 1) * rowHeight + spacingBetweenLastRowAndButtonRow + additionalYSpace + Resize(Extent(getSize().x, topMargin + (y + 1) * rowHeight + spacingBetweenLastRowAndButtonRow + additionalYSpace + buttonRowHeight + bottomMargin)); // "Next page" button - AddImageButton(0, DrawPoint(52, GetFullSize().y - 47), Extent(66, 32), TextureColor::Grey, - LOADER.GetImageN("io", 84), _("Next page")); + AddImageButton(0, DrawPoint(52, getFullSize().y - 47), Extent(66, 32), TextureColor::Grey, + LOADER.getImageN("io", 84), _("Next page")); // "Help" button - AddImageButton(12, DrawPoint(16, GetFullSize().y - 47), Extent(32, 32), TextureColor::Grey, - LOADER.GetImageN("io", 225), _("Help")); + AddImageButton(12, DrawPoint(16, getFullSize().y - 47), Extent(32, 32), TextureColor::Grey, + LOADER.getImageN("io", 225), _("Help")); - waresPage.SetVisible(true); + waresPage.setVisible(true); curPage_ = warePageID; } @@ -177,7 +177,7 @@ void iwWares::msgButtonClick(const unsigned ctrl_id) switch(ctrl_id) { case 0: // "Blättern" - SetPage(curPage_ + 1); + setPage(curPage_ + 1); break; case 12: // Hilfe WINDOWMANAGER.ReplaceWindow( @@ -196,7 +196,7 @@ void iwWares::msgPaintBefore() if(curPage_ != peoplePageID && curPage_ != warePageID) return; - auto* group = GetCtrl(curPage_); + auto* group = getCtrl(curPage_); if(group) { const unsigned count = @@ -204,19 +204,19 @@ void iwWares::msgPaintBefore() for(unsigned i = 0; i < count; ++i) { - auto* text = group->GetCtrl(600 + i); + auto* text = group->getCtrl(600 + i); if(text) { const unsigned amount = (curPage_ == warePageID) ? inventory[static_cast(i)] : inventory[static_cast(i)]; - text->SetText(std::to_string(amount)); - text->SetTextColor((amount == 0) ? COLOR_RED : COLOR_YELLOW); + text->setText(std::to_string(amount)); + text->setTextColor((amount == 0) ? COLOR_RED : COLOR_YELLOW); - if(leatheraddon::isAddonActive(player.GetGameWorld())) + if(leatheraddon::isAddonActive(player.getGameWorld())) { if(peoplePageID == curPage_ && isSoldier(static_cast(i))) { - auto* tooltip = group->GetCtrl(100 + i); + auto* tooltip = group->getCtrl(100 + i); std::string toolTip = _(JOB_NAMES[static_cast(i)]); toolTip += std::string(" (") @@ -224,7 +224,7 @@ void iwWares::msgPaintBefore() + std::string("/") + std::to_string(amount) + std::string(" ") + std::string(_("with armor)")); - tooltip->SetTooltip(toolTip); + tooltip->setTooltip(toolTip); } } } @@ -237,26 +237,26 @@ void iwWares::msgPaintBefore() * * @param[in] page Die neue Seite */ -void iwWares::SetPage(unsigned page) +void iwWares::setPage(unsigned page) { // alte Page verstecken - auto* group = GetCtrl(curPage_); + auto* group = getCtrl(curPage_); if(group) - group->SetVisible(false); + group->setVisible(false); // neue Page setzen curPage_ = (page - ID_pageOffset) % numPages + ID_pageOffset; // neue Page anzeigen - group = GetCtrl(curPage_); + group = getCtrl(curPage_); if(group) - group->SetVisible(true); + group->setVisible(true); } ctrlGroup& iwWares::AddPage() { ctrlGroup& grp = *AddGroup(ID_pageOffset + numPages); numPages++; - grp.SetVisible(false); + grp.setVisible(false); return grp; } diff --git a/libs/s25main/ingameWindows/iwWares.h b/libs/s25main/ingameWindows/iwWares.h index 68d5c7387b..9776d5a9a9 100644 --- a/libs/s25main/ingameWindows/iwWares.h +++ b/libs/s25main/ingameWindows/iwWares.h @@ -23,14 +23,14 @@ class iwWares : public IngameWindow protected: /// bestimmte Inventurseite zeigen. - virtual void SetPage(unsigned page); + virtual void setPage(unsigned page); /// Add a new page and return it. ID will be in range 100+ ctrlGroup& AddPage(); void msgButtonClick(unsigned ctrl_id) override; void msgPaintBefore() override; - unsigned GetCurPage() const { return curPage_; } + unsigned getCurPage() const { return curPage_; } private: unsigned curPage_; /// aktuelle Seite des Inventurfensters. diff --git a/libs/s25main/languages.cpp b/libs/s25main/languages.cpp index 9d056dfae3..85a8fb82c9 100644 --- a/libs/s25main/languages.cpp +++ b/libs/s25main/languages.cpp @@ -33,7 +33,7 @@ Languages::Languages() : loaded(false) void Languages::loadLanguages() { const libsiedler2::Archiv& langInfo = - dynamic_cast(*LOADER.GetArchive("languages").find("Languages")); + dynamic_cast(*LOADER.getArchive("languages").find("Languages")); unsigned count = langInfo.size(); for(unsigned i = 0; i < count; i++) diff --git a/libs/s25main/lua/LuaInterfaceGame.cpp b/libs/s25main/lua/LuaInterfaceGame.cpp index 3ae2d0623c..c0999c1464 100644 --- a/libs/s25main/lua/LuaInterfaceGame.cpp +++ b/libs/s25main/lua/LuaInterfaceGame.cpp @@ -201,16 +201,16 @@ LuaInterfaceGame::LuaInterfaceGame(Game& gameInstance, ILocalGameState& localGam LuaInterfaceGame::~LuaInterfaceGame() = default; -KAGUYA_MEMBER_FUNCTION_OVERLOADS(SetMissionGoalWrapper, LuaInterfaceGame, SetMissionGoal, 1, 2) +KAGUYA_MEMBER_FUNCTION_OVERLOADS(SetMissionGoalWrapper, LuaInterfaceGame, setMissionGoal, 1, 2) void LuaInterfaceGame::Register(kaguya::State& state) { state["RTTRGame"].setClass(kaguya::UserdataMetatable() .addFunction("ClearResources", &LuaInterfaceGame::ClearResources) - .addFunction("GetGF", &LuaInterfaceGame::GetGF) + .addFunction("GetGF", &LuaInterfaceGame::getGF) .addFunction("FormatNumGFs", &LuaInterfaceGame::FormatNumGFs) - .addFunction("GetGameFrame", &LuaInterfaceGame::GetGF) - .addFunction("GetNumPlayers", &LuaInterfaceGame::GetNumPlayers) + .addFunction("GetGameFrame", &LuaInterfaceGame::getGF) + .addFunction("GetNumPlayers", &LuaInterfaceGame::getNumPlayers) .addFunction("Chat", &LuaInterfaceGame::Chat) .addOverloadedFunctions("MissionStatement", &LuaInterfaceGame::MissionStatement, &LuaInterfaceGame::MissionStatement2, @@ -218,10 +218,10 @@ void LuaInterfaceGame::Register(kaguya::State& state) .addFunction("SetMissionGoal", SetMissionGoalWrapper()) .addFunction("PostMessage", &LuaInterfaceGame::PostMessageLua) .addFunction("PostMessageWithLocation", &LuaInterfaceGame::PostMessageWithLocation) - .addFunction("GetPlayer", &LuaInterfaceGame::GetPlayer) - .addFunction("GetWorld", &LuaInterfaceGame::GetWorld) + .addFunction("GetPlayer", &LuaInterfaceGame::getPlayer) + .addFunction("GetWorld", &LuaInterfaceGame::getWorld) // Old name - .addFunction("GetPlayerCount", &LuaInterfaceGame::GetNumPlayers)); + .addFunction("GetPlayerCount", &LuaInterfaceGame::getNumPlayers)); state["RTTR_Serializer"].setClass(kaguya::UserdataMetatable() .addFunction("PushInt", &Serializer::PushSignedInt) .addFunction("PopInt", &Serializer::PopSignedInt) @@ -261,13 +261,13 @@ bool LuaInterfaceGame::Deserialize(Serializer& luaSaveState) void LuaInterfaceGame::ClearResources() { - for(unsigned p = 0; p < gw.GetNumPlayers(); p++) - GetPlayer(p).ClearResources(); + for(unsigned p = 0; p < gw.getNumPlayers(); p++) + getPlayer(p).ClearResources(); } -unsigned LuaInterfaceGame::GetGF() const +unsigned LuaInterfaceGame::getGF() const { - return gw.GetEvMgr().GetCurrentGF(); + return gw.getEvMgr().getCurrentGF(); } std::string LuaInterfaceGame::FormatNumGFs(unsigned numGFs) const @@ -275,14 +275,14 @@ std::string LuaInterfaceGame::FormatNumGFs(unsigned numGFs) const return localGameState.FormatGFTime(numGFs); } -unsigned LuaInterfaceGame::GetNumPlayers() const +unsigned LuaInterfaceGame::getNumPlayers() const { - return gw.GetNumPlayers(); + return gw.getNumPlayers(); } void LuaInterfaceGame::Chat(int playerIdx, const std::string& msg) { - if(playerIdx >= 0 && localGameState.GetPlayerId() != unsigned(playerIdx)) + if(playerIdx >= 0 && localGameState.getPlayerId() != unsigned(playerIdx)) return; localGameState.SystemChat(msg); @@ -302,41 +302,41 @@ void LuaInterfaceGame::MissionStatement2(int playerIdx, const std::string& title void LuaInterfaceGame::MissionStatement3(int playerIdx, const std::string& title, const std::string& msg, unsigned imgIdx, bool pause) { - if(playerIdx >= 0 && localGameState.GetPlayerId() != unsigned(playerIdx)) + if(playerIdx >= 0 && localGameState.getPlayerId() != unsigned(playerIdx)) return; - WINDOWMANAGER.Show(std::make_unique(_(title), msg, gw.IsSinglePlayer() && pause, + WINDOWMANAGER.Show(std::make_unique(_(title), msg, gw.isSinglePlayer() && pause, iwMissionStatement::HelpImage(imgIdx))); } -void LuaInterfaceGame::SetMissionGoal(int playerIdx, const std::string& newGoal) +void LuaInterfaceGame::setMissionGoal(int playerIdx, const std::string& newGoal) { - gw.GetPostMgr().SetMissionGoal(playerIdx, newGoal); + gw.getPostMgr().setMissionGoal(playerIdx, newGoal); } // Must not be PostMessage as this is a windows define :( void LuaInterfaceGame::PostMessageLua(int playerIdx, const std::string& msg) { lua::assertTrue(playerIdx >= 0, "Invalid player idx"); - gw.GetPostMgr().SendMsg(static_cast(playerIdx), - std::make_unique(gw.GetEvMgr().GetCurrentGF(), msg, PostCategory::General)); + gw.getPostMgr().SendMsg(static_cast(playerIdx), + std::make_unique(gw.getEvMgr().getCurrentGF(), msg, PostCategory::General)); } void LuaInterfaceGame::PostMessageWithLocation(int playerIdx, const std::string& msg, int x, int y) { lua::assertTrue(playerIdx >= 0, "Invalid player idx"); - gw.GetPostMgr().SendMsg(static_cast(playerIdx), - std::make_unique(gw.GetEvMgr().GetCurrentGF(), msg, PostCategory::General, + gw.getPostMgr().SendMsg(static_cast(playerIdx), + std::make_unique(gw.getEvMgr().getCurrentGF(), msg, PostCategory::General, gw.MakeMapPoint(Position(x, y)))); } -LuaPlayer LuaInterfaceGame::GetPlayer(int playerIdx) +LuaPlayer LuaInterfaceGame::getPlayer(int playerIdx) { - lua::assertTrue(playerIdx >= 0 && static_cast(playerIdx) < gw.GetNumPlayers(), "Invalid player idx"); - return LuaPlayer(game, gw.GetPlayer(static_cast(playerIdx))); + lua::assertTrue(playerIdx >= 0 && static_cast(playerIdx) < gw.getNumPlayers(), "Invalid player idx"); + return LuaPlayer(game, gw.getPlayer(static_cast(playerIdx))); } -LuaWorld LuaInterfaceGame::GetWorld() +LuaWorld LuaInterfaceGame::getWorld() { return LuaWorld(gw); } @@ -407,7 +407,7 @@ bool LuaInterfaceGame::EventCancelPactRequest(PactType pt, unsigned char cancele void LuaInterfaceGame::EventSuggestPact(const PactType pt, unsigned char suggestedByPlayerId, unsigned char targetPlayerId, const unsigned duration) { - AIPlayer* ai = game.GetAIPlayer(targetPlayerId); + AIPlayer* ai = game.getAIPlayer(targetPlayerId); if(ai != nullptr) { kaguya::LuaRef onPactCancel = lua["onSuggestPact"]; @@ -416,7 +416,7 @@ void LuaInterfaceGame::EventSuggestPact(const PactType pt, unsigned char suggest AIInterface& aii = ai->getAIInterface(); auto luaResult = onPactCancel.call(pt, suggestedByPlayerId, targetPlayerId, duration); if(luaResult) - aii.AcceptPact(gw.GetEvMgr().GetCurrentGF(), pt, suggestedByPlayerId); + aii.AcceptPact(gw.getEvMgr().getCurrentGF(), pt, suggestedByPlayerId); else aii.CancelPact(pt, suggestedByPlayerId); } diff --git a/libs/s25main/lua/LuaInterfaceGame.h b/libs/s25main/lua/LuaInterfaceGame.h index e71758adcb..f8a33c9ed6 100644 --- a/libs/s25main/lua/LuaInterfaceGame.h +++ b/libs/s25main/lua/LuaInterfaceGame.h @@ -47,15 +47,15 @@ class LuaInterfaceGame : public LuaInterfaceGameBase unsigned duration); // Callable from Lua void ClearResources(); - unsigned GetGF() const; + unsigned getGF() const; std::string FormatNumGFs(unsigned numGFs) const; - unsigned GetNumPlayers() const; + unsigned getNumPlayers() const; void Chat(int playerIdx, const std::string& msg); void MissionStatement(int playerIdx, const std::string& title, const std::string& msg); void MissionStatement2(int playerIdx, const std::string& title, const std::string& msg, unsigned imgIdx); void MissionStatement3(int playerIdx, const std::string& title, const std::string& msg, unsigned imgIdx, bool pause); - void SetMissionGoal(int playerIdx, const std::string& newGoal = ""); + void setMissionGoal(int playerIdx, const std::string& newGoal = ""); void PostMessageLua(int playerIdx, const std::string& msg); void PostMessageWithLocation(int playerIdx, const std::string& msg, int x, int y); @@ -63,6 +63,6 @@ class LuaInterfaceGame : public LuaInterfaceGameBase ILocalGameState& localGameState; GameWorld& gw; Game& game; - LuaPlayer GetPlayer(int playerIdx); - LuaWorld GetWorld(); + LuaPlayer getPlayer(int playerIdx); + LuaWorld getWorld(); }; diff --git a/libs/s25main/lua/LuaInterfaceGameBase.cpp b/libs/s25main/lua/LuaInterfaceGameBase.cpp index 2478d7b325..afcf8614e6 100644 --- a/libs/s25main/lua/LuaInterfaceGameBase.cpp +++ b/libs/s25main/lua/LuaInterfaceGameBase.cpp @@ -9,12 +9,12 @@ #include "resources/ResourceId.h" #include "s25util/Log.h" -unsigned LuaInterfaceGameBase::GetVersion() +unsigned LuaInterfaceGameBase::getVersion() { return 1; } -unsigned LuaInterfaceGameBase::GetFeatureLevel() +unsigned LuaInterfaceGameBase::getFeatureLevel() { return 8; } @@ -28,9 +28,9 @@ void LuaInterfaceGameBase::Register(kaguya::State& state) { state["RTTRGameBase"].setClass( kaguya::UserdataMetatable() - .addStaticFunction("GetFeatureLevel", &LuaInterfaceGameBase::GetFeatureLevel) - .addFunction("IsHost", &LuaInterfaceGameBase::IsHost) - .addFunction("GetLocalPlayerIdx", &LuaInterfaceGameBase::GetLocalPlayerIdx) + .addStaticFunction("GetFeatureLevel", &LuaInterfaceGameBase::getFeatureLevel) + .addFunction("IsHost", &LuaInterfaceGameBase::isHost) + .addFunction("GetLocalPlayerIdx", &LuaInterfaceGameBase::getLocalPlayerIdx) .addOverloadedFunctions("MsgBox", &LuaInterfaceGameBase::MsgBox, &LuaInterfaceGameBase::MsgBox2) .addOverloadedFunctions("MsgBoxEx", &LuaInterfaceGameBase::MsgBoxEx, &LuaInterfaceGameBase::MsgBoxEx2)); } @@ -41,12 +41,12 @@ bool LuaInterfaceGameBase::CheckScriptVersion() if(func.type() == LUA_TFUNCTION) { const auto scriptVersion = func.call(); - if(scriptVersion == GetVersion()) + if(scriptVersion == getVersion()) return true; else { - LOG.write(_("Wrong lua script version: %1%. Current version: %2%.%3%.\n")) % scriptVersion % GetVersion() - % GetFeatureLevel(); + LOG.write(_("Wrong lua script version: %1%. Current version: %2%.%3%.\n")) % scriptVersion % getVersion() + % getFeatureLevel(); return false; } } else @@ -56,14 +56,14 @@ bool LuaInterfaceGameBase::CheckScriptVersion() } } -bool LuaInterfaceGameBase::IsHost() const +bool LuaInterfaceGameBase::isHost() const { - return localGameState.IsHost(); + return localGameState.isHost(); } -unsigned LuaInterfaceGameBase::GetLocalPlayerIdx() const +unsigned LuaInterfaceGameBase::getLocalPlayerIdx() const { - return localGameState.GetPlayerId(); + return localGameState.getPlayerId(); } void LuaInterfaceGameBase::MsgBox(const std::string& title, const std::string& msg, bool isError) diff --git a/libs/s25main/lua/LuaInterfaceGameBase.h b/libs/s25main/lua/LuaInterfaceGameBase.h index 8f9bc08c8e..4f04e546c9 100644 --- a/libs/s25main/lua/LuaInterfaceGameBase.h +++ b/libs/s25main/lua/LuaInterfaceGameBase.h @@ -15,17 +15,17 @@ class LuaInterfaceGameBase : public LuaInterfaceBase bool CheckScriptVersion(); /// Return version of the interface. Changes here reflect breaking changes - static unsigned GetVersion(); + static unsigned getVersion(); /// Get the feature level of this version. Reset on Version increase, increase for added features - static unsigned GetFeatureLevel(); + static unsigned getFeatureLevel(); protected: explicit LuaInterfaceGameBase(const ILocalGameState& localGameState); /// Return true, if local player is the host - bool IsHost() const; + bool isHost() const; /// Return the index of the local player - unsigned GetLocalPlayerIdx() const; + unsigned getLocalPlayerIdx() const; /// Show a message box with given title and text. /// If isError is true, a red exclamation mark is shown, otherwise a green one is shown void MsgBox(const std::string& title, const std::string& msg, bool isError); diff --git a/libs/s25main/lua/LuaInterfaceSettings.cpp b/libs/s25main/lua/LuaInterfaceSettings.cpp index 3b9f5e9643..de07ea02b1 100644 --- a/libs/s25main/lua/LuaInterfaceSettings.cpp +++ b/libs/s25main/lua/LuaInterfaceSettings.cpp @@ -36,14 +36,14 @@ void LuaInterfaceSettings::Register(kaguya::State& state) { state["RTTRSettings"].setClass( kaguya::UserdataMetatable() - .addFunction("GetNumPlayers", &LuaInterfaceSettings::GetNumPlayers) - .addFunction("GetPlayer", &LuaInterfaceSettings::GetPlayer) - .addOverloadedFunctions("SetAddon", &LuaInterfaceSettings::SetAddon, &LuaInterfaceSettings::SetBoolAddon) + .addFunction("GetNumPlayers", &LuaInterfaceSettings::getNumPlayers) + .addFunction("GetPlayer", &LuaInterfaceSettings::getPlayer) + .addOverloadedFunctions("SetAddon", &LuaInterfaceSettings::setAddon, &LuaInterfaceSettings::setBoolAddon) .addFunction("ResetAddons", &LuaInterfaceSettings::ResetAddons) .addFunction("ResetGameSettings", &LuaInterfaceSettings::ResetGameSettings) - .addFunction("SetGameSettings", &LuaInterfaceSettings::SetGameSettings) + .addFunction("SetGameSettings", &LuaInterfaceSettings::setGameSettings) // Old name - .addFunction("GetPlayerCount", &LuaInterfaceSettings::GetNumPlayers)); + .addFunction("GetPlayerCount", &LuaInterfaceSettings::getNumPlayers)); state["AddonId"].setClass(kaguya::UserdataMetatable()); @@ -87,20 +87,20 @@ void LuaInterfaceSettings::Register(kaguya::State& state) #pragma endregion ConstDefs } -unsigned LuaInterfaceSettings::GetNumPlayers() const +unsigned LuaInterfaceSettings::getNumPlayers() const { - return lobbyServerController_.GetMaxNumPlayers(); + return lobbyServerController_.getMaxNumPlayers(); } -LuaServerPlayer LuaInterfaceSettings::GetPlayer(int idx) +LuaServerPlayer LuaInterfaceSettings::getPlayer(int idx) { - lua::assertTrue(idx >= 0 && static_cast(idx) < GetNumPlayers(), "Invalid player idx"); + lua::assertTrue(idx >= 0 && static_cast(idx) < getNumPlayers(), "Invalid player idx"); return LuaServerPlayer(lobbyServerController_, static_cast(idx)); } -void LuaInterfaceSettings::SetAddon(AddonIdWrapper id, unsigned value) +void LuaInterfaceSettings::setAddon(AddonIdWrapper id, unsigned value) { - GlobalGameSettings ggs = lobbyServerController_.GetGGS(); + GlobalGameSettings ggs = lobbyServerController_.getGGS(); // The global "inexhaustible mines" addon was replaced by per-mine-type settings and is no longer registered. // Apply the same migration used for old settings and savegames instead of reporting an unknown addon. if(static_cast(id) == AddonId::INEXHAUSTIBLE_MINES) @@ -112,14 +112,14 @@ void LuaInterfaceSettings::SetAddon(AddonIdWrapper id, unsigned value) lobbyServerController_.ChangeGlobalGameSettings(ggs); } -void LuaInterfaceSettings::SetBoolAddon(AddonIdWrapper id, bool value) +void LuaInterfaceSettings::setBoolAddon(AddonIdWrapper id, bool value) { - SetAddon(id, value ? 1 : 0); + setAddon(id, value ? 1 : 0); } void LuaInterfaceSettings::ResetAddons() { - GlobalGameSettings ggs = lobbyServerController_.GetGGS(); + GlobalGameSettings ggs = lobbyServerController_.getGGS(); ggs.resetAddons(); lobbyServerController_.ChangeGlobalGameSettings(ggs); } @@ -130,9 +130,9 @@ void LuaInterfaceSettings::ResetGameSettings() lobbyServerController_.ChangeGlobalGameSettings(GlobalGameSettings()); } -void LuaInterfaceSettings::SetGameSettings(const kaguya::LuaTable& settings) +void LuaInterfaceSettings::setGameSettings(const kaguya::LuaTable& settings) { - GlobalGameSettings ggs = lobbyServerController_.GetGGS(); + GlobalGameSettings ggs = lobbyServerController_.getGGS(); std::vector keys = settings.keys(); if(helpers::contains(keys, "speed")) @@ -171,7 +171,7 @@ void LuaInterfaceSettings::SetGameSettings(const kaguya::LuaTable& settings) lobbyServerController_.ChangeGlobalGameSettings(ggs); } -kaguya::LuaRef LuaInterfaceSettings::GetAllowedChanges() +kaguya::LuaRef LuaInterfaceSettings::getAllowedChanges() { kaguya::LuaRef getGeneralConfig = lua["getAllowedChanges"]; if(getGeneralConfig.type() == LUA_TFUNCTION) @@ -220,9 +220,9 @@ void LuaInterfaceSettings::EventPlayerReady(unsigned playerIdx) func.call(playerIdx); } -bool LuaInterfaceSettings::IsChangeAllowed(const std::string& name, const bool defaultVal /* = false*/) +bool LuaInterfaceSettings::isChangeAllowed(const std::string& name, const bool defaultVal /* = false*/) { - kaguya::LuaRef cfg = GetAllowedChanges(); + kaguya::LuaRef cfg = getAllowedChanges(); if(cfg.isNilref()) return defaultVal; cfg = cfg.getField(name); @@ -232,7 +232,7 @@ bool LuaInterfaceSettings::IsChangeAllowed(const std::string& name, const bool d return defaultVal; } -std::vector LuaInterfaceSettings::GetAllowedAddons() +std::vector LuaInterfaceSettings::getAllowedAddons() { kaguya::LuaRef getAllowedAddons = lua["getAllowedAddons"]; if(getAllowedAddons.type() == LUA_TFUNCTION) @@ -248,7 +248,7 @@ std::vector LuaInterfaceSettings::GetAllowedAddons() return std::vector(); } -bool LuaInterfaceSettings::IsMapPreviewEnabled() +bool LuaInterfaceSettings::isMapPreviewEnabled() { kaguya::LuaRef func = lua["isMapPreviewEnabled"]; if(func.type() == LUA_TFUNCTION) diff --git a/libs/s25main/lua/LuaInterfaceSettings.h b/libs/s25main/lua/LuaInterfaceSettings.h index a577a3e1ed..2e6bb6383c 100644 --- a/libs/s25main/lua/LuaInterfaceSettings.h +++ b/libs/s25main/lua/LuaInterfaceSettings.h @@ -32,21 +32,21 @@ class LuaInterfaceSettings : public LuaInterfaceGameBase void EventPlayerLeft(unsigned playerIdx); void EventPlayerReady(unsigned playerIdx); /// Return whether the named change is allowed - bool IsChangeAllowed(const std::string& name, bool defaultVal = false); + bool isChangeAllowed(const std::string& name, bool defaultVal = false); /// Get addons that are allowed to be changed - std::vector GetAllowedAddons(); - bool IsMapPreviewEnabled(); + std::vector getAllowedAddons(); + bool isMapPreviewEnabled(); private: IGameLobbyController& lobbyServerController_; - kaguya::LuaRef GetAllowedChanges(); + kaguya::LuaRef getAllowedChanges(); // Callable from Lua - unsigned GetNumPlayers() const; - LuaServerPlayer GetPlayer(int idx); - void SetAddon(AddonIdWrapper id, unsigned value); - void SetBoolAddon(AddonIdWrapper id, bool value); // Alias + unsigned getNumPlayers() const; + LuaServerPlayer getPlayer(int idx); + void setAddon(AddonIdWrapper id, unsigned value); + void setBoolAddon(AddonIdWrapper id, bool value); // Alias void ResetAddons(); void ResetGameSettings(); - void SetGameSettings(const kaguya::LuaTable& settings); + void setGameSettings(const kaguya::LuaTable& settings); }; diff --git a/libs/s25main/lua/LuaPlayer.cpp b/libs/s25main/lua/LuaPlayer.cpp index b629ead3f0..12fcd58f66 100644 --- a/libs/s25main/lua/LuaPlayer.cpp +++ b/libs/s25main/lua/LuaPlayer.cpp @@ -22,7 +22,7 @@ #include "s25util/Log.h" #include -const BasePlayerInfo& LuaPlayer::GetPlayer() const +const BasePlayerInfo& LuaPlayer::getPlayer() const { return player; } @@ -35,30 +35,30 @@ void LuaPlayer::Register(kaguya::State& state) .addFunction("DisableBuilding", &LuaPlayer::DisableBuilding) .addFunction("EnableAllBuildings", &LuaPlayer::EnableAllBuildings) .addFunction("DisableAllBuildings", &LuaPlayer::DisableAllBuildings) - .addFunction("SetRestrictedArea", &LuaPlayer::SetRestrictedArea) - .addFunction("IsInRestrictedArea", &LuaPlayer::IsInRestrictedArea) + .addFunction("SetRestrictedArea", &LuaPlayer::setRestrictedArea) + .addFunction("IsInRestrictedArea", &LuaPlayer::isInRestrictedArea) .addFunction("ClearResources", &LuaPlayer::ClearResources) .addFunction("AddWares", &LuaPlayer::AddWares) .addFunction("AddPeople", &LuaPlayer::AddPeople) - .addFunction("GetNumBuildings", &LuaPlayer::GetNumBuildings) - .addFunction("GetNumBuildingSites", &LuaPlayer::GetNumBuildingSites) - .addFunction("GetNumWares", &LuaPlayer::GetNumWares) - .addFunction("GetNumPeople", &LuaPlayer::GetNumPeople) - .addFunction("GetStatisticsValue", &LuaPlayer::GetStatisticsValue) + .addFunction("GetNumBuildings", &LuaPlayer::getNumBuildings) + .addFunction("GetNumBuildingSites", &LuaPlayer::getNumBuildingSites) + .addFunction("GetNumWares", &LuaPlayer::getNumWares) + .addFunction("GetNumPeople", &LuaPlayer::getNumPeople) + .addFunction("GetStatisticsValue", &LuaPlayer::getStatisticsValue) .addFunction("AIConstructionOrder", &LuaPlayer::AIConstructionOrder) .addFunction("ModifyHQ", &LuaPlayer::ModifyHQ) - .addFunction("GetHQPos", &LuaPlayer::GetHQPos) + .addFunction("GetHQPos", &LuaPlayer::getHQPos) .addFunction("IsDefeated", &LuaPlayer::IsDefeated) .addFunction("Surrender", &LuaPlayer::Surrender) - .addFunction("IsAlly", &LuaPlayer::IsAlly) - .addFunction("IsAttackable", &LuaPlayer::IsAttackable) + .addFunction("IsAlly", &LuaPlayer::isAlly) + .addFunction("IsAttackable", &LuaPlayer::isAttackable) .addFunction("SuggestPact", &LuaPlayer::SuggestPact) .addFunction("CancelPact", &LuaPlayer::CancelPact) // Old names - .addFunction("GetBuildingCount", &LuaPlayer::GetNumBuildings) - .addFunction("GetBuildingSitesCount", &LuaPlayer::GetNumBuildingSites) - .addFunction("GetWareCount", &LuaPlayer::GetNumWares) - .addFunction("GetPeopleCount", &LuaPlayer::GetNumPeople)); + .addFunction("GetBuildingCount", &LuaPlayer::getNumBuildings) + .addFunction("GetBuildingSitesCount", &LuaPlayer::getNumBuildingSites) + .addFunction("GetWareCount", &LuaPlayer::getNumWares) + .addFunction("GetPeopleCount", &LuaPlayer::getNumPeople)); } void LuaPlayer::EnableBuilding(lua::SafeEnum bld, bool notify) @@ -67,7 +67,7 @@ void LuaPlayer::EnableBuilding(lua::SafeEnum bld, bool notify) if(notify) { player.SendPostMessage( - std::make_unique(player.GetGameWorld().GetEvMgr().GetCurrentGF(), + std::make_unique(player.getGameWorld().getEvMgr().getCurrentGF(), std::string(_("New building type:")) + "\n" + _(BUILDING_NAMES[bld]), PostCategory::General, bld, player.nation)); } @@ -90,12 +90,12 @@ void LuaPlayer::DisableAllBuildings() player.DisableBuilding(bld); } -void LuaPlayer::SetRestrictedArea(kaguya::VariadicArgType inPoints) +void LuaPlayer::setRestrictedArea(kaguya::VariadicArgType inPoints) { if(inPoints.size() == 0) { // Skip everything else if we only want to lift the restrictions - player.GetRestrictedArea().clear(); + player.getRestrictedArea().clear(); return; } @@ -162,27 +162,27 @@ void LuaPlayer::SetRestrictedArea(kaguya::VariadicArgType inPoints) pts.push_back(MapPoint(0, 0)); } else if(pts.front() == pts.back()) pts.pop_back(); - player.GetRestrictedArea() = pts; + player.getRestrictedArea() = pts; } -bool LuaPlayer::IsInRestrictedArea(unsigned x, unsigned y) const +bool LuaPlayer::isInRestrictedArea(unsigned x, unsigned y) const { - const GameWorld& world = player.GetGameWorld(); - lua::assertTrue(x < world.GetWidth(), "x coordinate to large"); - lua::assertTrue(y < world.GetHeight(), "y coordinate to large"); - return TerritoryRegion::IsPointValid(world.GetSize(), player.GetRestrictedArea(), MapPoint(x, y)); + const GameWorld& world = player.getGameWorld(); + lua::assertTrue(x < world.getWidth(), "x coordinate to large"); + lua::assertTrue(y < world.getHeight(), "y coordinate to large"); + return TerritoryRegion::isPointValid(world.getSize(), player.getRestrictedArea(), MapPoint(x, y)); } void LuaPlayer::ClearResources() { - const std::list warehouses = player.GetBuildingRegister().GetStorehouses(); + const std::list warehouses = player.getBuildingRegister().getStorehouses(); for(auto* warehouse : warehouses) warehouse->Clear(); } bool LuaPlayer::AddWares(const std::map, unsigned>& wares) { - nobBaseWarehouse* warehouse = player.GetFirstWH(); + nobBaseWarehouse* warehouse = player.getFirstWH(); if(!warehouse) return false; @@ -197,7 +197,7 @@ bool LuaPlayer::AddWares(const std::map, unsigned>& ware bool LuaPlayer::AddPeople(const std::map, unsigned>& people) { - nobBaseWarehouse* warehouse = player.GetFirstWH(); + nobBaseWarehouse* warehouse = player.getFirstWH(); if(!warehouse) return false; @@ -219,29 +219,29 @@ bool LuaPlayer::AddPeople(const std::map, unsigned>& people) return true; } -unsigned LuaPlayer::GetNumBuildings(lua::SafeEnum bld) const +unsigned LuaPlayer::getNumBuildings(lua::SafeEnum bld) const { - return player.GetBuildingRegister().GetBuildingNums().buildings[bld]; + return player.getBuildingRegister().getBuildingNums().buildings[bld]; } -unsigned LuaPlayer::GetNumBuildingSites(lua::SafeEnum bld) const +unsigned LuaPlayer::getNumBuildingSites(lua::SafeEnum bld) const { - return player.GetBuildingRegister().GetBuildingNums().buildingSites[bld]; + return player.getBuildingRegister().getBuildingNums().buildingSites[bld]; } -unsigned LuaPlayer::GetNumWares(lua::SafeEnum ware) const +unsigned LuaPlayer::getNumWares(lua::SafeEnum ware) const { - return player.GetInventory().goods[ware]; + return player.getInventory().goods[ware]; } -unsigned LuaPlayer::GetNumPeople(lua::SafeEnum job) const +unsigned LuaPlayer::getNumPeople(lua::SafeEnum job) const { - return player.GetInventory().people[job]; + return player.getInventory().people[job]; } -unsigned LuaPlayer::GetStatisticsValue(lua::SafeEnum stat) const +unsigned LuaPlayer::getStatisticsValue(lua::SafeEnum stat) const { - return player.GetStatisticCurrentValue(stat); + return player.getStatisticCurrentValue(stat); } bool LuaPlayer::AIConstructionOrder(unsigned x, unsigned y, lua::SafeEnum bld) @@ -249,16 +249,16 @@ bool LuaPlayer::AIConstructionOrder(unsigned x, unsigned y, lua::SafeEnum LuaPlayer::GetHQPos() const +std::pair LuaPlayer::getHQPos() const { - return std::pair(player.GetHQPos().x, player.GetHQPos().y); + return std::pair(player.getHQPos().x, player.getHQPos().y); } -bool LuaPlayer::IsAlly(unsigned char otherPlayerId) +bool LuaPlayer::isAlly(unsigned char otherPlayerId) { - return player.IsAlly(otherPlayerId); + return player.isAlly(otherPlayerId); } -bool LuaPlayer::IsAttackable(unsigned char otherPlayerId) +bool LuaPlayer::isAttackable(unsigned char otherPlayerId) { - return player.IsAttackable(otherPlayerId); + return player.isAttackable(otherPlayerId); } void LuaPlayer::SuggestPact(unsigned char otherPlayerId, const lua::SafeEnum pt, const unsigned duration) { - AIPlayer* ai = game.GetAIPlayer(player.GetPlayerId()); + AIPlayer* ai = game.getAIPlayer(player.getPlayerId()); if(ai != nullptr) ai->getAIInterface().SuggestPact(otherPlayerId, pt, duration); } void LuaPlayer::CancelPact(const lua::SafeEnum pt, unsigned char otherPlayerId) { - AIPlayer* ai = game.GetAIPlayer(player.GetPlayerId()); + AIPlayer* ai = game.getAIPlayer(player.getPlayerId()); if(ai != nullptr) ai->getAIInterface().CancelPact(pt, otherPlayerId); } diff --git a/libs/s25main/lua/LuaPlayer.h b/libs/s25main/lua/LuaPlayer.h index 3335084a51..fc51763521 100644 --- a/libs/s25main/lua/LuaPlayer.h +++ b/libs/s25main/lua/LuaPlayer.h @@ -29,7 +29,7 @@ class LuaPlayer : public LuaPlayerBase GamePlayer& player; protected: - const BasePlayerInfo& GetPlayer() const override; + const BasePlayerInfo& getPlayer() const override; public: LuaPlayer(Game& game, GamePlayer& player) : game(game), player(player) {} @@ -39,23 +39,23 @@ class LuaPlayer : public LuaPlayerBase void DisableBuilding(lua::SafeEnum bld); void EnableAllBuildings(); void DisableAllBuildings(); - void SetRestrictedArea(kaguya::VariadicArgType inPoints); - bool IsInRestrictedArea(unsigned x, unsigned y) const; + void setRestrictedArea(kaguya::VariadicArgType inPoints); + bool isInRestrictedArea(unsigned x, unsigned y) const; void ClearResources(); bool AddWares(const std::map, unsigned>& wares); bool AddPeople(const std::map, unsigned>& people); - unsigned GetNumBuildings(lua::SafeEnum bld) const; - unsigned GetNumBuildingSites(lua::SafeEnum bld) const; - unsigned GetNumWares(lua::SafeEnum ware) const; - unsigned GetNumPeople(lua::SafeEnum job) const; - unsigned GetStatisticsValue(lua::SafeEnum stat) const; + unsigned getNumBuildings(lua::SafeEnum bld) const; + unsigned getNumBuildingSites(lua::SafeEnum bld) const; + unsigned getNumWares(lua::SafeEnum ware) const; + unsigned getNumPeople(lua::SafeEnum job) const; + unsigned getStatisticsValue(lua::SafeEnum stat) const; bool AIConstructionOrder(unsigned x, unsigned y, lua::SafeEnum bld); void ModifyHQ(bool isTent); bool IsDefeated() const; void Surrender(bool destroyBlds); - std::pair GetHQPos() const; - bool IsAlly(unsigned char otherPlayerId); - bool IsAttackable(unsigned char otherPlayerId); + std::pair getHQPos() const; + bool isAlly(unsigned char otherPlayerId); + bool isAttackable(unsigned char otherPlayerId); void SuggestPact(unsigned char otherPlayerId, lua::SafeEnum pt, unsigned duration); void CancelPact(lua::SafeEnum pt, unsigned char otherPlayerId); }; diff --git a/libs/s25main/lua/LuaPlayerBase.cpp b/libs/s25main/lua/LuaPlayerBase.cpp index 43053647b2..74c042060b 100644 --- a/libs/s25main/lua/LuaPlayerBase.cpp +++ b/libs/s25main/lua/LuaPlayerBase.cpp @@ -11,15 +11,15 @@ void LuaPlayerBase::Register(kaguya::State& state) { state["PlayerBase"].setClass(kaguya::UserdataMetatable() - .addFunction("GetName", &LuaPlayerBase::GetName) - .addFunction("GetNation", &LuaPlayerBase::GetNation) - .addFunction("GetTeam", &LuaPlayerBase::GetTeam) - .addFunction("GetColor", &LuaPlayerBase::GetColor) - .addFunction("IsFree", &LuaPlayerBase::IsFree) - .addFunction("IsHuman", &LuaPlayerBase::IsHuman) - .addFunction("IsAI", &LuaPlayerBase::IsAI) - .addFunction("IsClosed", &LuaPlayerBase::IsClosed) - .addFunction("GetAILevel", &LuaPlayerBase::GetAILevel)); + .addFunction("GetName", &LuaPlayerBase::getName) + .addFunction("GetNation", &LuaPlayerBase::getNation) + .addFunction("GetTeam", &LuaPlayerBase::getTeam) + .addFunction("GetColor", &LuaPlayerBase::getColor) + .addFunction("IsFree", &LuaPlayerBase::isFree) + .addFunction("IsHuman", &LuaPlayerBase::isHuman) + .addFunction("IsAI", &LuaPlayerBase::isAI) + .addFunction("IsClosed", &LuaPlayerBase::isClosed) + .addFunction("GetAILevel", &LuaPlayerBase::getAILevel)); #pragma region ConstDefs @@ -35,57 +35,57 @@ void LuaPlayerBase::Register(kaguya::State& state) #pragma endregion ConstDefs } -std::string LuaPlayerBase::GetName() const +std::string LuaPlayerBase::getName() const { - return GetPlayer().name; + return getPlayer().name; } -Nation LuaPlayerBase::GetNation() const +Nation LuaPlayerBase::getNation() const { - return GetPlayer().nation; + return getPlayer().nation; } -Team LuaPlayerBase::GetTeam() const +Team LuaPlayerBase::getTeam() const { - return GetPlayer().team; + return getPlayer().team; } -unsigned LuaPlayerBase::GetColor() const +unsigned LuaPlayerBase::getColor() const { - int colorIdx = GetPlayer().GetColorIdx(); + int colorIdx = getPlayer().getColorIdx(); if(colorIdx < 0) - return GetPlayer().color; + return getPlayer().color; else return static_cast(colorIdx); } -bool LuaPlayerBase::IsHuman() const +bool LuaPlayerBase::isHuman() const { - return GetPlayer().ps == PlayerState::Occupied; + return getPlayer().ps == PlayerState::Occupied; } -bool LuaPlayerBase::IsAI() const +bool LuaPlayerBase::isAI() const { - return GetPlayer().ps == PlayerState::AI; + return getPlayer().ps == PlayerState::AI; } -bool LuaPlayerBase::IsClosed() const +bool LuaPlayerBase::isClosed() const { - return GetPlayer().ps == PlayerState::Locked; + return getPlayer().ps == PlayerState::Locked; } -bool LuaPlayerBase::IsFree() const +bool LuaPlayerBase::isFree() const { - return GetPlayer().ps == PlayerState::Free; + return getPlayer().ps == PlayerState::Free; } -int LuaPlayerBase::GetAILevel() const +int LuaPlayerBase::getAILevel() const { - if(GetPlayer().ps != PlayerState::AI) + if(getPlayer().ps != PlayerState::AI) return -1; - if(GetPlayer().aiInfo.type == AI::Type::Dummy) + if(getPlayer().aiInfo.type == AI::Type::Dummy) return 0; - switch(GetPlayer().aiInfo.level) + switch(getPlayer().aiInfo.level) { case AI::Level::Easy: return 1; case AI::Level::Medium: return 2; diff --git a/libs/s25main/lua/LuaPlayerBase.h b/libs/s25main/lua/LuaPlayerBase.h index 483c374d1e..cf4c09f4e3 100644 --- a/libs/s25main/lua/LuaPlayerBase.h +++ b/libs/s25main/lua/LuaPlayerBase.h @@ -19,18 +19,18 @@ class LuaPlayerBase LuaPlayerBase() = default; virtual ~LuaPlayerBase() = default; - virtual const BasePlayerInfo& GetPlayer() const = 0; + virtual const BasePlayerInfo& getPlayer() const = 0; public: static void Register(kaguya::State& state); - std::string GetName() const; - Nation GetNation() const; - Team GetTeam() const; - unsigned GetColor() const; - bool IsHuman() const; - bool IsAI() const; - bool IsClosed() const; - bool IsFree() const; - int GetAILevel() const; + std::string getName() const; + Nation getNation() const; + Team getTeam() const; + unsigned getColor() const; + bool isHuman() const; + bool isAI() const; + bool isClosed() const; + bool isFree() const; + int getAILevel() const; }; diff --git a/libs/s25main/lua/LuaServerPlayer.cpp b/libs/s25main/lua/LuaServerPlayer.cpp index b3cdbf84f6..342ff164a2 100644 --- a/libs/s25main/lua/LuaServerPlayer.cpp +++ b/libs/s25main/lua/LuaServerPlayer.cpp @@ -9,42 +9,42 @@ #include "s25util/colors.h" #include -const BasePlayerInfo& LuaServerPlayer::GetPlayer() const +const BasePlayerInfo& LuaServerPlayer::getPlayer() const { return player; } LuaServerPlayer::LuaServerPlayer(IGameLobbyController& lobbyServerController, unsigned playerId) : lobbyServerController_(lobbyServerController), playerId(playerId), - player(lobbyServerController_.GetJoinPlayer(playerId)) + player(lobbyServerController_.getJoinPlayer(playerId)) {} void LuaServerPlayer::Register(kaguya::State& state) { LuaPlayerBase::Register(state); state["Player"].setClass(kaguya::UserdataMetatable() - .addFunction("SetNation", &LuaServerPlayer::SetNation) - .addFunction("SetTeam", &LuaServerPlayer::SetTeam) - .addFunction("SetColor", &LuaServerPlayer::SetColor) + .addFunction("SetNation", &LuaServerPlayer::setNation) + .addFunction("SetTeam", &LuaServerPlayer::setTeam) + .addFunction("SetColor", &LuaServerPlayer::setColor) .addFunction("Close", &LuaServerPlayer::Close) - .addFunction("SetAI", &LuaServerPlayer::SetAI) - .addFunction("SetName", &LuaServerPlayer::SetName) - .addFunction("SetPortrait", &LuaServerPlayer::SetPortrait)); + .addFunction("SetAI", &LuaServerPlayer::setAI) + .addFunction("SetName", &LuaServerPlayer::setName) + .addFunction("SetPortrait", &LuaServerPlayer::setPortrait)); } -void LuaServerPlayer::SetNation(lua::SafeEnum nat) +void LuaServerPlayer::setNation(lua::SafeEnum nat) { player.nation = nat; - lobbyServerController_.SetNation(playerId, nat); + lobbyServerController_.setNation(playerId, nat); } -void LuaServerPlayer::SetTeam(lua::SafeEnum team) +void LuaServerPlayer::setTeam(lua::SafeEnum team) { player.team = team; - lobbyServerController_.SetTeam(playerId, team); + lobbyServerController_.setTeam(playerId, team); } -void LuaServerPlayer::SetColor(unsigned colorOrIdx) +void LuaServerPlayer::setColor(unsigned colorOrIdx) { if(GetAlpha(colorOrIdx) == 0) { @@ -52,7 +52,7 @@ void LuaServerPlayer::SetColor(unsigned colorOrIdx) player.color = PLAYER_COLORS[colorOrIdx]; } else player.color = colorOrIdx; - lobbyServerController_.SetColor(playerId, player.color); + lobbyServerController_.setColor(playerId, player.color); } void LuaServerPlayer::Close() @@ -62,7 +62,7 @@ void LuaServerPlayer::Close() lobbyServerController_.CloseSlot(playerId); } -void LuaServerPlayer::SetAI(unsigned level) +void LuaServerPlayer::setAI(unsigned level) { AI::Info info(AI::Type::Default); switch(level) @@ -73,15 +73,15 @@ void LuaServerPlayer::SetAI(unsigned level) case 3: info.level = AI::Level::Hard; break; default: lua::assertTrue(false, "Invalid AI level"); } - lobbyServerController_.SetPlayerState(playerId, PlayerState::AI, info); + lobbyServerController_.setPlayerState(playerId, PlayerState::AI, info); } -void LuaServerPlayer::SetName(const std::string& name) +void LuaServerPlayer::setName(const std::string& name) { - lobbyServerController_.SetName(playerId, name); + lobbyServerController_.setName(playerId, name); } -void LuaServerPlayer::SetPortrait(unsigned int portraitIndex) +void LuaServerPlayer::setPortrait(unsigned int portraitIndex) { - lobbyServerController_.SetPortrait(playerId, portraitIndex); + lobbyServerController_.setPortrait(playerId, portraitIndex); } diff --git a/libs/s25main/lua/LuaServerPlayer.h b/libs/s25main/lua/LuaServerPlayer.h index 1b56504b59..b879791520 100644 --- a/libs/s25main/lua/LuaServerPlayer.h +++ b/libs/s25main/lua/LuaServerPlayer.h @@ -18,17 +18,17 @@ class LuaServerPlayer : public LuaPlayerBase JoinPlayerInfo& player; protected: - const BasePlayerInfo& GetPlayer() const override; + const BasePlayerInfo& getPlayer() const override; public: LuaServerPlayer(IGameLobbyController& lobbyServerController, unsigned playerId); static void Register(kaguya::State& state); - void SetNation(lua::SafeEnum nat); - void SetTeam(lua::SafeEnum team); - void SetColor(unsigned colorOrIdx); + void setNation(lua::SafeEnum nat); + void setTeam(lua::SafeEnum team); + void setColor(unsigned colorOrIdx); void Close(); - void SetAI(unsigned level); - void SetName(const std::string& name); - void SetPortrait(unsigned int portraitIndex); + void setAI(unsigned level); + void setName(const std::string& name); + void setPortrait(unsigned int portraitIndex); }; diff --git a/libs/s25main/lua/LuaWorld.cpp b/libs/s25main/lua/LuaWorld.cpp index 9d93c9e65b..349376fbd0 100644 --- a/libs/s25main/lua/LuaWorld.cpp +++ b/libs/s25main/lua/LuaWorld.cpp @@ -34,7 +34,7 @@ void LuaWorld::Register(kaguya::State& state) .addFunction("AddEnvObject", AddEnvObjectWrapper()) .addFunction("AddStaticObject", AddStaticObjectWrapper()) .addFunction("AddAnimal", &LuaWorld::AddAnimal) - .addFunction("SetComputerBarrier", &LuaWorld::SetComputerBarrier)); + .addFunction("SetComputerBarrier", &LuaWorld::setComputerBarrier)); } static bool isValidObject(unsigned file, unsigned id) @@ -53,17 +53,17 @@ bool LuaWorld::AddEnvObject(int x, int y, unsigned id, unsigned file /* = 0xFFFF lua::assertTrue(isValidObject(file, id), "Invalid object (file/id)"); MapPoint pt = gw.MakeMapPoint(Position(x, y)); - noBase* obj = gw.GetNode(pt).obj; + noBase* obj = gw.getNode(pt).obj; if(obj) { - const GO_Type got = obj->GetGOT(); + const GO_Type got = obj->getGOT(); RTTR_Assert(got != GO_Type::Nothing); if(got != GO_Type::Staticobject && got != GO_Type::Envobject) return false; } gw.DestroyNO(pt, false); - gw.SetNO(pt, new noEnvObject(pt, id, file)); + gw.setNO(pt, new noEnvObject(pt, id, file)); gw.RecalcBQAroundPoint(pt); return true; } @@ -74,17 +74,17 @@ bool LuaWorld::AddStaticObject(int x, int y, unsigned id, unsigned file /* = 0xF lua::assertTrue(isValidObject(file, id), "Invalid object (file/id)"); MapPoint pt = gw.MakeMapPoint(Position(x, y)); - noBase* obj = gw.GetNode(pt).obj; + noBase* obj = gw.getNode(pt).obj; if(obj) { - const GO_Type got = obj->GetGOT(); + const GO_Type got = obj->getGOT(); RTTR_Assert(got != GO_Type::Nothing); if(got != GO_Type::Staticobject && got != GO_Type::Envobject) return false; } gw.DestroyNO(pt, false); - gw.SetNO(pt, new noStaticObject(pt, id, file, size)); + gw.setNO(pt, new noStaticObject(pt, id, file, size)); if(size > 1) gw.RecalcBQAroundPointBig(pt); else if(size == 1) @@ -98,7 +98,7 @@ void LuaWorld::AddAnimal(int x, int y, lua::SafeEnum species) gw.AddFigure(pos, std::make_unique(species, pos)).StartLiving(); } -void LuaWorld::SetComputerBarrier(unsigned radius, unsigned short x, unsigned short y) +void LuaWorld::setComputerBarrier(unsigned radius, unsigned short x, unsigned short y) { - gw.SetComputerBarrier({x, y}, radius); + gw.setComputerBarrier({x, y}, radius); } diff --git a/libs/s25main/lua/LuaWorld.h b/libs/s25main/lua/LuaWorld.h index 1b951b84f1..59b600d600 100644 --- a/libs/s25main/lua/LuaWorld.h +++ b/libs/s25main/lua/LuaWorld.h @@ -23,5 +23,5 @@ class LuaWorld bool AddEnvObject(int x, int y, unsigned id, unsigned file = 0xFFFF); bool AddStaticObject(int x, int y, unsigned id, unsigned file = 0xFFFF, unsigned size = 1); void AddAnimal(int x, int y, lua::SafeEnum species); - void SetComputerBarrier(unsigned radius, unsigned short x, unsigned short y); + void setComputerBarrier(unsigned radius, unsigned short x, unsigned short y); }; diff --git a/libs/s25main/mapGenerator/Algorithms.cpp b/libs/s25main/mapGenerator/Algorithms.cpp index b3974aefb8..5d9d34f5c4 100644 --- a/libs/s25main/mapGenerator/Algorithms.cpp +++ b/libs/s25main/mapGenerator/Algorithms.cpp @@ -16,7 +16,7 @@ void UpdateDistances(NodeMapBase& distances, std::queue& que queue.pop(); - const auto& neighbors = distances.GetNeighbours(currentPoint); + const auto& neighbors = distances.getNeighbours(currentPoint); for(const MapPoint& neighbor : neighbors) { @@ -35,8 +35,8 @@ void UpdateDistances(NodeMapBase& distances, std::queue& que void FlattenForCastleBuilding(NodeMapBase& heightMap, MapPoint pos) { - const auto& neighbors = heightMap.GetNeighbours(pos); - const auto& farNeighbors = heightMap.GetPointsInRadius(pos, 2); + const auto& neighbors = heightMap.getNeighbours(pos); + const auto& farNeighbors = heightMap.getPointsInRadius(pos, 2); const auto compareHeight = [&heightMap](const MapPoint& p1, const MapPoint& p2) { return heightMap[p1] < heightMap[p2]; diff --git a/libs/s25main/mapGenerator/Algorithms.h b/libs/s25main/mapGenerator/Algorithms.h index f27a28de7a..41576e1647 100644 --- a/libs/s25main/mapGenerator/Algorithms.h +++ b/libs/s25main/mapGenerator/Algorithms.h @@ -37,12 +37,12 @@ auto join(const T& container) template void Smooth(unsigned iterations, unsigned radius, NodeMapBase& nodes) { - const MapExtent& size = nodes.GetSize(); + const MapExtent& size = nodes.getSize(); std::vector> neighbors(size.x * size.y); RTTR_FOREACH_PT(MapPoint, size) { - neighbors[nodes.GetIdx(pt)] = nodes.GetPointsInRadius(pt, radius); + neighbors[nodes.getIdx(pt)] = nodes.getPointsInRadius(pt, radius); } for(unsigned i = 0; i < iterations; ++i) @@ -50,7 +50,7 @@ void Smooth(unsigned iterations, unsigned radius, NodeMapBase& nodes) RTTR_FOREACH_PT(MapPoint, size) { int sum = static_cast(nodes[pt]); - const auto& neighborPoints = neighbors[nodes.GetIdx(pt)]; + const auto& neighborPoints = neighbors[nodes.getIdx(pt)]; for(const MapPoint& p : neighborPoints) { @@ -76,7 +76,7 @@ template void Scale(NodeMapBase& values, T minimum, T maximum) { auto range = GetRange(values); - auto actualRange = range.GetDifference(); + auto actualRange = range.getDifference(); auto actualMinimum = range.minimum; if(actualRange == 0) @@ -86,7 +86,7 @@ void Scale(NodeMapBase& values, T minimum, T maximum) auto scaledRange = maximum - minimum; - RTTR_FOREACH_PT(MapPoint, values.GetSize()) + RTTR_FOREACH_PT(MapPoint, values.getSize()) { auto normalizer = static_cast(values[pt] - actualMinimum) / actualRange; auto offset = round(normalizer * scaledRange); @@ -128,7 +128,7 @@ std::vector Collect(const MapBase& map, const MapPoint& pt, T&& evalua { body.push_back(currentPoint); - const auto& neighbors = map.GetNeighbours(currentPoint); + const auto& neighbors = map.getNeighbours(currentPoint); for(MapPoint neighbor : neighbors) { searchSpace.push(neighbor); @@ -243,7 +243,7 @@ T LimitFor(const NodeMapBase& values, double coverage, T minimum) return maximum; } - const auto nodes = values.GetWidth() * values.GetHeight(); + const auto nodes = values.getWidth() * values.getHeight(); const auto expectedNodes = static_cast(coverage * nodes); unsigned currentNodes = 0; @@ -293,7 +293,7 @@ T LimitFor(const NodeMapBase& values, const T_Area& area, double coverage, T return maximum; } - const auto nodes = area.empty() ? values.GetWidth() * values.GetHeight() : area.size(); + const auto nodes = area.empty() ? values.getWidth() * values.getHeight() : area.size(); const auto expectedNodes = static_cast(coverage * nodes); unsigned currentNodes = 0; diff --git a/libs/s25main/mapGenerator/Harbors.cpp b/libs/s25main/mapGenerator/Harbors.cpp index f373231d98..546306c667 100644 --- a/libs/s25main/mapGenerator/Harbors.cpp +++ b/libs/s25main/mapGenerator/Harbors.cpp @@ -16,14 +16,14 @@ void PlaceHarborPosition(Map& map, const MapPoint& position) auto& textures = map.textureMap; - auto harborTexture = textures.Find(IsBuildableCoast); + auto harborTexture = textures.Find(isBuildableCoast); auto triangles = GetTriangles(position, map.size); auto isWater = [&textures](const MapPoint& pt) { return textures.Any(pt, IsWater); }; for(const Triangle& triangle : triangles) { - textures.Set(triangle, harborTexture); + textures.set(triangle, harborTexture); } for(const Triangle& triangle : triangles) @@ -42,8 +42,8 @@ std::vector> FindCoastlines(const Map& map, const std::vec const auto isCoast = [&map](const MapPoint& pt) { const auto allWater = [&map](const MapPoint& p) { return map.textureMap.All(p, IsWater); }; - return map.textureMap.Any(pt, IsLand) && map.textureMap.Any(pt, IsWater) - && helpers::contains_if(map.getTextures().GetNeighbours(pt), allWater); + return map.textureMap.Any(pt, isLand) && map.textureMap.Any(pt, IsWater) + && helpers::contains_if(map.getTextures().getNeighbours(pt), allWater); }; RTTR_FOREACH_PT(MapPoint, map.size) diff --git a/libs/s25main/mapGenerator/HeadQuarters.cpp b/libs/s25main/mapGenerator/HeadQuarters.cpp index 4e78845fb8..f51ea2ce48 100644 --- a/libs/s25main/mapGenerator/HeadQuarters.cpp +++ b/libs/s25main/mapGenerator/HeadQuarters.cpp @@ -14,10 +14,10 @@ std::vector FindLargestConnectedArea(const Map& map) std::set visited; std::vector connectedArea; - auto partiallyBuildable = [&map](const MapPoint& pt) { return map.textureMap.Any(pt, IsBuildableLand); }; + auto partiallyBuildable = [&map](const MapPoint& pt) { return map.textureMap.Any(pt, isBuildableLand); }; auto partiallyConnected = [&map, &partiallyBuildable](const MapPoint& pt) { - return helpers::contains_if(map.getTextures().GetNeighbours(pt), partiallyBuildable); + return helpers::contains_if(map.getTextures().getNeighbours(pt), partiallyBuildable); }; RTTR_FOREACH_PT(MapPoint, map.size) diff --git a/libs/s25main/mapGenerator/HeadQuarters.h b/libs/s25main/mapGenerator/HeadQuarters.h index cbfbfe8c8f..bd310e3073 100644 --- a/libs/s25main/mapGenerator/HeadQuarters.h +++ b/libs/s25main/mapGenerator/HeadQuarters.h @@ -83,7 +83,7 @@ std::vector FindHqPositions(const Map& map, const T_Container& area, M } // 5. sort remaining points by how close they're to desired mountain distance - const auto mountain = [&map](const MapPoint& pt) { return map.textureMap.Any(pt, IsMinableMountain); }; + const auto mountain = [&map](const MapPoint& pt) { return map.textureMap.Any(pt, isMinableMountain); }; const auto mountainDistances = DistancesTo(map.size, mountain); const auto desiredDistance = static_cast(distance); const auto desiredDistanceOffset = [&mountainDistances, desiredDistance](const MapPoint& pt) { diff --git a/libs/s25main/mapGenerator/Islands.cpp b/libs/s25main/mapGenerator/Islands.cpp index 13915d1405..4ad749b4fa 100644 --- a/libs/s25main/mapGenerator/Islands.cpp +++ b/libs/s25main/mapGenerator/Islands.cpp @@ -17,7 +17,7 @@ Island CreateIsland(Map& map, RandomUtility& rnd, unsigned size, unsigned minLan const unsigned maxDistance = *std::max_element(distances.begin(), distances.end()); const unsigned minDistance = std::min(maxDistance, minLandDist * 10); const auto possibleCenters = SelectPoints( - [&distances, minDistance](const MapPoint& pt) { return distances[pt] >= minDistance; }, distances.GetSize()); + [&distances, minDistance](const MapPoint& pt) { return distances[pt] >= minDistance; }, distances.getSize()); const MapPoint center = rnd.RandomItem(possibleCenters); const auto compare = [&distances, ¢er](const MapPoint& rhs, const MapPoint& lhs) { @@ -41,7 +41,7 @@ Island CreateIsland(Map& map, RandomUtility& rnd, unsigned size, unsigned minLan queue.pop(); - const auto& points = map.z.GetPointsInRadius(currentPoint, minLandDist); + const auto& points = map.z.getPointsInRadius(currentPoint, minLandDist); for(const MapPoint& pt : points) { @@ -56,7 +56,7 @@ Island CreateIsland(Map& map, RandomUtility& rnd, unsigned size, unsigned minLan } auto isCoast = [&map, &island](const MapPoint& pt) { - return helpers::contains_if(map.z.GetNeighbours(pt), + return helpers::contains_if(map.z.getNeighbours(pt), [&island](const MapPoint& pt) { return !helpers::contains(island, pt); }); }; @@ -69,11 +69,11 @@ Island CreateIsland(Map& map, RandomUtility& rnd, unsigned size, unsigned minLan map.z[pt] = std::min(static_cast(minimum), map.height.maximum); } - auto mountain = map.textureMap.FindAll(IsMinableMountain); + auto mountain = map.textureMap.FindAll(isMinableMountain); auto mountainLevel = LimitFor(coastDistance, island, 1. - mountainCoverage, map.height.minimum + 1u); auto mountainRange = ValueRange(mountainLevel, GetMaximum(coastDistance, island)); - auto textures = map.textureMap.FindAll(IsBuildableLand); + auto textures = map.textureMap.FindAll(isBuildableLand); auto textureRange = ValueRange(0u, mountainLevel); map.textureMap.Sort(textures, ByHumidity); @@ -82,10 +82,10 @@ Island CreateIsland(Map& map, RandomUtility& rnd, unsigned size, unsigned minLan { if(coastDistance[pt] < mountainLevel) { - map.textureMap.Set(pt, textures[MapValueToIndex(coastDistance[pt], textureRange, textures.size())]); + map.textureMap.set(pt, textures[MapValueToIndex(coastDistance[pt], textureRange, textures.size())]); } else { - map.textureMap.Set(pt, mountain[MapValueToIndex(coastDistance[pt], mountainRange, mountain.size())]); + map.textureMap.set(pt, mountain[MapValueToIndex(coastDistance[pt], mountainRange, mountain.size())]); } } diff --git a/libs/s25main/mapGenerator/Map.cpp b/libs/s25main/mapGenerator/Map.cpp index c50d090bd5..de9238ebb5 100644 --- a/libs/s25main/mapGenerator/Map.cpp +++ b/libs/s25main/mapGenerator/Map.cpp @@ -32,7 +32,7 @@ libsiedler2::Archiv Map::CreateArchiv() const header->setWidth(size.x); header->setHeight(size.y); header->setNumPlayers(players); - header->setGfxSet(textureMap.GetLandscapeId()); + header->setGfxSet(textureMap.getLandscapeId()); if(players != hqPositions.size()) throw std::logic_error("Not all players have an HQ set"); @@ -66,8 +66,8 @@ libsiedler2::Archiv Map::CreateArchiv() const const auto& textureTriangles = getTextures(); for(unsigned i = 0; i < numNodes; i++) { - rsu[i] = textureMap.GetTextureId(textureTriangles[i].rsu); - lsd[i] = textureMap.GetTextureId(textureTriangles[i].lsd); + rsu[i] = textureMap.getTextureId(textureTriangles[i].rsu); + lsd[i] = textureMap.getTextureId(textureTriangles[i].lsd); animal[i] = static_cast(this->animals[i]); } @@ -75,8 +75,8 @@ libsiedler2::Archiv Map::CreateArchiv() const { if(hqPositions[i].isValid()) { - objectType[this->objectTypes.GetIdx(hqPositions[i])] = libsiedler2::OT_HeadquarterMask; - objectInfo[this->objectInfos.GetIdx(hqPositions[i])] = i; + objectType[this->objectTypes.getIdx(hqPositions[i])] = libsiedler2::OT_HeadquarterMask; + objectInfo[this->objectInfos.getIdx(hqPositions[i])] = i; } } diff --git a/libs/s25main/mapGenerator/NodeMapUtilities.h b/libs/s25main/mapGenerator/NodeMapUtilities.h index b2a842f712..fd13b08d51 100644 --- a/libs/s25main/mapGenerator/NodeMapUtilities.h +++ b/libs/s25main/mapGenerator/NodeMapUtilities.h @@ -25,7 +25,7 @@ struct ValueRange * * @returns the difference between maximum and minimum. */ - T_Value GetDifference() const { return maximum - minimum; } + T_Value getDifference() const { return maximum - minimum; } }; /** @@ -42,7 +42,7 @@ struct ValueRange template unsigned MapValueToIndex(T_Value value, const ValueRange& range, size_t size) { - T_Value difference = range.GetDifference(); + T_Value difference = range.getDifference(); if(difference) { @@ -113,7 +113,7 @@ MapPoint GetMaximumPoint(const NodeMapBase& values) { auto maximum = std::max_element(values.begin(), values.end()); auto index = std::distance(values.begin(), maximum); - return MapPoint(static_cast(index % values.GetWidth()), static_cast(index / values.GetWidth())); + return MapPoint(static_cast(index % values.getWidth()), static_cast(index / values.getWidth())); } /** diff --git a/libs/s25main/mapGenerator/RandomMap.cpp b/libs/s25main/mapGenerator/RandomMap.cpp index 50535154b7..b302748e78 100644 --- a/libs/s25main/mapGenerator/RandomMap.cpp +++ b/libs/s25main/mapGenerator/RandomMap.cpp @@ -18,7 +18,7 @@ namespace rttr::mapGenerator { -unsigned GetMaximumHeight(const MapExtent& size) +unsigned getMaximumHeight(const MapExtent& size) { const unsigned combinedSize = size.x * size.y; if(combinedSize <= 64 * 64) @@ -35,7 +35,7 @@ unsigned GetMaximumHeight(const MapExtent& size) return 60; } -unsigned GetCoastline(const MapExtent& size) +unsigned getCoastline(const MapExtent& size) { const unsigned combinedSize = size.x * size.y; if(combinedSize <= 128 * 128) @@ -48,7 +48,7 @@ unsigned GetCoastline(const MapExtent& size) return 4; } -unsigned GetIslandRadius(const MapExtent& size) +unsigned getIslandRadius(const MapExtent& size) { const unsigned combinedSize = size.x * size.y; if(combinedSize <= 128 * 128) @@ -63,7 +63,7 @@ unsigned GetIslandRadius(const MapExtent& size) return 6; } -unsigned GetIslandSize(const MapExtent& size) +unsigned getIslandSize(const MapExtent& size) { const unsigned combinedSize = size.x * size.y; if(combinedSize <= 64 * 64) @@ -78,7 +78,7 @@ unsigned GetIslandSize(const MapExtent& size) return 1200; } -unsigned GetSmoothRadius(const MapExtent& size) +unsigned getSmoothRadius(const MapExtent& size) { const unsigned combinedSize = size.x * size.y; if(combinedSize <= 128 * 128) @@ -93,7 +93,7 @@ unsigned GetSmoothRadius(const MapExtent& size) return 7; } -unsigned GetSmoothIterations(const MapExtent& size) +unsigned getSmoothIterations(const MapExtent& size) { const unsigned combinedSize = size.x * size.y; if(combinedSize <= 64 * 64) @@ -112,8 +112,8 @@ unsigned GetSmoothIterations(const MapExtent& size) void SmoothHeightMap(NodeMapBase& z, const ValueRange& range) { - int radius = GetSmoothRadius(z.GetSize()); - int iterations = GetSmoothIterations(z.GetSize()); + int radius = getSmoothRadius(z.getSize()); + int iterations = getSmoothIterations(z.getSize()); Smooth(iterations, radius, z); Scale(z, range.minimum, range.maximum); @@ -125,7 +125,7 @@ RandomMap::RandomMap(RandomUtility& rnd, Map& map) void RandomMap::Create(const MapSettings& settings) { - auto defaultHeight = map_.height.minimum + map_.height.GetDifference() / 2; + auto defaultHeight = map_.height.minimum + map_.height.getDifference() / 2; settings_ = settings; map_.z.Resize(settings.size, defaultHeight); @@ -165,9 +165,9 @@ std::vector RandomMap::CreateRivers(const MapPoint source) void RandomMap::CreateFreeIslands(unsigned waterNodes) { - const auto islandRadius = GetIslandRadius(map_.size); + const auto islandRadius = getIslandRadius(map_.size); const auto islandAmount = static_cast(settings_.islands) / 100; - const auto maxIslandSize = GetIslandSize(map_.size); + const auto maxIslandSize = getIslandSize(map_.size); const auto minIslandSize = std::min(200u, maxIslandSize); auto islandNodes = static_cast(islandAmount * waterNodes); auto islandSize = rnd_.RandomValue(minIslandSize, maxIslandSize); @@ -203,7 +203,7 @@ void RandomMap::CreateMixedMap() CreateFreeIslands(waterNodes); - texturizer_.AddTextures(mountainLevel, GetCoastline(map_.size)); + texturizer_.AddTextures(mountainLevel, getCoastline(map_.size)); PlaceHarbors(map_, rivers); PlaceHeadquarters(map_, rnd_, map_.players, settings_.mountainDistance); @@ -230,8 +230,8 @@ void RandomMap::CreateWaterMap() const unsigned waterNodes = helpers::count(map_.z, map_.height.minimum); const auto land = 1. - static_cast(waterNodes) / (map_.size.x * map_.size.y) - mountain; const auto mountainLevel = LimitFor(map_.z, land, static_cast(1)) + 1; - const auto islandSize = GetIslandSize(map_.size); - const auto islandRadius = GetIslandRadius(map_.size); + const auto islandSize = getIslandSize(map_.size); + const auto islandRadius = getIslandRadius(map_.size); std::vector islands(map_.players); @@ -247,7 +247,7 @@ void RandomMap::CreateWaterMap() const auto rivers = CreateRivers(center); - texturizer_.AddTextures(mountainLevel, GetCoastline(map_.size)); + texturizer_.AddTextures(mountainLevel, getCoastline(map_.size)); PlaceHarbors(map_, rivers); @@ -271,14 +271,14 @@ void RandomMap::CreateLandMap() const auto mountainLevel = LimitFor(map_.z, land, static_cast(1)) + 1; CreateRivers(); - texturizer_.AddTextures(mountainLevel, GetCoastline(map_.size)); + texturizer_.AddTextures(mountainLevel, getCoastline(map_.size)); PlaceHeadquarters(map_, rnd_, map_.players, settings_.mountainDistance); } Map GenerateRandomMap(RandomUtility& rnd, const WorldDescription& worldDesc, const MapSettings& settings) { - auto height = GetMaximumHeight(settings.size); + auto height = getMaximumHeight(settings.size); Map map(settings.size, settings.numPlayers, worldDesc, settings.type, height); RandomMap randomMap(rnd, map); randomMap.Create(settings); diff --git a/libs/s25main/mapGenerator/RandomMap.h b/libs/s25main/mapGenerator/RandomMap.h index 97d7835dff..b59f9ca320 100644 --- a/libs/s25main/mapGenerator/RandomMap.h +++ b/libs/s25main/mapGenerator/RandomMap.h @@ -13,12 +13,12 @@ namespace rttr::mapGenerator { -unsigned GetMaximumHeight(const MapExtent& size); -unsigned GetCoastline(const MapExtent& size); -unsigned GetIslandRadius(const MapExtent& size); -unsigned GetIslandSize(const MapExtent& size); -unsigned GetSmoothRadius(const MapExtent& size); -unsigned GetSmoothIterations(const MapExtent& size); +unsigned getMaximumHeight(const MapExtent& size); +unsigned getCoastline(const MapExtent& size); +unsigned getIslandRadius(const MapExtent& size); +unsigned getIslandSize(const MapExtent& size); +unsigned getSmoothRadius(const MapExtent& size); +unsigned getSmoothIterations(const MapExtent& size); void SmoothHeightMap(NodeMapBase& z, const ValueRange& range); diff --git a/libs/s25main/mapGenerator/Resources.cpp b/libs/s25main/mapGenerator/Resources.cpp index a46bd94573..19c798814b 100644 --- a/libs/s25main/mapGenerator/Resources.cpp +++ b/libs/s25main/mapGenerator/Resources.cpp @@ -14,7 +14,7 @@ namespace rttr::mapGenerator { std::vector CreateTrees(const TextureMap& textures) { - const auto landscapeId = textures.GetLandscapeId(); + const auto landscapeId = textures.getLandscapeId(); Tree pineApple(libsiedler2::OT_Palm, libsiedler2::OI_Tree1_Begin); Tree palm1(libsiedler2::OT_TreeOrPalm, libsiedler2::OI_Palm_Begin); @@ -66,7 +66,7 @@ void AddObjects(Map& map, RandomUtility& rnd, const MapSettings& settings) { auto suroundingArea = map.getTextures().GetPointsInRadiusWithCenter(pt, 5); excludedArea.insert(suroundingArea.begin(), suroundingArea.end()); - } else if(map.textureMap.Any(pt, IsSnowOrLava)) + } else if(map.textureMap.Any(pt, isSnowOrLava)) { excludedArea.insert(pt); } @@ -84,7 +84,7 @@ void AddObjects(Map& map, RandomUtility& rnd, const MapSettings& settings) // 3b) mountains: last element of trees auto& textureMap = map.textureMap; - const auto mountain = [&textureMap](const MapPoint& pt) { return textureMap.Any(pt, IsMountainOrSnowOrLava); }; + const auto mountain = [&textureMap](const MapPoint& pt) { return textureMap.Any(pt, isMountainOrSnowOrLava); }; const auto mountainDistance = DistancesTo(map.size, mountain); const auto water = [&textureMap](const MapPoint& pt) { return textureMap.Any(pt, IsWater); }; @@ -102,9 +102,9 @@ void AddObjects(Map& map, RandomUtility& rnd, const MapSettings& settings) const auto range = GetRange(waterDistance); const auto probRange = ValueRange(settings.trees / 2, settings.trees); - const unsigned probDiff = probRange.GetDifference(); + const unsigned probDiff = probRange.getDifference(); - const auto mountainFoot = [&map](const MapPoint& pt) { return !map.textureMap.All(pt, IsMountainOrSnowOrLava); }; + const auto mountainFoot = [&map](const MapPoint& pt) { return !map.textureMap.All(pt, isMountainOrSnowOrLava); }; const auto mountainDepth = DistancesTo(map.size, mountainFoot); const auto mountainRange = GetRange(mountainDepth); @@ -196,7 +196,7 @@ void AddResources(Map& map, RandomUtility& rnd, const MapSettings& settings) RTTR_FOREACH_PT(MapPoint, map.size) { - if(textures.All(pt, IsMinableMountain)) + if(textures.All(pt, isMinableMountain)) { // No mineable resources wanted. if(total == 0) @@ -226,7 +226,7 @@ void AddResources(Map& map, RandomUtility& rnd, const MapSettings& settings) const MapPoint pt_d = resources.MakeMapPoint(pt + Position(xd, yd)); // Only place it on mines that have no resource yet, adjust the budget for each placed // resource. - if(!resources[pt_d] && textures.All(pt_d, IsMinableMountain)) + if(!resources[pt_d] && textures.All(pt_d, isMinableMountain)) { --mRI.budget; resources[pt_d] = mRI.resource + rnd.RandomValue(1, 8); @@ -256,7 +256,7 @@ void AddAnimals(Map& map, RandomUtility& rnd) if(textures.All(pt, IsWater)) { map.animals[pt] = libsiedler2::Animal::Duck; - } else if(textures.All(pt, IsLand)) + } else if(textures.All(pt, isLand)) { map.animals[pt] = rnd.RandomItem(landAnimals); } diff --git a/libs/s25main/mapGenerator/Rivers.cpp b/libs/s25main/mapGenerator/Rivers.cpp index 19badaadaa..b2a5126070 100644 --- a/libs/s25main/mapGenerator/Rivers.cpp +++ b/libs/s25main/mapGenerator/Rivers.cpp @@ -28,7 +28,7 @@ River CreateStream(RandomUtility& rnd, Map& map, const MapPoint& source, Directi for(const auto& triangle : triangles) { - textures.Set(triangle, water); + textures.set(triangle, water); const auto& edges = GetTriangleEdges(triangle, size); for(const MapPoint& edge : edges) @@ -49,7 +49,7 @@ River CreateStream(RandomUtility& rnd, Map& map, const MapPoint& source, Directi currentDir = lastDir + (rnd.ByChance(50) ? 5 : 1); } - currentNode = map.getTextures().GetNeighbour(currentNode, lastDir); + currentNode = map.getTextures().getNeighbour(currentNode, lastDir); if(rnd.ByChance(splitRate)) { diff --git a/libs/s25main/mapGenerator/TextureHelper.cpp b/libs/s25main/mapGenerator/TextureHelper.cpp index bdce06bca0..76e87e31f5 100644 --- a/libs/s25main/mapGenerator/TextureHelper.cpp +++ b/libs/s25main/mapGenerator/TextureHelper.cpp @@ -16,54 +16,54 @@ bool IsWater(const TerrainDesc& terrain) return terrain.kind == TerrainKind::Water; } -bool IsSwamp(const TerrainDesc& terrain) +bool isSwamp(const TerrainDesc& terrain) { return !terrain.Is(ETerrain::Walkable) && terrain.humidity > 0; } -bool IsLand(const TerrainDesc& terrain) +bool isLand(const TerrainDesc& terrain) { return terrain.kind == TerrainKind::Land; } -bool IsShipableWater(const TerrainDesc& terrain) +bool isShipableWater(const TerrainDesc& terrain) { return terrain.kind == TerrainKind::Water && terrain.Is(ETerrain::Shippable); } -bool IsBuildableLand(const TerrainDesc& terrain) +bool isBuildableLand(const TerrainDesc& terrain) { return terrain.kind == TerrainKind::Land && terrain.Is(ETerrain::Buildable); } -bool IsCoastTerrain(const TerrainDesc& terrain) +bool isCoastTerrain(const TerrainDesc& terrain) { return terrain.kind == TerrainKind::Land && terrain.Is(ETerrain::Walkable) && terrain.GetBQ() == TerrainBQ::Flag; } -bool IsBuildableCoast(const TerrainDesc& terrain) +bool isBuildableCoast(const TerrainDesc& terrain) { - return terrain.GetBQ() == TerrainBQ::Castle && terrain.IsVital() && terrain.humidity < 100; + return terrain.GetBQ() == TerrainBQ::Castle && terrain.isVital() && terrain.humidity < 100; } -bool IsBuildableMountain(const TerrainDesc& terrain) +bool isBuildableMountain(const TerrainDesc& terrain) { return terrain.kind == TerrainKind::Mountain && terrain.Is(ETerrain::Buildable); } -bool IsMinableMountain(const TerrainDesc& terrain) +bool isMinableMountain(const TerrainDesc& terrain) { return terrain.kind == TerrainKind::Mountain && terrain.Is(ETerrain::Mineable); } -bool IsSnowOrLava(const TerrainDesc& terrain) +bool isSnowOrLava(const TerrainDesc& terrain) { return terrain.kind == TerrainKind::Snow || terrain.kind == TerrainKind::Lava; } -bool IsMountainOrSnowOrLava(const TerrainDesc& terrain) +bool isMountainOrSnowOrLava(const TerrainDesc& terrain) { - return terrain.kind == TerrainKind::Mountain || IsSnowOrLava(terrain); + return terrain.kind == TerrainKind::Mountain || isSnowOrLava(terrain); } } // namespace rttr::mapGenerator diff --git a/libs/s25main/mapGenerator/TextureHelper.h b/libs/s25main/mapGenerator/TextureHelper.h index 29c7cf9940..9ff03c51ed 100644 --- a/libs/s25main/mapGenerator/TextureHelper.h +++ b/libs/s25main/mapGenerator/TextureHelper.h @@ -12,24 +12,24 @@ uint8_t ByHumidity(const TerrainDesc& terrain); bool IsWater(const TerrainDesc& terrain); -bool IsSwamp(const TerrainDesc& terrain); +bool isSwamp(const TerrainDesc& terrain); -bool IsLand(const TerrainDesc& terrain); +bool isLand(const TerrainDesc& terrain); -bool IsShipableWater(const TerrainDesc& terrain); +bool isShipableWater(const TerrainDesc& terrain); -bool IsBuildableLand(const TerrainDesc& terrain); +bool isBuildableLand(const TerrainDesc& terrain); -bool IsCoastTerrain(const TerrainDesc& terrain); +bool isCoastTerrain(const TerrainDesc& terrain); -bool IsBuildableCoast(const TerrainDesc& terrain); +bool isBuildableCoast(const TerrainDesc& terrain); -bool IsBuildableMountain(const TerrainDesc& terrain); +bool isBuildableMountain(const TerrainDesc& terrain); -bool IsMinableMountain(const TerrainDesc& terrain); +bool isMinableMountain(const TerrainDesc& terrain); -bool IsSnowOrLava(const TerrainDesc& terrain); +bool isSnowOrLava(const TerrainDesc& terrain); -bool IsMountainOrSnowOrLava(const TerrainDesc& terrain); +bool isMountainOrSnowOrLava(const TerrainDesc& terrain); } // namespace rttr::mapGenerator diff --git a/libs/s25main/mapGenerator/Textures.cpp b/libs/s25main/mapGenerator/Textures.cpp index 082684d72a..fcdfb36652 100644 --- a/libs/s25main/mapGenerator/Textures.cpp +++ b/libs/s25main/mapGenerator/Textures.cpp @@ -12,17 +12,17 @@ namespace rttr::mapGenerator { -void TextureMap::Set(const MapPoint& pt, DescIdx texture) +void TextureMap::set(const MapPoint& pt, DescIdx texture) { - const auto& triangles = GetTriangles(pt, textures_.GetSize()); + const auto& triangles = GetTriangles(pt, textures_.getSize()); for(const Triangle& triangle : triangles) { - Set(triangle, texture); + set(triangle, texture); } } -void TextureMap::Set(const Triangle& triangle, DescIdx texture) +void TextureMap::set(const Triangle& triangle, DescIdx texture) { if(triangle.rsu) { @@ -33,7 +33,7 @@ void TextureMap::Set(const Triangle& triangle, DescIdx texture) } } -DescIdx TextureMap::Get(const Triangle& triangle) const +DescIdx TextureMap::get(const Triangle& triangle) const { if(triangle.rsu) { @@ -53,11 +53,11 @@ std::vector> Texturizer::CreateTextureMapping(unsigned moun const uint8_t maximum = *std::max_element(z_.begin(), z_.end()); std::vector> mapping(maximum + 1); - const auto waterTexture = textureMap_.Find(IsShipableWater); - auto landTextures = textureMap_.FindAll(IsBuildableLand); + const auto waterTexture = textureMap_.Find(isShipableWater); + auto landTextures = textureMap_.FindAll(isBuildableLand); textureMap_.Sort(landTextures, ByHumidity); - auto mountainTextures = textureMap_.FindAll(IsMinableMountain); - mountainTextures.push_back(textureMap_.Find(IsSnowOrLava)); + auto mountainTextures = textureMap_.FindAll(isMinableMountain); + mountainTextures.push_back(textureMap_.Find(isSnowOrLava)); for(uint8_t z = 0; z <= maximum; z++) { @@ -81,7 +81,7 @@ std::vector> Texturizer::CreateTextureMapping(unsigned moun void Texturizer::ApplyTexturingByHeightMap(unsigned mountainLevel) { const auto& mapping = CreateTextureMapping(mountainLevel); - const MapExtent size = z_.GetSize(); + const MapExtent size = z_.getSize(); const auto& z = z_; auto interpolateEdges = [&size, z](const Triangle& triangle) { @@ -108,15 +108,15 @@ void Texturizer::ApplyCoastTexturing(const std::vector& coast, unsigne std::copy(coast.begin(), coast.end(), std::inserter(visited, visited.begin())); // setup transition textures from water to land - auto sand = textureMap_.Find(IsCoastTerrain); - auto sandGrass = textureMap_.FindAll(IsBuildableCoast); + auto sand = textureMap_.Find(isCoastTerrain); + auto sandGrass = textureMap_.FindAll(isBuildableCoast); textureMap_.Sort(sandGrass, ByHumidity); std::array, 3> transitionTextures{sand, sandGrass[0], sandGrass[1]}; // exclude mountain & water textures from being replaced by water-land transition std::set> excludedTextures; - const auto mountainTextures = textureMap_.FindAll(IsMountainOrSnowOrLava); - const auto water = textureMap_.Find(IsShipableWater); + const auto mountainTextures = textureMap_.FindAll(isMountainOrSnowOrLava); + const auto water = textureMap_.Find(isShipableWater); excludedTextures.insert(mountainTextures.begin(), mountainTextures.end()); excludedTextures.insert(water); @@ -133,16 +133,16 @@ void Texturizer::ApplyCoastTexturing(const std::vector& coast, unsigne void Texturizer::ApplyMountainTransitions(const std::vector& mountainFoot) { - std::set> excludedTextures{textureMap_.Find(IsShipableWater)}; + std::set> excludedTextures{textureMap_.Find(isShipableWater)}; - const auto& mountainTextures = textureMap_.FindAll(IsMountainOrSnowOrLava); + const auto& mountainTextures = textureMap_.FindAll(isMountainOrSnowOrLava); for(const auto& mountainTexture : mountainTextures) { excludedTextures.insert(mountainTexture); } - auto mountainTransition = textureMap_.Find(IsBuildableMountain); + auto mountainTransition = textureMap_.Find(isBuildableMountain); for(const MapPoint& point : mountainFoot) { @@ -155,8 +155,8 @@ void Texturizer::ApplyMountainWaterTransitions(const std::vector& tran std::set nodes; nodes.insert(transitions.begin(), transitions.end()); const auto water = textureMap_.Find(IsWater); - const auto boulder = textureMap_.Find(IsBuildableMountain); - const auto swamp = textureMap_.Find(IsSwamp); + const auto boulder = textureMap_.Find(isBuildableMountain); + const auto swamp = textureMap_.Find(isSwamp); ReplaceTextures(textures_, 0, nodes, swamp, {water}); ReplaceTextures(textures_, 1, nodes, boulder, {swamp, water}); } @@ -166,14 +166,14 @@ void Texturizer::AddTextures(unsigned mountainLevel, unsigned coastline) ApplyTexturingByHeightMap(mountainLevel); auto coast = SelectPoints( - [this](const MapPoint& pt) { return this->textureMap_.Any(pt, IsLand) && this->textureMap_.Any(pt, IsWater); }, - this->textures_.GetSize()); + [this](const MapPoint& pt) { return this->textureMap_.Any(pt, isLand) && this->textureMap_.Any(pt, IsWater); }, + this->textures_.getSize()); ApplyCoastTexturing(coast, 1); // small for tiny rivers auto isRiver = [this](const MapPoint& pt) { auto suroundedByWater = [this](const MapPoint& pt) { return this->textureMap_.All(pt, IsWater); }; - return !helpers::contains_if(this->textures_.GetNeighbours(pt), suroundedByWater); + return !helpers::contains_if(this->textures_.getNeighbours(pt), suroundedByWater); }; helpers::erase_if(coast, isRiver); @@ -181,17 +181,17 @@ void Texturizer::AddTextures(unsigned mountainLevel, unsigned coastline) const auto mountainFoot = SelectPoints( [this](const MapPoint& pt) { - return this->textureMap_.Any(pt, IsMinableMountain) && !this->textureMap_.All(pt, IsMountainOrSnowOrLava); + return this->textureMap_.Any(pt, isMinableMountain) && !this->textureMap_.All(pt, isMountainOrSnowOrLava); }, - this->textures_.GetSize()); + this->textures_.getSize()); ApplyMountainTransitions(mountainFoot); const auto moutainWaterTransition = SelectPoints( [this](const MapPoint& pt) { - return this->textureMap_.Any(pt, IsMinableMountain) && this->textureMap_.Any(pt, IsWater); + return this->textureMap_.Any(pt, isMinableMountain) && this->textureMap_.Any(pt, IsWater); }, - this->textures_.GetSize()); + this->textures_.getSize()); ApplyMountainWaterTransitions(moutainWaterTransition); } @@ -199,7 +199,7 @@ void Texturizer::AddTextures(unsigned mountainLevel, unsigned coastline) void ReplaceTextureForPoint(NodeMapBase& textures, const MapPoint& point, DescIdx texture, const std::set>& excluded) { - auto triangles = GetTriangles(point, textures.GetSize()); + auto triangles = GetTriangles(point, textures.getSize()); for(const Triangle& triangle : triangles) { @@ -230,7 +230,7 @@ void ReplaceTextures(NodeMapBase& textures, unsigned radius, std::s for(const MapPoint& pt : initialNodes) { - auto points = textures.GetPointsInRadius(pt, radius); + auto points = textures.getPointsInRadius(pt, radius); for(const MapPoint& p : points) { diff --git a/libs/s25main/mapGenerator/Textures.h b/libs/s25main/mapGenerator/Textures.h index 71719c0590..ebc6e6bf86 100644 --- a/libs/s25main/mapGenerator/Textures.h +++ b/libs/s25main/mapGenerator/Textures.h @@ -35,9 +35,9 @@ class TextureOperator terrains_(worldDesc_.terrain.findAll([landscape](const TerrainDesc& t) { return t.landscape == landscape; })) {} - uint8_t GetTextureId(DescIdx texture) const { return worldDesc_.get(texture).s2Id; } + uint8_t getTextureId(DescIdx texture) const { return worldDesc_.get(texture).s2Id; } - uint8_t GetLandscapeId() const { return worldDesc_.get(landscape_).s2Id; } + uint8_t getLandscapeId() const { return worldDesc_.get(landscape_).s2Id; } template DescIdx Find(T_Predicate predicate) const @@ -108,14 +108,14 @@ class TextureMap : public TextureOperator bool Any(const MapPoint& point, T_Predicate predicate) const { auto condition = [this, &predicate](auto triangle) { return this->Check(triangle, predicate); }; - return helpers::contains_if(GetTriangles(point, textures_.GetSize()), condition); + return helpers::contains_if(GetTriangles(point, textures_.getSize()), condition); } template bool All(const MapPoint& point, T_Predicate predicate) const { auto condition = [this, &predicate](auto triangle) { return !this->Check(triangle, predicate); }; - return !helpers::contains_if(GetTriangles(point, textures_.GetSize()), condition); + return !helpers::contains_if(GetTriangles(point, textures_.getSize()), condition); } /** @@ -124,7 +124,7 @@ class TextureMap : public TextureOperator * @param triangle triangle to update * @param texture texture to place on the triangle */ - void Set(const Triangle& triangle, DescIdx texture); + void set(const Triangle& triangle, DescIdx texture); /** * Updates all textures around the specified node. @@ -132,7 +132,7 @@ class TextureMap : public TextureOperator * @param pt position of the node * @param texture texture to place */ - void Set(const MapPoint& pt, DescIdx texture); + void set(const MapPoint& pt, DescIdx texture); /** * Gets the texture of the specified triangle. @@ -141,7 +141,7 @@ class TextureMap : public TextureOperator * * @returns the texture of the triangle. */ - DescIdx Get(const Triangle& triangle) const; + DescIdx get(const Triangle& triangle) const; }; class Texturizer diff --git a/libs/s25main/network/GameClient.cpp b/libs/s25main/network/GameClient.cpp index af58e4db0f..8fbc294b5c 100644 --- a/libs/s25main/network/GameClient.cpp +++ b/libs/s25main/network/GameClient.cpp @@ -221,7 +221,7 @@ void GameClient::Stop() else if(state == ClientState::Connect || state == ClientState::Config) gameLobby.reset(); - if(IsHost()) + if(isHost()) GAMESERVER.Stop(); framesinfo.Clear(); @@ -230,7 +230,7 @@ void GameClient::Stop() if(replayinfo) { - if(replayinfo->replay.IsRecording()) + if(replayinfo->replay.isRecording()) replayinfo->replay.StopRecording(); replayinfo->replay.Close(); replayinfo.reset(); @@ -251,17 +251,17 @@ void GameClient::Stop() aiBattlePlayers_.clear(); } -std::shared_ptr GameClient::GetGameLobby() +std::shared_ptr GameClient::getGameLobby() { RTTR_Assert(state != ClientState::Config || gameLobby); return gameLobby; } -const AIPlayer* GameClient::GetAIPlayer(unsigned id) const +const AIPlayer* GameClient::getAIPlayer(unsigned id) const { if(!game) return nullptr; - return game->GetAIPlayer(id); + return game->getAIPlayer(id); } /** @@ -274,9 +274,9 @@ void GameClient::StartGame(const unsigned random_init) RTTR_Assert(state == ClientState::Config || (state == ClientState::Stopped && replayMode)); // Mond malen - Position moonPos = VIDEODRIVER.GetMousePos(); + Position moonPos = VIDEODRIVER.getMousePos(); moonPos.y -= 40; - LOADER.GetImageN("resource", 33)->DrawFull(moonPos); + LOADER.getImageN("resource", 33)->DrawFull(moonPos); VIDEODRIVER.SwapBuffers(); // Start in pause mode @@ -290,7 +290,7 @@ void GameClient::StartGame(const unsigned random_init) RANDOM.Init(random_init); AI::getRandomGenerator().seed(random_init); - if(!IsReplayModeOn() && mapinfo.savegame && !mapinfo.savegame->Load(mapinfo.filepath, SaveGameDataToLoad::All)) + if(!isReplayModeOn() && mapinfo.savegame && !mapinfo.savegame->Load(mapinfo.filepath, SaveGameDataToLoad::All)) { OnError(ClientError::InvalidMap); return; @@ -302,7 +302,7 @@ void GameClient::StartGame(const unsigned random_init) game = std::make_shared(std::move(gameLobby->getSettings()), startGF, std::vector(gameLobby->getPlayers().begin(), gameLobby->getPlayers().end())); - if(!IsReplayModeOn()) + if(!isReplayModeOn()) { for(unsigned id = 0; id < gameLobby->getNumPlayers(); id++) { @@ -319,11 +319,11 @@ void GameClient::StartGame(const unsigned random_init) ci->CI_GameLoading(game); // Get standard settings before they get overwritten - GetPlayer(GetPlayerId()).FillVisualSettings(default_settings); + getPlayer(getPlayerId()).FillVisualSettings(default_settings); try { - SetupGameWorld(*game, mapinfo, *this, GetReplay()); + setupGameWorld(*game, mapinfo, *this, getReplay()); } catch(const GameSetupError& error) { LOG.write("%1%\n") % error.what(); @@ -355,18 +355,18 @@ void GameClient::GameLoaded() else { // Notify server that we are ready - if(IsHost()) + if(isHost()) { - for(unsigned id = 0; id < GetNumPlayers(); id++) + for(unsigned id = 0; id < getNumPlayers(); id++) { - if(GetPlayer(id).ps == PlayerState::AI) + if(getPlayer(id).ps == PlayerState::AI) { - game->AddAIPlayer(CreateAIPlayer(id, GetPlayer(id).aiInfo)); + game->AddAIPlayer(CreateAIPlayer(id, getPlayer(id).aiInfo)); SendNothingNC(id); } } - if(IsAIBattleModeOn()) - ToggleHumanAIPlayer(aiBattlePlayers_[GetPlayerId()]); + if(isAIBattleModeOn()) + ToggleHumanAIPlayer(aiBattlePlayers_[getPlayerId()]); } SendNothingNC(); } @@ -381,9 +381,9 @@ void GameClient::ExitGame() gameCommands_.clear(); } -unsigned GameClient::GetGFNumber() const +unsigned GameClient::getGFNumber() const { - return game->em_->GetCurrentGF(); + return game->em_->getCurrentGF(); } /** @@ -412,7 +412,7 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Id& msg) mainPlayer.playerId = msg.player; // Server-Typ senden - mainPlayer.sendMsgAsync(new GameMessage_Server_Type(clientconfig.servertyp, rttr::version::GetRevision())); + mainPlayer.sendMsgAsync(new GameMessage_Server_Type(clientconfig.servertyp, rttr::version::getRevision())); AdvanceState(ConnectState::VerifyServer); return true; } @@ -497,9 +497,9 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Ping& msg) gameLobby->getPlayer(msg.player).ping = msg.ping; } else if(state == ClientState::Loading || state == ClientState::Loaded || state == ClientState::Game) { - if(msg.player >= GetNumPlayers()) + if(msg.player >= getNumPlayers()) return true; - GetPlayer(msg.player).ping = msg.ping; + getPlayer(msg.player).ping = msg.ping; } else { RTTR_Assert(false); @@ -626,13 +626,13 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Kicked& msg) } else if(state == ClientState::Loading || state == ClientState::Loaded || state == ClientState::Game) { // Im Spiel anzeigen, dass der Spieler das Spiel verlassen hat - GamePlayer& player = GetPlayer(msg.player); + GamePlayer& player = getPlayer(msg.player); if(player.ps != PlayerState::AI) { player.ps = PlayerState::AI; player.aiInfo = AI::Info(AI::Type::Dummy); // Host has to handle it - if(IsHost()) + if(isHost()) { game->AddAIPlayer(CreateAIPlayer(msg.player, player.aiInfo)); SendNothingNC(msg.player); @@ -702,7 +702,7 @@ bool GameClient::OnGameMessage(const GameMessage_Server_TypeOK& msg) case StatusCode::WrongVersion: { LOG.write(_("Version mismatch. Server version: %1%, your version %2%")) % msg.version - % rttr::version::GetRevision(); + % rttr::version::getRevision(); OnError(ClientError::WrongVersion); return true; } @@ -779,20 +779,20 @@ bool GameClient::OnGameMessage(const GameMessage_Chat& msg) { if(msg.destination == ChatDestination::System) { - SystemChat(msg.text, (msg.player < game->world_.GetNumPlayers()) ? msg.player : GetPlayerId()); + SystemChat(msg.text, (msg.player < game->world_.getNumPlayers()) ? msg.player : getPlayerId()); return true; } if(state == ClientState::Game) { // Ingame message: Do some checking and logging - if(msg.player >= game->world_.GetNumPlayers()) + if(msg.player >= game->world_.getNumPlayers()) return true; /// Mit im Replay aufzeichnen - if(replayinfo && replayinfo->replay.IsRecording()) - replayinfo->replay.AddChatCommand(GetGFNumber(), msg.player, msg.destination, msg.text); + if(replayinfo && replayinfo->replay.isRecording()) + replayinfo->replay.AddChatCommand(getGFNumber(), msg.player, msg.destination, msg.text); - const GamePlayer& player = game->world_.GetPlayer(msg.player); + const GamePlayer& player = game->world_.getPlayer(msg.player); // Besiegte dürfen nicht mehr heimlich mit Verbüdeten oder Feinden reden if(player.IsDefeated() && msg.destination != ChatDestination::All) @@ -806,18 +806,18 @@ bool GameClient::OnGameMessage(const GameMessage_Chat& msg) { case ChatDestination::System: case ChatDestination::All: return true; - case ChatDestination::Allies: return player.IsAlly(playerId); - case ChatDestination::Enemies: return !player.IsAlly(playerId); + case ChatDestination::Allies: return player.isAlly(playerId); + case ChatDestination::Enemies: return !player.isAlly(playerId); } return true; // LCOV_EXCL_LINE }; for(AIPlayer& ai : game->aiPlayers_) { - if(isValidRecipient(ai.GetPlayerId())) + if(isValidRecipient(ai.getPlayerId())) ai.OnChatMessage(msg.player, msg.destination, msg.text); } - if(!isValidRecipient(GetPlayerId())) + if(!isValidRecipient(getPlayerId())) return true; } else if(state == ClientState::Config) { @@ -844,7 +844,7 @@ bool GameClient::OnGameMessage(const GameMessage_Server_Async& msg) std::stringstream checksum_list; for(unsigned i = 0; i < msg.checksums.size(); ++i) { - checksum_list << GetPlayer(i).name << ": " << msg.checksums[i]; + checksum_list << getPlayer(i).name << ": " << msg.checksums[i]; if(i + 1 < msg.checksums.size()) checksum_list << ", "; } @@ -858,8 +858,8 @@ bool GameClient::OnGameMessage(const GameMessage_Server_Async& msg) ci->CI_Async(checksum_list.str()); std::string fileName = s25util::Time::FormatTime("async_%Y-%m-%d_%H-%i-%s"); - fileName += "_" + s25util::toStringClassic(GetPlayerId()) + "_"; - fileName += GetPlayer(GetPlayerId()).name; + fileName += "_" + s25util::toStringClassic(getPlayerId()) + "_"; + fileName += getPlayer(getPlayerId()).name; const bfs::path filePathSave = RTTRCONFIG.ExpandPath(s25::folders::save) / makePortableFileName(fileName + ".sav"); const bfs::path filePathLog = @@ -1025,7 +1025,7 @@ bool GameClient::OnGameMessage(const GameMessage_Map_Data& msg) bool GameClient::OnGameMessage(const GameMessage_SkipToGF& msg) { skiptogf = msg.targetGF; - LOG.write("Jumping from GF %1% to GF %2%\n") % GetGFNumber() % skiptogf; + LOG.write("Jumping from GF %1% to GF %2%\n") % getGFNumber() % skiptogf; return true; } @@ -1083,16 +1083,16 @@ bool GameClient::CreateLobby() if(!mapinfo.savegame->Load(mapinfo.filepath, SaveGameDataToLoad::HeaderAndSettings)) return false; - numPlayers = mapinfo.savegame->GetNumPlayers(); - mapinfo.title = mapinfo.savegame->GetMapName(); + numPlayers = mapinfo.savegame->getNumPlayers(); + mapinfo.title = mapinfo.savegame->getMapName(); break; default: return false; } - if(GetPlayerId() >= numPlayers) + if(getPlayerId() >= numPlayers) return false; - gameLobby = std::make_shared(mapinfo.type == MapType::Savegame, IsHost(), numPlayers); + gameLobby = std::make_shared(mapinfo.type == MapType::Savegame, isHost(), numPlayers); return true; } @@ -1173,23 +1173,23 @@ void GameClient::IncreaseSpeed(const bool wraparound) // Go from debug speed directly back to min speed, else in fixed steps static_assert(MIN_SPEED_DEBUG > MIN_SPEED); if(framesinfo.gfLengthReq > MIN_SPEED) - SetNewSpeed(MIN_SPEED); // NOLINT(bugprone-branch-clone) + setNewSpeed(MIN_SPEED); // NOLINT(bugprone-branch-clone) else - SetNewSpeed((framesinfo.gfLengthReq - 1ms) / SPEED_STEP * SPEED_STEP); + setNewSpeed((framesinfo.gfLengthReq - 1ms) / SPEED_STEP * SPEED_STEP); // If unchanged we capped at max speed, so wrap around if requested if(wraparound && framesinfo.gfLengthReq == curSpeed) - SetNewSpeed(MIN_SPEED); + setNewSpeed(MIN_SPEED); } void GameClient::DecreaseSpeed() { if((DEBUG_MODE || replayMode) && framesinfo.gfLengthReq >= MIN_SPEED) - SetNewSpeed(MIN_SPEED_DEBUG); + setNewSpeed(MIN_SPEED_DEBUG); else - SetNewSpeed(framesinfo.gfLengthReq / SPEED_STEP * SPEED_STEP + SPEED_STEP); + setNewSpeed(framesinfo.gfLengthReq / SPEED_STEP * SPEED_STEP + SPEED_STEP); } -void GameClient::SetNewSpeed(std::chrono::milliseconds gfLength) +void GameClient::setNewSpeed(std::chrono::milliseconds gfLength) { static_assert(MIN_SPEED >= SPEED_GF_LENGTHS[GameSpeed::VeryFast], "Not all speeds reachable"); static_assert(MAX_SPEED <= SPEED_GF_LENGTHS[GameSpeed::VerySlow], "Not all speeds reachable"); @@ -1288,7 +1288,7 @@ void GameClient::ExecuteGameFrame() return; // Pause } - const unsigned curGF = GetGFNumber(); + const unsigned curGF = getGFNumber(); const bool isSkipping = skiptogf > curGF; // Is it time for the next GF? If we are skipping, it is always time for the next GF if(isSkipping || (currentTime - framesinfo.lastTime) >= framesinfo.gf_length) @@ -1347,7 +1347,7 @@ void GameClient::ExecuteGameFrame() HandleAutosave(); // GF-Ende im Replay aktualisieren - if(replayinfo && replayinfo->replay.IsRecording()) + if(replayinfo && replayinfo->replay.isRecording()) replayinfo->replay.UpdateLastGF(curGF); } @@ -1356,7 +1356,7 @@ void GameClient::ExecuteGameFrame() SystemChat((boost::format(_("Error during execution of lua script: %1%\nGame stopped!")) % e.what()).str()); OnError(ClientError::InvalidMap); } - if(skiptogf == GetGFNumber()) + if(skiptogf == getGFNumber()) skiptogf = 0; } framesinfo.frameTime = @@ -1391,7 +1391,7 @@ void GameClient::HandleAutosave() return; // Alle .... GF - if(GetGFNumber() % SETTINGS.interface.autosaveInterval == 0) + if(getGFNumber() % SETTINGS.interface.autosaveInterval == 0) { std::string filename; if(mapinfo.title.empty()) @@ -1407,7 +1407,7 @@ void GameClient::HandleAutosave() void GameClient::NextGF(bool wasNWF) { for(AIPlayer& ai : game->aiPlayers_) - ai.RunGF(GetGFNumber(), wasNWF); + ai.RunGF(getGFNumber(), wasNWF); game->RunGF(); } @@ -1427,8 +1427,8 @@ void GameClient::WritePlayerInfo(SavedFile& file) { RTTR_Assert(state == ClientState::Loading || state == ClientState::Loaded || state == ClientState::Game); // Spielerdaten - for(unsigned i = 0; i < GetNumPlayers(); ++i) - file.AddPlayer(GetPlayer(i)); + for(unsigned i = 0; i < getNumPlayers(); ++i) + file.AddPlayer(getPlayer(i)); } void GameClient::OnGameStart() @@ -1440,7 +1440,7 @@ void GameClient::OnGameStart() state = ClientState::Game; if(ci) ci->CI_GameStarted(); - } else if(state == ClientState::Game && !game->IsStarted()) + } else if(state == ClientState::Game && !game->isStarted()) { framesinfo.isPaused = replayMode; game->Start(!!mapinfo.savegame); @@ -1472,17 +1472,17 @@ bool GameClient::StartReplay(const boost::filesystem::path& path) if(!replayinfo->replay.LoadHeader(path) || !replayinfo->replay.LoadGameData(mapinfo)) //-V807 { LOG.write(_("Invalid Replay %1%! Reason: %2%\n")) % path - % (replayinfo->replay.GetLastErrorMsg().empty() ? _("Unknown") : replayinfo->replay.GetLastErrorMsg()); + % (replayinfo->replay.getLastErrorMsg().empty() ? _("Unknown") : replayinfo->replay.getLastErrorMsg()); OnError(ClientError::InvalidMap); replayinfo.reset(); return false; } replayinfo->filename = path.filename(); - gameLobby = std::make_shared(true, true, replayinfo->replay.GetNumPlayers()); + gameLobby = std::make_shared(true, true, replayinfo->replay.getNumPlayers()); - for(unsigned i = 0; i < replayinfo->replay.GetNumPlayers(); ++i) - gameLobby->getPlayer(i) = JoinPlayerInfo(replayinfo->replay.GetPlayer(i)); + for(unsigned i = 0; i < replayinfo->replay.getNumPlayers(); ++i) + gameLobby->getPlayer(i) = JoinPlayerInfo(replayinfo->replay.getPlayer(i)); bool playerFound = false; // Find a player to spectate from @@ -1558,12 +1558,12 @@ bool GameClient::StartReplay(const boost::filesystem::path& path) return true; } -void GameClient::SetAIBattlePlayers(std::vector aiInfos) +void GameClient::setAIBattlePlayers(std::vector aiInfos) { aiBattlePlayers_ = std::move(aiInfos); } -unsigned GameClient::GetGlobalAnimation(const unsigned short max, const unsigned char factor_numerator, +unsigned GameClient::getGlobalAnimation(const unsigned short max, const unsigned char factor_numerator, const unsigned char factor_denumerator, const unsigned offset) { // Unit for animations is 630ms (dividable by 2, 3, 5, 6, 7, 10, 15, ...) @@ -1582,7 +1582,7 @@ T GameClient::doInterpolate(const T x1, const T x2, const GameEvent& ev) const // TODO: Move to some animation system that is part of game std::chrono::milliseconds elapsedTime{}; if(state == ClientState::Game) - elapsedTime = (GetGFNumber() - ev.startGF) * framesinfo.gf_length + framesinfo.frameTime; + elapsedTime = (getGFNumber() - ev.startGF) * framesinfo.gf_length + framesinfo.frameTime; const auto duration = ev.length * framesinfo.gf_length; return helpers::interpolate(x1, x2, elapsedTime, duration); } @@ -1611,26 +1611,26 @@ void GameClient::ServerLost() */ void GameClient::SkipGF(unsigned gf, GameWorldView& gwv) { - if(gf <= GetGFNumber()) + if(gf <= getGFNumber()) return; - unsigned start_ticks = VIDEODRIVER.GetTickCount(); + unsigned start_ticks = VIDEODRIVER.getTickCount(); if(!replayMode) { // unpause before skipping - SetPause(false); + setPause(false); mainPlayer.sendMsgAsync(new GameMessage_SkipToGF(gf)); return; } - SetPause(false); - if(GetGFNumber() < GetLastReplayGF()) - gf = std::min(gf, GetLastReplayGF() + 1u); + setPause(false); + if(getGFNumber() < getLastReplayGF()) + gf = std::min(gf, getLastReplayGF() + 1u); skiptogf = gf; // GFs überspringen - for(unsigned i = GetGFNumber(); i < skiptogf; ++i) + for(unsigned i = getGFNumber(); i < skiptogf; ++i) { if(i % 1000 == 0) { @@ -1642,8 +1642,8 @@ void GameClient::SkipGF(unsigned gf, GameWorldView& gwv) // text oben noch hinschreiben boost::format nwfString(_("current GF: %u - still fast forwarding: %d GFs left (%d %%)")); - nwfString % GetGFNumber() % (gf - i) % (i * 100 / gf); - LargeFont->Draw(DrawPoint(VIDEODRIVER.GetRenderSize() / 2u), nwfString.str(), FontStyle::CENTER, + nwfString % getGFNumber() % (gf - i) % (i * 100 / gf); + LargeFont->Draw(DrawPoint(VIDEODRIVER.getRenderSize() / 2u), nwfString.str(), FontStyle::CENTER, COLOR_YELLOW); VIDEODRIVER.SwapBuffers(); @@ -1651,19 +1651,19 @@ void GameClient::SkipGF(unsigned gf, GameWorldView& gwv) ExecuteGameFrame(); } // Either we force-stopped skipping (skiptogf set to 0) or we reached the target gf - RTTR_Assert(skiptogf == 0u || GetGFNumber() == gf); + RTTR_Assert(skiptogf == 0u || getGFNumber() == gf); // Spiel pausieren & text ausgabe wie lang das jetzt gedauert hat - unsigned ticks = VIDEODRIVER.GetTickCount() - start_ticks; + unsigned ticks = VIDEODRIVER.getTickCount() - start_ticks; boost::format text(_("Jump finished (%1$.3g seconds).")); text % (ticks / 1000.0); SystemChat(text.str()); - SetPause(true); + setPause(true); } void GameClient::SystemChat(const std::string& text) { - SystemChat(text, GetPlayerId()); + SystemChat(text, getPlayerId()); } void GameClient::SystemChat(const std::string& text, unsigned char fromPlayerIdx) @@ -1674,12 +1674,12 @@ void GameClient::SystemChat(const std::string& text, unsigned char fromPlayerIdx bool GameClient::SaveToFile(const boost::filesystem::path& filepath) { - mainPlayer.sendMsg(GameMessage_Chat(GetPlayerId(), ChatDestination::System, _("Saving game..."))); + mainPlayer.sendMsg(GameMessage_Chat(getPlayerId(), ChatDestination::System, _("Saving game..."))); // Mond malen - Position moonPos = VIDEODRIVER.GetMousePos(); + Position moonPos = VIDEODRIVER.getMousePos(); moonPos.y -= 40; - LOADER.GetImageN("resource", 33)->DrawFull(moonPos); + LOADER.getImageN("resource", 33)->DrawFull(moonPos); VIDEODRIVER.SwapBuffers(); Savegame save; @@ -1689,7 +1689,7 @@ bool GameClient::SaveToFile(const boost::filesystem::path& filepath) // GGS-Daten save.ggs = game->ggs_; - save.start_gf = GetGFNumber(); + save.start_gf = getGFNumber(); // Enable/Disable debugging of savegames save.sgd.debugMode = SETTINGS.global.debugMode; @@ -1709,10 +1709,10 @@ bool GameClient::SaveToFile(const boost::filesystem::path& filepath) void GameClient::ResetVisualSettings() { - GetPlayer(GetPlayerId()).FillVisualSettings(visual_settings); + getPlayer(getPlayerId()).FillVisualSettings(visual_settings); } -void GameClient::SetPause(bool pause) +void GameClient::setPause(bool pause) { if(state == ClientState::Stopped) { @@ -1727,7 +1727,7 @@ void GameClient::SetPause(bool pause) // Pause instantly framesinfo.isPaused = pause; framesinfo.frameTime = 0ms; - } else if(IsHost()) + } else if(isHost()) { auto* msg = new GameMessage_Pause(pause); if(pause) @@ -1736,43 +1736,43 @@ void GameClient::SetPause(bool pause) } } -void GameClient::SetReplayFOW(const bool hideFOW) +void GameClient::setReplayFOW(const bool hideFOW) { if(replayinfo) replayinfo->allVisible = hideFOW; } -bool GameClient::IsReplayFOWDisabled() const +bool GameClient::isReplayFOWDisabled() const { return replayMode && replayinfo->allVisible; } -unsigned GameClient::GetLastReplayGF() const +unsigned GameClient::getLastReplayGF() const { - return replayinfo ? replayinfo->replay.GetLastGF() : 0u; + return replayinfo ? replayinfo->replay.getLastGF() : 0u; } bool GameClient::AddGC(gc::GameCommandPtr gc) { // Nicht in der Pause oder wenn er besiegt wurde - if(framesinfo.isPaused || GetPlayer(GetPlayerId()).IsDefeated() || IsReplayModeOn()) + if(framesinfo.isPaused || getPlayer(getPlayerId()).IsDefeated() || isReplayModeOn()) return false; gameCommands_.push_back(gc); return true; } -unsigned GameClient::GetNumPlayers() const +unsigned GameClient::getNumPlayers() const { RTTR_Assert(state == ClientState::Loading || state == ClientState::Loaded || state == ClientState::Game); - return game->world_.GetNumPlayers(); + return game->world_.getNumPlayers(); } -GamePlayer& GameClient::GetPlayer(const unsigned id) +GamePlayer& GameClient::getPlayer(const unsigned id) { RTTR_Assert(state == ClientState::Loading || state == ClientState::Loaded || state == ClientState::Game); - RTTR_Assert(id < GetNumPlayers()); - return game->world_.GetPlayer(id); + RTTR_Assert(id < getNumPlayers()); + return game->world_.getPlayer(id); } std::unique_ptr GameClient::CreateAIPlayer(unsigned playerId, const AI::Info& aiInfo) @@ -1802,24 +1802,24 @@ std::string GameClient::FormatGFTime(const unsigned gf) const return helpers::format("%02u:%02u", numMinutes.count(), numSeconds.count()); } -const boost::filesystem::path& GameClient::GetReplayFilename() const +const boost::filesystem::path& GameClient::getReplayFilename() const { static boost::filesystem::path emptyString; return replayinfo ? replayinfo->filename : emptyString; } -Replay* GameClient::GetReplay() +Replay* GameClient::getReplay() { return replayinfo ? &replayinfo->replay : nullptr; } -std::shared_ptr GameClient::GetNWFInfo() const +std::shared_ptr GameClient::getNWFInfo() const { return nwfInfo; } /// Is tournament mode activated (0 if not)? Returns the durations of the tournament mode in gf otherwise -unsigned GameClient::GetTournamentModeDuration() const +unsigned GameClient::getTournamentModeDuration() const { using namespace std::chrono; if(game && rttr::enum_cast(game->ggs_.objective) >= rttr::enum_cast(GameObjective::Tournament1) @@ -1834,16 +1834,16 @@ unsigned GameClient::GetTournamentModeDuration() const void GameClient::ToggleHumanAIPlayer(const AI::Info& aiInfo) { - RTTR_Assert(!IsReplayModeOn()); + RTTR_Assert(!isReplayModeOn()); auto it = helpers::find_if(game->aiPlayers_, - [id = this->GetPlayerId()](const auto& player) { return player.GetPlayerId() == id; }); + [id = this->getPlayerId()](const auto& player) { return player.getPlayerId() == id; }); if(it != game->aiPlayers_.end()) { game->aiPlayers_.erase(it); SystemChat(_("Disabled AI for current player")); } else { - game->AddAIPlayer(CreateAIPlayer(GetPlayerId(), aiInfo)); + game->AddAIPlayer(CreateAIPlayer(getPlayerId(), aiInfo)); SystemChat(_("Enabled AI for current player")); } } @@ -1852,7 +1852,7 @@ void GameClient::RequestSwapToPlayer(const unsigned char newId) { if(state != ClientState::Game) return; - GamePlayer& player = GetPlayer(newId); + GamePlayer& player = getPlayer(newId); if(player.ps == PlayerState::AI && player.aiInfo.type == AI::Type::Dummy) mainPlayer.sendMsgAsync(new GameMessage_Player_Swap(0xFF, newId)); } diff --git a/libs/s25main/network/GameClient.h b/libs/s25main/network/GameClient.h index b83677623a..50a6d87624 100644 --- a/libs/s25main/network/GameClient.h +++ b/libs/s25main/network/GameClient.h @@ -64,19 +64,19 @@ class GameClient final : GameClient(); ~GameClient(); - void SetInterface(ClientInterface* ci) { this->ci = ci; } + void setInterface(ClientInterface* ci) { this->ci = ci; } /// Removes the given interface (if it is not yet overwritten by another one) void RemoveInterface(ClientInterface* ci) { if(this->ci == ci) this->ci = nullptr; } - bool IsHost() const override { return clientconfig.isHost; } + bool isHost() const override { return clientconfig.isHost; } /// Manually set the host status. Normally done in connect call - void SetIsHost(bool isHost) { clientconfig.isHost = isHost; } - std::string GetGameName() const { return clientconfig.gameName; } + void setIsHost(bool isHost) { clientconfig.isHost = isHost; } + std::string getGameName() const { return clientconfig.gameName; } - unsigned GetPlayerId() const override { return mainPlayer.playerId; } + unsigned getPlayerId() const override { return mainPlayer.playerId; } bool Connect(const std::string& server, const std::string& password, ServerType servertyp, unsigned short port, bool host, bool use_ipv6); @@ -87,12 +87,12 @@ class GameClient final : void Stop(); /// Gibt Map-Titel zurück - const std::string& GetMapTitle() const { return mapinfo.title; } + const std::string& getMapTitle() const { return mapinfo.title; } /// Gibt Pfad zu der Map zurück - const boost::filesystem::path& GetMapPath() const { return mapinfo.filepath; } + const boost::filesystem::path& getMapPath() const { return mapinfo.filepath; } /// Gibt Map-Typ zurück - MapType GetMapType() const { return mapinfo.type; } - const boost::filesystem::path& GetLuaFilePath() const { return mapinfo.luaFilepath; } + MapType getMapType() const { return mapinfo.type; } + const boost::filesystem::path& getLuaFilePath() const { return mapinfo.luaFilepath; } // Initialisiert und startet das Spiel void StartGame(unsigned random_init); @@ -102,17 +102,17 @@ class GameClient final : /// Beendet das Spiel, zerstört die Spielstrukturen void ExitGame(); - ClientState GetState() const { return state; } - Replay* GetReplay(); - std::shared_ptr GetNWFInfo() const; - std::shared_ptr GetGameLobby(); - const AIPlayer* GetAIPlayer(unsigned id) const; - - unsigned GetGFNumber() const; - std::chrono::milliseconds GetGFLength() const { return framesinfo.gf_length; } - unsigned GetNWFLength() const { return framesinfo.nwf_length; } - std::chrono::milliseconds GetFrameTime() const { return framesinfo.frameTime; } - unsigned GetGlobalAnimation(unsigned short max, unsigned char factor_numerator, unsigned char factor_denumerator, + ClientState getState() const { return state; } + Replay* getReplay(); + std::shared_ptr getNWFInfo() const; + std::shared_ptr getGameLobby(); + const AIPlayer* getAIPlayer(unsigned id) const; + + unsigned getGFNumber() const; + std::chrono::milliseconds getGFLength() const { return framesinfo.gf_length; } + unsigned getNWFLength() const { return framesinfo.nwf_length; } + std::chrono::milliseconds getFrameTime() const { return framesinfo.frameTime; } + unsigned getGlobalAnimation(unsigned short max, unsigned char factor_numerator, unsigned char factor_denumerator, unsigned offset); unsigned Interpolate(unsigned maxVal, const GameEvent* ev) const; int Interpolate(int x1, int x2, const GameEvent* ev) const; @@ -130,36 +130,36 @@ class GameClient final : void IncreaseSpeed(bool wraparound = false); void DecreaseSpeed(); - void SetNewSpeed(std::chrono::milliseconds gfLength); + void setNewSpeed(std::chrono::milliseconds gfLength); // Used by tests (stinks, but what to do?) - std::chrono::milliseconds GetGFLengthReq() { return framesinfo.gfLengthReq; } + std::chrono::milliseconds getGFLengthReq() { return framesinfo.gfLengthReq; } /// Lädt ein Replay und startet dementsprechend das Spiel bool StartReplay(const boost::filesystem::path& path); /// When a non-empty vector is given then an AI battle with the given AIs is started - void SetAIBattlePlayers(std::vector aiInfos); - const std::vector& GetAIBattlePlayers() const { return aiBattlePlayers_; } - bool IsAIBattleModeOn() const { return !aiBattlePlayers_.empty(); } + void setAIBattlePlayers(std::vector aiInfos); + const std::vector& getAIBattlePlayers() const { return aiBattlePlayers_; } + bool isAIBattleModeOn() const { return !aiBattlePlayers_.empty(); } - void SetPause(bool pause); - void TogglePause() { SetPause(!framesinfo.isPaused); } + void setPause(bool pause); + void TogglePause() { setPause(!framesinfo.isPaused); } /// Hide or show the fog-of-war. Only in replay mode - void SetReplayFOW(bool hideFOW); + void setReplayFOW(bool hideFOW); /// Return whether we are in replay mode and fog-of-war is disabled - bool IsReplayFOWDisabled() const; + bool isReplayFOWDisabled() const; /// Gibt Replay-Ende (GF) zurück - unsigned GetLastReplayGF() const; + unsigned getLastReplayGF() const; /// Wandelt eine GF-Angabe in eine Zeitangabe um (HH:MM:SS oder MM:SS wenn Stunden = 0) std::string FormatGFTime(unsigned gf) const override; /// Gibt Replay-Dateiname zurück - const boost::filesystem::path& GetReplayFilename() const; + const boost::filesystem::path& getReplayFilename() const; /// Wird ein Replay abgespielt? - bool IsReplayModeOn() const { return replayMode; } + bool isReplayModeOn() const { return replayMode; } /// Is tournament mode activated (0 if not)? Returns the durations of the tournament mode in gf otherwise - unsigned GetTournamentModeDuration() const; + unsigned getTournamentModeDuration() const; void SkipGF(unsigned gf, GameWorldView& gwv); @@ -169,7 +169,7 @@ class GameClient final : void RequestSwapToPlayer(unsigned char newId); /// Spiel pausiert? - bool IsPaused() const { return framesinfo.isPaused; } + bool isPaused() const { return framesinfo.isPaused; } /// Schreibt Header der Save-Datei bool SaveToFile(const boost::filesystem::path& filepath); /// Visuelle Einstellungen aus den richtigen ableiten @@ -180,7 +180,7 @@ class GameClient final : /// Toggle current player to be an AI player of the given type void ToggleHumanAIPlayer(const AI::Info& aiInfo); - NetworkPlayer& GetMainPlayer() { return mainPlayer; } + NetworkPlayer& getMainPlayer() { return mainPlayer; } private: /// Create an AI player for the current world @@ -189,9 +189,9 @@ class GameClient final : /// Add the gamecommand. Return true in success, false otherwise (paused, or defeated) bool AddGC(gc::GameCommandPtr gc) override; - unsigned GetNumPlayers() const; + unsigned getNumPlayers() const; /// Liefert einen Player zurück - GamePlayer& GetPlayer(unsigned id); + GamePlayer& getPlayer(unsigned id); /// Versucht einen neuen GameFrame auszuführen, falls die Zeit dafür gekommen ist void ExecuteGameFrame(); diff --git a/libs/s25main/network/GameClientCommands.cpp b/libs/s25main/network/GameClientCommands.cpp index 763357a565..c367cef6a4 100644 --- a/libs/s25main/network/GameClientCommands.cpp +++ b/libs/s25main/network/GameClientCommands.cpp @@ -18,7 +18,7 @@ void GameClient::commandChat(const std::string& text, const ChatDestination cd) { // Replaymodus oder kein Text --> nichts senden - if(IsReplayModeOn() || text.empty()) + if(isReplayModeOn() || text.empty()) return; mainPlayer.sendMsgAsync(new GameMessage_Chat(0xff, cd, text)); @@ -69,38 +69,38 @@ void GameClient::ChangePlayerIngame(const unsigned char playerId1, const unsigne return; // ID auch innerhalb der Spielerzahl? - if(playerId2 >= GetNumPlayers() || playerId1 >= GetNumPlayers()) + if(playerId2 >= getNumPlayers() || playerId1 >= getNumPlayers()) return; - if(IsReplayModeOn()) + if(isReplayModeOn()) { - RTTR_Assert(playerId1 == GetPlayerId()); + RTTR_Assert(playerId1 == getPlayerId()); // There must be someone at this slot - if(!GetPlayer(playerId2).isUsed()) + if(!getPlayer(playerId2).isUsed()) return; // In replay mode we don't touch the player } else { // old_id must be a player - GamePlayer& player1 = GetPlayer(playerId1); + GamePlayer& player1 = getPlayer(playerId1); if(player1.ps != PlayerState::Occupied) return; // new_id must be an AI - GamePlayer& player2 = GetPlayer(playerId2); + GamePlayer& player2 = getPlayer(playerId2); if(player2.ps != PlayerState::AI) return; std::swap(player1.ps, player2.ps); std::swap(player1.aiInfo, player2.aiInfo); - if(IsHost()) + if(isHost()) { // Switch AIs - game->aiPlayers_.erase_if([playerId2](const auto& player) { return player.GetPlayerId() == playerId2; }); + game->aiPlayers_.erase_if([playerId2](const auto& player) { return player.getPlayerId() == playerId2; }); game->AddAIPlayer(CreateAIPlayer(playerId1, AI::Info(AI::Type::Dummy))); } - GetPlayer(playerId1).ps = PlayerState::AI; - GetPlayer(playerId2).ps = PlayerState::Occupied; + getPlayer(playerId1).ps = PlayerState::AI; + getPlayer(playerId2).ps = PlayerState::Occupied; } // Wenn wir betroffen waren, unsere ID neu setzen @@ -108,7 +108,7 @@ void GameClient::ChangePlayerIngame(const unsigned char playerId1, const unsigne { mainPlayer.playerId = playerId2; - if(!IsReplayModeOn()) + if(!isReplayModeOn()) { // Our currently accumulated gamecommands are invalid after the change, as they would modify the old player gameCommands_.clear(); diff --git a/libs/s25main/network/GameClientGF_Game.cpp b/libs/s25main/network/GameClientGF_Game.cpp index c865bc8e2c..abc8246321 100644 --- a/libs/s25main/network/GameClientGF_Game.cpp +++ b/libs/s25main/network/GameClientGF_Game.cpp @@ -15,7 +15,7 @@ void GameClient::ExecuteNWF() // Geschickte Network Commands der Spieler ausführen und ggf. im Replay aufzeichnen AsyncChecksum checksum = AsyncChecksum::create(*game); - const unsigned curGF = GetGFNumber(); + const unsigned curGF = getGFNumber(); for(const NWFPlayerInfo& player : nwfInfo->getPlayerInfos()) { @@ -23,7 +23,7 @@ void GameClient::ExecuteNWF() // Command im Replay aufzeichnen (wenn nicht gerade eins schon läuft xD) // Nur Commands reinschreiben, KEINE PLATZHALTER (nc_count = 0) - if(!currentGCs.gcs.empty() && replayinfo && replayinfo->replay.IsRecording()) + if(!currentGCs.gcs.empty() && replayinfo && replayinfo->replay.isRecording()) { // Set the current checksum as the GF checksum. The checksum from the command is from the last NWF! PlayerGameCommands replayCmds(checksum, currentGCs.gcs); @@ -40,10 +40,10 @@ void GameClient::ExecuteNWF() { const std::vector aiGCs = ai.FetchGameCommands(); /// Cmds from own AI get added to our gcs - if(ai.GetPlayerId() == GetPlayerId()) + if(ai.getPlayerId() == getPlayerId()) gameCommands_.insert(gameCommands_.end(), aiGCs.begin(), aiGCs.end()); else - mainPlayer.sendMsgAsync(new GameMessage_GameCommand(ai.GetPlayerId(), checksum, aiGCs)); + mainPlayer.sendMsgAsync(new GameMessage_GameCommand(ai.getPlayerId(), checksum, aiGCs)); for(auto& msg : ai.getAIInterface().FetchChatMessages()) mainPlayer.sendMsgAsync(msg.release()); } diff --git a/libs/s25main/network/GameClientGF_Replay.cpp b/libs/s25main/network/GameClientGF_Replay.cpp index c72ce29d0e..01d92e55d9 100644 --- a/libs/s25main/network/GameClientGF_Replay.cpp +++ b/libs/s25main/network/GameClientGF_Replay.cpp @@ -12,8 +12,8 @@ void GameClient::executeGameFrameReplay() { - const unsigned curGF = GetGFNumber(); - RTTR_Assert(replayinfo->nextGF.value_or(curGF) >= curGF || curGF > replayinfo->replay.GetLastGF()); //-V807 + const unsigned curGF = getGFNumber(); + RTTR_Assert(replayinfo->nextGF.value_or(curGF) >= curGF || curGF > replayinfo->replay.getLastGF()); //-V807 const ReplayCommandsResult result = ExecuteReplayCommands(replayinfo->replay, replayinfo->nextGF, *game, [this](const Replay::ChatCommand& cmd) { @@ -47,19 +47,19 @@ void GameClient::executeGameFrameReplay() NextGF(result.executedGameCommands); // Check for game end - if(curGF == replayinfo->replay.GetLastGF()) + if(curGF == replayinfo->replay.getLastGF()) { if(ci) { using std::chrono::duration_cast; - std::chrono::seconds runtime = duration_cast(GAMEMANAGER.GetRuntime()); + std::chrono::seconds runtime = duration_cast(GAMEMANAGER.getRuntime()); std::chrono::hours hours = duration_cast(runtime); std::chrono::minutes mins = duration_cast(runtime - hours); std::chrono::seconds secs = duration_cast(runtime - hours - mins); const std::string text = (boost::format(_("Notice: The played replay has ended. (GF: %u, %dh %dmin %ds, TF: %u, AVG_FPS: %u)")) - % curGF % hours.count() % mins.count() % secs.count() % GAMEMANAGER.GetNumFrames() - % GAMEMANAGER.GetAverageGFPS()) + % curGF % hours.count() % mins.count() % secs.count() % GAMEMANAGER.getNumFrames() + % GAMEMANAGER.getAverageGFPS()) .str(); ci->CI_ReplayEndReached(text); @@ -74,6 +74,6 @@ void GameClient::executeGameFrameReplay() replayinfo->nextGF.reset(); framesinfo.isPaused = true; if(skiptogf) - skiptogf = GetGFNumber(); + skiptogf = getGFNumber(); } } diff --git a/libs/s25main/network/GameServer.cpp b/libs/s25main/network/GameServer.cpp index e057443dae..3317cdd73f 100644 --- a/libs/s25main/network/GameServer.cpp +++ b/libs/s25main/network/GameServer.cpp @@ -155,12 +155,12 @@ bool GameServer::Start(const CreateServerInfo& csi, const MapDescription& map, c return false; // Spieleranzahl - playerInfos.resize(save.GetNumPlayers()); - mapinfo.title = save.GetMapName(); + playerInfos.resize(save.getNumPlayers()); + mapinfo.title = save.getMapName(); for(unsigned i = 0; i < playerInfos.size(); ++i) { - playerInfos[i] = JoinPlayerInfo(save.GetPlayer(i)); + playerInfos[i] = JoinPlayerInfo(save.getPlayer(i)); // If it was a human we make it free, so someone can join if(playerInfos[i].ps == PlayerState::Occupied) playerInfos[i].ps = PlayerState::Free; @@ -226,7 +226,7 @@ bool GameServer::Start(const CreateServerInfo& csi, const MapDescription& map, c return true; } -unsigned GameServer::GetNumFilledSlots() const +unsigned GameServer::getNumFilledSlots() const { unsigned numFilled = 0; for(const JoinPlayerInfo& player : playerInfos) @@ -245,19 +245,19 @@ void GameServer::AnnounceStatusChange() info.name = config.gamename; info.hasPwd = !config.password.empty(); info.map = mapinfo.title; - info.curNumPlayers = GetNumFilledSlots(); + info.curNumPlayers = getNumFilledSlots(); info.maxNumPlayers = playerInfos.size(); info.port = config.port; info.isIPv6 = config.ipv6; - info.version = rttr::version::GetReadableVersion(); - info.revision = rttr::version::GetRevision(); + info.version = rttr::version::getReadableVersion(); + info.revision = rttr::version::getRevision(); Serializer ser; info.Serialize(ser); lanAnnouncer.SetPayload(ser.GetData(), ser.GetLength()); } else if(config.servertype == ServerType::Lobby) { if(LOBBYCLIENT.IsIngame()) - LOBBYCLIENT.UpdateServerNumPlayers(GetNumFilledSlots(), playerInfos.size()); + LOBBYCLIENT.UpdateServerNumPlayers(getNumFilledSlots(), playerInfos.size()); } } @@ -328,7 +328,7 @@ void GameServer::RunStateConfig() return; } } else - SendToAll(GameMessage_Countdown(countdown.GetRemainingSecs())); + SendToAll(GameMessage_Countdown(countdown.getRemainingSecs())); } } @@ -613,7 +613,7 @@ void GameServer::KickPlayer(uint8_t playerId, KickReason cause, uint32_t param) if(playerId >= playerInfos.size()) return; JoinPlayerInfo& playerInfo = playerInfos[playerId]; - GameServerPlayer* player = GetNetworkPlayer(playerId); + GameServerPlayer* player = getNetworkPlayer(playerId); if(player) player->closeConnection(); // Non-existing or connecting player @@ -629,7 +629,7 @@ void GameServer::KickPlayer(uint8_t playerId, KickReason cause, uint32_t param) playerInfo.ps = PlayerState::AI; playerInfo.aiInfo = AI::Info(AI::Type::Dummy); } else - CancelCountdown(); + cancelCountdown(); AnnounceStatusChange(); LOG.writeToFile("SERVER >>> BROADCAST: NMS_PLAYERKICKED(%d,%d,%d)\n") % unsigned(playerId) % unsigned(cause) @@ -729,7 +729,7 @@ void GameServer::ExecuteNWF() { // Pause game RTTR_Assert(!framesinfo.isPaused); - SetPaused(true); + setPaused(true); // Notify players std::vector checksumHashes; @@ -836,7 +836,7 @@ void GameServer::WaitForClients() // Geeigneten Platz suchen for(unsigned playerId = 0; playerId < playerInfos.size(); ++playerId) { - if(playerInfos[playerId].ps == PlayerState::Free && !GetNetworkPlayer(playerId)) + if(playerInfos[playerId].ps == PlayerState::Free && !getNetworkPlayer(playerId)) { networkPlayers.push_back(GameServerPlayer(playerId, socket)); newPlayerId = playerId; @@ -890,7 +890,7 @@ void GameServer::FillPlayerQueues() bool GameServer::OnGameMessage(const GameMessage_Pong& msg) { - GameServerPlayer* player = GetNetworkPlayer(msg.senderPlayerID); + GameServerPlayer* player = getNetworkPlayer(msg.senderPlayerID); if(player) { unsigned ping = player->calcPingTime(); @@ -910,17 +910,17 @@ bool GameServer::OnGameMessage(const GameMessage_Server_Type& msg) return true; } - GameServerPlayer* player = GetNetworkPlayer(msg.senderPlayerID); + GameServerPlayer* player = getNetworkPlayer(msg.senderPlayerID); if(!player) return true; auto typeok = GameMessage_Server_TypeOK::StatusCode::Ok; if(msg.type != config.servertype) typeok = GameMessage_Server_TypeOK::StatusCode::InvalidServerType; - else if(msg.revision != rttr::version::GetRevision()) + else if(msg.revision != rttr::version::getRevision()) typeok = GameMessage_Server_TypeOK::StatusCode::WrongVersion; - player->sendMsg(GameMessage_Server_TypeOK(typeok, rttr::version::GetRevision())); + player->sendMsg(GameMessage_Server_TypeOK(typeok, rttr::version::getRevision())); if(typeok != GameMessage_Server_TypeOK::StatusCode::Ok) KickPlayer(msg.senderPlayerID, KickReason::ConnectionLost, __LINE__); @@ -935,7 +935,7 @@ bool GameServer::OnGameMessage(const GameMessage_Server_Password& msg) return true; } - GameServerPlayer* player = GetNetworkPlayer(msg.senderPlayerID); + GameServerPlayer* player = getNetworkPlayer(msg.senderPlayerID); if(!player) return true; @@ -958,7 +958,7 @@ bool GameServer::OnGameMessage(const GameMessage_Server_Password& msg) bool GameServer::OnGameMessage(const GameMessage_Chat& msg) { - int playerID = GetTargetPlayer(msg); + int playerID = getTargetPlayer(msg); if(playerID >= 0) SendToAll(GameMessage_Chat(playerID, msg.destination, msg.text)); return true; @@ -974,7 +974,7 @@ bool GameServer::OnGameMessage(const GameMessage_Player_State& msg) return true; } - int playerID = GetTargetPlayer(msg); + int playerID = getTargetPlayer(msg); if(playerID < 0) return true; JoinPlayerInfo& player = playerInfos[playerID]; @@ -982,7 +982,7 @@ bool GameServer::OnGameMessage(const GameMessage_Player_State& msg) if(playerID != msg.senderPlayerID) { // Remove the player currently occupying the target slot, if any - if(GetNetworkPlayer(playerID)) + if(getNetworkPlayer(playerID)) KickPlayer(playerID, KickReason::NoCause, __LINE__); if(mapinfo.type == MapType::Savegame) @@ -1010,7 +1010,7 @@ bool GameServer::OnGameMessage(const GameMessage_Player_State& msg) if(player.ps == PlayerState::AI) { - player.SetAIName(playerID); + player.setAIName(playerID); SendToAll(GameMessage_Player_Name(playerID, player.name)); } // If slot is filled, check current color @@ -1036,7 +1036,7 @@ bool GameServer::OnGameMessage(const GameMessage_Player_Name& msg) KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } - int playerID = GetTargetPlayer(msg); + int playerID = getTargetPlayer(msg); if(playerID < 0) return true; @@ -1056,7 +1056,7 @@ bool GameServer::OnGameMessage(const GameMessage_Player_Portrait& msg) KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } - int playerID = GetTargetPlayer(msg); + int playerID = getTargetPlayer(msg); if(playerID < 0) return true; if(msg.playerPortraitIndex >= Portraits.size()) @@ -1077,7 +1077,7 @@ bool GameServer::OnGameMessage(const GameMessage_Player_Nation& msg) KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } - int playerID = GetTargetPlayer(msg); + int playerID = getTargetPlayer(msg); if(playerID < 0) return true; @@ -1095,7 +1095,7 @@ bool GameServer::OnGameMessage(const GameMessage_Player_Team& msg) KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } - int playerID = GetTargetPlayer(msg); + int playerID = getTargetPlayer(msg); if(playerID < 0) return true; @@ -1113,7 +1113,7 @@ bool GameServer::OnGameMessage(const GameMessage_Player_Color& msg) KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } - int playerID = GetTargetPlayer(msg); + int playerID = getTargetPlayer(msg); if(playerID < 0) return true; @@ -1129,7 +1129,7 @@ bool GameServer::OnGameMessage(const GameMessage_Player_Ready& msg) KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } - int playerID = GetTargetPlayer(msg); + int playerID = getTargetPlayer(msg); if(playerID < 0) return true; @@ -1139,7 +1139,7 @@ bool GameServer::OnGameMessage(const GameMessage_Player_Ready& msg) // countdown ggf abbrechen if(!player.isReady && countdown.IsActive()) - CancelCountdown(); + cancelCountdown(); SendToAll(GameMessage_Player_Ready(playerID, msg.ready)); return true; @@ -1152,7 +1152,7 @@ bool GameServer::OnGameMessage(const GameMessage_MapRequest& msg) KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } - GameServerPlayer* player = GetNetworkPlayer(msg.senderPlayerID); + GameServerPlayer* player = getNetworkPlayer(msg.senderPlayerID); if(!player) return true; @@ -1206,7 +1206,7 @@ bool GameServer::OnGameMessage(const GameMessage_Map_Checksum& msg) KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } - GameServerPlayer* player = GetNetworkPlayer(msg.senderPlayerID); + GameServerPlayer* player = getNetworkPlayer(msg.senderPlayerID); if(!player) return true; @@ -1268,7 +1268,7 @@ bool GameServer::OnGameMessage(const GameMessage_Speed& msg) bool GameServer::OnGameMessage(const GameMessage_GameCommand& msg) { - int targetPlayerId = GetTargetPlayer(msg); + int targetPlayerId = getTargetPlayer(msg); if((state != ServerState::Game && state != ServerState::Loading) || targetPlayerId < 0 || (state == ServerState::Loading && !msg.cmds.gcs.empty())) { @@ -1278,7 +1278,7 @@ bool GameServer::OnGameMessage(const GameMessage_GameCommand& msg) if(!nwfInfo.addPlayerCmds(targetPlayerId, msg.cmds)) return true; // Ignore - GameServerPlayer* player = GetNetworkPlayer(targetPlayerId); + GameServerPlayer* player = getNetworkPlayer(targetPlayerId); if(player) player->setNotLagging(); SendToAll(GameMessage_GameCommand(targetPlayerId, msg.cmds.checksum, msg.cmds.gcs)); @@ -1350,7 +1350,7 @@ bool GameServer::OnGameMessage(const GameMessage_AsyncLog& msg) bool GameServer::OnGameMessage(const GameMessage_RemoveLua& msg) { - if(state != ServerState::Config || !IsHost(msg.senderPlayerID)) + if(state != ServerState::Config || !isHost(msg.senderPlayerID)) { KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; @@ -1359,19 +1359,19 @@ bool GameServer::OnGameMessage(const GameMessage_RemoveLua& msg) mapinfo.luaData.Clear(); mapinfo.luaChecksum = 0; SendToAll(msg); - CancelCountdown(); + cancelCountdown(); return true; } bool GameServer::OnGameMessage(const GameMessage_Countdown& msg) { - if(state != ServerState::Config || !IsHost(msg.senderPlayerID)) + if(state != ServerState::Config || !isHost(msg.senderPlayerID)) { KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } - NetworkPlayer* nwPlayer = GetNetworkPlayer(msg.senderPlayerID); + NetworkPlayer* nwPlayer = getNetworkPlayer(msg.senderPlayerID); if(!nwPlayer || countdown.IsActive()) return true; @@ -1385,8 +1385,8 @@ bool GameServer::OnGameMessage(const GameMessage_Countdown& msg) if(networkPlayers.size() > 1) { countdown.Start(msg.countdown); - SendToAll(GameMessage_Countdown(countdown.GetRemainingSecs())); - LOG.writeToFile("SERVER >>> Countdown started(%d)\n") % countdown.GetRemainingSecs(); + SendToAll(GameMessage_Countdown(countdown.getRemainingSecs())); + LOG.writeToFile("SERVER >>> Countdown started(%d)\n") % countdown.getRemainingSecs(); } else if(!StartGame()) Stop(); } @@ -1396,26 +1396,26 @@ bool GameServer::OnGameMessage(const GameMessage_Countdown& msg) bool GameServer::OnGameMessage(const GameMessage_CancelCountdown& msg) { - if(state != ServerState::Config || !IsHost(msg.senderPlayerID)) + if(state != ServerState::Config || !isHost(msg.senderPlayerID)) { KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } - CancelCountdown(); + cancelCountdown(); return true; } bool GameServer::OnGameMessage(const GameMessage_Pause& msg) { - if(IsHost(msg.senderPlayerID)) - SetPaused(msg.paused); + if(isHost(msg.senderPlayerID)) + setPaused(msg.paused); return true; } bool GameServer::OnGameMessage(const GameMessage_SkipToGF& msg) { - if(IsHost(msg.senderPlayerID)) + if(isHost(msg.senderPlayerID)) { skiptogf = msg.targetGF; SendToAll(msg); @@ -1425,18 +1425,18 @@ bool GameServer::OnGameMessage(const GameMessage_SkipToGF& msg) bool GameServer::OnGameMessage(const GameMessage_GGSChange& msg) { - if(state != ServerState::Config || !IsHost(msg.senderPlayerID)) + if(state != ServerState::Config || !isHost(msg.senderPlayerID)) { KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } ggs_ = msg.ggs; SendToAll(msg); - CancelCountdown(); + cancelCountdown(); return true; } -void GameServer::CancelCountdown() +void GameServer::cancelCountdown() { if(!countdown.IsActive()) return; @@ -1474,8 +1474,8 @@ bool GameServer::ArePlayersReady() const void GameServer::PlayerDataChanged(unsigned playerIdx) { - CancelCountdown(); - JoinPlayerInfo& player = GetJoinPlayer(playerIdx); + cancelCountdown(); + JoinPlayerInfo& player = getJoinPlayer(playerIdx); if(player.ps != PlayerState::AI && player.isReady) { player.isReady = false; @@ -1627,7 +1627,7 @@ void GameServer::CheckAndSetColor(unsigned playerIdx, unsigned newColor, bool en takenColors.insert(otherPlayer.color); } // Look for a unique color - int newColorIdx = JoinPlayerInfo::GetColorIdx(newColor); + int newColorIdx = JoinPlayerInfo::getColorIdx(newColor); while(helpers::contains(takenColors, newColor)) newColor = PLAYER_COLORS[(++newColorIdx) % PLAYER_COLORS.size()]; } @@ -1645,7 +1645,7 @@ bool GameServer::OnGameMessage(const GameMessage_Player_Swap& msg) { if(state != ServerState::Game && state != ServerState::Config) return true; - int targetPlayer = GetTargetPlayer(msg); + int targetPlayer = getTargetPlayer(msg); if(targetPlayer < 0) return true; auto player1 = static_cast(targetPlayer); @@ -1658,7 +1658,7 @@ bool GameServer::OnGameMessage(const GameMessage_Player_Swap& msg) bool GameServer::OnGameMessage(const GameMessage_Player_SwapConfirm& msg) { - GameServerPlayer* player = GetNetworkPlayer(msg.senderPlayerID); + GameServerPlayer* player = getNetworkPlayer(msg.senderPlayerID); if(!player) return true; for(auto it = player->getPendingSwaps().begin(); it != player->getPendingSwaps().end(); ++it) @@ -1701,8 +1701,8 @@ void GameServer::SwapPlayer(const uint8_t player1, const uint8_t player2) swap(playerInfos[player2].isHost, playerInfos[player1].isHost); } // Change ids of network players (if any). Get both first! - GameServerPlayer* newPlayer = GetNetworkPlayer(player2); - GameServerPlayer* oldPlayer = GetNetworkPlayer(player1); + GameServerPlayer* newPlayer = getNetworkPlayer(player2); + GameServerPlayer* oldPlayer = getNetworkPlayer(player1); if(newPlayer) newPlayer->playerId = player1; if(oldPlayer) @@ -1717,7 +1717,7 @@ void GameServer::SwapPlayer(const uint8_t player1, const uint8_t player2) } } -GameServerPlayer* GameServer::GetNetworkPlayer(unsigned playerId) +GameServerPlayer* GameServer::getNetworkPlayer(unsigned playerId) { for(GameServerPlayer& player : networkPlayers) { @@ -1727,7 +1727,7 @@ GameServerPlayer* GameServer::GetNetworkPlayer(unsigned playerId) return nullptr; } -void GameServer::SetPaused(bool paused) +void GameServer::setPaused(bool paused) { if(framesinfo.isPaused == paused) return; @@ -1737,23 +1737,23 @@ void GameServer::SetPaused(bool paused) player.setNotLagging(); } -JoinPlayerInfo& GameServer::GetJoinPlayer(unsigned playerIdx) +JoinPlayerInfo& GameServer::getJoinPlayer(unsigned playerIdx) { return playerInfos.at(playerIdx); } -bool GameServer::IsHost(unsigned playerIdx) const +bool GameServer::isHost(unsigned playerIdx) const { return playerIdx < playerInfos.size() && playerInfos[playerIdx].isHost; } -int GameServer::GetTargetPlayer(const GameMessageWithPlayer& msg) +int GameServer::getTargetPlayer(const GameMessageWithPlayer& msg) { if(msg.player != 0xFF) { - if(msg.player < playerInfos.size() && (msg.player == msg.senderPlayerID || IsHost(msg.senderPlayerID))) + if(msg.player < playerInfos.size() && (msg.player == msg.senderPlayerID || isHost(msg.senderPlayerID))) { - GameServerPlayer* networkPlayer = GetNetworkPlayer(msg.senderPlayerID); + GameServerPlayer* networkPlayer = getNetworkPlayer(msg.senderPlayerID); if(networkPlayer->isActive()) return msg.player; unsigned result = msg.player; diff --git a/libs/s25main/network/GameServer.h b/libs/s25main/network/GameServer.h index f1f7d5deb3..bfecdb787e 100644 --- a/libs/s25main/network/GameServer.h +++ b/libs/s25main/network/GameServer.h @@ -57,7 +57,7 @@ class GameServer : unsigned CalcNWFLength(std::chrono::milliseconds minDuration) const; - GameServerPlayer* GetNetworkPlayer(unsigned playerId); + GameServerPlayer* getNetworkPlayer(unsigned playerId); /// Swap players ingame or during config void SwapPlayer(uint8_t player1, uint8_t player2); @@ -72,10 +72,10 @@ class GameServer : void WaitForClients(); void FillPlayerQueues(); - unsigned GetNumFilledSlots() const; + unsigned getNumFilledSlots() const; /// Notifies listeners (e.g. Lobby) that the game status has changed (e.g player count) void AnnounceStatusChange(); - void SetPaused(bool paused); + void setPaused(bool paused); void LC_Status_Error(const std::string& error) override; void LC_Created() override; @@ -107,7 +107,7 @@ class GameServer : bool OnGameMessage(const GameMessage_SkipToGF& msg) override; RTTR_POP_DIAGNOSTIC - void CancelCountdown(); + void cancelCountdown(); bool ArePlayersReady() const; /// Some player data has changed. Set non-ready and cancel countdown void PlayerDataChanged(unsigned playerIdx); @@ -127,12 +127,12 @@ class GameServer : void CheckAndKickLaggingPlayers(); bool CheckForLaggingPlayers(); - JoinPlayerInfo& GetJoinPlayer(unsigned playerIdx); + JoinPlayerInfo& getJoinPlayer(unsigned playerIdx); /// Is the player with the given idx the host? - bool IsHost(unsigned playerIdx) const; + bool isHost(unsigned playerIdx) const; /// Get the player this message concerns. which is msg.player, msg.senderPlayer or -1 on error/wrong values - int GetTargetPlayer(const GameMessageWithPlayer& msg); + int getTargetPlayer(const GameMessageWithPlayer& msg); unsigned skiptogf; @@ -182,7 +182,7 @@ class GameServer : /// Updates the state and returns true on change. Stops 1s after remainingSecs reached zero bool Update(); bool IsActive() const { return isActive; } - unsigned GetRemainingSecs() const { return remainingSecs; } + unsigned getRemainingSecs() const { return remainingSecs; } } countdown; struct AsyncLog; diff --git a/libs/s25main/network/IGameLobbyController.h b/libs/s25main/network/IGameLobbyController.h index 04bc394070..f410c66781 100644 --- a/libs/s25main/network/IGameLobbyController.h +++ b/libs/s25main/network/IGameLobbyController.h @@ -19,15 +19,15 @@ class IGameLobbyController { public: virtual ~IGameLobbyController() = default; - virtual unsigned GetMaxNumPlayers() const = 0; - virtual JoinPlayerInfo& GetJoinPlayer(unsigned playerIdx) = 0; + virtual unsigned getMaxNumPlayers() const = 0; + virtual JoinPlayerInfo& getJoinPlayer(unsigned playerIdx) = 0; virtual void CloseSlot(unsigned playerIdx) = 0; - virtual void SetPlayerState(unsigned playerIdx, PlayerState state, const AI::Info& aiInfo) = 0; - virtual void SetName(unsigned playerIdx, const std::string& name) = 0; - virtual void SetPortrait(unsigned playerIdx, unsigned portraitIndex) = 0; - virtual void SetColor(unsigned playerIdx, unsigned newColor) = 0; - virtual void SetTeam(unsigned playerIdx, Team newTeam) = 0; - virtual void SetNation(unsigned playerIdx, Nation newNation) = 0; - virtual const GlobalGameSettings& GetGGS() const = 0; + virtual void setPlayerState(unsigned playerIdx, PlayerState state, const AI::Info& aiInfo) = 0; + virtual void setName(unsigned playerIdx, const std::string& name) = 0; + virtual void setPortrait(unsigned playerIdx, unsigned portraitIndex) = 0; + virtual void setColor(unsigned playerIdx, unsigned newColor) = 0; + virtual void setTeam(unsigned playerIdx, Team newTeam) = 0; + virtual void setNation(unsigned playerIdx, Nation newNation) = 0; + virtual const GlobalGameSettings& getGGS() const = 0; virtual void ChangeGlobalGameSettings(const GlobalGameSettings& ggs) = 0; }; diff --git a/libs/s25main/nodeObjs/noAnimal.cpp b/libs/s25main/nodeObjs/noAnimal.cpp index f54c6b6a2b..5909a413f2 100644 --- a/libs/s25main/nodeObjs/noAnimal.cpp +++ b/libs/s25main/nodeObjs/noAnimal.cpp @@ -48,7 +48,7 @@ noAnimal::noAnimal(SerializedGameData& sgd, const unsigned obj_id) : noMovable(sgd, obj_id), species(sgd.Pop()), state(sgd.Pop()), pause_way(sgd.PopUnsignedShort()), hunter(sgd.PopObject(GO_Type::NofHunter)), skinner(nullptr), sound_moment(0) { - if(sgd.GetGameDataVersion() >= 12) + if(sgd.getGameDataVersion() >= 12) skinner = sgd.PopObject(GO_Type::NofSkinner); } @@ -73,22 +73,22 @@ void noAnimal::Draw(DrawPoint drawPt) // Interpolieren zwischen beiden Knotenpunkten drawPt += CalcWalkingRelative(); - unsigned ani_step = GAMECLIENT.Interpolate(ASCENT_ANIMATION_STEPS[GetAscent()], current_ev) + unsigned ani_step = GAMECLIENT.Interpolate(ASCENT_ANIMATION_STEPS[getAscent()], current_ev) % ANIMALCONSTS[species].animation_steps; // Zeichnen - LOADER.getAnimalSprite(species, GetCurMoveDir(), ani_step).draw(drawPt); + LOADER.getAnimalSprite(species, getCurMoveDir(), ani_step).draw(drawPt); // Bei Enten und Schafen: Soll ein Sound gespielt werden? if(species == Species::Duck || species == Species::Sheep) { - const unsigned now = VIDEODRIVER.GetTickCount(); + const unsigned now = VIDEODRIVER.getTickCount(); // Wurde der Soundzeitpunkt schon überschritten? if(now > sound_moment) { // Play the sound if we unless we missed the timeframe by at least 1s - if((now < sound_moment + 1000) && !GAMECLIENT.IsPaused()) - world->GetSoundMgr().playAnimalSound((species == Species::Sheep) ? 94 : 95); + if((now < sound_moment + 1000) && !GAMECLIENT.isPaused()) + world->getSoundMgr().playAnimalSound((species == Species::Sheep) ? 94 : 95); // Calc new sound time sound_moment = now + helpers::randomValue(getAnimalRng(), 8000, 13000); @@ -100,7 +100,7 @@ void noAnimal::Draw(DrawPoint drawPt) case State::Paused: { // Stehend zeichnen - LOADER.getAnimalSprite(species, GetCurMoveDir(), 0).draw(drawPt); + LOADER.getAnimalSprite(species, getCurMoveDir(), 0).draw(drawPt); } break; case State::Dead: @@ -123,7 +123,7 @@ void noAnimal::Draw(DrawPoint drawPt) } else { // Stehend zeichnen - LOADER.getAnimalSprite(species, GetCurMoveDir(), 0).draw(drawPt, SetAlpha(COLOR_WHITE, alpha)); + LOADER.getAnimalSprite(species, getCurMoveDir(), 0).draw(drawPt, SetAlpha(COLOR_WHITE, alpha)); } } break; @@ -172,7 +172,7 @@ void noAnimal::HandleEvent(const unsigned id) case 2: { // nun verschwinden - current_ev = GetEvMgr().AddEvent(this, 30, 3); + current_ev = getEvMgr().AddEvent(this, 30, 3); state = State::Disappearing; // Jäger ggf. Bescheid sagen (falls der es nicht mehr rechtzeitig schafft, bis ich verwest bin) @@ -192,7 +192,7 @@ void noAnimal::HandleEvent(const unsigned id) case 3: { // von der Karte tilgen - GetEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); + getEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); } break; } @@ -246,7 +246,7 @@ void noAnimal::Walked() // dann stellt es sich hier hin und wartet erstmal eine Weile state = State::Paused; pause_way = 5 + RANDOM_RAND(15); - current_ev = GetEvMgr().AddEvent(this, 50 + RANDOM_RAND(50), 1); + current_ev = getEvMgr().AddEvent(this, 50 + RANDOM_RAND(50), 1); } else { StandardWalking(); @@ -255,7 +255,7 @@ void noAnimal::Walked() // Bei Enten und Schafen: Soundzeitpunkt ggf. setzen if(species == Species::Duck || species == Species::Sheep) { - const unsigned now = VIDEODRIVER.GetTickCount(); + const unsigned now = VIDEODRIVER.getTickCount(); // Wurde der Soundzeitpunkt schon überschritten? if(now > sound_moment) sound_moment = now + helpers::randomValue(getAnimalRng(), 8000, 13000); @@ -269,11 +269,11 @@ helpers::OptionalEnum noAnimal::FindDir() { // mit zufälliger Richtung anfangen const Direction doffset = RANDOM_ENUM(Direction); - const WorldDescription& worldDesc = world->GetDescription(); + const WorldDescription& worldDesc = world->getDescription(); for(const auto dir : helpers::enumRange(doffset)) { - const auto terrains = world->GetTerrain(pos, dir); + const auto terrains = world->getTerrain(pos, dir); const DescIdx tLeft = terrains.left; const DescIdx tRight = terrains.right; @@ -290,25 +290,25 @@ helpers::OptionalEnum noAnimal::FindDir() } else { // Die anderen Tiere dürfen nur auf Wiesen,Savannen usw. laufen, nicht auf Bergen oder in der Wüste! - if(!worldDesc.get(tLeft).IsUsableByAnimals() || !worldDesc.get(tRight).IsUsableByAnimals()) + if(!worldDesc.get(tLeft).isUsableByAnimals() || !worldDesc.get(tRight).isUsableByAnimals()) continue; // Außerdem dürfen keine Hindernisse im Weg sein - const MapPoint dst = world->GetNeighbour(pos, dir); - const noBase* no = world->GetNO(dst); + const MapPoint dst = world->getNeighbour(pos, dir); + const noBase* no = world->getNO(dst); - if(no->GetType() != NodalObjectType::Nothing && no->GetType() != NodalObjectType::Environment - && no->GetType() != NodalObjectType::Tree) + if(no->getType() != NodalObjectType::Nothing && no->getType() != NodalObjectType::Environment + && no->getType() != NodalObjectType::Tree) continue; // Schließlich auch möglichst keine anderen Figuren bzw. Tiere - if(!world->GetFigures(dst).empty()) + if(!world->getFigures(dst).empty()) continue; // Und möglichst auch keine Straßen for(const auto dir2 : helpers::EnumRange{}) { - if(world->GetPointRoad(dst, dir2) != PointRoad::None) + if(world->getPointRoad(dst, dir2) != PointRoad::None) return std::nullopt; } return dir; @@ -319,12 +319,12 @@ helpers::OptionalEnum noAnimal::FindDir() return std::nullopt; } -bool noAnimal::CanBeSkinned() const +bool noAnimal::canBeSkinned() const { return (species != Species::Duck && state == State::Dead && !skinner); } -bool noAnimal::IsGettingSkinned() const +bool noAnimal::isGettingSkinned() const { return skinner != nullptr; } @@ -334,7 +334,7 @@ void noAnimal::Skinned() if(!hunter) { // Remove decay event for animal because skinner has taken it - GetEvMgr().RemoveEvent(current_ev); + getEvMgr().RemoveEvent(current_ev); } // Reset skinner skinner = nullptr; @@ -350,13 +350,13 @@ void noAnimal::StopSkinning() skinner = nullptr; } -bool noAnimal::CanHunted() const +bool noAnimal::canHunted() const { // Enten sowie Tiere, die bereits gejagt werden, oder schon tot daliegen, können nicht gejagt werden return (species != Species::Duck && state != State::Dead && state != State::Disappearing && !hunter); } -bool noAnimal::IsHunted() const +bool noAnimal::isHunted() const { return hunter != nullptr; } @@ -374,13 +374,13 @@ MapPoint noAnimal::HunterIsNear() // dann bleibt es einfach stehen und gibt seine jetzigen Koordinaten zurück state = State::WaitingForHunter; // Warteevent abmelden - GetEvMgr().RemoveEvent(current_ev); + getEvMgr().RemoveEvent(current_ev); return pos; } else { // ansonsten nach dem Laufen stehenbleiben und die Koordinaten zurückgeben von dem Punkt, der erreicht wird state = State::WalkingUntilWaitingForHunter; - return world->GetNeighbour(pos, GetCurMoveDir()); + return world->getNeighbour(pos, getCurMoveDir()); } } @@ -416,12 +416,12 @@ void noAnimal::Die() { // Verwesungsevent unsigned gf_length = leatheraddon::isAddonActive(*world) ? 600 : 300; - current_ev = GetEvMgr().AddEvent(this, gf_length, 2); + current_ev = getEvMgr().AddEvent(this, gf_length, 2); state = State::Dead; } else { // Falls keine Verwesungsgrafik --> sofort verschwinden - current_ev = GetEvMgr().AddEvent(this, 30, 3); + current_ev = getEvMgr().AddEvent(this, 30, 3); state = State::Disappearing; } } @@ -429,8 +429,8 @@ void noAnimal::Die() void noAnimal::Eviscerated() { // Event abmelden - if(!IsGettingSkinned()) - GetEvMgr().RemoveEvent(current_ev); + if(!isGettingSkinned()) + getEvMgr().RemoveEvent(current_ev); // Reset hunter hunter = nullptr; } diff --git a/libs/s25main/nodeObjs/noAnimal.h b/libs/s25main/nodeObjs/noAnimal.h index 826d8f3b90..68c410afaa 100644 --- a/libs/s25main/nodeObjs/noAnimal.h +++ b/libs/s25main/nodeObjs/noAnimal.h @@ -63,8 +63,8 @@ class noAnimal : public noMovable noMovable::Destroy(); } - GO_Type GetGOT() const final { return GO_Type::Animal; } - Species GetSpecies() const { return species; } + GO_Type getGOT() const final { return GO_Type::Animal; } + Species getSpecies() const { return species; } // An x,y zeichnen void Draw(DrawPoint drawPt) override; @@ -74,15 +74,15 @@ class noAnimal : public noMovable /// Wird aufgerufen, nachdem das Tier erzeugt wurde und zur Figurenliste hinzugefügt wurde void StartLiving(); - bool CanBeSkinned() const; - bool IsGettingSkinned() const; + bool canBeSkinned() const; + bool isGettingSkinned() const; void BeginSkinning(nofSkinner* skinner); void StopSkinning(); void Skinned(); /// Kann das Tier noch vom Jäger gejagt werden? - bool CanHunted() const; - bool IsHunted() const; + bool canHunted() const; + bool isHunted() const; /// Ein Jäger geht das Tier jagen void BeginHunting(nofHunter* hunter); @@ -93,8 +93,8 @@ class noAnimal : public noMovable void StopHunting(); /// Steht das Tier schon schön ruhig, damit der Jäger es erschießen kann? - bool IsReadyForShooting() const { return (state == State::WaitingForHunter); } - bool IsGettingReadyForShooting() const { return (state == State::WalkingUntilWaitingForHunter); } + bool isReadyForShooting() const { return (state == State::WaitingForHunter); } + bool isGettingReadyForShooting() const { return (state == State::WalkingUntilWaitingForHunter); } /// Tier soll sterben - erstmal nur Leiche liegen lassen void Die(); /// Tier wurde vom Jäger ausgenommen und muss sofort verschwinden diff --git a/libs/s25main/nodeObjs/noBase.cpp b/libs/s25main/nodeObjs/noBase.cpp index 4d40574a41..128b81a590 100644 --- a/libs/s25main/nodeObjs/noBase.cpp +++ b/libs/s25main/nodeObjs/noBase.cpp @@ -20,13 +20,13 @@ std::unique_ptr noBase::CreateFOWObject() const return nullptr; } -BlockingManner noBase::GetBM() const +BlockingManner noBase::getBM() const { return BlockingManner::None; } /// Gibt zurück, ob sich das angegebene Objekt zwischen zwei Punkten bewegt -bool noBase::IsMoving() const +bool noBase::isMoving() const { return false; } diff --git a/libs/s25main/nodeObjs/noBase.h b/libs/s25main/nodeObjs/noBase.h index cf81e282da..01c3effcce 100644 --- a/libs/s25main/nodeObjs/noBase.h +++ b/libs/s25main/nodeObjs/noBase.h @@ -34,16 +34,16 @@ class noBase : public GameObject virtual void Draw(DrawPoint drawPt) = 0; /// Type zurückgeben. - NodalObjectType GetType() const { return nop; } + NodalObjectType getType() const { return nop; } void Serialize(SerializedGameData& sgd) const override; /// Erzeugt von ihnen selbst ein FOW Objekt als visuelle "Erinnerung" für den Fog of War virtual std::unique_ptr CreateFOWObject() const; - virtual BlockingManner GetBM() const; + virtual BlockingManner getBM() const; /// Gibt zurück, ob sich das angegebene Objekt zwischen zwei Punkten bewegt - virtual bool IsMoving() const; + virtual bool isMoving() const; private: NodalObjectType nop; /// Typ des NodeObjekt ( @see NodalObjectTypes.h ) diff --git a/libs/s25main/nodeObjs/noCharburnerPile.cpp b/libs/s25main/nodeObjs/noCharburnerPile.cpp index 22a09b699a..f3b5f730d7 100644 --- a/libs/s25main/nodeObjs/noCharburnerPile.cpp +++ b/libs/s25main/nodeObjs/noCharburnerPile.cpp @@ -37,7 +37,7 @@ noCharburnerPile::~noCharburnerPile() = default; void noCharburnerPile::Destroy() { - GetEvMgr().RemoveEvent(event); + getEvMgr().RemoveEvent(event); // Bauplätze drumrum neu berechnen world->RecalcBQAroundPointBig(pos); @@ -67,17 +67,17 @@ void noCharburnerPile::Draw(DrawPoint drawPt) case State::Wood: { // Draw sand on which the wood stack is constructed - LOADER.GetImageN("charburner_bobs", 25)->DrawFull(drawPt); + LOADER.getImageN("charburner_bobs", 25)->DrawFull(drawPt); glArchivItem_Bitmap* image; if(step == 0) - image = LOADER.GetImageN("charburner_bobs", 26); + image = LOADER.getImageN("charburner_bobs", 26); else { - image = LOADER.GetImageN("charburner_bobs", 28); + image = LOADER.getImageN("charburner_bobs", 28); // Draw wood pile beneath the cover - LOADER.GetImageN("charburner_bobs", 26)->DrawFull(drawPt); + LOADER.getImageN("charburner_bobs", 26)->DrawFull(drawPt); } unsigned short progress = sub_step * 100 / CONSTRUCTION_WORKING_STEPS[step]; @@ -88,27 +88,27 @@ void noCharburnerPile::Draw(DrawPoint drawPt) case State::Smoldering: { LOADER - .GetImageN("charburner_bobs", - 27 + GAMECLIENT.GetGlobalAnimation(2, 10, 1, GetObjId() + this->pos.x * 10 + this->pos.y * 10)) + .getImageN("charburner_bobs", + 27 + GAMECLIENT.getGlobalAnimation(2, 10, 1, getObjId() + this->pos.x * 10 + this->pos.y * 10)) ->DrawFull(drawPt); // Dann Qualm zeichnen - unsigned globalAnimation = GAMECLIENT.GetGlobalAnimation(8, 5, 2, (this->pos.x + this->pos.y) * 100); - LOADER.GetMapTexture(692 + 1 * 8 + globalAnimation) + unsigned globalAnimation = GAMECLIENT.getGlobalAnimation(8, 5, 2, (this->pos.x + this->pos.y) * 100); + LOADER.getMapTexture(692 + 1 * 8 + globalAnimation) ->DrawFull(drawPt + DrawPoint(21, -11), 0x99EEEEEE); //-V525 - LOADER.GetMapTexture(692 + 2 * 8 + globalAnimation)->DrawFull(drawPt - DrawPoint(2, 06), 0x99EEEEEE); - LOADER.GetMapTexture(692 + 1 * 8 + globalAnimation)->DrawFull(drawPt - DrawPoint(25, 11), 0x99EEEEEE); - LOADER.GetMapTexture(692 + 3 * 8 + globalAnimation)->DrawFull(drawPt - DrawPoint(2, 35), 0x99EEEEEE); + LOADER.getMapTexture(692 + 2 * 8 + globalAnimation)->DrawFull(drawPt - DrawPoint(2, 06), 0x99EEEEEE); + LOADER.getMapTexture(692 + 1 * 8 + globalAnimation)->DrawFull(drawPt - DrawPoint(25, 11), 0x99EEEEEE); + LOADER.getMapTexture(692 + 3 * 8 + globalAnimation)->DrawFull(drawPt - DrawPoint(2, 35), 0x99EEEEEE); } return; case State::RemoveCover: { - LOADER.GetImageN("charburner_bobs", 28 + step)->DrawFull(drawPt); + LOADER.getImageN("charburner_bobs", 28 + step)->DrawFull(drawPt); } return; case State::Harvest: { - LOADER.GetImageN("charburner_bobs", 34 + step)->DrawFull(drawPt); + LOADER.getImageN("charburner_bobs", 34 + step)->DrawFull(drawPt); } return; default: return; @@ -123,14 +123,14 @@ void noCharburnerPile::HandleEvent(const unsigned /*id*/) { state = State::RemoveCover; // start a selfdestruct timer - event = GetEvMgr().AddEvent(this, SELFDESTRUCT_DELAY, 0); + event = getEvMgr().AddEvent(this, SELFDESTRUCT_DELAY, 0); } else { // selfdestruct! event = nullptr; - world->SetNO(pos, new noFire(pos, false), true); + world->setNO(pos, new noFire(pos, false), true); world->RecalcBQAroundPoint(pos); - GetEvMgr().AddToKillList(this); + getEvMgr().AddToKillList(this); } } @@ -139,8 +139,8 @@ void noCharburnerPile::NextStep() { // reset selfdestruct timer if(event) - GetEvMgr().RemoveEvent(event); - event = GetEvMgr().AddEvent(this, SELFDESTRUCT_DELAY, 0); + getEvMgr().RemoveEvent(event); + event = getEvMgr().AddEvent(this, SELFDESTRUCT_DELAY, 0); // execute step switch(state) @@ -159,8 +159,8 @@ void noCharburnerPile::NextStep() { step = 0; state = State::Smoldering; - GetEvMgr().RemoveEvent(event); - event = GetEvMgr().AddEvent(this, SMOLDERING_LENGTH, 0); + getEvMgr().RemoveEvent(event); + event = getEvMgr().AddEvent(this, SMOLDERING_LENGTH, 0); } } } @@ -194,8 +194,8 @@ void noCharburnerPile::NextStep() if(step == 6) { // Add an empty pile as environmental object - world->SetNO(pos, new noEnvObject(pos, 40, 6), true); - GetEvMgr().AddToKillList(this); + world->setNO(pos, new noEnvObject(pos, 40, 6), true); + getEvMgr().AddToKillList(this); // BQ drumrum neu berechnen world->RecalcBQAroundPoint(pos); @@ -206,7 +206,7 @@ void noCharburnerPile::NextStep() } } -noCharburnerPile::WareType noCharburnerPile::GetNeededWareType() const +noCharburnerPile::WareType noCharburnerPile::getNeededWareType() const { if(sub_step % 2 == 0) return WareType::Wood; diff --git a/libs/s25main/nodeObjs/noCharburnerPile.h b/libs/s25main/nodeObjs/noCharburnerPile.h index f624be9366..541bb5dae3 100644 --- a/libs/s25main/nodeObjs/noCharburnerPile.h +++ b/libs/s25main/nodeObjs/noCharburnerPile.h @@ -44,15 +44,15 @@ class noCharburnerPile : public noCoordBase void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Charburnerpile; } + GO_Type getGOT() const final { return GO_Type::Charburnerpile; } void Draw(DrawPoint drawPt) override; void HandleEvent(unsigned id) override; - BlockingManner GetBM() const override { return BlockingManner::NothingAround; } + BlockingManner getBM() const override { return BlockingManner::NothingAround; } /// Get the current state of the charburner pile - State GetState() const { return state; } + State getState() const { return state; } /// Charburner has worked on it --> Goto next step void NextStep(); @@ -64,5 +64,5 @@ class noCharburnerPile : public noCoordBase Wood, Grain }; - WareType GetNeededWareType() const; + WareType getNeededWareType() const; }; diff --git a/libs/s25main/nodeObjs/noCoordBase.h b/libs/s25main/nodeObjs/noCoordBase.h index 0c53515ea8..ae665676c2 100644 --- a/libs/s25main/nodeObjs/noCoordBase.h +++ b/libs/s25main/nodeObjs/noCoordBase.h @@ -17,12 +17,12 @@ class noCoordBase : public noBase void Serialize(SerializedGameData& sgd) const override; /// liefert die X-Koordinate. - MapCoord GetX() const { return pos.x; } + MapCoord getX() const { return pos.x; } /// liefert die Y-Koordinate. - MapCoord GetY() const { return pos.y; } + MapCoord getY() const { return pos.y; } /// Returns position - MapPoint GetPos() const { return pos; } + MapPoint getPos() const { return pos; } protected: MapPoint pos; diff --git a/libs/s25main/nodeObjs/noDisappearingEnvObject.cpp b/libs/s25main/nodeObjs/noDisappearingEnvObject.cpp index 7c81ca4aa4..a3f205aa29 100644 --- a/libs/s25main/nodeObjs/noDisappearingEnvObject.cpp +++ b/libs/s25main/nodeObjs/noDisappearingEnvObject.cpp @@ -15,7 +15,7 @@ noDisappearingEnvObject::noDisappearingEnvObject(const MapPoint pos, const unsig const unsigned add_var_living_time) : noCoordBase(NodalObjectType::Environment, pos), disappearing(false) { - dead_event = GetEvMgr().AddEvent(this, living_time + RANDOM_RAND(add_var_living_time)); + dead_event = getEvMgr().AddEvent(this, living_time + RANDOM_RAND(add_var_living_time)); } void noDisappearingEnvObject::Serialize(SerializedGameData& sgd) const @@ -30,7 +30,7 @@ noDisappearingEnvObject::noDisappearingEnvObject(SerializedGameData& sgd, const : noCoordBase(sgd, obj_id), disappearing(sgd.PopBool()), dead_event(sgd.PopEvent()) {} -unsigned noDisappearingEnvObject::GetDrawColor() const +unsigned noDisappearingEnvObject::getDrawColor() const { if(disappearing) { @@ -40,7 +40,7 @@ unsigned noDisappearingEnvObject::GetDrawColor() const return 0xFFFFFFFF; } -unsigned noDisappearingEnvObject::GetDrawShadowColor() const +unsigned noDisappearingEnvObject::getDrawShadowColor() const { if(disappearing) { @@ -54,25 +54,25 @@ void noDisappearingEnvObject::HandleEvent(const unsigned /*id*/) { if(disappearing) { - RTTR_Assert(world->GetNode(pos).obj == this); - world->SetNO(pos, nullptr); - GetEvMgr().AddToKillList(this); + RTTR_Assert(world->getNode(pos).obj == this); + world->setNO(pos, nullptr); + getEvMgr().AddToKillList(this); dead_event = nullptr; } else { disappearing = true; // Remove after some time fading out - dead_event = GetEvMgr().AddEvent(this, 30, 1); + dead_event = getEvMgr().AddEvent(this, 30, 1); } } void noDisappearingEnvObject::Destroy() { // Remove from map if still present - if(world->GetNode(pos).obj == this) - world->SetNO(pos, nullptr); + if(world->getNode(pos).obj == this) + world->setNO(pos, nullptr); - GetEvMgr().RemoveEvent(dead_event); + getEvMgr().RemoveEvent(dead_event); noCoordBase::Destroy(); } diff --git a/libs/s25main/nodeObjs/noDisappearingEnvObject.h b/libs/s25main/nodeObjs/noDisappearingEnvObject.h index c19456d127..baa5909362 100644 --- a/libs/s25main/nodeObjs/noDisappearingEnvObject.h +++ b/libs/s25main/nodeObjs/noDisappearingEnvObject.h @@ -22,9 +22,9 @@ class noDisappearingEnvObject : public noCoordBase protected: /// Gibt Farbe zurück, mit der das Objekt gezeichnet werden soll - unsigned GetDrawColor() const; + unsigned getDrawColor() const; /// Gibt Farbe zurück, mit der der Schatten des Objekts gezeichnet werden soll - unsigned GetDrawShadowColor() const; + unsigned getDrawShadowColor() const; private: /// Bin ich grad in der Sterbephase (in der das Schild immer transparenter wird, bevor es verschwindet) diff --git a/libs/s25main/nodeObjs/noDisappearingMapEnvObject.cpp b/libs/s25main/nodeObjs/noDisappearingMapEnvObject.cpp index a378972d11..b6a2ed93e8 100644 --- a/libs/s25main/nodeObjs/noDisappearingMapEnvObject.cpp +++ b/libs/s25main/nodeObjs/noDisappearingMapEnvObject.cpp @@ -36,7 +36,7 @@ noDisappearingMapEnvObject::noDisappearingMapEnvObject(SerializedGameData& sgd, void noDisappearingMapEnvObject::Draw(DrawPoint drawPt) { // Bild - LOADER.GetMapTexture(map_id)->DrawFull(drawPt, GetDrawColor()); + LOADER.getMapTexture(map_id)->DrawFull(drawPt, getDrawColor()); // Schatten - LOADER.GetMapTexture(map_id + 100)->DrawFull(drawPt, GetDrawShadowColor()); + LOADER.getMapTexture(map_id + 100)->DrawFull(drawPt, getDrawShadowColor()); } diff --git a/libs/s25main/nodeObjs/noDisappearingMapEnvObject.h b/libs/s25main/nodeObjs/noDisappearingMapEnvObject.h index 2a3a2f6254..3ae6267f27 100644 --- a/libs/s25main/nodeObjs/noDisappearingMapEnvObject.h +++ b/libs/s25main/nodeObjs/noDisappearingMapEnvObject.h @@ -16,7 +16,7 @@ class noDisappearingMapEnvObject : public noDisappearingEnvObject void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Disappearingmapenvobject; } + GO_Type getGOT() const final { return GO_Type::Disappearingmapenvobject; } /// An x,y zeichnen. void Draw(DrawPoint drawPt) override; diff --git a/libs/s25main/nodeObjs/noEnvObject.h b/libs/s25main/nodeObjs/noEnvObject.h index aa77475ad5..183962a8cf 100644 --- a/libs/s25main/nodeObjs/noEnvObject.h +++ b/libs/s25main/nodeObjs/noEnvObject.h @@ -13,5 +13,5 @@ class noEnvObject : public noStaticObject noEnvObject(MapPoint pos, unsigned short id, unsigned short file = 0xFFFF); noEnvObject(SerializedGameData& sgd, unsigned obj_id); - GO_Type GetGOT() const final { return GO_Type::Envobject; } + GO_Type getGOT() const final { return GO_Type::Envobject; } }; diff --git a/libs/s25main/nodeObjs/noExtension.h b/libs/s25main/nodeObjs/noExtension.h index 9b7b4ae7e6..4b5aeaa552 100644 --- a/libs/s25main/nodeObjs/noExtension.h +++ b/libs/s25main/nodeObjs/noExtension.h @@ -15,15 +15,15 @@ class noExtension final : public noBase noExtension(SerializedGameData& sgd, unsigned obj_id); ~noExtension() override; - noBase* GetBaseObject() const { return base; } + noBase* getBaseObject() const { return base; } void Draw(DrawPoint /*drawPt*/) override {} void Destroy() override {} void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Extension; } + GO_Type getGOT() const final { return GO_Type::Extension; } - BlockingManner GetBM() const override { return BlockingManner::Single; } + BlockingManner getBM() const override { return BlockingManner::Single; } private: noBase* const base; diff --git a/libs/s25main/nodeObjs/noFighting.cpp b/libs/s25main/nodeObjs/noFighting.cpp index a016a3375e..84dd70066f 100644 --- a/libs/s25main/nodeObjs/noFighting.cpp +++ b/libs/s25main/nodeObjs/noFighting.cpp @@ -21,8 +21,8 @@ noFighting::noFighting(nofActiveSoldier& soldier1, nofActiveSoldier& soldier2) : noBase(NodalObjectType::Fighting) { - RTTR_Assert(soldier1.GetPlayer() != soldier2.GetPlayer()); - const MapPoint pos = soldier1.GetPos(); + RTTR_Assert(soldier1.getPlayer() != soldier2.getPlayer()); + const MapPoint pos = soldier1.getPos(); soldiers[0] = world->RemoveFigure(pos, soldier1); soldiers[1] = world->RemoveFigure(pos, soldier2); @@ -31,14 +31,14 @@ noFighting::noFighting(nofActiveSoldier& soldier1, nofActiveSoldier& soldier2) : player_won = 0xFF; // Beginn-Event Anmelden (Soldaten gehen auf ihre Seiten) - current_ev = GetEvMgr().AddEvent(this, 15); + current_ev = getEvMgr().AddEvent(this, 15); // anderen Leute, die auf diesem Punkt zulaufen, stoppen world->StopOnRoads(pos); // Sichtradius behalten - world->MakeVisibleAroundPoint(pos, VISUALRANGE_SOLDIER, soldier1.GetPlayer()); - world->MakeVisibleAroundPoint(pos, VISUALRANGE_SOLDIER, soldier2.GetPlayer()); + world->MakeVisibleAroundPoint(pos, VISUALRANGE_SOLDIER, soldier1.getPlayer()); + world->MakeVisibleAroundPoint(pos, VISUALRANGE_SOLDIER, soldier2.getPlayer()); } noFighting::~noFighting() = default; @@ -81,14 +81,14 @@ void noFighting::Draw(DrawPoint drawPt) { const unsigned curAnimFrame = GAMECLIENT.Interpolate(16, current_ev); const auto& soldier = *soldiers[turn - 3]; - const GamePlayer& owner = world->GetPlayer(soldier.GetPlayer()); + const GamePlayer& owner = world->getPlayer(soldier.getPlayer()); // Sterben des einen Soldatens (letzte Phase) if(curAnimFrame < 4) { // Noch kurz dastehen und warten, bis man stirbt - LOADER.fight_cache[owner.nation][soldier.GetRank()][turn - 3].defending[0][0].drawForPlayer( + LOADER.fight_cache[owner.nation][soldier.getRank()][turn - 3].defending[0][0].drawForPlayer( drawPt, owner.color); } else { @@ -97,14 +97,14 @@ void noFighting::Draw(DrawPoint drawPt) drawPt.x -= 12; else drawPt.x += 12; - LOADER.GetPlayerImage("rom_bobs", 903 + curAnimFrame - 4)->DrawFull(drawPt, COLOR_WHITE, owner.color); + LOADER.getPlayerImage("rom_bobs", 903 + curAnimFrame - 4)->DrawFull(drawPt, COLOR_WHITE, owner.color); } - if(soldiers[turn - 3]->HasArmor()) + if(soldiers[turn - 3]->hasArmor()) soldiers[turn - 3]->DrawArmor(drawPt); // Sterbesound abspielen if(curAnimFrame == 6) - world->GetSoundMgr().playNOSound(104, *this, 2); + world->getSoundMgr().playNOSound(104, *this, 2); } break; case 2: @@ -114,12 +114,12 @@ void noFighting::Draw(DrawPoint drawPt) drawPt.x -= x_diff; for(unsigned i : {0, 1}) { - const GamePlayer& owner = world->GetPlayer(soldiers[i]->GetPlayer()); - glSmartBitmap& bmp = LOADER.getBobSprite(owner.nation, soldiers[i]->GetJobType(), + const GamePlayer& owner = world->getPlayer(soldiers[i]->getPlayer()); + glSmartBitmap& bmp = LOADER.getBobSprite(owner.nation, soldiers[i]->getJobType(), (i == 0) ? Direction::West : Direction::East, GAMECLIENT.Interpolate(8, current_ev)); bmp.draw(drawPt, COLOR_WHITE, owner.color); - if(soldiers[i]->HasArmor()) + if(soldiers[i]->hasArmor()) soldiers[i]->DrawArmor(drawPt); drawPt.x += 2 * x_diff; } @@ -134,8 +134,8 @@ void noFighting::Draw(DrawPoint drawPt) for(unsigned i : {0, 1}) { const auto& soldier = *soldiers[i]; - const GamePlayer& owner = world->GetPlayer(soldier.GetPlayer()); - auto& fightAnim = LOADER.fight_cache[owner.nation][soldier.GetRank()][i]; + const GamePlayer& owner = world->getPlayer(soldier.getPlayer()); + auto& fightAnim = LOADER.fight_cache[owner.nation][soldier.getRank()][i]; // Ist der Soldat mit Angreifen dran? if(turn == i) @@ -153,32 +153,32 @@ void noFighting::Draw(DrawPoint drawPt) // Wenn schwache Soldaten Schild hinhalten (Ani 0 und 1) oder stärkere sich mit den Schwertern // schützen (Ani 0) dann Schwert-aneinanderklirr-Sound abspielen if(curAnimFrame == 5 - && ((soldier.GetRank() < 2 && defending_animation < 2) - || (soldier.GetRank() > 1 && defending_animation == 0))) - world->GetSoundMgr().playNOSound(101, *this, 1); + && ((soldier.getRank() < 2 && defending_animation < 2) + || (soldier.getRank() > 1 && defending_animation == 0))) + world->getSoundMgr().playNOSound(101, *this, 1); } else { // Getroffen-Animation (weißes Aufblinken) - if(curAnimFrame == HIT_MOMENT[soldiers[1 - i]->GetRank()]) + if(curAnimFrame == HIT_MOMENT[soldiers[1 - i]->getRank()]) { // weiß aufblinken fightAnim.hit.drawForPlayer(drawPt, owner.color); // Treffersound - world->GetSoundMgr().playNOSound(105, *this, 1); + world->getSoundMgr().playNOSound(105, *this, 1); } else // normal dastehen fightAnim.defending[0][0].drawForPlayer(drawPt, owner.color); } } - if(soldiers[i]->HasArmor()) + if(soldiers[i]->hasArmor()) soldiers[i]->DrawArmor(drawPt + DrawPoint(i == 0 ? -12 : 12, 0)); } // Angriffssound if(curAnimFrame == 3) - world->GetSoundMgr().playNOSound(103, *this, 0); + world->getSoundMgr().playNOSound(103, *this, 0); } break; } @@ -205,20 +205,20 @@ void noFighting::HandleEvent(const unsigned id) case 1: { // Sounds löschen von der letzten Kampfphase - world->GetSoundMgr().stopSounds(*this); + world->getSoundMgr().stopSounds(*this); // Wurde der eine getroffen? if(defending_animation == 3) { soldiers[1 - turn]->TakeHit(); - if(soldiers[1 - turn]->GetHitpoints() == 0) + if(soldiers[1 - turn]->getHitpoints() == 0) { // Besitzer merken für die Sichtbarkeiten am Ende dann - player_won = soldiers[turn]->GetPlayer(); + player_won = soldiers[turn]->getPlayer(); // Soldat Bescheid sagen, dass er stirbt soldiers[1 - turn]->LostFighting(); // Anderen Soldaten auf die Karte wieder setzen, Bescheid sagen, er kann wieder loslaufen - const MapPoint pos = soldiers[turn]->GetPos(); + const MapPoint pos = soldiers[turn]->getPos(); auto& winningSoldier = world->AddFigure(pos, std::move(soldiers[turn])); // Hitpoints sind 0 --> Soldat ist tot, Kampf beendet, turn = 3+welche Soldat stirbt // Do this before calling WonFighting so this fight doesn't block the soldier looking for a new @@ -226,12 +226,12 @@ void noFighting::HandleEvent(const unsigned id) turn = 3 + (1 - turn); winningSoldier.WonFighting(); // Event zum Sterben des einen Soldaten anmelden - current_ev = GetEvMgr().AddEvent(this, 30); + current_ev = getEvMgr().AddEvent(this, 30); // Umstehenden Figuren Bescheid Bescheid sagen world->RoadNodeAvailable(pos); // In die Statistik eintragen - world->GetPlayer(player_won).ChangeStatisticValue(StatisticType::Vanquished, 1); + world->getPlayer(player_won).ChangeStatisticValue(StatisticType::Vanquished, 1); return; } } @@ -244,31 +244,31 @@ void noFighting::HandleEvent(const unsigned id) case 4: { unsigned player_lost = turn - 3; - MapPoint pt = soldiers[player_lost]->GetPos(); + MapPoint pt = soldiers[player_lost]->getPos(); // Sounds löschen vom Sterben - world->GetSoundMgr().stopSounds(*this); + world->getSoundMgr().stopSounds(*this); // Kampf ist endgültig beendet - GetEvMgr().AddToKillList(world->RemoveFigure(pt, *this)); + getEvMgr().AddToKillList(world->RemoveFigure(pt, *this)); // Wenn da nix war bzw. nur ein Verzierungsobjekt, kommt nun ein Skelett hin - NodalObjectType noType = world->GetNO(pt)->GetType(); + NodalObjectType noType = world->getNO(pt)->getType(); if(noType == NodalObjectType::Nothing || noType == NodalObjectType::Environment) { world->DestroyNO(pt, false); - world->SetNO(pt, new noSkeleton(pt)); + world->setNO(pt, new noSkeleton(pt)); } // Sichtradius ausblenden am Ende des Kampfes, an jeweiligen Soldaten dann übergeben, welcher überlebt // hat - world->RecalcVisibilitiesAroundPoint(pt, VISUALRANGE_SOLDIER, soldiers[player_lost]->GetPlayer(), + world->RecalcVisibilitiesAroundPoint(pt, VISUALRANGE_SOLDIER, soldiers[player_lost]->getPlayer(), nullptr); world->RecalcVisibilitiesAroundPoint(pt, VISUALRANGE_SOLDIER, player_won, nullptr); // Soldaten endgültig umbringen - world->GetPlayer(soldiers[player_lost]->GetPlayer()) - .DecreaseInventoryJob(soldiers[player_lost]->GetJobType(), 1); + world->getPlayer(soldiers[player_lost]->getPlayer()) + .DecreaseInventoryJob(soldiers[player_lost]->getJobType(), 1); soldiers[player_lost]->Destroy(); soldiers[player_lost].reset(); } @@ -286,13 +286,13 @@ void noFighting::StartAttack() std::array results; for(unsigned i = 0; i < 2; ++i) { - switch(world->GetGGS().getSelection(AddonId::ADJUST_MILITARY_STRENGTH)) + switch(world->getGGS().getSelection(AddonId::ADJUST_MILITARY_STRENGTH)) { case 0: // Maximale Stärke - results[i] = RANDOM_RAND(soldiers[i]->GetRank() + 6); + results[i] = RANDOM_RAND(soldiers[i]->getRank() + 6); break; case 1: // Mittlere Stärke - default: results[i] = RANDOM_RAND(soldiers[i]->GetRank() + 10); break; + default: results[i] = RANDOM_RAND(soldiers[i]->getRank() + 10); break; case 2: // Minimale Stärke results[i] = RANDOM_RAND(10); break; @@ -307,7 +307,7 @@ void noFighting::StartAttack() defending_animation = static_cast(RANDOM_RAND(3)); // Entsprechendes Event anmelden - current_ev = GetEvMgr().AddEvent(this, 15); + current_ev = getEvMgr().AddEvent(this, 15); } bool noFighting::IsActive() const @@ -315,11 +315,11 @@ bool noFighting::IsActive() const return turn < 3; } -bool noFighting::IsSoldierOfPlayer(const unsigned char player) const +bool noFighting::isSoldierOfPlayer(const unsigned char player) const { for(const std::unique_ptr& soldier : soldiers) { - if(soldier && soldier->GetPlayer() == player) + if(soldier && soldier->getPlayer() == player) return true; } diff --git a/libs/s25main/nodeObjs/noFighting.h b/libs/s25main/nodeObjs/noFighting.h index e8f45c3b6a..a8c10be977 100644 --- a/libs/s25main/nodeObjs/noFighting.h +++ b/libs/s25main/nodeObjs/noFighting.h @@ -39,15 +39,15 @@ class noFighting : public noBase void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Fighting; } + GO_Type getGOT() const final { return GO_Type::Fighting; } void Draw(DrawPoint drawPt) override; void HandleEvent(unsigned id) override; /// Dürfen andern Figuren diesen Kampf schon durchqueren? bool IsActive() const; - bool IsFighter(const nofActiveSoldier& as) const { return &as == soldiers[0].get() || &as == soldiers[1].get(); } + bool isFighter(const nofActiveSoldier& as) const { return &as == soldiers[0].get() || &as == soldiers[1].get(); } /// Prüfen, ob ein Soldat von einem bestimmten Spieler in den Kampf verwickelt ist - bool IsSoldierOfPlayer(unsigned char player) const; + bool isSoldierOfPlayer(unsigned char player) const; }; diff --git a/libs/s25main/nodeObjs/noFire.cpp b/libs/s25main/nodeObjs/noFire.cpp index 567d33fcea..723e4c5bf2 100644 --- a/libs/s25main/nodeObjs/noFire.cpp +++ b/libs/s25main/nodeObjs/noFire.cpp @@ -22,20 +22,20 @@ noFire::noFire(const MapPoint pos, bool isBig) : noCoordBase(NodalObjectType::Fire, pos), isBig(isBig), was_sounding(false), last_sound(0), next_interval(0) { // Burn for some time - dead_event = GetEvMgr().AddEvent(this, FIREDURATION[world->GetGGS().getSelection(AddonId::BURN_DURATION)]); + dead_event = getEvMgr().AddEvent(this, FIREDURATION[world->getGGS().getSelection(AddonId::BURN_DURATION)]); } noFire::~noFire() = default; void noFire::Destroy() { // Remove from map if still present - if(world->GetNode(pos).obj == this) - world->SetNO(pos, nullptr); + if(world->getNode(pos).obj == this) + world->setNO(pos, nullptr); world->RecalcBQAroundPoint(pos); - world->GetSoundMgr().stopSounds(*this); + world->getSoundMgr().stopSounds(*this); - GetEvMgr().RemoveEvent(dead_event); + getEvMgr().RemoveEvent(dead_event); noCoordBase::Destroy(); } @@ -55,36 +55,36 @@ noFire::noFire(SerializedGameData& sgd, const unsigned obj_id) void noFire::Draw(DrawPoint drawPt) { unsigned id = - GAMECLIENT.Interpolate(FIREANIMATIONDURATION[world->GetGGS().getSelection(AddonId::BURN_DURATION)], dead_event); + GAMECLIENT.Interpolate(FIREANIMATIONDURATION[world->getGGS().getSelection(AddonId::BURN_DURATION)], dead_event); // Burn for the first 2/3 of the time, leave debris for the last 1/3 - if(id < FIREANIMATIONDURATION[world->GetGGS().getSelection(AddonId::BURN_DURATION)] * 2 / 3) + if(id < FIREANIMATIONDURATION[world->getGGS().getSelection(AddonId::BURN_DURATION)] * 2 / 3) { // Fire animation - LOADER.GetMapTexture(2500 + (isBig ? 8 : 0) + id % 8)->DrawFull(drawPt); - LOADER.GetMapTexture(2530 + (isBig ? 8 : 0) + id % 8)->DrawFull(drawPt, 0xC0101010); + LOADER.getMapTexture(2500 + (isBig ? 8 : 0) + id % 8)->DrawFull(drawPt); + LOADER.getMapTexture(2530 + (isBig ? 8 : 0) + id % 8)->DrawFull(drawPt, 0xC0101010); // Fire sound play in random intervals - if(VIDEODRIVER.GetTickCount() - last_sound > next_interval) + if(VIDEODRIVER.getTickCount() - last_sound > next_interval) { - world->GetSoundMgr().playNOSound(96, *this, id); + world->getSoundMgr().playNOSound(96, *this, id); was_sounding = true; - last_sound = VIDEODRIVER.GetTickCount(); + last_sound = VIDEODRIVER.getTickCount(); next_interval = 500 + rand() % 1400; } } else { // Debris - LOADER.GetMapTexture(2524 + (isBig ? 1 : 0))->DrawFull(drawPt); + LOADER.getMapTexture(2524 + (isBig ? 1 : 0))->DrawFull(drawPt); } } void noFire::HandleEvent(const unsigned /*id*/) { // End event: Remove from map and destroy - RTTR_Assert(world->GetNode(pos).obj == this); - world->SetNO(pos, nullptr); + RTTR_Assert(world->getNode(pos).obj == this); + world->setNO(pos, nullptr); dead_event = nullptr; - GetEvMgr().AddToKillList(this); + getEvMgr().AddToKillList(this); } diff --git a/libs/s25main/nodeObjs/noFire.h b/libs/s25main/nodeObjs/noFire.h index 85f831c3e7..f45d7d3bc4 100644 --- a/libs/s25main/nodeObjs/noFire.h +++ b/libs/s25main/nodeObjs/noFire.h @@ -31,9 +31,9 @@ class noFire : public noCoordBase void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Fire; } + GO_Type getGOT() const final { return GO_Type::Fire; } - BlockingManner GetBM() const override { return BlockingManner::FlagsAround; } + BlockingManner getBM() const override { return BlockingManner::FlagsAround; } /// Zeichnen void Draw(DrawPoint drawPt) override; diff --git a/libs/s25main/nodeObjs/noFlag.cpp b/libs/s25main/nodeObjs/noFlag.cpp index 3f0911801b..c81dacb1a2 100644 --- a/libs/s25main/nodeObjs/noFlag.cpp +++ b/libs/s25main/nodeObjs/noFlag.cpp @@ -32,13 +32,13 @@ noFlag::noFlag(const MapPoint pos, const unsigned char player) // Gucken, ob die Flagge auf einen bereits bestehenden Weg gesetzt wurde Direction dir; - noFlag* flag = world->GetRoadFlag(pos, dir); + noFlag* flag = world->getRoadFlag(pos, dir); - if(flag && flag->GetRoute(dir)) - flag->GetRoute(dir)->SplitRoad(this); + if(flag && flag->getRoute(dir)) + flag->getRoute(dir)->SplitRoad(this); // auf Wasseranteile prüfen - if(world->HasTerrain(pos, [](const auto& desc) { return desc.kind == TerrainKind::Water; })) + if(world->hasTerrain(pos, [](const auto& desc) { return desc.kind == TerrainKind::Water; })) flagtype = FlagType::Water; else flagtype = FlagType::Normal; @@ -47,7 +47,7 @@ noFlag::noFlag(const MapPoint pos, const unsigned char player) noFlag::noFlag(SerializedGameData& sgd, const unsigned obj_id) : noRoadNode(sgd, obj_id), ani_offset(rand() % 20000), flagtype(sgd.Pop()) { - if(sgd.GetGameDataVersion() < 8) + if(sgd.getGameDataVersion() < 8) { for(unsigned i = 0; i < wares.max_size(); i++) { @@ -71,7 +71,7 @@ noFlag::~noFlag() = default; void noFlag::Destroy() { /// Da ist dann nichts - world->SetNO(pos, nullptr); + world->setNO(pos, nullptr); // Waren vernichten for(auto& ware : wares) @@ -83,7 +83,7 @@ void noFlag::Destroy() wares.clear(); // Den Flag-Workern Bescheid sagen, die hier ggf. arbeiten - world->GetPlayer(player).FlagDestroyed(this); + world->getPlayer(player).FlagDestroyed(this); noRoadNode::Destroy(); } @@ -109,15 +109,15 @@ void noFlag::Draw(DrawPoint drawPt) static constexpr std::array WARES_POS = { {{0, 0}, {-4, 0}, {3, -1}, {-7, -1}, {6, -2}, {-10, -2}, {9, -5}, {-13, -5}}}; - unsigned ani_step = GAMECLIENT.GetGlobalAnimation(8, 2, 1, ani_offset); + unsigned ani_step = GAMECLIENT.getGlobalAnimation(8, 2, 1, ani_offset); - LOADER.flag_cache[world->GetPlayer(player).nation][flagtype][ani_step].draw(drawPt, 0xFFFFFFFF, - world->GetPlayer(player).color); + LOADER.flag_cache[world->getPlayer(player).nation][flagtype][ani_step].draw(drawPt, 0xFFFFFFFF, + world->getPlayer(player).color); // Waren (von hinten anfangen zu zeichnen) for(unsigned i = wares.size(); i > 0; --i) { - LOADER.GetWareStackTex(wares[i - 1]->type)->DrawFull(drawPt + WARES_POS[i - 1]); + LOADER.getWareStackTex(wares[i - 1]->type)->DrawFull(drawPt + WARES_POS[i - 1]); } } @@ -127,7 +127,7 @@ void noFlag::Draw(DrawPoint drawPt) */ std::unique_ptr noFlag::CreateFOWObject() const { - const GamePlayer& owner = world->GetPlayer(player); + const GamePlayer& owner = world->getPlayer(player); return std::make_unique(owner.color, owner.nation, flagtype); } @@ -137,11 +137,11 @@ std::unique_ptr noFlag::CreateFOWObject() const void noFlag::AddWare(std::unique_ptr ware) { // First add ware, then tell carrier. So get the info from the ware first - const RoadPathDirection nextDir = ware->GetNextDir(); + const RoadPathDirection nextDir = ware->getNextDir(); wares.push_back(std::move(ware)); if(nextDir != RoadPathDirection::None) - GetRoute(toDirection(nextDir))->AddWareJob(this); + getRoute(toDirection(nextDir))->AddWareJob(this); } /** @@ -159,12 +159,12 @@ std::unique_ptr noFlag::SelectWare(const Direction roadDir, const bool swa // Die mit der niedrigsten, d.h. höchsten Priorität wird als erstes transportiert for(unsigned i = 0; i < wares.size(); ++i) { - if(wares[i]->GetNextDir() == toRoadPathDirection(roadDir)) + if(wares[i]->getNextDir() == toRoadPathDirection(roadDir)) { if(best_ware_index >= 0) { - if(world->GetPlayer(player).GetTransportPriority(wares[i]->type) - < world->GetPlayer(player).GetTransportPriority(wares[best_ware_index]->type)) + if(world->getPlayer(player).getTransportPriority(wares[i]->type) + < world->getPlayer(player).getTransportPriority(wares[best_ware_index]->type)) { best_ware_index = i; } @@ -182,7 +182,7 @@ std::unique_ptr noFlag::SelectWare(const Direction roadDir, const bool swa } // ggf. anderen Trägern Bescheid sagen, aber nicht dem, der die Ware aufgehoben hat! - GetRoute(roadDir)->WareJobRemoved(carrier); + getRoute(roadDir)->WareJobRemoved(carrier); if(!swap_wares && bestWare) { @@ -190,7 +190,7 @@ std::unique_ptr noFlag::SelectWare(const Direction roadDir, const bool swa // Bescheid sagen, die evtl waren, dass sie wieder was ablegen können for(const auto dir : helpers::EnumRange{}) { - const auto* route = GetRoute(dir); + const auto* route = getRoute(dir); if(!route) continue; @@ -198,10 +198,10 @@ std::unique_ptr noFlag::SelectWare(const Direction roadDir, const bool swa { // Gebäude? - if(world->GetSpecObj(world->GetNeighbour(pos, Direction::NorthWest))->GetType() + if(world->getSpecObj(world->getNeighbour(pos, Direction::NorthWest))->getType() == NodalObjectType::Building) { - if(world->GetSpecObj(world->GetNeighbour(pos, Direction::NorthWest))->FreePlaceAtFlag()) + if(world->getSpecObj(world->getNeighbour(pos, Direction::NorthWest))->FreePlaceAtFlag()) break; } } else @@ -211,7 +211,7 @@ std::unique_ptr noFlag::SelectWare(const Direction roadDir, const bool swa { if(route->hasCarrier(c)) { - if(route->getCarrier(c)->SpaceAtFlag(this == route->GetF2())) + if(route->getCarrier(c)->SpaceAtFlag(this == route->getF2())) break; } } @@ -222,13 +222,13 @@ std::unique_ptr noFlag::SelectWare(const Direction roadDir, const bool swa return bestWare; } -unsigned noFlag::GetNumWaresForRoad(const Direction dir) const +unsigned noFlag::getNumWaresForRoad(const Direction dir) const { const auto roadDir = toRoadPathDirection(dir); - return helpers::count_if(wares, [roadDir](const auto& ware) { return ware->GetNextDir() == roadDir; }); + return helpers::count_if(wares, [roadDir](const auto& ware) { return ware->getNextDir() == roadDir; }); } -unsigned noFlag::GetPunishmentPoints(const Direction dir) const +unsigned noFlag::getPunishmentPoints(const Direction dir) const { constexpr auto PATHFINDING_PENALTY_CARRIER_ARRIVING = 50; constexpr auto PATHFINDING_PENALTY_NO_CARRIER = 500; @@ -236,24 +236,24 @@ unsigned noFlag::GetPunishmentPoints(const Direction dir) const // TODO(Replay): Move to `way_costs` in nobHarborBuilding::GetShipConnections constexpr auto PATHFINDING_PENALTY_START_SHIPPING = 500; // 2 Points per ware as carrier has to walk to other point and back for each ware - unsigned points = GetNumWaresForRoad(dir) * 2; + unsigned points = getNumWaresForRoad(dir) * 2; - const RoadSegment* routeInDir = GetRoute(dir); + const RoadSegment* routeInDir = getRoute(dir); const nofCarrier* humanCarrier = routeInDir->getCarrier(0); if(humanCarrier) { // normal carrier has been ordered from the warehouse but has not yet arrived and no donkey - if(humanCarrier->GetCarrierState() == CarrierState::FigureWork && !routeInDir->hasCarrier(1)) + if(humanCarrier->getCarrierState() == CarrierState::FigureWork && !routeInDir->hasCarrier(1)) points += PATHFINDING_PENALTY_CARRIER_ARRIVING; } else if(!routeInDir->hasCarrier(1)) { // Routes are either between flags or from a flag to a building, see the ctor of noBaseBuilding - const bool isBuildingEntry = (dir == Direction::NorthWest) && (routeInDir->GetF2()->GetGOT() != GO_Type::Flag); + const bool isBuildingEntry = (dir == Direction::NorthWest) && (routeInDir->getF2()->getGOT() != GO_Type::Flag); // For entering a building no carrier is required // Only roads to buildings considered by path finding are those to harbors if(isBuildingEntry) { - RTTR_Assert(routeInDir->GetF2()->GetGOT() == GO_Type::NobHarborbuilding); + RTTR_Assert(routeInDir->getF2()->getGOT() == GO_Type::NobHarborbuilding); points += PATHFINDING_PENALTY_START_SHIPPING; } else points += PATHFINDING_PENALTY_NO_CARRIER; @@ -268,8 +268,8 @@ unsigned noFlag::GetPunishmentPoints(const Direction dir) const void noFlag::DestroyAttachedBuilding() { // Achtung es wird ein Feuer durch Destroy gesetzt, daher Objekt merken! - noBase* no = world->GetNO(world->GetNeighbour(pos, Direction::NorthWest)); - if(no->GetType() == NodalObjectType::Buildingsite || no->GetType() == NodalObjectType::Building) + noBase* no = world->getNO(world->getNeighbour(pos, Direction::NorthWest)); + if(no->getType() == NodalObjectType::Buildingsite || no->getType() == NodalObjectType::Building) { no->Destroy(); delete no; @@ -306,14 +306,14 @@ void noFlag::Capture(const unsigned char new_owner) wares.clear(); // Unregister this flag in the players flags - world->GetPlayer(player).FlagDestroyed(this); + world->getPlayer(player).FlagDestroyed(this); this->player = new_owner; } /** * Ist diese Flagge für eine bestimmte Lagerhausflüchtlingsgruppe (BWU) nicht zugänglich? */ -bool noFlag::IsImpossibleForBWU(const unsigned bwu_id) const +bool noFlag::isImpossibleForBWU(const unsigned bwu_id) const { // Zeitintervall, in der die Zugänglichkeit der Flaggen von einer bestimmten BWU überprüft wird const unsigned MAX_BWU_INTERVAL = 2000; @@ -324,7 +324,7 @@ bool noFlag::IsImpossibleForBWU(const unsigned bwu_id) const if(bwu.id == bwu_id) { // Wenn letzter TÜV noch nicht zu lange zurückliegt, können wir sie als unzugänglich zurückgeben - return GetEvMgr().GetCurrentGF() - bwu.last_gf <= MAX_BWU_INTERVAL; + return getEvMgr().getCurrentGF() - bwu.last_gf <= MAX_BWU_INTERVAL; } } @@ -341,7 +341,7 @@ void noFlag::ImpossibleForBWU(const unsigned bwu_id) { if(bwu.id == bwu_id) { - bwu.last_gf = GetEvMgr().GetCurrentGF(); + bwu.last_gf = getEvMgr().getCurrentGF(); return; } } diff --git a/libs/s25main/nodeObjs/noFlag.h b/libs/s25main/nodeObjs/noFlag.h index 79483862e0..9eff5b5b1f 100644 --- a/libs/s25main/nodeObjs/noFlag.h +++ b/libs/s25main/nodeObjs/noFlag.h @@ -26,28 +26,28 @@ class noFlag : public noRoadNode void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Flag; } - FlagType GetFlagType() const { return flagtype; } + GO_Type getGOT() const final { return GO_Type::Flag; } + FlagType getFlagType() const { return flagtype; } /// Gibt Auskunft darüber, ob noch Platz für eine Ware an der Flagge ist. - bool HasSpaceForWare() const { return wares.size() < wares.max_size(); } + bool hasSpaceForWare() const { return wares.size() < wares.max_size(); } void Draw(DrawPoint drawPt) override; - BlockingManner GetBM() const override { return BlockingManner::Flag; } + BlockingManner getBM() const override { return BlockingManner::Flag; } /// Erzeugt von ihnen selbst ein FOW Objekt als visuelle "Erinnerung" für den Fog of War. std::unique_ptr CreateFOWObject() const override; /// Legt eine Ware an der Flagge ab. void AddWare(std::unique_ptr ware) override; /// Gibt die Anzahl der Waren zurück, die an der Flagge liegen. - unsigned GetNumWares() const { return wares.size(); } + unsigned getNumWares() const { return wares.size(); } /// Wählt eine Ware von einer Flagge aus (anhand der Transportreihenfolge), entfernt sie von der Flagge und gibt sie /// zurück. std::unique_ptr SelectWare(Direction roadDir, bool swap_wares, const noFigure* carrier); /// Prüft, ob es Waren gibt, die auf den Weg in Richtung dir getragen werden müssen. - unsigned GetNumWaresForRoad(Direction dir) const; + unsigned getNumWaresForRoad(Direction dir) const; /// Penalty for transporting a ware in a specific direction - unsigned GetPunishmentPoints(Direction dir) const override; + unsigned getPunishmentPoints(Direction dir) const override; /// Zerstört evtl. vorhandenes Gebäude bzw. Baustelle vor der Flagge. void DestroyAttachedBuilding(); /// Baut normale Flaggen zu "gloriösen" aus bei Eselstraßen. @@ -55,7 +55,7 @@ class noFlag : public noRoadNode /// Feind übernimmt die Flagge. void Capture(unsigned char new_owner); /// Ist diese Flagge für eine bestimmte Lagerhausflüchtlingsgruppe (BWU) nicht zugänglich? - bool IsImpossibleForBWU(unsigned bwu_id) const; + bool isImpossibleForBWU(unsigned bwu_id) const; /// Hinzufügen, dass diese Flagge für eine bestimmte Lagerhausgruppe nicht zugänglich ist. void ImpossibleForBWU(unsigned bwu_id); diff --git a/libs/s25main/nodeObjs/noGrainfield.cpp b/libs/s25main/nodeObjs/noGrainfield.cpp index 175c01a429..16f96af18a 100644 --- a/libs/s25main/nodeObjs/noGrainfield.cpp +++ b/libs/s25main/nodeObjs/noGrainfield.cpp @@ -21,14 +21,14 @@ const unsigned GROWING_LENGTH = 16; noGrainfield::noGrainfield(const MapPoint pos) : noCoordBase(NodalObjectType::Grainfield, pos), type(RANDOM_RAND(2)), state(State::GrowingWaiting), size(0) { - event = GetEvMgr().AddEvent(this, GROWING_WAITING_LENGTH); + event = getEvMgr().AddEvent(this, GROWING_WAITING_LENGTH); } noGrainfield::~noGrainfield() = default; void noGrainfield::Destroy() { - GetEvMgr().RemoveEvent(event); + getEvMgr().RemoveEvent(event); // Bauplätze drumrum neu berechnen world->RecalcBQAroundPoint(pos); @@ -90,7 +90,7 @@ void noGrainfield::HandleEvent(const unsigned /*id*/) case State::GrowingWaiting: { // Feld hat gewartet, also wächst es jetzt - event = GetEvMgr().AddEvent(this, GROWING_LENGTH); + event = getEvMgr().AddEvent(this, GROWING_LENGTH); state = State::Growing; } break; @@ -100,7 +100,7 @@ void noGrainfield::HandleEvent(const unsigned /*id*/) // wächst if(++size != 3) { - event = GetEvMgr().AddEvent(this, GROWING_WAITING_LENGTH); + event = getEvMgr().AddEvent(this, GROWING_WAITING_LENGTH); // Erstmal wieder bis zum nächsten Wachsstumsschub warten state = State::GrowingWaiting; } else @@ -108,7 +108,7 @@ void noGrainfield::HandleEvent(const unsigned /*id*/) // bin nun ausgewachsen state = State::Normal; // nach langer Zeit verdorren - event = GetEvMgr().AddEvent(this, 3000 + RANDOM_RAND(1000)); + event = getEvMgr().AddEvent(this, 3000 + RANDOM_RAND(1000)); } } break; @@ -116,15 +116,15 @@ void noGrainfield::HandleEvent(const unsigned /*id*/) { // Jetzt lebt es schon zu lange --> hokus pokus verschwindibus! state = State::Withering; - event = GetEvMgr().AddEvent(this, 20); + event = getEvMgr().AddEvent(this, 20); } break; case State::Withering: { // Selbst zerstören event = nullptr; - world->SetNO(pos, nullptr); - GetEvMgr().AddToKillList(this); + world->setNO(pos, nullptr); + getEvMgr().AddToKillList(this); } break; } @@ -133,7 +133,7 @@ void noGrainfield::HandleEvent(const unsigned /*id*/) void noGrainfield::BeginHarvesting() { // Event killen, damit wir nicht plötzlich verschwinden, wenn er uns aberntet - GetEvMgr().RemoveEvent(event); + getEvMgr().RemoveEvent(event); event = nullptr; state = State::Normal; } @@ -141,5 +141,5 @@ void noGrainfield::BeginHarvesting() void noGrainfield::EndHarvesting() { // nach langer Zeit verdorren (von neuem) - event = GetEvMgr().AddEvent(this, 3000 + RANDOM_RAND(1000)); + event = getEvMgr().AddEvent(this, 3000 + RANDOM_RAND(1000)); } diff --git a/libs/s25main/nodeObjs/noGrainfield.h b/libs/s25main/nodeObjs/noGrainfield.h index fafbc51d66..a0b17462f6 100644 --- a/libs/s25main/nodeObjs/noGrainfield.h +++ b/libs/s25main/nodeObjs/noGrainfield.h @@ -40,18 +40,18 @@ class noGrainfield : public noCoordBase void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Grainfield; } + GO_Type getGOT() const final { return GO_Type::Grainfield; } void Draw(DrawPoint drawPt) override; void HandleEvent(unsigned id) override; - BlockingManner GetBM() const override { return BlockingManner::FlagsAround; } + BlockingManner getBM() const override { return BlockingManner::FlagsAround; } /// Kann man es abernten? - bool IsHarvestable() const { return size == 3 && state == State::Normal; } + bool isHarvestable() const { return size == 3 && state == State::Normal; } /// Gibt die ID des abgeernteten Getreidefelds in der map_last zurück - unsigned GetHarvestMapLstID() const { return 532 + type * 5 + 4; } + unsigned getHarvestMapLstID() const { return 532 + type * 5 + 4; } /// Bauer beginnt dieses Feld abzuernten void BeginHarvesting(); diff --git a/libs/s25main/nodeObjs/noGranite.h b/libs/s25main/nodeObjs/noGranite.h index a4f27d0f72..fe8c26fa9b 100644 --- a/libs/s25main/nodeObjs/noGranite.h +++ b/libs/s25main/nodeObjs/noGranite.h @@ -21,11 +21,11 @@ class noGranite final : public noBase void Destroy() override {} void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Granite; } + GO_Type getGOT() const final { return GO_Type::Granite; } void Draw(DrawPoint drawPt) override; - BlockingManner GetBM() const override { return BlockingManner::FlagsAround; } + BlockingManner getBM() const override { return BlockingManner::FlagsAround; } /// Erzeugt von ihnen selbst ein FOW Objekt als visuelle "Erinnerung" für den Fog of War std::unique_ptr CreateFOWObject() const override; @@ -34,8 +34,8 @@ class noGranite final : public noBase void Hew(); /// Gibt true zurück, falls der Granitblock nur noch 1 Stein groß ist und damit dann vernichtet werden kann - bool IsSmall() const { return (state == 0); } + bool isSmall() const { return (state == 0); } /// Return the size of this pile. - unsigned char GetSize() const { return state; } + unsigned char getSize() const { return state; } }; diff --git a/libs/s25main/nodeObjs/noGrapefield.cpp b/libs/s25main/nodeObjs/noGrapefield.cpp index 24299783b5..e4ce87b727 100644 --- a/libs/s25main/nodeObjs/noGrapefield.cpp +++ b/libs/s25main/nodeObjs/noGrapefield.cpp @@ -25,14 +25,14 @@ using namespace wineaddon; noGrapefield::noGrapefield(const MapPoint pos) : noCoordBase(NodalObjectType::Grapefield, pos), type(RANDOM_RAND(2)), state(State::GrowingWaiting), size(0) { - event = GetEvMgr().AddEvent(this, GROWING_WAITING_LENGTH); + event = getEvMgr().AddEvent(this, GROWING_WAITING_LENGTH); } noGrapefield::~noGrapefield() = default; void noGrapefield::Destroy() { - GetEvMgr().RemoveEvent(event); + getEvMgr().RemoveEvent(event); // recompute BQ around world->RecalcBQAroundPoint(pos); @@ -94,7 +94,7 @@ void noGrapefield::HandleEvent(const unsigned /*id*/) case State::GrowingWaiting: { // Field was waiting, so it is growing now - event = GetEvMgr().AddEvent(this, GROWING_LENGTH); + event = getEvMgr().AddEvent(this, GROWING_LENGTH); state = State::Growing; } break; @@ -103,7 +103,7 @@ void noGrapefield::HandleEvent(const unsigned /*id*/) // When not fully grown, add an additional wait event, so the field can grow further if(++size != 3) { - event = GetEvMgr().AddEvent(this, GROWING_WAITING_LENGTH); + event = getEvMgr().AddEvent(this, GROWING_WAITING_LENGTH); // Wait until the next growing phase state = State::GrowingWaiting; } else @@ -111,7 +111,7 @@ void noGrapefield::HandleEvent(const unsigned /*id*/) // Fully grown state = State::Normal; // wither after large time - event = GetEvMgr().AddEvent(this, 3000 + RANDOM_RAND(1000)); + event = getEvMgr().AddEvent(this, 3000 + RANDOM_RAND(1000)); } } break; @@ -119,21 +119,21 @@ void noGrapefield::HandleEvent(const unsigned /*id*/) { // Living to long --> start vanishing state = State::Withering; - event = GetEvMgr().AddEvent(this, 20); + event = getEvMgr().AddEvent(this, 20); } break; case State::Withering: { // Self destruction event = nullptr; - world->SetNO(pos, nullptr); - GetEvMgr().AddToKillList(this); + world->setNO(pos, nullptr); + getEvMgr().AddToKillList(this); } break; } } -unsigned noGrapefield::GetHarvestID() const +unsigned noGrapefield::getHarvestID() const { return bobIndex[BobTypes(rttr::enum_cast(BobTypes::WINEGROWER_GRAPEFIELDS_ONE) + type)] + 4; } @@ -141,7 +141,7 @@ unsigned noGrapefield::GetHarvestID() const void noGrapefield::BeginHarvesting() { // Kill event, so we do not disappear when we are harvested - GetEvMgr().RemoveEvent(event); + getEvMgr().RemoveEvent(event); event = nullptr; state = State::Normal; } @@ -149,5 +149,5 @@ void noGrapefield::BeginHarvesting() void noGrapefield::AbortHarvesting() { // Wither after long time - event = GetEvMgr().AddEvent(this, 3000 + RANDOM_RAND(1000)); + event = getEvMgr().AddEvent(this, 3000 + RANDOM_RAND(1000)); } diff --git a/libs/s25main/nodeObjs/noGrapefield.h b/libs/s25main/nodeObjs/noGrapefield.h index bccf3608c0..ba48b065c8 100644 --- a/libs/s25main/nodeObjs/noGrapefield.h +++ b/libs/s25main/nodeObjs/noGrapefield.h @@ -40,18 +40,18 @@ class noGrapefield : public noCoordBase void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Grapefield; } + GO_Type getGOT() const final { return GO_Type::Grapefield; } void Draw(DrawPoint drawPt) override; void HandleEvent(unsigned id) override; - BlockingManner GetBM() const override { return BlockingManner::FlagsAround; } + BlockingManner getBM() const override { return BlockingManner::FlagsAround; } /// Can we harvest it? - bool IsHarvestable() const { return size == 3 && state == State::Normal; } + bool isHarvestable() const { return size == 3 && state == State::Normal; } /// Return the ID of the withered grape field in the wine_bobs - unsigned GetHarvestID() const; + unsigned getHarvestID() const; /// Winegrower starts harvesting the field void BeginHarvesting(); diff --git a/libs/s25main/nodeObjs/noMovable.cpp b/libs/s25main/nodeObjs/noMovable.cpp index a90a4a7f5e..17e176cdb6 100644 --- a/libs/s25main/nodeObjs/noMovable.cpp +++ b/libs/s25main/nodeObjs/noMovable.cpp @@ -43,7 +43,7 @@ void noMovable::Walk() { moving = false; const MapPoint oldPos = pos; - pos = world->GetNeighbour(pos, curMoveDir); + pos = world->getNeighbour(pos, curMoveDir); world->AddFigure(pos, world->RemoveFigure(oldPos, *this)); } @@ -57,14 +57,14 @@ void noMovable::StartMoving(const Direction dir, unsigned gf_length) RTTR_Assert(!moving); // Ist das Wesen stehengeblieben mitten aufm Weg? - if(IsStoppedBetweenNodes()) + if(isStoppedBetweenNodes()) { // Das Laufevent fortführen RTTR_Assert(dir == curMoveDir); // Avoid setting an event for current gf by increasing the length if(pauseEv.length == pauseEv.elapsed) pauseEv.length++; - current_ev = GetEvMgr().AddEvent(this, pauseEv.length, 0, pauseEv.elapsed); + current_ev = getEvMgr().AddEvent(this, pauseEv.length, 0, pauseEv.elapsed); pauseEv = EventState(); moving = true; return; @@ -72,7 +72,7 @@ void noMovable::StartMoving(const Direction dir, unsigned gf_length) // Steigung ermitteln, muss entsprechend langsamer (hoch) bzw. schneller (runter) laufen // runter natürlich nich so viel schneller werden wie langsamer hoch - switch(int(world->GetNeighbourNode(pos, dir).altitude) - int(world->GetNode(pos).altitude)) + switch(int(world->getNeighbourNode(pos, dir).altitude) - int(world->getNode(pos).altitude)) { default: ascent = 3; break; // gerade case 1: @@ -96,7 +96,7 @@ void noMovable::StartMoving(const Direction dir, unsigned gf_length) case -5: ascent = 0; break; // steil runter } - current_ev = GetEvMgr().AddEvent(this, gf_length); + current_ev = getEvMgr().AddEvent(this, gf_length); this->curMoveDir = dir; moving = true; } @@ -111,12 +111,12 @@ DrawPoint noMovable::CalcRelative(DrawPoint curPt, DrawPoint nextPt) const LOG.write("WARNING: Bug detected (GF: %u). Please report this with the savegame and replay. " "noMovable::CalcRelative: " "current_ev->gf_length = 0!\n") - % GetEvMgr().GetCurrentGF(); + % getEvMgr().getCurrentGF(); return Position(0, 0); } } - RTTR_Assert(IsMoving() || IsStoppedBetweenNodes()); + RTTR_Assert(isMoving() || isStoppedBetweenNodes()); using milliseconds_i32_t = std::chrono::duration; @@ -125,9 +125,9 @@ DrawPoint noMovable::CalcRelative(DrawPoint curPt, DrawPoint nextPt) const milliseconds_i32_t frame_time; if(current_ev) { - curState.elapsed = GetEvMgr().GetCurrentGF() - current_ev->startGF; + curState.elapsed = getEvMgr().getCurrentGF() - current_ev->startGF; curState.length = current_ev->length; - frame_time = GAMECLIENT.GetFrameTime(); + frame_time = GAMECLIENT.getFrameTime(); } else { curState = pauseEv; @@ -135,7 +135,7 @@ DrawPoint noMovable::CalcRelative(DrawPoint curPt, DrawPoint nextPt) const } // Convert to real world time - const milliseconds_i32_t gfLength = GAMECLIENT.GetGFLength(); + const milliseconds_i32_t gfLength = GAMECLIENT.getGFLength(); // Time since the start of the event milliseconds_i32_t curTimePassed = curState.elapsed * gfLength + frame_time; // Duration of the event @@ -145,7 +145,7 @@ DrawPoint noMovable::CalcRelative(DrawPoint curPt, DrawPoint nextPt) const RTTR_Assert(curTimePassed <= duration); // Check for map border crossing - const Position mapDrawSize = world->GetSize() * Position(TR_W, TR_H); + const Position mapDrawSize = world->getSize() * Position(TR_W, TR_H); if(std::abs(nextPt.x - curPt.x) >= mapDrawSize.x / 2) { // So we need to get closer to nextPt @@ -168,35 +168,35 @@ DrawPoint noMovable::CalcRelative(DrawPoint curPt, DrawPoint nextPt) const /// Interpoliert fürs Laufen zwischen zwei Kartenpunkten DrawPoint noMovable::CalcWalkingRelative() const { - Position curPt = world->GetNodePos(pos); - Position nextPt = world->GetNodePos(world->GetNeighbour(pos, curMoveDir)); + Position curPt = world->getNodePos(pos); + Position nextPt = world->getNodePos(world->getNeighbour(pos, curMoveDir)); return CalcRelative(curPt, nextPt); } void noMovable::PauseWalking() { - RTTR_Assert(IsMoving()); + RTTR_Assert(isMoving()); // Frames festhalten, bis zu denen wir gekommen sind - pauseEv = EventState(GetEvMgr().GetCurrentGF() - current_ev->startGF, current_ev->length); + pauseEv = EventState(getEvMgr().getCurrentGF() - current_ev->startGF, current_ev->length); // Event abmelden - GetEvMgr().RemoveEvent(current_ev); + getEvMgr().RemoveEvent(current_ev); moving = false; } /// Gibt zurück, ob sich das angegebene Objekt zwischen zwei Punkten bewegt -bool noMovable::IsMoving() const +bool noMovable::isMoving() const { return current_ev && (current_ev->id == 0); } /// Gibt die Position zurück, wo wir uns hinbewegen (selbe Position, wenn Schiff steht) -MapPoint noMovable::GetDestinationForCurrentMove() const +MapPoint noMovable::getDestinationForCurrentMove() const { // Bewegt sich das Ding gerade? - if(IsMoving()) + if(isMoving()) // Dann unsere Zielrichtung zur Berechnung verwenden - return world->GetNeighbour(pos, curMoveDir); + return world->getNeighbour(pos, curMoveDir); return pos; } diff --git a/libs/s25main/nodeObjs/noMovable.h b/libs/s25main/nodeObjs/noMovable.h index 9228c2ee89..c5ceefb99b 100644 --- a/libs/s25main/nodeObjs/noMovable.h +++ b/libs/s25main/nodeObjs/noMovable.h @@ -45,12 +45,12 @@ class noMovable : public noCoordBase void Serialize(SerializedGameData& sgd) const override; /// Sets the position. Usually not required as all position changes are done by the walk functions - void SetPos(const MapPoint& pos) { this->pos = pos; } + void setPos(const MapPoint& pos) { this->pos = pos; } /// Returns the direction in which the object is moving/which it is facing - Direction GetCurMoveDir() const { return curMoveDir; } - uint8_t GetAscent() const { return ascent; } - const EventState& GetPausedEvent() { return pauseEv; } + Direction getCurMoveDir() const { return curMoveDir; } + uint8_t getAscent() const { return ascent; } + const EventState& getPausedEvent() { return pauseEv; } /// "Turns" the object in that direction without starting to walk void FaceDir(Direction newDir); /// In aktueller Richtung ein Stück zurücklegen @@ -62,9 +62,9 @@ class noMovable : public noCoordBase /// Interpoliert fürs Laufen zwischen zwei Kartenpunkten DrawPoint CalcWalkingRelative() const; // Steht er in der zwischen 2 Wegpunkten? - bool IsStoppedBetweenNodes() const { return pauseEv.elapsed > 0; } + bool isStoppedBetweenNodes() const { return pauseEv.elapsed > 0; } /// Gibt die Position zurück, wo wir uns hinbewegen (selbe Position, wenn Schiff steht) - MapPoint GetDestinationForCurrentMove() const; + MapPoint getDestinationForCurrentMove() const; /// Gibt zurück, ob sich das angegebene Objekt zwischen zwei Punkten bewegt - bool IsMoving() const override; + bool isMoving() const override; }; diff --git a/libs/s25main/nodeObjs/noNothing.h b/libs/s25main/nodeObjs/noNothing.h index 0afbdca6f0..dfc3188799 100644 --- a/libs/s25main/nodeObjs/noNothing.h +++ b/libs/s25main/nodeObjs/noNothing.h @@ -12,6 +12,6 @@ class noNothing final : public noBase noNothing() : noBase(NodalObjectType::Nothing) {} void Destroy() override {} - GO_Type GetGOT() const final { return GO_Type::Nothing; } + GO_Type getGOT() const final { return GO_Type::Nothing; } void Draw(DrawPoint) override {} }; diff --git a/libs/s25main/nodeObjs/noRoadNode.cpp b/libs/s25main/nodeObjs/noRoadNode.cpp index 2b0c4423db..88eb423b50 100644 --- a/libs/s25main/nodeObjs/noRoadNode.cpp +++ b/libs/s25main/nodeObjs/noRoadNode.cpp @@ -31,7 +31,7 @@ void noRoadNode::Serialize(SerializedGameData& sgd) const sgd.PushUnsignedChar(player); // the trick only seems to work for flags - if(this->GetGOT() == GO_Type::Flag) + if(this->getGOT() == GO_Type::Flag) { // this is a trick: // -> initialize routes for flag with nullptr @@ -58,29 +58,29 @@ noRoadNode::noRoadNode(SerializedGameData& sgd, const unsigned obj_id) void noRoadNode::UpgradeRoad(const Direction dir) const { - if(GetRoute(dir)) - GetRoute(dir)->UpgradeDonkeyRoad(); + if(getRoute(dir)) + getRoute(dir)->UpgradeDonkeyRoad(); } void noRoadNode::DestroyRoad(const Direction dir) { - RoadSegment* route = GetRoute(dir); + RoadSegment* route = getRoute(dir); if(!route) return; - MapPoint t = route->GetF1()->GetPos(); + MapPoint t = route->getF1()->getPos(); for(unsigned z = 0; z < route->GetLength(); ++z) { - world->SetPointRoad(t, route->GetRoute(z), PointRoad::None); + world->setPointRoad(t, route->getRoute(z), PointRoad::None); world->RecalcBQForRoad(t); - t = world->GetNeighbour(t, route->GetRoute(z)); + t = world->getNeighbour(t, route->getRoute(z)); } noRoadNode* otherFlag; - if(route->GetF1() == this) - otherFlag = route->GetF2(); + if(route->getF1() == this) + otherFlag = route->getF2(); else - otherFlag = route->GetF1(); + otherFlag = route->getF1(); for(const auto z : helpers::EnumRange{}) { @@ -91,13 +91,13 @@ void noRoadNode::DestroyRoad(const Direction dir) } } - SetRoute(dir, nullptr); + setRoute(dir, nullptr); route->Destroy(); delete route; // Spieler Bescheid sagen - world->GetPlayer(player).RoadDestroyed(); + world->getPlayer(player).RoadDestroyed(); } /// Vernichtet Alle Straße um diesen Knoten diff --git a/libs/s25main/nodeObjs/noRoadNode.h b/libs/s25main/nodeObjs/noRoadNode.h index 359ec4c8e6..3308d6e6e0 100644 --- a/libs/s25main/nodeObjs/noRoadNode.h +++ b/libs/s25main/nodeObjs/noRoadNode.h @@ -43,33 +43,33 @@ class noRoadNode : public noCoordBase void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - RoadSegment* GetRoute(const Direction dir) const { return routes[dir]; } - void SetRoute(const Direction dir, RoadSegment* route) { routes[dir] = route; } + RoadSegment* getRoute(const Direction dir) const { return routes[dir]; } + void setRoute(const Direction dir, RoadSegment* route) { routes[dir] = route; } const auto& getRoutes() const { return routes; } - noRoadNode* GetNeighbour(Direction dir) const; + noRoadNode* getNeighbour(Direction dir) const; void DestroyRoad(Direction dir); void UpgradeRoad(Direction dir) const; /// Vernichtet Alle Straße um diesen Knoten void DestroyAllRoads(); - unsigned char GetPlayer() const { return player; } + unsigned char getPlayer() const { return player; } /// Legt eine Ware am Objekt ab (an allen Straßenknoten (Gebäude, Baustellen und Flaggen) kann man Waren ablegen virtual void AddWare(std::unique_ptr ware) = 0; /// Nur für Flagge, Gebäude können 0 zurückgeben, gibt Wegstrafpunkte für das Pathfinden für Waren, die in eine /// bestimmte Richtung noch transportiert werden müssen - virtual unsigned GetPunishmentPoints(Direction) const { return 0; } + virtual unsigned getPunishmentPoints(Direction) const { return 0; } }; -inline noRoadNode* noRoadNode::GetNeighbour(const Direction dir) const +inline noRoadNode* noRoadNode::getNeighbour(const Direction dir) const { - const RoadSegment* route = GetRoute(dir); + const RoadSegment* route = getRoute(dir); if(!route) return nullptr; - else if(route->GetF1() == this) - return route->GetF2(); + else if(route->getF1() == this) + return route->getF2(); else - return route->GetF1(); + return route->getF1(); } diff --git a/libs/s25main/nodeObjs/noShip.cpp b/libs/s25main/nodeObjs/noShip.cpp index bbf76be4f2..5f6b4d2761 100644 --- a/libs/s25main/nodeObjs/noShip.cpp +++ b/libs/s25main/nodeObjs/noShip.cpp @@ -49,13 +49,13 @@ constexpr std::array, 2> SHIPS_FLAG_POS noShip::noShip(const MapPoint pos, const unsigned char player) : noMovable(NodalObjectType::Ship, pos), ownerId_(player), state(State::Idle), goal_dir(0), - name(RANDOM_ELEMENT(ship_names[world->GetPlayer(player).nation])), curRouteIdx(0), lost(false), + name(RANDOM_ELEMENT(ship_names[world->getPlayer(player).nation])), curRouteIdx(0), lost(false), remaining_sea_attackers(0), covered_distance(0) { // Meer ermitteln, auf dem dieses Schiff fährt for(const auto dir : helpers::EnumRange{}) { - SeaId seaId = world->GetNeighbourNode(pos, dir).seaId; + SeaId seaId = world->getNeighbourNode(pos, dir).seaId; if(seaId) this->seaId_ = seaId; } @@ -89,12 +89,12 @@ void noShip::Serialize(SerializedGameData& sgd) const noShip::noShip(SerializedGameData& sgd, const unsigned obj_id) : noMovable(sgd, obj_id), ownerId_(sgd.PopUnsignedChar()), state(sgd.Pop()), seaId_(sgd.PopUnsignedShort()), goalHarbor(sgd.PopUnsignedInt()), goal_dir(sgd.PopUnsignedChar()), - name(sgd.GetGameDataVersion() < 2 ? sgd.PopLongString() : sgd.PopString()), curRouteIdx(sgd.PopUnsignedInt()), - route_(sgd.GetGameDataVersion() < 7 ? sgd.PopUnsignedInt() : 0), lost(sgd.PopBool()), + name(sgd.getGameDataVersion() < 2 ? sgd.PopLongString() : sgd.PopString()), curRouteIdx(sgd.PopUnsignedInt()), + route_(sgd.getGameDataVersion() < 7 ? sgd.PopUnsignedInt() : 0), lost(sgd.PopBool()), remaining_sea_attackers(sgd.PopUnsignedInt()), homeHarbor(sgd.PopUnsignedInt()), covered_distance(sgd.PopUnsignedInt()) { - helpers::popContainer(sgd, route_, sgd.GetGameDataVersion() < 7); + helpers::popContainer(sgd, route_, sgd.getGameDataVersion() < 7); sgd.PopObjectContainer(figures); sgd.PopObjectContainer(wares, GO_Type::Ware); } @@ -103,9 +103,9 @@ void noShip::Destroy() { RTTR_Assert(figures.empty()); RTTR_Assert(wares.empty()); - world->GetNotifications().publish(ShipNote(ShipNote::Destroyed, ownerId_, pos)); + world->getNotifications().publish(ShipNote(ShipNote::Destroyed, ownerId_, pos)); // Schiff wieder abmelden - world->GetPlayer(ownerId_).RemoveShip(this); + world->getPlayer(ownerId_).RemoveShip(this); } void noShip::Draw(DrawPoint drawPt) @@ -171,24 +171,24 @@ void noShip::Draw(DrawPoint drawPt) break; } - LOADER.GetPlayerImage("boot_z", 40 + GAMECLIENT.GetGlobalAnimation(6, 1, 1, GetObjId())) - ->DrawFull(drawPt + SHIPS_FLAG_POS[flag_drawing_type][GetCurMoveDir()], COLOR_WHITE, - world->GetPlayer(ownerId_).color); + LOADER.getPlayerImage("boot_z", 40 + GAMECLIENT.getGlobalAnimation(6, 1, 1, getObjId())) + ->DrawFull(drawPt + SHIPS_FLAG_POS[flag_drawing_type][getCurMoveDir()], COLOR_WHITE, + world->getPlayer(ownerId_).color); // Second, white flag, only when on expedition, always swinging in the opposite direction if(state >= State::ExpeditionLoading && state <= State::ExpeditionDriving) - LOADER.GetPlayerImage("boot_z", 40 + GAMECLIENT.GetGlobalAnimation(6, 1, 1, GetObjId() + 4)) - ->DrawFull(drawPt + SHIPS_FLAG_POS[flag_drawing_type][GetCurMoveDir()]); + LOADER.getPlayerImage("boot_z", 40 + GAMECLIENT.getGlobalAnimation(6, 1, 1, getObjId() + 4)) + ->DrawFull(drawPt + SHIPS_FLAG_POS[flag_drawing_type][getCurMoveDir()]); } /// Zeichnet das Schiff stehend mit oder ohne Waren void noShip::DrawFixed(DrawPoint drawPt, const bool draw_wares) { - LOADER.GetImageN("boot_z", rttr::enum_cast(GetCurMoveDir() + 3u) * 2 + 1)->DrawFull(drawPt, COLOR_SHADOW); - LOADER.GetImageN("boot_z", rttr::enum_cast(GetCurMoveDir() + 3u) * 2)->DrawFull(drawPt); + LOADER.getImageN("boot_z", rttr::enum_cast(getCurMoveDir() + 3u) * 2 + 1)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getImageN("boot_z", rttr::enum_cast(getCurMoveDir() + 3u) * 2)->DrawFull(drawPt); if(draw_wares) /// Waren zeichnen - LOADER.GetImageN("boot_z", 30 + rttr::enum_cast(GetCurMoveDir() + 3u))->DrawFull(drawPt); + LOADER.getImageN("boot_z", 30 + rttr::enum_cast(getCurMoveDir() + 3u))->DrawFull(drawPt); } /// Zeichnet normales Fahren auf dem Meer ohne irgendwelche Güter @@ -197,8 +197,8 @@ void noShip::DrawDriving(DrawPoint& drawPt) // Interpolieren zwischen beiden Knotenpunkten drawPt += CalcWalkingRelative(); - LOADER.GetImageN("boot_z", 13 + rttr::enum_cast(GetCurMoveDir() + 3u) * 2)->DrawFull(drawPt, COLOR_SHADOW); - LOADER.GetImageN("boot_z", 12 + rttr::enum_cast(GetCurMoveDir() + 3u) * 2)->DrawFull(drawPt); + LOADER.getImageN("boot_z", 13 + rttr::enum_cast(getCurMoveDir() + 3u) * 2)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getImageN("boot_z", 12 + rttr::enum_cast(getCurMoveDir() + 3u) * 2)->DrawFull(drawPt); } /// Zeichnet normales Fahren auf dem Meer mit Gütern @@ -206,7 +206,7 @@ void noShip::DrawDrivingWithWares(DrawPoint& drawPt) { DrawDriving(drawPt); /// Waren zeichnen - LOADER.GetImageN("boot_z", 30 + rttr::enum_cast(GetCurMoveDir() + 3u))->DrawFull(drawPt); + LOADER.getImageN("boot_z", 30 + rttr::enum_cast(getCurMoveDir() + 3u))->DrawFull(drawPt); } void noShip::HandleEvent(const unsigned id) @@ -235,10 +235,10 @@ void noShip::HandleEvent(const unsigned id) state = State::ExpeditionWaiting; // Spieler benachrichtigen - SendPostMessage(ownerId_, std::make_unique(GetEvMgr().GetCurrentGF(), + SendPostMessage(ownerId_, std::make_unique(getEvMgr().getCurrentGF(), _("A ship is ready for an expedition."), PostCategory::Economy, *this)); - world->GetNotifications().publish(ExpeditionNote(ExpeditionNote::Waiting, ownerId_, pos)); + world->getNotifications().publish(ExpeditionNote(ExpeditionNote::Waiting, ownerId_, pos)); break; case State::ExplorationexpeditionLoading: case State::ExplorationexpeditionWaiting: @@ -248,9 +248,9 @@ void noShip::HandleEvent(const unsigned id) case State::ExpeditionUnloading: { // Hafen herausfinden - noBase* hb = goalHarbor ? world->GetNO(world->GetHarborPoint(goalHarbor)) : nullptr; + noBase* hb = goalHarbor ? world->getNO(world->getHarborPoint(goalHarbor)) : nullptr; - if(hb && hb->GetGOT() == GO_Type::NobHarborbuilding) + if(hb && hb->getGOT() == GO_Type::NobHarborbuilding) { GoodsAndPeopleCounts goods; goods.goods[GoodType::Boards] = BUILDING_COSTS[BuildingType::HarborBuilding].boards; @@ -259,7 +259,7 @@ void noShip::HandleEvent(const unsigned id) static_cast(hb)->AddToInventory(goods, false); // Wieder idlen und ggf. neuen Job suchen StartIdling(); - world->GetPlayer(ownerId_).GetJobForShip(*this); + world->getPlayer(ownerId_).getJobForShip(*this); } else { // target harbor for unloading doesnt exist anymore -> set state to driving and handle the new state @@ -271,18 +271,18 @@ void noShip::HandleEvent(const unsigned id) case State::ExplorationexpeditionUnloading: { // Hafen herausfinden - noBase* hb = goalHarbor ? world->GetNO(world->GetHarborPoint(goalHarbor)) : nullptr; + noBase* hb = goalHarbor ? world->getNO(world->getHarborPoint(goalHarbor)) : nullptr; - unsigned old_visual_range = GetVisualRange(); + unsigned old_visual_range = getVisualRange(); - if(hb && hb->GetGOT() == GO_Type::NobHarborbuilding) + if(hb && hb->getGOT() == GO_Type::NobHarborbuilding) { // Späher wieder entladen - const auto people = PeopleCounts::make(Job::Scout, world->GetGGS().GetNumScoutsExpedition()); + const auto people = PeopleCounts::make(Job::Scout, world->getGGS().getNumScoutsExpedition()); static_cast(hb)->AddToInventory(people, false); // Wieder idlen und ggf. neuen Job suchen StartIdling(); - world->GetPlayer(ownerId_).GetJobForShip(*this); + world->getPlayer(ownerId_).getJobForShip(*this); } else { // target harbor for unloading doesnt exist anymore -> set state to driving and handle the new state @@ -301,8 +301,8 @@ void noShip::HandleEvent(const unsigned id) { // Hafen herausfinden RTTR_Assert(state == State::SeaattackUnloading || remaining_sea_attackers == 0); - noBase* hb = goalHarbor ? world->GetNO(world->GetHarborPoint(goalHarbor)) : nullptr; - if(hb && hb->GetGOT() == GO_Type::NobHarborbuilding) + noBase* hb = goalHarbor ? world->getNO(world->getHarborPoint(goalHarbor)) : nullptr; + if(hb && hb->getGOT() == GO_Type::NobHarborbuilding) { static_cast(hb)->ReceiveGoodsFromShip(figures, wares); figures.clear(); @@ -317,7 +317,7 @@ void noShip::HandleEvent(const unsigned id) { // Wieder idlen und ggf. neuen Job suchen StartIdling(); - world->GetPlayer(ownerId_).GetJobForShip(*this); + world->getPlayer(ownerId_).getJobForShip(*this); } } else { @@ -339,14 +339,14 @@ void noShip::HandleEvent(const unsigned id) // Evtl. ist ein Angreifer schon fertig und wieder an Board gegangen // der darf dann natürlich nicht noch einmal raus, sonst kann die schöne Reise // böse enden - if(static_cast(*figures.front()).IsSeaAttackCompleted()) + if(static_cast(*figures.front()).isSeaAttackCompleted()) break; auto& attacker = world->AddFigure(pos, std::move(figures.front())); figures.pop_front(); - current_ev = GetEvMgr().AddEvent(this, 30, 1); - static_cast(attacker).StartAttackOnOtherIsland(pos, GetObjId()); + current_ev = getEvMgr().AddEvent(this, 30, 1); + static_cast(attacker).StartAttackOnOtherIsland(pos, getObjId()); break; } } @@ -357,20 +357,20 @@ void noShip::StartDriving(const Direction dir) { const std::array SHIP_SPEEDS = {35, 25, 20, 10, 5}; - StartMoving(dir, SHIP_SPEEDS[world->GetGGS().getSelection(AddonId::SHIP_SPEED)]); + StartMoving(dir, SHIP_SPEEDS[world->getGGS().getSelection(AddonId::SHIP_SPEED)]); } void noShip::Driven() { MapPoint enemy_territory_discovered(MapPoint::Invalid()); - world->RecalcMovingVisibilities(pos, ownerId_, GetVisualRange(), GetCurMoveDir(), &enemy_territory_discovered); + world->RecalcMovingVisibilities(pos, ownerId_, getVisualRange(), getCurMoveDir(), &enemy_territory_discovered); // Feindliches Territorium entdeckt? if(enemy_territory_discovered.isValid()) { // Send message if necessary - if(world->GetPlayer(ownerId_).ShipDiscoveredHostileTerritory(enemy_territory_discovered)) - SendPostMessage(ownerId_, std::make_unique(GetEvMgr().GetCurrentGF(), + if(world->getPlayer(ownerId_).ShipDiscoveredHostileTerritory(enemy_territory_discovered)) + SendPostMessage(ownerId_, std::make_unique(getEvMgr().getCurrentGF(), _("A ship disovered an enemy territory"), PostCategory::Military, enemy_territory_discovered)); } @@ -387,25 +387,25 @@ void noShip::Driven() } } -bool noShip::IsLoading() const +bool noShip::isLoading() const { return state == State::ExpeditionLoading || state == State::ExplorationexpeditionLoading || state == State::TransportLoading || state == State::SeaattackLoading; } -bool noShip::IsUnloading() const +bool noShip::isUnloading() const { return state == State::ExpeditionUnloading || state == State::ExplorationexpeditionUnloading || state == State::TransportUnloading || state == State::SeaattackUnloading; } -bool noShip::IsOnBoard(const noFigure& figure) const +bool noShip::isOnBoard(const noFigure& figure) const { return helpers::containsPtr(figures, &figure); } /// Gibt Sichtradius dieses Schiffes zurück -unsigned noShip::GetVisualRange() const +unsigned noShip::getVisualRange() const { // Erkundungsschiffe haben einen größeren Sichtbereich if(state >= State::ExplorationexpeditionLoading && state <= State::ExplorationexpeditionDriving) @@ -424,7 +424,7 @@ void noShip::GoToHarbor(const nobHarborBuilding& hb, const std::vectorGetNode(hb.GetPos()).harborId; + goalHarbor = world->getNode(hb.getPos()).harborId; RTTR_Assert(goalHarbor); // Route merken @@ -440,9 +440,9 @@ void noShip::StartExpedition(HarborId homeHarborId) { /// Schiff wird "beladen", also kurze Zeit am Hafen stehen, bevor wir bereit sind state = State::ExpeditionLoading; - current_ev = GetEvMgr().AddEvent(this, LOADING_TIME, 1); + current_ev = getEvMgr().AddEvent(this, LOADING_TIME, 1); RTTR_Assert(homeHarborId); - RTTR_Assert(pos == world->GetCoastalPoint(homeHarborId, seaId_)); + RTTR_Assert(pos == world->getCoastalPoint(homeHarborId, seaId_)); homeHarbor = homeHarborId; goalHarbor = homeHarborId; // This is current goal (commands are relative to current goal) } @@ -452,14 +452,14 @@ void noShip::StartExplorationExpedition(HarborId homeHarborId) { /// Schiff wird "beladen", also kurze Zeit am Hafen stehen, bevor wir bereit sind state = State::ExplorationexpeditionLoading; - current_ev = GetEvMgr().AddEvent(this, LOADING_TIME, 1); + current_ev = getEvMgr().AddEvent(this, LOADING_TIME, 1); covered_distance = 0; RTTR_Assert(homeHarborId); - RTTR_Assert(pos == world->GetCoastalPoint(homeHarborId, seaId_)); + RTTR_Assert(pos == world->getCoastalPoint(homeHarborId, seaId_)); homeHarbor = homeHarborId; goalHarbor = homeHarborId; // This is current goal (commands are relative to current goal) // Sichtbarkeiten neu berechnen - world->MakeVisibleAroundPoint(pos, GetVisualRange(), ownerId_); + world->MakeVisibleAroundPoint(pos, getVisualRange(), ownerId_); } /// Fährt weiter zu einem Hafen @@ -467,10 +467,10 @@ noShip::Result noShip::DriveToHarbour() { if(!goalHarbor) return Result::HarborDoesntExist; - const MapPoint goal = world->GetHarborPoint(goalHarbor); + const MapPoint goal = world->getHarborPoint(goalHarbor); // Existiert der Hafen überhaupt noch? - if(world->GetGOT(goal) != GO_Type::NobHarborbuilding) + if(world->getGOT(goal) != GO_Type::NobHarborbuilding) return Result::HarborDoesntExist; return DriveToHarbourPlace(); @@ -500,7 +500,7 @@ noShip::Result noShip::DriveToHarbourPlace() // Wir fangen bei der neuen Route wieder von vorne an curRouteIdx = 0; - } else if(goalRoutePos != world->GetCoastalPoint(goalHarbor, seaId_)) + } else if(goalRoutePos != world->getCoastalPoint(goalHarbor, seaId_)) { // Our goal point of the current route has changed // If we are close to it, recalculate the route @@ -520,18 +520,18 @@ noShip::Result noShip::DriveToHarbourPlace() return Result::Driving; } -HarborId noShip::GetCurrentHarbor() const +HarborId noShip::getCurrentHarbor() const { RTTR_Assert(state == State::ExpeditionWaiting); return goalHarbor; } -HarborId noShip::GetTargetHarbor() const +HarborId noShip::getTargetHarbor() const { return goalHarbor; } -HarborId noShip::GetHomeHarbor() const +HarborId noShip::getHomeHarbor() const { return homeHarbor; } @@ -543,7 +543,7 @@ void noShip::ContinueExpedition(const ShipDirection dir) return; // Nächsten Hafenpunkt in dieser Richtung suchen - HarborId new_goal = world->GetNextFreeHarborPoint(pos, goalHarbor, dir, ownerId_); + HarborId new_goal = world->getNextFreeHarborPoint(pos, goalHarbor, dir, ownerId_); // Auch ein Ziel gefunden? if(!new_goal) @@ -603,9 +603,9 @@ void noShip::FoundColony() // Dann idlen wir wieder StartIdling(); // Neue Arbeit suchen - world->GetPlayer(ownerId_).GetJobForShip(*this); + world->getPlayer(ownerId_).getJobForShip(*this); } else // colony founding FAILED - world->GetNotifications().publish(ExpeditionNote(ExpeditionNote::Waiting, ownerId_, pos)); + world->getNotifications().publish(ExpeditionNote(ExpeditionNote::Waiting, ownerId_, pos)); } void noShip::handleStateGoToHarbor() @@ -623,21 +623,21 @@ void noShip::handleStateGoToHarbor() case Result::Driving: return; // Continue case Result::GoalReached: { - const MapPoint goal = world->GetHarborPoint(goalHarbor); + const MapPoint goal = world->getHarborPoint(goalHarbor); // Go idle here (if harbor does not need it) StartIdling(); // Hafen Bescheid sagen, dass wir da sind (falls er überhaupt noch existiert) - noBase* hb = goal.isValid() ? world->GetNO(goal) : nullptr; - if(hb && hb->GetGOT() == GO_Type::NobHarborbuilding) + noBase* hb = goal.isValid() ? world->getNO(goal) : nullptr; + if(hb && hb->getGOT() == GO_Type::NobHarborbuilding) static_cast(hb)->ShipArrived(*this); } break; case Result::NoRouteFound: { - MapPoint goal(world->GetHarborPoint(goalHarbor)); + MapPoint goal(world->getHarborPoint(goalHarbor)); RTTR_Assert(goal.isValid()); // Dem Hafen Bescheid sagen - world->GetSpecObj(goal)->ShipLost(this); + world->getSpecObj(goal)->ShipLost(this); StartIdling(); } break; @@ -664,7 +664,7 @@ void noShip::handleStateExpeditionDriving() { // Sachen wieder in den Hafen verladen state = State::ExpeditionUnloading; - current_ev = GetEvMgr().AddEvent(this, UNLOADING_TIME, 1); + current_ev = getEvMgr().AddEvent(this, UNLOADING_TIME, 1); } else { // Warten auf weitere Anweisungen @@ -672,10 +672,10 @@ void noShip::handleStateExpeditionDriving() // Spieler benachrichtigen SendPostMessage( - ownerId_, std::make_unique(GetEvMgr().GetCurrentGF(), + ownerId_, std::make_unique(getEvMgr().getCurrentGF(), _("A ship has reached the destination of its expedition."), PostCategory::Economy, *this)); - world->GetNotifications().publish(ExpeditionNote(ExpeditionNote::Waiting, ownerId_, pos)); + world->getNotifications().publish(ExpeditionNote(ExpeditionNote::Waiting, ownerId_, pos)); } } break; @@ -714,7 +714,7 @@ void noShip::handleStateExplorationExpeditionDriving() { // Dann sind wir fertig -> wieder entladen state = State::ExplorationexpeditionUnloading; - current_ev = GetEvMgr().AddEvent(this, UNLOADING_TIME, 1); + current_ev = getEvMgr().AddEvent(this, UNLOADING_TIME, 1); } else { // Strecke, die wir gefahren sind, draufaddieren @@ -722,7 +722,7 @@ void noShip::handleStateExplorationExpeditionDriving() // Erstmal kurz ausruhen an diesem Punkt und das Rohr ausfahren, um ein bisschen // auf der Insel zu gucken state = State::ExplorationexpeditionWaiting; - current_ev = GetEvMgr().AddEvent(this, EXPLORATION_EXPEDITION_WAITING_TIME, 1); + current_ev = getEvMgr().AddEvent(this, EXPLORATION_EXPEDITION_WAITING_TIME, 1); } } break; @@ -749,7 +749,7 @@ void noShip::handleStateTransportDriving() { // Waren abladen, dafür wieder kurze Zeit hier ankern state = State::TransportUnloading; - current_ev = GetEvMgr().AddEvent(this, UNLOADING_TIME, 1); + current_ev = getEvMgr().AddEvent(this, UNLOADING_TIME, 1); } break; case Result::NoRouteFound: @@ -764,7 +764,7 @@ void noShip::handleStateTransportDriving() for(auto& figure : figures) { figure->Abrogate(); - figure->SetGoalTonullptr(); + figure->setGoalTonullptr(); } for(auto& ware : wares) @@ -787,7 +787,7 @@ void noShip::handleStateSeaAttackDriving() case Result::GoalReached: // Ziel erreicht, dann stellen wir das Schiff hier hin und die Soldaten laufen nacheinander raus zum Ziel state = State::SeaattackWaiting; - current_ev = GetEvMgr().AddEvent(this, 15, 1); + current_ev = getEvMgr().AddEvent(this, 15, 1); remaining_sea_attackers = figures.size(); break; case Result::NoRouteFound: @@ -807,7 +807,7 @@ void noShip::handleStateSeaAttackReturn() case Result::GoalReached: // Entladen state = State::SeaattackUnloading; - this->current_ev = GetEvMgr().AddEvent(this, UNLOADING_TIME, 1); + this->current_ev = getEvMgr().AddEvent(this, UNLOADING_TIME, 1); break; case Result::HarborDoesntExist: case Result::NoRouteFound: AbortSeaAttack(); break; @@ -815,7 +815,7 @@ void noShip::handleStateSeaAttackReturn() } /// Gibt zurück, ob das Schiff jetzt in der Lage wäre, eine Kolonie zu gründen -bool noShip::IsAbleToFoundColony() const +bool noShip::isAbleToFoundColony() const { // Warten wir gerade? if(state == State::ExpeditionWaiting) @@ -823,7 +823,7 @@ bool noShip::IsAbleToFoundColony() const // We must always have a goal harbor RTTR_Assert(goalHarbor); // Ist der Punkt, an dem wir gerade ankern, noch frei? - if(world->IsHarborPointFree(goalHarbor, ownerId_)) + if(world->isHarborPointFree(goalHarbor, ownerId_)) return true; } @@ -831,9 +831,9 @@ bool noShip::IsAbleToFoundColony() const } /// Gibt zurück, ob das Schiff einen bestimmten Hafen ansteuert -bool noShip::IsGoingToHarbor(const nobHarborBuilding& hb) const +bool noShip::isGoingToHarbor(const nobHarborBuilding& hb) const { - if(goalHarbor != hb.GetHarborPosID()) + if(goalHarbor != hb.getHarborPosID()) return false; // Explicit switch to check all states switch(state) @@ -867,18 +867,18 @@ void noShip::PrepareTransport(HarborId homeHarborId, MapPoint goal, std::list> wares) { RTTR_Assert(homeHarborId); - RTTR_Assert(pos == world->GetCoastalPoint(homeHarborId, seaId_)); + RTTR_Assert(pos == world->getCoastalPoint(homeHarborId, seaId_)); this->homeHarbor = homeHarborId; // ID von Zielhafen herausfinden - noBase* nb = world->GetNO(goal); - RTTR_Assert(nb->GetGOT() == GO_Type::NobHarborbuilding); - this->goalHarbor = static_cast(nb)->GetHarborPosID(); + noBase* nb = world->getNO(goal); + RTTR_Assert(nb->getGOT() == GO_Type::NobHarborbuilding); + this->goalHarbor = static_cast(nb)->getHarborPosID(); this->figures = std::move(figures); this->wares = std::move(wares); state = State::TransportLoading; - current_ev = GetEvMgr().AddEvent(this, LOADING_TIME, 1); + current_ev = getEvMgr().AddEvent(this, LOADING_TIME, 1); } /// Belädt das Schiff mit Schiffs-Angreifern @@ -886,9 +886,9 @@ void noShip::PrepareSeaAttack(HarborId homeHarborId, MapPoint goal, std::vector< { // Heimathafen merken RTTR_Assert(homeHarborId); - RTTR_Assert(pos == world->GetCoastalPoint(homeHarborId, seaId_)); + RTTR_Assert(pos == world->getCoastalPoint(homeHarborId, seaId_)); homeHarbor = homeHarborId; - goalHarbor = world->GetHarborPointID(goal); + goalHarbor = world->getHarborPointID(goal); RTTR_Assert(goalHarbor); figures.clear(); for(auto& attacker : attackers) @@ -898,7 +898,7 @@ void noShip::PrepareSeaAttack(HarborId homeHarborId, MapPoint goal, std::vector< figures.push_back(std::move(attacker)); } state = State::SeaattackLoading; - current_ev = GetEvMgr().AddEvent(this, LOADING_TIME, 1); + current_ev = getEvMgr().AddEvent(this, LOADING_TIME, 1); } /// Startet Schiffs-Angreiff @@ -939,13 +939,13 @@ void noShip::AbortSeaAttack() // attack failed and we cannot go back to our home harbor // -> Tell figures that they won't go to their planned destination for(auto& figure : figures) - checkedCast(figure.get())->CancelSeaAttack(); + checkedCast(figure.get())->cancelSeaAttack(); if(state == State::SeaattackLoading) { // Abort loading RTTR_Assert(current_ev); - GetEvMgr().RemoveEvent(current_ev); + getEvMgr().RemoveEvent(current_ev); } // Das Schiff muss einen Notlandeplatz ansteuern @@ -962,15 +962,15 @@ void noShip::StartDrivingToHarborPlace() return; } - MapPoint coastalPos = world->GetCoastalPoint(goalHarbor, seaId_); + MapPoint coastalPos = world->getCoastalPoint(goalHarbor, seaId_); if(pos == coastalPos) route_.clear(); else { // if we still have and are at the home harbor get route directly - if(homeHarbor && pos == world->GetCoastalPoint(homeHarbor, seaId_)) + if(homeHarbor && pos == world->getCoastalPoint(homeHarbor, seaId_)) { - route_ = world->GetShipPathData().getHarborConnection(homeHarbor, goalHarbor, seaId_); + route_ = world->getShipPathData().getHarborConnection(homeHarbor, goalHarbor, seaId_); RTTR_Assert(!route_.empty()); } else { @@ -983,9 +983,9 @@ void noShip::StartDrivingToHarborPlace() "replay.\nnoShip::StartDrivingToHarborPlace: Schiff hat keinen Weg gefunden!\nplayer %i state %i " "pos %u,%u goal " "coastal %u,%u goal-id %i goalpos %u,%u \n") - % GetEvMgr().GetCurrentGF() % unsigned(ownerId_) % unsigned(state) % pos.x % pos.y % coastalPos.x - % coastalPos.y % goalHarbor % world->GetHarborPoint(goalHarbor).x - % world->GetHarborPoint(goalHarbor).y; + % getEvMgr().getCurrentGF() % unsigned(ownerId_) % unsigned(state) % pos.x % pos.y % coastalPos.x + % coastalPos.y % goalHarbor % world->getHarborPoint(goalHarbor).x + % world->getHarborPoint(goalHarbor).y; goalHarbor.reset(); return; } @@ -1009,7 +1009,7 @@ void noShip::FindUnloadGoal(State newState) state = newState; // Das Schiff muss einen Notlandeplatz ansteuern // Neuen Hafen suchen - if(world->GetPlayer(ownerId_).FindHarborForUnloading(this, pos, &goalHarbor, &route_, nullptr)) + if(world->getPlayer(ownerId_).FindHarborForUnloading(this, pos, &goalHarbor, &route_, nullptr)) { curRouteIdx = 0; homeHarbor = goalHarbor; // To allow unloading here @@ -1040,7 +1040,7 @@ void noShip::FindUnloadGoal(State newState) /// Sagt dem Schiff, das ein bestimmter Hafen zerstört wurde void noShip::HarborDestroyed(nobHarborBuilding* hb) { - const HarborId destroyedHarborId = hb->GetHarborPosID(); + const HarborId destroyedHarborId = hb->getHarborPosID(); // Almost every case of a destroyed harbor is handled when the ships event fires (the handler detects the destroyed // harbor) So mostly we just reset the corresponding id @@ -1057,7 +1057,7 @@ void noShip::HarborDestroyed(nobHarborBuilding* hb) { default: // Just reset goal, but not for expeditions - if(!IsOnExpedition() && !IsOnExplorationExpedition()) + if(!isOnExpedition() && !isOnExplorationExpedition()) goalHarbor.reset(); return; // Skip the rest case State::TransportLoading: @@ -1066,15 +1066,15 @@ void noShip::HarborDestroyed(nobHarborBuilding* hb) for(auto& figure : figures) { figure->Abrogate(); - figure->SetGoalTonullptr(); + figure->setGoalTonullptr(); } for(auto& ware : wares) { // Notify goal only, if it is not the destroyed harbor. It already knows about that ;) - if(ware->GetGoal() != hb) + if(ware->getGoal() != hb) ware->NotifyGoalAboutLostWare(); else - ware->SetGoal(nullptr); + ware->setGoal(nullptr); } break; case State::SeaattackLoading: @@ -1096,13 +1096,13 @@ void noShip::HarborDestroyed(nobHarborBuilding* hb) state = State::TransportUnloading; } else { - GetEvMgr().RemoveEvent(current_ev); + getEvMgr().RemoveEvent(current_ev); FindUnloadGoal(State::TransportDriving); } } else if(oldState == State::TransportUnloading || oldState == State::SeaattackUnloading) { // Remove current unload event - GetEvMgr().RemoveEvent(current_ev); + getEvMgr().RemoveEvent(current_ev); if(oldState == State::SeaattackUnloading) AbortSeaAttack(); @@ -1119,8 +1119,8 @@ void noShip::StartIdling() RTTR_Assert(wares.empty()); RTTR_Assert(remaining_sea_attackers == 0); // Implicit contained wares/figures on expeditions - RTTR_Assert(!IsOnExplorationExpedition() || state == State::ExplorationexpeditionUnloading); - RTTR_Assert(!IsOnExpedition() || state == State::ExpeditionUnloading); + RTTR_Assert(!isOnExplorationExpedition() || state == State::ExplorationexpeditionUnloading); + RTTR_Assert(!isOnExpedition() || state == State::ExpeditionUnloading); homeHarbor.reset(); goalHarbor.reset(); @@ -1138,7 +1138,7 @@ void noShip::SeaAttackerWishesNoReturn() if(remaining_sea_attackers == 0) { // Andere Events ggf. erstmal abmelden - GetEvMgr().RemoveEvent(current_ev); + getEvMgr().RemoveEvent(current_ev); if(!figures.empty()) { // Go back home. Note: home_harbor can be 0 if it was destroyed, allow this and let the state handlers @@ -1151,7 +1151,7 @@ void noShip::SeaAttackerWishesNoReturn() { // Wenn keine Soldaten mehr da sind können wir auch erstmal idlen StartIdling(); - world->GetPlayer(ownerId_).GetJobForShip(*this); + world->getPlayer(ownerId_).getJobForShip(*this); } } } @@ -1179,7 +1179,7 @@ void noShip::ContinueExplorationExpedition() // Find the next harbor spot to explore std::vector hps; if(goalHarbor) - hps = world->GetUnexploredHarborPoints(goalHarbor, seaId_, GetPlayerId()); + hps = world->getUnexploredHarborPoints(goalHarbor, seaId_, getPlayerId()); // No possible spots? -> Go home if(hps.empty()) @@ -1202,11 +1202,11 @@ void noShip::NewHarborBuilt(nobHarborBuilding* hb) if(!lost) return; // Liegt der Hafen auch am Meer von diesem Schiff? - if(!world->IsHarborAtSea(hb->GetHarborPosID(), seaId_)) + if(!world->isHarborAtSea(hb->getHarborPosID(), seaId_)) return; // LOG.write(("lost ship has new goal harbor player %i state %i pos %u,%u \n",player,state,x,y); - homeHarbor = goalHarbor = hb->GetHarborPosID(); + homeHarbor = goalHarbor = hb->getHarborPosID(); lost = false; StartDrivingToHarborPlace(); diff --git a/libs/s25main/nodeObjs/noShip.h b/libs/s25main/nodeObjs/noShip.h index 6d77440291..14e0e84a81 100644 --- a/libs/s25main/nodeObjs/noShip.h +++ b/libs/s25main/nodeObjs/noShip.h @@ -136,7 +136,7 @@ class noShip : public noMovable void Serialize(SerializedGameData& sgd) const override; void Destroy() override; - GO_Type GetGOT() const final { return GO_Type::Ship; } + GO_Type getGOT() const final { return GO_Type::Ship; } // An x,y zeichnen void Draw(DrawPoint drawPt) override; @@ -144,50 +144,50 @@ class noShip : public noMovable void HandleEvent(unsigned id) override; /// Gibt den Besitzer zurück - unsigned char GetPlayerId() const { return ownerId_; } + unsigned char getPlayerId() const { return ownerId_; } /// Gibt die ID des Meeres zurück, auf dem es sich befindet - SeaId GetSeaID() const { return seaId_; } + SeaId getSeaID() const { return seaId_; } /// Gibt den Schiffsnamen zurück - const std::string& GetName() const { return name; } + const std::string& getName() const { return name; } /// Hat das Schiff gerade nichts zu tun - bool IsIdling() const { return (state == State::Idle); } - bool IsLost() const { return lost; } + bool isIdling() const { return (state == State::Idle); } + bool isLost() const { return lost; } /// Führt das Schiff gerade eine Expedition durch und wartet auf weitere Befehle? - bool IsWaitingForExpeditionInstructions() const { return (state == State::ExpeditionWaiting); } + bool isWaitingForExpeditionInstructions() const { return (state == State::ExpeditionWaiting); } /// Ist das Schiff gerade irgendwie am Expeditionieren und hat entsprechenden Kram an Bord? - bool IsOnExpedition() const + bool isOnExpedition() const { return (state == State::ExpeditionLoading || state == State::ExpeditionWaiting || state == State::ExpeditionDriving); } /// Ist das Schiff gerade irgendwie am Explorations-Expeditionieren und hat entsprechenden Kram an Bord? - bool IsOnExplorationExpedition() const + bool isOnExplorationExpedition() const { return (state == State::ExplorationexpeditionLoading || state == State::ExplorationexpeditionUnloading || state == State::ExplorationexpeditionWaiting || state == State::ExplorationexpeditionDriving); } - bool IsOnAttackMission() const + bool isOnAttackMission() const { return (state == State::SeaattackLoading || state == State::SeaattackUnloading || state == State::SeaattackDrivingToDestination || state == State::SeaattackWaiting || state == State::SeaattackReturnDriving); } - bool IsLoading() const; - bool IsUnloading() const; + bool isLoading() const; + bool isUnloading() const; /// Gibt Liste der Waren an Bord zurück - auto GetWares() const { return helpers::nonNullPtrSpan(wares); } + auto getWares() const { return helpers::nonNullPtrSpan(wares); } /// Gibt Liste der Menschen an Bord zurück - auto GetFigures() const { return helpers::nonNullPtrSpan(figures); } - bool IsOnBoard(const noFigure& figure) const; + auto getFigures() const { return helpers::nonNullPtrSpan(figures); } + bool isOnBoard(const noFigure& figure) const; /// Gibt Sichtradius dieses Schiffes zurück - unsigned GetVisualRange() const; + unsigned getVisualRange() const; /// Return the harbor ID where the ship currently is. Only valid when waiting for expedition instructions - HarborId GetCurrentHarbor() const; + HarborId getCurrentHarbor() const; /// Return the harbor the ship is currently targeting (0 if ship is idling) - HarborId GetTargetHarbor() const; + HarborId getTargetHarbor() const; /// Return the source harbor from where the ship left the current mission (0 if ship is idling) - HarborId GetHomeHarbor() const; + HarborId getHomeHarbor() const; /// Fährt zum Hafen, um dort eine Mission (Expedition) zu erledigen void GoToHarbor(const nobHarborBuilding& hb, const std::vector& route); @@ -203,11 +203,11 @@ class noShip : public noMovable /// Weist das Schiff an, seine Erkundungs-Expedition fortzusetzen void ContinueExplorationExpedition(); /// Gibt zurück, ob das Schiff jetzt in der Lage wäre, eine Kolonie zu gründen - bool IsAbleToFoundColony() const; + bool isAbleToFoundColony() const; /// Weist das Schiff an, an der aktuellen Position einen Hafen zu gründen void FoundColony(); /// Return true, if the ship is driving to this harbor as its final destination (free for new orders) - bool IsGoingToHarbor(const nobHarborBuilding& hb) const; + bool isGoingToHarbor(const nobHarborBuilding& hb) const; /// Belädt das Schiff mit Waren und Figuren, um eine Transportfahrt zu starten void PrepareTransport(HarborId homeHarborId, MapPoint goal, std::list> figures, diff --git a/libs/s25main/nodeObjs/noShipBuildingSite.cpp b/libs/s25main/nodeObjs/noShipBuildingSite.cpp index 3682ddf9e4..53cbba98e1 100644 --- a/libs/s25main/nodeObjs/noShipBuildingSite.cpp +++ b/libs/s25main/nodeObjs/noShipBuildingSite.cpp @@ -22,8 +22,8 @@ noShipBuildingSite::~noShipBuildingSite() = default; void noShipBuildingSite::Destroy() { - if(world->GetNode(pos).obj == this) - world->SetNO(pos, nullptr); + if(world->getNode(pos).obj == this) + world->setNO(pos, nullptr); noCoordBase::Destroy(); } @@ -47,27 +47,27 @@ void noShipBuildingSite::Draw(DrawPoint drawPt) { if(progress < PROGRESS_PARTS[0] + PROGRESS_PARTS[1]) { - glArchivItem_Bitmap* image = LOADER.GetImageN("boot_z", 24); + glArchivItem_Bitmap* image = LOADER.getImageN("boot_z", 24); unsigned percentDone = (progress > PROGRESS_PARTS[0]) ? 100u : progress * 100 / PROGRESS_PARTS[0]; image->DrawPercent(drawPt, percentDone); - image = LOADER.GetImageN("boot_z", 25); + image = LOADER.getImageN("boot_z", 25); image->DrawPercent(drawPt, percentDone, COLOR_SHADOW); } if(progress > PROGRESS_PARTS[0]) { unsigned curProg = progress - PROGRESS_PARTS[0]; unsigned percentDone = (curProg > PROGRESS_PARTS[1]) ? 100u : curProg * 100 / PROGRESS_PARTS[1]; - glArchivItem_Bitmap* image = LOADER.GetImageN("boot_z", 26); + glArchivItem_Bitmap* image = LOADER.getImageN("boot_z", 26); image->DrawPercent(drawPt, percentDone); - image = LOADER.GetImageN("boot_z", 27); + image = LOADER.getImageN("boot_z", 27); image->DrawPercent(drawPt, percentDone, COLOR_SHADOW); } if(progress > PROGRESS_PARTS[0] + PROGRESS_PARTS[1]) { unsigned percentDone = (progress - PROGRESS_PARTS[0] - PROGRESS_PARTS[1]) * 100 / PROGRESS_PARTS[2]; - glArchivItem_Bitmap* image = LOADER.GetImageN("boot_z", 28); + glArchivItem_Bitmap* image = LOADER.getImageN("boot_z", 28); image->DrawPercent(drawPt, percentDone); - image = LOADER.GetImageN("boot_z", 29); + image = LOADER.getImageN("boot_z", 29); image->DrawPercent(drawPt, percentDone, COLOR_SHADOW); } } @@ -81,19 +81,19 @@ void noShipBuildingSite::MakeBuildStep() if(progress > PROGRESS_PARTS[0] + PROGRESS_PARTS[1] + PROGRESS_PARTS[2]) { // Replace me by ship - world->SetNO(pos, nullptr); - GetEvMgr().AddToKillList(this); + world->setNO(pos, nullptr); + getEvMgr().AddToKillList(this); auto& ship = world->AddFigure(pos, std::make_unique(pos, player)); // Schiff registrieren lassen - world->GetPlayer(player).RegisterShip(ship); + world->getPlayer(player).RegisterShip(ship); // BQ neu berechnen, da Schiff nicht mehr blockiert world->RecalcBQAroundPointBig(pos); // Spieler über Fertigstellung benachrichtigen - SendPostMessage(player, std::make_unique(GetEvMgr().GetCurrentGF(), _("A new ship is ready"), + SendPostMessage(player, std::make_unique(getEvMgr().getCurrentGF(), _("A new ship is ready"), PostCategory::Economy, ship)); - world->GetNotifications().publish(ShipNote(ShipNote::Constructed, player, pos)); + world->getNotifications().publish(ShipNote(ShipNote::Constructed, player, pos)); } } diff --git a/libs/s25main/nodeObjs/noShipBuildingSite.h b/libs/s25main/nodeObjs/noShipBuildingSite.h index ad91c36794..58f0e07e97 100644 --- a/libs/s25main/nodeObjs/noShipBuildingSite.h +++ b/libs/s25main/nodeObjs/noShipBuildingSite.h @@ -16,15 +16,15 @@ class noShipBuildingSite : public noCoordBase ~noShipBuildingSite() override; void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Shipbuildingsite; } + GO_Type getGOT() const final { return GO_Type::Shipbuildingsite; } /// Gibt den Eigentümer zurück - unsigned char GetPlayer() const { return player; } + unsigned char getPlayer() const { return player; } /// Das Schiff wird um eine Stufe weitergebaut void MakeBuildStep(); - BlockingManner GetBM() const override { return BlockingManner::Building; } + BlockingManner getBM() const override { return BlockingManner::Building; } protected: void Draw(DrawPoint drawPt) override; diff --git a/libs/s25main/nodeObjs/noSign.cpp b/libs/s25main/nodeObjs/noSign.cpp index 2f2bbba33a..b2555b29d6 100644 --- a/libs/s25main/nodeObjs/noSign.cpp +++ b/libs/s25main/nodeObjs/noSign.cpp @@ -15,7 +15,7 @@ noSign::noSign(const MapPoint pos, Resource resource) : noDisappearingEnvObject( - pos, 8500 * (signDurabilityFactor[world->GetGGS().getSelection(AddonId::DURABLE_GEOLOGIST_SIGNS)]), 500), + pos, 8500 * (signDurabilityFactor[world->getGGS().getSelection(AddonId::DURABLE_GEOLOGIST_SIGNS)]), 500), resource(resource) { // As this is only for drawing we set the type to nothing if the resource is depleted @@ -49,8 +49,8 @@ void noSign::Draw(DrawPoint drawPt) default: return; } imgId += std::min(resource.getAmount() / 3u, 2u); - LOADER.GetMapTexture(imgId)->DrawFull(drawPt, GetDrawColor()); + LOADER.getMapTexture(imgId)->DrawFull(drawPt, getDrawColor()); // Schatten des Schildes - LOADER.GetMapTexture(700)->DrawFull(drawPt, GetDrawShadowColor()); + LOADER.getMapTexture(700)->DrawFull(drawPt, getDrawShadowColor()); } diff --git a/libs/s25main/nodeObjs/noSign.h b/libs/s25main/nodeObjs/noSign.h index fe27be592e..ac93a1bfdd 100644 --- a/libs/s25main/nodeObjs/noSign.h +++ b/libs/s25main/nodeObjs/noSign.h @@ -17,13 +17,13 @@ class noSign : public noDisappearingEnvObject void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Sign; } + GO_Type getGOT() const final { return GO_Type::Sign; } /// An x,y zeichnen. void Draw(DrawPoint drawPt) override; /// Return the resources found, as drawn on the sign. - Resource GetResource() const { return resource; } + Resource getResource() const { return resource; } private: Resource resource; diff --git a/libs/s25main/nodeObjs/noSkeleton.cpp b/libs/s25main/nodeObjs/noSkeleton.cpp index 8540e3b4bc..dac0a3b6d9 100644 --- a/libs/s25main/nodeObjs/noSkeleton.cpp +++ b/libs/s25main/nodeObjs/noSkeleton.cpp @@ -12,7 +12,7 @@ noSkeleton::noSkeleton(const MapPoint pos) : noCoordBase(NodalObjectType::Environment, pos), type(0) { - current_event = GetEvMgr().AddEvent(this, 15000 + RANDOM_RAND(10000)); + current_event = getEvMgr().AddEvent(this, 15000 + RANDOM_RAND(10000)); } noSkeleton::~noSkeleton() = default; @@ -20,10 +20,10 @@ noSkeleton::~noSkeleton() = default; void noSkeleton::Destroy() { // Remove from map if still present - if(world->GetNode(pos).obj == this) - world->SetNO(pos, nullptr); + if(world->getNode(pos).obj == this) + world->setNO(pos, nullptr); - GetEvMgr().RemoveEvent(current_event); + getEvMgr().RemoveEvent(current_event); noCoordBase::Destroy(); } @@ -42,7 +42,7 @@ noSkeleton::noSkeleton(SerializedGameData& sgd, const unsigned obj_id) void noSkeleton::Draw(DrawPoint drawPt) { - LOADER.GetMapTexture(547 + type)->DrawFull(drawPt); + LOADER.getMapTexture(547 + type)->DrawFull(drawPt); } void noSkeleton::HandleEvent(const unsigned /*id*/) @@ -51,13 +51,13 @@ void noSkeleton::HandleEvent(const unsigned /*id*/) { // weiter verwesen, dann später sterben nach ner zufälligen Zeit type = 1; - current_event = GetEvMgr().AddEvent(this, 10000 + RANDOM_RAND(10000)); + current_event = getEvMgr().AddEvent(this, 10000 + RANDOM_RAND(10000)); } else { // Remove from map and destroy - RTTR_Assert(world->GetNode(pos).obj == this); - world->SetNO(pos, nullptr); - GetEvMgr().AddToKillList(this); + RTTR_Assert(world->getNode(pos).obj == this); + world->setNO(pos, nullptr); + getEvMgr().AddToKillList(this); current_event = nullptr; } } diff --git a/libs/s25main/nodeObjs/noSkeleton.h b/libs/s25main/nodeObjs/noSkeleton.h index cfe0387f5d..ab2adf90a4 100644 --- a/libs/s25main/nodeObjs/noSkeleton.h +++ b/libs/s25main/nodeObjs/noSkeleton.h @@ -20,7 +20,7 @@ class noSkeleton : public noCoordBase void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Skeleton; } + GO_Type getGOT() const final { return GO_Type::Skeleton; } protected: void Draw(DrawPoint drawPt) override; diff --git a/libs/s25main/nodeObjs/noStaticObject.cpp b/libs/s25main/nodeObjs/noStaticObject.cpp index 824d67efc9..93ac23915f 100644 --- a/libs/s25main/nodeObjs/noStaticObject.cpp +++ b/libs/s25main/nodeObjs/noStaticObject.cpp @@ -26,13 +26,13 @@ noStaticObject::noStaticObject(const MapPoint pos, unsigned short id, unsigned s : noCoordBase(type, pos), id(id), file(file), size(size) { // sind wir ein "Schloss" Objekt? - if(GetSize() == 2) + if(getSize() == 2) { for(const Direction dir : {Direction::West, Direction::NorthWest, Direction::NorthEast}) { - MapPoint nb = world->GetNeighbour(pos, dir); + MapPoint nb = world->getNeighbour(pos, dir); world->DestroyNO(nb, false); - world->SetNO(nb, new noExtension(this)); + world->setNO(nb, new noExtension(this)); } } } @@ -53,16 +53,16 @@ void noStaticObject::Serialize(SerializedGameData& sgd) const void noStaticObject::Destroy() { // waren wir ein "Schloss" Objekt? - if(GetSize() == 2) + if(getSize() == 2) { for(const Direction i : {Direction::West, Direction::NorthWest, Direction::NorthEast}) - world->DestroyNO(world->GetNeighbour(pos, i)); + world->DestroyNO(world->getNeighbour(pos, i)); } noCoordBase::Destroy(); } -BlockingManner noStaticObject::GetBM() const +BlockingManner noStaticObject::getBM() const { return (size == 0) ? BlockingManner::None : BlockingManner::Single; } @@ -75,7 +75,7 @@ BlockingManner noStaticObject::GetBM() const */ void noStaticObject::Draw(DrawPoint drawPt) { - if(IsAnimated() || !textures.bmp) + if(isAnimated() || !textures.bmp) { textures = getTextures(file, id); RTTR_Assert(textures.bmp); @@ -92,32 +92,32 @@ void noStaticObject::Draw(DrawPoint drawPt) noStaticObject::Textures noStaticObject::getTextures(unsigned short file, unsigned short id) { Textures textures{}; - if(IsOpenGateway(file, id)) - textures.bmp = &LOADER.gateway_cache[GAMECLIENT.GetGlobalAnimation(4, 5, 4, 0) + 1]; + if(isOpenGateway(file, id)) + textures.bmp = &LOADER.gateway_cache[GAMECLIENT.getGlobalAnimation(4, 5, 4, 0) + 1]; else if(file == 0xFFFF) - textures = {LOADER.GetMapTexture(id), LOADER.GetMapTexture(id + 100)}; + textures = {LOADER.getMapTexture(id), LOADER.getMapTexture(id + 100)}; else if(file < 8) { static const std::array files = {"mis0bobs", "mis1bobs", "mis2bobs", "mis3bobs", "mis4bobs", "mis5bobs", "charburner_bobs", "wine_bobs"}; - textures.bmp = LOADER.GetTextureN(files[file], id); + textures.bmp = LOADER.getTextureN(files[file], id); // Use only shadows where available if(file < 6) - textures.shadow = LOADER.GetTextureN(files[file], id + 1); + textures.shadow = LOADER.getTextureN(files[file], id + 1); else if(file == 7) - textures.shadow = LOADER.GetTextureN(files[file], id + 10); + textures.shadow = LOADER.getTextureN(files[file], id + 10); } else throw std::runtime_error("Invalid file number for static object"); return textures; } -bool noStaticObject::IsAnimated() const +bool noStaticObject::isAnimated() const { - return IsOpenGateway(file, id); + return isOpenGateway(file, id); } -bool noStaticObject::IsOpenGateway(unsigned short file, unsigned short id) +bool noStaticObject::isOpenGateway(unsigned short file, unsigned short id) { return file == 0xFFFF && id == 561; } diff --git a/libs/s25main/nodeObjs/noStaticObject.h b/libs/s25main/nodeObjs/noStaticObject.h index 69644b845c..848c74f290 100644 --- a/libs/s25main/nodeObjs/noStaticObject.h +++ b/libs/s25main/nodeObjs/noStaticObject.h @@ -22,25 +22,25 @@ class noStaticObject : public noCoordBase void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const override { return GO_Type::Staticobject; } + GO_Type getGOT() const override { return GO_Type::Staticobject; } /// gibt die Item-ID zurück (nr in der jeweiligen File) - unsigned short GetItemID() const { return id; } + unsigned short getItemID() const { return id; } /// gibt die Nr der File zurück) - unsigned short GetItemFile() const { return file; } + unsigned short getItemFile() const { return file; } /// gibt die Größe des Objekts zurück. - unsigned char GetSize() const { return size; } + unsigned char getSize() const { return size; } - BlockingManner GetBM() const override; + BlockingManner getBM() const override; /// zeichnet das Objekt. void Draw(DrawPoint drawPt) override; static Textures getTextures(unsigned short file, unsigned short id); - bool IsAnimated() const; + bool isAnimated() const; protected: - static bool IsOpenGateway(unsigned short file, unsigned short id); + static bool isOpenGateway(unsigned short file, unsigned short id); unsigned short id; unsigned short file; unsigned char size; diff --git a/libs/s25main/nodeObjs/noTree.cpp b/libs/s25main/nodeObjs/noTree.cpp index 502150fb87..4d11763b68 100644 --- a/libs/s25main/nodeObjs/noTree.cpp +++ b/libs/s25main/nodeObjs/noTree.cpp @@ -28,7 +28,7 @@ noTree::noTree(const MapPoint pos, const unsigned char type, const unsigned char // Wenn der Baum klein ist, muss später mal wachsen if(!size) { - event = GetEvMgr().AddEvent(this, WAIT_LENGTH); + event = getEvMgr().AddEvent(this, WAIT_LENGTH); state = State::GrowingWait; } else state = State::Nothing; @@ -36,18 +36,18 @@ noTree::noTree(const MapPoint pos, const unsigned char type, const unsigned char // Every nth tree produces animals, but no palm and pineapple trees const std::array TREESPERANIMALSPAWN = {20, 13, 10, 6, 4, 2}; produce_animals = (type < 3 || type > 5) - && (RANDOM_RAND(TREESPERANIMALSPAWN[world->GetGGS().getSelection(AddonId::MORE_ANIMALS)]) == 0); + && (RANDOM_RAND(TREESPERANIMALSPAWN[world->getGGS().getSelection(AddonId::MORE_ANIMALS)]) == 0); // Falls das der Fall ist, dann wollen wir doch gleich mal eins produzieren if(produce_animals) - produce_animal_event = GetEvMgr().AddEvent(this, 6000 + RANDOM_RAND(2000), 3); + produce_animal_event = getEvMgr().AddEvent(this, 6000 + RANDOM_RAND(2000), 3); } noTree::~noTree() = default; void noTree::Destroy() { - GetEvMgr().RemoveEvent(produce_animal_event); + getEvMgr().RemoveEvent(produce_animal_event); noCoordBase::Destroy(); } @@ -78,7 +78,7 @@ void noTree::Draw(DrawPoint drawPt) // Wenn er ausgewachsen ist, dann animiert zeichnen LOADER .tree_cache[type] - [GAMECLIENT.GetGlobalAnimation(8, 7 - GetX() % 2, 3 + GetY() % 3, GetX() * GetY() * 10 * type)] + [GAMECLIENT.getGlobalAnimation(8, 7 - getX() % 2, 3 + getY() % 3, getX() * getY() * 10 * type)] .draw(drawPt); // je mehr Bäume gezeichnet, desto mehr Vogelgezwitscher @@ -138,7 +138,7 @@ void noTree::HandleEvent(const unsigned id) // Neues Tier erzeugen ProduceAnimal(); // nächstes Event anmelden - produce_animal_event = GetEvMgr().AddEvent(this, 6000 + RANDOM_RAND(2000), 3); + produce_animal_event = getEvMgr().AddEvent(this, 6000 + RANDOM_RAND(2000), 3); return; } @@ -148,7 +148,7 @@ void noTree::HandleEvent(const unsigned id) case State::GrowingWait: { // Der Baum hat gewartet, also wächst er jetzt - event = GetEvMgr().AddEvent(this, GROWING_LENGTH); + event = getEvMgr().AddEvent(this, GROWING_LENGTH); state = State::GrowingGrow; } break; @@ -158,7 +158,7 @@ void noTree::HandleEvent(const unsigned id) // wächst if(++size != 3) { - event = GetEvMgr().AddEvent(this, WAIT_LENGTH); + event = getEvMgr().AddEvent(this, WAIT_LENGTH); // Erstmal wieder bis zum nächsten Wachsstumsschub warten state = State::GrowingWait; } else @@ -174,33 +174,33 @@ void noTree::HandleEvent(const unsigned id) // Jetzt umfallen state = State::FallingFall; - event = GetEvMgr().AddEvent(this, 15); + event = getEvMgr().AddEvent(this, 15); } break; case State::FallingFall: { // Baum ist gefallen, nach bestimmer Zeit verschwinden state = State::FallingFallen; - event = GetEvMgr().AddEvent(this, 28); + event = getEvMgr().AddEvent(this, 28); } break; case State::FallingFallen: { // Baum verschwindet nun und es bleibt ein Baumstumpf zurück event = nullptr; - GetEvMgr().AddToKillList(this); + getEvMgr().AddToKillList(this); // Due to the "build headquarters" cheat, there could be an HQ in these directions. Replace stump with // extension which would have otherwise been placed in noBaseBuilding ctor. bool shouldPlaceStump = true; for(const Direction i : {Direction::East, Direction::SouthEast, Direction::SouthWest}) { - const noBase* neighborNo = world->GetNO(world->GetNeighbour(pos, i)); + const noBase* neighborNo = world->getNO(world->getNeighbour(pos, i)); - if(neighborNo->GetType() == NodalObjectType::Building - && static_cast(neighborNo)->GetBuildingType() == BuildingType::Headquarters) + if(neighborNo->getType() == NodalObjectType::Building + && static_cast(neighborNo)->getBuildingType() == BuildingType::Headquarters) { - world->SetNO(pos, new noExtension(this), true); + world->setNO(pos, new noExtension(this), true); shouldPlaceStump = false; break; } @@ -208,13 +208,13 @@ void noTree::HandleEvent(const unsigned id) if(shouldPlaceStump) { - world->SetNO(pos, new noDisappearingMapEnvObject(pos, 531), true); + world->setNO(pos, new noDisappearingMapEnvObject(pos, 531), true); world->RecalcBQAroundPoint(pos); } // Minimap Bescheid geben (Baum gefallen) - if(world->GetGameInterface()) - world->GetGameInterface()->GI_UpdateMinimap(pos); + if(world->getGameInterface()) + world->getGameInterface()->GI_UpdateMinimap(pos); } break; default: break; @@ -229,14 +229,14 @@ std::unique_ptr noTree::CreateFOWObject() const void noTree::FallSoon() { // Warten bis der Holzfäller fertig ist und der Baum dann umfällt - event = GetEvMgr().AddEvent(this, 105); + event = getEvMgr().AddEvent(this, 105); state = State::FallingWait; } void noTree::DontFall() { if(state == State::FallingWait) - GetEvMgr().RemoveEvent(event); + getEvMgr().RemoveEvent(event); } void noTree::ProduceAnimal() diff --git a/libs/s25main/nodeObjs/noTree.h b/libs/s25main/nodeObjs/noTree.h index 6f09a0dc18..66711fa902 100644 --- a/libs/s25main/nodeObjs/noTree.h +++ b/libs/s25main/nodeObjs/noTree.h @@ -73,20 +73,20 @@ class noTree : public noCoordBase void Destroy() override; void Serialize(SerializedGameData& sgd) const override; - GO_Type GetGOT() const final { return GO_Type::Tree; } + GO_Type getGOT() const final { return GO_Type::Tree; } void Draw(DrawPoint drawPt) override; void HandleEvent(unsigned id) override; - BlockingManner GetBM() const override { return BlockingManner::Tree; } + BlockingManner getBM() const override { return BlockingManner::Tree; } /// Erzeugt von ihnen selbst ein FOW Objekt als visuelle "Erinnerung" für den Fog of War std::unique_ptr CreateFOWObject() const override; /// Can this tree(type) produce wood? bool ProducesWood() const { return type != 5; } /// Return if this tree is fully grown - bool IsFullyGrown() const { return size == 3; } + bool isFullyGrown() const { return size == 3; } /// Vom Holzfäller aufgerufen: Wenn der Holzfäller anfängt und der Baum dann in einer bestimmten Zeit umfallen soll void FallSoon(); diff --git a/libs/s25main/notifications/NotificationManager_impl.h b/libs/s25main/notifications/NotificationManager_impl.h index 341089248b..4c850932f4 100644 --- a/libs/s25main/notifications/NotificationManager_impl.h +++ b/libs/s25main/notifications/NotificationManager_impl.h @@ -17,7 +17,7 @@ struct NotificationManager::NoteCallbackBase { NoteCallbackBase() noexcept : isSubscribed(true) {} - void SetUnsubscribed() noexcept { isSubscribed = false; } + void setUnsubscribed() noexcept { isSubscribed = false; } bool IsSubscribed() const noexcept { return isSubscribed; } private: @@ -43,7 +43,7 @@ inline NotificationManager::~NotificationManager() for(void* callback : subscribers.second.callbacks) { if(callback) - static_cast(callback)->SetUnsubscribed(); + static_cast(callback)->setUnsubscribed(); } } } @@ -83,7 +83,7 @@ void NotificationManager::unsubscribe(NoteCallback* callback) noexcept else callbacks.erase(itEl); // Set only the flag. Actual deletion of the callback must be handled by the shared_ptr deleter - callback->SetUnsubscribed(); + callback->setUnsubscribed(); } template diff --git a/libs/s25main/ogl/ITexture.h b/libs/s25main/ogl/ITexture.h index d914f40913..392316acb1 100644 --- a/libs/s25main/ogl/ITexture.h +++ b/libs/s25main/ogl/ITexture.h @@ -13,8 +13,8 @@ class ITexture virtual ~ITexture() = default; public: - virtual Position GetOrigin() const = 0; - virtual Extent GetSize() const = 0; + virtual Position getOrigin() const = 0; + virtual Extent getSize() const = 0; virtual void DrawFull(const Position& dstPos, unsigned color = 0xFFFFFFFFu) = 0; /// Draws portion of image specified by srcArea on area defined by dstArea. diff --git a/libs/s25main/ogl/MusicItem.cpp b/libs/s25main/ogl/MusicItem.cpp index 1224881c98..392f742377 100644 --- a/libs/s25main/ogl/MusicItem.cpp +++ b/libs/s25main/ogl/MusicItem.cpp @@ -10,5 +10,5 @@ void MusicItem::Play(int repeats) { if(!SETTINGS.sound.musicEnabled) return; - AUDIODRIVER.PlayMusic(GetSoundHandle(), repeats); + AUDIODRIVER.PlayMusic(getSoundHandle(), repeats); } diff --git a/libs/s25main/ogl/SoundEffectItem.cpp b/libs/s25main/ogl/SoundEffectItem.cpp index e9c00796c3..a74478396e 100644 --- a/libs/s25main/ogl/SoundEffectItem.cpp +++ b/libs/s25main/ogl/SoundEffectItem.cpp @@ -10,5 +10,5 @@ EffectPlayId SoundEffectItem::Play(uint8_t volume, bool loop) { if(!SETTINGS.sound.effectsEnabled) return EffectPlayId::Invalid; - return AUDIODRIVER.PlayEffect(GetSoundHandle(), volume, loop); + return AUDIODRIVER.PlayEffect(getSoundHandle(), volume, loop); } diff --git a/libs/s25main/ogl/SoundItem.h b/libs/s25main/ogl/SoundItem.h index 64c58a46ad..5bd4f84055 100644 --- a/libs/s25main/ogl/SoundItem.h +++ b/libs/s25main/ogl/SoundItem.h @@ -18,7 +18,7 @@ class SoundItem /// Load the sound item into the driver virtual SoundHandle Load() = 0; /// Return the handle loading it if required - SoundHandle& GetSoundHandle() + SoundHandle& getSoundHandle() { if(!handle) handle = Load(); diff --git a/libs/s25main/ogl/glArchivItem_Bitmap.cpp b/libs/s25main/ogl/glArchivItem_Bitmap.cpp index 86a50fd4fc..36b82b838a 100644 --- a/libs/s25main/ogl/glArchivItem_Bitmap.cpp +++ b/libs/s25main/ogl/glArchivItem_Bitmap.cpp @@ -19,7 +19,7 @@ glArchivItem_Bitmap::glArchivItem_Bitmap(const glArchivItem_Bitmap& item) */ void glArchivItem_Bitmap::Draw(Rect dstArea, Rect srcArea, unsigned color /*= COLOR_WHITE*/) { - if(GetTexture() == 0) + if(getTexture() == 0) return; RTTR_Assert(dstArea.getSize().x > 0 && dstArea.getSize().y > 0); @@ -42,15 +42,15 @@ void glArchivItem_Bitmap::Draw(Rect dstArea, Rect srcArea, unsigned color /*= CO std::array, 4> texCoords, vertices; - dstArea.move(-GetOrigin()); + dstArea.move(-getOrigin()); vertices[0].x = vertices[1].x = GLfloat(dstArea.left); vertices[2].x = vertices[3].x = GLfloat(dstArea.right); vertices[0].y = vertices[3].y = GLfloat(dstArea.top); vertices[1].y = vertices[2].y = GLfloat(dstArea.bottom); - Point srcOrig = Point(srcArea.getOrigin()) / GetTexSize(); - Point srcEndPt = Point(srcArea.getEndPt()) / GetTexSize(); + Point srcOrig = Point(srcArea.getOrigin()) / getTexSize(); + Point srcEndPt = Point(srcArea.getEndPt()) / getTexSize(); texCoords[0].x = texCoords[1].x = srcOrig.x; texCoords[2].x = texCoords[3].x = srcEndPt.x; texCoords[0].y = texCoords[3].y = srcOrig.y; @@ -58,19 +58,19 @@ void glArchivItem_Bitmap::Draw(Rect dstArea, Rect srcArea, unsigned color /*= CO glVertexPointer(2, GL_FLOAT, 0, vertices.data()); glTexCoordPointer(2, GL_FLOAT, 0, texCoords.data()); - VIDEODRIVER.BindTexture(GetTexture()); + VIDEODRIVER.BindTexture(getTexture()); glColor4ub(GetRed(color), GetGreen(color), GetBlue(color), GetAlpha(color)); glDrawArrays(GL_QUADS, 0, 4); } void glArchivItem_Bitmap::DrawFull(const Rect& destArea, unsigned color) { - Draw(destArea, Rect(Position(0, 0), GetSize()), color); + Draw(destArea, Rect(Position(0, 0), getSize()), color); } void glArchivItem_Bitmap::DrawFull(const DrawPoint& dstPos, unsigned color) { - DrawFull(Rect(dstPos, GetSize()), color); + DrawFull(Rect(dstPos, getSize()), color); } void glArchivItem_Bitmap::DrawPart(const Rect& destArea, const DrawPoint& offset, unsigned color) @@ -95,9 +95,9 @@ void glArchivItem_Bitmap::DrawPercent(const DrawPoint& dstPos, unsigned percent, void glArchivItem_Bitmap::FillTexture() { - int iformat = GetInternalFormat(), dformat = GL_BGRA; + int iformat = getInternalFormat(), dformat = GL_BGRA; - const Extent texSize = GetTexSize(); + const Extent texSize = getTexSize(); libsiedler2::PixelBufferBGRA buffer(texSize.x, texSize.y); print(buffer); glTexImage2D(GL_TEXTURE_2D, 0, iformat, texSize.x, texSize.y, 0, dformat, GL_UNSIGNED_BYTE, buffer.getPixelPtr()); @@ -105,5 +105,5 @@ void glArchivItem_Bitmap::FillTexture() Extent glArchivItem_Bitmap::CalcTextureSize() const { - return VIDEODRIVER.calcPreferredTextureSize(GetSize()); + return VIDEODRIVER.calcPreferredTextureSize(getSize()); } diff --git a/libs/s25main/ogl/glArchivItem_BitmapBase.cpp b/libs/s25main/ogl/glArchivItem_BitmapBase.cpp index a17663a133..de805c4493 100644 --- a/libs/s25main/ogl/glArchivItem_BitmapBase.cpp +++ b/libs/s25main/ogl/glArchivItem_BitmapBase.cpp @@ -32,7 +32,7 @@ glArchivItem_BitmapBase::~glArchivItem_BitmapBase() /** * Liefert das GL-Textur-Handle. */ -unsigned glArchivItem_BitmapBase::GetTexture() +unsigned glArchivItem_BitmapBase::getTexture() { if(texture == 0) GenerateTexture(); @@ -60,7 +60,7 @@ void glArchivItem_BitmapBase::setInterpolateTexture(bool interpolate) DeleteTexture(); } -Extent glArchivItem_BitmapBase::GetTexSize() const +Extent glArchivItem_BitmapBase::getTexSize() const { RTTR_Assert(texture); // Invalid if no texture exists return textureSize_; @@ -80,7 +80,7 @@ void glArchivItem_BitmapBase::GenerateTexture() return; if(!getPalette() && getFormat() == libsiedler2::TextureFormat::Paletted) - setPaletteCopy(*LOADER.GetPaletteN("pal5")); + setPaletteCopy(*LOADER.getPaletteN("pal5")); VIDEODRIVER.BindTexture(texture); @@ -91,7 +91,7 @@ void glArchivItem_BitmapBase::GenerateTexture() FillTexture(); } -int glArchivItem_BitmapBase::GetInternalFormat() const +int glArchivItem_BitmapBase::getInternalFormat() const { return GL_RGBA; } diff --git a/libs/s25main/ogl/glArchivItem_BitmapBase.h b/libs/s25main/ogl/glArchivItem_BitmapBase.h index 29dfbad7a7..4fc4e093ee 100644 --- a/libs/s25main/ogl/glArchivItem_BitmapBase.h +++ b/libs/s25main/ogl/glArchivItem_BitmapBase.h @@ -16,17 +16,17 @@ class glArchivItem_BitmapBase : public virtual libsiedler2::ArchivItem_BitmapBas ~glArchivItem_BitmapBase() override; /// liefert das GL-Textur-Handle. - unsigned GetTexture(); - unsigned GetTextureNoCreate() const { return texture; } + unsigned getTexture(); + unsigned getTextureNoCreate() const { return texture; } /// Löscht die GL-Textur (z.B fürs Neuerstellen) void DeleteTexture(); /// Setzt den Texturfilter auf einen bestimmten Wert. virtual void setInterpolateTexture(bool interpolate); /// Return the "Null point" - DrawPoint GetOrigin() const override { return DrawPoint(nx_, ny_); } - Extent GetSize() const override { return Extent(getWidth(), getHeight()); } - Extent GetTexSize() const; + DrawPoint getOrigin() const override { return DrawPoint(nx_, ny_); } + Extent getSize() const override { return Extent(getWidth(), getHeight()); } + Extent getTexSize() const; private: /// Erzeugt die Textur. @@ -38,11 +38,11 @@ class glArchivItem_BitmapBase : public virtual libsiedler2::ArchivItem_BitmapBas protected: /// Returns the internal texure format - int GetInternalFormat() const; + int getInternalFormat() const; /// Fill a just generated texture (glTexImage2D calls) virtual void FillTexture() = 0; /// Calculate the actual texture size virtual Extent CalcTextureSize() const = 0; /// Returns the currently set texture or 0 if none created - unsigned GetTexNoCreate() const { return texture; } + unsigned getTexNoCreate() const { return texture; } }; diff --git a/libs/s25main/ogl/glArchivItem_Bitmap_Direct.cpp b/libs/s25main/ogl/glArchivItem_Bitmap_Direct.cpp index 4ad5bc8a91..394588d5ec 100644 --- a/libs/s25main/ogl/glArchivItem_Bitmap_Direct.cpp +++ b/libs/s25main/ogl/glArchivItem_Bitmap_Direct.cpp @@ -28,14 +28,14 @@ void glArchivItem_Bitmap_Direct::endUpdate() throw std::logic_error("Already updating! Forgot an endUpdate?"); isUpdating_ = false; // Nothing to update or no texture created yet - if(prodOfComponents(areaToUpdate_.getSize()) == 0 || !GetTexNoCreate()) + if(prodOfComponents(areaToUpdate_.getSize()) == 0 || !getTexNoCreate()) return; libsiedler2::PixelBufferBGRA buffer(areaToUpdate_.getSize().x, areaToUpdate_.getSize().y); Position origin = areaToUpdate_.getOrigin(); int ec = print(buffer, nullptr, 0, 0, origin.x, origin.y); RTTR_Assert(ec == 0); - VIDEODRIVER.BindTexture(GetTexNoCreate()); + VIDEODRIVER.BindTexture(getTexNoCreate()); glTexSubImage2D(GL_TEXTURE_2D, 0, origin.x, origin.y, buffer.getWidth(), buffer.getHeight(), GL_BGRA, GL_UNSIGNED_BYTE, buffer.getPixelPtr()); } @@ -44,7 +44,7 @@ void glArchivItem_Bitmap_Direct::updatePixel(const DrawPoint& pos, const libsied { RTTR_Assert(isUpdating_); RTTR_Assert(pos.x >= 0 && pos.y >= 0); - RTTR_Assert(static_cast(pos.x) < GetSize().x && static_cast(pos.y) < GetSize().y); + RTTR_Assert(static_cast(pos.x) < getSize().x && static_cast(pos.y) < getSize().y); setPixel(pos.x, pos.y, clr); // If the area is empty, create one if(areaToUpdate_.getSize().x == 0) diff --git a/libs/s25main/ogl/glArchivItem_Bitmap_Player.cpp b/libs/s25main/ogl/glArchivItem_Bitmap_Player.cpp index f064e28a94..c617e666eb 100644 --- a/libs/s25main/ogl/glArchivItem_Bitmap_Player.cpp +++ b/libs/s25main/ogl/glArchivItem_Bitmap_Player.cpp @@ -19,17 +19,17 @@ struct GL_RGBAColor Extent glArchivItem_Bitmap_Player::CalcTextureSize() const { // We have the texture 2 times: one with non-player colors and one with them - return VIDEODRIVER.calcPreferredTextureSize(Extent(GetSize().x * 2, GetSize().y)); + return VIDEODRIVER.calcPreferredTextureSize(Extent(getSize().x * 2, getSize().y)); } void glArchivItem_Bitmap_Player::DrawFull(const Rect& destArea, unsigned color, unsigned player_color) { - Draw(destArea, Rect(Position::all(0), GetSize()), color, player_color); + Draw(destArea, Rect(Position::all(0), getSize()), color, player_color); } void glArchivItem_Bitmap_Player::DrawFull(const DrawPoint& dst, unsigned color, unsigned player_color) { - DrawFull(Rect(dst, GetSize()), color, player_color); + DrawFull(Rect(dst, getSize()), color, player_color); } void glArchivItem_Bitmap_Player::DrawFull(const Position& dstPos, unsigned color) @@ -50,7 +50,7 @@ void glArchivItem_Bitmap_Player::Draw(Rect dstArea, Rect srcArea, unsigned color void glArchivItem_Bitmap_Player::Draw(Rect dstArea, Rect srcArea, unsigned color /*= COLOR_WHITE*/, unsigned player_color /*= COLOR_WHITE*/) { - if(GetTexture() == 0) + if(getTexture() == 0) return; RTTR_Assert(dstArea.getSize().x > 0 && dstArea.getSize().y > 0); @@ -71,15 +71,15 @@ void glArchivItem_Bitmap_Player::Draw(Rect dstArea, Rect srcArea, unsigned color std::array, 8> texCoords, vertices; - dstArea.move(-GetOrigin()); + dstArea.move(-getOrigin()); vertices[0].x = vertices[1].x = GLfloat(dstArea.left); vertices[2].x = vertices[3].x = GLfloat(dstArea.right); vertices[0].y = vertices[3].y = GLfloat(dstArea.top); vertices[1].y = vertices[2].y = GLfloat(dstArea.bottom); - Point srcOrig = Point(srcArea.getOrigin()) / GetTexSize(); - Point srcEndPt = Point(srcArea.getEndPt()) / GetTexSize(); + Point srcOrig = Point(srcArea.getOrigin()) / getTexSize(); + Point srcEndPt = Point(srcArea.getEndPt()) / getTexSize(); texCoords[0].x = texCoords[1].x = srcOrig.x; texCoords[2].x = texCoords[3].x = srcEndPt.x; texCoords[0].y = texCoords[3].y = srcOrig.y; @@ -110,7 +110,7 @@ void glArchivItem_Bitmap_Player::Draw(Rect dstArea, Rect srcArea, unsigned color glVertexPointer(2, GL_FLOAT, 0, vertices.data()); glTexCoordPointer(2, GL_FLOAT, 0, texCoords.data()); glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors.data()); - VIDEODRIVER.BindTexture(GetTexture()); + VIDEODRIVER.BindTexture(getTexture()); glDrawArrays(GL_QUADS, 0, 8); glDisableClientState(GL_COLOR_ARRAY); } @@ -119,11 +119,11 @@ void glArchivItem_Bitmap_Player::FillTexture() { // Spezialpalette (blaue Spielerfarben sind Grau) verwenden, // damit man per OpenGL einfärben kann! - const libsiedler2::ArchivItem_Palette* palette = LOADER.GetPaletteN("colors"); + const libsiedler2::ArchivItem_Palette* palette = LOADER.getPaletteN("colors"); - int iformat = GetInternalFormat(), dformat = GL_BGRA; // GL_BGRA_EXT; + int iformat = getInternalFormat(), dformat = GL_BGRA; // GL_BGRA_EXT; - Extent texSize = GetTexSize(); + Extent texSize = getTexSize(); libsiedler2::PixelBufferBGRA buffer(texSize.x, texSize.y); print(buffer, palette, 128, 0, 0, 0, 0, 0, 0, false); diff --git a/libs/s25main/ogl/glFont.cpp b/libs/s25main/ogl/glFont.cpp index 9fcce96f5e..f4721eed61 100644 --- a/libs/s25main/ogl/glFont.cpp +++ b/libs/s25main/ogl/glFont.cpp @@ -49,7 +49,7 @@ glFont::glFont(const libsiedler2::ArchivItem_Font& font) : maxCharSize(font.getD libsiedler2::PixelBufferBGRA bufferWithOutline(texSize.x, texSize.y); libsiedler2::PixelBufferBGRA bufferNoOutline(texSize.x, texSize.y); - const libsiedler2::ArchivItem_Palette* const palette = LOADER.GetPaletteN("colors"); + const libsiedler2::ArchivItem_Palette* const palette = LOADER.getPaletteN("colors"); Position curPos(spacing); numChars = 0; for(unsigned i = 0; i < font.size(); ++i) @@ -80,9 +80,9 @@ glFont::glFont(const libsiedler2::ArchivItem_Font& font) : maxCharSize(font.getD // Set the placeholder for non-existent glyphs. Use '?' (should always be possible) if(CharExist(0xFFFD)) - placeHolder = GetCharInfo(0xFFFD); + placeHolder = getCharInfo(0xFFFD); else if(CharExist('?')) - placeHolder = GetCharInfo('?'); + placeHolder = getCharInfo('?'); else throw std::runtime_error("Cannot find '?' glyph in font. What shall I use as fallback?"); @@ -103,7 +103,7 @@ bool glFont::CharExist(char32_t c) const return helpers::contains(utf8_mapping, c); } -const glFont::CharInfo& glFont::GetCharInfo(char32_t c) const +const glFont::CharInfo& glFont::getCharInfo(char32_t c) const { if(c < asciiMapping.size()) { @@ -131,7 +131,7 @@ void glFont::AddCharInfo(char32_t c, const CharInfo& info) */ inline void glFont::DrawChar(char32_t curChar, VertexArrays& vertices, DrawPoint& curPos) const { - CharInfo ci = GetCharInfo(curChar); + CharInfo ci = getCharInfo(curChar); GlPoint texCoord1(ci.pos); GlPoint texCoord2(ci.pos + DrawPoint(ci.width, maxCharSize.y)); @@ -239,10 +239,10 @@ void glFont::Draw(DrawPoint pos, const std::string& text, FontStyle format, unsi // Get texture first as it might need to be created glArchivItem_Bitmap& usedFont = format.is(FontStyle::NO_OUTLINE) ? *fontNoOutline : *fontWithOutline; - unsigned texture = usedFont.GetTexture(); + unsigned texture = usedFont.getTexture(); if(!texture) return; - const GlPoint texSize(usedFont.GetTexSize()); + const GlPoint texSize(usedFont.getTexSize()); RTTR_Assert(texList.texCoords.size() == texList.vertices.size()); RTTR_Assert(texList.texCoords.size() % 4u == 0); for(GlPoint& pt : texList.texCoords) @@ -326,7 +326,7 @@ std::vector glFont::WrapInfo::CreateSingleStrings(const std::string * @param[in] primary_width Maximale Breite der ersten Zeile * @param[in] secondary_width Maximale Breite der weiteren Zeilen */ -glFont::WrapInfo glFont::GetWrapInfo(const std::string& text, const unsigned short primary_width, +glFont::WrapInfo glFont::getWrapInfo(const std::string& text, const unsigned short primary_width, const unsigned short secondary_width) const { RTTR_Assert(s25util::isValidUTF8(text)); // Can only handle UTF-8 strings! diff --git a/libs/s25main/ogl/glFont.h b/libs/s25main/ogl/glFont.h index f79c08ced3..3ac5efc952 100644 --- a/libs/s25main/ogl/glFont.h +++ b/libs/s25main/ogl/glFont.h @@ -60,12 +60,12 @@ class glFont /// Gibt Infos, über die Unterbrechungspunkte in einem Text, versucht Wörter nicht zu trennen, tut dies aber, falls /// es unumgänglich ist (Wort länger als die Zeile) - WrapInfo GetWrapInfo(const std::string& text, unsigned short primary_width, unsigned short secondary_width) const; + WrapInfo getWrapInfo(const std::string& text, unsigned short primary_width, unsigned short secondary_width) const; /// prüft ob ein Buchstabe existiert. bool CharExist(char32_t c) const; /// liefert die Breite eines Zeichens - unsigned CharWidth(char32_t c) const { return GetCharInfo(c).width; } + unsigned CharWidth(char32_t c) const { return getCharInfo(c).width; } private: struct CharInfo @@ -84,7 +84,7 @@ class glFont void AddCharInfo(char32_t c, const CharInfo& info); /// liefert das Char-Info eines Zeichens - const CharInfo& GetCharInfo(char32_t c) const; + const CharInfo& getCharInfo(char32_t c) const; void DrawChar(char32_t curChar, VertexArrays& vertices, DrawPoint& curPos) const; Extent maxCharSize; // How big each char is at most (aka dx,dy) diff --git a/libs/s25main/ogl/glSmartBitmap.cpp b/libs/s25main/ogl/glSmartBitmap.cpp index 9757da4a9f..ff73b7a058 100644 --- a/libs/s25main/ogl/glSmartBitmap.cpp +++ b/libs/s25main/ogl/glSmartBitmap.cpp @@ -111,8 +111,8 @@ void glSmartBitmap::calcDimensions() void glSmartBitmap::drawTo(libsiedler2::PixelBufferBGRA& buffer, const Extent& bufOffset) const { - libsiedler2::ArchivItem_Palette* p_colors = LOADER.GetPaletteN("colors"); - libsiedler2::ArchivItem_Palette* p_5 = LOADER.GetPaletteN("pal5"); + libsiedler2::ArchivItem_Palette* p_colors = LOADER.getPaletteN("colors"); + libsiedler2::ArchivItem_Palette* p_5 = LOADER.getPaletteN("pal5"); for(const glBitmapItem& bmpItem : items) { diff --git a/libs/s25main/ogl/glSmartBitmap.h b/libs/s25main/ogl/glSmartBitmap.h index 40a765eb22..e978609307 100644 --- a/libs/s25main/ogl/glSmartBitmap.h +++ b/libs/s25main/ogl/glSmartBitmap.h @@ -41,8 +41,8 @@ class glSmartBitmap : public ITexture ~glSmartBitmap(); void reset(); - Position GetOrigin() const override { return origin_; } - Extent GetSize() const override { return size_; } + Position getOrigin() const override { return origin_; } + Extent getSize() const override { return size_; } /// Return the space required on the texture Extent getRequiredTexSize() const; diff --git a/libs/s25main/pathfinding/FindPathForRoad.cpp b/libs/s25main/pathfinding/FindPathForRoad.cpp index 301ecf6b4a..6f5ceb207a 100644 --- a/libs/s25main/pathfinding/FindPathForRoad.cpp +++ b/libs/s25main/pathfinding/FindPathForRoad.cpp @@ -17,7 +17,7 @@ struct GetWorld template<> struct GetWorld { - static const GameWorldBase& get(const GameWorldViewer& gwv) { return gwv.GetWorld(); } + static const GameWorldBase& get(const GameWorldViewer& gwv) { return gwv.getWorld(); } }; template @@ -35,7 +35,7 @@ std::vector FindPathForRoad(const T_WorldOrViewer& world, const MapPo { RTTR_Assert(startPt != endPt); std::vector road; - getWorld(world).GetFreePathFinder().FindPath(startPt, endPt, false, maxLen, &road, nullptr, nullptr, + getWorld(world).getFreePathFinder().FindPath(startPt, endPt, false, maxLen, &road, nullptr, nullptr, makePathConditionRoad(world, isBoatRoad)); return road; } diff --git a/libs/s25main/pathfinding/FindPathReachable.cpp b/libs/s25main/pathfinding/FindPathReachable.cpp index cebdf0af2f..7358a82b47 100644 --- a/libs/s25main/pathfinding/FindPathReachable.cpp +++ b/libs/s25main/pathfinding/FindPathReachable.cpp @@ -16,13 +16,13 @@ struct PathConditionReachableWithStaticBlockers : PathConditionReachable { PathConditionReachableWithStaticBlockers(const World& world) : PathConditionReachable(world) {} - BOOST_FORCEINLINE bool IsNodeOk(const MapPoint& pt) const + BOOST_FORCEINLINE bool isNodeOk(const MapPoint& pt) const { - const auto* obj = world.GetNode(pt).obj; - if(obj && obj->GetGOT() == GO_Type::Staticobject && obj->GetBM() != BlockingManner::None) + const auto* obj = world.getNode(pt).obj; + if(obj && obj->getGOT() == GO_Type::Staticobject && obj->getBM() != BlockingManner::None) return false; - return PathConditionReachable::IsNodeOk(pt); + return PathConditionReachable::isNodeOk(pt); } }; @@ -31,6 +31,6 @@ struct PathConditionReachableWithStaticBlockers : PathConditionReachable bool DoesReachablePathExist(const GameWorldBase& world, const MapPoint startPt, const MapPoint endPt, unsigned maxLen) { RTTR_Assert(startPt != endPt); - return world.GetFreePathFinder().FindPath(startPt, endPt, false, maxLen, nullptr, nullptr, nullptr, + return world.getFreePathFinder().FindPath(startPt, endPt, false, maxLen, nullptr, nullptr, nullptr, PathConditionReachableWithStaticBlockers(world)); } diff --git a/libs/s25main/pathfinding/FreePathFinder.cpp b/libs/s25main/pathfinding/FreePathFinder.cpp index af7c9c8b3f..789e9cf9f7 100644 --- a/libs/s25main/pathfinding/FreePathFinder.cpp +++ b/libs/s25main/pathfinding/FreePathFinder.cpp @@ -32,7 +32,7 @@ void FreePathFinder::Init(const MapExtent& mapSize) fpNodes.resize(nodes.size()); RTTR_FOREACH_PT(MapPoint, size_) { - const unsigned idx = gwb_.GetIdx(pt); + const unsigned idx = gwb_.getIdx(pt); nodes[idx].mapPt = pt; fpNodes[idx].lastVisited = 0; fpNodes[idx].mapPt = pt; @@ -71,7 +71,7 @@ bool FreePathFinder::FindPathAlternatingConditions(const MapPoint start, const M RTTR_Assert(false); LOG.write("WARNING: Bug detected (GF: %u). Please report this with the savegame and replay (Start==Dest in " "pathfinding %u,%u)\n") - % gwb_.GetEvMgr().GetCurrentGF() % unsigned(start.x) % unsigned(start.y); + % gwb_.getEvMgr().getCurrentGF() % unsigned(start.x) % unsigned(start.y); // But for now we assume it to be valid and return (kind of) correct values if(route) route->clear(); @@ -86,13 +86,13 @@ bool FreePathFinder::FindPathAlternatingConditions(const MapPoint start, const M IncreaseCurrentVisit(); std::list todo; - const unsigned destId = gwb_.GetIdx(dest); + const unsigned destId = gwb_.getIdx(dest); bool prevStepEven = true; // flips between even and odd unsigned stepsTilSwitch = 1; // Add start node - unsigned startId = gwb_.GetIdx(start); + unsigned startId = gwb_.getIdx(start); todo.push_back(PathfindingPoint(startId, gwb_.CalcDistance(start, dest), 0)); // And init it nodes[startId].prevEven = INVALID_PREV; @@ -102,7 +102,7 @@ bool FreePathFinder::FindPathAlternatingConditions(const MapPoint start, const M // Start at random dir (so different jobs may use different roads) const Direction startDir = - randomRoute ? convertToDirection(gwb_.GetIdx(start) * gwb_.GetEvMgr().GetCurrentGF()) : Direction::West; + randomRoute ? convertToDirection(gwb_.getIdx(start) * gwb_.getEvMgr().getCurrentGF()) : Direction::West; while(!todo.empty()) { @@ -170,10 +170,10 @@ bool FreePathFinder::FindPathAlternatingConditions(const MapPoint start, const M for(const auto dir : helpers::enumRange(startDir)) { // Koordinaten des entsprechenden umliegenden Punktes bilden - MapPoint neighbourPos = gwb_.GetNeighbour(nodes[bestId].mapPt, dir); + MapPoint neighbourPos = gwb_.getNeighbour(nodes[bestId].mapPt, dir); // ID des umliegenden Knotens bilden - unsigned nbId = gwb_.GetIdx(neighbourPos); + unsigned nbId = gwb_.getIdx(neighbourPos); // Knoten schon auf dem Feld gebildet ? if((prevStepEven && nodes[nbId].lastVisited == currentVisit) @@ -202,7 +202,7 @@ bool FreePathFinder::FindPathAlternatingConditions(const MapPoint start, const M i--) // backtrack the plannend route and check if another "even" position is too close { Direction pdir = alternate ? nodes[back_id].dirEven : nodes[back_id].dir; - p = gwb_.GetNeighbour(p, pdir + 3u); + p = gwb_.getNeighbour(p, pdir + 3u); if(i % 2 == 0) // even step { evenLocationsOnRoute.push_back(p); diff --git a/libs/s25main/pathfinding/FreePathFinderImpl.h b/libs/s25main/pathfinding/FreePathFinderImpl.h index 9e9090df78..eab268f079 100644 --- a/libs/s25main/pathfinding/FreePathFinderImpl.h +++ b/libs/s25main/pathfinding/FreePathFinderImpl.h @@ -48,8 +48,8 @@ bool FreePathFinder::FindPath(const MapPoint start, const MapPoint dest, bool ra IncreaseCurrentVisit(); QueueImpl todo; - const unsigned startId = gwb_.GetIdx(start); - const unsigned destId = gwb_.GetIdx(dest); + const unsigned startId = gwb_.getIdx(start); + const unsigned destId = gwb_.getIdx(dest); FreePathNode& startNode = fpNodes[startId]; FreePathNode& destNode = fpNodes[destId]; @@ -65,7 +65,7 @@ bool FreePathFinder::FindPath(const MapPoint start, const MapPoint dest, bool ra // Bei Zufälliger Richtung anfangen (damit man nicht immer denselben Weg geht, besonders für die Soldaten wichtig) // TODO confirm random: RANDOM.Rand(__FILE__, __LINE__, y_start * GetWidth() + x_start, 6); const Direction startDir = - randomRoute ? convertToDirection(gwb_.GetIdx(start) * gwb_.GetEvMgr().GetCurrentGF()) : Direction::West; + randomRoute ? convertToDirection(gwb_.getIdx(start) * gwb_.getEvMgr().getCurrentGF()) : Direction::West; while(!todo.empty()) { @@ -104,14 +104,14 @@ bool FreePathFinder::FindPath(const MapPoint start, const MapPoint dest, bool ra continue; // Knoten in alle 6 Richtungen bilden - const auto neighbors = gwb_.GetNeighbours(best.mapPt); + const auto neighbors = gwb_.getNeighbours(best.mapPt); for(const Direction dir : helpers::enumRange(startDir)) { // Koordinaten des entsprechenden umliegenden Punktes bilden MapPoint neighbourPos = neighbors[dir]; // ID des umliegenden Knotens bilden - unsigned nbId = gwb_.GetIdx(neighbourPos); + unsigned nbId = gwb_.getIdx(neighbourPos); FreePathNode& neighbour = fpNodes[nbId]; // Don't try to go back where we came from (would also bail out in the conditions below) @@ -125,7 +125,7 @@ bool FreePathFinder::FindPath(const MapPoint start, const MapPoint dest, bool ra if(best.curDistance + 1 < neighbour.curDistance) { // Check if we can use this transition - if(!nodeChecker.IsEdgeOk(best.mapPt, dir)) + if(!nodeChecker.isEdgeOk(best.mapPt, dir)) continue; neighbour.curDistance = best.curDistance + 1; @@ -139,12 +139,12 @@ bool FreePathFinder::FindPath(const MapPoint start, const MapPoint dest, bool ra // Check node for all but the goal (goal is assumed to be ok) if(&neighbour != &destNode) { - if(!nodeChecker.IsNodeOk(neighbourPos)) + if(!nodeChecker.isNodeOk(neighbourPos)) continue; } // Check if we can use this transition - if(!nodeChecker.IsEdgeOk(best.mapPt, dir)) + if(!nodeChecker.isEdgeOk(best.mapPt, dir)) continue; // Alles in Ordnung, Knoten kann gebildet werden @@ -176,19 +176,19 @@ bool FreePathFinder::CheckRoute(const MapPoint start, const std::vector(el)->pos; } - key_type GetKey(T* el) const { return T_GetKey::operator()(*el); } - key_type GetKey(size_type idx) const { return GetKey(this->elements[idx].el); } + static size_type& getPos(T* el) { return static_cast(el)->pos; } + key_type getKey(T* el) const { return T_GetKey::operator()(*el); } + key_type getKey(size_type idx) const { return getKey(this->elements[idx].el); } boost::container::small_vector elements; }; @@ -88,9 +88,9 @@ bool OpenListBinaryHeap::isHeap() const const size_type left = LeftChildPos(i); const size_type right = RightChildPos(i); // If child exist, parent must be "less" than child - if(left < size && GetKey(left) < GetKey(i)) + if(left < size && getKey(left) < getKey(i)) return false; - if(right < size && GetKey(right) < GetKey(i)) + if(right < size && getKey(right) < getKey(i)) return false; } return true; @@ -101,7 +101,7 @@ bool OpenListBinaryHeap::arePositionsValid() const { for(size_type i = 0; i < this->size(); i++) { - if(i != GetPos(this->elements[i].el)) + if(i != getPos(this->elements[i].el)) return false; } return true; @@ -118,16 +118,16 @@ template inline void OpenListBinaryHeap::push(T* newEl) { RTTR_VALIDATE_HEAP(); - GetPos(newEl) = this->size(); - this->elements.push_back(Element(GetKey(newEl), newEl)); + getPos(newEl) = this->size(); + this->elements.push_back(Element(getKey(newEl), newEl)); decreasedKey(newEl); } template inline void OpenListBinaryHeap::decreasedKey(T* el) { - size_type i = GetPos(el); - unsigned elVal = this->elements[i].key = GetKey(el); + size_type i = getPos(el); + unsigned elVal = this->elements[i].key = getKey(el); RTTR_Assert(i < this->size()); while(i > 0) { @@ -135,11 +135,11 @@ inline void OpenListBinaryHeap::decreasedKey(T* el) if(elVal >= this->elements[parentPos].key) break; using std::swap; - GetPos(this->elements[parentPos].el) = i; + getPos(this->elements[parentPos].el) = i; swap(this->elements[parentPos], this->elements[i]); i = parentPos; } - GetPos(el) = i; + getPos(el) = i; RTTR_VALIDATE_HEAP(); } @@ -180,7 +180,7 @@ inline T* OpenListBinaryHeap::pop() if(right >= size || leftVal < this->elements[right].key) // left < right { this->elements[i] = this->elements[left]; - GetPos(this->elements[i].el) = i; + getPos(this->elements[i].el) = i; i = left; continue; } @@ -189,14 +189,14 @@ inline T* OpenListBinaryHeap::pop() if(right < size && this->elements[right].key < el.key) // right < i { this->elements[i] = this->elements[right]; - GetPos(this->elements[i].el) = i; + getPos(this->elements[i].el) = i; i = right; } else break; } while(true); this->elements[i] = el; - GetPos(el.el) = i; + getPos(el.el) = i; return result; } diff --git a/libs/s25main/pathfinding/OpenListVector.h b/libs/s25main/pathfinding/OpenListVector.h index fc4b2c5923..83caf4e887 100644 --- a/libs/s25main/pathfinding/OpenListVector.h +++ b/libs/s25main/pathfinding/OpenListVector.h @@ -9,7 +9,7 @@ struct GetEstimateFromPtr { template - static unsigned GetValue(T* el) + static unsigned getValue(T* el) { return el->estimate; } @@ -37,14 +37,14 @@ class OpenListVector return best; } int bestIdx = 0; - unsigned bestEstimate = T_GetOrderValue::GetValue(elements.front()); + unsigned bestEstimate = T_GetOrderValue::getValue(elements.front()); for(int i = 1; i < size; i++) { // Note that this check does not consider nodes with the same value // However this is a) correct (same estimate = same quality so no preference from the algorithm) // and b) still fully deterministic as the entries are NOT sorted and the insertion-extraction-pattern // is completely pre-determined by the graph-structur - const unsigned estimate = T_GetOrderValue::GetValue(elements[i]); + const unsigned estimate = T_GetOrderValue::getValue(elements[i]); if(estimate < bestEstimate) { bestEstimate = estimate; diff --git a/libs/s25main/pathfinding/PathConditionHuman.h b/libs/s25main/pathfinding/PathConditionHuman.h index 496c7debb0..1ea3f01ff4 100644 --- a/libs/s25main/pathfinding/PathConditionHuman.h +++ b/libs/s25main/pathfinding/PathConditionHuman.h @@ -16,28 +16,28 @@ struct PathConditionHuman : PathConditionReachable PathConditionHuman(const World& world) : PathConditionReachable(world) {} // Called for every node but the start & goal and should return true, if this point is usable - BOOST_FORCEINLINE bool IsNodeOk(const MapPoint& pt) const + BOOST_FORCEINLINE bool isNodeOk(const MapPoint& pt) const { // Node blocked -> Can't go there - const auto* no = world.GetNode(pt).obj; - const BlockingManner bm = no ? no->GetBM() : BlockingManner::None; + const auto* no = world.getNode(pt).obj; + const BlockingManner bm = no ? no->getBM() : BlockingManner::None; if(bm != BlockingManner::None && bm != BlockingManner::Tree && bm != BlockingManner::Flag) return false; - return PathConditionReachable::IsNodeOk(pt); + return PathConditionReachable::isNodeOk(pt); } // Called for every node - BOOST_FORCEINLINE bool IsEdgeOk(const MapPoint& fromPt, const Direction dir) const + BOOST_FORCEINLINE bool isEdgeOk(const MapPoint& fromPt, const Direction dir) const { // If there is a road (but no boat road) we can pass - const PointRoad road = world.GetPointRoad(fromPt, dir); + const PointRoad road = world.getPointRoad(fromPt, dir); if(road != PointRoad::None && road != PointRoad::Boat) return true; // Check terrain for node transition - const auto terrains = world.GetTerrain(fromPt, dir); - const TerrainDesc& tLeft = world.GetDescription().get(terrains.left); - const TerrainDesc& tRight = world.GetDescription().get(terrains.right); + const auto terrains = world.getTerrain(fromPt, dir); + const TerrainDesc& tLeft = world.getDescription().get(terrains.left); + const TerrainDesc& tRight = world.getDescription().get(terrains.right); // Don't go next to danger terrain if(tLeft.Is(ETerrain::Unreachable) || tRight.Is(ETerrain::Unreachable)) return false; diff --git a/libs/s25main/pathfinding/PathConditionReachable.h b/libs/s25main/pathfinding/PathConditionReachable.h index 958ad60916..d9398dc4a6 100644 --- a/libs/s25main/pathfinding/PathConditionReachable.h +++ b/libs/s25main/pathfinding/PathConditionReachable.h @@ -13,12 +13,12 @@ struct PathConditionReachable PathConditionReachable(const World& world) : world(world) {} // Called for every node but the start & goal and should return true, if this point is usable - BOOST_FORCEINLINE bool IsNodeOk(const MapPoint& pt) const + BOOST_FORCEINLINE bool isNodeOk(const MapPoint& pt) const { bool goodTerrainFound = false; - for(const DescIdx tIdx : world.GetTerrainsAround(pt)) + for(const DescIdx tIdx : world.getTerrainsAround(pt)) { - const TerrainDesc& t = world.GetDescription().get(tIdx); + const TerrainDesc& t = world.getDescription().get(tIdx); if(t.Is(ETerrain::Unreachable)) return false; else if(t.Is(ETerrain::Walkable)) @@ -27,12 +27,12 @@ struct PathConditionReachable return goodTerrainFound; } // Called for every node - BOOST_FORCEINLINE bool IsEdgeOk(const MapPoint& fromPt, const Direction dir) const + BOOST_FORCEINLINE bool isEdgeOk(const MapPoint& fromPt, const Direction dir) const { // Check terrain for node transition - const auto terrains = world.GetTerrain(fromPt, dir); - const TerrainDesc& tLeft = world.GetDescription().get(terrains.left); - const TerrainDesc& tRight = world.GetDescription().get(terrains.right); + const auto terrains = world.getTerrain(fromPt, dir); + const TerrainDesc& tLeft = world.getDescription().get(terrains.left); + const TerrainDesc& tRight = world.getDescription().get(terrains.right); // Don't go next to danger terrain return !tLeft.Is(ETerrain::Unreachable) && !tRight.Is(ETerrain::Unreachable); } diff --git a/libs/s25main/pathfinding/PathConditionRoad.h b/libs/s25main/pathfinding/PathConditionRoad.h index d5e7c79e27..276cf12d76 100644 --- a/libs/s25main/pathfinding/PathConditionRoad.h +++ b/libs/s25main/pathfinding/PathConditionRoad.h @@ -17,13 +17,13 @@ struct PathConditionRoad {} // Called for every node but the start & goal and should return true, if this point is usable - BOOST_FORCEINLINE bool IsNodeOk(const MapPoint& pt) const + BOOST_FORCEINLINE bool isNodeOk(const MapPoint& pt) const { - return worldOrViewer.IsPlayerTerritory(pt) && worldOrViewer.IsRoadAvailable(isBoatRoad, pt); + return worldOrViewer.isPlayerTerritory(pt) && worldOrViewer.isRoadAvailable(isBoatRoad, pt); } // Called for every edge (node to other node) - BOOST_FORCEINLINE bool IsEdgeOk(const MapPoint& /*fromPt*/, const Direction /*dir*/) const { return true; } + BOOST_FORCEINLINE bool isEdgeOk(const MapPoint& /*fromPt*/, const Direction /*dir*/) const { return true; } }; template diff --git a/libs/s25main/pathfinding/PathConditionShip.h b/libs/s25main/pathfinding/PathConditionShip.h index 737dc9eaea..446d4e4d76 100644 --- a/libs/s25main/pathfinding/PathConditionShip.h +++ b/libs/s25main/pathfinding/PathConditionShip.h @@ -15,15 +15,15 @@ struct PathConditionShip PathConditionShip(const World& world) : world(world) {} // Called for every node but the start & goal and should return true, if this point is usable - BOOST_FORCEINLINE bool IsNodeOk(const MapPoint& pt) const { return world.IsSeaPoint(pt); } + BOOST_FORCEINLINE bool isNodeOk(const MapPoint& pt) const { return world.isSeaPoint(pt); } // Called for every node - BOOST_FORCEINLINE bool IsEdgeOk(const MapPoint& fromPt, const Direction dir) const + BOOST_FORCEINLINE bool isEdgeOk(const MapPoint& fromPt, const Direction dir) const { // We must have shippable water on both sides - const auto terrains = world.GetTerrain(fromPt, dir); - const TerrainDesc& tLeft = world.GetDescription().get(terrains.left); - const TerrainDesc& tRight = world.GetDescription().get(terrains.right); + const auto terrains = world.getTerrain(fromPt, dir); + const TerrainDesc& tLeft = world.getDescription().get(terrains.left); + const TerrainDesc& tRight = world.getDescription().get(terrains.right); return tLeft.Is(ETerrain::Shippable) && tRight.Is(ETerrain::Shippable); } }; diff --git a/libs/s25main/pathfinding/PathConditionTrade.h b/libs/s25main/pathfinding/PathConditionTrade.h index 7f0aeff3a0..162c261546 100644 --- a/libs/s25main/pathfinding/PathConditionTrade.h +++ b/libs/s25main/pathfinding/PathConditionTrade.h @@ -14,17 +14,17 @@ struct PathConditionTrade : public PathConditionHuman const GamePlayer& player; PathConditionTrade(const GameWorldBase& gwb, unsigned char player) - : PathConditionHuman(gwb), player(gwb.GetPlayer(player)) + : PathConditionHuman(gwb), player(gwb.getPlayer(player)) {} // Called for every node but the start & goal and should return true, if this point is usable - BOOST_FORCEINLINE bool IsNodeOk(const MapPoint& pt) const + BOOST_FORCEINLINE bool isNodeOk(const MapPoint& pt) const { - if(!PathConditionHuman::IsNodeOk(pt)) + if(!PathConditionHuman::isNodeOk(pt)) return false; - unsigned char owner = world.GetNode(pt).owner; + unsigned char owner = world.getNode(pt).owner; // Ally or no player? Then ok - return (owner == 0 || player.IsAlly(owner - 1)); + return (owner == 0 || player.isAlly(owner - 1)); } }; diff --git a/libs/s25main/pathfinding/RoadPathFinder.cpp b/libs/s25main/pathfinding/RoadPathFinder.cpp index 7e628cd1f6..70b75a3215 100644 --- a/libs/s25main/pathfinding/RoadPathFinder.cpp +++ b/libs/s25main/pathfinding/RoadPathFinder.cpp @@ -22,7 +22,7 @@ struct RoadNodeComperatorGreater if(lhs->estimate == rhs->estimate) { // Use a tie-breaker to get strict ordering - return (lhs->GetObjId() > rhs->GetObjId()); + return (lhs->getObjId() > rhs->getObjId()); } return (lhs->estimate > rhs->estimate); @@ -45,7 +45,7 @@ struct Carrier unsigned operator()(const noRoadNode& curNode, const Direction nextDir) const { // Add costs for busy carriers to allow alternative routes - return curNode.GetPunishmentPoints(nextDir); + return curNode.getPunishmentPoints(nextDir); } }; } // namespace AdditonalCosts @@ -70,7 +70,7 @@ struct AvoidSegment template struct AvoidRoadType { - bool operator()(const RoadSegment& segment) const { return segment.GetRoadType() != T_roadType; } + bool operator()(const RoadSegment& segment) const { return segment.getRoadType() != T_roadType; } }; /// Combines 2 functors by returning true only if both of them return true @@ -115,29 +115,29 @@ bool RoadPathFinder::FindPathImpl(const noRoadNode& start, const noRoadNode& goa RTTR_Assert(false); LOG.write("WARNING: Bug detected (GF: %u). Please report this with the savegame and replay (Start==Goal in " "pathfinding %u,%u)\n") - % gwb_.GetEvMgr().GetCurrentGF() % unsigned(start.GetX()) % unsigned(start.GetY()); + % gwb_.getEvMgr().getCurrentGF() % unsigned(start.getX()) % unsigned(start.getY()); // But for now we assume it to be valid and return (kind of) correct values if(length) *length = 0; if(firstDir) *firstDir = RoadPathDirection::None; if(firstNodePos) - *firstNodePos = start.GetPos(); + *firstNodePos = start.getPos(); return true; } // If the goal is a flag (unlikely) we have no goal building // TODO(Replay): Change RoadPathFinder::FindPath to target flag instead of building for wares - const noRoadNode* goalBld = (goal.GetGOT() == GO_Type::Flag) ? nullptr : &goal; + const noRoadNode* goalBld = (goal.getGOT() == GO_Type::Flag) ? nullptr : &goal; // Use a counter for the visited-states so we don't have to reset them on every invocation currentVisit++; // if the counter reaches its maximum, tidy up if(currentVisit == std::numeric_limits::max()) { - RTTR_FOREACH_PT(MapPoint, gwb_.GetSize()) + RTTR_FOREACH_PT(MapPoint, gwb_.getSize()) { - auto* const node = gwb_.GetSpecObj(pt); + auto* const node = gwb_.getSpecObj(pt); if(node) node->last_visit = 0; } @@ -147,8 +147,8 @@ bool RoadPathFinder::FindPathImpl(const noRoadNode& start, const noRoadNode& goa // Add start node todo.clear(); - const MapPoint goalPos = goal.GetPos(); - start.targetDistance = gwb_.CalcDistance(start.GetPos(), goalPos); + const MapPoint goalPos = goal.getPos(); + start.targetDistance = gwb_.CalcDistance(start.getPos(), goalPos); start.estimate = start.targetDistance; start.last_visit = currentVisit; start.prev = nullptr; @@ -180,7 +180,7 @@ bool RoadPathFinder::FindPathImpl(const noRoadNode& start, const noRoadNode& goa *firstDir = firstNode->dir_; if(firstNodePos) - *firstNodePos = firstNode->GetPos(); + *firstNodePos = firstNode->getPos(); } // Done, path found @@ -198,9 +198,9 @@ bool RoadPathFinder::FindPathImpl(const noRoadNode& start, const noRoadNode& goa continue; // Check the 2 flags, one is the current node, so we need the other - noRoadNode* neighbour = route->GetF1(); + noRoadNode* neighbour = route->getF1(); if(neighbour == &best) - neighbour = route->GetF2(); + neighbour = route->getF2(); // this eliminates 1/6 of all nodes and avoids cost calculation and further checks, if(neighbour == prevNode) @@ -210,7 +210,7 @@ bool RoadPathFinder::FindPathImpl(const noRoadNode& start, const noRoadNode& goa if(dir == Direction::NorthWest && neighbour != &goal) { // Flags and harbors are allowed - const GO_Type got = neighbour->GetGOT(); + const GO_Type got = neighbour->getGOT(); if(got != GO_Type::Flag && got != GO_Type::NobHarborbuilding) continue; } @@ -240,7 +240,7 @@ bool RoadPathFinder::FindPathImpl(const noRoadNode& start, const noRoadNode& goa { // Not visited yet -> Add to list neighbour->cost = cost; - neighbour->targetDistance = gwb_.CalcDistance(neighbour->GetPos(), goalPos); + neighbour->targetDistance = gwb_.CalcDistance(neighbour->getPos(), goalPos); neighbour->estimate = neighbour->targetDistance + cost; neighbour->last_visit = currentVisit; neighbour->prev = &best; @@ -251,9 +251,9 @@ bool RoadPathFinder::FindPathImpl(const noRoadNode& start, const noRoadNode& goa } // For harbors also consider ship connections - if(best.GetGOT() != GO_Type::NobHarborbuilding) + if(best.getGOT() != GO_Type::NobHarborbuilding) continue; - for(const auto& sc : static_cast(best).GetShipConnections()) + for(const auto& sc : static_cast(best).getShipConnections()) { unsigned cost = best.cost + sc.way_costs; @@ -277,7 +277,7 @@ bool RoadPathFinder::FindPathImpl(const noRoadNode& start, const noRoadNode& goa { // Not visited yet -> Add to list dest.cost = cost; - dest.targetDistance = gwb_.CalcDistance(dest.GetPos(), goalPos); + dest.targetDistance = gwb_.CalcDistance(dest.getPos(), goalPos); dest.estimate = dest.targetDistance + cost; dest.last_visit = currentVisit; dest.prev = &best; diff --git a/libs/s25main/pathfinding/ShipPathData.cpp b/libs/s25main/pathfinding/ShipPathData.cpp index a4f8f40a8f..a19fe72e8e 100644 --- a/libs/s25main/pathfinding/ShipPathData.cpp +++ b/libs/s25main/pathfinding/ShipPathData.cpp @@ -37,13 +37,13 @@ const std::vector* ShipPathData::findCachedPath(MapPoint start, MapPo { if(e.start == start && e.dest == dest) { - const_cast(e).lastUse = world_.GetEvMgr().GetCurrentGF(); + const_cast(e).lastUse = world_.getEvMgr().getCurrentGF(); reversed = false; return &e.route; } if(e.start == dest && e.dest == start) { - const_cast(e).lastUse = world_.GetEvMgr().GetCurrentGF(); + const_cast(e).lastUse = world_.getEvMgr().getCurrentGF(); reversed = true; return &e.route; } @@ -53,7 +53,7 @@ const std::vector* ShipPathData::findCachedPath(MapPoint start, MapPo void ShipPathData::addToCache(MapPoint start, MapPoint dest, std::vector route) { - PathEntry entry{start, dest, world_.GetEvMgr().GetCurrentGF(), std::move(route)}; + PathEntry entry{start, dest, world_.getEvMgr().getCurrentGF(), std::move(route)}; if(cachedPaths_.size() < cachedPaths_.max_size()) cachedPaths_.emplace_back(std::move(entry)); else @@ -67,14 +67,14 @@ void ShipPathData::addToCache(MapPoint start, MapPoint dest, std::vector(world_.GetNumHarborPoints())) + harborConnections_.resize(world_.getNumHarborPoints()); + for(const auto startHbId : helpers::idRange(world_.getNumHarborPoints())) { auto& curConnections = harborConnections_[startHbId]; std::vector neighbors; for(const auto dir : helpers::EnumRange{}) { - const auto& curNbs = world_.GetHarborNeighbors(startHbId, dir); + const auto& curNbs = world_.getHarborNeighbors(startHbId, dir); neighbors.insert(neighbors.end(), curNbs.begin(), curNbs.end()); } for(const auto& nb : neighbors) @@ -85,8 +85,8 @@ void ShipPathData::initHarborConnections() RTTR_Assert(!helpers::contains_if(curConnections, HarborConnection::Matcher{nb.id, nb.sea})); curConnections.push_back(HarborConnection{nb.id, nb.sea, {}}); unsigned len = 0; - const auto startPoint = world_.GetCoastalPoint(startHbId, nb.sea); - const auto nbPoint = world_.GetCoastalPoint(nb.id, nb.sea); + const auto startPoint = world_.getCoastalPoint(startHbId, nb.sea); + const auto nbPoint = world_.getCoastalPoint(nb.id, nb.sea); const bool found = (startPoint == nbPoint) || world_.FindShipPath(startPoint, nbPoint, nb.distance, &curConnections.back().route, &len); diff --git a/libs/s25main/postSystem/DiplomacyPostQuestion.cpp b/libs/s25main/postSystem/DiplomacyPostQuestion.cpp index b793ab1259..3477bdcaa7 100644 --- a/libs/s25main/postSystem/DiplomacyPostQuestion.cpp +++ b/libs/s25main/postSystem/DiplomacyPostQuestion.cpp @@ -11,7 +11,7 @@ DiplomacyPostQuestion::DiplomacyPostQuestion(unsigned sendFrame, PactType pact, unsigned id, const GamePlayerInfo& otherPlayer, int duration) : PostMsg(sendFrame, "", PostCategory::Diplomacy), acceptOrCancel(true), pact(pact), pactId(id), - player(otherPlayer.GetPlayerId()) + player(otherPlayer.getPlayerId()) { std::string text = boost::str(boost::format(_("The player '%s' offers you a %s.")) % otherPlayer.name % _(PACT_NAMES[pact])) + "\n"; @@ -21,16 +21,16 @@ DiplomacyPostQuestion::DiplomacyPostQuestion(unsigned sendFrame, PactType pact, text += boost::str(boost::format(_("Duration: %d GF (%s)")) % duration % GAMECLIENT.FormatGFTime(static_cast(duration))); - SetText(text); + setText(text); } DiplomacyPostQuestion::DiplomacyPostQuestion(unsigned sendFrame, PactType pact, unsigned id, const GamePlayerInfo& otherPlayer) : PostMsg(sendFrame, "", PostCategory::Diplomacy), acceptOrCancel(false), pact(pact), pactId(id), - player(otherPlayer.GetPlayerId()) + player(otherPlayer.getPlayerId()) { std::string text = boost::str(boost::format(_("The player '%s' want to cancel the '%s' between you both prematurely. Do you agree?")) % otherPlayer.name % _(PACT_NAMES[pact])); - SetText(text); + setText(text); } diff --git a/libs/s25main/postSystem/DiplomacyPostQuestion.h b/libs/s25main/postSystem/DiplomacyPostQuestion.h index 5461986b52..b79b2dc5a1 100644 --- a/libs/s25main/postSystem/DiplomacyPostQuestion.h +++ b/libs/s25main/postSystem/DiplomacyPostQuestion.h @@ -19,10 +19,10 @@ class DiplomacyPostQuestion : public PostMsg /// Cancel contract DiplomacyPostQuestion(unsigned sendFrame, PactType pact, unsigned id, const GamePlayerInfo& otherPlayer); - bool IsAccept() const { return acceptOrCancel; } - PactType GetPactType() const { return pact; } - unsigned GetPactId() const { return pactId; } - unsigned GetPlayerId() const { return player; } + bool isAccept() const { return acceptOrCancel; } + PactType getPactType() const { return pact; } + unsigned getPactId() const { return pactId; } + unsigned getPlayerId() const { return player; } private: /// Type of the question. True for accepting a new contract, false for canceling existing one diff --git a/libs/s25main/postSystem/PostBox.cpp b/libs/s25main/postSystem/PostBox.cpp index 042269f982..a6dfc8501f 100644 --- a/libs/s25main/postSystem/PostBox.cpp +++ b/libs/s25main/postSystem/PostBox.cpp @@ -56,19 +56,19 @@ void PostBox::Clear() DeleteMsg(i - 1); } -const PostMsg* PostBox::GetMsg(unsigned idx) const +const PostMsg* PostBox::getMsg(unsigned idx) const { if(idx >= numMessages) return nullptr; return messages[idx].get(); } -void PostBox::SetCurrentMissionGoal(const std::string& goal) +void PostBox::setCurrentMissionGoal(const std::string& goal) { currentMissionGoal = goal; } -std::string PostBox::GetCurrentMissionGoal() const +std::string PostBox::getCurrentMissionGoal() const { return currentMissionGoal; } diff --git a/libs/s25main/postSystem/PostBox.h b/libs/s25main/postSystem/PostBox.h index e5c1aa846f..40f74e0ed8 100644 --- a/libs/s25main/postSystem/PostBox.h +++ b/libs/s25main/postSystem/PostBox.h @@ -28,19 +28,19 @@ class PostBox /// Oldest message is at index 0 bool DeleteMsg(unsigned idx); void Clear(); - unsigned GetNumMsgs() const { return numMessages; } - static constexpr unsigned GetMaxMsgs() { return MAX_MESSAGES; } + unsigned getNumMsgs() const { return numMessages; } + static constexpr unsigned getMaxMsgs() { return MAX_MESSAGES; } /// Get message by index or nullptr if invalid index /// Oldest message is at index 0 - const PostMsg* GetMsg(unsigned idx) const; + const PostMsg* getMsg(unsigned idx) const; /// Set callback that receives new message and message count everytime a message is added void ObserveNewMsg(const NewMsgCallback& callback) { evNewMsg = callback; } /// Set callback that receives new message count everytime a message is deleted void ObserveDeletedMsg(const MsgDeletedCallback& callback) { evDelMsg = callback; } /// Sets the current goal as shown in the post window - void SetCurrentMissionGoal(const std::string& goal); - std::string GetCurrentMissionGoal() const; + void setCurrentMissionGoal(const std::string& goal); + std::string getCurrentMissionGoal() const; private: static constexpr unsigned MAX_MESSAGES = 20; diff --git a/libs/s25main/postSystem/PostManager.cpp b/libs/s25main/postSystem/PostManager.cpp index 023d5489e9..efdaab5390 100644 --- a/libs/s25main/postSystem/PostManager.cpp +++ b/libs/s25main/postSystem/PostManager.cpp @@ -15,13 +15,13 @@ PostBox& PostManager::AddPostBox(unsigned player) { if(player >= postBoxes.size()) throw std::out_of_range("Invalid player for new postbox"); - if(GetPostBox(player)) + if(getPostBox(player)) throw std::logic_error("Postbox already exists"); postBoxes[player] = std::make_unique(); return *postBoxes[player]; } -PostBox* PostManager::GetPostBox(unsigned player) const +PostBox* PostManager::getPostBox(unsigned player) const { return (player < postBoxes.size()) ? postBoxes[player].get() : nullptr; } @@ -33,14 +33,14 @@ void PostManager::RemovePostBox(unsigned player) void PostManager::SendMsg(unsigned player, std::unique_ptr msg) const { - PostBox* box = GetPostBox(player); + PostBox* box = getPostBox(player); if(box) box->AddMsg(std::move(msg)); } -void PostManager::SetMissionGoal(unsigned player, const std::string& newGoal) const +void PostManager::setMissionGoal(unsigned player, const std::string& newGoal) const { - PostBox* box = GetPostBox(player); + PostBox* box = getPostBox(player); if(box) - box->SetCurrentMissionGoal(newGoal); + box->setCurrentMissionGoal(newGoal); } diff --git a/libs/s25main/postSystem/PostManager.h b/libs/s25main/postSystem/PostManager.h index 3f0363aad6..39627d172b 100644 --- a/libs/s25main/postSystem/PostManager.h +++ b/libs/s25main/postSystem/PostManager.h @@ -18,10 +18,10 @@ class PostManager PostManager(); ~PostManager(); PostBox& AddPostBox(unsigned player); - PostBox* GetPostBox(unsigned player) const; + PostBox* getPostBox(unsigned player) const; void RemovePostBox(unsigned player); void SendMsg(unsigned player, std::unique_ptr msg) const; - void SetMissionGoal(unsigned player, const std::string& newGoal) const; + void setMissionGoal(unsigned player, const std::string& newGoal) const; private: std::array, MAX_PLAYERS> postBoxes; diff --git a/libs/s25main/postSystem/PostMsg.h b/libs/s25main/postSystem/PostMsg.h index 108a6ab5aa..6a20c71159 100644 --- a/libs/s25main/postSystem/PostMsg.h +++ b/libs/s25main/postSystem/PostMsg.h @@ -25,17 +25,17 @@ class PostMsg SoundEffect soundEffect = SoundEffect::Pidgeon); virtual ~PostMsg() = default; - unsigned GetSendFrame() const { return sendFrame_; } - const std::string& GetText() const { return text_; } - PostCategory GetCategory() const { return cat_; } + unsigned getSendFrame() const { return sendFrame_; } + const std::string& getText() const { return text_; } + PostCategory getCategory() const { return cat_; } /// Get position related to this message (optional, defaults to invalid) - MapPoint GetPos() const { return pt_; } - SoundEffect GetSoundEffect() const { return soundEffect_; } + MapPoint getPos() const { return pt_; } + SoundEffect getSoundEffect() const { return soundEffect_; } /// Get Associated image or nullptr if none exists - virtual ITexture* GetImage_() const { return nullptr; } + virtual ITexture* getImage() const { return nullptr; } protected: - void SetText(const std::string& text) { text_ = text; } + void setText(const std::string& text) { text_ = text; } private: unsigned sendFrame_; diff --git a/libs/s25main/postSystem/PostMsgWithBuilding.cpp b/libs/s25main/postSystem/PostMsgWithBuilding.cpp index 47de6357a0..dbe9ad2aeb 100644 --- a/libs/s25main/postSystem/PostMsgWithBuilding.cpp +++ b/libs/s25main/postSystem/PostMsgWithBuilding.cpp @@ -7,7 +7,7 @@ PostMsgWithBuilding::PostMsgWithBuilding(unsigned sendFrame, const std::string& text, PostCategory cat, const noBaseBuilding& bld, SoundEffect soundEffect) - : PostMsg(sendFrame, text, cat, bld.GetPos(), soundEffect), bldType(bld.GetBuildingType()), nation(bld.GetNation()) + : PostMsg(sendFrame, text, cat, bld.getPos(), soundEffect), bldType(bld.getBuildingType()), nation(bld.getNation()) {} PostMsgWithBuilding::PostMsgWithBuilding(unsigned sendFrame, const std::string& text, PostCategory cat, @@ -15,7 +15,7 @@ PostMsgWithBuilding::PostMsgWithBuilding(unsigned sendFrame, const std::string& : PostMsg(sendFrame, text, cat, pos), bldType(bld), nation(nation) {} -ITexture* PostMsgWithBuilding::GetImage_() const +ITexture* PostMsgWithBuilding::getImage() const { - return &noBaseBuilding::GetBuildingImage(bldType, nation); + return &noBaseBuilding::getBuildingImage(bldType, nation); } diff --git a/libs/s25main/postSystem/PostMsgWithBuilding.h b/libs/s25main/postSystem/PostMsgWithBuilding.h index fdf7617675..dd5ff585e8 100644 --- a/libs/s25main/postSystem/PostMsgWithBuilding.h +++ b/libs/s25main/postSystem/PostMsgWithBuilding.h @@ -22,7 +22,7 @@ class PostMsgWithBuilding : public PostMsg PostMsgWithBuilding(unsigned sendFrame, const std::string& text, PostCategory cat, BuildingType bld, Nation nation, const MapPoint& pos = MapPoint::Invalid()); - ITexture* GetImage_() const override; + ITexture* getImage() const override; private: const BuildingType bldType; diff --git a/libs/s25main/postSystem/ShipPostMsg.cpp b/libs/s25main/postSystem/ShipPostMsg.cpp index bc1b84f0a1..8b5a49bf61 100644 --- a/libs/s25main/postSystem/ShipPostMsg.cpp +++ b/libs/s25main/postSystem/ShipPostMsg.cpp @@ -7,10 +7,10 @@ #include "nodeObjs/noShip.h" ShipPostMsg::ShipPostMsg(unsigned sendFrame, const std::string& text, PostCategory cat, const noShip& ship) - : PostMsg(sendFrame, text, cat, ship.GetPos()) + : PostMsg(sendFrame, text, cat, ship.getPos()) {} -ITexture* ShipPostMsg::GetImage_() const +ITexture* ShipPostMsg::getImage() const { - return LOADER.GetTextureN("boot_z", 12); + return LOADER.getTextureN("boot_z", 12); } diff --git a/libs/s25main/postSystem/ShipPostMsg.h b/libs/s25main/postSystem/ShipPostMsg.h index 6c52964b79..7af22ad316 100644 --- a/libs/s25main/postSystem/ShipPostMsg.h +++ b/libs/s25main/postSystem/ShipPostMsg.h @@ -15,5 +15,5 @@ class ShipPostMsg : public PostMsg /// Creates the message. /// Note: Ship object might get invalidated after this call so do not store! ShipPostMsg(unsigned sendFrame, const std::string& text, PostCategory cat, const noShip& ship); - ITexture* GetImage_() const override; + ITexture* getImage() const override; }; diff --git a/libs/s25main/random/Random.cpp b/libs/s25main/random/Random.cpp index 31507df6ca..1821638c46 100644 --- a/libs/s25main/random/Random.cpp +++ b/libs/s25main/random/Random.cpp @@ -44,7 +44,7 @@ int Random::Rand(const RandomContext& context, const int maxExcl) } template -unsigned Random::GetChecksum() const +unsigned Random::getChecksum() const { return CalcChecksum(rng_); } @@ -65,7 +65,7 @@ unsigned Random::CalcChecksum(const PRNG& rng) } template -const typename Random::PRNG& Random::GetCurrentState() const +const typename Random::PRNG& Random::getCurrentState() const { return rng_; } @@ -126,7 +126,7 @@ void Random::RandomEntry::Deserialize(Serializer& ser) } template -int Random::RandomEntry::GetValue() const +int Random::RandomEntry::getValue() const { PRNG tmpRng(rngState); return calcRandValue(tmpRng, maxExcl); diff --git a/libs/s25main/random/Random.h b/libs/s25main/random/Random.h index 60b4b950b5..38e5e977ec 100644 --- a/libs/s25main/random/Random.h +++ b/libs/s25main/random/Random.h @@ -54,7 +54,7 @@ class Random : public Singleton> void Serialize(Serializer& ser) const; void Deserialize(Serializer& ser); - int GetValue() const; + int getValue() const; }; Random(); @@ -66,11 +66,11 @@ class Random : public Singleton> int Rand(const RandomContext& context, int maxExcl); /// Get a checksum of the RNG - unsigned GetChecksum() const; + unsigned getChecksum() const; static unsigned CalcChecksum(const PRNG& rng); /// Get current rng state - const PRNG& GetCurrentState() const; + const PRNG& getCurrentState() const; std::vector GetAsyncLog(); @@ -91,7 +91,7 @@ using RandomEntry = UsedRandom::RandomEntry; // Macros / Defines #define RANDOM UsedRandom::inst() #define RANDOM_CONTEXT() \ - RandomContext { __FILE__, __LINE__, GetObjId() } + RandomContext { __FILE__, __LINE__, getObjId() } #define RANDOM_CONTEXT2(objId) \ RandomContext { __FILE__, __LINE__, objId } /// Shortcut to get a new random value in range [0, maxVal) for a given object id diff --git a/libs/s25main/random/randomIO.cpp b/libs/s25main/random/randomIO.cpp index f46efe5e60..b5415db7b2 100644 --- a/libs/s25main/random/randomIO.cpp +++ b/libs/s25main/random/randomIO.cpp @@ -9,11 +9,11 @@ std::ostream& operator<<(std::ostream& os, const RandomEntry& entry) { - static const std::string rttrSrcBaseName = RttrConfig::GetSourceDir().generic_string() + "/"; + static const std::string rttrSrcBaseName = RttrConfig::getSourceDir().generic_string() + "/"; std::string strippedSrcFile = boost::filesystem::path(entry.srcName).generic_string(); if(strippedSrcFile.find(rttrSrcBaseName) == 0) strippedSrcFile = strippedSrcFile.substr(rttrSrcBaseName.size()); - return os << entry.counter << ":R(" << entry.maxExcl << ")=" << entry.GetValue() << ",z=" << std::hex + return os << entry.counter << ":R(" << entry.maxExcl << ")=" << entry.getValue() << ",z=" << std::hex << std::setw(8) << entry.rngState << std::dec << std::setw(0) << "\t| " << strippedSrcFile << "#" << entry.srcLine << "\t| id=" << entry.objId; } diff --git a/libs/s25main/world/BQCalculator.h b/libs/s25main/world/BQCalculator.h index 88db722d3c..a3a81fe8a6 100644 --- a/libs/s25main/world/BQCalculator.h +++ b/libs/s25main/world/BQCalculator.h @@ -23,7 +23,7 @@ template BuildingQuality BQCalculator::operator()(const MapPoint pt, T_IsOnRoad isOnRoad, const bool flagOnly /*= false*/) const { // Cannot build on blocking objects - if(world.GetNO(pt)->GetBM() != BlockingManner::None) + if(world.getNO(pt)->getBM() != BlockingManner::None) return BuildingQuality::Nothing; ////////////////////////////////////////////////////////////////////////// @@ -33,12 +33,12 @@ BuildingQuality BQCalculator::operator()(const MapPoint pt, T_IsOnRoad isOnRoad, unsigned mine_hits = 0; unsigned flag_hits = 0; - const WorldDescription& desc = world.GetDescription(); + const WorldDescription& desc = world.getDescription(); BuildingQuality curBQ; if(flagOnly) { bool flagPossible = false; - for(const DescIdx tIdx : world.GetTerrainsAround(pt)) + for(const DescIdx tIdx : world.getTerrainsAround(pt)) { TerrainBQ bq = desc.get(tIdx).GetBQ(); if(bq == TerrainBQ::Danger) @@ -52,7 +52,7 @@ BuildingQuality BQCalculator::operator()(const MapPoint pt, T_IsOnRoad isOnRoad, return BuildingQuality::Nothing; } else { - for(const DescIdx tIdx : world.GetTerrainsAround(pt)) + for(const DescIdx tIdx : world.getTerrainsAround(pt)) { TerrainBQ bq = desc.get(tIdx).GetBQ(); if(bq == TerrainBQ::Castle) @@ -75,7 +75,7 @@ BuildingQuality BQCalculator::operator()(const MapPoint pt, T_IsOnRoad isOnRoad, return BuildingQuality::Nothing; } RTTR_Assert(curBQ == BuildingQuality::Flag || curBQ == BuildingQuality::Mine || curBQ == BuildingQuality::Castle); - const auto neighbours = world.GetNeighbours(pt); + const auto neighbours = world.getNeighbours(pt); ////////////////////////////////////////////////////////////////////////// // 2. Reduce BQ based on altitude @@ -83,10 +83,10 @@ BuildingQuality BQCalculator::operator()(const MapPoint pt, T_IsOnRoad isOnRoad, // Restraints for buildings if(curBQ == BuildingQuality::Castle) { - const unsigned char curAltitude = world.GetNode(pt).altitude; + const unsigned char curAltitude = world.getNode(pt).altitude; // First check the height of the (possible) buildings flag // flag point more than 1 higher? -> Flag - unsigned char otherAltitude = world.GetNode(neighbours[Direction::SouthEast]).altitude; + unsigned char otherAltitude = world.getNode(neighbours[Direction::SouthEast]).altitude; if(otherAltitude > curAltitude + 1) curBQ = BuildingQuality::Flag; else @@ -94,7 +94,7 @@ BuildingQuality BQCalculator::operator()(const MapPoint pt, T_IsOnRoad isOnRoad, // Direct neighbours: Flag for altitude difference > 3 for(const MapPoint nb : neighbours) { - otherAltitude = world.GetNode(nb).altitude; + otherAltitude = world.getNode(nb).altitude; if(absDiff(curAltitude, otherAltitude) > 3) { curBQ = BuildingQuality::Flag; @@ -107,7 +107,7 @@ BuildingQuality BQCalculator::operator()(const MapPoint pt, T_IsOnRoad isOnRoad, // Radius-2 neighbours: Hut for altitude difference > 2 for(unsigned i = 0; i < 12; ++i) { - otherAltitude = world.GetNode(world.GetNeighbour2(pt, i)).altitude; + otherAltitude = world.getNode(world.getNeighbour2(pt, i)).altitude; if(absDiff(curAltitude, otherAltitude) > 2) { curBQ = BuildingQuality::Hut; @@ -118,7 +118,7 @@ BuildingQuality BQCalculator::operator()(const MapPoint pt, T_IsOnRoad isOnRoad, } } else if(curBQ == BuildingQuality::Mine - && world.GetNode(neighbours[Direction::SouthEast]).altitude > world.GetNode(pt).altitude + 3) + && world.getNode(neighbours[Direction::SouthEast]).altitude > world.getNode(pt).altitude + 3) { // Mines only possible till altitude diff of 3 curBQ = BuildingQuality::Flag; @@ -130,7 +130,7 @@ BuildingQuality BQCalculator::operator()(const MapPoint pt, T_IsOnRoad isOnRoad, // Blocking manners of neighbours (cache for reuse) helpers::EnumArray neighbourBlocks; for(const auto dir : helpers::EnumRange{}) - neighbourBlocks[dir] = world.GetNO(neighbours[dir])->GetBM(); + neighbourBlocks[dir] = world.getNO(neighbours[dir])->getBM(); // Don't build anything around charburner piles if(helpers::contains(neighbourBlocks, BlockingManner::NothingAround)) @@ -182,7 +182,7 @@ BuildingQuality BQCalculator::operator()(const MapPoint pt, T_IsOnRoad isOnRoad, { for(unsigned i = 0; i < 12; ++i) { - BlockingManner bm = world.GetNO(world.GetNeighbour2(pt, i))->GetBM(); + BlockingManner bm = world.getNO(world.getNeighbour2(pt, i))->getBM(); if(bm == BlockingManner::Building) { @@ -219,7 +219,7 @@ BuildingQuality BQCalculator::operator()(const MapPoint pt, T_IsOnRoad isOnRoad, } // If we can build a castle and this is a harbor point -> Allow harbor - if(curBQ == BuildingQuality::Castle && world.GetNode(pt).harborId) + if(curBQ == BuildingQuality::Castle && world.getNode(pt).harborId) curBQ = BuildingQuality::Harbor; ////////////////////////////////////////////////////////////////////////// diff --git a/libs/s25main/world/GameWorld.cpp b/libs/s25main/world/GameWorld.cpp index eaca432a5c..c44015a676 100644 --- a/libs/s25main/world/GameWorld.cpp +++ b/libs/s25main/world/GameWorld.cpp @@ -64,7 +64,7 @@ GameWorld::~GameWorld() GameObject::DetachWorld(this); } -MilitarySquares& GameWorld::GetMilitarySquares() +MilitarySquares& GameWorld::getMilitarySquares() { return militarySquares; } @@ -74,14 +74,14 @@ bool GameWorld::SetFlag(const MapPoint pt, const unsigned char player) if(GetBQ(pt, player) == BuildingQuality::Nothing) return false; // There must be no other flag around that point - if(IsFlagAround(pt)) + if(isFlagAround(pt)) return false; // Gucken, nicht, dass schon eine Flagge dasteht - if(GetNO(pt)->GetType() != NodalObjectType::Flag) + if(getNO(pt)->getType() != NodalObjectType::Flag) { DestroyNO(pt, false); - SetNO(pt, new noFlag(pt, player)); + setNO(pt, new noFlag(pt, player)); RecalcBQAroundPointBig(pt); } @@ -91,20 +91,20 @@ bool GameWorld::SetFlag(const MapPoint pt, const unsigned char player) void GameWorld::DestroyFlag(const MapPoint pt, unsigned char playerId) { // Let's see if there is a flag - if(GetNO(pt)->GetType() == NodalObjectType::Flag) + if(getNO(pt)->getType() == NodalObjectType::Flag) { - auto* flag = GetSpecObj(pt); - if(flag->GetPlayer() != playerId) + auto* flag = getSpecObj(pt); + if(flag->getPlayer() != playerId) return; // Get the attached building if existing - noBase* building = GetNO(GetNeighbour(pt, Direction::NorthWest)); + noBase* building = getNO(getNeighbour(pt, Direction::NorthWest)); // Is this a military building? - if(building->GetGOT() == GO_Type::NobMilitary) + if(building->getGOT() == GO_Type::NobMilitary) { // Maybe demolition of the building is not allowed? - if(!static_cast(building)->IsDemolitionAllowed()) + if(!static_cast(building)->isDemolitionAllowed()) return; // Abort the whole thing } @@ -119,10 +119,10 @@ void GameWorld::DestroyFlag(const MapPoint pt, unsigned char playerId) gi->GI_FlagDestroyed(pt); } -void GameWorld::SetPointRoad(MapPoint pt, const Direction dir, const PointRoad type) +void GameWorld::setPointRoad(MapPoint pt, const Direction dir, const PointRoad type) { const RoadDir rDir = toRoadDir(pt, dir); - SetRoad(pt, rDir, type); + setRoad(pt, rDir, type); if(gi) gi->GI_UpdateMinimap(pt); @@ -130,7 +130,7 @@ void GameWorld::SetPointRoad(MapPoint pt, const Direction dir, const PointRoad t void GameWorld::SetBuildingSite(const BuildingType type, const MapPoint pt, const unsigned char player) { - if(!GetPlayer(player).IsBuildingEnabled(type)) + if(!getPlayer(player).isBuildingEnabled(type)) return; // Gucken, ob das Gebäude hier überhaupt noch gebaut wrden kann @@ -139,20 +139,20 @@ void GameWorld::SetBuildingSite(const BuildingType type, const MapPoint pt, cons // Wenn das ein Militärgebäude ist und andere Militärgebäude bereits in der Nähe sind, darf dieses nicht gebaut // werden - if(BuildingProperties::IsMilitary(type)) + if(BuildingProperties::isMilitary(type)) { - if(IsMilitaryBuildingNearNode(pt, player)) + if(isMilitaryBuildingNearNode(pt, player)) return; } // Prüfen ob Katapult und ob Katapult erlaubt ist - if(type == BuildingType::Catapult && !GetPlayer(player).CanBuildCatapult()) + if(type == BuildingType::Catapult && !getPlayer(player).canBuildCatapult()) return; DestroyNO(pt, false); // Baustelle setzen - SetNO(pt, new noBuildingSite(type, pt, player)); + setNO(pt, new noBuildingSite(type, pt, player)); if(gi) gi->GI_UpdateMinimap(pt); @@ -164,19 +164,19 @@ void GameWorld::DestroyBuilding(const MapPoint pt, const unsigned char player) { // Steht da auch ein Gebäude oder eine Baustelle, nicht dass wir aus Verzögerung Feuer abreißen wollen, das geht // schief - if(GetNO(pt)->GetType() == NodalObjectType::Building || GetNO(pt)->GetType() == NodalObjectType::Buildingsite) + if(getNO(pt)->getType() == NodalObjectType::Building || getNO(pt)->getType() == NodalObjectType::Buildingsite) { - auto* nbb = GetSpecObj(pt); + auto* nbb = getSpecObj(pt); // Ist das Gebäude auch von dem Spieler, der es abreißen will? - if(nbb->GetPlayer() != player) + if(nbb->getPlayer() != player) return; // Militärgebäude? - if(nbb->GetGOT() == GO_Type::NobMilitary) + if(nbb->getGOT() == GO_Type::NobMilitary) { // Darf das Gebäude abgerissen werden? - if(!static_cast(nbb)->IsDemolitionAllowed()) + if(!static_cast(nbb)->isDemolitionAllowed()) return; } @@ -196,9 +196,9 @@ MapPoint GameWorld::BuildRoad(const unsigned char playerId, const bool boat_road return {}; } - if(!GetSpecObj(start) || GetSpecObj(start)->GetPlayer() != playerId) + if(!getSpecObj(start) || getSpecObj(start)->getPlayer() != playerId) { - GetNotifications().publish(RoadNote(RoadNote::ConstructionFailed, playerId, start, route)); + getNotifications().publish(RoadNote(RoadNote::ConstructionFailed, playerId, start, route)); return {}; } @@ -207,79 +207,79 @@ MapPoint GameWorld::BuildRoad(const unsigned char playerId, const bool boat_road MapPoint curPt(start); for(const auto i : helpers::range(route.size() - 1u)) { - bool roadOk = roadChecker.IsEdgeOk(curPt, route[i]); - curPt = GetNeighbour(curPt, route[i]); - roadOk &= roadChecker.IsNodeOk(curPt); + bool roadOk = roadChecker.isEdgeOk(curPt, route[i]); + curPt = getNeighbour(curPt, route[i]); + roadOk &= roadChecker.isNodeOk(curPt); if(!roadOk) { // No? Then check whether the desired road is already there if(!RoadAlreadyBuilt(boat_road, start, route)) - GetNotifications().publish(RoadNote(RoadNote::ConstructionFailed, playerId, start, route)); + getNotifications().publish(RoadNote(RoadNote::ConstructionFailed, playerId, start, route)); return {}; } } - const auto endPt = GetNeighbour(curPt, route.back()); + const auto endPt = getNeighbour(curPt, route.back()); // Check whether there is a flag at the end or whether one can be built - if(GetNO(endPt)->GetGOT() == GO_Type::Flag) + if(getNO(endPt)->getGOT() == GO_Type::Flag) { // Wrong player? - if(GetSpecObj(endPt)->GetPlayer() != playerId) + if(getSpecObj(endPt)->getPlayer() != playerId) { - GetNotifications().publish(RoadNote(RoadNote::ConstructionFailed, playerId, start, route)); + getNotifications().publish(RoadNote(RoadNote::ConstructionFailed, playerId, start, route)); return {}; } } else if(!SetFlag(endPt, playerId)) // Try placing a flag { - GetNotifications().publish(RoadNote(RoadNote::ConstructionFailed, playerId, start, route)); + getNotifications().publish(RoadNote(RoadNote::ConstructionFailed, playerId, start, route)); return {}; } // Destroy possible decorative objects at start - if(HasRemovableObjForRoad(start)) + if(hasRemovableObjForRoad(start)) DestroyNO(start); curPt = start; for(auto i : route) { - SetPointRoad(curPt, i, boat_road ? PointRoad::Boat : PointRoad::Normal); + setPointRoad(curPt, i, boat_road ? PointRoad::Boat : PointRoad::Normal); RecalcBQForRoad(curPt); - curPt = GetNeighbour(curPt, i); + curPt = getNeighbour(curPt, i); // Destroy possible decorative objects at end - if(HasRemovableObjForRoad(curPt)) + if(hasRemovableObjForRoad(curPt)) DestroyNO(curPt); } - auto* rs = new RoadSegment(boat_road ? RoadType::Water : RoadType::Normal, GetSpecObj(start), - GetSpecObj(endPt), route); + auto* rs = new RoadSegment(boat_road ? RoadType::Water : RoadType::Normal, getSpecObj(start), + getSpecObj(endPt), route); - GetSpecObj(start)->SetRoute(route.front(), rs); - GetSpecObj(endPt)->SetRoute(route.back() + 3u, rs); + getSpecObj(start)->setRoute(route.front(), rs); + getSpecObj(endPt)->setRoute(route.back() + 3u, rs); // Tell the economy that a new road has been built - GetPlayer(playerId).NewRoadConnection(rs); - GetNotifications().publish(RoadNote(RoadNote::Constructed, playerId, start, route)); + getPlayer(playerId).NewRoadConnection(rs); + getNotifications().publish(RoadNote(RoadNote::Constructed, playerId, start, route)); // Add flags on land roads for human players if addon is enabled - if(GetGGS().isEnabled(AddonId::AUTOFLAGS) && rs->GetRoadType() != RoadType::Water && GetPlayer(playerId).isHuman()) + if(getGGS().isEnabled(AddonId::AUTOFLAGS) && rs->getRoadType() != RoadType::Water && getPlayer(playerId).isHuman()) { - MapPoint roadPt = GetSpecObj(start)->GetPos(); + MapPoint roadPt = getSpecObj(start)->getPos(); for(const Direction curDir : route) { - roadPt = GetNeighbour(roadPt, curDir); - if(!IsFlagAround(roadPt)) + roadPt = getNeighbour(roadPt, curDir); + if(!isFlagAround(roadPt)) SetFlag(roadPt, playerId); } } return endPt; } -bool GameWorld::HasRemovableObjForRoad(const MapPoint pt) const +bool GameWorld::hasRemovableObjForRoad(const MapPoint pt) const { - const auto* obj = GetSpecObj(pt); - return obj && obj->GetSize() == 0; + const auto* obj = getSpecObj(pt); + return obj && obj->getSize() == 0; } // When defined the game tries to remove "blocks" of border stones that look ugly (TODO: Example?) @@ -291,11 +291,11 @@ void GameWorld::RecalcBorderStones(Position startPt, Extent areaSize) { // Add a bit extra space as this influences also border stones around the region // But not so much we wrap completely around the map (+1 to round up, /2 to have extra space centered) - Position EXTRA_SPACE = elMin(Position::all(3), (GetSize() - areaSize + Position::all(1)) / 2); + Position EXTRA_SPACE = elMin(Position::all(3), (getSize() - areaSize + Position::all(1)) / 2); startPt -= EXTRA_SPACE; areaSize += 2u * Extent(EXTRA_SPACE); // We might still be 1 node to big, make sure we have don't exceed the mapsize - areaSize = elMin(areaSize, Extent(GetSize())); + areaSize = elMin(areaSize, Extent(getSize())); #ifdef PREVENT_BORDER_STONE_BLOCKING // Store how many neighbors a border stone has @@ -306,16 +306,16 @@ void GameWorld::RecalcBorderStones(Position startPt, Extent areaSize) { // Make map point const MapPoint curMapPt = MakeMapPoint(pt + startPt); - const unsigned char owner = GetNode(curMapPt).owner; - BoundaryStones& boundaryStones = GetBoundaryStones(curMapPt); + const unsigned char owner = getNode(curMapPt).owner; + BoundaryStones& boundaryStones = getBoundaryStones(curMapPt); // Is this a border node? - if(owner && IsBorderNode(curMapPt, owner)) + if(owner && isBorderNode(curMapPt, owner)) { // Check which neighbors are also border nodes and place the half-way stones to them for(const auto bPos : helpers::EnumRange{}) { - if(bPos == BorderStonePos::OnPoint || IsBorderNode(GetNeighbour(curMapPt, toDirection(bPos)), owner)) + if(bPos == BorderStonePos::OnPoint || isBorderNode(getNeighbour(curMapPt, toDirection(bPos)), owner)) boundaryStones[bPos] = owner; else boundaryStones[bPos] = 0; @@ -324,9 +324,9 @@ void GameWorld::RecalcBorderStones(Position startPt, Extent areaSize) #ifdef PREVENT_BORDER_STONE_BLOCKING // Count number of border nodes with same owner int idx = pt.y * width + pt.x; - for(const MapPoint nb : GetNeighbours(curMapPt)) + for(const MapPoint nb : getNeighbours(curMapPt)) { - if(GetNode(nb).boundary_stones[0] == owner) + if(getNode(nb).boundary_stones[0] == owner) ++neighbors[idx]; } #endif @@ -344,7 +344,7 @@ void GameWorld::RecalcBorderStones(Position startPt, Extent areaSize) const MapPoint curMapPt = MakeMapPoint(pt + startPt); // Do we have a stone here? - const unsigned char owner = GetNode(curMapPt).boundary_stones[BorderStonePos::OnPoint]; + const unsigned char owner = getNode(curMapPt).boundary_stones[BorderStonePos::OnPoint]; if(!owner) continue; @@ -355,12 +355,12 @@ void GameWorld::RecalcBorderStones(Position startPt, Extent areaSize) for(unsigned dir = 0; dir < 3 && neighbors[idx] > 2; ++dir) { // Do we have a border stone of the same owner on the node in that direction? - BoundaryStones& nbBoundStones = GetBoundaryStones(GetNeighbour(curMapPt, dir + 3)); + BoundaryStones& nbBoundStones = getBoundaryStones(getNeighbour(curMapPt, dir + 3)); if(nbBoundStones[0] != owner) continue; - Position pa = ::GetNeighbour(pt, Direction(dir + 3)); + Position pa = ::getNeighbour(pt, Direction(dir + 3)); if(pa.x < 0 || pa.x >= areaSize.x || pa.y < 0 || pa.y >= areaSize.y) continue; // If that one has to many stones too, we delete the connection stone @@ -382,28 +382,28 @@ void GameWorld::RecalcTerritory(const noBaseBuilding& building, TerritoryChangeR static const int ADD_RADIUS = 2; // Get the military radius this building affects. Bld is either a military building or a harbor building site RTTR_Assert( - (building.GetBuildingType() == BuildingType::HarborBuilding && dynamic_cast(&building)) + (building.getBuildingType() == BuildingType::HarborBuilding && dynamic_cast(&building)) || dynamic_cast(&building)); - const unsigned militaryRadius = building.GetMilitaryRadius(); + const unsigned militaryRadius = building.getMilitaryRadius(); RTTR_Assert(militaryRadius > 0u); const TerritoryRegion region = CreateTerritoryRegion(building, militaryRadius + ADD_RADIUS, reason); std::vector ptsWithChangedOwners; - std::vector sizeChanges(GetNumPlayers()); + std::vector sizeChanges(getNumPlayers()); // Copy owners from territory region to map and do the bookkeeping RTTR_FOREACH_PT(Position, region.size) { const MapPoint curMapPt = MakeMapPoint(pt + region.startPt); - const uint8_t oldOwner = GetNode(curMapPt).owner; - const uint8_t newOwner = region.GetOwner(pt); + const uint8_t oldOwner = getNode(curMapPt).owner; + const uint8_t newOwner = region.getOwner(pt); // If nothing changed, there is nothing to do (ownerChanged was already initialized) if(oldOwner == newOwner) continue; - SetOwner(curMapPt, newOwner); + setOwner(curMapPt, newOwner); ptsWithChangedOwners.push_back(curMapPt); if(newOwner != 0) sizeChanges[newOwner - 1]++; @@ -411,13 +411,13 @@ void GameWorld::RecalcTerritory(const noBaseBuilding& building, TerritoryChangeR sizeChanges[oldOwner - 1]--; } - const std::vector ptsToHandle = GetAllNeighboursUnion(ptsWithChangedOwners); + const std::vector ptsToHandle = getAllNeighboursUnion(ptsWithChangedOwners); // Destroy everything from old player on all nodes where the owner has changed for(const MapPoint& curMapPt : ptsToHandle) { // Do not destroy the triggering building or its flag - DestroyPlayerRests(curMapPt, GetNode(curMapPt).owner, &building); + DestroyPlayerRests(curMapPt, getNode(curMapPt).owner, &building); if(gi) gi->GI_UpdateMinimap(curMapPt); @@ -428,16 +428,16 @@ void GameWorld::RecalcTerritory(const noBaseBuilding& building, TerritoryChangeR { // Skip if there is an object. We are looking only for roads going through, not ending here // (objects here are already destroyed and if the road ended there it would have been as well) - if(GetNode(curMapPt).obj) + if(getNode(curMapPt).obj) continue; Direction dir; - noFlag* flag = GetRoadFlag(curMapPt, dir); + noFlag* flag = getRoadFlag(curMapPt, dir); if(!flag) continue; - const uint8_t owner = GetNode(curMapPt).owner; - if(flag->GetPlayer() + 1 == owner && IsPlayerTerritory(curMapPt, owner)) + const uint8_t owner = getNode(curMapPt).owner; + if(flag->getPlayer() + 1 == owner && isPlayerTerritory(curMapPt, owner)) continue; flag->DestroyRoad(dir); @@ -445,15 +445,15 @@ void GameWorld::RecalcTerritory(const noBaseBuilding& building, TerritoryChangeR // Notify for(const MapPoint& curMapPt : ptsWithChangedOwners) - GetNotifications().publish(NodeNote(NodeNote::Owner, curMapPt)); + getNotifications().publish(NodeNote(NodeNote::Owner, curMapPt)); for(const MapPoint& pt : ptsToHandle) { // BQ neu berechnen RecalcBQ(pt); // ggf den noch darüber, falls es eine Flagge war (kann ja ein Gebäude entstehen) - const MapPoint neighbourPt = GetNeighbour(pt, Direction::NorthWest); - if(GetNode(neighbourPt).bq != BuildingQuality::Nothing) + const MapPoint neighbourPt = getNeighbour(pt, Direction::NorthWest); + if(getNode(neighbourPt).bq != BuildingQuality::Nothing) RecalcBQ(neighbourPt); } @@ -463,35 +463,35 @@ void GameWorld::RecalcTerritory(const noBaseBuilding& building, TerritoryChangeR // Otherwise just set everything to visible const unsigned visualRadius = militaryRadius + VISUALRANGE_MILITARY; if(reason == TerritoryChangeReason::Destroyed) - RecalcVisibilitiesAroundPoint(building.GetPos(), visualRadius, building.GetPlayer(), &building); + RecalcVisibilitiesAroundPoint(building.getPos(), visualRadius, building.getPlayer(), &building); else - MakeVisibleAroundPoint(building.GetPos(), visualRadius, building.GetPlayer()); + MakeVisibleAroundPoint(building.getPos(), visualRadius, building.getPlayer()); // Notify players - for(unsigned i = 0; i < GetNumPlayers(); ++i) + for(unsigned i = 0; i < getNumPlayers(); ++i) { - GetPlayer(i).ChangeStatisticValue(StatisticType::Country, sizeChanges[i]); + getPlayer(i).ChangeStatisticValue(StatisticType::Country, sizeChanges[i]); // Negatives Wachstum per Post dem/der jeweiligen Landesherren/dame melden, nur bei neugebauten Gebäuden if(reason == TerritoryChangeReason::Build && sizeChanges[i] < 0) { - GetPostMgr().SendMsg(i, std::make_unique(GetEvMgr().GetCurrentGF(), + getPostMgr().SendMsg(i, std::make_unique(getEvMgr().getCurrentGF(), _("Lost land by this building"), PostCategory::Military, building)); - GetNotifications().publish( - BuildingNote(BuildingNote::LostLand, i, building.GetPos(), building.GetBuildingType())); + getNotifications().publish( + BuildingNote(BuildingNote::LostLand, i, building.getPos(), building.getBuildingType())); } } // Notify script - if(HasLua()) + if(hasLua()) { for(const MapPoint& pt : ptsWithChangedOwners) { - const uint8_t newOwner = GetNode(pt).owner; + const uint8_t newOwner = getNode(pt).owner; // Event for map scripting if(newOwner != 0) - GetLua().EventOccupied(newOwner - 1, pt); + getLua().EventOccupied(newOwner - 1, pt); } } } @@ -500,9 +500,9 @@ bool GameWorld::DoesDestructionChangeTerritory(const noBaseBuilding& building) c { // Get the military radius this building affects. Bld is either a military building or a harbor building site RTTR_Assert( - (building.GetBuildingType() == BuildingType::HarborBuilding && dynamic_cast(&building)) + (building.getBuildingType() == BuildingType::HarborBuilding && dynamic_cast(&building)) || dynamic_cast(&building)); - const unsigned militaryRadius = building.GetMilitaryRadius(); + const unsigned militaryRadius = building.getMilitaryRadius(); RTTR_Assert(militaryRadius > 0u); const TerritoryRegion region = CreateTerritoryRegion(building, militaryRadius, TerritoryChangeReason::Destroyed); @@ -511,19 +511,19 @@ bool GameWorld::DoesDestructionChangeTerritory(const noBaseBuilding& building) c RTTR_FOREACH_PT(Position, region.size) { MapPoint curMapPt = MakeMapPoint(pt + region.startPt); - const MapNode& node = GetNode(curMapPt); - if(node.owner == region.GetOwner(pt)) + const MapNode& node = getNode(curMapPt); + if(node.owner == region.getOwner(pt)) continue; // AI can ignore water/snow/lava/swamp terrain (because it wouldn't help win the game) // So we check if any terrain is usable and if it is -> Land is important - if(GetDescription().get(node.t1).Is(ETerrain::Walkable) && GetDescription().get(node.t2).Is(ETerrain::Walkable)) + if(getDescription().get(node.t1).Is(ETerrain::Walkable) && getDescription().get(node.t2).Is(ETerrain::Walkable)) return true; // also check neighboring nodes since border will still count as player territory but not allow any buildings! - for(const MapPoint neighbourPt : GetNeighbours(curMapPt)) + for(const MapPoint neighbourPt : getNeighbours(curMapPt)) { - const MapNode& nNode = GetNode(neighbourPt); - if(GetDescription().get(nNode.t1).Is(ETerrain::Walkable) - || GetDescription().get(nNode.t2).Is(ETerrain::Walkable)) + const MapNode& nNode = getNode(neighbourPt); + if(getDescription().get(nNode.t1).Is(ETerrain::Walkable) + || getDescription().get(nNode.t2).Is(ETerrain::Walkable)) return true; } } @@ -533,19 +533,19 @@ bool GameWorld::DoesDestructionChangeTerritory(const noBaseBuilding& building) c TerritoryRegion GameWorld::CreateTerritoryRegion(const noBaseBuilding& building, unsigned radius, TerritoryChangeReason reason) const { - const MapPoint bldPos = building.GetPos(); + const MapPoint bldPos = building.getPos(); // Span at most half the map size (assert even sizes, given due to layout) - RTTR_Assert(GetWidth() % 2 == 0); - RTTR_Assert(GetHeight() % 2 == 0); - Extent halfSize(GetSize() / 2u); + RTTR_Assert(getWidth() % 2 == 0); + RTTR_Assert(getHeight() % 2 == 0); + Extent halfSize(getSize() / 2u); Extent radius2D = elMin(Extent::all(radius), halfSize); // Koordinaten erzeugen für TerritoryRegion const Position startPt = Position(bldPos) - radius2D; // If we want to check the same number of points right of bld as left we need a +1. // But we can't check more than the whole map. - const Extent size = elMin(2u * radius2D + Extent(1, 1), Extent(GetSize())); + const Extent size = elMin(2u * radius2D + Extent(1, 1), Extent(getSize())); TerritoryRegion region(startPt, size, *this); // Alle Gebäude ihr Terrain in der Nähe neu berechnen @@ -570,27 +570,27 @@ TerritoryRegion GameWorld::CreateTerritoryRegion(const noBaseBuilding& building, void GameWorld::CleanTerritoryRegion(TerritoryRegion& region, TerritoryChangeReason reason, const noBaseBuilding& triggerBld) const { - if(GetGGS().isEnabled(AddonId::NO_ALLIED_PUSH)) + if(getGGS().isEnabled(AddonId::NO_ALLIED_PUSH)) { - const bool isHq = triggerBld.GetBuildingType() == BuildingType::Headquarters; - const auto newOwnerOfTriggerBld = region.GetOwner(region.GetPosFromMapPos(triggerBld.GetPos())); + const bool isHq = triggerBld.getBuildingType() == BuildingType::Headquarters; + const auto newOwnerOfTriggerBld = region.getOwner(region.getPosFromMapPos(triggerBld.getPos())); // An HQ can be placed independently of the current owner. // So ensure the HQ position is always considered to belong to the HQ owner // if the TerritoryChangeReason is Build const auto ownerOfTriggerBld = - isHq && reason == TerritoryChangeReason::Build ? newOwnerOfTriggerBld : GetNode(triggerBld.GetPos()).owner; + isHq && reason == TerritoryChangeReason::Build ? newOwnerOfTriggerBld : getNode(triggerBld.getPos()).owner; RTTR_FOREACH_PT(Position, region.size) { const MapPoint curMapPt = MakeMapPoint(pt + region.startPt); - const auto oldOwner = GetNode(curMapPt).owner; - const auto newOwner = region.GetOwner(pt); + const auto oldOwner = getNode(curMapPt).owner; + const auto newOwner = region.getOwner(pt); // If nothing changed, there is nothing to do (ownerChanged was already initialized) if(oldOwner == newOwner) continue; - const bool ownersAllied = oldOwner > 0 && newOwner > 0 && GetPlayer(oldOwner - 1).IsAlly(newOwner - 1); + const bool ownersAllied = oldOwner > 0 && newOwner > 0 && getPlayer(oldOwner - 1).isAlly(newOwner - 1); if( // rule 1: only take territory from an ally if that ally loses a building // special case: headquarter can take territory @@ -601,7 +601,7 @@ void GameWorld::CleanTerritoryRegion(TerritoryRegion& region, TerritoryChangeRea ((ownerOfTriggerBld == oldOwner && oldOwner > 0 && reason == TerritoryChangeReason::Build) || (newOwnerOfTriggerBld == oldOwner && reason == TerritoryChangeReason::Captured))) { - region.SetOwner(pt, oldOwner); + region.setOwner(pt, oldOwner); } } } @@ -609,14 +609,14 @@ void GameWorld::CleanTerritoryRegion(TerritoryRegion& region, TerritoryChangeRea // "Cosmetics": Remove points that do not border to territory to avoid edges of border stones RTTR_FOREACH_PT(Position, region.size) { - uint8_t owner = region.GetOwner(pt); + uint8_t owner = region.getOwner(pt); if(!owner) continue; // Check if any neighbour is fully surrounded by player territory bool isPlayerTerritoryNear = false; for(const auto d : helpers::EnumRange{}) { - Position neighbour = ::GetNeighbour(pt + region.startPt, d); + Position neighbour = ::getNeighbour(pt + region.startPt, d); if(region.SafeGetOwner(neighbour - region.startPt) != owner) continue; // Don't check this point as it is always true @@ -635,7 +635,7 @@ void GameWorld::CleanTerritoryRegion(TerritoryRegion& region, TerritoryChangeRea uint8_t newOwner = 0; for(const auto d : helpers::EnumRange{}) { - Position neighbour = ::GetNeighbour(pt + region.startPt, d); + Position neighbour = ::getNeighbour(pt + region.startPt, d); uint8_t nbOwner = region.SafeGetOwner(neighbour - region.startPt); // No or same player? if(!nbOwner || nbOwner == owner) @@ -649,35 +649,35 @@ void GameWorld::CleanTerritoryRegion(TerritoryRegion& region, TerritoryChangeRea break; } } - region.SetOwner(pt, newOwner); + region.setOwner(pt, newOwner); } } void GameWorld::DestroyPlayerRests(const MapPoint pt, unsigned char newOwner, const noBaseBuilding* exception) { - noBase* no = GetNode(pt).obj; + noBase* no = getNode(pt).obj; if(!no || no == exception) return; // Destroy only flags, buildings and building sites - const NodalObjectType noType = no->GetType(); + const NodalObjectType noType = no->getType(); if(noType != NodalObjectType::Flag && noType != NodalObjectType::Building && noType != NodalObjectType::Buildingsite) return; // is the building on a node with a different owner? Border is allways destroyed. - if(static_cast(no)->GetPlayer() + 1 == newOwner && !IsBorderNode(pt, newOwner)) + if(static_cast(no)->getPlayer() + 1 == newOwner && !isBorderNode(pt, newOwner)) return; // Do not destroy military buildings that hold territory on their own // Normally they will be on players territory but it can happen that they don't // Examples: Improved alliances or expedition building sites - const noBase* noCheckMil = (noType == NodalObjectType::Flag) ? GetNO(GetNeighbour(pt, Direction::NorthWest)) : no; - const GO_Type goType = noCheckMil->GetGOT(); + const noBase* noCheckMil = (noType == NodalObjectType::Flag) ? getNO(getNeighbour(pt, Direction::NorthWest)) : no; + const GO_Type goType = noCheckMil->getGOT(); if(goType == GO_Type::NobHq || goType == GO_Type::NobHarborbuilding - || (goType == GO_Type::NobMilitary && !static_cast(noCheckMil)->IsNewBuilt()) - || (noCheckMil->GetType() == NodalObjectType::Buildingsite - && static_cast(noCheckMil)->IsHarborBuildingSiteFromSea())) + || (goType == GO_Type::NobMilitary && !static_cast(noCheckMil)->isNewBuilt()) + || (noCheckMil->getType() == NodalObjectType::Buildingsite + && static_cast(noCheckMil)->isHarborBuildingSiteFromSea())) { // LOG.write(("DestroyPlayerRests of hq, military, harbor or colony-harbor in construction stopped at x, %i y, // %i type, %i \n", x, y, noType); @@ -685,7 +685,7 @@ void GameWorld::DestroyPlayerRests(const MapPoint pt, unsigned char newOwner, co } // If it is a flag, destroy the building - if(noType == NodalObjectType::Flag && (!exception || no != exception->GetFlag())) + if(noType == NodalObjectType::Flag && (!exception || no != exception->getFlag())) static_cast(no)->DestroyAttachedBuilding(); DestroyNO(pt, false); @@ -694,16 +694,16 @@ void GameWorld::DestroyPlayerRests(const MapPoint pt, unsigned char newOwner, co void GameWorld::RoadNodeAvailable(const MapPoint pt) { // Figuren direkt daneben - for(const MapPoint nb : GetNeighbours(pt)) + for(const MapPoint nb : getNeighbours(pt)) { // Nochmal prüfen, ob er nun wirklich verfügbar ist (evtl blocken noch mehr usw.) - if(!IsRoadNodeForFigures(pt)) + if(!isRoadNodeForFigures(pt)) continue; // Figuren Bescheid sagen - for(noBase& object : GetFigures(nb)) + for(noBase& object : getFigures(nb)) { - if(object.GetType() == NodalObjectType::Figure) + if(object.getType() == NodalObjectType::Figure) static_cast(object).NodeFreed(pt); } } @@ -720,8 +720,8 @@ struct PotentialAttacker void GameWorld::Attack(const unsigned char player_attacker, const MapPoint pt, const unsigned short soldiers_count, const bool strong_soldiers) { - auto* attacked_building = GetSpecObj(pt); - if(!attacked_building || !attacked_building->IsAttackable(player_attacker)) + auto* attacked_building = getSpecObj(pt); + if(!attacked_building || !attacked_building->isAttackable(player_attacker)) return; // Militärgebäude in der Nähe finden @@ -733,21 +733,21 @@ void GameWorld::Attack(const unsigned char player_attacker, const MapPoint pt, c for(const auto* building : buildings) { // Muss ein Gebäude von uns sein und darf nur ein "normales Militärgebäude" sein (kein HQ etc.) - if(building->GetPlayer() != player_attacker || !BuildingProperties::IsMilitary(building->GetBuildingType())) + if(building->getPlayer() != player_attacker || !BuildingProperties::isMilitary(building->getBuildingType())) continue; const auto& milBld = static_cast(*building); - unsigned numSoldiersForCurrentBld = milBld.GetNumSoldiersForAttack(pt); + unsigned numSoldiersForCurrentBld = milBld.getNumSoldiersForAttack(pt); if(!numSoldiersForCurrentBld) continue; // Take soldier(s) unsigned curNumSoldiers = 0; - const unsigned distance = CalcDistance(building->GetPos(), pt); + const unsigned distance = CalcDistance(building->getPos(), pt); if(strong_soldiers) { // Strong soldiers first - for(auto& curSoldier : helpers::reverse(milBld.GetTroops())) + for(auto& curSoldier : helpers::reverse(milBld.getTroops())) { if(curNumSoldiers >= numSoldiersForCurrentBld) break; @@ -756,16 +756,16 @@ void GameWorld::Attack(const unsigned char player_attacker, const MapPoint pt, c new soldiers rank is greater OR new soldiers rank is equal AND new soldiers distance is smaller */ const auto itInsertPos = helpers::find_if( - potentialAttackers, [curRank = curSoldier.GetRank(), distance](const PotentialAttacker& pa) { - return pa.soldier->GetRank() < curRank - || (pa.soldier->GetRank() == curRank && pa.distance > distance); + potentialAttackers, [curRank = curSoldier.getRank(), distance](const PotentialAttacker& pa) { + return pa.soldier->getRank() < curRank + || (pa.soldier->getRank() == curRank && pa.distance > distance); }); potentialAttackers.emplace(itInsertPos, PotentialAttacker{&curSoldier, distance}); } } else { // Weak soldiers first - for(auto& curSoldier : milBld.GetTroops()) + for(auto& curSoldier : milBld.getTroops()) { if(curNumSoldiers >= numSoldiersForCurrentBld) break; @@ -774,9 +774,9 @@ void GameWorld::Attack(const unsigned char player_attacker, const MapPoint pt, c new soldiers rank is less OR new soldiers rank is equal AND new soldiers distance is smaller */ const auto itInsertPos = helpers::find_if( - potentialAttackers, [curRank = curSoldier.GetRank(), distance](const PotentialAttacker& pa) { - return pa.soldier->GetRank() > curRank - || (pa.soldier->GetRank() == curRank && pa.distance > distance); + potentialAttackers, [curRank = curSoldier.getRank(), distance](const PotentialAttacker& pa) { + return pa.soldier->getRank() > curRank + || (pa.soldier->getRank() == curRank && pa.distance > distance); }); potentialAttackers.emplace(itInsertPos, PotentialAttacker{&curSoldier, distance}); } @@ -794,9 +794,9 @@ void GameWorld::Attack(const unsigned char player_attacker, const MapPoint pt, c curNumSoldiers++; } - if(curNumSoldiers > 0 && HasLua()) + if(curNumSoldiers > 0 && hasLua()) { - GetLua().EventAttack(player_attacker, attacked_building->GetPlayer(), curNumSoldiers); + getLua().EventAttack(player_attacker, attacked_building->getPlayer(), curNumSoldiers); } } @@ -807,18 +807,18 @@ struct CmpSeaAttacker : private T_RankCmp bool operator()(const GameWorldBase::PotentialSeaAttacker& lhs, const GameWorldBase::PotentialSeaAttacker& rhs) { // Sort after rank, then armor then distance then objId - if(lhs.soldier->GetRank() == rhs.soldier->GetRank()) + if(lhs.soldier->getRank() == rhs.soldier->getRank()) { - if(lhs.soldier->HasArmor() == rhs.soldier->HasArmor()) + if(lhs.soldier->hasArmor() == rhs.soldier->hasArmor()) { if(lhs.distance == rhs.distance) - return (lhs.soldier->GetObjId() < rhs.soldier->GetObjId()); // tie breaker + return (lhs.soldier->getObjId() < rhs.soldier->getObjId()); // tie breaker else return lhs.distance < rhs.distance; } else - return T_RankCmp::operator()(lhs.soldier->HasArmor() ? 1 : 0, rhs.soldier->HasArmor() ? 1 : 0); + return T_RankCmp::operator()(lhs.soldier->hasArmor() ? 1 : 0, rhs.soldier->hasArmor() ? 1 : 0); } else - return T_RankCmp::operator()(lhs.soldier->GetRank(), rhs.soldier->GetRank()); + return T_RankCmp::operator()(lhs.soldier->getRank(), rhs.soldier->getRank()); } }; @@ -826,7 +826,7 @@ void GameWorld::AttackViaSea(const unsigned char player_attacker, const MapPoint const unsigned short soldiers_count, const bool strong_soldiers) { // Verfügbare Soldaten herausfinden - std::vector attackers = GetSoldiersForSeaAttack(player_attacker, pt); + std::vector attackers = getSoldiersForSeaAttack(player_attacker, pt); if(attackers.empty()) return; @@ -836,7 +836,7 @@ void GameWorld::AttackViaSea(const unsigned char player_attacker, const MapPoint else helpers::sort(attackers, CmpSeaAttacker>()); - auto& attacked_building = *GetSpecObj(pt); + auto& attacked_building = *getSpecObj(pt); unsigned counter = 0; for(GameWorldBase::PotentialSeaAttacker& pa : attackers) { @@ -846,13 +846,13 @@ void GameWorld::AttackViaSea(const unsigned char player_attacker, const MapPoint counter++; } - if(counter > 0 && HasLua()) + if(counter > 0 && hasLua()) { - GetLua().EventAttack(player_attacker, attacked_building.GetPlayer(), counter); + getLua().EventAttack(player_attacker, attacked_building.getPlayer(), counter); } } -TradePathCache& GameWorld::GetTradePathCache() +TradePathCache& GameWorld::getTradePathCache() { if(!tradePathCache) tradePathCache = std::make_unique(*this); @@ -865,10 +865,10 @@ void GameWorld::setEconHandler(std::unique_ptr handler) econHandler = std::move(handler); } -bool GameWorld::IsRoadNodeForFigures(const MapPoint pt) +bool GameWorld::isRoadNodeForFigures(const MapPoint pt) { // Figuren durchgehen, bei Kämpfen und wartenden Angreifern sowie anderen wartenden Figuren stoppen! - for(const noBase& object : GetFigures(pt)) + for(const noBase& object : getFigures(pt)) { // andere wartende Figuren /* @@ -884,13 +884,13 @@ bool GameWorld::IsRoadNodeForFigures(const MapPoint pt) }*/ // Kampf - if(object.GetGOT() == GO_Type::Fighting) + if(object.getGOT() == GO_Type::Fighting) { if(static_cast(object).IsActive()) return false; - } else if(object.GetGOT() == GO_Type::NofAttacker) // wartende Angreifer + } else if(object.getGOT() == GO_Type::NofAttacker) // wartende Angreifer { - if(static_cast(object).IsBlockingRoads()) + if(static_cast(object).isBlockingRoads()) return false; } } @@ -906,27 +906,27 @@ void GameWorld::StopOnRoads(const MapPoint pt, const helpers::OptionalEnum figures; // Auch vom Ausgangspunkt aus, da sie im GameWorld wegem Zeichnen auch hier hängen können! - for(auto& fieldFigure : GetFigures(pt)) + for(auto& fieldFigure : getFigures(pt)) { - if(fieldFigure.GetType() == NodalObjectType::Figure) + if(fieldFigure.getType() == NodalObjectType::Figure) figures.push_back(static_cast(&fieldFigure)); } // Und natürlich in unmittelbarer Umgebung suchen - for(const MapPoint nb : GetNeighbours(pt)) + for(const MapPoint nb : getNeighbours(pt)) { - for(auto& fieldFigure : GetFigures(nb)) + for(auto& fieldFigure : getFigures(nb)) { - if(fieldFigure.GetType() == NodalObjectType::Figure) + if(fieldFigure.getType() == NodalObjectType::Figure) figures.push_back(static_cast(&fieldFigure)); } } for(auto& figure : figures) { - if(dir && *dir + 3u == static_cast(figure)->GetCurMoveDir()) + if(dir && *dir + 3u == static_cast(figure)->getCurMoveDir()) { - if(GetNeighbour(pt, *dir) == static_cast(figure)->GetPos()) + if(getNeighbour(pt, *dir) == static_cast(figure)->getPos()) continue; } @@ -937,9 +937,9 @@ void GameWorld::StopOnRoads(const MapPoint pt, const helpers::OptionalEnum(pt); + auto* flag = getSpecObj(pt); if(flag) { flag->DestroyAttachedBuilding(); @@ -950,10 +950,10 @@ void GameWorld::Armageddon() void GameWorld::Armageddon(const unsigned char player) { - RTTR_FOREACH_PT(MapPoint, GetSize()) + RTTR_FOREACH_PT(MapPoint, getSize()) { - auto* flag = GetSpecObj(pt); - if(flag && flag->GetPlayer() == player) + auto* flag = getSpecObj(pt); + if(flag && flag->getPlayer() == player) { flag->DestroyAttachedBuilding(); DestroyNO(pt, false); @@ -964,51 +964,51 @@ void GameWorld::Armageddon(const unsigned char player) bool GameWorld::ValidWaitingAroundBuildingPoint(const MapPoint pt, const MapPoint center) { // Gültiger Punkt für Figuren? - if(!PathConditionHuman(*this).IsNodeOk(pt)) + if(!PathConditionHuman(*this).isNodeOk(pt)) return false; // Objekte, die sich hier befinden durchgehen - for(const auto& figure : GetFigures(pt)) + for(const auto& figure : getFigures(pt)) { // Ist hier ein anderer Soldat, der hier ebenfalls wartet? - if(figure.GetGOT() == GO_Type::NofAttacker || figure.GetGOT() == GO_Type::NofAggressivedefender - || figure.GetGOT() == GO_Type::NofDefender) + if(figure.getGOT() == GO_Type::NofAttacker || figure.getGOT() == GO_Type::NofAggressivedefender + || figure.getGOT() == GO_Type::NofDefender) { - const auto state = static_cast(figure).GetState(); + const auto state = static_cast(figure).getState(); if(state == nofActiveSoldier::SoldierState::WaitingForFight || state == nofActiveSoldier::SoldierState::AttackingWaitingAroundBuilding) return false; } // Oder ein Kampf, der hier tobt? - if(figure.GetGOT() == GO_Type::Fighting) + if(figure.getGOT() == GO_Type::Fighting) return false; } // object wall or impassable terrain increasing my path to target length to a higher value than the direct distance? return FindHumanPath(pt, center, CalcDistance(pt, center)).has_value(); } -bool GameWorld::IsValidPointForFighting(MapPoint pt, const nofActiveSoldier& soldier, +bool GameWorld::isValidPointForFighting(MapPoint pt, const nofActiveSoldier& soldier, bool avoid_military_building_flags) { // Is this a flag of a military building? - if(avoid_military_building_flags && GetNO(pt)->GetGOT() == GO_Type::Flag) + if(avoid_military_building_flags && getNO(pt)->getGOT() == GO_Type::Flag) { - GO_Type got = GetNO(GetNeighbour(pt, Direction::NorthWest))->GetGOT(); + GO_Type got = getNO(getNeighbour(pt, Direction::NorthWest))->getGOT(); if(got == GO_Type::NobMilitary || got == GO_Type::NobHarborbuilding || got == GO_Type::NobHq) return false; } // Objekte, die sich hier befinden durchgehen - for(const auto& figure : GetFigures(pt)) + for(const auto& figure : getFigures(pt)) { // Ist hier ein anderer Soldat, der hier ebenfalls wartet ? - const GO_Type got = figure.GetGOT(); + const GO_Type got = figure.getGOT(); if(got == GO_Type::NofAttacker || got == GO_Type::NofAggressivedefender || got == GO_Type::NofDefender) { if(static_cast(&figure) == &soldier) continue; - switch(static_cast(figure).GetState()) + switch(static_cast(figure).getState()) { default: break; case nofActiveSoldier::SoldierState::WaitingForFight: @@ -1020,17 +1020,17 @@ bool GameWorld::IsValidPointForFighting(MapPoint pt, const nofActiveSoldier& sol { const auto& fight = static_cast(figure); // A soldier currently fighting shouldn't look for a new fighting spot - RTTR_Assert(!fight.IsFighter(soldier)); + RTTR_Assert(!fight.isFighter(soldier)); if(fight.IsActive()) return false; } } // Liegt hier was rum auf dem man nicht kämpfen sollte? - const BlockingManner bm = GetNO(pt)->GetBM(); + const BlockingManner bm = getNO(pt)->getBM(); return bm == BlockingManner::None || bm == BlockingManner::Tree || bm == BlockingManner::Flag; } -bool GameWorld::IsPointCompletelyVisible(const MapPoint& pt, unsigned char player, +bool GameWorld::isPointCompletelyVisible(const MapPoint& pt, unsigned char player, const noBaseBuilding* exception) const { sortedMilitaryBlds buildings = LookForMilitaryBuildings(pt, 3); @@ -1038,16 +1038,16 @@ bool GameWorld::IsPointCompletelyVisible(const MapPoint& pt, unsigned char playe // Sichtbereich von Militärgebäuden for(const nobBaseMilitary* milBld : buildings) { - if(milBld->GetPlayer() == player && milBld != exception) + if(milBld->getPlayer() == player && milBld != exception) { // Prüfen, obs auch unbesetzt ist - if(milBld->GetGOT() == GO_Type::NobMilitary) + if(milBld->getGOT() == GO_Type::NobMilitary) { - if(static_cast(milBld)->IsNewBuilt()) + if(static_cast(milBld)->isNewBuilt()) continue; } - if(CalcDistance(pt, milBld->GetPos()) <= unsigned(milBld->GetMilitaryRadius() + VISUALRANGE_MILITARY)) + if(CalcDistance(pt, milBld->getPos()) <= unsigned(milBld->getMilitaryRadius() + VISUALRANGE_MILITARY)) return true; } } @@ -1055,18 +1055,18 @@ bool GameWorld::IsPointCompletelyVisible(const MapPoint& pt, unsigned char playe // Sichtbereich von Hafenbaustellen for(const noBuildingSite* bldSite : harbor_building_sites_from_sea) { - if(bldSite->GetPlayer() == player && bldSite != exception) + if(bldSite->getPlayer() == player && bldSite != exception) { - if(CalcDistance(pt, bldSite->GetPos()) <= unsigned(HARBOR_RADIUS + VISUALRANGE_MILITARY)) + if(CalcDistance(pt, bldSite->getPos()) <= unsigned(HARBOR_RADIUS + VISUALRANGE_MILITARY)) return true; } } // Sichtbereich von Spähtürmen - for(const nobUsual* bld : GetPlayer(player).GetBuildingRegister().GetBuildings(BuildingType::LookoutTower)) //-V807 + for(const nobUsual* bld : getPlayer(player).getBuildingRegister().getBuildings(BuildingType::LookoutTower)) //-V807 { // Ist Späturm überhaupt besetzt? - if(!bld->HasWorker()) + if(!bld->hasWorker()) continue; // Nicht die Ausnahme wählen @@ -1074,7 +1074,7 @@ bool GameWorld::IsPointCompletelyVisible(const MapPoint& pt, unsigned char playe continue; // Liegt Spähturm innerhalb des Sichtradius? - if(CalcDistance(pt, bld->GetPos()) <= VISUALRANGE_LOOKOUTTOWER) + if(CalcDistance(pt, bld->getPos()) <= VISUALRANGE_LOOKOUTTOWER) return true; } @@ -1082,26 +1082,26 @@ bool GameWorld::IsPointCompletelyVisible(const MapPoint& pt, unsigned char playe const unsigned range = std::max(VISUALRANGE_SCOUT, VISUALRANGE_SOLDIER); if(CheckPointsInRadius( pt, range, - [this, player](auto pt, auto distance) { return this->IsScoutingFigureOnNode(pt, player, distance); }, true)) + [this, player](auto pt, auto distance) { return this->isScoutingFigureOnNode(pt, player, distance); }, true)) { return true; } - return IsPointScoutedByShip(pt, player); + return isPointScoutedByShip(pt, player); } -bool GameWorld::IsScoutingFigureOnNode(const MapPoint& pt, unsigned player, unsigned distance) const +bool GameWorld::isScoutingFigureOnNode(const MapPoint& pt, unsigned player, unsigned distance) const { static_assert(VISUALRANGE_SCOUT >= VISUALRANGE_SOLDIER, "Visual range changed. Check loop below!"); // Späher/Soldaten in der Nähe prüfen und direkt auf dem Punkt - for(const noBase& obj : GetFigures(pt)) + for(const noBase& obj : getFigures(pt)) { - const GO_Type got = obj.GetGOT(); + const GO_Type got = obj.getGOT(); // Check for scout. Note: no need to check for distance as scouts have higher distance than soldiers if(got == GO_Type::NofScoutFree) { // Prüfen, ob er auch am Erkunden ist und an der Position genau und ob es vom richtigen Spieler ist - if(static_cast(obj).GetPlayer() == player) + if(static_cast(obj).getPlayer() == player) return true; else continue; @@ -1110,14 +1110,14 @@ bool GameWorld::IsScoutingFigureOnNode(const MapPoint& pt, unsigned player, unsi // Soldaten? if(got == GO_Type::NofAttacker || got == GO_Type::NofAggressivedefender) { - if(static_cast(obj).GetPlayer() == player) + if(static_cast(obj).getPlayer() == player) return true; } // Kämpfe (wo auch Soldaten drin sind) else if(got == GO_Type::Fighting) { // Prüfen, ob da ein Soldat vom angegebenen Spieler dabei ist - if(static_cast(obj).IsSoldierOfPlayer(player)) + if(static_cast(obj).isSoldierOfPlayer(player)) return true; } } @@ -1126,13 +1126,13 @@ bool GameWorld::IsScoutingFigureOnNode(const MapPoint& pt, unsigned player, unsi return false; } -bool GameWorld::IsPointScoutedByShip(const MapPoint& pt, unsigned player) const +bool GameWorld::isPointScoutedByShip(const MapPoint& pt, unsigned player) const { - const std::vector& ships = GetPlayer(player).GetShips(); + const std::vector& ships = getPlayer(player).getShips(); for(const noShip* ship : ships) { - unsigned shipDistance = CalcDistance(pt, ship->GetPos()); - if(shipDistance <= ship->GetVisualRange()) + unsigned shipDistance = CalcDistance(pt, ship->getPos()); + if(shipDistance <= ship->getVisualRange()) return true; } return false; @@ -1141,10 +1141,10 @@ bool GameWorld::IsPointScoutedByShip(const MapPoint& pt, unsigned player) const void GameWorld::RecalcVisibility(const MapPoint pt, const unsigned char player, const noBaseBuilding* const exception) { /// Zustand davor merken - Visibility visibility_before = GetNode(pt).fow[player].visibility; + Visibility visibility_before = getNode(pt).fow[player].visibility; /// Herausfinden, ob vollständig sichtbar - bool visible = IsPointCompletelyVisible(pt, player, exception); + bool visible = isPointCompletelyVisible(pt, player, exception); // Vollständig sichtbar --> vollständig sichtbar logischerweise if(visible) @@ -1153,7 +1153,7 @@ void GameWorld::RecalcVisibility(const MapPoint pt, const unsigned char player, { // nicht mehr sichtbar // Je nach vorherigen Zustand und Einstellung entscheiden - switch(GetGGS().exploration) + switch(getGGS().exploration) { case Exploration::Disabled: case Exploration::Classic: @@ -1165,7 +1165,7 @@ void GameWorld::RecalcVisibility(const MapPoint pt, const unsigned char player, // wenn es mal sichtbar war, nun im Nebel des Krieges if(visibility_before == Visibility::Visible) { - SetVisibility(pt, player, Visibility::FogOfWar, GetEvMgr().GetCurrentGF()); + setVisibility(pt, player, Visibility::FogOfWar, getEvMgr().getCurrentGF()); } break; default: throw std::logic_error("Invalid exploration value"); @@ -1175,7 +1175,7 @@ void GameWorld::RecalcVisibility(const MapPoint pt, const unsigned char player, void GameWorld::MakeVisible(const MapPoint pt, const unsigned char player) { - SetVisibility(pt, player, Visibility::Visible); + setVisibility(pt, player, Visibility::Visible); } void GameWorld::RecalcVisibilitiesAroundPoint(const MapPoint pt, const MapCoord radius, const unsigned char player, @@ -1203,7 +1203,7 @@ void GameWorld::RecalcMovingVisibilities(const MapPoint pt, const unsigned char // Zum Eckpunkt der beiden neuen sichtbaren Kanten gehen MapPoint t(pt); for(MapCoord i = 0; i < radius; ++i) - t = GetNeighbour(t, moving_dir); + t = getNeighbour(t, moving_dir); // Und zu beiden Abzweigungen weiter gehen und Punkte auf visible setzen MakeVisible(t, player); @@ -1211,20 +1211,20 @@ void GameWorld::RecalcMovingVisibilities(const MapPoint pt, const unsigned char Direction dir = moving_dir + 2u; for(MapCoord i = 0; i < radius; ++i) { - tt = GetNeighbour(tt, dir); + tt = getNeighbour(tt, dir); // Sichtbarkeit und für FOW-Gebiet vorherigen Besitzer merken // (d.h. der dort zuletzt war, als es für Spieler player sichtbar war) Visibility old_vis = CalcVisiblityWithAllies(tt, player); - unsigned char old_owner = GetNode(tt).fow[player].owner; + unsigned char old_owner = getNode(tt).fow[player].owner; MakeVisible(tt, player); // Neues feindliches Gebiet entdeckt? // Muss vorher undaufgedeckt oder FOW gewesen sein, aber in dem Fall darf dort vorher noch kein // Territorium entdeckt worden sein - unsigned char current_owner = GetNode(tt).owner; + unsigned char current_owner = getNode(tt).owner; if(current_owner && (old_vis == Visibility::Invisible || (old_vis == Visibility::FogOfWar && old_owner != current_owner))) { - if(GetPlayer(player).IsAttackable(current_owner - 1) && enemy_territory) + if(getPlayer(player).isAttackable(current_owner - 1) && enemy_territory) { *enemy_territory = tt; } @@ -1235,20 +1235,20 @@ void GameWorld::RecalcMovingVisibilities(const MapPoint pt, const unsigned char dir = moving_dir - 2u; for(MapCoord i = 0; i < radius; ++i) { - tt = GetNeighbour(tt, dir); + tt = getNeighbour(tt, dir); // Sichtbarkeit und für FOW-Gebiet vorherigen Besitzer merken // (d.h. der dort zuletzt war, als es für Spieler player sichtbar war) Visibility old_vis = CalcVisiblityWithAllies(tt, player); - unsigned char old_owner = GetNode(tt).fow[player].owner; + unsigned char old_owner = getNode(tt).fow[player].owner; MakeVisible(tt, player); // Neues feindliches Gebiet entdeckt? // Muss vorher undaufgedeckt oder FOW gewesen sein, aber in dem Fall darf dort vorher noch kein // Territorium entdeckt worden sein - unsigned char current_owner = GetNode(tt).owner; + unsigned char current_owner = getNode(tt).owner; if(current_owner && (old_vis == Visibility::Invisible || (old_vis == Visibility::FogOfWar && old_owner != current_owner))) { - if(GetPlayer(player).IsAttackable(current_owner - 1) && enemy_territory) + if(getPlayer(player).isAttackable(current_owner - 1) && enemy_territory) { *enemy_territory = tt; } @@ -1260,14 +1260,14 @@ void GameWorld::RecalcMovingVisibilities(const MapPoint pt, const unsigned char t = pt; Direction anti_moving_dir = moving_dir + 3u; for(MapCoord i = 0; i < radius + 1; ++i) - t = GetNeighbour(t, anti_moving_dir); + t = getNeighbour(t, anti_moving_dir); RecalcVisibility(t, player, nullptr); tt = t; dir = anti_moving_dir + 2u; for(MapCoord i = 0; i < radius; ++i) { - tt = GetNeighbour(tt, dir); + tt = getNeighbour(tt, dir); RecalcVisibility(tt, player, nullptr); } @@ -1275,29 +1275,29 @@ void GameWorld::RecalcMovingVisibilities(const MapPoint pt, const unsigned char dir = anti_moving_dir - 2u; for(unsigned i = 0; i < radius; ++i) { - tt = GetNeighbour(tt, dir); + tt = getNeighbour(tt, dir); RecalcVisibility(tt, player, nullptr); } } -bool GameWorld::IsBorderNode(const MapPoint pt, const unsigned char owner) const +bool GameWorld::isBorderNode(const MapPoint pt, const unsigned char owner) const { - return (GetNode(pt).owner == owner && !IsPlayerTerritory(pt, owner)); + return (getNode(pt).owner == owner && !isPlayerTerritory(pt, owner)); } /// Gründet vom Schiff aus eine neue Kolonie bool GameWorld::FoundColony(const HarborId harbor, const unsigned char player, const SeaId seaId) { // Ist es hier überhaupt noch möglich, eine Kolonie zu gründen? - if(!IsHarborAtSea(harbor, seaId) || !IsHarborPointFree(harbor, player)) + if(!isHarborAtSea(harbor, seaId) || !isHarborPointFree(harbor, player)) return false; - MapPoint pos(GetHarborPoint(harbor)); + MapPoint pos(getHarborPoint(harbor)); DestroyNO(pos, false); // Hafenbaustelle errichten auto* bs = new noBuildingSite(pos, player); - SetNO(pos, bs); + setNO(pos, bs); AddHarborBuildingSiteFromSea(bs); if(gi) @@ -1307,46 +1307,46 @@ bool GameWorld::FoundColony(const HarborId harbor, const unsigned char player, c // BQ neu berechnen (evtl durch RecalcTerritory noch nicht geschehen) RecalcBQAroundPointBig(pos); - GetNotifications().publish(ExpeditionNote(ExpeditionNote::ColonyFounded, player, pos)); + getNotifications().publish(ExpeditionNote(ExpeditionNote::ColonyFounded, player, pos)); return true; } void GameWorld::RemoveHarborBuildingSiteFromSea(noBuildingSite* building_site) { - RTTR_Assert(building_site->GetBuildingType() == BuildingType::HarborBuilding); + RTTR_Assert(building_site->getBuildingType() == BuildingType::HarborBuilding); harbor_building_sites_from_sea.remove(building_site); } -bool GameWorld::IsHarborBuildingSiteFromSea(const noBuildingSite* building_site) const +bool GameWorld::isHarborBuildingSiteFromSea(const noBuildingSite* building_site) const { return helpers::contains(harbor_building_sites_from_sea, building_site); } -std::vector GameWorld::GetUnexploredHarborPoints(const HarborId hbIdToSkip, const SeaId seaId, +std::vector GameWorld::getUnexploredHarborPoints(const HarborId hbIdToSkip, const SeaId seaId, unsigned playerId) const { std::vector hps; - for(const auto i : helpers::idRange(GetNumHarborPoints())) + for(const auto i : helpers::idRange(getNumHarborPoints())) { - if(i == hbIdToSkip || !IsHarborAtSea(i, seaId)) + if(i == hbIdToSkip || !isHarborAtSea(i, seaId)) continue; - if(CalcVisiblityWithAllies(GetHarborPoint(i), playerId) != Visibility::Visible) + if(CalcVisiblityWithAllies(getHarborPoint(i), playerId) != Visibility::Visible) hps.push_back(i); } return hps; } -MapNode& GameWorld::GetNodeWriteable(const MapPoint pt) +MapNode& GameWorld::getNodeWriteable(const MapPoint pt) { - return GetNodeInt(pt); + return getNodeInt(pt); } void GameWorld::VisibilityChanged(const MapPoint pt, unsigned player, Visibility oldVis, Visibility newVis) { GameWorldBase::VisibilityChanged(pt, player, oldVis, newVis); - if(oldVis == Visibility::Invisible && newVis == Visibility::Visible && HasLua()) - GetLua().EventExplored(player, pt, GetNode(pt).owner); + if(oldVis == Visibility::Invisible && newVis == Visibility::Visible && hasLua()) + getLua().EventExplored(player, pt, getNode(pt).owner); // Minimap Bescheid sagen if(gi) gi->GI_UpdateMinimap(pt); diff --git a/libs/s25main/world/GameWorld.h b/libs/s25main/world/GameWorld.h index 4ae3d05d15..2f204a9b23 100644 --- a/libs/s25main/world/GameWorld.h +++ b/libs/s25main/world/GameWorld.h @@ -38,14 +38,14 @@ class GameWorld : public GameWorldBase void DestroyPlayerRests(MapPoint pt, unsigned char newOwner, const noBaseBuilding* exception); /// Return if there are deco-objects that can be removed when building roads - bool HasRemovableObjForRoad(MapPoint pt) const; + bool hasRemovableObjForRoad(MapPoint pt) const; - bool IsPointCompletelyVisible(const MapPoint& pt, unsigned char player, const noBaseBuilding* exception) const; + bool isPointCompletelyVisible(const MapPoint& pt, unsigned char player, const noBaseBuilding* exception) const; /// Return if there is a scout (or an attacking soldier) of this player at that node with a visual range of at most /// the given distance. Excludes scouting ships! - bool IsScoutingFigureOnNode(const MapPoint& pt, unsigned player, unsigned distance) const; + bool isScoutingFigureOnNode(const MapPoint& pt, unsigned player, unsigned distance) const; /// Return true, if the point is explored by any ship of the player - bool IsPointScoutedByShip(const MapPoint& pt, unsigned player) const; + bool isPointScoutedByShip(const MapPoint& pt, unsigned player) const; /// Berechnet die Sichtbarkeit eines Punktes neu für den angegebenen Spieler /// exception ist ein Gebäude (Spähturm, Militärgebäude), was nicht mit in die Berechnung einbezogen /// werden soll, z.b. weil es abgerissen wird @@ -65,12 +65,12 @@ class GameWorld : public GameWorldBase ~GameWorld() override; /// Stellt anderen Spielern/Spielobjekten das Game-GUI-Interface zur Verfüung - GameInterface* GetGameInterface() const { return gi; } - TradePathCache& GetTradePathCache(); + GameInterface* getGameInterface() const { return gi; } + TradePathCache& getTradePathCache(); void setEconHandler(std::unique_ptr handler); /// Kann dieser Punkt von auf Straßen laufenden Menschen betreten werden? (Kämpfe!) - bool IsRoadNodeForFigures(MapPoint pt); + bool isRoadNodeForFigures(MapPoint pt); /// Lässt alle Figuren, die auf diesen Punkt auf Wegen zulaufen, anhalten auf dem Weg (wegen einem Kampf) void StopOnRoads(MapPoint pt, helpers::OptionalEnum dir = std::nullopt); @@ -106,7 +106,7 @@ class GameWorld : public GameWorldBase MapPoint* dest = nullptr) const; /// setzt den Straßen-Wert um den Punkt X,Y. - void SetPointRoad(MapPoint pt, Direction dir, PointRoad type); + void setPointRoad(MapPoint pt, Direction dir, PointRoad type); /// Actually build a road. Return the endpoint of the built road on success, else an invalid state. MapPoint BuildRoad(unsigned char playerId, bool boat_road, MapPoint start, const std::vector& route); @@ -123,7 +123,7 @@ class GameWorld : public GameWorldBase /// Greift ein Militäregebäude mit Schiffen an void AttackViaSea(unsigned char player_attacker, MapPoint pt, unsigned short soldiers_count, bool strong_soldiers); - MilitarySquares& GetMilitarySquares(); + MilitarySquares& getMilitarySquares(); /// Lässt alles spielerische abbrennen, indem es alle Flaggen der Spieler zerstört void Armageddon(); @@ -134,7 +134,7 @@ class GameWorld : public GameWorldBase /// Ist der Punkt ein geeigneter Platz zum Warten vor dem Militärgebäude bool ValidWaitingAroundBuildingPoint(MapPoint pt, MapPoint center); /// Is this point a valid point for the given soldier to fight? - bool IsValidPointForFighting(MapPoint pt, const nofActiveSoldier& soldier, bool avoid_military_building_flags); + bool isValidPointForFighting(MapPoint pt, const nofActiveSoldier& soldier, bool avoid_military_building_flags); /// Berechnet die Sichtbarkeiten neu um einen Punkt mit radius void RecalcVisibilitiesAroundPoint(MapPoint pt, MapCoord radius, unsigned char player, @@ -146,7 +146,7 @@ class GameWorld : public GameWorldBase MapPoint* enemy_territory); /// Return whether this is a border node (node belongs to player, but not all others around) - bool IsBorderNode(MapPoint pt, unsigned char owner) const; + bool isBorderNode(MapPoint pt, unsigned char owner) const; /// Gründet vom Schiff aus eine neue Kolonie, gibt true zurück bei Erfolg bool FoundColony(HarborId harbor, unsigned char player, SeaId seaId); @@ -158,12 +158,12 @@ class GameWorld : public GameWorldBase /// Removes it. It is allowed to be called with a regular harbor building site (no-op in that case) void RemoveHarborBuildingSiteFromSea(noBuildingSite* building_site); /// Gibt zurück, ob eine bestimmte Baustellen eine Baustelle ist, die vom Schiff aus errichtet wurde - bool IsHarborBuildingSiteFromSea(const noBuildingSite* building_site) const; + bool isHarborBuildingSiteFromSea(const noBuildingSite* building_site) const; /// Liefert eine Liste der Hafenpunkte, die von einem bestimmten Hafenpunkt erreichbar sind - std::vector GetUnexploredHarborPoints(HarborId hbIdToSkip, SeaId seaId, unsigned playerId) const; + std::vector getUnexploredHarborPoints(HarborId hbIdToSkip, SeaId seaId, unsigned playerId) const; /// Writeable access to node. Use only for initial map setup! - MapNode& GetNodeWriteable(MapPoint pt); + MapNode& getNodeWriteable(MapPoint pt); /// Recalculates where border stones should be done after a change in the given region void RecalcBorderStones(Position startPt, Extent areaSize); diff --git a/libs/s25main/world/GameWorldBase.cpp b/libs/s25main/world/GameWorldBase.cpp index 72d0202882..14c186b68f 100644 --- a/libs/s25main/world/GameWorldBase.cpp +++ b/libs/s25main/world/GameWorldBase.cpp @@ -38,30 +38,30 @@ GameWorldBase::~GameWorldBase() = default; void GameWorldBase::Init(const MapExtent& mapSize, DescIdx lt) { - RTTR_Assert(GetDescription().terrain.size() > 0); // Must have game data initialized + RTTR_Assert(getDescription().terrain.size() > 0); // Must have game data initialized World::Init(mapSize, lt); freePathFinder->Init(mapSize); } void GameWorldBase::InitAfterLoad() { - RTTR_FOREACH_PT(MapPoint, GetSize()) + RTTR_FOREACH_PT(MapPoint, getSize()) RecalcBQ(pt); } -GamePlayer& GameWorldBase::GetPlayer(const unsigned id) +GamePlayer& GameWorldBase::getPlayer(const unsigned id) { - RTTR_Assert(id < GetNumPlayers()); + RTTR_Assert(id < getNumPlayers()); return players[id]; } -const GamePlayer& GameWorldBase::GetPlayer(const unsigned id) const +const GamePlayer& GameWorldBase::getPlayer(const unsigned id) const { - RTTR_Assert(id < GetNumPlayers()); + RTTR_Assert(id < getNumPlayers()); return players[id]; } -unsigned GameWorldBase::GetNumPlayers() const +unsigned GameWorldBase::getNumPlayers() const { return players.size(); } @@ -76,7 +76,7 @@ s25util::span GameWorldBase::getPlayers() const return players; } -bool GameWorldBase::IsSinglePlayer() const +bool GameWorldBase::isSinglePlayer() const { bool foundPlayer = false; for(const PlayerInfo& player : players) @@ -92,35 +92,35 @@ bool GameWorldBase::IsSinglePlayer() const return true; } -ShipPathData& GameWorldBase::GetShipPathData() const +ShipPathData& GameWorldBase::getShipPathData() const { if(!shipPathData) shipPathData = std::make_unique(*this); return *shipPathData; } -bool GameWorldBase::IsRoadAvailable(const bool boat_road, const MapPoint pt) const +bool GameWorldBase::isRoadAvailable(const bool boat_road, const MapPoint pt) const { // Hindernisse - if(GetNode(pt).obj) + if(getNode(pt).obj) { - BlockingManner bm = GetNode(pt).obj->GetBM(); + BlockingManner bm = getNode(pt).obj->getBM(); if(bm != BlockingManner::None) return false; } // dont build on the border - if(GetNode(pt).boundary_stones[BorderStonePos::OnPoint]) + if(getNode(pt).boundary_stones[BorderStonePos::OnPoint]) return false; for(const auto dir : helpers::EnumRange{}) { // Roads around charburner piles are not possible - if(GetNO(GetNeighbour(pt, dir))->GetBM() == BlockingManner::NothingAround) + if(getNO(getNeighbour(pt, dir))->getBM() == BlockingManner::NothingAround) return false; // Other roads at this point? - if(GetPointRoad(pt, dir) != PointRoad::None) + if(getPointRoad(pt, dir) != PointRoad::None) return false; } @@ -129,9 +129,9 @@ bool GameWorldBase::IsRoadAvailable(const bool boat_road, const MapPoint pt) con { bool flagPossible = false; - for(const DescIdx tIdx : GetTerrainsAround(pt)) + for(const DescIdx tIdx : getTerrainsAround(pt)) { - const TerrainBQ bq = GetDescription().get(tIdx).GetBQ(); + const TerrainBQ bq = getDescription().get(tIdx).GetBQ(); if(bq == TerrainBQ::Danger) return false; else if(bq != TerrainBQ::Nothing) @@ -142,7 +142,7 @@ bool GameWorldBase::IsRoadAvailable(const bool boat_road, const MapPoint pt) con } else { // Beim Wasserweg muss um den Punkt herum Wasser sein - if(!IsWaterPoint(pt)) + if(!isWaterPoint(pt)) return false; } @@ -156,43 +156,43 @@ bool GameWorldBase::RoadAlreadyBuilt(const bool /*boat_road*/, const MapPoint st for(unsigned i = 0; i < route.size() - 1; ++i) { // Richtiger Weg auf diesem Punkt? - if(GetPointRoad(tmp, route[i]) == PointRoad::None) + if(getPointRoad(tmp, route[i]) == PointRoad::None) return false; - tmp = GetNeighbour(tmp, route[i]); + tmp = getNeighbour(tmp, route[i]); } return true; } -bool GameWorldBase::IsOnRoad(const MapPoint& pt) const +bool GameWorldBase::isOnRoad(const MapPoint& pt) const { // This must be fast for BQ calculation so don't use GetVisiblePointRoad for(const auto roadDir : helpers::EnumRange{}) - if(GetRoad(pt, roadDir) != PointRoad::None) + if(getRoad(pt, roadDir) != PointRoad::None) return true; for(const auto roadDir : helpers::EnumRange{}) { const Direction oppositeDir = getOppositeDir(roadDir); - if(GetRoad(GetNeighbour(pt, oppositeDir), roadDir) != PointRoad::None) + if(getRoad(getNeighbour(pt, oppositeDir), roadDir) != PointRoad::None) return true; } return false; } -bool GameWorldBase::IsFlagAround(const MapPoint& pt) const +bool GameWorldBase::isFlagAround(const MapPoint& pt) const { - for(const MapPoint nb : GetNeighbours(pt)) + for(const MapPoint nb : getNeighbours(pt)) { - if(GetNO(nb)->GetBM() == BlockingManner::Flag) + if(getNO(nb)->getBM() == BlockingManner::Flag) return true; } return false; } -bool GameWorldBase::IsAnyNeighborOwned(const MapPoint& pt) const +bool GameWorldBase::isAnyNeighborOwned(const MapPoint& pt) const { - for(const MapPoint& nb : GetNeighbours(pt)) - if(GetNode(nb).owner) + for(const MapPoint& nb : getNeighbours(pt)) + if(getNode(nb).owner) return true; return false; } @@ -202,30 +202,30 @@ void GameWorldBase::RecalcBQForRoad(const MapPoint pt) RecalcBQ(pt); for(const Direction dir : {Direction::East, Direction::SouthEast, Direction::SouthWest}) - RecalcBQ(GetNeighbour(pt, dir)); + RecalcBQ(getNeighbour(pt, dir)); } namespace { bool IsMilBldOfOwner(const GameWorldBase& gwb, MapPoint pt, unsigned char owner) { - return gwb.IsMilitaryBuildingOnNode(pt, false) && (gwb.GetNode(pt).owner == owner); + return gwb.isMilitaryBuildingOnNode(pt, false) && (gwb.getNode(pt).owner == owner); } } // namespace -bool GameWorldBase::IsMilitaryBuildingNearNode(const MapPoint nPt, const unsigned char player) const +bool GameWorldBase::isMilitaryBuildingNearNode(const MapPoint nPt, const unsigned char player) const { // Im Umkreis von 4 Punkten ein Militärgebäude suchen return CheckPointsInRadius( nPt, 4, [this, player](auto pt, auto) { return IsMilBldOfOwner(*this, pt, player + 1); }, false); } -bool GameWorldBase::IsMilitaryBuildingOnNode(const MapPoint pt, bool attackBldsOnly) const +bool GameWorldBase::isMilitaryBuildingOnNode(const MapPoint pt, bool attackBldsOnly) const { - const noBase* obj = GetNO(pt); - if(obj->GetType() == NodalObjectType::Building || obj->GetType() == NodalObjectType::Buildingsite) + const noBase* obj = getNO(pt); + if(obj->getType() == NodalObjectType::Building || obj->getType() == NodalObjectType::Buildingsite) { - BuildingType buildingType = static_cast(obj)->GetBuildingType(); - if(BuildingProperties::IsMilitary(buildingType)) + BuildingType buildingType = static_cast(obj)->getBuildingType(); + if(BuildingProperties::isMilitary(buildingType)) return true; if(!attackBldsOnly && (buildingType == BuildingType::Headquarters || buildingType == BuildingType::HarborBuilding)) @@ -237,18 +237,18 @@ bool GameWorldBase::IsMilitaryBuildingOnNode(const MapPoint pt, bool attackBldsO sortedMilitaryBlds GameWorldBase::LookForMilitaryBuildings(const MapPoint pt, unsigned short radius) const { - return militarySquares.GetBuildingsInRange(pt, radius); + return militarySquares.getBuildingsInRange(pt, radius); } -noFlag* GameWorldBase::GetRoadFlag(MapPoint pt, Direction& dir, const helpers::OptionalEnum prevDir) +noFlag* GameWorldBase::getRoadFlag(MapPoint pt, Direction& dir, const helpers::OptionalEnum prevDir) { // Getting a flag is const - const noFlag* flag = const_cast(this)->GetRoadFlag(pt, dir, prevDir); + const noFlag* flag = const_cast(this)->getRoadFlag(pt, dir, prevDir); // However we self are not const, so we allow returning a non-const flag pointer return const_cast(flag); } -const noFlag* GameWorldBase::GetRoadFlag(MapPoint pt, Direction& dir, helpers::OptionalEnum prevDir) const +const noFlag* GameWorldBase::getRoadFlag(MapPoint pt, Direction& dir, helpers::OptionalEnum prevDir) const { while(true) { @@ -256,7 +256,7 @@ const noFlag* GameWorldBase::GetRoadFlag(MapPoint pt, Direction& dir, helpers::O helpers::OptionalEnum nextDir; for(const auto i : helpers::EnumRange{}) { - if(i != prevDir && GetPointRoad(pt, i) != PointRoad::None) + if(i != prevDir && getPointRoad(pt, i) != PointRoad::None) { nextDir = i; break; @@ -266,39 +266,39 @@ const noFlag* GameWorldBase::GetRoadFlag(MapPoint pt, Direction& dir, helpers::O if(!nextDir) return nullptr; - pt = GetNeighbour(pt, *nextDir); + pt = getNeighbour(pt, *nextDir); // endlich am Ende des Weges und an einer Flagge angekommen? - if(GetNO(pt)->GetType() == NodalObjectType::Flag) + if(getNO(pt)->getType() == NodalObjectType::Flag) { dir = *nextDir + 3u; - return GetSpecObj(pt); + return getSpecObj(pt); } prevDir = *nextDir + 3u; } } -Position GameWorldBase::GetNodePos(const MapPoint pt) const +Position GameWorldBase::getNodePos(const MapPoint pt) const { - return ::GetNodePos(pt, GetNode(pt).altitude); + return ::getNodePos(pt, getNode(pt).altitude); } void GameWorldBase::VisibilityChanged(const MapPoint pt, unsigned player, Visibility /*oldVis*/, Visibility /*newVis*/) { - GetNotifications().publish(PlayerNodeNote(PlayerNodeNote::Visibility, pt, player)); + getNotifications().publish(PlayerNodeNote(PlayerNodeNote::Visibility, pt, player)); } /// Verändert die Höhe eines Punktes und die damit verbundenen Schatten void GameWorldBase::AltitudeChanged(const MapPoint pt) { RecalcBQAroundPointBig(pt); - GetNotifications().publish(NodeNote(NodeNote::Altitude, pt)); + getNotifications().publish(NodeNote(NodeNote::Altitude, pt)); } void GameWorldBase::RecalcBQAroundPoint(const MapPoint pt) { RecalcBQ(pt); - for(const MapPoint nb : GetNeighbours(pt)) + for(const MapPoint nb : getNeighbours(pt)) RecalcBQ(nb); } @@ -308,25 +308,25 @@ void GameWorldBase::RecalcBQAroundPointBig(const MapPoint pt) RecalcBQAroundPoint(pt); // And radius 2 for(unsigned i = 0; i < 12; ++i) - RecalcBQ(GetNeighbour2(pt, i)); + RecalcBQ(getNeighbour2(pt, i)); } Visibility GameWorldBase::CalcVisiblityWithAllies(const MapPoint pt, const unsigned char player) const { - const MapNode& node = GetNode(pt); + const MapNode& node = getNode(pt); Visibility best_visibility = node.fow[player].visibility; if(best_visibility == Visibility::Visible) return best_visibility; /// Teamsicht aktiviert? - if(GetGGS().teamView) + if(getGGS().teamView) { - const GamePlayer& curPlayer = GetPlayer(player); + const GamePlayer& curPlayer = getPlayer(player); // Dann prüfen, ob Teammitglieder evtl. eine bessere Sicht auf diesen Punkt haben - for(unsigned i = 0; i < GetNumPlayers(); ++i) + for(unsigned i = 0; i < getNumPlayers(); ++i) { - if(i != player && curPlayer.IsAlly(i)) + if(i != player && curPlayer.isAlly(i)) { if(node.fow[i].visibility > best_visibility) best_visibility = node.fow[i].visibility; @@ -337,14 +337,14 @@ Visibility GameWorldBase::CalcVisiblityWithAllies(const MapPoint pt, const unsig return best_visibility; } -bool GameWorldBase::IsCoastalPointToSeaWithHarbor(const MapPoint pt) const +bool GameWorldBase::isCoastalPointToSeaWithHarbor(const MapPoint pt) const { - SeaId sea = GetSeaFromCoastalPoint(pt); + SeaId sea = getSeaFromCoastalPoint(pt); if(sea) { - for(const auto i : helpers::idRange(GetNumHarborPoints())) + for(const auto i : helpers::idRange(getNumHarborPoints())) { - if(IsHarborAtSea(HarborId(i), sea)) + if(isHarborAtSea(HarborId(i), sea)) return true; } } @@ -352,30 +352,30 @@ bool GameWorldBase::IsCoastalPointToSeaWithHarbor(const MapPoint pt) const } template -HarborId GameWorldBase::GetHarborInDir(const MapPoint pt, const HarborId originHarborId, const ShipDirection& dir, +HarborId GameWorldBase::getHarborInDir(const MapPoint pt, const HarborId originHarborId, const ShipDirection& dir, T_IsHarborOk isHarborOk) const { RTTR_Assert(originHarborId); - const MapPoint hbPt = GetHarborPoint(originHarborId); + const MapPoint hbPt = getHarborPoint(originHarborId); // Find sea of harbor point SeaId seaId; for(const auto d : helpers::EnumRange{}) { - if(GetNeighbour(hbPt, d) == pt) + if(getNeighbour(hbPt, d) == pt) { - seaId = GetSeaId(originHarborId, d); + seaId = getSeaId(originHarborId, d); break; } } RTTR_Assert(seaId); - const std::vector& neighbors = GetHarborNeighbors(originHarborId, dir); + const std::vector& neighbors = getHarborNeighbors(originHarborId, dir); for(const auto& neighbor : neighbors) { - if(IsHarborAtSea(neighbor.id, seaId) && isHarborOk(neighbor.id)) + if(isHarborAtSea(neighbor.id, seaId) && isHarborOk(neighbor.id)) return neighbor.id; } @@ -394,82 +394,82 @@ struct IsPointOwnerDifferent bool operator()(const MapPoint pt, unsigned /*distance*/) const { - const unsigned char owner = gwb.GetNode(pt).owner; + const unsigned char owner = gwb.getNode(pt).owner; return owner != 0 && owner != cmpOwner; } }; /// Ist es an dieser Stelle für einen Spieler möglich einen Hafen zu bauen -bool GameWorldBase::IsHarborPointFree(const HarborId harborId, const unsigned char player) const +bool GameWorldBase::isHarborPointFree(const HarborId harborId, const unsigned char player) const { - MapPoint hbPos(GetHarborPoint(harborId)); + MapPoint hbPos(getHarborPoint(harborId)); // Überprüfen, ob das Gebiet in einem bestimmten Radius entweder vom Spieler oder gar nicht besetzt ist außer wenn // der Hafen und die Flagge im Spielergebiet liegen - MapPoint flagPos = GetNeighbour(hbPos, Direction::SouthEast); - if(GetNode(hbPos).owner != player + 1 || GetNode(flagPos).owner != player + 1) + MapPoint flagPos = getNeighbour(hbPos, Direction::SouthEast); + if(getNode(hbPos).owner != player + 1 || getNode(flagPos).owner != player + 1) { if(CheckPointsInRadius(hbPos, 4, IsPointOwnerDifferent(*this, player), false)) return false; } - return GetNode(hbPos).bq == BuildingQuality::Harbor; + return getNode(hbPos).bq == BuildingQuality::Harbor; } /// Sucht freie Hafenpunkte, also wo noch ein Hafen gebaut werden kann -HarborId GameWorldBase::GetNextFreeHarborPoint(const MapPoint pt, const HarborId originHarborId, +HarborId GameWorldBase::getNextFreeHarborPoint(const MapPoint pt, const HarborId originHarborId, const ShipDirection& dir, const unsigned char player) const { - return GetHarborInDir(pt, originHarborId, dir, - [this, player](auto harborId) { return this->IsHarborPointFree(harborId, player); }); + return getHarborInDir(pt, originHarborId, dir, + [this, player](auto harborId) { return this->isHarborPointFree(harborId, player); }); } /// Bestimmt für einen beliebigen Punkt auf der Karte die Entfernung zum nächsten Hafenpunkt unsigned GameWorldBase::CalcDistanceToNearestHarbor(const MapPoint pos) const { unsigned min_distance = std::numeric_limits::max(); - for(const auto i : helpers::idRange(GetNumHarborPoints())) - min_distance = std::min(min_distance, this->CalcDistance(pos, GetHarborPoint(i))); + for(const auto i : helpers::idRange(getNumHarborPoints())) + min_distance = std::min(min_distance, this->CalcDistance(pos, getHarborPoint(i))); return min_distance; } /// returns true when a harborpoint is in SEAATTACK_DISTANCE for figures! -bool GameWorldBase::IsAHarborInSeaAttackDistance(const MapPoint pos) const +bool GameWorldBase::isAHarborInSeaAttackDistance(const MapPoint pos) const { - for(const auto i : helpers::idRange(GetNumHarborPoints())) + for(const auto i : helpers::idRange(getNumHarborPoints())) { - if(CalcDistance(pos, GetHarborPoint(i)) < SEAATTACK_DISTANCE) + if(CalcDistance(pos, getHarborPoint(i)) < SEAATTACK_DISTANCE) { - if(FindHumanPath(pos, GetHarborPoint(i), SEAATTACK_DISTANCE)) + if(FindHumanPath(pos, getHarborPoint(i), SEAATTACK_DISTANCE)) return true; } } return false; } -std::vector GameWorldBase::GetUsableTargetHarborsForAttack(const MapPoint targetPt, +std::vector GameWorldBase::getUsableTargetHarborsForAttack(const MapPoint targetPt, std::vector& use_seas, const unsigned char player_attacker) const { // Walk to the flag of the bld/harbor. Important to check because in some locations where the coast is north of the // harbor this might be blocked - const MapPoint flagPt = GetNeighbour(targetPt, Direction::SouthEast); + const MapPoint flagPt = getNeighbour(targetPt, Direction::SouthEast); std::vector harbor_points; // Check each possible harbor - for(const auto curHbId : helpers::idRange(GetNumHarborPoints())) + for(const auto curHbId : helpers::idRange(getNumHarborPoints())) { - const MapPoint harborPt = GetHarborPoint(curHbId); + const MapPoint harborPt = getHarborPoint(curHbId); if(CalcDistance(harborPt, targetPt) > SEAATTACK_DISTANCE) continue; // Not attacking this harbor and harbors block? - if(targetPt != harborPt && GetGGS().getSelection(AddonId::SEA_ATTACK) == 1) + if(targetPt != harborPt && getGGS().getSelection(AddonId::SEA_ATTACK) == 1) { // Does an enemy harbor exist at current harbor spot? -> Can't attack through this harbor spot - const auto* hb = GetSpecObj(harborPt); - if(hb && GetPlayer(player_attacker).IsAttackable(hb->GetPlayer())) + const auto* hb = getSpecObj(harborPt); + if(hb && getPlayer(player_attacker).isAttackable(hb->getPlayer())) continue; } @@ -477,14 +477,14 @@ std::vector GameWorldBase::GetUsableTargetHarborsForAttack(const MapPo bool harborinlist = false; for(const auto dir : helpers::enumRange()) { - const SeaId seaId = GetSeaId(curHbId, dir); + const SeaId seaId = getSeaId(curHbId, dir); if(!seaId) continue; // checks previously tested sea ids to skip pathfinding bool previouslytested = false; for(unsigned k = 0; k < rttr::enum_cast(dir); k++) { - if(seaId == GetSeaId(curHbId, Direction(k))) + if(seaId == getSeaId(curHbId, Direction(k))) { previouslytested = true; break; @@ -494,7 +494,7 @@ std::vector GameWorldBase::GetUsableTargetHarborsForAttack(const MapPo continue; // Can figures reach flag from coast - const MapPoint coastalPt = GetCoastalPoint(curHbId, seaId); + const MapPoint coastalPt = getCoastalPoint(curHbId, seaId); if((flagPt == coastalPt) || FindHumanPath(flagPt, coastalPt, SEAATTACK_DISTANCE)) { use_seas.at(seaId.value() - 1) = true; @@ -509,34 +509,34 @@ std::vector GameWorldBase::GetUsableTargetHarborsForAttack(const MapPo return harbor_points; } -std::vector GameWorldBase::GetFilteredSeaIDsForAttack(const MapPoint targetPt, +std::vector GameWorldBase::getFilteredSeaIDsForAttack(const MapPoint targetPt, const std::vector& usableSeas, const unsigned char player_attacker) const { // Walk to the flag of the bld/harbor. Important to check because in some locations where the coast is north of the // harbor this might be blocked - const MapPoint flagPt = GetNeighbour(targetPt, Direction::SouthEast); + const MapPoint flagPt = getNeighbour(targetPt, Direction::SouthEast); std::vector confirmedSeaIds; // Check each possible harbor - for(const auto curHbId : helpers::idRange(GetNumHarborPoints())) + for(const auto curHbId : helpers::idRange(getNumHarborPoints())) { - const MapPoint harborPt = GetHarborPoint(curHbId); + const MapPoint harborPt = getHarborPoint(curHbId); if(CalcDistance(harborPt, targetPt) > SEAATTACK_DISTANCE) continue; // Not attacking this harbor and harbors block? - if(targetPt != harborPt && GetGGS().getSelection(AddonId::SEA_ATTACK) == 1) + if(targetPt != harborPt && getGGS().getSelection(AddonId::SEA_ATTACK) == 1) { // Does an enemy harbor exist at current harbor spot? -> Can't attack through this harbor spot - const auto* hb = GetSpecObj(harborPt); - if(hb && GetPlayer(player_attacker).IsAttackable(hb->GetPlayer())) + const auto* hb = getSpecObj(harborPt); + if(hb && getPlayer(player_attacker).isAttackable(hb->getPlayer())) continue; } for(const auto dir : helpers::enumRange()) { - const SeaId seaId = GetSeaId(curHbId, dir); + const SeaId seaId = getSeaId(curHbId, dir); if(!seaId) continue; // sea id is not in compare list or already confirmed? -> skip rest @@ -547,7 +547,7 @@ std::vector GameWorldBase::GetFilteredSeaIDsForAttack(const MapPoint targ bool previouslytested = false; for(unsigned k = 0; k < rttr::enum_cast(dir); k++) { - if(seaId == GetSeaId(curHbId, Direction(k))) + if(seaId == getSeaId(curHbId, Direction(k))) { previouslytested = true; break; @@ -557,7 +557,7 @@ std::vector GameWorldBase::GetFilteredSeaIDsForAttack(const MapPoint targ continue; // Can figures reach flag from coast - MapPoint coastalPt = GetCoastalPoint(curHbId, seaId); + MapPoint coastalPt = getCoastalPoint(curHbId, seaId); if((flagPt == coastalPt) || FindHumanPath(flagPt, coastalPt, SEAATTACK_DISTANCE)) { confirmedSeaIds.push_back(seaId); @@ -571,14 +571,14 @@ std::vector GameWorldBase::GetFilteredSeaIDsForAttack(const MapPoint targ } /// Liefert Hafenpunkte im Umkreis von einem bestimmten Militärgebäude -std::vector GameWorldBase::GetHarborPointsAroundMilitaryBuilding(const MapPoint pt) const +std::vector GameWorldBase::getHarborPointsAroundMilitaryBuilding(const MapPoint pt) const { std::vector harbor_points; // Nach Hafenpunkten in der Nähe des angegriffenen Gebäudes suchen // Alle unsere Häfen durchgehen - for(const auto i : helpers::idRange(GetNumHarborPoints())) + for(const auto i : helpers::idRange(getNumHarborPoints())) { - const MapPoint harborPt = GetHarborPoint(i); + const MapPoint harborPt = getHarborPoint(i); if(CalcDistance(harborPt, pt) <= SEAATTACK_DISTANCE) { @@ -592,22 +592,22 @@ std::vector GameWorldBase::GetHarborPointsAroundMilitaryBuilding(const /// Gibt Anzahl oder geschätzte Stärke(rang summe + anzahl) der verfügbaren Soldaten die zu einem Schiffsangriff starten /// können von einer bestimmten sea id aus -unsigned GameWorldBase::GetNumSoldiersForSeaAttackAtSea(const unsigned char player_attacker, SeaId sea, +unsigned GameWorldBase::getNumSoldiersForSeaAttackAtSea(const unsigned char player_attacker, SeaId sea, bool returnCount) const { // Liste alle Militärgebäude des Angreifers, die Soldaten liefern std::vector buildings; unsigned attackercount = 0; // Angrenzende Häfen des Angreifers an den entsprechenden Meeren herausfinden - const std::list& harbors = GetPlayer(player_attacker).GetBuildingRegister().GetHarbors(); + const std::list& harbors = getPlayer(player_attacker).getBuildingRegister().getHarbors(); for(auto* harbor : harbors) { // Bestimmen, ob Hafen an einem der Meere liegt, über die sich auch die gegnerischen // Hafenpunkte erreichen lassen - if(!IsHarborAtSea(harbor->GetHarborPosID(), sea)) + if(!isHarborAtSea(harbor->getHarborPosID(), sea)) continue; - std::vector tmp = harbor->GetAttackerBuildingsForSeaIdAttack(); + std::vector tmp = harbor->getAttackerBuildingsForSeaIdAttack(); buildings.insert(buildings.begin(), tmp.begin(), tmp.end()); } @@ -616,7 +616,7 @@ unsigned GameWorldBase::GetNumSoldiersForSeaAttackAtSea(const unsigned char play { // Soldaten holen std::vector tmp_soldiers = - building.building->GetSoldiersForAttack(building.harbor->GetPos()); + building.building->getSoldiersForAttack(building.harbor->getPos()); // Überhaupt welche gefunden? if(tmp_soldiers.empty()) @@ -628,7 +628,7 @@ unsigned GameWorldBase::GetNumSoldiersForSeaAttackAtSea(const unsigned char play if(returnCount) attackercount++; else - attackercount += (tmp_soldier->GetRank() + 1); // private is rank 0 -> increase by 1-5 + attackercount += (tmp_soldier->getRank() + 1); // private is rank 0 -> increase by 1-5 } } return attackercount; @@ -636,26 +636,26 @@ unsigned GameWorldBase::GetNumSoldiersForSeaAttackAtSea(const unsigned char play /// Sucht verfügbare Soldaten, um dieses Militärgebäude mit einem Seeangriff anzugreifen std::vector -GameWorldBase::GetSoldiersForSeaAttack(const unsigned char player_attacker, const MapPoint pt) const +GameWorldBase::getSoldiersForSeaAttack(const unsigned char player_attacker, const MapPoint pt) const { std::vector attackers; // sea attack abgeschaltet per addon? - if(!GetGGS().isEnabled(AddonId::SEA_ATTACK)) + if(!getGGS().isEnabled(AddonId::SEA_ATTACK)) return attackers; // Do we have an attackble military building? - const auto* milBld = GetSpecObj(pt); - if(!milBld || !milBld->IsAttackable(player_attacker)) + const auto* milBld = getSpecObj(pt); + if(!milBld || !milBld->isAttackable(player_attacker)) return attackers; - std::vector use_seas(GetNumSeas()); + std::vector use_seas(getNumSeas()); // Mögliche Hafenpunkte in der Nähe des Gebäudes - std::vector defender_harbors = GetUsableTargetHarborsForAttack(pt, use_seas, player_attacker); + std::vector defender_harbors = getUsableTargetHarborsForAttack(pt, use_seas, player_attacker); // Liste alle Militärgebäude des Angreifers, die Soldaten liefern std::vector buildings; // Angrenzende Häfen des Angreifers an den entsprechenden Meeren herausfinden - const std::list& harbors = GetPlayer(player_attacker).GetBuildingRegister().GetHarbors(); + const std::list& harbors = getPlayer(player_attacker).getBuildingRegister().getHarbors(); for(auto* harbor : harbors) { // Bestimmen, ob Hafen an einem der Meere liegt, über die sich auch die gegnerischen @@ -663,7 +663,7 @@ GameWorldBase::GetSoldiersForSeaAttack(const unsigned char player_attacker, cons bool is_at_sea = false; for(const auto dir : helpers::EnumRange{}) { - const SeaId seaId = GetSeaId(harbor->GetHarborPosID(), dir); + const SeaId seaId = getSeaId(harbor->getHarborPosID(), dir); if(seaId && use_seas[seaId.value() - 1]) { is_at_sea = true; @@ -675,7 +675,7 @@ GameWorldBase::GetSoldiersForSeaAttack(const unsigned char player_attacker, cons continue; std::vector tmp = - harbor->GetAttackerBuildingsForSeaAttack(defender_harbors); + harbor->getAttackerBuildingsForSeaAttack(defender_harbors); for(auto& itBld : tmp) { // Check if the building was already inserted @@ -687,7 +687,7 @@ GameWorldBase::GetSoldiersForSeaAttack(const unsigned char player_attacker, cons buildings.push_back(itBld); } else if(oldBldIt->distance > itBld.distance || (oldBldIt->distance == itBld.distance - && oldBldIt->harbor->GetObjId() > itBld.harbor->GetObjId())) + && oldBldIt->harbor->getObjId() > itBld.harbor->getObjId())) { // New distance is smaller (with tie breaker for async prevention) -> update *oldBldIt = itBld; @@ -699,7 +699,7 @@ GameWorldBase::GetSoldiersForSeaAttack(const unsigned char player_attacker, cons for(const auto& bld : buildings) { // Soldaten holen - std::vector tmp_soldiers = bld.building->GetSoldiersForAttack(bld.harbor->GetPos()); + std::vector tmp_soldiers = bld.building->getSoldiersForAttack(bld.harbor->getPos()); // Soldaten hinzufügen for(nofPassiveSoldier* soldier : tmp_soldiers) @@ -715,19 +715,19 @@ GameWorldBase::GetSoldiersForSeaAttack(const unsigned char player_attacker, cons void GameWorldBase::RecalcBQ(const MapPoint pt) { BQCalculator calcBQ(*this); - if(SetBQ(pt, calcBQ(pt, [this](auto pt) { return this->IsOnRoad(pt); }))) + if(setBQ(pt, calcBQ(pt, [this](auto pt) { return this->isOnRoad(pt); }))) { - GetNotifications().publish(NodeNote(NodeNote::BQ, pt)); + getNotifications().publish(NodeNote(NodeNote::BQ, pt)); } } -void GameWorldBase::SetComputerBarrier(const MapPoint& pt, unsigned radius) +void GameWorldBase::setComputerBarrier(const MapPoint& pt, unsigned radius) { for(const auto& pt : GetPointsInRadiusWithCenter(pt, radius)) ptsInsideComputerBarriers.insert(pt); } -bool GameWorldBase::IsInsideComputerBarrier(const MapPoint& pt) const +bool GameWorldBase::isInsideComputerBarrier(const MapPoint& pt) const { return helpers::contains(ptsInsideComputerBarriers, pt); } diff --git a/libs/s25main/world/GameWorldBase.h b/libs/s25main/world/GameWorldBase.h index ca488d9e52..d1397e9b74 100644 --- a/libs/s25main/world/GameWorldBase.h +++ b/libs/s25main/world/GameWorldBase.h @@ -81,9 +81,9 @@ class GameWorldBase : public World // Remaining initialization after loading (BQ...) void InitAfterLoad(); - GameInterface* GetGameInterface() { return gi; } - const GameInterface* GetGameInterface() const { return gi; } - void SetGameInterface(GameInterface* const gi) { this->gi = gi; } + GameInterface* getGameInterface() { return gi; } + const GameInterface* getGameInterface() const { return gi; } + void setGameInterface(GameInterface* const gi) { this->gi = gi; } /// Get the economy mode handler if set. /// TODO: Add const correct version, but iwEconomicProgress still needs to be able to call UpdateAmounts @@ -91,24 +91,24 @@ class GameWorldBase : public World /// Can a node be used for a road (no flag/bld, no other road, no danger...) /// Should only be used for the points between the 2 flags of a road - bool IsRoadAvailable(bool boat_road, MapPoint pt) const; + bool isRoadAvailable(bool boat_road, MapPoint pt) const; /// Check if this road already exists completely bool RoadAlreadyBuilt(bool boat_road, MapPoint start, const std::vector& route); - bool IsOnRoad(const MapPoint& pt) const; + bool isOnRoad(const MapPoint& pt) const; /// Check if a flag is at a neighbour node - bool IsFlagAround(const MapPoint& pt) const; + bool isFlagAround(const MapPoint& pt) const; /// Checks if any of the neighboring nodes of a given map point are owned by any player. - bool IsAnyNeighborOwned(const MapPoint& pt) const; + bool isAnyNeighborOwned(const MapPoint& pt) const; /// Berechnet BQ bei einer gebauten Stra�e void RecalcBQForRoad(MapPoint pt); /// Pr�ft, ob sich in unmittelbarer N�he (im Radius von 4) Milit�rgeb�ude befinden - bool IsMilitaryBuildingNearNode(MapPoint nPt, unsigned char player) const; + bool isMilitaryBuildingNearNode(MapPoint nPt, unsigned char player) const; /// Return true if there is a military building or building site on the node /// If attackBldsOnly is true, then only troop buildings are returned /// Otherwise it includes e.g. HQ and harbour which cannot attack itself but hold land - bool IsMilitaryBuildingOnNode(MapPoint pt, bool attackBldsOnly) const; + bool isMilitaryBuildingOnNode(MapPoint pt, bool attackBldsOnly) const; /// Erstellt eine Liste mit allen Milit�rgeb�uden in der Umgebung, radius bestimmt wie viele K�stchen nach einer /// Richtung im Umkreis sortedMilitaryBlds LookForMilitaryBuildings(MapPoint pt, unsigned short radius) const; @@ -124,18 +124,18 @@ class GameWorldBase : public World /// Find path for ships with a limited distance. Return true on success bool FindShipPath(MapPoint start, MapPoint dest, unsigned maxDistance, std::vector* route, unsigned* length) const; - RoadPathFinder& GetRoadPathFinder() const { return *roadPathFinder; } - FreePathFinder& GetFreePathFinder() const { return *freePathFinder; } - ShipPathData& GetShipPathData() const; + RoadPathFinder& getRoadPathFinder() const { return *roadPathFinder; } + FreePathFinder& getFreePathFinder() const { return *freePathFinder; } + ShipPathData& getShipPathData() const; /// Return flag that is on road at given point. dir will be set to the direction of the road from the returned flag /// prevDir (if set) will be skipped when searching for the road points - noFlag* GetRoadFlag(MapPoint pt, Direction& dir, helpers::OptionalEnum prevDir = std::nullopt); - const noFlag* GetRoadFlag(MapPoint pt, Direction& dir, + noFlag* getRoadFlag(MapPoint pt, Direction& dir, helpers::OptionalEnum prevDir = std::nullopt); + const noFlag* getRoadFlag(MapPoint pt, Direction& dir, helpers::OptionalEnum prevDir = std::nullopt) const; /// Gets the (height adjusted) global coordinates of the node (e.g. for drawing) - Position GetNodePos(MapPoint pt) const; + Position getNodePos(MapPoint pt) const; /// Berechnet Bauqualitäten an Punkt x;y und den ersten Kreis darum neu void RecalcBQAroundPoint(MapPoint pt); @@ -146,38 +146,38 @@ class GameWorldBase : public World Visibility CalcVisiblityWithAllies(MapPoint pt, unsigned char player) const; /// Ist es an dieser Stelle für einen Spieler möglich einen Hafen zu bauen - bool IsHarborPointFree(HarborId harborId, unsigned char player) const; + bool isHarborPointFree(HarborId harborId, unsigned char player) const; /// Ermittelt, ob ein Punkt Küstenpunkt ist, d.h. Zugang zu einem schiffbaren Meer, an dem auch mindestens 1 /// Hafenplatz liegt, hat und gibt ggf. die Meeres-ID zurück, ansonsten 0 - bool IsCoastalPointToSeaWithHarbor(MapPoint pt) const; + bool isCoastalPointToSeaWithHarbor(MapPoint pt) const; /// Sucht freie Hafenpunkte, also wo noch ein Hafen gebaut werden kann - HarborId GetNextFreeHarborPoint(MapPoint pt, HarborId originHarborId, const ShipDirection& dir, + HarborId getNextFreeHarborPoint(MapPoint pt, HarborId originHarborId, const ShipDirection& dir, unsigned char player) const; /// Bestimmt für einen beliebigen Punkt auf der Karte die Entfernung zum nächsten Hafenpunkt unsigned CalcDistanceToNearestHarbor(MapPoint pos) const; /// returns true when a harborpoint is in SEAATTACK_DISTANCE for figures! - bool IsAHarborInSeaAttackDistance(MapPoint pos) const; + bool isAHarborInSeaAttackDistance(MapPoint pos) const; /// Return the player with the given index - GamePlayer& GetPlayer(unsigned id); - const GamePlayer& GetPlayer(unsigned id) const; - unsigned GetNumPlayers() const; + GamePlayer& getPlayer(unsigned id); + const GamePlayer& getPlayer(unsigned id) const; + unsigned getNumPlayers() const; s25util::span getPlayers(); s25util::span getPlayers() const; - bool IsSinglePlayer() const; + bool isSinglePlayer() const; /// Return the game settings - const GlobalGameSettings& GetGGS() const { return gameSettings; } + const GlobalGameSettings& getGGS() const { return gameSettings; } /// Get the replay (minor) version with which (backward) compatibility is enabled. - uint8_t GetReplayCompatVersion() const { return replayCompatVersion_; } + uint8_t getReplayCompatVersion() const { return replayCompatVersion_; } /// Set the replay minor version to change the behavior of the game for backward compatibility. - void SetReplayCompatVersion(uint8_t version) { replayCompatVersion_ = version; } - - EventManager& GetEvMgr() { return em; } - const EventManager& GetEvMgr() const { return em; } - SoundManager& GetSoundMgr() { return *soundManager; } - PostManager& GetPostMgr() { return postManager; } - const PostManager& GetPostMgr() const { return postManager; } - NotificationManager& GetNotifications() const + void setReplayCompatVersion(uint8_t version) { replayCompatVersion_ = version; } + + EventManager& getEvMgr() { return em; } + const EventManager& getEvMgr() const { return em; } + SoundManager& getSoundMgr() { return *soundManager; } + PostManager& getPostMgr() { return postManager; } + const PostManager& getPostMgr() const { return postManager; } + NotificationManager& getNotifications() const { // We want to be abled to add notifications even on a const world // Hence return as non-const @@ -206,30 +206,30 @@ class GameWorldBase : public World }; /// Liefert Hafenpunkte im Umkreis von einem bestimmten Milit�rgeb�ude - std::vector GetHarborPointsAroundMilitaryBuilding(MapPoint pt) const; + std::vector getHarborPointsAroundMilitaryBuilding(MapPoint pt) const; /// Return all harbor Ids that can be used as a landing site for attacking the given point /// Sets all entries in @param use_seas to true, if the given sea can be used for attacking (seaId=1 -> Index 0 as /// seaId=0 is invalid sea) - std::vector GetUsableTargetHarborsForAttack(MapPoint targetPt, std::vector& use_seas, + std::vector getUsableTargetHarborsForAttack(MapPoint targetPt, std::vector& use_seas, unsigned char player_attacker) const; /// Return all sea Ids from @param usableSeas that can be used for attacking the given point - std::vector GetFilteredSeaIDsForAttack(MapPoint targetPt, const std::vector& usableSeas, + std::vector getFilteredSeaIDsForAttack(MapPoint targetPt, const std::vector& usableSeas, unsigned char player_attacker) const; /// Return all soldiers (in no specific order) that can be used to attack the given point via a sea. /// Checks all preconditions for a sea attack (addon, attackable...) - std::vector GetSoldiersForSeaAttack(unsigned char player_attacker, MapPoint pt) const; + std::vector getSoldiersForSeaAttack(unsigned char player_attacker, MapPoint pt) const; /// Return number or strength (summed ranks) of soldiers that can attack via the given sea - unsigned GetNumSoldiersForSeaAttackAtSea(unsigned char player_attacker, SeaId sea, bool returnCount = true) const; + unsigned getNumSoldiersForSeaAttackAtSea(unsigned char player_attacker, SeaId sea, bool returnCount = true) const; /// Recalculates the BQ for the given point void RecalcBQ(MapPoint pt); - void SetComputerBarrier(const MapPoint& pt, unsigned radius); - bool IsInsideComputerBarrier(const MapPoint& pt) const; + void setComputerBarrier(const MapPoint& pt, unsigned radius); + bool isInsideComputerBarrier(const MapPoint& pt) const; - bool HasLua() const { return lua != nullptr; } - LuaInterfaceGame& GetLua() const { return *lua; } - void SetLua(LuaInterfaceGame* newLua) { lua = newLua; } + bool hasLua() const { return lua != nullptr; } + LuaInterfaceGame& getLua() const { return *lua; } + void setLua(LuaInterfaceGame* newLua) { lua = newLua; } protected: /// Called when the visibility of point changed for a player @@ -241,6 +241,6 @@ class GameWorldBase : public World /// Returns the harbor ID of the next matching harbor in the given direction (0 = None) /// T_IsHarborOk must be a predicate taking a harbor Id and returning a bool if the harbor is valid to return template - HarborId GetHarborInDir(MapPoint pt, HarborId originHarborId, const ShipDirection& dir, + HarborId getHarborInDir(MapPoint pt, HarborId originHarborId, const ShipDirection& dir, T_IsHarborOk isHarborOk) const; }; diff --git a/libs/s25main/world/GameWorldView.cpp b/libs/s25main/world/GameWorldView.cpp index b2befbf896..377bf2aecc 100644 --- a/libs/s25main/world/GameWorldView.cpp +++ b/libs/s25main/world/GameWorldView.cpp @@ -46,24 +46,24 @@ GameWorldView::GameWorldView(const GameWorldViewer& gwv, const Position& pos, const Extent& size) : gwv(gwv), origin_(pos), size_(size), selPt(0, 0), show_bq(SETTINGS.ingame.showBQ), show_names(SETTINGS.ingame.showNames), show_productivity(SETTINGS.ingame.showProductivity), - isBuildingRadiusEnabled_(GetWorld().GetGGS().isEnabled(AddonId::BUILDING_RADIUS)), offset(0, 0), lastOffset(0, 0), + isBuildingRadiusEnabled_(getWorld().getGGS().isEnabled(AddonId::BUILDING_RADIUS)), offset(0, 0), lastOffset(0, 0), zoomFactor_(1.f), targetZoomFactor_(1.f), zoomSpeed_(0.f) { updateEffectiveZoomFactor(); MoveBy({0, 0}); } -const GameWorldBase& GameWorldView::GetWorld() const +const GameWorldBase& GameWorldView::getWorld() const { - return gwv.GetWorld(); + return gwv.getWorld(); } -SoundManager& GameWorldView::GetSoundMgr() +SoundManager& GameWorldView::getSoundMgr() { - return const_cast(gwv).GetSoundMgr(); + return const_cast(gwv).getSoundMgr(); } -void GameWorldView::SetNextZoomFactor() +void GameWorldView::setNextZoomFactor() { if(zoomFactor_ == targetZoomFactor_) // == with float is ok here, is explicitly set in last step //-V550 return; @@ -98,7 +98,7 @@ void GameWorldView::SetNextZoomFactor() CalcFxLx(); } -float GameWorldView::SetZoomFactor(float zoomFactor, bool smoothTransition /* = true*/) +float GameWorldView::setZoomFactor(float zoomFactor, bool smoothTransition /* = true*/) { targetZoomFactor_ = zoomFactor; if(!smoothTransition) @@ -110,7 +110,7 @@ float GameWorldView::SetZoomFactor(float zoomFactor, bool smoothTransition /* = return targetZoomFactor_; } -float GameWorldView::GetCurrentTargetZoomFactor() const +float GameWorldView::getCurrentTargetZoomFactor() const { return targetZoomFactor_; } @@ -137,16 +137,16 @@ struct ObjectBetweenLines void GameWorldView::Draw(const RoadBuildState& rb, const MapPoint selected, bool drawMouse, unsigned* water) { - SetNextZoomFactor(); + setNextZoomFactor(); - const auto windowSize = VIDEODRIVER.GetWindowSize(); + const auto windowSize = VIDEODRIVER.getWindowSize(); const auto& guiScale = VIDEODRIVER.getGuiScale(); const auto screenOrigin = guiScale.viewToScreen(origin_); const auto screenSize = guiScale.viewToScreen(size_); glScissor(screenOrigin.x, windowSize.height - (screenOrigin.y + screenSize.y), screenSize.x, screenSize.y); int shortestDistToMouse = 100000; - Position mousePos = VIDEODRIVER.GetMousePos(); + Position mousePos = VIDEODRIVER.getMousePos(); mousePos -= Position(origin_); if(effectiveZoomFactor_ != 1.f) //-V550 { @@ -167,12 +167,12 @@ void GameWorldView::Draw(const RoadBuildState& rb, const MapPoint selected, bool static_cast(origin_.y) / effectiveZoomFactor_, 0.0f); glTranslatef(static_cast(-offset.x), static_cast(-offset.y), 0.0f); - const TerrainRenderer& terrainRenderer = gwv.GetTerrainRenderer(); - terrainRenderer.Draw(GetFirstPt(), GetLastPt(), gwv, water); + const TerrainRenderer& terrainRenderer = gwv.getTerrainRenderer(); + terrainRenderer.Draw(getFirstPt(), getLastPt(), gwv, water); glTranslatef(static_cast(offset.x), static_cast(offset.y), 0.0f); - const auto& world = GetWorld(); - const auto resourceRevealMode = world.GetGameInterface()->GI_GetCheats().getResourceRevealMode(); + const auto& world = getWorld(); + const auto resourceRevealMode = world.getGameInterface()->GI_GetCheats().getResourceRevealMode(); // Save figures that are between rows (due to moving) to draw later std::vector objsBetweenRows; @@ -183,7 +183,7 @@ void GameWorldView::Draw(const RoadBuildState& rb, const MapPoint selected, bool { Position curOffset; const MapPoint curPt = terrainRenderer.ConvertCoords(Position(x, y), &curOffset); - const DrawPoint curPos = world.GetNodePos(curPt) - offset + curOffset; + const DrawPoint curPos = world.getNodePos(curPt) - offset + curOffset; Position mouseDist = mousePos - curPos; mouseDist *= mouseDist; @@ -194,7 +194,7 @@ void GameWorldView::Draw(const RoadBuildState& rb, const MapPoint selected, bool shortestDistToMouse = std::abs(mouseDist.x) + std::abs(mouseDist.y); } - const Visibility visibility = gwv.GetVisibility(curPt); + const Visibility visibility = gwv.getVisibility(curPt); DrawBoundaryStone(curPt, curPos, visibility); @@ -210,7 +210,7 @@ void GameWorldView::Draw(const RoadBuildState& rb, const MapPoint selected, bool DrawResource(curPt, curPos, resourceRevealMode); } else if(visibility == Visibility::FogOfWar) { - const FOWObject* fowobj = gwv.GetYoungestFOWObject(MapPoint(curPt)); + const FOWObject* fowobj = gwv.getYoungestFOWObject(MapPoint(curPt)); if(fowobj) fowobj->Draw(curPos); } @@ -239,8 +239,8 @@ void GameWorldView::Draw(const RoadBuildState& rb, const MapPoint selected, bool // Draw catapult stones for(auto* catapult_stone : world.catapult_stones) { - if(gwv.GetVisibility(catapult_stone->dest_building) == Visibility::Visible - || gwv.GetVisibility(catapult_stone->dest_map) == Visibility::Visible) + if(gwv.getVisibility(catapult_stone->dest_building) == Visibility::Visible + || gwv.getVisibility(catapult_stone->dest_map) == Visibility::Visible) catapult_stone->Draw(offset); } @@ -265,9 +265,9 @@ void GameWorldView::DrawGUI(const RoadBuildState& rb, const TerrainRenderer& ter if(rb.mode != RoadBuildMode::Disabled) { for(const auto dir : helpers::EnumRange{}) - road_points[dir] = GetWorld().GetNeighbour(rb.point, dir); + road_points[dir] = getWorld().getNeighbour(rb.point, dir); - const unsigned index = GetWorld().GetGGS().getSelection(AddonId::MAX_WATERWAY_LENGTH); + const unsigned index = getWorld().getGGS().getSelection(AddonId::MAX_WATERWAY_LENGTH); RTTR_Assert(index < waterwayLengths.size()); maxWaterWayLen = waterwayLengths[index]; } @@ -279,7 +279,7 @@ void GameWorldView::DrawGUI(const RoadBuildState& rb, const TerrainRenderer& ter // Coordinates transform Position curOffset; MapPoint curPt = terrainRenderer.ConvertCoords(Position(x, y), &curOffset); - Position curPos = GetWorld().GetNodePos(curPt) - offset + curOffset; + Position curPos = getWorld().getNodePos(curPt) - offset + curOffset; /// Current point indicated by Mouse if(drawMouse && selPt == curPt) @@ -299,26 +299,26 @@ void GameWorldView::DrawGUI(const RoadBuildState& rb, const TerrainRenderer& ter default: break; } } - LOADER.GetMapTexture(mid)->DrawFull(curPos); + LOADER.getMapTexture(mid)->DrawFull(curPos); } // Currently selected point if(selectedPt == curPt) - LOADER.GetMapTexture(20)->DrawFull(curPos); + LOADER.getMapTexture(20)->DrawFull(curPos); // not building roads, no further action needed if(rb.mode == RoadBuildMode::Disabled) continue; // we dont own curPt, no need for any rendering... - if(!gwv.IsPlayerTerritory(curPt)) + if(!gwv.isPlayerTerritory(curPt)) continue; // we are in road build mode // highlight current route pt if(rb.point == curPt) { - LOADER.GetMapTexture(21)->DrawFull(curPos); + LOADER.getMapTexture(21)->DrawFull(curPos); continue; } @@ -335,17 +335,17 @@ void GameWorldView::DrawGUI(const RoadBuildState& rb, const TerrainRenderer& ter // render special icon for route revert if(!rb.route.empty() && road_points[rb.route.back() + 3u] == curPt) { - LOADER.GetMapTexture(67)->DrawFull(curPos); + LOADER.getMapTexture(67)->DrawFull(curPos); continue; } // is a flag but not the route start flag, as it would revert the route. - const bool targetFlag = GetWorld().GetNO(curPt)->GetType() == NodalObjectType::Flag && curPt != rb.start; - int altitude = GetWorld().GetNode(rb.point).altitude; - if(targetFlag || gwv.IsRoadAvailable(rb.mode == RoadBuildMode::Boat, curPt)) + const bool targetFlag = getWorld().getNO(curPt)->getType() == NodalObjectType::Flag && curPt != rb.start; + int altitude = getWorld().getNode(rb.point).altitude; + if(targetFlag || gwv.isRoadAvailable(rb.mode == RoadBuildMode::Boat, curPt)) { unsigned id; - switch(int(GetWorld().GetNode(curPt).altitude) - altitude) + switch(int(getWorld().getNode(curPt).altitude) - altitude) { case 1: id = 61; break; case 2: @@ -360,13 +360,13 @@ void GameWorldView::DrawGUI(const RoadBuildState& rb, const TerrainRenderer& ter default: id = 60; break; } if(!targetFlag) - LOADER.GetMapTexture(id)->DrawFull(curPos); + LOADER.getMapTexture(id)->DrawFull(curPos); else { - DrawPoint lastPos = GetWorld().GetNodePos(rb.point) - offset + curOffset; + DrawPoint lastPos = getWorld().getNodePos(rb.point) - offset + curOffset; DrawPoint halfWayPos = (curPos + lastPos) / 2; - LOADER.GetMapTexture(id)->DrawFull(halfWayPos); - LOADER.GetMapTexture(20)->DrawFull(curPos); + LOADER.getMapTexture(id)->DrawFull(halfWayPos); + LOADER.getMapTexture(20)->DrawFull(curPos); } } } @@ -376,10 +376,10 @@ void GameWorldView::DrawGUI(const RoadBuildState& rb, const TerrainRenderer& ter void GameWorldView::DrawNameProductivityOverlay(const TerrainRenderer& terrainRenderer) { const bool showEnemyProductivity = - GetWorld().GetGameInterface()->GI_GetCheats().shouldShowEnemyProductivityOverlay(); + getWorld().getGameInterface()->GI_GetCheats().shouldShowEnemyProductivityOverlay(); auto* attackAidImage = - (GetWorld().GetGGS().getSelection(AddonId::MILITARY_AID) == 2) ? LOADER.GetImageN("map_new", 20000) : nullptr; - const bool isAllVisible = gwv.IsAllVisible(); + (getWorld().getGGS().getSelection(AddonId::MILITARY_AID) == 2) ? LOADER.getImageN("map_new", 20000) : nullptr; + const bool isAllVisible = gwv.isAllVisible(); for(int x = firstPt.x; x <= lastPt.x; ++x) { for(int y = firstPt.y; y <= lastPt.y; ++y) @@ -388,19 +388,19 @@ void GameWorldView::DrawNameProductivityOverlay(const TerrainRenderer& terrainRe Position curOffset; MapPoint pt = terrainRenderer.ConvertCoords(Position(x, y), &curOffset); - const auto* no = GetWorld().GetSpecObj(pt); + const auto* no = getWorld().getSpecObj(pt); if(!no) continue; - Position curPos = GetWorld().GetNodePos(pt) - offset + curOffset; + Position curPos = getWorld().getNodePos(pt) - offset + curOffset; curPos.y -= 22; // Is object not belonging to local player? - if(no->GetPlayer() != gwv.GetPlayerId()) + if(no->getPlayer() != gwv.getPlayerId()) { - if(!isAllVisible && gwv.GetVisibility(pt, false) != Visibility::Visible) + if(!isAllVisible && gwv.getVisibility(pt, false) != Visibility::Visible) continue; - if(attackAidImage && gwv.GetNumSoldiersForAttack(pt) > 0) + if(attackAidImage && gwv.getNumSoldiersForAttack(pt) > 0) attackAidImage->DrawFull(curPos - DrawPoint(0, attackAidImage->getHeight())); // Do not draw enemy productivity overlay unless the related cheat is on if(!showEnemyProductivity) @@ -410,8 +410,8 @@ void GameWorldView::DrawNameProductivityOverlay(const TerrainRenderer& terrainRe // Draw object name if(show_names) { - unsigned color = (no->GetGOT() == GO_Type::Buildingsite) ? COLOR_GREY : COLOR_YELLOW; - SmallFont->Draw(curPos, _(BUILDING_NAMES[no->GetBuildingType()]), + unsigned color = (no->getGOT() == GO_Type::Buildingsite) ? COLOR_GREY : COLOR_YELLOW; + SmallFont->Draw(curPos, _(BUILDING_NAMES[no->getBuildingType()]), FontStyle::CENTER | FontStyle::VCENTER, color); curPos.y += SmallFont->getHeight(); } @@ -425,12 +425,12 @@ void GameWorldView::DrawNameProductivityOverlay(const TerrainRenderer& terrainRe void GameWorldView::DrawProductivity(const noBaseBuilding& no, const DrawPoint& curPos) { - const GO_Type got = no.GetGOT(); + const GO_Type got = no.getGOT(); if(got == GO_Type::Buildingsite) { unsigned color = COLOR_GREY; - unsigned short p = static_cast(no).GetBuildProgress(); + unsigned short p = static_cast(no).getBuildProgress(); SmallFont->Draw(curPos, (boost::format("(%1% %%)") % p).str(), FontStyle::CENTER | FontStyle::VCENTER, color); } else if(got == GO_Type::NobUsual || got == GO_Type::NobShipyard || got == GO_Type::NobTemple) { @@ -438,17 +438,17 @@ void GameWorldView::DrawProductivity(const noBaseBuilding& no, const DrawPoint& std::string text; unsigned color = COLOR_0_PERCENT; - if(!n.HasWorker()) + if(!n.hasWorker()) text = _("(House unoccupied)"); - else if(n.IsProductionDisabledVirtual()) + else if(n.isProductionDisabledVirtual()) text = _("(stopped)"); else { // Catapult and Lookout tower doesn't have productivity! - if(n.GetBuildingType() == BuildingType::Catapult || n.GetBuildingType() == BuildingType::LookoutTower) + if(n.getBuildingType() == BuildingType::Catapult || n.getBuildingType() == BuildingType::LookoutTower) return; - unsigned short p = n.GetProductivity(); + unsigned short p = n.getProductivity(); text = helpers::toString(p) + " %"; if(p >= 60) color = COLOR_60_PERCENT; @@ -461,7 +461,7 @@ void GameWorldView::DrawProductivity(const noBaseBuilding& no, const DrawPoint& } else if(got == GO_Type::NobMilitary) { // Display amount of soldiers - unsigned soldiers_count = static_cast(no).GetNumTroops(); + unsigned soldiers_count = static_cast(no).getNumTroops(); std::string sSoldiers; if(soldiers_count == 1) sSoldiers = _("(1 soldier)"); @@ -476,17 +476,17 @@ void GameWorldView::DrawProductivity(const noBaseBuilding& no, const DrawPoint& void GameWorldView::DrawFigures(const MapPoint& pt, const DrawPoint& curPos, std::vector& objsBetweenRows) const { - for(noBase& figure : GetWorld().GetFigures(pt)) + for(noBase& figure : getWorld().getFigures(pt)) { - if(figure.IsMoving()) + if(figure.isMoving()) { // Drawn from above - Direction curMoveDir = static_cast(figure).GetCurMoveDir(); + Direction curMoveDir = static_cast(figure).getCurMoveDir(); if(curMoveDir == Direction::NorthEast || curMoveDir == Direction::NorthWest) continue; // Draw later objsBetweenRows.push_back(ObjectBetweenLines(figure, curPos)); - } else if(figure.GetGOT() == GO_Type::Ship) + } else if(figure.getGOT() == GO_Type::Ship) objsBetweenRows.push_back(ObjectBetweenLines(figure, curPos)); // TODO: Why special handling for ships? else figure.Draw(curPos); // Draw normally @@ -502,12 +502,12 @@ void GameWorldView::DrawMovingFiguresFromBelow(const TerrainRenderer& terrainRen // Get figures opposite the current dir and check if they are moving in this dir // Coordinates transform Position curOffset; - MapPoint curPt = terrainRenderer.ConvertCoords(GetNeighbour(curPos, dir + 3u), &curOffset); - Position figPos = GetWorld().GetNodePos(curPt) - offset + curOffset; + MapPoint curPt = terrainRenderer.ConvertCoords(getNeighbour(curPos, dir + 3u), &curOffset); + Position figPos = getWorld().getNodePos(curPt) - offset + curOffset; - for(noBase& figure : GetWorld().GetFigures(curPt)) + for(noBase& figure : getWorld().getFigures(curPt)) { - if(figure.IsMoving() && static_cast(figure).GetCurMoveDir() == dir) + if(figure.isMoving() && static_cast(figure).getCurMoveDir() == dir) objsBetweenRows.push_back(ObjectBetweenLines(figure, figPos)); } } @@ -531,23 +531,23 @@ void GameWorldView::DrawConstructionAid(const MapPoint& pt, const DrawPoint& cur if(bq != BuildingQuality::Nothing) { constexpr auto bqImgs = getBqImgs(); - auto* bm = LOADER.GetMapTexture(bqImgs[bq]); + auto* bm = LOADER.getMapTexture(bqImgs[bq]); // Draw building quality icon bm->DrawFull(curPos); // Show ability to construct military buildings - if(GetWorld().GetGGS().isEnabled(AddonId::MILITARY_AID)) + if(getWorld().getGGS().isEnabled(AddonId::MILITARY_AID)) { - if(!GetWorld().IsMilitaryBuildingNearNode(pt, gwv.GetPlayerId()) + if(!getWorld().isMilitaryBuildingNearNode(pt, gwv.getPlayerId()) && (bq == BuildingQuality::Hut || bq == BuildingQuality::House || bq == BuildingQuality::Castle || bq == BuildingQuality::Harbor)) - LOADER.GetImageN("map_new", 20000)->DrawFull(curPos - DrawPoint(-1, bm->GetSize().y + 5)); + LOADER.getImageN("map_new", 20000)->DrawFull(curPos - DrawPoint(-1, bm->getSize().y + 5)); } } } void GameWorldView::DrawObject(const MapPoint& pt, const DrawPoint& curPos) const { - noBase* obj = GetWorld().GetNode(pt).obj; + noBase* obj = getWorld().getNode(pt).obj; if(!obj) return; @@ -562,18 +562,18 @@ void GameWorldView::DrawBoundaryStone(const MapPoint& pt, const DrawPoint pos, V const bool isFoW = vis == Visibility::FogOfWar; const BoundaryStones& boundary_stones = - isFoW ? gwv.GetYoungestFOWNode(pt).boundary_stones : GetWorld().GetNode(pt).boundary_stones; + isFoW ? gwv.getYoungestFOWNode(pt).boundary_stones : getWorld().getNode(pt).boundary_stones; const unsigned char owner = boundary_stones[BorderStonePos::OnPoint]; if(!owner) return; - const Nation nation = GetWorld().GetPlayer(owner - 1).nation; - unsigned player_color = GetWorld().GetPlayer(owner - 1).color; + const Nation nation = getWorld().getPlayer(owner - 1).nation; + unsigned player_color = getWorld().getPlayer(owner - 1).color; if(isFoW) player_color = CalcPlayerFOWDrawColor(player_color); - const auto curVertexPos = gwv.GetTerrainRenderer().GetVertexPos(pt); + const auto curVertexPos = gwv.getTerrainRenderer().getVertexPos(pt); for(const auto bPos : helpers::EnumRange{}) { DrawPoint curPos; @@ -581,7 +581,7 @@ void GameWorldView::DrawBoundaryStone(const MapPoint& pt, const DrawPoint pos, V curPos = pos; else if(boundary_stones[bPos]) curPos = pos - - DrawPoint((curVertexPos - gwv.GetTerrainRenderer().GetNeighbourVertexPos(pt, toDirection(bPos))) + - DrawPoint((curVertexPos - gwv.getTerrainRenderer().getNeighbourVertexPos(pt, toDirection(bPos))) / 2.0f); else continue; @@ -596,7 +596,7 @@ void GameWorldView::DrawResource(const MapPoint& pt, DrawPoint curPos, const Che if(resRevealMode == RRM::Nothing) return; - const Resource res = gwv.GetNode(pt).resources; + const Resource res = gwv.getNode(pt).resources; const auto amount = res.getAmount(); if(!amount) @@ -623,7 +623,7 @@ void GameWorldView::DrawResource(const MapPoint& pt, DrawPoint curPos, const Che case ResourceType::Nothing: return; } - if(auto* bm = LOADER.GetWareTex(gt)) + if(auto* bm = LOADER.getWareTex(gt)) { for([[maybe_unused]] const auto i : helpers::range(amount)) { @@ -679,7 +679,7 @@ void GameWorldView::MoveBy(const DrawPoint& numPixels) void GameWorldView::MoveTo(const DrawPoint& newPos) { offset = newPos; - DrawPoint size(GetWorld().GetWidth() * TR_W, GetWorld().GetHeight() * TR_H); + DrawPoint size(getWorld().getWidth() * TR_W, getWorld().getHeight() * TR_H); if(size.x && size.y) { offset.x %= size.x; @@ -700,9 +700,9 @@ void GameWorldView::MoveToMapPt(const MapPoint pt) return; lastOffset = offset; - Position nodePos = GetWorld().GetNodePos(pt); + Position nodePos = getWorld().getNodePos(pt); - MoveTo(nodePos - GetSize() / 2u); + MoveTo(nodePos - getSize() / 2u); } void GameWorldView::MoveToLastPosition() @@ -714,7 +714,7 @@ void GameWorldView::MoveToLastPosition() lastOffset = newLastOffset; } -unsigned GameWorldView::GetBuildingRadius(BuildingType bld) const +unsigned GameWorldView::getBuildingRadius(BuildingType bld) const { switch(bld) { @@ -748,7 +748,7 @@ unsigned GameWorldView::GetBuildingRadius(BuildingType bld) const case BuildingType::Vineyard: case BuildingType::Woodcutter: { - return nofFarmhand::GetWorkRadius(GetWorld().GetGGS(), BLD_WORK_DESC[bld].job.value()); + return nofFarmhand::getWorkRadius(getWorld().getGGS(), BLD_WORK_DESC[bld].job.value()); } // Remaining building types have no relevant radius case BuildingType::Armory: @@ -791,10 +791,10 @@ void GameWorldView::ShowRadiusPreview(MapPoint center, unsigned radius) if(radiusPreview_ && radiusPreview_->center == center && radiusPreview_->radius == radius) return; std::vector pts; - for(const auto& [mapPt, dist] : GetWorld().GetPointsInRadius(center, radius, ReturnMapPointWithRadius{})) + for(const auto& [mapPt, dist] : getWorld().getPointsInRadius(center, radius, ReturnMapPointWithRadius{})) { if(dist == radius) - pts.push_back(GetWorld().GetNodePos(mapPt)); + pts.push_back(getWorld().getNodePos(mapPt)); } radiusPreview_ = RadiusPreview{center, radius, std::move(pts)}; } @@ -813,16 +813,16 @@ void GameWorldView::DrawRadiusOutline() if(!radiusPreview_) return; - const auto& world = GetWorld(); + const auto& world = getWorld(); - const MapExtent mapSize = world.GetSize(); + const MapExtent mapSize = world.getSize(); constexpr unsigned BORDER_COLOR = 0xFFFF0000; constexpr auto BORDER_SIZE = Extent::all(5); const Extent mapPxSize = mapSize * Extent(TR_W, TR_H); // Screen position of the center vertex. // selPtOffset accounts for the pixel shift when the map wraps at the seam. - const DrawPoint centerScr = world.GetNodePos(radiusPreview_->center) + selPtOffset; + const DrawPoint centerScr = world.getNodePos(radiusPreview_->center) + selPtOffset; for(auto screenPt : radiusPreview_->outline) { @@ -833,22 +833,22 @@ void GameWorldView::DrawRadiusOutline() void GameWorldView::UpdateRadiusPreviewForMousePos() { - const auto& world = GetWorld(); + const auto& world = getWorld(); std::optional bldType; - switch(gwv.GetVisibility(selPt)) + switch(gwv.getVisibility(selPt)) { case Visibility::Visible: { - const auto* bld = world.GetSpecObj(selPt); + const auto* bld = world.getSpecObj(selPt); if(bld) - bldType = bld->GetBuildingType(); + bldType = bld->getBuildingType(); } break; case Visibility::FogOfWar: { - const FOWObject* fow = gwv.GetYoungestFOWObject(selPt); - if(fow && fow->GetType() == FoW_Type::Building) - bldType = static_cast(*fow).GetBuildingType(); + const FOWObject* fow = gwv.getYoungestFOWObject(selPt); + if(fow && fow->getType() == FoW_Type::Building) + bldType = static_cast(*fow).getBuildingType(); } break; case Visibility::Invisible: break; @@ -856,7 +856,7 @@ void GameWorldView::UpdateRadiusPreviewForMousePos() if(bldType) { - const unsigned bldRadius = GetBuildingRadius(*bldType); + const unsigned bldRadius = getBuildingRadius(*bldType); if(bldRadius > 0) ShowRadiusPreview(selPt, bldRadius); else diff --git a/libs/s25main/world/GameWorldView.h b/libs/s25main/world/GameWorldView.h index c3344c8af5..f63be08eca 100644 --- a/libs/s25main/world/GameWorldView.h +++ b/libs/s25main/world/GameWorldView.h @@ -85,19 +85,19 @@ class GameWorldView public: GameWorldView(const GameWorldViewer& gwv, const Position& pos, const Extent& size); - const GameWorldViewer& GetViewer() const { return gwv; } - const GameWorldBase& GetWorld() const; - SoundManager& GetSoundMgr(); + const GameWorldViewer& getViewer() const { return gwv; } + const GameWorldBase& getWorld() const; + SoundManager& getSoundMgr(); - void SetPos(const Position& newPos) { origin_ = newPos; } - Position GetPos() const { return origin_; } - Extent GetSize() const { return size_; } + void setPos(const Position& newPos) { origin_ = newPos; } + Position getPos() const { return origin_; } + Extent getSize() const { return size_; } /// Set target zoom factor and start zooming if smoothTransition is true /// Returns actual zoom factor used, potentially clamped - float SetZoomFactor(float zoomFactor, bool smoothTransition = true); - float GetCurrentTargetZoomFactor() const; - void SetNextZoomFactor(); + float setZoomFactor(float zoomFactor, bool smoothTransition = true); + float getCurrentTargetZoomFactor() const; + void setNextZoomFactor(); // Converts a view coordinate to map position Position ViewPosToMap(Position pos) const; @@ -125,10 +125,10 @@ class GameWorldView /// Springt zur letzten Position, bevor man "weggesprungen" ist void MoveToLastPosition(); - DrawPoint GetOffset() const { return offset; } + DrawPoint getOffset() const { return offset; } /// Get the radius in tiles for a building type (worker reach, territory influence, attack range, etc.) - unsigned GetBuildingRadius(BuildingType bld) const; + unsigned getBuildingRadius(BuildingType bld) const; /// Add a debug node printer void AddDrawNodeCallback(IDrawNodeCallback* newCallback); @@ -148,12 +148,12 @@ class GameWorldView static DrawPoint SnapToNearestCopy(DrawPoint pt, DrawPoint ref, Extent mapSize); /// Gibt selektierten Punkt zurück - MapPoint GetSelectedPt() const { return selPt; } + MapPoint getSelectedPt() const { return selPt; } /// Gibt ersten Punkt an, der beim Zeichnen angezeigt wird - Position GetFirstPt() const { return firstPt; } + Position getFirstPt() const { return firstPt; } /// Gibt letzten Punkt an, der beim Zeichnen angezeigt wird - Position GetLastPt() const { return lastPt; } + Position getLastPt() const { return lastPt; } void Resize(const Extent& newSize); diff --git a/libs/s25main/world/GameWorldViewer.cpp b/libs/s25main/world/GameWorldViewer.cpp index 9230026b2f..c5e59c9a7e 100644 --- a/libs/s25main/world/GameWorldViewer.cpp +++ b/libs/s25main/world/GameWorldViewer.cpp @@ -23,32 +23,32 @@ GameWorldViewer::GameWorldViewer(unsigned playerId, GameWorldBase& gwb) : player { InitVisualData(); maxNodeAltitude_ = 0; - RTTR_FOREACH_PT(MapPoint, gwb.GetSize()) + RTTR_FOREACH_PT(MapPoint, gwb.getSize()) { - maxNodeAltitude_ = std::max(maxNodeAltitude_, gwb.GetNode(pt).altitude); + maxNodeAltitude_ = std::max(maxNodeAltitude_, gwb.getNode(pt).altitude); } - evAltitudeChanged = gwb.GetNotifications().subscribe([this](const NodeNote& note) { + evAltitudeChanged = gwb.getNotifications().subscribe([this](const NodeNote& note) { if(note.type == NodeNote::Altitude) { - maxNodeAltitude_ = std::max(maxNodeAltitude_, this->gwb.GetNode(note.pos).altitude); + maxNodeAltitude_ = std::max(maxNodeAltitude_, this->gwb.getNode(note.pos).altitude); } }); } void GameWorldViewer::InitVisualData() { - visualNodes.Resize(gwb.GetSize()); - RTTR_FOREACH_PT(MapPoint, gwb.GetSize()) + visualNodes.Resize(gwb.getSize()); + RTTR_FOREACH_PT(MapPoint, gwb.getSize()) { VisualMapNode& vNode = visualNodes[pt]; - const MapNode& node = gwb.GetNode(pt); + const MapNode& node = gwb.getNode(pt); vNode.bq = node.bq; // Roads are only overlays. At first we don't have any -> PointRoad::None=use real road std::fill(vNode.roads.begin(), vNode.roads.end(), PointRoad::None); } evRoadConstruction = - gwb.GetNotifications().subscribe([this](const RoadNote& note) { RoadConstructionEnded(note); }); - evBQChanged = gwb.GetNotifications().subscribe([this](const NodeNote& note) { + gwb.getNotifications().subscribe([this](const RoadNote& note) { RoadConstructionEnded(note); }); + evBQChanged = gwb.getNotifications().subscribe([this](const NodeNote& note) { if(note.type == NodeNote::BQ) RecalcBQ(note.pos); }); @@ -58,51 +58,51 @@ void GameWorldViewer::InitTerrainRenderer() { tr.GenerateOpenGL(*this); // Notify renderer about altitude changes - evAltitudeChanged = gwb.GetNotifications().subscribe([this](const NodeNote& note) { + evAltitudeChanged = gwb.getNotifications().subscribe([this](const NodeNote& note) { if(note.type == NodeNote::Altitude) { - maxNodeAltitude_ = std::max(maxNodeAltitude_, gwb.GetNode(note.pos).altitude); + maxNodeAltitude_ = std::max(maxNodeAltitude_, gwb.getNode(note.pos).altitude); tr.AltitudeChanged(note.pos, *this); } }); // And visibility changes - evVisibilityChanged = gwb.GetNotifications().subscribe([this](const PlayerNodeNote& note) { + evVisibilityChanged = gwb.getNotifications().subscribe([this](const PlayerNodeNote& note) { if(note.type == PlayerNodeNote::Visibility) VisibilityChanged(note.pt, note.player); }); } -SoundManager& GameWorldViewer::GetSoundMgr() +SoundManager& GameWorldViewer::getSoundMgr() { - return gwb.GetSoundMgr(); + return gwb.getSoundMgr(); } -const GamePlayer& GameWorldViewer::GetPlayer() const +const GamePlayer& GameWorldViewer::getPlayer() const { - return GetWorld().GetPlayer(playerId_); + return getWorld().getPlayer(playerId_); } -unsigned GameWorldViewer::GetNumPlayers() const +unsigned GameWorldViewer::getNumPlayers() const { - return GetWorld().GetNumPlayers(); + return getWorld().getNumPlayers(); } -unsigned GameWorldViewer::GetNumSoldiersForAttack(const MapPoint pt) const +unsigned GameWorldViewer::getNumSoldiersForAttack(const MapPoint pt) const { - const auto* attacked_building = GetWorld().GetSpecObj(pt); + const auto* attacked_building = getWorld().getSpecObj(pt); // Can we actually attack this bld? - if(!attacked_building || !attacked_building->IsAttackable(playerId_)) + if(!attacked_building || !attacked_building->isAttackable(playerId_)) return 0; // Militärgebäude in der Nähe finden unsigned total_count = 0; - sortedMilitaryBlds buildings = GetWorld().LookForMilitaryBuildings(pt, 3); + sortedMilitaryBlds buildings = getWorld().LookForMilitaryBuildings(pt, 3); for(auto& building : buildings) { // Muss ein Gebäude von uns sein und darf nur ein "normales Militärgebäude" sein (kein HQ etc.) - if(building->GetPlayer() == playerId_ && BuildingProperties::IsMilitary(building->GetBuildingType())) - total_count += static_cast(building)->GetNumSoldiersForAttack(pt); + if(building->getPlayer() == playerId_ && BuildingProperties::isMilitary(building->getBuildingType())) + total_count += static_cast(building)->getNumSoldiersForAttack(pt); } return total_count; @@ -110,50 +110,50 @@ unsigned GameWorldViewer::GetNumSoldiersForAttack(const MapPoint pt) const BuildingQuality GameWorldViewer::GetBQ(const MapPoint& pt) const { - return GetWorld().AdjustBQ(pt, playerId_, visualNodes[pt].bq); + return getWorld().AdjustBQ(pt, playerId_, visualNodes[pt].bq); } -Visibility GameWorldViewer::GetVisibility(const MapPoint pt, const bool checkAllVisible) const +Visibility GameWorldViewer::getVisibility(const MapPoint pt, const bool checkAllVisible) const { - if(checkAllVisible && IsAllVisible()) + if(checkAllVisible && isAllVisible()) return Visibility::Visible; - return GetWorld().CalcVisiblityWithAllies(pt, playerId_); + return getWorld().CalcVisiblityWithAllies(pt, playerId_); } -bool GameWorldViewer::IsAllVisible() const +bool GameWorldViewer::isAllVisible() const { - const auto* const gi = GetWorld().GetGameInterface(); + const auto* const gi = getWorld().getGameInterface(); if(gi && gi->GI_GetCheats().isAllVisible()) return true; /// Replaymodus und FoW aus? Dann alles sichtbar - if(GAMECLIENT.IsReplayModeOn() && GAMECLIENT.IsReplayFOWDisabled()) + if(GAMECLIENT.isReplayModeOn() && GAMECLIENT.isReplayFOWDisabled()) return true; // Spieler schon tot? Dann auch alles sichtbar? - if(GetPlayer().IsDefeated()) + if(getPlayer().IsDefeated()) return true; return false; } -bool GameWorldViewer::IsOwner(const MapPoint& pt) const +bool GameWorldViewer::isOwner(const MapPoint& pt) const { - return GetWorld().GetNode(pt).owner == playerId_ + 1; + return getWorld().getNode(pt).owner == playerId_ + 1; } -bool GameWorldViewer::IsPlayerTerritory(const MapPoint& pt) const +bool GameWorldViewer::isPlayerTerritory(const MapPoint& pt) const { - return GetWorld().IsPlayerTerritory(pt, playerId_ + 1); + return getWorld().isPlayerTerritory(pt, playerId_ + 1); } -const MapNode& GameWorldViewer::GetNode(const MapPoint& pt) const +const MapNode& GameWorldViewer::getNode(const MapPoint& pt) const { - return GetWorld().GetNode(pt); + return getWorld().getNode(pt); } -MapPoint GameWorldViewer::GetNeighbour(const MapPoint pt, const Direction dir) const +MapPoint GameWorldViewer::getNeighbour(const MapPoint pt, const Direction dir) const { - return GetWorld().GetNeighbour(pt, dir); + return getWorld().getNeighbour(pt, dir); } void GameWorldViewer::RecalcAllColors() @@ -162,72 +162,72 @@ void GameWorldViewer::RecalcAllColors() } /// liefert sichtbare Straße, im FoW entsprechend die FoW-Straße -PointRoad GameWorldViewer::GetVisibleRoad(const MapPoint pt, RoadDir roadDir, const Visibility visibility) const +PointRoad GameWorldViewer::getVisibleRoad(const MapPoint pt, RoadDir roadDir, const Visibility visibility) const { if(visibility == Visibility::Visible) - return GetVisibleRoad(pt, roadDir); + return getVisibleRoad(pt, roadDir); else if(visibility == Visibility::FogOfWar) - return GetYoungestFOWNode(pt).roads[roadDir]; + return getYoungestFOWNode(pt).roads[roadDir]; else return PointRoad::None; } -PointRoad GameWorldViewer::GetVisibleRoad(const MapPoint pt, RoadDir roadDir) const +PointRoad GameWorldViewer::getVisibleRoad(const MapPoint pt, RoadDir roadDir) const { const PointRoad visualResult = visualNodes[pt].roads[roadDir]; if(visualResult != PointRoad::None) return visualResult; else - return GetWorld().GetRoad(pt, roadDir); + return getWorld().getRoad(pt, roadDir); } -PointRoad GameWorldViewer::GetVisiblePointRoad(MapPoint pt, Direction dir) const +PointRoad GameWorldViewer::getVisiblePointRoad(MapPoint pt, Direction dir) const { - const RoadDir rDir = GetWorld().toRoadDir(pt, dir); - return GetVisibleRoad(pt, rDir); + const RoadDir rDir = getWorld().toRoadDir(pt, dir); + return getVisibleRoad(pt, rDir); } -void GameWorldViewer::SetVisiblePointRoad(MapPoint pt, Direction dir, PointRoad type) +void GameWorldViewer::setVisiblePointRoad(MapPoint pt, Direction dir, PointRoad type) { - const RoadDir rDir = GetWorld().toRoadDir(pt, dir); + const RoadDir rDir = getWorld().toRoadDir(pt, dir); visualNodes[pt].roads[rDir] = type; } -bool GameWorldViewer::IsOnRoad(const MapPoint& pt) const +bool GameWorldViewer::isOnRoad(const MapPoint& pt) const { // This must be fast for BQ calculation so don't use GetVisiblePointRoad for(const auto roadDir : helpers::EnumRange{}) - if(GetVisibleRoad(pt, roadDir) != PointRoad::None) + if(getVisibleRoad(pt, roadDir) != PointRoad::None) return true; for(const auto roadDir : helpers::EnumRange{}) { const Direction oppositeDir = getOppositeDir(roadDir); - if(GetVisibleRoad(GetNeighbour(pt, oppositeDir), roadDir) != PointRoad::None) + if(getVisibleRoad(getNeighbour(pt, oppositeDir), roadDir) != PointRoad::None) return true; } return false; } /// Return a ship at this position owned by the given player. Prefers ships that need instructions. -const noShip* GameWorldViewer::GetShip(const MapPoint pt) const +const noShip* GameWorldViewer::getShip(const MapPoint pt) const { const noShip* resultShip = nullptr; // Check if we want this ship and set resultShip. Return true if we found a ship which is waiting for instructions auto checkShip = [pt, &resultShip, playerId = playerId_](const noShip& ship) { - if(ship.GetPlayerId() == playerId && (ship.GetPos() == pt || ship.GetDestinationForCurrentMove() == pt)) + if(ship.getPlayerId() == playerId && (ship.getPos() == pt || ship.getDestinationForCurrentMove() == pt)) { resultShip = &ship; - if(ship.IsWaitingForExpeditionInstructions()) + if(ship.isWaitingForExpeditionInstructions()) return true; } return false; }; - const auto& world = GetWorld(); + const auto& world = getWorld(); auto checkPointForShips = [&world, checkShip](const MapPoint curPt, auto /*radius*/) { - for(const auto& figure : world.GetFigures(curPt)) + for(const auto& figure : world.getFigures(curPt)) { - if(figure.GetGOT() == GO_Type::Ship && checkShip(static_cast(figure))) + if(figure.getGOT() == GO_Type::Ship && checkShip(static_cast(figure))) return true; } return false; @@ -238,9 +238,9 @@ const noShip* GameWorldViewer::GetShip(const MapPoint pt) const } /// Gibt die verfügbar Anzahl der Angreifer für einen Seeangriff zurück -unsigned GameWorldViewer::GetNumSoldiersForSeaAttack(const MapPoint pt) const +unsigned GameWorldViewer::getNumSoldiersForSeaAttack(const MapPoint pt) const { - return unsigned(GetWorld().GetSoldiersForSeaAttack(playerId_, pt).size()); + return unsigned(getWorld().getSoldiersForSeaAttack(playerId_, pt).size()); } void GameWorldViewer::ChangePlayer(unsigned player, bool updateVisualData /* = true*/) @@ -255,15 +255,15 @@ void GameWorldViewer::ChangePlayer(unsigned player, bool updateVisualData /* = t } } -helpers::EnumArray GameWorldViewer::GetNeighbours(const MapPoint pt) const +helpers::EnumArray GameWorldViewer::getNeighbours(const MapPoint pt) const { - return GetWorld().GetNeighbours(pt); + return getWorld().getNeighbours(pt); } void GameWorldViewer::VisibilityChanged(const MapPoint& pt, unsigned player) { // If visibility changed for us, or our team mate if shared view is on -> Update renderer - if(player == playerId_ || (GetWorld().GetGGS().teamView && GetWorld().GetPlayer(playerId_).IsAlly(player))) + if(player == playerId_ || (getWorld().getGGS().teamView && getWorld().getPlayer(playerId_).isAlly(player))) tr.VisibilityChanged(pt, *this); } @@ -278,8 +278,8 @@ void GameWorldViewer::RoadConstructionEnded(const RoadNote& note) void GameWorldViewer::RecalcBQ(const MapPoint& pt) { - BQCalculator calcBQ(GetWorld()); - visualNodes[pt].bq = calcBQ(pt, [this](const MapPoint& pos) { return IsOnRoad(pos); }); + BQCalculator calcBQ(getWorld()); + visualNodes[pt].bq = calcBQ(pt, [this](const MapPoint& pos) { return isOnRoad(pos); }); } void GameWorldViewer::RecalcBQForRoad(const MapPoint& pt) @@ -287,7 +287,7 @@ void GameWorldViewer::RecalcBQForRoad(const MapPoint& pt) RecalcBQ(pt); for(const Direction dir : {Direction::East, Direction::SouthEast, Direction::SouthWest}) - RecalcBQ(GetNeighbour(pt, dir)); + RecalcBQ(getNeighbour(pt, dir)); } void GameWorldViewer::RemoveVisualRoad(const MapPoint& start, const std::vector& route) @@ -295,40 +295,40 @@ void GameWorldViewer::RemoveVisualRoad(const MapPoint& start, const std::vector< MapPoint curPt = start; for(auto i : route) { - SetVisiblePointRoad(curPt, i, PointRoad::None); + setVisiblePointRoad(curPt, i, PointRoad::None); RecalcBQForRoad(curPt); - curPt = GetWorld().GetNeighbour(curPt, i); + curPt = getWorld().getNeighbour(curPt, i); } RecalcBQForRoad(curPt); } -bool GameWorldViewer::IsRoadAvailable(bool isWaterRoad, const MapPoint& pt) const +bool GameWorldViewer::isRoadAvailable(bool isWaterRoad, const MapPoint& pt) const { - return !IsOnRoad(pt) && GetWorld().IsRoadAvailable(isWaterRoad, pt); + return !isOnRoad(pt) && getWorld().isRoadAvailable(isWaterRoad, pt); } /// Get the "youngest" FOWObject of all players who share the view with the local player -const FOWObject* GameWorldViewer::GetYoungestFOWObject(const MapPoint pos) const +const FOWObject* GameWorldViewer::getYoungestFOWObject(const MapPoint pos) const { - return GetYoungestFOWNode(pos).object.get(); + return getYoungestFOWNode(pos).object.get(); } /// Gets the youngest fow node of all visible objects of all players who are connected /// with the local player via team view -const FoWNode& GameWorldViewer::GetYoungestFOWNode(const MapPoint pos) const +const FoWNode& GameWorldViewer::getYoungestFOWNode(const MapPoint pos) const { - const MapNode& node = GetWorld().GetNode(pos); + const MapNode& node = getWorld().getNode(pos); const FoWNode* bestNode = &node.fow[playerId_]; unsigned youngest_time = bestNode->last_update_time; // Shared team view enabled? - if(GetWorld().GetGGS().teamView) + if(getWorld().getGGS().teamView) { - const GamePlayer& player = GetWorld().GetPlayer(playerId_); + const GamePlayer& player = getWorld().getPlayer(playerId_); // Then check if team members have a better (="younger", see our economy) fow object - for(unsigned i = 0; i < GetWorld().GetNumPlayers(); ++i) + for(unsigned i = 0; i < getWorld().getNumPlayers(); ++i) { - if(!player.IsAlly(i)) + if(!player.isAlly(i)) continue; // Has the player FOW at this point at all? const FoWNode* curNode = &node.fow[i]; diff --git a/libs/s25main/world/GameWorldViewer.h b/libs/s25main/world/GameWorldViewer.h index d9b816ba79..94911a402a 100644 --- a/libs/s25main/world/GameWorldViewer.h +++ b/libs/s25main/world/GameWorldViewer.h @@ -32,22 +32,22 @@ class GameWorldViewer void InitTerrainRenderer(); /// Return the world itself - const GameWorldBase& GetWorld() const { return gwb; } + const GameWorldBase& getWorld() const { return gwb; } /// Return non-const world (TODO: Remove, this is a view only!) - GameWorldBase& GetWorldNonConst() { return gwb; } - const TerrainRenderer& GetTerrainRenderer() const { return tr; } + GameWorldBase& getWorldNonConst() { return gwb; } + const TerrainRenderer& getTerrainRenderer() const { return tr; } auto getMaxNodeAltitude() const { return maxNodeAltitude_; } - SoundManager& GetSoundMgr(); + SoundManager& getSoundMgr(); /// Get the player instance for this view - const GamePlayer& GetPlayer() const; + const GamePlayer& getPlayer() const; /// Get the ID of the views player - unsigned GetPlayerId() const { return playerId_; } - unsigned GetNumPlayers() const; + unsigned getPlayerId() const { return playerId_; } + unsigned getNumPlayers() const; /// Get number of soldiers that can attack bld at that point - unsigned GetNumSoldiersForAttack(MapPoint pt) const; + unsigned getNumSoldiersForAttack(MapPoint pt) const; /// Get number of soldiers for attacking a point via sea - unsigned GetNumSoldiersForSeaAttack(MapPoint pt) const; + unsigned getNumSoldiersForSeaAttack(MapPoint pt) const; /// Get BQ for this player BuildingQuality GetBQ(const MapPoint& pt) const; @@ -55,37 +55,37 @@ class GameWorldViewer void RecalcBQForRoad(const MapPoint& pt); /// Ermittelt Sichtbarkeit eines Punktes für den lokalen Spieler, berücksichtigt ggf. Teamkameraden /// If checkAllVisible is false then `IsAllVisible` is assumed to return false, else it is called to check - Visibility GetVisibility(MapPoint pt, bool checkAllVisible = true) const; + Visibility getVisibility(MapPoint pt, bool checkAllVisible = true) const; /// Check if the whole map should be visible - bool IsAllVisible() const; + bool isAllVisible() const; /// Returns true, if we own this point (but may not be our territory if this is a border point) - bool IsOwner(const MapPoint& pt) const; + bool isOwner(const MapPoint& pt) const; /// Return true if the point belongs to any player - bool IsPlayerTerritory(const MapPoint& pt) const; - const MapNode& GetNode(const MapPoint& pt) const; - MapPoint GetNeighbour(MapPoint pt, Direction dir) const; + bool isPlayerTerritory(const MapPoint& pt) const; + const MapNode& getNode(const MapPoint& pt) const; + MapPoint getNeighbour(MapPoint pt, Direction dir) const; /// liefert sichtbare Strasse, im Nebel entsprechend die FoW-Strasse - PointRoad GetVisibleRoad(MapPoint pt, RoadDir roadDir, Visibility visibility) const; - PointRoad GetVisibleRoad(MapPoint pt, RoadDir roadDir) const; + PointRoad getVisibleRoad(MapPoint pt, RoadDir roadDir, Visibility visibility) const; + PointRoad getVisibleRoad(MapPoint pt, RoadDir roadDir) const; /// Get road, including virtual ones - PointRoad GetVisiblePointRoad(MapPoint pt, Direction dir) const; - void SetVisiblePointRoad(MapPoint pt, Direction dir, PointRoad type); - bool IsOnRoad(const MapPoint& pt) const; + PointRoad getVisiblePointRoad(MapPoint pt, Direction dir) const; + void setVisiblePointRoad(MapPoint pt, Direction dir, PointRoad type); + bool isOnRoad(const MapPoint& pt) const; /// Remove a visual (not yet built) road void RemoveVisualRoad(const MapPoint& start, const std::vector& route); /// Checks if the road can be build in the world and additonally if there is no virtual road at that point - bool IsRoadAvailable(bool isWaterRoad, const MapPoint& pt) const; + bool isRoadAvailable(bool isWaterRoad, const MapPoint& pt) const; /// Get the "youngest" FOWObject of all players who share the view with the local player - const FOWObject* GetYoungestFOWObject(MapPoint pos) const; + const FOWObject* getYoungestFOWObject(MapPoint pos) const; /// Gets the youngest fow node of all visible objects of all players who are connected /// with the local player via team view - const FoWNode& GetYoungestFOWNode(MapPoint pos) const; + const FoWNode& getYoungestFOWNode(MapPoint pos) const; /// Get first found ship of this player at that point or nullptr of none - const noShip* GetShip(MapPoint pt) const; + const noShip* getShip(MapPoint pt) const; /// Schattierungen (vor allem FoW) neu berechnen void RecalcAllColors(); @@ -93,7 +93,7 @@ class GameWorldViewer /// Makes this a viewer for another player void ChangePlayer(unsigned player, bool updateVisualData = true); - helpers::EnumArray GetNeighbours(MapPoint pt) const; + helpers::EnumArray getNeighbours(MapPoint pt) const; private: /// Visual node status (might be different than world if GameCommand is just sent) to hide network latency diff --git a/libs/s25main/world/MapBase.cpp b/libs/s25main/world/MapBase.cpp index 15046a3d27..b9e0a0048e 100644 --- a/libs/s25main/world/MapBase.cpp +++ b/libs/s25main/world/MapBase.cpp @@ -29,7 +29,7 @@ void MapBase::Resize(const MapExtent& newSize) size_ = newSize; } -MapPoint MapBase::GetNeighbour(const MapPoint pt, const Direction dir) const +MapPoint MapBase::getNeighbour(const MapPoint pt, const Direction dir) const { /* Note that every 2nd row is shifted by half a triangle to the left, therefore: Modifications for the dirs: @@ -83,26 +83,26 @@ MapPoint MapBase::GetNeighbour(const MapPoint pt, const Direction dir) const return res; } -MapPoint MapBase::GetNeighbour2(const MapPoint pt, unsigned dir) const +MapPoint MapBase::getNeighbour2(const MapPoint pt, unsigned dir) const { - return MakeMapPoint(::GetNeighbour2(Position(pt), dir)); + return MakeMapPoint(::getNeighbour2(Position(pt), dir)); } -std::vector MapBase::GetAllNeighboursUnion(const std::vector& points) const +std::vector MapBase::getAllNeighboursUnion(const std::vector& points) const { std::set ptsToReturn; for(const MapPoint& curMapPt : points) { ptsToReturn.insert(curMapPt); - const auto neighbours = GetNeighbours(curMapPt); + const auto neighbours = getNeighbours(curMapPt); ptsToReturn.insert(neighbours.begin(), neighbours.end()); } return std::vector(ptsToReturn.begin(), ptsToReturn.end()); } -helpers::EnumArray MapBase::GetNeighbours(const MapPoint pt) const +helpers::EnumArray MapBase::getNeighbours(const MapPoint pt) const { const MapCoord yplus1 = pt.y == size_.y - 1 ? 0 : pt.y + 1; const MapCoord yminus1 = (pt.y == 0 ? size_.y : pt.y) - 1; diff --git a/libs/s25main/world/MapBase.h b/libs/s25main/world/MapBase.h index f9477936a3..8143862b4a 100644 --- a/libs/s25main/world/MapBase.h +++ b/libs/s25main/world/MapBase.h @@ -44,45 +44,45 @@ class MapBase virtual void Resize(const MapExtent& newSize); /// Return the size of the world - unsigned short GetWidth() const { return GetSize().x; } - unsigned short GetHeight() const { return GetSize().y; } - MapExtent GetSize() const { return size_; } + unsigned short getWidth() const { return getSize().x; } + unsigned short getHeight() const { return getSize().y; } + MapExtent getSize() const { return size_; } /// Returns a MapPoint from a point. This ensures, the coords are actually in the map [0, mapSize) MapPoint MakeMapPoint(Position pt) const; /// Returns the linear index for a map point - unsigned GetIdx(MapPoint pt) const; + unsigned getIdx(MapPoint pt) const; /// Get coordinates of neighbor in the given direction - MapPoint GetNeighbour(MapPoint pt, Direction dir) const; + MapPoint getNeighbour(MapPoint pt, Direction dir) const; /// Return neighboring point (2nd layer: dir 0-11) - MapPoint GetNeighbour2(MapPoint, unsigned dir) const; + MapPoint getNeighbour2(MapPoint, unsigned dir) const; // Convenience functions for the above function - MapCoord GetXA(MapPoint pt, Direction dir) const; + MapCoord getXA(MapPoint pt, Direction dir) const; // Gets all neighbors (in all directions) for given position - helpers::EnumArray GetNeighbours(MapPoint pt) const; + helpers::EnumArray getNeighbours(MapPoint pt) const; // Gets union of given points and all their neighbors without duplicates // For a single point it returns itself and all neighbours - std::vector GetAllNeighboursUnion(const std::vector& points) const; + std::vector getAllNeighboursUnion(const std::vector& points) const; /// Return all points in a radius around pt (excluding pt) that satisfy a given condition. /// Points can be transformed (e.g. to flags at those points) by the functor taking a map point and a radius /// Number of results is constrained to maxResults (if > 0) template detail::GetPointsResult_t - GetPointsInRadius(MapPoint pt, unsigned radius, T_TransformPt&& transformPt = T_TransformPt{}, + getPointsInRadius(MapPoint pt, unsigned radius, T_TransformPt&& transformPt = T_TransformPt{}, T_IsValidPt&& isValid = T_IsValidPt{}, bool includePt = false) const; /// Return all points in the given radius that match the condition template std::vector GetMatchingPointsInRadius(MapPoint pt, unsigned radius, T_IsValidPt&& isValid, bool includePt = false) const { - return GetPointsInRadius(pt, radius, ReturnMapPoint{}, std::forward(isValid), + return getPointsInRadius(pt, radius, ReturnMapPoint{}, std::forward(isValid), includePt); } /// Convenience method to return all points in the given radious including the center point std::vector GetPointsInRadiusWithCenter(const MapPoint pt, unsigned radius) const { - return GetPointsInRadius(pt, radius, ReturnMapPoint{}, AlwaysTrue{}, true); + return getPointsInRadius(pt, radius, ReturnMapPoint{}, AlwaysTrue{}, true); } /// Returns true, if the IsValid functor returns true for any point in the given radius /// If includePt is true, then the point itself is also checked @@ -104,19 +104,19 @@ class MapBase // Implementation ////////////////////////////////////////////////////////////////////////// -inline MapCoord MapBase::GetXA(const MapPoint pt, Direction dir) const +inline MapCoord MapBase::getXA(const MapPoint pt, Direction dir) const { - return GetNeighbour(pt, dir).x; + return getNeighbour(pt, dir).x; } -inline unsigned MapBase::GetIdx(const MapPoint pt) const +inline unsigned MapBase::getIdx(const MapPoint pt) const { RTTR_Assert(pt.x < size_.x && pt.y < size_.y); return static_cast(pt.y) * size_.x + pt.x; } template -detail::GetPointsResult_t MapBase::GetPointsInRadius(const MapPoint pt, unsigned radius, +detail::GetPointsResult_t MapBase::getPointsInRadius(const MapPoint pt, unsigned radius, T_TransformPt&& transformPt, T_IsValidPt&& isValid, bool includePt) const { @@ -143,7 +143,7 @@ detail::GetPointsResult_t MapBase::GetPointsInRadius(const MapPoi for(unsigned r = 1; r <= radius; ++r) { // Go one level/hull to the left - curStartPt = GetNeighbour(curStartPt, Direction::West); + curStartPt = getNeighbour(curStartPt, Direction::West); // Now iterate over the "circle" of radius r by going r steps in one direction, turn right and repeat MapPoint curPt = curStartPt; for(const auto dir : helpers::enumRange(Direction::NorthEast)) @@ -157,7 +157,7 @@ detail::GetPointsResult_t MapBase::GetPointsInRadius(const MapPoi if(T_maxResults > 0 && static_cast(result.size()) >= T_maxResults) return result; } - curPt = GetNeighbour(curPt, dir); + curPt = getNeighbour(curPt, dir); } } } @@ -174,7 +174,7 @@ inline bool MapBase::CheckPointsInRadius(const MapPoint pt, unsigned radius, T_I for(unsigned r = 1; r <= radius; ++r) { // Go one level/hull to the left - curStartPt = GetNeighbour(curStartPt, Direction::West); + curStartPt = getNeighbour(curStartPt, Direction::West); // Now iterate over the "circle" of radius r by going r steps in one direction, turn right and repeat MapPoint curPt = curStartPt; for(const auto dir : helpers::enumRange(Direction::NorthEast)) @@ -183,7 +183,7 @@ inline bool MapBase::CheckPointsInRadius(const MapPoint pt, unsigned radius, T_I { if(isValid(curPt, r)) return true; - curPt = GetNeighbour(curPt, dir); + curPt = getNeighbour(curPt, dir); } } } diff --git a/libs/s25main/world/MapGeometry.cpp b/libs/s25main/world/MapGeometry.cpp index 888db346bc..5fce5361f3 100644 --- a/libs/s25main/world/MapGeometry.cpp +++ b/libs/s25main/world/MapGeometry.cpp @@ -9,7 +9,7 @@ #include #include -Position GetNeighbour(const Position& p, const Direction dir) +Position getNeighbour(const Position& p, const Direction dir) { /* Note that every 2nd row is shifted by half a triangle to the left, therefore: Modifications for the dirs: @@ -34,7 +34,7 @@ Position GetNeighbour(const Position& p, const Direction dir) BOOST_UNREACHABLE_RETURN({}) // LCOV_EXCL_LINE } -Position GetNeighbour2(Position pt, unsigned dir) +Position getNeighbour2(Position pt, unsigned dir) { if(dir >= 12) throw std::logic_error("Invalid direction!"); @@ -75,12 +75,12 @@ MapPoint MakeMapPoint(Position pt, const MapExtent& size) return MapPoint(pt); } -Position GetNodePos(MapPoint pt) +Position getNodePos(MapPoint pt) { - return GetNodePos(Position(pt)); + return getNodePos(Position(pt)); } -Position GetNodePos(Position pt) +Position getNodePos(Position pt) { Position result = pt * Position(TR_W, TR_H); if(pt.y & 1) @@ -88,9 +88,9 @@ Position GetNodePos(Position pt) return result; } -Position GetNodePos(MapPoint pt, uint8_t height) +Position getNodePos(MapPoint pt, uint8_t height) { - Position result = GetNodePos(pt); + Position result = getNodePos(pt); result.y -= HEIGHT_FACTOR * height; return result; } diff --git a/libs/s25main/world/MapGeometry.h b/libs/s25main/world/MapGeometry.h index a4f9d07539..e3ffad1149 100644 --- a/libs/s25main/world/MapGeometry.h +++ b/libs/s25main/world/MapGeometry.h @@ -8,11 +8,11 @@ #include "gameTypes/Direction.h" #include "gameTypes/MapCoordinates.h" -Position GetNeighbour(const Position& p, Direction dir); -Position GetNeighbour2(Position pt, unsigned dir); +Position getNeighbour(const Position& p, Direction dir); +Position getNeighbour2(Position pt, unsigned dir); MapPoint MakeMapPoint(Position pt, const MapExtent& size); /// Return the position of the node on a flat map -Position GetNodePos(MapPoint pt); -Position GetNodePos(Position pt); +Position getNodePos(MapPoint pt); +Position getNodePos(Position pt); /// Return the height adjusted point -Position GetNodePos(MapPoint pt, uint8_t height); +Position getNodePos(MapPoint pt, uint8_t height); diff --git a/libs/s25main/world/MapLoader.cpp b/libs/s25main/world/MapLoader.cpp index b1c8572ea3..fd2eb3241d 100644 --- a/libs/s25main/world/MapLoader.cpp +++ b/libs/s25main/world/MapLoader.cpp @@ -44,13 +44,13 @@ MapLoader::MapLoader(GameWorldBase& world) : world_(world) {} bool MapLoader::Load(const libsiedler2::ArchivItem_Map& map, Exploration exploration) { - GameDataLoader gdLoader(world_.GetDescriptionWriteable()); + GameDataLoader gdLoader(world_.getDescriptionWriteable()); if(!gdLoader.Load()) return false; uint8_t gfxSet = map.getHeader().getGfxSet(); DescIdx lt = - world_.GetDescription().landscapes.find([gfxSet](const LandscapeDesc& l) { return l.s2Id == gfxSet; }); + world_.getDescription().landscapes.find([gfxSet](const LandscapeDesc& l) { return l.s2Id == gfxSet; }); world_.Init(MapExtent(map.getHeader().getWidth(), map.getHeader().getHeight()), lt); //-V807 if(!InitNodes(map, exploration)) @@ -65,7 +65,7 @@ bool MapLoader::Load(const libsiedler2::ArchivItem_Map& map, Exploration explora // If we have explored FoW, create the FoW objects if(exploration == Exploration::FogOfWarExplored) - SetMapExplored(world_); + setMapExplored(world_); return true; } @@ -81,7 +81,7 @@ bool MapLoader::Load(const boost::filesystem::path& mapFilePath) const libsiedler2::ArchivItem_Map& map = *static_cast(mapArchiv[0]); - if(!Load(map, world_.GetGGS().exploration)) + if(!Load(map, world_.getGGS().exploration)) return false; if(!PlaceHQs()) return false; @@ -96,22 +96,22 @@ bool MapLoader::LoadLuaScript(Game& game, ILocalGameState& localgameState, const auto lua = std::make_unique(game, localgameState); if(!lua->loadScript(luaFilePath) || !lua->CheckScriptVersion()) return false; - game.SetLua(std::move(lua)); + game.setLua(std::move(lua)); return true; } bool MapLoader::PlaceHQs(bool addStartWares) { std::vector hqPositions = hqPositions_; - if(world_.GetGGS().randomStartPosition) + if(world_.getGGS().randomStartPosition) RANDOM_SHUFFLE2(hqPositions, 0); return PlaceHQs(world_, hqPositions, addStartWares); } -void MapLoader::SetupResources(GameWorldBase& world, const bool fixFish) +void MapLoader::setupResources(GameWorldBase& world, const bool fixFish) { ResourceType target; - switch(world.GetGGS().getSelection(AddonId::CHANGE_GOLD_DEPOSITS)) + switch(world.getGGS().getSelection(AddonId::CHANGE_GOLD_DEPOSITS)) { case 0: default: target = ResourceType::Gold; break; @@ -132,26 +132,26 @@ void MapLoader::ConvertMineResourceTypes(GameWorldBase& world, ResourceType from if(from == to) return; - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - Resource resources = world.GetNode(pt).resources; + Resource resources = world.getNode(pt).resources; // Gibt es Ressourcen dieses Typs? // Wenn ja, dann umwandeln bzw löschen if(resources.getType() == from) { resources.setType(to); - world.SetResource(pt, resources); + world.setResource(pt, resources); } } } void MapLoader::PlaceAndFixWater(GameWorldBase& world) { - const bool waterEverywhere = world.GetGGS().getSelection(AddonId::EXHAUSTIBLE_WATER) == 1; + const bool waterEverywhere = world.getGGS().getSelection(AddonId::EXHAUSTIBLE_WATER) == 1; - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - Resource curNodeResource = world.GetNode(pt).resources; + Resource curNodeResource = world.getNode(pt).resources; if(curNodeResource.getType() == ResourceType::Nothing) { @@ -161,9 +161,9 @@ void MapLoader::PlaceAndFixWater(GameWorldBase& world) continue; // do not override maps resource. uint8_t minHumidity = 100; - for(const DescIdx tIdx : world.GetTerrainsAround(pt)) + for(const DescIdx tIdx : world.getTerrainsAround(pt)) { - const uint8_t curHumidity = world.GetDescription().get(tIdx).humidity; + const uint8_t curHumidity = world.getDescription().get(tIdx).humidity; if(curHumidity < minHumidity) { minHumidity = curHumidity; @@ -178,29 +178,29 @@ void MapLoader::PlaceAndFixWater(GameWorldBase& world) } else curNodeResource = Resource(ResourceType::Nothing, 0); - world.SetResource(pt, curNodeResource); + world.setResource(pt, curNodeResource); } } void MapLoader::RemoveUnusableFishResources(GameWorldBase& world) { - const auto isWaterPoint = [&world](const MapPoint nb) { return world.IsWaterPoint(nb); }; - for(const MapCoord y : helpers::range(world.GetHeight())) + const auto isWaterPoint = [&world](const MapPoint nb) { return world.isWaterPoint(nb); }; + for(const MapCoord y : helpers::range(world.getHeight())) { // Optimization: When there was fish on the previous node (in the same row) // we do not need to check for isolated water points, as there is at least that water point bool previousHasFish = false; - for(const MapCoord x : helpers::range(world.GetWidth())) + for(const MapCoord x : helpers::range(world.getWidth())) { const MapPoint pt(x, y); bool hasFish = false; - if(world.GetNode(pt).resources.has(ResourceType::Fish)) + if(world.getNode(pt).resources.has(ResourceType::Fish)) { - if(isWaterPoint(pt) && (previousHasFish || helpers::contains_if(world.GetNeighbours(pt), isWaterPoint))) + if(isWaterPoint(pt) && (previousHasFish || helpers::contains_if(world.getNeighbours(pt), isWaterPoint))) hasFish = true; else - world.SetResource(pt, Resource(ResourceType::Nothing, 0)); + world.setResource(pt, Resource(ResourceType::Nothing, 0)); } previousHasFish = hasFish; } @@ -209,19 +209,19 @@ void MapLoader::RemoveUnusableFishResources(GameWorldBase& world) void MapLoader::InitShadows(World& world) { - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) world.RecalcShadow(pt); } -void MapLoader::SetMapExplored(World& world) +void MapLoader::setMapExplored(World& world) { - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { // For every player for(const auto i : helpers::range(MAX_PLAYERS)) { // If we have FoW here, save it - if(world.GetNode(pt).fow[i].visibility == Visibility::FogOfWar) + if(world.getNode(pt).fow[i].visibility == Visibility::FogOfWar) world.SaveFOWNode(pt, i, 0); } } @@ -229,7 +229,7 @@ void MapLoader::SetMapExplored(World& world) DescIdx MapLoader::getTerrainFromS2(uint8_t s2Id) const { - return world_.GetDescription().terrain.find([s2Id, landscape = world_.GetLandscapeType()](const TerrainDesc& t) { + return world_.getDescription().terrain.find([s2Id, landscape = world_.GetLandscapeType()](const TerrainDesc& t) { return t.s2Id == s2Id && t.landscape == landscape; }); } @@ -238,9 +238,9 @@ bool MapLoader::InitNodes(const libsiedler2::ArchivItem_Map& map, Exploration ex { using libsiedler2::MapLayer; // Init node data (everything except the objects, figures and BQ) - RTTR_FOREACH_PT(MapPoint, world_.GetSize()) + RTTR_FOREACH_PT(MapPoint, world_.getSize()) { - MapNode& node = world_.GetNodeInt(pt); + MapNode& node = world_.getNodeInt(pt); std::fill(node.roads.begin(), node.roads.end(), PointRoad::None); node.altitude = map.getMapDataAt(MapLayer::Altitude, pt.x, pt.y); @@ -307,7 +307,7 @@ void MapLoader::PlaceObjects(const libsiedler2::ArchivItem_Map& map) { hqPositions_.clear(); - RTTR_FOREACH_PT(MapPoint, world_.GetSize()) + RTTR_FOREACH_PT(MapPoint, world_.getSize()) { using libsiedler2::MapLayer; unsigned char lc = map.getMapDataAt(MapLayer::ObjectIndex, pt.x, pt.y); @@ -461,14 +461,14 @@ void MapLoader::PlaceObjects(const libsiedler2::ArchivItem_Map& map) break; } - world_.GetNodeInt(pt).obj = obj; + world_.getNodeInt(pt).obj = obj; } } void MapLoader::PlaceAnimals(const libsiedler2::ArchivItem_Map& map) { // Tiere auslesen - RTTR_FOREACH_PT(MapPoint, world_.GetSize()) + RTTR_FOREACH_PT(MapPoint, world_.getSize()) { Species species; using libsiedler2::MapLayer; @@ -500,10 +500,10 @@ void MapLoader::PlaceAnimals(const libsiedler2::ArchivItem_Map& map) bool MapLoader::PlaceHQs(GameWorldBase& world, const std::vector& hqPositions, const bool addStartWares) { - for(unsigned i = 0; i < world.GetNumPlayers(); ++i) + for(unsigned i = 0; i < world.getNumPlayers(); ++i) { // Skip unused slots - if(!world.GetPlayer(i).isUsed()) + if(!world.getPlayer(i).isUsed()) continue; // Does the HQ have a position? @@ -514,7 +514,7 @@ bool MapLoader::PlaceHQs(GameWorldBase& world, const std::vector& hqPo } auto* hq = checkedCast(BuildingFactory::CreateBuilding(world, BuildingType::Headquarters, - hqPositions[i], i, world.GetPlayer(i).nation)); + hqPositions[i], i, world.getPlayer(i).nation)); if(addStartWares) hq->addStartWares(); } @@ -526,9 +526,9 @@ bool MapLoader::InitSeasAndHarbors(World& world, const std::vector& ad for(MapPoint pt : additionalHarbors) world.harborData.push_back(HarborPos(pt)); // Clear current harbors and seas - RTTR_FOREACH_PT(MapPoint, world.GetSize()) //-V807 + RTTR_FOREACH_PT(MapPoint, world.getSize()) //-V807 { - MapNode& node = world.GetNodeInt(pt); + MapNode& node = world.getNodeInt(pt); node.seaId.reset(); node.harborId.reset(); } @@ -536,10 +536,10 @@ bool MapLoader::InitSeasAndHarbors(World& world, const std::vector& ad /// Determine all seas world.seas.clear(); SeaId curSeaId(1); - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { // Point is not yet assigned a sea but should be - if(!world.GetNode(pt).seaId && world.IsSeaPoint(pt)) + if(!world.getNode(pt).seaId && world.isSeaPoint(pt)) { const auto seaSize = MeasureSea(world, pt, curSeaId); world.seas.push_back(World::Sea(seaSize)); @@ -559,7 +559,7 @@ bool MapLoader::InitSeasAndHarbors(World& world, const std::vector& ad // Skip point at NW as often there is no path from it if the harbor is north of an island if(dir != Direction::NorthWest) { - seaId = world.GetSeaFromCoastalPoint(world.GetNeighbour(it->pos, dir)); + seaId = world.getSeaFromCoastalPoint(world.getNeighbour(it->pos, dir)); if(seaId) { foundCoast = true; @@ -578,7 +578,7 @@ bool MapLoader::InitSeasAndHarbors(World& world, const std::vector& ad it = world.harborData.erase(it); } else { - world.GetNodeInt(it->pos).harborId = curHarborId; + world.getNodeInt(it->pos).harborId = curHarborId; curHarborId = curHarborId.next(); ++it; } @@ -612,10 +612,10 @@ void MapLoader::CalcHarborPosNeighbors(World& world) // pre-calculate sea-points, as IsSeaPoint is rather expensive std::vector ptIsSeaPt(world.nodes.size()); //-V656 - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - if(shipPathChecker.IsNodeOk(pt)) - ptIsSeaPt[world.GetIdx(pt)] = -1; + if(shipPathChecker.isNodeOk(pt)) + ptIsSeaPt[world.getIdx(pt)] = -1; } // FIFO queue used for a BFS @@ -641,13 +641,13 @@ void MapLoader::CalcHarborPosNeighbors(World& world) { for(const auto dir : helpers::EnumRange{}) { - SeaId seaId = world.GetSeaId(otherHbId, dir); + SeaId seaId = world.getSeaId(otherHbId, dir); // No sea? -> Next if(!seaId) continue; - const MapPoint coastPt = world.GetNeighbour(world.GetHarborPoint(otherHbId), dir); + const MapPoint coastPt = world.getNeighbour(world.getHarborPoint(otherHbId), dir); // This should not be marked for visit - unsigned idx = world.GetIdx(coastPt); + unsigned idx = world.getIdx(coastPt); RTTR_Assert(ptToVisitOrHb[idx] != -1); if(otherHbId == startHbId) { @@ -664,8 +664,8 @@ void MapLoader::CalcHarborPosNeighbors(World& world) for(const MapPoint& ownCoastPt : ownCoastalPoints) { // Special case: Get all harbors that share the coast point with us - const SeaId seaId = world.GetSeaFromCoastalPoint(ownCoastPt); - auto const coastToHbs = coastToHarborPerSea[seaId].equal_range(world.GetIdx(ownCoastPt)); + const SeaId seaId = world.getSeaFromCoastalPoint(ownCoastPt); + auto const coastToHbs = coastToHarborPerSea[seaId].equal_range(world.getIdx(ownCoastPt)); for(auto it = coastToHbs.first; it != coastToHbs.second; ++it) { ShipDirection shipDir = world.GetShipDir(ownCoastPt, ownCoastPt); @@ -682,21 +682,21 @@ void MapLoader::CalcHarborPosNeighbors(World& world) for(const auto dir : helpers::EnumRange{}) { - MapPoint curPt = world.GetNeighbour(curNode.pos, dir); - unsigned idx = world.GetIdx(curPt); + MapPoint curPt = world.getNeighbour(curNode.pos, dir); + unsigned idx = world.getIdx(curPt); const int8_t ptValue = ptToVisitOrHb[idx]; // Already visited if(ptValue == 0) continue; // Not reachable - if(!shipPathChecker.IsEdgeOk(curNode.pos, dir)) + if(!shipPathChecker.isEdgeOk(curNode.pos, dir)) continue; if(ptValue > 0) // found harbor(s) { const ShipDirection shipDir = world.GetShipDir(world.harborData[startHbId].pos, curPt); - const SeaId seaId = world.GetSeaFromCoastalPoint(curPt); + const SeaId seaId = world.getSeaFromCoastalPoint(curPt); RTTR_Assert(seaId); auto const coastToHbs = coastToHarborPerSea[seaId].equal_range(idx); for(auto it = coastToHbs.first; it != coastToHbs.second; ++it) @@ -713,7 +713,7 @@ void MapLoader::CalcHarborPosNeighbors(World& world) HarborPos& otherHb = world.harborData[otherHbId]; for(const auto hbDir : helpers::EnumRange{}) { - if(otherHb.seaIds[hbDir] == seaId && world.GetNeighbour(otherHb.pos, hbDir) != curPt) + if(otherHb.seaIds[hbDir] == seaId && world.getNeighbour(otherHb.pos, hbDir) != curPt) otherHb.seaIds[hbDir].reset(); } } @@ -730,11 +730,11 @@ void MapLoader::CalcHarborPosNeighbors(World& world) unsigned MapLoader::MeasureSea(World& world, const MapPoint start, SeaId seaId) { // Breitensuche von diesem Punkt aus durchf�hren - std::vector visited(world.GetWidth() * world.GetHeight(), false); + std::vector visited(world.getWidth() * world.getHeight(), false); std::queue todo; todo.push(start); - visited[world.GetIdx(start)] = true; + visited[world.getIdx(start)] = true; // Count of nodes (including start node) unsigned count = 0; @@ -744,17 +744,17 @@ unsigned MapLoader::MeasureSea(World& world, const MapPoint start, SeaId seaId) MapPoint p = todo.front(); todo.pop(); - RTTR_Assert(visited[world.GetIdx(p)]); - world.GetNodeInt(p).seaId = seaId; + RTTR_Assert(visited[world.getIdx(p)]); + world.getNodeInt(p).seaId = seaId; - for(const MapPoint neighbourPt : world.GetNeighbours(p)) + for(const MapPoint neighbourPt : world.getNeighbours(p)) { - if(visited[world.GetIdx(neighbourPt)]) + if(visited[world.getIdx(neighbourPt)]) continue; - visited[world.GetIdx(neighbourPt)] = true; + visited[world.getIdx(neighbourPt)] = true; // Ist das dort auch ein Meerespunkt? - if(world.IsSeaPoint(neighbourPt)) + if(world.isSeaPoint(neighbourPt)) todo.push(neighbourPt); } diff --git a/libs/s25main/world/MapLoader.h b/libs/s25main/world/MapLoader.h index 44d52d2a77..22c499c61f 100644 --- a/libs/s25main/world/MapLoader.h +++ b/libs/s25main/world/MapLoader.h @@ -53,13 +53,13 @@ class MapLoader bool PlaceHQs(bool addStartWares = true); /// Setup resources like gold and water after loading a new map. /// TODO(Replay): Remove fixFish (always set to true) - static void SetupResources(GameWorldBase& world, bool fixFish = true); + static void setupResources(GameWorldBase& world, bool fixFish = true); /// Return the (original/unshuffled) position of the players HQ (only valid after successful load) - MapPoint GetOriginalHQPos(unsigned player) const { return hqPositions_[player]; } + MapPoint getOriginalHQPos(unsigned player) const { return hqPositions_[player]; } static void InitShadows(World& world); - static void SetMapExplored(World& world); + static void setMapExplored(World& world); static bool InitSeasAndHarbors(World& world, const std::vector& additionalHarbors = std::vector()); /// Place the HQs on a loaded map and add starting wares if desired. diff --git a/libs/s25main/world/MapSerializer.cpp b/libs/s25main/world/MapSerializer.cpp index b56f60bef5..39bbbf7d42 100644 --- a/libs/s25main/world/MapSerializer.cpp +++ b/libs/s25main/world/MapSerializer.cpp @@ -17,16 +17,16 @@ void MapSerializer::Serialize(const GameWorldBase& world, SerializedGameData& sgd) { // Headinformationen - helpers::pushPoint(sgd, world.GetSize()); - sgd.PushString(world.GetDescription().get(world.GetLandscapeType()).name); + helpers::pushPoint(sgd, world.getSize()); + sgd.PushString(world.getDescription().get(world.GetLandscapeType()).name); - sgd.PushUnsignedInt(GameObject::GetObjIDCounter()); + sgd.PushUnsignedInt(GameObject::getObjIDCounter()); // Alle Weltpunkte serialisieren - const unsigned numPlayers = world.GetNumPlayers(); + const unsigned numPlayers = world.getNumPlayers(); for(const auto& node : world.nodes) { - node.Serialize(sgd, numPlayers, world.GetDescription()); + node.Serialize(sgd, numPlayers, world.getDescription()); } // Katapultsteine serialisieren @@ -58,15 +58,15 @@ void MapSerializer::Serialize(const GameWorldBase& world, SerializedGameData& sg sgd.PushObjectContainer(world.harbor_building_sites_from_sea, true); - if(!world.HasLua()) + if(!world.hasLua()) sgd.PushLongString(""); else { - sgd.PushLongString(world.GetLua().getScript()); + sgd.PushLongString(world.getLua().getScript()); Serializer luaSaveState; try { - if(!world.GetLua().Serialize(luaSaveState)) + if(!world.getLua().Serialize(luaSaveState)) throw SerializedGameData::Error(_("Failed to save lua state!")); } catch(const std::exception& e) { @@ -83,21 +83,21 @@ void MapSerializer::Deserialize(GameWorldBase& world, SerializedGameData& sgd, G ILocalGameState& localgameState) { // Initialisierungen - GameDataLoader gdLoader(world.GetDescriptionWriteable()); + GameDataLoader gdLoader(world.getDescriptionWriteable()); if(!gdLoader.Load()) throw SerializedGameData::Error(_("Failed to load game data!")); // Headinformationen const auto size = helpers::popPoint(sgd); DescIdx lt; - if(sgd.GetGameDataVersion() < 3) + if(sgd.getGameDataVersion() < 3) { uint8_t gfxSet = sgd.PopUnsignedChar(); - lt = world.GetDescription().landscapes.find([gfxSet](const LandscapeDesc& l) { return l.s2Id == gfxSet; }); + lt = world.getDescription().landscapes.find([gfxSet](const LandscapeDesc& l) { return l.s2Id == gfxSet; }); } else { std::string sLandscape = sgd.PopString(); - lt = world.GetDescription().landscapes.getIndex(sLandscape); + lt = world.getDescription().landscapes.getIndex(sLandscape); if(!lt) throw SerializedGameData::Error(std::string("Invalid landscape: ") + sLandscape); } @@ -105,20 +105,20 @@ void MapSerializer::Deserialize(GameWorldBase& world, SerializedGameData& sgd, G GameObject::ResetCounters(sgd.PopUnsignedInt()); std::vector> landscapeTerrains; - if(sgd.GetGameDataVersion() < 3) + if(sgd.getGameDataVersion() < 3) { // Assumes the order of the terrain in the description file is the same as in the prior RTTR versions landscapeTerrains = - world.GetDescription().terrain.findAll([lt](const TerrainDesc& t) { return t.landscape == lt; }); + world.getDescription().terrain.findAll([lt](const TerrainDesc& t) { return t.landscape == lt; }); } // Alle Weltpunkte MapPoint curPos(0, 0); - const unsigned numPlayers = world.GetNumPlayers(); + const unsigned numPlayers = world.getNumPlayers(); for(auto& node : world.nodes) { - node.Deserialize(sgd, numPlayers, world.GetDescription(), landscapeTerrains); + node.Deserialize(sgd, numPlayers, world.getDescription(), landscapeTerrains); curPos.x++; - if(curPos.x >= world.GetWidth()) + if(curPos.x >= world.getWidth()) { curPos.x = 0; curPos.y++; @@ -148,20 +148,20 @@ void MapSerializer::Deserialize(GameWorldBase& world, SerializedGameData& sgd, G { const auto id = HarborId(sgd.PopUnsignedInt()); SeaId sea; - if(sgd.GetGameDataVersion() >= 15) + if(sgd.getGameDataVersion() >= 15) sea = SeaId(sgd.PopUnsignedInt()); const auto distance = sgd.PopUnsignedInt(); neighbor.emplace_back(id, sea, distance); } } } - if(sgd.GetGameDataVersion() < 13 && !world.harborData.empty()) + if(sgd.getGameDataVersion() < 13 && !world.harborData.empty()) { // Workaround for save games without increased game data version after introducing the change if(!world.harborData.front().pos.isValid()) world.harborData.erase(world.harborData.begin()); } - if(sgd.GetGameDataVersion() < 15) + if(sgd.getGameDataVersion() < 15) { const auto getSeas = [&world](const HarborId& hbId) { boost::container::static_vector> seas; @@ -173,7 +173,7 @@ void MapSerializer::Deserialize(GameWorldBase& world, SerializedGameData& sgd, G return seas; }; // Determine seas for neighbors - for(const auto startHbId : helpers::idRange(world.GetNumHarborPoints())) + for(const auto startHbId : helpers::idRange(world.getNumHarborPoints())) { const auto mySeas = getSeas(startHbId); for(auto& neighborsPerDir : world.harborData[startHbId].neighbors) @@ -198,15 +198,15 @@ void MapSerializer::Deserialize(GameWorldBase& world, SerializedGameData& sgd, G if(!helpers::contains(otherSeas, sea)) continue; unsigned len = 0; - const auto startPoint = world.GetCoastalPoint(startHbId, sea); - const auto nbPoint = world.GetCoastalPoint(neighbor.id, sea); + const auto startPoint = world.getCoastalPoint(startHbId, sea); + const auto nbPoint = world.getCoastalPoint(neighbor.id, sea); if(neighbor.distance == 0 && startPoint == nbPoint) { neighbor.sea = sea; break; } - if(world.FindShipPath(world.GetCoastalPoint(startHbId, sea), - world.GetCoastalPoint(neighbor.id, sea), neighbor.distance, nullptr, &len) + if(world.FindShipPath(world.getCoastalPoint(startHbId, sea), + world.getCoastalPoint(neighbor.id, sea), neighbor.distance, nullptr, &len) && len == neighbor.distance) { neighbor.sea = sea; @@ -246,6 +246,6 @@ void MapSerializer::Deserialize(GameWorldBase& world, SerializedGameData& sgd, G { throw SerializedGameData::Error(std::string(_("Failed to load lua state!")) + _("Error: ") + e.what()); } - game.SetLua(std::move(lua)); + game.setLua(std::move(lua)); } } diff --git a/libs/s25main/world/MilitarySquares.cpp b/libs/s25main/world/MilitarySquares.cpp index 176ecab835..c32df55cb4 100644 --- a/libs/s25main/world/MilitarySquares.cpp +++ b/libs/s25main/world/MilitarySquares.cpp @@ -24,7 +24,7 @@ void MilitarySquares::Clear() size_ = MapExtent::all(0); } -std::list& MilitarySquares::GetSquare(const MapPoint pt) +std::list& MilitarySquares::getSquare(const MapPoint pt) { MapPoint milPt = pt / MILITARY_SQUARE_SIZE; return squares[milPt.y * size_.x + milPt.x]; @@ -32,16 +32,16 @@ std::list& MilitarySquares::GetSquare(const MapPoint pt) void MilitarySquares::Add(nobBaseMilitary* const bld) { - GetSquare(bld->GetPos()).push_back(bld); + getSquare(bld->getPos()).push_back(bld); } void MilitarySquares::Remove(nobBaseMilitary* const bld) { - RTTR_Assert(helpers::contains(GetSquare(bld->GetPos()), bld)); - GetSquare(bld->GetPos()).remove(bld); + RTTR_Assert(helpers::contains(getSquare(bld->getPos()), bld)); + getSquare(bld->getPos()).remove(bld); } -sortedMilitaryBlds MilitarySquares::GetBuildingsInRange(const MapPoint pt, unsigned short radius) const +sortedMilitaryBlds MilitarySquares::getBuildingsInRange(const MapPoint pt, unsigned short radius) const { // maximum radius is half the size (rounded up) to avoid overlapping const Position offsets = elMin((size_ + Position::all(1)) / 2, Position::all(radius)); diff --git a/libs/s25main/world/MilitarySquares.h b/libs/s25main/world/MilitarySquares.h index d18ea35ee8..0a4666e52f 100644 --- a/libs/s25main/world/MilitarySquares.h +++ b/libs/s25main/world/MilitarySquares.h @@ -17,7 +17,7 @@ class MilitarySquares std::vector> squares; MapExtent size_; // Liefert das entsprechende Militärquadrat für einen bestimmten Punkt auf der Karte zurück (normale Koordinaten) - std::list& GetSquare(MapPoint pt); + std::list& getSquare(MapPoint pt); public: MilitarySquares(); @@ -25,5 +25,5 @@ class MilitarySquares void Clear(); void Add(nobBaseMilitary* bld); void Remove(nobBaseMilitary* bld); - sortedMilitaryBlds GetBuildingsInRange(MapPoint pt, unsigned short radius) const; + sortedMilitaryBlds getBuildingsInRange(MapPoint pt, unsigned short radius) const; }; diff --git a/libs/s25main/world/NodeMapBase.h b/libs/s25main/world/NodeMapBase.h index 83b9f9f746..3e07ffaf85 100644 --- a/libs/s25main/world/NodeMapBase.h +++ b/libs/s25main/world/NodeMapBase.h @@ -39,13 +39,13 @@ class NodeMapBase final : public MapBase template inline const T_Node& NodeMapBase::operator[](const MapPoint& pt) const { - return nodes[GetIdx(pt)]; + return nodes[getIdx(pt)]; } template inline T_Node& NodeMapBase::operator[](const MapPoint& pt) { - return nodes[GetIdx(pt)]; + return nodes[getIdx(pt)]; } template diff --git a/libs/s25main/world/TerritoryRegion.cpp b/libs/s25main/world/TerritoryRegion.cpp index cfc80cf2fa..89d7dd7e93 100644 --- a/libs/s25main/world/TerritoryRegion.cpp +++ b/libs/s25main/world/TerritoryRegion.cpp @@ -15,7 +15,7 @@ TerritoryRegion::TerritoryRegion(const Position& startPt, const Extent& size, const GameWorldBase& gwb) : startPt(startPt), size(size), world(gwb) { - if(size.x > gwb.GetWidth() || size.y > gwb.GetHeight()) + if(size.x > gwb.getWidth() || size.y > gwb.getHeight()) throw std::runtime_error("Size to big for TerritoryRegion"); // Feld erzeugen nodes.resize(size.x * size.y); @@ -23,7 +23,7 @@ TerritoryRegion::TerritoryRegion(const Position& startPt, const Extent& size, co TerritoryRegion::~TerritoryRegion() = default; -bool TerritoryRegion::IsPointInPolygon(const std::vector& polygon, const Position& pt) +bool TerritoryRegion::isPointInPolygon(const std::vector& polygon, const Position& pt) { // Adapted from http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html // The site contains a lot of details and information. @@ -54,14 +54,14 @@ bool TerritoryRegion::IsPointInPolygon(const std::vector& polygon, con return (inside); } -bool TerritoryRegion::IsPointValid(const MapExtent& mapSize, const std::vector& polygon, const MapPoint pt) +bool TerritoryRegion::isPointValid(const MapExtent& mapSize, const std::vector& polygon, const MapPoint pt) { // This is for specifying polyons that wrap around corners: // - e.g. w=64, h=64, polygon = {(40,40), (40,80), (80,80), (80,40)} Position pt2(pt.x + mapSize.x, pt.y), pt3(pt.x, pt.y + mapSize.y), pt4(pt + mapSize); const std::vector polygonInt(polygon.begin(), polygon.end()); - return (polygon.empty() || IsPointInPolygon(polygonInt, Position(pt)) || IsPointInPolygon(polygonInt, pt2) - || IsPointInPolygon(polygonInt, pt3) || IsPointInPolygon(polygonInt, pt4)); + return (polygon.empty() || isPointInPolygon(polygonInt, Position(pt)) || isPointInPolygon(polygonInt, pt2) + || isPointInPolygon(polygonInt, pt3) || isPointInPolygon(polygonInt, pt4)); } void TerritoryRegion::AdjustNode(MapPoint pt, uint8_t player, uint16_t radius, const std::vector* allowedArea) @@ -72,7 +72,7 @@ void TerritoryRegion::AdjustNode(MapPoint pt, uint8_t player, uint16_t radius, c return; // check whether this node is within the area we may have territory in - if(allowedArea && !IsPointValid(world.GetSize(), *allowedArea, pt)) + if(allowedArea && !isPointValid(world.getSize(), *allowedArea, pt)) return; /// If the new distance is less then the old, then we claim this point. @@ -86,7 +86,7 @@ void TerritoryRegion::AdjustNode(MapPoint pt, uint8_t player, uint16_t radius, c TerritoryRegion::TRNode* TerritoryRegion::TryGetNode(const MapPoint& pt) { - return TryGetNode(GetPosFromMapPos(pt)); + return TryGetNode(getPosFromMapPos(pt)); } TerritoryRegion::TRNode* TerritoryRegion::TryGetNode(Position realPt) @@ -94,7 +94,7 @@ TerritoryRegion::TRNode* TerritoryRegion::TryGetNode(Position realPt) if(!AdjustCoords(realPt)) return nullptr; - return &GetNode(realPt); + return &getNode(realPt); } const TerritoryRegion::TRNode* TerritoryRegion::TryGetNode(Position realPt) const @@ -102,7 +102,7 @@ const TerritoryRegion::TRNode* TerritoryRegion::TryGetNode(Position realPt) cons if(!AdjustCoords(realPt)) return nullptr; - return &GetNode(realPt); + return &getNode(realPt); } bool TerritoryRegion::AdjustCoords(Position& pt) const @@ -114,18 +114,18 @@ bool TerritoryRegion::AdjustCoords(Position& pt) const // Check if this point is inside this region // Apply wrap-around if on either side if(pt.x < 0) - pt.x += world.GetWidth(); + pt.x += world.getWidth(); else if(static_cast(pt.x) >= size.x) - pt.x -= world.GetWidth(); + pt.x -= world.getWidth(); // Check the (possibly) adjusted point if(pt.x < 0 || static_cast(pt.x) >= size.x) return false; // Apply wrap-around if on either side if(pt.y < 0) - pt.y += world.GetHeight(); + pt.y += world.getHeight(); else if(static_cast(pt.y) >= size.y) - pt.y -= world.GetHeight(); + pt.y -= world.getHeight(); // Check the (possibly) adjusted point if(pt.y < 0 || static_cast(pt.y) >= size.y) return false; @@ -134,33 +134,33 @@ bool TerritoryRegion::AdjustCoords(Position& pt) const void TerritoryRegion::CalcTerritoryOfBuilding(const noBaseBuilding& building) { - unsigned radius = building.GetMilitaryRadius(); + unsigned radius = building.getMilitaryRadius(); // Does not hold territory? -> Out if(radius == 0u) return; // Also ignore non-occupied military buildings - if(building.GetGOT() == GO_Type::NobMilitary && static_cast(building).IsNewBuilt()) + if(building.getGOT() == GO_Type::NobMilitary && static_cast(building).isNewBuilt()) return; - const std::vector* allowedArea = &world.GetPlayer(building.GetPlayer()).GetRestrictedArea(); + const std::vector* allowedArea = &world.getPlayer(building.getPlayer()).getRestrictedArea(); if(allowedArea->empty()) allowedArea = nullptr; // Punkt, auf dem das Militärgebäude steht - MapPoint bldPos = building.GetPos(); - AdjustNode(bldPos, building.GetPlayer(), 0, + MapPoint bldPos = building.getPos(); + AdjustNode(bldPos, building.getPlayer(), 0, nullptr); // no need to check barriers here. this point is on our territory. - const auto pts = world.GetPointsInRadius(bldPos, radius, ReturnMapPointWithRadius{}); + const auto pts = world.getPointsInRadius(bldPos, radius, ReturnMapPointWithRadius{}); for(const auto& ptWithRadius : pts) - AdjustNode(ptWithRadius.first, building.GetPlayer(), ptWithRadius.second, allowedArea); + AdjustNode(ptWithRadius.first, building.getPlayer(), ptWithRadius.second, allowedArea); } uint8_t TerritoryRegion::SafeGetOwner(const Position& pt) const { const TRNode* node = TryGetNode(pt); if(!node) - return world.GetNode(world.MakeMapPoint(pt + startPt)).owner; + return world.getNode(world.MakeMapPoint(pt + startPt)).owner; return node->owner; } @@ -170,7 +170,7 @@ bool TerritoryRegion::WillBePlayerTerritory(const Position& mapPos, uint8_t owne { if(d == exceptDir) continue; - if(SafeGetOwner(::GetNeighbour(mapPos, d) - startPt) != owner) + if(SafeGetOwner(::getNeighbour(mapPos, d) - startPt) != owner) return false; } return true; diff --git a/libs/s25main/world/TerritoryRegion.h b/libs/s25main/world/TerritoryRegion.h index b81b342bc4..93cdc61c0c 100644 --- a/libs/s25main/world/TerritoryRegion.h +++ b/libs/s25main/world/TerritoryRegion.h @@ -24,18 +24,18 @@ class TerritoryRegion TerritoryRegion(const Position& startPt, const Extent& size, const GameWorldBase& gwb); ~TerritoryRegion(); - static bool IsPointValid(const MapExtent& mapSize, const std::vector& polygon, MapPoint pt); + static bool isPointValid(const MapExtent& mapSize, const std::vector& polygon, MapPoint pt); /// Adds the territory of the building void CalcTerritoryOfBuilding(const noBaseBuilding& building); - unsigned GetIdx(const Position& pt) const; - Position GetPosFromMapPos(const MapPoint& pt) const; + unsigned getIdx(const Position& pt) const; + Position getPosFromMapPos(const MapPoint& pt) const; /// Return the owner of the point from this region (pt is relative to startPt) - uint8_t GetOwner(const Position& pt) const { return GetNode(pt).owner; } + uint8_t getOwner(const Position& pt) const { return getNode(pt).owner; } /// Return the owner. If the point is outside the region return owner from map uint8_t SafeGetOwner(const Position& pt) const; - void SetOwner(const Position& pt, uint8_t owner) { GetNode(pt).owner = owner; } + void setOwner(const Position& pt, uint8_t owner) { getNode(pt).owner = owner; } /// Return true, if all points surrounding the given point (relative to map origin!!!) have the same owner /// Direction exceptDir will not be checked bool WillBePlayerTerritory(const Position& mapPos, uint8_t owner, Direction exceptDir); @@ -58,11 +58,11 @@ class TerritoryRegion }; /// Check whether the point is part of the polygon - static bool IsPointInPolygon(const std::vector& polygon, const Position& pt); + static bool isPointInPolygon(const std::vector& polygon, const Position& pt); /// Check and set if a point belongs to the player, when a military bld in the given radius is added void AdjustNode(MapPoint pt, uint8_t player, uint16_t radius, const std::vector* allowedArea); - TRNode& GetNode(const Position& pt) { return nodes[GetIdx(pt)]; } - const TRNode& GetNode(const Position& pt) const { return nodes[GetIdx(pt)]; } + TRNode& getNode(const Position& pt) { return nodes[getIdx(pt)]; } + const TRNode& getNode(const Position& pt) const { return nodes[getIdx(pt)]; } /// Return a pointer to the node, if it is inside this region TRNode* TryGetNode(const MapPoint& pt); TRNode* TryGetNode(Position realPt); @@ -73,14 +73,14 @@ class TerritoryRegion std::vector nodes; }; -inline unsigned TerritoryRegion::GetIdx(const Position& pt) const +inline unsigned TerritoryRegion::getIdx(const Position& pt) const { RTTR_Assert(pt.x >= 0 && static_cast(pt.x) < size.x); RTTR_Assert(pt.y >= 0 && static_cast(pt.y) < size.y); return pt.y * size.x + pt.x; } -inline Position TerritoryRegion::GetPosFromMapPos(const MapPoint& pt) const +inline Position TerritoryRegion::getPosFromMapPos(const MapPoint& pt) const { return pt - startPt; } diff --git a/libs/s25main/world/TradeRoute.cpp b/libs/s25main/world/TradeRoute.cpp index 97d9e27f56..d55601432d 100644 --- a/libs/s25main/world/TradeRoute.cpp +++ b/libs/s25main/world/TradeRoute.cpp @@ -25,7 +25,7 @@ void TradeRoute::Serialize(SerializedGameData& sgd) const } /// Gets the next direction the caravane has to take -helpers::OptionalEnum TradeRoute::GetNextDir() +helpers::OptionalEnum TradeRoute::getNextDir() { if(curPos == path.goal) return TradeDirection::ReachedGoal; @@ -49,7 +49,7 @@ helpers::OptionalEnum TradeRoute::GetNextDir() RTTR_Assert(nextDir == path.route[curRouteIdx]); curRouteIdx++; - curPos = world.GetNeighbour(curPos, nextDir); + curPos = world.getNeighbour(curPos, nextDir); return TradeDirection(rttr::enum_cast(nextDir)); } diff --git a/libs/s25main/world/TradeRoute.h b/libs/s25main/world/TradeRoute.h index 99503b985c..36580f8936 100644 --- a/libs/s25main/world/TradeRoute.h +++ b/libs/s25main/world/TradeRoute.h @@ -30,16 +30,16 @@ class TradeRoute void Serialize(SerializedGameData& sgd) const; /// Gets the next direction the caravane has to take, TradeDirection::ReachedGoal or std::nullopt_t - helpers::OptionalEnum GetNextDir(); + helpers::OptionalEnum getNextDir(); /// Returns the current position. This is assumed to be the position currently walking to and reached by the time /// GetNextDir should be called - MapPoint GetCurPos() const { return curPos; } + MapPoint getCurPos() const { return curPos; } /// Returns true, if this is a valid route - bool IsValid() const { return !path.route.empty() || path.start == path.goal; } + bool isValid() const { return !path.route.empty() || path.start == path.goal; } /// Assigns new start and goal positions and hence, a new route void AssignNewGoal(const MapPoint& start, const MapPoint& newGoal); - const TradePath& GetTradePath() const { return path; } + const TradePath& getTradePath() const { return path; } }; diff --git a/libs/s25main/world/World.cpp b/libs/s25main/world/World.cpp index f5af3e96ce..4be5834128 100644 --- a/libs/s25main/world/World.cpp +++ b/libs/s25main/world/World.cpp @@ -28,7 +28,7 @@ World::~World() void World::Init(const MapExtent& mapSize, DescIdx lt) { - RTTR_Assert(GetSize() == MapExtent::all(0)); // Already init + RTTR_Assert(getSize() == MapExtent::all(0)); // Already init RTTR_Assert(mapSize.x > 0 && mapSize.y > 0); // No empty map Resize(mapSize); if(!lt) @@ -45,13 +45,13 @@ void World::Unload() std::set roadsegments; for(const auto& node : nodes) { - if(!node.obj || node.obj->GetGOT() != GO_Type::Flag) + if(!node.obj || node.obj->getGOT() != GO_Type::Flag) continue; for(const auto dir : helpers::EnumRange{}) { - if(static_cast(node.obj)->GetRoute(dir)) + if(static_cast(node.obj)->getRoute(dir)) { - roadsegments.insert(static_cast(node.obj)->GetRoute(dir)); + roadsegments.insert(static_cast(node.obj)->getRoute(dir)); } } } @@ -79,10 +79,10 @@ void World::Resize(const MapExtent& newSize) MapBase::Resize(newSize); nodes.clear(); militarySquares.Clear(); - if(GetSize().x > 0) + if(getSize().x > 0) { - nodes.resize(prodOfComponents(GetSize())); - militarySquares.Init(GetSize()); + nodes.resize(prodOfComponents(getSize())); + militarySquares.Init(getSize()); } } @@ -90,11 +90,11 @@ noBase& World::AddFigureImpl(const MapPoint pt, std::unique_ptr fig) { RTTR_Assert(fig); - auto& figures = GetNodeInt(pt).figures; + auto& figures = getNodeInt(pt).figures; #if RTTR_ENABLE_ASSERTS RTTR_Assert(!helpers::containsPtr(figures, fig.get())); - for(const MapPoint nb : GetNeighbours(pt)) - RTTR_Assert(!helpers::containsPtr(GetNode(nb).figures, fig.get())); // Added figure that is in surrounding? + for(const MapPoint nb : getNeighbours(pt)) + RTTR_Assert(!helpers::containsPtr(getNode(nb).figures, fig.get())); // Added figure that is in surrounding? #endif noBase& result = *fig; @@ -104,42 +104,42 @@ noBase& World::AddFigureImpl(const MapPoint pt, std::unique_ptr fig) noBase* World::RemoveFigureImpl(const MapPoint pt, noBase& fig) { - return helpers::extractPtr(GetNodeInt(pt).figures, &fig).release(); + return helpers::extractPtr(getNodeInt(pt).figures, &fig).release(); } -noBase* World::GetNO(const MapPoint pt) +noBase* World::getNO(const MapPoint pt) { - if(GetNode(pt).obj) - return GetNode(pt).obj; + if(getNode(pt).obj) + return getNode(pt).obj; else return noNodeObj.get(); } -const noBase* World::GetNO(const MapPoint pt) const +const noBase* World::getNO(const MapPoint pt) const { - if(GetNode(pt).obj) - return GetNode(pt).obj; + if(getNode(pt).obj) + return getNode(pt).obj; else return noNodeObj.get(); } -void World::SetNO(const MapPoint pt, noBase* obj, const bool replace /* = false*/) +void World::setNO(const MapPoint pt, noBase* obj, const bool replace /* = false*/) { - RTTR_Assert(replace || obj == nullptr || GetNode(pt).obj == nullptr); + RTTR_Assert(replace || obj == nullptr || getNode(pt).obj == nullptr); #if RTTR_ENABLE_ASSERTS RTTR_Assert(!dynamic_cast(obj)); // It should be a static, non-movable object #endif - GetNodeInt(pt).obj = obj; + getNodeInt(pt).obj = obj; } void World::DestroyNO(const MapPoint pt, const bool checkExists /* = true*/) { - noBase* obj = GetNodeInt(pt).obj; + noBase* obj = getNodeInt(pt).obj; if(obj) { // Destroy may remove the NO already from the map or replace it (e.g. building -> fire) // So remove from map, then destroy and free - GetNodeInt(pt).obj = nullptr; + getNodeInt(pt).obj = nullptr; obj->Destroy(); deletePtr(obj); } else @@ -147,31 +147,31 @@ void World::DestroyNO(const MapPoint pt, const bool checkExists /* = true*/) } /// Returns the GOT if an object or GOT_NOTHING if none -GO_Type World::GetGOT(const MapPoint pt) const +GO_Type World::getGOT(const MapPoint pt) const { - noBase* obj = GetNode(pt).obj; + noBase* obj = getNode(pt).obj; if(obj) - return obj->GetGOT(); + return obj->getGOT(); else return GO_Type::Nothing; } void World::ReduceResource(const MapPoint pt) { - const uint8_t curAmount = GetNodeInt(pt).resources.getAmount(); + const uint8_t curAmount = getNodeInt(pt).resources.getAmount(); RTTR_Assert(curAmount > 0); - GetNodeInt(pt).resources.setAmount(curAmount - 1u); + getNodeInt(pt).resources.setAmount(curAmount - 1u); } -void World::SetReserved(const MapPoint pt, const bool reserved) +void World::setReserved(const MapPoint pt, const bool reserved) { - RTTR_Assert(GetNodeInt(pt).reserved != reserved); - GetNodeInt(pt).reserved = reserved; + RTTR_Assert(getNodeInt(pt).reserved != reserved); + getNodeInt(pt).reserved = reserved; } -void World::SetVisibility(const MapPoint pt, unsigned char player, Visibility vis, unsigned fowTime) +void World::setVisibility(const MapPoint pt, unsigned char player, Visibility vis, unsigned fowTime) { - FoWNode& node = GetNodeInt(pt).fow[player]; + FoWNode& node = getNodeInt(pt).fow[player]; Visibility oldVis = node.visibility; if(oldVis == vis) return; @@ -186,28 +186,28 @@ void World::SetVisibility(const MapPoint pt, unsigned char player, Visibility vi void World::ChangeAltitude(const MapPoint pt, const unsigned char altitude) { - GetNodeInt(pt).altitude = altitude; + getNodeInt(pt).altitude = altitude; // Schattierung neu berechnen von diesem Punkt und den Punkten drumherum RecalcShadow(pt); - for(const MapPoint nb : GetNeighbours(pt)) + for(const MapPoint nb : getNeighbours(pt)) RecalcShadow(nb); // Abgeleiteter Klasse Bescheid sagen AltitudeChanged(pt); } -bool World::IsPlayerTerritory(const MapPoint pt, const unsigned char owner) const +bool World::isPlayerTerritory(const MapPoint pt, const unsigned char owner) const { - const unsigned char ptOwner = GetNode(pt).owner; + const unsigned char ptOwner = getNode(pt).owner; if(owner != 0 && ptOwner != owner) return false; // Neighbour nodes must belong to this player - for(const MapPoint nb : GetNeighbours(pt)) + for(const MapPoint nb : getNeighbours(pt)) { - if(GetNode(nb).owner != ptOwner) + if(getNode(nb).owner != ptOwner) return false; } @@ -216,20 +216,20 @@ bool World::IsPlayerTerritory(const MapPoint pt, const unsigned char owner) cons BuildingQuality World::GetBQ(const MapPoint pt, const unsigned char player) const { - return AdjustBQ(pt, player, GetNode(pt).bq); + return AdjustBQ(pt, player, getNode(pt).bq); } BuildingQuality World::AdjustBQ(const MapPoint pt, unsigned char player, BuildingQuality nodeBQ) const { - if(nodeBQ == BuildingQuality::Nothing || !IsPlayerTerritory(pt, player + 1)) + if(nodeBQ == BuildingQuality::Nothing || !isPlayerTerritory(pt, player + 1)) return BuildingQuality::Nothing; // If we could build a building, but the buildings flag point is at the border, we can only build a flag - if(nodeBQ != BuildingQuality::Flag && !IsPlayerTerritory(GetNeighbour(pt, Direction::SouthEast))) + if(nodeBQ != BuildingQuality::Flag && !isPlayerTerritory(getNeighbour(pt, Direction::SouthEast))) { // Check for close flags, that prohibit to build a flag but not a building at this spot for(const Direction dir : {Direction::West, Direction::NorthWest, Direction::NorthEast}) { - if(GetNO(GetNeighbour(pt, dir))->GetBM() == BlockingManner::Flag) + if(getNO(getNeighbour(pt, dir))->getBM() == BlockingManner::Flag) return BuildingQuality::Nothing; } return BuildingQuality::Flag; @@ -237,15 +237,15 @@ BuildingQuality World::AdjustBQ(const MapPoint pt, unsigned char player, Buildin return nodeBQ; } -bool World::HasFigureAt(const MapPoint pt, const noBase& figure) const +bool World::hasFigureAt(const MapPoint pt, const noBase& figure) const { - return helpers::containsPtr(GetNode(pt).figures, &figure); + return helpers::containsPtr(getNode(pt).figures, &figure); } -WalkTerrain World::GetTerrain(MapPoint pt, Direction dir) const +WalkTerrain World::getTerrain(MapPoint pt, Direction dir) const { // Manually inlined code from GetNeighbors. Measured to greatly improve performance - const MapExtent size = GetSize(); + const MapExtent size = getSize(); const MapCoord yminus1 = (pt.y == 0 ? size.y : pt.y) - 1; const MapCoord xplus1 = pt.x == size.x - 1 ? 0 : pt.x + 1; const MapCoord xminus1 = (pt.x == 0 ? size.x : pt.x) - 1; @@ -258,38 +258,38 @@ WalkTerrain World::GetTerrain(MapPoint pt, Direction dir) const { case Direction::West: { - return {GetNode(wPt).t2, GetNode(nwPt).t1}; + return {getNode(wPt).t2, getNode(nwPt).t1}; } case Direction::NorthWest: { - const MapNode& node = GetNode(nwPt); + const MapNode& node = getNode(nwPt); return {node.t1, node.t2}; } case Direction::NorthEast: { - return {GetNode(nwPt).t2, GetNode(nePt).t1}; + return {getNode(nwPt).t2, getNode(nePt).t1}; } case Direction::East: { - return {GetNode(nePt).t1, GetNode(pt).t2}; + return {getNode(nePt).t1, getNode(pt).t2}; } case Direction::SouthEast: { - const MapNode& node = GetNode(pt); + const MapNode& node = getNode(pt); return {node.t2, node.t1}; } case Direction::SouthWest: { - return {GetNode(pt).t1, GetNode(wPt).t2}; + return {getNode(pt).t1, getNode(wPt).t2}; } } throw std::logic_error("Invalid direction"); } -helpers::EnumArray, Direction> World::GetTerrainsAround(MapPoint pt) const +helpers::EnumArray, Direction> World::getTerrainsAround(MapPoint pt) const { // Manually inlined code from GetNeighbors. Measured to greatly improve performance - const MapExtent size = GetSize(); + const MapExtent size = getSize(); const MapCoord yminus1 = (pt.y == 0 ? size.y : pt.y) - 1; const MapCoord xplus1 = pt.x == size.x - 1 ? 0 : pt.x + 1; const MapCoord xminus1 = (pt.x == 0 ? size.x : pt.x) - 1; @@ -299,10 +299,10 @@ helpers::EnumArray, Direction> World::GetTerrainsAround(Map const MapPoint nwPt(!isEvenRow ? pt.x : xminus1, yminus1); const MapPoint nePt(isEvenRow ? pt.x : xplus1, yminus1); - const MapNode& nwNode = GetNode(nwPt); - const MapNode& neNode = GetNode(nePt); - const MapNode& curNode = GetNode(pt); - const MapNode& wNode = GetNode(wPt); + const MapNode& nwNode = getNode(nwPt); + const MapNode& neNode = getNode(nePt); + const MapNode& curNode = getNode(pt); + const MapNode& wNode = getNode(wPt); helpers::EnumArray, Direction> result{nwNode.t1, nwNode.t2, neNode.t1, curNode.t2, curNode.t1, wNode.t2}; return result; @@ -310,50 +310,50 @@ helpers::EnumArray, Direction> World::GetTerrainsAround(Map void World::SaveFOWNode(const MapPoint pt, const unsigned player, unsigned curTime) { - FoWNode& fow = GetNodeInt(pt).fow[player]; + FoWNode& fow = getNodeInt(pt).fow[player]; fow.last_update_time = curTime; // FOW-Objekt erzeugen - fow.object = GetNO(pt)->CreateFOWObject(); + fow.object = getNO(pt)->CreateFOWObject(); // Wege speichern, aber nur richtige, keine, die gerade gebaut werden for(const auto dir : helpers::EnumRange{}) - fow.roads[dir] = GetNode(pt).roads[dir]; + fow.roads[dir] = getNode(pt).roads[dir]; // Store ownership so FoW boundary stones can be drawn - fow.owner = GetNode(pt).owner; + fow.owner = getNode(pt).owner; // Grenzsteine merken - fow.boundary_stones = GetNode(pt).boundary_stones; + fow.boundary_stones = getNode(pt).boundary_stones; } -bool World::IsSeaPoint(const MapPoint pt) const +bool World::isSeaPoint(const MapPoint pt) const { - return World::IsOfTerrain(pt, [](const auto& desc) { return desc.Is(ETerrain::Shippable); }); + return World::isOfTerrain(pt, [](const auto& desc) { return desc.Is(ETerrain::Shippable); }); } -bool World::IsWaterPoint(const MapPoint pt) const +bool World::isWaterPoint(const MapPoint pt) const { - return World::IsOfTerrain(pt, [](const auto& desc) { return desc.kind == TerrainKind::Water; }); + return World::isOfTerrain(pt, [](const auto& desc) { return desc.kind == TerrainKind::Water; }); } -unsigned World::GetSeaSize(const SeaId seaId) const +unsigned World::getSeaSize(const SeaId seaId) const { RTTR_Assert(seaId && seaId.value() <= seas.size()); return seas[seaId].nodes_count; } -SeaId World::GetSeaId(const HarborId harborId, const Direction dir) const +SeaId World::getSeaId(const HarborId harborId, const Direction dir) const { RTTR_Assert(harborId); return harborData[harborId].seaIds[dir]; } -bool World::IsHarborAtSea(const HarborId harborId, const SeaId seaId) const +bool World::isHarborAtSea(const HarborId harborId, const SeaId seaId) const { - return GetCoastalPoint(harborId, seaId).isValid(); + return getCoastalPoint(harborId, seaId).isValid(); } -MapPoint World::GetCoastalPoint(const HarborId harborId, const SeaId seaId) const +MapPoint World::getCoastalPoint(const HarborId harborId, const SeaId seaId) const { RTTR_Assert(harborId); RTTR_Assert(seaId); @@ -362,28 +362,28 @@ MapPoint World::GetCoastalPoint(const HarborId harborId, const SeaId seaId) cons for(auto dir : helpers::enumRange(Direction::NorthEast)) { if(harborData[harborId].seaIds[dir] == seaId) - return GetNeighbour(harborData[harborId].pos, dir); + return getNeighbour(harborData[harborId].pos, dir); } // Keinen Punkt gefunden return MapPoint::Invalid(); } -PointRoad World::GetRoad(const MapPoint pt, RoadDir dir) const +PointRoad World::getRoad(const MapPoint pt, RoadDir dir) const { - return GetNode(pt).roads[dir]; + return getNode(pt).roads[dir]; } -PointRoad World::GetPointRoad(MapPoint pt, Direction dir) const +PointRoad World::getPointRoad(MapPoint pt, Direction dir) const { const RoadDir rDir = toRoadDir(pt, dir); - return GetRoad(pt, rDir); + return getRoad(pt, rDir); } -PointRoad World::GetPointFOWRoad(MapPoint pt, Direction dir, const unsigned char viewing_player) const +PointRoad World::getPointFOWRoad(MapPoint pt, Direction dir, const unsigned char viewing_player) const { const RoadDir rDir = toRoadDir(pt, dir); - return GetNode(pt).fow[viewing_player].roads[rDir]; + return getNode(pt).fow[viewing_player].roads[rDir]; } void World::AddCatapultStone(CatapultStone* cs) @@ -398,21 +398,21 @@ void World::RemoveCatapultStone(CatapultStone* cs) catapult_stones.remove(cs); } -MapPoint World::GetHarborPoint(const HarborId harborId) const +MapPoint World::getHarborPoint(const HarborId harborId) const { RTTR_Assert(harborId); return harborData[harborId].pos; } -const std::vector& World::GetHarborNeighbors(const HarborId harborId, +const std::vector& World::getHarborNeighbors(const HarborId harborId, const ShipDirection& dir) const { RTTR_Assert(harborId); return harborData[harborId].neighbors[dir]; } -unsigned World::GetMinHarborDistance(HarborId haborId1, HarborId harborId2) const +unsigned World::getMinHarborDistance(HarborId haborId1, HarborId harborId2) const { if(haborId1 == harborId2) // special case: distance to self return 0; @@ -428,7 +428,7 @@ unsigned World::GetMinHarborDistance(HarborId haborId1, HarborId harborId2) cons return minDistance; } -unsigned World::GetHarborDistance(HarborId haborId1, HarborId harborId2, SeaId sea) const +unsigned World::getHarborDistance(HarborId haborId1, HarborId harborId2, SeaId sea) const { if(haborId1 == harborId2) // special case: distance to self return 0; @@ -444,24 +444,24 @@ unsigned World::GetHarborDistance(HarborId haborId1, HarborId harborId2, SeaId s return std::numeric_limits::max(); } -SeaId World::GetSeaFromCoastalPoint(const MapPoint pt) const +SeaId World::getSeaFromCoastalPoint(const MapPoint pt) const { // Point itself must not be a sea - if(GetNode(pt).seaId) + if(getNode(pt).seaId) return SeaId::invalidValue(); // Should not be inside water itself - if(IsWaterPoint(pt)) + if(isWaterPoint(pt)) return SeaId::invalidValue(); // Surrounding must be valid sea - for(const MapPoint nb : GetNeighbours(pt)) + for(const MapPoint nb : getNeighbours(pt)) { - SeaId seaId = GetNode(nb).seaId; + SeaId seaId = getNode(nb).seaId; if(seaId) { // Check size (TODO: Others checks like harbor spots?) - if(GetSeaSize(seaId) > 20) + if(getSeaSize(seaId) > 20) return seaId; } } @@ -469,32 +469,32 @@ SeaId World::GetSeaFromCoastalPoint(const MapPoint pt) const return SeaId::invalidValue(); } -void World::SetRoad(const MapPoint pt, RoadDir roadDir, PointRoad type) +void World::setRoad(const MapPoint pt, RoadDir roadDir, PointRoad type) { - GetNodeInt(pt).roads[roadDir] = type; + getNodeInt(pt).roads[roadDir] = type; } -bool World::SetBQ(const MapPoint pt, BuildingQuality bq) +bool World::setBQ(const MapPoint pt, BuildingQuality bq) { BuildingQuality oldBQ = bq; - std::swap(GetNodeInt(pt).bq, oldBQ); + std::swap(getNodeInt(pt).bq, oldBQ); return oldBQ != bq; } void World::RecalcShadow(const MapPoint pt) { - int altitude = GetNode(pt).altitude; - int A = GetNeighbourNode(pt, Direction::NorthEast).altitude - altitude; - int B = GetNode(GetNeighbour2(pt, 0)).altitude - altitude; - int C = GetNode(GetNeighbour(pt, Direction::West)).altitude - altitude; - int D = GetNode(GetNeighbour2(pt, 11)).altitude - altitude; + int altitude = getNode(pt).altitude; + int A = getNeighbourNode(pt, Direction::NorthEast).altitude - altitude; + int B = getNode(getNeighbour2(pt, 0)).altitude - altitude; + int C = getNode(getNeighbour(pt, Direction::West)).altitude - altitude; + int D = getNode(getNeighbour2(pt, 11)).altitude - altitude; int shadingS2 = 64 + 9 * A - 3 * B - 6 * C - 9 * D; if(shadingS2 > 128) shadingS2 = 128; else if(shadingS2 < 0) shadingS2 = 0; - GetNodeInt(pt).shadow = shadingS2; + getNodeInt(pt).shadow = shadingS2; } void World::MakeWholeMapVisibleForAllPlayers() diff --git a/libs/s25main/world/World.h b/libs/s25main/world/World.h index 1fc4532338..df7faa30e1 100644 --- a/libs/s25main/world/World.h +++ b/libs/s25main/world/World.h @@ -87,13 +87,13 @@ class World : public MapBase /// Return the type of the landscape DescIdx GetLandscapeType() const { return lt; } - const WorldDescription& GetDescription() const { return description_; } - WorldDescription& GetDescriptionWriteable() { return description_; } + const WorldDescription& getDescription() const { return description_; } + WorldDescription& getDescriptionWriteable() { return description_; } /// Return the node at that point - const MapNode& GetNode(MapPoint pt) const; + const MapNode& getNode(MapPoint pt) const; /// Return the neighboring node - const MapNode& GetNeighbourNode(MapPoint pt, Direction dir) const; + const MapNode& getNeighbourNode(MapPoint pt, Direction dir) const; // Add a figure to a node (taking ownership) and returns a reference to it template @@ -109,24 +109,24 @@ class World : public MapBase template std::unique_ptr RemoveFigure(MapPoint pt, T*& fig) = delete; /// Return the NO from that point or a "nothing"-object if there is none - noBase* GetNO(MapPoint pt); + noBase* getNO(MapPoint pt); /// Return the NO from that point or a "nothing"-object if there is none - const noBase* GetNO(MapPoint pt) const; + const noBase* getNO(MapPoint pt) const; /// Places a NO at a given position. If replace is true, the old object is replaced, else it is assumed as /// non-existent - void SetNO(MapPoint pt, noBase* obj, bool replace = false); + void setNO(MapPoint pt, noBase* obj, bool replace = false); /// Destroys the object at the given node and removes it from the map. If checkExists is false than it is ok, if /// there is no obj void DestroyNO(MapPoint pt, bool checkExists = true); /// Return the game object type of the object at that point or GOT_NONE of there is none - GO_Type GetGOT(MapPoint pt) const; + GO_Type getGOT(MapPoint pt) const; void ReduceResource(MapPoint pt); - void SetResource(const MapPoint pt, Resource newResource) { GetNodeInt(pt).resources = newResource; } - void SetOwner(const MapPoint pt, unsigned char newOwner) { GetNodeInt(pt).owner = newOwner; } - void SetReserved(MapPoint pt, bool reserved); + void setResource(const MapPoint pt, Resource newResource) { getNodeInt(pt).resources = newResource; } + void setOwner(const MapPoint pt, unsigned char newOwner) { getNodeInt(pt).owner = newOwner; } + void setReserved(MapPoint pt, bool reserved); /// Sets the visibility and fires a Visibility Changed event if different /// fowTime is only used if visibility gets changed to FoW - void SetVisibility(MapPoint pt, unsigned char player, Visibility vis, unsigned fowTime = 0); + void setVisibility(MapPoint pt, unsigned char player, Visibility vis, unsigned fowTime = 0); void ChangeAltitude(MapPoint pt, unsigned char altitude); @@ -135,7 +135,7 @@ class World : public MapBase /// Checks if the point completely belongs to a player (if false but point itself belongs to player then it is a /// border) if owner is != 0 it checks if the points specific ownership - bool IsPlayerTerritory(MapPoint pt, unsigned char owner = 0) const; + bool isPlayerTerritory(MapPoint pt, unsigned char owner = 0) const; /// Return the BQ for the given player at the point (including ownership constraints) BuildingQuality GetBQ(MapPoint pt, unsigned char player) const; @@ -143,62 +143,62 @@ class World : public MapBase BuildingQuality AdjustBQ(MapPoint pt, unsigned char player, BuildingQuality nodeBQ) const; /// Return the figures currently on the node - auto GetFigures(const MapPoint pt) const { return helpers::nonNullPtrSpan(GetNode(pt).figures); } - bool HasFigureAt(MapPoint pt, const noBase& figure) const; + auto getFigures(const MapPoint pt) const { return helpers::nonNullPtrSpan(getNode(pt).figures); } + bool hasFigureAt(MapPoint pt, const noBase& figure) const; /// Return a specific object or nullptr template - T* GetSpecObj(const MapPoint pt) + T* getSpecObj(const MapPoint pt) { - return dynamic_cast(GetNode(pt).obj); + return dynamic_cast(getNode(pt).obj); } /// Return a specific object or nullptr template - const T* GetSpecObj(MapPoint pt) const + const T* getSpecObj(MapPoint pt) const { - return dynamic_cast(GetNode(pt).obj); + return dynamic_cast(getNode(pt).obj); } /// Get left and right terrain from the point in the given direction - WalkTerrain GetTerrain(MapPoint pt, Direction dir) const; + WalkTerrain getTerrain(MapPoint pt, Direction dir) const; /// Return all terrains around the given point. The per-direction entry is the terrain to the right - helpers::EnumArray, Direction> GetTerrainsAround(MapPoint pt) const; + helpers::EnumArray, Direction> getTerrainsAround(MapPoint pt) const; /// Create the FOW-objects, -streets, etc for a point and player void SaveFOWNode(MapPoint pt, unsigned player, unsigned curTime); - unsigned GetNumSeas() const { return seas.size(); } + unsigned getNumSeas() const { return seas.size(); } /// Return whether a node is inside a (shippable) sea (surrounded by shippable water) - bool IsSeaPoint(MapPoint pt) const; + bool isSeaPoint(MapPoint pt) const; /// Return true, if the point is surrounded by water - bool IsWaterPoint(MapPoint pt) const; + bool isWaterPoint(MapPoint pt) const; /// Return true if all surrounding terrains match the given predicate template - bool IsOfTerrain(MapPoint pt, T_Predicate predicate) const; + bool isOfTerrain(MapPoint pt, T_Predicate predicate) const; /// Return true if any surrounding terrain (description) matches the predicate template - bool HasTerrain(MapPoint pt, T_Predicate predicate) const; + bool hasTerrain(MapPoint pt, T_Predicate predicate) const; - unsigned GetSeaSize(SeaId seaId) const; + unsigned getSeaSize(SeaId seaId) const; /// Return the id of the sea at which the coast in the given direction of the harbor lies. 0 = None - SeaId GetSeaId(HarborId harborId, Direction dir) const; + SeaId getSeaId(HarborId harborId, Direction dir) const; /// Is the harbor at the given sea - bool IsHarborAtSea(HarborId harborId, SeaId seaId) const; + bool isHarborAtSea(HarborId harborId, SeaId seaId) const; /// Return the coast pt for a given harbor (where ships can land) if any - MapPoint GetCoastalPoint(HarborId harborId, SeaId seaId) const; + MapPoint getCoastalPoint(HarborId harborId, SeaId seaId) const; /// Return the number of harbor points - unsigned GetNumHarborPoints() const { return harborData.size(); } + unsigned getNumHarborPoints() const { return harborData.size(); } /// Return the coordinates for a given harbor point - MapPoint GetHarborPoint(HarborId harborId) const; + MapPoint getHarborPoint(HarborId harborId) const; /// Return the ID of the harbor point on that node or 0 if there is none - HarborId GetHarborPointID(const MapPoint pt) const { return GetNode(pt).harborId; } - const std::vector& GetHarborNeighbors(HarborId harborId, const ShipDirection& dir) const; + HarborId getHarborPointID(const MapPoint pt) const { return getNode(pt).harborId; } + const std::vector& getHarborNeighbors(HarborId harborId, const ShipDirection& dir) const; /// Return the minimum distance between 2 harbors /// Note: Harbors could be at 2 seas, so there might be multiple, different distances - unsigned GetMinHarborDistance(HarborId haborId1, HarborId harborId2) const; + unsigned getMinHarborDistance(HarborId haborId1, HarborId harborId2) const; /// Return distance between harbors at given sea - unsigned GetHarborDistance(HarborId haborId1, HarborId harborId2, SeaId sea) const; + unsigned getHarborDistance(HarborId haborId1, HarborId harborId2, SeaId sea) const; /// Return the sea id if this is a point at a coast to a sea where ships can go. Else returns 0 - SeaId GetSeaFromCoastalPoint(MapPoint pt) const; + SeaId getSeaFromCoastalPoint(MapPoint pt) const; RoadDir toRoadDir(MapPoint& pt, const Direction dir) const { @@ -219,17 +219,17 @@ class World : public MapBase && enum_cast(Direction::NorthWest) == enum_cast(RoadDir::SouthEast) && enum_cast(Direction::NorthEast) == enum_cast(RoadDir::SouthWest), "Mismatch"); - pt = GetNeighbour(pt, dir); + pt = getNeighbour(pt, dir); } return RoadDir(iDir); } /// Return the road type of this point in the given direction - PointRoad GetRoad(MapPoint pt, RoadDir dir) const; + PointRoad getRoad(MapPoint pt, RoadDir dir) const; /// Return the road type from this point in the given direction - PointRoad GetPointRoad(MapPoint pt, Direction dir) const; + PointRoad getPointRoad(MapPoint pt, Direction dir) const; /// Return the FOW road type for a player - PointRoad GetPointFOWRoad(MapPoint pt, Direction dir, unsigned char viewing_player) const; + PointRoad getPointFOWRoad(MapPoint pt, Direction dir, unsigned char viewing_player) const; /// Adds a catapult stone currently flying void AddCatapultStone(CatapultStone* cs); @@ -237,18 +237,18 @@ class World : public MapBase protected: /// Internal method for access to nodes with write access - MapNode& GetNodeInt(MapPoint pt); - MapNode& GetNeighbourNodeInt(MapPoint pt, Direction dir); + MapNode& getNodeInt(MapPoint pt); + MapNode& getNeighbourNodeInt(MapPoint pt, Direction dir); /// Notify derived classes of changed altitude virtual void AltitudeChanged(MapPoint pt) = 0; /// Notify derived classes of changed visibility virtual void VisibilityChanged(MapPoint pt, unsigned player, Visibility oldVis, Visibility newVis) = 0; /// Sets the road for the given (road) direction - void SetRoad(MapPoint pt, RoadDir roadDir, PointRoad type); - BoundaryStones& GetBoundaryStones(const MapPoint pt) { return GetNodeInt(pt).boundary_stones; } + void setRoad(MapPoint pt, RoadDir roadDir, PointRoad type); + BoundaryStones& getBoundaryStones(const MapPoint pt) { return getNodeInt(pt).boundary_stones; } /// Set the BQ at the point and return true if it was changed - bool SetBQ(MapPoint pt, BuildingQuality bq); + bool setBQ(MapPoint pt, BuildingQuality bq); /// Recalculates the shade of a point void RecalcShadow(MapPoint pt); @@ -258,44 +258,44 @@ class World : public MapBase // Implementation ////////////////////////////////////////////////////////////////////////// -inline const MapNode& World::GetNode(const MapPoint pt) const +inline const MapNode& World::getNode(const MapPoint pt) const { - return nodes[GetIdx(pt)]; + return nodes[getIdx(pt)]; } -inline MapNode& World::GetNodeInt(const MapPoint pt) +inline MapNode& World::getNodeInt(const MapPoint pt) { - return nodes[GetIdx(pt)]; + return nodes[getIdx(pt)]; } -inline const MapNode& World::GetNeighbourNode(const MapPoint pt, Direction dir) const +inline const MapNode& World::getNeighbourNode(const MapPoint pt, Direction dir) const { - return GetNode(GetNeighbour(pt, dir)); + return getNode(getNeighbour(pt, dir)); } -inline MapNode& World::GetNeighbourNodeInt(const MapPoint pt, Direction dir) +inline MapNode& World::getNeighbourNodeInt(const MapPoint pt, Direction dir) { - return GetNodeInt(GetNeighbour(pt, dir)); + return getNodeInt(getNeighbour(pt, dir)); } template -inline bool World::IsOfTerrain(const MapPoint pt, T_Predicate predicate) const +inline bool World::isOfTerrain(const MapPoint pt, T_Predicate predicate) const { // NOTE: This is '!HasTerrain(pt, !predicate)' - for(const DescIdx tIdx : GetTerrainsAround(pt)) + for(const DescIdx tIdx : getTerrainsAround(pt)) { - if(!predicate(GetDescription().get(tIdx))) + if(!predicate(getDescription().get(tIdx))) return false; } return true; } template -inline bool World::HasTerrain(const MapPoint pt, T_Predicate predicate) const +inline bool World::hasTerrain(const MapPoint pt, T_Predicate predicate) const { - for(const DescIdx tIdx : GetTerrainsAround(pt)) + for(const DescIdx tIdx : getTerrainsAround(pt)) { - if(predicate(GetDescription().get(tIdx))) + if(predicate(getDescription().get(tIdx))) return true; } return false; diff --git a/tests/legacyFiles/src/legacy/TerrainData.cpp b/tests/legacyFiles/src/legacy/TerrainData.cpp index e0dfe066d1..ba6cb02444 100644 --- a/tests/legacyFiles/src/legacy/TerrainData.cpp +++ b/tests/legacyFiles/src/legacy/TerrainData.cpp @@ -8,7 +8,7 @@ #include #include -unsigned char TerrainData::GetTextureIdentifier(TerrainType t) +unsigned char TerrainData::getTextureIdentifier(TerrainType t) { switch(t) { @@ -73,7 +73,7 @@ TerrainType TerrainData::MapIdx2Terrain(unsigned char mapIdx) } } -Rect TerrainData::GetPosInTexture(TerrainType t) +Rect TerrainData::getPosInTexture(TerrainType t) { switch(t) { @@ -103,12 +103,12 @@ Rect TerrainData::GetPosInTexture(TerrainType t) throw std::logic_error("Invalid parameters given"); } -bool TerrainData::IsAnimated(TerrainType t) +bool TerrainData::isAnimated(TerrainType t) { - return IsWater(t) || IsLava(t); + return IsWater(t) || isLava(t); } -unsigned TerrainData::GetNumFrames(TerrainType t) +unsigned TerrainData::getNumFrames(TerrainType t) { switch(t) { @@ -123,7 +123,7 @@ unsigned TerrainData::GetNumFrames(TerrainType t) } } -unsigned char TerrainData::GetStartColor(TerrainType t) +unsigned char TerrainData::getStartColor(TerrainType t) { switch(t) { @@ -138,7 +138,7 @@ unsigned char TerrainData::GetStartColor(TerrainType t) } } -unsigned TerrainData::GetColor(Landscape landsCape, TerrainType t) +unsigned TerrainData::getColor(Landscape landsCape, TerrainType t) { switch(landsCape) { @@ -226,7 +226,7 @@ unsigned TerrainData::GetColor(Landscape landsCape, TerrainType t) throw std::logic_error("Invalid parameters given"); } -EdgeType TerrainData::GetEdgeType(Landscape landsCape, TerrainType t) +EdgeType TerrainData::getEdgeType(Landscape landsCape, TerrainType t) { switch(landsCape) { @@ -389,7 +389,7 @@ const helpers::MultiArray TERRAIN_DRAW_PRIORI /*TT_LAVA3*/ {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, 0}, /*TT_LAVA4*/ {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, 0, 0}}}}; -unsigned char TerrainData::GetEdgeType(Landscape landsCape, TerrainType t1, TerrainType t2) +unsigned char TerrainData::getEdgeType(Landscape landsCape, TerrainType t1, TerrainType t2) { static std::array, NUM_TTS>, NUM_LTS> EDGE_TABLE; static bool isInitialized = false; @@ -400,8 +400,8 @@ unsigned char TerrainData::GetEdgeType(Landscape landsCape, TerrainType t1, Terr for(int iT1 = 0; iT1 < NUM_TTS; ++iT1) for(int iT2 = 0; iT2 <= iT1; ++iT2) { - EdgeType et1 = GetEdgeType(Landscape(lt), TerrainType(iT1)); - EdgeType et2 = GetEdgeType(Landscape(lt), TerrainType(iT2)); + EdgeType et1 = getEdgeType(Landscape(lt), TerrainType(iT1)); + EdgeType et2 = getEdgeType(Landscape(lt), TerrainType(iT2)); if(iT1 == iT2 || // Same terrain !TERRAIN_DRAW_PRIORITY[lt][iT1][iT2]) // Same priority { @@ -434,10 +434,10 @@ static void CheckPriorities(Landscape lt, const std::array& terrai { for(int iT2 = 0; iT2 < NUM_TTS; ++iT2) { - unsigned oldEdge = TerrainData::GetEdgeType(lt, TerrainType(iT1), TerrainType(iT2)); + unsigned oldEdge = TerrainData::getEdgeType(lt, TerrainType(iT1), TerrainType(iT2)); unsigned newEdge; if(terrainPrios[iT1] > terrainPrios[iT2]) - newEdge = TerrainData::GetEdgeType(lt, TerrainType(iT1)); + newEdge = TerrainData::getEdgeType(lt, TerrainType(iT1)); else newEdge = 0; if(oldEdge != newEdge) @@ -450,7 +450,7 @@ static void CheckPriorities(Landscape lt, const std::array& terrai std::cout << numWrong << " different entries" << std::endl; } -const std::array& TerrainData::GetEdgePrios(Landscape landsCape) +const std::array& TerrainData::getEdgePrios(Landscape landsCape) { static const std::array prioGL{}; static const std::array prioWL{}; @@ -469,17 +469,17 @@ void TerrainData::PrintEdgePrios() for(int lt = 0; lt < NUM_LTS; ++lt) { std::cout << "Calculation landscape " << lt << std::endl; - CheckPriorities(Landscape(lt), GetEdgePrios(Landscape(lt))); + CheckPriorities(Landscape(lt), getEdgePrios(Landscape(lt))); } } -bool TerrainData::IsUseable(TerrainType t) +bool TerrainData::isUseable(TerrainType t) { - TerrainBQ bq = GetBuildingQuality(t); + TerrainBQ bq = getBuildingQuality(t); return (bq != TerrainBQ::Nothing && bq != TerrainBQ::Danger); } -bool TerrainData::IsUsableByShip(TerrainType t) +bool TerrainData::isUsableByShip(TerrainType t) { switch(t) { @@ -488,7 +488,7 @@ bool TerrainData::IsUsableByShip(TerrainType t) } } -bool TerrainData::IsUsableByAnimals(TerrainType t) +bool TerrainData::isUsableByAnimals(TerrainType t) { switch(t) { @@ -504,7 +504,7 @@ bool TerrainData::IsUsableByAnimals(TerrainType t) } } -bool TerrainData::IsVital(TerrainType t) +bool TerrainData::isVital(TerrainType t) { switch(t) { @@ -529,7 +529,7 @@ bool TerrainData::IsWater(TerrainType t) } } -bool TerrainData::IsLava(TerrainType t) +bool TerrainData::isLava(TerrainType t) { switch(t) { @@ -541,7 +541,7 @@ bool TerrainData::IsLava(TerrainType t) } } -bool TerrainData::IsSnow(Landscape lt, TerrainType t) +bool TerrainData::isSnow(Landscape lt, TerrainType t) { switch(lt) { @@ -552,7 +552,7 @@ bool TerrainData::IsSnow(Landscape lt, TerrainType t) throw std::logic_error("Invalid terrain type"); } -bool TerrainData::IsMountain(TerrainType t) +bool TerrainData::isMountain(TerrainType t) { switch(t) { @@ -566,12 +566,12 @@ bool TerrainData::IsMountain(TerrainType t) } } -bool TerrainData::IsMineable(TerrainType t) +bool TerrainData::isMineable(TerrainType t) { - return GetBuildingQuality(t) == TerrainBQ::Mine; + return getBuildingQuality(t) == TerrainBQ::Mine; } -TerrainBQ TerrainData::GetBuildingQuality(TerrainType t) +TerrainBQ TerrainData::getBuildingQuality(TerrainType t) { switch(t) { diff --git a/tests/legacyFiles/src/legacy/TerrainData.h b/tests/legacyFiles/src/legacy/TerrainData.h index 3090eed86e..c91076c414 100644 --- a/tests/legacyFiles/src/legacy/TerrainData.h +++ b/tests/legacyFiles/src/legacy/TerrainData.h @@ -20,44 +20,44 @@ class TerrainData /// Returns the terrain type for a given map terrain index static TerrainType MapIdx2Terrain(unsigned char mapIdx); /// Returns the position in the texture image - static Rect GetPosInTexture(TerrainType t); + static Rect getPosInTexture(TerrainType t); /// Returns whether the terrains texture is animated - static bool IsAnimated(TerrainType t); + static bool isAnimated(TerrainType t); /// Gets the number of frames in the animation - static unsigned GetNumFrames(TerrainType t); + static unsigned getNumFrames(TerrainType t); /// Gets the texture identifier for the terrain in the SWD file format - static unsigned char GetTextureIdentifier(TerrainType t); + static unsigned char getTextureIdentifier(TerrainType t); /// Gets the start color for the animation (extraction) - static unsigned char GetStartColor(TerrainType t); + static unsigned char getStartColor(TerrainType t); /// Returns the color for the terrain - static unsigned GetColor(Landscape landsCape, TerrainType t); + static unsigned getColor(Landscape landsCape, TerrainType t); /// Gets the edge type for a terrain type - static EdgeType GetEdgeType(Landscape landsCape, TerrainType t); + static EdgeType getEdgeType(Landscape landsCape, TerrainType t); /// Gets the edge type that t1 draws over t2 /// 0: None, 1: Snow, 2: Mountain, 3: Desert, 4: Meadow, 5: Water - static unsigned char GetEdgeType(Landscape landsCape, TerrainType t1, TerrainType t2); + static unsigned char getEdgeType(Landscape landsCape, TerrainType t1, TerrainType t2); static void PrintEdgePrios(); - static const std::array& GetEdgePrios(Landscape landsCape); + static const std::array& getEdgePrios(Landscape landsCape); /// Returns whether the given map terrain index is a harbour spot - static bool IsHarborSpot(unsigned char mapIdx) { return (mapIdx & 0x40) != 0; } + static bool isHarborSpot(unsigned char mapIdx) { return (mapIdx & 0x40) != 0; } /// Returns whether the given terrain type can be used (is not deadly) - static bool IsUseable(TerrainType t); + static bool isUseable(TerrainType t); /// Returns whether the given terrain type can be used by a ship (non-blocking water) - static bool IsUsableByShip(TerrainType t); + static bool isUsableByShip(TerrainType t); /// Returns whether "regular" animals walk on that terrain (no water or snow animals) - static bool IsUsableByAnimals(TerrainType t); + static bool isUsableByAnimals(TerrainType t); /// Returns whether corn fields can grow on the terrain (no dessert, mountain etc) - static bool IsVital(TerrainType t); + static bool isVital(TerrainType t); /// Returns whether the given terrain is any kind of water static bool IsWater(TerrainType t); /// Returns whether the given terrain is any kind of lava - static bool IsLava(TerrainType t); + static bool isLava(TerrainType t); /// Returns whether the given terrain is any kind of snow - static bool IsSnow(Landscape lt, TerrainType t); + static bool isSnow(Landscape lt, TerrainType t); /// Returns whether the given terrain is a mountain - static bool IsMountain(TerrainType t); + static bool isMountain(TerrainType t); /// Returns whether the given terrain is a mineable mountain - static bool IsMineable(TerrainType t); + static bool isMineable(TerrainType t); /// Returns what kind of buildings can be build on that terrain - static TerrainBQ GetBuildingQuality(TerrainType t); + static TerrainBQ getBuildingQuality(TerrainType t); }; diff --git a/tests/libGameData/testCampaignLuaFile.cpp b/tests/libGameData/testCampaignLuaFile.cpp index 98794ca49b..400e6d7f53 100644 --- a/tests/libGameData/testCampaignLuaFile.cpp +++ b/tests/libGameData/testCampaignLuaFile.cpp @@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE(ScriptVersion) { bnw::ofstream file(campaignFile, std::ios::app); file << helpers::format("function getRequiredLuaVersion()\n return %1%\n end\n", - CampaignDataLoader::GetVersion()); + CampaignDataLoader::getVersion()); } CampaignDescription desc; @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(ScriptVersion) bnw::ofstream file(tmp / "campaign.lua", std::ios::app); BOOST_TEST_PASSPOINT(); file << helpers::format("function getRequiredLuaVersion()\n return %1%\n end\n", - CampaignDataLoader::GetVersion() + 1); + CampaignDataLoader::getVersion() + 1); BOOST_TEST_PASSPOINT(); } @@ -102,8 +102,8 @@ BOOST_AUTO_TEST_CASE(ScriptVersion) rttr::test::LogAccessor logAcc; BOOST_TEST_REQUIRE(!loader.Load()); RTTR_REQUIRE_LOG_CONTAINS(helpers::format("Wrong lua script version: %1%. Current version: %2%.\n", - CampaignDataLoader::GetVersion() + 1, - CampaignDataLoader::GetVersion()), + CampaignDataLoader::getVersion() + 1, + CampaignDataLoader::getVersion()), false); } } diff --git a/tests/libGameData/testGameData.cpp b/tests/libGameData/testGameData.cpp index dffa9d76c2..76e2e31842 100644 --- a/tests/libGameData/testGameData.cpp +++ b/tests/libGameData/testGameData.cpp @@ -93,23 +93,23 @@ BOOST_AUTO_TEST_CASE(LoadGameData) { const auto t = TerrainType(i); const TerrainDesc& desc = worldDesc.terrain.get(worldDesc.terrain.getIndex(tNames[i])); - BOOST_TEST(desc.s2Id == TerrainData::GetTextureIdentifier(t)); + BOOST_TEST(desc.s2Id == TerrainData::getTextureIdentifier(t)); const EdgeType newEdge = !desc.edgeType ? ET_NONE : EdgeType((helpers::indexOf(eNames, worldDesc.get(desc.edgeType).name) + 1)); - BOOST_TEST(newEdge == TerrainData::GetEdgeType(lt, t)); - BOOST_TEST(desc.GetBQ() == TerrainData::GetBuildingQuality(t)); + BOOST_TEST(newEdge == TerrainData::getEdgeType(lt, t)); + BOOST_TEST(desc.GetBQ() == TerrainData::getBuildingQuality(t)); BOOST_TEST(!desc.Is(ETerrain::Walkable) - == (TerrainData::GetBuildingQuality(t) == TerrainBQ::Nothing - || TerrainData::GetBuildingQuality(t) == TerrainBQ::Danger)); - BOOST_TEST(desc.Is(ETerrain::Mineable) == (TerrainData::GetBuildingQuality(t) == TerrainBQ::Mine)); - BOOST_TEST(desc.Is(ETerrain::Buildable) == (TerrainData::GetBuildingQuality(t) == TerrainBQ::Castle)); - BOOST_TEST(desc.Is(ETerrain::Shippable) == TerrainData::IsUsableByShip(t)); - BOOST_TEST((desc.kind == TerrainKind::Snow) == TerrainData::IsSnow(lt, t)); + == (TerrainData::getBuildingQuality(t) == TerrainBQ::Nothing + || TerrainData::getBuildingQuality(t) == TerrainBQ::Danger)); + BOOST_TEST(desc.Is(ETerrain::Mineable) == (TerrainData::getBuildingQuality(t) == TerrainBQ::Mine)); + BOOST_TEST(desc.Is(ETerrain::Buildable) == (TerrainData::getBuildingQuality(t) == TerrainBQ::Castle)); + BOOST_TEST(desc.Is(ETerrain::Shippable) == TerrainData::isUsableByShip(t)); + BOOST_TEST((desc.kind == TerrainKind::Snow) == TerrainData::isSnow(lt, t)); - BOOST_TEST((desc.IsUsableByAnimals() || desc.kind == TerrainKind::Snow) - == (TerrainData::IsUsableByAnimals(t) || TerrainData::IsSnow(lt, t))); - BOOST_TEST(desc.IsVital() == TerrainData::IsVital(t)); - BOOST_TEST(desc.minimapColor == TerrainData::GetColor(lt, t)); + BOOST_TEST((desc.isUsableByAnimals() || desc.kind == TerrainKind::Snow) + == (TerrainData::isUsableByAnimals(t) || TerrainData::isSnow(lt, t))); + BOOST_TEST(desc.isVital() == TerrainData::isVital(t)); + BOOST_TEST(desc.minimapColor == TerrainData::getColor(lt, t)); } } // TerrainData::PrintEdgePrios(); @@ -265,31 +265,31 @@ BOOST_AUTO_TEST_CASE(TextureCoords) BOOST_TEST_REQUIRE(loader.Load()); // Border points are inset by half a pixel for OpenGL (sample middle of pixel!) // Overlapped uses the full rectangle - const TerrainDesc::Triangle rsuO = desc.terrain.tryGet("terrain1")->GetRSUTriangle(); + const TerrainDesc::Triangle rsuO = desc.terrain.tryGet("terrain1")->getRSUTriangle(); BOOST_TEST(rsuO.tip == PointF(10 + 32 / 2.f, 20 + 0.5f)); BOOST_TEST(rsuO.left == PointF(10 + 0.5f, 20 + 31 - 0.5f)); BOOST_TEST(rsuO.right == PointF(10 + 32 - 0.5f, 20 + 31 - 0.5f)); - const TerrainDesc::Triangle usdO = desc.terrain.tryGet("terrain1")->GetUSDTriangle(); + const TerrainDesc::Triangle usdO = desc.terrain.tryGet("terrain1")->getUSDTriangle(); BOOST_TEST(usdO.tip == PointF(10 + 32 / 2.f, 20 + 31 - 0.5f)); BOOST_TEST(usdO.left == PointF(10 + 0.5f, 20 + 0.5f)); BOOST_TEST(usdO.right == PointF(10 + 32 - 0.5f, 20 + 0.5f)); // Stacked has RSU over USD - const TerrainDesc::Triangle rsuS = desc.terrain.tryGet("terrain2")->GetRSUTriangle(); + const TerrainDesc::Triangle rsuS = desc.terrain.tryGet("terrain2")->getRSUTriangle(); BOOST_TEST(rsuS.tip == rsuO.tip); BOOST_TEST(rsuS.left == PointF(10 + 0.5f, 20 + 31 / 2.f)); BOOST_TEST(rsuS.right == PointF(10 + 32 - 0.5f, 20 + 31 / 2.f)); - const TerrainDesc::Triangle usdS = desc.terrain.tryGet("terrain2")->GetUSDTriangle(); + const TerrainDesc::Triangle usdS = desc.terrain.tryGet("terrain2")->getUSDTriangle(); BOOST_TEST(usdS.tip == usdO.tip); BOOST_TEST(usdS.left == PointF(10 + 0.5f, 20 + 31 / 2.f)); BOOST_TEST(usdS.right == PointF(10 + 32 - 0.5f, 20 + 31 / 2.f)); // Rotated is stacked sideways (note that order stays the same) - const TerrainDesc::Triangle rsuR = desc.terrain.tryGet("terrain3")->GetRSUTriangle(); + const TerrainDesc::Triangle rsuR = desc.terrain.tryGet("terrain3")->getRSUTriangle(); BOOST_TEST(rsuR.tip == rsuS.left); BOOST_TEST(rsuR.left == rsuS.right); BOOST_TEST(rsuR.right == rsuS.tip); - const TerrainDesc::Triangle usdR = desc.terrain.tryGet("terrain3")->GetUSDTriangle(); + const TerrainDesc::Triangle usdR = desc.terrain.tryGet("terrain3")->getUSDTriangle(); BOOST_TEST(usdR.tip == usdS.right); BOOST_TEST(usdR.left == usdS.tip); BOOST_TEST(usdR.right == usdS.left); diff --git a/tests/mockupDrivers/MockupAudioDriver.h b/tests/mockupDrivers/MockupAudioDriver.h index 4a04ac6e50..54a2b20a4b 100644 --- a/tests/mockupDrivers/MockupAudioDriver.h +++ b/tests/mockupDrivers/MockupAudioDriver.h @@ -25,10 +25,10 @@ MOCK_BASE_CLASS(MockupAudioDriver, driver::AudioDriver) { MockupAudioDriver(IAudioDriverCallback * callback) : AudioDriver(callback) {} ~MockupAudioDriver() override { CleanUp(); } - const char* GetName() const override { return "MockupAudio"; } + const char* getName() const override { return "MockupAudio"; } bool Initialize() override { - SetNumChannels(DEFAULT_NUM_CHANNELS); + setNumChannels(DEFAULT_NUM_CHANNELS); initialized = true; return true; } @@ -42,15 +42,15 @@ MOCK_BASE_CLASS(MockupAudioDriver, driver::AudioDriver) MOCK_NON_CONST_METHOD(PlayMusic, 2); MOCK_NON_CONST_METHOD(StopMusic, 0); MOCK_NON_CONST_METHOD(doStopEffect, 1, void(int)); - MOCK_NON_CONST_METHOD(IsEffectPlaying, 1); + MOCK_NON_CONST_METHOD(isEffectPlaying, 1); MOCK_NON_CONST_METHOD(ChangeVolume, 2); - MOCK_NON_CONST_METHOD(SetMasterEffectVolume, 1); - MOCK_NON_CONST_METHOD(SetMusicVolume, 1); + MOCK_NON_CONST_METHOD(setMasterEffectVolume, 1); + MOCK_NON_CONST_METHOD(setMusicVolume, 1); MOCK_NON_CONST_METHOD(doUnloadSound, 1, void(driver::RawSoundHandle sound)); driver::RawSoundHandle doLoad(driver::SoundType type) { return createRawSoundHandle(new MockupSoundData(type), type); } - using driver::AudioDriver::GetEffectChannel; + using driver::AudioDriver::getEffectChannel; }; diff --git a/tests/mockupDrivers/MockupVideoDriver.cpp b/tests/mockupDrivers/MockupVideoDriver.cpp index 51eb4e37ec..b32ebb6873 100644 --- a/tests/mockupDrivers/MockupVideoDriver.cpp +++ b/tests/mockupDrivers/MockupVideoDriver.cpp @@ -18,7 +18,7 @@ MockupVideoDriver::MockupVideoDriver(VideoDriverLoaderInterface* CallBack) MockupVideoDriver::~MockupVideoDriver() = default; -const char* MockupVideoDriver::GetName() const +const char* MockupVideoDriver::getName() const { return "Mockup Video Driver"; } @@ -39,7 +39,7 @@ bool MockupVideoDriver::CreateScreen(const std::string&, const VideoMode newSize bool MockupVideoDriver::ResizeScreen(const VideoMode newSize, DisplayMode displayMode) { - SetNewSize(newSize, Extent(newSize.width, newSize.height)); + setNewSize(newSize, Extent(newSize.width, newSize.height)); displayMode_ = displayMode; return true; } @@ -49,7 +49,7 @@ bool MockupVideoDriver::MessageLoop() return true; } -unsigned long MockupVideoDriver::GetTickCount() const +unsigned long MockupVideoDriver::getTickCount() const { return tickCount_; } @@ -59,7 +59,7 @@ static void* dummyLoader(const char*) return nullptr; } -OpenGL_Loader_Proc MockupVideoDriver::GetLoaderFunction() const +OpenGL_Loader_Proc MockupVideoDriver::getLoaderFunction() const { return dummyLoader; } @@ -69,17 +69,17 @@ std::vector MockupVideoDriver::ListVideoModes() const return video_modes_; } -void MockupVideoDriver::SetMousePos(Position pos) +void MockupVideoDriver::setMousePos(Position pos) { mouse_xy.pos = pos; } -KeyEvent MockupVideoDriver::GetModKeyState() const +KeyEvent MockupVideoDriver::getModKeyState() const { return modKeyState_; } -void* MockupVideoDriver::GetMapPointer() const +void* MockupVideoDriver::getMapPointer() const { return nullptr; } @@ -89,7 +89,7 @@ void MockupVideoDriver::ShowErrorMessage(const std::string& title, const std::st std::cerr << title << ": " << message << std::endl; } -bool MockupVideoDriver::IsTouchEvent() const +bool MockupVideoDriver::isTouchEvent() const { return numTfinger_; } diff --git a/tests/mockupDrivers/MockupVideoDriver.h b/tests/mockupDrivers/MockupVideoDriver.h index 1b2e5b7dd5..0efcaa71c6 100644 --- a/tests/mockupDrivers/MockupVideoDriver.h +++ b/tests/mockupDrivers/MockupVideoDriver.h @@ -11,24 +11,24 @@ class MockupVideoDriver : public VideoDriver public: MockupVideoDriver(VideoDriverLoaderInterface* CallBack); ~MockupVideoDriver() override; - const char* GetName() const override; + const char* getName() const override; bool Initialize() override; bool CreateScreen(const std::string& title, VideoMode newSize, DisplayMode displayMode) override; bool ResizeScreen(VideoMode newSize, DisplayMode displayMode) override; void DestroyScreen() override {} bool SwapBuffers() override { return true; } bool MessageLoop() override; - unsigned long GetTickCount() const override; - OpenGL_Loader_Proc GetLoaderFunction() const override; + unsigned long getTickCount() const override; + OpenGL_Loader_Proc getLoaderFunction() const override; std::vector ListVideoModes() const override; - void SetMousePos(Position pos) override; - KeyEvent GetModKeyState() const override; - void* GetMapPointer() const override; - bool IsOpenGL() const override { return false; } + void setMousePos(Position pos) override; + KeyEvent getModKeyState() const override; + void* getMapPointer() const override; + bool isOpenGL() const override { return false; } void ShowErrorMessage(const std::string& title, const std::string& message) override; using VideoDriver::FindClosestVideoMode; - using VideoDriver::SetNewSize; - bool IsTouchEvent() const override; + using VideoDriver::setNewSize; + bool isTouchEvent() const override; KeyEvent modKeyState_; unsigned long tickCount_; diff --git a/tests/rttrConfig/testRttrConfig.cpp b/tests/rttrConfig/testRttrConfig.cpp index e645402fb0..be05d22c42 100644 --- a/tests/rttrConfig/testRttrConfig.cpp +++ b/tests/rttrConfig/testRttrConfig.cpp @@ -32,7 +32,7 @@ class ResetWorkDir BOOST_FIXTURE_TEST_CASE(PrefixPath, rttr::test::BaseFixture) { rttr::test::LogAccessor logAcc; - fs::path prefixPath = RTTRCONFIG.GetPrefixPath(); + fs::path prefixPath = RTTRCONFIG.getPrefixPath(); BOOST_TEST_REQUIRE(!prefixPath.empty()); BOOST_TEST(fs::exists(prefixPath)); BOOST_TEST(fs::is_directory(prefixPath)); @@ -46,7 +46,7 @@ BOOST_FIXTURE_TEST_CASE(PrefixPath, rttr::test::BaseFixture) { fs::path fakePrefixPath = fs::current_path() / "testPrefixPath"; BOOST_TEST_REQUIRE(System::setEnvVar("RTTR_PREFIX_DIR", fakePrefixPath.string())); - BOOST_TEST(RTTRCONFIG.GetPrefixPath() == fakePrefixPath); + BOOST_TEST(RTTRCONFIG.getPrefixPath() == fakePrefixPath); RTTR_REQUIRE_LOG_CONTAINS("manually set", false); BOOST_TEST_REQUIRE(System::removeEnvVar("RTTR_PREFIX_DIR")); } @@ -72,7 +72,7 @@ BOOST_FIXTURE_TEST_CASE(EnvOverride, rttr::test::BaseFixture) BOOST_AUTO_TEST_CASE(YearIsValid) { - const std::string year = rttr::version::GetYear(); + const std::string year = rttr::version::getYear(); BOOST_TEST(year.length() == 4u); int iYear; BOOST_TEST_REQUIRE(boost::conversion::try_lexical_convert(year, iYear)); @@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE(YearIsValid) BOOST_AUTO_TEST_CASE(BuildDateIsValid) { - const std::string date = rttr::version::GetBuildDate(); + const std::string date = rttr::version::getBuildDate(); BOOST_TEST(date.length() == 8u); int iDate; BOOST_TEST_REQUIRE(boost::conversion::try_lexical_convert(date, iDate)); diff --git a/tests/s25Main/UI/testAnimations.cpp b/tests/s25Main/UI/testAnimations.cpp index 651707a912..d72abd56cc 100644 --- a/tests/s25Main/UI/testAnimations.cpp +++ b/tests/s25Main/UI/testAnimations.cpp @@ -55,7 +55,7 @@ struct WindowFixture double lastNextFramepartTime; unsigned lastFrame; WindowFixture() - : wnd(DrawPoint(0, 0), 0, nullptr, Extent(800, 600)), animMgr(wnd.GetAnimationManager()), animFinished(false) + : wnd(DrawPoint(0, 0), 0, nullptr, Extent(800, 600)), animMgr(wnd.getAnimationManager()), animFinished(false) { bt = wnd.AddTextButton(0, DrawPoint(10, 20), Extent(100, 20), TextureColor::Red1, "Test", NormalFont); bt2 = wnd.AddTextButton(1, DrawPoint(10, 40), Extent(100, 20), TextureColor::Red1, "Test", NormalFont); @@ -157,7 +157,7 @@ BOOST_AUTO_TEST_CASE(AddRemoveAnimations) BOOST_TEST_REQUIRE(animMgr.getAnimation(animIds[i]) == anims[i]); BOOST_TEST_REQUIRE(animMgr.getAnimationId(anims[i]) == animIds[i]); } - std::vector elAnims = animMgr.getElementAnimations(bt->GetID()); + std::vector elAnims = animMgr.getElementAnimations(bt->getID()); BOOST_TEST_REQUIRE(elAnims.size() == 3u); for(unsigned i = 0; i < anims.size(); i++) BOOST_TEST_REQUIRE(helpers::contains(anims, elAnims[i])); @@ -171,10 +171,10 @@ BOOST_AUTO_TEST_CASE(AddRemoveAnimations) // and not removed for removeElementAnimations animMgr.addAnimation(new TestAnimation(*this, bt2, 10, 10, Animation::RepeatType::Repeat)); BOOST_TEST_REQUIRE(animMgr.getNumActiveAnimations() == 3u); - BOOST_TEST_REQUIRE(animMgr.getElementAnimations(bt->GetID()).size() == 2u); - animMgr.removeElementAnimations(bt->GetID()); + BOOST_TEST_REQUIRE(animMgr.getElementAnimations(bt->getID()).size() == 2u); + animMgr.removeElementAnimations(bt->getID()); BOOST_TEST_REQUIRE(animMgr.getNumActiveAnimations() == 1u); - BOOST_TEST_REQUIRE(animMgr.getElementAnimations(bt->GetID()).size() == 0u); + BOOST_TEST_REQUIRE(animMgr.getElementAnimations(bt->getID()).size() == 0u); } BOOST_AUTO_TEST_CASE(AnimationSetterGetter) @@ -288,7 +288,7 @@ BOOST_AUTO_TEST_CASE(FinishAnims) // Finish before it started -> 1 frame executed right away lastFrame = 9999; animMgr.addAnimation(new TestAnimation(*this, bt, 6, 10, rpt)); - animMgr.finishElementAnimations(bt->GetID(), false); + animMgr.finishElementAnimations(bt->getID(), false); BOOST_TEST_REQUIRE(animMgr.getNumActiveAnimations() == 0u); BOOST_TEST_REQUIRE(lastFrame == expectedLastFrame); @@ -296,7 +296,7 @@ BOOST_AUTO_TEST_CASE(FinishAnims) lastFrame = 9999; animMgr.addAnimation(new TestAnimation(*this, bt, 6, 10, rpt)); animMgr.update(time += 10); - animMgr.finishElementAnimations(bt->GetID(), false); + animMgr.finishElementAnimations(bt->getID(), false); // Non-oscillating have to go to end, oscillate already are if(!isOscillate) { @@ -309,7 +309,7 @@ BOOST_AUTO_TEST_CASE(FinishAnims) lastFrame = 9999; animMgr.addAnimation(new TestAnimation(*this, bt, 6, 10, rpt)); animMgr.update(time += 10); - animMgr.finishElementAnimations(bt->GetID(), true); + animMgr.finishElementAnimations(bt->getID(), true); BOOST_TEST_REQUIRE(animMgr.getNumActiveAnimations() == 0u); BOOST_TEST_REQUIRE(lastFrame == expectedLastFrame); @@ -318,7 +318,7 @@ BOOST_AUTO_TEST_CASE(FinishAnims) animMgr.addAnimation(new TestAnimation(*this, bt, 6, 10, rpt)); animMgr.update(time += 10); animMgr.update(time += 10); - animMgr.finishElementAnimations(bt->GetID(), false); + animMgr.finishElementAnimations(bt->getID(), false); BOOST_TEST_REQUIRE(animMgr.getNumActiveAnimations() == 1u); animMgr.update(time += 40); // Those have to go back @@ -335,7 +335,7 @@ BOOST_AUTO_TEST_CASE(FinishAnims) animMgr.addAnimation(new TestAnimation(*this, bt, 6, 10, rpt)); animMgr.update(time += 10); animMgr.update(time += 50); - animMgr.finishElementAnimations(bt->GetID(), false); + animMgr.finishElementAnimations(bt->getID(), false); // Those have to go back if(isOscillate) { @@ -353,7 +353,7 @@ BOOST_AUTO_TEST_CASE(FinishAnims) // Another frame for repeat mode if(rpt == Animation::RepeatType::Repeat) animMgr.update(time += 10); - animMgr.finishElementAnimations(bt->GetID(), false); + animMgr.finishElementAnimations(bt->getID(), false); BOOST_TEST_REQUIRE(animMgr.getNumActiveAnimations() == 0u); BOOST_TEST_REQUIRE(lastFrame == expectedLastFrame); } @@ -368,7 +368,7 @@ BOOST_AUTO_TEST_CASE(FinishAnims) // Unstarted lastFrame = 9999; animMgr.addAnimation(new TestAnimation(*this, bt, 6, 10, rpt)); - animMgr.finishElementAnimations(bt->GetID(), true); + animMgr.finishElementAnimations(bt->getID(), true); BOOST_TEST_REQUIRE(animMgr.getNumActiveAnimations() == 0u); BOOST_TEST_REQUIRE(lastFrame == expectedLastFrame); // Start and run some time -> always at last frame @@ -378,7 +378,7 @@ BOOST_AUTO_TEST_CASE(FinishAnims) animMgr.addAnimation(new TestAnimation(*this, bt, 6, 10, rpt)); animMgr.update(time += 1); animMgr.update(time += dt); - animMgr.finishElementAnimations(bt->GetID(), true); + animMgr.finishElementAnimations(bt->getID(), true); BOOST_TEST_REQUIRE(animMgr.getNumActiveAnimations() == 0u); BOOST_TEST_REQUIRE(lastFrame == expectedLastFrame); } @@ -628,7 +628,7 @@ BOOST_AUTO_TEST_CASE(LinearInterpolationFactor) BOOST_AUTO_TEST_CASE(MoveAni) { - bt->SetPos(DrawPoint(100, 200)); + bt->setPos(DrawPoint(100, 200)); DrawPoint targetPt(110, 300); animMgr.addAnimation(new MoveAnimation(bt, targetPt, 500, Animation::RepeatType::None)); // Init with any start time @@ -636,48 +636,48 @@ BOOST_AUTO_TEST_CASE(MoveAni) animMgr.update(time); // Move half way animMgr.update(time += 250); - BOOST_TEST_REQUIRE(bt->GetPos() == DrawPoint(105, 250)); + BOOST_TEST_REQUIRE(bt->getPos() == DrawPoint(105, 250)); // Move over target animMgr.update(time += 270); - BOOST_TEST_REQUIRE(bt->GetPos() == targetPt); + BOOST_TEST_REQUIRE(bt->getPos() == targetPt); BOOST_TEST_REQUIRE(animMgr.getNumActiveAnimations() == 0u); - bt->SetPos(DrawPoint(100, 200)); + bt->setPos(DrawPoint(100, 200)); unsigned animId = animMgr.addAnimation(new MoveAnimation(bt, targetPt, 500, Animation::RepeatType::Repeat)); unsigned frameRate = animMgr.getAnimation(animId)->getFrameRate(); animMgr.update(time += 1); // Move over target: Animation is 500ms long and restarts after 1 frame -> 500 + frame + 50(10%) animMgr.update(time += (550 + frameRate)); - BOOST_TEST_REQUIRE(bt->GetPos() == DrawPoint(101, 210)); + BOOST_TEST_REQUIRE(bt->getPos() == DrawPoint(101, 210)); BOOST_TEST_REQUIRE(animMgr.isAnimationActive(animId)); animMgr.getAnimation(animId)->setRepeat(Animation::RepeatType::Oscillate); // Move over target. Here we don't need the additional frame as we move directly to the 2nd last frame animMgr.update(time + 500); - BOOST_TEST_REQUIRE(bt->GetPos() == DrawPoint(109, 290)); + BOOST_TEST_REQUIRE(bt->getPos() == DrawPoint(109, 290)); BOOST_TEST_REQUIRE(animMgr.isAnimationActive(animId)); } BOOST_AUTO_TEST_CASE(MoveAniScale) { - MockupVideoDriver* video = uiHelper::GetVideoDriver(); + MockupVideoDriver* video = uiHelper::getVideoDriver(); auto* dsk = WINDOWMANAGER.Switch(std::make_unique(nullptr)); WINDOWMANAGER.Draw(); bt = dsk->AddTextButton(0, DrawPoint(10, 20), Extent(100, 150), TextureColor::Red1, "", NormalFont); ctrlButton* btReference = - dsk->AddTextButton(1, DrawPoint(130, bt->GetPos().y), bt->GetSize(), TextureColor::Red1, "", NormalFont); - dsk->GetAnimationManager().addAnimation( - new MoveAnimation(bt, btReference->GetPos(), 1000, Animation::RepeatType::None)); + dsk->AddTextButton(1, DrawPoint(130, bt->getPos().y), bt->getSize(), TextureColor::Red1, "", NormalFont); + dsk->getAnimationManager().addAnimation( + new MoveAnimation(bt, btReference->getPos(), 1000, Animation::RepeatType::None)); dsk->msgPaintBefore(); // Pass the animation video->tickCount_ += 1100; dsk->msgPaintBefore(); - BOOST_TEST_REQUIRE(bt->GetPos() == btReference->GetPos()); + BOOST_TEST_REQUIRE(bt->getPos() == btReference->getPos()); // Restart - bt->SetPos(DrawPoint(10, 20)); - dsk->GetAnimationManager().addAnimation( - new MoveAnimation(bt, btReference->GetPos(), 1000, Animation::RepeatType::None)); + bt->setPos(DrawPoint(10, 20)); + dsk->getAnimationManager().addAnimation( + new MoveAnimation(bt, btReference->getPos(), 1000, Animation::RepeatType::None)); video->tickCount_ += 1; dsk->msgPaintBefore(); // Resize the screen and test that the final position got updated too @@ -685,25 +685,25 @@ BOOST_AUTO_TEST_CASE(MoveAniScale) // Pass the animation video->tickCount_ += 1100; dsk->msgPaintBefore(); - BOOST_TEST_REQUIRE(bt->GetPos() == btReference->GetPos()); + BOOST_TEST_REQUIRE(bt->getPos() == btReference->getPos()); } BOOST_AUTO_TEST_CASE(ToogleAnim) { - animMgr.addAnimation(new ToggleAnimation(bt, &Window::SetVisible, true, 1000)); + animMgr.addAnimation(new ToggleAnimation(bt, &Window::setVisible, true, 1000)); animMgr.addAnimation(new BlinkButtonAnim(bt2, true, 1000)); // Init with any start time unsigned time = 100; animMgr.update(time); - BOOST_TEST_REQUIRE(bt->IsVisible()); - BOOST_TEST_REQUIRE(bt2->GetIlluminated()); + BOOST_TEST_REQUIRE(bt->isVisible()); + BOOST_TEST_REQUIRE(bt2->getIlluminated()); // Switch animMgr.update(time += 1000); - BOOST_TEST_REQUIRE(!bt->IsVisible()); - BOOST_TEST_REQUIRE(!bt2->GetIlluminated()); + BOOST_TEST_REQUIRE(!bt->isVisible()); + BOOST_TEST_REQUIRE(!bt2->getIlluminated()); animMgr.update(time + 1000); - BOOST_TEST_REQUIRE(bt->IsVisible()); - BOOST_TEST_REQUIRE(bt2->GetIlluminated()); + BOOST_TEST_REQUIRE(bt->isVisible()); + BOOST_TEST_REQUIRE(bt2->getIlluminated()); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/UI/testComboBox.cpp b/tests/s25Main/UI/testComboBox.cpp index d5b897b207..b3702e04d3 100644 --- a/tests/s25Main/UI/testComboBox.cpp +++ b/tests/s25Main/UI/testComboBox.cpp @@ -35,41 +35,41 @@ BOOST_AUTO_TEST_CASE(ItemHandling) TestWindow wnd; auto cb = std::make_unique(&wnd, randomValue(), DrawPoint(0, 0), Extent(40, 20), TextureColor::Green1, NormalFont, 20, false); - REQUIRE(cb->GetNumItems() == 0); - REQUIRE(!cb->GetSelection()); + REQUIRE(cb->getNumItems() == 0); + REQUIRE(!cb->getSelection()); cb->AddItem("text"); - REQUIRE(cb->GetNumItems() == 1); - REQUIRE(!cb->GetSelection()); - REQUIRE(cb->GetText(0) == "text"); + REQUIRE(cb->getNumItems() == 1); + REQUIRE(!cb->getSelection()); + REQUIRE(cb->getText(0) == "text"); - cb->SetSelection(0); - REQUIRE(cb->GetSelection() == 0u); - REQUIRE(cb->GetText(0) == "text"); + cb->setSelection(0); + REQUIRE(cb->getSelection() == 0u); + REQUIRE(cb->getText(0) == "text"); // Out of bounds selection - cb->SetSelection(1); - REQUIRE(cb->GetSelection() == 0u); - REQUIRE(cb->GetText(0) == "text"); + cb->setSelection(1); + REQUIRE(cb->getSelection() == 0u); + REQUIRE(cb->getText(0) == "text"); std::vector lines{1, "text"}; for(int i = 0; i < 10; i++) { lines.emplace_back(randString()); cb->AddItem(lines.back()); - REQUIRE(cb->GetNumItems() == lines.size()); - REQUIRE(cb->GetSelection() == 0u); + REQUIRE(cb->getNumItems() == lines.size()); + REQUIRE(cb->getSelection() == 0u); } for(unsigned i = 0; i < lines.size(); i++) { - REQUIRE(cb->GetText(i) == lines[i]); + REQUIRE(cb->getText(i) == lines[i]); auto sel = randomValue(0, lines.size() - 1); - cb->SetSelection(sel); - REQUIRE(cb->GetSelection() == sel); + cb->setSelection(sel); + REQUIRE(cb->getSelection() == sel); } cb->DeleteAllItems(); - REQUIRE(cb->GetNumItems() == 0); - REQUIRE(!cb->GetSelection()); + REQUIRE(cb->getNumItems() == 0); + REQUIRE(!cb->getSelection()); } BOOST_AUTO_TEST_CASE(ControlWithScrollWheel) @@ -83,30 +83,30 @@ BOOST_AUTO_TEST_CASE(ControlWithScrollWheel) { cb->AddItem(randString()); } - REQUIRE(!cb->GetSelection()); + REQUIRE(!cb->getSelection()); mock::sequence s; // Scroll down 3 times (each selected) - MouseCoords mc{cb->GetPos() - + Position(randomValue(0u, cb->GetSize().x - 1u), randomValue(0u, cb->GetSize().y - 1u))}; + MouseCoords mc{cb->getPos() + + Position(randomValue(0u, cb->getSize().x - 1u), randomValue(0u, cb->getSize().y - 1u))}; for(unsigned i = 0; i < 3u; i++) { - MOCK_EXPECT(wnd.msgComboSelectItem).once().with(cb->GetID(), static_cast(i)).in(s); + MOCK_EXPECT(wnd.msgComboSelectItem).once().with(cb->getID(), static_cast(i)).in(s); cb->msgWheelDown(mc); - REQUIRE(cb->GetSelection() == i); + REQUIRE(cb->getSelection() == i); } // 4th time does nothing cb->msgWheelDown(mc); - REQUIRE(cb->GetSelection() == 2u); + REQUIRE(cb->getSelection() == 2u); // Same but up for(int i = 1; i >= 0; i--) { - MOCK_EXPECT(wnd.msgComboSelectItem).once().with(cb->GetID(), static_cast(i)).in(s); + MOCK_EXPECT(wnd.msgComboSelectItem).once().with(cb->getID(), static_cast(i)).in(s); cb->msgWheelUp(mc); - REQUIRE(cb->GetSelection() == static_cast(i)); + REQUIRE(cb->getSelection() == static_cast(i)); } // next time does nothing cb->msgWheelUp(mc); - REQUIRE(cb->GetSelection() == 0u); + REQUIRE(cb->getSelection() == 0u); } BOOST_AUTO_TEST_CASE(ListRemove) @@ -119,64 +119,64 @@ BOOST_AUTO_TEST_CASE(ListRemove) { lines.emplace_back(randString()); list->AddItem(lines.back()); - REQUIRE(list->GetNumLines() == lines.size()); - REQUIRE(!list->GetSelection()); + REQUIRE(list->getNumLines() == lines.size()); + REQUIRE(!list->getSelection()); } mock::sequence s; - MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->GetID(), 4).in(s); - list->SetSelection(4); - REQUIRE(list->GetSelection() == 4u); - REQUIRE(list->GetSelItemText() == lines[4]); + MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->getID(), 4).in(s); + list->setSelection(4); + REQUIRE(list->getSelection() == 4u); + REQUIRE(list->getSelItemText() == lines[4]); // To big list->Remove(10); - REQUIRE(list->GetNumLines() == lines.size()); - REQUIRE(list->GetSelItemText() == lines[4]); + REQUIRE(list->getNumLines() == lines.size()); + REQUIRE(list->getSelItemText() == lines[4]); // Remove after selected. Selection remains list->Remove(5); - REQUIRE(list->GetNumLines() == lines.size() - 1); - REQUIRE(list->GetSelItemText() == lines[4]); + REQUIRE(list->getNumLines() == lines.size() - 1); + REQUIRE(list->getSelItemText() == lines[4]); lines.erase(lines.begin() + 5); // Remove all before. Selection remains for(int i = 1; i <= 4; i++) { list->Remove(randomValue(0, 4 - i)); - REQUIRE(list->GetNumLines() == lines.size() - i); - REQUIRE(list->GetSelItemText() == lines[4]); + REQUIRE(list->getNumLines() == lines.size() - i); + REQUIRE(list->getSelItemText() == lines[4]); } lines.erase(lines.begin(), lines.begin() + 4); for(unsigned i = 0; i < lines.size(); i++) - REQUIRE(list->GetItemText(i) == lines[i]); + REQUIRE(list->getItemText(i) == lines[i]); // Remove selection -> Next selected - REQUIRE(list->GetNumLines() == 5); - REQUIRE(list->GetSelection() == 0u); - MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->GetID(), 0).in(s); + REQUIRE(list->getNumLines() == 5); + REQUIRE(list->getSelection() == 0u); + MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->getID(), 0).in(s); list->Remove(0); - REQUIRE(list->GetNumLines() == 4); - REQUIRE(list->GetSelection() == 0u); - REQUIRE(list->GetSelItemText() == lines[1]); + REQUIRE(list->getNumLines() == 4); + REQUIRE(list->getSelection() == 0u); + REQUIRE(list->getSelItemText() == lines[1]); lines.erase(lines.begin()); // Also for middle pos - MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->GetID(), 2).in(s); - MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->GetID(), 2).in(s); - list->SetSelection(2); + MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->getID(), 2).in(s); + MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->getID(), 2).in(s); + list->setSelection(2); list->Remove(2); - REQUIRE(list->GetNumLines() == 3); - REQUIRE(list->GetSelection() == 2u); - REQUIRE(list->GetSelItemText() == lines[3]); + REQUIRE(list->getNumLines() == 3); + REQUIRE(list->getSelection() == 2u); + REQUIRE(list->getSelItemText() == lines[3]); lines.erase(lines.begin() + 2); // For last pos previous is selected - list->SetSelection(list->GetNumLines() - 1); - MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->GetID(), 1).in(s); - list->Remove(list->GetNumLines() - 1); - REQUIRE(list->GetNumLines() == 2); - REQUIRE(list->GetSelection() == 1u); - REQUIRE(list->GetSelItemText() == lines[lines.size() - 2]); + list->setSelection(list->getNumLines() - 1); + MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->getID(), 1).in(s); + list->Remove(list->getNumLines() - 1); + REQUIRE(list->getNumLines() == 2); + REQUIRE(list->getSelection() == 1u); + REQUIRE(list->getSelItemText() == lines[lines.size() - 2]); // Removing all sets selection to -1 list->Remove(0); list->Remove(0); - REQUIRE(list->GetNumLines() == 0); - REQUIRE(!list->GetSelection()); - REQUIRE(list->GetSelItemText() == ""); + REQUIRE(list->getNumLines() == 0); + REQUIRE(!list->getSelection()); + REQUIRE(list->getSelItemText() == ""); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/UI/testControls.cpp b/tests/s25Main/UI/testControls.cpp index d300e9d14c..e9a11d8899 100644 --- a/tests/s25Main/UI/testControls.cpp +++ b/tests/s25Main/UI/testControls.cpp @@ -62,18 +62,18 @@ BOOST_FIXTURE_TEST_CASE(MouseOver, uiHelper::Fixture) const auto size = rttr::test::randomPoint(10); const auto font = createMockFont({'H', 'e', 'l', 'o', '?'}); ctrlTextButton bt(nullptr, 1, pos, size, TextureColor::Bricks, "Hello", font.get(), ""); - BOOST_TEST(bt.IsMouseOver(pos)); - BOOST_TEST(!bt.IsMouseOver(pos - DrawPoint(1, 0))); - BOOST_TEST(!bt.IsMouseOver(pos - DrawPoint(0, 1))); - BOOST_TEST(bt.IsMouseOver(pos + size / 2u)); - BOOST_TEST(bt.IsMouseOver(pos + size - DrawPoint(1, 1))); - BOOST_TEST(!bt.IsMouseOver(pos + size)); - BOOST_TEST(!bt.IsMouseOver(pos + size + DrawPoint(0, 1))); + BOOST_TEST(bt.isMouseOver(pos)); + BOOST_TEST(!bt.isMouseOver(pos - DrawPoint(1, 0))); + BOOST_TEST(!bt.isMouseOver(pos - DrawPoint(0, 1))); + BOOST_TEST(bt.isMouseOver(pos + size / 2u)); + BOOST_TEST(bt.isMouseOver(pos + size - DrawPoint(1, 1))); + BOOST_TEST(!bt.isMouseOver(pos + size)); + BOOST_TEST(!bt.isMouseOver(pos + size + DrawPoint(0, 1))); // Without argument asks the video driver for the mouse position - uiHelper::GetVideoDriver()->SetMousePos(pos + size / 2u); - BOOST_TEST(bt.IsMouseOver()); - uiHelper::GetVideoDriver()->SetMousePos(pos + size * 2u); - BOOST_TEST(!bt.IsMouseOver()); + uiHelper::getVideoDriver()->setMousePos(pos + size / 2u); + BOOST_TEST(bt.isMouseOver()); + uiHelper::getVideoDriver()->setMousePos(pos + size * 2u); + BOOST_TEST(!bt.isMouseOver()); } static void resizeMap(libsiedler2::ArchivItem_Map& glMap, const Extent& size) @@ -91,45 +91,45 @@ BOOST_FIXTURE_TEST_CASE(PreviewMinimap, uiHelper::Fixture) DrawPoint pos(5, 12); Extent size(20, 10); ctrlPreviewMinimap mm(nullptr, 1, pos, size, nullptr); - BOOST_TEST_REQUIRE(mm.GetCurMapSize() == Extent::all(0)); - BOOST_TEST_REQUIRE(mm.GetBoundaryRect().getSize() == Extent::all(4)); // Padding + BOOST_TEST_REQUIRE(mm.getCurMapSize() == Extent::all(0)); + BOOST_TEST_REQUIRE(mm.getBoundaryRect().getSize() == Extent::all(4)); // Padding // Remove padding - mm.SetPadding(Extent::all(0)); - BOOST_TEST_REQUIRE(mm.GetBoundaryRect().getSize() == Extent::all(0)); + mm.setPadding(Extent::all(0)); + BOOST_TEST_REQUIRE(mm.getBoundaryRect().getSize() == Extent::all(0)); libsiedler2::ArchivItem_Map map; resizeMap(map, size); - mm.SetMap(&map); - BOOST_TEST_REQUIRE(mm.GetBoundaryRect().getSize().x <= size.x); //-V807 - BOOST_TEST_REQUIRE(mm.GetBoundaryRect().getSize().y <= size.y); - const Extent origBoundary = mm.GetBoundaryRect().getSize(); + mm.setMap(&map); + BOOST_TEST_REQUIRE(mm.getBoundaryRect().getSize().x <= size.x); //-V807 + BOOST_TEST_REQUIRE(mm.getBoundaryRect().getSize().y <= size.y); + const Extent origBoundary = mm.getBoundaryRect().getSize(); // Width smaller -> Don't go over width resizeMap(map, Extent(size.x / 2, size.y)); - mm.SetMap(&map); - BOOST_TEST_REQUIRE(mm.GetBoundaryRect().getSize().x <= size.x); - BOOST_TEST_REQUIRE(mm.GetBoundaryRect().getSize().y == size.y); + mm.setMap(&map); + BOOST_TEST_REQUIRE(mm.getBoundaryRect().getSize().x <= size.x); + BOOST_TEST_REQUIRE(mm.getBoundaryRect().getSize().y == size.y); // Height smaller -> Don't go over height resizeMap(map, Extent(size.x, size.y / 2)); - mm.SetMap(&map); - BOOST_TEST_REQUIRE(mm.GetBoundaryRect().getSize().x == size.x); - BOOST_TEST_REQUIRE(mm.GetBoundaryRect().getSize().y <= size.y); + mm.setMap(&map); + BOOST_TEST_REQUIRE(mm.getBoundaryRect().getSize().x == size.x); + BOOST_TEST_REQUIRE(mm.getBoundaryRect().getSize().y <= size.y); // Both smaller -> Stretch to original height resizeMap(map, size / 2u); - mm.SetMap(&map); - BOOST_TEST_REQUIRE(mm.GetBoundaryRect().getSize() == origBoundary); + mm.setMap(&map); + BOOST_TEST_REQUIRE(mm.getBoundaryRect().getSize() == origBoundary); // Width bigger -> Narrow map resizeMap(map, Extent(size.x * 2, size.y)); - mm.SetMap(&map); - BOOST_TEST_REQUIRE(mm.GetBoundaryRect().getSize().x == size.x); - BOOST_TEST_REQUIRE(mm.GetBoundaryRect().getSize().y <= size.y); + mm.setMap(&map); + BOOST_TEST_REQUIRE(mm.getBoundaryRect().getSize().x == size.x); + BOOST_TEST_REQUIRE(mm.getBoundaryRect().getSize().y <= size.y); // Height bigger -> Narrow map in x resizeMap(map, Extent(size.x, size.y * 2)); - mm.SetMap(&map); - BOOST_TEST_REQUIRE(mm.GetBoundaryRect().getSize().x <= size.x); - BOOST_TEST_REQUIRE(mm.GetBoundaryRect().getSize().y == size.y); + mm.setMap(&map); + BOOST_TEST_REQUIRE(mm.getBoundaryRect().getSize().x <= size.x); + BOOST_TEST_REQUIRE(mm.getBoundaryRect().getSize().y == size.y); // Both bigger -> Stretch to original height resizeMap(map, size * 2u); - mm.SetMap(&map); - BOOST_TEST_REQUIRE(mm.GetBoundaryRect().getSize() == origBoundary); + mm.setMap(&map); + BOOST_TEST_REQUIRE(mm.getBoundaryRect().getSize() == origBoundary); } BOOST_FIXTURE_TEST_CASE(EditShowsCorrectChars, uiHelper::Fixture) @@ -151,13 +151,13 @@ BOOST_FIXTURE_TEST_CASE(EditShowsCorrectChars, uiHelper::Fixture) const auto font = createMockFont(codepoints); ctrlEdit edt(nullptr, 0, DrawPoint(0, 0), Extent(90, 15), TextureColor::Green1, font.get()); ctrlEdit edt2(nullptr, 0, DrawPoint(0, 0), Extent(90, 15), TextureColor::Green1, font.get()); - const ctrlBaseText* txt = edt.GetCtrl(0); - const ctrlBaseText* txt2 = edt2.GetCtrl(0); + const ctrlBaseText* txt = edt.getCtrl(0); + const ctrlBaseText* txt2 = edt2.getCtrl(0); BOOST_TEST_REQUIRE(txt); BOOST_TEST_REQUIRE(txt2); - BOOST_TEST_REQUIRE(txt->GetText() == ""); + BOOST_TEST_REQUIRE(txt->getText() == ""); // Width available for text excludes the border left&right and 1 "Dx" for new chars - const auto allowedWidth = edt.GetSize().x - ctrlDeepening::borderSize.x * 2; + const auto allowedWidth = edt.getSize().x - ctrlDeepening::borderSize.x * 2; std::vector curChars; // Add random chars and observe front chars beeing removed for(int i = 0; i < 30; i++) @@ -166,9 +166,9 @@ BOOST_FIXTURE_TEST_CASE(EditShowsCorrectChars, uiHelper::Fixture) auto it = curChars.back().begin(); const char32_t c = utfDecoder::decode_valid(it); std::string curText = std::accumulate(curChars.begin(), curChars.end(), std::string{}); - edt.SetText(curText); + edt.setText(curText); // Activate - MouseCoords mc(edt2.GetPos()); + MouseCoords mc(edt2.getPos()); mc.ldown = true; edt2.msgLeftDown(mc); edt2.msgPaintAfter(); @@ -179,11 +179,11 @@ BOOST_FIXTURE_TEST_CASE(EditShowsCorrectChars, uiHelper::Fixture) { curText = std::accumulate(++itFirst, curChars.end(), std::string{}); } - BOOST_TEST_REQUIRE(txt->GetText() == curText); - BOOST_TEST_REQUIRE(txt2->GetText() == curText); + BOOST_TEST_REQUIRE(txt->getText() == curText); + BOOST_TEST_REQUIRE(txt2->getText() == curText); } // Check navigating of cursor - MouseCoords mc(edt2.GetPos()); + MouseCoords mc(edt2.getPos()); mc.ldown = true; edt.msgLeftDown(mc); // Activate edt.msgPaintAfter(); @@ -204,7 +204,7 @@ BOOST_FIXTURE_TEST_CASE(EditShowsCorrectChars, uiHelper::Fixture) curChars.erase(curChars.begin() + --curCursorPos); } const auto curText = std::accumulate(curChars.begin(), curChars.end(), std::string{}); - BOOST_TEST_REQUIRE(edt.GetText() == curText); + BOOST_TEST_REQUIRE(edt.getText() == curText); } // Check "movement" of text when using cursor // First create a text bigger than fit @@ -215,7 +215,7 @@ BOOST_FIXTURE_TEST_CASE(EditShowsCorrectChars, uiHelper::Fixture) curChars.push_back(chars[rttr::test::randomValue(0u, chars.size() - 1)]); curText += curChars.back(); } while(font->getWidth(curText) <= allowedWidth); - edt.SetText(curText); + edt.setText(curText); // Now cursor is at end and first "char" is not showing curCursorPos = curChars.size(); const auto txtWithoutFirst = curText.substr(curChars.front().size()); @@ -223,20 +223,20 @@ BOOST_FIXTURE_TEST_CASE(EditShowsCorrectChars, uiHelper::Fixture) // At least 5 chars before cursor should be shown -> No change until curCursorPos <= 5 do { - BOOST_TEST_REQUIRE(txt->GetText() == txtWithoutFirst); + BOOST_TEST_REQUIRE(txt->getText() == txtWithoutFirst); edt.msgKeyDown(KeyEvent(KeyType::Left)); --curCursorPos; } while(curCursorPos > 5); while(curCursorPos-- >= 0) { - BOOST_TEST_REQUIRE(txt->GetText() == curText); // Trailing chars are removed by font rendering + BOOST_TEST_REQUIRE(txt->getText() == curText); // Trailing chars are removed by font rendering edt.msgKeyDown(KeyEvent(KeyType::Left)); } // Moving fully right shows txt again curCursorPos = 0; while(static_cast(curCursorPos++) < curChars.size()) edt.msgKeyDown(KeyEvent(KeyType::Right)); - BOOST_TEST_REQUIRE(txt->GetText() == txtWithoutFirst); + BOOST_TEST_REQUIRE(txt->getText() == txtWithoutFirst); } BOOST_FIXTURE_TEST_CASE(EditFileNameOnlyFiltersInvalidChars, uiHelper::Fixture) @@ -244,23 +244,23 @@ BOOST_FIXTURE_TEST_CASE(EditFileNameOnlyFiltersInvalidChars, uiHelper::Fixture) const auto font = createMockFont( {'a', 'B', 'c', 'D', '1', '2', '3', '4', ' ', '-', '!', '<', '>', ':', '"', '/', '\\', '|', '?', '*'}); ctrlEdit edt(nullptr, 0, DrawPoint(0, 0), Extent(200, 15), TextureColor::Green1, font.get()); - edt.SetType(EditType::Filename); + edt.setType(EditType::Filename); - MouseCoords mc(edt.GetPos()); + MouseCoords mc(edt.getPos()); mc.ldown = true; edt.msgLeftDown(mc); // give focus for(char32_t c : {U'a', U'B', U'1', U'2', U' '}) // valid chars edt.msgKeyDown(KeyEvent(c)); - BOOST_TEST(edt.GetText() == "aB12 "); // all accepted + BOOST_TEST(edt.getText() == "aB12 "); // all accepted for(char32_t c : {U'c', U'<', U'D', U'>', U'-', U':', U'"', U'3', U'/', U'\\', U'4', U'|', U'?', U'!', U'*'}) // mixed valid and invalid chars edt.msgKeyDown(KeyEvent(c)); - BOOST_TEST(edt.GetText() == "aB12 cD-34!"); // only valid accepted + BOOST_TEST(edt.getText() == "aB12 cD-34!"); // only valid accepted - edt.SetText("a/B\\1"); - BOOST_TEST(edt.GetText() == "aB1"); + edt.setText("a/B\\1"); + BOOST_TEST(edt.getText() == "aB1"); } BOOST_FIXTURE_TEST_CASE(EditGetFileName, uiHelper::Fixture) @@ -269,35 +269,35 @@ BOOST_FIXTURE_TEST_CASE(EditGetFileName, uiHelper::Fixture) 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', static_cast(0xE9)}); ctrlEdit edt(nullptr, 0, DrawPoint(0, 0), Extent(200, 15), TextureColor::Green1, font.get()); - edt.SetType(EditType::Filename); + edt.setType(EditType::Filename); - edt.SetText(""); - BOOST_TEST((edt.GetFileName(".ini").status == FileNameStatus::Empty)); + edt.setText(""); + BOOST_TEST((edt.getFileName(".ini").status == FileNameStatus::Empty)); - edt.SetText(" "); // whitespace only - BOOST_TEST((edt.GetFileName(".ini").status == FileNameStatus::Empty)); + edt.setText(" "); // whitespace only + BOOST_TEST((edt.getFileName(".ini").status == FileNameStatus::Empty)); // leading whitespace trimmed, trailing kept - not at the end of the filename - edt.SetText(" mypreset "); - auto r = edt.GetFileName(".ini"); + edt.setText(" mypreset "); + auto r = edt.getFileName(".ini"); BOOST_TEST((r.status == FileNameStatus::Valid)); BOOST_TEST(r.name == "mypreset .ini"); // trailing space right before the extension round-trips - edt.SetText("abc "); - r = edt.GetFileName(".ini"); + edt.setText("abc "); + r = edt.getFileName(".ini"); BOOST_TEST((r.status == FileNameStatus::Valid)); BOOST_TEST(r.name == "abc .ini"); // valid name: extension appended - edt.SetText("mypreset"); - r = edt.GetFileName(".ini"); + edt.setText("mypreset"); + r = edt.getFileName(".ini"); BOOST_TEST((r.status == FileNameStatus::Valid)); BOOST_TEST(r.name == "mypreset.ini"); // extension appended even when the input already ends in it - edt.SetText("mypreset.ini"); - r = edt.GetFileName(".ini"); + edt.setText("mypreset.ini"); + r = edt.getFileName(".ini"); BOOST_TEST((r.status == FileNameStatus::Valid)); BOOST_TEST(r.name == "mypreset.ini.ini"); @@ -306,25 +306,25 @@ BOOST_FIXTURE_TEST_CASE(EditGetFileName, uiHelper::Fixture) std::string justFitsName; for(int i = 0; i < 125; ++i) justFitsName += twoByteChar; - edt.SetText(justFitsName); - r = edt.GetFileName(".ini"); + edt.setText(justFitsName); + r = edt.getFileName(".ini"); BOOST_TEST((r.status == FileNameStatus::Valid)); BOOST_TEST(r.name == justFitsName + ".ini"); // With one more character the name is rejected const std::string oneOverName = justFitsName + twoByteChar; - edt.SetText(oneOverName); - BOOST_TEST((edt.GetFileName(".ini").status == FileNameStatus::Invalid)); + edt.setText(oneOverName); + BOOST_TEST((edt.getFileName(".ini").status == FileNameStatus::Invalid)); // no ext: name returned as-is without appending - edt.SetText("mypreset"); - r = edt.GetFileName(); + edt.setText("mypreset"); + r = edt.getFileName(); BOOST_TEST((r.status == FileNameStatus::Valid)); BOOST_TEST(r.name == "mypreset"); // no ext: leading and trailing space trimmed - edt.SetText(" mypreset "); - r = edt.GetFileName(); + edt.setText(" mypreset "); + r = edt.getFileName(); BOOST_TEST((r.status == FileNameStatus::Valid)); BOOST_TEST(r.name == "mypreset"); } @@ -333,7 +333,7 @@ BOOST_FIXTURE_TEST_CASE(EditSpaceKeyDoesNotDuplicateChar, uiHelper::Fixture) { const auto font = createMockFont({U' ', '?'}); // '?' is required as glFont's missing-glyph fallback ctrlEdit edt(nullptr, 0, DrawPoint(0, 0), Extent(200, 15), TextureColor::Green1, font.get()); - MouseCoords mc(edt.GetPos()); + MouseCoords mc(edt.getPos()); mc.ldown = true; edt.msgLeftDown(mc); @@ -341,23 +341,23 @@ BOOST_FIXTURE_TEST_CASE(EditSpaceKeyDoesNotDuplicateChar, uiHelper::Fixture) // (WM_KEYDOWN+WM_CHAR) for one physical key press. edt.msgKeyDown(KeyEvent(KeyType::Space)); // OS "key down" event - must not insert anything edt.msgKeyDown(KeyEvent(U' ')); // OS "char/text-input" event - inserts the space - BOOST_TEST(edt.GetText() == " "); // exactly one space, not two + BOOST_TEST(edt.getText() == " "); // exactly one space, not two } BOOST_FIXTURE_TEST_CASE(EditMaxLengthTruncatesInput, uiHelper::Fixture) { const auto font = createMockFont({'a', 'b', 'c', 'd', 'e', '?'}); // '?' is glFont's missing-glyph fallback ctrlEdit edt(nullptr, 0, DrawPoint(0, 0), Extent(200, 15), TextureColor::Green1, font.get(), 3 /*maxlength*/); - MouseCoords mc(edt.GetPos()); + MouseCoords mc(edt.getPos()); mc.ldown = true; edt.msgLeftDown(mc); for(char32_t c : {U'a', U'b', U'c', U'd', U'e'}) // 5 chars typed, cap is 3 edt.msgKeyDown(KeyEvent(c)); - BOOST_TEST(edt.GetText() == "abc"); // input beyond maxLength is dropped + BOOST_TEST(edt.getText() == "abc"); // input beyond maxLength is dropped - edt.SetText("abcde"); // input beyond maxLength is dropped - BOOST_TEST(edt.GetText() == "abc"); + edt.setText("abcde"); // input beyond maxLength is dropped + BOOST_TEST(edt.getText() == "abc"); } BOOST_AUTO_TEST_CASE(AdjustWidthForMaxChars_SetsCorrectSize) @@ -366,26 +366,26 @@ BOOST_AUTO_TEST_CASE(AdjustWidthForMaxChars_SetsCorrectSize) { ctrlTextDeepening txt(nullptr, 1, rttr::test::randomPoint(), rttr::test::randomPoint(), TextureColor::Green1, "foo", font.get(), COLOR_BLACK); - const Extent sizeBefore = txt.GetSize(); + const Extent sizeBefore = txt.getSize(); // Don't assume size, so get size for 0 chars txt.ResizeForMaxChars(0); - const Extent sizeZero = txt.GetSize(); + const Extent sizeZero = txt.getSize(); BOOST_TEST(sizeZero.y == sizeBefore.y); const auto numChars = rttr::test::randomValue(1u, 20u); txt.ResizeForMaxChars(numChars); - BOOST_TEST(txt.GetSize() == Extent(sizeZero.x + numChars * font->getDx(), sizeBefore.y)); + BOOST_TEST(txt.getSize() == Extent(sizeZero.x + numChars * font->getDx(), sizeBefore.y)); } { ctrlTextButton txt(nullptr, 1, rttr::test::randomPoint(), rttr::test::randomPoint(), TextureColor::Green1, "foo", font.get(), "tooltip"); - const Extent sizeBefore = txt.GetSize(); + const Extent sizeBefore = txt.getSize(); // Don't assume size, so get size for 0 chars txt.ResizeForMaxChars(0); - const Extent sizeZero = txt.GetSize(); + const Extent sizeZero = txt.getSize(); BOOST_TEST(sizeZero.y == sizeBefore.y); const auto numChars = rttr::test::randomValue(1u, 20u); txt.ResizeForMaxChars(numChars); - BOOST_TEST(txt.GetSize() == Extent(sizeZero.x + numChars * font->getDx(), sizeBefore.y)); + BOOST_TEST(txt.getSize() == Extent(sizeZero.x + numChars * font->getDx(), sizeBefore.y)); } } @@ -399,8 +399,8 @@ BOOST_AUTO_TEST_CASE(TextControlWorks) ctrlText text(&parent, 0, pos, testText, COLOR_YELLOW, FontStyle{}, font.get()); // Test positioning - BOOST_TEST(text.GetPos() == pos); - const auto origBoundaryRect = text.GetBoundaryRect(); + BOOST_TEST(text.getPos() == pos); + const auto origBoundaryRect = text.getBoundaryRect(); BOOST_TEST(origBoundaryRect.getOrigin() == pos + parentPos); const auto fullTextWidth = font->getWidth(testText); BOOST_TEST(origBoundaryRect.getSize() == Extent(fullTextWidth, font->getHeight())); @@ -409,31 +409,31 @@ BOOST_AUTO_TEST_CASE(TextControlWorks) { const Position origSize(origBoundaryRect.getSize()); // Convert to signed type ctrlText textRight(&parent, 0, pos, testText, COLOR_YELLOW, FontStyle::RIGHT, font.get()); - BOOST_TEST(textRight.GetBoundaryRect() == Rect::move(origBoundaryRect, Position(-origSize.x, 0))); + BOOST_TEST(textRight.getBoundaryRect() == Rect::move(origBoundaryRect, Position(-origSize.x, 0))); ctrlText textCenter(&parent, 0, pos, testText, COLOR_YELLOW, FontStyle::CENTER, font.get()); - BOOST_TEST(textCenter.GetBoundaryRect() == Rect::move(origBoundaryRect, Position(-origSize.x / 2, 0))); + BOOST_TEST(textCenter.getBoundaryRect() == Rect::move(origBoundaryRect, Position(-origSize.x / 2, 0))); ctrlText textBottom(&parent, 0, pos, testText, COLOR_YELLOW, FontStyle::BOTTOM, font.get()); - BOOST_TEST(textBottom.GetBoundaryRect() == Rect::move(origBoundaryRect, Position(0, -origSize.y))); + BOOST_TEST(textBottom.getBoundaryRect() == Rect::move(origBoundaryRect, Position(0, -origSize.y))); ctrlText textVCenter(&parent, 0, pos, testText, COLOR_YELLOW, FontStyle::VCENTER, font.get()); - BOOST_TEST(textVCenter.GetBoundaryRect() == Rect::move(origBoundaryRect, Position(0, -origSize.y / 2))); + BOOST_TEST(textVCenter.getBoundaryRect() == Rect::move(origBoundaryRect, Position(0, -origSize.y / 2))); ctrlText textFullCenter(&parent, 0, pos, testText, COLOR_YELLOW, FontStyle::CENTER | FontStyle::VCENTER, font.get()); - BOOST_TEST(textFullCenter.GetBoundaryRect() + BOOST_TEST(textFullCenter.getBoundaryRect() == Rect::move(origBoundaryRect, Position(-origSize.x / 2, -origSize.y / 2))); ctrlText textBottomRight(&parent, 0, pos, testText, COLOR_YELLOW, FontStyle::RIGHT | FontStyle::BOTTOM, font.get()); - BOOST_TEST(textBottomRight.GetBoundaryRect() + BOOST_TEST(textBottomRight.getBoundaryRect() == Rect::move(origBoundaryRect, Position(-origSize.x, -origSize.y))); } // Test maxWidth { text.setMaxWidth(fullTextWidth); // Limit width without actually limiting it - BOOST_TEST(text.GetBoundaryRect() == origBoundaryRect); + BOOST_TEST(text.getBoundaryRect() == origBoundaryRect); // Limit width truncating the text const auto maxWidth = rttr::test::randomValue(font->getDx(), fullTextWidth - 1u); text.setMaxWidth(maxWidth); - const auto newBoundaryRect = text.GetBoundaryRect(); + const auto newBoundaryRect = text.getBoundaryRect(); BOOST_TEST(newBoundaryRect.getOrigin() == origBoundaryRect.getOrigin()); // TODO: Test that with a maxWidth of x-1 the width matches that of the last few chars replaced by dots BOOST_TEST(newBoundaryRect.getSize().x <= maxWidth); @@ -443,9 +443,9 @@ BOOST_AUTO_TEST_CASE(TextControlWorks) static std::vector getRow(const ctrlTable& table, unsigned row) { - std::vector values(table.GetNumColumns()); - for(unsigned i = 0; i < table.GetNumColumns(); i++) - values[i] = table.GetItemText(row, i); + std::vector values(table.getNumColumns()); + for(unsigned i = 0; i < table.getNumColumns(); i++) + values[i] = table.getItemText(row, i); return values; } @@ -481,27 +481,27 @@ BOOST_AUTO_TEST_CASE(TableSorting) }; table.SortRows(0, TableSortDir::Descending); - BOOST_TEST(table.GetSortColumn() == 0); - BOOST_TEST(table.GetSortDirection() == TableSortDir::Descending); + BOOST_TEST(table.getSortColumn() == 0); + BOOST_TEST(table.getSortDirection() == TableSortDir::Descending); BOOST_TEST_CONTEXT("String column") testRowsEqual({&r5, &r6, &r4, &r3, &r1, &r2}); table.SortRows(1, TableSortDir::Ascending); - BOOST_TEST(table.GetSortColumn() == 1); - BOOST_TEST(table.GetSortDirection() == TableSortDir::Ascending); + BOOST_TEST(table.getSortColumn() == 1); + BOOST_TEST(table.getSortDirection() == TableSortDir::Ascending); BOOST_TEST_CONTEXT("MapSize column") testRowsEqual({&r3, &r1, &r2, &r6, &r4, &r5}); table.SortRows(2, TableSortDir::Descending); - BOOST_TEST(table.GetSortColumn() == 2); - BOOST_TEST(table.GetSortDirection() == TableSortDir::Descending); + BOOST_TEST(table.getSortColumn() == 2); + BOOST_TEST(table.getSortDirection() == TableSortDir::Descending); BOOST_TEST_CONTEXT("Number column") testRowsEqual({&r6, &r5, &r4, &r3, &r2, &r1}); table.SortRows(3, TableSortDir::Ascending); - BOOST_TEST(table.GetSortColumn() == 3); - BOOST_TEST(table.GetSortDirection() == TableSortDir::Ascending); + BOOST_TEST(table.getSortColumn() == 3); + BOOST_TEST(table.getSortDirection() == TableSortDir::Ascending); BOOST_TEST_CONTEXT("Date column") testRowsEqual({&r4, &r1, &r2, &r3, &r5, &r6}); table.SortRows(3, TableSortDir::Descending); - BOOST_TEST(table.GetSortColumn() == 3); - BOOST_TEST(table.GetSortDirection() == TableSortDir::Descending); + BOOST_TEST(table.getSortColumn() == 3); + BOOST_TEST(table.getSortDirection() == TableSortDir::Descending); BOOST_TEST_CONTEXT("Date column") testRowsEqual({&r6, &r5, &r3, &r2, &r1, &r4}); } diff --git a/tests/s25Main/UI/testDskGameLobby.cpp b/tests/s25Main/UI/testDskGameLobby.cpp index 0af195b39c..6210e58e26 100644 --- a/tests/s25Main/UI/testDskGameLobby.cpp +++ b/tests/s25Main/UI/testDskGameLobby.cpp @@ -57,9 +57,9 @@ BOOST_FIXTURE_TEST_CASE(LobbyChat, uiHelper::Fixture) auto* ci = dynamic_cast(desktop); auto* li = dynamic_cast(desktop); BOOST_TEST_REQUIRE((ci && li)); - std::vector chatTab = desktop->GetCtrls(); + std::vector chatTab = desktop->getCtrls(); BOOST_TEST_REQUIRE(chatTab.size() == 1u); - std::vector chatBts = chatTab.front()->GetCtrls(); + std::vector chatBts = chatTab.front()->getCtrls(); BOOST_TEST_REQUIRE(chatBts.size() == 2u); WINDOWMANAGER.Draw(); @@ -71,7 +71,7 @@ BOOST_FIXTURE_TEST_CASE(LobbyChat, uiHelper::Fixture) RTTR_REQUIRE_LOG_CONTAINS("", false); li->LC_Chat("OtherPlayer", "Test"); RTTR_REQUIRE_LOG_CONTAINS("", false); - desktop->msgOptionGroupChange(chatTab.front()->GetID(), chatBts[i % 2]->GetID()); + desktop->msgOptionGroupChange(chatTab.front()->getID(), chatBts[i % 2]->getID()); } // Free desktop etc to trigger mock verification WINDOWMANAGER.CleanUp(); @@ -84,20 +84,20 @@ BOOST_AUTO_TEST_CASE(CheckServerVersionValidity) info.setVersion(""); BOOST_TEST(!isServerVersionValid(info)); // Exact match - info.setVersion(rttr::version::GetReadableVersion()); + info.setVersion(rttr::version::getReadableVersion()); BOOST_TEST(isServerVersionValid(info)); // Build with same revision but on 30.07.2012 - info.setVersion("v20120730 - " + rttr::version::GetShortRevision()); + info.setVersion("v20120730 - " + rttr::version::getShortRevision()); BOOST_TEST(isServerVersionValid(info)); // Build with same revision on a tag - info.setVersion("v0.8.9 - " + rttr::version::GetShortRevision()); + info.setVersion("v0.8.9 - " + rttr::version::getShortRevision()); BOOST_TEST(isServerVersionValid(info)); // Wrong revision (purposely non-hex char to avoid accidental match) info.setVersion("v0.8.9 - a1b2z3d"); BOOST_TEST(!isServerVersionValid(info)); rttr::test::LogAccessor logAcc; // Invalid format (can't get revision) - info.setVersion("v20120730 " + rttr::version::GetShortRevision()); + info.setVersion("v20120730 " + rttr::version::getShortRevision()); BOOST_TEST(!isServerVersionValid(info)); RTTR_REQUIRE_LOG_CONTAINS("Can't get server revision", true); } diff --git a/tests/s25Main/UI/testFont.cpp b/tests/s25Main/UI/testFont.cpp index e695cb63e8..3a74bf3ec2 100644 --- a/tests/s25Main/UI/testFont.cpp +++ b/tests/s25Main/UI/testFont.cpp @@ -21,13 +21,13 @@ BOOST_FIXTURE_TEST_CASE(WrapInfoVaryingLen, uiHelper::Fixture) const auto& font = *SmallFont; std::string input = "a\naa\naaa\naaaa\naaaaa\naa"; auto output = std::vector{"a", "aa", "aaa", "aaaa", "aaaa", "a", "aa"}; - glFont::WrapInfo wrapInfo = font.GetWrapInfo(input, font.CharWidth('a') * 4, font.CharWidth('a') * 4); + glFont::WrapInfo wrapInfo = font.getWrapInfo(input, font.CharWidth('a') * 4, font.CharWidth('a') * 4); BOOST_TEST(wrapInfo.lines.size() == output.size()); BOOST_TEST(wrapInfo.CreateSingleStrings(input) == output, boost::test_tools::per_element{}); input = "a aa aaa aaaa aaaaa aa"; output = std::vector{"a aa", "aaa", "aaaa", "aaaa", "a aa"}; - wrapInfo = font.GetWrapInfo(input, font.CharWidth('a') * 4, font.CharWidth('a') * 4); + wrapInfo = font.getWrapInfo(input, font.CharWidth('a') * 4, font.CharWidth('a') * 4); BOOST_TEST(wrapInfo.lines.size() == output.size()); BOOST_TEST(wrapInfo.CreateSingleStrings(input) == output, boost::test_tools::per_element{}); } @@ -36,7 +36,7 @@ BOOST_FIXTURE_TEST_CASE(WrapInfoWithTrailingNewlines, uiHelper::Fixture) { const std::string input = "a1\nb234\n\nc4124\n\n\n"; const auto output = std::vector{"a1", "b234", "", "c4124", "", "", ""}; - const glFont::WrapInfo wrapInfo = SmallFont->GetWrapInfo(input, 1000, 1000); + const glFont::WrapInfo wrapInfo = SmallFont->getWrapInfo(input, 1000, 1000); BOOST_TEST(wrapInfo.lines.size() == output.size()); BOOST_TEST(wrapInfo.CreateSingleStrings(input) == output, boost::test_tools::per_element{}); } diff --git a/tests/s25Main/UI/testImageButton.cpp b/tests/s25Main/UI/testImageButton.cpp index 0cf513360d..e12c1c390f 100644 --- a/tests/s25Main/UI/testImageButton.cpp +++ b/tests/s25Main/UI/testImageButton.cpp @@ -17,8 +17,8 @@ MOCK_BASE_CLASS(TestTexture, ITexture) { public: TestTexture(Extent size, Position origin) : size_(size), origin_(origin) {} - Position GetOrigin() const override { return origin_; } - Extent GetSize() const override { return size_; } + Position getOrigin() const override { return origin_; } + Extent getSize() const override { return size_; } MOCK_NON_CONST_METHOD(DrawFull, 2) // LCOV_EXCL_LINE MOCK_NON_CONST_METHOD(Draw, 3) diff --git a/tests/s25Main/UI/testIngameWindow.cpp b/tests/s25Main/UI/testIngameWindow.cpp index a642bb4e0d..02d12e2572 100644 --- a/tests/s25Main/UI/testIngameWindow.cpp +++ b/tests/s25Main/UI/testIngameWindow.cpp @@ -58,17 +58,17 @@ static MouseCoords makeLeftDblClick(const Position pos) BOOST_AUTO_TEST_CASE(MinimizeWindow) { iwHelp wnd("Foo barFoo barFoo barFoo bar\n\n\n\nFoo\nFoo\nFoo\nFoo\nFoo\nFoo\nFoo\nFoo\nFoo\nFoo\nFoo\nFoo\n"); - const Extent oldSize = wnd.GetSize(); + const Extent oldSize = wnd.getSize(); BOOST_TEST_REQUIRE(oldSize.x > 50u); BOOST_TEST_REQUIRE(oldSize.y > 50u); // Window should reduce height (only) - wnd.SetMinimized(true); - BOOST_TEST_REQUIRE(wnd.GetSize().x == oldSize.x); //-V807 - BOOST_TEST_REQUIRE(wnd.GetSize().y > 0u); - BOOST_TEST_REQUIRE(wnd.GetSize().y < oldSize.y); + wnd.setMinimized(true); + BOOST_TEST_REQUIRE(wnd.getSize().x == oldSize.x); //-V807 + BOOST_TEST_REQUIRE(wnd.getSize().y > 0u); + BOOST_TEST_REQUIRE(wnd.getSize().y < oldSize.y); // And fully expand to old size - wnd.SetMinimized(false); - BOOST_TEST_REQUIRE(wnd.GetSize() == oldSize); + wnd.setMinimized(false); + BOOST_TEST_REQUIRE(wnd.getSize() == oldSize); } BOOST_AUTO_TEST_CASE(IwMapGenerator) @@ -86,38 +86,38 @@ BOOST_AUTO_TEST_CASE(IwMapGenerator) rttr::mapGenerator::MapSettings settings; iwMapGenerator wnd(settings); // UI values are set according to current values. Check that and adjust to random value to test apply-button - BOOST_TEST(wnd.GetCtrl(iwMapGenerator::ID_cbNumPlayers)->GetSelection().value() + BOOST_TEST(wnd.getCtrl(iwMapGenerator::ID_cbNumPlayers)->getSelection().value() == settings.numPlayers - 2u); - wnd.GetCtrl(iwMapGenerator::ID_cbNumPlayers)->SetSelection(expectedNumPlayers - 2); - BOOST_TEST(wnd.GetCtrl(iwMapGenerator::ID_cbMapType)->GetSelection().value() == settings.type.value); - wnd.GetCtrl(iwMapGenerator::ID_cbMapType)->SetSelection(expectedMapType); - BOOST_TEST(wnd.GetCtrl(iwMapGenerator::ID_cbMapStyle)->GetSelection().value() + wnd.getCtrl(iwMapGenerator::ID_cbNumPlayers)->setSelection(expectedNumPlayers - 2); + BOOST_TEST(wnd.getCtrl(iwMapGenerator::ID_cbMapType)->getSelection().value() == settings.type.value); + wnd.getCtrl(iwMapGenerator::ID_cbMapType)->setSelection(expectedMapType); + BOOST_TEST(wnd.getCtrl(iwMapGenerator::ID_cbMapStyle)->getSelection().value() == static_cast(settings.style)); - wnd.GetCtrl(iwMapGenerator::ID_cbMapStyle)->SetSelection(1); // MapStyle::Land - BOOST_TEST(wnd.GetCtrl(iwMapGenerator::ID_cbMapSizeX)->GetSelectedText().value() + wnd.getCtrl(iwMapGenerator::ID_cbMapStyle)->setSelection(1); // MapStyle::Land + BOOST_TEST(wnd.getCtrl(iwMapGenerator::ID_cbMapSizeX)->getSelectedText().value() == s25util::toStringClassic(settings.size.x)); - BOOST_TEST(wnd.GetCtrl(iwMapGenerator::ID_cbMapSizeY)->GetSelectedText().value() + BOOST_TEST(wnd.getCtrl(iwMapGenerator::ID_cbMapSizeY)->getSelectedText().value() == s25util::toStringClassic(settings.size.y)); - wnd.GetCtrl(iwMapGenerator::ID_cbMapSizeX)->SetSelection(7); // 256 - wnd.GetCtrl(iwMapGenerator::ID_cbMapSizeY)->SetSelection(3); // 128 - BOOST_TEST(wnd.GetCtrl(iwMapGenerator::ID_cbMountainDist)->GetSelection().value() == 1u); // Normal - wnd.GetCtrl(iwMapGenerator::ID_cbMountainDist)->SetSelection(3); // VeryFar - BOOST_TEST(wnd.GetCtrl(iwMapGenerator::ID_cbIslands)->GetSelection().value() == 0u); // Few - wnd.GetCtrl(iwMapGenerator::ID_cbIslands)->SetSelection(2); // IslandAmount::Many - BOOST_TEST(wnd.GetCtrl(iwMapGenerator::ID_pgGoldRatio)->GetPosition() == settings.ratioGold); - wnd.GetCtrl(iwMapGenerator::ID_pgGoldRatio)->SetPosition(expectedGoldRatio); - BOOST_TEST(wnd.GetCtrl(iwMapGenerator::ID_pgIronRatio)->GetPosition() == settings.ratioIron); - wnd.GetCtrl(iwMapGenerator::ID_pgIronRatio)->SetPosition(expectedIronRatio); - BOOST_TEST(wnd.GetCtrl(iwMapGenerator::ID_pgCoalRatio)->GetPosition() == settings.ratioCoal); - wnd.GetCtrl(iwMapGenerator::ID_pgCoalRatio)->SetPosition(expectedCoalRatio); - BOOST_TEST(wnd.GetCtrl(iwMapGenerator::ID_pgGraniteRatio)->GetPosition() == settings.ratioGranite); - wnd.GetCtrl(iwMapGenerator::ID_pgGraniteRatio)->SetPosition(expectedGraniteRatio); - BOOST_TEST(wnd.GetCtrl(iwMapGenerator::ID_pgRivers)->GetPosition() == settings.rivers); - wnd.GetCtrl(iwMapGenerator::ID_pgRivers)->SetPosition(expectedRivers); - BOOST_TEST(wnd.GetCtrl(iwMapGenerator::ID_pgTrees)->GetPosition() == settings.trees); - wnd.GetCtrl(iwMapGenerator::ID_pgTrees)->SetPosition(expectedTrees); - BOOST_TEST(wnd.GetCtrl(iwMapGenerator::ID_pgStonePiles)->GetPosition() == settings.stonePiles); - wnd.GetCtrl(iwMapGenerator::ID_pgStonePiles)->SetPosition(expectedStonePiles); + wnd.getCtrl(iwMapGenerator::ID_cbMapSizeX)->setSelection(7); // 256 + wnd.getCtrl(iwMapGenerator::ID_cbMapSizeY)->setSelection(3); // 128 + BOOST_TEST(wnd.getCtrl(iwMapGenerator::ID_cbMountainDist)->getSelection().value() == 1u); // Normal + wnd.getCtrl(iwMapGenerator::ID_cbMountainDist)->setSelection(3); // VeryFar + BOOST_TEST(wnd.getCtrl(iwMapGenerator::ID_cbIslands)->getSelection().value() == 0u); // Few + wnd.getCtrl(iwMapGenerator::ID_cbIslands)->setSelection(2); // IslandAmount::Many + BOOST_TEST(wnd.getCtrl(iwMapGenerator::ID_pgGoldRatio)->getPosition() == settings.ratioGold); + wnd.getCtrl(iwMapGenerator::ID_pgGoldRatio)->setPosition(expectedGoldRatio); + BOOST_TEST(wnd.getCtrl(iwMapGenerator::ID_pgIronRatio)->getPosition() == settings.ratioIron); + wnd.getCtrl(iwMapGenerator::ID_pgIronRatio)->setPosition(expectedIronRatio); + BOOST_TEST(wnd.getCtrl(iwMapGenerator::ID_pgCoalRatio)->getPosition() == settings.ratioCoal); + wnd.getCtrl(iwMapGenerator::ID_pgCoalRatio)->setPosition(expectedCoalRatio); + BOOST_TEST(wnd.getCtrl(iwMapGenerator::ID_pgGraniteRatio)->getPosition() == settings.ratioGranite); + wnd.getCtrl(iwMapGenerator::ID_pgGraniteRatio)->setPosition(expectedGraniteRatio); + BOOST_TEST(wnd.getCtrl(iwMapGenerator::ID_pgRivers)->getPosition() == settings.rivers); + wnd.getCtrl(iwMapGenerator::ID_pgRivers)->setPosition(expectedRivers); + BOOST_TEST(wnd.getCtrl(iwMapGenerator::ID_pgTrees)->getPosition() == settings.trees); + wnd.getCtrl(iwMapGenerator::ID_pgTrees)->setPosition(expectedTrees); + BOOST_TEST(wnd.getCtrl(iwMapGenerator::ID_pgStonePiles)->getPosition() == settings.stonePiles); + wnd.getCtrl(iwMapGenerator::ID_pgStonePiles)->setPosition(expectedStonePiles); wnd.msgButtonClick(iwMapGenerator::ID_btApply); BOOST_TEST(wnd.ShouldBeClosed()); @@ -139,13 +139,13 @@ BOOST_AUTO_TEST_CASE(IwMapGenerator) BOOST_AUTO_TEST_CASE(ConnectWindow) { iwDirectIPConnect wnd(ServerType::Local); - const auto edts = wnd.GetCtrls(); + const auto edts = wnd.getCtrls(); // Should have (at least) 3 fields: IP, port, password (in this order) const auto& edtIp = *edts.at(0); const auto& edtPort = *edts.at(1); const auto& edtPw = *edts.at(2); // And an option group to choose IPv6 vs IPv4 - auto& ipGrp = *wnd.GetCtrls().at(0); + auto& ipGrp = *wnd.getCtrls().at(0); const auto testHost = rttr::test::randString(10); const auto testPort = rttr::test::randomValue(10, 10000); const auto testIsIpv6 = rttr::test::randomBool(); @@ -153,11 +153,11 @@ BOOST_AUTO_TEST_CASE(ConnectWindow) true); // When the server has a password, the window shouldn't initiate the connection process BOOST_TEST_REQUIRE(!wnd.ShouldBeClosed()); // No error or anything, window still open // Fields filled and password field has focus - BOOST_TEST(edtIp.GetText() == testHost); - BOOST_TEST(edtPort.GetText() == s25util::toStringClassic(testPort)); - BOOST_TEST(edtPw.GetText().empty()); - BOOST_TEST(edtPw.HasFocus()); - BOOST_TEST(ipGrp.GetSelection() == static_cast(testIsIpv6)); + BOOST_TEST(edtIp.getText() == testHost); + BOOST_TEST(edtPort.getText() == s25util::toStringClassic(testPort)); + BOOST_TEST(edtPw.getText().empty()); + BOOST_TEST(edtPw.hasFocus()); + BOOST_TEST(ipGrp.getSelection() == static_cast(testIsIpv6)); } BOOST_AUTO_TEST_CASE(ConnectingWindow) @@ -168,36 +168,36 @@ BOOST_AUTO_TEST_CASE(ConnectingWindow) ClientInterface& ci = wnd; boost::signals2::scoped_connection _ = wnd.onError.connect(onError); // Modal and doesn't react on right-click - BOOST_TEST(wnd.IsModal()); + BOOST_TEST(wnd.isModal()); BOOST_TEST(wnd.getCloseBehavior() == CloseBehavior::Custom); - ctrlPercent& progressBar = *wnd.GetCtrls().at(0); - BOOST_TEST(!progressBar.IsVisible()); // Initially hidden + ctrlPercent& progressBar = *wnd.getCtrls().at(0); + BOOST_TEST(!progressBar.isVisible()); // Initially hidden for(auto st : {ConnectState::Initiated, ConnectState::VerifyServer, ConnectState::QueryPw, ConnectState::QueryMapInfo}) { ci.CI_NextConnectState(st); - BOOST_TEST(!progressBar.IsVisible()); // Still hidden + BOOST_TEST(!progressBar.isVisible()); // Still hidden } ci.CI_NextConnectState(ConnectState::ReceiveMap); - BOOST_TEST(progressBar.IsVisible()); // Shown + BOOST_TEST(progressBar.isVisible()); // Shown BOOST_TEST(progressBar.getPercentage() == 0u); ci.CI_MapPartReceived(499, 1000); - BOOST_TEST(progressBar.IsVisible()); + BOOST_TEST(progressBar.isVisible()); BOOST_TEST(progressBar.getPercentage() == 50u); ci.CI_MapPartReceived(1000, 1000); - BOOST_TEST(progressBar.IsVisible()); + BOOST_TEST(progressBar.isVisible()); BOOST_TEST(progressBar.getPercentage() == 100u); for(auto st : {ConnectState::VerifyMap, ConnectState::QueryServerName, ConnectState::QueryPlayerList, ConnectState::QuerySettings}) { ci.CI_NextConnectState(st); - BOOST_TEST(!progressBar.IsVisible()); // Hidden again + BOOST_TEST(!progressBar.isVisible()); // Hidden again } BOOST_TEST(!wnd.ShouldBeClosed()); ci.CI_NextConnectState(ConnectState::Finished); BOOST_TEST(wnd.ShouldBeClosed()); WINDOWMANAGER.Draw(); - BOOST_TEST((dynamic_cast(WINDOWMANAGER.GetCurrentDesktop()) != nullptr)); + BOOST_TEST((dynamic_cast(WINDOWMANAGER.getCurrentDesktop()) != nullptr)); } { iwConnecting wnd(ServerType::Local, nullptr); @@ -211,9 +211,9 @@ BOOST_AUTO_TEST_CASE(ConnectingWindow) { iwConnecting wnd(ServerType::Local, nullptr); // Clicking the button sends the onError signal (or if not set opens an error window) and closes the window - wnd.msgButtonClick(wnd.GetCtrls().at(0)->GetID()); + wnd.msgButtonClick(wnd.getCtrls().at(0)->getID()); BOOST_TEST(wnd.ShouldBeClosed()); - BOOST_TEST((dynamic_cast(WINDOWMANAGER.GetTopMostWindow()))); + BOOST_TEST((dynamic_cast(WINDOWMANAGER.getTopMostWindow()))); } } @@ -228,10 +228,10 @@ BOOST_AUTO_TEST_CASE(SaveAndRestoreMinimized) settings.isMinimized = false; IngameWindow wnd(id, IngameWindow::posLastOrCenter, Extent(100, 100), "Test Window", nullptr); - BOOST_TEST(!wnd.IsMinimized()); - BOOST_TEST(wnd.GetSize() == Extent(100, 100)); + BOOST_TEST(!wnd.isMinimized()); + BOOST_TEST(wnd.getSize() == Extent(100, 100)); - wnd.SetMinimized(true); + wnd.setMinimized(true); BOOST_TEST(settings.isMinimized); } @@ -239,10 +239,10 @@ BOOST_AUTO_TEST_CASE(SaveAndRestoreMinimized) settings.isMinimized = true; IngameWindow wnd(id, IngameWindow::posLastOrCenter, Extent(100, 100), "Test Window", nullptr); - BOOST_TEST(wnd.IsMinimized()); - BOOST_TEST(wnd.GetSize() != Extent(100, 100)); + BOOST_TEST(wnd.isMinimized()); + BOOST_TEST(wnd.getSize() != Extent(100, 100)); - wnd.SetMinimized(false); + wnd.setMinimized(false); BOOST_TEST(!settings.isMinimized); } } @@ -258,10 +258,10 @@ BOOST_AUTO_TEST_CASE(SaveAndRestorePinned) settings.isPinned = false; IngameWindow wnd(id, IngameWindow::posLastOrCenter, Extent(100, 100), "Test Window", nullptr); - BOOST_TEST(!wnd.IsPinned()); - BOOST_TEST(wnd.GetSize() == Extent(100, 100)); + BOOST_TEST(!wnd.isPinned()); + BOOST_TEST(wnd.getSize() == Extent(100, 100)); - wnd.SetPinned(); + wnd.setPinned(); BOOST_TEST(settings.isPinned); } @@ -269,9 +269,9 @@ BOOST_AUTO_TEST_CASE(SaveAndRestorePinned) settings.isPinned = true; IngameWindow wnd(id, IngameWindow::posLastOrCenter, Extent(100, 100), "Test Window", nullptr); - BOOST_TEST(wnd.IsPinned()); + BOOST_TEST(wnd.isPinned()); - wnd.SetPinned(false); + wnd.setPinned(false); BOOST_TEST(!settings.isPinned); } } @@ -291,13 +291,13 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) BOOST_TEST_CONTEXT("Left title bar button closes window") { IngameWindow wnd(id, IngameWindow::posLastOrCenter, Extent(100, 100), "Test Window", nullptr); - const MouseCoords evLDown = makeLeftDown(wnd.GetPos() + DrawPoint(4, 4)); - const MouseCoords evLDownInsideWindow = makeLeftDown(wnd.GetPos() + wnd.GetSize() / 2); + const MouseCoords evLDown = makeLeftDown(wnd.getPos() + DrawPoint(4, 4)); + const MouseCoords evLDownInsideWindow = makeLeftDown(wnd.getPos() + wnd.getSize() / 2); const MouseCoords evLUp = MouseCoords(evLDown.pos); BOOST_TEST(!wnd.ShouldBeClosed()); - BOOST_TEST(!wnd.IsMinimized()); - BOOST_TEST(!wnd.IsPinned()); + BOOST_TEST(!wnd.isMinimized()); + BOOST_TEST(!wnd.isPinned()); // Only react when clicking the button not when moving the mouse to the button // while holding left mouse button @@ -305,22 +305,22 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) wnd.msgMouseMove(evLDown); wnd.msgLeftUp(evLUp); BOOST_TEST(!wnd.ShouldBeClosed()); - BOOST_TEST(!wnd.IsMinimized()); - BOOST_TEST(!wnd.IsPinned()); + BOOST_TEST(!wnd.isMinimized()); + BOOST_TEST(!wnd.isPinned()); // Similar when moving out of the button wnd.msgLeftDown(evLDown); wnd.msgMouseMove(evLDownInsideWindow); wnd.msgMouseMove(evLDown); wnd.msgLeftUp(evLUp); BOOST_TEST(!wnd.ShouldBeClosed()); - BOOST_TEST(!wnd.IsMinimized()); - BOOST_TEST(!wnd.IsPinned()); + BOOST_TEST(!wnd.isMinimized()); + BOOST_TEST(!wnd.isPinned()); wnd.msgLeftDown(evLDown); wnd.msgLeftUp(evLUp); BOOST_TEST(wnd.ShouldBeClosed()); - BOOST_TEST(!wnd.IsMinimized()); - BOOST_TEST(!wnd.IsPinned()); + BOOST_TEST(!wnd.isMinimized()); + BOOST_TEST(!wnd.isPinned()); BOOST_TEST(!settings.isOpen); BOOST_TEST(!settings.isMinimized); BOOST_TEST(!settings.isPinned); @@ -329,17 +329,17 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) BOOST_TEST_CONTEXT("Double-click on the window title has no effect") { IngameWindow wnd(id, IngameWindow::posLastOrCenter, Extent(100, 100), "Test Window", nullptr); - const MouseCoords evLDown = makeLeftDown(wnd.GetPos() + DrawPoint(wnd.GetSize().x / 2, 4)); + const MouseCoords evLDown = makeLeftDown(wnd.getPos() + DrawPoint(wnd.getSize().x / 2, 4)); const MouseCoords evLDblClick = makeLeftDblClick(evLDown.pos); BOOST_TEST(!wnd.ShouldBeClosed()); - BOOST_TEST(!wnd.IsMinimized()); - BOOST_TEST(!wnd.IsPinned()); + BOOST_TEST(!wnd.isMinimized()); + BOOST_TEST(!wnd.isPinned()); wnd.msgLeftDown(evLDown); wnd.msgLeftUp(evLDblClick); BOOST_TEST(!wnd.ShouldBeClosed()); - BOOST_TEST(!wnd.IsMinimized()); - BOOST_TEST(!wnd.IsPinned()); + BOOST_TEST(!wnd.isMinimized()); + BOOST_TEST(!wnd.isPinned()); BOOST_TEST(settings.isOpen); BOOST_TEST(!settings.isMinimized); BOOST_TEST(!settings.isPinned); @@ -349,17 +349,17 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) BOOST_TEST_CONTEXT("Right title bar button minimizes window") { IngameWindow wnd(id, IngameWindow::posLastOrCenter, Extent(100, 100), "Test Window", nullptr); - const MouseCoords evLDown = makeLeftDown(wnd.GetPos() + DrawPoint(wnd.GetSize().x, 0) + DrawPoint(-4, 4)); + const MouseCoords evLDown = makeLeftDown(wnd.getPos() + DrawPoint(wnd.getSize().x, 0) + DrawPoint(-4, 4)); const MouseCoords evLUp = MouseCoords(evLDown.pos); BOOST_TEST(!wnd.ShouldBeClosed()); - BOOST_TEST(!wnd.IsMinimized()); - BOOST_TEST(!wnd.IsPinned()); + BOOST_TEST(!wnd.isMinimized()); + BOOST_TEST(!wnd.isPinned()); wnd.msgLeftDown(evLDown); wnd.msgLeftUp(evLUp); BOOST_TEST(!wnd.ShouldBeClosed()); - BOOST_TEST(wnd.IsMinimized()); - BOOST_TEST(!wnd.IsPinned()); + BOOST_TEST(wnd.isMinimized()); + BOOST_TEST(!wnd.isPinned()); BOOST_TEST(settings.isOpen); BOOST_TEST(settings.isMinimized); BOOST_TEST(!settings.isPinned); @@ -374,17 +374,17 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) BOOST_TEST_CONTEXT("Left title bar button closes window") { IngameWindow wnd(id, IngameWindow::posLastOrCenter, Extent(100, 100), "Test Window", nullptr); - const MouseCoords evLDown = makeLeftDown(wnd.GetPos() + DrawPoint(4, 4)); + const MouseCoords evLDown = makeLeftDown(wnd.getPos() + DrawPoint(4, 4)); const MouseCoords evLUp = MouseCoords(evLDown.pos); BOOST_TEST(!wnd.ShouldBeClosed()); - BOOST_TEST(!wnd.IsMinimized()); - BOOST_TEST(!wnd.IsPinned()); + BOOST_TEST(!wnd.isMinimized()); + BOOST_TEST(!wnd.isPinned()); wnd.msgLeftDown(evLDown); wnd.msgLeftUp(evLUp); BOOST_TEST(wnd.ShouldBeClosed()); - BOOST_TEST(!wnd.IsMinimized()); - BOOST_TEST(!wnd.IsPinned()); + BOOST_TEST(!wnd.isMinimized()); + BOOST_TEST(!wnd.isPinned()); BOOST_TEST(!settings.isOpen); BOOST_TEST(!settings.isMinimized); BOOST_TEST(!settings.isPinned); @@ -393,17 +393,17 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) BOOST_TEST_CONTEXT("Double-click on the window title minimizes") { IngameWindow wnd(id, IngameWindow::posLastOrCenter, Extent(100, 100), "Test Window", nullptr); - const MouseCoords evLDown = makeLeftDown(wnd.GetPos() + DrawPoint(wnd.GetSize().x / 2, 4)); + const MouseCoords evLDown = makeLeftDown(wnd.getPos() + DrawPoint(wnd.getSize().x / 2, 4)); const MouseCoords evLDblClick = makeLeftDblClick(evLDown.pos); BOOST_TEST(!wnd.ShouldBeClosed()); - BOOST_TEST(!wnd.IsMinimized()); - BOOST_TEST(!wnd.IsPinned()); + BOOST_TEST(!wnd.isMinimized()); + BOOST_TEST(!wnd.isPinned()); wnd.msgLeftDown(evLDown); wnd.msgLeftUp(evLDblClick); BOOST_TEST(!wnd.ShouldBeClosed()); - BOOST_TEST(wnd.IsMinimized()); - BOOST_TEST(!wnd.IsPinned()); + BOOST_TEST(wnd.isMinimized()); + BOOST_TEST(!wnd.isPinned()); BOOST_TEST(settings.isOpen); BOOST_TEST(settings.isMinimized); BOOST_TEST(!settings.isPinned); @@ -414,17 +414,17 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) BOOST_TEST_CONTEXT("Right title bar button pins window") { IngameWindow wnd(id, IngameWindow::posLastOrCenter, Extent(100, 100), "Test Window", nullptr); - const MouseCoords evLDown = makeLeftDown(wnd.GetPos() + DrawPoint(wnd.GetSize().x, 0) + DrawPoint(-4, 4)); + const MouseCoords evLDown = makeLeftDown(wnd.getPos() + DrawPoint(wnd.getSize().x, 0) + DrawPoint(-4, 4)); const MouseCoords evLUp = MouseCoords(evLDown.pos); BOOST_TEST(!wnd.ShouldBeClosed()); - BOOST_TEST(!wnd.IsMinimized()); - BOOST_TEST(!wnd.IsPinned()); + BOOST_TEST(!wnd.isMinimized()); + BOOST_TEST(!wnd.isPinned()); wnd.msgLeftDown(evLDown); wnd.msgLeftUp(evLUp); BOOST_TEST(!wnd.ShouldBeClosed()); - BOOST_TEST(!wnd.IsMinimized()); - BOOST_TEST(wnd.IsPinned()); + BOOST_TEST(!wnd.isMinimized()); + BOOST_TEST(wnd.isPinned()); BOOST_TEST(settings.isOpen); BOOST_TEST(!settings.isMinimized); BOOST_TEST(settings.isPinned); @@ -440,11 +440,11 @@ void WindowPositioning_testOne(IngameWindow& wnd, const char* context, const std { BOOST_TEST_CONTEXT("Before minimize/un-minimize") checkNormal(); - wnd.SetMinimized(true); + wnd.setMinimized(true); BOOST_TEST_CONTEXT("Minimized") checkMinimized(); - wnd.SetMinimized(false); + wnd.setMinimized(false); BOOST_TEST_CONTEXT("After minimize/un-minimize") checkNormal(); } @@ -455,7 +455,7 @@ BOOST_AUTO_TEST_CASE(WindowPositioning) { VIDEODRIVER.ResizeScreen(VideoMode(800, 600), DisplayMode::Windowed); - const auto renderSize = VIDEODRIVER.GetRenderSize(); + const auto renderSize = VIDEODRIVER.getRenderSize(); constexpr auto idPersisted = CGI_MINIMAP; constexpr auto idNonPersisted = CGI_OBSERVATION; @@ -472,8 +472,8 @@ BOOST_AUTO_TEST_CASE(WindowPositioning) auto& settings = it->second; // Calculate minimized height - const auto minHeight = LOADER.GetImageN("resource", 42)->getHeight() // title bar - + LOADER.GetImageN("resource", 40)->getHeight(); // bottom bar + const auto minHeight = LOADER.getImageN("resource", 42)->getHeight() // title bar + + LOADER.getImageN("resource", 40)->getHeight(); // bottom bar BOOST_TEST_CONTEXT("Persisted window, fresh settings, posLastOrCenter") { @@ -484,65 +484,65 @@ BOOST_AUTO_TEST_CASE(WindowPositioning) WindowPositioning_testOne( wnd, "Window should be centered", [&]() { - BOOST_TEST(wnd.GetPos() == (renderSize / 2 - wndSizeM / 2)); - BOOST_TEST(wnd.GetPos() == settings.lastPos); - BOOST_TEST(wnd.GetPos() == settings.restorePos); - BOOST_TEST(wnd.GetSize() == wndSizeM); + BOOST_TEST(wnd.getPos() == (renderSize / 2 - wndSizeM / 2)); + BOOST_TEST(wnd.getPos() == settings.lastPos); + BOOST_TEST(wnd.getPos() == settings.restorePos); + BOOST_TEST(wnd.getSize() == wndSizeM); }, [&]() { - BOOST_TEST(wnd.GetPos() == settings.lastPos); - BOOST_TEST(wnd.GetPos() == settings.restorePos); - BOOST_TEST(wnd.GetPos() == (renderSize / 2 - wndSizeM / 2)); - BOOST_TEST(wnd.GetSize() == Extent(wndSizeM.x, minHeight)); + BOOST_TEST(wnd.getPos() == settings.lastPos); + BOOST_TEST(wnd.getPos() == settings.restorePos); + BOOST_TEST(wnd.getPos() == (renderSize / 2 - wndSizeM / 2)); + BOOST_TEST(wnd.getSize() == Extent(wndSizeM.x, minHeight)); }); const auto restorePos = renderSize - offset; // new position is also the restorePos WindowPositioning_testOne( wnd, "Move window into bottom right corner, not connecting with the screen edges", [&]() { - wnd.SetPos(restorePos); - BOOST_TEST(wnd.GetPos() == restorePos); - BOOST_TEST(wnd.GetPos() == settings.lastPos); - BOOST_TEST(wnd.GetPos() == settings.restorePos); - BOOST_TEST(wnd.GetSize() == wndSizeM); + wnd.setPos(restorePos); + BOOST_TEST(wnd.getPos() == restorePos); + BOOST_TEST(wnd.getPos() == settings.lastPos); + BOOST_TEST(wnd.getPos() == settings.restorePos); + BOOST_TEST(wnd.getSize() == wndSizeM); }, [&]() { - BOOST_TEST(wnd.GetPos() == restorePos); - BOOST_TEST(wnd.GetPos() == settings.lastPos); - BOOST_TEST(wnd.GetPos() == settings.restorePos); - BOOST_TEST(wnd.GetSize() == Extent(wndSizeM.x, minHeight)); + BOOST_TEST(wnd.getPos() == restorePos); + BOOST_TEST(wnd.getPos() == settings.lastPos); + BOOST_TEST(wnd.getPos() == settings.restorePos); + BOOST_TEST(wnd.getSize() == Extent(wndSizeM.x, minHeight)); }); WindowPositioning_testOne( wnd, "Increase size, window connects with screen edges and should move", [&]() { wnd.Resize(wndSizeL); - BOOST_TEST(wnd.GetPos() == DrawPoint(renderSize - wndSizeL)); - BOOST_TEST(wnd.GetPos() == settings.lastPos); + BOOST_TEST(wnd.getPos() == DrawPoint(renderSize - wndSizeL)); + BOOST_TEST(wnd.getPos() == settings.lastPos); BOOST_TEST(restorePos == settings.restorePos); - BOOST_TEST(wnd.GetSize() == wndSizeL); + BOOST_TEST(wnd.getSize() == wndSizeL); }, [&]() { - BOOST_TEST(wnd.GetPos() == renderSize - DrawPoint(wndSizeL.x, minHeight)); - BOOST_TEST(wnd.GetPos() == settings.lastPos); + BOOST_TEST(wnd.getPos() == renderSize - DrawPoint(wndSizeL.x, minHeight)); + BOOST_TEST(wnd.getPos() == settings.lastPos); BOOST_TEST(restorePos == settings.restorePos); - BOOST_TEST(wnd.GetSize() == Extent(wndSizeL.x, minHeight)); + BOOST_TEST(wnd.getSize() == Extent(wndSizeL.x, minHeight)); }); WindowPositioning_testOne( wnd, "Decrease size, window no longer connects with screen edges and should move to restorePos", [&]() { wnd.Resize(wndSizeS); - BOOST_TEST(wnd.GetPos() == restorePos); - BOOST_TEST(wnd.GetPos() == settings.lastPos); + BOOST_TEST(wnd.getPos() == restorePos); + BOOST_TEST(wnd.getPos() == settings.lastPos); BOOST_TEST(restorePos == settings.restorePos); - BOOST_TEST(wnd.GetSize() == wndSizeS); + BOOST_TEST(wnd.getSize() == wndSizeS); }, [&]() { - BOOST_TEST(wnd.GetPos() == restorePos); - BOOST_TEST(wnd.GetPos() == settings.lastPos); + BOOST_TEST(wnd.getPos() == restorePos); + BOOST_TEST(wnd.getPos() == settings.lastPos); BOOST_TEST(restorePos == settings.restorePos); - BOOST_TEST(wnd.GetSize() == Extent(wndSizeS.x, minHeight)); + BOOST_TEST(wnd.getSize() == Extent(wndSizeS.x, minHeight)); }); } @@ -552,44 +552,44 @@ BOOST_AUTO_TEST_CASE(WindowPositioning) constexpr auto cursorOffset = DrawPoint(-20, wndSizeM.y / 2); const auto restorePos = renderSize - offset; // initial window position is also the restorePos - VIDEODRIVER.SetMousePos(restorePos + cursorOffset); - BOOST_REQUIRE(VIDEODRIVER.GetMousePos() == (restorePos + cursorOffset)); + VIDEODRIVER.setMousePos(restorePos + cursorOffset); + BOOST_REQUIRE(VIDEODRIVER.getMousePos() == (restorePos + cursorOffset)); IngameWindow wnd(idNonPersisted, IngameWindow::posAtMouse, wndSizeM, "Test Window", nullptr); WindowPositioning_testOne( wnd, "Window should be at cursor", [&]() { - BOOST_TEST(wnd.GetPos() == restorePos); - BOOST_TEST(wnd.GetSize() == wndSizeM); + BOOST_TEST(wnd.getPos() == restorePos); + BOOST_TEST(wnd.getSize() == wndSizeM); }, [&]() { - BOOST_TEST(wnd.GetPos() == restorePos); - BOOST_TEST(wnd.GetSize() == Extent(wndSizeM.x, minHeight)); + BOOST_TEST(wnd.getPos() == restorePos); + BOOST_TEST(wnd.getSize() == Extent(wndSizeM.x, minHeight)); }); WindowPositioning_testOne( wnd, "Increase size, window connects with screen edges and should move", [&]() { wnd.Resize(wndSizeL); - BOOST_TEST(wnd.GetPos() == DrawPoint(renderSize - wndSizeL)); - BOOST_TEST(wnd.GetSize() == wndSizeL); + BOOST_TEST(wnd.getPos() == DrawPoint(renderSize - wndSizeL)); + BOOST_TEST(wnd.getSize() == wndSizeL); }, [&]() { - BOOST_TEST(wnd.GetPos() == renderSize - DrawPoint(wndSizeL.x, minHeight)); - BOOST_TEST(wnd.GetSize() == Extent(wndSizeL.x, minHeight)); + BOOST_TEST(wnd.getPos() == renderSize - DrawPoint(wndSizeL.x, minHeight)); + BOOST_TEST(wnd.getSize() == Extent(wndSizeL.x, minHeight)); }); WindowPositioning_testOne( wnd, "Decrease size, window no longer connects with screen edges and should move to restorePos", [&]() { wnd.Resize(wndSizeS); - BOOST_TEST(wnd.GetPos() == restorePos); - BOOST_TEST(wnd.GetSize() == wndSizeS); + BOOST_TEST(wnd.getPos() == restorePos); + BOOST_TEST(wnd.getSize() == wndSizeS); }, [&]() { - BOOST_TEST(wnd.GetPos() == restorePos); - BOOST_TEST(wnd.GetSize() == Extent(wndSizeS.x, minHeight)); + BOOST_TEST(wnd.getPos() == restorePos); + BOOST_TEST(wnd.getSize() == Extent(wndSizeS.x, minHeight)); }); } } @@ -606,37 +606,37 @@ BOOST_AUTO_TEST_CASE(WindowSnapping) std::make_unique(0, DrawPoint(200, 480), Extent(100, 100), "Test Window 2", nullptr))); { - const DrawPoint mousePosRel = DrawPoint(wnd2.GetSize().x / 2, 4); - const MouseCoords evLDown = makeLeftDown(wnd2.GetPos() + mousePosRel); + const DrawPoint mousePosRel = DrawPoint(wnd2.getSize().x / 2, 4); + const MouseCoords evLDown = makeLeftDown(wnd2.getPos() + mousePosRel); wnd2.msgLeftDown(evLDown); { const auto mc = makeLeftDown(evLDown.pos + DrawPoint(-80, 0)); - VIDEODRIVER.SetMousePos(mc.pos); + VIDEODRIVER.setMousePos(mc.pos); wnd2.msgMouseMove(mc); - BOOST_TEST(wnd2.GetPos() == DrawPoint(120, 480)); // Not in snap range yet - BOOST_TEST(VIDEODRIVER.GetMousePos() == (wnd2.GetPos() + mousePosRel)); + BOOST_TEST(wnd2.getPos() == DrawPoint(120, 480)); // Not in snap range yet + BOOST_TEST(VIDEODRIVER.getMousePos() == (wnd2.getPos() + mousePosRel)); } { const auto mc = makeLeftDown(evLDown.pos + DrawPoint(-90, 0)); - VIDEODRIVER.SetMousePos(mc.pos); + VIDEODRIVER.setMousePos(mc.pos); wnd2.msgMouseMove(mc); - BOOST_TEST(wnd2.GetPos() == DrawPoint(100, 480)); // In snap range - BOOST_TEST(VIDEODRIVER.GetMousePos() == mc.pos); + BOOST_TEST(wnd2.getPos() == DrawPoint(100, 480)); // In snap range + BOOST_TEST(VIDEODRIVER.getMousePos() == mc.pos); // Cursor position is off by snap offset - BOOST_TEST((VIDEODRIVER.GetMousePos() - (wnd2.GetPos() + mousePosRel)) == DrawPoint(10, 0)); + BOOST_TEST((VIDEODRIVER.getMousePos() - (wnd2.getPos() + mousePosRel)) == DrawPoint(10, 0)); } { const auto mc = makeLeftDown(evLDown.pos + DrawPoint(-90, 30)); // Reset mouse position to ensure it's properly updated in Msg_MouseMove() - VIDEODRIVER.SetMousePos(Position(0, 0)); + VIDEODRIVER.setMousePos(Position(0, 0)); wnd2.msgMouseMove(mc); - BOOST_TEST(wnd2.GetPos() == DrawPoint(100, 500)); // Still in snap range - BOOST_TEST(VIDEODRIVER.GetMousePos() == Position(mc.pos.x, wnd2.GetPos().y + mousePosRel.y)); + BOOST_TEST(wnd2.getPos() == DrawPoint(100, 500)); // Still in snap range + BOOST_TEST(VIDEODRIVER.getMousePos() == Position(mc.pos.x, wnd2.getPos().y + mousePosRel.y)); // Cursor position is off by snap offset - BOOST_TEST((VIDEODRIVER.GetMousePos() - (wnd2.GetPos() + mousePosRel)) == DrawPoint(10, 0)); + BOOST_TEST((VIDEODRIVER.getMousePos() - (wnd2.getPos() + mousePosRel)) == DrawPoint(10, 0)); } } @@ -645,34 +645,34 @@ BOOST_AUTO_TEST_CASE(WindowSnapping) auto& wnd3 = static_cast(WINDOWMANAGER.Show( std::make_unique(0, DrawPoint(200, 0), Extent(100, 100), "Test Window 3", nullptr))); - const DrawPoint mousePosRel = DrawPoint(wnd3.GetSize().x / 2, 4); - const MouseCoords evLDown = makeLeftDown(wnd3.GetPos() + mousePosRel); + const DrawPoint mousePosRel = DrawPoint(wnd3.getSize().x / 2, 4); + const MouseCoords evLDown = makeLeftDown(wnd3.getPos() + mousePosRel); wnd3.msgLeftDown(evLDown); { - wnd1.SetPos(DrawPoint(0, 0)); - wnd2.SetPos(DrawPoint(5, 0)); + wnd1.setPos(DrawPoint(0, 0)); + wnd2.setPos(DrawPoint(5, 0)); const auto mc = makeLeftDown(evLDown.pos + DrawPoint(-90, 0)); - VIDEODRIVER.SetMousePos(mc.pos); + VIDEODRIVER.setMousePos(mc.pos); wnd3.msgMouseMove(mc); // In snap range of wnd1 and wnd2, but closest to wnd2 - BOOST_TEST(wnd3.GetPos() == DrawPoint(wnd2.GetPos().x + wnd2.GetSize().x, 0)); - BOOST_TEST(VIDEODRIVER.GetMousePos() == mc.pos); + BOOST_TEST(wnd3.getPos() == DrawPoint(wnd2.getPos().x + wnd2.getSize().x, 0)); + BOOST_TEST(VIDEODRIVER.getMousePos() == mc.pos); // Cursor position is off by snap offset - BOOST_TEST((VIDEODRIVER.GetMousePos() - (wnd3.GetPos() + mousePosRel)) == DrawPoint(5, 0)); + BOOST_TEST((VIDEODRIVER.getMousePos() - (wnd3.getPos() + mousePosRel)) == DrawPoint(5, 0)); } { - wnd1.SetPos(DrawPoint(5, 0)); - wnd2.SetPos(DrawPoint(0, 0)); + wnd1.setPos(DrawPoint(5, 0)); + wnd2.setPos(DrawPoint(0, 0)); const auto mc = makeLeftDown(evLDown.pos + DrawPoint(-90, 0)); - VIDEODRIVER.SetMousePos(mc.pos); + VIDEODRIVER.setMousePos(mc.pos); wnd3.msgMouseMove(mc); // In snap range of wnd1 and wnd2, but closest to wnd1 - BOOST_TEST(wnd3.GetPos() == DrawPoint(wnd1.GetPos().x + wnd1.GetSize().x, 0)); - BOOST_TEST(VIDEODRIVER.GetMousePos() == mc.pos); + BOOST_TEST(wnd3.getPos() == DrawPoint(wnd1.getPos().x + wnd1.getSize().x, 0)); + BOOST_TEST(VIDEODRIVER.getMousePos() == mc.pos); // Cursor position is off by snap offset - BOOST_TEST((VIDEODRIVER.GetMousePos() - (wnd3.GetPos() + mousePosRel)) == DrawPoint(5, 0)); + BOOST_TEST((VIDEODRIVER.getMousePos() - (wnd3.getPos() + mousePosRel)) == DrawPoint(5, 0)); } } } diff --git a/tests/s25Main/UI/testMapSelection.cpp b/tests/s25Main/UI/testMapSelection.cpp index 757c730dc3..6c70923e3c 100644 --- a/tests/s25Main/UI/testMapSelection.cpp +++ b/tests/s25Main/UI/testMapSelection.cpp @@ -137,16 +137,16 @@ void testMapSelection(Position const& windowPos, Extent const& windowExtent, Ext // Initial the selection is not set BOOST_TEST(!ms.getSelection()); // Click on non mission area => selection will not change - ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + freeQuadrantMidPoint)); + ms.msgLeftUp(MouseCoords(ms.getPos() + offsetOfBackground + freeQuadrantMidPoint)); BOOST_TEST(!ms.getSelection()); // Click on mission area of first mission => selection will change because mission is playable - ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + firstMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.getPos() + offsetOfBackground + firstMissionMidPoint)); BOOST_TEST(ms.getSelection() == 0u); // Click on mission area of second mission => selection will not change because mission is not playable - ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + secondMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.getPos() + offsetOfBackground + secondMissionMidPoint)); BOOST_TEST(ms.getSelection() == 0u); // Click on mission area of third mission => selection will not change because mission is not playable - ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + thirdMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.getPos() + offsetOfBackground + thirdMissionMidPoint)); BOOST_TEST(ms.getSelection() == 0u); // Activate first and second mission @@ -154,16 +154,16 @@ void testMapSelection(Position const& windowPos, Extent const& windowExtent, Ext // Selection stays the same as before BOOST_TEST(ms.getSelection() == 0u); // Click on mission area of second mission => selection will change because mission is playable - ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + secondMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.getPos() + offsetOfBackground + secondMissionMidPoint)); BOOST_TEST(ms.getSelection() == 1u); // Click on mission area of third mission => selection will not change because mission is not playable - ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + thirdMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.getPos() + offsetOfBackground + thirdMissionMidPoint)); BOOST_TEST(ms.getSelection() == 1u); // Click on non mission area => selection will not change - ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + freeQuadrantMidPoint)); + ms.msgLeftUp(MouseCoords(ms.getPos() + offsetOfBackground + freeQuadrantMidPoint)); BOOST_TEST(ms.getSelection() == 1u); // Click on mission area of first mission => selection will change because mission is playable - ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + firstMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.getPos() + offsetOfBackground + firstMissionMidPoint)); BOOST_TEST(ms.getSelection() == 0u); // Test selection @@ -192,13 +192,13 @@ void testMapSelection(Position const& windowPos, Extent const& windowExtent, Ext ms.setSelection(0); ms.setPreview(true); BOOST_TEST(ms.getSelection() == 0u); - ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + secondMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.getPos() + offsetOfBackground + secondMissionMidPoint)); BOOST_TEST(ms.getSelection() == 0u); - ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + thirdMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.getPos() + offsetOfBackground + thirdMissionMidPoint)); BOOST_TEST(ms.getSelection() == 0u); - ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + freeQuadrantMidPoint)); + ms.msgLeftUp(MouseCoords(ms.getPos() + offsetOfBackground + freeQuadrantMidPoint)); BOOST_TEST(ms.getSelection() == 0u); - ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + firstMissionMidPoint)); + ms.msgLeftUp(MouseCoords(ms.getPos() + offsetOfBackground + firstMissionMidPoint)); BOOST_TEST(ms.getSelection() == 0u); ms.setPreview(false); @@ -217,9 +217,9 @@ void testMapSelection(Position const& windowPos, Extent const& windowExtent, Ext borderPoint.y--; const unsigned deselectIndex = (mid + 1) < midPoints.size() ? (mid + 1) : 0; - ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + midPoints[deselectIndex])); + ms.msgLeftUp(MouseCoords(ms.getPos() + offsetOfBackground + midPoints[deselectIndex])); BOOST_TEST(ms.getSelection() == deselectIndex); - ms.msgLeftUp(MouseCoords(ms.GetPos() + offsetOfBackground + borderPoint)); + ms.msgLeftUp(MouseCoords(ms.getPos() + offsetOfBackground + borderPoint)); BOOST_TEST(ms.getSelection() == mid); } } diff --git a/tests/s25Main/UI/testSmartBitmap.cpp b/tests/s25Main/UI/testSmartBitmap.cpp index d72dda2f9d..4700ccaa35 100644 --- a/tests/s25Main/UI/testSmartBitmap.cpp +++ b/tests/s25Main/UI/testSmartBitmap.cpp @@ -97,7 +97,7 @@ namespace { std::unique_ptr createBmp(Extent size, unsigned percentTransparent) { - const auto* pal = LOADER.GetPaletteN("pal5"); + const auto* pal = LOADER.getPaletteN("pal5"); auto bmp = std::make_unique(); bmp->init(size.x, size.y, TextureFormat::BGRA); const auto offset = rttr::test::randomPoint(-100, 100); @@ -120,7 +120,7 @@ std::unique_ptr createRandBmp(unsigned percentTransparent std::unique_ptr createRandPlayerBmp(unsigned percentTransparent) { - const auto* pal = LOADER.GetPaletteN("colors"); + const auto* pal = LOADER.getPaletteN("colors"); auto bmp = std::make_unique(); const auto size = rttr::test::randomPoint(10, 50); const auto offset = rttr::test::randomPoint(-100, 100); @@ -171,9 +171,9 @@ BOOST_AUTO_TEST_CASE(RegularBitmap) PixelBufferBGRA buffer(size.x * 2 + offset.x, size.y * 2 + offset.y); glSmartBitmap smartBmp; smartBmp.add(bmpSrc.get()); - BOOST_TEST(smartBmp.GetSize() == size); + BOOST_TEST(smartBmp.getSize() == size); BOOST_TEST(smartBmp.getRequiredTexSize() == size); - BOOST_TEST(smartBmp.GetOrigin() == Position(bmpSrc->getNx(), bmpSrc->getNy())); + BOOST_TEST(smartBmp.getOrigin() == Position(bmpSrc->getNx(), bmpSrc->getNy())); smartBmp.drawTo(buffer, offset); Position iSize(size); RTTR_FOREACH_PT(Position, Extent(buffer.getWidth(), buffer.getHeight())) @@ -201,16 +201,16 @@ BOOST_AUTO_TEST_CASE(MultiRegularBitmap) commonOrigin.x = std::max(commonOrigin.x, bmp->getNx()); commonOrigin.y = std::max(commonOrigin.y, bmp->getNy()); } - Extent size = smartBmp.GetSize(); + Extent size = smartBmp.getSize(); for(const auto& bmp : bmps) { size.x = std::max(size.x, bmp->getWidth() + commonOrigin.x - bmp->getNx()); size.y = std::max(size.y, bmp->getHeight() + commonOrigin.y - bmp->getNy()); } - BOOST_TEST(smartBmp.GetSize() == smartBmp.getRequiredTexSize()); + BOOST_TEST(smartBmp.getSize() == smartBmp.getRequiredTexSize()); // Note: We don't test size and origin as they may be adjusted for optimization purposes // which is considered an internal detail - commonOrigin = smartBmp.GetOrigin(); + commonOrigin = smartBmp.getOrigin(); const auto offset = rttr::test::randomPoint(0, 100); // Draw to a large buffer (detect pixels at wrong positions) @@ -247,14 +247,14 @@ BOOST_AUTO_TEST_CASE(PlayerBitmap) { // Fully opaque bitmap so origin and size match auto bmp = createRandPlayerBmp(0); - const auto* pal = LOADER.GetPaletteN("colors"); + const auto* pal = LOADER.getPaletteN("colors"); const Extent size(bmp->getWidth(), bmp->getHeight()); const auto offset = rttr::test::randomPoint(0, 100); glSmartBitmap smartBmp; smartBmp.add(bmp.get()); - BOOST_TEST(smartBmp.GetSize() == size); + BOOST_TEST(smartBmp.getSize() == size); BOOST_TEST(smartBmp.getRequiredTexSize() == Extent(size.x * 2, size.y)); - BOOST_TEST(smartBmp.GetOrigin() == Position(bmp->getNx(), bmp->getNy())); + BOOST_TEST(smartBmp.getOrigin() == Position(bmp->getNx(), bmp->getNy())); PixelBufferBGRA buffer(size.x * 4 + offset.x, size.y * 4 + offset.y); smartBmp.drawTo(buffer, offset); RTTR_FOREACH_PT(Position, Extent(buffer.getWidth(), buffer.getHeight())) @@ -263,10 +263,10 @@ BOOST_AUTO_TEST_CASE(PlayerBitmap) ColorBGRA expectedColor; if(bmpPos.x >= 0 && bmpPos.y >= 0 && bmpPos.y < bmp->getHeight()) { - if(bmpPos.x >= static_cast(smartBmp.GetSize().x)) + if(bmpPos.x >= static_cast(smartBmp.getSize().x)) { // Player color - const int plClrPos = bmpPos.x - smartBmp.GetSize().x; + const int plClrPos = bmpPos.x - smartBmp.getSize().x; if(plClrPos < bmp->getWidth() && bmp->isPlayerColor(plClrPos, bmpPos.y)) { expectedColor = pal->get(bmp->getPlayerColorIdx(plClrPos, bmpPos.y) + 128); @@ -294,7 +294,7 @@ BOOST_AUTO_TEST_CASE(MultiPlayerBitmap) smartBmp.add(bmps.back().get()); } - Extent size = smartBmp.GetSize(); + Extent size = smartBmp.getSize(); BOOST_TEST(smartBmp.getRequiredTexSize() == Extent(size.x * 2, size.y)); Position commonOrigin(bmps[0]->getNx(), bmps[0]->getNy()); @@ -310,25 +310,25 @@ BOOST_AUTO_TEST_CASE(MultiPlayerBitmap) } // Note: We don't test size and origin as they may be adjusted for optimization purposes // which is considered an internal detail - commonOrigin = smartBmp.GetOrigin(); + commonOrigin = smartBmp.getOrigin(); const auto offset = rttr::test::randomPoint(0, 100); // Draw to a large buffer (detect pixels at wrong positions) PixelBufferBGRA buffer(size.x * 4 + offset.x, size.y * 4 + offset.y); smartBmp.drawTo(buffer, offset); - const auto* pal = LOADER.GetPaletteN("colors"); + const auto* pal = LOADER.getPaletteN("colors"); RTTR_FOREACH_PT(Position, Extent(buffer.getWidth(), buffer.getHeight())) { const Position curPos = pt - offset; const bool isPlayerClrRegion = - (curPos.x >= static_cast(smartBmp.GetSize().x) && curPos.x < static_cast(smartBmp.GetSize().x) * 2); + (curPos.x >= static_cast(smartBmp.getSize().x) && curPos.x < static_cast(smartBmp.getSize().x) * 2); // Bitmaps are drawn in order added, so final pixel value is determined by all bitmaps at that position ColorBGRA expectedColor; for(const auto& bmp : bmps) { // Drawing buffer at `pos` - commonOrigin should be equal to drawing bmp at `pos` - origin const Position curOriginOffset = Position(bmp->getNx(), bmp->getNy()) - commonOrigin; - const Position bmpPos = curPos + curOriginOffset - Extent(isPlayerClrRegion ? smartBmp.GetSize().x : 0, 0); + const Position bmpPos = curPos + curOriginOffset - Extent(isPlayerClrRegion ? smartBmp.getSize().x : 0, 0); if(bmpPos.x >= 0 && bmpPos.y >= 0 && bmpPos.x < bmp->getWidth() && bmpPos.y < bmp->getHeight()) { const ColorBGRA color = bmp->getPixel(bmpPos.x, bmpPos.y); diff --git a/tests/s25Main/UI/testVideoDriver.cpp b/tests/s25Main/UI/testVideoDriver.cpp index 6ea0efc60f..ea2cb1698e 100644 --- a/tests/s25Main/UI/testVideoDriver.cpp +++ b/tests/s25Main/UI/testVideoDriver.cpp @@ -23,7 +23,7 @@ static std::ostream& operator<<(std::ostream& os, const VideoMode mode) BOOST_AUTO_TEST_CASE(FindClosestVideoMode) { - auto* driver = uiHelper::GetVideoDriver(); + auto* driver = uiHelper::getVideoDriver(); driver->video_modes_ = {VideoMode(800, 600), VideoMode(1000, 600), VideoMode(1500, 800)}; // Exact match for(const auto& mode : driver->video_modes_) @@ -105,7 +105,7 @@ BOOST_FIXTURE_TEST_CASE(CreateAndDestroyTextures, uiHelper::Fixture) BOOST_AUTO_TEST_CASE(TranslateDimensionsBetweenScreenAndViewSpace) { - auto* driver = uiHelper::GetVideoDriver(); + auto* driver = uiHelper::getVideoDriver(); driver->CreateScreen("", VideoMode(800 * 2, 600 * 2), DisplayMode::Windowed); { @@ -193,7 +193,7 @@ BOOST_AUTO_TEST_CASE(TranslateDimensionsBetweenScreenAndViewSpace) BOOST_AUTO_TEST_CASE(GuiScaleRangeCalculation) { GuiScaleRange range; - auto* driver = uiHelper::GetVideoDriver(); + auto* driver = uiHelper::getVideoDriver(); driver->CreateScreen("", VideoMode(800 * 3, 600 * 3), DisplayMode::Windowed); // Regular DPI configuration @@ -212,7 +212,7 @@ BOOST_AUTO_TEST_CASE(GuiScaleRangeCalculation) // HighDPI configuration (50% larger render size than window size) driver->ResizeScreen(VideoMode(800 * 2, 600 * 2), DisplayMode::Windowed); - driver->SetNewSize(driver->GetWindowSize(), Extent(800 * 3, 600 * 3)); + driver->setNewSize(driver->getWindowSize(), Extent(800 * 3, 600 * 3)); range = driver->getGuiScaleRange(); BOOST_TEST(range.minPercent == 100u); BOOST_TEST(range.maxPercent == (200 * 1.5)); @@ -221,38 +221,38 @@ BOOST_AUTO_TEST_CASE(GuiScaleRangeCalculation) BOOST_AUTO_TEST_CASE(DpiScale) { - auto* driver = uiHelper::GetVideoDriver(); + auto* driver = uiHelper::getVideoDriver(); - driver->SetNewSize(VideoMode(800, 600), Extent(800, 600)); + driver->setNewSize(VideoMode(800, 600), Extent(800, 600)); BOOST_TEST(driver->getDpiScale() == 1.f); - driver->SetNewSize(VideoMode(800, 600), Extent(800 * 3 / 2, 600 * 3 / 2)); + driver->setNewSize(VideoMode(800, 600), Extent(800 * 3 / 2, 600 * 3 / 2)); BOOST_TEST(driver->getDpiScale() == 1.5f); - driver->SetNewSize(VideoMode(800, 600), Extent(800 * 2, 600 * 2)); + driver->setNewSize(VideoMode(800, 600), Extent(800 * 2, 600 * 2)); BOOST_TEST(driver->getDpiScale() == 2.f); } BOOST_AUTO_TEST_CASE(AutoGuiScale) { - auto* driver = uiHelper::GetVideoDriver(); + auto* driver = uiHelper::getVideoDriver(); BOOST_TEST_CONTEXT("Fixed GUI scale") { - driver->SetNewSize(VideoMode(800, 600), Extent(800, 600)); + driver->setNewSize(VideoMode(800, 600), Extent(800, 600)); driver->setGuiScalePercent(100); BOOST_TEST(driver->getDpiScale() == 1.f); BOOST_TEST(driver->getGuiScale().percent() == 100u); // Changing window and render size has no effect on GUI scale, even though DPI scale has changed - driver->SetNewSize(VideoMode(800, 600), Extent(800 * 2, 600 * 2)); + driver->setNewSize(VideoMode(800, 600), Extent(800 * 2, 600 * 2)); BOOST_TEST(driver->getDpiScale() == 2.f); BOOST_TEST(driver->getGuiScale().percent() == 100u); } BOOST_TEST_CONTEXT("Automatic GUI scale") { - driver->SetNewSize(VideoMode(800, 600), Extent(800, 600)); + driver->setNewSize(VideoMode(800, 600), Extent(800, 600)); driver->setGuiScalePercent(0); // Automatic GUI scale is correctly calculated from current sizes @@ -260,7 +260,7 @@ BOOST_AUTO_TEST_CASE(AutoGuiScale) BOOST_TEST(driver->getGuiScale().percent() == 100u); // After changing window and render size, GUI scale is updated based on DPI scale - driver->SetNewSize(VideoMode(800, 600), Extent(800 * 2, 600 * 2)); + driver->setNewSize(VideoMode(800, 600), Extent(800 * 2, 600 * 2)); BOOST_TEST(driver->getDpiScale() == 2.f); BOOST_TEST(driver->getGuiScale().percent() == 200u); } diff --git a/tests/s25Main/UI/testWindowManager.cpp b/tests/s25Main/UI/testWindowManager.cpp index aa34d17e56..52396d6cc4 100644 --- a/tests/s25Main/UI/testWindowManager.cpp +++ b/tests/s25Main/UI/testWindowManager.cpp @@ -44,7 +44,7 @@ struct WMFixture : mock::cleanup { MockupVideoDriver* video; TestDesktop* dsk; - WMFixture() : video(uiHelper::GetVideoDriver()) + WMFixture() : video(uiHelper::getVideoDriver()) { dsk = static_cast(WINDOWMANAGER.Switch(std::make_unique())); MOCK_EXPECT(dsk->msgMouseMove).once().returns(true); @@ -260,13 +260,13 @@ BOOST_FIXTURE_TEST_CASE(ShowIngameWnd, uiHelper::Fixture) MOCK_EXPECT(wnd->DrawContent).once(); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_ACTIVE(wnd); - BOOST_TEST(!WINDOWMANAGER.GetCurrentDesktop()->IsActive()); + BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); // Closing the window removes it and calls delete wnd->Close(); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_DESTROYED(wnd); // Desktop active again - BOOST_TEST(WINDOWMANAGER.GetCurrentDesktop()->IsActive()); + BOOST_TEST(WINDOWMANAGER.getCurrentDesktop()->IsActive()); // Opening a window with the same ID works. The last gets the focus wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); @@ -278,24 +278,24 @@ BOOST_FIXTURE_TEST_CASE(ShowIngameWnd, uiHelper::Fixture) REQUIRE_WINDOW_ALIVE(wnd); REQUIRE_WINDOW_ACTIVE(wnd2); // Desktop inactive again - BOOST_TEST(!WINDOWMANAGER.GetCurrentDesktop()->IsActive()); + BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); // Closing a window and immediately reopening works wnd->Close(); wnd2->Close(); - wnd2 = &WINDOWMANAGER.Show(std::make_unique(wnd->GetID())); + wnd2 = &WINDOWMANAGER.Show(std::make_unique(wnd->getID())); BOOST_TEST_REQUIRE(wnd2); MOCK_EXPECT(wnd2->DrawContent).once(); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_DESTROYED(wnd); REQUIRE_WINDOW_ACTIVE(wnd2); - BOOST_TEST(!WINDOWMANAGER.GetCurrentDesktop()->IsActive()); + BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); // Close by ID - WINDOWMANAGER.Close(wnd2->GetID()); + WINDOWMANAGER.Close(wnd2->getID()); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_DESTROYED(wnd2); - BOOST_TEST(WINDOWMANAGER.GetCurrentDesktop()->IsActive()); + BOOST_TEST(WINDOWMANAGER.getCurrentDesktop()->IsActive()); mock::verify(); } @@ -307,7 +307,7 @@ BOOST_FIXTURE_TEST_CASE(ToggleIngameWnd, uiHelper::Fixture) MOCK_EXPECT(wnd->DrawContent).once(); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_ACTIVE(wnd); - BOOST_TEST(!WINDOWMANAGER.GetCurrentDesktop()->IsActive()); + BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); // When window is about to be closed we can open a new one wnd->Close(); @@ -317,17 +317,17 @@ BOOST_FIXTURE_TEST_CASE(ToggleIngameWnd, uiHelper::Fixture) WINDOWMANAGER.Draw(); REQUIRE_WINDOW_ACTIVE(wnd2); REQUIRE_WINDOW_DESTROYED(wnd); - BOOST_TEST(!WINDOWMANAGER.GetCurrentDesktop()->IsActive()); + BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); // Opening a window with the same ID closes and frees both wnd = wnd2; - wnd2 = new TestIngameWnd(wnd->GetID()); + wnd2 = new TestIngameWnd(wnd->getID()); BOOST_TEST((WINDOWMANAGER.ToggleWindow(std::unique_ptr(wnd2)) == nullptr)); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_DESTROYED(wnd); REQUIRE_WINDOW_DESTROYED(wnd2); // Desktop active again - BOOST_TEST(WINDOWMANAGER.GetCurrentDesktop()->IsActive()); + BOOST_TEST(WINDOWMANAGER.getCurrentDesktop()->IsActive()); // Windows with different IDs are fine wnd = WINDOWMANAGER.ToggleWindow(std::make_unique(CGI_HELP)); @@ -350,7 +350,7 @@ BOOST_FIXTURE_TEST_CASE(ReplaceIngameWnd, uiHelper::Fixture) MOCK_EXPECT(wnd->DrawContent).once(); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_ACTIVE(wnd); - BOOST_TEST(!WINDOWMANAGER.GetCurrentDesktop()->IsActive()); + BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); // When window is about to be closed we can open a new one wnd->Close(); @@ -360,7 +360,7 @@ BOOST_FIXTURE_TEST_CASE(ReplaceIngameWnd, uiHelper::Fixture) WINDOWMANAGER.Draw(); REQUIRE_WINDOW_ACTIVE(wnd2); REQUIRE_WINDOW_DESTROYED(wnd); - BOOST_TEST(!WINDOWMANAGER.GetCurrentDesktop()->IsActive()); + BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); // Opening a window with the same ID closes and frees the first wnd = wnd2; @@ -370,7 +370,7 @@ BOOST_FIXTURE_TEST_CASE(ReplaceIngameWnd, uiHelper::Fixture) WINDOWMANAGER.Draw(); REQUIRE_WINDOW_DESTROYED(wnd); REQUIRE_WINDOW_ACTIVE(wnd2); - BOOST_TEST(!WINDOWMANAGER.GetCurrentDesktop()->IsActive()); + BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); // Windows with different IDs are fine wnd = wnd2; @@ -405,20 +405,20 @@ BOOST_FIXTURE_TEST_CASE(ModalWindowPlacement, uiHelper::Fixture) MOCK_EXPECT(wnd.DrawContent).once(); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_ACTIVE(&wnd); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == &wnd); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == &wnd); auto& wnd2 = WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_MSGBOX, true)); MOCK_EXPECT(wnd.DrawContent).once(); MOCK_EXPECT(wnd2.DrawContent).once(); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_ACTIVE(&wnd2); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == &wnd2); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == &wnd2); auto& wnd3 = WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_MISSION_STATEMENT, true)); MOCK_EXPECT(wnd.DrawContent).once(); MOCK_EXPECT(wnd2.DrawContent).once(); MOCK_EXPECT(wnd3.DrawContent).once(); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_ACTIVE(&wnd3); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == &wnd3); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == &wnd3); auto& wnd4 = WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_MSGBOX)); MOCK_EXPECT(wnd.DrawContent).once(); MOCK_EXPECT(wnd2.DrawContent).once(); @@ -426,7 +426,7 @@ BOOST_FIXTURE_TEST_CASE(ModalWindowPlacement, uiHelper::Fixture) MOCK_EXPECT(wnd4.DrawContent).once(); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_ACTIVE(&wnd3); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == &wnd3); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == &wnd3); auto& wnd5 = WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_HELP, true)); MOCK_EXPECT(wnd.DrawContent).once(); MOCK_EXPECT(wnd2.DrawContent).once(); @@ -435,7 +435,7 @@ BOOST_FIXTURE_TEST_CASE(ModalWindowPlacement, uiHelper::Fixture) MOCK_EXPECT(wnd5.DrawContent).once(); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_ACTIVE(&wnd5); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == &wnd5); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == &wnd5); auto& wnd6 = WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_SETTINGS)); MOCK_EXPECT(wnd.DrawContent).once(); MOCK_EXPECT(wnd2.DrawContent).once(); @@ -445,7 +445,7 @@ BOOST_FIXTURE_TEST_CASE(ModalWindowPlacement, uiHelper::Fixture) MOCK_EXPECT(wnd6.DrawContent).once(); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_ACTIVE(&wnd5); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == &wnd5); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == &wnd5); // Now we have the following order std::vector expectedOrder = {&wnd5, &wnd3, &wnd2, &wnd, &wnd6, &wnd4}; // Only way to check the order is to simulate a key event, expect the top most one to handle it and close it, then @@ -472,22 +472,22 @@ BOOST_FIXTURE_TEST_CASE(ModalBlocksMouseActivation, uiHelper::Fixture) { auto* wndA = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); auto* wndB = &WINDOWMANAGER.Show(std::make_unique(CGI_SETTINGS, true)); - wndB->SetPos(DrawPoint(200, 200)); + wndB->setPos(DrawPoint(200, 200)); MOCK_EXPECT(wndA->DrawContent).once(); MOCK_EXPECT(wndB->DrawContent).once(); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_ACTIVE(wndB); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wndB); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wndB); // Click is over non-modal A, not modal B; B must still receive it instead of the window under the cursor. - const Position posInA = wndA->GetDrawPos() + Position(10, 10); + const Position posInA = wndA->getDrawPos() + Position(10, 10); MOCK_EXPECT(wndB->msgLeftDown).once().returns(true); MouseCoords mcDown(posInA); mcDown.ldown = true; WINDOWMANAGER.msgLeftDown(mcDown); WINDOWMANAGER.msgLeftUp(MouseCoords(posInA)); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wndB); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wndB); REQUIRE_WINDOW_ACTIVE(wndB); BOOST_TEST(!wndA->IsActive()); mock::verify(); @@ -496,14 +496,14 @@ BOOST_FIXTURE_TEST_CASE(ModalBlocksMouseActivation, uiHelper::Fixture) MouseCoords mcMiddle(posInA); mcMiddle.mdown = true; WINDOWMANAGER.msgMiddleDown(mcMiddle); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wndB); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wndB); BOOST_TEST(!wndA->IsActive()); mock::verify(); // Wheel events must respect modal blocking too; the stack/active state must stay unchanged regardless. WINDOWMANAGER.msgWheelUp(MouseCoords(posInA)); WINDOWMANAGER.msgWheelDown(MouseCoords(posInA)); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wndB); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wndB); REQUIRE_WINDOW_ACTIVE(wndB); BOOST_TEST(!wndA->IsActive()); } @@ -518,16 +518,16 @@ BOOST_FIXTURE_TEST_CASE(BuriedModalClosedByGame, uiHelper::Fixture) MOCK_EXPECT(wndC->DrawContent).once(); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_ACTIVE(wndC); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wndC); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wndC); // Topmost C must remain topmost after non-topmost B is closed - WINDOWMANAGER.Close(wndB->GetID()); + WINDOWMANAGER.Close(wndB->getID()); MOCK_EXPECT(wndA->DrawContent).once(); MOCK_EXPECT(wndC->DrawContent).once(); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_DESTROYED(wndB); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wndC); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wndC); REQUIRE_WINDOW_ACTIVE(wndC); REQUIRE_WINDOW_ALIVE(wndA); mock::verify(); @@ -537,32 +537,32 @@ BOOST_FIXTURE_TEST_CASE(ClickActivatesBackgroundNonModal, uiHelper::Fixture) { auto* wndA = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); auto* wndB = &WINDOWMANAGER.Show(std::make_unique(CGI_SETTINGS)); - wndB->SetPos(DrawPoint(200, 200)); + wndB->setPos(DrawPoint(200, 200)); MOCK_EXPECT(wndA->DrawContent).once(); MOCK_EXPECT(wndB->DrawContent).once(); WINDOWMANAGER.Draw(); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wndB); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wndB); REQUIRE_WINDOW_ACTIVE(wndB); BOOST_TEST(!wndA->IsActive()); // B is topmost, click is over A which must become topmost/active MOCK_EXPECT(wndA->msgLeftDown).once().returns(true); - MouseCoords mcDownA(wndA->GetDrawPos() + Position(10, 10)); + MouseCoords mcDownA(wndA->getDrawPos() + Position(10, 10)); mcDownA.ldown = true; WINDOWMANAGER.msgLeftDown(mcDownA); WINDOWMANAGER.msgLeftUp(MouseCoords(mcDownA.pos)); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wndA); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wndA); REQUIRE_WINDOW_ACTIVE(wndA); BOOST_TEST(!wndB->IsActive()); mock::verify(); // A is topmost, click is over B which must become topmost/active again MOCK_EXPECT(wndB->msgLeftDown).once().returns(true); - MouseCoords mcDownB(wndB->GetDrawPos() + Position(10, 10)); + MouseCoords mcDownB(wndB->getDrawPos() + Position(10, 10)); mcDownB.ldown = true; WINDOWMANAGER.msgLeftDown(mcDownB); WINDOWMANAGER.msgLeftUp(MouseCoords(mcDownB.pos)); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wndB); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wndB); REQUIRE_WINDOW_ACTIVE(wndB); BOOST_TEST(!wndA->IsActive()); mock::verify(); @@ -571,11 +571,11 @@ BOOST_FIXTURE_TEST_CASE(ClickActivatesBackgroundNonModal, uiHelper::Fixture) BOOST_FIXTURE_TEST_CASE(EscClosesWindow, uiHelper::Fixture) { auto* wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); const KeyEvent evEsc(KeyType::Escape); WINDOWMANAGER.msgKeyDown(evEsc); WINDOWMANAGER.Draw(); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == nullptr); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == nullptr); REQUIRE_WINDOW_DESTROYED(wnd); // Multiple escapes close multiple windows, even modal ones @@ -586,7 +586,7 @@ BOOST_FIXTURE_TEST_CASE(EscClosesWindow, uiHelper::Fixture) WINDOWMANAGER.msgKeyDown(evEsc); MOCK_EXPECT(wnd1->DrawContent).once(); WINDOWMANAGER.Draw(); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd1); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd1); REQUIRE_WINDOW_DESTROYED(wnd2); REQUIRE_WINDOW_DESTROYED(wnd3); WINDOWMANAGER.msgKeyDown(evEsc); @@ -595,33 +595,33 @@ BOOST_FIXTURE_TEST_CASE(EscClosesWindow, uiHelper::Fixture) // ESC does not close non-user-closable windows wnd1 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, false, CloseBehavior::Custom)); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd1); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd1); WINDOWMANAGER.msgKeyDown(evEsc); REQUIRE_WINDOW_ALIVE(wnd1); MOCK_EXPECT(wnd1->DrawContent).once(); WINDOWMANAGER.Draw(); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd1); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd1); wnd2 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, true, CloseBehavior::Custom)); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd2); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd2); WINDOWMANAGER.msgKeyDown(evEsc); REQUIRE_WINDOW_ALIVE(wnd1); REQUIRE_WINDOW_ALIVE(wnd2); MOCK_EXPECT(wnd1->DrawContent).once(); MOCK_EXPECT(wnd2->DrawContent).once(); WINDOWMANAGER.Draw(); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd2); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd2); } BOOST_FIXTURE_TEST_CASE(RightclickClosesWindow, uiHelper::Fixture) { auto* wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); - MouseCoords evRDown(wnd->GetDrawPos() + Position(10, 10)); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); + MouseCoords evRDown(wnd->getDrawPos() + Position(10, 10)); evRDown.rdown = true; WINDOWMANAGER.msgRightDown(evRDown); WINDOWMANAGER.Draw(); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == nullptr); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == nullptr); REQUIRE_WINDOW_DESTROYED(wnd); // Only close top most window @@ -630,7 +630,7 @@ BOOST_FIXTURE_TEST_CASE(RightclickClosesWindow, uiHelper::Fixture) WINDOWMANAGER.msgRightDown(evRDown); MOCK_EXPECT(wnd1->DrawContent).once(); WINDOWMANAGER.Draw(); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd1); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd1); REQUIRE_WINDOW_DESTROYED(wnd2); // Also modal windows, even when not opened last wnd2 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, true)); @@ -641,7 +641,7 @@ BOOST_FIXTURE_TEST_CASE(RightclickClosesWindow, uiHelper::Fixture) MOCK_EXPECT(wnd1->DrawContent).once(); MOCK_EXPECT(wnd3->DrawContent).once(); WINDOWMANAGER.Draw(); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd3); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd3); REQUIRE_WINDOW_DESTROYED(wnd2); WINDOWMANAGER.msgRightDown(evRDown); MOCK_EXPECT(wnd1->DrawContent).once(); @@ -653,19 +653,19 @@ BOOST_FIXTURE_TEST_CASE(RightclickClosesWindow, uiHelper::Fixture) // Don't close non-user-closable windows wnd1 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, false, CloseBehavior::Custom)); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd1); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd1); WINDOWMANAGER.msgRightDown(evRDown); MOCK_EXPECT(wnd1->DrawContent).once(); WINDOWMANAGER.Draw(); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd1); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd1); wnd2 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, true, CloseBehavior::NoRightClick)); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd2); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd2); WINDOWMANAGER.msgRightDown(evRDown); MOCK_EXPECT(wnd1->DrawContent).once(); MOCK_EXPECT(wnd2->DrawContent).once(); WINDOWMANAGER.Draw(); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd2); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd2); } BOOST_FIXTURE_TEST_CASE(PinnedWindows, uiHelper::Fixture) @@ -678,17 +678,17 @@ BOOST_FIXTURE_TEST_CASE(PinnedWindows, uiHelper::Fixture) { auto* wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); - wnd->SetPinned(); + wnd->setPinned(); BOOST_TEST_CONTEXT("Pinned") { - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); WINDOWMANAGER.msgKeyDown(evEsc); MOCK_EXPECT(wnd->DrawContent).once(); WINDOWMANAGER.Draw(); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); } - wnd->SetPinned(false); + wnd->setPinned(false); BOOST_TEST_CONTEXT("Un-pinned") { WINDOWMANAGER.msgKeyDown(evEsc); @@ -701,10 +701,10 @@ BOOST_FIXTURE_TEST_CASE(PinnedWindows, uiHelper::Fixture) { auto* wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); - wnd->SetPinned(); + wnd->setPinned(); BOOST_TEST_CONTEXT("Pinned") { - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); WINDOWMANAGER.msgKeyDown(evAltW); WINDOWMANAGER.Draw(); REQUIRE_WINDOW_DESTROYED(wnd); @@ -714,20 +714,20 @@ BOOST_FIXTURE_TEST_CASE(PinnedWindows, uiHelper::Fixture) BOOST_TEST_CONTEXT("Pinned windows ignore right click") { auto* wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); - MouseCoords evRDown(wnd->GetDrawPos() + Position(10, 10)); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); + MouseCoords evRDown(wnd->getDrawPos() + Position(10, 10)); evRDown.rdown = true; - wnd->SetPinned(); + wnd->setPinned(); BOOST_TEST_CONTEXT("Pinned") { WINDOWMANAGER.msgRightDown(evRDown); MOCK_EXPECT(wnd->DrawContent).once(); WINDOWMANAGER.Draw(); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); } - wnd->SetPinned(false); + wnd->setPinned(false); BOOST_TEST_CONTEXT("Un-pinned") { WINDOWMANAGER.msgRightDown(evRDown); @@ -747,13 +747,13 @@ BOOST_FIXTURE_TEST_CASE(SnapWindow, uiHelper::Fixture) auto* wnd = &WINDOWMANAGER.Show(std::make_unique(0, DrawPoint(100, 0), Extent(100, 100), "", nullptr)); - BOOST_TEST(WINDOWMANAGER.snapWindow(wnd, wnd->GetBoundaryRect()) == SnapOffset(0, 0)); + BOOST_TEST(WINDOWMANAGER.snapWindow(wnd, wnd->getBoundaryRect()) == SnapOffset(0, 0)); - wnd->SetPos(DrawPoint(111, 5)); - BOOST_TEST(WINDOWMANAGER.snapWindow(wnd, wnd->GetBoundaryRect()) == SnapOffset(0, 0)); + wnd->setPos(DrawPoint(111, 5)); + BOOST_TEST(WINDOWMANAGER.snapWindow(wnd, wnd->getBoundaryRect()) == SnapOffset(0, 0)); - wnd->SetPos(DrawPoint(110, 5)); - BOOST_TEST(WINDOWMANAGER.snapWindow(wnd, wnd->GetBoundaryRect()) == SnapOffset(-10, -5)); + wnd->setPos(DrawPoint(110, 5)); + BOOST_TEST(WINDOWMANAGER.snapWindow(wnd, wnd->getBoundaryRect()) == SnapOffset(-10, -5)); } MOCK_BASE_CLASS(MockSettingsWnd, TransmitSettingsIgwAdapter) @@ -800,24 +800,24 @@ BOOST_FIXTURE_TEST_CASE(TestTransmitSettingsAdapter, uiHelper::Fixture) { // Save settings on ESC wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_TOOLS)); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); MOCK_EXPECT(wnd->TransmitSettings).once(); WINDOWMANAGER.msgKeyDown(KeyEvent(KeyType::Escape)); WINDOWMANAGER.Draw(); BOOST_TEST(MockSettingsWnd::activeWnds == 0); - BOOST_TEST(WINDOWMANAGER.GetTopMostWindow() == nullptr); + BOOST_TEST(WINDOWMANAGER.getTopMostWindow() == nullptr); } { // Save settings on ALT+W wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_TOOLS)); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == wnd); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); MOCK_EXPECT(wnd->TransmitSettings).once(); KeyEvent ke('w'); ke.alt = true; WINDOWMANAGER.msgKeyDown(ke); WINDOWMANAGER.Draw(); BOOST_TEST(MockSettingsWnd::activeWnds == 0); - BOOST_TEST(WINDOWMANAGER.GetTopMostWindow() == nullptr); + BOOST_TEST(WINDOWMANAGER.getTopMostWindow() == nullptr); } mock::verify(); } diff --git a/tests/s25Main/UI/testWindows.cpp b/tests/s25Main/UI/testWindows.cpp index d835b3576c..e64bf4353d 100644 --- a/tests/s25Main/UI/testWindows.cpp +++ b/tests/s25Main/UI/testWindows.cpp @@ -50,18 +50,18 @@ BOOST_AUTO_TEST_CASE(Victory) winnerNames.push_back("BarNameBaz"); const iwVictory wnd(winnerNames); // 2 buttons - BOOST_TEST_REQUIRE(wnd.GetCtrls().size() == 2u); + BOOST_TEST_REQUIRE(wnd.getCtrls().size() == 2u); // Find a text field containing all winner names - const auto txts = wnd.GetCtrls(); + const auto txts = wnd.getCtrls(); bool found = false; for(const ctrlMultiline* txt : txts) { - if(txt->GetNumLines() != winnerNames.size()) + if(txt->getNumLines() != winnerNames.size()) continue; // LCOV_EXCL_LINE bool curFound = true; for(unsigned i = 0; i < winnerNames.size(); i++) { - curFound &= txt->GetLine(i) == winnerNames[i]; + curFound &= txt->getLine(i) == winnerNames[i]; } found |= curFound; } @@ -73,27 +73,27 @@ BOOST_AUTO_TEST_CASE(AddonWindow) GlobalGameSettings ggs; const iwAddons wndAllChangeable(ggs, nullptr, AddonChangeAllowed::All); const iwAddons wndAllReadOnly(ggs, nullptr, AddonChangeAllowed::None); - const auto addonsChangeableGui = wndAllChangeable.GetCtrls(); + const auto addonsChangeableGui = wndAllChangeable.getCtrls(); BOOST_TEST_REQUIRE(addonsChangeableGui.size() == ggs.getNumAddons() + 1); // First element is the option group - const auto addonsReadonlyGui = wndAllReadOnly.GetCtrls(); + const auto addonsReadonlyGui = wndAllReadOnly.getCtrls(); BOOST_TEST_REQUIRE(addonsReadonlyGui.size() == ggs.getNumAddons() + 1); for(unsigned i = 1; i <= ggs.getNumAddons(); ++i) { const ctrlGroup* changeableGroup = addonsChangeableGui[i]; const ctrlGroup* readonlyGroup = addonsReadonlyGui[i]; // No lock icon - BOOST_TEST(changeableGroup->GetCtrls().empty()); + BOOST_TEST(changeableGroup->getCtrls().empty()); // Lock icon - BOOST_TEST_REQUIRE(!readonlyGroup->GetCtrls().empty()); + BOOST_TEST_REQUIRE(!readonlyGroup->getCtrls().empty()); // Verify it is the lock icon with tooltip - BOOST_TEST_REQUIRE(readonlyGroup->GetCtrls()[0]->GetTooltip() == _("Locked")); - for(const auto* checkbox : changeableGroup->GetCtrls()) + BOOST_TEST_REQUIRE(readonlyGroup->getCtrls()[0]->getTooltip() == _("Locked")); + for(const auto* checkbox : changeableGroup->getCtrls()) BOOST_TEST_REQUIRE(!checkbox->isReadOnly()); - for(const auto* checkbox : readonlyGroup->GetCtrls()) + for(const auto* checkbox : readonlyGroup->getCtrls()) BOOST_TEST_REQUIRE(checkbox->isReadOnly()); - for(const auto* cb : changeableGroup->GetCtrls()) + for(const auto* cb : changeableGroup->getCtrls()) BOOST_TEST_REQUIRE(!cb->isReadOnly()); - for(const auto* cb : readonlyGroup->GetCtrls()) + for(const auto* cb : readonlyGroup->getCtrls()) BOOST_TEST_REQUIRE(cb->isReadOnly()); } } @@ -106,9 +106,9 @@ BOOST_FIXTURE_TEST_CASE(JumpWindow, SmallWorldFixture) GameWorldView view(gwv, Position(0, 0), Extent(100, 100)); iwSkipGFs wnd(view); // At least 4 buttons for "jump by x" and at least 1 extra for "jump to" - const auto bts = wnd.GetCtrls(); + const auto bts = wnd.getCtrls(); BOOST_TEST(bts.size() > 4); - const auto numIncBts = helpers::count_if(bts, [](const ctrlTextButton* bt) { return bt->GetText().at(0) == '+'; }); + const auto numIncBts = helpers::count_if(bts, [](const ctrlTextButton* bt) { return bt->getText().at(0) == '+'; }); BOOST_TEST(numIncBts >= 4); } @@ -124,27 +124,27 @@ struct AddonPresetFixture : uiHelper::Fixture // Selects the named preset, false if there is no such preset static bool select(Window& wnd, const std::string& name) { - auto& table = *wnd.GetCtrls().at(0); - for(unsigned short i = 0; i < table.GetNumRows(); ++i) + auto& table = *wnd.getCtrls().at(0); + for(unsigned short i = 0; i < table.getNumRows(); ++i) { - if(table.GetItemText(i, 0) == name) + if(table.getItemText(i, 0) == name) { - table.SetSelection(i); + table.setSelection(i); return true; } } return false; } - static iwMsgbox* topMsgbox() { return dynamic_cast(WINDOWMANAGER.GetTopMostWindow()); } + static iwMsgbox* topMsgbox() { return dynamic_cast(WINDOWMANAGER.getTopMostWindow()); } static bool mentions(const iwMsgbox& msgbox, const std::string& name) { bool found = false; - for(const auto* ml : msgbox.GetCtrls()) + for(const auto* ml : msgbox.getCtrls()) { - for(unsigned i = 0; i < ml->GetNumLines(); ++i) - found |= ml->GetLine(i).find(name) != std::string::npos; + for(unsigned i = 0; i < ml->getNumLines(); ++i) + found |= ml->getLine(i).find(name) != std::string::npos; } return found; } @@ -164,7 +164,7 @@ struct AddonPresetFixture : uiHelper::Fixture { iwSaveAddonPreset wnd(states); Window& base = wnd; - base.GetCtrls().at(0)->SetText(name); + base.getCtrls().at(0)->setText(name); base.msgButtonClick(iwAddonPresetsBase::ID_btAction); } @@ -183,7 +183,7 @@ struct AddonPresetFixture : uiHelper::Fixture unsigned numPresets() { iwLoadAddonPreset wnd([](const std::map&) noexcept {}); - return wnd.GetCtrls().at(0)->GetNumRows(); + return wnd.getCtrls().at(0)->getNumRows(); } }; } // namespace @@ -205,11 +205,11 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetOverwrite, AddonPresetFixture) { iwSaveAddonPreset wnd(newStates); Window& base = wnd; - base.GetCtrls().at(0)->SetText("myPreset"); + base.getCtrls().at(0)->setText("myPreset"); base.msgEditEnter(0); const auto& msgbox = ensureNonNull(topMsgbox()); - BOOST_TEST(msgbox.GetTitle() == _("Overwrite Preset")); + BOOST_TEST(msgbox.getTitle() == _("Overwrite Preset")); BOOST_TEST(mentions(msgbox, "myPreset")); answerMsgbox(base, iwSaveAddonPreset::ID_mbOverwrite, MsgboxResult::No); @@ -220,7 +220,7 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetOverwrite, AddonPresetFixture) { iwSaveAddonPreset wnd(newStates); Window& base = wnd; - base.GetCtrls().at(0)->SetText("myPreset"); + base.getCtrls().at(0)->setText("myPreset"); base.msgEditEnter(0); answerMsgbox(base, iwSaveAddonPreset::ID_mbOverwrite, MsgboxResult::Yes); } @@ -275,7 +275,7 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetLoadCorrupt, AddonPresetFixture) BOOST_TEST(numLoaded == 1u); // nothing is applied from a corrupt preset auto& msgbox = ensureNonNull(topMsgbox()); - BOOST_TEST(msgbox.GetTitle() == _("Load Failed")); + BOOST_TEST(msgbox.getTitle() == _("Load Failed")); closeMsgbox(msgbox); } @@ -288,14 +288,14 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetSaveUnwritable, AddonPresetFixture) const std::map states{{1, 2}}; iwSaveAddonPreset wnd(states); Window& base = wnd; - base.GetCtrls().at(0)->SetText("blocked"); + base.getCtrls().at(0)->setText("blocked"); base.msgButtonClick(iwAddonPresetsBase::ID_btAction); answerMsgbox(base, iwSaveAddonPreset::ID_mbOverwrite, MsgboxResult::Yes); auto& msgbox = ensureNonNull(topMsgbox()); - BOOST_TEST(msgbox.GetTitle() == _("Save Failed")); + BOOST_TEST(msgbox.getTitle() == _("Save Failed")); BOOST_TEST(!wnd.ShouldBeClosed()); - BOOST_TEST(base.GetCtrls().at(0)->GetText() == "blocked"); + BOOST_TEST(base.getCtrls().at(0)->getText() == "blocked"); closeMsgbox(msgbox); } @@ -310,27 +310,27 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetSaveNameFollowsSelection, AddonPresetFixture) iwSaveAddonPreset wnd(statesNew); Window& base = wnd; - const auto& deleteBtn = ensureNonNull(wnd.GetCtrl(iwAddonPresetsBase::ID_btDelete)); - BOOST_TEST(!deleteBtn.GetEnabled()); - auto& edit = *wnd.GetCtrls().at(0); - auto& table = *wnd.GetCtrls().at(0); + const auto& deleteBtn = ensureNonNull(wnd.getCtrl(iwAddonPresetsBase::ID_btDelete)); + BOOST_TEST(!deleteBtn.getEnabled()); + auto& edit = *wnd.getCtrls().at(0); + auto& table = *wnd.getCtrls().at(0); // Rows are sorted ascending, so row 0 is presetA - table.SetSelection(0u); - BOOST_TEST_REQUIRE(edit.GetText() == "presetA"); - BOOST_TEST(deleteBtn.GetEnabled()); - table.SetSelection(1u); - BOOST_TEST(edit.GetText() == "presetB"); // correct name for a non-first row - table.SetSelection(std::nullopt); - BOOST_TEST(edit.GetText() == "presetB"); // only picking a preset replaces the name - BOOST_TEST(!deleteBtn.GetEnabled()); + table.setSelection(0u); + BOOST_TEST_REQUIRE(edit.getText() == "presetA"); + BOOST_TEST(deleteBtn.getEnabled()); + table.setSelection(1u); + BOOST_TEST(edit.getText() == "presetB"); // correct name for a non-first row + table.setSelection(std::nullopt); + BOOST_TEST(edit.getText() == "presetB"); // only picking a preset replaces the name + BOOST_TEST(!deleteBtn.getEnabled()); // User now types a new name after having selected a preset - table.SetSelection(0u); - BOOST_TEST_REQUIRE(deleteBtn.GetEnabled()); - edit.SetText("presetC"); + table.setSelection(0u); + BOOST_TEST_REQUIRE(deleteBtn.getEnabled()); + edit.setText("presetC"); // Editing drops the selection, so there is nothing left to delete - BOOST_TEST(!table.GetSelection().has_value()); - BOOST_TEST(!deleteBtn.GetEnabled()); - BOOST_TEST(edit.GetText() == "presetC"); + BOOST_TEST(!table.getSelection().has_value()); + BOOST_TEST(!deleteBtn.getEnabled()); + BOOST_TEST(edit.getText() == "presetC"); base.msgEditEnter(0); BOOST_TEST(numPresets() == 3u); @@ -349,15 +349,15 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetDelete, AddonPresetFixture) base.msgButtonClick(iwAddonPresetsBase::ID_btDelete); const auto& msgbox = ensureNonNull(topMsgbox()); - BOOST_TEST(msgbox.GetTitle() == _("Delete Preset")); + BOOST_TEST(msgbox.getTitle() == _("Delete Preset")); BOOST_TEST(mentions(msgbox, "toDelete")); answerMsgbox(base, iwAddonPresetsBase::ID_mbDelete, MsgboxResult::Yes); BOOST_TEST(numPresets() == 0u); // Deleting drops the selection, so both actions are unavailable again - BOOST_TEST(!ensureNonNull(wnd.GetCtrl(iwAddonPresetsBase::ID_btAction)).GetEnabled()); - BOOST_TEST(!ensureNonNull(wnd.GetCtrl(iwAddonPresetsBase::ID_btDelete)).GetEnabled()); + BOOST_TEST(!ensureNonNull(wnd.getCtrl(iwAddonPresetsBase::ID_btAction)).getEnabled()); + BOOST_TEST(!ensureNonNull(wnd.getCtrl(iwAddonPresetsBase::ID_btDelete)).getEnabled()); } BOOST_FIXTURE_TEST_CASE(AddonPresetSaveWindowCanDelete, AddonPresetFixture) @@ -371,10 +371,10 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetSaveWindowCanDelete, AddonPresetFixture) answerMsgbox(base, iwAddonPresetsBase::ID_mbDelete, MsgboxResult::Yes); BOOST_TEST(numPresets() == 0u); - BOOST_TEST(!ensureNonNull(wnd.GetCtrl(iwAddonPresetsBase::ID_btDelete)).GetEnabled()); + BOOST_TEST(!ensureNonNull(wnd.getCtrl(iwAddonPresetsBase::ID_btDelete)).getEnabled()); // The name stays, so the preset can be saved again right away - BOOST_TEST(base.GetCtrls().at(0)->GetText() == "toDelete"); - BOOST_TEST(ensureNonNull(wnd.GetCtrl(iwAddonPresetsBase::ID_btAction)).GetEnabled()); + BOOST_TEST(base.getCtrls().at(0)->getText() == "toDelete"); + BOOST_TEST(ensureNonNull(wnd.getCtrl(iwAddonPresetsBase::ID_btAction)).getEnabled()); } // Loading and deleting act on the list selection, so both stay unavailable until one is picked. @@ -384,16 +384,16 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetActionsRequireSelection, AddonPresetFixture) iwLoadAddonPreset wnd([](const std::map&) noexcept {}); Window& base = wnd; - const auto& loadBtn = ensureNonNull(wnd.GetCtrl(iwAddonPresetsBase::ID_btAction)); - const auto& deleteBtn = ensureNonNull(wnd.GetCtrl(iwAddonPresetsBase::ID_btDelete)); - BOOST_TEST(wnd.GetCtrls().empty()); // no name field, the list is the only target - BOOST_TEST(!loadBtn.GetEnabled()); - BOOST_TEST(!deleteBtn.GetEnabled()); + const auto& loadBtn = ensureNonNull(wnd.getCtrl(iwAddonPresetsBase::ID_btAction)); + const auto& deleteBtn = ensureNonNull(wnd.getCtrl(iwAddonPresetsBase::ID_btDelete)); + BOOST_TEST(wnd.getCtrls().empty()); // no name field, the list is the only target + BOOST_TEST(!loadBtn.getEnabled()); + BOOST_TEST(!deleteBtn.getEnabled()); BOOST_TEST(!select(base, "notSaved")); BOOST_TEST_REQUIRE(select(base, "exists")); - BOOST_TEST(loadBtn.GetEnabled()); - BOOST_TEST(deleteBtn.GetEnabled()); + BOOST_TEST(loadBtn.getEnabled()); + BOOST_TEST(deleteBtn.getEnabled()); } // Saving needs a name, typed or taken from a picked preset @@ -403,21 +403,21 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetSaveRequiresName, AddonPresetFixture) iwSaveAddonPreset wnd(std::map{{3, 4}}); Window& base = wnd; - const auto& saveBtn = ensureNonNull(wnd.GetCtrl(iwAddonPresetsBase::ID_btAction)); - auto& edit = *wnd.GetCtrls().at(0); - BOOST_TEST(!saveBtn.GetEnabled()); - - edit.SetText(" "); - BOOST_TEST(!saveBtn.GetEnabled()); // spaces alone are no name - edit.SetText("new"); - BOOST_TEST(saveBtn.GetEnabled()); - edit.SetText("nul"); - BOOST_TEST(saveBtn.GetEnabled()); // an invalid name is reported when saving instead - edit.SetText(""); - BOOST_TEST(!saveBtn.GetEnabled()); + const auto& saveBtn = ensureNonNull(wnd.getCtrl(iwAddonPresetsBase::ID_btAction)); + auto& edit = *wnd.getCtrls().at(0); + BOOST_TEST(!saveBtn.getEnabled()); + + edit.setText(" "); + BOOST_TEST(!saveBtn.getEnabled()); // spaces alone are no name + edit.setText("new"); + BOOST_TEST(saveBtn.getEnabled()); + edit.setText("nul"); + BOOST_TEST(saveBtn.getEnabled()); // an invalid name is reported when saving instead + edit.setText(""); + BOOST_TEST(!saveBtn.getEnabled()); BOOST_TEST_REQUIRE(select(base, "exists")); - BOOST_TEST(saveBtn.GetEnabled()); + BOOST_TEST(saveBtn.getEnabled()); } namespace { @@ -433,7 +433,7 @@ MOCK_BASE_CLASS(TestWindow, Window) BOOST_AUTO_TEST_CASE(DrawOrder) { - Desktop* dsk = WINDOWMANAGER.GetCurrentDesktop(); + Desktop* dsk = WINDOWMANAGER.getCurrentDesktop(); std::vector wnds; wnds.reserve(6); // Top level controls diff --git a/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.cpp b/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.cpp index a56dc55b3c..75e67ddb9c 100644 --- a/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.cpp +++ b/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.cpp @@ -24,7 +24,7 @@ void initGUITests() { libsiedler2::setAllocator(new GlAllocator); BOOST_TEST_CHECKPOINT("Load video driver"); - if(!dynamic_cast(VIDEODRIVER.GetDriver())) + if(!dynamic_cast(VIDEODRIVER.getDriver())) { rttr::test::LogAccessor logAcc; VIDEODRIVER.LoadDriver(new MockupVideoDriver(&WINDOWMANAGER)); @@ -44,20 +44,20 @@ void initGUITests() BOOST_TEST_CHECKPOINT("GUI test initialized"); } -MockupVideoDriver* GetVideoDriver() +MockupVideoDriver* getVideoDriver() { - auto* video = dynamic_cast(VIDEODRIVER.GetDriver()); + auto* video = dynamic_cast(VIDEODRIVER.getDriver()); if(!video) { initGUITests(); - video = dynamic_cast(VIDEODRIVER.GetDriver()); + video = dynamic_cast(VIDEODRIVER.getDriver()); } return video; } Fixture::~Fixture() { - if(!dynamic_cast(WINDOWMANAGER.GetCurrentDesktop()) || WINDOWMANAGER.GetTopMostWindow()) + if(!dynamic_cast(WINDOWMANAGER.getCurrentDesktop()) || WINDOWMANAGER.getTopMostWindow()) { // Switch back to new, empty desktop to clean up active windows WINDOWMANAGER.Switch(std::make_unique()); diff --git a/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.hpp b/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.hpp index cde3613918..1c2339f0ea 100644 --- a/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.hpp +++ b/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.hpp @@ -18,5 +18,5 @@ struct Fixture }; /// Return the video driver. Initializes the GUI tests if required -MockupVideoDriver* GetVideoDriver(); +MockupVideoDriver* getVideoDriver(); } // namespace uiHelper diff --git a/tests/s25Main/audio/LoadMockupAudio.h b/tests/s25Main/audio/LoadMockupAudio.h index dfb8d54fca..81133afce6 100644 --- a/tests/s25Main/audio/LoadMockupAudio.h +++ b/tests/s25Main/audio/LoadMockupAudio.h @@ -23,7 +23,7 @@ struct LoadMockupAudio auto driver = std::make_unique(audioCallbackMock.get()); audioDriverMock = driver.get(); AUDIODRIVER.LoadDriver(std::move(driver)); - BOOST_TEST_REQUIRE(AUDIODRIVER.GetName() != ""); + BOOST_TEST_REQUIRE(AUDIODRIVER.getName() != ""); } ~LoadMockupAudio() { AUDIODRIVER.UnloadDriver(); } /// Return a callable to be used with MOCK_EXPECT(...).calls(...) that loads a sound of the given type diff --git a/tests/s25Main/audio/testPlaylist.cpp b/tests/s25Main/audio/testPlaylist.cpp index 6ea7e26126..ff588d1c77 100644 --- a/tests/s25Main/audio/testPlaylist.cpp +++ b/tests/s25Main/audio/testPlaylist.cpp @@ -18,7 +18,7 @@ BOOST_AUTO_TEST_CASE(DefaultConstructedPlaylistIsEmpty) BOOST_TEST(pl.getSongs().empty()); BOOST_TEST(pl.getCurrentSong().empty()); BOOST_TEST(pl.getNextSong().empty()); - pl.SetStartSong(0); // No error + pl.setStartSong(0); // No error BOOST_TEST(pl.getNextSong().empty()); } @@ -150,14 +150,14 @@ BOOST_AUTO_TEST_CASE(SetNextSong) const std::vector songs{"s01", "s02", "s03", "s04", "s05"}; Playlist pl(songs, 0, false); BOOST_TEST(pl.getNextSong() == "s01"); - pl.SetStartSong(3); + pl.setStartSong(3); BOOST_TEST(pl.getNextSong() == "s04"); BOOST_TEST(pl.getNextSong() == "s03"); BOOST_TEST(pl.getNextSong() == "s02"); // Works also when playlist was not started yet (see #1833) pl = Playlist(songs, 0, false); - pl.SetStartSong(3); + pl.setStartSong(3); BOOST_TEST(pl.getNextSong() == "s04"); } diff --git a/tests/s25Main/audio/testSoundManager.cpp b/tests/s25Main/audio/testSoundManager.cpp index 59b4b01af2..f776c341f9 100644 --- a/tests/s25Main/audio/testSoundManager.cpp +++ b/tests/s25Main/audio/testSoundManager.cpp @@ -39,7 +39,7 @@ class DummyNO final : public noBase // LCOV_EXCL_START void Draw(DrawPoint) override {} void Destroy() override {} - GO_Type GetGOT() const override { return GO_Type::Animal; } + GO_Type getGOT() const override { return GO_Type::Animal; } // LCOV_EXCL_STOP }; @@ -56,7 +56,7 @@ struct LoadMockupAudioWithSounds : LoadMockupAudio f << "Test"; } BOOST_TEST_REQUIRE(LOADER.Load(soundPath)); - libsiedler2::Archiv& sounds = LOADER.GetArchive("sound"); + libsiedler2::Archiv& sounds = LOADER.getArchive("sound"); sounds.alloc(115); for(int i = 50; i < 115; ++i) sounds.set(i, std::make_unique()); @@ -129,20 +129,20 @@ BOOST_FIXTURE_TEST_CASE(OceanSounds, LoadMockupAudioWithSounds) // Play on 10% water int volume = -1; - MOCK_EXPECT(audioDriverMock->IsEffectPlaying).once().with(EffectPlayId::Invalid).returns(false); + MOCK_EXPECT(audioDriverMock->isEffectPlaying).once().with(EffectPlayId::Invalid).returns(false); MOCK_EXPECT(audioDriverMock->doPlayEffect).once().with(mock::any, mock::retrieve(volume), true).returns(0); manager.playOceanBrawling(10); mock::verify(); BOOST_TEST(volume > 0); // If already playing don't change it or play again, just adjust volume - MOCK_EXPECT(audioDriverMock->IsEffectPlaying).once().returns(true); + MOCK_EXPECT(audioDriverMock->isEffectPlaying).once().returns(true); MOCK_EXPECT(audioDriverMock->ChangeVolume).once().with(mock::any, volume); manager.playOceanBrawling(10); mock::verify(); // More water -> Sound gets louder - MOCK_EXPECT(audioDriverMock->IsEffectPlaying).once().returns(true); + MOCK_EXPECT(audioDriverMock->isEffectPlaying).once().returns(true); int oldVolume = volume; MOCK_EXPECT(audioDriverMock->ChangeVolume).once().with(mock::any, mock::retrieve(volume)); manager.playOceanBrawling(20); @@ -150,7 +150,7 @@ BOOST_FIXTURE_TEST_CASE(OceanSounds, LoadMockupAudioWithSounds) BOOST_TEST(volume > oldVolume); // Max volume - MOCK_EXPECT(audioDriverMock->IsEffectPlaying).once().returns(true); + MOCK_EXPECT(audioDriverMock->isEffectPlaying).once().returns(true); oldVolume = volume; MOCK_EXPECT(audioDriverMock->ChangeVolume).once().with(mock::any, mock::retrieve(volume)); manager.playOceanBrawling(100); @@ -164,13 +164,13 @@ BOOST_FIXTURE_TEST_CASE(OceanSounds, LoadMockupAudioWithSounds) mock::verify(); // Play again after old effect was stopped - MOCK_EXPECT(audioDriverMock->IsEffectPlaying).once().returns(false); + MOCK_EXPECT(audioDriverMock->isEffectPlaying).once().returns(false); MOCK_EXPECT(audioDriverMock->doPlayEffect).once().returns(1); manager.playOceanBrawling(10); mock::verify(); // Trigger a known bug in SDL_mixer where IsEffectPlaying might wrongly return false but effect is still playing - MOCK_EXPECT(audioDriverMock->IsEffectPlaying).once().returns(false); + MOCK_EXPECT(audioDriverMock->isEffectPlaying).once().returns(false); MOCK_EXPECT(audioDriverMock->doStopEffect).once(); // It should make sure the effect is actually stopped MOCK_EXPECT(audioDriverMock->doPlayEffect).once().returns(1); manager.playOceanBrawling(10); @@ -224,12 +224,12 @@ BOOST_FIXTURE_TEST_CASE(AnimalSounds, LoadMockupAudioWithSounds) { // All previously added sounds are checked if(i) - MOCK_EXPECT(audioDriverMock->IsEffectPlaying).exactly(i).returns(true); + MOCK_EXPECT(audioDriverMock->isEffectPlaying).exactly(i).returns(true); manager.playAnimalSound(50); ++channel; } // Do not play the same sound again - MOCK_EXPECT(audioDriverMock->IsEffectPlaying).exactly(SoundManager::maxPlayCtPerSound).returns(true); + MOCK_EXPECT(audioDriverMock->isEffectPlaying).exactly(SoundManager::maxPlayCtPerSound).returns(true); manager.playAnimalSound(50); mock::verify(); @@ -240,8 +240,8 @@ BOOST_FIXTURE_TEST_CASE(AnimalSounds, LoadMockupAudioWithSounds) // If one sound has ended, we can play another one MOCK_EXPECT(audioDriverMock->doPlayEffect).once().returns(channel++); - MOCK_EXPECT(audioDriverMock->IsEffectPlaying).once().returns(false); - MOCK_EXPECT(audioDriverMock->IsEffectPlaying).exactly(SoundManager::maxPlayCtPerSound - 1u).returns(true); + MOCK_EXPECT(audioDriverMock->isEffectPlaying).once().returns(false); + MOCK_EXPECT(audioDriverMock->isEffectPlaying).exactly(SoundManager::maxPlayCtPerSound - 1u).returns(true); manager.playAnimalSound(50); mock::verify(); diff --git a/tests/s25Main/audio/testSounds.cpp b/tests/s25Main/audio/testSounds.cpp index 5aacc58d23..7d3908bd8f 100644 --- a/tests/s25Main/audio/testSounds.cpp +++ b/tests/s25Main/audio/testSounds.cpp @@ -120,18 +120,18 @@ BOOST_FIXTURE_TEST_CASE(PlayFromFile, LoadMockupAudio) BOOST_TEST_REQUIRE(MockupSoundData::numAlive == 1); BOOST_TEST(effect->getLoadedType() == SoundType::Effect); BOOST_TEST(id != EffectPlayId::Invalid); - BOOST_TEST(audioDriverMock->GetEffectChannel(id) == channel); - MOCK_EXPECT(audioDriverMock->IsEffectPlaying).in(s).once().with(id).returns(true); - BOOST_TEST_REQUIRE(AUDIODRIVER.IsEffectPlaying(id)); + BOOST_TEST(audioDriverMock->getEffectChannel(id) == channel); + MOCK_EXPECT(audioDriverMock->isEffectPlaying).in(s).once().with(id).returns(true); + BOOST_TEST_REQUIRE(AUDIODRIVER.isEffectPlaying(id)); // Stop playing MOCK_EXPECT(audioDriverMock->doStopEffect).in(s).once().with(channel); - MOCK_EXPECT(audioDriverMock->IsEffectPlaying).in(s).once().with(id).returns(false); + MOCK_EXPECT(audioDriverMock->isEffectPlaying).in(s).once().with(id).returns(false); const auto idCopy = id; AUDIODRIVER.StopEffect(id); BOOST_TEST(id == EffectPlayId::Invalid); - BOOST_TEST_REQUIRE(audioDriverMock->GetEffectChannel(idCopy) == -1); - BOOST_TEST(!AUDIODRIVER.IsEffectPlaying(idCopy)); + BOOST_TEST_REQUIRE(audioDriverMock->getEffectChannel(idCopy) == -1); + BOOST_TEST(!AUDIODRIVER.isEffectPlaying(idCopy)); // Unload when effect goes out of scope MOCK_EXPECT(audioDriverMock->doUnloadSound).in(s).once().calls(makeUnloadHandle(SoundType::Effect)); @@ -190,7 +190,7 @@ BOOST_FIXTURE_TEST_CASE(PlayListRepeatsCorrect, LoadMockupAudio) (rttr::test::libsiedler2TestFilesDir / "testMidi.mid").string()}, 0, false); MusicPlayer player; - player.SetPlaylist(playlist); + player.setPlaylist(playlist); auto handleOgg1 = audioDriverMock->doLoad(SoundType::Music); auto handleOgg2 = audioDriverMock->doLoad(SoundType::Music); @@ -220,7 +220,7 @@ BOOST_FIXTURE_TEST_CASE(PlayListRepeatsCorrect, LoadMockupAudio) // Play both songs twice (1 repeat), then play first again Playlist playlist_repeat(playlist.getSongs(), 1, false); - player.SetPlaylist(playlist_repeat); + player.setPlaylist(playlist_repeat); MOCK_EXPECT(audioDriverMock->PlayMusic).in(s).exactly(2).with(isType(SoundType::Effect), 0); MOCK_EXPECT(audioDriverMock->PlayMusic).in(s).exactly(2).with(isType(SoundType::Music), 0); MOCK_EXPECT(audioDriverMock->PlayMusic).in(s).once().with(isType(SoundType::Effect), 0); @@ -235,7 +235,7 @@ BOOST_FIXTURE_TEST_CASE(PlayListRepeatsCorrect, LoadMockupAudio) // Same but in random order Playlist playlist_random(playlist.getSongs(), 1, true); - player.SetPlaylist(playlist_random); + player.setPlaylist(playlist_random); MOCK_EXPECT(audioDriverMock->PlayMusic).exactly(2).with(isType(SoundType::Effect), 0); MOCK_EXPECT(audioDriverMock->PlayMusic).exactly(2).with(isType(SoundType::Music), 0); MOCK_EXPECT(audioDriverMock->PlayMusic).once().with(mock::any, 0); diff --git a/tests/s25Main/drivers/testDriverWrapper.cpp b/tests/s25Main/drivers/testDriverWrapper.cpp index cfc174c8e0..45c2003c70 100644 --- a/tests/s25Main/drivers/testDriverWrapper.cpp +++ b/tests/s25Main/drivers/testDriverWrapper.cpp @@ -15,8 +15,8 @@ BOOST_AUTO_TEST_CASE(GetDriverList) BOOST_TEST(!drivers.empty()); for(const auto& driver : drivers) { - BOOST_TEST(!driver.GetName().empty()); - BOOST_TEST(bfs::exists(driver.GetFile())); + BOOST_TEST(!driver.getName().empty()); + BOOST_TEST(bfs::exists(driver.getFile())); } } } @@ -26,11 +26,11 @@ BOOST_AUTO_TEST_CASE(AllAudioDriversAreLoadable) const auto drivers = drivers::DriverWrapper::LoadDriverList(drivers::DriverType::Audio); for(const auto& driver : drivers) { - std::string preference = driver.GetName(); + std::string preference = driver.getName(); BOOST_TEST_CHECKPOINT("Loading " << preference); BOOST_TEST_REQUIRE(AUDIODRIVER.LoadDriver(preference)); - BOOST_TEST(preference == driver.GetName()); - BOOST_TEST(AUDIODRIVER.GetName() == driver.GetName()); + BOOST_TEST(preference == driver.getName()); + BOOST_TEST(AUDIODRIVER.getName() == driver.getName()); AUDIODRIVER.UnloadDriver(); } } @@ -40,12 +40,12 @@ BOOST_AUTO_TEST_CASE(AllVideoDriversAreLoadable) const auto drivers = drivers::DriverWrapper::LoadDriverList(drivers::DriverType::Video); for(const auto& driver : drivers) { - std::string preference = driver.GetName(); + std::string preference = driver.getName(); BOOST_TEST_CHECKPOINT("Loading " << preference); BOOST_TEST_REQUIRE(VIDEODRIVER.LoadDriver(preference)); - BOOST_TEST(preference == driver.GetName()); - BOOST_TEST(VIDEODRIVER.GetName() == driver.GetName()); - BOOST_TEST(VIDEODRIVER.GetDriver()); + BOOST_TEST(preference == driver.getName()); + BOOST_TEST(VIDEODRIVER.getName() == driver.getName()); + BOOST_TEST(VIDEODRIVER.getDriver()); VIDEODRIVER.UnloadDriver(); } } diff --git a/tests/s25Main/integration/testAI.cpp b/tests/s25Main/integration/testAI.cpp index 2443914a1d..84bff8d87a 100644 --- a/tests/s25Main/integration/testAI.cpp +++ b/tests/s25Main/integration/testAI.cpp @@ -41,19 +41,19 @@ template inline bool containsBldType(const T_Col& collection, BuildingType type) { return helpers::contains_if(collection, - [type](const noBaseBuilding* bld) { return bld->GetBuildingType() == type; }); + [type](const noBaseBuilding* bld) { return bld->getBuildingType() == type; }); } inline bool playerHasBld(const GamePlayer& player, BuildingType type) { - const BuildingRegister& blds = player.GetBuildingRegister(); - if(containsBldType(blds.GetBuildingSites(), type)) + const BuildingRegister& blds = player.getBuildingRegister(); + if(containsBldType(blds.getBuildingSites(), type)) return true; - if(BuildingProperties::IsMilitary(type)) - return containsBldType(blds.GetMilitaryBuildings(), type); - if(BuildingProperties::IsWareHouse(type)) // Includes harbors - return containsBldType(blds.GetStorehouses(), type); - return !blds.GetBuildings(type).empty(); + if(BuildingProperties::isMilitary(type)) + return containsBldType(blds.getMilitaryBuildings(), type); + if(BuildingProperties::isWareHouse(type)) // Includes harbors + return containsBldType(blds.getStorehouses(), type); + return !blds.getBuildings(type).empty(); } DescIdx GetMineableTerrain(const WorldDescription& desc) @@ -65,10 +65,10 @@ DescIdx GetMineableTerrain(const WorldDescription& desc) void makeWorldMineable(GameWorld& world) { - const DescIdx mineableTerrain = GetMineableTerrain(world.GetDescription()); - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + const DescIdx mineableTerrain = GetMineableTerrain(world.getDescription()); + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - MapNode& node = world.GetNodeWriteable(pt); + MapNode& node = world.getNodeWriteable(pt); node.t1 = node.t2 = mineableTerrain; node.resources = Resource(); } @@ -79,9 +79,9 @@ void makeWorldMineable(GameWorld& world) // mine resource behavior under test and not on unrelated terrain/ownership state. void initAIJhNodes(AIJH::AIPlayerJH& aijh, const GameWorld& world, const unsigned player) { - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - AIJH::Node& node = aijh.GetAINode(pt); + AIJH::Node& node = aijh.getAINode(pt); node.bq = world.GetBQ(pt, player); node.owned = true; node.reachable = true; @@ -106,15 +106,15 @@ BOOST_AUTO_TEST_SUITE(AI) BOOST_FIXTURE_TEST_CASE(PlayerHasBld_IsCorrect, EmptyWorldFixture1P) { - const GamePlayer& player = world.GetPlayer(0); + const GamePlayer& player = world.getPlayer(0); BOOST_TEST(playerHasBld(player, BuildingType::Headquarters)); - MapPoint pos = player.GetHQPos(); + MapPoint pos = player.getHQPos(); for(const auto bld : {BuildingType::Woodcutter, BuildingType::Barracks, BuildingType::Storehouse}) { pos = world.MakeMapPoint(pos + Position(2, 0)); BOOST_TEST_INFO(bld); BOOST_TEST(!playerHasBld(player, bld)); - BuildingFactory::CreateBuilding(world, bld, pos, player.GetPlayerId(), Nation::Romans); + BuildingFactory::CreateBuilding(world, bld, pos, player.getPlayerId(), Nation::Romans); BOOST_TEST_INFO(bld); BOOST_TEST(playerHasBld(player, bld)); } @@ -149,13 +149,13 @@ BOOST_FIXTURE_TEST_CASE(AIChat, EmptyWorldFixture2P) BOOST_FIXTURE_TEST_CASE(MineResourceRatingAccountsForS4LikeExhaustion, EmptyWorldFixture1P) { - const MapPoint resourcePos = world.MakeMapPoint(world.GetPlayer(0).GetHQPos() + Position(2, 0)); - world.GetNodeWriteable(resourcePos).resources = Resource(ResourceType::Coal, 1); + const MapPoint resourcePos = world.MakeMapPoint(world.getPlayer(0).getHQPos() + Position(2, 0)); + world.getNodeWriteable(resourcePos).resources = Resource(ResourceType::Coal, 1); MockAI ai(0, world, AI::Level::Easy); const auto ratingWith = [&](const MineResourceBehavior behavior) { ggs.setSelection(AddonId::COALMINE_RESOURCE_BEHAVIOR, static_cast(behavior)); - return ai.getAIInterface().GetResourceRating(resourcePos, AIResource::Coal); + return ai.getAIInterface().getResourceRating(resourcePos, AIResource::Coal); }; // A spot with a coal deposit gets the full radius rating for all behaviors that mine the deposit as-is... @@ -180,13 +180,13 @@ BOOST_FIXTURE_TEST_CASE(MineWorkEverywhereAffectsMatchingResourceOnly, EmptyWorl initAIJhNodes(ai, world, 0); // The HQ is the only guaranteed reachable/owned starting spot, so searches are centered on it. - const MapPoint searchCenter = world.GetPlayer(0).GetHQPos(); + const MapPoint searchCenter = world.getPlayer(0).getHQPos(); // The only iron deposit sits well outside the search radius below, so default iron mining has no reachable spot. const MapPoint ironPos = world.MakeMapPoint(searchCenter + Position(8, 0)); - world.GetNodeWriteable(ironPos).resources = Resource(ResourceType::Iron, 4); + world.getNodeWriteable(ironPos).resources = Resource(ResourceType::Iron, 4); // WorkEverywhere coal treats any mineable node as a coal spot, even one that actually holds an iron deposit. - BOOST_TEST(ai.getAIInterface().GetResourceRating(ironPos, AIResource::Coal) + BOOST_TEST(ai.getAIInterface().getResourceRating(ironPos, AIResource::Coal) == static_cast(RES_RADIUS[AIResource::Coal])); // So coal finds a spot right around the HQ, while default iron finds none because its only deposit is out of range. BOOST_TEST(ai.FindBestPosition(searchCenter, AIResource::Coal, BuildingQuality::Mine, 5).isValid()); @@ -197,7 +197,7 @@ BOOST_FIXTURE_TEST_CASE(GraniteMineResourceBehaviorAffectsAIMineSearch, EmptyWor { // Mineable terrain everywhere but no deposits, so only the granite behavior decides what the AI can place. makeWorldMineable(world); - const MapPoint searchCenter = world.GetPlayer(0).GetHQPos(); + const MapPoint searchCenter = world.getPlayer(0).getHQPos(); // The AI rates all nodes once during setup, so each behavior needs an AI of its own. const auto findsMineSpotFor = [&](const MineResourceBehavior behavior, const AIResource res) { ggs.setSelection(AddonId::GRANITEMINE_RESOURCE_BEHAVIOR, static_cast(behavior)); @@ -219,7 +219,7 @@ BOOST_FIXTURE_TEST_CASE(GraniteMineResourceBehaviorAffectsAIMineSearch, EmptyWor BOOST_TEST(!findsMineSpotFor(MineResourceBehavior::Inexhaustible, AIResource::Granite)); BOOST_TEST(!findsMineSpotFor(MineResourceBehavior::Inexhaustible, AIResource::Coal)); // But if we place a granite deposit, the AI can find it - world.GetNodeWriteable(searchCenter).resources = Resource(ResourceType::Granite, 1); + world.getNodeWriteable(searchCenter).resources = Resource(ResourceType::Granite, 1); for(const auto behavior : helpers::EnumRange{}) BOOST_TEST_CONTEXT("Behavior: " << rttr::enum_cast(behavior)) { @@ -232,11 +232,11 @@ BOOST_FIXTURE_TEST_CASE(KeepBQUpdated, BiggerWorldWithGCExecution) { addStartResources(); // Place some trees to reduce BQ at some points - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - if(pt.x % 4 == 0 && pt.y % 2 == 0 && world.GetNode(pt).bq == BuildingQuality::Castle + if(pt.x % 4 == 0 && pt.y % 2 == 0 && world.getNode(pt).bq == BuildingQuality::Castle && world.CalcDistance(pt, hqPos) > 6) - world.SetNO(pt, new noTree(pt, 0, 3)); + world.setNO(pt, new noTree(pt, 0, 3)); } world.InitAfterLoad(); @@ -245,10 +245,10 @@ BOOST_FIXTURE_TEST_CASE(KeepBQUpdated, BiggerWorldWithGCExecution) const auto assertBqEqualOnWholeMap = [this, &aijh](const unsigned lineNr) { BOOST_TEST_CONTEXT("Line #" << lineNr) - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { BOOST_TEST_INFO(pt); - BOOST_TEST(this->world.GetBQ(pt, curPlayer) == aijh.GetAINode(pt).bq); + BOOST_TEST(this->world.GetBQ(pt, curPlayer) == aijh.getAINode(pt).bq); } }; const auto assertBqEqualAround = [this, &aijh](const unsigned lineNr, MapPoint pt, unsigned radius) { @@ -257,7 +257,7 @@ BOOST_FIXTURE_TEST_CASE(KeepBQUpdated, BiggerWorldWithGCExecution) pt, radius, [&](const MapPoint curPt, unsigned) { BOOST_TEST_INFO(curPt); - BOOST_TEST(this->world.GetBQ(curPt, curPlayer) == aijh.GetAINode(curPt).bq); + BOOST_TEST(this->world.GetBQ(curPt, curPlayer) == aijh.getAINode(curPt).bq); return false; }, true); @@ -267,87 +267,87 @@ BOOST_FIXTURE_TEST_CASE(KeepBQUpdated, BiggerWorldWithGCExecution) for(unsigned gf = 0; gf < 100; ++gf) { em.ExecuteNextGF(); - ai->RunGF(em.GetCurrentGF(), true); + ai->RunGF(em.getCurrentGF(), true); } assertBqEqualOnWholeMap(__LINE__); // Set and destroy flag everywhere possible std::vector possibleFlagNodes; - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - if(world.GetBQ(pt, curPlayer) != BuildingQuality::Nothing && !world.IsFlagAround(pt)) + if(world.GetBQ(pt, curPlayer) != BuildingQuality::Nothing && !world.isFlagAround(pt)) possibleFlagNodes.push_back(pt); } for(const MapPoint flagPos : possibleFlagNodes) { this->SetFlag(flagPos); - BOOST_TEST_REQUIRE(world.GetSpecObj(flagPos)); + BOOST_TEST_REQUIRE(world.getSpecObj(flagPos)); em.ExecuteNextGF(); - ai->RunGF(em.GetCurrentGF(), true); + ai->RunGF(em.getCurrentGF(), true); assertBqEqualAround(__LINE__, flagPos, 3); this->DestroyFlag(flagPos); - BOOST_TEST_REQUIRE(!world.GetSpecObj(flagPos)); + BOOST_TEST_REQUIRE(!world.getSpecObj(flagPos)); em.ExecuteNextGF(); - ai->RunGF(em.GetCurrentGF(), true); + ai->RunGF(em.getCurrentGF(), true); assertBqEqualAround(__LINE__, flagPos, 3); } // Build road - const MapPoint flagPos = world.MakeMapPoint(world.GetNeighbour(hqPos, Direction::SouthEast) + Position(4, 0)); - this->BuildRoad(world.GetNeighbour(hqPos, Direction::SouthEast), false, std::vector(4, Direction::East)); - BOOST_TEST_REQUIRE(world.GetSpecObj(flagPos)->GetRoute(Direction::West)); + const MapPoint flagPos = world.MakeMapPoint(world.getNeighbour(hqPos, Direction::SouthEast) + Position(4, 0)); + this->BuildRoad(world.getNeighbour(hqPos, Direction::SouthEast), false, std::vector(4, Direction::East)); + BOOST_TEST_REQUIRE(world.getSpecObj(flagPos)->getRoute(Direction::West)); em.ExecuteNextGF(); - ai->RunGF(em.GetCurrentGF(), true); + ai->RunGF(em.getCurrentGF(), true); assertBqEqualAround(__LINE__, flagPos, 6); // Destroy road and flag this->DestroyFlag(flagPos); em.ExecuteNextGF(); - ai->RunGF(em.GetCurrentGF(), true); + ai->RunGF(em.getCurrentGF(), true); assertBqEqualAround(__LINE__, flagPos, 6); // Build building const MapPoint bldPos = world.MakeMapPoint(hqPos + Position(5, 0)); this->SetBuildingSite(bldPos, BuildingType::Barracks); - BOOST_TEST_REQUIRE(world.GetSpecObj(bldPos)); + BOOST_TEST_REQUIRE(world.getSpecObj(bldPos)); em.ExecuteNextGF(); - ai->RunGF(em.GetCurrentGF(), true); + ai->RunGF(em.getCurrentGF(), true); assertBqEqualAround(__LINE__, bldPos, 6); - this->BuildRoad(world.GetNeighbour(bldPos, Direction::SouthEast), false, + this->BuildRoad(world.getNeighbour(bldPos, Direction::SouthEast), false, std::vector(5, Direction::West)); em.ExecuteNextGF(); - ai->RunGF(em.GetCurrentGF(), true); - RTTR_EXEC_TILL(2000, world.GetSpecObj(bldPos)); + ai->RunGF(em.getCurrentGF(), true); + RTTR_EXEC_TILL(2000, world.getSpecObj(bldPos)); em.ExecuteNextGF(); - ai->RunGF(em.GetCurrentGF(), false); + ai->RunGF(em.getCurrentGF(), false); assertBqEqualOnWholeMap(__LINE__); // Gain land - const nobMilitary* bld = world.GetSpecObj(bldPos); + const nobMilitary* bld = world.getSpecObj(bldPos); for(unsigned i = 0; i < 500; i++) { em.ExecuteNextGF(); - ai->RunGF(em.GetCurrentGF(), false); - if(bld->GetNumTroops() > 0u) + ai->RunGF(em.getCurrentGF(), false); + if(bld->getNumTroops() > 0u) break; } - BOOST_TEST_REQUIRE(bld->GetNumTroops() > 0u); + BOOST_TEST_REQUIRE(bld->getNumTroops() > 0u); assertBqEqualOnWholeMap(__LINE__); // Move the boundary by one node std::set outerBoundaryNodes; std::vector borderNodes; - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - if(world.IsBorderNode(pt, curPlayer + 1)) + if(world.isBorderNode(pt, curPlayer + 1)) { borderNodes.push_back(pt); world.CheckPointsInRadius( pt, 1, [&outerBoundaryNodes, &world = this->world, curPlayer = this->curPlayer](const MapPoint curPt, unsigned) { - if(world.GetNode(curPt).owner != curPlayer + 1) + if(world.getNode(curPt).owner != curPlayer + 1) outerBoundaryNodes.insert(curPt); return false; }, @@ -356,46 +356,46 @@ BOOST_FIXTURE_TEST_CASE(KeepBQUpdated, BiggerWorldWithGCExecution) } // Once to outside for(const MapPoint pt : outerBoundaryNodes) - world.SetOwner(pt, curPlayer + 1); - world.RecalcBorderStones(Position(0, 0), Extent(world.GetSize())); + world.setOwner(pt, curPlayer + 1); + world.RecalcBorderStones(Position(0, 0), Extent(world.getSize())); for(const MapPoint pt : outerBoundaryNodes) - world.GetNotifications().publish(NodeNote(NodeNote::Owner, pt)); + world.getNotifications().publish(NodeNote(NodeNote::Owner, pt)); em.ExecuteNextGF(); - ai->RunGF(em.GetCurrentGF(), false); + ai->RunGF(em.getCurrentGF(), false); assertBqEqualOnWholeMap(__LINE__); // And back for(const MapPoint pt : outerBoundaryNodes) - world.SetOwner(pt, 0); - world.RecalcBorderStones(Position(0, 0), Extent(world.GetSize())); + world.setOwner(pt, 0); + world.RecalcBorderStones(Position(0, 0), Extent(world.getSize())); for(const MapPoint pt : outerBoundaryNodes) - world.GetNotifications().publish(NodeNote(NodeNote::Owner, pt)); + world.getNotifications().publish(NodeNote(NodeNote::Owner, pt)); em.ExecuteNextGF(); - ai->RunGF(em.GetCurrentGF(), false); + ai->RunGF(em.getCurrentGF(), false); assertBqEqualOnWholeMap(__LINE__); // And once to inside for(const MapPoint pt : borderNodes) - world.SetOwner(pt, 0); - world.RecalcBorderStones(Position(0, 0), Extent(world.GetSize())); + world.setOwner(pt, 0); + world.RecalcBorderStones(Position(0, 0), Extent(world.getSize())); for(const MapPoint pt : borderNodes) - world.GetNotifications().publish(NodeNote(NodeNote::Owner, pt)); + world.getNotifications().publish(NodeNote(NodeNote::Owner, pt)); em.ExecuteNextGF(); - ai->RunGF(em.GetCurrentGF(), false); + ai->RunGF(em.getCurrentGF(), false); assertBqEqualOnWholeMap(__LINE__); } BOOST_FIXTURE_TEST_CASE(BuildWoodIndustry, WorldWithGCExecution<1>) { // Place a few trees - for(const MapPoint& pt : world.GetPointsInRadius(hqPos + MapPoint(4, 0), 2)) + for(const MapPoint& pt : world.getPointsInRadius(hqPos + MapPoint(4, 0), 2)) { - if(!world.GetNode(pt).obj) - world.SetNO(pt, new noTree(pt, 0, 3)); + if(!world.getNode(pt).obj) + world.setNO(pt, new noTree(pt, 0, 3)); } world.InitAfterLoad(); - const GamePlayer& player = world.GetPlayer(curPlayer); + const GamePlayer& player = world.getPlayer(curPlayer); auto ai = AIFactory::Create(AI::Info(AI::Type::Default, AI::Level::Hard), curPlayer, world); // Build a woodcutter, sawmill and forester at some point for(unsigned gf = 0; gf < 2000;) @@ -404,7 +404,7 @@ BOOST_FIXTURE_TEST_CASE(BuildWoodIndustry, WorldWithGCExecution<1>) for(unsigned i = 0; i < 5; i++, gf++) { em.ExecuteNextGF(); - ai->RunGF(em.GetCurrentGF(), i == 0); + ai->RunGF(em.getCurrentGF(), i == 0); } for(gc::GameCommandPtr& gc : aiGcs) { @@ -423,14 +423,14 @@ namespace { void forceExpansion(const GamePlayer& player, GameWorld& world) { // No space for saw mill due to altitude diff of 3 in range 2 -> Huts only - for(unsigned y = 0; y < world.GetHeight(); y += 2) + for(unsigned y = 0; y < world.getHeight(); y += 2) { - for(unsigned x = 0; x < world.GetWidth(); x += 2) + for(unsigned x = 0; x < world.getWidth(); x += 2) world.ChangeAltitude(MapPoint(x, y), 13); } - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - BOOST_TEST_REQUIRE(world.GetBQ(pt, player.GetPlayerId()) <= BuildingQuality::Hut); + BOOST_TEST_REQUIRE(world.GetBQ(pt, player.getPlayerId()) <= BuildingQuality::Hut); } } @@ -444,7 +444,7 @@ void runUntilMilitaryBuildingSiteFound(TestEventManager& em, unsigned curPlayer, for(unsigned i = 0; i < 5; i++, gf++) { em.ExecuteNextGF(); - ai->RunGF(em.GetCurrentGF(), i == 0); + ai->RunGF(em.getCurrentGF(), i == 0); } for(gc::GameCommandPtr& gc : aiGcs) { @@ -458,8 +458,8 @@ void runUntilMilitaryBuildingSiteFound(TestEventManager& em, unsigned curPlayer, BOOST_FIXTURE_TEST_CASE(ExpandWhenNoSpace, BiggerWorldWithGCExecution) { - const auto& player = world.GetPlayer(curPlayer); - const auto& bldSites = player.GetBuildingRegister().GetBuildingSites(); + const auto& player = world.getPlayer(curPlayer); + const auto& bldSites = player.getBuildingRegister().getBuildingSites(); forceExpansion(player, world); runUntilMilitaryBuildingSiteFound(em, curPlayer, world, bldSites); @@ -470,13 +470,13 @@ BOOST_FIXTURE_TEST_CASE(ExpandWhenNoSpace, BiggerWorldWithGCExecution) BOOST_FIXTURE_TEST_CASE(DoNotBuildMilitaryBuildingsWithinComputerBarrier, BiggerWorldWithGCExecution) { - const auto& player = world.GetPlayer(curPlayer); - const auto& bldSites = player.GetBuildingRegister().GetBuildingSites(); + const auto& player = world.getPlayer(curPlayer); + const auto& bldSites = player.getBuildingRegister().getBuildingSites(); - const auto& barrierPt = player.GetHQPos(); + const auto& barrierPt = player.getHQPos(); constexpr auto radius = HQ_RADIUS; - world.SetComputerBarrier(barrierPt, radius); + world.setComputerBarrier(barrierPt, radius); forceExpansion(player, world); runUntilMilitaryBuildingSiteFound(em, curPlayer, world, bldSites); @@ -486,15 +486,15 @@ BOOST_FIXTURE_TEST_CASE(DoNotBuildMilitaryBuildingsWithinComputerBarrier, Bigger BOOST_FIXTURE_TEST_CASE(DoBuildMilitaryBuildingsOutsideComputerBarrier, BiggerWorldWithGCExecution) { - const auto& player = world.GetPlayer(curPlayer); - const auto& bldSites = player.GetBuildingRegister().GetBuildingSites(); + const auto& player = world.getPlayer(curPlayer); + const auto& bldSites = player.getBuildingRegister().getBuildingSites(); - auto barrierPt = player.GetHQPos(); + auto barrierPt = player.getHQPos(); // move barrier 2 tiles west of HQ, now military buildings should be buildable to the east barrierPt.x -= 2; constexpr auto radius = HQ_RADIUS; - world.SetComputerBarrier(barrierPt, radius); + world.setComputerBarrier(barrierPt, radius); forceExpansion(player, world); runUntilMilitaryBuildingSiteFound(em, curPlayer, world, bldSites); @@ -505,8 +505,8 @@ BOOST_FIXTURE_TEST_CASE(DoBuildMilitaryBuildingsOutsideComputerBarrier, BiggerWo BOOST_TEST_REQUIRE(!world.CheckPointsInRadius( barrierPt, radius, [bldSite](const MapPoint& pt, unsigned) { - const auto type = bldSite->GetBuildingType(); - return (type == BuildingType::Barracks || type == BuildingType::Guardhouse) && pt == bldSite->GetPos(); + const auto type = bldSite->getBuildingType(); + return (type == BuildingType::Barracks || type == BuildingType::Guardhouse) && pt == bldSite->getPos(); }, true)); } diff --git a/tests/s25Main/integration/testArmor.cpp b/tests/s25Main/integration/testArmor.cpp index 0cffcdcb3d..dc5bc5be4b 100644 --- a/tests/s25Main/integration/testArmor.cpp +++ b/tests/s25Main/integration/testArmor.cpp @@ -16,15 +16,15 @@ struct ArmoredSoldierFixture : public WorldWithGCExecution3P { for(auto i = 0; i < 3; i++) { - auto* curWh = world.GetSpecObj(world.GetPlayer(i).GetHQPos()); + auto* curWh = world.getSpecObj(world.getPlayer(i).getHQPos()); BOOST_TEST_REQUIRE(curWh); PeopleCounts soldiers; for(auto soldier : SOLDIER_JOBS) { soldiers[jobEnumToAmoredSoldierEnum(soldier)] = 2u; soldiers[soldier] = 3u; - curWh->SetRealReserve(getSoldierRank(soldier), 0); - curWh->SetReserveVisual(getSoldierRank(soldier), 0); + curWh->setRealReserve(getSoldierRank(soldier), 0); + curWh->setReserveVisual(getSoldierRank(soldier), 0); } curWh->AddToInventory(soldiers, true); } @@ -44,27 +44,27 @@ struct ArmorTradeFixture : public ArmoredSoldierFixture curPlayer = 1; addStartResources(); - world.GetPlayer(0).team = Team::Team1; //-V525 - world.GetPlayer(1).team = Team::Team1; - world.GetPlayer(2).team = Team::Team2; - for(unsigned i = 0; i < world.GetNumPlayers(); i++) + world.getPlayer(0).team = Team::Team1; //-V525 + world.getPlayer(1).team = Team::Team1; + world.getPlayer(2).team = Team::Team2; + for(unsigned i = 0; i < world.getNumPlayers(); i++) { - world.GetPlayer(i).MakeStartPacts(); - players[i] = &world.GetPlayer(i); + world.getPlayer(i).MakeStartPacts(); + players[i] = &world.getPlayer(i); } - BOOST_TEST_REQUIRE(players[1]->IsAlly(0)); - BOOST_TEST_REQUIRE(!players[1]->IsAlly(2)); - curWh = world.GetSpecObj(players[1]->GetHQPos()); + BOOST_TEST_REQUIRE(players[1]->isAlly(0)); + BOOST_TEST_REQUIRE(!players[1]->isAlly(2)); + curWh = world.getSpecObj(players[1]->getHQPos()); BOOST_TEST_REQUIRE(curWh); - RTTR_EXEC_TILL(200 * curWh->GetNumRealWares(GoodType::Sword), curWh->GetNumRealWares(GoodType::Sword) == 0); + RTTR_EXEC_TILL(200 * curWh->getNumRealWares(GoodType::Sword), curWh->getNumRealWares(GoodType::Sword) == 0); // Get start count and check that we have some - numHelpers = curWh->GetNumRealFigures(Job::Helper); - numDonkeys = curWh->GetNumRealFigures(Job::PackDonkey); + numHelpers = curWh->getNumRealFigures(Job::Helper); + numDonkeys = curWh->getNumRealFigures(Job::PackDonkey); for(unsigned i = 0; i < NUM_SOLDIER_RANKS; i++) { - numSoldiers[i] = curWh->GetNumRealFigures(SOLDIER_JOBS[i]); - numArmoredSoldiers[i] = curWh->GetNumRealArmoredFigures(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])); + numSoldiers[i] = curWh->getNumRealFigures(SOLDIER_JOBS[i]); + numArmoredSoldiers[i] = curWh->getNumRealArmoredFigures(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])); } BOOST_TEST_REQUIRE(numHelpers > 10u); @@ -86,27 +86,27 @@ struct ArmorTradeFixture : public ArmoredSoldierFixture { for(const auto& player : world.getPlayers()) { - auto const& playerWh = world.GetSpecObj(player.GetHQPos()); - auto const& globalInventoryPlayer = player.GetInventory(); + auto const& playerWh = world.getSpecObj(player.getHQPos()); + auto const& globalInventoryPlayer = player.getInventory(); for(unsigned i = 0; i < NUM_SOLDIER_RANKS; i++) { - BOOST_TEST(playerWh->GetNumRealArmoredFigures(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])) + BOOST_TEST(playerWh->getNumRealArmoredFigures(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])) == globalInventoryPlayer[jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])]); - BOOST_TEST(playerWh->GetNumRealFigures(SOLDIER_JOBS[i]) == globalInventoryPlayer[SOLDIER_JOBS[i]]); + BOOST_TEST(playerWh->getNumRealFigures(SOLDIER_JOBS[i]) == globalInventoryPlayer[SOLDIER_JOBS[i]]); } } } void testExpectedFigures() const { - BOOST_TEST(curWh->GetNumRealFigures(Job::Helper) == numHelpers); - BOOST_TEST(curWh->GetNumRealFigures(Job::PackDonkey) == numDonkeys); + BOOST_TEST(curWh->getNumRealFigures(Job::Helper) == numHelpers); + BOOST_TEST(curWh->getNumRealFigures(Job::PackDonkey) == numDonkeys); for(unsigned i = 0; i < NUM_SOLDIER_RANKS; i++) { - BOOST_TEST(curWh->GetNumRealArmoredFigures(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])) + BOOST_TEST(curWh->getNumRealArmoredFigures(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])) == numArmoredSoldiers[i]); - BOOST_TEST(curWh->GetNumRealFigures(SOLDIER_JOBS[i]) == numSoldiers[i]); + BOOST_TEST(curWh->getNumRealFigures(SOLDIER_JOBS[i]) == numSoldiers[i]); } testExpectedFiguresInGlobalInventoryMatchWithHQInventory(); } @@ -114,20 +114,20 @@ struct ArmorTradeFixture : public ArmoredSoldierFixture void testAfterLeaving(unsigned numTradeItems) { // Run enough GFs so all trade caravans are out (~numTradeItems + 1 people need to leave taking 30GFs max each) - RTTR_EXEC_TILL(30 * (numTradeItems + 1), curWh->GetLeavingFigures().empty()); + RTTR_EXEC_TILL(30 * (numTradeItems + 1), curWh->getLeavingFigures().empty()); // Real count should not be changed // But helpers can be produced in the meantime - BOOST_TEST(curWh->GetNumRealFigures(Job::Helper) >= numHelpers); - numHelpers = curWh->GetNumRealFigures(Job::Helper); + BOOST_TEST(curWh->getNumRealFigures(Job::Helper) >= numHelpers); + numHelpers = curWh->getNumRealFigures(Job::Helper); testExpectedFigures(); // Visual count should match real count - BOOST_TEST(curWh->GetNumVisualFigures(Job::Helper) == numHelpers); - BOOST_TEST(curWh->GetNumVisualFigures(Job::PackDonkey) == numDonkeys); + BOOST_TEST(curWh->getNumVisualFigures(Job::Helper) == numHelpers); + BOOST_TEST(curWh->getNumVisualFigures(Job::PackDonkey) == numDonkeys); for(unsigned i = 0; i < NUM_SOLDIER_RANKS; i++) { - BOOST_TEST(curWh->GetNumVisualArmoredFigures(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])) + BOOST_TEST(curWh->getNumVisualArmoredFigures(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])) == numArmoredSoldiers[i]); - BOOST_TEST(curWh->GetNumVisualFigures(SOLDIER_JOBS[i]) == numSoldiers[i]); + BOOST_TEST(curWh->getNumVisualFigures(SOLDIER_JOBS[i]) == numSoldiers[i]); } } }; @@ -138,14 +138,14 @@ BOOST_AUTO_TEST_CASE(TradeArmoredFigures) { // Disable trading this->ggs.setSelection(AddonId::TRADE, 0); - this->TradeOverLand(players[0]->GetHQPos(), Job::Officer, 3); + this->TradeOverLand(players[0]->getHQPos(), Job::Officer, 3); testExpectedFigures(); // Enable trading this->ggs.setSelection(AddonId::TRADE, 1); // Trade nothing -> Wrong - this->TradeOverLand(players[0]->GetHQPos(), Job::Officer, 0); + this->TradeOverLand(players[0]->getHQPos(), Job::Officer, 0); testExpectedFigures(); const unsigned officerSoldiersTraded = 3; @@ -158,7 +158,7 @@ BOOST_AUTO_TEST_CASE(TradeArmoredFigures) BOOST_TEST_REQUIRE(numArmoredSoldiers[getSoldierRank(Job::Officer)] == officerSoldiersWithArmor); BOOST_TEST_REQUIRE(numSoldiers[getSoldierRank(Job::Officer)] == officerSoldiersTraded); - this->TradeOverLand(players[0]->GetHQPos(), Job::Officer, officerSoldiersTraded); + this->TradeOverLand(players[0]->getHQPos(), Job::Officer, officerSoldiersTraded); numArmoredSoldiers[getSoldierRank(Job::Officer)] -= officerSoldiersWithArmor; numSoldiers[getSoldierRank(Job::Officer)] -= officerSoldiersTraded; numHelpers -= 1; // Trade leader @@ -166,18 +166,18 @@ BOOST_AUTO_TEST_CASE(TradeArmoredFigures) testAfterLeaving(3); // Let caravan arrive (20GFs per node) - unsigned distance = world.CalcDistance(curWh->GetPos(), players[0]->GetHQPos()) + 2; + unsigned distance = world.CalcDistance(curWh->getPos(), players[0]->getHQPos()) + 2; RTTR_SKIP_GFS(20 * distance); - curWh = world.GetSpecObj(players[0]->GetHQPos()); + curWh = world.getSpecObj(players[0]->getHQPos()); BOOST_TEST_REQUIRE(curWh); numSoldiers[getSoldierRank(Job::Officer)] = initialNumSoldiers + officerSoldiersTraded; numArmoredSoldiers[getSoldierRank(Job::Officer)] = initialNumArmoredSoldiers + officerSoldiersWithArmor; numHelpers = initialNumHelpers + 1 // Trade leader + (20 * distance) / 170; // Some were produced(at least every 170 GFs) // helpers can be produced in the meantime - BOOST_TEST_REQUIRE(curWh->GetNumRealFigures(Job::Helper) >= numHelpers); - numHelpers = curWh->GetNumRealFigures(Job::Helper); + BOOST_TEST_REQUIRE(curWh->getNumRealFigures(Job::Helper) >= numHelpers); + numHelpers = curWh->getNumRealFigures(Job::Helper); testExpectedFigures(); } @@ -186,7 +186,7 @@ BOOST_AUTO_TEST_CASE(ArmorTradeFail) const unsigned officerSoldiersTraded = 3; const unsigned officerSoldiersWithArmor = 2; - this->TradeOverLand(players[0]->GetHQPos(), Job::Officer, 3); + this->TradeOverLand(players[0]->getHQPos(), Job::Officer, 3); // For figures we don't need donkeys numArmoredSoldiers[getSoldierRank(Job::Officer)] -= officerSoldiersWithArmor; numSoldiers[getSoldierRank(Job::Officer)] -= officerSoldiersTraded; @@ -198,10 +198,10 @@ BOOST_AUTO_TEST_CASE(ArmorTradeFail) RTTR_SKIP_GFS(40); // Add a ring of enemy owned land so they cannot pass - for(const MapPoint& pt : world.GetPointsInRadius(curWh->GetPos(), 10)) + for(const MapPoint& pt : world.getPointsInRadius(curWh->getPos(), 10)) { - if(world.CalcDistance(pt, curWh->GetPos()) >= 8) - world.SetOwner(pt, 2 + 1); // playerID = 2 -> Owner = +1 + if(world.CalcDistance(pt, curWh->getPos()) >= 8) + world.setOwner(pt, 2 + 1); // playerID = 2 -> Owner = +1 } // Let them come in again (walk same way back, assume at most 8 nodes away + same as above) @@ -211,8 +211,8 @@ BOOST_AUTO_TEST_CASE(ArmorTradeFail) numSoldiers[getSoldierRank(Job::Officer)] += officerSoldiersTraded; numHelpers += 1; // helpers can be produced in the meantime - BOOST_TEST_REQUIRE(curWh->GetNumRealFigures(Job::Helper) >= numHelpers); - numHelpers = curWh->GetNumRealFigures(Job::Helper); + BOOST_TEST_REQUIRE(curWh->getNumRealFigures(Job::Helper) >= numHelpers); + numHelpers = curWh->getNumRealFigures(Job::Helper); testExpectedFigures(); } @@ -221,7 +221,7 @@ BOOST_AUTO_TEST_CASE(ArmorTradeFailDie) const unsigned officerSoldiersTraded = 3; const unsigned officerSoldiersWithArmor = 2; - this->TradeOverLand(players[0]->GetHQPos(), Job::Officer, 3); + this->TradeOverLand(players[0]->getHQPos(), Job::Officer, 3); // Each donkey carries a ware and we need 2 leaders numArmoredSoldiers[getSoldierRank(Job::Officer)] -= officerSoldiersWithArmor; numSoldiers[getSoldierRank(Job::Officer)] -= officerSoldiersTraded; @@ -235,12 +235,12 @@ BOOST_AUTO_TEST_CASE(ArmorTradeFailDie) // Now make everything enemy territory (e.g. enemy captured the building) // They will then not find any further route and die // See https://github.com/Return-To-The-Roots/s25client/issues/1336 - RTTR_FOREACH_PT(MapPoint, world.GetSize()) - world.SetOwner(pt, 2 + 1); // playerID = 2 -> Owner = +1 + RTTR_FOREACH_PT(MapPoint, world.getSize()) + world.setOwner(pt, 2 + 1); // playerID = 2 -> Owner = +1 // Let them all die RTTR_SKIP_GFS(40 + 20 * 8); // Don't care about helpers but check the rest: Still gone - numHelpers = curWh->GetNumRealFigures(Job::Helper); + numHelpers = curWh->getNumRealFigures(Job::Helper); testExpectedFigures(); } diff --git a/tests/s25Main/integration/testAttacking.cpp b/tests/s25Main/integration/testAttacking.cpp index 9ae043271b..656085f8f4 100644 --- a/tests/s25Main/integration/testAttacking.cpp +++ b/tests/s25Main/integration/testAttacking.cpp @@ -64,14 +64,14 @@ auto calcSum(const T& collection) std::array CountTroopsByRank(const nobMilitary& bld) { std::array counts{}; - for(const auto& soldier : bld.GetTroops()) - ++counts[soldier.GetRank()]; + for(const auto& soldier : bld.getTroops()) + ++counts[soldier.getRank()]; return counts; } void DeliverCoin(nobMilitary& bld, GameWorld& world, const MapPoint hqPos) { - auto* hq = world.GetSpecObj(hqPos); + auto* hq = world.getSpecObj(hqPos); BOOST_TEST_REQUIRE(hq); hq->AddToInventory(GoodCounts::make(GoodType::Coins, 1), true); @@ -81,12 +81,12 @@ void DeliverCoin(nobMilitary& bld, GameWorld& world, const MapPoint hqPos) /// Reschedule the walk event of the obj to be executed in numGFs GFs void rescheduleWalkEvent(TestEventManager& em, noMovable& obj, unsigned numGFs) { - std::vector evts = em.GetObjEvents(obj); + std::vector evts = em.getObjEvents(obj); for(const GameEvent* ev : evts) { if(ev->id == 0) { - em.RescheduleEvent(ev, em.GetCurrentGF() + numGFs); + em.RescheduleEvent(ev, em.getCurrentGF() + numGFs); return; } } @@ -98,13 +98,13 @@ void rescheduleWalkEvent(TestEventManager& em, noMovable& obj, unsigned numGFs) void moveObjTo(GameWorldBase& world, noFigure& obj, const MapPoint& pos) { std::unique_ptr ownedObj; - if(world.HasFigureAt(obj.GetPos(), obj)) - ownedObj = world.RemoveFigure(obj.GetPos(), obj); + if(world.hasFigureAt(obj.getPos(), obj)) + ownedObj = world.RemoveFigure(obj.getPos(), obj); else - ownedObj = world.RemoveFigure(world.GetNeighbour(obj.GetPos(), obj.GetCurMoveDir() + 3u), obj); - obj.SetPos(world.GetNeighbour(pos, Direction::West)); - world.AddFigure(obj.GetPos(), std::move(ownedObj)); - if(obj.IsMoving()) + ownedObj = world.RemoveFigure(world.getNeighbour(obj.getPos(), obj.getCurMoveDir() + 3u), obj); + obj.setPos(world.getNeighbour(pos, Direction::West)); + world.AddFigure(obj.getPos(), std::move(ownedObj)); + if(obj.isMoving()) obj.FaceDir(Direction::East); else obj.StartWalking(Direction::East); @@ -125,7 +125,7 @@ struct AttackFixtureBase : public WorldWithGCExecutionChangeMilitary(MILITARY_SETTINGS_SCALE); } @@ -142,27 +142,27 @@ struct AttackFixtureBase : public WorldWithGCExecution(bldPos); + BOOST_TEST_REQUIRE(rank <= world.getGGS().getMaxMilitaryRank()); + auto* bld = world.template getSpecObj(bldPos); BOOST_TEST_REQUIRE(bld); - const unsigned oldNumSoldiers = bld->GetNumTroops(); + const unsigned oldNumSoldiers = bld->getNumTroops(); for(unsigned i = 0; i < numSoldiers; i++) { auto& soldier = - world.AddFigure(bldPos, std::make_unique(bldPos, bld->GetPlayer(), bld, bld, rank)); - world.GetPlayer(bld->GetPlayer()).IncreaseInventoryJob(soldier.GetJobType(), 1); + world.AddFigure(bldPos, std::make_unique(bldPos, bld->getPlayer(), bld, bld, rank)); + world.getPlayer(bld->getPlayer()).IncreaseInventoryJob(soldier.getJobType(), 1); if(numArmoredSoldiers > 0) { - world.GetPlayer(bld->GetPlayer()) - .IncreaseInventoryJob(jobEnumToAmoredSoldierEnum(soldier.GetJobType()), 1); - soldier.SetArmor(true); + world.getPlayer(bld->getPlayer()) + .IncreaseInventoryJob(jobEnumToAmoredSoldierEnum(soldier.getJobType()), 1); + soldier.setArmor(true); numArmoredSoldiers--; } // Let him "walk" to goal -> Already reached -> Added and all internal states set correctly soldier.WalkToGoal(); - BOOST_TEST_REQUIRE(!soldier.GetGoal()); + BOOST_TEST_REQUIRE(!soldier.getGoal()); } - BOOST_TEST_REQUIRE(bld->GetNumTroops() == oldNumSoldiers + numSoldiers); + BOOST_TEST_REQUIRE(bld->getNumTroops() == oldNumSoldiers + numSoldiers); } void AddSoldiers(MapPoint bldPos, unsigned numWeak, unsigned numStrong) @@ -179,15 +179,15 @@ struct AttackFixtureBase : public WorldWithGCExecution, 2> soldiers{}; for(const auto job : SOLDIER_JOBS) { - soldiers[real][getSoldierRank(job)] = wh.GetNumRealFigures(job); - soldiers[visual][getSoldierRank(job)] = wh.GetNumVisualFigures(job); + soldiers[real][getSoldierRank(job)] = wh.getNumRealFigures(job); + soldiers[visual][getSoldierRank(job)] = wh.getNumVisualFigures(job); } return soldiers; } // Get counts of soldiers auto getTotalSoldiers(unsigned player) { - const auto& inv = world.GetPlayer(player).GetInventory(); + const auto& inv = world.getPlayer(player).getInventory(); std::array soldiers{}; for(const auto job : SOLDIER_JOBS) soldiers[getSoldierRank(job)] = inv[job]; @@ -209,7 +209,7 @@ struct NumSoldierTestFixture : public AttackFixtureBase<3, 56, 38> // Add some soldiers to the HQs for(const auto pos : hqPos) { - world.GetSpecObj(pos)->AddToInventory( + world.getSpecObj(pos)->AddToInventory( PeopleCounts::make(Job::General, rttr::test::randomValue(3, 10)), true); } // Assert player positions: 0: Top-Left, 1: Top-Right, 2: Bottom-Middle @@ -240,7 +240,7 @@ struct NumSoldierTestFixture : public AttackFixtureBase<3, 56, 38> MakeVisible(milBld1FarPos); } - void SetCurPlayer(unsigned playerIdx) + void setCurPlayer(unsigned playerIdx) { curPlayer = playerIdx; gwv.ChangePlayer(playerIdx, false); @@ -284,12 +284,12 @@ struct AttackFixture : public AttackFixtureBase void TestFailingAttack(const GameWorldViewer& gwv, const MapPoint& bldPos, const nobMilitary& attackSrc, unsigned numSoldiersLeft = 6u) { - BOOST_TEST_REQUIRE(attackSrc.GetNumTroops() == numSoldiersLeft); + BOOST_TEST_REQUIRE(attackSrc.getNumTroops() == numSoldiersLeft); // No available soldiers - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(bldPos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(bldPos) == 0u); this->Attack(bldPos, 1, true); // Same left - BOOST_TEST_REQUIRE(attackSrc.GetNumTroops() == numSoldiersLeft); + BOOST_TEST_REQUIRE(attackSrc.getNumTroops() == numSoldiersLeft); } }; } // namespace @@ -302,50 +302,50 @@ BOOST_FIXTURE_TEST_CASE(NumSoldiersForAttack, NumSoldierTestFixture) AddSoldiers(milBld1FarPos, 6, Job::Private); // Functions related to stationed soldiers - BOOST_TEST_REQUIRE(milBld0->HasMaxRankSoldier()); - BOOST_TEST_REQUIRE(milBld1Near->HasMaxRankSoldier()); - BOOST_TEST_REQUIRE(!milBld1Far->HasMaxRankSoldier()); - BOOST_TEST_REQUIRE(milBld1Near->GetSoldiersStrength() > milBld1Far->GetSoldiersStrength()); - BOOST_TEST_REQUIRE(milBld1Near->GetSoldiersStrength() > milBld0->GetSoldiersStrength()); + BOOST_TEST_REQUIRE(milBld0->hasMaxRankSoldier()); + BOOST_TEST_REQUIRE(milBld1Near->hasMaxRankSoldier()); + BOOST_TEST_REQUIRE(!milBld1Far->hasMaxRankSoldier()); + BOOST_TEST_REQUIRE(milBld1Near->getSoldiersStrength() > milBld1Far->getSoldiersStrength()); + BOOST_TEST_REQUIRE(milBld1Near->getSoldiersStrength() > milBld0->getSoldiersStrength()); // Player 2 has no military blds -> Can't attack - SetCurPlayer(2); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[0]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[1]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld0Pos) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld1NearPos) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld1FarPos) == 0u); - SetCurPlayer(1); + setCurPlayer(2); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[0]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[1]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld0Pos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1NearPos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1FarPos) == 0u); + setCurPlayer(1); // No self attack - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[1]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld1NearPos) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld1FarPos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[1]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1NearPos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1FarPos) == 0u); // Attack both others - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[0]) == 5u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[2]) == 5u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[0]) == 5u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[2]) == 5u); // This is in the extended range of the far bld -> 2 more (with current range) - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld0Pos) == 7u); - SetCurPlayer(0); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld0Pos) == 7u); + setCurPlayer(0); // No self attack - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[0]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld0Pos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[0]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld0Pos) == 0u); // Attack both others - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[1]) == 5u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[2]) == 5u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld1NearPos) == 5u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[1]) == 5u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[2]) == 5u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1NearPos) == 5u); // Counterpart: 2 possible for far bld - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld1FarPos) == 2u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1FarPos) == 2u); // Test in peaceful mode -- no attacks should be possible this->ggs.setSelection(AddonId::PEACEFULMODE, 1); - SetCurPlayer(1); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[0]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[2]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld0Pos) == 0u); - SetCurPlayer(0); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[1]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[2]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld1NearPos) == 0u); + setCurPlayer(1); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[0]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[2]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld0Pos) == 0u); + setCurPlayer(0); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[1]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[2]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1NearPos) == 0u); } BOOST_FIXTURE_TEST_CASE(StartAttack, AttackFixture<>) @@ -369,17 +369,17 @@ BOOST_FIXTURE_TEST_CASE(StartAttack, AttackFixture<>) MakeVisible(usualBldPos); MakeVisible(storehousePos); - world.GetPlayer(0).team = Team::Team1; - world.GetPlayer(1).team = Team::Team1; + world.getPlayer(0).team = Team::Team1; + world.getPlayer(1).team = Team::Team1; for(unsigned i = 0; i < 2; i++) - world.GetPlayer(i).MakeStartPacts(); + world.getPlayer(i).MakeStartPacts(); // Try to attack ally -> Fail TestFailingAttack(gwv, milBld1Pos, attackSrc); - world.GetPlayer(0).team = Team::Team1; - world.GetPlayer(1).team = Team::Team2; + world.getPlayer(0).team = Team::Team1; + world.getPlayer(1).team = Team::Team2; for(unsigned i = 0; i < 2; i++) - world.GetPlayer(i).MakeStartPacts(); + world.getPlayer(i).MakeStartPacts(); // Try to attack non-military bld -> Fail TestFailingAttack(gwv, usualBldPos, attackSrc); @@ -389,47 +389,47 @@ BOOST_FIXTURE_TEST_CASE(StartAttack, AttackFixture<>) // Try to attack newly build bld -> Fail BOOST_TEST_REQUIRE(world.CalcVisiblityWithAllies(milBld1Pos, curPlayer) == Visibility::Visible); - BOOST_TEST_REQUIRE(milBld1->IsNewBuilt()); + BOOST_TEST_REQUIRE(milBld1->isNewBuilt()); TestFailingAttack(gwv, milBld1Pos, attackSrc); // Add soldier AddSoldiers(milBld1Pos, 1, 0); - BOOST_TEST_REQUIRE(!milBld1->IsNewBuilt()); + BOOST_TEST_REQUIRE(!milBld1->isNewBuilt()); // Try to attack invisible bld -> Fail - MapNode& node = world.GetNodeWriteable(milBld1Pos); + MapNode& node = world.getNodeWriteable(milBld1Pos); node.fow[0].visibility = Visibility::FogOfWar; BOOST_TEST_REQUIRE(world.CalcVisiblityWithAllies(milBld1Pos, curPlayer) == Visibility::FogOfWar); TestFailingAttack(gwv, milBld1Pos, attackSrc); // Attack it node.fow[0].visibility = Visibility::Visible; - BOOST_TEST_REQUIRE(attackSrc.GetNumTroops() == 6u); - auto itTroops = attackSrc.GetTroops().begin(); + BOOST_TEST_REQUIRE(attackSrc.getNumTroops() == 6u); + auto itTroops = attackSrc.getTroops().begin(); for(int i = 0; i < 3; i++, ++itTroops) - BOOST_TEST_REQUIRE(itTroops->GetRank() == 0u); + BOOST_TEST_REQUIRE(itTroops->getRank() == 0u); for(int i = 3; i < 6; i++, ++itTroops) - BOOST_TEST_REQUIRE(itTroops->GetRank() == 4u); + BOOST_TEST_REQUIRE(itTroops->getRank() == 4u); this->Attack(milBld1Pos, 1, true); // 1 strong soldier has left - BOOST_TEST_REQUIRE(attackSrc.GetNumTroops() == 5u); - itTroops = attackSrc.GetTroops().begin(); + BOOST_TEST_REQUIRE(attackSrc.getNumTroops() == 5u); + itTroops = attackSrc.getTroops().begin(); for(int i = 0; i < 3; i++, ++itTroops) - BOOST_TEST_REQUIRE(itTroops->GetRank() == 0u); + BOOST_TEST_REQUIRE(itTroops->getRank() == 0u); for(int i = 3; i < 5; i++, ++itTroops) - BOOST_TEST_REQUIRE(itTroops->GetRank() == 4u); + BOOST_TEST_REQUIRE(itTroops->getRank() == 4u); // Attack with 1 weak soldier this->Attack(milBld1Pos, 1, false); // 1 weak soldier has left - BOOST_TEST_REQUIRE(attackSrc.GetNumTroops() == 4u); - itTroops = attackSrc.GetTroops().begin(); + BOOST_TEST_REQUIRE(attackSrc.getNumTroops() == 4u); + itTroops = attackSrc.getTroops().begin(); for(int i = 0; i < 2; i++, ++itTroops) - BOOST_TEST_REQUIRE(itTroops->GetRank() == 0u); + BOOST_TEST_REQUIRE(itTroops->getRank() == 0u); for(int i = 2; i < 4; i++, ++itTroops) - BOOST_TEST_REQUIRE(itTroops->GetRank() == 4u); + BOOST_TEST_REQUIRE(itTroops->getRank() == 4u); // -> 2 strong, 2 weak remaining, attack with 3 weak ones -> 1 strong remaining this->Attack(milBld1Pos, 3, false); - BOOST_TEST_REQUIRE(attackSrc.GetNumTroops() == 1u); - BOOST_TEST(attackSrc.GetTroops().front().GetRank() == 4u); + BOOST_TEST_REQUIRE(attackSrc.getNumTroops() == 1u); + BOOST_TEST(attackSrc.getTroops().front().getRank() == 4u); // None left TestFailingAttack(gwv, milBld1Pos, attackSrc, 1u); @@ -448,13 +448,13 @@ BOOST_FIXTURE_TEST_CASE(TroopLimitCommandRejectsInvalidSerializedRank, AttackFix } for(unsigned rank = 0; rank < expectedLimits.size(); ++rank) - BOOST_TEST_REQUIRE(milBld0->GetTroopLimit(rank) == expectedLimits[rank]); + BOOST_TEST_REQUIRE(milBld0->getTroopLimit(rank) == expectedLimits[rank]); BOOST_REQUIRE_THROW(this->SetTroopLimit(milBld0Pos, NUM_SOLDIER_RANKS, expectedLimits.back() + limitStep), std::range_error); for(unsigned rank = 0; rank < expectedLimits.size(); ++rank) - BOOST_TEST_REQUIRE(milBld0->GetTroopLimit(rank) == expectedLimits[rank]); + BOOST_TEST_REQUIRE(milBld0->getTroopLimit(rank) == expectedLimits[rank]); } BOOST_FIXTURE_TEST_CASE(ConquerBld, AttackFixture<>) @@ -466,64 +466,64 @@ BOOST_FIXTURE_TEST_CASE(ConquerBld, AttackFixture<>) // Add soldiers and build road so that HQ and send additional soldiers to the building starting the attack PeopleCounts soldiers; soldiers[Job::Sergeant] = 10; - ensureNonNull(world.GetSpecObj(hqPos[curPlayer])).AddToInventory(soldiers, true); + ensureNonNull(world.getSpecObj(hqPos[curPlayer])).AddToInventory(soldiers, true); BuildRoadForBlds(milBld0Pos, hqPos[0]); // Start attack ->1 (weak one first) this->Attack(milBld1Pos, 1, false); this->Attack(milBld1Pos, 5, false); - BOOST_TEST_REQUIRE(milBld0->GetNumTroops() == 1u); - BOOST_TEST_REQUIRE(milBld1->GetNumTroops() == 2u); + BOOST_TEST_REQUIRE(milBld0->getNumTroops() == 1u); + BOOST_TEST_REQUIRE(milBld1->getNumTroops() == 2u); // Run till attackers reach bld. 1 Soldier will leave for them. // 1 stays inside till an attacker is at door // 20 GFs/node + 30 GFs for leaving const unsigned distance = world.CalcDistance(milBld0Pos, milBld1Pos); - RTTR_EXEC_TILL(distance * 20 + 30, milBld1->GetNumTroops() == 1); - BOOST_TEST_REQUIRE(milBld1->GetNumTroops() + milBld1->GetLeavingFigures().size() == 2u); - const Inventory& attackedPlInventory = world.GetPlayer(1).GetInventory(); + RTTR_EXEC_TILL(distance * 20 + 30, milBld1->getNumTroops() == 1); + BOOST_TEST_REQUIRE(milBld1->getNumTroops() + milBld1->getLeavingFigures().size() == 2u); + const Inventory& attackedPlInventory = world.getPlayer(1).getInventory(); const unsigned oldWeakSoldierCt = attackedPlInventory.people[Job::Private]; const unsigned oldStrongerSoldierCt = attackedPlInventory.people[Job::PrivateFirstClass]; - const unsigned oldAttackerStrongSoldierCt = world.GetPlayer(curPlayer).GetInventory().people[Job::General]; + const unsigned oldAttackerStrongSoldierCt = world.getPlayer(curPlayer).getInventory().people[Job::General]; // 1st soldier will walk towards attacker and will be killed // Once an attacker reaches the flag, the bld will send a defender - BOOST_TEST_REQUIRE(!milBld1->GetDefender()); - RTTR_EXEC_TILL(300, milBld1->GetNumTroops() == 0); + BOOST_TEST_REQUIRE(!milBld1->getDefender()); + RTTR_EXEC_TILL(300, milBld1->getNumTroops() == 0); // Defender deployed, attacker at flag - BOOST_TEST_REQUIRE(milBld1->GetDefender()); + BOOST_TEST_REQUIRE(milBld1->getDefender()); { - const auto figures = world.GetFigures(milBld1->GetFlagPos()); + const auto figures = world.getFigures(milBld1->getFlagPos()); BOOST_TEST_REQUIRE(figures.size() == 1u); const auto& attacker = dynamic_cast(*figures.begin()); - BOOST_TEST_REQUIRE(static_cast(attacker).GetPlayer() == curPlayer); + BOOST_TEST_REQUIRE(static_cast(attacker).getPlayer() == curPlayer); } // Lets fight - RTTR_EXEC_TILL(1000, milBld1->IsBeingCaptured()); + RTTR_EXEC_TILL(1000, milBld1->isBeingCaptured()); // Let others in - RTTR_EXEC_TILL(200, !milBld1->IsBeingCaptured()); + RTTR_EXEC_TILL(200, !milBld1->isBeingCaptured()); // Building conquered - BOOST_TEST_REQUIRE(milBld1->GetPlayer() == curPlayer); + BOOST_TEST_REQUIRE(milBld1->getPlayer() == curPlayer); // 1 soldier must be inside - BOOST_TEST_REQUIRE(milBld1->GetNumTroops() > 1u); + BOOST_TEST_REQUIRE(milBld1->getNumTroops() > 1u); // Weak soldier must be dead BOOST_TEST_REQUIRE(attackedPlInventory.people[Job::Private] == oldWeakSoldierCt - 1); // Src building gets refilled - RTTR_EXEC_TILL(800, milBld0->GetNumTroops() == 6u); + RTTR_EXEC_TILL(800, milBld0->getNumTroops() == 6u); // We may have lost soldiers - BOOST_TEST_REQUIRE(world.GetPlayer(curPlayer).GetInventory().people[Job::General] <= oldAttackerStrongSoldierCt); + BOOST_TEST_REQUIRE(world.getPlayer(curPlayer).getInventory().people[Job::General] <= oldAttackerStrongSoldierCt); // The enemy may have lost his stronger soldier BOOST_TEST_REQUIRE(attackedPlInventory.people[Job::PrivateFirstClass] <= oldStrongerSoldierCt); // But only one BOOST_TEST_REQUIRE(attackedPlInventory.people[Job::PrivateFirstClass] >= oldStrongerSoldierCt - 1); // At least 2 survivors - BOOST_TEST_REQUIRE(milBld1->GetNumTroops() > 2u); + BOOST_TEST_REQUIRE(milBld1->getNumTroops() > 2u); // Points around bld should be ours - const std::vector pts = world.GetPointsInRadius(milBld1Pos, 3); + const std::vector pts = world.getPointsInRadius(milBld1Pos, 3); for(const MapPoint& pt : pts) { - BOOST_TEST_REQUIRE(world.GetNode(pt).owner == curPlayer + 1u); + BOOST_TEST_REQUIRE(world.getNode(pt).owner == curPlayer + 1u); } } @@ -532,23 +532,23 @@ BOOST_FIXTURE_TEST_CASE(ArmoredSoldierLosesArmorInFight, AttackFixture<>) AddSoldiers(milBld0Pos, 3, Job::General, 2); AddSoldiers(milBld1Pos, 1, Job::Private, 1); - BOOST_TEST_REQUIRE(milBld0->GetNumTroops() == 3u); - BOOST_TEST_REQUIRE(milBld1->GetNumTroops() == 1u); + BOOST_TEST_REQUIRE(milBld0->getNumTroops() == 3u); + BOOST_TEST_REQUIRE(milBld1->getNumTroops() == 1u); // Start attack ->1 (strong one first) this->Attack(milBld1Pos, 1, true); - RTTR_EXEC_TILL(30, milBld0->GetNumTroops() == 2); + RTTR_EXEC_TILL(30, milBld0->getNumTroops() == 2); auto countArmoredSoldiers = [](nobMilitary* bld) { - const auto troops = bld->GetTroops(); + const auto troops = bld->getTroops(); return std::count_if(std::begin(troops), std::end(troops), - [](const auto& soldier) { return soldier.HasArmor(); }); + [](const auto& soldier) { return soldier.hasArmor(); }); }; auto countNotArmoredSoldiers = [](nobMilitary* bld) { - const auto troops = bld->GetTroops(); + const auto troops = bld->getTroops(); return std::count_if(std::begin(troops), std::end(troops), - [](const auto& soldier) { return !soldier.HasArmor(); }); + [](const auto& soldier) { return !soldier.hasArmor(); }); }; BOOST_TEST_REQUIRE(countArmoredSoldiers(milBld0) == 1u); @@ -556,30 +556,30 @@ BOOST_FIXTURE_TEST_CASE(ArmoredSoldierLosesArmorInFight, AttackFixture<>) // Start attack ->1 (weak one first) this->Attack(milBld1Pos, 1, false); - RTTR_EXEC_TILL(30, milBld0->GetNumTroops() == 1); + RTTR_EXEC_TILL(30, milBld0->getNumTroops() == 1); BOOST_TEST_REQUIRE(countArmoredSoldiers(milBld0) == 1u); BOOST_TEST_REQUIRE(countNotArmoredSoldiers(milBld0) == 0u); - const Inventory& attackedPlInventory = world.GetPlayer(1).GetInventory(); + const Inventory& attackedPlInventory = world.getPlayer(1).getInventory(); const unsigned numOldWeakSoldiers = attackedPlInventory.people[Job::Private]; const unsigned numOldWeakSoldiersWithArmor = attackedPlInventory[jobEnumToAmoredSoldierEnum(Job::Private)]; // Run till attackers reach flag of bld. The bld will send a defender. // 20 GFs/node + 60 GFs for leaving const unsigned distance = world.CalcDistance(milBld0Pos, milBld1Pos); - RTTR_EXEC_TILL(distance * 20 + 60, milBld1->GetDefender() != nullptr); + RTTR_EXEC_TILL(distance * 20 + 60, milBld1->getDefender() != nullptr); - const auto soldiers = world.GetFigures(milBld1->GetFlagPos()); + const auto soldiers = world.getFigures(milBld1->getFlagPos()); BOOST_TEST_REQUIRE(soldiers.size() == 1u); const auto& attacker = dynamic_cast(*soldiers.begin()); - BOOST_TEST_REQUIRE(static_cast(attacker).GetPlayer() == curPlayer); + BOOST_TEST_REQUIRE(static_cast(attacker).getPlayer() == curPlayer); // Lets fight until defender has no armor anymore // He should not lose a hitpoint but the armor - RTTR_EXEC_TILL(1000, milBld1->GetDefender()->HasArmor() == false); + RTTR_EXEC_TILL(1000, milBld1->getDefender()->hasArmor() == false); BOOST_TEST(attackedPlInventory[jobEnumToAmoredSoldierEnum(Job::Private)] == numOldWeakSoldiersWithArmor - 1); BOOST_TEST(attackedPlInventory.people[Job::Private] == numOldWeakSoldiers); - BOOST_TEST(milBld1->GetDefender()->GetHitpoints() == HITPOINTS[milBld1->GetDefender()->GetRank()]); + BOOST_TEST(milBld1->getDefender()->getHitpoints() == HITPOINTS[milBld1->getDefender()->getRank()]); } BOOST_FIXTURE_TEST_CASE(TroopLimitKeepsOrderedRestrictedSoldier, AttackFixture<>) @@ -588,34 +588,34 @@ BOOST_FIXTURE_TEST_CASE(TroopLimitKeepsOrderedRestrictedSoldier, AttackFixture<> milSettings[4 + rttr::enum_cast(FrontierDistance::Far)] = 0; this->ChangeMilitary(milSettings); - auto* hq = world.GetSpecObj(hqPos[0]); + auto* hq = world.getSpecObj(hqPos[0]); BOOST_TEST_REQUIRE(hq); const Job soldierJob = Job::Private; const unsigned soldierRank = getSoldierRank(soldierJob); hq->AddToInventory(PeopleCounts::make(soldierJob, 2), true); - const unsigned hqSoldiersBefore = hq->GetNumRealFigures(soldierJob); + const unsigned hqSoldiersBefore = hq->getNumRealFigures(soldierJob); BOOST_TEST_REQUIRE(hqSoldiersBefore > 0u); BuildRoadForBlds(milBld0Pos, hqPos[0]); milBld0->RegulateTroops(); - BOOST_TEST_REQUIRE(milBld0->GetNumTroops() == 0u); - BOOST_TEST_REQUIRE(hq->GetLeavingFigures().size() == 1u); - BOOST_TEST_REQUIRE(hq->GetNumRealFigures(soldierJob) + 1 == hqSoldiersBefore); + BOOST_TEST_REQUIRE(milBld0->getNumTroops() == 0u); + BOOST_TEST_REQUIRE(hq->getLeavingFigures().size() == 1u); + BOOST_TEST_REQUIRE(hq->getNumRealFigures(soldierJob) + 1 == hqSoldiersBefore); this->SetInventorySetting(hqPos[0], soldierJob, EInventorySetting::Stop); milBld0->SetTroopLimit(soldierRank, 0); - BOOST_TEST_REQUIRE(milBld0->GetNumTroops() == 0u); - BOOST_TEST_REQUIRE(hq->GetLeavingFigures().size() == 1u); - BOOST_TEST_REQUIRE(hq->GetNumRealFigures(soldierJob) + 1 == hqSoldiersBefore); + BOOST_TEST_REQUIRE(milBld0->getNumTroops() == 0u); + BOOST_TEST_REQUIRE(hq->getLeavingFigures().size() == 1u); + BOOST_TEST_REQUIRE(hq->getNumRealFigures(soldierJob) + 1 == hqSoldiersBefore); - RTTR_EXEC_TILL(500, milBld0->GetNumTroops() == 1u); + RTTR_EXEC_TILL(500, milBld0->getNumTroops() == 1u); - BOOST_TEST_REQUIRE(milBld0->GetNumTroops() == 1u); - BOOST_TEST_REQUIRE(hq->GetNumRealFigures(soldierJob) + 1 == hqSoldiersBefore); - BOOST_TEST_REQUIRE(milBld0->GetLeavingFigures().empty()); + BOOST_TEST_REQUIRE(milBld0->getNumTroops() == 1u); + BOOST_TEST_REQUIRE(hq->getNumRealFigures(soldierJob) + 1 == hqSoldiersBefore); + BOOST_TEST_REQUIRE(milBld0->getLeavingFigures().empty()); } BOOST_FIXTURE_TEST_CASE(CoinTrainingUpgradesRankChainByDefault, AttackFixture<>) @@ -665,16 +665,16 @@ BOOST_FIXTURE_TEST_CASE(ConquerBldCoinAddonEnable, AttackFixture<>) // ensure that coins are disabled milBld1->SetCoinsAllowed(false); - BOOST_TEST_REQUIRE(milBld1->IsGoldDisabled()); + BOOST_TEST_REQUIRE(milBld1->isGoldDisabled()); // Start attack -> 1 this->Attack(milBld1Pos, 6, false); - BOOST_TEST_REQUIRE(milBld0->GetNumTroops() == 1u); + BOOST_TEST_REQUIRE(milBld0->getNumTroops() == 1u); - RTTR_EXEC_TILL(2000, milBld1->GetPlayer() == curPlayer); + RTTR_EXEC_TILL(2000, milBld1->getPlayer() == curPlayer); // check if coins were enabled after building was captured - BOOST_TEST_REQUIRE(!milBld1->IsGoldDisabled()); + BOOST_TEST_REQUIRE(!milBld1->isGoldDisabled()); } BOOST_FIXTURE_TEST_CASE(ConquerBldCoinAddonDisable, AttackFixture<>) @@ -686,16 +686,16 @@ BOOST_FIXTURE_TEST_CASE(ConquerBldCoinAddonDisable, AttackFixture<>) // ensure that coins are enabled milBld1->SetCoinsAllowed(true); - BOOST_TEST_REQUIRE(!milBld1->IsGoldDisabled()); + BOOST_TEST_REQUIRE(!milBld1->isGoldDisabled()); // Start attack -> 1 this->Attack(milBld1Pos, 6, false); - BOOST_TEST_REQUIRE(milBld0->GetNumTroops() == 1u); + BOOST_TEST_REQUIRE(milBld0->getNumTroops() == 1u); - RTTR_EXEC_TILL(2000, milBld1->GetPlayer() == curPlayer); + RTTR_EXEC_TILL(2000, milBld1->getPlayer() == curPlayer); // check if coins were disabled after building was captured - BOOST_TEST_REQUIRE(milBld1->IsGoldDisabled()); + BOOST_TEST_REQUIRE(milBld1->isGoldDisabled()); } enum Case @@ -723,67 +723,67 @@ BOOST_DATA_TEST_CASE_F(AttackFixture<>, ConquerBldArmorAddon, // ensure that armor are enabled/disabled bool armorAllowedBeforeAttack = (sample == Case::KeepEnabled || sample == Case::DisableAfterEnable); milBld1->SetArmorAllowed(armorAllowedBeforeAttack); - BOOST_TEST_REQUIRE(milBld1->IsArmorAllowed() == armorAllowedBeforeAttack); + BOOST_TEST_REQUIRE(milBld1->isArmorAllowed() == armorAllowedBeforeAttack); // Start attack -> 1 this->Attack(milBld1Pos, 5, false); - BOOST_TEST_REQUIRE(milBld0->GetNumTroops() == 1u); + BOOST_TEST_REQUIRE(milBld0->getNumTroops() == 1u); - RTTR_EXEC_TILL(2000, milBld1->GetPlayer() == curPlayer); + RTTR_EXEC_TILL(2000, milBld1->getPlayer() == curPlayer); // check if armor were enabled/disabled after building was captured bool armorAlloweAfterCaptured = (sample == Case::KeepEnabled || sample == Case::EnableAfterDisable); - BOOST_TEST_REQUIRE(milBld1->IsArmorAllowed() == armorAlloweAfterCaptured); + BOOST_TEST_REQUIRE(milBld1->isArmorAllowed() == armorAlloweAfterCaptured); } using AttackFixture4P = AttackFixture<4, 32, 34>; BOOST_FIXTURE_TEST_CASE(ConquerWithMultipleWalkingIn, AttackFixture4P) { - world.GetPlayer(0).team = Team::Team1; //-V525 - world.GetPlayer(1).team = Team::None; - world.GetPlayer(2).team = Team::Team1; // Allied to 0 - world.GetPlayer(3).team = Team::Team2; // Hostile to 0 + world.getPlayer(0).team = Team::Team1; //-V525 + world.getPlayer(1).team = Team::None; + world.getPlayer(2).team = Team::Team1; // Allied to 0 + world.getPlayer(3).team = Team::Team2; // Hostile to 0 for(unsigned i = 0; i < 4; i++) - world.GetPlayer(i).MakeStartPacts(); + world.getPlayer(i).MakeStartPacts(); MilitarySettings milSettings = MILITARY_SETTINGS_SCALE; milSettings[2] = 0; // No aggressive defenders for attacker this->ChangeMilitary(milSettings); AddSoldiers(milBld0Pos, 0, 6); AddSoldiers(milBld1Pos, 1, Job::Private); - const MapPoint milBld1FlagPos = milBld1->GetFlagPos(); + const MapPoint milBld1FlagPos = milBld1->getFlagPos(); // Scenario 1: Attack with one soldier. // Once enemy is defeated we walk in with another soldier of the enemy who wants to occupy its building. // The other soldier is faster -> we have to fight him this->Attack(milBld1Pos, 1, true); - BOOST_TEST_REQUIRE(milBld0->GetLeavingFigures().size() == 1u); //-V807 - auto& attacker = dynamic_cast(milBld0->GetLeavingFigures().front()); + BOOST_TEST_REQUIRE(milBld0->getLeavingFigures().size() == 1u); //-V807 + auto& attacker = dynamic_cast(milBld0->getLeavingFigures().front()); // Let him come out - RTTR_EXEC_TILL(70, milBld0->GetLeavingFigures().empty()); //-V807 + RTTR_EXEC_TILL(70, milBld0->getLeavingFigures().empty()); //-V807 moveObjTo(world, attacker, milBld1FlagPos); - BOOST_TEST_REQUIRE(!milBld1->IsDoorOpen()); - const auto flagFigs = world.GetFigures(milBld1FlagPos); - RTTR_EXEC_TILL(70, flagFigs.size() == 1u && flagFigs.begin()->GetGOT() == GO_Type::Fighting); //-V807 - BOOST_TEST_REQUIRE(!milBld1->IsDoorOpen()); + BOOST_TEST_REQUIRE(!milBld1->isDoorOpen()); + const auto flagFigs = world.getFigures(milBld1FlagPos); + RTTR_EXEC_TILL(70, flagFigs.size() == 1u && flagFigs.begin()->getGOT() == GO_Type::Fighting); //-V807 + BOOST_TEST_REQUIRE(!milBld1->isDoorOpen()); // Speed up fight by reducing defenders HP to 1 - auto* defender = const_cast(milBld1->GetDefender()); - while(defender->GetHitpoints() > 1u) + auto* defender = const_cast(milBld1->getDefender()); + while(defender->getHitpoints() > 1u) defender->TakeHit(); - RTTR_EXEC_TILL(500, milBld1->GetDefender() == nullptr); + RTTR_EXEC_TILL(500, milBld1->getDefender() == nullptr); // Defender defeated. Attacker moving in. - BOOST_TEST_REQUIRE(attacker.IsMoving()); - BOOST_TEST_REQUIRE(attacker.GetCurMoveDir() == Direction::NorthWest); + BOOST_TEST_REQUIRE(attacker.isMoving()); + BOOST_TEST_REQUIRE(attacker.getCurMoveDir() == Direction::NorthWest); // Door opened - BOOST_TEST_REQUIRE(milBld1->IsDoorOpen()); + BOOST_TEST_REQUIRE(milBld1->isDoorOpen()); // New soldiers walked in AddSoldiers(milBld1Pos, 4, Job::Private); // Let attacker walk in (try it at least) - RTTR_EXEC_TILL(20, attacker.GetPos() == milBld1Pos); - RTTR_EXEC_TILL(20, attacker.GetPos() == milBld1FlagPos); + RTTR_EXEC_TILL(20, attacker.getPos() == milBld1Pos); + RTTR_EXEC_TILL(20, attacker.getPos() == milBld1FlagPos); // New fight and door closed - RTTR_EXEC_TILL(70, flagFigs.size() == 1u && flagFigs.front().GetGOT() == GO_Type::Fighting); - BOOST_TEST_REQUIRE(!milBld1->IsDoorOpen()); + RTTR_EXEC_TILL(70, flagFigs.size() == 1u && flagFigs.front().getGOT() == GO_Type::Fighting); + BOOST_TEST_REQUIRE(!milBld1->isDoorOpen()); // Scenario 2: Attacker successful // We want all possible troops: @@ -795,15 +795,15 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithMultipleWalkingIn, AttackFixture4P) // 1. curPlayer = 1; this->Attack(milBld0Pos, 1, false); - BOOST_TEST_REQUIRE(milBld1->GetLeavingFigures().size() == 1u); - auto& attackerFromPl0 = dynamic_cast(milBld1->GetLeavingFigures().front()); + BOOST_TEST_REQUIRE(milBld1->getLeavingFigures().size() == 1u); + auto& attackerFromPl0 = dynamic_cast(milBld1->getLeavingFigures().front()); // 2. curPlayer = 0; this->Attack(milBld1Pos, 1, true); // Move him directly out - BOOST_TEST_REQUIRE(milBld0->GetLeavingFigures().size() == 1u); - auto& secAttacker = dynamic_cast(milBld0->GetLeavingFigures().front()); - RTTR_EXEC_TILL(70, milBld0->GetLeavingFigures().empty()); //-V807 + BOOST_TEST_REQUIRE(milBld0->getLeavingFigures().size() == 1u); + auto& secAttacker = dynamic_cast(milBld0->getLeavingFigures().front()); + RTTR_EXEC_TILL(70, milBld0->getLeavingFigures().empty()); //-V807 moveObjTo(world, secAttacker, world.MakeMapPoint(milBld1FlagPos - Position(15, 0))); nofAggressiveDefender& aggDefender = ensureNonNull(milBld1->SendAggressiveDefender(secAttacker)); secAttacker.LetsFight(aggDefender); @@ -814,8 +814,8 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithMultipleWalkingIn, AttackFixture4P) BuildingFactory::CreateBuilding(world, BuildingType::Guardhouse, bldPos, curPlayer, Nation::Africans)); AddSoldiers(bldPos, 2, Job::Private); this->Attack(milBld1Pos, 1, false); - BOOST_TEST_REQUIRE(alliedBld->GetLeavingFigures().size() == 1u); - auto& alliedAttacker = dynamic_cast(alliedBld->GetLeavingFigures().front()); + BOOST_TEST_REQUIRE(alliedBld->getLeavingFigures().size() == 1u); + auto& alliedAttacker = dynamic_cast(alliedBld->getLeavingFigures().front()); // 4. curPlayer = 3; bldPos = hqPos[curPlayer] + MapPoint(3, 0); @@ -823,8 +823,8 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithMultipleWalkingIn, AttackFixture4P) BuildingFactory::CreateBuilding(world, BuildingType::Guardhouse, bldPos, curPlayer, Nation::Africans)); AddSoldiers(bldPos, 2, Job::Private); this->Attack(milBld1Pos, 1, false); - BOOST_TEST_REQUIRE(hostileBld->GetLeavingFigures().size() == 1u); - auto& hostileAttacker = dynamic_cast(hostileBld->GetLeavingFigures().front()); + BOOST_TEST_REQUIRE(hostileBld->getLeavingFigures().size() == 1u); + auto& hostileAttacker = dynamic_cast(hostileBld->getLeavingFigures().front()); // Make sure all other soldiers left their buildings (<=30GFs each + 20 for walking to flag and a bit further) RTTR_SKIP_GFS(30 + 20 + 10); @@ -837,60 +837,60 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithMultipleWalkingIn, AttackFixture4P) RTTR_SKIP_GFS(30); rescheduleWalkEvent(em, aggDefender, 10000); // Let defenders (2!) die - defender = const_cast(milBld1->GetDefender()); - while(defender->GetHitpoints() > 1u) + defender = const_cast(milBld1->getDefender()); + while(defender->getHitpoints() > 1u) defender->TakeHit(); - RTTR_EXEC_TILL(500, milBld1->GetNumTroops() == 0u); - defender = const_cast(milBld1->GetDefender()); - while(defender->GetHitpoints() > 1u) + RTTR_EXEC_TILL(500, milBld1->getNumTroops() == 0u); + defender = const_cast(milBld1->getDefender()); + while(defender->getHitpoints() > 1u) defender->TakeHit(); - RTTR_EXEC_TILL(500, milBld1->GetDefender() == nullptr); + RTTR_EXEC_TILL(500, milBld1->getDefender() == nullptr); // Defender defeated. Attacker moving in. - BOOST_TEST_REQUIRE(attacker.IsMoving()); - BOOST_TEST_REQUIRE(attacker.GetCurMoveDir() == Direction::NorthWest); + BOOST_TEST_REQUIRE(attacker.isMoving()); + BOOST_TEST_REQUIRE(attacker.getCurMoveDir() == Direction::NorthWest); // Door opened - BOOST_TEST_REQUIRE(milBld1->IsDoorOpen()); + BOOST_TEST_REQUIRE(milBld1->isDoorOpen()); // Give him a bit of a head start RTTR_SKIP_GFS(1); // 5. Create new soldier who walks in after the attacker auto& newSld = world.AddFigure(milBld1FlagPos, std::make_unique(milBld1FlagPos, 1, milBld1, milBld1, 0)); ; - milBld1->GotWorker(newSld.GetJobType(), newSld); + milBld1->GotWorker(newSld.getJobType(), newSld); newSld.ActAtFirst(); // Attacker faster -> Bld taken - RTTR_EXEC_TILL(30, milBld1->GetPlayer() == 0u); + RTTR_EXEC_TILL(30, milBld1->getPlayer() == 0u); // New soldier should be wandering - RTTR_EXEC_TILL(10, newSld.IsWandering()); + RTTR_EXEC_TILL(10, newSld.isWandering()); // And door should be closed (latest after wandering soldier left flag) - RTTR_EXEC_TILL(40, !milBld1->IsDoorOpen()); + RTTR_EXEC_TILL(40, !milBld1->isDoorOpen()); // 1. Attackers from this building // No home -> Wander - BOOST_TEST_REQUIRE(!attackerFromPl0.GetHomeBld()); + BOOST_TEST_REQUIRE(!attackerFromPl0.getHomeBld()); rescheduleWalkEvent(em, attackerFromPl0, 1); - RTTR_EXEC_TILL(2, attackerFromPl0.IsWandering()); + RTTR_EXEC_TILL(2, attackerFromPl0.isWandering()); // 2. Aggressive defenders from this building // No further attack (unless already fighting) and wander // The attacker proceeds to the building and occupies it rescheduleWalkEvent(em, secAttacker, 1); rescheduleWalkEvent(em, aggDefender, 2); RTTR_SKIP_GFS(2); - BOOST_TEST_REQUIRE(aggDefender.GetAttacker() == nullptr); - BOOST_TEST_REQUIRE(secAttacker.GetHuntingDefender() == nullptr); - BOOST_TEST_REQUIRE(aggDefender.IsWandering()); - RTTR_EXEC_TILL(270, milBld1->GetNumTroops() == 2u); + BOOST_TEST_REQUIRE(aggDefender.getAttacker() == nullptr); + BOOST_TEST_REQUIRE(secAttacker.getHuntingDefender() == nullptr); + BOOST_TEST_REQUIRE(aggDefender.isWandering()); + RTTR_EXEC_TILL(270, milBld1->getNumTroops() == 2u); // 3. Allied aggressor towards this bld // Abort attack and return home rescheduleWalkEvent(em, alliedAttacker, 1); - RTTR_EXEC_TILL(1, alliedAttacker.GetAttackedGoal() == nullptr); - RTTR_EXEC_TILL(90, alliedBld->GetNumTroops() == 2u); + RTTR_EXEC_TILL(1, alliedAttacker.getAttackedGoal() == nullptr); + RTTR_EXEC_TILL(90, alliedBld->getNumTroops() == 2u); // 4. Hostile aggressor towards this bld // Continue attack and fight rescheduleWalkEvent(em, hostileAttacker, 1); - BOOST_TEST_REQUIRE(hostileAttacker.GetAttackedGoal() != nullptr); - RTTR_EXEC_TILL(220, hostileAttacker.GetPos() == milBld1FlagPos); - RTTR_EXEC_TILL(50, world.GetFigures(milBld1FlagPos).begin()->GetGOT() == GO_Type::Fighting); + BOOST_TEST_REQUIRE(hostileAttacker.getAttackedGoal() != nullptr); + RTTR_EXEC_TILL(220, hostileAttacker.getPos() == milBld1FlagPos); + RTTR_EXEC_TILL(50, world.getFigures(milBld1FlagPos).begin()->getGOT() == GO_Type::Fighting); } BOOST_FIXTURE_TEST_CASE(ConquerWithCarriersWalkingIn, AttackFixture<2>) @@ -899,13 +899,13 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithCarriersWalkingIn, AttackFixture<2>) // 2. Carrier with coin walking out of the building AddSoldiers(milBld0Pos, 0, 6); AddSoldiers(milBld1Pos, 1, Job::Private); - const MapPoint milBld1FlagPos = milBld1->GetFlagPos(); + const MapPoint milBld1FlagPos = milBld1->getFlagPos(); curPlayer = 1; const MapPoint flagPos = world.MakeMapPoint(milBld1FlagPos - Position(2, 0)); this->BuildRoad(milBld1FlagPos, false, std::vector(2, Direction::West)); - auto& flag = ensureNonNull(world.GetSpecObj(flagPos)); - RoadSegment* rs = flag.GetRoute(Direction::East); + auto& flag = ensureNonNull(world.getSpecObj(flagPos)); + RoadSegment* rs = flag.getRoute(Direction::East); BOOST_TEST_REQUIRE(rs); auto& carrierIn = world.AddFigure(flagPos, std::make_unique(CarrierType::Normal, flagPos, curPlayer, rs, &flag)); @@ -921,11 +921,11 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithCarriersWalkingIn, AttackFixture<2>) coin->RecalcRoute(); flag.AddWare(std::move(coin)); } - world.GetPlayer(1).IncreaseInventoryWare(GoodType::Coins, 2); + world.getPlayer(1).IncreaseInventoryWare(GoodType::Coins, 2); carrierIn.ActAtFirst(); carrierOut.ActAtFirst(); // Both picked up - BOOST_TEST_REQUIRE(flag.GetNumWares() == 0u); + BOOST_TEST_REQUIRE(flag.getNumWares() == 0u); // Move carriers to flag for(unsigned i = 0; i < 2; i++) { @@ -939,14 +939,14 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithCarriersWalkingIn, AttackFixture<2>) rescheduleWalkEvent(em, carrierOut, 1); RTTR_SKIP_GFS(1); rescheduleWalkEvent(em, carrierOut, 10000); - BOOST_TEST_REQUIRE(carrierIn.GetCurMoveDir() == Direction::NorthWest); - BOOST_TEST_REQUIRE(carrierOut.GetCurMoveDir() == Direction::SouthEast); + BOOST_TEST_REQUIRE(carrierIn.getCurMoveDir() == Direction::NorthWest); + BOOST_TEST_REQUIRE(carrierOut.getCurMoveDir() == Direction::SouthEast); // Add another for later MapPoint flagPosE = world.MakeMapPoint(milBld1FlagPos + Position(2, 0)); this->BuildRoad(milBld1FlagPos, false, std::vector(2, Direction::East)); - auto& flagE = ensureNonNull(world.GetSpecObj(flagPosE)); - RoadSegment& rsE = ensureNonNull(flagE.GetRoute(Direction::West)); + auto& flagE = ensureNonNull(world.getSpecObj(flagPosE)); + RoadSegment& rsE = ensureNonNull(flagE.getRoute(Direction::West)); auto& carrierInE = world.AddFigure(flagPosE, std::make_unique(CarrierType::Normal, flagPosE, curPlayer, &rsE, &flagE)); rsE.setCarrier(0, &carrierInE); @@ -955,61 +955,61 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithCarriersWalkingIn, AttackFixture<2>) coin->WaitAtFlag(flagE); coin->RecalcRoute(); flagE.AddWare(std::move(coin)); - world.GetPlayer(1).IncreaseInventoryWare(GoodType::Coins, 1); + world.getPlayer(1).IncreaseInventoryWare(GoodType::Coins, 1); carrierInE.ActAtFirst(); // Picked up - BOOST_TEST_REQUIRE(flagE.GetNumWares() == 0u); + BOOST_TEST_REQUIRE(flagE.getNumWares() == 0u); // And pause him rescheduleWalkEvent(em, carrierInE, 10000); curPlayer = 0; this->Attack(milBld1Pos, 1, true); - BOOST_TEST_REQUIRE(milBld0->GetLeavingFigures().size() == 1u); - auto& attacker = dynamic_cast(milBld0->GetLeavingFigures().front()); + BOOST_TEST_REQUIRE(milBld0->getLeavingFigures().size() == 1u); + auto& attacker = dynamic_cast(milBld0->getLeavingFigures().front()); // Move him directly out - RTTR_EXEC_TILL(70, milBld0->GetLeavingFigures().empty()); //-V807 + RTTR_EXEC_TILL(70, milBld0->getLeavingFigures().empty()); //-V807 moveObjTo(world, attacker, milBld1FlagPos); - RTTR_EXEC_TILL(20, attacker.GetPos() == milBld1FlagPos); + RTTR_EXEC_TILL(20, attacker.getPos() == milBld1FlagPos); // Carriers on pos or to pos get send away as soon as soldier arrives rescheduleWalkEvent(em, carrierIn, 1); rescheduleWalkEvent(em, carrierOut, 1); RTTR_SKIP_GFS(1); - BOOST_TEST_REQUIRE(carrierIn.IsWandering()); - BOOST_TEST_REQUIRE(carrierOut.IsWandering()); + BOOST_TEST_REQUIRE(carrierIn.isWandering()); + BOOST_TEST_REQUIRE(carrierOut.isWandering()); // Let east carrier walk rescheduleWalkEvent(em, carrierInE, 1); // Start fight - const auto flagFigs = world.GetFigures(milBld1FlagPos); - RTTR_EXEC_TILL(50, flagFigs.size() == 1u && flagFigs.front().GetGOT() == GO_Type::Fighting); + const auto flagFigs = world.getFigures(milBld1FlagPos); + RTTR_EXEC_TILL(50, flagFigs.size() == 1u && flagFigs.front().getGOT() == GO_Type::Fighting); // East carrier gets blocked - BOOST_TEST_REQUIRE(!carrierInE.IsMoving()); + BOOST_TEST_REQUIRE(!carrierInE.isMoving()); // Door closed latest after other carriers are gone - RTTR_EXEC_TILL(20, !milBld1->IsDoorOpen()); + RTTR_EXEC_TILL(20, !milBld1->isDoorOpen()); // Speed up fight by reducing defenders HP to 1 - auto* defender = const_cast(milBld1->GetDefender()); - while(defender->GetHitpoints() > 1u) + auto* defender = const_cast(milBld1->getDefender()); + while(defender->getHitpoints() > 1u) defender->TakeHit(); - RTTR_EXEC_TILL(500, milBld1->GetDefender() == nullptr); + RTTR_EXEC_TILL(500, milBld1->getDefender() == nullptr); // Defender defeated. Attacker moving in. - BOOST_TEST_REQUIRE(attacker.IsMoving()); - BOOST_TEST_REQUIRE(attacker.GetCurMoveDir() == Direction::NorthWest); + BOOST_TEST_REQUIRE(attacker.isMoving()); + BOOST_TEST_REQUIRE(attacker.getCurMoveDir() == Direction::NorthWest); // Door opened - BOOST_TEST_REQUIRE(milBld1->IsDoorOpen()); + BOOST_TEST_REQUIRE(milBld1->isDoorOpen()); // Blocked carrier can walk again - BOOST_TEST_REQUIRE(carrierInE.IsMoving()); + BOOST_TEST_REQUIRE(carrierInE.isMoving()); // Capture - RTTR_EXEC_TILL(20, milBld1->GetPlayer() == 0u); + RTTR_EXEC_TILL(20, milBld1->getPlayer() == 0u); // East Carrier should be wandering at some point - RTTR_EXEC_TILL(20, carrierInE.IsWandering()); + RTTR_EXEC_TILL(20, carrierInE.isWandering()); // Only 1 coin in the bld - BOOST_TEST_REQUIRE(milBld1->GetNumCoins() == 1u); + BOOST_TEST_REQUIRE(milBld1->getNumCoins() == 1u); // Door closed after carrier left it - RTTR_EXEC_TILL(40, !milBld1->IsDoorOpen()); + RTTR_EXEC_TILL(40, !milBld1->isDoorOpen()); } BOOST_FIXTURE_TEST_CASE(FlagBecomesUnreachableForWaitingAttacker, AttackFixture<2>) @@ -1031,14 +1031,14 @@ BOOST_FIXTURE_TEST_CASE(FlagBecomesUnreachableForWaitingAttacker, AttackFixture< swap(attackerBld, defenderBld); swap(plAttacker, plDefender); } - const auto attackerBldPos = attackerBld->GetPos(); - const auto defenderBldPos = defenderBld->GetPos(); + const auto attackerBldPos = attackerBld->getPos(); + const auto defenderBldPos = defenderBld->getPos(); AddSoldiers(defenderBldPos, 0, 1); AddSoldiers(attackerBldPos, 6, Job::Private); // Make defender building flag unreachable - const auto terrain = this->world.GetDescription().terrain.find( + const auto terrain = this->world.getDescription().terrain.find( [](const TerrainDesc& t) { return !t.Is(ETerrain::Walkable) && t.GetBQ() != TerrainBQ::Danger; }); - const auto flagPos = defenderBld->GetFlagPos(); + const auto flagPos = defenderBld->getFlagPos(); // At right there is 1 node of water, so not passable but soldiers can stand on other side /* "B"=Attacked building, "F"=Flag, "L"=Land terrain, Rest is water @@ -1057,66 +1057,66 @@ BOOST_FIXTURE_TEST_CASE(FlagBecomesUnreachableForWaitingAttacker, AttackFixture< for(const auto dy : helpers::range(-2, 3)) { MapPoint pt = world.MakeMapPoint(flagPos + Position(dx, dy)); - auto& node = world.GetNodeWriteable(pt); + auto& node = world.getNodeWriteable(pt); node.t1 = node.t2 = terrain; } } { // RSU triangle of node right of B so flag is not reachable from above - MapPoint pt = world.GetNeighbour(defenderBldPos, Direction::East); - auto& node = world.GetNodeWriteable(pt); + MapPoint pt = world.getNeighbour(defenderBldPos, Direction::East); + auto& node = world.getNodeWriteable(pt); node.t1 = terrain; } { // RSU triangle of building so it is reachable from flag - auto& node = world.GetNodeWriteable(defenderBldPos); - node.t1 = GetLandTerrain(world.GetDescription()); // RSU triangle of node right of B + auto& node = world.getNodeWriteable(defenderBldPos); + node.t1 = GetLandTerrain(world.getDescription()); // RSU triangle of node right of B } GameWorldViewer gwv(plAttacker, world); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(defenderBldPos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(defenderBldPos) == 0u); // Road over water makes it reachable curPlayer = plDefender; const MapPoint roadFlagPos = world.MakeMapPoint(flagPos + Position(2, 0)); this->BuildRoad(flagPos, false, std::vector(2, Direction::East)); - auto* flag = world.GetSpecObj(roadFlagPos); + auto* flag = world.getSpecObj(roadFlagPos); BOOST_TEST_REQUIRE(flag); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(defenderBldPos) >= 3u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(defenderBldPos) >= 3u); curPlayer = plAttacker; this->Attack(defenderBldPos, 3, true); - BOOST_TEST_REQUIRE(attackerBld->GetLeavingFigures().size() == 3); - auto& attacker1 = dynamic_cast(attackerBld->GetLeavingFigures().front()); - auto& attacker2 = dynamic_cast(*++attackerBld->GetLeavingFigures().begin()); - auto& attacker3 = dynamic_cast(*++(++attackerBld->GetLeavingFigures().begin())); + BOOST_TEST_REQUIRE(attackerBld->getLeavingFigures().size() == 3); + auto& attacker1 = dynamic_cast(attackerBld->getLeavingFigures().front()); + auto& attacker2 = dynamic_cast(*++attackerBld->getLeavingFigures().begin()); + auto& attacker3 = dynamic_cast(*++(++attackerBld->getLeavingFigures().begin())); // Let all exit and move almost to goal - RTTR_EXEC_TILL(200, attackerBld->GetLeavingFigures().empty()); - moveObjTo(world, attacker1, world.GetNeighbour(flagPos, Direction::East)); - moveObjTo(world, attacker2, world.GetNeighbour(roadFlagPos, Direction::East)); - moveObjTo(world, attacker3, world.GetNeighbour(flagPos, Direction::West)); - RTTR_EXEC_TILL(200, !defenderBld->GetLeavingFigures().empty()); - auto& defender = dynamic_cast(defenderBld->GetLeavingFigures().front()); - RTTR_EXEC_TILL(200, defender.IsFightingAtFlag()); - RTTR_EXEC_TILL(10, attacker2.IsAttackerReady() && attacker3.IsAttackerReady()); - BOOST_TEST_REQUIRE(attacker1.GetState() == SoldierState::AttackingFightingVsDefender); + RTTR_EXEC_TILL(200, attackerBld->getLeavingFigures().empty()); + moveObjTo(world, attacker1, world.getNeighbour(flagPos, Direction::East)); + moveObjTo(world, attacker2, world.getNeighbour(roadFlagPos, Direction::East)); + moveObjTo(world, attacker3, world.getNeighbour(flagPos, Direction::West)); + RTTR_EXEC_TILL(200, !defenderBld->getLeavingFigures().empty()); + auto& defender = dynamic_cast(defenderBld->getLeavingFigures().front()); + RTTR_EXEC_TILL(200, defender.isFightingAtFlag()); + RTTR_EXEC_TILL(10, attacker2.isAttackerReady() && attacker3.isAttackerReady()); + BOOST_TEST_REQUIRE(attacker1.getState() == SoldierState::AttackingFightingVsDefender); // Setup done, now remove the road and verify the goal is no longer attackable curPlayer = plDefender; DestroyRoad(flagPos, Direction::East); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(defenderBldPos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(defenderBldPos) == 0u); // Fight ended - RTTR_EXEC_TILL(500, !defender.IsFightingAtFlag()); + RTTR_EXEC_TILL(500, !defender.isFightingAtFlag()); // Attacker2 should go home - BOOST_TEST(attacker2.GetState() == SoldierState::WalkingHome); - BOOST_TEST(!attacker2.GetAttackedGoal()); - BOOST_TEST(!helpers::contains(defenderBld->GetAggressors(), &attacker2)); - BOOST_TEST(attacker2.IsMoving()); // Not stuck + BOOST_TEST(attacker2.getState() == SoldierState::WalkingHome); + BOOST_TEST(!attacker2.getAttackedGoal()); + BOOST_TEST(!helpers::contains(defenderBld->getAggressors(), &attacker2)); + BOOST_TEST(attacker2.isMoving()); // Not stuck // Attacker3 should go and fight now - BOOST_TEST(!attacker3.IsAttackerReady()); - BOOST_TEST(attacker3.GetAttackedGoal()); - BOOST_TEST(attacker3.IsMoving()); // Not stuck - RTTR_EXEC_TILL(100, defender.IsFightingAtFlag()); - BOOST_TEST(attacker3.GetState() == SoldierState::AttackingFightingVsDefender); + BOOST_TEST(!attacker3.isAttackerReady()); + BOOST_TEST(attacker3.getAttackedGoal()); + BOOST_TEST(attacker3.isMoving()); // Not stuck + RTTR_EXEC_TILL(100, defender.isFightingAtFlag()); + BOOST_TEST(attacker3.getState() == SoldierState::AttackingFightingVsDefender); } enum AttackedBldType @@ -1153,23 +1153,23 @@ void HandleLeavingAggDefendersOnAttack::test(AttackedBldType test_case, bool use // Handling for "real" military buildings and attackable warehouses (HQ) is different, so test all combinations std::array attackers{}; AddSoldiers(milBld0Pos, attackers.size() + 1, Job::General); - auto& attackedHq = ensureNonNull(world.GetSpecObj(hqPos[1])); + auto& attackedHq = ensureNonNull(world.getSpecObj(hqPos[1])); auto& attackedBld = (test_case == AttackedBldType::Hq) ? attackedHq : static_cast(*milBld1); - const auto attackedPlayer = attackedBld.GetPlayer(); + const auto attackedPlayer = attackedBld.getPlayer(); const auto numGenerals = rttr::test::randomValue(1, attackers.size() / 2); const auto numPrivates = rttr::test::randomValue(1, attackers.size() / 2); if(test_case == AttackedBldType::Hq) { // Make sure they can be sent out (aggressive defenders are not taken from the reserve) - attackedHq.SetRealReserve(getSoldierRank(Job::General), 0); - attackedHq.SetRealReserve(getSoldierRank(Job::Private), 0); + attackedHq.setRealReserve(getSoldierRank(Job::General), 0); + attackedHq.setRealReserve(getSoldierRank(Job::Private), 0); auto startSoldiers = PeopleCounts::make(Job::General, numGenerals); startSoldiers[Job::Private] = numPrivates; attackedHq.AddToInventory(startSoldiers, true); } else { - AddSoldiers(attackedBld.GetPos(), numGenerals, Job::General); - AddSoldiers(attackedBld.GetPos(), numPrivates, Job::Private); + AddSoldiers(attackedBld.getPos(), numGenerals, Job::General); + AddSoldiers(attackedBld.getPos(), numPrivates, Job::Private); } // Total soldiers should not change because none die in this test case // This ensures they are not double-accounted during conversion from agressive defender to defender @@ -1177,21 +1177,21 @@ void HandleLeavingAggDefendersOnAttack::test(AttackedBldType test_case, bool use const auto totalSoldiersBefore = getTotalSoldiers(attackedPlayer); const auto soldiersBefore = getNumSoldiers(attackedHq); const auto numAttackers = useAllDefenders ? attackers.size() : 1u; - this->Attack(attackedBld.GetPos(), numAttackers, true); - BOOST_TEST_REQUIRE(milBld0->GetLeavingFigures().size() == numAttackers); + this->Attack(attackedBld.getPos(), numAttackers, true); + BOOST_TEST_REQUIRE(milBld0->getLeavingFigures().size() == numAttackers); { int i = 0; - for(auto& fig : milBld0->GetLeavingFigures()) + for(auto& fig : milBld0->getLeavingFigures()) attackers[i++] = &dynamic_cast(fig); } // Let one out then call SendAggressiveDefender for all attackers. // This is technically wrong but we want to ensure they come from the target bld only and are still in the leave // queue when the first attacker calls the defender - RTTR_EXEC_TILL(50, milBld0->GetLeavingFigures().size() < numAttackers); + RTTR_EXEC_TILL(50, milBld0->getLeavingFigures().size() < numAttackers); for(unsigned i = 0; i < numAttackers; i++) { auto* attacker = attackers[i]; - if(attacker && !attacker->GetHuntingDefender()) + if(attacker && !attacker->getHuntingDefender()) { auto* aggDefender = attackedBld.SendAggressiveDefender(*attacker); if(aggDefender) @@ -1201,11 +1201,11 @@ void HandleLeavingAggDefendersOnAttack::test(AttackedBldType test_case, bool use if(useAllDefenders) { if(test_case == AttackedBldType::Hq) // HQs will be empty as all are leaving - BOOST_TEST_REQUIRE(attackedBld.GetLeavingFigures().size() == numGenerals + numPrivates); + BOOST_TEST_REQUIRE(attackedBld.getLeavingFigures().size() == numGenerals + numPrivates); else // Military buildings keep at least one - BOOST_TEST_REQUIRE(attackedBld.GetLeavingFigures().size() == numGenerals + numPrivates - 1u); + BOOST_TEST_REQUIRE(attackedBld.getLeavingFigures().size() == numGenerals + numPrivates - 1u); } else - BOOST_TEST_REQUIRE(!attackedBld.GetLeavingFigures().empty()); + BOOST_TEST_REQUIRE(!attackedBld.getLeavingFigures().empty()); if(test_case == AttackedBldType::Hq) { auto curSoldiers = getNumSoldiers(attackedHq); @@ -1221,17 +1221,17 @@ void HandleLeavingAggDefendersOnAttack::test(AttackedBldType test_case, bool use BOOST_TEST(getTotalSoldiers(attackedPlayer) == totalSoldiersBefore); // Move attacker to flag to trigger defender request auto& attacker = *attackers.front(); - moveObjTo(world, attacker, attackedBld.GetFlagPos()); + moveObjTo(world, attacker, attackedBld.getFlagPos()); rescheduleWalkEvent(em, attacker, 1); RTTR_SKIP_GFS(1); - BOOST_TEST_REQUIRE(attacker.GetState() == SoldierState::AttackingWaitingForDefender); + BOOST_TEST_REQUIRE(attacker.getState() == SoldierState::AttackingWaitingForDefender); // All agressive defenders are cancelled - for(const auto& fig : attackedBld.GetLeavingFigures()) - BOOST_TEST(fig.GetGOT() != GO_Type::NofAggressivedefender); - BOOST_TEST_REQUIRE(!attackedBld.GetLeavingFigures().empty()); + for(const auto& fig : attackedBld.getLeavingFigures()) + BOOST_TEST(fig.getGOT() != GO_Type::NofAggressivedefender); + BOOST_TEST_REQUIRE(!attackedBld.getLeavingFigures().empty()); // Defender is coming - BOOST_TEST_REQUIRE(attackedBld.GetLeavingFigures().front().GetGOT() == GO_Type::NofDefender); - const auto defenderRank = getSoldierRank(attackedBld.GetLeavingFigures().front().GetJobType()); + BOOST_TEST_REQUIRE(attackedBld.getLeavingFigures().front().getGOT() == GO_Type::NofDefender); + const auto defenderRank = getSoldierRank(attackedBld.getLeavingFigures().front().getJobType()); if(test_case == AttackedBldType::Hq) { const auto curSoldiers = getNumSoldiers(attackedHq); @@ -1240,7 +1240,7 @@ void HandleLeavingAggDefendersOnAttack::test(AttackedBldType test_case, bool use BOOST_TEST(curSoldiers[visual] == soldiersBefore[visual]); } BOOST_TEST(getTotalSoldiers(attackedPlayer) == totalSoldiersBefore); - RTTR_EXEC_TILL(70, attackedBld.GetLeavingFigures().empty()); + RTTR_EXEC_TILL(70, attackedBld.getLeavingFigures().empty()); if(test_case == AttackedBldType::Hq) { auto soldiersExpected = soldiersBefore; @@ -1255,38 +1255,38 @@ BOOST_FIXTURE_TEST_CASE(LeavingSoldierUsedAsDefender, AttackFixture<2>) // When the only soldier in a HQ is currently leaving (to a building) it is used as defender // Counts need to be correct at all times AddSoldiers(milBld0Pos, 2, Job::General); - auto& attackedHq = ensureNonNull(world.GetSpecObj(hqPos[1])); + auto& attackedHq = ensureNonNull(world.getSpecObj(hqPos[1])); const auto soldierJob = rttr::test::randomElement(SOLDIER_JOBS); - attackedHq.SetRealReserve(getSoldierRank(soldierJob), 0); + attackedHq.setRealReserve(getSoldierRank(soldierJob), 0); attackedHq.AddToInventory(PeopleCounts::make(soldierJob, 1), true); - const auto attackedPlayer = attackedHq.GetPlayer(); + const auto attackedPlayer = attackedHq.getPlayer(); const auto totalSoldiersBefore = getTotalSoldiers(attackedPlayer); const auto soldiersBefore = getNumSoldiers(attackedHq); - this->Attack(attackedHq.GetPos(), 1, true); - BOOST_TEST_REQUIRE(milBld0->GetLeavingFigures().size() == 1); - auto& attacker = dynamic_cast(milBld0->GetLeavingFigures().front()); - RTTR_EXEC_TILL(50, milBld0->GetLeavingFigures().empty()); + this->Attack(attackedHq.getPos(), 1, true); + BOOST_TEST_REQUIRE(milBld0->getLeavingFigures().size() == 1); + auto& attacker = dynamic_cast(milBld0->getLeavingFigures().front()); + RTTR_EXEC_TILL(50, milBld0->getLeavingFigures().empty()); curPlayer = attackedPlayer; BuildRoadForBlds(milBld1Pos, hqPos[1]); curPlayer = 0; - BOOST_TEST_REQUIRE(!attackedHq.GetLeavingFigures().empty()); + BOOST_TEST_REQUIRE(!attackedHq.getLeavingFigures().empty()); { - const auto& leavingSoldier = dynamic_cast(attackedHq.GetLeavingFigures().front()); - BOOST_TEST(leavingSoldier.GetGoal() == milBld1); + const auto& leavingSoldier = dynamic_cast(attackedHq.getLeavingFigures().front()); + BOOST_TEST(leavingSoldier.getGoal() == milBld1); } BOOST_TEST(getTotalSoldiers(attackedPlayer) == totalSoldiersBefore); const auto soldiersNow = getNumSoldiers(attackedHq); BOOST_TEST(soldiersNow[visual] == soldiersBefore[visual]); BOOST_TEST(calcSum(soldiersNow[real]) == 0u); - moveObjTo(world, attacker, attackedHq.GetFlagPos()); + moveObjTo(world, attacker, attackedHq.getFlagPos()); rescheduleWalkEvent(em, attacker, 1); RTTR_SKIP_GFS(1); - BOOST_TEST_REQUIRE(attackedHq.GetLeavingFigures().size() == 1); - BOOST_TEST(attackedHq.GetLeavingFigures().front().GetGOT() == GO_Type::NofDefender); + BOOST_TEST_REQUIRE(attackedHq.getLeavingFigures().size() == 1); + BOOST_TEST(attackedHq.getLeavingFigures().front().getGOT() == GO_Type::NofDefender); BOOST_TEST(getTotalSoldiers(attackedPlayer) == totalSoldiersBefore); BOOST_TEST(getNumSoldiers(attackedHq) == soldiersNow); - RTTR_EXEC_TILL(70, attackedHq.GetLeavingFigures().empty()); + RTTR_EXEC_TILL(70, attackedHq.getLeavingFigures().empty()); BOOST_TEST(getTotalSoldiers(attackedPlayer) == totalSoldiersBefore); const auto soldiersAfter = getNumSoldiers(attackedHq); BOOST_TEST(calcSum(soldiersAfter[visual]) == 0u); @@ -1317,25 +1317,25 @@ BOOST_FIXTURE_TEST_CASE(DestroyRoadsOnConquer, DestroyRoadsOnConquerFixture) // Flag -> Bld const MapPoint flagPt = world.MakeMapPoint(milBld1Pos - Position(2, 0)); this->SetFlag(flagPt); - BuildRoadForBlds(world.GetNeighbour(flagPt, Direction::NorthWest), milBld1Pos); + BuildRoadForBlds(world.getNeighbour(flagPt, Direction::NorthWest), milBld1Pos); // Build a long road connecting left&right w/o any flag in between (See #863) BuildRoadForBlds(leftBldPos, rightBldPos); - BOOST_TEST_REQUIRE(leftBld->GetFlag()->GetRoute(Direction::East)->GetLength() >= 10u); + BOOST_TEST_REQUIRE(leftBld->getFlag()->getRoute(Direction::East)->GetLength() >= 10u); curPlayer = 0; this->Attack(milBld1Pos, 5, true); - RTTR_EXEC_TILL(2000, milBld1->GetPlayer() == curPlayer); + RTTR_EXEC_TILL(2000, milBld1->getPlayer() == curPlayer); std::array bldPts = {{leftBldPos, rightBldPos, milBld1Pos}}; for(const MapPoint& bldPt : bldPts) { - MapPoint flagPt = world.GetNeighbour(bldPt, Direction::SouthEast); + MapPoint flagPt = world.getNeighbour(bldPt, Direction::SouthEast); for(Direction i : helpers::EnumRange{}) { // No routes except the main road if(i != Direction::NorthWest) { - BOOST_TEST_REQUIRE(!world.GetSpecObj(flagPt)->GetRoute(i)); - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt, i) == PointRoad::None); + BOOST_TEST_REQUIRE(!world.getSpecObj(flagPt)->getRoute(i)); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt, i) == PointRoad::None); } } } @@ -1357,44 +1357,44 @@ struct FreeFightFixture : AttackFixture<2> AddSoldiers(milBld0Pos, 6, Job::Private); AddSoldiers(milBld1Pos, 6, Job::Private); this->Attack(attackedBldPos, 1, true); - auto& attacker = dynamic_cast(attackerBld.GetLeavingFigures().front()); + auto& attacker = dynamic_cast(attackerBld.getLeavingFigures().front()); attacker_ = &attacker; - RTTR_EXEC_TILL(70, attackerBld.GetLeavingFigures().empty()); //-V807 + RTTR_EXEC_TILL(70, attackerBld.getLeavingFigures().empty()); //-V807 nofAggressiveDefender& defender = ensureNonNull(attackedBld.SendAggressiveDefender(attacker)); defender_ = &defender; - RTTR_EXEC_TILL(70, attackedBld.GetLeavingFigures().empty()); //-V807 + RTTR_EXEC_TILL(70, attackedBld.getLeavingFigures().empty()); //-V807 attacker.LetsFight(defender); // In a distance of 2 they find each other and meet half way const MapPoint fightSpot = attackedBldPos - MapPoint(3, 0); // attacker building is left -> place attacker left of fight spot - BOOST_TEST_REQUIRE(attackerBld.GetPos().x < attackedBldPos.x); + BOOST_TEST_REQUIRE(attackerBld.getPos().x < attackedBldPos.x); moveObjTo(world, attacker, fightSpot - MapPoint(1, 0)); moveObjTo(world, defender, fightSpot + MapPoint(1, 0)); rescheduleWalkEvent(em, attacker, 1); RTTR_SKIP_GFS(1); - BOOST_TEST_REQUIRE(defender.GetState() == SoldierState::MeetEnemy); - BOOST_TEST_REQUIRE(attacker.GetState() == SoldierState::MeetEnemy); + BOOST_TEST_REQUIRE(defender.getState() == SoldierState::MeetEnemy); + BOOST_TEST_REQUIRE(attacker.getState() == SoldierState::MeetEnemy); } /// Add blocking terrain around building of defender starting left of the specified position void blockDefenderBuilding(const MapCoord x) { const auto terrain = - this->world.GetDescription().terrain.find([](const TerrainDesc& t) { return !t.Is(ETerrain::Walkable); }); - for(const auto y : helpers::range(this->world.GetHeight())) + this->world.getDescription().terrain.find([](const TerrainDesc& t) { return !t.Is(ETerrain::Walkable); }); + for(const auto y : helpers::range(this->world.getHeight())) { - auto& node = this->world.GetNodeWriteable(MapPoint(x, y)); - auto& rightNode = this->world.GetNodeWriteable(MapPoint(attackedBldPos.x + 1, y)); + auto& node = this->world.getNodeWriteable(MapPoint(x, y)); + auto& rightNode = this->world.getNodeWriteable(MapPoint(attackedBldPos.x + 1, y)); node.t1 = node.t2 = rightNode.t1 = rightNode.t2 = terrain; } const auto yTop = this->world.MakeMapPoint(Position(attackedBldPos.x, attackedBldPos.y - 3)).y; const auto yBottom = this->world.MakeMapPoint(Position(attackedBldPos.x, attackedBldPos.y + 3)).y; for(const auto x : helpers::range(x, attackedBldPos.x)) { - auto& topNode = this->world.GetNodeWriteable(MapPoint(x, yTop)); - auto& bottomNode = this->world.GetNodeWriteable(MapPoint(x, yBottom)); + auto& topNode = this->world.getNodeWriteable(MapPoint(x, yTop)); + auto& bottomNode = this->world.getNodeWriteable(MapPoint(x, yBottom)); topNode.t1 = topNode.t2 = bottomNode.t1 = bottomNode.t2 = terrain; } } @@ -1414,11 +1414,11 @@ BOOST_FIXTURE_TEST_CASE(Attacker_Returns_When_AgressiveDefender_Aborts, FreeFigh moveObjTo(world, attacker, fightSpot); rescheduleWalkEvent(em, attacker, 1); RTTR_SKIP_GFS(1); - BOOST_TEST_REQUIRE(defender.GetState() == SoldierState::MeetEnemy); - BOOST_TEST_REQUIRE(attacker.GetState() == SoldierState::WaitingForFight); + BOOST_TEST_REQUIRE(defender.getState() == SoldierState::MeetEnemy); + BOOST_TEST_REQUIRE(attacker.getState() == SoldierState::WaitingForFight); // The next part of the test assumes they use this fight spot. // This doesn't need to stay true which only needs adjustments to the test. - BOOST_TEST_REQUIRE(attacker.GetPos() == fightSpot); + BOOST_TEST_REQUIRE(attacker.getPos() == fightSpot); blockDefenderBuilding(fightSpot.x); // -> defender can't reach attacker @@ -1426,15 +1426,15 @@ BOOST_FIXTURE_TEST_CASE(Attacker_Returns_When_AgressiveDefender_Aborts, FreeFigh // Pending fight should get aborted and both go back home: rescheduleWalkEvent(em, defender, 1); RTTR_SKIP_GFS(1); - BOOST_TEST(defender.IsMoving()); - BOOST_TEST(attacker.IsMoving()); - BOOST_TEST(defender.GetState() != SoldierState::MeetEnemy); - BOOST_TEST(attacker.GetState() != SoldierState::WaitingForFight); - - BOOST_TEST_REQUIRE(attackedBld.GetNumTroops() == 5u); // Sanity check - RTTR_EXEC_TILL(100, attackedBld.GetNumTroops() == 6u); - BOOST_TEST_REQUIRE(attackerBld.GetNumTroops() == 5u); // Sanity check - RTTR_EXEC_TILL(100, attackerBld.GetNumTroops() == 6u); + BOOST_TEST(defender.isMoving()); + BOOST_TEST(attacker.isMoving()); + BOOST_TEST(defender.getState() != SoldierState::MeetEnemy); + BOOST_TEST(attacker.getState() != SoldierState::WaitingForFight); + + BOOST_TEST_REQUIRE(attackedBld.getNumTroops() == 5u); // Sanity check + RTTR_EXEC_TILL(100, attackedBld.getNumTroops() == 6u); + BOOST_TEST_REQUIRE(attackerBld.getNumTroops() == 5u); // Sanity check + RTTR_EXEC_TILL(100, attackerBld.getNumTroops() == 6u); } BOOST_FIXTURE_TEST_CASE(AgressiveDefender_Returns_When_Attacker_Aborts, FreeFightFixture) @@ -1450,11 +1450,11 @@ BOOST_FIXTURE_TEST_CASE(AgressiveDefender_Returns_When_Attacker_Aborts, FreeFigh moveObjTo(world, defender, fightSpot); rescheduleWalkEvent(em, defender, 1); RTTR_SKIP_GFS(1); - BOOST_TEST_REQUIRE(defender.GetState() == SoldierState::WaitingForFight); - BOOST_TEST_REQUIRE(attacker.GetState() == SoldierState::MeetEnemy); + BOOST_TEST_REQUIRE(defender.getState() == SoldierState::WaitingForFight); + BOOST_TEST_REQUIRE(attacker.getState() == SoldierState::MeetEnemy); // The next part of the test assumes they use this fight spot. // This doesn't need to stay true which only needs adjustments to the test. - BOOST_TEST_REQUIRE(defender.GetPos() == fightSpot); + BOOST_TEST_REQUIRE(defender.getPos() == fightSpot); blockDefenderBuilding(fightSpot.x - 1); // -> attacker can't reach defender or attacked building @@ -1462,15 +1462,15 @@ BOOST_FIXTURE_TEST_CASE(AgressiveDefender_Returns_When_Attacker_Aborts, FreeFigh moveObjTo(world, attacker, fightSpot - MapPoint(1, 0)); rescheduleWalkEvent(em, attacker, 1); RTTR_SKIP_GFS(1); - BOOST_TEST(defender.IsMoving()); - BOOST_TEST(attacker.IsMoving()); - BOOST_TEST(defender.GetState() != SoldierState::WaitingForFight); - BOOST_TEST(attacker.GetState() != SoldierState::MeetEnemy); - - BOOST_TEST_REQUIRE(attackedBld.GetNumTroops() == 5u); // Sanity check - RTTR_EXEC_TILL(100, attackedBld.GetNumTroops() == 6u); - BOOST_TEST_REQUIRE(attackerBld.GetNumTroops() == 5u); // Sanity check - RTTR_EXEC_TILL(100, attackerBld.GetNumTroops() == 6u); + BOOST_TEST(defender.isMoving()); + BOOST_TEST(attacker.isMoving()); + BOOST_TEST(defender.getState() != SoldierState::WaitingForFight); + BOOST_TEST(attacker.getState() != SoldierState::MeetEnemy); + + BOOST_TEST_REQUIRE(attackedBld.getNumTroops() == 5u); // Sanity check + RTTR_EXEC_TILL(100, attackedBld.getNumTroops() == 6u); + BOOST_TEST_REQUIRE(attackerBld.getNumTroops() == 5u); // Sanity check + RTTR_EXEC_TILL(100, attackerBld.getNumTroops() == 6u); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/integration/testBaseWarehouse.cpp b/tests/s25Main/integration/testBaseWarehouse.cpp index afdf905bbc..fd8e2afd91 100644 --- a/tests/s25Main/integration/testBaseWarehouse.cpp +++ b/tests/s25Main/integration/testBaseWarehouse.cpp @@ -28,48 +28,48 @@ struct AddGoodsFixture : public WorldFixture, public rttr:: helpers::EnumArray numArmoredSoldiers, numArmoredSoldiersPlayer; AddGoodsFixture() { - GamePlayer& player = world.GetPlayer(0); + GamePlayer& player = world.getPlayer(0); // Don't keep any reserve - for(unsigned i = 0; i <= this->ggs.GetMaxMilitaryRank(); ++i) - player.GetFirstWH()->SetRealReserve(i, 0); //-V522 - numPeople = numPeoplePlayer = player.GetInventory().people; - numGoods = numGoodsPlayer = player.GetInventory().goods; - numArmoredSoldiers = numArmoredSoldiersPlayer = player.GetInventory().armoredSoldiers; + for(unsigned i = 0; i <= this->ggs.getMaxMilitaryRank(); ++i) + player.getFirstWH()->setRealReserve(i, 0); //-V522 + numPeople = numPeoplePlayer = player.getInventory().people; + numGoods = numGoodsPlayer = player.getInventory().goods; + numArmoredSoldiers = numArmoredSoldiersPlayer = player.getInventory().armoredSoldiers; } /// Asserts that the expected and actual good count match for the HQ void testNumGoodsHQ() { - nobBaseWarehouse& hq = *world.GetSpecObj(world.GetPlayer(0).GetHQPos()); + nobBaseWarehouse& hq = *world.getSpecObj(world.getPlayer(0).getHQPos()); for(const auto i : helpers::enumRange()) BOOST_TEST_CONTEXT("Job: " << rttr::enum_cast(i)) { - BOOST_TEST(hq.GetNumVisualFigures(i) == numPeople[i]); - BOOST_TEST(hq.GetNumRealFigures(i) == numPeople[i]); + BOOST_TEST(hq.getNumVisualFigures(i) == numPeople[i]); + BOOST_TEST(hq.getNumRealFigures(i) == numPeople[i]); } for(const auto i : helpers::enumRange()) BOOST_TEST_CONTEXT("ArmoredSoldier: " << rttr::enum_cast(i)) { - BOOST_TEST(hq.GetNumVisualArmoredFigures(i) == numArmoredSoldiers[i]); - BOOST_TEST(hq.GetNumRealArmoredFigures(i) == numArmoredSoldiers[i]); + BOOST_TEST(hq.getNumVisualArmoredFigures(i) == numArmoredSoldiers[i]); + BOOST_TEST(hq.getNumRealArmoredFigures(i) == numArmoredSoldiers[i]); } for(const auto i : helpers::enumRange()) BOOST_TEST_CONTEXT("Good: " << rttr::enum_cast(i)) { - BOOST_TEST(hq.GetNumVisualWares(i) == numGoods[i]); - BOOST_TEST(hq.GetNumRealWares(i) == numGoods[i]); + BOOST_TEST(hq.getNumVisualWares(i) == numGoods[i]); + BOOST_TEST(hq.getNumRealWares(i) == numGoods[i]); } } /// Asserts that the expected and actual good count match for the player void testNumGoodsPlayer() { - GamePlayer& player = world.GetPlayer(0); + GamePlayer& player = world.getPlayer(0); for(const auto i : helpers::enumRange()) - BOOST_TEST(player.GetInventory()[i] == numPeoplePlayer[i]); + BOOST_TEST(player.getInventory()[i] == numPeoplePlayer[i]); for(const auto i : helpers::enumRange()) - BOOST_TEST(player.GetInventory()[i] == numArmoredSoldiersPlayer[i]); + BOOST_TEST(player.getInventory()[i] == numArmoredSoldiersPlayer[i]); for(const auto i : helpers::enumRange()) - BOOST_TEST(player.GetInventory()[i] == numGoodsPlayer[i]); + BOOST_TEST(player.getInventory()[i] == numGoodsPlayer[i]); } }; @@ -80,8 +80,8 @@ using EmptyWorldFixture1P = WorldFixture; BOOST_FIXTURE_TEST_CASE(AddGoods, AddGoodsFixture) { LogAccessor logAcc; - GamePlayer& player = world.GetPlayer(0); - nobBaseWarehouse& hq = *world.GetSpecObj(player.GetHQPos()); + GamePlayer& player = world.getPlayer(0); + nobBaseWarehouse& hq = *world.getSpecObj(player.getHQPos()); testNumGoodsHQ(); // Add nothing -> nothing changed @@ -150,11 +150,11 @@ BOOST_FIXTURE_TEST_CASE(AddGoods, AddGoodsFixture) BOOST_FIXTURE_TEST_CASE(OrderJob, EmptyWorldFixture1P) { - GamePlayer& player = world.GetPlayer(0); - auto* hq = world.GetSpecObj(player.GetHQPos()); + GamePlayer& player = world.getPlayer(0); + auto* hq = world.getSpecObj(player.getHQPos()); auto* wh = static_cast(BuildingFactory::CreateBuilding( - world, BuildingType::Storehouse, player.GetHQPos() + MapPoint(4, 0), 0, Nation::Romans)); - world.BuildRoad(0, false, hq->GetFlagPos(), {4, Direction::East}); + world, BuildingType::Storehouse, player.getHQPos() + MapPoint(4, 0), 0, Nation::Romans)); + world.BuildRoad(0, false, hq->getFlagPos(), {4, Direction::East}); // Need some builders, hammers and helpers { @@ -166,45 +166,45 @@ BOOST_FIXTURE_TEST_CASE(OrderJob, EmptyWorldFixture1P) } // Order all existing builders - while(hq->GetNumRealFigures(Job::Builder) > 0u) + while(hq->getNumRealFigures(Job::Builder) > 0u) { - const auto numBuilders = hq->GetNumRealFigures(Job::Builder); + const auto numBuilders = hq->getNumRealFigures(Job::Builder); BOOST_TEST(hq->OrderJob(Job::Builder, *wh, false)); - BOOST_TEST_REQUIRE(hq->GetNumRealFigures(Job::Builder) == numBuilders - 1u); + BOOST_TEST_REQUIRE(hq->getNumRealFigures(Job::Builder) == numBuilders - 1u); } // Ordering another one fails BOOST_TEST_REQUIRE(!hq->OrderJob(Job::Builder, *wh, false)); - BOOST_TEST_REQUIRE(hq->GetNumRealFigures(Job::Builder) == 0u); + BOOST_TEST_REQUIRE(hq->getNumRealFigures(Job::Builder) == 0u); // Recruit all possible builders - while(hq->GetNumRealWares(GoodType::Hammer) > 0u) + while(hq->getNumRealWares(GoodType::Hammer) > 0u) { - const auto numHammers = hq->GetNumRealWares(GoodType::Hammer); + const auto numHammers = hq->getNumRealWares(GoodType::Hammer); BOOST_TEST(hq->OrderJob(Job::Builder, *wh, true)); - BOOST_TEST_REQUIRE(hq->GetNumRealWares(GoodType::Hammer) == numHammers - 1u); - BOOST_TEST_REQUIRE(hq->GetNumRealFigures(Job::Builder) == 0u); + BOOST_TEST_REQUIRE(hq->getNumRealWares(GoodType::Hammer) == numHammers - 1u); + BOOST_TEST_REQUIRE(hq->getNumRealFigures(Job::Builder) == 0u); } // Ordering another one fails BOOST_TEST_REQUIRE(!hq->OrderJob(Job::Builder, *wh, true)); - BOOST_TEST(hq->GetNumRealFigures(Job::Builder) == 0u); - BOOST_TEST(hq->GetNumRealWares(GoodType::Hammer) == 0u); + BOOST_TEST(hq->getNumRealFigures(Job::Builder) == 0u); + BOOST_TEST(hq->getNumRealWares(GoodType::Hammer) == 0u); } BOOST_FIXTURE_TEST_CASE(DestroyBuilding, EmptyWorldFixture1P) { - GamePlayer& player = world.GetPlayer(0); - auto* hq = world.GetSpecObj(player.GetHQPos()); + GamePlayer& player = world.getPlayer(0); + auto* hq = world.getSpecObj(player.getHQPos()); - MapPoint whPos = player.GetHQPos() + MapPoint(4, 0); + MapPoint whPos = player.getHQPos() + MapPoint(4, 0); auto* wh = static_cast( BuildingFactory::CreateBuilding(world, BuildingType::Storehouse, whPos, 0, Nation::Romans)); - world.BuildRoad(0, false, hq->GetFlagPos(), {4, Direction::East}); + world.BuildRoad(0, false, hq->getFlagPos(), {4, Direction::East}); // Reproduce issue #1559, where a dependent figure on the same position would cause a crash // upon building destruction. auto& scout = - world.AddFigure(whPos, std::make_unique(whPos, 0, world.GetSpecObj(whPos))); + world.AddFigure(whPos, std::make_unique(whPos, 0, world.getSpecObj(whPos))); wh->AddDependentFigure(scout); world.DestroyBuilding(whPos, 0); @@ -212,9 +212,9 @@ BOOST_FIXTURE_TEST_CASE(DestroyBuilding, EmptyWorldFixture1P) BOOST_FIXTURE_TEST_CASE(CollectGoodsAndFigures, WorldWithGCExecution1P) { - GamePlayer& player = world.GetPlayer(0); + GamePlayer& player = world.getPlayer(0); - MapPoint wh1Pos = player.GetHQPos() + MapPoint(2, 0); + MapPoint wh1Pos = player.getHQPos() + MapPoint(2, 0); MapPoint wh2Pos = wh1Pos + MapPoint(2, 0); auto* wh1 = static_cast( @@ -222,7 +222,7 @@ BOOST_FIXTURE_TEST_CASE(CollectGoodsAndFigures, WorldWithGCExecution1P) auto* wh2 = static_cast( BuildingFactory::CreateBuilding(world, BuildingType::Storehouse, wh2Pos, 0, Nation::Romans)); - world.BuildRoad(0, false, wh1->GetFlagPos(), {2, Direction::East}); + world.BuildRoad(0, false, wh1->getFlagPos(), {2, Direction::East}); MilitarySettings milSettings = MILITARY_SETTINGS_SCALE; milSettings[0] = 0; // No recruitment this->ChangeMilitary(milSettings); @@ -255,11 +255,11 @@ BOOST_FIXTURE_TEST_CASE(CollectGoodsAndFigures, WorldWithGCExecution1P) SetInventorySetting(wh2Pos, good, EInventorySetting::Collect); } - RTTR_EXEC_TILL(500, wh2->GetNumVisualFigures(Job::Helper) > 2); + RTTR_EXEC_TILL(500, wh2->getNumVisualFigures(Job::Helper) > 2); SetInventorySetting(wh2Pos, Job::Helper, EInventorySetting::Stop); - RTTR_EXEC_TILL(5000, wh2->GetNumVisualWares(maxEnumValue(GoodType{})) > 0); - RTTR_EXEC_TILL(5000, wh2->GetNumVisualFigures(maxEnumValue(Job{})) > 0); + RTTR_EXEC_TILL(5000, wh2->getNumVisualWares(maxEnumValue(GoodType{})) > 0); + RTTR_EXEC_TILL(5000, wh2->getNumVisualFigures(maxEnumValue(Job{})) > 0); for(const auto job : helpers::enumRange()) { if(job == Job::BoatCarrier) @@ -267,12 +267,12 @@ BOOST_FIXTURE_TEST_CASE(CollectGoodsAndFigures, WorldWithGCExecution1P) BOOST_TEST_INFO_SCOPE("Job: " << rttr::enum_cast(job)); if(job == Job::Helper) // Helpers get recruited continuously { - BOOST_TEST(wh2->GetNumVisualFigures(job) > 10u); - BOOST_TEST(wh2->GetNumRealFigures(job) > 10u); + BOOST_TEST(wh2->getNumVisualFigures(job) > 10u); + BOOST_TEST(wh2->getNumRealFigures(job) > 10u); } else { - BOOST_TEST(wh2->GetNumVisualFigures(job) == 1u); - BOOST_TEST(wh2->GetNumRealFigures(job) == 1u); + BOOST_TEST(wh2->getNumVisualFigures(job) == 1u); + BOOST_TEST(wh2->getNumRealFigures(job) == 1u); } } for(const auto good : helpers::enumRange()) @@ -280,58 +280,58 @@ BOOST_FIXTURE_TEST_CASE(CollectGoodsAndFigures, WorldWithGCExecution1P) if(ConvertShields(good) != good) continue; BOOST_TEST_INFO_SCOPE("Good: " << rttr::enum_cast(good)); - BOOST_TEST(wh2->GetNumVisualWares(good) == 1u); - BOOST_TEST(wh2->GetNumRealWares(good) == 1u); + BOOST_TEST(wh2->getNumVisualWares(good) == 1u); + BOOST_TEST(wh2->getNumRealWares(good) == 1u); } } BOOST_FIXTURE_TEST_CASE(AddSoldierWithArmor, EmptyWorldFixture1P) { - GamePlayer& player = world.GetPlayer(0); + GamePlayer& player = world.getPlayer(0); - auto* hq = world.GetSpecObj(player.GetHQPos()); - for(unsigned i = 0; i <= this->ggs.GetMaxMilitaryRank(); ++i) - hq->SetRealReserve(i, 0); + auto* hq = world.getSpecObj(player.getHQPos()); + for(unsigned i = 0; i <= this->ggs.getMaxMilitaryRank(); ++i) + hq->setRealReserve(i, 0); auto soldierWithArmor = - std::make_unique(player.GetHQPos(), 0, nullptr, nullptr, getSoldierRank(Job::Sergeant)); - soldierWithArmor->SetArmor(true); + std::make_unique(player.getHQPos(), 0, nullptr, nullptr, getSoldierRank(Job::Sergeant)); + soldierWithArmor->setArmor(true); hq->AddFigure(std::move(soldierWithArmor)); - BOOST_TEST(hq->GetNumRealArmoredFigures(ArmoredSoldier::Sergeant) == 1); - BOOST_TEST(hq->GetNumVisualArmoredFigures(ArmoredSoldier::Sergeant) == 1); - BOOST_TEST(hq->GetNumRealWares(GoodType::Armor) == 0); - BOOST_TEST(hq->GetNumVisualWares(GoodType::Armor) == 0); + BOOST_TEST(hq->getNumRealArmoredFigures(ArmoredSoldier::Sergeant) == 1); + BOOST_TEST(hq->getNumVisualArmoredFigures(ArmoredSoldier::Sergeant) == 1); + BOOST_TEST(hq->getNumRealWares(GoodType::Armor) == 0); + BOOST_TEST(hq->getNumVisualWares(GoodType::Armor) == 0); } BOOST_FIXTURE_TEST_CASE(CheckReserveSoldierWithArmor, EmptyWorldFixture1P) { - GamePlayer& player = world.GetPlayer(0); + GamePlayer& player = world.getPlayer(0); - auto* hq = world.GetSpecObj(player.GetHQPos()); + auto* hq = world.getSpecObj(player.getHQPos()); auto soldierWithArmor = - std::make_unique(player.GetHQPos(), 0, nullptr, nullptr, getSoldierRank(Job::Sergeant)); - soldierWithArmor->SetArmor(true); + std::make_unique(player.getHQPos(), 0, nullptr, nullptr, getSoldierRank(Job::Sergeant)); + soldierWithArmor->setArmor(true); hq->AddFigure(std::move(soldierWithArmor)); - BOOST_TEST(hq->GetNumRealArmoredFigures(ArmoredSoldier::Sergeant) == 0); - BOOST_TEST(hq->GetNumVisualArmoredFigures(ArmoredSoldier::Sergeant) == 0); - BOOST_TEST(hq->GetNumRealFigures(Job::Sergeant) == 0); - BOOST_TEST(hq->GetNumVisualFigures(Job::Sergeant) == 0); - BOOST_TEST(*hq->GetReserveAvailablePointer(getSoldierRank(Job::Sergeant)) == 1); - BOOST_TEST(*hq->GetReserveArmoredAvailablePointer(getSoldierRank(Job::Sergeant)) == 1); - BOOST_TEST(hq->GetNumRealWares(GoodType::Armor) == 0); - BOOST_TEST(hq->GetNumVisualWares(GoodType::Armor) == 0); + BOOST_TEST(hq->getNumRealArmoredFigures(ArmoredSoldier::Sergeant) == 0); + BOOST_TEST(hq->getNumVisualArmoredFigures(ArmoredSoldier::Sergeant) == 0); + BOOST_TEST(hq->getNumRealFigures(Job::Sergeant) == 0); + BOOST_TEST(hq->getNumVisualFigures(Job::Sergeant) == 0); + BOOST_TEST(*hq->getReserveAvailablePointer(getSoldierRank(Job::Sergeant)) == 1); + BOOST_TEST(*hq->getReserveArmoredAvailablePointer(getSoldierRank(Job::Sergeant)) == 1); + BOOST_TEST(hq->getNumRealWares(GoodType::Armor) == 0); + BOOST_TEST(hq->getNumVisualWares(GoodType::Armor) == 0); // free reserve - for(unsigned i = 0; i <= this->ggs.GetMaxMilitaryRank(); ++i) - player.GetFirstWH()->SetRealReserve(i, 0); - - BOOST_TEST(hq->GetNumRealArmoredFigures(ArmoredSoldier::Sergeant) == 1); - BOOST_TEST(hq->GetNumVisualArmoredFigures(ArmoredSoldier::Sergeant) == 1); - BOOST_TEST(hq->GetNumRealFigures(Job::Sergeant) == 1); - BOOST_TEST(hq->GetNumVisualFigures(Job::Sergeant) == 1); - BOOST_TEST(*hq->GetReserveAvailablePointer(getSoldierRank(Job::Sergeant)) == 0); - BOOST_TEST(*hq->GetReserveArmoredAvailablePointer(getSoldierRank(Job::Sergeant)) == 0); + for(unsigned i = 0; i <= this->ggs.getMaxMilitaryRank(); ++i) + player.getFirstWH()->setRealReserve(i, 0); + + BOOST_TEST(hq->getNumRealArmoredFigures(ArmoredSoldier::Sergeant) == 1); + BOOST_TEST(hq->getNumVisualArmoredFigures(ArmoredSoldier::Sergeant) == 1); + BOOST_TEST(hq->getNumRealFigures(Job::Sergeant) == 1); + BOOST_TEST(hq->getNumVisualFigures(Job::Sergeant) == 1); + BOOST_TEST(*hq->getReserveAvailablePointer(getSoldierRank(Job::Sergeant)) == 0); + BOOST_TEST(*hq->getReserveArmoredAvailablePointer(getSoldierRank(Job::Sergeant)) == 0); } diff --git a/tests/s25Main/integration/testBoundaryStones.cpp b/tests/s25Main/integration/testBoundaryStones.cpp index b969d29872..fb529cc117 100644 --- a/tests/s25Main/integration/testBoundaryStones.cpp +++ b/tests/s25Main/integration/testBoundaryStones.cpp @@ -15,11 +15,11 @@ namespace { using WorldFixtureEmpty0P = WorldFixture; boost::test_tools::predicate_result boundaryStonesMatch(GameWorld& world, const std::vector& expected) { - world.RecalcBorderStones(Position(0, 0), Extent(world.GetSize())); - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + world.RecalcBorderStones(Position(0, 0), Extent(world.getSize())); + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - const BoundaryStones& isValue = world.GetNode(pt).boundary_stones; - const BoundaryStones& expectedValue = expected[world.GetIdx(pt)]; + const BoundaryStones& isValue = world.getNode(pt).boundary_stones; + const BoundaryStones& expectedValue = expected[world.getIdx(pt)]; for(const auto bPos : helpers::EnumRange{}) { if(isValue[bPos] != expectedValue[bPos]) @@ -37,10 +37,10 @@ boost::test_tools::predicate_result boundaryStonesMatch(GameWorld& world, const BOOST_FIXTURE_TEST_CASE(BorderStones, WorldFixtureEmpty0P) { - std::vector expectedBoundaryStones(world.GetWidth() * world.GetHeight()); + std::vector expectedBoundaryStones(world.getWidth() * world.getHeight()); // Sanity check BOOST_TEST(boundaryStonesMatch(world, expectedBoundaryStones)); - expectedBoundaryStones[world.GetIdx(MapPoint(7, 5))][BorderStonePos::HalfSouthEast] = 1u; + expectedBoundaryStones[world.getIdx(MapPoint(7, 5))][BorderStonePos::HalfSouthEast] = 1u; BOOST_TEST(boundaryStonesMatch(world, expectedBoundaryStones).message().str() == "0!=1 at (7, 5)[BorderStonePos::HalfSouthEast]"); @@ -48,64 +48,64 @@ BOOST_FIXTURE_TEST_CASE(BorderStones, WorldFixtureEmpty0P) for(const auto middlePt : {MapPoint(5, 5), MapPoint(0, 0)}) { // Reset owner to 0 (None) and boundary stones to nothing - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - world.SetOwner(pt, 0); - std::fill(expectedBoundaryStones[world.GetIdx(pt)].begin(), expectedBoundaryStones[world.GetIdx(pt)].end(), + world.setOwner(pt, 0); + std::fill(expectedBoundaryStones[world.getIdx(pt)].begin(), expectedBoundaryStones[world.getIdx(pt)].end(), 0u); } // Get the minimum possible region where border stones would be placed - const auto radius1Pts = world.GetNeighbours(middlePt); + const auto radius1Pts = world.getNeighbours(middlePt); // Set only the middle pt and recalc - world.SetOwner(middlePt, 1); + world.setOwner(middlePt, 1); // Only middle pt has a single boundary stone - expectedBoundaryStones[world.GetIdx(middlePt)][BorderStonePos::OnPoint] = 1u; + expectedBoundaryStones[world.getIdx(middlePt)][BorderStonePos::OnPoint] = 1u; BOOST_TEST_REQUIRE(boundaryStonesMatch(world, expectedBoundaryStones)); for(MapPoint pt : radius1Pts) - world.SetOwner(pt, 1); + world.setOwner(pt, 1); // Midle pt lost its stone - expectedBoundaryStones[world.GetIdx(middlePt)][BorderStonePos::OnPoint] = 0u; + expectedBoundaryStones[world.getIdx(middlePt)][BorderStonePos::OnPoint] = 0u; // Each border node should have a boundary stone at the center for(MapPoint pt : radius1Pts) - expectedBoundaryStones[world.GetIdx(pt)][BorderStonePos::OnPoint] = 1u; - expectedBoundaryStones[world.GetIdx(radius1Pts[Direction::West])][BorderStonePos::HalfSouthEast] = 1u; - expectedBoundaryStones[world.GetIdx(radius1Pts[Direction::NorthWest])][BorderStonePos::HalfEast] = 1u; - expectedBoundaryStones[world.GetIdx(radius1Pts[Direction::NorthWest])][BorderStonePos::HalfSouthWest] = 1u; - expectedBoundaryStones[world.GetIdx(radius1Pts[Direction::NorthEast])][BorderStonePos::HalfSouthEast] = 1u; - expectedBoundaryStones[world.GetIdx(radius1Pts[Direction::East])][BorderStonePos::HalfSouthWest] = 1u; + expectedBoundaryStones[world.getIdx(pt)][BorderStonePos::OnPoint] = 1u; + expectedBoundaryStones[world.getIdx(radius1Pts[Direction::West])][BorderStonePos::HalfSouthEast] = 1u; + expectedBoundaryStones[world.getIdx(radius1Pts[Direction::NorthWest])][BorderStonePos::HalfEast] = 1u; + expectedBoundaryStones[world.getIdx(radius1Pts[Direction::NorthWest])][BorderStonePos::HalfSouthWest] = 1u; + expectedBoundaryStones[world.getIdx(radius1Pts[Direction::NorthEast])][BorderStonePos::HalfSouthEast] = 1u; + expectedBoundaryStones[world.getIdx(radius1Pts[Direction::East])][BorderStonePos::HalfSouthWest] = 1u; // SE has no other stone - expectedBoundaryStones[world.GetIdx(radius1Pts[Direction::SouthWest])][BorderStonePos::HalfEast] = 1u; + expectedBoundaryStones[world.getIdx(radius1Pts[Direction::SouthWest])][BorderStonePos::HalfEast] = 1u; BOOST_TEST_REQUIRE(boundaryStonesMatch(world, expectedBoundaryStones)); // Now obtain another node: - const MapPoint doubleWestPt = world.GetNeighbour(radius1Pts[Direction::West], Direction::West); - world.SetOwner(doubleWestPt, 1); + const MapPoint doubleWestPt = world.getNeighbour(radius1Pts[Direction::West], Direction::West); + world.setOwner(doubleWestPt, 1); // Still the same, but that node has 2 stones - expectedBoundaryStones[world.GetIdx(doubleWestPt)][BorderStonePos::OnPoint] = 1u; - expectedBoundaryStones[world.GetIdx(doubleWestPt)][BorderStonePos::HalfEast] = 1u; + expectedBoundaryStones[world.getIdx(doubleWestPt)][BorderStonePos::OnPoint] = 1u; + expectedBoundaryStones[world.getIdx(doubleWestPt)][BorderStonePos::HalfEast] = 1u; BOOST_TEST_REQUIRE(boundaryStonesMatch(world, expectedBoundaryStones)); // Next, actually increasing our territory // Note: The NW node and its West neighbour have (temporarly) 3 neigbouring stones leading to issue #538 where // the half-way stone to E gets removed with prevent-blocking enabled - const MapPoint doubleWestPt2 = world.GetNeighbour(doubleWestPt, Direction::NorthEast); - const MapPoint doubleWestPt3 = world.GetNeighbour(doubleWestPt, Direction::SouthEast); - world.SetOwner(doubleWestPt2, 1); - world.SetOwner(doubleWestPt3, 1); + const MapPoint doubleWestPt2 = world.getNeighbour(doubleWestPt, Direction::NorthEast); + const MapPoint doubleWestPt3 = world.getNeighbour(doubleWestPt, Direction::SouthEast); + world.setOwner(doubleWestPt2, 1); + world.setOwner(doubleWestPt3, 1); // New points get some stones: Top - expectedBoundaryStones[world.GetIdx(doubleWestPt2)][BorderStonePos::OnPoint] = 1u; - expectedBoundaryStones[world.GetIdx(doubleWestPt2)][BorderStonePos::HalfEast] = 1u; - expectedBoundaryStones[world.GetIdx(doubleWestPt2)][BorderStonePos::HalfSouthWest] = 1u; + expectedBoundaryStones[world.getIdx(doubleWestPt2)][BorderStonePos::OnPoint] = 1u; + expectedBoundaryStones[world.getIdx(doubleWestPt2)][BorderStonePos::HalfEast] = 1u; + expectedBoundaryStones[world.getIdx(doubleWestPt2)][BorderStonePos::HalfSouthWest] = 1u; // Bottom - expectedBoundaryStones[world.GetIdx(doubleWestPt3)][BorderStonePos::OnPoint] = 1u; - expectedBoundaryStones[world.GetIdx(doubleWestPt3)][BorderStonePos::HalfEast] = 1u; + expectedBoundaryStones[world.getIdx(doubleWestPt3)][BorderStonePos::OnPoint] = 1u; + expectedBoundaryStones[world.getIdx(doubleWestPt3)][BorderStonePos::HalfEast] = 1u; // Middle (gets one to bottom, looses one to right, as West point is now no border node anymore (affects 2 more) - expectedBoundaryStones[world.GetIdx(doubleWestPt)][BorderStonePos::HalfSouthEast] = 1u; - expectedBoundaryStones[world.GetIdx(doubleWestPt)][BorderStonePos::HalfEast] = 0u; - expectedBoundaryStones[world.GetIdx(radius1Pts[Direction::West])][BorderStonePos::OnPoint] = 0u; - expectedBoundaryStones[world.GetIdx(radius1Pts[Direction::West])][BorderStonePos::HalfSouthEast] = 0u; - expectedBoundaryStones[world.GetIdx(radius1Pts[Direction::NorthWest])][BorderStonePos::HalfSouthWest] = 0u; + expectedBoundaryStones[world.getIdx(doubleWestPt)][BorderStonePos::HalfSouthEast] = 1u; + expectedBoundaryStones[world.getIdx(doubleWestPt)][BorderStonePos::HalfEast] = 0u; + expectedBoundaryStones[world.getIdx(radius1Pts[Direction::West])][BorderStonePos::OnPoint] = 0u; + expectedBoundaryStones[world.getIdx(radius1Pts[Direction::West])][BorderStonePos::HalfSouthEast] = 0u; + expectedBoundaryStones[world.getIdx(radius1Pts[Direction::NorthWest])][BorderStonePos::HalfSouthWest] = 0u; BOOST_TEST_REQUIRE(boundaryStonesMatch(world, expectedBoundaryStones)); } } diff --git a/tests/s25Main/integration/testBuilding.cpp b/tests/s25Main/integration/testBuilding.cpp index 2b8baa78a1..31328c5c9e 100644 --- a/tests/s25Main/integration/testBuilding.cpp +++ b/tests/s25Main/integration/testBuilding.cpp @@ -57,7 +57,7 @@ boost::test_tools::predicate_result checkBQs(const GameWorldBase& world, const s bqReq = reducedBQs.find(pt)->second; //-V783 else bqReq = BuildingQuality::Castle; - const BuildingQuality isBQ = world.GetNode(pt).bq; + const BuildingQuality isBQ = world.getNode(pt).bq; if(bqReq == isBQ) continue; boost::test_tools::predicate_result result(false); @@ -70,7 +70,7 @@ boost::test_tools::predicate_result checkBQs(const GameWorldBase& world, const s BOOST_FIXTURE_TEST_CASE(checkBQs_Correct, EmptyWorldFixture1P) { - const MapPoint flagPos = world.MakeMapPoint(world.GetPlayer(0).GetHQPos() - Position(5, 6)); + const MapPoint flagPos = world.MakeMapPoint(world.getPlayer(0).getHQPos() - Position(5, 6)); const std::vector pts = world.GetPointsInRadiusWithCenter(flagPos, 4); std::stringstream s; s << flagPos; @@ -78,23 +78,23 @@ BOOST_FIXTURE_TEST_CASE(checkBQs_Correct, EmptyWorldFixture1P) ReducedBQMap reducedBQs; BOOST_TEST(checkBQs(world, pts, reducedBQs)); - world.GetNodeWriteable(flagPos).bq = BuildingQuality::Flag; + world.getNodeWriteable(flagPos).bq = BuildingQuality::Flag; BOOST_TEST(checkBQs(world, pts, reducedBQs).message().str() == "BuildingQuality::Flag!=BuildingQuality::Castle at " + s.str()); reducedBQs[flagPos] = BuildingQuality::Flag; BOOST_TEST(checkBQs(world, pts, reducedBQs)); - world.GetNodeWriteable(flagPos).bq = BuildingQuality::Castle; + world.getNodeWriteable(flagPos).bq = BuildingQuality::Castle; BOOST_TEST(checkBQs(world, pts, reducedBQs).message().str() == "BuildingQuality::Castle!=BuildingQuality::Flag at " + s.str()); } BOOST_FIXTURE_TEST_CASE(BQNextToBuilding, EmptyWorldFixture1P) { - const MapPoint flagPos = world.MakeMapPoint(world.GetPlayer(0).GetHQPos() - Position(5, 6)); - const MapPoint bldPos = world.GetNeighbour(flagPos, Direction::NorthWest); + const MapPoint flagPos = world.MakeMapPoint(world.getPlayer(0).getHQPos() - Position(5, 6)); + const MapPoint bldPos = world.getNeighbour(flagPos, Direction::NorthWest); // All points possibly affected by a building const std::vector pts = world.GetPointsInRadiusWithCenter(bldPos, 4); - const std::vector radius1Pts = world.GetPointsInRadius(bldPos, 1); + const std::vector radius1Pts = world.getPointsInRadius(bldPos, 1); ReducedBQMap reducedBQs; // Initially all are full BOOST_TEST_REQUIRE(checkBQs(world, pts, ReducedBQMap())); @@ -104,16 +104,16 @@ BOOST_FIXTURE_TEST_CASE(BQNextToBuilding, EmptyWorldFixture1P) reducedBQs.clear(); reducedBQs[flagPos] = BuildingQuality::Nothing; // Flag to any building would be to close and flag also to close (min diff of 2 required) - reducedBQs[world.GetNeighbour(flagPos, Direction::West)] = BuildingQuality::Nothing; - reducedBQs[world.GetNeighbour(flagPos, Direction::NorthEast)] = BuildingQuality::Nothing; + reducedBQs[world.getNeighbour(flagPos, Direction::West)] = BuildingQuality::Nothing; + reducedBQs[world.getNeighbour(flagPos, Direction::NorthEast)] = BuildingQuality::Nothing; // Can build houses but not castles for(const Direction dir : {Direction::East, Direction::SouthEast, Direction::SouthWest}) - reducedBQs[world.GetNeighbour(flagPos, dir)] = BuildingQuality::House; + reducedBQs[world.getNeighbour(flagPos, dir)] = BuildingQuality::House; // Flag to bld is blocked by flag for(const Direction dir : {Direction::West, Direction::NorthWest, Direction::NorthEast}) - reducedBQs[world.GetNeighbour(bldPos, dir)] = BuildingQuality::Flag; + reducedBQs[world.getNeighbour(bldPos, dir)] = BuildingQuality::Flag; BOOST_TEST_REQUIRE(checkBQs(world, pts, reducedBQs)); - BOOST_TEST_REQUIRE(!world.IsRoadAvailable(false, flagPos)); + BOOST_TEST_REQUIRE(!world.isRoadAvailable(false, flagPos)); // Remove flag -> BQ reset world.DestroyFlag(flagPos, 0); @@ -122,16 +122,16 @@ BOOST_FIXTURE_TEST_CASE(BQNextToBuilding, EmptyWorldFixture1P) // Place hut -> Addionally to changes by flag we can't place blds in range 1 // and no large blds in range 2 world.SetBuildingSite(BuildingType::Woodcutter, bldPos, 0); - BOOST_TEST_REQUIRE(world.GetSpecObj(bldPos)->GetSize() == BuildingQuality::Hut); //-V807 + BOOST_TEST_REQUIRE(world.getSpecObj(bldPos)->getSize() == BuildingQuality::Hut); //-V807 reducedBQs[bldPos] = BuildingQuality::Nothing; // Every bq with distance==2 has BuildingQuality::House for(unsigned i = 0; i < 12; i++) - reducedBQs[world.GetNeighbour2(bldPos, i)] = BuildingQuality::House; + reducedBQs[world.getNeighbour2(bldPos, i)] = BuildingQuality::House; BOOST_TEST_REQUIRE(checkBQs(world, pts, reducedBQs)); - BOOST_TEST_REQUIRE(!world.IsRoadAvailable(false, flagPos)); - BOOST_TEST_REQUIRE(!world.IsRoadAvailable(false, bldPos)); + BOOST_TEST_REQUIRE(!world.isRoadAvailable(false, flagPos)); + BOOST_TEST_REQUIRE(!world.isRoadAvailable(false, bldPos)); for(MapPoint pt : radius1Pts) - BOOST_TEST_REQUIRE((pt == flagPos || world.IsRoadAvailable(false, pt))); + BOOST_TEST_REQUIRE((pt == flagPos || world.isRoadAvailable(false, pt))); // Remove -> BQ reset world.DestroyFlag(flagPos, 0); @@ -139,12 +139,12 @@ BOOST_FIXTURE_TEST_CASE(BQNextToBuilding, EmptyWorldFixture1P) // Place house -> Same as hut world.SetBuildingSite(BuildingType::Sawmill, bldPos, 0); - BOOST_TEST_REQUIRE(world.GetSpecObj(bldPos)->GetSize() == BuildingQuality::House); + BOOST_TEST_REQUIRE(world.getSpecObj(bldPos)->getSize() == BuildingQuality::House); BOOST_TEST_REQUIRE(checkBQs(world, pts, reducedBQs)); - BOOST_TEST_REQUIRE(!world.IsRoadAvailable(false, flagPos)); - BOOST_TEST_REQUIRE(!world.IsRoadAvailable(false, bldPos)); + BOOST_TEST_REQUIRE(!world.isRoadAvailable(false, flagPos)); + BOOST_TEST_REQUIRE(!world.isRoadAvailable(false, bldPos)); for(MapPoint pt : radius1Pts) - BOOST_TEST_REQUIRE((pt == flagPos || world.IsRoadAvailable(false, pt))); + BOOST_TEST_REQUIRE((pt == flagPos || world.isRoadAvailable(false, pt))); // Remove -> BQ reset world.DestroyFlag(flagPos, 0); @@ -152,26 +152,26 @@ BOOST_FIXTURE_TEST_CASE(BQNextToBuilding, EmptyWorldFixture1P) // Place castle world.SetBuildingSite(BuildingType::Fortress, bldPos, 0); - BOOST_TEST_REQUIRE(world.GetSpecObj(bldPos)->GetSize() == BuildingQuality::Castle); + BOOST_TEST_REQUIRE(world.getSpecObj(bldPos)->getSize() == BuildingQuality::Castle); // Addionally to reduced BQs by hut: // Even flag is blocked by castle (model size) for(const Direction dir : {Direction::West, Direction::NorthWest, Direction::NorthEast}) { - const MapPoint wouldBeFlagPt = world.GetNeighbour(bldPos, dir); + const MapPoint wouldBeFlagPt = world.getNeighbour(bldPos, dir); reducedBQs[wouldBeFlagPt] = BuildingQuality::Nothing; // And therefore also the bld - reducedBQs[world.GetNeighbour(wouldBeFlagPt, Direction::NorthWest)] = BuildingQuality::Flag; + reducedBQs[world.getNeighbour(wouldBeFlagPt, Direction::NorthWest)] = BuildingQuality::Flag; } BOOST_TEST_REQUIRE(checkBQs(world, pts, reducedBQs)); - BOOST_TEST_REQUIRE(!world.IsRoadAvailable(false, flagPos)); - BOOST_TEST_REQUIRE(!world.IsRoadAvailable(false, bldPos)); + BOOST_TEST_REQUIRE(!world.isRoadAvailable(false, flagPos)); + BOOST_TEST_REQUIRE(!world.isRoadAvailable(false, bldPos)); // No roads over attachment - BOOST_TEST_REQUIRE(!world.IsRoadAvailable(false, world.GetNeighbour(bldPos, Direction::West))); - BOOST_TEST_REQUIRE(!world.IsRoadAvailable(false, world.GetNeighbour(bldPos, Direction::NorthWest))); - BOOST_TEST_REQUIRE(!world.IsRoadAvailable(false, world.GetNeighbour(bldPos, Direction::NorthEast))); + BOOST_TEST_REQUIRE(!world.isRoadAvailable(false, world.getNeighbour(bldPos, Direction::West))); + BOOST_TEST_REQUIRE(!world.isRoadAvailable(false, world.getNeighbour(bldPos, Direction::NorthWest))); + BOOST_TEST_REQUIRE(!world.isRoadAvailable(false, world.getNeighbour(bldPos, Direction::NorthEast))); // But other 2 points are ok - BOOST_TEST_REQUIRE(world.IsRoadAvailable(false, world.GetNeighbour(bldPos, Direction::SouthWest))); - BOOST_TEST_REQUIRE(world.IsRoadAvailable(false, world.GetNeighbour(bldPos, Direction::East))); + BOOST_TEST_REQUIRE(world.isRoadAvailable(false, world.getNeighbour(bldPos, Direction::SouthWest))); + BOOST_TEST_REQUIRE(world.isRoadAvailable(false, world.getNeighbour(bldPos, Direction::East))); // Remove -> BQ reset world.DestroyFlag(flagPos, 0); @@ -180,9 +180,9 @@ BOOST_FIXTURE_TEST_CASE(BQNextToBuilding, EmptyWorldFixture1P) BOOST_FIXTURE_TEST_CASE(BQWithRoad, EmptyWorldFixture0P) { - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - BuildingQuality bq = world.GetNode(pt).bq; + BuildingQuality bq = world.getNode(pt).bq; BOOST_TEST_INFO(" at " << pt); BOOST_TEST_REQUIRE(bq == BuildingQuality::Castle); } @@ -192,9 +192,9 @@ BOOST_FIXTURE_TEST_CASE(BQWithRoad, EmptyWorldFixture0P) for(unsigned i = 0; i < 6; i++) { roadPts.push_back(curPt); - world.SetPointRoad(curPt, Direction::SouthEast, PointRoad::Normal); + world.setPointRoad(curPt, Direction::SouthEast, PointRoad::Normal); world.RecalcBQForRoad(curPt); - curPt = world.GetNeighbour(curPt, Direction::SouthEast); + curPt = world.getNeighbour(curPt, Direction::SouthEast); } // Final pt still belongs to road roadPts.push_back(curPt); @@ -203,45 +203,45 @@ BOOST_FIXTURE_TEST_CASE(BQWithRoad, EmptyWorldFixture0P) for(MapPoint pt : roadPts) { - BOOST_TEST_REQUIRE(world.IsOnRoad(pt)); + BOOST_TEST_REQUIRE(world.isOnRoad(pt)); // On the road we only allow flags - BOOST_TEST_REQUIRE(world.GetNode(pt).bq == BuildingQuality::Flag); + BOOST_TEST_REQUIRE(world.getNode(pt).bq == BuildingQuality::Flag); // Next to the road should be houses // But left to first point is still a castle BuildingQuality leftBQ = (pt == roadPts[0]) ? BuildingQuality::Castle : BuildingQuality::House; - BOOST_TEST_REQUIRE(world.GetNode(pt - MapPoint(1, 0)).bq == leftBQ); - BOOST_TEST_REQUIRE(world.GetNode(pt + MapPoint(1, 0)).bq == BuildingQuality::House); + BOOST_TEST_REQUIRE(world.getNode(pt - MapPoint(1, 0)).bq == leftBQ); + BOOST_TEST_REQUIRE(world.getNode(pt + MapPoint(1, 0)).bq == BuildingQuality::House); } } BOOST_FIXTURE_TEST_CASE(BQWithVisualRoad, EmptyWorldFixture1PBigger) { uiHelper::initGUITests(); - RTTR_FOREACH_PT(MapPoint, world.GetSize()) - world.SetOwner(pt, 1); + RTTR_FOREACH_PT(MapPoint, world.getSize()) + world.setOwner(pt, 1); dskGameInterface gameDesktop(this->game, std::shared_ptr(), 0, false); - const GameWorldViewer& gwv = gameDesktop.GetView().GetViewer(); + const GameWorldViewer& gwv = gameDesktop.getView().getViewer(); // Start at a position a bit away from the HQ so all points are castles - const MapPoint roadPt = world.MakeMapPoint(world.GetPlayer(0).GetHQPos() - Position(6, 6)); + const MapPoint roadPt = world.MakeMapPoint(world.getPlayer(0).getHQPos() - Position(6, 6)); const std::vector roadRadiusPts = world.GetPointsInRadiusWithCenter(roadPt, 6); for(const MapPoint& pt : roadRadiusPts) BOOST_TEST_CONTEXT(" at " << pt) { - BuildingQuality bq = world.GetNode(pt).bq; + BuildingQuality bq = world.getNode(pt).bq; BOOST_TEST_REQUIRE(bq == BuildingQuality::Castle); bq = gwv.GetBQ(pt); BOOST_TEST_REQUIRE(bq == BuildingQuality::Castle); } gameDesktop.GI_StartRoadBuilding(roadPt, false); - BOOST_TEST_REQUIRE(gameDesktop.GetRoadMode() == RoadBuildMode::Normal); + BOOST_TEST_REQUIRE(gameDesktop.getRoadMode() == RoadBuildMode::Normal); std::vector roadPts; MapPoint curPt = roadPt; for(unsigned i = 0; i < 6; i++) { roadPts.push_back(curPt); - curPt = world.GetNeighbour(curPt, Direction::SouthEast); + curPt = world.getNeighbour(curPt, Direction::SouthEast); } // Final pt still belongs to road roadPts.push_back(curPt); @@ -252,27 +252,27 @@ BOOST_FIXTURE_TEST_CASE(BQWithVisualRoad, EmptyWorldFixture1PBigger) for(MapPoint pt : roadPts) { - BOOST_TEST_REQUIRE(gwv.IsOnRoad(pt)); + BOOST_TEST_REQUIRE(gwv.isOnRoad(pt)); // On the road we only allow flags BOOST_TEST_REQUIRE(gwv.GetBQ(pt) == BuildingQuality::Flag); // Next to the road should be houses // But left to first point is still a castle BuildingQuality leftBQ = (pt == roadPts[0]) ? BuildingQuality::Castle : BuildingQuality::House; - BOOST_TEST_REQUIRE(gwv.GetBQ(world.GetNeighbour(pt, Direction::West)) == leftBQ); - BOOST_TEST_REQUIRE(gwv.GetBQ(world.GetNeighbour(pt, Direction::East)) == BuildingQuality::House); + BOOST_TEST_REQUIRE(gwv.GetBQ(world.getNeighbour(pt, Direction::West)) == leftBQ); + BOOST_TEST_REQUIRE(gwv.GetBQ(world.getNeighbour(pt, Direction::East)) == BuildingQuality::House); } // Destroy road partially // The first point (after start) must have ID 2 - BOOST_TEST_REQUIRE(gameDesktop.GetIdInCurBuildRoad(roadPts[1]) == 2u); + BOOST_TEST_REQUIRE(gameDesktop.getIdInCurBuildRoad(roadPts[1]) == 2u); gameDesktop.DemolishRoad(2); - BOOST_TEST_REQUIRE(gwv.IsOnRoad(roadPts[0])); - BOOST_TEST_REQUIRE(gwv.IsOnRoad(roadPts[1])); + BOOST_TEST_REQUIRE(gwv.isOnRoad(roadPts[0])); + BOOST_TEST_REQUIRE(gwv.isOnRoad(roadPts[1])); for(unsigned i = 2; i < roadPts.size(); i++) - BOOST_TEST_REQUIRE(!gwv.IsOnRoad(roadPts[i])); + BOOST_TEST_REQUIRE(!gwv.isOnRoad(roadPts[i])); // Remove rest gameDesktop.GI_CancelRoadBuilding(); - BOOST_TEST_REQUIRE(!gwv.IsOnRoad(roadPts[0])); - BOOST_TEST_REQUIRE(!gwv.IsOnRoad(roadPts[1])); + BOOST_TEST_REQUIRE(!gwv.isOnRoad(roadPts[0])); + BOOST_TEST_REQUIRE(!gwv.isOnRoad(roadPts[1])); // BQ should be restored for(const MapPoint& pt : roadRadiusPts) { @@ -281,16 +281,16 @@ BOOST_FIXTURE_TEST_CASE(BQWithVisualRoad, EmptyWorldFixture1PBigger) BOOST_TEST_REQUIRE(bq == BuildingQuality::Castle); } - BOOST_TEST_REQUIRE(gameDesktop.GetRoadMode() == RoadBuildMode::Disabled); + BOOST_TEST_REQUIRE(gameDesktop.getRoadMode() == RoadBuildMode::Disabled); gameDesktop.GI_StartRoadBuilding(roadPt, false); - BOOST_TEST_REQUIRE(gameDesktop.GetRoadMode() == RoadBuildMode::Normal); + BOOST_TEST_REQUIRE(gameDesktop.getRoadMode() == RoadBuildMode::Normal); // Build horizontal road roadPts.clear(); curPt = roadPt; for(unsigned i = 0; i < 6; i++) { roadPts.push_back(curPt); - curPt = world.GetNeighbour(curPt, Direction::East); + curPt = world.getNeighbour(curPt, Direction::East); } // Final pt still belongs to road roadPts.push_back(curPt); @@ -301,21 +301,21 @@ BOOST_FIXTURE_TEST_CASE(BQWithVisualRoad, EmptyWorldFixture1PBigger) for(MapPoint pt : roadPts) { - BOOST_TEST_REQUIRE(gwv.IsOnRoad(pt)); + BOOST_TEST_REQUIRE(gwv.isOnRoad(pt)); // On the road we only allow flags BOOST_TEST_REQUIRE(gwv.GetBQ(pt) == BuildingQuality::Flag); // Above should be castles - BOOST_TEST_REQUIRE(gwv.GetBQ(world.GetNeighbour(pt, Direction::NorthWest)) == BuildingQuality::Castle); - BOOST_TEST_REQUIRE(gwv.GetBQ(world.GetNeighbour(pt, Direction::NorthEast)) == BuildingQuality::Castle); + BOOST_TEST_REQUIRE(gwv.GetBQ(world.getNeighbour(pt, Direction::NorthWest)) == BuildingQuality::Castle); + BOOST_TEST_REQUIRE(gwv.GetBQ(world.getNeighbour(pt, Direction::NorthEast)) == BuildingQuality::Castle); // Below should be big houses - BOOST_TEST_REQUIRE(gwv.GetBQ(world.GetNeighbour(pt, Direction::SouthWest)) == BuildingQuality::House); - BOOST_TEST_REQUIRE(gwv.GetBQ(world.GetNeighbour(pt, Direction::SouthEast)) == BuildingQuality::House); + BOOST_TEST_REQUIRE(gwv.GetBQ(world.getNeighbour(pt, Direction::SouthWest)) == BuildingQuality::House); + BOOST_TEST_REQUIRE(gwv.GetBQ(world.getNeighbour(pt, Direction::SouthEast)) == BuildingQuality::House); } // Destroy road gameDesktop.GI_CancelRoadBuilding(); for(MapPoint pt : roadPts) - BOOST_TEST_REQUIRE(!gwv.IsOnRoad(pt)); + BOOST_TEST_REQUIRE(!gwv.isOnRoad(pt)); // BQ should be restored for(const MapPoint& pt : roadRadiusPts) { @@ -327,15 +327,15 @@ BOOST_FIXTURE_TEST_CASE(BQWithVisualRoad, EmptyWorldFixture1PBigger) BOOST_FIXTURE_TEST_CASE(BQ_AtBorder, EmptyWorldFixture1PBiggest) { - GamePlayer& player = world.GetPlayer(0); - const MapPoint hqPos = player.GetHQPos(); - const nobBaseMilitary* hq = world.GetSpecObj(hqPos); + GamePlayer& player = world.getPlayer(0); + const MapPoint hqPos = player.getHQPos(); + const nobBaseMilitary* hq = world.getSpecObj(hqPos); BOOST_TEST_REQUIRE(hq); - const unsigned hqRadius = hq->GetMilitaryRadius(); + const unsigned hqRadius = hq->getMilitaryRadius(); BOOST_TEST_REQUIRE(hqRadius > 4u); - BOOST_TEST_REQUIRE(hqRadius * 2u < world.GetWidth()); - BOOST_TEST_REQUIRE(hqRadius * 2u < world.GetHeight()); - std::vector pts = world.GetPointsInRadius(hqPos, hqRadius + 1); + BOOST_TEST_REQUIRE(hqRadius * 2u < world.getWidth()); + BOOST_TEST_REQUIRE(hqRadius * 2u < world.getHeight()); + std::vector pts = world.getPointsInRadius(hqPos, hqRadius + 1); for(const MapPoint pt : pts) { const unsigned distance = world.CalcDistance(pt, hqPos); @@ -344,27 +344,27 @@ BOOST_FIXTURE_TEST_CASE(BQ_AtBorder, EmptyWorldFixture1PBiggest) else if(distance + 1 < hqRadius) { // Our territory -> No restrictions - BOOST_TEST_REQUIRE(world.IsPlayerTerritory(pt)); + BOOST_TEST_REQUIRE(world.isPlayerTerritory(pt)); BOOST_TEST_REQUIRE(world.GetBQ(pt, 0) == BuildingQuality::Castle); } else if(distance < hqRadius) { // Near border, flag if we cant build a buildings flag - BOOST_TEST_REQUIRE(world.IsPlayerTerritory(pt)); - if(!world.IsPlayerTerritory(world.GetNeighbour(pt, Direction::SouthEast))) + BOOST_TEST_REQUIRE(world.isPlayerTerritory(pt)); + if(!world.isPlayerTerritory(world.getNeighbour(pt, Direction::SouthEast))) BOOST_TEST_REQUIRE(world.GetBQ(pt, 0) == BuildingQuality::Flag); else BOOST_TEST_REQUIRE(world.GetBQ(pt, 0) == BuildingQuality::Castle); } else if(distance == hqRadius) { // At border - BOOST_TEST_REQUIRE(!world.IsPlayerTerritory(pt)); - BOOST_TEST_REQUIRE(world.GetNode(pt).owner == 0u + 1u); + BOOST_TEST_REQUIRE(!world.isPlayerTerritory(pt)); + BOOST_TEST_REQUIRE(world.getNode(pt).owner == 0u + 1u); BOOST_TEST_REQUIRE(world.GetBQ(pt, 0) == BuildingQuality::Nothing); } else { // Outside border - BOOST_TEST_REQUIRE(!world.IsPlayerTerritory(pt)); - BOOST_TEST_REQUIRE(world.GetNode(pt).owner == 0u); + BOOST_TEST_REQUIRE(!world.isPlayerTerritory(pt)); + BOOST_TEST_REQUIRE(world.getNode(pt).owner == 0u); BOOST_TEST_REQUIRE(world.GetBQ(pt, 0) == BuildingQuality::Nothing); } } @@ -372,57 +372,57 @@ BOOST_FIXTURE_TEST_CASE(BQ_AtBorder, EmptyWorldFixture1PBiggest) // Place a flag near a border MapPoint flagPt = hqPos; for(unsigned i = 0; i < hqRadius - 2; i++) - flagPt = world.GetNeighbour(flagPt, i % 2 ? Direction::SouthEast : Direction::SouthWest); + flagPt = world.getNeighbour(flagPt, i % 2 ? Direction::SouthEast : Direction::SouthWest); // This is near the border, so only a flag is possible - BOOST_TEST_REQUIRE(world.GetBQ(world.GetNeighbour(flagPt, Direction::SouthEast), 0) == BuildingQuality::Flag); + BOOST_TEST_REQUIRE(world.GetBQ(world.getNeighbour(flagPt, Direction::SouthEast), 0) == BuildingQuality::Flag); world.SetFlag(flagPt, 0); - BOOST_TEST_REQUIRE(world.GetNO(flagPt)->GetGOT() == GO_Type::Flag); - BOOST_TEST_REQUIRE(world.GetBQ(world.GetNeighbour(flagPt, Direction::West), 0) + BOOST_TEST_REQUIRE(world.getNO(flagPt)->getGOT() == GO_Type::Flag); + BOOST_TEST_REQUIRE(world.GetBQ(world.getNeighbour(flagPt, Direction::West), 0) == BuildingQuality::Nothing); // Buildings flag or flag to close to this - BOOST_TEST_REQUIRE(world.GetBQ(world.GetNeighbour(flagPt, Direction::NorthWest), 0) + BOOST_TEST_REQUIRE(world.GetBQ(world.getNeighbour(flagPt, Direction::NorthWest), 0) == BuildingQuality::Castle); // Building to this flag - BOOST_TEST_REQUIRE(world.GetBQ(world.GetNeighbour(flagPt, Direction::NorthEast), 0) + BOOST_TEST_REQUIRE(world.GetBQ(world.getNeighbour(flagPt, Direction::NorthEast), 0) == BuildingQuality::Nothing); // Buildings flag or flag to close to this - BOOST_TEST_REQUIRE(world.GetBQ(world.GetNeighbour(flagPt, Direction::East), 0) + BOOST_TEST_REQUIRE(world.GetBQ(world.getNeighbour(flagPt, Direction::East), 0) == BuildingQuality::House); // This flag blocks castles extensions // This flag is to close and border prohibits building - BOOST_TEST_REQUIRE(world.GetBQ(world.GetNeighbour(flagPt, Direction::SouthEast), 0) == BuildingQuality::Nothing); - BOOST_TEST_REQUIRE(world.GetBQ(world.GetNeighbour(flagPt, Direction::SouthWest), 0) == BuildingQuality::Nothing); + BOOST_TEST_REQUIRE(world.GetBQ(world.getNeighbour(flagPt, Direction::SouthEast), 0) == BuildingQuality::Nothing); + BOOST_TEST_REQUIRE(world.GetBQ(world.getNeighbour(flagPt, Direction::SouthWest), 0) == BuildingQuality::Nothing); } static void addStaticObj(GameWorldBase& world, const MapPoint& pos, unsigned size) { world.DestroyNO(pos, false); - world.SetNO(pos, new noStaticObject(pos, 0, 0, size)); + world.setNO(pos, new noStaticObject(pos, 0, 0, size)); world.RecalcBQAroundPointBig(pos); } BOOST_FIXTURE_TEST_CASE(BQNearObjects, EmptyWorldFixture1P) { - const MapPoint objPos = world.MakeMapPoint(world.GetPlayer(0).GetHQPos() - Position(3, 6)); + const MapPoint objPos = world.MakeMapPoint(world.getPlayer(0).getHQPos() - Position(3, 6)); const std::vector ptsAroundObj = world.GetPointsInRadiusWithCenter(objPos, 2); - const std::vector radius1Pts = world.GetPointsInRadius(objPos, 1); + const std::vector radius1Pts = world.getPointsInRadius(objPos, 1); BOOST_TEST_REQUIRE(checkBQs(world, ptsAroundObj, ReducedBQMap())); ReducedBQMap reducedBQs; // Size=0 -> Block Nothing addStaticObj(world, objPos, 0); BOOST_TEST_REQUIRE(checkBQs(world, ptsAroundObj, ReducedBQMap())); - BOOST_TEST_REQUIRE(world.IsRoadAvailable(false, objPos)); + BOOST_TEST_REQUIRE(world.isRoadAvailable(false, objPos)); for(MapPoint pt : radius1Pts) - BOOST_TEST_REQUIRE(world.IsRoadAvailable(false, pt)); + BOOST_TEST_REQUIRE(world.isRoadAvailable(false, pt)); // Size=1 -> Block only point addStaticObj(world, objPos, 1); reducedBQs[objPos] = BuildingQuality::Nothing; - reducedBQs[world.GetNeighbour(objPos, Direction::NorthWest)] = BuildingQuality::Flag; + reducedBQs[world.getNeighbour(objPos, Direction::NorthWest)] = BuildingQuality::Flag; // Can build houses but not castles for(const Direction dir : {Direction::East, Direction::SouthEast, Direction::SouthWest}) - reducedBQs[world.GetNeighbour(objPos, dir)] = BuildingQuality::House; + reducedBQs[world.getNeighbour(objPos, dir)] = BuildingQuality::House; BOOST_TEST_REQUIRE(checkBQs(world, ptsAroundObj, reducedBQs)); - BOOST_TEST_REQUIRE(!world.IsRoadAvailable(false, objPos)); + BOOST_TEST_REQUIRE(!world.isRoadAvailable(false, objPos)); for(MapPoint pt : radius1Pts) - BOOST_TEST_REQUIRE(world.IsRoadAvailable(false, pt)); + BOOST_TEST_REQUIRE(world.isRoadAvailable(false, pt)); // Size=2 -> Block like a castle addStaticObj(world, objPos, 2); @@ -430,34 +430,34 @@ BOOST_FIXTURE_TEST_CASE(BQNearObjects, EmptyWorldFixture1P) // Extensions block spots for(const Direction dir : {Direction::West, Direction::NorthWest, Direction::NorthEast}) { - const MapPoint extensionPos = world.GetNeighbour(objPos, dir); + const MapPoint extensionPos = world.getNeighbour(objPos, dir); reducedBQs[extensionPos] = BuildingQuality::Nothing; // And therefore also the bld - reducedBQs[world.GetNeighbour(extensionPos, Direction::NorthWest)] = BuildingQuality::Flag; + reducedBQs[world.getNeighbour(extensionPos, Direction::NorthWest)] = BuildingQuality::Flag; } // Also blocked by extensions: - reducedBQs[world.GetNeighbour(world.GetNeighbour(objPos, Direction::West), Direction::SouthWest)] = + reducedBQs[world.getNeighbour(world.getNeighbour(objPos, Direction::West), Direction::SouthWest)] = BuildingQuality::House; - reducedBQs[world.GetNeighbour(world.GetNeighbour(objPos, Direction::NorthEast), Direction::East)] = + reducedBQs[world.getNeighbour(world.getNeighbour(objPos, Direction::NorthEast), Direction::East)] = BuildingQuality::House; BOOST_TEST_REQUIRE(checkBQs(world, ptsAroundObj, reducedBQs)); - BOOST_TEST_REQUIRE(!world.IsRoadAvailable(false, objPos)); + BOOST_TEST_REQUIRE(!world.isRoadAvailable(false, objPos)); // No roads over attachment - BOOST_TEST_REQUIRE(!world.IsRoadAvailable(false, world.GetNeighbour(objPos, Direction::West))); - BOOST_TEST_REQUIRE(!world.IsRoadAvailable(false, world.GetNeighbour(objPos, Direction::NorthWest))); - BOOST_TEST_REQUIRE(!world.IsRoadAvailable(false, world.GetNeighbour(objPos, Direction::NorthEast))); + BOOST_TEST_REQUIRE(!world.isRoadAvailable(false, world.getNeighbour(objPos, Direction::West))); + BOOST_TEST_REQUIRE(!world.isRoadAvailable(false, world.getNeighbour(objPos, Direction::NorthWest))); + BOOST_TEST_REQUIRE(!world.isRoadAvailable(false, world.getNeighbour(objPos, Direction::NorthEast))); // But other 3 points are ok - BOOST_TEST_REQUIRE(world.IsRoadAvailable(false, world.GetNeighbour(objPos, Direction::East))); - BOOST_TEST_REQUIRE(world.IsRoadAvailable(false, world.GetNeighbour(objPos, Direction::SouthEast))); - BOOST_TEST_REQUIRE(world.IsRoadAvailable(false, world.GetNeighbour(objPos, Direction::SouthWest))); + BOOST_TEST_REQUIRE(world.isRoadAvailable(false, world.getNeighbour(objPos, Direction::East))); + BOOST_TEST_REQUIRE(world.isRoadAvailable(false, world.getNeighbour(objPos, Direction::SouthEast))); + BOOST_TEST_REQUIRE(world.isRoadAvailable(false, world.getNeighbour(objPos, Direction::SouthWest))); } BOOST_FIXTURE_TEST_CASE(RoadRemovesObjs, EmptyWorldFixture1P) { - RTTR_FOREACH_PT(MapPoint, world.GetSize()) - world.SetOwner(pt, 1); - const MapPoint hqPos = world.GetPlayer(0).GetHQPos(); - const MapPoint startPos = world.GetNeighbour(hqPos, Direction::SouthEast); + RTTR_FOREACH_PT(MapPoint, world.getSize()) + world.setOwner(pt, 1); + const MapPoint hqPos = world.getPlayer(0).getHQPos(); + const MapPoint startPos = world.getNeighbour(hqPos, Direction::SouthEast); const MapPoint endPos = world.MakeMapPoint(startPos + Position(4, 0)); // Place these env objs const std::vector ids{505, 506, 507, 508, 509, 510, 512, 513, 514, 515, 531, 536, 541, 542, 543, @@ -467,17 +467,17 @@ BOOST_FIXTURE_TEST_CASE(RoadRemovesObjs, EmptyWorldFixture1P) MapPoint curPos = startPos; for(unsigned i = 0; i < 4; i++) { - curPos = world.GetNeighbour(curPos, Direction::East); - world.SetNO(curPos, new noEnvObject(curPos, curId)); + curPos = world.getNeighbour(curPos, Direction::East); + world.setNO(curPos, new noEnvObject(curPos, curId)); } world.BuildRoad(0, false, startPos, std::vector(4, Direction::East)); // Check road build and objs removed curPos = startPos; for(unsigned i = 0; i < 3; i++) { - BOOST_TEST_REQUIRE(world.GetPointRoad(curPos, Direction::East) == PointRoad::Normal); - curPos = world.GetNeighbour(curPos, Direction::East); - BOOST_TEST_REQUIRE(world.GetNO(curPos)->GetType() == NodalObjectType::Nothing); + BOOST_TEST_REQUIRE(world.getPointRoad(curPos, Direction::East) == PointRoad::Normal); + curPos = world.getNeighbour(curPos, Direction::East); + BOOST_TEST_REQUIRE(world.getNO(curPos)->getType() == NodalObjectType::Nothing); } world.DestroyFlag(endPos, 0); } @@ -485,9 +485,9 @@ BOOST_FIXTURE_TEST_CASE(RoadRemovesObjs, EmptyWorldFixture1P) BOOST_FIXTURE_TEST_CASE(FisherIgnoresIsolatedFishWater, EmptyWorldFixture1PBiggest) { - const DescIdx tWater = GetWaterTerrain(world.GetDescription()); + const DescIdx tWater = GetWaterTerrain(world.getDescription()); - const MapPoint fisheryPos = world.MakeMapPoint(world.GetPlayer(0).GetHQPos() - Position(6, 6)); + const MapPoint fisheryPos = world.MakeMapPoint(world.getPlayer(0).getHQPos() - Position(6, 6)); auto* fishery = dynamic_cast( BuildingFactory::CreateBuilding(world, BuildingType::Fishery, fisheryPos, 0, Nation::Romans)); BOOST_TEST_REQUIRE(fishery); @@ -495,13 +495,13 @@ BOOST_FIXTURE_TEST_CASE(FisherIgnoresIsolatedFishWater, EmptyWorldFixture1PBigge nofFisher fisher(fisheryPos, 0, fishery); const MapPoint workPt = world.MakeMapPoint(fisheryPos + Position(4, 0)); - const MapPoint fishPt = world.GetNeighbour(workPt, Direction::East); + const MapPoint fishPt = world.getNeighbour(workPt, Direction::East); auto makeWaterPoint = [&](const MapPoint pt) { - MapNode& nwNode = world.GetNodeWriteable(world.GetNeighbour(pt, Direction::NorthWest)); - MapNode& neNode = world.GetNodeWriteable(world.GetNeighbour(pt, Direction::NorthEast)); - MapNode& curNode = world.GetNodeWriteable(pt); - MapNode& wNode = world.GetNodeWriteable(world.GetNeighbour(pt, Direction::West)); + MapNode& nwNode = world.getNodeWriteable(world.getNeighbour(pt, Direction::NorthWest)); + MapNode& neNode = world.getNodeWriteable(world.getNeighbour(pt, Direction::NorthEast)); + MapNode& curNode = world.getNodeWriteable(pt); + MapNode& wNode = world.getNodeWriteable(world.getNeighbour(pt, Direction::West)); nwNode.t1 = tWater; nwNode.t2 = tWater; @@ -512,34 +512,34 @@ BOOST_FIXTURE_TEST_CASE(FisherIgnoresIsolatedFishWater, EmptyWorldFixture1PBigge }; makeWaterPoint(fishPt); - world.SetResource(fishPt, Resource(ResourceType::Fish, 4)); - MapLoader::SetupResources(world); + world.setResource(fishPt, Resource(ResourceType::Fish, 4)); + MapLoader::setupResources(world); - BOOST_TEST_REQUIRE(!world.GetNode(fishPt).resources.has(ResourceType::Fish)); - BOOST_TEST_REQUIRE((fisher.GetPointQuality(workPt, false) == nofFarmhand::PointQuality::NotPossible)); + BOOST_TEST_REQUIRE(!world.getNode(fishPt).resources.has(ResourceType::Fish)); + BOOST_TEST_REQUIRE((fisher.getPointQuality(workPt, false) == nofFarmhand::PointQuality::NotPossible)); - const MapPoint connectedFishPt = world.GetNeighbour(fishPt, Direction::East); + const MapPoint connectedFishPt = world.getNeighbour(fishPt, Direction::East); makeWaterPoint(connectedFishPt); - world.SetResource(fishPt, Resource(ResourceType::Fish, 4)); - world.SetResource(connectedFishPt, Resource(ResourceType::Fish, 4)); - MapLoader::SetupResources(world); + world.setResource(fishPt, Resource(ResourceType::Fish, 4)); + world.setResource(connectedFishPt, Resource(ResourceType::Fish, 4)); + MapLoader::setupResources(world); - BOOST_TEST_REQUIRE(world.GetNode(fishPt).resources.has(ResourceType::Fish)); - BOOST_TEST_REQUIRE(world.GetNode(connectedFishPt).resources.has(ResourceType::Fish)); - BOOST_TEST_REQUIRE((fisher.GetPointQuality(workPt, false) == nofFarmhand::PointQuality::Class1)); + BOOST_TEST_REQUIRE(world.getNode(fishPt).resources.has(ResourceType::Fish)); + BOOST_TEST_REQUIRE(world.getNode(connectedFishPt).resources.has(ResourceType::Fish)); + BOOST_TEST_REQUIRE((fisher.getPointQuality(workPt, false) == nofFarmhand::PointQuality::Class1)); - const MapPoint rowEndFishPt(world.GetWidth() - 1, 10); - const MapPoint rowEndConnectedWaterPt = world.GetNeighbour(rowEndFishPt, Direction::West); + const MapPoint rowEndFishPt(world.getWidth() - 1, 10); + const MapPoint rowEndConnectedWaterPt = world.getNeighbour(rowEndFishPt, Direction::West); const MapPoint nextRowFishPt(0, rowEndFishPt.y + 1); makeWaterPoint(rowEndFishPt); makeWaterPoint(rowEndConnectedWaterPt); makeWaterPoint(nextRowFishPt); - world.SetResource(rowEndFishPt, Resource(ResourceType::Fish, 4)); - world.SetResource(nextRowFishPt, Resource(ResourceType::Fish, 4)); - MapLoader::SetupResources(world); + world.setResource(rowEndFishPt, Resource(ResourceType::Fish, 4)); + world.setResource(nextRowFishPt, Resource(ResourceType::Fish, 4)); + MapLoader::setupResources(world); - BOOST_TEST_REQUIRE(world.GetNode(rowEndFishPt).resources.has(ResourceType::Fish)); - BOOST_TEST_REQUIRE(!world.GetNode(nextRowFishPt).resources.has(ResourceType::Fish)); + BOOST_TEST_REQUIRE(world.getNode(rowEndFishPt).resources.has(ResourceType::Fish)); + BOOST_TEST_REQUIRE(!world.getNode(nextRowFishPt).resources.has(ResourceType::Fish)); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/integration/testBuildingProps.cpp b/tests/s25Main/integration/testBuildingProps.cpp index 3781854ad8..c62dc0f0ad 100644 --- a/tests/s25Main/integration/testBuildingProps.cpp +++ b/tests/s25Main/integration/testBuildingProps.cpp @@ -21,21 +21,21 @@ BOOST_FIXTURE_TEST_CASE(IsType, EmptyWorldFixture1P) const MapPoint bldPos(0, 0); for(const auto bldType : helpers::enumRange()) { - if(!BuildingProperties::IsValid(bldType)) + if(!BuildingProperties::isValid(bldType)) continue; noBuilding* bld = BuildingFactory::CreateBuilding(world, bldType, bldPos, 0, Nation::Romans); BOOST_TEST_REQUIRE(bld); - if(BuildingProperties::IsMilitary(bldType)) + if(BuildingProperties::isMilitary(bldType)) BOOST_TEST_REQUIRE(dynamic_cast(bld)); else BOOST_TEST_REQUIRE(!dynamic_cast(bld)); - if(BuildingProperties::IsWareHouse(bldType)) + if(BuildingProperties::isWareHouse(bldType)) BOOST_TEST_REQUIRE(dynamic_cast(bld)); else BOOST_TEST_REQUIRE(!dynamic_cast(bld)); - if(BuildingProperties::IsMine(bldType)) + if(BuildingProperties::isMine(bldType)) BOOST_TEST_REQUIRE(dynamic_cast(bld)); // At least a usual - if(BuildingProperties::IsUsual(bldType)) + if(BuildingProperties::isUsual(bldType)) BOOST_TEST_REQUIRE(dynamic_cast(bld)); world.DestroyNO(bldPos); // Destroy fire diff --git a/tests/s25Main/integration/testBuildingRadius.cpp b/tests/s25Main/integration/testBuildingRadius.cpp index c999a146f3..ac99522d12 100644 --- a/tests/s25Main/integration/testBuildingRadius.cpp +++ b/tests/s25Main/integration/testBuildingRadius.cpp @@ -49,44 +49,44 @@ BOOST_AUTO_TEST_CASE(FarmHandGetWorkRadius) { GlobalGameSettings ggs; // Fixed radius - BOOST_TEST(nofFarmhand::GetWorkRadius(ggs, Job::Farmer) > 0u); - BOOST_TEST(nofFarmhand::GetWorkRadius(ggs, Job::Fisher) > 0u); + BOOST_TEST(nofFarmhand::getWorkRadius(ggs, Job::Farmer) > 0u); + BOOST_TEST(nofFarmhand::getWorkRadius(ggs, Job::Fisher) > 0u); // Addon dependent - const auto defaultValue = nofFarmhand::GetWorkRadius(ggs, Job::Woodcutter); + const auto defaultValue = nofFarmhand::getWorkRadius(ggs, Job::Woodcutter); BOOST_TEST(defaultValue > 0); ggs.setSelection(AddonId::WOODCUTTER_REACH_RADIUS, rttr::test::randomValue(1, 3)); - BOOST_TEST(nofFarmhand::GetWorkRadius(ggs, Job::Woodcutter) > defaultValue); + BOOST_TEST(nofFarmhand::getWorkRadius(ggs, Job::Woodcutter) > defaultValue); // Non farmhand jobs throw - BOOST_CHECK_THROW(nofFarmhand::GetWorkRadius(ggs, Job::Helper), std::logic_error); - BOOST_CHECK_THROW(nofFarmhand::GetWorkRadius(ggs, Job::Metalworker), std::logic_error); + BOOST_CHECK_THROW(nofFarmhand::getWorkRadius(ggs, Job::Helper), std::logic_error); + BOOST_CHECK_THROW(nofFarmhand::getWorkRadius(ggs, Job::Metalworker), std::logic_error); } -BOOST_FIXTURE_TEST_CASE(GetBuildingRadius, GameWorldViewFixture) +BOOST_FIXTURE_TEST_CASE(getBuildingRadius, GameWorldViewFixture) { // Military buildings (territory influence radius) - BOOST_TEST(view.GetBuildingRadius(BuildingType::Barracks) == MILITARY_RADIUS[0]); - BOOST_TEST(view.GetBuildingRadius(BuildingType::Guardhouse) == MILITARY_RADIUS[1]); - BOOST_TEST(view.GetBuildingRadius(BuildingType::Watchtower) == MILITARY_RADIUS[2]); - BOOST_TEST(view.GetBuildingRadius(BuildingType::Fortress) == MILITARY_RADIUS[3]); - BOOST_TEST(view.GetBuildingRadius(BuildingType::Headquarters) == HQ_RADIUS); - BOOST_TEST(view.GetBuildingRadius(BuildingType::HarborBuilding) == HARBOR_RADIUS); - - BOOST_TEST(view.GetBuildingRadius(BuildingType::LookoutTower) == VISUALRANGE_LOOKOUTTOWER); - BOOST_TEST(view.GetBuildingRadius(BuildingType::Catapult) == CATAPULT_MAX_TARGET_RANGE); - BOOST_TEST(view.GetBuildingRadius(BuildingType::Hunter) == ANIMAL_RADIUS); - BOOST_TEST(view.GetBuildingRadius(BuildingType::Skinner) == ANIMAL_RADIUS); + BOOST_TEST(view.getBuildingRadius(BuildingType::Barracks) == MILITARY_RADIUS[0]); + BOOST_TEST(view.getBuildingRadius(BuildingType::Guardhouse) == MILITARY_RADIUS[1]); + BOOST_TEST(view.getBuildingRadius(BuildingType::Watchtower) == MILITARY_RADIUS[2]); + BOOST_TEST(view.getBuildingRadius(BuildingType::Fortress) == MILITARY_RADIUS[3]); + BOOST_TEST(view.getBuildingRadius(BuildingType::Headquarters) == HQ_RADIUS); + BOOST_TEST(view.getBuildingRadius(BuildingType::HarborBuilding) == HARBOR_RADIUS); + + BOOST_TEST(view.getBuildingRadius(BuildingType::LookoutTower) == VISUALRANGE_LOOKOUTTOWER); + BOOST_TEST(view.getBuildingRadius(BuildingType::Catapult) == CATAPULT_MAX_TARGET_RANGE); + BOOST_TEST(view.getBuildingRadius(BuildingType::Hunter) == ANIMAL_RADIUS); + BOOST_TEST(view.getBuildingRadius(BuildingType::Skinner) == ANIMAL_RADIUS); for(const auto mine : {BuildingType::GraniteMine, BuildingType::CoalMine, BuildingType::IronMine, BuildingType::GoldMine, BuildingType::Well}) { - BOOST_TEST(view.GetBuildingRadius(mine) == MINER_RADIUS); + BOOST_TEST(view.getBuildingRadius(mine) == MINER_RADIUS); } for(const auto bt : {BuildingType::Woodcutter, BuildingType::Forester, BuildingType::Fishery, BuildingType::Quarry, BuildingType::Farm, BuildingType::Vineyard, BuildingType::Charburner}) { - BOOST_TEST(view.GetBuildingRadius(bt) > 0u); + BOOST_TEST(view.getBuildingRadius(bt) > 0u); } // Remaining building types have no relevant radius @@ -96,7 +96,7 @@ BOOST_FIXTURE_TEST_CASE(GetBuildingRadius, GameWorldViewFixture) BuildingType::Sawmill, BuildingType::Shipyard, BuildingType::Slaughterhouse, BuildingType::Storehouse, BuildingType::Tannery, BuildingType::Temple, BuildingType::Winery}) { - BOOST_TEST(view.GetBuildingRadius(bt) == 0u); + BOOST_TEST(view.getBuildingRadius(bt) == 0u); } } @@ -104,19 +104,19 @@ BOOST_FIXTURE_TEST_CASE(GetBuildingRadiusRespectsAddons, GameWorldViewFixture) { // Smoke tests only: Increasing the addon setting increases reach w/o assuming specific number of settings or values ggs.setSelection(AddonId::WOODCUTTER_REACH_RADIUS, 0); - auto defaultRadius = view.GetBuildingRadius(BuildingType::Woodcutter); + auto defaultRadius = view.getBuildingRadius(BuildingType::Woodcutter); ggs.setSelection(AddonId::WOODCUTTER_REACH_RADIUS, 1); - BOOST_TEST(view.GetBuildingRadius(BuildingType::Woodcutter) > defaultRadius); + BOOST_TEST(view.getBuildingRadius(BuildingType::Woodcutter) > defaultRadius); ggs.setSelection(AddonId::FORESTER_REACH_RADIUS, 0); - defaultRadius = view.GetBuildingRadius(BuildingType::Forester); + defaultRadius = view.getBuildingRadius(BuildingType::Forester); ggs.setSelection(AddonId::FORESTER_REACH_RADIUS, 1); - BOOST_TEST(view.GetBuildingRadius(BuildingType::Forester) > defaultRadius); + BOOST_TEST(view.getBuildingRadius(BuildingType::Forester) > defaultRadius); ggs.setSelection(AddonId::STONEMASON_REACH_RADIUS, 0); - defaultRadius = view.GetBuildingRadius(BuildingType::Quarry); + defaultRadius = view.getBuildingRadius(BuildingType::Quarry); ggs.setSelection(AddonId::STONEMASON_REACH_RADIUS, 1); - BOOST_TEST(view.GetBuildingRadius(BuildingType::Quarry) > defaultRadius); + BOOST_TEST(view.getBuildingRadius(BuildingType::Quarry) > defaultRadius); } BOOST_AUTO_TEST_CASE(SnapToNearestCopy) @@ -171,17 +171,17 @@ BOOST_FIXTURE_TEST_CASE(TestUpdateRadiusPreview, GameWorldViewFixture) const auto selPt = MapPoint(2, 3); auto getIcons = [](iwAction& wnd) { - auto i = wnd.GetCtrls(); // main tab - auto i2 = i.at(0)->GetCtrls(); // build tab group - auto i3 = i2.at(0)->GetCtrls(); // build tab - i3.at(0)->SetSelection(1); // Select medium size tab - auto i4 = i3.at(0)->GetCtrls(); // bld sizes - return i4.at(1)->GetCtrls(); // medium buildings + auto i = wnd.getCtrls(); // main tab + auto i2 = i.at(0)->getCtrls(); // build tab group + auto i3 = i2.at(0)->getCtrls(); // build tab + i3.at(0)->setSelection(1); // Select medium size tab + auto i4 = i3.at(0)->getCtrls(); // bld sizes + return i4.at(1)->getCtrls(); // medium buildings }; std::vector icons; const auto& findIcon = [&](BuildingType type) -> const ctrlBuildingIcon& { const auto it = - helpers::find_if(icons, [type](const ctrlBuildingIcon* icon) { return icon->GetType() == type; }); + helpers::find_if(icons, [type](const ctrlBuildingIcon* icon) { return icon->getType() == type; }); BOOST_TEST_REQUIRE((it != icons.end()), "Icon for " << type << " not found"); return ensureNonNull(*it); }; @@ -194,11 +194,11 @@ BOOST_FIXTURE_TEST_CASE(TestUpdateRadiusPreview, GameWorldViewFixture) icons = getIcons(action); const auto& findIcon = [&](BuildingType type) -> const ctrlBuildingIcon& { const auto it = - helpers::find_if(icons, [type](const ctrlBuildingIcon* icon) { return icon->GetType() == type; }); + helpers::find_if(icons, [type](const ctrlBuildingIcon* icon) { return icon->getType() == type; }); BOOST_TEST_REQUIRE((it != icons.end())); return ensureNonNull(*it); }; - BOOST_TEST(findIcon(BuildingType::Watchtower).GetTooltip().find(_("Range:")) == std::string::npos); + BOOST_TEST(findIcon(BuildingType::Watchtower).getTooltip().find(_("Range:")) == std::string::npos); } // Enable addon and re-open iwAction @@ -206,15 +206,15 @@ BOOST_FIXTURE_TEST_CASE(TestUpdateRadiusPreview, GameWorldViewFixture) auto& action = WINDOWMANAGER.Show( std::make_unique(gi, view, tabs, selPt, DrawPoint(0, 0), iwAction::FlagType::Normal, true)); icons = getIcons(action); - BOOST_TEST(findIcon(BuildingType::Watchtower).GetTooltip().find(_("Range:")) != std::string::npos); - BOOST_TEST(findIcon(BuildingType::Catapult).GetTooltip().find(_("Range:")) != std::string::npos); - BOOST_TEST(findIcon(BuildingType::Mill).GetTooltip().find(_("Range:")) == std::string::npos); + BOOST_TEST(findIcon(BuildingType::Watchtower).getTooltip().find(_("Range:")) != std::string::npos); + BOOST_TEST(findIcon(BuildingType::Catapult).getTooltip().find(_("Range:")) != std::string::npos); + BOOST_TEST(findIcon(BuildingType::Mill).getTooltip().find(_("Range:")) == std::string::npos); // Moving mouse over icons shows radius preview for(const auto bt : {BuildingType::Watchtower, BuildingType::Mill, BuildingType::Catapult}) { const auto& icon = findIcon(bt); - WINDOWMANAGER.msgMouseMove(MouseCoords(icon.GetDrawPos() + DrawPoint(1, 1))); + WINDOWMANAGER.msgMouseMove(MouseCoords(icon.getDrawPos() + DrawPoint(1, 1))); BOOST_TEST_REQUIRE(icon.getState() == Window::ButtonState::Hover); const auto& radius = view.getRadiusPreview(); // Mill has no radius, so preview is hidden @@ -223,17 +223,17 @@ BOOST_FIXTURE_TEST_CASE(TestUpdateRadiusPreview, GameWorldViewFixture) else { BOOST_TEST(radius.value().center == selPt); - BOOST_TEST(radius.value().radius == view.GetBuildingRadius(bt)); + BOOST_TEST(radius.value().radius == view.getBuildingRadius(bt)); } } // Moving mouse away from icons hides radius preview BOOST_TEST_REQUIRE(view.getRadiusPreview().has_value()); - WINDOWMANAGER.msgMouseMove(MouseCoords(action.GetDrawPos())); + WINDOWMANAGER.msgMouseMove(MouseCoords(action.getDrawPos())); BOOST_TEST(!view.getRadiusPreview()); // Closing the action window hides radius preview const auto& icon = findIcon(BuildingType::Watchtower); - WINDOWMANAGER.msgMouseMove(MouseCoords(icon.GetDrawPos() + DrawPoint(1, 1))); + WINDOWMANAGER.msgMouseMove(MouseCoords(icon.getDrawPos() + DrawPoint(1, 1))); BOOST_TEST_REQUIRE(view.getRadiusPreview().has_value()); WINDOWMANAGER.CloseNow(&action); BOOST_TEST(!view.getRadiusPreview()); diff --git a/tests/s25Main/integration/testCheatCommandTracker.cpp b/tests/s25Main/integration/testCheatCommandTracker.cpp index 7fa8e4fcf3..aaa2e41d7c 100644 --- a/tests/s25Main/integration/testCheatCommandTracker.cpp +++ b/tests/s25Main/integration/testCheatCommandTracker.cpp @@ -139,10 +139,10 @@ BOOST_FIXTURE_TEST_CASE(CheatCommands, CheatCommandTrackerFixture1P) BOOST_FIXTURE_TEST_CASE(CheatKeys, CheatCommandTrackerFixture4P) { using RRM = Cheats::ResourceRevealMode; - auto& p1 = world.GetPlayer(0); - auto& p2 = world.GetPlayer(1); - auto& p3 = world.GetPlayer(2); - auto& p4 = world.GetPlayer(3); + auto& p1 = world.getPlayer(0); + auto& p2 = world.getPlayer(1); + auto& p3 = world.getPlayer(2); + auto& p4 = world.getPlayer(3); p2.ps = p3.ps = p4.ps = PlayerState::AI; const KeyEvent evKeyVisible(KeyType::F7); diff --git a/tests/s25Main/integration/testCheats.cpp b/tests/s25Main/integration/testCheats.cpp index 2823906183..bd3e4b3d12 100644 --- a/tests/s25Main/integration/testCheats.cpp +++ b/tests/s25Main/integration/testCheats.cpp @@ -38,26 +38,26 @@ struct CheatsFixture : WorldFixture(p1HQPos.x + HQ_RADIUS + 2), p1HQPos.y}; auto countHQs(const GamePlayer& player) { - return player.GetBuildingRegister().GetBuildingNums().buildings[BuildingType::Headquarters]; + return player.getBuildingRegister().getBuildingNums().buildings[BuildingType::Headquarters]; } auto getHQs(const GamePlayer& player) { std::vector ret; - for(auto* bld : player.GetBuildingRegister().GetStorehouses()) + for(auto* bld : player.getBuildingRegister().getStorehouses()) { - if(bld->GetBuildingType() == BuildingType::Headquarters) + if(bld->getBuildingType() == BuildingType::Headquarters) ret.push_back(static_cast(bld)); } return ret; @@ -66,7 +66,7 @@ struct CheatsFixture : WorldFixturecheats)); MOCK_EXPECT(mgi.GI_UpdateMapVisibility).exactly(3); // how many toggles should actually occur - world.SetGameInterface(&mgi); + world.setGameInterface(&mgi); MapPoint farawayPos = p1HQPos; farawayPos.x += 20; @@ -123,21 +123,21 @@ BOOST_FIXTURE_TEST_CASE(CanToggleAllVisible_IfCheatModeIsOn, CheatsFixture) const auto& viewer = getViewer(); // initially farawayPos is not visible - BOOST_TEST_REQUIRE((viewer.GetVisibility(farawayPos) == Visibility::Visible) == false); + BOOST_TEST_REQUIRE((viewer.getVisibility(farawayPos) == Visibility::Visible) == false); cheats.toggleAllVisible(); // still not visible - cheat mode is not on - BOOST_TEST_REQUIRE((viewer.GetVisibility(farawayPos) == Visibility::Visible) == false); + BOOST_TEST_REQUIRE((viewer.getVisibility(farawayPos) == Visibility::Visible) == false); cheats.toggleCheatMode(); cheats.toggleAllVisible(); // now visible - cheat mode is on - BOOST_TEST_REQUIRE((viewer.GetVisibility(farawayPos) == Visibility::Visible) == true); + BOOST_TEST_REQUIRE((viewer.getVisibility(farawayPos) == Visibility::Visible) == true); cheats.toggleAllVisible(); - BOOST_TEST_REQUIRE((viewer.GetVisibility(farawayPos) == Visibility::Visible) == false); + BOOST_TEST_REQUIRE((viewer.getVisibility(farawayPos) == Visibility::Visible) == false); cheats.toggleAllVisible(); - BOOST_TEST_REQUIRE((viewer.GetVisibility(farawayPos) == Visibility::Visible) == true); + BOOST_TEST_REQUIRE((viewer.getVisibility(farawayPos) == Visibility::Visible) == true); } BOOST_FIXTURE_TEST_CASE(CanToggleAllBuildingsEnabled_AndShowEnemyProductivityOverlay_IfCheatModeIsOn, CheatsFixture) @@ -174,20 +174,20 @@ BOOST_FIXTURE_TEST_CASE(AllBuildingsAreEnabled_WhenCheatModeIsOn, CheatsFixture) { MockGameInterface mgi; MOCK_EXPECT(mgi.GI_GetCheats).returns(std::ref(this->cheats)); - world.SetGameInterface(&mgi); + world.setGameInterface(&mgi); cheats.toggleCheatMode(); - GamePlayer& p1 = world.GetPlayer(0); + GamePlayer& p1 = world.getPlayer(0); const auto bld = BuildingType::Brewery; p1.DisableBuilding(bld); - BOOST_TEST_REQUIRE(p1.IsBuildingEnabled(bld) == false); + BOOST_TEST_REQUIRE(p1.isBuildingEnabled(bld) == false); cheats.toggleAllBuildingsEnabled(); - BOOST_TEST_REQUIRE(p1.IsBuildingEnabled(bld) == true); + BOOST_TEST_REQUIRE(p1.isBuildingEnabled(bld) == true); cheats.toggleAllBuildingsEnabled(); - BOOST_TEST_REQUIRE(p1.IsBuildingEnabled(bld) == false); + BOOST_TEST_REQUIRE(p1.isBuildingEnabled(bld) == false); cheats.toggleAllBuildingsEnabled(); - BOOST_TEST_REQUIRE(p1.IsBuildingEnabled(bld) == true); + BOOST_TEST_REQUIRE(p1.isBuildingEnabled(bld) == true); cheats.toggleCheatMode(); - BOOST_TEST_REQUIRE(p1.IsBuildingEnabled(bld) == false); + BOOST_TEST_REQUIRE(p1.isBuildingEnabled(bld) == false); } BOOST_FIXTURE_TEST_CASE(CannotPlaceCheatBuildingWithinOwnedTerritory, CheatsFixture) @@ -263,25 +263,25 @@ BOOST_FIXTURE_TEST_CASE(CheatBuildingHasTheSameNation, CheatsFixture) cheats.toggleCheatMode(); cheats.placeCheatBuilding(unownedPt, p1); for(auto* bld : getHQs(p1)) - BOOST_TEST_REQUIRE((bld->GetNation() == p1.nation) == true); + BOOST_TEST_REQUIRE((bld->getNation() == p1.nation) == true); } BOOST_FIXTURE_TEST_CASE(CheatBuildingIsATent_IfPrimaryHQIsATent, CheatsFixture) { - p1.SetHQIsTent(true); + p1.setHQIsTent(true); cheats.toggleCheatMode(); cheats.placeCheatBuilding(unownedPt, p1); for(auto* bld : getHQs(p1)) - BOOST_TEST_REQUIRE(static_cast(bld)->IsTent() == true); + BOOST_TEST_REQUIRE(static_cast(bld)->isTent() == true); } BOOST_FIXTURE_TEST_CASE(CheatBuildingIsNotATent_IfPrimaryHQIsNotATent, CheatsFixture) { - p1.SetHQIsTent(false); + p1.setHQIsTent(false); cheats.toggleCheatMode(); cheats.placeCheatBuilding(unownedPt, p1); for(auto* bld : getHQs(p1)) - BOOST_TEST_REQUIRE(static_cast(bld)->IsTent() == false); + BOOST_TEST_REQUIRE(static_cast(bld)->isTent() == false); } BOOST_FIXTURE_TEST_CASE(CanToggleResourcesToRevealSuccessively, CheatsFixture) diff --git a/tests/s25Main/integration/testDisappearingMapObjects.cpp b/tests/s25Main/integration/testDisappearingMapObjects.cpp index f22de0c0e7..281c8f6aca 100644 --- a/tests/s25Main/integration/testDisappearingMapObjects.cpp +++ b/tests/s25Main/integration/testDisappearingMapObjects.cpp @@ -36,15 +36,15 @@ struct DummyWorker : GameObject void HandleEvent(unsigned) override { - nodeWasEmptyWhenReplaced = (world.GetNode(pos).obj == nullptr); + nodeWasEmptyWhenReplaced = (world.getNode(pos).obj == nullptr); world.DestroyNO(pos, false); - world.SetNO(pos, new noStaticObject(pos, staticObjId)); + world.setNO(pos, new noStaticObject(pos, staticObjId)); } // LCOV_EXCL_START void Destroy() override {} void Serialize(SerializedGameData&) const override {} - GO_Type GetGOT() const final { return GO_Type::NofGeologist; } + GO_Type getGOT() const final { return GO_Type::NofGeologist; } // LCOV_EXCL_STOP }; @@ -52,8 +52,8 @@ struct Fixture : WorldFixture { const MapPoint testPos; /// Position not blocked by HQ for use const unsigned startNumObjs; - Fixture() : testPos(world.GetPlayer(0).GetHQPos() + MapPoint(4, 4)), startNumObjs(GameObject::GetNumObjs()) {} - unsigned getNumObjs() const { return GameObject::GetNumObjs() - startNumObjs; } + Fixture() : testPos(world.getPlayer(0).getHQPos() + MapPoint(4, 4)), startNumObjs(GameObject::getNumObjs()) {} + unsigned getNumObjs() const { return GameObject::getNumObjs() - startNumObjs; } }; template @@ -78,29 +78,29 @@ using DisappearingEnvObjs = boost::mpl::list(testPos); - world.SetNO(testPos, &obj); + world.setNO(testPos, &obj); const MapPoint testPos2 = testPos + MapPoint(1, 0); noBase& obj2 = *makeEnvObject(testPos2); - world.SetNO(testPos2, &obj2); + world.setNO(testPos2, &obj2); BOOST_TEST(getNumObjs() == 2u); // Should have an event scheduled for removal of the obj - BOOST_TEST_REQUIRE(em.GetObjEvents(obj).size() == 1u); + BOOST_TEST_REQUIRE(em.getObjEvents(obj).size() == 1u); if constexpr(!std::is_same_v) { // Except for fire, which burns until it gets removed, // objects start fading after some time and only then get removed, so trigger the first event. - em.RescheduleEvent(em.GetObjEvents(obj).at(0), em.GetCurrentGF() + 1); - em.RescheduleEvent(em.GetObjEvents(obj2).at(0), em.GetCurrentGF() + 1); + em.RescheduleEvent(em.getObjEvents(obj).at(0), em.getCurrentGF() + 1); + em.RescheduleEvent(em.getObjEvents(obj2).at(0), em.getCurrentGF() + 1); em.ExecuteNextGF(); } DummyWorker worker(world, testPos); DummyWorker worker2(world, testPos2); // Add worker event before and after object event, but both in the same GF em.AddEvent(&worker, 1); - em.RescheduleEvent(em.GetObjEvents(obj).at(0), em.GetCurrentGF() + 1); - em.RescheduleEvent(em.GetObjEvents(obj2).at(0), em.GetCurrentGF() + 1); + em.RescheduleEvent(em.getObjEvents(obj).at(0), em.getCurrentGF() + 1); + em.RescheduleEvent(em.getObjEvents(obj2).at(0), em.getCurrentGF() + 1); em.AddEvent(&worker2, 1); BOOST_TEST(getNumObjs() == 4u); @@ -113,8 +113,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(RemoveEnvObjectFromNodeBeforeKill, T, Disappearing // Object moved itself to kill list BOOST_TEST(worker2.nodeWasEmptyWhenReplaced); // Objects placed by "workers" are present on the map - BOOST_TEST(ensureNonNull(world.GetSpecObj(testPos)).GetItemID() == DummyWorker::staticObjId); - BOOST_TEST(ensureNonNull(world.GetSpecObj(testPos2)).GetItemID() == DummyWorker::staticObjId); + BOOST_TEST(ensureNonNull(world.getSpecObj(testPos)).getItemID() == DummyWorker::staticObjId); + BOOST_TEST(ensureNonNull(world.getSpecObj(testPos2)).getItemID() == DummyWorker::staticObjId); } // noShipBuildingSite has no timed death event; its removal happens synchronously in MakeBuildStep. @@ -124,39 +124,39 @@ BOOST_AUTO_TEST_CASE(ShipBuildingSiteDestroyDoesNotClobberNode) { // Similar for ship building sites: Replacing it by a new object must not hurt that new obj auto* site = new noShipBuildingSite(testPos, 0); - world.SetNO(testPos, site); + world.setNO(testPos, site); auto* staticObj = new noStaticObject(testPos, DummyWorker::staticObjId); BOOST_TEST(getNumObjs() == 2u); world.DestroyNO(testPos); - world.SetNO(testPos, staticObj); + world.setNO(testPos, staticObj); BOOST_TEST(getNumObjs() == 1u); // Catch possible double-free - BOOST_TEST(ensureNonNull(world.GetSpecObj(testPos)).GetItemID() == DummyWorker::staticObjId); + BOOST_TEST(ensureNonNull(world.getSpecObj(testPos)).getItemID() == DummyWorker::staticObjId); world.DestroyNO(testPos); // Fully build ship, then build new object there // Fake a nearby sea - world.GetNodeWriteable(world.GetNeighbour(testPos, Direction::SouthWest)).seaId = SeaId(1); + world.getNodeWriteable(world.getNeighbour(testPos, Direction::SouthWest)).seaId = SeaId(1); site = new noShipBuildingSite(testPos, 0); - world.SetNO(testPos, site); + world.setNO(testPos, site); BOOST_TEST(getNumObjs() == 1u); do { site->MakeBuildStep(); - } while(world.GetNO(testPos)->GetGOT() == GO_Type::Shipbuildingsite); + } while(world.getNO(testPos)->getGOT() == GO_Type::Shipbuildingsite); // Replaced by ship - BOOST_TEST(world.GetPlayer(0).GetNumShips() == 1u); + BOOST_TEST(world.getPlayer(0).getNumShips() == 1u); // Building site will be replaced at end of GF BOOST_TEST(getNumObjs() == 2u); - BOOST_TEST(em.IsObjectInKillList(*site)); + BOOST_TEST(em.isObjectInKillList(*site)); // Now place new object at the free spot staticObj = new noStaticObject(testPos, DummyWorker::staticObjId); BOOST_TEST(getNumObjs() == 3u); - world.SetNO(testPos, staticObj); + world.setNO(testPos, staticObj); // Should only destroy the building site em.ExecuteNextGF(); BOOST_TEST(getNumObjs() == 2u); - BOOST_TEST(ensureNonNull(world.GetSpecObj(testPos)).GetItemID() == DummyWorker::staticObjId); + BOOST_TEST(ensureNonNull(world.getSpecObj(testPos)).getItemID() == DummyWorker::staticObjId); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/integration/testDskGameInterface.cpp b/tests/s25Main/integration/testDskGameInterface.cpp index 1d2b42b71b..2a698c4dde 100644 --- a/tests/s25Main/integration/testDskGameInterface.cpp +++ b/tests/s25Main/integration/testDskGameInterface.cpp @@ -52,20 +52,20 @@ struct GameInterfaceFixture : uiHelper::Fixture gameDesktop = static_cast( WINDOWMANAGER.Switch(std::make_unique(worldFixture.game))); WINDOWMANAGER.Draw(); - view = &gameDesktop->GetView(); + view = &gameDesktop->getView(); } }; void checkNotScrolling(const GameWorldView& view, Cursor cursor = Cursor::Hand) { - const DrawPoint pos = view.GetOffset(); + const DrawPoint pos = view.getOffset(); MouseCoords mouse(Position(40, 11)); WINDOWMANAGER.msgMouseMove(mouse); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == cursor); - BOOST_TEST_REQUIRE(view.GetOffset() == pos); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == cursor); + BOOST_TEST_REQUIRE(view.getOffset() == pos); mouse.pos += Position(-20, 30); WINDOWMANAGER.msgMouseMove(mouse); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == cursor); - BOOST_TEST_REQUIRE(view.GetOffset() == pos); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == cursor); + BOOST_TEST_REQUIRE(view.getOffset() == pos); } } // namespace @@ -81,22 +81,22 @@ BOOST_FIXTURE_TEST_CASE(Scrolling, GameInterfaceFixture) // Regular scrolling: Right down, 2 moves, right up { WINDOWMANAGER.msgRightDown(mouse); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); - DrawPoint pos = view->GetOffset(); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); + DrawPoint pos = view->getOffset(); mouse.pos = startPos + Position(4, 3); WINDOWMANAGER.msgMouseMove(mouse); pos += acceleration * Position(4, 3); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); - BOOST_TEST_REQUIRE(view->GetOffset() == pos); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); + BOOST_TEST_REQUIRE(view->getOffset() == pos); mouse.pos = startPos + Position(-6, 7); WINDOWMANAGER.msgMouseMove(mouse); pos += acceleration * Position(-6, 7); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); - BOOST_TEST_REQUIRE(view->GetOffset() == pos); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); + BOOST_TEST_REQUIRE(view->getOffset() == pos); mouse.rdown = false; WINDOWMANAGER.msgRightUp(mouse); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Hand); - BOOST_TEST_REQUIRE(view->GetOffset() == pos); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Hand); + BOOST_TEST_REQUIRE(view->getOffset() == pos); checkNotScrolling(*view); } @@ -104,12 +104,12 @@ BOOST_FIXTURE_TEST_CASE(Scrolling, GameInterfaceFixture) SETTINGS.interface.mapScrollMode = MapScrollMode::ScrollSame; WINDOWMANAGER.msgRightDown(mouse); startPos = mouse.pos; - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); - const DrawPoint pos = view->GetOffset(); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); + const DrawPoint pos = view->getOffset(); mouse.pos = startPos + Position(4, 3); WINDOWMANAGER.msgMouseMove(mouse); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); - BOOST_TEST_REQUIRE(view->GetOffset() == pos - acceleration * Position(4, 3)); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); + BOOST_TEST_REQUIRE(view->getOffset() == pos - acceleration * Position(4, 3)); mouse.rdown = false; WINDOWMANAGER.msgRightUp(mouse); SETTINGS.interface.mapScrollMode = MapScrollMode::ScrollOpposite; @@ -119,12 +119,12 @@ BOOST_FIXTURE_TEST_CASE(Scrolling, GameInterfaceFixture) SETTINGS.interface.mapScrollMode = MapScrollMode::GrabAndDrag; WINDOWMANAGER.msgRightDown(mouse); startPos = mouse.pos; - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); - const DrawPoint pos = view->GetOffset(); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); + const DrawPoint pos = view->getOffset(); mouse.pos = startPos + Position(4, 3); WINDOWMANAGER.msgMouseMove(mouse); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); - BOOST_TEST_REQUIRE(view->GetOffset() == pos - Position(4, 3)); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); + BOOST_TEST_REQUIRE(view->getOffset() == pos - Position(4, 3)); mouse.rdown = false; WINDOWMANAGER.msgRightUp(mouse); SETTINGS.interface.mapScrollMode = MapScrollMode::ScrollOpposite; @@ -135,37 +135,37 @@ BOOST_FIXTURE_TEST_CASE(Scrolling, GameInterfaceFixture) mouse.rdown = true; WINDOWMANAGER.msgRightDown(mouse); startPos = mouse.pos; - DrawPoint pos = view->GetOffset(); + DrawPoint pos = view->getOffset(); KeyEvent key; key.kt = KeyType::Char; key.c = 'm'; key.ctrl = key.alt = key.shift = false; WINDOWMANAGER.msgKeyDown(key); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow()); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow()); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); mouse.pos = startPos + Position(-6, 7); WINDOWMANAGER.msgMouseMove(mouse); pos += acceleration * Position(-6, 7); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); - BOOST_TEST_REQUIRE(view->GetOffset() == pos); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); + BOOST_TEST_REQUIRE(view->getOffset() == pos); // Closing it doesn't either WINDOWMANAGER.msgKeyDown(key); WINDOWMANAGER.Draw(); BOOST_TEST_REQUIRE(gameDesktop->IsActive()); - BOOST_TEST_REQUIRE(!WINDOWMANAGER.GetTopMostWindow()); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); + BOOST_TEST_REQUIRE(!WINDOWMANAGER.getTopMostWindow()); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); mouse.pos = startPos + Position(-6, 7); WINDOWMANAGER.msgMouseMove(mouse); pos += acceleration * Position(-6, 7); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); - BOOST_TEST_REQUIRE(view->GetOffset() == pos); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); + BOOST_TEST_REQUIRE(view->getOffset() == pos); // Left click does cancel it mouse.ldown = true; WINDOWMANAGER.msgLeftDown(mouse); mouse.ldown = false; WINDOWMANAGER.msgLeftUp(mouse); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Hand); - BOOST_TEST_REQUIRE(view->GetOffset() == pos); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Hand); + BOOST_TEST_REQUIRE(view->getOffset() == pos); checkNotScrolling(*view); } } @@ -173,43 +173,43 @@ BOOST_FIXTURE_TEST_CASE(Scrolling, GameInterfaceFixture) BOOST_FIXTURE_TEST_CASE(ScrollingWhileRoadBuilding, GameInterfaceFixture) { const int acceleration = 2; - MapPoint hqPos = worldFixture.world.GetPlayer(0).GetFirstWH()->GetFlagPos(); //-V522 + MapPoint hqPos = worldFixture.world.getPlayer(0).getFirstWH()->getFlagPos(); //-V522 gameDesktop->GI_StartRoadBuilding(hqPos, false); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Remove); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Remove); Position startPos(10, 15); MouseCoords mouse(startPos); mouse.rdown = true; // Regular scrolling WINDOWMANAGER.msgRightDown(mouse); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); - DrawPoint pos = view->GetOffset(); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); + DrawPoint pos = view->getOffset(); mouse.pos = startPos + Position(4, 3); WINDOWMANAGER.msgMouseMove(mouse); pos += acceleration * Position(4, 3); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); - BOOST_TEST_REQUIRE(view->GetOffset() == pos); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); + BOOST_TEST_REQUIRE(view->getOffset() == pos); mouse.rdown = false; WINDOWMANAGER.msgRightUp(mouse); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Remove); - BOOST_TEST_REQUIRE(view->GetOffset() == pos); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Remove); + BOOST_TEST_REQUIRE(view->getOffset() == pos); checkNotScrolling(*view, Cursor::Remove); // left click also stops scrolling mouse.rdown = true; WINDOWMANAGER.msgRightDown(mouse); startPos = mouse.pos; - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); mouse.pos = startPos + Position(-6, 7); WINDOWMANAGER.msgMouseMove(mouse); pos += acceleration * Position(-6, 7); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); - BOOST_TEST_REQUIRE(view->GetOffset() == pos); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); + BOOST_TEST_REQUIRE(view->getOffset() == pos); mouse.ldown = true; WINDOWMANAGER.msgLeftDown(mouse); mouse.ldown = false; WINDOWMANAGER.msgLeftUp(mouse); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Remove); - BOOST_TEST_REQUIRE(view->GetOffset() == pos); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Remove); + BOOST_TEST_REQUIRE(view->getOffset() == pos); checkNotScrolling(*view, Cursor::Remove); } @@ -219,19 +219,19 @@ BOOST_FIXTURE_TEST_CASE(ScrollingWithCtrl, GameInterfaceFixture) Position startPos(10, 15); MouseCoords mouse(startPos); mouse.ldown = true; - uiHelper::GetVideoDriver()->modKeyState_.ctrl = true; + uiHelper::getVideoDriver()->modKeyState_.ctrl = true; WINDOWMANAGER.msgLeftDown(mouse); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); - DrawPoint pos = view->GetOffset(); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); + DrawPoint pos = view->getOffset(); mouse.pos = startPos + Position(4, 3); WINDOWMANAGER.msgMouseMove(mouse); pos += acceleration * Position(4, 3); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Scroll); - BOOST_TEST_REQUIRE(view->GetOffset() == pos); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); + BOOST_TEST_REQUIRE(view->getOffset() == pos); mouse.ldown = false; WINDOWMANAGER.msgLeftUp(mouse); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetCursor() == Cursor::Hand); - BOOST_TEST_REQUIRE(view->GetOffset() == pos); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Hand); + BOOST_TEST_REQUIRE(view->getOffset() == pos); checkNotScrolling(*view); } @@ -239,11 +239,11 @@ BOOST_FIXTURE_TEST_CASE(IwActionClose, GameInterfaceFixture) { gameDesktop->ShowActionWindow(iwAction::Tabs{}, MapPoint(0, 1), DrawPoint(42, 37), false); WINDOWMANAGER.Draw(); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow()); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == gameDesktop->actionwindow); - WINDOWMANAGER.GetTopMostWindow()->Close(); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow()); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == gameDesktop->actionwindow); + WINDOWMANAGER.getTopMostWindow()->Close(); WINDOWMANAGER.Draw(); - BOOST_TEST_REQUIRE(WINDOWMANAGER.GetTopMostWindow() == nullptr); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == nullptr); BOOST_TEST_REQUIRE(gameDesktop->actionwindow == nullptr); } @@ -254,62 +254,62 @@ BOOST_FIXTURE_TEST_CASE(Zooming, GameInterfaceFixture) KeyEvent zoomDefaultEv('z'); zoomDefaultEv.ctrl = true; - BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); + BOOST_TEST(view->getCurrentTargetZoomFactor() == ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); for(size_t i = ZOOM_DEFAULT_INDEX + 1; i < ZOOM_FACTORS.size(); i++) { gameDesktop->msgKeyDown(zoomInEv); - BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[i]); + BOOST_TEST(view->getCurrentTargetZoomFactor() == ZOOM_FACTORS[i]); } // Wrap around gameDesktop->msgKeyDown(zoomInEv); - BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[0]); + BOOST_TEST(view->getCurrentTargetZoomFactor() == ZOOM_FACTORS[0]); gameDesktop->msgKeyDown(zoomInEv); - BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[1]); + BOOST_TEST(view->getCurrentTargetZoomFactor() == ZOOM_FACTORS[1]); gameDesktop->msgKeyDown(zoomOutEv); - BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[0]); + BOOST_TEST(view->getCurrentTargetZoomFactor() == ZOOM_FACTORS[0]); gameDesktop->msgKeyDown(zoomOutEv); - BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS.back()); + BOOST_TEST(view->getCurrentTargetZoomFactor() == ZOOM_FACTORS.back()); gameDesktop->msgKeyDown(zoomDefaultEv); - BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); + BOOST_TEST(view->getCurrentTargetZoomFactor() == ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); gameDesktop->msgWheelDown({}); - auto curZoom = view->GetCurrentTargetZoomFactor(); + auto curZoom = view->getCurrentTargetZoomFactor(); BOOST_TEST(curZoom < ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); BOOST_TEST(curZoom > ZOOM_FACTORS[ZOOM_DEFAULT_INDEX - 1]); // Go to prev index gameDesktop->msgKeyDown(zoomOutEv); - BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[ZOOM_DEFAULT_INDEX - 1]); + BOOST_TEST(view->getCurrentTargetZoomFactor() == ZOOM_FACTORS[ZOOM_DEFAULT_INDEX - 1]); gameDesktop->msgKeyDown(zoomDefaultEv); gameDesktop->msgWheelUp({}); - curZoom = view->GetCurrentTargetZoomFactor(); + curZoom = view->getCurrentTargetZoomFactor(); BOOST_TEST(curZoom > ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); BOOST_TEST(curZoom < ZOOM_FACTORS[ZOOM_DEFAULT_INDEX + 1]); // Go to next index gameDesktop->msgKeyDown(zoomInEv); - BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[ZOOM_DEFAULT_INDEX + 1]); + BOOST_TEST(view->getCurrentTargetZoomFactor() == ZOOM_FACTORS[ZOOM_DEFAULT_INDEX + 1]); gameDesktop->msgWheelDown({}); - curZoom = view->GetCurrentTargetZoomFactor(); + curZoom = view->getCurrentTargetZoomFactor(); BOOST_TEST(curZoom > ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); BOOST_TEST(curZoom < ZOOM_FACTORS[ZOOM_DEFAULT_INDEX + 1]); // Go to prev index gameDesktop->msgKeyDown(zoomOutEv); - BOOST_TEST(view->GetCurrentTargetZoomFactor() == ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); + BOOST_TEST(view->getCurrentTargetZoomFactor() == ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); // Zoom in and out gets to 1.0 (default) static_assert(ZOOM_FACTORS[ZOOM_DEFAULT_INDEX] == 1.f); gameDesktop->msgWheelUp({}); gameDesktop->msgWheelDown({}); - BOOST_TEST(view->GetCurrentTargetZoomFactor() == 1.f); + BOOST_TEST(view->getCurrentTargetZoomFactor() == 1.f); const auto numZoom = rttr::test::randomValue(2, 10); for(int i = 0; i < numZoom; i++) gameDesktop->msgWheelDown({}); for(int i = 0; i < numZoom; i++) gameDesktop->msgWheelUp({}); - BOOST_TEST(view->GetCurrentTargetZoomFactor() == 1.f); + BOOST_TEST(view->getCurrentTargetZoomFactor() == 1.f); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/integration/testEconomyMode.cpp b/tests/s25Main/integration/testEconomyMode.cpp index 14d1cf5414..699ad6d226 100644 --- a/tests/s25Main/integration/testEconomyMode.cpp +++ b/tests/s25Main/integration/testEconomyMode.cpp @@ -30,13 +30,13 @@ class EconModeFixture : WorldFixture public: EconModeFixture() { - world.GetPlayer(0).team = Team::Team2; - world.GetPlayer(1).team = Team::Team1; - world.GetPlayer(2).team = Team::Team2; + world.getPlayer(0).team = Team::Team2; + world.getPlayer(1).team = Team::Team1; + world.getPlayer(2).team = Team::Team2; for(unsigned playerIdx = 0; playerIdx < 3; ++playerIdx) { - world.GetPlayer(playerIdx).MakeStartPacts(); - hqPos[playerIdx] = world.GetPlayer(playerIdx).GetHQPos(); + world.getPlayer(playerIdx).MakeStartPacts(); + hqPos[playerIdx] = world.getPlayer(playerIdx).getHQPos(); } this->ggs.objective = GameObjective::EconomyMode; } @@ -56,35 +56,35 @@ BOOST_FIXTURE_TEST_CASE(EconomyMode3Players, EconModeFixture) constexpr auto amountsToAdd = helpers::make_array(63, 100, 85); EconomyModeHandler econHandler(4); - const auto& goodsToCollect = econHandler.GetGoodTypesToCollect(); + const auto& goodsToCollect = econHandler.getGoodTypesToCollect(); BOOST_TEST_REQUIRE(!goodsToCollect.empty()); - BOOST_TEST(econHandler.GetEndFrame() == 4u); + BOOST_TEST(econHandler.getEndFrame() == 4u); BOOST_TEST(!econHandler.isOver()); BOOST_TEST(!econHandler.isInfinite()); - BOOST_TEST(world.GetEvMgr().ObjectHasEvents(econHandler)); - world.GetEvMgr().ExecuteNextGF(); + BOOST_TEST(world.getEvMgr().ObjectHasEvents(econHandler)); + world.getEvMgr().ExecuteNextGF(); econHandler.UpdateAmounts(); // Individual amount counting - unsigned initialAmount = econHandler.GetAmount(0, 0); - BOOST_TEST_REQUIRE(initialAmount == econHandler.GetAmount(0, 1)); - BOOST_TEST_REQUIRE(initialAmount == econHandler.GetAmount(0, 2)); + unsigned initialAmount = econHandler.getAmount(0, 0); + BOOST_TEST_REQUIRE(initialAmount == econHandler.getAmount(0, 1)); + BOOST_TEST_REQUIRE(initialAmount == econHandler.getAmount(0, 2)); for(unsigned playerIdx = 0; playerIdx < 3; ++playerIdx) { - world.GetSpecObj(hqPos[playerIdx]) + world.getSpecObj(hqPos[playerIdx]) ->AddToInventory(GoodCounts::make(goodsToCollect[0], amountsToAdd[playerIdx]), true); } - world.GetEvMgr().ExecuteNextGF(); + world.getEvMgr().ExecuteNextGF(); econHandler.UpdateAmounts(); for(unsigned playerIdx = 0; playerIdx < 3; ++playerIdx) { - BOOST_TEST_REQUIRE(econHandler.GetAmount(0, playerIdx) == initialAmount + amountsToAdd[playerIdx]); + BOOST_TEST_REQUIRE(econHandler.getAmount(0, playerIdx) == initialAmount + amountsToAdd[playerIdx]); } // Teams behaviour - const auto& econTeams = econHandler.GetTeams(); + const auto& econTeams = econHandler.getTeams(); // People get assigned to the correct teams? BOOST_TEST_REQUIRE(econTeams.size() == 2u); @@ -100,7 +100,7 @@ BOOST_FIXTURE_TEST_CASE(EconomyMode3Players, EconModeFixture) BOOST_TEST(econTeams[smallTeam].amountsTheTeamCollected[0] == initialAmount + amountsToAdd[1]); BOOST_TEST(econTeams[bigTeam].amountsTheTeamCollected[0] == 2 * initialAmount + amountsToAdd[0] + amountsToAdd[2]); BOOST_TEST(econTeams[smallTeam].goodTypeWins < econTeams[bigTeam].goodTypeWins); - BOOST_TEST(econHandler.GetMaxTeamAmount(0) == econTeams[bigTeam].amountsTheTeamCollected[0]); + BOOST_TEST(econHandler.getMaxTeamAmount(0) == econTeams[bigTeam].amountsTheTeamCollected[0]); } BOOST_FIXTURE_TEST_CASE(EconomyModeSerialization, EconModeFixture) @@ -108,40 +108,40 @@ BOOST_FIXTURE_TEST_CASE(EconomyModeSerialization, EconModeFixture) ggs.setSelection(AddonId::ECONOMY_MODE_GAME_LENGTH, rttr::test::randomValue(1, AddonEconomyModeGameLengthList.size() - 1)); game->Start(false); - const auto& goodsToCollect = world.getEconHandler()->GetGoodTypesToCollect(); + const auto& goodsToCollect = world.getEconHandler()->getGoodTypesToCollect(); for(unsigned playerIdx = 0; playerIdx < 3; ++playerIdx) { - world.GetSpecObj(hqPos[playerIdx]) + world.getSpecObj(hqPos[playerIdx]) ->AddToInventory(GoodCounts::make(goodsToCollect[0], rttr::test::randomValue(1u, 50u)), true); } - world.GetEvMgr().ExecuteNextGF(); + world.getEvMgr().ExecuteNextGF(); world.getEconHandler()->UpdateAmounts(); Savegame save; for(const auto& player : world.getPlayers()) save.AddPlayer(player); save.ggs = ggs; - save.start_gf = game->em_->GetCurrentGF(); + save.start_gf = game->em_->getCurrentGF(); save.sgd.MakeSnapshot(*game); TmpFile tmpFile; BOOST_TEST_REQUIRE(save.Save(tmpFile.filePath, "MapTitle")); Savegame loadSave; BOOST_TEST_REQUIRE(loadSave.Load(tmpFile.filePath, SaveGameDataToLoad::All)); - BOOST_TEST_REQUIRE(loadSave.GetNumPlayers() == 3u); + BOOST_TEST_REQUIRE(loadSave.getNumPlayers() == 3u); std::vector players; for(unsigned j = 0; j < 3; j++) - players.push_back(PlayerInfo(loadSave.GetPlayer(j))); + players.push_back(PlayerInfo(loadSave.getPlayer(j))); Game newGame(save.ggs, loadSave.start_gf, players); GameWorld& newWorld = newGame.world_; MockLocalGameState localGameState; save.sgd.ReadSnapshot(newGame, localGameState); BOOST_TEST_REQUIRE(newWorld.getEconHandler()); - BOOST_TEST(newWorld.getEconHandler()->GetEndFrame() == world.getEconHandler()->GetEndFrame()); - const auto& goodsToCollectAfter = newWorld.getEconHandler()->GetGoodTypesToCollect(); + BOOST_TEST(newWorld.getEconHandler()->getEndFrame() == world.getEconHandler()->getEndFrame()); + const auto& goodsToCollectAfter = newWorld.getEconHandler()->getGoodTypesToCollect(); BOOST_TEST(goodsToCollect == goodsToCollectAfter); - const auto& econTeams = world.getEconHandler()->GetTeams(); - const auto& econTeamsAfter = newWorld.getEconHandler()->GetTeams(); + const auto& econTeams = world.getEconHandler()->getTeams(); + const auto& econTeamsAfter = newWorld.getEconHandler()->getTeams(); BOOST_TEST_REQUIRE(econTeams.size() == econTeamsAfter.size()); newWorld.getEconHandler()->UpdateAmounts(); for(const auto& teamPair : boost::combine(econTeams, econTeamsAfter)) @@ -152,7 +152,7 @@ BOOST_FIXTURE_TEST_CASE(EconomyModeSerialization, EconModeFixture) BOOST_TEST_REQUIRE(before.amountsTheTeamCollected == after.amountsTheTeamCollected); BOOST_TEST_REQUIRE(before.goodTypeWins == after.goodTypeWins); } - BOOST_TEST(newWorld.GetEvMgr().ObjectHasEvents(*newWorld.getEconHandler())); + BOOST_TEST(newWorld.getEvMgr().ObjectHasEvents(*newWorld.getEconHandler())); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/integration/testEmergencyProtocol.cpp b/tests/s25Main/integration/testEmergencyProtocol.cpp index 162726be7e..a0a1d95233 100644 --- a/tests/s25Main/integration/testEmergencyProtocol.cpp +++ b/tests/s25Main/integration/testEmergencyProtocol.cpp @@ -11,7 +11,7 @@ /// Start with low wares and build 2 farms to trigger emergency protocol activation struct EmergencyFixture : public WorldWithGCExecution1P { - nobHQ* hq = world.GetPlayer(0).GetHQ(); + nobHQ* hq = world.getPlayer(0).getHQ(); EmergencyFixture() { hq->AddToInventory(hq->getStartInventory(StartWares::VLow), true); @@ -26,13 +26,13 @@ struct EmergencyFixture : public WorldWithGCExecution1P BuildRoadForBlds(pos, hqPos); // wait until emergency protocol should be activated - RTTR_EXEC_TILL(500, hq->GetInventory()[GoodType::Boards] == 10); + RTTR_EXEC_TILL(500, hq->getInventory()[GoodType::Boards] == 10); - BOOST_TEST_REQUIRE(world.GetPlayer(0).hasEmergency()); + BOOST_TEST_REQUIRE(world.getPlayer(0).hasEmergency()); // No more boards are carried out to the farms due to emergency protocol RTTR_SKIP_GFS(200); - BOOST_TEST(hq->GetInventory()[GoodType::Boards] == 10); + BOOST_TEST(hq->getInventory()[GoodType::Boards] == 10); initGameRNG(); } @@ -50,11 +50,11 @@ BOOST_AUTO_TEST_CASE(CanBuildWoodcutterAndSawmill) BuildRoadForBlds(posSawmill, hqPos); // check if inventory boards are given out - RTTR_EXEC_TILL(200, hq->GetInventory()[GoodType::Boards] < 10); + RTTR_EXEC_TILL(200, hq->getInventory()[GoodType::Boards] < 10); // check that buildings are built - RTTR_EXEC_TILL(2000, world.GetNO(posWoodcutter)->GetType() == NodalObjectType::Building); - RTTR_EXEC_TILL(2000, world.GetNO(posSawmill)->GetType() == NodalObjectType::Building); + RTTR_EXEC_TILL(2000, world.getNO(posWoodcutter)->getType() == NodalObjectType::Building); + RTTR_EXEC_TILL(2000, world.getNO(posSawmill)->getType() == NodalObjectType::Building); } BOOST_FIXTURE_TEST_CASE(CannotBuildOtherBuldings, EmergencyFixture) @@ -66,7 +66,7 @@ BOOST_FIXTURE_TEST_CASE(CannotBuildOtherBuldings, EmergencyFixture) // No boards are carried out to the farms or watchtower due to emergency protocol RTTR_SKIP_GFS(500); - BOOST_TEST(hq->GetInventory()[GoodType::Boards] == 10); + BOOST_TEST(hq->getInventory()[GoodType::Boards] == 10); } BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file diff --git a/tests/s25Main/integration/testFarmer.cpp b/tests/s25Main/integration/testFarmer.cpp index 8e9ff66a78..878ac9ff61 100644 --- a/tests/s25Main/integration/testFarmer.cpp +++ b/tests/s25Main/integration/testFarmer.cpp @@ -22,14 +22,14 @@ struct FarmerFixture : public WorldFixture FarmerFixture() { addStartResources(); - farmPt = world.GetPlayer(0).GetHQPos() + MapPoint(5, 0); + farmPt = world.getPlayer(0).getHQPos() + MapPoint(5, 0); farm = dynamic_cast( BuildingFactory::CreateBuilding(world, BuildingType::Farm, farmPt, 0, Nation::Romans)); BOOST_TEST_REQUIRE(farm); - world.BuildRoad(0, false, world.GetNeighbour(farmPt, Direction::SouthEast), + world.BuildRoad(0, false, world.getNeighbour(farmPt, Direction::SouthEast), std::vector(5, Direction::West)); - RTTR_EXEC_TILL(7 * 20 + 60, farm->HasWorker()); - farmer = dynamic_cast(farm->GetWorker()); + RTTR_EXEC_TILL(7 * 20 + 60, farm->hasWorker()); + farmer = dynamic_cast(farm->getWorker()); BOOST_TEST_REQUIRE(farmer); initGameRNG(); } @@ -38,18 +38,18 @@ struct FarmerFixture : public WorldFixture BOOST_FIXTURE_TEST_CASE(ForesterAvoidsPotentialFarmFieldSpots, FarmerFixture) { const auto isPointAvailable = [](const nofFarmhand& worker, const MapPoint pt) { - return worker.GetPointQuality(pt) != nofFarmhand::PointQuality::NotPossible; + return worker.getPointQuality(pt) != nofFarmhand::PointQuality::NotPossible; }; - const MapPoint fieldPt = world.GetNeighbour2(farmPt, 0); + const MapPoint fieldPt = world.getNeighbour2(farmPt, 0); BOOST_TEST_REQUIRE(isPointAvailable(*farmer, fieldPt)); - const MapPoint foresterPt = world.MakeMapPoint(world.GetPlayer(0).GetHQPos() - Position(5, 0)); + const MapPoint foresterPt = world.MakeMapPoint(world.getPlayer(0).getHQPos() - Position(5, 0)); auto* foresterBuilding = dynamic_cast( BuildingFactory::CreateBuilding(world, BuildingType::Forester, foresterPt, 0, Nation::Romans)); BOOST_TEST_REQUIRE(foresterBuilding); - nofForester foresterWorker(world.GetNeighbour(foresterPt, Direction::SouthEast), 0, foresterBuilding); + nofForester foresterWorker(world.getNeighbour(foresterPt, Direction::SouthEast), 0, foresterBuilding); BOOST_TEST_REQUIRE(isPointAvailable(foresterWorker, fieldPt)); @@ -60,7 +60,7 @@ BOOST_FIXTURE_TEST_CASE(ForesterAvoidsPotentialFarmFieldSpots, FarmerFixture) BOOST_FIXTURE_TEST_CASE(FarmFieldPlanting, FarmerFixture) { const auto isPointAvailable = [farmer = this->farmer](const MapPoint pt) { - return farmer->GetPointQuality(pt) != nofFarmhand::PointQuality::NotPossible; + return farmer->getPointQuality(pt) != nofFarmhand::PointQuality::NotPossible; }; std::vector radius1Pts = world.GetPointsInRadiusWithCenter(farmPt, 1); @@ -72,35 +72,35 @@ BOOST_FIXTURE_TEST_CASE(FarmFieldPlanting, FarmerFixture) for(unsigned dir = 0; dir < 12; dir++) { if(dir == 11) - BOOST_TEST_REQUIRE(!isPointAvailable(world.GetNeighbour2(farmPt, dir))); + BOOST_TEST_REQUIRE(!isPointAvailable(world.getNeighbour2(farmPt, dir))); else - BOOST_TEST_REQUIRE(isPointAvailable(world.GetNeighbour2(farmPt, dir))); + BOOST_TEST_REQUIRE(isPointAvailable(world.getNeighbour2(farmPt, dir))); } // Not on non-vital terrain - const auto tUnvital = world.GetDescription().terrain.find([](const TerrainDesc& t) { return !t.IsVital(); }); - world.GetNodeWriteable(world.GetNeighbour2(farmPt, 3)).t1 = tUnvital; - BOOST_TEST_REQUIRE(isPointAvailable(world.GetNeighbour2(farmPt, 2))); - BOOST_TEST_REQUIRE(!isPointAvailable(world.GetNeighbour2(farmPt, 3))); - BOOST_TEST_REQUIRE(isPointAvailable(world.GetNeighbour2(farmPt, 4))); - world.GetNodeWriteable(world.GetNeighbour2(farmPt, 3)).t2 = tUnvital; - BOOST_TEST_REQUIRE(!isPointAvailable(world.GetNeighbour2(farmPt, 3))); - BOOST_TEST_REQUIRE(!isPointAvailable(world.GetNeighbour2(farmPt, 4))); + const auto tUnvital = world.getDescription().terrain.find([](const TerrainDesc& t) { return !t.isVital(); }); + world.getNodeWriteable(world.getNeighbour2(farmPt, 3)).t1 = tUnvital; + BOOST_TEST_REQUIRE(isPointAvailable(world.getNeighbour2(farmPt, 2))); + BOOST_TEST_REQUIRE(!isPointAvailable(world.getNeighbour2(farmPt, 3))); + BOOST_TEST_REQUIRE(isPointAvailable(world.getNeighbour2(farmPt, 4))); + world.getNodeWriteable(world.getNeighbour2(farmPt, 3)).t2 = tUnvital; + BOOST_TEST_REQUIRE(!isPointAvailable(world.getNeighbour2(farmPt, 3))); + BOOST_TEST_REQUIRE(!isPointAvailable(world.getNeighbour2(farmPt, 4))); // Env obj is allowed - world.SetNO(world.GetNeighbour2(farmPt, 5), new noEnvObject(world.GetNeighbour2(farmPt, 5), 0)); - BOOST_TEST_REQUIRE(isPointAvailable(world.GetNeighbour2(farmPt, 5))); + world.setNO(world.getNeighbour2(farmPt, 5), new noEnvObject(world.getNeighbour2(farmPt, 5), 0)); + BOOST_TEST_REQUIRE(isPointAvailable(world.getNeighbour2(farmPt, 5))); // On bld and next to it is not allowed - world.SetBuildingSite(BuildingType::Watchtower, world.GetNeighbour2(farmPt, 6), 0); - BOOST_TEST_REQUIRE(!isPointAvailable(world.GetNeighbour2(farmPt, 6))); - BOOST_TEST_REQUIRE(!isPointAvailable(world.GetNeighbour2(farmPt, 7))); + world.SetBuildingSite(BuildingType::Watchtower, world.getNeighbour2(farmPt, 6), 0); + BOOST_TEST_REQUIRE(!isPointAvailable(world.getNeighbour2(farmPt, 6))); + BOOST_TEST_REQUIRE(!isPointAvailable(world.getNeighbour2(farmPt, 7))); // On or next to grain field is not allowed - const MapPoint grainFieldPos = world.GetNeighbour2(farmPt, 0); + const MapPoint grainFieldPos = world.getNeighbour2(farmPt, 0); auto* grainField = new noGrainfield(grainFieldPos); - world.SetNO(grainFieldPos, grainField); + world.setNO(grainFieldPos, grainField); BOOST_TEST_REQUIRE(!isPointAvailable(grainFieldPos)); - BOOST_TEST_REQUIRE(!isPointAvailable(world.GetNeighbour2(farmPt, 1))); - const MapPoint grainFieldPos2 = world.GetNeighbour(world.GetNeighbour2(farmPt, 2), Direction::NorthWest); - world.SetNO(grainFieldPos2, new noGrainfield(grainFieldPos2)); - BOOST_TEST_REQUIRE(!isPointAvailable(world.GetNeighbour2(farmPt, 0))); + BOOST_TEST_REQUIRE(!isPointAvailable(world.getNeighbour2(farmPt, 1))); + const MapPoint grainFieldPos2 = world.getNeighbour(world.getNeighbour2(farmPt, 2), Direction::NorthWest); + world.setNO(grainFieldPos2, new noGrainfield(grainFieldPos2)); + BOOST_TEST_REQUIRE(!isPointAvailable(world.getNeighbour2(farmPt, 0))); // Test farmer behavior for(unsigned i = 0; i < 2; i++) @@ -111,42 +111,42 @@ BOOST_FIXTURE_TEST_CASE(FarmFieldPlanting, FarmerFixture) // Find field, only these 3 remaining for(unsigned dir = 8; dir < 11; dir++) { - if(world.GetNode(world.GetNeighbour2(farmPt, dir)).reserved) + if(world.getNode(world.getNeighbour2(farmPt, dir)).reserved) { - newField = world.GetNeighbour2(farmPt, dir); + newField = world.getNeighbour2(farmPt, dir); break; } } BOOST_TEST_REQUIRE(newField.isValid()); // Let him get there - RTTR_EXEC_TILL(60, farmer->GetPos() == newField); + RTTR_EXEC_TILL(60, farmer->getPos() == newField); // Start sawing RTTR_SKIP_GFS(50); - BOOST_TEST_REQUIRE(!world.GetSpecObj(newField)); + BOOST_TEST_REQUIRE(!world.getSpecObj(newField)); if(i == 0) world.SetBuildingSite(BuildingType::Woodcutter, newField, 0); else - world.SetBuildingSite(BuildingType::Woodcutter, world.GetNeighbour(newField, Direction::SouthEast), 0); + world.SetBuildingSite(BuildingType::Woodcutter, world.getNeighbour(newField, Direction::SouthEast), 0); // Let farmer return RTTR_EXEC_TILL(150, !farm->is_working); // Aborted work - BOOST_TEST_REQUIRE(!world.GetSpecObj(newField)); + BOOST_TEST_REQUIRE(!world.getSpecObj(newField)); // And remove if(i == 0) - world.DestroyFlag(world.GetNeighbour(newField, Direction::SouthEast), 0); + world.DestroyFlag(world.getNeighbour(newField, Direction::SouthEast), 0); else - world.DestroyBuilding(world.GetNeighbour(newField, Direction::SouthEast), 0); + world.DestroyBuilding(world.getNeighbour(newField, Direction::SouthEast), 0); } - RTTR_EXEC_TILL(3000, grainField->IsHarvestable()); + RTTR_EXEC_TILL(3000, grainField->isHarvestable()); // Wait till farmer stopped working RTTR_EXEC_TILL(150, !farm->is_working); // And started again RTTR_EXEC_TILL(150, farm->is_working); // Should pick this - BOOST_TEST_REQUIRE(world.GetNode(grainFieldPos).reserved); + BOOST_TEST_REQUIRE(world.getNode(grainFieldPos).reserved); // Wait till farmer stopped working RTTR_EXEC_TILL(270, !farm->is_working); // Grainfield is gone - BOOST_TEST_REQUIRE(!world.GetSpecObj(grainFieldPos)); + BOOST_TEST_REQUIRE(!world.getSpecObj(grainFieldPos)); } diff --git a/tests/s25Main/integration/testFigures.cpp b/tests/s25Main/integration/testFigures.cpp index bf5df4814d..3eca8121ba 100644 --- a/tests/s25Main/integration/testFigures.cpp +++ b/tests/s25Main/integration/testFigures.cpp @@ -28,9 +28,9 @@ BOOST_AUTO_TEST_CASE(StrandedSoldierReturnSearchDefaultKeepsNormalTryingsAndRadi GlobalGameSettings ggs; ggs.setSelection(AddonId::STRANDED_SOLDIER_RETURN_SEARCH, 0); - BOOST_TEST(GetStrandedSoldierReturnSearchTryings(ggs) == 6u); - BOOST_TEST(GetStrandedSoldierReturnSearchRadius(ggs, 6) == 15u); - BOOST_TEST(GetStrandedSoldierReturnSearchRadius(ggs, 1) == 15u); + BOOST_TEST(getStrandedSoldierReturnSearchTryings(ggs) == 6u); + BOOST_TEST(getStrandedSoldierReturnSearchRadius(ggs, 6) == 15u); + BOOST_TEST(getStrandedSoldierReturnSearchRadius(ggs, 1) == 15u); } BOOST_AUTO_TEST_CASE(StrandedSoldierReturnSearchReducedKeepsNormalTryingsAndFixedHalfRadius) @@ -38,10 +38,10 @@ BOOST_AUTO_TEST_CASE(StrandedSoldierReturnSearchReducedKeepsNormalTryingsAndFixe GlobalGameSettings ggs; ggs.setSelection(AddonId::STRANDED_SOLDIER_RETURN_SEARCH, 1); - BOOST_TEST(GetStrandedSoldierReturnSearchTryings(ggs) == 6u); - BOOST_TEST(GetStrandedSoldierReturnSearchRadius(ggs, 12) == 7u); - BOOST_TEST(GetStrandedSoldierReturnSearchRadius(ggs, 6) == 7u); - BOOST_TEST(GetStrandedSoldierReturnSearchRadius(ggs, 1) == 7u); + BOOST_TEST(getStrandedSoldierReturnSearchTryings(ggs) == 6u); + BOOST_TEST(getStrandedSoldierReturnSearchRadius(ggs, 12) == 7u); + BOOST_TEST(getStrandedSoldierReturnSearchRadius(ggs, 6) == 7u); + BOOST_TEST(getStrandedSoldierReturnSearchRadius(ggs, 1) == 7u); } BOOST_AUTO_TEST_CASE(StrandedSoldierReturnSearchExtendedEscalatesAfterNormalTryings) @@ -49,11 +49,11 @@ BOOST_AUTO_TEST_CASE(StrandedSoldierReturnSearchExtendedEscalatesAfterNormalTryi GlobalGameSettings ggs; ggs.setSelection(AddonId::STRANDED_SOLDIER_RETURN_SEARCH, 2); - BOOST_TEST(GetStrandedSoldierReturnSearchTryings(ggs) == 12u); - BOOST_TEST(GetStrandedSoldierReturnSearchRadius(ggs, 12) == 15u); - BOOST_TEST(GetStrandedSoldierReturnSearchRadius(ggs, 7) == 15u); - BOOST_TEST(GetStrandedSoldierReturnSearchRadius(ggs, 6) == 30u); - BOOST_TEST(GetStrandedSoldierReturnSearchRadius(ggs, 1) == 30u); + BOOST_TEST(getStrandedSoldierReturnSearchTryings(ggs) == 12u); + BOOST_TEST(getStrandedSoldierReturnSearchRadius(ggs, 12) == 15u); + BOOST_TEST(getStrandedSoldierReturnSearchRadius(ggs, 7) == 15u); + BOOST_TEST(getStrandedSoldierReturnSearchRadius(ggs, 6) == 30u); + BOOST_TEST(getStrandedSoldierReturnSearchRadius(ggs, 1) == 30u); } BOOST_AUTO_TEST_CASE(StrandedSoldierReturnSearchVeryLargeEscalatesThroughThreeStages) @@ -61,69 +61,69 @@ BOOST_AUTO_TEST_CASE(StrandedSoldierReturnSearchVeryLargeEscalatesThroughThreeSt GlobalGameSettings ggs; ggs.setSelection(AddonId::STRANDED_SOLDIER_RETURN_SEARCH, 3); - BOOST_TEST(GetStrandedSoldierReturnSearchTryings(ggs) == 18u); - BOOST_TEST(GetStrandedSoldierReturnSearchRadius(ggs, 18) == 15u); - BOOST_TEST(GetStrandedSoldierReturnSearchRadius(ggs, 13) == 15u); - BOOST_TEST(GetStrandedSoldierReturnSearchRadius(ggs, 12) == 30u); - BOOST_TEST(GetStrandedSoldierReturnSearchRadius(ggs, 7) == 30u); - BOOST_TEST(GetStrandedSoldierReturnSearchRadius(ggs, 6) == 60u); - BOOST_TEST(GetStrandedSoldierReturnSearchRadius(ggs, 1) == 60u); + BOOST_TEST(getStrandedSoldierReturnSearchTryings(ggs) == 18u); + BOOST_TEST(getStrandedSoldierReturnSearchRadius(ggs, 18) == 15u); + BOOST_TEST(getStrandedSoldierReturnSearchRadius(ggs, 13) == 15u); + BOOST_TEST(getStrandedSoldierReturnSearchRadius(ggs, 12) == 30u); + BOOST_TEST(getStrandedSoldierReturnSearchRadius(ggs, 7) == 30u); + BOOST_TEST(getStrandedSoldierReturnSearchRadius(ggs, 6) == 60u); + BOOST_TEST(getStrandedSoldierReturnSearchRadius(ggs, 1) == 60u); } BOOST_FIXTURE_TEST_CASE(DestroyWHWithFigure, WorldWithGCExecution2P) { - world.GetPlayer(curPlayer).GetFirstWH()->AddToInventory(PeopleCounts::make(Job::Helper, 10), true); - MapPoint flagPos = world.GetNeighbour(hqPos, Direction::SouthEast); + world.getPlayer(curPlayer).getFirstWH()->AddToInventory(PeopleCounts::make(Job::Helper, 10), true); + MapPoint flagPos = world.getNeighbour(hqPos, Direction::SouthEast); MapPoint whPos(flagPos.x + 5, flagPos.y); auto* wh = static_cast( BuildingFactory::CreateBuilding(world, BuildingType::Storehouse, whPos, curPlayer, Nation::Romans)); wh->AddToInventory(PeopleCounts::make(Job::Helper, 1), true); - const unsigned numHelpers = world.GetPlayer(curPlayer).GetInventory().people[Job::Helper]; //-V807 - MapPoint whFlagPos = world.GetNeighbour(whPos, Direction::SouthEast); + const unsigned numHelpers = world.getPlayer(curPlayer).getInventory().people[Job::Helper]; //-V807 + MapPoint whFlagPos = world.getNeighbour(whPos, Direction::SouthEast); // Build a road -> Requests a worker this->BuildRoad(whFlagPos, false, std::vector(2, Direction::West)); - BOOST_TEST_REQUIRE(wh->GetNumRealFigures(Job::Helper) == 0u); - BOOST_TEST_REQUIRE(wh->GetLeavingFigures().size() == 1u); + BOOST_TEST_REQUIRE(wh->getNumRealFigures(Job::Helper) == 0u); + BOOST_TEST_REQUIRE(wh->getLeavingFigures().size() == 1u); // Destroy Road this->DestroyFlag(whFlagPos - MapPoint(2, 0)); - BOOST_TEST_REQUIRE(wh->GetNumRealFigures(Job::Helper) == 1u); - BOOST_TEST_REQUIRE(wh->GetLeavingFigures().size() == 0u); + BOOST_TEST_REQUIRE(wh->getNumRealFigures(Job::Helper) == 1u); + BOOST_TEST_REQUIRE(wh->getLeavingFigures().size() == 0u); this->BuildRoad(whFlagPos, false, std::vector(2, Direction::West)); - const noFigure* fig = &wh->GetLeavingFigures().front(); + const noFigure* fig = &wh->getLeavingFigures().front(); // Destroy wh -> Worker released this->DestroyFlag(whFlagPos); - BOOST_TEST_REQUIRE(world.GetPlayer(curPlayer).GetInventory().people[Job::Helper] == numHelpers); - BOOST_TEST_REQUIRE(fig->GetPos() == whPos); - BOOST_TEST_REQUIRE(fig->IsWandering()); + BOOST_TEST_REQUIRE(world.getPlayer(curPlayer).getInventory().people[Job::Helper] == numHelpers); + BOOST_TEST_REQUIRE(fig->getPos() == whPos); + BOOST_TEST_REQUIRE(fig->isWandering()); // Same for HQ // Build a road -> Requests a worker this->BuildRoad(flagPos, false, std::vector(2, Direction::West)); - wh = world.GetSpecObj(hqPos); - BOOST_TEST_REQUIRE(wh->GetLeavingFigures().size() == 1u); - fig = &wh->GetLeavingFigures().front(); + wh = world.getSpecObj(hqPos); + BOOST_TEST_REQUIRE(wh->getLeavingFigures().size() == 1u); + fig = &wh->getLeavingFigures().front(); // Destroy wh -> Worker released this->DestroyFlag(flagPos); - BOOST_TEST_REQUIRE(world.GetPlayer(curPlayer).GetInventory().people[Job::Helper] == numHelpers); - BOOST_TEST_REQUIRE(fig->GetPos() == hqPos); - BOOST_TEST_REQUIRE(fig->IsWandering()); + BOOST_TEST_REQUIRE(world.getPlayer(curPlayer).getInventory().people[Job::Helper] == numHelpers); + BOOST_TEST_REQUIRE(fig->getPos() == hqPos); + BOOST_TEST_REQUIRE(fig->isWandering()); } BOOST_FIXTURE_TEST_CASE(DestroyWHWithWare, WorldWithGCExecution2P) { addStartResources(); - MapPoint flagPos = world.GetNeighbour(hqPos, Direction::SouthEast); + MapPoint flagPos = world.getNeighbour(hqPos, Direction::SouthEast); MapPoint whFlagPos(flagPos.x + 5, flagPos.y); - MapPoint whPos = world.GetNeighbour(whFlagPos, Direction::NorthWest); + MapPoint whPos = world.getNeighbour(whFlagPos, Direction::NorthWest); BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, whPos, curPlayer, Nation::Romans); // Build a road this->BuildRoad(whFlagPos, false, std::vector(5, Direction::West)); // Request people and wares this->SetInventorySetting(whPos, GoodType::Wood, EInventorySetting::Collect); this->SetInventorySetting(whPos, Job::Woodcutter, EInventorySetting::Collect); - auto* flag = world.GetSpecObj(flagPos); - RTTR_EXEC_TILL(200, flag->GetNumWares() > 0); + auto* flag = world.getSpecObj(flagPos); + RTTR_EXEC_TILL(200, flag->getNumWares() > 0); // Destroy wh -> Cancel wares and figures this->DestroyFlag(whFlagPos); } @@ -132,51 +132,51 @@ using EmptyWorldFixture1PBig = WorldFixture; BOOST_FIXTURE_TEST_CASE(ScoutScouts, EmptyWorldFixture1PBig) { - const MapPoint hqFlagPos = world.GetNeighbour(world.GetPlayer(0).GetHQPos(), Direction::SouthEast); + const MapPoint hqFlagPos = world.getNeighbour(world.getPlayer(0).getHQPos(), Direction::SouthEast); auto& scout = world.AddFigure( - hqFlagPos, std::make_unique(hqFlagPos, 0, world.GetSpecObj(hqFlagPos))); + hqFlagPos, std::make_unique(hqFlagPos, 0, world.getSpecObj(hqFlagPos))); scout.ActAtFirst(); const auto countVisibleNodes = [&]() { unsigned numVisibleNodes = 0; - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { if(world.CalcVisiblityWithAllies(pt, 0) != Visibility::Invisible) numVisibleNodes++; } return numVisibleNodes; }; - BOOST_TEST_REQUIRE(countVisibleNodes() < prodOfComponents(world.GetSize())); // Must have scoutable nodes + BOOST_TEST_REQUIRE(countVisibleNodes() < prodOfComponents(world.getSize())); // Must have scoutable nodes RTTR_SKIP_GFS(600); // All scouted - BOOST_TEST(countVisibleNodes() == prodOfComponents(world.GetSize())); + BOOST_TEST(countVisibleNodes() == prodOfComponents(world.getSize())); } using EmptyWorldFixture1P = WorldFixture; BOOST_FIXTURE_TEST_CASE(GeologistPlacesSigns, EmptyWorldFixture1P) { - const MapPoint hqFlagPos = world.GetNeighbour(world.GetPlayer(0).GetHQPos(), Direction::SouthEast); - const MapPoint waterPos = world.GetNeighbour(hqFlagPos, Direction::NorthEast); - const MapPoint coalPos = world.GetNeighbour(hqFlagPos, Direction::East); - const MapPoint ironPos = world.GetNeighbour(hqFlagPos, Direction::SouthEast); - const MapPoint goldPos = world.GetNeighbour(hqFlagPos, Direction::SouthWest); - const MapPoint granitePos = world.GetNeighbour2(hqFlagPos, 6); // A bit further - world.GetNodeWriteable(waterPos).resources = Resource(ResourceType::Water, rttr::test::randomValue(1u, 15u)); - world.GetNodeWriteable(coalPos).resources = Resource(ResourceType::Coal, rttr::test::randomValue(1u, 15u)); - world.GetNodeWriteable(ironPos).resources = Resource(ResourceType::Iron, rttr::test::randomValue(1u, 15u)); - world.GetNodeWriteable(goldPos).resources = Resource(ResourceType::Gold, rttr::test::randomValue(1u, 15u)); - world.GetNodeWriteable(granitePos).resources = Resource(ResourceType::Granite, rttr::test::randomValue(1u, 15u)); + const MapPoint hqFlagPos = world.getNeighbour(world.getPlayer(0).getHQPos(), Direction::SouthEast); + const MapPoint waterPos = world.getNeighbour(hqFlagPos, Direction::NorthEast); + const MapPoint coalPos = world.getNeighbour(hqFlagPos, Direction::East); + const MapPoint ironPos = world.getNeighbour(hqFlagPos, Direction::SouthEast); + const MapPoint goldPos = world.getNeighbour(hqFlagPos, Direction::SouthWest); + const MapPoint granitePos = world.getNeighbour2(hqFlagPos, 6); // A bit further + world.getNodeWriteable(waterPos).resources = Resource(ResourceType::Water, rttr::test::randomValue(1u, 15u)); + world.getNodeWriteable(coalPos).resources = Resource(ResourceType::Coal, rttr::test::randomValue(1u, 15u)); + world.getNodeWriteable(ironPos).resources = Resource(ResourceType::Iron, rttr::test::randomValue(1u, 15u)); + world.getNodeWriteable(goldPos).resources = Resource(ResourceType::Gold, rttr::test::randomValue(1u, 15u)); + world.getNodeWriteable(granitePos).resources = Resource(ResourceType::Granite, rttr::test::randomValue(1u, 15u)); // Add some geologists for(unsigned i = 0; i < 10; i++) { world - .AddFigure(hqFlagPos, std::make_unique(hqFlagPos, 0, world.GetSpecObj(hqFlagPos))) + .AddFigure(hqFlagPos, std::make_unique(hqFlagPos, 0, world.getSpecObj(hqFlagPos))) .ActAtFirst(); } std::vector notes; const auto sub = - world.GetNotifications().subscribe([¬es](const ResourceNote& note) { notes.push_back(note); }); + world.getNotifications().subscribe([¬es](const ResourceNote& note) { notes.push_back(note); }); RTTR_SKIP_GFS(800); // All discovered @@ -190,10 +190,10 @@ BOOST_FIXTURE_TEST_CASE(GeologistPlacesSigns, EmptyWorldFixture1P) BOOST_TEST(helpers::contains_if(notes, [&](const ResourceNote& note) { return note.pos == granitePos; })); for(const ResourceNote& note : notes) { - BOOST_TEST(note.res == world.GetNode(note.pos).resources); - const auto* sign = world.GetSpecObj(note.pos); + BOOST_TEST(note.res == world.getNode(note.pos).resources); + const auto* sign = world.getSpecObj(note.pos); BOOST_TEST_REQUIRE(sign); - BOOST_TEST(sign->GetResource() == note.res); + BOOST_TEST(sign->getResource() == note.res); } } diff --git a/tests/s25Main/integration/testFrontierDistance.cpp b/tests/s25Main/integration/testFrontierDistance.cpp index c35d2029bb..bff64e8144 100644 --- a/tests/s25Main/integration/testFrontierDistance.cpp +++ b/tests/s25Main/integration/testFrontierDistance.cpp @@ -39,17 +39,17 @@ struct FrontierWorld : public WorldFixture FrontierWorld() { - const GamePlayer& p0 = world.GetPlayer(0); - const GamePlayer& p1 = world.GetPlayer(1); - milBld0Pos = p0.GetHQPos() - MapPoint(0, 2); - milBld1Pos = p1.GetHQPos() - MapPoint(0, 2); + const GamePlayer& p0 = world.getPlayer(0); + const GamePlayer& p1 = world.getPlayer(1); + milBld0Pos = p0.getHQPos() - MapPoint(0, 2); + milBld1Pos = p1.getHQPos() - MapPoint(0, 2); if(std::is_same_v) { // Assumed by distributions and sizes BOOST_TEST_REQUIRE(milBld0Pos.y == milBld1Pos.y); } // Destroy HQs so only buildings are checked - world.DestroyNO(p0.GetHQPos()); - world.DestroyNO(p1.GetHQPos()); + world.DestroyNO(p0.getHQPos()); + world.DestroyNO(p1.getHQPos()); milBld0 = dynamic_cast( BuildingFactory::CreateBuilding(world, BuildingType::Barracks, milBld0Pos, 0, Nation::Romans)); milBld1 = dynamic_cast( @@ -66,17 +66,17 @@ using FrontierWorldStaticBlocker = WorldFixture; BOOST_FIXTURE_TEST_CASE(FrontierDistanceNear, FrontierWorldSmall) { - const auto tWater = GetWaterTerrain(world.GetDescription()); + const auto tWater = GetWaterTerrain(world.getDescription()); - for(const auto y : helpers::range(1, +world.GetHeight())) + for(const auto y : helpers::range(1, +world.getHeight())) { - for(const auto x : helpers::range(1, +world.GetWidth())) + for(const auto x : helpers::range(1, +world.getWidth())) { MapPoint curPoint(x, y); if(curPoint == milBld0Pos || curPoint == milBld1Pos) continue; - MapNode& mapPoint = world.GetNodeWriteable(curPoint); + MapNode& mapPoint = world.getNodeWriteable(curPoint); mapPoint.t1 = tWater; mapPoint.t2 = tWater; } @@ -85,11 +85,11 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceNear, FrontierWorldSmall) for(int i = 0; i <= 1; i++) { this->ggs.setSelection(AddonId::FRONTIER_DISTANCE_REACHABLE, i); // addon is active on second run - world.GetPlayer(0).RecalcMilitaryFlags(); - world.GetPlayer(1).RecalcMilitaryFlags(); + world.getPlayer(0).RecalcMilitaryFlags(); + world.getPlayer(1).RecalcMilitaryFlags(); - FrontierDistance distance0 = milBld0->GetFrontierDistance(); - FrontierDistance distance1 = milBld1->GetFrontierDistance(); + FrontierDistance distance0 = milBld0->getFrontierDistance(); + FrontierDistance distance1 = milBld1->getFrontierDistance(); BOOST_TEST(distance0 == distance1); BOOST_TEST( @@ -103,18 +103,18 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceNearOtherFields, FrontierWorldSmall) for(int terrain = 0; terrain < 2; terrain++) { TerrainKind searchedTerrain = terrain == 1 ? TerrainKind::Lava : TerrainKind::Snow; - const auto tUnreachable = world.GetDescription().terrain.find( + const auto tUnreachable = world.getDescription().terrain.find( [searchedTerrain](const TerrainDesc& t) { return t.kind == searchedTerrain && t.Is(ETerrain::Unreachable); }); - for(const auto y : helpers::range(1, +world.GetHeight())) + for(const auto y : helpers::range(1, +world.getHeight())) { - for(const auto x : helpers::range(1, +world.GetWidth())) + for(const auto x : helpers::range(1, +world.getWidth())) { MapPoint curPoint(x, y); if(curPoint == milBld0Pos || curPoint == milBld1Pos) continue; - MapNode& mapPoint = world.GetNodeWriteable(curPoint); + MapNode& mapPoint = world.getNodeWriteable(curPoint); mapPoint.t1 = tUnreachable; mapPoint.t2 = tUnreachable; } @@ -123,11 +123,11 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceNearOtherFields, FrontierWorldSmall) for(int i = 0; i <= 1; i++) { this->ggs.setSelection(AddonId::FRONTIER_DISTANCE_REACHABLE, i); // addon is active on second run - world.GetPlayer(0).RecalcMilitaryFlags(); - world.GetPlayer(1).RecalcMilitaryFlags(); + world.getPlayer(0).RecalcMilitaryFlags(); + world.getPlayer(1).RecalcMilitaryFlags(); - FrontierDistance distance0 = milBld0->GetFrontierDistance(); - FrontierDistance distance1 = milBld1->GetFrontierDistance(); + FrontierDistance distance0 = milBld0->getFrontierDistance(); + FrontierDistance distance1 = milBld1->getFrontierDistance(); BOOST_TEST(distance0 == distance1); BOOST_TEST(distance0 @@ -139,11 +139,11 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceNearOtherFields, FrontierWorldSmall) BOOST_FIXTURE_TEST_CASE(FrontierDistanceMiddle, FrontierWorldMiddle) { - const DescIdx tWater = GetWaterTerrain(world.GetDescription()); + const DescIdx tWater = GetWaterTerrain(world.getDescription()); - for(const auto y : helpers::range(1, +world.GetHeight())) + for(const auto y : helpers::range(1, +world.getHeight())) { - for(const auto x : helpers::range(1, +world.GetWidth())) + for(const auto x : helpers::range(1, +world.getWidth())) { MapPoint curPoint(x, y); if(curPoint == milBld0Pos || curPoint == milBld1Pos) @@ -151,7 +151,7 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceMiddle, FrontierWorldMiddle) continue; } - MapNode& mapPoint = world.GetNodeWriteable(curPoint); + MapNode& mapPoint = world.getNodeWriteable(curPoint); mapPoint.t1 = tWater; mapPoint.t2 = tWater; } @@ -160,11 +160,11 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceMiddle, FrontierWorldMiddle) for(int i = 0; i <= 1; i++) { this->ggs.setSelection(AddonId::FRONTIER_DISTANCE_REACHABLE, i); // addon is active on second run - world.GetPlayer(0).RecalcMilitaryFlags(); - world.GetPlayer(1).RecalcMilitaryFlags(); + world.getPlayer(0).RecalcMilitaryFlags(); + world.getPlayer(1).RecalcMilitaryFlags(); - FrontierDistance distance0 = milBld0->GetFrontierDistance(); - FrontierDistance distance1 = milBld1->GetFrontierDistance(); + FrontierDistance distance0 = milBld0->getFrontierDistance(); + FrontierDistance distance1 = milBld1->getFrontierDistance(); BOOST_TEST(distance0 == distance1); BOOST_TEST( @@ -175,11 +175,11 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceMiddle, FrontierWorldMiddle) BOOST_FIXTURE_TEST_CASE(FrontierDistanceFar, FrontierWorldBig) { - const DescIdx tWater = GetWaterTerrain(world.GetDescription()); + const DescIdx tWater = GetWaterTerrain(world.getDescription()); - for(const auto y : helpers::range(1, +world.GetHeight())) + for(const auto y : helpers::range(1, +world.getHeight())) { - for(const auto x : helpers::range(1, +world.GetWidth())) + for(const auto x : helpers::range(1, +world.getWidth())) { MapPoint curPoint(x, y); if(curPoint == milBld0Pos || curPoint == milBld1Pos) @@ -187,7 +187,7 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceFar, FrontierWorldBig) continue; } - MapNode& node = world.GetNodeWriteable(curPoint); + MapNode& node = world.getNodeWriteable(curPoint); node.t1 = node.t2 = tWater; } } @@ -195,11 +195,11 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceFar, FrontierWorldBig) for(int i = 0; i <= 1; i++) { this->ggs.setSelection(AddonId::FRONTIER_DISTANCE_REACHABLE, i); // addon is active on second run - world.GetPlayer(0).RecalcMilitaryFlags(); - world.GetPlayer(1).RecalcMilitaryFlags(); + world.getPlayer(0).RecalcMilitaryFlags(); + world.getPlayer(1).RecalcMilitaryFlags(); - FrontierDistance distance0 = milBld0->GetFrontierDistance(); - FrontierDistance distance1 = milBld1->GetFrontierDistance(); + FrontierDistance distance0 = milBld0->getFrontierDistance(); + FrontierDistance distance1 = milBld1->getFrontierDistance(); BOOST_TEST_REQUIRE(distance0 == distance1); BOOST_TEST_REQUIRE(distance0 == FrontierDistance::Far); // every time inland @@ -211,33 +211,33 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceHarbor, FrontierWorldSea) // With sea attacks this->ggs.setSelection(AddonId::SEA_ATTACK, 0); milBld0->LookForEnemyBuildings(milBld1); - BOOST_TEST(milBld0->GetFrontierDistance() == FrontierDistance::Harbor); + BOOST_TEST(milBld0->getFrontierDistance() == FrontierDistance::Harbor); this->ggs.setSelection(AddonId::SEA_ATTACK, 1); milBld0->LookForEnemyBuildings(milBld1); - BOOST_TEST(milBld0->GetFrontierDistance() == FrontierDistance::Harbor); + BOOST_TEST(milBld0->getFrontierDistance() == FrontierDistance::Harbor); // With sea attacks disabled this->ggs.setSelection(AddonId::SEA_ATTACK, 2); milBld0->LookForEnemyBuildings(milBld1); - BOOST_TEST(milBld0->GetFrontierDistance() == FrontierDistance::Far); + BOOST_TEST(milBld0->getFrontierDistance() == FrontierDistance::Far); } BOOST_FIXTURE_TEST_CASE(FrontierDistanceIslandTest, FrontierWorldMiddle) { - const DescIdx tWater = GetWaterTerrain(world.GetDescription()); + const DescIdx tWater = GetWaterTerrain(world.getDescription()); // Little bit, but walkable water between the 2 buildings (middle of map) // and around the border big water - unsigned middle = world.GetWidth() / 2; - for(const auto y : helpers::range(1, +world.GetHeight())) + unsigned middle = world.getWidth() / 2; + for(const auto y : helpers::range(1, +world.getHeight())) { - for(const auto x : helpers::range(1, +world.GetWidth())) + for(const auto x : helpers::range(1, +world.getWidth())) { MapPoint curPoint(x, y); - if(curPoint.x < 5 || curPoint.x > world.GetWidth() - 5 || curPoint.y < 5 - || curPoint.y > world.GetHeight() - 5 || (curPoint.x >= middle - 1 && curPoint.x <= middle)) + if(curPoint.x < 5 || curPoint.x > world.getWidth() - 5 || curPoint.y < 5 + || curPoint.y > world.getHeight() - 5 || (curPoint.x >= middle - 1 && curPoint.x <= middle)) { - MapNode& mapPoint = world.GetNodeWriteable(curPoint); + MapNode& mapPoint = world.getNodeWriteable(curPoint); mapPoint.t1 = tWater; mapPoint.t2 = tWater; } @@ -247,11 +247,11 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceIslandTest, FrontierWorldMiddle) for(int i = 0; i <= 1; i++) { this->ggs.setSelection(AddonId::FRONTIER_DISTANCE_REACHABLE, i); // addon is active on second run - world.GetPlayer(0).RecalcMilitaryFlags(); - world.GetPlayer(1).RecalcMilitaryFlags(); + world.getPlayer(0).RecalcMilitaryFlags(); + world.getPlayer(1).RecalcMilitaryFlags(); - FrontierDistance distance0 = milBld0->GetFrontierDistance(); - FrontierDistance distance1 = milBld1->GetFrontierDistance(); + FrontierDistance distance0 = milBld0->getFrontierDistance(); + FrontierDistance distance1 = milBld1->getFrontierDistance(); BOOST_TEST_REQUIRE(distance0 == distance1); BOOST_TEST_REQUIRE(distance0 == FrontierDistance::Mid); @@ -287,24 +287,24 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceBug_815, WorldBig) { this->ggs.setSelection(AddonId::FRONTIER_DISTANCE_REACHABLE, 1); - GamePlayer& p0 = world.GetPlayer(0); - GamePlayer& p1 = world.GetPlayer(1); + GamePlayer& p0 = world.getPlayer(0); + GamePlayer& p1 = world.getPlayer(1); - const DescIdx tWater = GetWaterTerrain(world.GetDescription()); + const DescIdx tWater = GetWaterTerrain(world.getDescription()); - unsigned middle = world.GetWidth() / 2; + unsigned middle = world.getWidth() / 2; - for(const auto y : helpers::range(1, +world.GetHeight())) + for(const auto y : helpers::range(1, +world.getHeight())) { - for(const auto x : helpers::range(1, +world.GetWidth())) + for(const auto x : helpers::range(1, +world.getWidth())) { MapPoint curPoint(x, y); // get an island - if(curPoint.x < 10 || curPoint.x > world.GetWidth() - 10 || curPoint.y < 10 - || curPoint.y > world.GetHeight() - 10) + if(curPoint.x < 10 || curPoint.x > world.getWidth() - 10 || curPoint.y < 10 + || curPoint.y > world.getHeight() - 10) { - MapNode& mapPoint = world.GetNodeWriteable(curPoint); + MapNode& mapPoint = world.getNodeWriteable(curPoint); mapPoint.t1 = tWater; mapPoint.t2 = tWater; continue; @@ -313,16 +313,16 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceBug_815, WorldBig) // get bottleneck'ed passage on north of the island if((curPoint.x >= middle - 2 && curPoint.x <= middle + 2) && (curPoint.y > 20)) { - MapNode& mapPoint = world.GetNodeWriteable(curPoint); + MapNode& mapPoint = world.getNodeWriteable(curPoint); mapPoint.t1 = tWater; mapPoint.t2 = tWater; continue; } // get some water from the bottle neck to the west/east of the island - if(curPoint.x > 12 && curPoint.x < world.GetWidth() - 12 && curPoint.y > 20 && curPoint.y < 25) + if(curPoint.x > 12 && curPoint.x < world.getWidth() - 12 && curPoint.y > 20 && curPoint.y < 25) { - MapNode& mapPoint = world.GetNodeWriteable(curPoint); + MapNode& mapPoint = world.getNodeWriteable(curPoint); mapPoint.t1 = tWater; mapPoint.t2 = tWater; continue; @@ -332,21 +332,21 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceBug_815, WorldBig) // side of p1 outside the bottle neck, this building will cause the bug MapPoint p1Far(middle + 5, 30); - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, p1Far, p1.GetPlayerId(), Nation::Romans); + BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, p1Far, p1.getPlayerId(), Nation::Romans); // p1 s building, which should cause a frontier distance "near" MapPoint p1Near(middle + 5, 15); auto* milBld1 = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, p1Near, p1.GetPlayerId(), Nation::Romans)); + BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, p1Near, p1.getPlayerId(), Nation::Romans)); // p0 s building, should be near, like p1 s but, will be far cause p1Far cant be reached (patch is longer then 40 // units). It will override the NEAR-Distance from P1Near, when evaluating P1Far MapPoint p0Near(middle - 5, 15); auto* milBld0 = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, p0Near, p0.GetPlayerId(), Nation::Romans)); + BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, p0Near, p0.getPlayerId(), Nation::Romans)); - FrontierDistance distance0 = milBld0->GetFrontierDistance(); - FrontierDistance distance1 = milBld1->GetFrontierDistance(); + FrontierDistance distance0 = milBld0->getFrontierDistance(); + FrontierDistance distance1 = milBld1->getFrontierDistance(); BOOST_TEST_REQUIRE(distance0 == FrontierDistance::Near); BOOST_TEST_REQUIRE(distance1 == FrontierDistance::Near); @@ -354,18 +354,18 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceBug_815, WorldBig) BOOST_FIXTURE_TEST_CASE(FrontierDistanceReachabilityConsidersStaticObjectBlockers, FrontierWorldStaticBlocker) { - const DescIdx tWater = GetWaterTerrain(world.GetDescription()); + const DescIdx tWater = GetWaterTerrain(world.getDescription()); const unsigned corridorY = 6; const MapPoint startPt(2, corridorY); const MapPoint endPt(10, corridorY); constexpr unsigned maxPathLen = 8; - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { if(pt.y == corridorY && pt.x >= startPt.x && pt.x <= endPt.x) continue; - MapNode& node = world.GetNodeWriteable(pt); + MapNode& node = world.getNodeWriteable(pt); node.t1 = tWater; node.t2 = tWater; } @@ -376,7 +376,7 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceReachabilityConsidersStaticObjectBlocker { const MapPoint passablePt(x, corridorY); world.DestroyNO(passablePt, false); - world.SetNO(passablePt, new noStaticObject(passablePt, 0, 0, 0)); + world.setNO(passablePt, new noStaticObject(passablePt, 0, 0, 0)); } BOOST_TEST_REQUIRE(DoesReachablePathExist(world, startPt, endPt, maxPathLen)); @@ -385,7 +385,7 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceReachabilityConsidersStaticObjectBlocker { const MapPoint passablePt(x, corridorY); world.DestroyNO(passablePt, false); - world.SetNO(passablePt, new noEnvObject(passablePt, 0, 0)); + world.setNO(passablePt, new noEnvObject(passablePt, 0, 0)); } BOOST_TEST_REQUIRE(DoesReachablePathExist(world, startPt, endPt, maxPathLen)); @@ -394,7 +394,7 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceReachabilityConsidersStaticObjectBlocker { const MapPoint blockerPt(x, corridorY); world.DestroyNO(blockerPt, false); - world.SetNO(blockerPt, new noStaticObject(blockerPt, 0, 0, 1)); + world.setNO(blockerPt, new noStaticObject(blockerPt, 0, 0, 1)); } BOOST_TEST_REQUIRE(!DoesReachablePathExist(world, startPt, endPt, maxPathLen)); diff --git a/tests/s25Main/integration/testGameCommands.cpp b/tests/s25Main/integration/testGameCommands.cpp index 72c3363e82..a8cf2d0eb7 100644 --- a/tests/s25Main/integration/testGameCommands.cpp +++ b/tests/s25Main/integration/testGameCommands.cpp @@ -100,46 +100,46 @@ BOOST_FIXTURE_TEST_CASE(PlaceFlagTest, WorldWithGCExecution2P) curPlayer = 1; this->SetFlag(flagPt); // Wrong terrain - BOOST_TEST_REQUIRE(!world.GetSpecObj(flagPt)); + BOOST_TEST_REQUIRE(!world.getSpecObj(flagPt)); curPlayer = 0; this->SetFlag(flagPt); - BOOST_TEST_REQUIRE(world.GetNO(flagPt)->GetType() == NodalObjectType::Flag); - auto* flag = world.GetSpecObj(flagPt); + BOOST_TEST_REQUIRE(world.getNO(flagPt)->getType() == NodalObjectType::Flag); + auto* flag = world.getSpecObj(flagPt); BOOST_TEST_REQUIRE(flag); - BOOST_TEST_REQUIRE(flag->GetPos() == flagPt); - BOOST_TEST_REQUIRE(flag->GetPlayer() == 0); + BOOST_TEST_REQUIRE(flag->getPos() == flagPt); + BOOST_TEST_REQUIRE(flag->getPlayer() == 0); // Flag blocked - BOOST_TEST_REQUIRE(world.GetNeighbourNode(flagPt, Direction::West).bq == BuildingQuality::Nothing); - BOOST_TEST_REQUIRE(world.GetNeighbourNode(flagPt, Direction::NorthEast).bq == BuildingQuality::Nothing); + BOOST_TEST_REQUIRE(world.getNeighbourNode(flagPt, Direction::West).bq == BuildingQuality::Nothing); + BOOST_TEST_REQUIRE(world.getNeighbourNode(flagPt, Direction::NorthEast).bq == BuildingQuality::Nothing); // This flag = house flag - BOOST_TEST_REQUIRE(world.GetNeighbourNode(flagPt, Direction::NorthWest).bq == BuildingQuality::Castle); + BOOST_TEST_REQUIRE(world.getNeighbourNode(flagPt, Direction::NorthWest).bq == BuildingQuality::Castle); // Flag blocks castle - BOOST_TEST_REQUIRE(world.GetNeighbourNode(flagPt, Direction::East).bq == BuildingQuality::House); - BOOST_TEST_REQUIRE(world.GetNeighbourNode(flagPt, Direction::SouthEast).bq == BuildingQuality::House); - BOOST_TEST_REQUIRE(world.GetNeighbourNode(flagPt, Direction::SouthWest).bq == BuildingQuality::House); + BOOST_TEST_REQUIRE(world.getNeighbourNode(flagPt, Direction::East).bq == BuildingQuality::House); + BOOST_TEST_REQUIRE(world.getNeighbourNode(flagPt, Direction::SouthEast).bq == BuildingQuality::House); + BOOST_TEST_REQUIRE(world.getNeighbourNode(flagPt, Direction::SouthWest).bq == BuildingQuality::House); // Place flag again this->SetFlag(flagPt); // Nothing should be changed - BOOST_TEST_REQUIRE(world.GetSpecObj(flagPt) == flag); + BOOST_TEST_REQUIRE(world.getSpecObj(flagPt) == flag); // Place flag at neighbour - for(const MapPoint curPt : world.GetNeighbours(flagPt)) + for(const MapPoint curPt : world.getNeighbours(flagPt)) { this->SetFlag(curPt); // Should not work - BOOST_TEST_REQUIRE(!world.GetSpecObj(curPt)); + BOOST_TEST_REQUIRE(!world.getSpecObj(curPt)); } - unsigned objCt = GameObject::GetNumObjs(); + unsigned objCt = GameObject::getNumObjs(); this->DestroyFlag(flagPt); // Removed from map - BOOST_TEST_REQUIRE(world.GetNO(flagPt)->GetType() == NodalObjectType::Nothing); + BOOST_TEST_REQUIRE(world.getNO(flagPt)->getType() == NodalObjectType::Nothing); // Removed from game - BOOST_TEST_REQUIRE(GameObject::GetNumObjs() == objCt - 1); + BOOST_TEST_REQUIRE(GameObject::getNumObjs() == objCt - 1); // And everything clear now - for(const MapPoint nb : world.GetNeighbours(flagPt)) - BOOST_TEST_REQUIRE(world.GetNode(nb).bq == BuildingQuality::Castle); + for(const MapPoint nb : world.getNeighbours(flagPt)) + BOOST_TEST_REQUIRE(world.getNode(nb).bq == BuildingQuality::Castle); } BOOST_FIXTURE_TEST_CASE(BuildRoadTest, WorldWithGCExecution2P) @@ -152,85 +152,85 @@ BOOST_FIXTURE_TEST_CASE(BuildRoadTest, WorldWithGCExecution2P) // a1) invalid start pt -> No road this->BuildRoad(flagPt + MapPoint(2, 0), false, std::vector(4, Direction::East)); for(unsigned i = 0; i < 6; i++) - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); // a2) invalid player curPlayer = 1; this->BuildRoad(flagPt, false, std::vector(4, Direction::East)); for(unsigned i = 0; i < 6; i++) - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); curPlayer = 0; // b) Flag->Flag ->OK this->BuildRoad(flagPt, false, std::vector(4, Direction::East)); for(unsigned i = 0; i < 4; i++) { - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); // Same but in opposite direction - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i + 1, 0), Direction::West) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i + 1, 0), Direction::West) == PointRoad::Normal); } // End of road - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(4, 0), Direction::East) == PointRoad::None); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(4, 0), Direction::East) == PointRoad::None); // BQ on road - BOOST_TEST_REQUIRE(world.GetNode(flagPt + MapPoint(1, 0)).bq == BuildingQuality::Nothing); - BOOST_TEST_REQUIRE(world.GetNode(flagPt + MapPoint(2, 0)).bq == BuildingQuality::Flag); - BOOST_TEST_REQUIRE(world.GetNode(flagPt + MapPoint(3, 0)).bq == BuildingQuality::Nothing); - BOOST_TEST_REQUIRE(world.GetNode(flagPt + MapPoint(4, 0)).bq == BuildingQuality::Nothing); + BOOST_TEST_REQUIRE(world.getNode(flagPt + MapPoint(1, 0)).bq == BuildingQuality::Nothing); + BOOST_TEST_REQUIRE(world.getNode(flagPt + MapPoint(2, 0)).bq == BuildingQuality::Flag); + BOOST_TEST_REQUIRE(world.getNode(flagPt + MapPoint(3, 0)).bq == BuildingQuality::Nothing); + BOOST_TEST_REQUIRE(world.getNode(flagPt + MapPoint(4, 0)).bq == BuildingQuality::Nothing); // BQ above road - BOOST_TEST_REQUIRE(world.GetNeighbourNode(flagPt + MapPoint(2, 0), Direction::NorthWest).bq + BOOST_TEST_REQUIRE(world.getNeighbourNode(flagPt + MapPoint(2, 0), Direction::NorthWest).bq == BuildingQuality::Castle); // Flag could be build - BOOST_TEST_REQUIRE(world.GetNeighbourNode(flagPt + MapPoint(2, 0), Direction::NorthEast).bq + BOOST_TEST_REQUIRE(world.getNeighbourNode(flagPt + MapPoint(2, 0), Direction::NorthEast).bq == BuildingQuality::Flag); // only flag possible // BQ below road (Castle blocked by road) - BOOST_TEST_REQUIRE(world.GetNeighbourNode(flagPt + MapPoint(2, 0), Direction::SouthEast).bq + BOOST_TEST_REQUIRE(world.getNeighbourNode(flagPt + MapPoint(2, 0), Direction::SouthEast).bq == BuildingQuality::House); - BOOST_TEST_REQUIRE(world.GetNeighbourNode(flagPt + MapPoint(2, 0), Direction::SouthWest).bq + BOOST_TEST_REQUIRE(world.getNeighbourNode(flagPt + MapPoint(2, 0), Direction::SouthWest).bq == BuildingQuality::House); // Set another flag on the road // c) to close this->SetFlag(flagPt + MapPoint(1, 0)); - BOOST_TEST_REQUIRE(world.GetNO(flagPt + MapPoint(1, 0))->GetType() == NodalObjectType::Nothing); + BOOST_TEST_REQUIRE(world.getNO(flagPt + MapPoint(1, 0))->getType() == NodalObjectType::Nothing); // d) middle -> ok this->SetFlag(flagPt + MapPoint(2, 0)); - BOOST_TEST_REQUIRE(world.GetNO(flagPt + MapPoint(2, 0))->GetType() == NodalObjectType::Flag); //-V807 - BOOST_TEST_REQUIRE(world.GetNeighbourNode(flagPt + MapPoint(2, 0), Direction::NorthWest).bq + BOOST_TEST_REQUIRE(world.getNO(flagPt + MapPoint(2, 0))->getType() == NodalObjectType::Flag); //-V807 + BOOST_TEST_REQUIRE(world.getNeighbourNode(flagPt + MapPoint(2, 0), Direction::NorthWest).bq == BuildingQuality::Castle); // Flag could be build - BOOST_TEST_REQUIRE(world.GetNeighbourNode(flagPt + MapPoint(2, 0), Direction::NorthEast).bq + BOOST_TEST_REQUIRE(world.getNeighbourNode(flagPt + MapPoint(2, 0), Direction::NorthEast).bq == BuildingQuality::Nothing); // no more flag possible // f) destroy middle flag -> Road destroyed this->DestroyFlag(flagPt + MapPoint(2, 0)); for(unsigned i = 0; i < 4; i++) - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); this->DestroyFlag(flagPt + MapPoint(4, 0)); // g) Road with no existing end flag -> Build road and place flag if possible // g1) Other flag to close this->SetFlag(flagPt + MapPoint(3, 0)); this->BuildRoad(flagPt, false, std::vector(2, Direction::East)); - BOOST_TEST_REQUIRE(world.GetNO(flagPt + MapPoint(2, 0))->GetType() == NodalObjectType::Nothing); + BOOST_TEST_REQUIRE(world.getNO(flagPt + MapPoint(2, 0))->getType() == NodalObjectType::Nothing); for(unsigned i = 0; i < 3; i++) - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); this->DestroyFlag(flagPt + MapPoint(3, 0)); // g2) Building to close this->SetBuildingSite(flagPt + MapPoint(3, 0), BuildingType::Farm); this->BuildRoad(flagPt, false, std::vector(2, Direction::East)); - BOOST_TEST_REQUIRE(world.GetNO(flagPt + MapPoint(2, 0))->GetType() != NodalObjectType::Flag); + BOOST_TEST_REQUIRE(world.getNO(flagPt + MapPoint(2, 0))->getType() != NodalObjectType::Flag); for(unsigned i = 0; i < 2; i++) - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); - this->DestroyFlag(world.GetNeighbour(flagPt + MapPoint(3, 0), Direction::SouthEast)); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); + this->DestroyFlag(world.getNeighbour(flagPt + MapPoint(3, 0), Direction::SouthEast)); // g3) Nothing objectionable this->BuildRoad(flagPt, false, std::vector(2, Direction::East)); - BOOST_TEST_REQUIRE(world.GetNO(flagPt + MapPoint(2, 0))->GetType() == NodalObjectType::Flag); + BOOST_TEST_REQUIRE(world.getNO(flagPt + MapPoint(2, 0))->getType() == NodalObjectType::Flag); for(unsigned i = 0; i < 2; i++) - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); // h) Non-blocking env. object - world.SetNO(flagPt + MapPoint(3, 0), new noEnvObject(flagPt, 512)); - BOOST_TEST_REQUIRE(world.GetNO(flagPt + MapPoint(3, 0))->GetType() == NodalObjectType::Environment); + world.setNO(flagPt + MapPoint(3, 0), new noEnvObject(flagPt, 512)); + BOOST_TEST_REQUIRE(world.getNO(flagPt + MapPoint(3, 0))->getType() == NodalObjectType::Environment); this->BuildRoad(flagPt + MapPoint(2, 0), false, std::vector(2, Direction::East)); for(unsigned i = 2; i < 4; i++) - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); - BOOST_TEST_REQUIRE(world.GetNO(flagPt + MapPoint(3, 0))->GetType() == NodalObjectType::Nothing); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getNO(flagPt + MapPoint(3, 0))->getType() == NodalObjectType::Nothing); // Remove other flags this->DestroyFlag(flagPt + MapPoint(2, 0)); @@ -239,11 +239,11 @@ BOOST_FIXTURE_TEST_CASE(BuildRoadTest, WorldWithGCExecution2P) // i1) border this->BuildRoad(flagPt, false, std::vector(HQ_RADIUS - (flagPt.x - hqPos.x), Direction::East)); for(unsigned i = 0; i <= HQ_RADIUS; i++) - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); // i2) territory this->BuildRoad(flagPt, false, std::vector(HQ_RADIUS - (flagPt.x - hqPos.x) + 1, Direction::East)); for(unsigned i = 0; i <= HQ_RADIUS; i++) - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); } BOOST_FIXTURE_TEST_CASE(DestroyRoadTest, WorldWithGCExecution2P) @@ -255,96 +255,96 @@ BOOST_FIXTURE_TEST_CASE(DestroyRoadTest, WorldWithGCExecution2P) this->BuildRoad(flagPt, false, std::vector(2, Direction::East)); this->BuildRoad(flagPt2, false, std::vector(2, Direction::East)); for(unsigned i = 0; i < 4; i++) - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); // Destroy from middle of road -> fail this->DestroyRoad(flagPt2 + MapPoint(1, 0), Direction::East); for(unsigned i = 0; i < 4; i++) - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); // Wrong player -> Fail curPlayer = 1; this->DestroyRoad(flagPt2, Direction::East); for(unsigned i = 0; i < 4; i++) - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); // Wrong direction -> Fail curPlayer = 0; this->DestroyRoad(flagPt2, Direction::SouthEast); for(unsigned i = 0; i < 4; i++) - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); // Correct -> Succeed this->DestroyRoad(flagPt2, Direction::East); for(unsigned i = 0; i < 2; i++) { - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i + 2, 0), Direction::East) == PointRoad::None); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i + 2, 0), Direction::East) == PointRoad::None); } // Flags must still exist - BOOST_TEST_REQUIRE(world.GetSpecObj(flagPt)); - BOOST_TEST_REQUIRE(world.GetSpecObj(flagPt2)); - BOOST_TEST_REQUIRE(world.GetSpecObj(flagPt2 + MapPoint(2, 0))); + BOOST_TEST_REQUIRE(world.getSpecObj(flagPt)); + BOOST_TEST_REQUIRE(world.getSpecObj(flagPt2)); + BOOST_TEST_REQUIRE(world.getSpecObj(flagPt2 + MapPoint(2, 0))); // Rebuild this->BuildRoad(flagPt2, false, std::vector(2, Direction::East)); for(unsigned i = 0; i < 4; i++) - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::Normal); // Opposite dir this->DestroyRoad(flagPt2, Direction::West); for(unsigned i = 0; i < 2; i++) { - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i + 2, 0), Direction::East) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i + 2, 0), Direction::East) == PointRoad::Normal); } // Both this->DestroyRoad(flagPt2, Direction::East); for(unsigned i = 0; i < 4; i++) - BOOST_TEST_REQUIRE(world.GetPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); + BOOST_TEST_REQUIRE(world.getPointRoad(flagPt + MapPoint(i, 0), Direction::East) == PointRoad::None); // Flags must still exist - BOOST_TEST_REQUIRE(world.GetSpecObj(flagPt)); - BOOST_TEST_REQUIRE(world.GetSpecObj(flagPt2)); - BOOST_TEST_REQUIRE(world.GetSpecObj(flagPt2 + MapPoint(2, 0))); + BOOST_TEST_REQUIRE(world.getSpecObj(flagPt)); + BOOST_TEST_REQUIRE(world.getSpecObj(flagPt2)); + BOOST_TEST_REQUIRE(world.getSpecObj(flagPt2 + MapPoint(2, 0))); } BOOST_FIXTURE_TEST_CASE(UpgradeRoadTest, WorldWithGCExecution2P) { // 3 Roads, so we have a middle flag, and an additional road - const MapPoint hqFlagPos = world.GetNeighbour(hqPos, Direction::SouthEast); + const MapPoint hqFlagPos = world.getNeighbour(hqPos, Direction::SouthEast); this->BuildRoad(hqFlagPos, false, std::vector(2, Direction::East)); this->BuildRoad(hqFlagPos + MapPoint(2, 0), false, std::vector(2, Direction::East)); this->BuildRoad(hqFlagPos + MapPoint(4, 0), false, std::vector(2, Direction::East)); const MapPoint middleFlag = hqFlagPos + MapPoint(2, 0); - const noFlag* hqFlag = world.GetSpecObj(hqFlagPos); - const noFlag* flag = world.GetSpecObj(middleFlag); - const noFlag* flag2 = world.GetSpecObj(middleFlag + MapPoint(2, 0)); + const noFlag* hqFlag = world.getSpecObj(hqFlagPos); + const noFlag* flag = world.getSpecObj(middleFlag); + const noFlag* flag2 = world.getSpecObj(middleFlag + MapPoint(2, 0)); BOOST_TEST_REQUIRE(hqFlag); BOOST_TEST_REQUIRE(flag); BOOST_TEST_REQUIRE(flag2); - BOOST_TEST_REQUIRE(flag->GetFlagType() == FlagType::Normal); + BOOST_TEST_REQUIRE(flag->getFlagType() == FlagType::Normal); // No flag this->UpgradeRoad(middleFlag - MapPoint(1, 0), Direction::East); - BOOST_TEST_REQUIRE(flag->GetFlagType() == FlagType::Normal); + BOOST_TEST_REQUIRE(flag->getFlagType() == FlagType::Normal); // Wrong direction this->UpgradeRoad(middleFlag, Direction::SouthEast); - BOOST_TEST_REQUIRE(flag->GetFlagType() == FlagType::Normal); + BOOST_TEST_REQUIRE(flag->getFlagType() == FlagType::Normal); // Upgrading correctly but twice (2nd does nothing) for(unsigned i = 0; i < 2; i++) { // Correct this->UpgradeRoad(middleFlag, Direction::East); - BOOST_TEST(flag->GetFlagType() == FlagType::Large); - BOOST_TEST(flag2->GetFlagType() == FlagType::Large); - BOOST_TEST(hqFlag->GetFlagType() == FlagType::Normal); - BOOST_TEST(world.GetPointRoad(middleFlag, Direction::East) == PointRoad::Donkey); - BOOST_TEST(world.GetPointRoad(middleFlag + MapPoint(1, 0), Direction::East) == PointRoad::Donkey); - BOOST_TEST(world.GetPointRoad(middleFlag + MapPoint(2, 0), Direction::East) == PointRoad::Normal); - BOOST_TEST(world.GetPointRoad(middleFlag, Direction::West) == PointRoad::Normal); + BOOST_TEST(flag->getFlagType() == FlagType::Large); + BOOST_TEST(flag2->getFlagType() == FlagType::Large); + BOOST_TEST(hqFlag->getFlagType() == FlagType::Normal); + BOOST_TEST(world.getPointRoad(middleFlag, Direction::East) == PointRoad::Donkey); + BOOST_TEST(world.getPointRoad(middleFlag + MapPoint(1, 0), Direction::East) == PointRoad::Donkey); + BOOST_TEST(world.getPointRoad(middleFlag + MapPoint(2, 0), Direction::East) == PointRoad::Normal); + BOOST_TEST(world.getPointRoad(middleFlag, Direction::West) == PointRoad::Normal); } // Upgrade in other direction this->UpgradeRoad(middleFlag, Direction::West); - BOOST_TEST(flag->GetFlagType() == FlagType::Large); - BOOST_TEST(flag2->GetFlagType() == FlagType::Large); - BOOST_TEST(hqFlag->GetFlagType() == FlagType::Large); - BOOST_TEST(world.GetPointRoad(middleFlag, Direction::East) == PointRoad::Donkey); - BOOST_TEST(world.GetPointRoad(middleFlag + MapPoint(1, 0), Direction::East) == PointRoad::Donkey); - BOOST_TEST(world.GetPointRoad(middleFlag + MapPoint(2, 0), Direction::East) == PointRoad::Normal); - BOOST_TEST(world.GetPointRoad(middleFlag, Direction::West) == PointRoad::Donkey); + BOOST_TEST(flag->getFlagType() == FlagType::Large); + BOOST_TEST(flag2->getFlagType() == FlagType::Large); + BOOST_TEST(hqFlag->getFlagType() == FlagType::Large); + BOOST_TEST(world.getPointRoad(middleFlag, Direction::East) == PointRoad::Donkey); + BOOST_TEST(world.getPointRoad(middleFlag + MapPoint(1, 0), Direction::East) == PointRoad::Donkey); + BOOST_TEST(world.getPointRoad(middleFlag + MapPoint(2, 0), Direction::East) == PointRoad::Normal); + BOOST_TEST(world.getPointRoad(middleFlag, Direction::West) == PointRoad::Donkey); } BOOST_FIXTURE_TEST_CASE(PlayerEconomySettings, WorldWithGCExecution2P) @@ -358,7 +358,7 @@ BOOST_FIXTURE_TEST_CASE(PlayerEconomySettings, WorldWithGCExecution2P) this->ChangeDistribution(inDist); bool orderType = rand() % 2 == 0; - BuildOrders inBuildOrder = GamePlayer::GetStandardBuildOrder(); + BuildOrders inBuildOrder = GamePlayer::getStandardBuildOrder(); std::shuffle(inBuildOrder.begin(), inBuildOrder.end(), rttr::test::getRandState()); this->ChangeBuildOrder(orderType, inBuildOrder); @@ -378,7 +378,7 @@ BOOST_FIXTURE_TEST_CASE(PlayerEconomySettings, WorldWithGCExecution2P) toolPrio = rand() % 11; this->ChangeTools(toolPrios); - const GamePlayer& player = world.GetPlayer(curPlayer); + const GamePlayer& player = world.getPlayer(curPlayer); // TODO: Use better getters once available VisualSettings outSettings; player.FillVisualSettings(outSettings); @@ -390,11 +390,11 @@ BOOST_FIXTURE_TEST_CASE(PlayerEconomySettings, WorldWithGCExecution2P) for(unsigned i = 0; i < inTransportOrder.size(); i++) BOOST_TEST_REQUIRE(outSettings.transport_order[i] == inTransportOrder[i]); for(const auto i : helpers::enumRange()) - BOOST_TEST_REQUIRE(player.GetTransportPriority(i) == GetTransportPrioFromOrdering(inTransportOrder, i)); + BOOST_TEST_REQUIRE(player.getTransportPriority(i) == getTransportPrioFromOrdering(inTransportOrder, i)); for(unsigned i = 0; i < militarySettings.size(); i++) - BOOST_TEST_REQUIRE(player.GetMilitarySetting(i) == militarySettings[i]); + BOOST_TEST_REQUIRE(player.getMilitarySetting(i) == militarySettings[i]); for(const auto i : helpers::enumRange()) - BOOST_TEST_REQUIRE(player.GetToolPriority(i) == toolPrios[i]); + BOOST_TEST_REQUIRE(player.getToolPriority(i) == toolPrios[i]); } } @@ -409,56 +409,56 @@ BOOST_FIXTURE_TEST_CASE(BuildBuilding, WorldWithGCExecution2P) const MapPoint okMilPt = hqPos - MapPoint(5, 0); // Wrong BQ (blocked by HQ) this->SetBuildingSite(closePt, BuildingType::Farm); - BOOST_TEST_REQUIRE(world.GetNO(closePt)->GetType() == NodalObjectType::Nothing); //-V807 + BOOST_TEST_REQUIRE(world.getNO(closePt)->getType() == NodalObjectType::Nothing); //-V807 // OK this->SetBuildingSite(closePt, BuildingType::Woodcutter); - BOOST_TEST_REQUIRE(world.GetNO(closePt)->GetType() == NodalObjectType::Buildingsite); - BOOST_TEST_REQUIRE(world.GetSpecObj(closePt)->GetBuildingType() == BuildingType::Woodcutter); - BOOST_TEST_REQUIRE(world.GetNO(world.GetNeighbour(closePt, Direction::SouthEast))->GetType() + BOOST_TEST_REQUIRE(world.getNO(closePt)->getType() == NodalObjectType::Buildingsite); + BOOST_TEST_REQUIRE(world.getSpecObj(closePt)->getBuildingType() == BuildingType::Woodcutter); + BOOST_TEST_REQUIRE(world.getNO(world.getNeighbour(closePt, Direction::SouthEast))->getType() == NodalObjectType::Flag); // OK this->SetBuildingSite(farmPt, BuildingType::Farm); - BOOST_TEST_REQUIRE(world.GetNO(farmPt)->GetType() == NodalObjectType::Buildingsite); - BOOST_TEST_REQUIRE(world.GetSpecObj(farmPt)->GetBuildingType() == BuildingType::Farm); - BOOST_TEST_REQUIRE(world.GetNO(world.GetNeighbour(farmPt, Direction::SouthEast))->GetType() + BOOST_TEST_REQUIRE(world.getNO(farmPt)->getType() == NodalObjectType::Buildingsite); + BOOST_TEST_REQUIRE(world.getSpecObj(farmPt)->getBuildingType() == BuildingType::Farm); + BOOST_TEST_REQUIRE(world.getNO(world.getNeighbour(farmPt, Direction::SouthEast))->getType() == NodalObjectType::Flag); // Millitary bld to close this->SetBuildingSite(closeMilPt, BuildingType::Barracks); - BOOST_TEST_REQUIRE(world.GetNO(closeMilPt)->GetType() == NodalObjectType::Nothing); + BOOST_TEST_REQUIRE(world.getNO(closeMilPt)->getType() == NodalObjectType::Nothing); // Millitary bld ok this->SetBuildingSite(okMilPt, BuildingType::Barracks); - BOOST_TEST_REQUIRE(world.GetNO(okMilPt)->GetType() == NodalObjectType::Buildingsite); - BOOST_TEST_REQUIRE(world.GetSpecObj(okMilPt)->GetBuildingType() == BuildingType::Barracks); - BOOST_TEST_REQUIRE(world.GetNO(world.GetNeighbour(okMilPt, Direction::SouthEast))->GetType() + BOOST_TEST_REQUIRE(world.getNO(okMilPt)->getType() == NodalObjectType::Buildingsite); + BOOST_TEST_REQUIRE(world.getSpecObj(okMilPt)->getBuildingType() == BuildingType::Barracks); + BOOST_TEST_REQUIRE(world.getNO(world.getNeighbour(okMilPt, Direction::SouthEast))->getType() == NodalObjectType::Flag); // Remove bld this->DestroyBuilding(farmPt); - BOOST_TEST_REQUIRE(world.GetNO(farmPt)->GetType() == NodalObjectType::Nothing); - BOOST_TEST_REQUIRE(world.GetNO(world.GetNeighbour(farmPt, Direction::SouthEast))->GetType() + BOOST_TEST_REQUIRE(world.getNO(farmPt)->getType() == NodalObjectType::Nothing); + BOOST_TEST_REQUIRE(world.getNO(world.getNeighbour(farmPt, Direction::SouthEast))->getType() == NodalObjectType::Flag); // Remove flag -> bld also destroyed - this->DestroyFlag(world.GetNeighbour(okMilPt, Direction::SouthEast)); - BOOST_TEST_REQUIRE(world.GetNO(okMilPt)->GetType() == NodalObjectType::Nothing); - BOOST_TEST_REQUIRE(world.GetNO(world.GetNeighbour(okMilPt, Direction::SouthEast))->GetType() + this->DestroyFlag(world.getNeighbour(okMilPt, Direction::SouthEast)); + BOOST_TEST_REQUIRE(world.getNO(okMilPt)->getType() == NodalObjectType::Nothing); + BOOST_TEST_REQUIRE(world.getNO(world.getNeighbour(okMilPt, Direction::SouthEast))->getType() == NodalObjectType::Nothing); // Check if bld is build - this->BuildRoad(world.GetNeighbour(hqPos, Direction::SouthEast), false, std::vector(2, Direction::East)); - RTTR_EXEC_TILL(1200, world.GetNO(closePt)->GetType() == NodalObjectType::Building); - BOOST_TEST_REQUIRE(world.GetNO(closePt)->GetGOT() == GO_Type::NobUsual); - BOOST_TEST_REQUIRE(world.GetSpecObj(closePt)->GetBuildingType() == BuildingType::Woodcutter); + this->BuildRoad(world.getNeighbour(hqPos, Direction::SouthEast), false, std::vector(2, Direction::East)); + RTTR_EXEC_TILL(1200, world.getNO(closePt)->getType() == NodalObjectType::Building); + BOOST_TEST_REQUIRE(world.getNO(closePt)->getGOT() == GO_Type::NobUsual); + BOOST_TEST_REQUIRE(world.getSpecObj(closePt)->getBuildingType() == BuildingType::Woodcutter); // Destroy finished bld -> Fire this->DestroyBuilding(closePt); - BOOST_TEST_REQUIRE(world.GetNO(closePt)->GetType() == NodalObjectType::Fire); + BOOST_TEST_REQUIRE(world.getNO(closePt)->getType() == NodalObjectType::Fire); // Destroy twice -> Nothing happens this->DestroyBuilding(closePt); - BOOST_TEST_REQUIRE(world.GetNO(closePt)->GetType() == NodalObjectType::Fire); + BOOST_TEST_REQUIRE(world.getNO(closePt)->getType() == NodalObjectType::Fire); // Try to build on fire this->SetBuildingSite(closePt, BuildingType::Woodcutter); - BOOST_TEST_REQUIRE(world.GetNO(closePt)->GetType() == NodalObjectType::Fire); + BOOST_TEST_REQUIRE(world.getNO(closePt)->getType() == NodalObjectType::Fire); } BOOST_FIXTURE_TEST_CASE(SendSoldiersHomeTest, WorldWithGCExecution2P) @@ -467,10 +467,10 @@ BOOST_FIXTURE_TEST_CASE(SendSoldiersHomeTest, WorldWithGCExecution2P) const MapPoint milPt = hqPos + MapPoint(4, 0); // Setup: Give player 3 generals - GamePlayer& player = world.GetPlayer(curPlayer); - nobBaseWarehouse* wh = player.GetFirstWH(); + GamePlayer& player = world.getPlayer(curPlayer); + nobBaseWarehouse* wh = player.getFirstWH(); BOOST_TEST_REQUIRE(wh); - BOOST_TEST_REQUIRE(wh->GetInventory().people[Job::General] == 0u); //-V522 + BOOST_TEST_REQUIRE(wh->getInventory().people[Job::General] == 0u); //-V522 PeopleCounts soldiers; soldiers[Job::Private] = 10; soldiers[Job::PrivateFirstClass] = 1; @@ -479,7 +479,7 @@ BOOST_FIXTURE_TEST_CASE(SendSoldiersHomeTest, WorldWithGCExecution2P) soldiers[Job::General] = 2; wh->AddToInventory(soldiers, true); // Don't keep any reserve - for(unsigned i = 0; i <= this->ggs.GetMaxMilitaryRank(); ++i) + for(unsigned i = 0; i <= this->ggs.getMaxMilitaryRank(); ++i) this->ChangeReserve(hqPos, i, 0); // Set all military stuff to max this->ChangeMilitary(MILITARY_SETTINGS_SCALE); @@ -487,19 +487,19 @@ BOOST_FIXTURE_TEST_CASE(SendSoldiersHomeTest, WorldWithGCExecution2P) auto* bld = dynamic_cast( BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, milPt, curPlayer, player.nation)); BOOST_TEST_REQUIRE(bld); - this->BuildRoad(world.GetNeighbour(hqPos, Direction::SouthEast), false, + this->BuildRoad(world.getNeighbour(hqPos, Direction::SouthEast), false, std::vector((milPt.x - hqPos.x), Direction::East)); // Now run some GFs so the bld is occupied (<=30GFs/per Soldier for leaving HQ, 20GFs per node walked (distance + to // and from flag), 30GFs for leaving carrier) unsigned numGFtillAllArrive = 30 * 6 + 20 * (milPt.x - hqPos.x + 2) + 30; RTTR_SKIP_GFS(numGFtillAllArrive); // Now we should have 1 each of ranks 0-3 and 2 rank 4s - BOOST_TEST_REQUIRE(bld->GetNumTroops() == 6u); //-V522 - auto itTroops = bld->GetTroops().begin(); + BOOST_TEST_REQUIRE(bld->getNumTroops() == 6u); //-V522 + auto itTroops = bld->getTroops().begin(); for(unsigned i = 0; i < 4; i++, ++itTroops) - BOOST_TEST_REQUIRE(itTroops->GetRank() == i); + BOOST_TEST_REQUIRE(itTroops->getRank() == i); for(unsigned i = 0; i < 2; i++, ++itTroops) - BOOST_TEST_REQUIRE(itTroops->GetRank() == 4); + BOOST_TEST_REQUIRE(itTroops->getRank() == 4); // End preparation unsigned expectedTroopCt = 6u; @@ -508,30 +508,30 @@ BOOST_FIXTURE_TEST_CASE(SendSoldiersHomeTest, WorldWithGCExecution2P) { this->SetTroopLimit(milPt, curRank, 0); expectedTroopCt -= (curRank == 4) ? 2 : 1; // 2 generals, 1 of the others - BOOST_TEST_REQUIRE(bld->GetNumTroops() == expectedTroopCt); - itTroops = bld->GetTroops().begin(); + BOOST_TEST_REQUIRE(bld->getNumTroops() == expectedTroopCt); + itTroops = bld->getTroops().begin(); for(unsigned i = 0; i < expectedTroopCt; i++, ++itTroops) - BOOST_TEST_REQUIRE(itTroops->GetRank() == i); + BOOST_TEST_REQUIRE(itTroops->getRank() == i); } // One low rank is left - BOOST_TEST_REQUIRE(bld->GetNumTroops() == 1u); + BOOST_TEST_REQUIRE(bld->getNumTroops() == 1u); this->SetTroopLimit(milPt, 0, 0); // But he must stay - BOOST_TEST_REQUIRE(bld->GetNumTroops() == 1u); + BOOST_TEST_REQUIRE(bld->getNumTroops() == 1u); this->SetTroopLimit(milPt, 0, 6); // Wait till new soldiers have arrived RTTR_SKIP_GFS(numGFtillAllArrive); // 6 low ranks - BOOST_TEST_REQUIRE(bld->GetNumTroops() == 6u); - itTroops = bld->GetTroops().begin(); + BOOST_TEST_REQUIRE(bld->getNumTroops() == 6u); + itTroops = bld->getTroops().begin(); for(unsigned i = 0; i < 6; i++, ++itTroops) - BOOST_TEST_REQUIRE(itTroops->GetRank() == 0u); + BOOST_TEST_REQUIRE(itTroops->getRank() == 0u); // Send 5 of them home this->SetTroopLimit(milPt, 0, 1); - BOOST_TEST_REQUIRE(bld->GetNumTroops() == 1u); + BOOST_TEST_REQUIRE(bld->getNumTroops() == 1u); for(unsigned curRank = 4; curRank > 0; --curRank) this->SetTroopLimit(milPt, curRank, 6); @@ -540,7 +540,7 @@ BOOST_FIXTURE_TEST_CASE(SendSoldiersHomeTest, WorldWithGCExecution2P) // All higher rank soldiers should have been ordered and hence removed from the real inventory for(unsigned i = 1; i < SOLDIER_JOBS.size(); i++) - BOOST_TEST_REQUIRE(wh->GetNumRealFigures(SOLDIER_JOBS[i]) == 0u); + BOOST_TEST_REQUIRE(wh->getNumRealFigures(SOLDIER_JOBS[i]) == 0u); // Allow one of them to leave the HQ RTTR_SKIP_GFS(40); @@ -553,69 +553,69 @@ BOOST_FIXTURE_TEST_CASE(SendSoldiersHomeTest, WorldWithGCExecution2P) RTTR_SKIP_GFS(numGFtillAllArrive); // 3 low ranks and 1 each of other ranks except general - BOOST_TEST_REQUIRE(bld->GetNumTroops() == 6u); - itTroops = bld->GetTroops().begin(); + BOOST_TEST_REQUIRE(bld->getNumTroops() == 6u); + itTroops = bld->getTroops().begin(); for(unsigned i = 0; i < 3; i++, ++itTroops) - BOOST_TEST_REQUIRE(itTroops->GetRank() == 0u); + BOOST_TEST_REQUIRE(itTroops->getRank() == 0u); for(unsigned i = 1; i < 3; i++, ++itTroops) - BOOST_TEST_REQUIRE(itTroops->GetRank() == i); + BOOST_TEST_REQUIRE(itTroops->getRank() == i); } namespace { void FlagWorkerTest(WorldWithGCExecution2P& worldFixture, Job workerJob, GoodType toolType) { worldFixture.addStartResources(); - const MapPoint flagPt = worldFixture.world.GetNeighbour(worldFixture.hqPos, Direction::SouthEast) + MapPoint(3, 0); - GamePlayer& player = worldFixture.world.GetPlayer(worldFixture.curPlayer); - nobBaseWarehouse* wh = player.GetFirstWH(); + const MapPoint flagPt = worldFixture.world.getNeighbour(worldFixture.hqPos, Direction::SouthEast) + MapPoint(3, 0); + GamePlayer& player = worldFixture.world.getPlayer(worldFixture.curPlayer); + nobBaseWarehouse* wh = player.getFirstWH(); BOOST_TEST_REQUIRE(wh); - const unsigned startFigureCt = wh->GetNumRealFigures(workerJob); //-V522 - const unsigned startToolsCt = wh->GetNumRealWares(toolType); + const unsigned startFigureCt = wh->getNumRealFigures(workerJob); //-V522 + const unsigned startToolsCt = wh->getNumRealWares(toolType); // We need some of them! BOOST_TEST_REQUIRE(startFigureCt > 0u); BOOST_TEST_REQUIRE(startToolsCt > 0u); // No flag -> Nothing happens worldFixture.CallSpecialist(flagPt, workerJob); - BOOST_TEST_REQUIRE(wh->GetNumRealFigures(workerJob) == startFigureCt); - BOOST_TEST_REQUIRE(wh->GetLeavingFigures().empty()); //-V807 + BOOST_TEST_REQUIRE(wh->getNumRealFigures(workerJob) == startFigureCt); + BOOST_TEST_REQUIRE(wh->getLeavingFigures().empty()); //-V807 worldFixture.SetFlag(flagPt); // Unconnected flag -> Nothing happens worldFixture.CallSpecialist(flagPt, workerJob); - BOOST_TEST_REQUIRE(wh->GetNumRealFigures(workerJob) == startFigureCt); - BOOST_TEST_REQUIRE(wh->GetLeavingFigures().empty()); + BOOST_TEST_REQUIRE(wh->getNumRealFigures(workerJob) == startFigureCt); + BOOST_TEST_REQUIRE(wh->getLeavingFigures().empty()); // Build road and let worker leave worldFixture.BuildRoad(flagPt, false, std::vector(3, Direction::West)); for(unsigned i = 0; i < 30; i++) worldFixture.em.ExecuteNextGF(); - BOOST_TEST_REQUIRE(wh->GetLeavingFigures().empty()); + BOOST_TEST_REQUIRE(wh->getLeavingFigures().empty()); // Call one geologist to flag worldFixture.CallSpecialist(flagPt, workerJob); - BOOST_TEST_REQUIRE(wh->GetNumRealFigures(workerJob) + 1 == startFigureCt); - BOOST_TEST_REQUIRE(wh->GetLeavingFigures().size() == 1u); - BOOST_TEST_REQUIRE(wh->GetLeavingFigures().front().GetJobType() == workerJob); + BOOST_TEST_REQUIRE(wh->getNumRealFigures(workerJob) + 1 == startFigureCt); + BOOST_TEST_REQUIRE(wh->getLeavingFigures().size() == 1u); + BOOST_TEST_REQUIRE(wh->getLeavingFigures().front().getJobType() == workerJob); // Call remaining ones for(unsigned i = 1; i < startFigureCt; i++) worldFixture.CallSpecialist(flagPt, workerJob); - BOOST_TEST_REQUIRE(wh->GetNumRealFigures(workerJob) == 0u); - BOOST_TEST_REQUIRE(wh->GetLeavingFigures().size() == startFigureCt); + BOOST_TEST_REQUIRE(wh->getNumRealFigures(workerJob) == 0u); + BOOST_TEST_REQUIRE(wh->getLeavingFigures().size() == startFigureCt); // Recruit all possible ones - BOOST_TEST_REQUIRE(wh->GetNumRealWares(toolType) == startToolsCt); + BOOST_TEST_REQUIRE(wh->getNumRealWares(toolType) == startToolsCt); for(unsigned i = 0; i < startToolsCt; i++) worldFixture.CallSpecialist(flagPt, workerJob); - BOOST_TEST_REQUIRE(wh->GetNumRealFigures(workerJob) == 0u); - BOOST_TEST_REQUIRE(wh->GetLeavingFigures().size() == startFigureCt + startToolsCt); + BOOST_TEST_REQUIRE(wh->getNumRealFigures(workerJob) == 0u); + BOOST_TEST_REQUIRE(wh->getLeavingFigures().size() == startFigureCt + startToolsCt); // And an extra one -> Fail worldFixture.CallSpecialist(flagPt, workerJob); - BOOST_TEST_REQUIRE(wh->GetNumRealFigures(workerJob) == 0u); - BOOST_TEST_REQUIRE(wh->GetLeavingFigures().size() == startFigureCt + startToolsCt); + BOOST_TEST_REQUIRE(wh->getNumRealFigures(workerJob) == 0u); + BOOST_TEST_REQUIRE(wh->getLeavingFigures().size() == startFigureCt + startToolsCt); } } // namespace @@ -639,25 +639,25 @@ BOOST_FIXTURE_TEST_CASE(ChangeCoinAccept, WorldWithGCExecution2P) auto* bld = dynamic_cast( BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, bldPt, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(bld); - BOOST_TEST_REQUIRE(!bld->IsGoldDisabled()); //-V522 + BOOST_TEST_REQUIRE(!bld->isGoldDisabled()); //-V522 // Enable (already is) this->SetCoinsAllowed(bldPt, true); - BOOST_TEST_REQUIRE(!bld->IsGoldDisabled()); + BOOST_TEST_REQUIRE(!bld->isGoldDisabled()); // Disable this->SetCoinsAllowed(bldPt, false); - BOOST_TEST_REQUIRE(bld->IsGoldDisabled()); + BOOST_TEST_REQUIRE(bld->isGoldDisabled()); // Reenable this->SetCoinsAllowed(bldPt, true); - BOOST_TEST_REQUIRE(!bld->IsGoldDisabled()); + BOOST_TEST_REQUIRE(!bld->isGoldDisabled()); // Production should have no effect this->SetProductionEnabled(bldPt, true); - BOOST_TEST_REQUIRE(!bld->IsGoldDisabled()); + BOOST_TEST_REQUIRE(!bld->isGoldDisabled()); this->SetProductionEnabled(bldPt, false); - BOOST_TEST_REQUIRE(!bld->IsGoldDisabled()); + BOOST_TEST_REQUIRE(!bld->isGoldDisabled()); } BOOST_FIXTURE_TEST_CASE(ChangeArmorAccept, WorldWithGCExecution2P) @@ -666,25 +666,25 @@ BOOST_FIXTURE_TEST_CASE(ChangeArmorAccept, WorldWithGCExecution2P) auto* bld = dynamic_cast( BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, bldPt, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(bld); - BOOST_TEST_REQUIRE(bld->IsArmorAllowed()); //-V522 + BOOST_TEST_REQUIRE(bld->isArmorAllowed()); //-V522 // Enable (already is) this->SetArmorAllowed(bldPt, true); - BOOST_TEST_REQUIRE(bld->IsArmorAllowed()); + BOOST_TEST_REQUIRE(bld->isArmorAllowed()); // Disable this->SetArmorAllowed(bldPt, false); - BOOST_TEST_REQUIRE(!bld->IsArmorAllowed()); + BOOST_TEST_REQUIRE(!bld->isArmorAllowed()); // Reenable this->SetArmorAllowed(bldPt, true); - BOOST_TEST_REQUIRE(bld->IsArmorAllowed()); + BOOST_TEST_REQUIRE(bld->isArmorAllowed()); // Production should have no effect this->SetProductionEnabled(bldPt, true); - BOOST_TEST_REQUIRE(bld->IsArmorAllowed()); + BOOST_TEST_REQUIRE(bld->isArmorAllowed()); this->SetProductionEnabled(bldPt, false); - BOOST_TEST_REQUIRE(bld->IsArmorAllowed()); + BOOST_TEST_REQUIRE(bld->isArmorAllowed()); } BOOST_FIXTURE_TEST_CASE(DisableProduction, WorldWithGCExecution2P) @@ -693,44 +693,44 @@ BOOST_FIXTURE_TEST_CASE(DisableProduction, WorldWithGCExecution2P) auto* bld = dynamic_cast( BuildingFactory::CreateBuilding(world, BuildingType::Forester, bldPt, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(bld); - BOOST_TEST_REQUIRE(!bld->IsProductionDisabled()); //-V522 + BOOST_TEST_REQUIRE(!bld->isProductionDisabled()); //-V522 // Enable (already is) this->SetProductionEnabled(bldPt, true); - BOOST_TEST_REQUIRE(!bld->IsProductionDisabled()); + BOOST_TEST_REQUIRE(!bld->isProductionDisabled()); // Disable this->SetProductionEnabled(bldPt, false); - BOOST_TEST_REQUIRE(bld->IsProductionDisabled()); + BOOST_TEST_REQUIRE(bld->isProductionDisabled()); // Reenable this->SetProductionEnabled(bldPt, true); - BOOST_TEST_REQUIRE(!bld->IsProductionDisabled()); + BOOST_TEST_REQUIRE(!bld->isProductionDisabled()); // Coins should have no effect this->SetCoinsAllowed(bldPt, true); - BOOST_TEST_REQUIRE(!bld->IsProductionDisabled()); + BOOST_TEST_REQUIRE(!bld->isProductionDisabled()); this->SetCoinsAllowed(bldPt, false); - BOOST_TEST_REQUIRE(!bld->IsProductionDisabled()); + BOOST_TEST_REQUIRE(!bld->isProductionDisabled()); // Armor should have no effect this->SetArmorAllowed(bldPt, true); - BOOST_TEST_REQUIRE(!bld->IsProductionDisabled()); + BOOST_TEST_REQUIRE(!bld->isProductionDisabled()); this->SetArmorAllowed(bldPt, false); - BOOST_TEST_REQUIRE(!bld->IsProductionDisabled()); + BOOST_TEST_REQUIRE(!bld->isProductionDisabled()); } namespace { void InitPactsAndPost(GameWorldBase& world) { - for(unsigned i = 0; i < world.GetNumPlayers(); i++) + for(unsigned i = 0; i < world.getNumPlayers(); i++) { - world.GetPlayer(i).MakeStartPacts(); - PostBox& box = *world.GetPostMgr().GetPostBox(i); - const unsigned numMsgs = box.GetNumMsgs(); + world.getPlayer(i).MakeStartPacts(); + PostBox& box = *world.getPostMgr().getPostBox(i); + const unsigned numMsgs = box.getNumMsgs(); for(unsigned j = 0; j < numMsgs; j++) BOOST_TEST_REQUIRE(box.DeleteMsg(0u)); - BOOST_TEST_REQUIRE(box.GetNumMsgs() == 0u); + BOOST_TEST_REQUIRE(box.getNumMsgs() == 0u); } } } // namespace @@ -740,62 +740,62 @@ BOOST_FIXTURE_TEST_CASE(NotifyAllies, WorldWithGCExecution3P) // At first there are no teams for(const auto& player : world.getPlayers()) BOOST_TEST_REQUIRE(player.team == Team::None); - PostManager& postMgr = world.GetPostMgr(); + PostManager& postMgr = world.getPostMgr(); // Add postbox for each player - for(unsigned i = 0; i < world.GetNumPlayers(); i++) + for(unsigned i = 0; i < world.getNumPlayers(); i++) postMgr.AddPostBox(i); // Choose middle player so we can observe side effects and off-by-one errors curPlayer = 1; // No ally -> no messages this->NotifyAlliesOfLocation(hqPos); - for(unsigned i = 0; i < world.GetNumPlayers(); i++) - BOOST_TEST_REQUIRE(postMgr.GetPostBox(i)->GetNumMsgs() == 0u); //-V807 + for(unsigned i = 0; i < world.getNumPlayers(); i++) + BOOST_TEST_REQUIRE(postMgr.getPostBox(i)->getNumMsgs() == 0u); //-V807 // Still no allies - world.GetPlayer(1).team = Team::Team1; //-V807 + world.getPlayer(1).team = Team::Team1; //-V807 InitPactsAndPost(world); this->NotifyAlliesOfLocation(hqPos); - for(unsigned i = 0; i < world.GetNumPlayers(); i++) - BOOST_TEST_REQUIRE(postMgr.GetPostBox(i)->GetNumMsgs() == 0u); + for(unsigned i = 0; i < world.getNumPlayers(); i++) + BOOST_TEST_REQUIRE(postMgr.getPostBox(i)->getNumMsgs() == 0u); // First 2 players are allied -> Message received by player 0 only - world.GetPlayer(0).team = Team::Team1; //-V807 - world.GetPlayer(1).team = Team::Team1; + world.getPlayer(0).team = Team::Team1; //-V807 + world.getPlayer(1).team = Team::Team1; InitPactsAndPost(world); this->NotifyAlliesOfLocation(hqPos); - BOOST_TEST_REQUIRE(postMgr.GetPostBox(0u)->GetNumMsgs() == 1u); //-V807 - for(unsigned i = 1; i < world.GetNumPlayers(); i++) - BOOST_TEST_REQUIRE(postMgr.GetPostBox(i)->GetNumMsgs() == 0u); + BOOST_TEST_REQUIRE(postMgr.getPostBox(0u)->getNumMsgs() == 1u); //-V807 + for(unsigned i = 1; i < world.getNumPlayers(); i++) + BOOST_TEST_REQUIRE(postMgr.getPostBox(i)->getNumMsgs() == 0u); // Same if player 2 is in another team - world.GetPlayer(0).team = Team::Team1; //-V525 - world.GetPlayer(1).team = Team::Team1; - world.GetPlayer(2).team = Team::Team2; //-V807 + world.getPlayer(0).team = Team::Team1; //-V525 + world.getPlayer(1).team = Team::Team1; + world.getPlayer(2).team = Team::Team2; //-V807 InitPactsAndPost(world); this->NotifyAlliesOfLocation(hqPos); - BOOST_TEST_REQUIRE(postMgr.GetPostBox(0u)->GetNumMsgs() == 1u); - for(unsigned i = 1; i < world.GetNumPlayers(); i++) - BOOST_TEST_REQUIRE(postMgr.GetPostBox(i)->GetNumMsgs() == 0u); + BOOST_TEST_REQUIRE(postMgr.getPostBox(0u)->getNumMsgs() == 1u); + for(unsigned i = 1; i < world.getNumPlayers(); i++) + BOOST_TEST_REQUIRE(postMgr.getPostBox(i)->getNumMsgs() == 0u); // player 2 is in same team - world.GetPlayer(0).team = Team::Team1; //-V525 - world.GetPlayer(1).team = Team::Team2; - world.GetPlayer(2).team = Team::Team2; + world.getPlayer(0).team = Team::Team1; //-V525 + world.getPlayer(1).team = Team::Team2; + world.getPlayer(2).team = Team::Team2; InitPactsAndPost(world); this->NotifyAlliesOfLocation(hqPos); - BOOST_TEST_REQUIRE(postMgr.GetPostBox(2u)->GetNumMsgs() == 1u); + BOOST_TEST_REQUIRE(postMgr.getPostBox(2u)->getNumMsgs() == 1u); for(unsigned i = 0; i < 2; i++) - BOOST_TEST_REQUIRE(postMgr.GetPostBox(i)->GetNumMsgs() == 0u); + BOOST_TEST_REQUIRE(postMgr.getPostBox(i)->getNumMsgs() == 0u); // All are in same team - world.GetPlayer(0).team = Team::Team3; - world.GetPlayer(1).team = Team::Team3; - world.GetPlayer(2).team = Team::Team3; + world.getPlayer(0).team = Team::Team3; + world.getPlayer(1).team = Team::Team3; + world.getPlayer(2).team = Team::Team3; InitPactsAndPost(world); this->NotifyAlliesOfLocation(hqPos); - BOOST_TEST_REQUIRE(postMgr.GetPostBox(0u)->GetNumMsgs() == 1u); - BOOST_TEST_REQUIRE(postMgr.GetPostBox(1u)->GetNumMsgs() == 0u); - BOOST_TEST_REQUIRE(postMgr.GetPostBox(2u)->GetNumMsgs() == 1u); + BOOST_TEST_REQUIRE(postMgr.getPostBox(0u)->getNumMsgs() == 1u); + BOOST_TEST_REQUIRE(postMgr.getPostBox(1u)->getNumMsgs() == 0u); + BOOST_TEST_REQUIRE(postMgr.getPostBox(2u)->getNumMsgs() == 1u); } BOOST_AUTO_TEST_CASE(InventorySettingType) @@ -806,19 +806,19 @@ BOOST_AUTO_TEST_CASE(InventorySettingType) // Test all 3 single types setting = EInventorySetting::Stop; - BOOST_TEST_REQUIRE(setting.IsSet(EInventorySetting::Stop)); - BOOST_TEST(!setting.IsSet(EInventorySetting::Send)); - BOOST_TEST(!setting.IsSet(EInventorySetting::Collect)); + BOOST_TEST_REQUIRE(setting.isSet(EInventorySetting::Stop)); + BOOST_TEST(!setting.isSet(EInventorySetting::Send)); + BOOST_TEST(!setting.isSet(EInventorySetting::Collect)); setting = EInventorySetting::Send; - BOOST_TEST(!setting.IsSet(EInventorySetting::Stop)); - BOOST_TEST_REQUIRE(setting.IsSet(EInventorySetting::Send)); - BOOST_TEST(!setting.IsSet(EInventorySetting::Collect)); + BOOST_TEST(!setting.isSet(EInventorySetting::Stop)); + BOOST_TEST_REQUIRE(setting.isSet(EInventorySetting::Send)); + BOOST_TEST(!setting.isSet(EInventorySetting::Collect)); setting = EInventorySetting::Collect; - BOOST_TEST(!setting.IsSet(EInventorySetting::Stop)); - BOOST_TEST(!setting.IsSet(EInventorySetting::Send)); - BOOST_TEST_REQUIRE(setting.IsSet(EInventorySetting::Collect)); + BOOST_TEST(!setting.isSet(EInventorySetting::Stop)); + BOOST_TEST(!setting.isSet(EInventorySetting::Send)); + BOOST_TEST_REQUIRE(setting.isSet(EInventorySetting::Collect)); // Reset and test toggle setting = InventorySetting(); @@ -826,9 +826,9 @@ BOOST_AUTO_TEST_CASE(InventorySettingType) BOOST_TEST_REQUIRE(setting == EInventorySetting::Stop); setting.Toggle(EInventorySetting::Send); // Both set - BOOST_TEST_REQUIRE(setting.IsSet(EInventorySetting::Stop)); - BOOST_TEST_REQUIRE(setting.IsSet(EInventorySetting::Send)); - BOOST_TEST_REQUIRE(!setting.IsSet(EInventorySetting::Collect)); + BOOST_TEST_REQUIRE(setting.isSet(EInventorySetting::Stop)); + BOOST_TEST_REQUIRE(setting.isSet(EInventorySetting::Send)); + BOOST_TEST_REQUIRE(!setting.isSet(EInventorySetting::Collect)); // Resets others setting.Toggle(EInventorySetting::Collect); @@ -854,25 +854,25 @@ auto makeVector(const helpers::EnumArray& srcArray) BOOST_FIXTURE_TEST_CASE(SetInventorySettingTest, WorldWithGCExecution2P) { addStartResources(); - GamePlayer& player = world.GetPlayer(curPlayer); - const nobBaseWarehouse* wh = player.GetFirstWH(); + GamePlayer& player = world.getPlayer(curPlayer); + const nobBaseWarehouse* wh = player.getFirstWH(); BOOST_TEST_REQUIRE(wh); InventorySetting expectedSetting; - BOOST_TEST_REQUIRE(wh->GetInventorySetting(GoodType::Boards) == expectedSetting); //-V522 - BOOST_TEST_REQUIRE(wh->GetInventorySetting(Job::Private) == expectedSetting); + BOOST_TEST_REQUIRE(wh->getInventorySetting(GoodType::Boards) == expectedSetting); //-V522 + BOOST_TEST_REQUIRE(wh->getInventorySetting(Job::Private) == expectedSetting); expectedSetting.Toggle(EInventorySetting::Stop); expectedSetting.Toggle(EInventorySetting::Send); this->SetInventorySetting(hqPos, GoodType::Boards, expectedSetting); - BOOST_TEST_REQUIRE(wh->GetInventorySetting(GoodType::Boards) == expectedSetting); + BOOST_TEST_REQUIRE(wh->getInventorySetting(GoodType::Boards) == expectedSetting); this->SetInventorySetting(hqPos, Job::Private, expectedSetting); - BOOST_TEST_REQUIRE(wh->GetInventorySetting(Job::Private) == expectedSetting); + BOOST_TEST_REQUIRE(wh->getInventorySetting(Job::Private) == expectedSetting); expectedSetting.Toggle(EInventorySetting::Collect); this->SetInventorySetting(hqPos, GoodType::Boards, expectedSetting); - BOOST_TEST_REQUIRE(wh->GetInventorySetting(GoodType::Boards) == expectedSetting); + BOOST_TEST_REQUIRE(wh->getInventorySetting(GoodType::Boards) == expectedSetting); this->SetInventorySetting(hqPos, Job::Private, expectedSetting); - BOOST_TEST_REQUIRE(wh->GetInventorySetting(Job::Private) == expectedSetting); + BOOST_TEST_REQUIRE(wh->getInventorySetting(Job::Private) == expectedSetting); helpers::EnumArray jobSettings; for(const auto i : helpers::enumRange()) @@ -882,9 +882,9 @@ BOOST_FIXTURE_TEST_CASE(SetInventorySettingTest, WorldWithGCExecution2P) { // Boat carriers are stored as helpers and boats if(i == Job::BoatCarrier) - BOOST_TEST_REQUIRE(wh->GetInventorySetting(i) == jobSettings[Job::Helper]); + BOOST_TEST_REQUIRE(wh->getInventorySetting(i) == jobSettings[Job::Helper]); else - BOOST_TEST_REQUIRE(wh->GetInventorySetting(i) == jobSettings[i]); + BOOST_TEST_REQUIRE(wh->getInventorySetting(i) == jobSettings[i]); } helpers::EnumArray goodSettings; @@ -892,46 +892,46 @@ BOOST_FIXTURE_TEST_CASE(SetInventorySettingTest, WorldWithGCExecution2P) goodSettings[i] = InventorySetting(rand() % 5); this->SetAllInventorySettings(hqPos, false, makeVector(goodSettings)); for(const auto i : helpers::enumRange()) - BOOST_TEST_REQUIRE(wh->GetInventorySetting(i) == goodSettings[ConvertShields(i)]); + BOOST_TEST_REQUIRE(wh->getInventorySetting(i) == goodSettings[ConvertShields(i)]); std::fill(goodSettings.begin(), goodSettings.end(), InventorySetting(0)); this->SetAllInventorySettings(hqPos, false, makeVector(goodSettings)); std::fill(jobSettings.begin(), jobSettings.end(), InventorySetting(0)); this->SetAllInventorySettings(hqPos, true, makeVector(jobSettings)); - unsigned numBoards = wh->GetNumRealWares(GoodType::Boards); - unsigned numWoodcutters = wh->GetNumRealFigures(Job::Woodcutter); + unsigned numBoards = wh->getNumRealWares(GoodType::Boards); + unsigned numWoodcutters = wh->getNumRealFigures(Job::Woodcutter); this->SetInventorySetting(hqPos, GoodType::Boards, EInventorySetting::Send); // Nothing should happen RTTR_SKIP_GFS(100); - BOOST_TEST_REQUIRE(wh->GetNumRealWares(GoodType::Boards) == numBoards); + BOOST_TEST_REQUIRE(wh->getNumRealWares(GoodType::Boards) == numBoards); this->SetInventorySetting(hqPos, GoodType::Boards, InventorySetting()); this->SetInventorySetting(hqPos, Job::Woodcutter, EInventorySetting::Send); // Figure goes out and wanders RTTR_SKIP_GFS(100); - BOOST_TEST_REQUIRE(wh->GetNumRealFigures(Job::Woodcutter) < numWoodcutters); + BOOST_TEST_REQUIRE(wh->getNumRealFigures(Job::Woodcutter) < numWoodcutters); this->SetInventorySetting(hqPos, Job::Woodcutter, InventorySetting()); - numWoodcutters = wh->GetNumRealFigures(Job::Woodcutter); + numWoodcutters = wh->getNumRealFigures(Job::Woodcutter); MapPoint whPos = hqPos + MapPoint(3, 0); BuildingFactory::CreateBuilding(world, BuildingType::Storehouse, whPos, curPlayer, Nation::Africans); - this->BuildRoad(wh->GetFlagPos(), false, std::vector(3, Direction::East)); + this->BuildRoad(wh->getFlagPos(), false, std::vector(3, Direction::East)); this->SetInventorySetting(hqPos, GoodType::Boards, EInventorySetting::Send); // Send some RTTR_SKIP_GFS(100); - BOOST_TEST_REQUIRE(wh->GetNumRealWares(GoodType::Boards) < numBoards); + BOOST_TEST_REQUIRE(wh->getNumRealWares(GoodType::Boards) < numBoards); this->SetInventorySetting(hqPos, GoodType::Boards, InventorySetting()); this->SetInventorySetting(hqPos, Job::Woodcutter, EInventorySetting::Send); // Nothing should happen RTTR_SKIP_GFS(100); - BOOST_TEST_REQUIRE(wh->GetNumRealFigures(Job::Woodcutter) < numWoodcutters); + BOOST_TEST_REQUIRE(wh->getNumRealFigures(Job::Woodcutter) < numWoodcutters); this->SetInventorySetting(hqPos, Job::Woodcutter, InventorySetting()); } BOOST_FIXTURE_TEST_CASE(ChangeReserveTest, WorldWithGCExecution2P) { - GamePlayer& player = world.GetPlayer(curPlayer); - nobBaseWarehouse* wh = player.GetFirstWH(); + GamePlayer& player = world.getPlayer(curPlayer); + nobBaseWarehouse* wh = player.getFirstWH(); BOOST_TEST_REQUIRE(wh); PeopleCounts soldiers; @@ -944,96 +944,96 @@ BOOST_FIXTURE_TEST_CASE(ChangeReserveTest, WorldWithGCExecution2P) for(unsigned i = 0; i < SOLDIER_JOBS.size(); i++) { // We already have soldier per rank as reserve - BOOST_TEST_REQUIRE(wh->GetReserveClaimed(i) == 1u); - BOOST_TEST_REQUIRE(*wh->GetReserveAvailablePointer(i) == 1u); + BOOST_TEST_REQUIRE(wh->getReserveClaimed(i) == 1u); + BOOST_TEST_REQUIRE(*wh->getReserveAvailablePointer(i) == 1u); unsigned newVal = i * 5 + 2; - unsigned numSoldiersAv = wh->GetNumVisualFigures(SOLDIER_JOBS[i]); - BOOST_TEST_REQUIRE(wh->GetNumRealFigures(SOLDIER_JOBS[i]) == numSoldiersAv); + unsigned numSoldiersAv = wh->getNumVisualFigures(SOLDIER_JOBS[i]); + BOOST_TEST_REQUIRE(wh->getNumRealFigures(SOLDIER_JOBS[i]) == numSoldiersAv); // Update reserve -> Removed from inventory this->ChangeReserve(hqPos, i, newVal); - BOOST_TEST_REQUIRE(wh->GetReserveClaimed(i) == newVal); - BOOST_TEST_REQUIRE(*wh->GetReserveAvailablePointer(i) == newVal); + BOOST_TEST_REQUIRE(wh->getReserveClaimed(i) == newVal); + BOOST_TEST_REQUIRE(*wh->getReserveAvailablePointer(i) == newVal); // Current figure ct should be old figure count minus the new reserve soldiers (currentVal - 1 for old reserve // val) - BOOST_TEST_REQUIRE(wh->GetNumVisualFigures(SOLDIER_JOBS[i]) == numSoldiersAv - (newVal - 1)); - BOOST_TEST_REQUIRE(wh->GetNumRealFigures(SOLDIER_JOBS[i]) == numSoldiersAv - (newVal - 1)); + BOOST_TEST_REQUIRE(wh->getNumVisualFigures(SOLDIER_JOBS[i]) == numSoldiersAv - (newVal - 1)); + BOOST_TEST_REQUIRE(wh->getNumRealFigures(SOLDIER_JOBS[i]) == numSoldiersAv - (newVal - 1)); } // Use less for(unsigned i = 0; i < SOLDIER_JOBS.size(); i++) { unsigned newVal = i * 3 + 1; - unsigned numSoldiersAv = wh->GetNumVisualFigures(SOLDIER_JOBS[i]); - unsigned numSoldiersReleased = *wh->GetReserveAvailablePointer(i) - newVal; + unsigned numSoldiersAv = wh->getNumVisualFigures(SOLDIER_JOBS[i]); + unsigned numSoldiersReleased = *wh->getReserveAvailablePointer(i) - newVal; // Release some soldiers from reserve -> Added to inventory this->ChangeReserve(hqPos, i, newVal); - BOOST_TEST_REQUIRE(wh->GetReserveClaimed(i) == newVal); - BOOST_TEST_REQUIRE(*wh->GetReserveAvailablePointer(i) == newVal); - BOOST_TEST_REQUIRE(wh->GetNumVisualFigures(SOLDIER_JOBS[i]) == numSoldiersAv + numSoldiersReleased); - BOOST_TEST_REQUIRE(wh->GetNumRealFigures(SOLDIER_JOBS[i]) == numSoldiersAv + numSoldiersReleased); + BOOST_TEST_REQUIRE(wh->getReserveClaimed(i) == newVal); + BOOST_TEST_REQUIRE(*wh->getReserveAvailablePointer(i) == newVal); + BOOST_TEST_REQUIRE(wh->getNumVisualFigures(SOLDIER_JOBS[i]) == numSoldiersAv + numSoldiersReleased); + BOOST_TEST_REQUIRE(wh->getNumRealFigures(SOLDIER_JOBS[i]) == numSoldiersAv + numSoldiersReleased); } } BOOST_FIXTURE_TEST_CASE(Armageddon, WorldWithGCExecution2P) { - GamePlayer& player1 = world.GetPlayer(0); - GamePlayer& player2 = world.GetPlayer(1); - MapPoint hqPt1 = player1.GetHQPos(); - MapPoint hqPt2 = player2.GetHQPos(); + GamePlayer& player1 = world.getPlayer(0); + GamePlayer& player2 = world.getPlayer(1); + MapPoint hqPt1 = player1.getHQPos(); + MapPoint hqPt2 = player2.getHQPos(); BOOST_TEST_REQUIRE(hqPt1.isValid()); BOOST_TEST_REQUIRE(hqPt2.isValid()); // Destroy everything this->CheatArmageddon(); - BOOST_TEST_REQUIRE(!player1.GetHQPos().isValid()); - BOOST_TEST_REQUIRE(!player2.GetHQPos().isValid()); - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + BOOST_TEST_REQUIRE(!player1.getHQPos().isValid()); + BOOST_TEST_REQUIRE(!player2.getHQPos().isValid()); + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - const MapNode& node = world.GetNode(pt); + const MapNode& node = world.getNode(pt); BOOST_TEST_REQUIRE(node.owner == 0u); } - BOOST_TEST_REQUIRE(world.GetNO(hqPt1)->GetGOT() != GO_Type::NobHq); - BOOST_TEST_REQUIRE(world.GetNO(hqPt2)->GetGOT() != GO_Type::NobHq); + BOOST_TEST_REQUIRE(world.getNO(hqPt1)->getGOT() != GO_Type::NobHq); + BOOST_TEST_REQUIRE(world.getNO(hqPt2)->getGOT() != GO_Type::NobHq); BOOST_TEST_REQUIRE(player1.IsDefeated()); BOOST_TEST_REQUIRE(player2.IsDefeated()); } BOOST_FIXTURE_TEST_CASE(DestroyAllTest, WorldWithGCExecution2P) { - GamePlayer& player1 = world.GetPlayer(0); - GamePlayer& player2 = world.GetPlayer(1); - MapPoint hqPt1 = player1.GetHQPos(); - MapPoint hqPt2 = player2.GetHQPos(); + GamePlayer& player1 = world.getPlayer(0); + GamePlayer& player2 = world.getPlayer(1); + MapPoint hqPt1 = player1.getHQPos(); + MapPoint hqPt2 = player2.getHQPos(); BOOST_TEST_REQUIRE(hqPt1.isValid()); BOOST_TEST_REQUIRE(hqPt2.isValid()); // Destroy only own buildings this->DestroyAll(); - BOOST_TEST_REQUIRE(!player1.GetHQPos().isValid()); - BOOST_TEST_REQUIRE(player2.GetHQPos().isValid()); - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + BOOST_TEST_REQUIRE(!player1.getHQPos().isValid()); + BOOST_TEST_REQUIRE(player2.getHQPos().isValid()); + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - const MapNode& node = world.GetNode(pt); + const MapNode& node = world.getNode(pt); BOOST_TEST_REQUIRE(node.owner != 1u); } - BOOST_TEST_REQUIRE(world.GetNO(hqPt1)->GetGOT() != GO_Type::NobHq); - BOOST_TEST_REQUIRE(world.GetNO(hqPt2)->GetGOT() == GO_Type::NobHq); + BOOST_TEST_REQUIRE(world.getNO(hqPt1)->getGOT() != GO_Type::NobHq); + BOOST_TEST_REQUIRE(world.getNO(hqPt2)->getGOT() == GO_Type::NobHq); BOOST_TEST_REQUIRE(player1.IsDefeated()); BOOST_TEST_REQUIRE(!player2.IsDefeated()); } BOOST_FIXTURE_TEST_CASE(SurrenderTest, WorldWithGCExecution2P) { - GamePlayer& player1 = world.GetPlayer(0); - GamePlayer& player2 = world.GetPlayer(1); - MapPoint hqPt1 = player1.GetHQPos(); - MapPoint hqPt2 = player2.GetHQPos(); + GamePlayer& player1 = world.getPlayer(0); + GamePlayer& player2 = world.getPlayer(1); + MapPoint hqPt1 = player1.getHQPos(); + MapPoint hqPt2 = player2.getHQPos(); BOOST_TEST_REQUIRE(hqPt1.isValid()); BOOST_TEST_REQUIRE(hqPt2.isValid()); // Only sets defeated flag this->Surrender(); - BOOST_TEST_REQUIRE(player1.GetHQPos().isValid()); - BOOST_TEST_REQUIRE(player2.GetHQPos().isValid()); - BOOST_TEST_REQUIRE(world.GetNode(hqPt1).obj != (const noBase*)nullptr); - BOOST_TEST_REQUIRE(world.GetNode(hqPt2).obj != (const noBase*)nullptr); + BOOST_TEST_REQUIRE(player1.getHQPos().isValid()); + BOOST_TEST_REQUIRE(player2.getHQPos().isValid()); + BOOST_TEST_REQUIRE(world.getNode(hqPt1).obj != (const noBase*)nullptr); + BOOST_TEST_REQUIRE(world.getNode(hqPt2).obj != (const noBase*)nullptr); BOOST_TEST_REQUIRE(player1.IsDefeated()); BOOST_TEST_REQUIRE(!player2.IsDefeated()); } diff --git a/tests/s25Main/integration/testGameEvents.cpp b/tests/s25Main/integration/testGameEvents.cpp index 1f298929f1..dd2a5d8ec3 100644 --- a/tests/s25Main/integration/testGameEvents.cpp +++ b/tests/s25Main/integration/testGameEvents.cpp @@ -14,11 +14,11 @@ BOOST_AUTO_TEST_SUITE(GameEventsTestSuite) BOOST_AUTO_TEST_CASE(AdvanceGFs) { EventManager evMgr(42); - BOOST_TEST_REQUIRE(evMgr.GetCurrentGF() == 42u); + BOOST_TEST_REQUIRE(evMgr.getCurrentGF() == 42u); for(unsigned gf = 43; gf < 50; gf++) { evMgr.ExecuteNextGF(); - BOOST_TEST_REQUIRE(evMgr.GetCurrentGF() == gf); + BOOST_TEST_REQUIRE(evMgr.getCurrentGF() == gf); } } @@ -31,7 +31,7 @@ class TestEventHandler : public GameObject // LCOV_EXCL_START void Destroy() override {} void Serialize(SerializedGameData&) const override {} - GO_Type GetGOT() const final { return GO_Type::Staticobject; } + GO_Type getGOT() const final { return GO_Type::Staticobject; } // LCOV_EXCL_STOP }; @@ -46,24 +46,24 @@ BOOST_AUTO_TEST_CASE(AddAndExecuteEvent) BOOST_TEST_REQUIRE(ev->startGF == startGF); BOOST_TEST_REQUIRE(ev->length == 5u); BOOST_TEST_REQUIRE(ev->id == 42u); - BOOST_TEST_REQUIRE(ev->GetTargetGF() == startGF + ev->length); - BOOST_TEST(evMgr.IsEventActive(obj, 42)); - BOOST_TEST(!evMgr.IsEventActive(obj, 43)); + BOOST_TEST_REQUIRE(ev->getTargetGF() == startGF + ev->length); + BOOST_TEST(evMgr.isEventActive(obj, 42)); + BOOST_TEST(!evMgr.isEventActive(obj, 43)); BOOST_TEST(evMgr.ObjectHasEvents(obj)); // Check that event is not executed before it is due - for(unsigned i = startGF + 1; i < ev->GetTargetGF(); i++) + for(unsigned i = startGF + 1; i < ev->getTargetGF(); i++) { evMgr.ExecuteNextGF(); - BOOST_TEST_REQUIRE(evMgr.GetCurrentGF() == i); // Rechecked for clarity + BOOST_TEST_REQUIRE(evMgr.getCurrentGF() == i); // Rechecked for clarity BOOST_TEST_REQUIRE(obj.handledEventIds.size() == 0u); } - BOOST_TEST_REQUIRE(evMgr.GetCurrentGF() + 1u == ev->GetTargetGF()); + BOOST_TEST_REQUIRE(evMgr.getCurrentGF() + 1u == ev->getTargetGF()); // Now the event should be executed evMgr.ExecuteNextGF(); BOOST_TEST_REQUIRE(obj.handledEventIds.size() == 1u); BOOST_TEST_REQUIRE(obj.handledEventIds.front() == 42u); // And nothing should be left - BOOST_TEST(!evMgr.IsEventActive(obj, 42)); + BOOST_TEST(!evMgr.isEventActive(obj, 42)); BOOST_TEST(!evMgr.ObjectHasEvents(obj)); } @@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(AddSuspendedEvent) BOOST_TEST_REQUIRE(ev->startGF == startGF - 48u); // "Started" 48 GFs ago BOOST_TEST_REQUIRE(ev->length == 50u); BOOST_TEST_REQUIRE(ev->id == 42u); - BOOST_TEST_REQUIRE(ev->GetTargetGF() == startGF + 2); + BOOST_TEST_REQUIRE(ev->getTargetGF() == startGF + 2); // Check that event is not executed before it is due evMgr.ExecuteNextGF(); BOOST_TEST_REQUIRE(obj.handledEventIds.size() == 0u); @@ -115,7 +115,7 @@ BOOST_AUTO_TEST_CASE(Reschedule) // Run 3 of the 5 GFs for(unsigned i = 1; i <= 3; i++) evMgr.ExecuteNextGF(); - std::vector evts = evMgr.GetObjEvents(obj); + std::vector evts = evMgr.getObjEvents(obj); BOOST_TEST_REQUIRE(evts.size() == 1u); BOOST_TEST_REQUIRE(evts.front() == ev); // Execute at GF 7 instead @@ -138,15 +138,15 @@ class TestLogKill final : public GameObject ~TestLogKill() override { killNum++; } void HandleEvent(unsigned /*evId*/) override { - BOOST_TEST_REQUIRE(!em.IsObjectInKillList(*this)); + BOOST_TEST_REQUIRE(!em.isObjectInKillList(*this)); // Kill this on event em.AddToKillList(this); - BOOST_TEST_REQUIRE(em.IsObjectInKillList(*this)); + BOOST_TEST_REQUIRE(em.isObjectInKillList(*this)); } // LCOV_EXCL_START void Destroy() override { destroyNum++; } void Serialize(SerializedGameData&) const override {} - GO_Type GetGOT() const final { return GO_Type::Staticobject; } + GO_Type getGOT() const final { return GO_Type::Staticobject; } // LCOV_EXCL_STOP }; @@ -166,7 +166,7 @@ BOOST_AUTO_TEST_CASE(KillList) evMgr.ExecuteNextGF(); BOOST_TEST_REQUIRE(TestLogKill::killNum == 1u); BOOST_TEST_REQUIRE(TestLogKill::destroyNum == 1u); - BOOST_TEST_REQUIRE(!evMgr.IsObjectInKillList(*obj)); + BOOST_TEST_REQUIRE(!evMgr.isObjectInKillList(*obj)); } class TestRemoveEvent : public TestEventHandler diff --git a/tests/s25Main/integration/testGamePlayer.cpp b/tests/s25Main/integration/testGamePlayer.cpp index cc3ed10a01..13877a461c 100644 --- a/tests/s25Main/integration/testGamePlayer.cpp +++ b/tests/s25Main/integration/testGamePlayer.cpp @@ -25,24 +25,24 @@ using WorldFixtureEmpty2P = WorldFixture; BOOST_FIXTURE_TEST_CASE(Defeat, WorldFixtureEmpty2P) { - BOOST_TEST_REQUIRE(!world.GetPlayer(0).IsDefeated()); - BOOST_TEST_REQUIRE(!world.GetPlayer(1).IsDefeated()); + BOOST_TEST_REQUIRE(!world.getPlayer(0).IsDefeated()); + BOOST_TEST_REQUIRE(!world.getPlayer(1).IsDefeated()); // Destroy HQ -> defeated - world.DestroyNO(world.GetPlayer(1).GetHQPos()); //-V522 - BOOST_TEST_REQUIRE(!world.GetPlayer(0).IsDefeated()); - BOOST_TEST_REQUIRE(world.GetPlayer(1).IsDefeated()); + world.DestroyNO(world.getPlayer(1).getHQPos()); //-V522 + BOOST_TEST_REQUIRE(!world.getPlayer(0).IsDefeated()); + BOOST_TEST_REQUIRE(world.getPlayer(1).IsDefeated()); // Destroy HQ but leave a military bld - MapPoint milBldPos = world.MakeMapPoint(world.GetPlayer(0).GetFirstWH()->GetPos() + Position(4, 0)); //-V522 + MapPoint milBldPos = world.MakeMapPoint(world.getPlayer(0).getFirstWH()->getPos() + Position(4, 0)); //-V522 auto* milBld = dynamic_cast( BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, milBldPos, 0, Nation::Babylonians)); auto& sld = world.AddFigure(milBldPos, std::make_unique(milBldPos, 0, milBld, milBld, 0)); milBld->GotWorker(Job::Private, sld); sld.WalkToGoal(); - world.DestroyNO(world.GetPlayer(0).GetHQPos()); - BOOST_TEST_REQUIRE(!world.GetPlayer(0).IsDefeated()); + world.DestroyNO(world.getPlayer(0).getHQPos()); + BOOST_TEST_REQUIRE(!world.getPlayer(0).IsDefeated()); // Destroy this -> defeated world.DestroyNO(milBldPos); - BOOST_TEST_REQUIRE(world.GetPlayer(0).IsDefeated()); + BOOST_TEST_REQUIRE(world.getPlayer(0).IsDefeated()); } namespace { @@ -74,19 +74,19 @@ struct MineProductivityFixture : WorldFixture( BuildingFactory::CreateBuilding(world, BuildingType::CoalMine, minePos, 0, Nation::Romans)); // Clear resources in the radius explicitly. for(const MapPoint pt : world.GetPointsInRadiusWithCenter(minePos, MINER_RADIUS)) - world.SetResource(pt, Resource()); + world.setResource(pt, Resource()); } // Puts given amounts of coal on the mine node and its eastern neighbor void setCoalAmounts(const unsigned atMine, const unsigned atNeighbor) { - world.SetResource(minePos, Resource(ResourceType::Coal, atMine)); - world.SetResource(world.GetNeighbour(minePos, Direction::East), Resource(ResourceType::Coal, atNeighbor)); + world.setResource(minePos, Resource(ResourceType::Coal, atMine)); + world.setResource(world.getNeighbour(minePos, Direction::East), Resource(ResourceType::Coal, atNeighbor)); } // Spreads the given total coal amount as evenly as possible over every node in the radius (rest set to none). @@ -98,7 +98,7 @@ struct MineProductivityFixture : WorldFixture(pts.size()) - i); - world.SetResource(pts[i], here ? Resource(ResourceType::Coal, here) : Resource()); + world.setResource(pts[i], here ? Resource(ResourceType::Coal, here) : Resource()); remaining -= here; } } @@ -108,7 +108,7 @@ struct MineProductivityFixture : WorldFixture expectedProductivity{}; BOOST_TEST(buildingRegister.CalcProductivities() == expectedProductivity, per_element()); BOOST_TEST(buildingRegister.CalcAverageProductivity() == 0u); @@ -119,24 +119,24 @@ BOOST_FIXTURE_TEST_CASE(ProductivityStats, WorldFixtureEmpty1P) // Sort buildings so military buildings are created first // and no buildings are destroyed when borders are recalculated std::partition(buildingTypes.begin(), buildingTypes.end(), - [](BuildingType bld) { return !BuildingProperties::IsUsual(bld); }); + [](BuildingType bld) { return !BuildingProperties::isUsual(bld); }); MapPoint curPos(0, 0); for(const auto bldType : buildingTypes) { - if(!BuildingProperties::IsValid(bldType)) + if(!BuildingProperties::isValid(bldType)) continue; noBuilding* bld; if(bldType == BuildingType::Headquarters) - bld = world.GetPlayer(0).GetFirstWH(); + bld = world.getPlayer(0).getFirstWH(); else { // Size checks (in x) only for safety. Should never fail due to construction of map size - while(world.GetNode(curPos).bq != BuildingQuality::Castle) - BOOST_TEST_REQUIRE((++curPos.x) < world.GetSize().x); + while(world.getNode(curPos).bq != BuildingQuality::Castle) + BOOST_TEST_REQUIRE((++curPos.x) < world.getSize().x); bld = BuildingFactory::CreateBuilding(world, bldType, curPos, 0, Nation::Babylonians); - BOOST_TEST_REQUIRE((curPos.x += 2) < world.GetSize().x); + BOOST_TEST_REQUIRE((curPos.x += 2) < world.getSize().x); } // Test productivity calculation for all buildings shown in the productivity window if(helpers::contains(iwBuildingProductivities::allIcons, bldType)) @@ -159,7 +159,7 @@ BOOST_FIXTURE_TEST_CASE(ProductivityStats, WorldFixtureEmpty1P) { auto* bld = static_cast(BuildingFactory::CreateBuilding(world, bldType, curPos, 0, Nation::Babylonians)); - if((curPos.x += 2) >= world.GetSize().x) + if((curPos.x += 2) >= world.getSize().x) curPos = MapPoint(0, curPos.y + 2); const auto productivity = rttr::test::randomValue(1, 100); setProductivity(bld, productivity); @@ -177,29 +177,29 @@ BOOST_FIXTURE_TEST_CASE(MineProductivityAccountsForS4LikeResourceChance, MinePro // Without the S4-like behavior the base productivity is reported unchanged, regardless of the resources left. setCoalAmounts(1, 0); - BOOST_TEST(coalMine->GetProductivity() == 100u); + BOOST_TEST(coalMine->getProductivity() == 100u); ggs.setSelection(AddonId::COALMINE_RESOURCE_BEHAVIOR, static_cast(MineResourceBehavior::S4LikeExhaustion)); // S4-like scales productivity with the resources left, reaching the full base value at 20 (full productivity). setCoalAmounts(15, 5); // == S4LIKE_FULL_PRODUCTIVITY_AMOUNT - BOOST_TEST(coalMine->GetProductivity() == 100u); + BOOST_TEST(coalMine->getProductivity() == 100u); // Halving the resources halves the reported productivity. setCoalAmounts(5, 5); - BOOST_TEST(coalMine->GetProductivity() == 50u); + BOOST_TEST(coalMine->getProductivity() == 50u); // Lowering the base productivity scales the result by the same factor: 80% of the 50% chance -> 40%. setProductivity(coalMine, 80); - BOOST_TEST(coalMine->GetProductivity() == 40u); - BOOST_TEST(world.GetPlayer(0).GetBuildingRegister().CalcProductivities()[BuildingType::CoalMine] == 40u); + BOOST_TEST(coalMine->getProductivity() == 40u); + BOOST_TEST(world.getPlayer(0).getBuildingRegister().CalcProductivities()[BuildingType::CoalMine] == 40u); // No resources left -> no production. setProductivity(coalMine, 100); setCoalAmounts(0, 0); - BOOST_TEST(coalMine->GetProductivity() == 0u); + BOOST_TEST(coalMine->getProductivity() == 0u); // Inexhaustible mines always report their base productivity again, ignoring the resources. ggs.setSelection(AddonId::COALMINE_RESOURCE_BEHAVIOR, static_cast(MineResourceBehavior::Inexhaustible)); - BOOST_TEST(coalMine->GetProductivity() == 100u); + BOOST_TEST(coalMine->getProductivity() == 100u); } BOOST_FIXTURE_TEST_CASE(MineProductivityUsesAllMatchingResourcesWithinMineRadius, MineProductivityFixture) @@ -210,45 +210,45 @@ BOOST_FIXTURE_TEST_CASE(MineProductivityUsesAllMatchingResourcesWithinMineRadius static_cast(MineResourceBehavior::S4LikeExhaustion)); // A different resource type in range and matching coal just outside the radius must not count as coal. - world.SetResource(world.GetNeighbour(minePos, Direction::NorthWest), Resource(ResourceType::Iron, 15)); + world.setResource(world.getNeighbour(minePos, Direction::NorthWest), Resource(ResourceType::Iron, 15)); const MapPoint outOfRangePt = world.MakeMapPoint(minePos + Position(MINER_RADIUS + 1, 0)); - world.SetResource(outOfRangePt, Resource(ResourceType::Coal, 15)); - BOOST_TEST(GetRemainingMineResources(world, minePos, ResourceType::Coal) == 0u); - BOOST_TEST(coalMine->GetProductivity() == 0u); + world.setResource(outOfRangePt, Resource(ResourceType::Coal, 15)); + BOOST_TEST(getRemainingMineResources(world, minePos, ResourceType::Coal) == 0u); + BOOST_TEST(coalMine->getProductivity() == 0u); // Half of the full amount, but spread across every node of the radius: productivity depends only on the sum in // range, not on how it is distributed. This overwrites the in-range iron, which no longer matters here. spreadCoalInRadius(S4LIKE_FULL_PRODUCTIVITY_AMOUNT / 2); - BOOST_TEST(GetRemainingMineResources(world, minePos, ResourceType::Coal) == 10u); - BOOST_TEST(coalMine->GetProductivity() == 50u); - BOOST_TEST(world.GetPlayer(0).GetBuildingRegister().CalcProductivities()[BuildingType::CoalMine] == 50u); + BOOST_TEST(getRemainingMineResources(world, minePos, ResourceType::Coal) == 10u); + BOOST_TEST(coalMine->getProductivity() == 50u); + BOOST_TEST(world.getPlayer(0).getBuildingRegister().CalcProductivities()[BuildingType::CoalMine] == 50u); } BOOST_FIXTURE_TEST_CASE(IsHQTent_ReturnsFalse_IfPrimaryHQIsNotTent, WorldFixtureEmpty1P) { - GamePlayer& p1 = world.GetPlayer(0); + GamePlayer& p1 = world.getPlayer(0); // place another HQ that is a tent - MapPoint newHqPos = p1.GetHQPos(); + MapPoint newHqPos = p1.getHQPos(); newHqPos.x += 3; static_cast( BuildingFactory::CreateBuilding(world, BuildingType::Headquarters, newHqPos, 0, Nation::Babylonians)) - ->SetIsTent(true); + ->setIsTent(true); - BOOST_TEST_REQUIRE(p1.IsHQTent() == false); + BOOST_TEST_REQUIRE(p1.isHQTent() == false); } BOOST_FIXTURE_TEST_CASE(IsHQTent_ReturnsTrue_IfPrimaryHQIsTent, WorldFixtureEmpty1P) { - GamePlayer& p1 = world.GetPlayer(0); - p1.SetHQIsTent(true); + GamePlayer& p1 = world.getPlayer(0); + p1.setHQIsTent(true); // place another HQ that is not a tent - MapPoint newHqPos = p1.GetHQPos(); + MapPoint newHqPos = p1.getHQPos(); newHqPos.x += 3; static_cast( BuildingFactory::CreateBuilding(world, BuildingType::Headquarters, newHqPos, 0, Nation::Babylonians)) - ->SetIsTent(false); + ->setIsTent(false); - BOOST_TEST_REQUIRE(p1.IsHQTent() == true); + BOOST_TEST_REQUIRE(p1.isHQTent() == true); } diff --git a/tests/s25Main/integration/testGameWorldView.cpp b/tests/s25Main/integration/testGameWorldView.cpp index 11ffc05782..aa800c2c7e 100644 --- a/tests/s25Main/integration/testGameWorldView.cpp +++ b/tests/s25Main/integration/testGameWorldView.cpp @@ -25,20 +25,20 @@ BOOST_FIXTURE_TEST_CASE(HasCorrectDrawCoords, EmptyWorldFixture1P) GameWorldViewer gwv(0, world); const auto viewSize = rttr::test::randomPoint(100, 1000); GameWorldView view(gwv, Position(0, 0), viewSize); - BOOST_TEST(view.GetPos() == Position(0, 0)); - BOOST_TEST(view.GetSize() == viewSize); - BOOST_TEST(view.GetFirstPt() == Position(-1, -1)); - BOOST_TEST(view.GetLastPt().x > static_cast(viewSize.x / TR_W)); - BOOST_TEST(view.GetLastPt().y > static_cast(viewSize.y / TR_H)); + BOOST_TEST(view.getPos() == Position(0, 0)); + BOOST_TEST(view.getSize() == viewSize); + BOOST_TEST(view.getFirstPt() == Position(-1, -1)); + BOOST_TEST(view.getLastPt().x > static_cast(viewSize.x / TR_W)); + BOOST_TEST(view.getLastPt().y > static_cast(viewSize.y / TR_H)); - const auto origFirstPt = view.GetFirstPt(); - const auto origLastPt = view.GetLastPt(); + const auto origFirstPt = view.getFirstPt(); + const auto origLastPt = view.getLastPt(); auto newOffset = rttr::test::randomPoint(100, 200); - BOOST_TEST_REQUIRE(view.GetOffset() == DrawPoint(0, 0)); + BOOST_TEST_REQUIRE(view.getOffset() == DrawPoint(0, 0)); view.MoveTo(newOffset); - BOOST_TEST_REQUIRE(view.GetOffset() == newOffset); - const auto offsetFirstPt = view.GetFirstPt(); - const auto offsetLastPt = view.GetLastPt(); + BOOST_TEST_REQUIRE(view.getOffset() == newOffset); + const auto offsetFirstPt = view.getFirstPt(); + const auto offsetLastPt = view.getLastPt(); BOOST_TEST(offsetFirstPt.x > origFirstPt.x); BOOST_TEST(offsetFirstPt.y > origFirstPt.y); BOOST_TEST(offsetLastPt.x > origLastPt.x); @@ -47,36 +47,36 @@ BOOST_FIXTURE_TEST_CASE(HasCorrectDrawCoords, EmptyWorldFixture1P) { const auto offset = rttr::test::randomPoint(-100, 70); // Smallish max offset to not exceed map size view.MoveBy(offset); - BOOST_TEST_REQUIRE(view.GetOffset() == newOffset + offset); + BOOST_TEST_REQUIRE(view.getOffset() == newOffset + offset); } // Don't move if moved by multiples of total size { - const DrawPoint drawSize(world.GetSize() * DrawPoint(TR_W, TR_H)); + const DrawPoint drawSize(world.getSize() * DrawPoint(TR_W, TR_H)); // Absolute view.MoveTo(newOffset + drawSize); - BOOST_TEST_REQUIRE(view.GetOffset() == newOffset); + BOOST_TEST_REQUIRE(view.getOffset() == newOffset); // Relative +- view.MoveBy(drawSize); - BOOST_TEST_REQUIRE(view.GetOffset() == newOffset); + BOOST_TEST_REQUIRE(view.getOffset() == newOffset); view.MoveBy(drawSize); - BOOST_TEST_REQUIRE(view.GetOffset() == newOffset); + BOOST_TEST_REQUIRE(view.getOffset() == newOffset); // Absolute by multiples of the size const auto offset = rttr::test::randomPoint(1, 10); view.MoveTo(newOffset + (drawSize * rttr::test::randomPoint(2, 5)) + offset); - BOOST_TEST_REQUIRE(view.GetOffset() == newOffset + offset); + BOOST_TEST_REQUIRE(view.getOffset() == newOffset + offset); } // Move back to start restores first/last points view.MoveTo({0, 0}); - BOOST_TEST_REQUIRE(view.GetOffset() == DrawPoint(0, 0)); - BOOST_TEST(view.GetFirstPt() == origFirstPt); - BOOST_TEST(view.GetLastPt() == origLastPt); + BOOST_TEST_REQUIRE(view.getOffset() == DrawPoint(0, 0)); + BOOST_TEST(view.getFirstPt() == origFirstPt); + BOOST_TEST(view.getLastPt() == origLastPt); // Relative move also updates first/last point view.MoveBy(newOffset); - BOOST_TEST_REQUIRE(view.GetOffset() == newOffset); - BOOST_TEST(view.GetFirstPt() == offsetFirstPt); - BOOST_TEST(view.GetLastPt() == offsetLastPt); + BOOST_TEST_REQUIRE(view.getOffset() == newOffset); + BOOST_TEST(view.getFirstPt() == offsetFirstPt); + BOOST_TEST(view.getLastPt() == offsetLastPt); } BOOST_FIXTURE_TEST_CASE(GetsCorrectMaxHeight, EmptyWorldFixture1P) @@ -86,24 +86,24 @@ BOOST_FIXTURE_TEST_CASE(GetsCorrectMaxHeight, EmptyWorldFixture1P) GameWorldViewer gwv(0, world); const auto viewSize = rttr::test::randomPoint(100, 1000); GameWorldView view(gwv, Position(0, 0), viewSize); - BOOST_TEST(gwv.getMaxNodeAltitude() == world.GetNode(MapPoint(0, 0)).altitude); // All same height + BOOST_TEST(gwv.getMaxNodeAltitude() == world.getNode(MapPoint(0, 0)).altitude); // All same height { EmptyWorldFixture1P world2; - const auto newMaxHeight = world2.world.GetNodeWriteable(MapPoint(0, 0)).altitude *= 2; + const auto newMaxHeight = world2.world.getNodeWriteable(MapPoint(0, 0)).altitude *= 2; GameWorldViewer gwv2(0, world2.world); BOOST_TEST(gwv2.getMaxNodeAltitude() == newMaxHeight); GameWorldView view2(gwv2, Position(0, 0), viewSize); - BOOST_TEST(view2.GetFirstPt() == view.GetFirstPt()); - BOOST_TEST(view2.GetLastPt().x == view.GetLastPt().x); - BOOST_TEST(view2.GetLastPt().y > view.GetLastPt().y); // Should have increased due to higher altitude + BOOST_TEST(view2.getFirstPt() == view.getFirstPt()); + BOOST_TEST(view2.getLastPt().x == view.getLastPt().x); + BOOST_TEST(view2.getLastPt().y > view.getLastPt().y); // Should have increased due to higher altitude // React on height changes, at least after moves world.ChangeAltitude(MapPoint(0, 0), newMaxHeight); view.MoveBy(DrawPoint(0, 0)); // no-op move BOOST_TEST(gwv.getMaxNodeAltitude() == newMaxHeight); - BOOST_TEST(view.GetFirstPt() == view2.GetFirstPt()); - BOOST_TEST(view.GetLastPt() == view2.GetLastPt()); + BOOST_TEST(view.getFirstPt() == view2.getFirstPt()); + BOOST_TEST(view.getLastPt() == view2.getLastPt()); } } diff --git a/tests/s25Main/integration/testHarbor.cpp b/tests/s25Main/integration/testHarbor.cpp index 30d3aff250..66c0dc4ecb 100644 --- a/tests/s25Main/integration/testHarbor.cpp +++ b/tests/s25Main/integration/testHarbor.cpp @@ -14,11 +14,11 @@ struct HarborFixture : WorldFixture { HarborFixture() { - GamePlayer& player = world.GetPlayer(0); - hq = world.GetSpecObj(player.GetHQPos()); + GamePlayer& player = world.getPlayer(0); + hq = world.getSpecObj(player.getHQPos()); hb = static_cast(BuildingFactory::CreateBuilding( - world, BuildingType::HarborBuilding, player.GetHQPos() + MapPoint(4, 0), 0, Nation::Romans)); - world.BuildRoad(0, false, hq->GetFlagPos(), {4, Direction::East}); + world, BuildingType::HarborBuilding, player.getHQPos() + MapPoint(4, 0), 0, Nation::Romans)); + world.BuildRoad(0, false, hq->getFlagPos(), {4, Direction::East}); } nobBaseWarehouse* hq; @@ -29,25 +29,25 @@ struct HarborFixture : WorldFixture BOOST_FIXTURE_TEST_CASE(StartExpeditionThenCancel, HarborFixture) { addStartResources(); - BOOST_TEST_REQUIRE(hq->GetNumRealFigures(Job::Builder) >= 1u); // Must have a builder - const auto numLeavingFigs = hq->GetLeavingFigures().size(); + BOOST_TEST_REQUIRE(hq->getNumRealFigures(Job::Builder) >= 1u); // Must have a builder + const auto numLeavingFigs = hq->getLeavingFigures().size(); hb->StartExpedition(); // Builder should be ordered - BOOST_TEST_REQUIRE(hq->GetLeavingFigures().size() == numLeavingFigs + 1u); + BOOST_TEST_REQUIRE(hq->getLeavingFigures().size() == numLeavingFigs + 1u); hb->StopExpedition(); // Builder should still come - BOOST_TEST_REQUIRE(hq->GetLeavingFigures().size() == numLeavingFigs + 1u); + BOOST_TEST_REQUIRE(hq->getLeavingFigures().size() == numLeavingFigs + 1u); } BOOST_FIXTURE_TEST_CASE(StartExpeditionThenDestroy, HarborFixture) { addStartResources(); - BOOST_TEST_REQUIRE(hq->GetNumRealFigures(Job::Builder) >= 1u); // Must have a builder - const auto numLeavingFigs = hq->GetLeavingFigures().size(); + BOOST_TEST_REQUIRE(hq->getNumRealFigures(Job::Builder) >= 1u); // Must have a builder + const auto numLeavingFigs = hq->getLeavingFigures().size(); hb->StartExpedition(); // Builder should be ordered - BOOST_TEST_REQUIRE(hq->GetLeavingFigures().size() == numLeavingFigs + 1u); - world.DestroyBuilding(hb->GetPos(), 0); + BOOST_TEST_REQUIRE(hq->getLeavingFigures().size() == numLeavingFigs + 1u); + world.DestroyBuilding(hb->getPos(), 0); // Builder should be canceled - BOOST_TEST_REQUIRE(hq->GetLeavingFigures().size() == numLeavingFigs); + BOOST_TEST_REQUIRE(hq->getLeavingFigures().size() == numLeavingFigs); } diff --git a/tests/s25Main/integration/testPacts.cpp b/tests/s25Main/integration/testPacts.cpp index 6d936386fc..2c5c6ecdeb 100644 --- a/tests/s25Main/integration/testPacts.cpp +++ b/tests/s25Main/integration/testPacts.cpp @@ -25,27 +25,27 @@ BOOST_AUTO_TEST_SUITE(PactTestSuite) BOOST_FIXTURE_TEST_CASE(InitialPactStates, WorldWithGCExecution3P) { // No pacts at start - for(unsigned i = 0; i < world.GetNumPlayers(); i++) + for(unsigned i = 0; i < world.getNumPlayers(); i++) { - const GamePlayer& player = world.GetPlayer(i); - for(unsigned j = 0; j < world.GetNumPlayers(); j++) + const GamePlayer& player = world.getPlayer(i); + for(unsigned j = 0; j < world.getNumPlayers(); j++) { BOOST_TEST_INFO_SCOPE(i << " vs " << j); // Self is always an ally and not attackable if(i == j) { - BOOST_TEST(player.IsAlly(j)); - BOOST_TEST(!player.IsAttackable(j)); + BOOST_TEST(player.isAlly(j)); + BOOST_TEST(!player.isAttackable(j)); } else { - BOOST_TEST(!player.IsAlly(j)); - BOOST_TEST(player.IsAttackable(j)); + BOOST_TEST(!player.isAlly(j)); + BOOST_TEST(player.isAttackable(j)); } for(const auto p : helpers::enumRange()) { BOOST_TEST_INFO_SCOPE("Pact " << p); - BOOST_TEST(player.GetPactState(p, j) == PactState::None); - BOOST_TEST(player.GetRemainingPactTime(p, j) == 0u); + BOOST_TEST(player.getPactState(p, j) == PactState::None); + BOOST_TEST(player.getRemainingPactTime(p, j) == 0u); } } } @@ -56,49 +56,49 @@ namespace { void CheckPactState(const GameWorldBase& world, unsigned playerIdFrom, unsigned playerIdTo, PactType pact, PactState expectedState) { - const GamePlayer& playerFrom = world.GetPlayer(playerIdFrom); - const GamePlayer& playerTo = world.GetPlayer(playerIdTo); + const GamePlayer& playerFrom = world.getPlayer(playerIdFrom); + const GamePlayer& playerTo = world.getPlayer(playerIdTo); - BOOST_TEST_REQUIRE(playerFrom.GetPactState(pact, playerIdTo) == expectedState); + BOOST_TEST_REQUIRE(playerFrom.getPactState(pact, playerIdTo) == expectedState); // If pact was requested, to other player has no pact yet if(expectedState == PactState::InProgress) - BOOST_TEST_REQUIRE(playerTo.GetPactState(pact, playerIdFrom) == PactState::None); + BOOST_TEST_REQUIRE(playerTo.getPactState(pact, playerIdFrom) == PactState::None); else - BOOST_TEST_REQUIRE(playerTo.GetPactState(pact, playerIdFrom) == expectedState); + BOOST_TEST_REQUIRE(playerTo.getPactState(pact, playerIdFrom) == expectedState); // If pact is accepted, we must have some time remaining, else not if(expectedState == PactState::Accepted) - BOOST_TEST_REQUIRE(playerFrom.GetRemainingPactTime(pact, playerIdTo) > 0u); + BOOST_TEST_REQUIRE(playerFrom.getRemainingPactTime(pact, playerIdTo) > 0u); else - BOOST_TEST_REQUIRE(playerFrom.GetRemainingPactTime(pact, playerIdTo) == 0u); + BOOST_TEST_REQUIRE(playerFrom.getRemainingPactTime(pact, playerIdTo) == 0u); // Remaining times must match - BOOST_TEST_REQUIRE(playerFrom.GetRemainingPactTime(pact, playerIdTo) - == playerFrom.GetRemainingPactTime(pact, playerIdTo)); + BOOST_TEST_REQUIRE(playerFrom.getRemainingPactTime(pact, playerIdTo) + == playerFrom.getRemainingPactTime(pact, playerIdTo)); // Attackable must match - BOOST_TEST_REQUIRE(playerFrom.IsAttackable(playerIdTo) == playerTo.IsAttackable(playerIdFrom)); + BOOST_TEST_REQUIRE(playerFrom.isAttackable(playerIdTo) == playerTo.isAttackable(playerIdFrom)); // Ally must match - BOOST_TEST_REQUIRE(playerFrom.IsAlly(playerIdTo) == playerTo.IsAlly(playerIdFrom)); + BOOST_TEST_REQUIRE(playerFrom.isAlly(playerIdTo) == playerTo.isAlly(playerIdFrom)); // Attackable only when non-agg. pact not accepted - BOOST_TEST_REQUIRE(playerFrom.IsAttackable(playerIdTo) - == (playerFrom.GetPactState(PactType::NonAgressionPact, playerIdTo) != PactState::Accepted)); + BOOST_TEST_REQUIRE(playerFrom.isAttackable(playerIdTo) + == (playerFrom.getPactState(PactType::NonAgressionPact, playerIdTo) != PactState::Accepted)); // Ally when treaty of alliance accepted - BOOST_TEST_REQUIRE(playerFrom.IsAlly(playerIdTo) - == (playerFrom.GetPactState(PactType::TreatyOfAlliance, playerIdTo) == PactState::Accepted)); + BOOST_TEST_REQUIRE(playerFrom.isAlly(playerIdTo) + == (playerFrom.getPactState(PactType::TreatyOfAlliance, playerIdTo) == PactState::Accepted)); } } // namespace BOOST_FIXTURE_TEST_CASE(MakePactTest, WorldWithGCExecution3P, *utf::depends_on("PactTestSuite/InitialPactStates")) { - for(unsigned i = 0; i < world.GetNumPlayers(); i++) - world.GetPostMgr().AddPostBox(i); + for(unsigned i = 0; i < world.getNumPlayers(); i++) + world.getPostMgr().AddPostBox(i); // Use middle player for off-by-one detection curPlayer = 1; - GamePlayer& player1 = world.GetPlayer(1); - PostBox& postbox2 = *world.GetPostMgr().GetPostBox(2); - BOOST_TEST_REQUIRE(postbox2.GetNumMsgs() == 0u); + GamePlayer& player1 = world.getPlayer(1); + PostBox& postbox2 = *world.getPostMgr().getPostBox(2); + BOOST_TEST_REQUIRE(postbox2.getNumMsgs() == 0u); // Invalid length this->SuggestPact(2, PactType::NonAgressionPact, 0u); @@ -106,39 +106,39 @@ BOOST_FIXTURE_TEST_CASE(MakePactTest, WorldWithGCExecution3P, *utf::depends_on(" // Own player this->SuggestPact(1, PactType::NonAgressionPact, 0u); CheckPactState(world, 1, 2, PactType::NonAgressionPact, PactState::None); - BOOST_TEST_REQUIRE(postbox2.GetNumMsgs() == 0u); + BOOST_TEST_REQUIRE(postbox2.getNumMsgs() == 0u); const unsigned duration = 10; this->SuggestPact(2, PactType::NonAgressionPact, duration); // Suggesting a pact must send a post message to the target player - BOOST_TEST_REQUIRE(postbox2.GetNumMsgs() == 1u); - const auto* msg = dynamic_cast(postbox2.GetMsg(0)); + BOOST_TEST_REQUIRE(postbox2.getNumMsgs() == 1u); + const auto* msg = dynamic_cast(postbox2.getMsg(0)); BOOST_TEST_REQUIRE(msg); - BOOST_TEST(msg->GetPactType() == PactType::NonAgressionPact); //-V522 - BOOST_TEST(msg->GetPlayerId() == curPlayer); - BOOST_TEST(msg->IsAccept() == true); + BOOST_TEST(msg->getPactType() == PactType::NonAgressionPact); //-V522 + BOOST_TEST(msg->getPlayerId() == curPlayer); + BOOST_TEST(msg->isAccept() == true); // should be in progress for player1 CheckPactState(world, 1, 2, PactType::NonAgressionPact, PactState::InProgress); // Same player sends accept -> Disallowed - this->AcceptPact(msg->GetPactId(), PactType::NonAgressionPact, 2); + this->AcceptPact(msg->getPactId(), PactType::NonAgressionPact, 2); CheckPactState(world, 1, 2, PactType::NonAgressionPact, PactState::InProgress); curPlayer = 2; // Wrong ID - this->AcceptPact(msg->GetPactId() + 1, PactType::NonAgressionPact, msg->GetPlayerId()); + this->AcceptPact(msg->getPactId() + 1, PactType::NonAgressionPact, msg->getPlayerId()); CheckPactState(world, 1, 2, PactType::NonAgressionPact, PactState::InProgress); // Wrong Pact - this->AcceptPact(msg->GetPactId(), PactType::TreatyOfAlliance, msg->GetPlayerId()); + this->AcceptPact(msg->getPactId(), PactType::TreatyOfAlliance, msg->getPlayerId()); CheckPactState(world, 1, 2, PactType::NonAgressionPact, PactState::InProgress); // Correct - this->AcceptPact(msg->GetPactId(), PactType::NonAgressionPact, msg->GetPlayerId()); + this->AcceptPact(msg->getPactId(), PactType::NonAgressionPact, msg->getPlayerId()); CheckPactState(world, 1, 2, PactType::NonAgressionPact, PactState::Accepted); // Other pact should not be affected CheckPactState(world, 1, 2, PactType::TreatyOfAlliance, PactState::None); // Check duration - BOOST_TEST(player1.GetRemainingPactTime(PactType::NonAgressionPact, 2) == duration); + BOOST_TEST(player1.getRemainingPactTime(PactType::NonAgressionPact, 2) == duration); } // Creates a non-aggression pact between players 1 and 2 @@ -148,49 +148,49 @@ struct PactCreatedFixture : public WorldWithGCExecution3P const DiplomacyPostQuestion* msg; PactCreatedFixture() { - for(unsigned i = 0; i < world.GetNumPlayers(); i++) - world.GetPostMgr().AddPostBox(i); + for(unsigned i = 0; i < world.getNumPlayers(); i++) + world.getPostMgr().AddPostBox(i); // Use middle player for off-by-one detection curPlayer = 1; - PostBox& postbox2 = *world.GetPostMgr().GetPostBox(2); + PostBox& postbox2 = *world.getPostMgr().getPostBox(2); this->SuggestPact(2, PactType::NonAgressionPact, duration); - msg = dynamic_cast(postbox2.GetMsg(0)); + msg = dynamic_cast(postbox2.getMsg(0)); BOOST_TEST_REQUIRE(msg); curPlayer = 2; - this->AcceptPact(msg->GetPactId(), PactType::NonAgressionPact, msg->GetPlayerId()); + this->AcceptPact(msg->getPactId(), PactType::NonAgressionPact, msg->getPlayerId()); CheckPactState(world, 1, 2, PactType::NonAgressionPact, PactState::Accepted); } }; BOOST_FIXTURE_TEST_CASE(PactDurationTest, PactCreatedFixture, *utf::depends_on("PactTestSuite/MakePactTest")) { - GamePlayer& player1 = world.GetPlayer(1); + GamePlayer& player1 = world.getPlayer(1); // Check duration - BOOST_TEST_REQUIRE(player1.GetRemainingPactTime(PactType::NonAgressionPact, 2) == duration); + BOOST_TEST_REQUIRE(player1.getRemainingPactTime(PactType::NonAgressionPact, 2) == duration); // Execute the GFs during which the pact is valid, starting in the GF in which the pact was accepted for(unsigned i = 0; i < duration; i++) { // Pact still valid CheckPactState(world, 1, 2, PactType::NonAgressionPact, PactState::Accepted); - BOOST_TEST_REQUIRE(player1.GetRemainingPactTime(PactType::NonAgressionPact, 2) == duration - i); + BOOST_TEST_REQUIRE(player1.getRemainingPactTime(PactType::NonAgressionPact, 2) == duration - i); // Double accept -> Do not change - this->AcceptPact(msg->GetPactId(), PactType::NonAgressionPact, msg->GetPlayerId()); - BOOST_TEST_REQUIRE(player1.GetRemainingPactTime(PactType::NonAgressionPact, 2) == duration - i); + this->AcceptPact(msg->getPactId(), PactType::NonAgressionPact, msg->getPlayerId()); + BOOST_TEST_REQUIRE(player1.getRemainingPactTime(PactType::NonAgressionPact, 2) == duration - i); // Advance 1 GF and test pacts em.ExecuteNextGF(); player1.TestPacts(); } // On last GF the pact expired - BOOST_TEST(player1.GetRemainingPactTime(PactType::NonAgressionPact, 2) == 0u); + BOOST_TEST(player1.getRemainingPactTime(PactType::NonAgressionPact, 2) == 0u); CheckPactState(world, 1, 2, PactType::NonAgressionPact, PactState::None); } BOOST_FIXTURE_TEST_CASE(PactCanceling, PactCreatedFixture, *utf::depends_on("PactTestSuite/MakePactTest")) { - PostBox& postbox1 = *world.GetPostMgr().GetPostBox(1); - PostBox& postbox2 = *world.GetPostMgr().GetPostBox(2); + PostBox& postbox1 = *world.getPostMgr().getPostBox(1); + PostBox& postbox2 = *world.getPostMgr().getPostBox(2); postbox1.Clear(); postbox2.Clear(); @@ -199,12 +199,12 @@ BOOST_FIXTURE_TEST_CASE(PactCanceling, PactCreatedFixture, *utf::depends_on("Pac // Pact still alive CheckPactState(world, 1, 2, PactType::NonAgressionPact, PactState::Accepted); // But player1 should have received a question - BOOST_TEST_REQUIRE(postbox1.GetNumMsgs() == 1u); - msg = dynamic_cast(postbox1.GetMsg(0)); + BOOST_TEST_REQUIRE(postbox1.getNumMsgs() == 1u); + msg = dynamic_cast(postbox1.getMsg(0)); BOOST_TEST_REQUIRE(msg); - BOOST_TEST(msg->GetPlayerId() == 2u); - BOOST_TEST(msg->GetPactType() == PactType::NonAgressionPact); - BOOST_TEST(msg->IsAccept() == false); + BOOST_TEST(msg->getPlayerId() == 2u); + BOOST_TEST(msg->getPactType() == PactType::NonAgressionPact); + BOOST_TEST(msg->isAccept() == false); // Same player tries to cancel again this->CancelPact(PactType::NonAgressionPact, 1); @@ -220,22 +220,22 @@ BOOST_FIXTURE_TEST_CASE(PactCanceling, PactCreatedFixture, *utf::depends_on("Pac CheckPactState(world, 1, 2, PactType::NonAgressionPact, PactState::Accepted); // And finally do it. Each player should receive a message - BOOST_TEST_REQUIRE(postbox1.GetNumMsgs() == 2u); // 2 cancel messages - BOOST_TEST_REQUIRE(postbox2.GetNumMsgs() == 0u); + BOOST_TEST_REQUIRE(postbox1.getNumMsgs() == 2u); // 2 cancel messages + BOOST_TEST_REQUIRE(postbox2.getNumMsgs() == 0u); this->CancelPact(PactType::NonAgressionPact, 2); CheckPactState(world, 1, 2, PactType::NonAgressionPact, PactState::None); - BOOST_TEST_REQUIRE(postbox1.GetNumMsgs() == 3u); - BOOST_TEST_REQUIRE(postbox2.GetNumMsgs() == 1u); + BOOST_TEST_REQUIRE(postbox1.getNumMsgs() == 3u); + BOOST_TEST_REQUIRE(postbox2.getNumMsgs() == 1u); // The new message should not be a question - BOOST_TEST(!dynamic_cast(postbox1.GetMsg(postbox1.GetNumMsgs() - 1))); - BOOST_TEST(!dynamic_cast(postbox2.GetMsg(postbox2.GetNumMsgs() - 1))); + BOOST_TEST(!dynamic_cast(postbox1.getMsg(postbox1.getNumMsgs() - 1))); + BOOST_TEST(!dynamic_cast(postbox2.getMsg(postbox2.getNumMsgs() - 1))); } BOOST_FIXTURE_TEST_CASE(SuggestNewPactAfterExpiration, PactCreatedFixture, *utf::depends_on("PactTestSuite/MakePactTest")) { - GamePlayer& player1 = world.GetPlayer(1); - PostBox& postbox2 = *world.GetPostMgr().GetPostBox(2); + GamePlayer& player1 = world.getPlayer(1); + PostBox& postbox2 = *world.getPostMgr().getPostBox(2); postbox2.Clear(); // Execute the GFs until the pact is expired @@ -251,12 +251,12 @@ BOOST_FIXTURE_TEST_CASE(SuggestNewPactAfterExpiration, PactCreatedFixture, this->SuggestPact(2, PactType::NonAgressionPact, duration); // Test if other player has received the suggestion - BOOST_TEST_REQUIRE(postbox2.GetNumMsgs() == 1u); - msg = dynamic_cast(postbox2.GetMsg(0)); + BOOST_TEST_REQUIRE(postbox2.getNumMsgs() == 1u); + msg = dynamic_cast(postbox2.getMsg(0)); BOOST_TEST_REQUIRE(msg); // Other player accepts curPlayer = 2; - this->AcceptPact(msg->GetPactId(), PactType::NonAgressionPact, msg->GetPlayerId()); + this->AcceptPact(msg->getPactId(), PactType::NonAgressionPact, msg->getPlayerId()); // pact state must be accepted CheckPactState(world, 1, 2, PactType::NonAgressionPact, PactState::Accepted); } diff --git a/tests/s25Main/integration/testPathfinding.cpp b/tests/s25Main/integration/testPathfinding.cpp index c94b393ec2..3f7e79f20c 100644 --- a/tests/s25Main/integration/testPathfinding.cpp +++ b/tests/s25Main/integration/testPathfinding.cpp @@ -28,9 +28,9 @@ using WorldFixtureEmpty1P = WorldFixture; /// Sets all terrain to the given terrain void clearWorld(GameWorld& world, DescIdx terrain) { - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - MapNode& node = world.GetNodeWriteable(pt); + MapNode& node = world.getNodeWriteable(pt); node.t1 = node.t2 = terrain; } } @@ -42,17 +42,17 @@ void setupTestcase1(GameWorld& world, const MapPoint& startPt, DescIdx tWalkable, @@ -64,7 +64,7 @@ void setupTestcase2to4(GameWorld& world, const MapPoint& startPt, DescIdx testDirections{Direction::East, Direction::SouthEast, Direction::NorthEast}; - const auto deepWaterTerrains = world.GetDescription().terrain.findAll( + const auto deepWaterTerrains = world.getDescription().terrain.findAll( [](const TerrainDesc& t) { return !t.Is(ETerrain::Walkable) && !t.Is(ETerrain::Unreachable); }); - const auto tLand = GetLandTerrain(world.GetDescription()); + const auto tLand = GetLandTerrain(world.getDescription()); for(DescIdx deepWater : deepWaterTerrains) { for(Direction dir : testDirections) @@ -151,7 +151,7 @@ BOOST_FIXTURE_TEST_CASE(CrossTerrain, WorldFixtureEmpty1P) // 3 steps in dir MapPoint endPt(startPt); for(unsigned i = 0; i < 3; i++) - endPt = world.GetNeighbour(endPt, dir); + endPt = world.getNeighbour(endPt, dir); // We can't go directly so 1 step detour unsigned length; BOOST_TEST_REQUIRE(world.FindHumanPath(startPt, endPt, 99, false, &length)); @@ -164,15 +164,15 @@ BOOST_FIXTURE_TEST_CASE(CrossTerrain, WorldFixtureEmpty1P) std::vector roadRoute(3, dir); BOOST_TEST(world.BuildRoad(0, false, startPt, roadRoute) == endPt); Direction revDir(dir + 3u); - BOOST_TEST_REQUIRE(world.GetPointRoad(startPt, dir) == PointRoad::Normal); - BOOST_TEST_REQUIRE(world.GetPointRoad(endPt, revDir) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getPointRoad(startPt, dir) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getPointRoad(endPt, revDir) == PointRoad::Normal); world.DestroyFlag(endPt, 0); // Reverse direction std::vector roadRouteRev(3, revDir); world.SetFlag(endPt, 0); BOOST_TEST(world.BuildRoad(0, false, endPt, roadRouteRev) == startPt); - BOOST_TEST_REQUIRE(world.GetPointRoad(startPt, dir) == PointRoad::Normal); - BOOST_TEST_REQUIRE(world.GetPointRoad(endPt, revDir) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getPointRoad(startPt, dir) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getPointRoad(endPt, revDir) == PointRoad::Normal); world.DestroyFlag(startPt, 0); world.DestroyFlag(endPt, 0); } @@ -182,9 +182,9 @@ BOOST_FIXTURE_TEST_CASE(CrossTerrain, WorldFixtureEmpty1P) BOOST_FIXTURE_TEST_CASE(DontPassTerrain, WorldFixtureEmpty1P) { // For road checking all the points must belong to us (or any owner) - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - world.SetOwner(pt, 1); + world.setOwner(pt, 1); } // Start far enough away from the HQ in the middle const MapPoint startPt(1, 2); @@ -193,8 +193,8 @@ BOOST_FIXTURE_TEST_CASE(DontPassTerrain, WorldFixtureEmpty1P) // Test cases 4 a) b) c) Direction::West, Direction::SouthWest, Direction::NorthWest}; std::vector> deadlyTerrains = - world.GetDescription().terrain.findAll([](const TerrainDesc& t) { return t.Is(ETerrain::Unreachable); }); - const auto tLand = GetLandTerrain(world.GetDescription()); + world.getDescription().terrain.findAll([](const TerrainDesc& t) { return t.Is(ETerrain::Unreachable); }); + const auto tLand = GetLandTerrain(world.getDescription()); for(DescIdx deadlyTerrain : deadlyTerrains) { for(Direction dir : testDirections) @@ -203,7 +203,7 @@ BOOST_FIXTURE_TEST_CASE(DontPassTerrain, WorldFixtureEmpty1P) // 3 steps in dir MapPoint endPt(startPt); for(unsigned i = 0; i < 3; i++) - endPt = world.GetNeighbour(endPt, dir); + endPt = world.getNeighbour(endPt, dir); MapPoint curStartPt(startPt); // We test the green points first and the yellow points second for(int i = 0; i < 2; i++) @@ -219,19 +219,19 @@ BOOST_FIXTURE_TEST_CASE(DontPassTerrain, WorldFixtureEmpty1P) std::vector roadRoute(3, dir); BOOST_TEST(!world.BuildRoad(0, false, startPt, roadRoute).isValid()); Direction revDir(dir + 3u); - BOOST_TEST_REQUIRE(world.GetPointRoad(startPt, dir) == PointRoad::None); - BOOST_TEST_REQUIRE(world.GetPointRoad(endPt, revDir) == PointRoad::None); + BOOST_TEST_REQUIRE(world.getPointRoad(startPt, dir) == PointRoad::None); + BOOST_TEST_REQUIRE(world.getPointRoad(endPt, revDir) == PointRoad::None); world.DestroyFlag(startPt, 0); // Reverse direction std::vector roadRouteRev(3, revDir); world.SetFlag(endPt, 0); BOOST_TEST(!world.BuildRoad(0, false, endPt, roadRouteRev).isValid()); - BOOST_TEST_REQUIRE(world.GetPointRoad(startPt, revDir) == PointRoad::None); - BOOST_TEST_REQUIRE(world.GetPointRoad(endPt, dir) == PointRoad::None); + BOOST_TEST_REQUIRE(world.getPointRoad(startPt, revDir) == PointRoad::None); + BOOST_TEST_REQUIRE(world.getPointRoad(endPt, dir) == PointRoad::None); world.DestroyFlag(endPt, 0); // Switch to yellow points. They are placed to be one step left than the direction - curStartPt = world.GetNeighbour(curStartPt, dir - 1u); - endPt = world.GetNeighbour(endPt, dir - 1u); + curStartPt = world.getNeighbour(curStartPt, dir - 1u); + endPt = world.getNeighbour(endPt, dir - 1u); } } } @@ -241,12 +241,12 @@ BOOST_FIXTURE_TEST_CASE(BlockedPaths, WorldFixtureEmpty0P) { MapPoint startPt(3, 6); // Create a circle of stones so the path is completely blocked - std::vector surroundingPts = world.GetPointsInRadius(startPt, 1); + std::vector surroundingPts = world.getPointsInRadius(startPt, 1); for(const MapPoint& pt : surroundingPts) - world.SetNO(pt, new noGranite(GraniteType::One, 1)); + world.setNO(pt, new noGranite(GraniteType::One, 1)); std::vector surroundingPts2; for(unsigned i = 0; i < 12; i++) - surroundingPts2.push_back(world.GetNeighbour2(startPt, i)); + surroundingPts2.push_back(world.getNeighbour2(startPt, i)); for(const MapPoint& pt : surroundingPts2) BOOST_TEST_REQUIRE(!world.FindHumanPath(startPt, pt)); // Allow left exit diff --git a/tests/s25Main/integration/testProduction.cpp b/tests/s25Main/integration/testProduction.cpp index 8c23de0079..7a9cba9cdf 100644 --- a/tests/s25Main/integration/testProduction.cpp +++ b/tests/s25Main/integration/testProduction.cpp @@ -51,7 +51,7 @@ struct MineProductionFixture : WorldWithGCExecution1P inv[GoodType::Fish] = 40; inv[GoodType::PickAxe] = 1; inv[Job::Miner] = 1; - world.GetSpecObj(hqPos)->AddToInventory(inv, true); + world.getSpecObj(hqPos)->AddToInventory(inv, true); } // Places a mine of the given type next to the HQ, optionally seeds its resource spot, connects it by road and @@ -62,9 +62,9 @@ struct MineProductionFixture : WorldWithGCExecution1P const auto* mine = static_cast(BuildingFactory::CreateBuilding(world, mineType, minePos, curPlayer, Nation::Romans)); if(initialResource.getType() != ResourceType::Nothing) - world.GetNodeWriteable(minePos).resources = initialResource; - BuildRoad(world.GetNeighbour(minePos, Direction::SouthEast), false, std::vector(2, Direction::West)); - RTTR_EXEC_TILL(500, mine->HasWorker()); + world.getNodeWriteable(minePos).resources = initialResource; + BuildRoad(world.getNeighbour(minePos, Direction::SouthEast), false, std::vector(2, Direction::West)); + RTTR_EXEC_TILL(500, mine->hasWorker()); return minePos; } @@ -95,14 +95,14 @@ BOOST_FIXTURE_TEST_CASE(MetalWorkerStopped, WorldWithGCExecution1P) rttr::test::LogAccessor logAcc; ggs.setSelection(AddonId::TOOL_ORDERING, 1); ggs.setSelection(AddonId::METALWORKSBEHAVIORONZERO, 1); - world.GetSpecObj(hqPos)->AddToInventory(GoodCounts::make(GoodType::Iron, 10), true); + world.getSpecObj(hqPos)->AddToInventory(GoodCounts::make(GoodType::Iron, 10), true); MapPoint bldPos = hqPos + MapPoint(2, 0); BuildingFactory::CreateBuilding(world, BuildingType::Metalworks, bldPos, curPlayer, Nation::Africans); - this->BuildRoad(world.GetNeighbour(bldPos, Direction::SouthEast), false, + this->BuildRoad(world.getNeighbour(bldPos, Direction::SouthEast), false, std::vector(2, Direction::West)); MapPoint bldPos2 = hqPos - MapPoint(2, 0); BuildingFactory::CreateBuilding(world, BuildingType::Metalworks, bldPos2, curPlayer, Nation::Africans); - this->BuildRoad(world.GetNeighbour(bldPos2, Direction::SouthEast), false, + this->BuildRoad(world.getNeighbour(bldPos2, Direction::SouthEast), false, std::vector(2, Direction::East)); helpers::EnumArray toolOrder; @@ -116,9 +116,9 @@ BOOST_FIXTURE_TEST_CASE(MetalWorkerStopped, WorldWithGCExecution1P) toolOrder[Tool::Tongs] = 1; toolOrder[Tool::Cleaver] = 1; toolOrder[Tool::Rollingpin] = 1; - PostBox& postbox = world.GetPostMgr().AddPostBox(0); + PostBox& postbox = world.getPostMgr().AddPostBox(0); postbox.Clear(); - const Inventory& curInventory = world.GetPlayer(curPlayer).GetInventory(); + const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); Inventory expectedInventory = curInventory; expectedInventory.Add(GoodType::Tongs, toolOrder[Tool::Tongs]); expectedInventory.Add(GoodType::Cleaver, toolOrder[Tool::Cleaver]); @@ -127,8 +127,8 @@ BOOST_FIXTURE_TEST_CASE(MetalWorkerStopped, WorldWithGCExecution1P) this->ChangeTools(toolSettings, toolOrder.data()); RTTR_REQUIRE_LOG_CONTAINS("Committing an order", true); // Wait for completion message - RTTR_EXEC_TILL(3000, postbox.GetNumMsgs() == 1u); - BOOST_TEST_REQUIRE(postbox.GetMsg(0)->GetCategory() == PostCategory::Economy); + RTTR_EXEC_TILL(3000, postbox.getNumMsgs() == 1u); + BOOST_TEST_REQUIRE(postbox.getMsg(0)->getCategory() == PostCategory::Economy); // Stop it and wait till goods are produced this->SetProductionEnabled(bldPos, false); this->SetProductionEnabled(bldPos2, false); @@ -144,7 +144,7 @@ BOOST_FIXTURE_TEST_CASE(MetalWorkerOrders, WorldWithGCExecution1P) inv[GoodType::Stones] = 20; inv[GoodType::Iron] = 10; inv[Job::Metalworker] = 1; - world.GetSpecObj(hqPos)->AddToInventory(inv, true); + world.getSpecObj(hqPos)->AddToInventory(inv, true); ggs.setSelection(AddonId::METALWORKSBEHAVIORONZERO, 1); ggs.setSelection(AddonId::TOOL_ORDERING, 1); ToolSettings settings; @@ -153,13 +153,13 @@ BOOST_FIXTURE_TEST_CASE(MetalWorkerOrders, WorldWithGCExecution1P) MapPoint housePos(hqPos.x + 3, hqPos.y); const nobUsual* mw = static_cast( BuildingFactory::CreateBuilding(world, BuildingType::Metalworks, housePos, curPlayer, Nation::Romans)); - MapPoint flagPos = world.GetNeighbour(hqPos, Direction::SouthEast); + MapPoint flagPos = world.getNeighbour(hqPos, Direction::SouthEast); this->BuildRoad(flagPos, false, std::vector(3, Direction::East)); - RTTR_EXEC_TILL(200, mw->HasWorker()); + RTTR_EXEC_TILL(200, mw->hasWorker()); BOOST_TEST_REQUIRE(!mw->is_working); // Wait till he has all the wares - RTTR_EXEC_TILL(3000, mw->GetNumWares(0) == 6); - RTTR_EXEC_TILL(3000, mw->GetNumWares(1) == 6); + RTTR_EXEC_TILL(3000, mw->getNumWares(0) == 6); + RTTR_EXEC_TILL(3000, mw->getNumWares(1) == 6); // No order -> not working BOOST_TEST_REQUIRE(!mw->is_working); helpers::EnumArray orders; @@ -174,7 +174,7 @@ BOOST_FIXTURE_TEST_CASE(MetalWorkerOrders, WorldWithGCExecution1P) BOOST_FIXTURE_TEST_CASE(GraniteMineWithoutResourcesNeedsAddon, MineProductionFixture) { CreateMine(BuildingType::GraniteMine); - const Inventory& curInventory = world.GetPlayer(curPlayer).GetInventory(); + const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialStones = curInventory[GoodType::Stones]; RTTR_SKIP_GFS(maxProductionGFs); @@ -187,7 +187,7 @@ BOOST_FIXTURE_TEST_CASE(InexhaustibleGraniteMineStillNeedsResourceSpot, MineProd ggs.setSelection(AddonId::GRANITEMINE_RESOURCE_BEHAVIOR, static_cast(MineResourceBehavior::Inexhaustible)); CreateMine(BuildingType::GraniteMine); - const Inventory& curInventory = world.GetPlayer(curPlayer).GetInventory(); + const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialStones = curInventory[GoodType::Stones]; RTTR_SKIP_GFS(maxProductionGFs); @@ -200,14 +200,14 @@ BOOST_FIXTURE_TEST_CASE(GraniteMineWorkEverywhereProducesWithoutCreatingResource ggs.setSelection(AddonId::GRANITEMINE_RESOURCE_BEHAVIOR, static_cast(MineResourceBehavior::WorkEverywhere)); const MapPoint minePos = CreateMine(BuildingType::GraniteMine); - const Inventory& curInventory = world.GetPlayer(curPlayer).GetInventory(); + const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialStones = curInventory[GoodType::Stones]; RTTR_EXEC_TILL(maxProductionGFs, curInventory[GoodType::Stones] > initialStones); // WorkEverywhere must not conjure a deposit into the ground - BOOST_TEST(static_cast(world.GetNode(minePos).resources.getType()) + BOOST_TEST(static_cast(world.getNode(minePos).resources.getType()) == static_cast(ResourceType::Nothing)); - BOOST_TEST(world.GetNode(minePos).resources.getAmount() == 0u); + BOOST_TEST(world.getNode(minePos).resources.getAmount() == 0u); } BOOST_FIXTURE_TEST_CASE(GraniteMineWorkEverywhereIgnoresExistingResource, MineProductionFixture) @@ -217,12 +217,12 @@ BOOST_FIXTURE_TEST_CASE(GraniteMineWorkEverywhereIgnoresExistingResource, MinePr // A granite mine on a foreign (coal) deposit still just makes stones and leaves the deposit untouched. const Resource foreignDeposit(ResourceType::Coal, 4); const MapPoint minePos = CreateMine(BuildingType::GraniteMine, foreignDeposit); - const Inventory& curInventory = world.GetPlayer(curPlayer).GetInventory(); + const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialStones = curInventory[GoodType::Stones]; RTTR_EXEC_TILL(maxProductionGFs, curInventory[GoodType::Stones] > initialStones); - BOOST_TEST(world.GetNode(minePos).resources.has(foreignDeposit.getType())); - BOOST_TEST(world.GetNode(minePos).resources.getAmount() == foreignDeposit.getAmount()); + BOOST_TEST(world.getNode(minePos).resources.has(foreignDeposit.getType())); + BOOST_TEST(world.getNode(minePos).resources.getAmount() == foreignDeposit.getAmount()); } BOOST_FIXTURE_TEST_CASE(CoalMineInexhaustibleBehaviorDoesNotDepleteResource, MineProductionFixture) @@ -230,14 +230,14 @@ BOOST_FIXTURE_TEST_CASE(CoalMineInexhaustibleBehaviorDoesNotDepleteResource, Min ggs.setSelection(AddonId::COALMINE_RESOURCE_BEHAVIOR, static_cast(MineResourceBehavior::Inexhaustible)); const Resource initCoal(ResourceType::Coal, 4); const MapPoint minePos = CreateMine(BuildingType::CoalMine, initCoal); - const Inventory& curInventory = world.GetPlayer(curPlayer).GetInventory(); + const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialCoal = curInventory[GoodType::Coal]; RTTR_EXEC_TILL(maxProductionGFs, curInventory[GoodType::Coal] > initialCoal); // Inexhaustible mines produce without ever reducing the deposit - BOOST_TEST(world.GetNode(minePos).resources.has(initCoal.getType())); - BOOST_TEST(world.GetNode(minePos).resources.getAmount() == initCoal.getAmount()); + BOOST_TEST(world.getNode(minePos).resources.has(initCoal.getType())); + BOOST_TEST(world.getNode(minePos).resources.getAmount() == initCoal.getAmount()); } // Comparison A: an almost exhausted S4-like mine mostly mines nothing, so the coal count stays put (see the @@ -247,14 +247,14 @@ BOOST_FIXTURE_TEST_CASE(CoalMineS4LikeExhaustionCanProduceNothing, MineProductio ggs.setSelection(AddonId::COALMINE_RESOURCE_BEHAVIOR, static_cast(MineResourceBehavior::S4LikeExhaustion)); const MapPoint minePos = CreateMine(BuildingType::CoalMine, Resource(ResourceType::Coal, 1)); - const Inventory& curInventory = world.GetPlayer(curPlayer).GetInventory(); + const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialCoal = curInventory[GoodType::Coal]; SeedProductionRng(s4LikeComparisonSeed); RTTR_SKIP_GFS(s4LikeComparisonGFs); BOOST_TEST(curInventory[GoodType::Coal] == initialCoal); - BOOST_TEST(world.GetNode(minePos).resources.getAmount() == 1u); + BOOST_TEST(world.getNode(minePos).resources.getAmount() == 1u); } // Same scenario for every configured no-output fallback: an S4-like mine sitting on a single-unit deposit keeps @@ -275,7 +275,7 @@ BOOST_DATA_TEST_CASE_F( ggs.setSelection(sample.mineBehaviorAddon, static_cast(MineResourceBehavior::S4LikeExhaustion)); ggs.setSelection(AddonId::MINE_NO_OUTPUT_FALLBACK, static_cast(sample.fallback)); const MapPoint minePos = CreateMine(sample.mineType, Resource(sample.mineResource, 1)); - const Inventory& curInventory = world.GetPlayer(curPlayer).GetInventory(); + const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialPrimary = curInventory[sample.primaryGood]; const unsigned initialFallback = curInventory[sample.fallbackGood]; @@ -283,7 +283,7 @@ BOOST_DATA_TEST_CASE_F( RTTR_EXEC_TILL(maxProductionGFs, curInventory[sample.fallbackGood] > initialFallback); BOOST_TEST(curInventory[sample.primaryGood] == initialPrimary); - BOOST_TEST(world.GetNode(minePos).resources.getAmount() == 1u); + BOOST_TEST(world.getNode(minePos).resources.getAmount() == 1u); } // Comparison B (see CoalMineS4LikeExhaustionCanProduceNothing): same seed and window, but a full deposit reliably @@ -295,9 +295,9 @@ BOOST_FIXTURE_TEST_CASE(CoalMineS4LikeExhaustionReducesResourceOnSuccessfulCycle const MapPoint minePos = CreateMine(BuildingType::CoalMine, Resource(ResourceType::Coal, 15)); SeedProductionRng(s4LikeComparisonSeed); - RTTR_EXEC_TILL(s4LikeComparisonGFs, world.GetNode(minePos).resources.getAmount() == 14u); + RTTR_EXEC_TILL(s4LikeComparisonGFs, world.getNode(minePos).resources.getAmount() == 14u); - BOOST_TEST(world.GetNode(minePos).resources.getAmount() == 14u); + BOOST_TEST(world.getNode(minePos).resources.getAmount() == 14u); } // A mine that actually produces its primary ware ignores the no-output fallback entirely (no stones), both for the @@ -308,7 +308,7 @@ BOOST_FIXTURE_TEST_CASE(CoalMineS4LikeSuccessfulCycleIgnoresNoOutputFallback, Mi static_cast(MineResourceBehavior::S4LikeExhaustion)); ggs.setSelection(AddonId::MINE_NO_OUTPUT_FALLBACK, static_cast(MineNoOutputFallback::ProduceGranite100)); const MapPoint minePos = CreateMine(BuildingType::CoalMine, Resource(ResourceType::Coal, 15)); - const Inventory& curInventory = world.GetPlayer(curPlayer).GetInventory(); + const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialCoal = curInventory[GoodType::Coal]; const unsigned initialStones = curInventory[GoodType::Stones]; @@ -318,14 +318,14 @@ BOOST_FIXTURE_TEST_CASE(CoalMineS4LikeSuccessfulCycleIgnoresNoOutputFallback, Mi BOOST_TEST(curInventory[GoodType::Stones] == initialStones); // S4-like consumes exactly one unit per successful cycle - BOOST_TEST(world.GetNode(minePos).resources.getAmount() == 14u); + BOOST_TEST(world.getNode(minePos).resources.getAmount() == 14u); } BOOST_FIXTURE_TEST_CASE(CoalMineDefaultProductionIgnoresNoOutputFallback, MineProductionFixture) { ggs.setSelection(AddonId::MINE_NO_OUTPUT_FALLBACK, static_cast(MineNoOutputFallback::ProduceGranite100)); const MapPoint minePos = CreateMine(BuildingType::CoalMine, Resource(ResourceType::Coal, 3)); - const Inventory& curInventory = world.GetPlayer(curPlayer).GetInventory(); + const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialCoal = curInventory[GoodType::Coal]; const unsigned initialStones = curInventory[GoodType::Stones]; @@ -334,41 +334,41 @@ BOOST_FIXTURE_TEST_CASE(CoalMineDefaultProductionIgnoresNoOutputFallback, MinePr BOOST_TEST(curInventory[GoodType::Stones] == initialStones); // The default behavior depletes the deposit on every production - BOOST_TEST(world.GetNode(minePos).resources.getAmount() < 3u); + BOOST_TEST(world.getNode(minePos).resources.getAmount() < 3u); } BOOST_FIXTURE_TEST_CASE(CoalMineWorkEverywhereBehaviorProducesWithoutCreatingResource, MineProductionFixture) { ggs.setSelection(AddonId::COALMINE_RESOURCE_BEHAVIOR, static_cast(MineResourceBehavior::WorkEverywhere)); const MapPoint minePos = CreateMine(BuildingType::CoalMine); - const Inventory& curInventory = world.GetPlayer(curPlayer).GetInventory(); + const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialCoal = curInventory[GoodType::Coal]; RTTR_EXEC_TILL(maxProductionGFs, curInventory[GoodType::Coal] > initialCoal); - BOOST_TEST(static_cast(world.GetNode(minePos).resources.getType()) + BOOST_TEST(static_cast(world.getNode(minePos).resources.getType()) == static_cast(ResourceType::Nothing)); - BOOST_TEST(world.GetNode(minePos).resources.getAmount() == 0u); + BOOST_TEST(world.getNode(minePos).resources.getAmount() == 0u); } // Regression test: the out-of-resources notification was moved from nofWorkman::FindPointWithResource into its // callers, so every caller (not only mines) must still report it. BOOST_FIXTURE_TEST_CASE(WellWithoutWaterReportsOutOfResources, WorldWithGCExecution1P) { - PostBox& postbox = world.GetPostMgr().AddPostBox(curPlayer); + PostBox& postbox = world.getPostMgr().AddPostBox(curPlayer); GoodsAndPeopleCounts inv; inv[GoodType::Fish] = 40; inv[Job::Helper] = 2; - world.GetSpecObj(hqPos)->AddToInventory(inv, true); + world.getSpecObj(hqPos)->AddToInventory(inv, true); const MapPoint wellPos = hqPos + MapPoint(2, 0); const auto* well = static_cast( BuildingFactory::CreateBuilding(world, BuildingType::Well, wellPos, curPlayer, Nation::Romans)); - BuildRoad(world.GetNeighbour(wellPos, Direction::SouthEast), false, std::vector(2, Direction::West)); - RTTR_EXEC_TILL(500, well->HasWorker()); + BuildRoad(world.getNeighbour(wellPos, Direction::SouthEast), false, std::vector(2, Direction::West)); + RTTR_EXEC_TILL(500, well->hasWorker()); // The empty test world has no water resources at all, so the well must report that it dried out - RTTR_EXEC_TILL(2000, postbox.GetNumMsgs() > 0u); - BOOST_TEST(well->GetProductivity() == 0u); + RTTR_EXEC_TILL(2000, postbox.getNumMsgs() > 0u); + BOOST_TEST(well->getProductivity() == 0u); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/integration/testSeaAttacking.cpp b/tests/s25Main/integration/testSeaAttacking.cpp index 0d2ff3c5df..ec785ac453 100644 --- a/tests/s25Main/integration/testSeaAttacking.cpp +++ b/tests/s25Main/integration/testSeaAttacking.cpp @@ -47,37 +47,37 @@ struct SeaAttackFixture : public SeaWorldWithGCExecution<3, 62, 64> SeaAttackFixture() : gwv(curPlayer, world) { // Make sure attacking is not limited by visibility - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - world.SetVisibility(pt, 2, Visibility::Visible); + world.setVisibility(pt, 2, Visibility::Visible); } // Block diagonals with granite so no human path is possible - for(MapCoord i = 1; i < std::min(world.GetWidth(), world.GetHeight()); i++) + for(MapCoord i = 1; i < std::min(world.getWidth(), world.getHeight()); i++) { MapPoint pt(i, i); - if(world.GetNode(pt).bq != BuildingQuality::Nothing) + if(world.getNode(pt).bq != BuildingQuality::Nothing) { - world.SetNO(pt, new noGranite(GraniteType::One, 5)); - if(pt.x + 1 < world.GetWidth()) - world.SetNO(pt + MapPoint(1, 0), new noGranite(GraniteType::One, 5)); + world.setNO(pt, new noGranite(GraniteType::One, 5)); + if(pt.x + 1 < world.getWidth()) + world.setNO(pt + MapPoint(1, 0), new noGranite(GraniteType::One, 5)); world.RecalcBQAroundPointBig(pt); } - pt = MapPoint(world.GetHeight() - i - 1u, i); - if(pt.x < world.GetWidth() && world.GetNode(pt).bq != BuildingQuality::Nothing) + pt = MapPoint(world.getHeight() - i - 1u, i); + if(pt.x < world.getWidth() && world.getNode(pt).bq != BuildingQuality::Nothing) { - world.SetNO(pt, new noGranite(GraniteType::One, 5)); - if(pt.x + 1 < world.GetWidth()) - world.SetNO(pt + MapPoint(1, 0), new noGranite(GraniteType::One, 5)); + world.setNO(pt, new noGranite(GraniteType::One, 5)); + if(pt.x + 1 < world.getWidth()) + world.setNO(pt + MapPoint(1, 0), new noGranite(GraniteType::One, 5)); world.RecalcBQAroundPointBig(pt); } } for(unsigned i = 0; i < 3; i++) { - SetCurPlayer(i); - hqPos[i] = world.GetPlayer(i).GetHQPos(); - auto* hq = world.GetSpecObj(hqPos[i]); + setCurPlayer(i); + hqPos[i] = world.getPlayer(i).getHQPos(); + auto* hq = world.getSpecObj(hqPos[i]); hq->AddToInventory(PeopleCounts::make(Job::General, 3), true); this->ChangeMilitary(MILITARY_SETTINGS_SCALE); } @@ -89,45 +89,45 @@ struct SeaAttackFixture : public SeaWorldWithGCExecution<3, 62, 64> // Harbors must be at same sea constexpr SeaId seaId(1); - BOOST_TEST_REQUIRE(world.IsHarborAtSea(HarborId(1), seaId)); - BOOST_TEST_REQUIRE(world.IsHarborAtSea(HarborId(3), seaId)); - BOOST_TEST_REQUIRE(world.IsHarborAtSea(HarborId(6), seaId)); - harborPos[0] = world.GetHarborPoint(HarborId(1)); - harborPos[1] = world.GetHarborPoint(HarborId(3)); - harborPos[2] = world.GetHarborPoint(HarborId(6)); + BOOST_TEST_REQUIRE(world.isHarborAtSea(HarborId(1), seaId)); + BOOST_TEST_REQUIRE(world.isHarborAtSea(HarborId(3), seaId)); + BOOST_TEST_REQUIRE(world.isHarborAtSea(HarborId(6), seaId)); + harborPos[0] = world.getHarborPoint(HarborId(1)); + harborPos[1] = world.getHarborPoint(HarborId(3)); + harborPos[2] = world.getHarborPoint(HarborId(6)); // Place harbors (Player 0 has none) for(unsigned i = 1; i < 3; i++) { - SetCurPlayer(i); + setCurPlayer(i); BOOST_TEST_REQUIRE(gwv.GetBQ(harborPos[i]) == BuildingQuality::Harbor); const noBuilding* hb = BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, harborPos[i], i, Nation(i)); BOOST_TEST_REQUIRE(hb); BuildRoadForBlds(harborPos[i], hqPos[i]); - MapPoint shipPos = world.GetCoastalPoint(world.GetHarborPointID(harborPos[i]), seaId); + MapPoint shipPos = world.getCoastalPoint(world.getHarborPointID(harborPos[i]), seaId); shipPos = world.MakeMapPoint(Position(shipPos) + (Position(shipPos) - Position(harborPos[i])) * 8); BOOST_TEST_REQUIRE(shipPos.isValid()); auto& ship = world.AddFigure(shipPos, std::make_unique(shipPos, i)); - world.GetPlayer(i).RegisterShip(ship); + world.getPlayer(i).RegisterShip(ship); } // Build some military buildings - milBld1NearPos = FindBldPos(world.GetHarborPoint(HarborId(3)) + MapPoint(3, 2), BuildingQuality::House, 1); + milBld1NearPos = FindBldPos(world.getHarborPoint(HarborId(3)) + MapPoint(3, 2), BuildingQuality::House, 1); BOOST_TEST_REQUIRE(milBld1NearPos.isValid()); BOOST_TEST_REQUIRE(world.GetBQ(milBld1NearPos, 1) >= BuildingQuality::House); milBld1Near = dynamic_cast( BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, milBld1NearPos, 1, Nation::Romans)); BOOST_TEST_REQUIRE(milBld1Near); - milBld1FarPos = FindBldPos(world.GetHarborPoint(HarborId(4)) - MapPoint(1, 4), BuildingQuality::House, 1); + milBld1FarPos = FindBldPos(world.getHarborPoint(HarborId(4)) - MapPoint(1, 4), BuildingQuality::House, 1); BOOST_TEST_REQUIRE(milBld1FarPos.isValid()); BOOST_TEST_REQUIRE(world.GetBQ(milBld1FarPos, 1) >= BuildingQuality::House); milBld1Far = dynamic_cast( BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, milBld1FarPos, 1, Nation::Romans)); BOOST_TEST_REQUIRE(milBld1Far); - milBld2Pos = FindBldPos(world.GetHarborPoint(HarborId(6)) - MapPoint(2, 2), BuildingQuality::House, 2); + milBld2Pos = FindBldPos(world.getHarborPoint(HarborId(6)) - MapPoint(2, 2), BuildingQuality::House, 2); BOOST_TEST_REQUIRE(milBld2Pos.isValid()); BOOST_TEST_REQUIRE(world.GetBQ(milBld2Pos, 2) >= BuildingQuality::House); milBld2 = dynamic_cast( @@ -139,7 +139,7 @@ struct SeaAttackFixture : public SeaWorldWithGCExecution<3, 62, 64> AddSoldiers(milBld1FarPos, 6, 0); // Skip near bld so we have an empty one for testing - SetCurPlayer(2); + setCurPlayer(2); // Enemy harbors don't block ggs.setSelection(AddonId::SEA_ATTACK, 0); } @@ -161,7 +161,7 @@ struct SeaAttackFixture : public SeaWorldWithGCExecution<3, 62, 64> return pts.at(0); } - void SetCurPlayer(unsigned playerIdx) + void setCurPlayer(unsigned playerIdx) { curPlayer = playerIdx; gwv.ChangePlayer(playerIdx, false); @@ -169,20 +169,20 @@ struct SeaAttackFixture : public SeaWorldWithGCExecution<3, 62, 64> void AddSoldiersWithRank(MapPoint bldPos, unsigned numSoldiers, unsigned rank) { - BOOST_TEST_REQUIRE(rank <= world.GetGGS().GetMaxMilitaryRank()); - auto* bld = world.GetSpecObj(bldPos); + BOOST_TEST_REQUIRE(rank <= world.getGGS().getMaxMilitaryRank()); + auto* bld = world.getSpecObj(bldPos); BOOST_TEST_REQUIRE(bld); - const unsigned oldNumSoldiers = bld->GetNumTroops(); + const unsigned oldNumSoldiers = bld->getNumTroops(); for(unsigned i = 0; i < numSoldiers; i++) { auto& soldier = - world.AddFigure(bldPos, std::make_unique(bldPos, bld->GetPlayer(), bld, bld, rank)); - world.GetPlayer(bld->GetPlayer()).IncreaseInventoryJob(soldier.GetJobType(), 1); + world.AddFigure(bldPos, std::make_unique(bldPos, bld->getPlayer(), bld, bld, rank)); + world.getPlayer(bld->getPlayer()).IncreaseInventoryJob(soldier.getJobType(), 1); // Let him "walk" to goal -> Already reached -> Added and all internal states set correctly soldier.WalkToGoal(); - BOOST_TEST_REQUIRE(!soldier.GetGoal()); + BOOST_TEST_REQUIRE(!soldier.getGoal()); } - BOOST_TEST_REQUIRE(bld->GetNumTroops() == oldNumSoldiers + numSoldiers); + BOOST_TEST_REQUIRE(bld->getNumTroops() == oldNumSoldiers + numSoldiers); } void AddSoldiers(MapPoint bldPos, unsigned numWeak, unsigned numStrong) @@ -194,23 +194,23 @@ struct SeaAttackFixture : public SeaWorldWithGCExecution<3, 62, 64> /// Assert that attacking the given building from milBld2 fails void TestFailingSeaAttack(MapPoint bldPos, unsigned numSoldiersLeft = 6u) { - BOOST_TEST_REQUIRE(milBld2->GetNumTroops() == numSoldiersLeft); + BOOST_TEST_REQUIRE(milBld2->getNumTroops() == numSoldiersLeft); // No available soldiers - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForSeaAttack(bldPos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForSeaAttack(bldPos) == 0u); this->SeaAttack(bldPos, 1, true); // Same left - BOOST_TEST_REQUIRE(milBld2->GetNumTroops() == numSoldiersLeft); + BOOST_TEST_REQUIRE(milBld2->getNumTroops() == numSoldiersLeft); } /// Asserts that the milBld2 contains the given amount of strong/weak soldiers void TestTroopCt(unsigned numStrong, unsigned numWeak) const { - BOOST_TEST_REQUIRE(milBld2->GetNumTroops() == numStrong + numWeak); - auto itTroops = milBld2->GetTroops().begin(); + BOOST_TEST_REQUIRE(milBld2->getNumTroops() == numStrong + numWeak); + auto itTroops = milBld2->getTroops().begin(); for(unsigned i = 0; i < numWeak; i++, ++itTroops) - BOOST_TEST_REQUIRE(itTroops->GetRank() == 0u); + BOOST_TEST_REQUIRE(itTroops->getRank() == 0u); for(unsigned i = 0; i < numStrong; i++, ++itTroops) - BOOST_TEST_REQUIRE(itTroops->GetRank() == 4u); + BOOST_TEST_REQUIRE(itTroops->getRank() == 4u); } }; @@ -222,12 +222,12 @@ BOOST_FIXTURE_TEST_CASE(SeaAttackDisabled, SeaAttackFixture) ggs.setSelection(AddonId::SEA_ATTACK, 2); // No land attack - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[0]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[1]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(harborPos[0]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(harborPos[1]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld1NearPos) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld1FarPos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[0]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[1]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(harborPos[0]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(harborPos[1]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1NearPos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1FarPos) == 0u); // No sea attack TestFailingSeaAttack(hqPos[0]); @@ -245,12 +245,12 @@ BOOST_FIXTURE_TEST_CASE(SeaAttackInPeacefulMode, SeaAttackFixture) ggs.setSelection(AddonId::PEACEFULMODE, 1); // No land attack - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[0]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[1]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(harborPos[0]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(harborPos[1]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld1NearPos) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld1FarPos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[0]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[1]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(harborPos[0]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(harborPos[1]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1NearPos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1FarPos) == 0u); // No sea attack TestFailingSeaAttack(hqPos[0]); @@ -265,12 +265,12 @@ BOOST_FIXTURE_TEST_CASE(NoHarborBlock, SeaAttackFixture) // Enemy harbors don't block ggs.setSelection(AddonId::SEA_ATTACK, 0); // No land attack - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[0]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[1]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(harborPos[0]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(harborPos[1]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld1NearPos) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld1FarPos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[0]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[1]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(harborPos[0]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(harborPos[1]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1NearPos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1FarPos) == 0u); // No building TestFailingSeaAttack(harborPos[0]); @@ -291,21 +291,21 @@ BOOST_FIXTURE_TEST_CASE(NoHarborBlock, SeaAttackFixture) AddSoldiers(milBld1NearPos, 6, 0); // Rest is attackable - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForSeaAttack(hqPos[0]) == 5u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForSeaAttack(hqPos[1]) == 5u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForSeaAttack(milBld1NearPos) == 5u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForSeaAttack(harborPos[1]) == 5u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForSeaAttack(hqPos[0]) == 5u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForSeaAttack(hqPos[1]) == 5u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForSeaAttack(milBld1NearPos) == 5u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForSeaAttack(harborPos[1]) == 5u); this->SeaAttack(hqPos[0], 1, true); - BOOST_TEST_REQUIRE(milBld2->GetNumTroops() == 5u); + BOOST_TEST_REQUIRE(milBld2->getNumTroops() == 5u); this->SeaAttack(hqPos[1], 1, true); - BOOST_TEST_REQUIRE(milBld2->GetNumTroops() == 4u); + BOOST_TEST_REQUIRE(milBld2->getNumTroops() == 4u); this->SeaAttack(milBld1NearPos, 1, true); - BOOST_TEST_REQUIRE(milBld2->GetNumTroops() == 3u); + BOOST_TEST_REQUIRE(milBld2->getNumTroops() == 3u); this->SeaAttack(harborPos[1], 2, true); - BOOST_TEST_REQUIRE(milBld2->GetNumTroops() == 1u); + BOOST_TEST_REQUIRE(milBld2->getNumTroops() == 1u); // All gone TestFailingSeaAttack(harborPos[1], 1u); @@ -318,12 +318,12 @@ BOOST_FIXTURE_TEST_CASE(HarborsBlock, SeaAttackFixture) // Enemy harbors block ggs.setSelection(AddonId::SEA_ATTACK, 1); // No land attack - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[0]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(hqPos[1]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(harborPos[0]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(harborPos[1]) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld1NearPos) == 0u); - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForAttack(milBld1FarPos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[0]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(hqPos[1]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(harborPos[0]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(harborPos[1]) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1NearPos) == 0u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1FarPos) == 0u); // Harbor exists -> Can't attack TestFailingSeaAttack(hqPos[1]); @@ -340,41 +340,41 @@ BOOST_FIXTURE_TEST_CASE(HarborsBlock, SeaAttackFixture) TestFailingSeaAttack(harborPos[0]); // HQ Attackable as no harbor at harbor spot (but regular bld) - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForSeaAttack(hqPos[0]) == 5u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForSeaAttack(hqPos[0]) == 5u); // Harbor is always attackable - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForSeaAttack(harborPos[1]) == 5u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForSeaAttack(harborPos[1]) == 5u); // HQ this->SeaAttack(hqPos[0], 1, true); - BOOST_TEST_REQUIRE(milBld2->GetNumTroops() == 5u); + BOOST_TEST_REQUIRE(milBld2->getNumTroops() == 5u); // Harbor this->SeaAttack(harborPos[1], 1, true); - BOOST_TEST_REQUIRE(milBld2->GetNumTroops() == 4u); + BOOST_TEST_REQUIRE(milBld2->getNumTroops() == 4u); // Test for unowned harbor - const MapPoint harborBot1 = world.GetHarborPoint(HarborId(7)); - const MapPoint harborBot2 = world.GetHarborPoint(HarborId(8)); - BOOST_TEST_REQUIRE(world.GetNode(harborBot1).owner == 0u); - BOOST_TEST_REQUIRE(world.GetNode(harborBot2).owner == 0u); + const MapPoint harborBot1 = world.getHarborPoint(HarborId(7)); + const MapPoint harborBot2 = world.getHarborPoint(HarborId(8)); + BOOST_TEST_REQUIRE(world.getNode(harborBot1).owner == 0u); + BOOST_TEST_REQUIRE(world.getNode(harborBot2).owner == 0u); // Place military bld for player 1, first make some owned land const MapPoint bldPos = (harborBot1 + harborBot2) / MapCoord(2) + MapPoint(6, 0); // Distance: <= attack distance (+ reserve) but greater than range from military bld (current values) BOOST_TEST_REQUIRE(world.CalcDistance(bldPos, harborBot2) <= 12u); BOOST_TEST_REQUIRE(world.CalcDistance(bldPos, harborBot2) >= 9u); - BOOST_TEST_REQUIRE(world.GetNode(bldPos).bq == BuildingQuality::Castle); - std::vector pts = world.GetPointsInRadius(bldPos, 3); + BOOST_TEST_REQUIRE(world.getNode(bldPos).bq == BuildingQuality::Castle); + std::vector pts = world.getPointsInRadius(bldPos, 3); pts.push_back(bldPos); for(const MapPoint& pt : pts) - world.SetOwner(pt, 1 + 1); + world.setOwner(pt, 1 + 1); const noBuilding* bld = BuildingFactory::CreateBuilding(world, BuildingType::Barracks, bldPos, 1, Nation::Romans); BOOST_TEST_REQUIRE(bld); AddSoldiers(bldPos, 2, 0); // Still unowned harbors - BOOST_TEST_REQUIRE(world.GetNode(harborBot1).owner == 0u); - BOOST_TEST_REQUIRE(world.GetNode(harborBot2).owner == 0u); + BOOST_TEST_REQUIRE(world.getNode(harborBot1).owner == 0u); + BOOST_TEST_REQUIRE(world.getNode(harborBot2).owner == 0u); // But we can attack the building - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForSeaAttack(bldPos) == 3u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForSeaAttack(bldPos) == 3u); this->SeaAttack(bldPos, 1, true); - BOOST_TEST_REQUIRE(milBld2->GetNumTroops() == 3u); + BOOST_TEST_REQUIRE(milBld2->getNumTroops() == 3u); } BOOST_FIXTURE_TEST_CASE(AttackWithTeams, SeaAttackFixture) @@ -392,27 +392,27 @@ BOOST_FIXTURE_TEST_CASE(AttackWithTeams, SeaAttackFixture) // Enemy harbor blocks TestFailingSeaAttack(hqPos[1]); - world.GetPlayer(0).team = Team::Team2; //-V525 - world.GetPlayer(1).team = Team::Team1; - world.GetPlayer(2).team = Team::Team1; + world.getPlayer(0).team = Team::Team2; //-V525 + world.getPlayer(1).team = Team::Team1; + world.getPlayer(2).team = Team::Team1; for(unsigned i = 0; i < 3; i++) - world.GetPlayer(i).MakeStartPacts(); + world.getPlayer(i).MakeStartPacts(); // Can't attack ally TestFailingSeaAttack(harborPos[1]); TestFailingSeaAttack(hqPos[1]); // Invisible point - world.SetVisibility(hqPos[0], 1, Visibility::FogOfWar, em.GetCurrentGF()); - world.SetVisibility(hqPos[0], 2, Visibility::FogOfWar, em.GetCurrentGF()); + world.setVisibility(hqPos[0], 1, Visibility::FogOfWar, em.getCurrentGF()); + world.setVisibility(hqPos[0], 2, Visibility::FogOfWar, em.getCurrentGF()); TestFailingSeaAttack(hqPos[0]); // Visible for ally - world.SetVisibility(hqPos[0], 1, Visibility::Visible); + world.setVisibility(hqPos[0], 1, Visibility::Visible); // Attackable - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForSeaAttack(hqPos[0]) == 5u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForSeaAttack(hqPos[0]) == 5u); this->SeaAttack(hqPos[0], 1, true); - BOOST_TEST_REQUIRE(milBld2->GetNumTroops() == 5u); + BOOST_TEST_REQUIRE(milBld2->getNumTroops() == 5u); } BOOST_FIXTURE_TEST_CASE(AttackHarbor, SeaAttackFixture) @@ -422,71 +422,71 @@ BOOST_FIXTURE_TEST_CASE(AttackHarbor, SeaAttackFixture) BuildRoadForBlds(milBld2Pos, harborPos[2]); BuildRoadForBlds(milBld2Pos, hqPos[2]); // Add 1 soldier to dest harbor so we have a defender - nobHarborBuilding& hbDest = *world.GetSpecObj(harborPos[1]); + nobHarborBuilding& hbDest = *world.getSpecObj(harborPos[1]); hbDest.AddToInventory(PeopleCounts::make(Job::Sergeant, 1), true); // Don't keep him in reserve - hbDest.SetRealReserve(getSoldierRank(Job::Sergeant), 0); - BOOST_TEST_REQUIRE(hbDest.GetNumVisualFigures(Job::Sergeant) == 1u); - BOOST_TEST_REQUIRE(!hbDest.GetDefender()); + hbDest.setRealReserve(getSoldierRank(Job::Sergeant), 0); + BOOST_TEST_REQUIRE(hbDest.getNumVisualFigures(Job::Sergeant) == 1u); + BOOST_TEST_REQUIRE(!hbDest.getDefender()); - const noShip& ship = *world.GetPlayer(2).GetShipByID(0); - const nobHarborBuilding& hbSrc = *world.GetSpecObj(harborPos[2]); + const noShip& ship = *world.getPlayer(2).getShipByID(0); + const nobHarborBuilding& hbSrc = *world.getSpecObj(harborPos[2]); // Start attack (1 strong first) -> Soldiers walk to harbor, ship does nothing yet this->SeaAttack(harborPos[1], 1, true); this->SeaAttack(harborPos[1], 4, true); - BOOST_TEST_REQUIRE(milBld2->GetNumTroops() == 1u); - BOOST_TEST_REQUIRE(ship.IsIdling()); - BOOST_TEST_REQUIRE(hbSrc.GetNumVisualFigures(Job::General) == 0u); + BOOST_TEST_REQUIRE(milBld2->getNumTroops() == 1u); + BOOST_TEST_REQUIRE(ship.isIdling()); + BOOST_TEST_REQUIRE(hbSrc.getNumVisualFigures(Job::General) == 0u); // Let soldier walk to harbor unsigned distance = 2 * world.CalcDistance(milBld2Pos, harborPos[2]); - RTTR_EXEC_TILL(distance * 20 + 30, !ship.IsIdling()); - BOOST_TEST_REQUIRE(ship.IsGoingToHarbor(hbSrc)); - BOOST_TEST_REQUIRE(hbSrc.GetNumVisualFigures(Job::General) == 1u); + RTTR_EXEC_TILL(distance * 20 + 30, !ship.isIdling()); + BOOST_TEST_REQUIRE(ship.isGoingToHarbor(hbSrc)); + BOOST_TEST_REQUIRE(hbSrc.getNumVisualFigures(Job::General) == 1u); // Let ship arrive and count soldiers that arrived so far unsigned numSoldiersForAttack = 0; for(unsigned gf = 0; gf < 60;) { - numSoldiersForAttack = hbSrc.GetNumVisualFigures(Job::Private) + hbSrc.GetNumVisualFigures(Job::General); + numSoldiersForAttack = hbSrc.getNumVisualFigures(Job::Private) + hbSrc.getNumVisualFigures(Job::General); unsigned numGfs = em.ExecuteNextEvent(); RTTR_Assert(numGfs > 0u); gf += numGfs; - if(ship.IsOnAttackMission()) + if(ship.isOnAttackMission()) break; } - BOOST_TEST_REQUIRE(ship.IsOnAttackMission()); + BOOST_TEST_REQUIRE(ship.isOnAttackMission()); // Ship should have picked up all soldiers - BOOST_TEST_REQUIRE(hbSrc.GetNumVisualFigures(Job::Private) == 0u); - BOOST_TEST_REQUIRE(hbSrc.GetNumVisualFigures(Job::General) == 0u); + BOOST_TEST_REQUIRE(hbSrc.getNumVisualFigures(Job::Private) == 0u); + BOOST_TEST_REQUIRE(hbSrc.getNumVisualFigures(Job::General) == 0u); // min. 2 soldiers, or attack success is not save. Place ship further away if required BOOST_TEST_REQUIRE(numSoldiersForAttack >= 2u); // Note: This might be off by one if the ship arrived in the same GF a soldier arrived. But this is unlikely - BOOST_TEST_REQUIRE(ship.GetFigures().size() == numSoldiersForAttack); //-V807 - for(const noFigure& attacker : ship.GetFigures()) + BOOST_TEST_REQUIRE(ship.getFigures().size() == numSoldiersForAttack); //-V807 + for(const noFigure& attacker : ship.getFigures()) { - BOOST_TEST_REQUIRE(!dynamic_cast(attacker).IsSeaAttackCompleted()); + BOOST_TEST_REQUIRE(!dynamic_cast(attacker).isSeaAttackCompleted()); } // Ship loads, then starts driving (currently 200GF) - RTTR_EXEC_TILL(200, ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.IsOnAttackMission()); + RTTR_EXEC_TILL(200, ship.isMoving()); + BOOST_TEST_REQUIRE(ship.isOnAttackMission()); // This should not have been changed - BOOST_TEST_REQUIRE(ship.GetFigures().size() == numSoldiersForAttack); + BOOST_TEST_REQUIRE(ship.getFigures().size() == numSoldiersForAttack); // Ship does NOT go to any harbor, as that one is an intermediate spot only - BOOST_TEST_REQUIRE(!ship.IsGoingToHarbor(hbDest)); - BOOST_TEST_REQUIRE(!ship.IsGoingToHarbor(hbSrc)); + BOOST_TEST_REQUIRE(!ship.isGoingToHarbor(hbDest)); + BOOST_TEST_REQUIRE(!ship.isGoingToHarbor(hbSrc)); // Ship must not yet be at target harbor - const MapPoint targetPt = world.GetCoastalPoint(hbDest.GetHarborPosID(), ship.GetSeaID()); - distance = world.CalcDistance(ship.GetPos(), targetPt); + const MapPoint targetPt = world.getCoastalPoint(hbDest.getHarborPosID(), ship.getSeaID()); + distance = world.CalcDistance(ship.getPos(), targetPt); BOOST_TEST_REQUIRE(distance > 2u); // Ship goes to enemy harbor coast and starts unloading - RTTR_EXEC_TILL(distance * 20 + 20, !ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.IsOnAttackMission()); - BOOST_TEST_REQUIRE(ship.GetPos() == targetPt); + RTTR_EXEC_TILL(distance * 20 + 20, !ship.isMoving()); + BOOST_TEST_REQUIRE(ship.isOnAttackMission()); + BOOST_TEST_REQUIRE(ship.getPos() == targetPt); // This should not (yet) have been changed - BOOST_TEST_REQUIRE(ship.GetFigures().size() == numSoldiersForAttack); + BOOST_TEST_REQUIRE(ship.getFigures().size() == numSoldiersForAttack); // Now soldiers get out one by one for(unsigned curNumSoldiers = 1; curNumSoldiers <= numSoldiersForAttack; curNumSoldiers++) @@ -494,40 +494,40 @@ BOOST_FIXTURE_TEST_CASE(AttackHarbor, SeaAttackFixture) for(unsigned gf = 0; gf < 40; gf++) { em.ExecuteNextGF(); - if(ship.GetFigures().size() + curNumSoldiers <= numSoldiersForAttack) + if(ship.getFigures().size() + curNumSoldiers <= numSoldiersForAttack) break; } - BOOST_TEST_REQUIRE(ship.GetFigures().size() + curNumSoldiers == numSoldiersForAttack); + BOOST_TEST_REQUIRE(ship.getFigures().size() + curNumSoldiers == numSoldiersForAttack); } // All out - BOOST_TEST_REQUIRE(ship.GetFigures().size() == 0u); + BOOST_TEST_REQUIRE(ship.getFigures().size() == 0u); // Harbor might already be destroyed for fast fights and many attackers. Add more defenders for that case - BOOST_TEST_REQUIRE(world.GetSpecObj(harborPos[1])); + BOOST_TEST_REQUIRE(world.getSpecObj(harborPos[1])); // Soldiers go to enemy harbor and engage defender - RTTR_EXEC_TILL(100, hbDest.GetDefender()); + RTTR_EXEC_TILL(100, hbDest.getDefender()); // Harbor still valid - BOOST_TEST_REQUIRE(world.GetSpecObj(harborPos[1])); + BOOST_TEST_REQUIRE(world.getSpecObj(harborPos[1])); // Defender sent - BOOST_TEST_REQUIRE(hbDest.GetDefender()); + BOOST_TEST_REQUIRE(hbDest.getDefender()); // Eventually the harbor gets destroyed - RTTR_EXEC_TILL(1000, world.GetNO(harborPos[1])->GetGOT() == GO_Type::Fire); + RTTR_EXEC_TILL(1000, world.getNO(harborPos[1])->getGOT() == GO_Type::Fire); // Collect remaining attackers, so we know how many survived - std::vector pts = world.GetPointsInRadius(harborPos[1], 5); + std::vector pts = world.getPointsInRadius(harborPos[1], 5); pts.push_back(harborPos[1]); std::vector attackerIds; for(const MapPoint& pt : pts) { - for(const noBase& fig : world.GetFigures(pt)) + for(const noBase& fig : world.getFigures(pt)) { const auto* attacker = dynamic_cast(&fig); if(attacker) { - BOOST_TEST_REQUIRE(attacker->GetPlayer() == 2u); + BOOST_TEST_REQUIRE(attacker->getPlayer() == 2u); // Save those for later, as attackers get deleted - attackerIds.push_back(attacker->GetObjId()); + attackerIds.push_back(attacker->getObjId()); } } } @@ -536,31 +536,31 @@ BOOST_FIXTURE_TEST_CASE(AttackHarbor, SeaAttackFixture) BOOST_TEST_REQUIRE(attackerIds.size() <= numSoldiersForAttack); // Ship waits till all attackers have returned and leaves then - RTTR_EXEC_TILL(100, ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.IsOnAttackMission()); - BOOST_TEST_REQUIRE(ship.IsGoingToHarbor(hbSrc)); - BOOST_TEST_REQUIRE(ship.GetFigures().size() == attackerIds.size()); - for(const noFigure& attacker : ship.GetFigures()) + RTTR_EXEC_TILL(100, ship.isMoving()); + BOOST_TEST_REQUIRE(ship.isOnAttackMission()); + BOOST_TEST_REQUIRE(ship.isGoingToHarbor(hbSrc)); + BOOST_TEST_REQUIRE(ship.getFigures().size() == attackerIds.size()); + for(const noFigure& attacker : ship.getFigures()) { - BOOST_TEST_REQUIRE(dynamic_cast(attacker).IsSeaAttackCompleted()); + BOOST_TEST_REQUIRE(dynamic_cast(attacker).isSeaAttackCompleted()); } // Ship returns home and starts unloading - RTTR_EXEC_TILL(distance * 20 + 20, !ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.IsOnAttackMission()); - BOOST_TEST_REQUIRE(ship.IsGoingToHarbor(hbSrc)); + RTTR_EXEC_TILL(distance * 20 + 20, !ship.isMoving()); + BOOST_TEST_REQUIRE(ship.isOnAttackMission()); + BOOST_TEST_REQUIRE(ship.isGoingToHarbor(hbSrc)); // And should finish this in currently 200GF - RTTR_EXEC_TILL(200, ship.IsIdling()); - BOOST_TEST_REQUIRE(!ship.IsOnAttackMission()); + RTTR_EXEC_TILL(200, ship.isIdling()); + BOOST_TEST_REQUIRE(!ship.isOnAttackMission()); // Finally troops should return home (and missing ones replaced by HQ) - RTTR_EXEC_TILL(1000, milBld2->GetNumTroops() == 6u); + RTTR_EXEC_TILL(1000, milBld2->getNumTroops() == 6u); // All troups should have returned home unsigned numTroopsFound = 0; - for(const nofPassiveSoldier& soldier : milBld2->GetTroops()) + for(const nofPassiveSoldier& soldier : milBld2->getTroops()) { - if(helpers::contains(attackerIds, soldier.GetObjId())) + if(helpers::contains(attackerIds, soldier.getObjId())) numTroopsFound++; } BOOST_TEST_REQUIRE(numTroopsFound == attackerIds.size()); @@ -569,20 +569,20 @@ BOOST_FIXTURE_TEST_CASE(AttackHarbor, SeaAttackFixture) BOOST_TEST_REQUIRE(attackerIds.size() == numTroopsFound); // All soldiers should have left - BOOST_TEST_REQUIRE(hbSrc.GetNumVisualFigures(Job::Private) == 0u); - BOOST_TEST_REQUIRE(hbSrc.GetNumVisualFigures(Job::General) == 0u); + BOOST_TEST_REQUIRE(hbSrc.getNumVisualFigures(Job::Private) == 0u); + BOOST_TEST_REQUIRE(hbSrc.getNumVisualFigures(Job::General) == 0u); } BOOST_FIXTURE_TEST_CASE(HarborBlocksSpots, SeaAttackFixture) { - const auto tWater = GetWaterTerrain(world.GetDescription()); - const auto tLand = GetLandTerrain(world.GetDescription()); + const auto tWater = GetWaterTerrain(world.getDescription()); + const auto tLand = GetLandTerrain(world.getDescription()); // Issue: A harbor is a castle-sized building and blocks the nodes W, NW, NE // If the NW node is selected as the corresponding seas coastal position, we cannot attack that harbor as the // walking path would go over the harbor or a blocked point if we can't walk around it Harbors is attackable by // default - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForSeaAttack(harborPos[1]) == 5u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForSeaAttack(harborPos[1]) == 5u); // build such a situation for player 1 (left) // Make everything west of harbor water for(MapPoint pt = harborPos[1] - MapPoint(0, 3); pt.y < harborPos[1].y + 3; pt.y++) @@ -591,54 +591,54 @@ BOOST_FIXTURE_TEST_CASE(HarborBlocksSpots, SeaAttackFixture) { if(world.CalcDistance(pt, harborPos[1]) < 2) continue; - world.GetNodeWriteable(pt).t1 = tWater; - world.GetNodeWriteable(pt).t2 = tWater; + world.getNodeWriteable(pt).t1 = tWater; + world.getNodeWriteable(pt).t2 = tWater; } } - const MapPoint ptW = world.GetNeighbour(harborPos[1], Direction::West); + const MapPoint ptW = world.getNeighbour(harborPos[1], Direction::West); // Make west point a non-coastal point by adding land to its sea points - const MapPoint seaPtW = world.GetNeighbour(ptW, Direction::West); - const MapPoint seaPtW2 = world.GetNeighbour(ptW, Direction::NorthWest); - world.GetNodeWriteable(seaPtW).t2 = tLand; - world.GetNodeWriteable(seaPtW2).t1 = tLand; + const MapPoint seaPtW = world.getNeighbour(ptW, Direction::West); + const MapPoint seaPtW2 = world.getNeighbour(ptW, Direction::NorthWest); + world.getNodeWriteable(seaPtW).t2 = tLand; + world.getNodeWriteable(seaPtW2).t1 = tLand; // Make NE pt a sea point - const MapPoint ptNE = world.GetNeighbour(harborPos[1], Direction::NorthEast); - const MapPoint seaPtN = world.GetNeighbour(ptNE, Direction::NorthWest); - world.GetNodeWriteable(seaPtN).t1 = tWater; - world.GetNodeWriteable(seaPtN).t2 = tWater; - - const MapPoint ptNW = world.GetNeighbour(harborPos[1], Direction::NorthWest); - BOOST_TEST_REQUIRE(world.IsWaterPoint(world.GetNeighbour(ptNW, Direction::NorthWest))); - BOOST_TEST_REQUIRE(world.IsWaterPoint(seaPtN)); + const MapPoint ptNE = world.getNeighbour(harborPos[1], Direction::NorthEast); + const MapPoint seaPtN = world.getNeighbour(ptNE, Direction::NorthWest); + world.getNodeWriteable(seaPtN).t1 = tWater; + world.getNodeWriteable(seaPtN).t2 = tWater; + + const MapPoint ptNW = world.getNeighbour(harborPos[1], Direction::NorthWest); + BOOST_TEST_REQUIRE(world.isWaterPoint(world.getNeighbour(ptNW, Direction::NorthWest))); + BOOST_TEST_REQUIRE(world.isWaterPoint(seaPtN)); // Re-init seas/harbors BOOST_TEST_REQUIRE(MapLoader::InitSeasAndHarbors(world)); // Still have our harbor - const HarborId hbId = world.GetHarborPointID(harborPos[1]); + const HarborId hbId = world.getHarborPointID(harborPos[1]); BOOST_TEST_REQUIRE(hbId); // Should have coast at NE (NW is skipped) - BOOST_TEST_REQUIRE(!world.GetSeaId(hbId, Direction::West)); - BOOST_TEST_REQUIRE(!world.GetSeaId(hbId, Direction::NorthWest)); - BOOST_TEST_REQUIRE(world.GetSeaId(hbId, Direction::NorthEast) == SeaId(1)); - BOOST_TEST_REQUIRE(!world.GetSeaId(hbId, Direction::East)); - BOOST_TEST_REQUIRE(!world.GetSeaId(hbId, Direction::SouthEast)); - BOOST_TEST_REQUIRE(!world.GetSeaId(hbId, Direction::SouthWest)); + BOOST_TEST_REQUIRE(!world.getSeaId(hbId, Direction::West)); + BOOST_TEST_REQUIRE(!world.getSeaId(hbId, Direction::NorthWest)); + BOOST_TEST_REQUIRE(world.getSeaId(hbId, Direction::NorthEast) == SeaId(1)); + BOOST_TEST_REQUIRE(!world.getSeaId(hbId, Direction::East)); + BOOST_TEST_REQUIRE(!world.getSeaId(hbId, Direction::SouthEast)); + BOOST_TEST_REQUIRE(!world.getSeaId(hbId, Direction::SouthWest)); // So we should still be able to attack - BOOST_TEST_REQUIRE(gwv.GetNumSoldiersForSeaAttack(harborPos[1]) == 5u); + BOOST_TEST_REQUIRE(gwv.getNumSoldiersForSeaAttack(harborPos[1]) == 5u); // Start attack this->SeaAttack(harborPos[1], 5, true); // Let soldier walk to harbor unsigned distance = 2 * world.CalcDistance(milBld2Pos, harborPos[2]); RTTR_SKIP_GFS(distance * 20 + 30); // And ship go to harbor (+200 GFs for loading) - const noShip& ship = *world.GetPlayer(2).GetShipByID(0); - distance = world.CalcDistance(ship.GetPos(), harborPos[1]); - RTTR_EXEC_TILL(distance * 2 * 20 + 200, (!ship.IsMoving() && world.CalcDistance(ship.GetPos(), harborPos[1]) <= 2)); - BOOST_TEST_REQUIRE(ship.IsOnAttackMission()); + const noShip& ship = *world.getPlayer(2).getShipByID(0); + distance = world.CalcDistance(ship.getPos(), harborPos[1]); + RTTR_EXEC_TILL(distance * 2 * 20 + 200, (!ship.isMoving() && world.CalcDistance(ship.getPos(), harborPos[1]) <= 2)); + BOOST_TEST_REQUIRE(ship.isOnAttackMission()); // Harbor should be destroyed and the ship go back - RTTR_EXEC_TILL(500, ship.IsMoving()); - BOOST_TEST_REQUIRE(world.GetNO(harborPos[1])->GetGOT() == GO_Type::Fire); + RTTR_EXEC_TILL(500, ship.isMoving()); + BOOST_TEST_REQUIRE(world.getNO(harborPos[1])->getGOT() == GO_Type::Fire); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/integration/testSeaWorldCreation.cpp b/tests/s25Main/integration/testSeaWorldCreation.cpp index 499a480b10..02b384d2c9 100644 --- a/tests/s25Main/integration/testSeaWorldCreation.cpp +++ b/tests/s25Main/integration/testSeaWorldCreation.cpp @@ -69,62 +69,62 @@ BOOST_AUTO_TEST_CASE(GetShipDir) MapBase world; world.Resize(MapExtent(202, 350)); // Basic case - testShipDir(world, MapPoint(world.GetWidth() / 2, world.GetHeight() / 2)); + testShipDir(world, MapPoint(world.getWidth() / 2, world.getHeight() / 2)); // Left/Right border - testShipDir(world, MapPoint(0, world.GetHeight() / 2)); - testShipDir(world, MapPoint(world.GetWidth() - 1, world.GetHeight() / 2)); + testShipDir(world, MapPoint(0, world.getHeight() / 2)); + testShipDir(world, MapPoint(world.getWidth() - 1, world.getHeight() / 2)); // Top/Bottom border - testShipDir(world, MapPoint(world.GetWidth() / 2, 0)); - testShipDir(world, MapPoint(world.GetWidth() / 2, world.GetHeight() - 1)); + testShipDir(world, MapPoint(world.getWidth() / 2, 0)); + testShipDir(world, MapPoint(world.getWidth() / 2, world.getHeight() - 1)); // Diagonal ends testShipDir(world, MapPoint(0, 0)); - testShipDir(world, MapPoint(world.GetWidth() - 1, world.GetHeight() - 1)); + testShipDir(world, MapPoint(world.getWidth() - 1, world.getHeight() - 1)); } BOOST_FIXTURE_TEST_CASE(HarborSpotCreation, SeaWorldWithGCExecution<>) { rttr::test::LogAccessor logAcc; // Point 0,0 is definitely inside the sea - BOOST_TEST_REQUIRE(world.IsWaterPoint(MapPoint(0, 0))); - BOOST_TEST_REQUIRE(world.IsSeaPoint(MapPoint(0, 0))); + BOOST_TEST_REQUIRE(world.isWaterPoint(MapPoint(0, 0))); + BOOST_TEST_REQUIRE(world.isSeaPoint(MapPoint(0, 0))); // 2 harbors for each of the 4 player spots - BOOST_TEST_REQUIRE(world.GetNumHarborPoints() == 8u); + BOOST_TEST_REQUIRE(world.getNumHarborPoints() == 8u); // 2 seas: 1 outside, 1 inside - BOOST_TEST_REQUIRE(world.GetNumSeas() == 2u); + BOOST_TEST_REQUIRE(world.getNumSeas() == 2u); // Harbor ID 0 is means invalid harbor #if RTTR_ENABLE_ASSERTS - RTTR_REQUIRE_ASSERT(world.GetHarborPoint(HarborId::invalidValue())); + RTTR_REQUIRE_ASSERT(world.getHarborPoint(HarborId::invalidValue())); #endif - for(const auto curHarborId : helpers::idRange(world.GetNumHarborPoints())) + for(const auto curHarborId : helpers::idRange(world.getNumHarborPoints())) { - const MapPoint curHarborPt = world.GetHarborPoint(curHarborId); + const MapPoint curHarborPt = world.getHarborPoint(curHarborId); BOOST_TEST_REQUIRE(curHarborPt.isValid()); // Reverse mapping must match - BOOST_TEST_REQUIRE(world.GetHarborPointID(curHarborPt) == curHarborId); + BOOST_TEST_REQUIRE(world.getHarborPointID(curHarborPt) == curHarborId); // We must be at one of the 2 seas SeaId seaId(1); - if(!world.IsHarborAtSea(curHarborId, seaId)) + if(!world.isHarborAtSea(curHarborId, seaId)) { seaId = SeaId(2); - BOOST_TEST_REQUIRE(world.IsHarborAtSea(curHarborId, seaId)); + BOOST_TEST_REQUIRE(world.isHarborAtSea(curHarborId, seaId)); } // We must have a coast point at that sea - const MapPoint coastPt = world.GetCoastalPoint(curHarborId, seaId); + const MapPoint coastPt = world.getCoastalPoint(curHarborId, seaId); BOOST_TEST_REQUIRE(coastPt.isValid()); - BOOST_TEST_REQUIRE(world.GetSeaFromCoastalPoint(coastPt).isValid()); + BOOST_TEST_REQUIRE(world.getSeaFromCoastalPoint(coastPt).isValid()); // Sea in the direction of the coast must match bool coastPtFound = false; for(const auto dir : helpers::EnumRange{}) { - if(world.GetNeighbour(curHarborPt, dir) == coastPt) + if(world.getNeighbour(curHarborPt, dir) == coastPt) { - BOOST_TEST_REQUIRE(world.GetSeaId(curHarborId, dir) == seaId); + BOOST_TEST_REQUIRE(world.getSeaId(curHarborId, dir) == seaId); coastPtFound = true; break; } } BOOST_TEST_REQUIRE(coastPtFound); - BOOST_TEST_REQUIRE(world.GetNode(curHarborPt).bq == BuildingQuality::Harbor); + BOOST_TEST_REQUIRE(world.getNode(curHarborPt).bq == BuildingQuality::Harbor); } } @@ -133,47 +133,47 @@ BOOST_FIXTURE_TEST_CASE(HarborNeighbors, SeaWorldWithGCExecution<>) // Now just test some assumptions: 2 harbor spots per possible HQ. // Square land, 1 HQ on each side, harbors top and bottom or left and right of it // 1) Compare those around each HQ - BOOST_TEST_REQUIRE(world.GetHarborPoint(HarborId(1)).y < world.GetHarborPoint(HarborId(2)).y); //-V807 - BOOST_TEST_REQUIRE(world.GetHarborPoint(HarborId(7)).y < world.GetHarborPoint(HarborId(8)).y); - BOOST_TEST_REQUIRE(world.GetHarborPoint(HarborId(3)).x < world.GetHarborPoint(HarborId(4)).x); - BOOST_TEST_REQUIRE(world.GetHarborPoint(HarborId(5)).x < world.GetHarborPoint(HarborId(6)).x); //-V807 + BOOST_TEST_REQUIRE(world.getHarborPoint(HarborId(1)).y < world.getHarborPoint(HarborId(2)).y); //-V807 + BOOST_TEST_REQUIRE(world.getHarborPoint(HarborId(7)).y < world.getHarborPoint(HarborId(8)).y); + BOOST_TEST_REQUIRE(world.getHarborPoint(HarborId(3)).x < world.getHarborPoint(HarborId(4)).x); + BOOST_TEST_REQUIRE(world.getHarborPoint(HarborId(5)).x < world.getHarborPoint(HarborId(6)).x); //-V807 // 2) Compare between them - BOOST_TEST_REQUIRE(world.GetHarborPoint(HarborId(2)).y < world.GetHarborPoint(HarborId(7)).y); - BOOST_TEST_REQUIRE(world.GetHarborPoint(HarborId(4)).x < world.GetHarborPoint(HarborId(5)).x); - BOOST_TEST_REQUIRE(world.GetHarborPoint(HarborId(3)).x < world.GetHarborPoint(HarborId(1)).x); - BOOST_TEST_REQUIRE(world.GetHarborPoint(HarborId(1)).x < world.GetHarborPoint(HarborId(5)).x); + BOOST_TEST_REQUIRE(world.getHarborPoint(HarborId(2)).y < world.getHarborPoint(HarborId(7)).y); + BOOST_TEST_REQUIRE(world.getHarborPoint(HarborId(4)).x < world.getHarborPoint(HarborId(5)).x); + BOOST_TEST_REQUIRE(world.getHarborPoint(HarborId(3)).x < world.getHarborPoint(HarborId(1)).x); + BOOST_TEST_REQUIRE(world.getHarborPoint(HarborId(1)).x < world.getHarborPoint(HarborId(5)).x); // Test neighbors std::vector nb; // Hb 1 (outside) HarborId hbId(1); - nb = world.GetHarborNeighbors(hbId, ShipDirection::SouthWest); + nb = world.getHarborNeighbors(hbId, ShipDirection::SouthWest); BOOST_TEST_REQUIRE(nb.size() == 1u); BOOST_TEST(nb[0].id == HarborId(3)); - nb = world.GetHarborNeighbors(hbId, ShipDirection::SouthEast); + nb = world.getHarborNeighbors(hbId, ShipDirection::SouthEast); BOOST_TEST_REQUIRE(nb.size() == 1u); BOOST_TEST(nb[0].id == HarborId(6)); - nb = world.GetHarborNeighbors(hbId, ShipDirection::North); + nb = world.getHarborNeighbors(hbId, ShipDirection::North); BOOST_TEST_REQUIRE(nb.size() == 1u); BOOST_TEST(nb[0].id == HarborId(8)); - BOOST_TEST_REQUIRE(world.GetHarborNeighbors(hbId, ShipDirection::South).size() == 0u); - BOOST_TEST_REQUIRE(world.GetHarborNeighbors(hbId, ShipDirection::NorthEast).size() == 0u); - BOOST_TEST_REQUIRE(world.GetHarborNeighbors(hbId, ShipDirection::NorthWest).size() == 0u); + BOOST_TEST_REQUIRE(world.getHarborNeighbors(hbId, ShipDirection::South).size() == 0u); + BOOST_TEST_REQUIRE(world.getHarborNeighbors(hbId, ShipDirection::NorthEast).size() == 0u); + BOOST_TEST_REQUIRE(world.getHarborNeighbors(hbId, ShipDirection::NorthWest).size() == 0u); // Hb 7 (inside) hbId = HarborId(7); - nb = world.GetHarborNeighbors(hbId, ShipDirection::NorthWest); + nb = world.getHarborNeighbors(hbId, ShipDirection::NorthWest); BOOST_TEST_REQUIRE(nb.size() == 1u); BOOST_TEST(nb[0].id == HarborId(4)); - nb = world.GetHarborNeighbors(hbId, ShipDirection::NorthEast); + nb = world.getHarborNeighbors(hbId, ShipDirection::NorthEast); BOOST_TEST_REQUIRE(nb.size() == 1u); BOOST_TEST(nb[0].id == HarborId(5)); - nb = world.GetHarborNeighbors(hbId, ShipDirection::North); + nb = world.getHarborNeighbors(hbId, ShipDirection::North); BOOST_TEST_REQUIRE(nb.size() == 1u); BOOST_TEST(nb[0].id == HarborId(2)); - BOOST_TEST_REQUIRE(world.GetHarborNeighbors(hbId, ShipDirection::South).size() == 0u); - BOOST_TEST_REQUIRE(world.GetHarborNeighbors(hbId, ShipDirection::SouthEast).size() == 0u); - BOOST_TEST_REQUIRE(world.GetHarborNeighbors(hbId, ShipDirection::SouthWest).size() == 0u); + BOOST_TEST_REQUIRE(world.getHarborNeighbors(hbId, ShipDirection::South).size() == 0u); + BOOST_TEST_REQUIRE(world.getHarborNeighbors(hbId, ShipDirection::SouthEast).size() == 0u); + BOOST_TEST_REQUIRE(world.getHarborNeighbors(hbId, ShipDirection::SouthWest).size() == 0u); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/integration/testSeafaring.cpp b/tests/s25Main/integration/testSeafaring.cpp index 91ea12541c..e169583476 100644 --- a/tests/s25Main/integration/testSeafaring.cpp +++ b/tests/s25Main/integration/testSeafaring.cpp @@ -56,28 +56,28 @@ BOOST_AUTO_TEST_SUITE(SeafaringTestSuite) BOOST_FIXTURE_TEST_CASE(HarborPlacing, SeaWorldWithGCExecution<>) { - const GamePlayer& player = world.GetPlayer(curPlayer); - const BuildingRegister& buildings = player.GetBuildingRegister(); - const MapPoint hqPos = player.GetHQPos(); + const GamePlayer& player = world.getPlayer(curPlayer); + const BuildingRegister& buildings = player.getBuildingRegister(); + const MapPoint hqPos = player.getHQPos(); const SeaId seaId(1); const HarborId hbId(1); - const MapPoint hbPos = world.GetHarborPoint(hbId); + const MapPoint hbPos = world.getHarborPoint(hbId); BOOST_TEST_REQUIRE(world.CalcDistance(hqPos, hbPos) < HQ_RADIUS); auto* harbor = dynamic_cast( BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, hbPos, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(harbor); - BOOST_TEST_REQUIRE(world.IsHarborAtSea(hbId, seaId)); - BOOST_TEST_REQUIRE(buildings.GetHarbors().size() == 1u); //-V807 - BOOST_TEST_REQUIRE(buildings.GetHarbors().front() == harbor); + BOOST_TEST_REQUIRE(world.isHarborAtSea(hbId, seaId)); + BOOST_TEST_REQUIRE(buildings.getHarbors().size() == 1u); //-V807 + BOOST_TEST_REQUIRE(buildings.getHarbors().front() == harbor); // A harbor is also a storehouse - BOOST_TEST_REQUIRE(buildings.GetStorehouses().size() == 2u); - BOOST_TEST_REQUIRE(buildings.GetHarbors().back() == harbor); - BOOST_TEST_REQUIRE(world.GetNode(MapPoint(0, 0)).seaId == seaId); - BOOST_TEST_REQUIRE(world.GetSeaId(hbId, Direction::NorthEast) == seaId); + BOOST_TEST_REQUIRE(buildings.getStorehouses().size() == 2u); + BOOST_TEST_REQUIRE(buildings.getHarbors().back() == harbor); + BOOST_TEST_REQUIRE(world.getNode(MapPoint(0, 0)).seaId == seaId); + BOOST_TEST_REQUIRE(world.getSeaId(hbId, Direction::NorthEast) == seaId); - const std::vector road = FindRoadPath(world.GetNeighbour(hqPos, Direction::SouthEast), - world.GetNeighbour(hbPos, Direction::SouthEast), world); + const std::vector road = FindRoadPath(world.getNeighbour(hqPos, Direction::SouthEast), + world.getNeighbour(hbPos, Direction::SouthEast), world); BOOST_TEST_REQUIRE(!road.empty()); } @@ -85,7 +85,7 @@ BOOST_FIXTURE_TEST_CASE(ShipConnections, SmallSeaWorld) { unsigned curPlayer = 0; const auto createHarbor = [this, &curPlayer](HarborId hbId) -> nobHarborBuilding& { - MapPoint hbPos = world.GetHarborPoint(hbId); + MapPoint hbPos = world.getHarborPoint(hbId); auto* harbor = static_cast( BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, hbPos, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(harbor); @@ -101,37 +101,37 @@ BOOST_FIXTURE_TEST_CASE(ShipConnections, SmallSeaWorld) // I.e.: constexpr SeaId sea1(1); constexpr SeaId sea2(2); - BOOST_TEST(world.IsHarborAtSea(HarborId(1), sea1)); - BOOST_TEST(world.IsHarborAtSea(HarborId(3), sea1)); - BOOST_TEST(world.IsHarborAtSea(HarborId(6), sea1)); - BOOST_TEST(world.IsHarborAtSea(HarborId(8), sea1)); + BOOST_TEST(world.isHarborAtSea(HarborId(1), sea1)); + BOOST_TEST(world.isHarborAtSea(HarborId(3), sea1)); + BOOST_TEST(world.isHarborAtSea(HarborId(6), sea1)); + BOOST_TEST(world.isHarborAtSea(HarborId(8), sea1)); - BOOST_TEST(world.IsHarborAtSea(HarborId(2), sea2)); - BOOST_TEST(world.IsHarborAtSea(HarborId(4), sea2)); - BOOST_TEST(world.IsHarborAtSea(HarborId(5), sea2)); - BOOST_TEST(world.IsHarborAtSea(HarborId(7), sea2)); + BOOST_TEST(world.isHarborAtSea(HarborId(2), sea2)); + BOOST_TEST(world.isHarborAtSea(HarborId(4), sea2)); + BOOST_TEST(world.isHarborAtSea(HarborId(5), sea2)); + BOOST_TEST(world.isHarborAtSea(HarborId(7), sea2)); const auto& hb1 = createHarbor(HarborId(1)); // No other harbor - BOOST_TEST(hb1.GetShipConnections().empty()); + BOOST_TEST(hb1.getShipConnections().empty()); const auto& hb2 = createHarbor(HarborId(2)); // Different seas - BOOST_TEST(hb1.GetShipConnections().empty()); - BOOST_TEST(hb2.GetShipConnections().empty()); + BOOST_TEST(hb1.getShipConnections().empty()); + BOOST_TEST(hb2.getShipConnections().empty()); using harbors_t = std::set; // 3 and 1 share sea const auto& hb3 = createHarbor(HarborId(3)); - BOOST_TEST(toHarbors(hb1.GetShipConnections()) == harbors_t{&hb3}); - BOOST_TEST(hb2.GetShipConnections().empty()); - BOOST_TEST(toHarbors(hb3.GetShipConnections()) == harbors_t{&hb1}); + BOOST_TEST(toHarbors(hb1.getShipConnections()) == harbors_t{&hb3}); + BOOST_TEST(hb2.getShipConnections().empty()); + BOOST_TEST(toHarbors(hb3.getShipConnections()) == harbors_t{&hb1}); // 2,4,5 share sea const auto& hb4 = createHarbor(HarborId(4)); const auto& hb5 = createHarbor(HarborId(5)); - BOOST_TEST(toHarbors(hb1.GetShipConnections()) == harbors_t{&hb3}); - BOOST_TEST(toHarbors(hb2.GetShipConnections()) == (harbors_t{&hb4, &hb5})); - BOOST_TEST(toHarbors(hb3.GetShipConnections()) == harbors_t{&hb1}); - BOOST_TEST(toHarbors(hb4.GetShipConnections()) == (harbors_t{&hb2, &hb5})); - BOOST_TEST(toHarbors(hb5.GetShipConnections()) == (harbors_t{&hb2, &hb4})); + BOOST_TEST(toHarbors(hb1.getShipConnections()) == harbors_t{&hb3}); + BOOST_TEST(toHarbors(hb2.getShipConnections()) == (harbors_t{&hb4, &hb5})); + BOOST_TEST(toHarbors(hb3.getShipConnections()) == harbors_t{&hb1}); + BOOST_TEST(toHarbors(hb4.getShipConnections()) == (harbors_t{&hb2, &hb5})); + BOOST_TEST(toHarbors(hb5.getShipConnections()) == (harbors_t{&hb2, &hb4})); } BOOST_FIXTURE_TEST_CASE(ShipBuilding, SeaWorldWithGCExecution<>) @@ -139,58 +139,58 @@ BOOST_FIXTURE_TEST_CASE(ShipBuilding, SeaWorldWithGCExecution<>) addStartResources(); initGameRNG(); - const GamePlayer& player = world.GetPlayer(curPlayer); - const MapPoint hqPos = player.GetHQPos(); - const MapPoint hqFlagPos = world.GetNeighbour(hqPos, Direction::SouthEast); + const GamePlayer& player = world.getPlayer(curPlayer); + const MapPoint hqPos = player.getHQPos(); + const MapPoint hqFlagPos = world.getNeighbour(hqPos, Direction::SouthEast); const HarborId hbId(1); - const MapPoint hbPos = world.GetHarborPoint(hbId); + const MapPoint hbPos = world.getHarborPoint(hbId); const MapPoint shipyardPos(hqPos.x + 3, hqPos.y - 5); auto* harbor = dynamic_cast( BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, hbPos, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(harbor); - std::vector road = FindRoadPath(hqFlagPos, world.GetNeighbour(hbPos, Direction::SouthEast), world); + std::vector road = FindRoadPath(hqFlagPos, world.getNeighbour(hbPos, Direction::SouthEast), world); BOOST_TEST_REQUIRE(!road.empty()); this->BuildRoad(hqFlagPos, false, road); MapPoint curPt = hqFlagPos; for(auto i : road) { - curPt = world.GetNeighbour(curPt, i); + curPt = world.getNeighbour(curPt, i); this->SetFlag(curPt); } BOOST_TEST_REQUIRE(world.GetBQ(shipyardPos, curPlayer) == BuildingQuality::Castle); auto* shipYard = dynamic_cast( BuildingFactory::CreateBuilding(world, BuildingType::Shipyard, shipyardPos, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(shipYard); - road = FindRoadPath(hqFlagPos, world.GetNeighbour(shipyardPos, Direction::SouthEast), world); + road = FindRoadPath(hqFlagPos, world.getNeighbour(shipyardPos, Direction::SouthEast), world); BOOST_TEST_REQUIRE(!road.empty()); this->BuildRoad(hqFlagPos, false, road); - BOOST_TEST_REQUIRE(shipYard->GetMode() == nobShipYard::Mode::Boats); //-V522 + BOOST_TEST_REQUIRE(shipYard->getMode() == nobShipYard::Mode::Boats); //-V522 this->SetShipYardMode(shipyardPos, false); - BOOST_TEST_REQUIRE(shipYard->GetMode() == nobShipYard::Mode::Boats); + BOOST_TEST_REQUIRE(shipYard->getMode() == nobShipYard::Mode::Boats); this->SetShipYardMode(shipyardPos, true); - BOOST_TEST_REQUIRE(shipYard->GetMode() == nobShipYard::Mode::Ships); + BOOST_TEST_REQUIRE(shipYard->getMode() == nobShipYard::Mode::Ships); this->SetShipYardMode(shipyardPos, true); - BOOST_TEST_REQUIRE(shipYard->GetMode() == nobShipYard::Mode::Ships); + BOOST_TEST_REQUIRE(shipYard->getMode() == nobShipYard::Mode::Ships); this->SetShipYardMode(shipyardPos, false); - BOOST_TEST_REQUIRE(shipYard->GetMode() == nobShipYard::Mode::Boats); + BOOST_TEST_REQUIRE(shipYard->getMode() == nobShipYard::Mode::Boats); this->SetShipYardMode(shipyardPos, true); - BOOST_TEST_REQUIRE(shipYard->GetMode() == nobShipYard::Mode::Ships); + BOOST_TEST_REQUIRE(shipYard->getMode() == nobShipYard::Mode::Ships); - world.GetPostMgr().AddPostBox(curPlayer); - PostBox& postBox = *world.GetPostMgr().GetPostBox(curPlayer); + world.getPostMgr().AddPostBox(curPlayer); + PostBox& postBox = *world.getPostMgr().getPostBox(curPlayer); postBox.Clear(); // Ship building takes 10 steps with ~500 GFs each. +600 GF to let wares and people reach the site - RTTR_EXEC_TILL(5600, postBox.GetNumMsgs() > 0); + RTTR_EXEC_TILL(5600, postBox.getNumMsgs() > 0); // There should be a msg telling the player about the new ship - BOOST_TEST_REQUIRE(postBox.GetNumMsgs() == 1u); - const auto* msg = dynamic_cast(postBox.GetMsg(0)); + BOOST_TEST_REQUIRE(postBox.getNumMsgs() == 1u); + const auto* msg = dynamic_cast(postBox.getMsg(0)); BOOST_TEST_REQUIRE(msg); - BOOST_TEST_REQUIRE(player.GetNumShips() == 1u); - BOOST_TEST_REQUIRE(player.GetShips().size() == 1u); - noShip* ship = player.GetShipByID(0); + BOOST_TEST_REQUIRE(player.getNumShips() == 1u); + BOOST_TEST_REQUIRE(player.getShips().size() == 1u); + noShip* ship = player.getShipByID(0); BOOST_TEST_REQUIRE(ship); - BOOST_TEST_REQUIRE(player.GetShipID(*ship) == 0u); + BOOST_TEST_REQUIRE(player.getShipID(*ship) == 0u); } template( BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, hbPos, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(harbor); world.RecalcBQAroundPointBig(hbPos); - std::vector road = FindRoadPath(hqFlagPos, world.GetNeighbour(hbPos, Direction::SouthEast), world); + std::vector road = FindRoadPath(hqFlagPos, world.getNeighbour(hbPos, Direction::SouthEast), world); BOOST_TEST_REQUIRE(!road.empty()); this->BuildRoad(hqFlagPos, false, road); MapPoint curPt = hqFlagPos; for(auto& i : road) { - curPt = world.GetNeighbour(curPt, i); + curPt = world.getNeighbour(curPt, i); this->SetFlag(curPt); } MapPoint shipPos(hbPos.x, hbPos.y - 3); - if(!world.IsSeaPoint(shipPos)) + if(!world.isSeaPoint(shipPos)) shipPos.y += 6; - BOOST_TEST_REQUIRE(world.IsSeaPoint(shipPos)); + BOOST_TEST_REQUIRE(world.isSeaPoint(shipPos)); auto& ship = world.AddFigure(shipPos, std::make_unique(shipPos, curPlayer)); player.RegisterShip(ship); - BOOST_TEST_REQUIRE(player.GetNumShips() == 1u); + BOOST_TEST_REQUIRE(player.getNumShips() == 1u); postBox->Clear(); initGameRNG(); } @@ -241,7 +241,7 @@ struct ShipReadyFixture : public SeaWorldWithGCExecution()) { - if(world.GetNextFreeHarborPoint(ship.GetPos(), ship.GetCurrentHarbor(), dir, ship.GetPlayerId()) + if(world.getNextFreeHarborPoint(ship.getPos(), ship.getCurrentHarbor(), dir, ship.getPlayerId()) == targetHbId) return dir; } @@ -254,298 +254,298 @@ BOOST_FIXTURE_TEST_CASE(ExplorationExpedition, ShipReadyFixture<>) { curPlayer = 0; addStartResources(); - const GamePlayer& player = world.GetPlayer(curPlayer); - const noShip& ship = ensureNonNull(player.GetShipByID(0)); - const nobHarborBuilding& harbor = *player.GetBuildingRegister().GetHarbors().front(); - const MapPoint hbPos = harbor.GetPos(); - const HarborId hbId = world.GetHarborPointID(hbPos); - BOOST_TEST_REQUIRE(ship.IsIdling()); - BOOST_TEST_REQUIRE(!harbor.IsExplorationExpeditionActive()); + const GamePlayer& player = world.getPlayer(curPlayer); + const noShip& ship = ensureNonNull(player.getShipByID(0)); + const nobHarborBuilding& harbor = *player.getBuildingRegister().getHarbors().front(); + const MapPoint hbPos = harbor.getPos(); + const HarborId hbId = world.getHarborPointID(hbPos); + BOOST_TEST_REQUIRE(ship.isIdling()); + BOOST_TEST_REQUIRE(!harbor.isExplorationExpeditionActive()); this->StartStopExplorationExpedition(hbPos, true); - BOOST_TEST_REQUIRE(harbor.IsExplorationExpeditionActive()); + BOOST_TEST_REQUIRE(harbor.isExplorationExpeditionActive()); // Expedition not ready, ship still idling - BOOST_TEST_REQUIRE(ship.IsIdling()); + BOOST_TEST_REQUIRE(ship.isIdling()); // Wait till scouts arrive - RTTR_EXEC_TILL(380, !ship.IsIdling()); - BOOST_TEST_REQUIRE(ship.IsGoingToHarbor(harbor)); - BOOST_TEST_REQUIRE(ship.GetTargetHarbor() == hbId); - BOOST_TEST_REQUIRE(player.GetShipsToHarbor(harbor) == 1u); + RTTR_EXEC_TILL(380, !ship.isIdling()); + BOOST_TEST_REQUIRE(ship.isGoingToHarbor(harbor)); + BOOST_TEST_REQUIRE(ship.getTargetHarbor() == hbId); + BOOST_TEST_REQUIRE(player.getShipsToHarbor(harbor) == 1u); // No available scouts - BOOST_TEST_REQUIRE(harbor.GetNumRealFigures(Job::Scout) == 0u); + BOOST_TEST_REQUIRE(harbor.getNumRealFigures(Job::Scout) == 0u); // Stop it this->StartStopExplorationExpedition(hbPos, true); - BOOST_TEST_REQUIRE(harbor.IsExplorationExpeditionActive()); + BOOST_TEST_REQUIRE(harbor.isExplorationExpeditionActive()); this->StartStopExplorationExpedition(hbPos, false); - BOOST_TEST_REQUIRE(!harbor.IsExplorationExpeditionActive()); + BOOST_TEST_REQUIRE(!harbor.isExplorationExpeditionActive()); this->StartStopExplorationExpedition(hbPos, false); - BOOST_TEST_REQUIRE(!harbor.IsExplorationExpeditionActive()); + BOOST_TEST_REQUIRE(!harbor.isExplorationExpeditionActive()); // Scouts available again - BOOST_TEST_REQUIRE(harbor.GetNumRealFigures(Job::Scout) == 3u); + BOOST_TEST_REQUIRE(harbor.getNumRealFigures(Job::Scout) == 3u); // Let ship arrive - RTTR_EXEC_TILL(180, ship.IsIdling()); - BOOST_TEST_REQUIRE(!ship.IsGoingToHarbor(harbor)); - BOOST_TEST_REQUIRE(player.GetShipsToHarbor(harbor) == 0u); - BOOST_TEST_REQUIRE(!ship.GetTargetHarbor()); - BOOST_TEST_REQUIRE(!ship.GetHomeHarbor()); + RTTR_EXEC_TILL(180, ship.isIdling()); + BOOST_TEST_REQUIRE(!ship.isGoingToHarbor(harbor)); + BOOST_TEST_REQUIRE(player.getShipsToHarbor(harbor) == 0u); + BOOST_TEST_REQUIRE(!ship.getTargetHarbor()); + BOOST_TEST_REQUIRE(!ship.getHomeHarbor()); // We want the ship to only scout unexplored harbors, so set all but one to visible - world.GetNodeWriteable(world.GetHarborPoint(HarborId(6))).fow[curPlayer].visibility = Visibility::Visible; //-V807 + world.getNodeWriteable(world.getHarborPoint(HarborId(6))).fow[curPlayer].visibility = Visibility::Visible; //-V807 // Team visibility, so set one to own team - world.GetPlayer(curPlayer).team = Team::Team1; - world.GetPlayer(1).team = Team::Team1; - world.GetPlayer(curPlayer).MakeStartPacts(); - world.GetPlayer(1).MakeStartPacts(); - world.GetNodeWriteable(world.GetHarborPoint(HarborId(3))).fow[1].visibility = Visibility::Visible; + world.getPlayer(curPlayer).team = Team::Team1; + world.getPlayer(1).team = Team::Team1; + world.getPlayer(curPlayer).MakeStartPacts(); + world.getPlayer(1).MakeStartPacts(); + world.getNodeWriteable(world.getHarborPoint(HarborId(3))).fow[1].visibility = Visibility::Visible; HarborId targetHbId(8); // Start again (everything is here) this->StartStopExplorationExpedition(hbPos, true); // ...so we can start right now - BOOST_TEST_REQUIRE(ship.IsOnExplorationExpedition()); + BOOST_TEST_REQUIRE(ship.isOnExplorationExpedition()); // Load and start RTTR_SKIP_GFS(202); - BOOST_TEST_REQUIRE(ship.GetHomeHarbor() == hbId); - BOOST_TEST_REQUIRE(ship.GetTargetHarbor() == targetHbId); + BOOST_TEST_REQUIRE(ship.getHomeHarbor() == hbId); + BOOST_TEST_REQUIRE(ship.getTargetHarbor() == targetHbId); - unsigned distance = world.CalcDistance(hbPos, world.GetHarborPoint(targetHbId)); + unsigned distance = world.CalcDistance(hbPos, world.getHarborPoint(targetHbId)); // Let the ship scout the harbor - RTTR_EXEC_TILL(distance * 2 * 20, !ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.IsOnExplorationExpedition()); - BOOST_TEST_REQUIRE(world.CalcDistance(world.GetHarborPoint(targetHbId), ship.GetPos()) <= 2u); + RTTR_EXEC_TILL(distance * 2 * 20, !ship.isMoving()); + BOOST_TEST_REQUIRE(ship.isOnExplorationExpedition()); + BOOST_TEST_REQUIRE(world.CalcDistance(world.getHarborPoint(targetHbId), ship.getPos()) <= 2u); // Now the ship waits and will select the next harbor. We allow another one: HarborId nextHbId(6); - world.GetNodeWriteable(world.GetHarborPoint(nextHbId)).fow[curPlayer].visibility = Visibility::FogOfWar; - RTTR_EXEC_TILL(350, ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.GetHomeHarbor() == hbId); - BOOST_TEST_REQUIRE(ship.GetTargetHarbor() == nextHbId); - distance = world.CalcDistance(ship.GetPos(), world.GetHarborPoint(nextHbId)); + world.getNodeWriteable(world.getHarborPoint(nextHbId)).fow[curPlayer].visibility = Visibility::FogOfWar; + RTTR_EXEC_TILL(350, ship.isMoving()); + BOOST_TEST_REQUIRE(ship.getHomeHarbor() == hbId); + BOOST_TEST_REQUIRE(ship.getTargetHarbor() == nextHbId); + distance = world.CalcDistance(ship.getPos(), world.getHarborPoint(nextHbId)); // Let the ship scout the harbor - RTTR_EXEC_TILL(distance * 2 * 20, !ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.IsOnExplorationExpedition()); - BOOST_TEST_REQUIRE(world.CalcDistance(world.GetHarborPoint(nextHbId), ship.GetPos()) <= 2u); + RTTR_EXEC_TILL(distance * 2 * 20, !ship.isMoving()); + BOOST_TEST_REQUIRE(ship.isOnExplorationExpedition()); + BOOST_TEST_REQUIRE(world.CalcDistance(world.getHarborPoint(nextHbId), ship.getPos()) <= 2u); // Now disallow the first harbor so ship returns home - world.GetNodeWriteable(world.GetHarborPoint(targetHbId)).fow[curPlayer].visibility = Visibility::Visible; + world.getNodeWriteable(world.getHarborPoint(targetHbId)).fow[curPlayer].visibility = Visibility::Visible; - RTTR_EXEC_TILL(350, ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.GetHomeHarbor() == hbId); - BOOST_TEST_REQUIRE(ship.GetTargetHarbor() == hbId); + RTTR_EXEC_TILL(350, ship.isMoving()); + BOOST_TEST_REQUIRE(ship.getHomeHarbor() == hbId); + BOOST_TEST_REQUIRE(ship.getTargetHarbor() == hbId); - distance = world.CalcDistance(ship.GetPos(), world.GetHarborPoint(hbId)); + distance = world.CalcDistance(ship.getPos(), world.getHarborPoint(hbId)); // And at some time it should return home - RTTR_EXEC_TILL(distance * 2 * 20 + 200, ship.IsIdling()); + RTTR_EXEC_TILL(distance * 2 * 20 + 200, ship.isIdling()); const SeaId seaId(1); - BOOST_TEST_REQUIRE(ship.GetSeaID() == seaId); - BOOST_TEST_REQUIRE(ship.GetPos() == world.GetCoastalPoint(hbId, seaId)); + BOOST_TEST_REQUIRE(ship.getSeaID() == seaId); + BOOST_TEST_REQUIRE(ship.getPos() == world.getCoastalPoint(hbId, seaId)); // Now try to start an expedition but all harbors are explored -> Load, Unload, Idle - world.GetNodeWriteable(world.GetHarborPoint(nextHbId)).fow[curPlayer].visibility = Visibility::Visible; + world.getNodeWriteable(world.getHarborPoint(nextHbId)).fow[curPlayer].visibility = Visibility::Visible; this->StartStopExplorationExpedition(hbPos, true); - BOOST_TEST_REQUIRE(ship.IsOnExplorationExpedition()); - RTTR_EXEC_TILL(2 * 200 + 5, ship.IsIdling()); + BOOST_TEST_REQUIRE(ship.isOnExplorationExpedition()); + RTTR_EXEC_TILL(2 * 200 + 5, ship.isIdling()); } BOOST_FIXTURE_TEST_CASE(DestroyHomeOnExplExp, ShipReadyFixture<2>) { addStartResources(); curPlayer = 0; - const GamePlayer& player = world.GetPlayer(curPlayer); - const noShip& ship = ensureNonNull(player.GetShipByID(0)); - const nobHarborBuilding& harbor = *player.GetBuildingRegister().GetHarbors().front(); - const MapPoint hbPos = harbor.GetPos(); - const HarborId hbId = world.GetHarborPointID(hbPos); - unsigned numScouts = player.GetInventory()[Job::Scout]; //-V807 - BOOST_TEST_REQUIRE(ship.IsIdling()); + const GamePlayer& player = world.getPlayer(curPlayer); + const noShip& ship = ensureNonNull(player.getShipByID(0)); + const nobHarborBuilding& harbor = *player.getBuildingRegister().getHarbors().front(); + const MapPoint hbPos = harbor.getPos(); + const HarborId hbId = world.getHarborPointID(hbPos); + unsigned numScouts = player.getInventory()[Job::Scout]; //-V807 + BOOST_TEST_REQUIRE(ship.isIdling()); // We want the ship to only scout unexplored harbors, so set all but one to visible - world.GetPlayer(curPlayer).team = Team::Team1; - world.GetPlayer(1).team = Team::Team1; - world.GetPlayer(curPlayer).MakeStartPacts(); - world.GetPlayer(1).MakeStartPacts(); + world.getPlayer(curPlayer).team = Team::Team1; + world.getPlayer(1).team = Team::Team1; + world.getPlayer(curPlayer).MakeStartPacts(); + world.getPlayer(1).MakeStartPacts(); - world.GetNodeWriteable(world.GetHarborPoint(HarborId(6))).fow[1].visibility = Visibility::Visible; - world.GetNodeWriteable(world.GetHarborPoint(HarborId(3))).fow[1].visibility = Visibility::Visible; + world.getNodeWriteable(world.getHarborPoint(HarborId(6))).fow[1].visibility = Visibility::Visible; + world.getNodeWriteable(world.getHarborPoint(HarborId(3))).fow[1].visibility = Visibility::Visible; HarborId targetHbId(8); this->StartStopExplorationExpedition(hbPos, true); // Start it - RTTR_EXEC_TILL(600, ship.IsOnExplorationExpedition() && ship.IsMoving()); + RTTR_EXEC_TILL(600, ship.isOnExplorationExpedition() && ship.isMoving()); // Incorporate recruitment - BOOST_TEST_REQUIRE(player.GetInventory()[Job::Scout] >= numScouts); - numScouts = player.GetInventory()[Job::Scout]; + BOOST_TEST_REQUIRE(player.getInventory()[Job::Scout] >= numScouts); + numScouts = player.getInventory()[Job::Scout]; - BOOST_TEST_REQUIRE(ship.GetHomeHarbor() == hbId); - BOOST_TEST_REQUIRE(ship.GetTargetHarbor() == targetHbId); + BOOST_TEST_REQUIRE(ship.getHomeHarbor() == hbId); + BOOST_TEST_REQUIRE(ship.getTargetHarbor() == targetHbId); // Run till ship is coming back - RTTR_EXEC_TILL(1000, ship.GetTargetHarbor() == hbId); + RTTR_EXEC_TILL(1000, ship.getTargetHarbor() == hbId); // Avoid that it goes back to that point - world.GetNodeWriteable(world.GetHarborPoint(targetHbId)).fow[1].visibility = Visibility::Visible; + world.getNodeWriteable(world.getHarborPoint(targetHbId)).fow[1].visibility = Visibility::Visible; // Destroy home harbor world.DestroyNO(hbPos); - RTTR_EXEC_TILL(2000, ship.IsLost()); - BOOST_TEST_REQUIRE(!ship.IsMoving()); + RTTR_EXEC_TILL(2000, ship.isLost()); + BOOST_TEST_REQUIRE(!ship.isMoving()); - MapPoint newHbPos = world.GetHarborPoint(HarborId(6)); + MapPoint newHbPos = world.getHarborPoint(HarborId(6)); auto* newHarbor = dynamic_cast( BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, newHbPos, curPlayer, Nation::Romans)); - BOOST_TEST_REQUIRE(!ship.IsLost()); - BOOST_TEST_REQUIRE(ship.IsMoving()); - RTTR_EXEC_TILL(1200, ship.IsIdling()); - BOOST_TEST(player.GetInventory()[Job::Scout] == numScouts); - BOOST_TEST(newHarbor->GetNumRealFigures(Job::Scout) == newHarbor->GetNumVisualFigures(Job::Scout)); //-V522 - BOOST_TEST(newHarbor->GetNumRealFigures(Job::Scout) - + world.GetSpecObj(player.GetHQPos())->GetNumRealFigures(Job::Scout) + BOOST_TEST_REQUIRE(!ship.isLost()); + BOOST_TEST_REQUIRE(ship.isMoving()); + RTTR_EXEC_TILL(1200, ship.isIdling()); + BOOST_TEST(player.getInventory()[Job::Scout] == numScouts); + BOOST_TEST(newHarbor->getNumRealFigures(Job::Scout) == newHarbor->getNumVisualFigures(Job::Scout)); //-V522 + BOOST_TEST(newHarbor->getNumRealFigures(Job::Scout) + + world.getSpecObj(player.getHQPos())->getNumRealFigures(Job::Scout) == numScouts); } BOOST_FIXTURE_TEST_CASE(Expedition, ShipReadyFixture<>) { addStartResources(); - const GamePlayer& player = world.GetPlayer(curPlayer); - const noShip& ship = ensureNonNull(player.GetShipByID(0)); - const nobHarborBuilding& harbor = *player.GetBuildingRegister().GetHarbors().front(); - const MapPoint hbPos = harbor.GetPos(); - BOOST_TEST_REQUIRE(ship.IsIdling()); - BOOST_TEST_REQUIRE(!harbor.IsExpeditionActive()); + const GamePlayer& player = world.getPlayer(curPlayer); + const noShip& ship = ensureNonNull(player.getShipByID(0)); + const nobHarborBuilding& harbor = *player.getBuildingRegister().getHarbors().front(); + const MapPoint hbPos = harbor.getPos(); + BOOST_TEST_REQUIRE(ship.isIdling()); + BOOST_TEST_REQUIRE(!harbor.isExpeditionActive()); this->StartStopExpedition(hbPos, true); - BOOST_TEST_REQUIRE(harbor.IsExpeditionActive()); + BOOST_TEST_REQUIRE(harbor.isExpeditionActive()); // Expedition not ready, ship still idling - BOOST_TEST_REQUIRE(ship.IsIdling()); + BOOST_TEST_REQUIRE(ship.isIdling()); // Wait till wares arrive - RTTR_EXEC_TILL(3400, !ship.IsIdling()); + RTTR_EXEC_TILL(3400, !ship.isIdling()); // Expedition ready, ship ordered - BOOST_TEST_REQUIRE(ship.IsGoingToHarbor(harbor)); - BOOST_TEST_REQUIRE(player.GetShipsToHarbor(harbor) == 1u); + BOOST_TEST_REQUIRE(ship.isGoingToHarbor(harbor)); + BOOST_TEST_REQUIRE(player.getShipsToHarbor(harbor) == 1u); // No available boards - BOOST_TEST_REQUIRE(harbor.GetNumRealWares(GoodType::Boards) == 0u); + BOOST_TEST_REQUIRE(harbor.getNumRealWares(GoodType::Boards) == 0u); // Stop it this->StartStopExpedition(hbPos, true); - BOOST_TEST_REQUIRE(harbor.IsExpeditionActive()); + BOOST_TEST_REQUIRE(harbor.isExpeditionActive()); this->StartStopExpedition(hbPos, false); - BOOST_TEST_REQUIRE(!harbor.IsExpeditionActive()); + BOOST_TEST_REQUIRE(!harbor.isExpeditionActive()); this->StartStopExpedition(hbPos, false); - BOOST_TEST_REQUIRE(!harbor.IsExpeditionActive()); + BOOST_TEST_REQUIRE(!harbor.isExpeditionActive()); // Boards available again - BOOST_TEST_REQUIRE(harbor.GetNumRealWares(GoodType::Boards) > 0u); + BOOST_TEST_REQUIRE(harbor.getNumRealWares(GoodType::Boards) > 0u); // Let ship arrive - RTTR_EXEC_TILL(180, ship.IsIdling()); - BOOST_TEST_REQUIRE(!ship.IsGoingToHarbor(harbor)); - BOOST_TEST_REQUIRE(player.GetShipsToHarbor(harbor) == 0u); + RTTR_EXEC_TILL(180, ship.isIdling()); + BOOST_TEST_REQUIRE(!ship.isGoingToHarbor(harbor)); + BOOST_TEST_REQUIRE(player.getShipsToHarbor(harbor) == 0u); // Start again (everything is here) this->StartStopExpedition(hbPos, true); // ...so we can start right now - BOOST_TEST_REQUIRE(ship.IsOnExpedition()); + BOOST_TEST_REQUIRE(ship.isOnExpedition()); // Wait for ship to be "loaded" - RTTR_EXEC_TILL(200, ship.IsWaitingForExpeditionInstructions()); + RTTR_EXEC_TILL(200, ship.isWaitingForExpeditionInstructions()); // Ship should be waiting for expedition instructions (where to go) and player should have received a message - BOOST_TEST_REQUIRE(ship.GetCurrentHarbor() == harbor.GetHarborPosID()); - BOOST_TEST_REQUIRE(postBox->GetNumMsgs() == 1u); - const auto* msg = dynamic_cast(postBox->GetMsg(0)); + BOOST_TEST_REQUIRE(ship.getCurrentHarbor() == harbor.getHarborPosID()); + BOOST_TEST_REQUIRE(postBox->getNumMsgs() == 1u); + const auto* msg = dynamic_cast(postBox->getMsg(0)); BOOST_TEST_REQUIRE(msg); - BOOST_TEST_REQUIRE(msg->GetPos() == ship.GetPos()); //-V522 + BOOST_TEST_REQUIRE(msg->getPos() == ship.getPos()); //-V522 // Harbor pos taken by other player - this->TravelToNextSpot(ShipDirection::SouthEast, player.GetShipID(ship)); - BOOST_TEST_REQUIRE(ship.IsWaitingForExpeditionInstructions()); + this->TravelToNextSpot(ShipDirection::SouthEast, player.getShipID(ship)); + BOOST_TEST_REQUIRE(ship.isWaitingForExpeditionInstructions()); // Last free one (far south -> North is closer) - this->TravelToNextSpot(ShipDirection::North, player.GetShipID(ship)); - BOOST_TEST_REQUIRE(!ship.IsWaitingForExpeditionInstructions()); - BOOST_TEST_REQUIRE(ship.IsMoving()); + this->TravelToNextSpot(ShipDirection::North, player.getShipID(ship)); + BOOST_TEST_REQUIRE(!ship.isWaitingForExpeditionInstructions()); + BOOST_TEST_REQUIRE(ship.isMoving()); unsigned gfsToDest; - RTTR_EXEC_TILL_CT_GF(1000, ship.IsWaitingForExpeditionInstructions(), gfsToDest); + RTTR_EXEC_TILL_CT_GF(1000, ship.isWaitingForExpeditionInstructions(), gfsToDest); HarborId hbId(8); - BOOST_TEST_REQUIRE(ship.GetCurrentHarbor() == hbId); - BOOST_TEST_REQUIRE(world.CalcDistance(ship.GetPos(), world.GetHarborPoint(hbId)) == 1u); + BOOST_TEST_REQUIRE(ship.getCurrentHarbor() == hbId); + BOOST_TEST_REQUIRE(world.CalcDistance(ship.getPos(), world.getHarborPoint(hbId)) == 1u); // Cancel expedition -> Ship is going back to harbor - this->CancelExpedition(player.GetShipID(ship)); - BOOST_TEST_REQUIRE(ship.IsMoving()); + this->CancelExpedition(player.getShipID(ship)); + BOOST_TEST_REQUIRE(ship.isMoving()); // Let ship arrive and unload - RTTR_EXEC_TILL(gfsToDest + 300, ship.IsIdling()); + RTTR_EXEC_TILL(gfsToDest + 300, ship.isIdling()); // Start again (everything is here) this->StartStopExpedition(hbPos, true); - BOOST_TEST_REQUIRE(ship.IsOnExpedition()); + BOOST_TEST_REQUIRE(ship.isOnExpedition()); // Wait for ship to be "loaded" - RTTR_EXEC_TILL(200, ship.IsWaitingForExpeditionInstructions()); - BOOST_TEST_REQUIRE(ship.GetCurrentHarbor() == harbor.GetHarborPosID()); + RTTR_EXEC_TILL(200, ship.isWaitingForExpeditionInstructions()); + BOOST_TEST_REQUIRE(ship.getCurrentHarbor() == harbor.getHarborPosID()); // Try to found colony -> Fail - this->FoundColony(player.GetShipID(ship)); - BOOST_TEST_REQUIRE(ship.IsWaitingForExpeditionInstructions()); + this->FoundColony(player.getShipID(ship)); + BOOST_TEST_REQUIRE(ship.isWaitingForExpeditionInstructions()); // Go back to free spot - this->TravelToNextSpot(ShipDirection::North, player.GetShipID(ship)); - BOOST_TEST_REQUIRE(!ship.IsWaitingForExpeditionInstructions()); + this->TravelToNextSpot(ShipDirection::North, player.getShipID(ship)); + BOOST_TEST_REQUIRE(!ship.isWaitingForExpeditionInstructions()); for(unsigned gf = 0; gf < 2; gf++) { // Send commands that should be ignored as ship is not expecting them - this->FoundColony(player.GetShipID(ship)); - BOOST_TEST_REQUIRE(ship.IsMoving()); - this->TravelToNextSpot(ShipDirection::South, player.GetShipID(ship)); - this->CancelExpedition(player.GetShipID(ship)); - BOOST_TEST_REQUIRE(ship.IsMoving()); + this->FoundColony(player.getShipID(ship)); + BOOST_TEST_REQUIRE(ship.isMoving()); + this->TravelToNextSpot(ShipDirection::South, player.getShipID(ship)); + this->CancelExpedition(player.getShipID(ship)); + BOOST_TEST_REQUIRE(ship.isMoving()); this->em.ExecuteNextGF(); } // Go to destination postBox->Clear(); RTTR_SKIP_GFS(gfsToDest); - BOOST_TEST_REQUIRE(ship.IsWaitingForExpeditionInstructions()); + BOOST_TEST_REQUIRE(ship.isWaitingForExpeditionInstructions()); // This should again trigger a message - msg = dynamic_cast(postBox->GetMsg(0)); + msg = dynamic_cast(postBox->getMsg(0)); BOOST_TEST_REQUIRE(msg); - BOOST_TEST_REQUIRE(msg->GetPos() == ship.GetPos()); + BOOST_TEST_REQUIRE(msg->getPos() == ship.getPos()); // And now we can found a new colony - this->FoundColony(player.GetShipID(ship)); + this->FoundColony(player.getShipID(ship)); // Ship is free again - BOOST_TEST_REQUIRE(ship.IsIdling()); - const noBuildingSite* newHarbor = world.GetSpecObj(world.GetHarborPoint(hbId)); + BOOST_TEST_REQUIRE(ship.isIdling()); + const noBuildingSite* newHarbor = world.getSpecObj(world.getHarborPoint(hbId)); BOOST_TEST_REQUIRE(newHarbor); - BOOST_TEST_REQUIRE(world.IsHarborBuildingSiteFromSea(newHarbor)); + BOOST_TEST_REQUIRE(world.isHarborBuildingSiteFromSea(newHarbor)); // And it should be completed after some time - RTTR_EXEC_TILL(5000, player.GetBuildingRegister().GetHarbors().size() > 1); //-V807 - BOOST_TEST_REQUIRE(player.GetBuildingRegister().GetHarbors().size() == 2u); + RTTR_EXEC_TILL(5000, player.getBuildingRegister().getHarbors().size() > 1); //-V807 + BOOST_TEST_REQUIRE(player.getBuildingRegister().getHarbors().size() == 2u); } using ShipReadyFixtureBig = ShipReadyFixture<1, 2, 64, 800>; BOOST_FIXTURE_TEST_CASE(LongDistanceTravel, ShipReadyFixtureBig) { - const GamePlayer& player = world.GetPlayer(curPlayer); - const noShip& ship = ensureNonNull(player.GetShipByID(0)); - nobHarborBuilding& harbor = *player.GetBuildingRegister().GetHarbors().front(); - const MapPoint hbPos = harbor.GetPos(); + const GamePlayer& player = world.getPlayer(curPlayer); + const noShip& ship = ensureNonNull(player.getShipByID(0)); + nobHarborBuilding& harbor = *player.getBuildingRegister().getHarbors().front(); + const MapPoint hbPos = harbor.getPos(); // Go to opposite one const HarborId targetHbId(7); // Make sure that the other harbor is far away - BOOST_TEST_REQUIRE(world.GetMinHarborDistance(harbor.GetHarborPosID(), targetHbId) > 600u); + BOOST_TEST_REQUIRE(world.getMinHarborDistance(harbor.getHarborPosID(), targetHbId) > 600u); // Add some scouts harbor.AddToInventory(PeopleCounts::make(Job::Scout, 20), true); // We want the ship to only scout unexplored harbors, so set all but one to visible - for(const auto i : helpers::idRange(world.GetNumHarborPoints())) - world.GetNodeWriteable(world.GetHarborPoint(i)).fow[curPlayer].visibility = Visibility::Visible; - world.GetNodeWriteable(world.GetHarborPoint(targetHbId)).fow[curPlayer].visibility = Visibility::Invisible; + for(const auto i : helpers::idRange(world.getNumHarborPoints())) + world.getNodeWriteable(world.getHarborPoint(i)).fow[curPlayer].visibility = Visibility::Visible; + world.getNodeWriteable(world.getHarborPoint(targetHbId)).fow[curPlayer].visibility = Visibility::Invisible; // Start an exploration expedition this->StartStopExplorationExpedition(hbPos, true); - BOOST_TEST_REQUIRE(harbor.IsExplorationExpeditionActive()); + BOOST_TEST_REQUIRE(harbor.isExplorationExpeditionActive()); // Wait till ship has arrived and starts loading - RTTR_EXEC_TILL(100, ship.IsOnExplorationExpedition()); + RTTR_EXEC_TILL(100, ship.isOnExplorationExpedition()); // Wait till ship has loaded scouts - RTTR_EXEC_TILL(200, ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.GetTargetHarbor() == targetHbId); + RTTR_EXEC_TILL(200, ship.isMoving()); + BOOST_TEST_REQUIRE(ship.getTargetHarbor() == targetHbId); } namespace { @@ -559,11 +559,11 @@ struct ShipAndHarborsReadyFixture : using Parent = WorldFixture; using Parent::world; - GameWorld& GetWorld() override { return world; } + GameWorld& getWorld() override { return world; } nobHarborBuilding& createHarbor(HarborId hbPosId) { - MapPoint hbPos = world.GetHarborPoint(hbPosId); + MapPoint hbPos = world.getHarborPoint(hbPosId); auto* harbor = static_cast( BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, hbPos, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(harbor); @@ -576,17 +576,17 @@ struct ShipAndHarborsReadyFixture : ShipAndHarborsReadyFixture() { - GamePlayer& player = world.GetPlayer(curPlayer); + GamePlayer& player = world.getPlayer(curPlayer); createHarbor(HarborId(1)); createHarbor(HarborId(2)); - MapPoint hbPos = world.GetHarborPoint(HarborId(1)); + MapPoint hbPos = world.getHarborPoint(HarborId(1)); MapPoint shipPos = world.MakeMapPoint(hbPos - Position(2, 0)); - BOOST_TEST_REQUIRE(world.IsSeaPoint(shipPos)); + BOOST_TEST_REQUIRE(world.isSeaPoint(shipPos)); auto& ship = world.AddFigure(shipPos, std::make_unique(shipPos, curPlayer)); player.RegisterShip(ship); - BOOST_TEST_REQUIRE(player.GetNumShips() == 1u); + BOOST_TEST_REQUIRE(player.getNumShips() == 1u); } }; @@ -596,13 +596,13 @@ void destroyBldAndFire(GameWorldBase& world, const MapPoint& pos) // Remove fire world.DestroyNO(pos); // Remove burned wh if existing - for(noBase& fig : world.GetFigures(pos)) + for(noBase& fig : world.getFigures(pos)) { - if(fig.GetGOT() == GO_Type::Burnedwarehouse) + if(fig.getGOT() == GO_Type::Burnedwarehouse) { // Remove go-out event (not automatically done as the burned wh is never removed) - const GameEvent* ev = static_cast(world.GetEvMgr()).GetObjEvents(fig).front(); - world.GetEvMgr().RemoveEvent(ev); + const GameEvent* ev = static_cast(world.getEvMgr()).getObjEvents(fig).front(); + world.getEvMgr().RemoveEvent(ev); world.RemoveFigure(pos, fig)->Destroy(); break; } @@ -612,82 +612,82 @@ void destroyBldAndFire(GameWorldBase& world, const MapPoint& pos) BOOST_FIXTURE_TEST_CASE(HarborDestroyed, ShipAndHarborsReadyFixture<1>) { - const GamePlayer& player = world.GetPlayer(curPlayer); - const noShip& ship = *player.GetShipByID(0); + const GamePlayer& player = world.getPlayer(curPlayer); + const noShip& ship = *player.getShipByID(0); constexpr HarborId hb1Id(1); constexpr HarborId hb2Id(2); constexpr HarborId hb3Id(3); - const MapPoint hb1Pos = world.GetHarborPoint(hb1Id); - const MapPoint hb2Pos = world.GetHarborPoint(hb2Id); - const MapPoint hb3Pos = world.GetHarborPoint(hb3Id); + const MapPoint hb1Pos = world.getHarborPoint(hb1Id); + const MapPoint hb2Pos = world.getHarborPoint(hb2Id); + const MapPoint hb3Pos = world.getHarborPoint(hb3Id); // Order goods SetInventorySetting(hb2Pos, GoodType::Wood, EInventorySetting::Collect); SetInventorySetting(hb2Pos, Job::Woodcutter, EInventorySetting::Collect); // Destroy home before load -> Abort after ship reaches harbor - RTTR_EXEC_TILL(90, ship.IsMoving()); + RTTR_EXEC_TILL(90, ship.isMoving()); destroyBldAndFire(world, hb1Pos); - RTTR_EXEC_TILL(10, !ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.IsIdling()); + RTTR_EXEC_TILL(10, !ship.isMoving()); + BOOST_TEST_REQUIRE(ship.isIdling()); // Destroy home during load -> Continue createHarbor(hb1Id); // Just wait for re-order event and instantly go to loading as ship does not need to move - RTTR_EXEC_TILL(90, ship.IsLoading()); + RTTR_EXEC_TILL(90, ship.isLoading()); destroyBldAndFire(world, hb1Pos); - BOOST_TEST_REQUIRE(ship.IsLoading()); - BOOST_TEST_REQUIRE(!ship.GetHomeHarbor()); - RTTR_EXEC_TILL(300, ship.IsUnloading()); + BOOST_TEST_REQUIRE(ship.isLoading()); + BOOST_TEST_REQUIRE(!ship.getHomeHarbor()); + RTTR_EXEC_TILL(300, ship.isUnloading()); constexpr SeaId seaId(1); - BOOST_TEST_REQUIRE(ship.GetPos() == world.GetCoastalPoint(hb2Id, seaId)); - RTTR_EXEC_TILL(200, ship.IsIdling()); + BOOST_TEST_REQUIRE(ship.getPos() == world.getCoastalPoint(hb2Id, seaId)); + RTTR_EXEC_TILL(200, ship.isIdling()); // Destroy destination before load -> Abort after ship reaches harbor createHarbor(hb1Id); - RTTR_EXEC_TILL(90, ship.IsMoving()); + RTTR_EXEC_TILL(90, ship.isMoving()); destroyBldAndFire(world, hb2Pos); - RTTR_EXEC_TILL(200, !ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.IsIdling()); + RTTR_EXEC_TILL(200, !ship.isMoving()); + BOOST_TEST_REQUIRE(ship.isIdling()); // Destroy destination during load -> Unload again createHarbor(hb2Id); // Order goods SetInventorySetting(hb2Pos, GoodType::Wood, EInventorySetting::Collect); SetInventorySetting(hb2Pos, Job::Woodcutter, EInventorySetting::Collect); - RTTR_EXEC_TILL(300, ship.IsLoading()); + RTTR_EXEC_TILL(300, ship.isLoading()); destroyBldAndFire(world, hb2Pos); - BOOST_TEST_REQUIRE(ship.IsUnloading()); - RTTR_EXEC_TILL(200, ship.IsIdling()); + BOOST_TEST_REQUIRE(ship.isUnloading()); + RTTR_EXEC_TILL(200, ship.isIdling()); // Destroy destination during driving -> Go back and unload createHarbor(hb2Id); // Order goods SetInventorySetting(hb2Pos, GoodType::Wood, EInventorySetting::Collect); SetInventorySetting(hb2Pos, Job::Woodcutter, EInventorySetting::Collect); - RTTR_EXEC_TILL(300, ship.IsLoading()); - RTTR_EXEC_TILL(200, ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.GetHomeHarbor() == hb1Id); - BOOST_TEST_REQUIRE(ship.GetTargetHarbor() == hb2Id); + RTTR_EXEC_TILL(300, ship.isLoading()); + RTTR_EXEC_TILL(200, ship.isMoving()); + BOOST_TEST_REQUIRE(ship.getHomeHarbor() == hb1Id); + BOOST_TEST_REQUIRE(ship.getTargetHarbor() == hb2Id); destroyBldAndFire(world, hb2Pos); - RTTR_EXEC_TILL(10, ship.GetTargetHarbor() == hb1Id); - RTTR_EXEC_TILL(20, ship.IsUnloading()); - BOOST_TEST_REQUIRE(ship.GetPos() == world.GetCoastalPoint(hb1Id, seaId)); - RTTR_EXEC_TILL(200, ship.IsIdling()); + RTTR_EXEC_TILL(10, ship.getTargetHarbor() == hb1Id); + RTTR_EXEC_TILL(20, ship.isUnloading()); + BOOST_TEST_REQUIRE(ship.getPos() == world.getCoastalPoint(hb1Id, seaId)); + RTTR_EXEC_TILL(200, ship.isIdling()); // Destroy destination during unloading -> Go back and unload createHarbor(hb2Id); // Order goods SetInventorySetting(hb2Pos, GoodType::Wood, EInventorySetting::Collect); SetInventorySetting(hb2Pos, Job::Woodcutter, EInventorySetting::Collect); - RTTR_EXEC_TILL(700, ship.IsUnloading()); - BOOST_TEST_REQUIRE(ship.GetHomeHarbor() == hb1Id); - BOOST_TEST_REQUIRE(ship.GetTargetHarbor() == hb2Id); + RTTR_EXEC_TILL(700, ship.isUnloading()); + BOOST_TEST_REQUIRE(ship.getHomeHarbor() == hb1Id); + BOOST_TEST_REQUIRE(ship.getTargetHarbor() == hb2Id); destroyBldAndFire(world, hb2Pos); - RTTR_EXEC_TILL(10, ship.GetTargetHarbor() == hb1Id); - RTTR_EXEC_TILL(200, ship.IsUnloading()); - BOOST_TEST_REQUIRE(ship.GetPos() == world.GetCoastalPoint(hb1Id, seaId)); - RTTR_EXEC_TILL(200, ship.IsIdling()); + RTTR_EXEC_TILL(10, ship.getTargetHarbor() == hb1Id); + RTTR_EXEC_TILL(200, ship.isUnloading()); + BOOST_TEST_REQUIRE(ship.getPos() == world.getCoastalPoint(hb1Id, seaId)); + RTTR_EXEC_TILL(200, ship.isIdling()); // Destroy both during unloading -> Go to 3rd and unload createHarbor(hb2Id); @@ -695,21 +695,21 @@ BOOST_FIXTURE_TEST_CASE(HarborDestroyed, ShipAndHarborsReadyFixture<1>) // Order goods SetInventorySetting(hb2Pos, GoodType::Wood, EInventorySetting::Collect); SetInventorySetting(hb2Pos, Job::Woodcutter, EInventorySetting::Collect); - RTTR_EXEC_TILL(700, ship.IsUnloading()); - BOOST_TEST_REQUIRE(ship.GetHomeHarbor() == hb1Id); - BOOST_TEST_REQUIRE(ship.GetTargetHarbor() == hb2Id); + RTTR_EXEC_TILL(700, ship.isUnloading()); + BOOST_TEST_REQUIRE(ship.getHomeHarbor() == hb1Id); + BOOST_TEST_REQUIRE(ship.getTargetHarbor() == hb2Id); destroyBldAndFire(world, hb1Pos); destroyBldAndFire(world, hb2Pos); - RTTR_EXEC_TILL(10, ship.GetTargetHarbor() == HarborId(3)); + RTTR_EXEC_TILL(10, ship.getTargetHarbor() == HarborId(3)); // Destroy last -> destroyBldAndFire(world, hb3Pos); - RTTR_EXEC_TILL(10, ship.IsLost()); - BOOST_TEST_REQUIRE(!ship.GetHomeHarbor()); - BOOST_TEST_REQUIRE(!ship.GetTargetHarbor()); + RTTR_EXEC_TILL(10, ship.isLost()); + BOOST_TEST_REQUIRE(!ship.getHomeHarbor()); + BOOST_TEST_REQUIRE(!ship.getTargetHarbor()); createHarbor(hb1Id); - BOOST_TEST_REQUIRE(ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.GetHomeHarbor() == hb1Id); - BOOST_TEST_REQUIRE(ship.GetTargetHarbor() == hb1Id); + BOOST_TEST_REQUIRE(ship.isMoving()); + BOOST_TEST_REQUIRE(ship.getHomeHarbor() == hb1Id); + BOOST_TEST_REQUIRE(ship.getTargetHarbor() == hb1Id); } // Dimensions must be large enough so path tolerances get too small @@ -733,10 +733,10 @@ BOOST_FIXTURE_TEST_CASE(IncreasedPathLengthWhenHarborDestroyed, ShipReadyFixture constexpr HarborId hbIdLeft(4); constexpr HarborId hbIdRight(5); constexpr HarborId hbIdBottom(7); - const MapPoint hbTopPos = world.GetHarborPoint(hbIdTop); - const MapPoint hbLeftPos = world.GetHarborPoint(hbIdLeft); - const MapPoint hbRightPos = world.GetHarborPoint(hbIdRight); - const MapPoint hbBottomPos = world.GetHarborPoint(hbIdBottom); + const MapPoint hbTopPos = world.getHarborPoint(hbIdTop); + const MapPoint hbLeftPos = world.getHarborPoint(hbIdLeft); + const MapPoint hbRightPos = world.getHarborPoint(hbIdRight); + const MapPoint hbBottomPos = world.getHarborPoint(hbIdBottom); // Sanity check expected geometry, ensured by fixture BOOST_TEST_REQUIRE(hbLeftPos.x < hbRightPos.x); BOOST_TEST_REQUIRE(hbLeftPos.y == hbRightPos.y); @@ -744,10 +744,10 @@ BOOST_FIXTURE_TEST_CASE(IncreasedPathLengthWhenHarborDestroyed, ShipReadyFixture BOOST_TEST_REQUIRE(hbLeftPos.y < hbBottomPos.y); const unsigned yDiff = hbLeftPos.y - hbTopPos.y; BOOST_TEST_REQUIRE(yDiff >= 4u * 3u); // So divisions below yield noticeable difference - const auto t = GetLandTerrain(world.GetDescription(), ETerrain::Buildable); + const auto t = GetLandTerrain(world.getDescription(), ETerrain::Buildable); for(const auto y : helpers::range(hbLeftPos.y - yDiff * 3u / 4u, hbLeftPos.y + yDiff / 2u)) { - auto& node = world.GetNodeWriteable(MapPoint(hbTopPos.x, y)); + auto& node = world.getNodeWriteable(MapPoint(hbTopPos.x, y)); node.t1 = node.t2 = t; } constexpr auto horStripHeight = 2u; @@ -756,58 +756,58 @@ BOOST_FIXTURE_TEST_CASE(IncreasedPathLengthWhenHarborDestroyed, ShipReadyFixture { for(const auto x : helpers::range(hbLeftPos.x + 4, hbRightPos.x - 4)) { - auto& node = world.GetNodeWriteable(MapPoint(x, y)); + auto& node = world.getNodeWriteable(MapPoint(x, y)); node.t1 = node.t2 = t; } } MapLoader::InitSeasAndHarbors(world); // Harbors unchanged - BOOST_TEST_REQUIRE(world.GetHarborPointID(hbTopPos) == hbIdTop); - BOOST_TEST_REQUIRE(world.GetHarborPointID(hbLeftPos) == hbIdLeft); - BOOST_TEST_REQUIRE(world.GetHarborPointID(hbRightPos) == hbIdRight); - BOOST_TEST_REQUIRE(world.GetHarborPointID(hbBottomPos) == hbIdBottom); + BOOST_TEST_REQUIRE(world.getHarborPointID(hbTopPos) == hbIdTop); + BOOST_TEST_REQUIRE(world.getHarborPointID(hbLeftPos) == hbIdLeft); + BOOST_TEST_REQUIRE(world.getHarborPointID(hbRightPos) == hbIdRight); + BOOST_TEST_REQUIRE(world.getHarborPointID(hbBottomPos) == hbIdBottom); - const GamePlayer& player = world.GetPlayer(curPlayer); - const noShip& ship = ensureNonNull(player.GetShipByID(0)); - const SeaId seaId = ship.GetSeaID(); + const GamePlayer& player = world.getPlayer(curPlayer); + const noShip& ship = ensureNonNull(player.getShipByID(0)); + const SeaId seaId = ship.getSeaID(); // Start shipment to left harbor - nobHarborBuilding& topHarbor = *player.GetBuildingRegister().GetHarbors().front(); + nobHarborBuilding& topHarbor = *player.getBuildingRegister().getHarbors().front(); BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, hbLeftPos, curPlayer, Nation::Romans); topHarbor.AddToInventory(GoodCounts::make(GoodType::Wood, 10), true); SetInventorySetting(hbLeftPos, GoodType::Wood, EInventorySetting::Collect); - RTTR_EXEC_TILL(90, ship.IsLoading()); - BOOST_TEST_REQUIRE(ship.GetPos() == world.GetCoastalPoint(hbIdTop, seaId)); - RTTR_EXEC_TILL(400, ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.GetTargetHarbor() == hbIdLeft); - const auto leftCoastPt = world.GetCoastalPoint(hbIdLeft, seaId); + RTTR_EXEC_TILL(90, ship.isLoading()); + BOOST_TEST_REQUIRE(ship.getPos() == world.getCoastalPoint(hbIdTop, seaId)); + RTTR_EXEC_TILL(400, ship.isMoving()); + BOOST_TEST_REQUIRE(ship.getTargetHarbor() == hbIdLeft); + const auto leftCoastPt = world.getCoastalPoint(hbIdLeft, seaId); // Wait till ship is close to left harbor constexpr auto extraDist = 16u; // Choosen to be larger than a magic number used as tolerance - RTTR_EXEC_TILL(2000, world.CalcDistance(ship.GetPos(), leftCoastPt) < extraDist * 2); + RTTR_EXEC_TILL(2000, world.CalcDistance(ship.getPos(), leftCoastPt) < extraDist * 2); // Destroy home so it cannot go back, then target harbor destroyBldAndFire(world, hbTopPos); destroyBldAndFire(world, hbLeftPos); - RTTR_EXEC_TILL(10, ship.IsLost()); - BOOST_TEST_REQUIRE(!ship.GetHomeHarbor()); - BOOST_TEST_REQUIRE(!ship.GetTargetHarbor()); + RTTR_EXEC_TILL(10, ship.isLost()); + BOOST_TEST_REQUIRE(!ship.getHomeHarbor()); + BOOST_TEST_REQUIRE(!ship.getTargetHarbor()); // Building harbor at right makes ship go there even though distance is (too) long unsigned len; BOOST_TEST_REQUIRE( - world.FindShipPath(ship.GetPos(), world.GetCoastalPoint(hbIdRight, seaId), unsigned(-1), nullptr, &len)); - const auto hbDistance = world.GetMinHarborDistance(hbIdLeft, hbIdRight); + world.FindShipPath(ship.getPos(), world.getCoastalPoint(hbIdRight, seaId), unsigned(-1), nullptr, &len)); + const auto hbDistance = world.getMinHarborDistance(hbIdLeft, hbIdRight); // Reproducer requires the path to be longer than the direct distance and other connections BOOST_TEST_REQUIRE(len > hbDistance + extraDist); - BOOST_TEST_REQUIRE(hbDistance > world.GetMinHarborDistance(hbIdRight, hbIdTop)); - BOOST_TEST_REQUIRE(hbDistance > world.GetMinHarborDistance(hbIdRight, hbIdBottom)); + BOOST_TEST_REQUIRE(hbDistance > world.getMinHarborDistance(hbIdRight, hbIdTop)); + BOOST_TEST_REQUIRE(hbDistance > world.getMinHarborDistance(hbIdRight, hbIdBottom)); BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, hbRightPos, curPlayer, Nation::Romans); - BOOST_TEST_REQUIRE(ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.GetHomeHarbor() == hbIdRight); - BOOST_TEST_REQUIRE(ship.GetTargetHarbor() == hbIdRight); + BOOST_TEST_REQUIRE(ship.isMoving()); + BOOST_TEST_REQUIRE(ship.getHomeHarbor() == hbIdRight); + BOOST_TEST_REQUIRE(ship.getTargetHarbor() == hbIdRight); } struct MockWare : Ware @@ -828,78 +828,78 @@ BOOST_FIXTURE_TEST_CASE(AddWareWithUnreachableGoalToHarbor, ShipAndHarborsReadyF // 2. Goal becomes unreachable (e.g. road removed) // 3. Ware reaches harbor and needs to be carried into a storehouse // 4. Harbor itself does not accept the ware so another storehouse must be found - GamePlayer& player = world.GetPlayer(curPlayer); - const auto& harbors = player.GetBuildingRegister().GetHarbors(); + GamePlayer& player = world.getPlayer(curPlayer); + const auto& harbors = player.getBuildingRegister().getHarbors(); BOOST_TEST_REQUIRE(harbors.size() >= 2u); nobHarborBuilding& harbor1 = *harbors.front(); nobHarborBuilding& harbor2 = **(++harbors.begin()); auto* wh = static_cast(BuildingFactory::CreateBuilding( - world, BuildingType::Storehouse, harbor2.GetPos() + MapPoint(2, 0), curPlayer, Nation::Romans)); + world, BuildingType::Storehouse, harbor2.getPos() + MapPoint(2, 0), curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(wh); - BuildRoadForBlds(harbor2.GetPos(), wh->GetPos()); + BuildRoadForBlds(harbor2.getPos(), wh->getPos()); constexpr auto goodType = GoodType::Wood; // Sanity check: Move from harbor1 to wh (over harbor2) auto ware = std::make_unique(goodType, wh, &harbor1); auto* warePtr = ware.get(); ware->Carry(harbor1); - auto numVisWaresBefore = harbor1.GetNumVisualWares(goodType); - auto numRealWaresBefore = harbor1.GetNumRealWares(goodType); + auto numVisWaresBefore = harbor1.getNumVisualWares(goodType); + auto numRealWaresBefore = harbor1.getNumRealWares(goodType); harbor1.AddWare(std::move(ware)); - BOOST_TEST(harbor1.GetNumVisualWares(goodType) == numVisWaresBefore + 1u); + BOOST_TEST(harbor1.getNumVisualWares(goodType) == numVisWaresBefore + 1u); // Wares that will be moved out are only in visual count - BOOST_TEST(harbor1.GetNumRealWares(goodType) == numRealWaresBefore); + BOOST_TEST(harbor1.getNumRealWares(goodType) == numRealWaresBefore); BOOST_TEST_REQUIRE(!MockWare::destroyed); - BOOST_TEST(warePtr->GetGoal() == wh); - BOOST_TEST(warePtr->GetNextDir() == RoadPathDirection::Ship); + BOOST_TEST(warePtr->getGoal() == wh); + BOOST_TEST(warePtr->getNextDir() == RoadPathDirection::Ship); // Add ware with unreachable goal -> Added to harbor // First fully disconnect 2nd harbor -> Only reachable via ship for(const auto d : helpers::enumRange()) { if(d != Direction::NorthWest) - DestroyRoad(harbor2.GetFlagPos(), d); + DestroyRoad(harbor2.getFlagPos(), d); } ware = std::make_unique(goodType, wh, &harbor1); ware->Carry(harbor1); - numVisWaresBefore = harbor1.GetNumVisualWares(goodType); - numRealWaresBefore = harbor1.GetNumRealWares(goodType); + numVisWaresBefore = harbor1.getNumVisualWares(goodType); + numRealWaresBefore = harbor1.getNumRealWares(goodType); harbor1.AddWare(std::move(ware)); - BOOST_TEST(harbor1.GetNumVisualWares(goodType) == numVisWaresBefore + 1u); - BOOST_TEST(harbor1.GetNumRealWares(goodType) == numRealWaresBefore + 1u); + BOOST_TEST(harbor1.getNumVisualWares(goodType) == numVisWaresBefore + 1u); + BOOST_TEST(harbor1.getNumRealWares(goodType) == numRealWaresBefore + 1u); BOOST_TEST(MockWare::destroyed); // Same but disallow harbor as goal -> Find another storehouse - SetInventorySetting(harbor1.GetPos(), goodType, EInventorySetting::Stop); + SetInventorySetting(harbor1.getPos(), goodType, EInventorySetting::Stop); ware = std::make_unique(goodType, wh, &harbor1); ware->Carry(harbor1); warePtr = ware.get(); - numVisWaresBefore = harbor1.GetNumVisualWares(goodType); - numRealWaresBefore = harbor1.GetNumRealWares(goodType); + numVisWaresBefore = harbor1.getNumVisualWares(goodType); + numRealWaresBefore = harbor1.getNumRealWares(goodType); harbor1.AddWare(std::move(ware)); - BOOST_TEST(harbor1.GetNumVisualWares(goodType) == numVisWaresBefore + 1u); - BOOST_TEST(harbor1.GetNumRealWares(goodType) == numRealWaresBefore); + BOOST_TEST(harbor1.getNumVisualWares(goodType) == numVisWaresBefore + 1u); + BOOST_TEST(harbor1.getNumRealWares(goodType) == numRealWaresBefore); BOOST_TEST_REQUIRE(!MockWare::destroyed); - BOOST_TEST(warePtr->GetGoal() == &harbor2); + BOOST_TEST(warePtr->getGoal() == &harbor2); // If no other storehouse is available take it anyway - SetInventorySetting(harbor2.GetPos(), goodType, EInventorySetting::Stop); + SetInventorySetting(harbor2.getPos(), goodType, EInventorySetting::Stop); ware = std::make_unique(goodType, wh, &harbor1); ware->Carry(harbor1); - numVisWaresBefore = harbor1.GetNumVisualWares(goodType); - numRealWaresBefore = harbor1.GetNumRealWares(goodType); + numVisWaresBefore = harbor1.getNumVisualWares(goodType); + numRealWaresBefore = harbor1.getNumRealWares(goodType); harbor1.AddWare(std::move(ware)); - BOOST_TEST(harbor1.GetNumVisualWares(goodType) == numVisWaresBefore + 1u); - BOOST_TEST(harbor1.GetNumRealWares(goodType) == numRealWaresBefore + 1u); + BOOST_TEST(harbor1.getNumVisualWares(goodType) == numVisWaresBefore + 1u); + BOOST_TEST(harbor1.getNumRealWares(goodType) == numRealWaresBefore + 1u); BOOST_TEST(MockWare::destroyed); } BOOST_FIXTURE_TEST_CASE(GoToNeighborHarbor, ShipReadyFixture<1>) { - const GamePlayer& player = world.GetPlayer(curPlayer); - const noShip& ship = ensureNonNull(player.GetShipByID(0)); - nobHarborBuilding& homeHarbor = *player.GetBuildingRegister().GetHarbors().front(); - const MapPoint homeHbPos = homeHarbor.GetPos(); + const GamePlayer& player = world.getPlayer(curPlayer); + const noShip& ship = ensureNonNull(player.getShipByID(0)); + nobHarborBuilding& homeHarbor = *player.getBuildingRegister().getHarbors().front(); + const MapPoint homeHbPos = homeHarbor.getPos(); GoodsAndPeopleCounts expWares; expWares[Job::Builder] = 1; expWares[GoodType::Boards] = 20; @@ -918,71 +918,71 @@ BOOST_FIXTURE_TEST_CASE(GoToNeighborHarbor, ShipReadyFixture<1>) // Put the harbors up into the sea so we can control the coastal point const MapPoint harborPos = homeHbPos + MapPoint(7, -3); // (1) - const MapPoint nbHbPos = world.GetNeighbour(harborPos, Direction::SouthEast); // (2) + const MapPoint nbHbPos = world.getNeighbour(harborPos, Direction::SouthEast); // (2) const MapPoint otherHbPos = world.MakeMapPoint(homeHbPos - Point(3, 0)); // Unrelated harbor const std::vector harborPoints = {harborPos, nbHbPos, otherHbPos}; for(const MapPoint p : harborPoints) - world.GetNodeWriteable(p).bq = BuildingQuality::Harbor; + world.getNodeWriteable(p).bq = BuildingQuality::Harbor; // These nodes and 3 left of it get land terrain (below) const std::array nodes{ - world.GetNeighbour(world.GetNeighbour(harborPos, Direction::NorthEast), Direction::NorthEast), - world.GetNeighbour(harborPos, Direction::NorthWest), harborPos, nbHbPos}; + world.getNeighbour(world.getNeighbour(harborPos, Direction::NorthEast), Direction::NorthEast), + world.getNeighbour(harborPos, Direction::NorthWest), harborPos, nbHbPos}; for(auto p : nodes) { for([[maybe_unused]] auto i : helpers::range(2)) { - auto& node = world.GetNodeWriteable(p); - node.t1 = node.t2 = GetLandTerrain(world.GetDescription()); - p = world.GetNeighbour(p, Direction::West); + auto& node = world.getNodeWriteable(p); + node.t1 = node.t2 = GetLandTerrain(world.getDescription()); + p = world.getNeighbour(p, Direction::West); } } - const auto coastPoint = world.GetNeighbour(harborPos, Direction::East); + const auto coastPoint = world.getNeighbour(harborPos, Direction::East); // And the coastal point { - auto& node = world.GetNodeWriteable(world.GetNeighbour(coastPoint, Direction::NorthWest)); - node.t1 = GetLandTerrain(world.GetDescription()); + auto& node = world.getNodeWriteable(world.getNeighbour(coastPoint, Direction::NorthWest)); + node.t1 = GetLandTerrain(world.getDescription()); } MapLoader::InitSeasAndHarbors(world, harborPoints); - const auto harborId = world.GetHarborPointID(harborPos); - const auto nbHbId = world.GetHarborPointID(nbHbPos); + const auto harborId = world.getHarborPointID(harborPos); + const auto nbHbId = world.getHarborPointID(nbHbPos); BOOST_TEST_REQUIRE(harborId.isValid()); BOOST_TEST_REQUIRE(nbHbId.isValid()); - const auto seaId = world.GetSeaId(harborId, Direction::East); + const auto seaId = world.getSeaId(harborId, Direction::East); BOOST_TEST_REQUIRE(seaId.isValid()); - BOOST_TEST_REQUIRE(world.GetCoastalPoint(harborId, seaId) == coastPoint); - const auto nbSeaId = world.GetSeaId(nbHbId, Direction::NorthEast); + BOOST_TEST_REQUIRE(world.getCoastalPoint(harborId, seaId) == coastPoint); + const auto nbSeaId = world.getSeaId(nbHbId, Direction::NorthEast); BOOST_TEST_REQUIRE(nbSeaId == seaId); - BOOST_TEST_REQUIRE(world.GetCoastalPoint(nbHbId, seaId) == coastPoint); + BOOST_TEST_REQUIRE(world.getCoastalPoint(nbHbId, seaId) == coastPoint); this->StartStopExpedition(homeHbPos, true); - BOOST_TEST_REQUIRE(homeHarbor.IsExpeditionActive()); + BOOST_TEST_REQUIRE(homeHarbor.isExpeditionActive()); // Wait till ship has loaded wares and is ready - RTTR_EXEC_TILL(500, ship.IsWaitingForExpeditionInstructions()); + RTTR_EXEC_TILL(500, ship.isWaitingForExpeditionInstructions()); - this->TravelToNextSpot(this->GetShipDir(ship, harborId), player.GetShipID(ship)); - BOOST_TEST_REQUIRE(!ship.IsWaitingForExpeditionInstructions()); - BOOST_TEST_REQUIRE(ship.IsMoving()); - BOOST_TEST_REQUIRE(ship.GetTargetHarbor() == harborId); + this->TravelToNextSpot(this->GetShipDir(ship, harborId), player.getShipID(ship)); + BOOST_TEST_REQUIRE(!ship.isWaitingForExpeditionInstructions()); + BOOST_TEST_REQUIRE(ship.isMoving()); + BOOST_TEST_REQUIRE(ship.getTargetHarbor() == harborId); - RTTR_EXEC_TILL(500, ship.IsWaitingForExpeditionInstructions()); - BOOST_TEST_REQUIRE(ship.GetPos() == coastPoint); + RTTR_EXEC_TILL(500, ship.isWaitingForExpeditionInstructions()); + BOOST_TEST_REQUIRE(ship.getPos() == coastPoint); - this->TravelToNextSpot(this->GetShipDir(ship, nbHbId), player.GetShipID(ship)); - BOOST_TEST_REQUIRE(ship.GetTargetHarbor() == nbHbId); + this->TravelToNextSpot(this->GetShipDir(ship, nbHbId), player.getShipID(ship)); + BOOST_TEST_REQUIRE(ship.getTargetHarbor() == nbHbId); // Already there - BOOST_TEST(ship.IsWaitingForExpeditionInstructions()); - BOOST_TEST(ship.GetPos() == coastPoint); + BOOST_TEST(ship.isWaitingForExpeditionInstructions()); + BOOST_TEST(ship.getPos() == coastPoint); // Can move - const auto otherHarborId = world.GetHarborPointID(otherHbPos); + const auto otherHarborId = world.getHarborPointID(otherHbPos); BOOST_TEST_REQUIRE(otherHarborId.isValid()); // Precondition that any ship dir will be found - BOOST_TEST_REQUIRE(world.IsHarborAtSea(otherHarborId, seaId)); - this->TravelToNextSpot(this->GetShipDir(ship, otherHarborId), player.GetShipID(ship)); - BOOST_TEST_REQUIRE(ship.GetTargetHarbor() == otherHarborId); + BOOST_TEST_REQUIRE(world.isHarborAtSea(otherHarborId, seaId)); + this->TravelToNextSpot(this->GetShipDir(ship, otherHarborId), player.getShipID(ship)); + BOOST_TEST_REQUIRE(ship.getTargetHarbor() == otherHarborId); // Moving - BOOST_TEST_REQUIRE(ship.IsMoving()); + BOOST_TEST_REQUIRE(ship.isMoving()); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/integration/testSerialization.cpp b/tests/s25Main/integration/testSerialization.cpp index fdd5ba1e12..d6823017a5 100644 --- a/tests/s25Main/integration/testSerialization.cpp +++ b/tests/s25Main/integration/testSerialization.cpp @@ -53,9 +53,9 @@ struct RandWorldFixture : public WorldFixture { RandWorldFixture() { - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - MapNode& worldNode = world.GetNodeWriteable(pt); + MapNode& worldNode = world.getNodeWriteable(pt); worldNode.altitude = rttr::test::randomValue(10, 20); worldNode.shadow = rttr::test::randomValue(0, 20); worldNode.resources = Resource(rttr::test::randomValue()); @@ -64,14 +64,14 @@ struct RandWorldFixture : public WorldFixture worldNode.harborId = HarborId(rttr::test::randomValue(0, 20)); } world.InitAfterLoad(); - world.GetPlayer(0).name = "Human"; - world.GetPlayer(1).ps = PlayerState::AI; //-V807 - world.GetPlayer(1).aiInfo = AI::Info(AI::Type::Default, AI::Level::Medium); - world.GetPlayer(1).name = "PlAI"; - world.GetPlayer(2).ps = PlayerState::Locked; - world.GetPlayer(3).ps = PlayerState::AI; //-V807 - world.GetPlayer(3).aiInfo = AI::Info(AI::Type::Default, AI::Level::Easy); - world.GetPlayer(3).name = "PlAI2"; + world.getPlayer(0).name = "Human"; + world.getPlayer(1).ps = PlayerState::AI; //-V807 + world.getPlayer(1).aiInfo = AI::Info(AI::Type::Default, AI::Level::Medium); + world.getPlayer(1).name = "PlAI"; + world.getPlayer(2).ps = PlayerState::Locked; + world.getPlayer(3).ps = PlayerState::AI; //-V807 + world.getPlayer(3).aiInfo = AI::Info(AI::Type::Default, AI::Level::Easy); + world.getPlayer(3).name = "PlAI2"; ggs.speed = GameSpeed::VeryFast; } @@ -111,7 +111,7 @@ void AddReplayCmds(Replay& replay, const PlayerGameCommands& cmds) void CheckReplayCmds(Replay& loadReplay, const PlayerGameCommands& recordedCmds) { - BOOST_TEST_REQUIRE(loadReplay.IsReplaying()); + BOOST_TEST_REQUIRE(loadReplay.isReplaying()); auto gf = loadReplay.ReadGF(); BOOST_TEST(gf == 1u); @@ -230,7 +230,7 @@ BOOST_AUTO_TEST_CASE(LegacyInexhaustibleMinesDeserializeMigratesToPerMineBehavio for(const BuildingType mineType : {BuildingType::GraniteMine, BuildingType::CoalMine, BuildingType::IronMine, BuildingType::GoldMine}) - BOOST_TEST(GetMineResourceBehavior(ggsLoaded, mineType) == MineResourceBehavior::Inexhaustible); + BOOST_TEST(getMineResourceBehavior(ggsLoaded, mineType) == MineResourceBehavior::Inexhaustible); BOOST_TEST(ggsLoaded.getSelection(AddonId::INEXHAUSTIBLE_MINES) == 0u); } @@ -254,7 +254,7 @@ BOOST_AUTO_TEST_CASE(LegacyInexhaustibleMinesDeserializeAlsoMigratesLegacyGranit for(const BuildingType mineType : {BuildingType::GraniteMine, BuildingType::CoalMine, BuildingType::IronMine, BuildingType::GoldMine}) - BOOST_TEST(GetMineResourceBehavior(ggsLoaded, mineType) == MineResourceBehavior::Inexhaustible); + BOOST_TEST(getMineResourceBehavior(ggsLoaded, mineType) == MineResourceBehavior::Inexhaustible); } BOOST_AUTO_TEST_CASE(LegacyInexhaustibleMinesDeserializeDoesNotOverridePerMineBehavior) @@ -271,17 +271,17 @@ BOOST_AUTO_TEST_CASE(LegacyInexhaustibleMinesDeserializeDoesNotOverridePerMineBe GlobalGameSettings ggsLoaded; ggsLoaded.Deserialize(loader); - BOOST_TEST(GetMineResourceBehavior(ggsLoaded, BuildingType::CoalMine) == MineResourceBehavior::S4LikeExhaustion); - BOOST_TEST(GetMineResourceBehavior(ggsLoaded, BuildingType::GraniteMine) == MineResourceBehavior::Inexhaustible); - BOOST_TEST(GetMineResourceBehavior(ggsLoaded, BuildingType::IronMine) == MineResourceBehavior::Inexhaustible); - BOOST_TEST(GetMineResourceBehavior(ggsLoaded, BuildingType::GoldMine) == MineResourceBehavior::Inexhaustible); + BOOST_TEST(getMineResourceBehavior(ggsLoaded, BuildingType::CoalMine) == MineResourceBehavior::S4LikeExhaustion); + BOOST_TEST(getMineResourceBehavior(ggsLoaded, BuildingType::GraniteMine) == MineResourceBehavior::Inexhaustible); + BOOST_TEST(getMineResourceBehavior(ggsLoaded, BuildingType::IronMine) == MineResourceBehavior::Inexhaustible); + BOOST_TEST(getMineResourceBehavior(ggsLoaded, BuildingType::GoldMine) == MineResourceBehavior::Inexhaustible); } BOOST_FIXTURE_TEST_CASE(BaseSaveLoad, RandWorldFixture) { MockLocalGameState lgsGame; const std::string luaScript = helpers::format( - "-- Hello World\n function getRequiredLuaVersion()\n return %1%\n end", LuaInterfaceGameBase::GetVersion()); + "-- Hello World\n function getRequiredLuaVersion()\n return %1%\n end", LuaInterfaceGameBase::getVersion()); { MapLoader loader(world); TmpFile validLuaFile(".lua"); @@ -289,25 +289,25 @@ BOOST_FIXTURE_TEST_CASE(BaseSaveLoad, RandWorldFixture) validLuaFile.close(); BOOST_TEST_REQUIRE(loader.LoadLuaScript(*game, lgsGame, validLuaFile.filePath)); - BOOST_TEST(world.HasLua()); + BOOST_TEST(world.hasLua()); } - const MapPoint hqPos = world.GetPlayer(0).GetHQPos(); - auto& hq = ensureNonNull(world.GetSpecObj(hqPos)); - auto& hqFlag = ensureNonNull(hq.GetFlag()); + const MapPoint hqPos = world.getPlayer(0).getHQPos(); + auto& hq = ensureNonNull(world.getSpecObj(hqPos)); + auto& hqFlag = ensureNonNull(hq.getFlag()); const MapPoint usualBldPos = world.MakeMapPoint(hqPos + Position(3, 0)); auto* usualBld = static_cast( BuildingFactory::CreateBuilding(world, BuildingType::Bakery, usualBldPos, 0, Nation::Vikings)); world.RecalcBQAroundPointBig(usualBldPos); - world.BuildRoad(0, false, hqFlag.GetPos(), std::vector(3, Direction::East)); + world.BuildRoad(0, false, hqFlag.getPos(), std::vector(3, Direction::East)); usualBld->is_working = true; // Add 3 fires with first between the others to have a mixed event order in the same GF for(const auto& offset : {Position(8, 0), Position(7, 0), Position(9, 0)}) { const auto pt = world.MakeMapPoint(hqPos + offset); - BOOST_TEST_REQUIRE(!world.GetNode(pt).obj); - world.SetNO(pt, new noFire(pt, false)); + BOOST_TEST_REQUIRE(!world.getNode(pt).obj); + world.setNO(pt, new noFire(pt, false)); world.RecalcBQAroundPoint(pt); } @@ -330,7 +330,7 @@ BOOST_FIXTURE_TEST_CASE(BaseSaveLoad, RandWorldFixture) save.AddPlayer(player); save.ggs = ggs; - save.start_gf = em.GetCurrentGF(); + save.start_gf = em.getCurrentGF(); save.sgd.MakeSnapshot(*game); TmpFile tmpFile; @@ -339,32 +339,32 @@ BOOST_FIXTURE_TEST_CASE(BaseSaveLoad, RandWorldFixture) s25util::time64_t saveTime = s25util::Time::CurrentTime(); BOOST_TEST_REQUIRE(save.Save(tmpFile.filePath, "MapTitle")); - BOOST_TEST(save.GetSaveTime() - saveTime <= 20); // 20s difference max - const unsigned origObjNum = GameObject::GetNumObjs(); - const unsigned origObjIdNum = GameObject::GetObjIDCounter(); + BOOST_TEST(save.getSaveTime() - saveTime <= 20); // 20s difference max + const unsigned origObjNum = GameObject::getNumObjs(); + const unsigned origObjIdNum = GameObject::getObjIDCounter(); for(const auto what : {SaveGameDataToLoad::Header, SaveGameDataToLoad::HeaderAndSettings, SaveGameDataToLoad::All}) { Savegame loadSave; BOOST_TEST_REQUIRE(loadSave.Load(tmpFile.filePath, what)); - BOOST_TEST(loadSave.GetSaveTime() == save.GetSaveTime()); - BOOST_TEST(loadSave.GetMapName() == "MapTitle"); - BOOST_TEST(loadSave.GetPlayerNames().size() == 3u); - BOOST_TEST(loadSave.GetPlayerNames()[0] == "Human"); - BOOST_TEST(loadSave.GetPlayerNames()[1] == "PlAI"); - BOOST_TEST(loadSave.GetPlayerNames()[2] == "PlAI2"); - BOOST_TEST(loadSave.start_gf == em.GetCurrentGF()); + BOOST_TEST(loadSave.getSaveTime() == save.getSaveTime()); + BOOST_TEST(loadSave.getMapName() == "MapTitle"); + BOOST_TEST(loadSave.getPlayerNames().size() == 3u); + BOOST_TEST(loadSave.getPlayerNames()[0] == "Human"); + BOOST_TEST(loadSave.getPlayerNames()[1] == "PlAI"); + BOOST_TEST(loadSave.getPlayerNames()[2] == "PlAI2"); + BOOST_TEST(loadSave.start_gf == em.getCurrentGF()); // Players are loaded with the settings if(what == SaveGameDataToLoad::Header) { - BOOST_TEST(loadSave.GetNumPlayers() == 0u); + BOOST_TEST(loadSave.getNumPlayers() == 0u); } else { - BOOST_TEST_REQUIRE(loadSave.GetNumPlayers() == 4u); + BOOST_TEST_REQUIRE(loadSave.getNumPlayers() == 4u); for(unsigned j = 0; j < 4; j++) { - const BasePlayerInfo& loadPlayer = loadSave.GetPlayer(j); - const BasePlayerInfo& worldPlayer = world.GetPlayer(j); + const BasePlayerInfo& loadPlayer = loadSave.getPlayer(j); + const BasePlayerInfo& worldPlayer = world.getPlayer(j); BOOST_TEST(loadPlayer.ps == worldPlayer.ps); if(!loadPlayer.isUsed()) continue; @@ -383,33 +383,33 @@ BOOST_FIXTURE_TEST_CASE(BaseSaveLoad, RandWorldFixture) { std::vector players; for(unsigned j = 0; j < 4; j++) - players.push_back(PlayerInfo(loadSave.GetPlayer(j))); + players.push_back(PlayerInfo(loadSave.getPlayer(j))); Game game(save.ggs, loadSave.start_gf, players); MockLocalGameState localGameState; save.sgd.ReadSnapshot(game, localGameState); game.world_.InitAfterLoad(); const World& newWorld = game.world_; - auto& newEm = static_cast(game.world_.GetEvMgr()); - - BOOST_TEST(newWorld.GetSize() == world.GetSize()); - BOOST_TEST(newEm.GetCurrentGF() == em.GetCurrentGF()); - BOOST_TEST(GameObject::GetNumObjs() == origObjNum); - BOOST_TEST(GameObject::GetObjIDCounter() == origObjIdNum); - std::vector worldEvs = em.GetEvents(); - std::vector loadEvs = newEm.GetEvents(); + auto& newEm = static_cast(game.world_.getEvMgr()); + + BOOST_TEST(newWorld.getSize() == world.getSize()); + BOOST_TEST(newEm.getCurrentGF() == em.getCurrentGF()); + BOOST_TEST(GameObject::getNumObjs() == origObjNum); + BOOST_TEST(GameObject::getObjIDCounter() == origObjIdNum); + std::vector worldEvs = em.getEvents(); + std::vector loadEvs = newEm.getEvents(); BOOST_TEST(worldEvs.size() == loadEvs.size()); for(unsigned j = 0; j < worldEvs.size(); ++j) { - BOOST_TEST(worldEvs[j]->GetInstanceId() == loadEvs[j]->GetInstanceId()); + BOOST_TEST(worldEvs[j]->getInstanceId() == loadEvs[j]->getInstanceId()); BOOST_TEST(worldEvs[j]->startGF == loadEvs[j]->startGF); BOOST_TEST(worldEvs[j]->length == loadEvs[j]->length); BOOST_TEST(worldEvs[j]->id == loadEvs[j]->id); } - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) BOOST_TEST_CONTEXT("Point " << pt) { - const MapNode& worldNode = world.GetNode(pt); - const MapNode& loadNode = newWorld.GetNode(pt); + const MapNode& worldNode = world.getNode(pt); + const MapNode& loadNode = newWorld.getNode(pt); BOOST_TEST(loadNode.roads == worldNode.roads, boost::test_tools::per_element()); BOOST_TEST(loadNode.altitude == worldNode.altitude); BOOST_TEST(loadNode.shadow == worldNode.shadow); @@ -423,20 +423,20 @@ BOOST_FIXTURE_TEST_CASE(BaseSaveLoad, RandWorldFixture) BOOST_TEST(loadNode.harborId == worldNode.harborId); BOOST_TEST((loadNode.obj != nullptr) == (worldNode.obj != nullptr)); } - const auto* newUsual = newWorld.GetSpecObj(usualBldPos); + const auto* newUsual = newWorld.getSpecObj(usualBldPos); BOOST_TEST_REQUIRE(newUsual); BOOST_TEST(newUsual->is_working == usualBld->is_working); - BOOST_TEST(newUsual->HasWorker() == usualBld->HasWorker()); - BOOST_TEST(newUsual->GetProductivity() == usualBld->GetProductivity()); + BOOST_TEST(newUsual->hasWorker() == usualBld->hasWorker()); + BOOST_TEST(newUsual->getProductivity() == usualBld->getProductivity()); - auto* hqLoaded = world.GetSpecObj(hqPos); + auto* hqLoaded = world.getSpecObj(hqPos); BOOST_TEST_REQUIRE(hqLoaded); - auto* hqFlagLoaded = hqLoaded->GetFlag(); + auto* hqFlagLoaded = hqLoaded->getFlag(); BOOST_TEST_REQUIRE(hqFlagLoaded); - BOOST_TEST(hqFlagLoaded->GetNumWares() == 1u); + BOOST_TEST(hqFlagLoaded->getNumWares() == 1u); - BOOST_TEST_REQUIRE(world.HasLua()); - BOOST_TEST(world.GetLua().getScript() == luaScript); + BOOST_TEST_REQUIRE(world.hasLua()); + BOOST_TEST(world.getLua().getScript() == luaScript); SerializedGameData loadedSgd; loadedSgd.MakeSnapshot(game); @@ -487,18 +487,18 @@ BOOST_FIXTURE_TEST_CASE(EmptyReplayRecordingIsRemoved, ReplayMapFixture) bfs::remove(tmpFile.filePath); BOOST_TEST_REQUIRE(replay.StartRecording(tmpFile.filePath, map, 42)); - BOOST_TEST_REQUIRE(replay.IsRecording()); - BOOST_TEST(replay.GetLastGF() == 0u); + BOOST_TEST_REQUIRE(replay.isRecording()); + BOOST_TEST(replay.getLastGF() == 0u); BOOST_TEST_REQUIRE(replay.StopRecording()); - BOOST_TEST_REQUIRE(!replay.IsRecording()); + BOOST_TEST_REQUIRE(!replay.isRecording()); BOOST_TEST(!bfs::exists(tmpFile.filePath)); } BOOST_FIXTURE_TEST_CASE(ReplayWithMap, ReplayMapFixture) { Replay replay; - BOOST_TEST_REQUIRE(!replay.IsRecording()); - BOOST_TEST_REQUIRE(!replay.IsReplaying()); + BOOST_TEST_REQUIRE(!replay.isRecording()); + BOOST_TEST_REQUIRE(!replay.isReplaying()); for(const BasePlayerInfo& player : players) replay.AddPlayer(player); replay.ggs.speed = GameSpeed::VeryFast; @@ -508,48 +508,48 @@ BOOST_FIXTURE_TEST_CASE(ReplayWithMap, ReplayMapFixture) tmpFile.close(); // No overwrite BOOST_TEST_REQUIRE(!replay.StartRecording(tmpFile.filePath, map, 815)); - BOOST_TEST_REQUIRE(!replay.IsRecording()); - BOOST_TEST(!replay.IsReplaying()); + BOOST_TEST_REQUIRE(!replay.isRecording()); + BOOST_TEST(!replay.isReplaying()); bfs::remove(tmpFile.filePath); s25util::time64_t saveTime = s25util::Time::CurrentTime(); BOOST_TEST_REQUIRE(replay.StartRecording(tmpFile.filePath, map, 42)); - BOOST_TEST(replay.GetSaveTime() - saveTime <= 20); // 20s difference max - BOOST_TEST_REQUIRE(replay.IsRecording()); - BOOST_TEST(!replay.IsReplaying()); + BOOST_TEST(replay.getSaveTime() - saveTime <= 20); // 20s difference max + BOOST_TEST_REQUIRE(replay.isRecording()); + BOOST_TEST(!replay.isReplaying()); GlobalGameSettings ggs = replay.ggs; Game game(ggs, 0u, players); PlayerGameCommands cmds = GetTestCommands().create(game).result; AddReplayCmds(replay, cmds); - BOOST_TEST(replay.GetLastGF() == 5u); + BOOST_TEST(replay.getLastGF() == 5u); BOOST_TEST_REQUIRE(replay.StopRecording()); - BOOST_TEST_REQUIRE(!replay.IsRecording()); - BOOST_TEST(!replay.IsReplaying()); + BOOST_TEST_REQUIRE(!replay.isRecording()); + BOOST_TEST(!replay.isReplaying()); for(const bool loadSettings : {false, true}) { Replay loadReplay; BOOST_TEST_REQUIRE(loadReplay.LoadHeader(tmpFile.filePath)); - BOOST_TEST(loadReplay.GetSaveTime() == replay.GetSaveTime()); - BOOST_TEST(loadReplay.GetMapName() == "MapTitle"); - BOOST_TEST_REQUIRE(loadReplay.GetPlayerNames().size() == 3u); - BOOST_TEST(loadReplay.GetPlayerNames()[0] == "Human"); - BOOST_TEST(loadReplay.GetPlayerNames()[1] == "PlAI"); - BOOST_TEST(loadReplay.GetPlayerNames()[2] == "PlAI2"); - BOOST_TEST(loadReplay.GetLastGF() == 5u); + BOOST_TEST(loadReplay.getSaveTime() == replay.getSaveTime()); + BOOST_TEST(loadReplay.getMapName() == "MapTitle"); + BOOST_TEST_REQUIRE(loadReplay.getPlayerNames().size() == 3u); + BOOST_TEST(loadReplay.getPlayerNames()[0] == "Human"); + BOOST_TEST(loadReplay.getPlayerNames()[1] == "PlAI"); + BOOST_TEST(loadReplay.getPlayerNames()[2] == "PlAI2"); + BOOST_TEST(loadReplay.getLastGF() == 5u); if(!loadSettings) { // Not loaded - BOOST_TEST(loadReplay.GetNumPlayers() == 0u); + BOOST_TEST(loadReplay.getNumPlayers() == 0u); continue; } MapInfo newMap; BOOST_TEST_REQUIRE(loadReplay.LoadGameData(newMap)); - BOOST_TEST_REQUIRE(loadReplay.GetNumPlayers() == 4u); + BOOST_TEST_REQUIRE(loadReplay.getNumPlayers() == 4u); for(unsigned j = 0; j < 4; j++) { - const BasePlayerInfo& loadPlayer = loadReplay.GetPlayer(j); + const BasePlayerInfo& loadPlayer = loadReplay.getPlayer(j); const BasePlayerInfo& worldPlayer = players[j]; BOOST_TEST(loadPlayer.ps == worldPlayer.ps); if(!loadPlayer.isUsed()) @@ -593,28 +593,28 @@ BOOST_FIXTURE_TEST_CASE(BrokenReplayWithMap, ReplayMapFixture) replay.ggs.speed = GameSpeed::VeryFast; BOOST_TEST_REQUIRE(replay.StartRecording(tmpFile.filePath, map, randomInit)); - saveTime = replay.GetSaveTime(); - BOOST_TEST_REQUIRE(replay.IsRecording()); + saveTime = replay.getSaveTime(); + BOOST_TEST_REQUIRE(replay.isRecording()); AddReplayCmds(replay, cmds); - BOOST_TEST(replay.GetLastGF() == 5u); + BOOST_TEST(replay.getLastGF() == 5u); // Assume an exception/crash here so Replay is simply destroyed without Close or StopRecording } Replay loadReplay; BOOST_TEST_REQUIRE(loadReplay.LoadHeader(tmpFile.filePath)); - BOOST_TEST(loadReplay.GetSaveTime() == saveTime); - BOOST_TEST(loadReplay.GetMapName() == map.title); - BOOST_TEST(loadReplay.GetPlayerNames().size() == 3u); - BOOST_TEST(loadReplay.GetPlayerNames()[0] == "Human"); - BOOST_TEST(loadReplay.GetPlayerNames()[1] == "PlAI"); - BOOST_TEST(loadReplay.GetPlayerNames()[2] == "PlAI2"); - BOOST_TEST(loadReplay.GetLastGF() == 5u); + BOOST_TEST(loadReplay.getSaveTime() == saveTime); + BOOST_TEST(loadReplay.getMapName() == map.title); + BOOST_TEST(loadReplay.getPlayerNames().size() == 3u); + BOOST_TEST(loadReplay.getPlayerNames()[0] == "Human"); + BOOST_TEST(loadReplay.getPlayerNames()[1] == "PlAI"); + BOOST_TEST(loadReplay.getPlayerNames()[2] == "PlAI2"); + BOOST_TEST(loadReplay.getLastGF() == 5u); MapInfo newMap; BOOST_TEST_REQUIRE(loadReplay.LoadGameData(newMap)); - BOOST_TEST_REQUIRE(loadReplay.GetNumPlayers() == 4u); + BOOST_TEST_REQUIRE(loadReplay.getNumPlayers() == 4u); for(unsigned j = 0; j < 4; j++) { - const BasePlayerInfo& loadPlayer = loadReplay.GetPlayer(j); + const BasePlayerInfo& loadPlayer = loadReplay.getPlayer(j); const BasePlayerInfo& worldPlayer = players[j]; BOOST_TEST_REQUIRE(loadPlayer.ps == worldPlayer.ps); if(loadPlayer.isUsed()) @@ -654,12 +654,12 @@ BOOST_FIXTURE_TEST_CASE(ReplayWithSavegame, RandWorldFixture) players[3].name = "PlAI2"; map.savegame->ggs = ggs; - map.savegame->start_gf = em.GetCurrentGF(); + map.savegame->start_gf = em.getCurrentGF(); map.savegame->sgd.MakeSnapshot(*game); Replay replay; - BOOST_TEST_REQUIRE(!replay.IsRecording()); - BOOST_TEST_REQUIRE(!replay.IsReplaying()); + BOOST_TEST_REQUIRE(!replay.isRecording()); + BOOST_TEST_REQUIRE(!replay.isReplaying()); for(const BasePlayerInfo& player : players) replay.AddPlayer(player); replay.ggs.speed = GameSpeed::VeryFast; @@ -670,40 +670,40 @@ BOOST_FIXTURE_TEST_CASE(ReplayWithSavegame, RandWorldFixture) bfs::remove(tmpFile.filePath); s25util::time64_t saveTime = s25util::Time::CurrentTime(); BOOST_TEST_REQUIRE(replay.StartRecording(tmpFile.filePath, map, 815)); - BOOST_TEST_REQUIRE(replay.GetSaveTime() - saveTime <= 20); // 20s difference max - BOOST_TEST_REQUIRE(replay.IsRecording()); - BOOST_TEST(!replay.IsReplaying()); + BOOST_TEST_REQUIRE(replay.getSaveTime() - saveTime <= 20); // 20s difference max + BOOST_TEST_REQUIRE(replay.isRecording()); + BOOST_TEST(!replay.isReplaying()); PlayerGameCommands cmds = GetTestCommands().create(*game).result; AddReplayCmds(replay, cmds); - BOOST_TEST(replay.GetLastGF() == 5u); + BOOST_TEST(replay.getLastGF() == 5u); BOOST_TEST_REQUIRE(replay.StopRecording()); - BOOST_TEST(!replay.IsRecording()); - BOOST_TEST_REQUIRE(!replay.IsReplaying()); + BOOST_TEST(!replay.isRecording()); + BOOST_TEST_REQUIRE(!replay.isReplaying()); for(const bool loadSettings : {false, true}) { Replay loadReplay; BOOST_TEST_REQUIRE(loadReplay.LoadHeader(tmpFile.filePath)); - BOOST_TEST(loadReplay.GetSaveTime() == replay.GetSaveTime()); - BOOST_TEST(loadReplay.GetMapName() == "MapTitle"); - BOOST_TEST_REQUIRE(loadReplay.GetPlayerNames().size() == 3u); - BOOST_TEST(loadReplay.GetPlayerNames()[0] == "PlAI"); - BOOST_TEST(loadReplay.GetPlayerNames()[1] == "Human"); - BOOST_TEST(loadReplay.GetPlayerNames()[2] == "PlAI2"); - BOOST_TEST(loadReplay.GetLastGF() == 5u); + BOOST_TEST(loadReplay.getSaveTime() == replay.getSaveTime()); + BOOST_TEST(loadReplay.getMapName() == "MapTitle"); + BOOST_TEST_REQUIRE(loadReplay.getPlayerNames().size() == 3u); + BOOST_TEST(loadReplay.getPlayerNames()[0] == "PlAI"); + BOOST_TEST(loadReplay.getPlayerNames()[1] == "Human"); + BOOST_TEST(loadReplay.getPlayerNames()[2] == "PlAI2"); + BOOST_TEST(loadReplay.getLastGF() == 5u); if(!loadSettings) { // Not loaded - BOOST_TEST(loadReplay.GetNumPlayers() == 0u); + BOOST_TEST(loadReplay.getNumPlayers() == 0u); continue; } MapInfo newMap; BOOST_TEST_REQUIRE(loadReplay.LoadGameData(newMap)); - BOOST_TEST_REQUIRE(loadReplay.GetNumPlayers() == 4u); + BOOST_TEST_REQUIRE(loadReplay.getNumPlayers() == 4u); for(unsigned j = 0; j < 4; j++) { - const BasePlayerInfo& loadPlayer = loadReplay.GetPlayer(j); + const BasePlayerInfo& loadPlayer = loadReplay.getPlayer(j); const BasePlayerInfo& worldPlayer = players[j]; BOOST_TEST_REQUIRE(loadPlayer.ps == worldPlayer.ps); if(!loadPlayer.isUsed()) @@ -733,7 +733,7 @@ BOOST_FIXTURE_TEST_CASE(ReplayWithSavegame, RandWorldFixture) BOOST_FIXTURE_TEST_CASE(SerializeHunter, EmptyWorldFixture1P) { SerializedGameData sgd; - const auto hunterPos1 = world.MakeMapPoint(world.GetPlayer(0).GetHQPos() + rttr::test::randomPoint(2, 4)); + const auto hunterPos1 = world.MakeMapPoint(world.getPlayer(0).getHQPos() + rttr::test::randomPoint(2, 4)); const auto hunterPos2 = world.MakeMapPoint(hunterPos1 + Position(2, 0)); { auto* hunterBld1 = static_cast(BuildingFactory::CreateBuilding( @@ -752,13 +752,13 @@ BOOST_FIXTURE_TEST_CASE(SerializeHunter, EmptyWorldFixture1P) em.Clear(); world.Unload(); sgd.ReadSnapshot(*game, lgs); - BOOST_TEST_REQUIRE(world.GetFigures(hunterPos1).size() == 1u); - BOOST_TEST_REQUIRE(world.GetFigures(hunterPos2).size() == 2u); - const auto* deserializedHunter1 = dynamic_cast(&world.GetFigures(hunterPos1).front()); - const auto* deserializedHunter2 = dynamic_cast(&world.GetFigures(hunterPos2).front()); + BOOST_TEST_REQUIRE(world.getFigures(hunterPos1).size() == 1u); + BOOST_TEST_REQUIRE(world.getFigures(hunterPos2).size() == 2u); + const auto* deserializedHunter1 = dynamic_cast(&world.getFigures(hunterPos1).front()); + const auto* deserializedHunter2 = dynamic_cast(&world.getFigures(hunterPos2).front()); BOOST_TEST_REQUIRE(deserializedHunter1); BOOST_TEST_REQUIRE(deserializedHunter2); - BOOST_TEST(deserializedHunter1->GetState() != deserializedHunter2->GetState()); + BOOST_TEST(deserializedHunter1->getState() != deserializedHunter2->getState()); // Serialize again and compare data SerializedGameData sgd2; diff --git a/tests/s25Main/integration/testTerritoryRegion.cpp b/tests/s25Main/integration/testTerritoryRegion.cpp index e938c88b44..b81da34417 100644 --- a/tests/s25Main/integration/testTerritoryRegion.cpp +++ b/tests/s25Main/integration/testTerritoryRegion.cpp @@ -23,7 +23,7 @@ BOOST_AUTO_TEST_SUITE(TerritoryRegionTestSuite) -BOOST_AUTO_TEST_CASE(IsPointValid) +BOOST_AUTO_TEST_CASE(isPointValid) { // Max tested point is (20, 20) -> size > 20 const MapExtent worldSize(24, 22); @@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE(IsPointValid) { // Result for this particular point bool result = helpers::contains(results, pt); - BOOST_TEST_REQUIRE(TerritoryRegion::IsPointValid(worldSize, i, pt) == result); + BOOST_TEST_REQUIRE(TerritoryRegion::isPointValid(worldSize, i, pt) == result); } } @@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE(IsPointValid) pt.x += y - 10; else if(y >= 13) pt.x += 15 - y; - BOOST_TEST_REQUIRE(TerritoryRegion::IsPointValid(worldSize, rectAreas[i], pt)); + BOOST_TEST_REQUIRE(TerritoryRegion::isPointValid(worldSize, rectAreas[i], pt)); if(i == 0) results.insert(pt); } @@ -158,17 +158,17 @@ BOOST_AUTO_TEST_CASE(IsPointValid) // Those must be outside for(MapPoint pt : outsidePts) { - BOOST_TEST_REQUIRE(!TerritoryRegion::IsPointValid(worldSize, rectArea, pt)); + BOOST_TEST_REQUIRE(!TerritoryRegion::isPointValid(worldSize, rectArea, pt)); } } // Border points are unspecified, but must be consistently either inside or outside for(MapPoint pt : borderPts) { - const bool isValid = TerritoryRegion::IsPointValid(worldSize, rectAreas[0], pt); + const bool isValid = TerritoryRegion::isPointValid(worldSize, rectAreas[0], pt); if(isValid) results.insert(pt); for(unsigned i = 1; i < rectAreas.size(); i++) - BOOST_TEST_REQUIRE(TerritoryRegion::IsPointValid(worldSize, rectAreas[i], pt) == isValid); + BOOST_TEST_REQUIRE(TerritoryRegion::isPointValid(worldSize, rectAreas[i], pt) == isValid); } // Note the usage of width and height to include the border points @@ -198,7 +198,7 @@ BOOST_AUTO_TEST_CASE(IsPointValid) // If the point is in the set, it is in the small rect and should not be in the big rect with this as a // hole const bool result = !helpers::contains(results, pt); - const bool isValid = TerritoryRegion::IsPointValid(worldSize, fullArea, pt); + const bool isValid = TerritoryRegion::isPointValid(worldSize, fullArea, pt); BOOST_TEST_INFO(" at " << pt); BOOST_TEST_REQUIRE(isValid == result); } @@ -211,13 +211,13 @@ using WorldFixtureEmpty2P = WorldFixture; BOOST_FIXTURE_TEST_CASE(CreateTerritoryRegion, WorldFixtureEmpty2P) { std::array milBldPos; - milBldPos[0] = world.MakeMapPoint(world.GetPlayer(0).GetHQPos() + Position(2, 0)); + milBldPos[0] = world.MakeMapPoint(world.getPlayer(0).getHQPos() + Position(2, 0)); milBldPos[1] = world.MakeMapPoint(milBldPos[0] + Position(5, 4)); milBldPos[2] = world.MakeMapPoint(milBldPos[0] + Position(5, -4)); // Distance to HQ must be less than distance to other blds or they will be destroyed on capture - BOOST_TEST_REQUIRE(world.CalcDistance(milBldPos[0], world.GetPlayer(0).GetHQPos()) + 1 + BOOST_TEST_REQUIRE(world.CalcDistance(milBldPos[0], world.getPlayer(0).getHQPos()) + 1 < world.CalcDistance(milBldPos[0], milBldPos[1])); - BOOST_TEST_REQUIRE(world.CalcDistance(milBldPos[0], world.GetPlayer(0).GetHQPos()) + 1 + BOOST_TEST_REQUIRE(world.CalcDistance(milBldPos[0], world.getPlayer(0).getHQPos()) + 1 < world.CalcDistance(milBldPos[0], milBldPos[2])); // Create them in different orders. 3 blds -> 6 orders for(unsigned i = 0; i < 6; i++) @@ -249,63 +249,63 @@ BOOST_FIXTURE_TEST_CASE(CreateTerritoryRegion, WorldFixtureEmpty2P) // bld 0 last as it would destroy others for(int j = 2; j >= 0; --j) { - milBlds[j] = world.GetSpecObj(milBldPos[j]); - MapPoint flagPt = milBlds[j]->GetFlagPos(); - auto sld = std::make_unique(flagPt, milBlds[j]->GetPlayer(), milBlds[j], + milBlds[j] = world.getSpecObj(milBldPos[j]); + MapPoint flagPt = milBlds[j]->getFlagPos(); + auto sld = std::make_unique(flagPt, milBlds[j]->getPlayer(), milBlds[j], static_cast(milBlds[j]), 0); world.AddFigure(flagPt, std::move(sld)).ActAtFirst(); } - milBlds[3] = world.GetSpecObj(world.GetPlayer(0).GetHQPos()); - milBlds[4] = world.GetSpecObj(world.GetPlayer(1).GetHQPos()); + milBlds[3] = world.getSpecObj(world.getPlayer(0).getHQPos()); + milBlds[4] = world.getSpecObj(world.getPlayer(1).getHQPos()); RTTR_SKIP_GFS(30); - TerritoryRegion region(Position(0, 0), Extent(world.GetSize()), world); + TerritoryRegion region(Position(0, 0), Extent(world.getSize()), world); sortedMilitaryBlds buildings = world.LookForMilitaryBuildings(MapPoint(0, 0), 99); BOOST_TEST_REQUIRE(buildings.size() == 5u); for(const nobBaseMilitary* bld : buildings) region.CalcTerritoryOfBuilding(*bld); // Check that TerritoryRegion assigned owners as expected - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { uint8_t owner = 0; unsigned bestDist = 1000; unsigned bestID = 0; for(const nobBaseMilitary* bld : milBlds) { - unsigned distance = world.CalcDistance(pt, bld->GetPos()); + unsigned distance = world.CalcDistance(pt, bld->getPos()); // The closest bld gets the point. If 2 players are tied, the younger bld gets it - if(distance > bestDist || distance > bld->GetMilitaryRadius()) + if(distance > bestDist || distance > bld->getMilitaryRadius()) continue; - if(distance < bestDist || bld->GetObjId() > bestID) + if(distance < bestDist || bld->getObjId() > bestID) { - owner = bld->GetPlayer() + 1; + owner = bld->getPlayer() + 1; bestDist = distance; - bestID = bld->GetObjId(); + bestID = bld->getObjId(); } } BOOST_TEST_INFO(pt << " iteration " << i); - BOOST_TEST_REQUIRE(region.GetOwner(Position(pt)) == owner); + BOOST_TEST_REQUIRE(region.getOwner(Position(pt)) == owner); } // Check that all world points that should have an owner do have one - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - uint8_t owner = region.GetOwner(Position(pt)); + uint8_t owner = region.getOwner(Position(pt)); BOOST_TEST_INFO(pt << " iteration " << i); if(!owner) - BOOST_TEST_REQUIRE(world.GetNode(pt).owner == 0u); + BOOST_TEST_REQUIRE(world.getNode(pt).owner == 0u); else - BOOST_TEST_REQUIRE(world.GetNode(pt).owner != 0u); + BOOST_TEST_REQUIRE(world.getNode(pt).owner != 0u); } for(const MapPoint pt : milBldPos) { world.DestroyNO(pt); world.DestroyNO(pt); // Destroy fire // Pause figure - for(const noBase& sld : world.GetFigures(pt)) + for(const noBase& sld : world.getFigures(pt)) { - std::vector evts = em.GetObjEvents(sld); + std::vector evts = em.getObjEvents(sld); for(const GameEvent* ev : evts) - em.RescheduleEvent(ev, em.GetCurrentGF() + 10000); + em.RescheduleEvent(ev, em.getCurrentGF() + 10000); } } } @@ -315,14 +315,14 @@ BOOST_FIXTURE_TEST_CASE(CreateTerritoryRegionForHQs, WorldFixtureEmpty2P) { // All points should belong to the HQ closest with and without improved alliances - const MapPoint hq0Pos = world.GetPlayer(0).GetHQPos(); - const MapPoint hq1Pos = world.GetPlayer(1).GetHQPos(); + const MapPoint hq0Pos = world.getPlayer(0).getHQPos(); + const MapPoint hq1Pos = world.getPlayer(1).getHQPos(); auto distance = hq1Pos.x - hq0Pos.x; for(const MapPoint pt : world.GetPointsInRadiusWithCenter(hq0Pos, distance / 2)) - BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.GetNode(pt).owner == 1); } + BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.getNode(pt).owner == 1); } for(const MapPoint pt : world.GetPointsInRadiusWithCenter(hq1Pos, distance / 2)) - BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.GetNode(pt).owner == 2); } + BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.getNode(pt).owner == 2); } // Remove HQ 1 and its fire to place it closer to HQ 0 world.DestroyNO(hq1Pos); @@ -333,22 +333,22 @@ BOOST_FIXTURE_TEST_CASE(CreateTerritoryRegionForHQs, WorldFixtureEmpty2P) const MapPoint newHq1Pos = hq0Pos + MapPoint(distance, 0); BuildingFactory::CreateBuilding(world, BuildingType::Headquarters, newHq1Pos, 1, Nation::Africans); for(const MapPoint pt : world.GetPointsInRadiusWithCenter(hq0Pos, distance / 2)) - BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.GetNode(pt).owner == 1); } + BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.getNode(pt).owner == 1); } for(const MapPoint pt : world.GetPointsInRadiusWithCenter(newHq1Pos, distance / 2)) - BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.GetNode(pt).owner == 2); } + BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.getNode(pt).owner == 2); } } // HQ radius = 9 BOOST_FIXTURE_TEST_CASE(CreateTerritoryRegionForDestroyedHQ, WorldFixtureEmpty2P) { - const MapPoint hq0Pos = world.GetPlayer(0).GetHQPos(); - const MapPoint hq1Pos = world.GetPlayer(1).GetHQPos(); + const MapPoint hq0Pos = world.getPlayer(0).getHQPos(); + const MapPoint hq1Pos = world.getPlayer(1).getHQPos(); auto distance = hq1Pos.x - hq0Pos.x; for(const MapPoint pt : world.GetPointsInRadiusWithCenter(hq0Pos, distance / 2)) - BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.GetNode(pt).owner == 1); } + BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.getNode(pt).owner == 1); } for(const MapPoint pt : world.GetPointsInRadiusWithCenter(hq1Pos, distance / 2)) - BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.GetNode(pt).owner == 2); } + BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.getNode(pt).owner == 2); } this->ggs.setSelection(AddonId::NO_ALLIED_PUSH, true); @@ -357,10 +357,10 @@ BOOST_FIXTURE_TEST_CASE(CreateTerritoryRegionForDestroyedHQ, WorldFixtureEmpty2P world.DestroyNO(hq1Pos); auto hq0Region = world.GetPointsInRadiusWithCenter(hq0Pos, 9); - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { auto owner = std::find(std::begin(hq0Region), std::end(hq0Region), pt) != std::end(hq0Region) ? 1 : 0; - BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.GetNode(pt).owner == owner); } + BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.getNode(pt).owner == owner); } } } diff --git a/tests/s25Main/integration/testTrading.cpp b/tests/s25Main/integration/testTrading.cpp index a500cbd608..9b84e761ea 100644 --- a/tests/s25Main/integration/testTrading.cpp +++ b/tests/s25Main/integration/testTrading.cpp @@ -26,25 +26,25 @@ struct TradeFixture : public WorldWithGCExecution3P { curPlayer = 1; addStartResources(); - world.GetPlayer(0).team = Team::Team1; //-V525 - world.GetPlayer(1).team = Team::Team1; - world.GetPlayer(2).team = Team::Team2; - for(unsigned i = 0; i < world.GetNumPlayers(); i++) + world.getPlayer(0).team = Team::Team1; //-V525 + world.getPlayer(1).team = Team::Team1; + world.getPlayer(2).team = Team::Team2; + for(unsigned i = 0; i < world.getNumPlayers(); i++) { - world.GetPlayer(i).MakeStartPacts(); - players[i] = &world.GetPlayer(i); + world.getPlayer(i).MakeStartPacts(); + players[i] = &world.getPlayer(i); } - BOOST_TEST_REQUIRE(players[1]->IsAlly(0)); - BOOST_TEST_REQUIRE(!players[1]->IsAlly(2)); - curWh = world.GetSpecObj(players[1]->GetHQPos()); + BOOST_TEST_REQUIRE(players[1]->isAlly(0)); + BOOST_TEST_REQUIRE(!players[1]->isAlly(2)); + curWh = world.getSpecObj(players[1]->getHQPos()); BOOST_TEST_REQUIRE(curWh); // Get start count and check that we have some - numHelpers = curWh->GetNumRealFigures(Job::Helper); - numWoodcutters = curWh->GetNumRealFigures(Job::Woodcutter); - numDonkeys = curWh->GetNumRealFigures(Job::PackDonkey); - numBoards = curWh->GetNumRealWares(GoodType::Boards); - numSaws = curWh->GetNumRealWares(GoodType::Saw); - numSwords = curWh->GetNumRealWares(GoodType::Sword); + numHelpers = curWh->getNumRealFigures(Job::Helper); + numWoodcutters = curWh->getNumRealFigures(Job::Woodcutter); + numDonkeys = curWh->getNumRealFigures(Job::PackDonkey); + numBoards = curWh->getNumRealWares(GoodType::Boards); + numSaws = curWh->getNumRealWares(GoodType::Saw); + numSwords = curWh->getNumRealWares(GoodType::Sword); BOOST_TEST_REQUIRE(numHelpers > 10u); BOOST_TEST_REQUIRE(numDonkeys > 5u); BOOST_TEST_REQUIRE(numBoards > 10u); @@ -58,28 +58,28 @@ struct TradeFixture : public WorldWithGCExecution3P void testExpectedWares() const { - BOOST_TEST_REQUIRE(curWh->GetNumRealFigures(Job::Helper) == numHelpers); - BOOST_TEST_REQUIRE(curWh->GetNumRealFigures(Job::Woodcutter) == numWoodcutters); - BOOST_TEST_REQUIRE(curWh->GetNumRealFigures(Job::PackDonkey) == numDonkeys); - BOOST_TEST_REQUIRE(curWh->GetNumRealWares(GoodType::Boards) == numBoards); - BOOST_TEST_REQUIRE(curWh->GetNumRealWares(GoodType::Saw) == numSaws); + BOOST_TEST_REQUIRE(curWh->getNumRealFigures(Job::Helper) == numHelpers); + BOOST_TEST_REQUIRE(curWh->getNumRealFigures(Job::Woodcutter) == numWoodcutters); + BOOST_TEST_REQUIRE(curWh->getNumRealFigures(Job::PackDonkey) == numDonkeys); + BOOST_TEST_REQUIRE(curWh->getNumRealWares(GoodType::Boards) == numBoards); + BOOST_TEST_REQUIRE(curWh->getNumRealWares(GoodType::Saw) == numSaws); } void testAfterLeaving(unsigned numTradeItems) { // Run enough GFs so all trade caravans are out (~numTradeItems + 1 people need to leave taking 30GFs max each) - RTTR_EXEC_TILL(30 * (numTradeItems + 1), curWh->GetLeavingFigures().empty()); + RTTR_EXEC_TILL(30 * (numTradeItems + 1), curWh->getLeavingFigures().empty()); // Real count should not be changed // But helpers can be produced in the meantime - BOOST_TEST_REQUIRE(curWh->GetNumRealFigures(Job::Helper) >= numHelpers); - numHelpers = curWh->GetNumRealFigures(Job::Helper); + BOOST_TEST_REQUIRE(curWh->getNumRealFigures(Job::Helper) >= numHelpers); + numHelpers = curWh->getNumRealFigures(Job::Helper); testExpectedWares(); // Visual count should match real count - BOOST_TEST_REQUIRE(curWh->GetNumVisualFigures(Job::Helper) == numHelpers); - BOOST_TEST_REQUIRE(curWh->GetNumVisualFigures(Job::Woodcutter) == numWoodcutters); - BOOST_TEST_REQUIRE(curWh->GetNumVisualFigures(Job::PackDonkey) == numDonkeys); - BOOST_TEST_REQUIRE(curWh->GetNumVisualWares(GoodType::Boards) == numBoards); - BOOST_TEST_REQUIRE(curWh->GetNumVisualWares(GoodType::Saw) == numSaws); + BOOST_TEST_REQUIRE(curWh->getNumVisualFigures(Job::Helper) == numHelpers); + BOOST_TEST_REQUIRE(curWh->getNumVisualFigures(Job::Woodcutter) == numWoodcutters); + BOOST_TEST_REQUIRE(curWh->getNumVisualFigures(Job::PackDonkey) == numDonkeys); + BOOST_TEST_REQUIRE(curWh->getNumVisualWares(GoodType::Boards) == numBoards); + BOOST_TEST_REQUIRE(curWh->getNumVisualWares(GoodType::Saw) == numSaws); } }; @@ -89,23 +89,23 @@ BOOST_AUTO_TEST_CASE(TradeWares) { // Disable trading this->ggs.setSelection(AddonId::TRADE, 0); - this->TradeOverLand(players[0]->GetHQPos(), GoodType::Boards, 2); + this->TradeOverLand(players[0]->getHQPos(), GoodType::Boards, 2); testExpectedWares(); // Enable trading this->ggs.setSelection(AddonId::TRADE, 1); // Trade self -> Wrong - this->TradeOverLand(players[1]->GetHQPos(), GoodType::Boards, 2); //-V525 + this->TradeOverLand(players[1]->getHQPos(), GoodType::Boards, 2); //-V525 testExpectedWares(); // Trade enemy -> Wrong - this->TradeOverLand(players[2]->GetHQPos(), GoodType::Boards, 2); + this->TradeOverLand(players[2]->getHQPos(), GoodType::Boards, 2); testExpectedWares(); // Trade nothing -> Wrong - this->TradeOverLand(players[0]->GetHQPos(), GoodType::Boards, 0); + this->TradeOverLand(players[0]->getHQPos(), GoodType::Boards, 0); testExpectedWares(); // Trade ally -> Ok - this->TradeOverLand(players[0]->GetHQPos(), GoodType::Boards, 2); + this->TradeOverLand(players[0]->getHQPos(), GoodType::Boards, 2); // Each donkey carries a ware and we need a leader numBoards -= 2; numDonkeys -= 2; @@ -114,13 +114,13 @@ BOOST_AUTO_TEST_CASE(TradeWares) testAfterLeaving(2); // Let caravan arrive (20GFs per node) - unsigned distance = world.CalcDistance(curWh->GetPos(), players[0]->GetHQPos()) + 2; + unsigned distance = world.CalcDistance(curWh->getPos(), players[0]->getHQPos()) + 2; RTTR_SKIP_GFS(20 * distance); // Some were recruited numHelpers -= numSwords; // And some were produced (at least every 170 GFs) numHelpers += (20 * distance) / 170; - curWh = world.GetSpecObj(players[0]->GetHQPos()); + curWh = world.getSpecObj(players[0]->getHQPos()); BOOST_TEST_REQUIRE(curWh); // Expected amount is our amount + 2 times the stuff send (1 because we did not send anything, and 2 as we received // them) @@ -128,8 +128,8 @@ BOOST_AUTO_TEST_CASE(TradeWares) numDonkeys += 2 * 2; numHelpers += 2 * 1; // helpers can be produced in the meantime - BOOST_TEST_REQUIRE(curWh->GetNumRealFigures(Job::Helper) >= numHelpers); - numHelpers = curWh->GetNumRealFigures(Job::Helper); + BOOST_TEST_REQUIRE(curWh->getNumRealFigures(Job::Helper) >= numHelpers); + numHelpers = curWh->getNumRealFigures(Job::Helper); testExpectedWares(); } @@ -137,39 +137,39 @@ BOOST_AUTO_TEST_CASE(TradeFigures) { // Disable trading this->ggs.setSelection(AddonId::TRADE, 0); - this->TradeOverLand(players[0]->GetHQPos(), Job::Woodcutter, 2); + this->TradeOverLand(players[0]->getHQPos(), Job::Woodcutter, 2); testExpectedWares(); // Enable trading this->ggs.setSelection(AddonId::TRADE, 1); // Trade nothing -> Wrong - this->TradeOverLand(players[0]->GetHQPos(), Job::Woodcutter, 0); + this->TradeOverLand(players[0]->getHQPos(), Job::Woodcutter, 0); testExpectedWares(); // For figures we don't need donkeys - this->TradeOverLand(players[0]->GetHQPos(), Job::Woodcutter, 2); + this->TradeOverLand(players[0]->getHQPos(), Job::Woodcutter, 2); numWoodcutters -= 2; numHelpers -= 1; testExpectedWares(); testAfterLeaving(2); // Let caravan arrive (20GFs per node) - unsigned distance = world.CalcDistance(curWh->GetPos(), players[0]->GetHQPos()) + 2; + unsigned distance = world.CalcDistance(curWh->getPos(), players[0]->getHQPos()) + 2; RTTR_SKIP_GFS(20 * distance); // Some were recruited numHelpers -= numSwords; // And some were produced (at least every 170 GFs) numHelpers += (20 * distance) / 170; - curWh = world.GetSpecObj(players[0]->GetHQPos()); + curWh = world.getSpecObj(players[0]->getHQPos()); BOOST_TEST_REQUIRE(curWh); // Expected amount is our amount + 2 times the stuff send (1 because we did not send anything, and 2 as we received // them) numWoodcutters += 2 * 2; numHelpers += 2 * 1; // helpers can be produced in the meantime - BOOST_TEST_REQUIRE(curWh->GetNumRealFigures(Job::Helper) >= numHelpers); - numHelpers = curWh->GetNumRealFigures(Job::Helper); + BOOST_TEST_REQUIRE(curWh->getNumRealFigures(Job::Helper) >= numHelpers); + numHelpers = curWh->getNumRealFigures(Job::Helper); testExpectedWares(); } @@ -177,7 +177,7 @@ BOOST_AUTO_TEST_CASE(TradeToMuch) { // Trade more wares than available (not limited by donkeys) BOOST_TEST_REQUIRE(numSaws < numDonkeys); - this->TradeOverLand(players[0]->GetHQPos(), GoodType::Saw, numSaws * 2); + this->TradeOverLand(players[0]->getHQPos(), GoodType::Saw, numSaws * 2); numDonkeys -= numSaws; numSaws = 0; numHelpers -= 1; @@ -185,14 +185,14 @@ BOOST_AUTO_TEST_CASE(TradeToMuch) // Trade more than donkeys available -> Trade what is possible, limited by donkeys BOOST_TEST_REQUIRE(numBoards > numDonkeys); - this->TradeOverLand(players[0]->GetHQPos(), GoodType::Boards, numBoards); + this->TradeOverLand(players[0]->getHQPos(), GoodType::Boards, numBoards); numBoards -= numDonkeys; numDonkeys = 0; numHelpers -= 1; testExpectedWares(); // Trade to many figures - this->TradeOverLand(players[0]->GetHQPos(), Job::Woodcutter, numWoodcutters * 2); + this->TradeOverLand(players[0]->getHQPos(), Job::Woodcutter, numWoodcutters * 2); numWoodcutters = 0; numHelpers -= 1; testExpectedWares(); @@ -203,35 +203,35 @@ BOOST_AUTO_TEST_CASE(TradeToMuch) BOOST_AUTO_TEST_CASE(TradeLessFiguresThenInStoreHouse) { - auto* const hqPlayer1 = world.GetSpecObj(players[1]->GetHQPos()); + auto* const hqPlayer1 = world.getSpecObj(players[1]->getHQPos()); // Add second warehouse auto* wh1 = static_cast(BuildingFactory::CreateBuilding( - world, BuildingType::Storehouse, players[1]->GetHQPos() + MapPoint(2, 0), 1, Nation::Romans)); - world.BuildRoad(0, false, wh1->GetFlagPos(), {2, Direction::East}); + world, BuildingType::Storehouse, players[1]->getHQPos() + MapPoint(2, 0), 1, Nation::Romans)); + world.BuildRoad(0, false, wh1->getFlagPos(), {2, Direction::East}); PeopleCounts inv; inv[Job::Woodcutter] = 2; inv[Job::Helper] = 1; wh1->AddToInventory(inv, true); - BOOST_TEST_REQUIRE(hqPlayer1->GetNumRealFigures(Job::Woodcutter) == 8); - BOOST_TEST_REQUIRE(wh1->GetNumRealFigures(Job::Woodcutter) == 2); + BOOST_TEST_REQUIRE(hqPlayer1->getNumRealFigures(Job::Woodcutter) == 8); + BOOST_TEST_REQUIRE(wh1->getNumRealFigures(Job::Woodcutter) == 2); // Trade less figures then in nearest warehouse wh1 - this->TradeOverLand(players[0]->GetHQPos(), Job::Woodcutter, 1); + this->TradeOverLand(players[0]->getHQPos(), Job::Woodcutter, 1); // Trade less figures then in nearest warehouse wh1 should use only figures from that WH // Run enough GFs so all trade caravans are out (~numTradeItems + 1 people need to leave taking 30GFs max each) - RTTR_EXEC_TILL(30 * (1 + 1), wh1->GetLeavingFigures().empty() && hqPlayer1->GetLeavingFigures().empty()); + RTTR_EXEC_TILL(30 * (1 + 1), wh1->getLeavingFigures().empty() && hqPlayer1->getLeavingFigures().empty()); - BOOST_TEST_REQUIRE(hqPlayer1->GetNumRealFigures(Job::Woodcutter) == 8); - BOOST_TEST_REQUIRE(wh1->GetNumRealFigures(Job::Woodcutter) == 1); + BOOST_TEST_REQUIRE(hqPlayer1->getNumRealFigures(Job::Woodcutter) == 8); + BOOST_TEST_REQUIRE(wh1->getNumRealFigures(Job::Woodcutter) == 1); } BOOST_AUTO_TEST_CASE(TradeFail) { - this->TradeOverLand(players[0]->GetHQPos(), GoodType::Boards, 2); + this->TradeOverLand(players[0]->getHQPos(), GoodType::Boards, 2); // Each donkey carries a ware and we need a leader numBoards -= 2; numDonkeys -= 2; @@ -243,20 +243,20 @@ BOOST_AUTO_TEST_CASE(TradeFail) RTTR_SKIP_GFS(40); // Start a trade that will fail once they leave the bld - this->TradeOverLand(players[0]->GetHQPos(), Job::Woodcutter, 2); + this->TradeOverLand(players[0]->getHQPos(), Job::Woodcutter, 2); numHelpers -= 1; numWoodcutters -= 2; testExpectedWares(); // Add a ring of enemy owned land so they cannot pass - std::vector pts = world.GetPointsInRadius(curWh->GetPos(), 10); + std::vector pts = world.getPointsInRadius(curWh->getPos(), 10); for(const MapPoint& pt : pts) { - if(world.CalcDistance(pt, curWh->GetPos()) >= 8) - world.SetOwner(pt, 2 + 1); // playerID = 2 -> Owner = +1 + if(world.CalcDistance(pt, curWh->getPos()) >= 8) + world.setOwner(pt, 2 + 1); // playerID = 2 -> Owner = +1 } // New trade fails - this->TradeOverLand(players[0]->GetHQPos(), GoodType::Boards, 2); + this->TradeOverLand(players[0]->getHQPos(), GoodType::Boards, 2); testExpectedWares(); // Let them come in again (walk same way back, assume at most 8 nodes away + same as above) @@ -269,15 +269,15 @@ BOOST_AUTO_TEST_CASE(TradeFail) numHelpers += 1 + 1; numWoodcutters += 2; // helpers can be produced in the meantime - BOOST_TEST_REQUIRE(curWh->GetNumRealFigures(Job::Helper) >= numHelpers); - numHelpers = curWh->GetNumRealFigures(Job::Helper); + BOOST_TEST_REQUIRE(curWh->getNumRealFigures(Job::Helper) >= numHelpers); + numHelpers = curWh->getNumRealFigures(Job::Helper); testExpectedWares(); } BOOST_AUTO_TEST_CASE(TradeFailDie) { - this->TradeOverLand(players[0]->GetHQPos(), GoodType::Boards, 2); - this->TradeOverLand(players[0]->GetHQPos(), Job::Woodcutter, 2); + this->TradeOverLand(players[0]->getHQPos(), GoodType::Boards, 2); + this->TradeOverLand(players[0]->getHQPos(), Job::Woodcutter, 2); // Each donkey carries a ware and we need 2 leaders numBoards -= 2; numDonkeys -= 2; @@ -292,58 +292,58 @@ BOOST_AUTO_TEST_CASE(TradeFailDie) // Now make everything enemy territory (e.g. enemy captured the building) // They will then not find any further route and die // See https://github.com/Return-To-The-Roots/s25client/issues/1336 - RTTR_FOREACH_PT(MapPoint, world.GetSize()) - world.SetOwner(pt, 2 + 1); // playerID = 2 -> Owner = +1 + RTTR_FOREACH_PT(MapPoint, world.getSize()) + world.setOwner(pt, 2 + 1); // playerID = 2 -> Owner = +1 // Let them all die RTTR_SKIP_GFS(50); // Don't care about helpers but check the rest: Still gone - numHelpers = curWh->GetNumRealFigures(Job::Helper); + numHelpers = curWh->getNumRealFigures(Job::Helper); testExpectedWares(); } BOOST_AUTO_TEST_CASE(TradeMessages) { - const PostBox& postbox = world.GetPostMgr().AddPostBox(0); + const PostBox& postbox = world.getPostMgr().AddPostBox(0); - this->TradeOverLand(players[0]->GetHQPos(), Job::Woodcutter, 2); + this->TradeOverLand(players[0]->getHQPos(), Job::Woodcutter, 2); numHelpers -= 1; numWoodcutters -= 2; testAfterLeaving(2); - unsigned distance = world.CalcDistance(curWh->GetPos(), players[0]->GetHQPos()) + 2; + unsigned distance = world.CalcDistance(curWh->getPos(), players[0]->getHQPos()) + 2; RTTR_SKIP_GFS(20 * distance); // warriors are recruited numHelpers -= numSwords; - const PostMsg* post = postbox.GetMsg(0); + const PostMsg* post = postbox.getMsg(0); BOOST_TEST_REQUIRE(post); const auto* msg = dynamic_cast(post); - BOOST_TEST_REQUIRE(msg->GetText().find('2') != std::string::npos); - BOOST_TEST_REQUIRE(msg->GetText().find(_(JOB_NAMES[Job::Woodcutter])) != std::string::npos); - BOOST_TEST_REQUIRE(msg->GetText().find(players[1]->name) != std::string::npos); + BOOST_TEST_REQUIRE(msg->getText().find('2') != std::string::npos); + BOOST_TEST_REQUIRE(msg->getText().find(_(JOB_NAMES[Job::Woodcutter])) != std::string::npos); + BOOST_TEST_REQUIRE(msg->getText().find(players[1]->name) != std::string::npos); - this->TradeOverLand(players[0]->GetHQPos(), GoodType::Boards, 2); + this->TradeOverLand(players[0]->getHQPos(), GoodType::Boards, 2); numHelpers -= 1; numDonkeys -= 2; numBoards -= 2; testAfterLeaving(2); - distance = world.CalcDistance(curWh->GetPos(), players[0]->GetHQPos()) + 2; + distance = world.CalcDistance(curWh->getPos(), players[0]->getHQPos()) + 2; RTTR_SKIP_GFS(20 * distance); - const PostMsg* post2 = postbox.GetMsg(1); + const PostMsg* post2 = postbox.getMsg(1); BOOST_TEST_REQUIRE(post2); const auto* msg2 = dynamic_cast(post2); - BOOST_TEST_REQUIRE(msg2->GetText().find('2') != std::string::npos); - BOOST_TEST_REQUIRE(msg2->GetText().find(_(WARE_NAMES[GoodType::Boards])) != std::string::npos); - BOOST_TEST_REQUIRE(msg2->GetText().find(players[1]->name) != std::string::npos); + BOOST_TEST_REQUIRE(msg2->getText().find('2') != std::string::npos); + BOOST_TEST_REQUIRE(msg2->getText().find(_(WARE_NAMES[GoodType::Boards])) != std::string::npos); + BOOST_TEST_REQUIRE(msg2->getText().find(players[1]->name) != std::string::npos); } -BOOST_AUTO_TEST_CASE(GetWarehousesForTrading) +BOOST_AUTO_TEST_CASE(getWarehousesForTrading) { std::array hqs{}; for(unsigned i = 0; i < players.size(); i++) - hqs[i] = world.GetSpecObj(players[i]->GetHQPos()); + hqs[i] = world.getSpecObj(players[i]->getHQPos()); for(int i = 0; i < 2; i++) { // Run the same test twice @@ -352,7 +352,7 @@ BOOST_AUTO_TEST_CASE(GetWarehousesForTrading) for(unsigned iGoal = 0; iGoal < players.size(); iGoal++) { const std::vector possibleWhs = - players[iStart]->GetWarehousesForTrading(*hqs[iGoal]); + players[iStart]->getWarehousesForTrading(*hqs[iGoal]); if(iStart == iGoal) // Trade to self is not possible BOOST_TEST(possibleWhs.empty()); else if(iStart == 2 || iGoal == 2) // Player 2 has no ally -> no trade @@ -368,7 +368,7 @@ BOOST_AUTO_TEST_CASE(GetWarehousesForTrading) { // Poison the tradepath cache with invalid entries. This is possible if e.g. a route is no longer possible // or a wh was destroyed - TradePathCache& cache = world.GetTradePathCache(); + TradePathCache& cache = world.getTradePathCache(); const unsigned oldCacheSize = cache.size(); // The above should have added 1 entry for the connection of player 1 and 2 whs BOOST_TEST(oldCacheSize == 1u); diff --git a/tests/s25Main/integration/testWorld.cpp b/tests/s25Main/integration/testWorld.cpp index c38e2d784f..78bb7bf77d 100644 --- a/tests/s25Main/integration/testWorld.cpp +++ b/tests/s25Main/integration/testWorld.cpp @@ -74,16 +74,16 @@ BOOST_FIXTURE_TEST_CASE(LoadWorld, WorldFixture) MapLoader loader(world); BOOST_TEST_REQUIRE(loader.Load(fixture.testMapPath)); - BOOST_TEST(world.GetWidth() == map.getHeader().getWidth()); - BOOST_TEST(world.GetHeight() == map.getHeader().getHeight()); + BOOST_TEST(world.getWidth() == map.getHeader().getWidth()); + BOOST_TEST(world.getHeight() == map.getHeader().getHeight()); } BOOST_FIXTURE_TEST_CASE(HeightLoading, WorldLoadedWithS2MapFixture) { using libsiedler2::MapLayer; - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - BOOST_TEST_REQUIRE(world.GetNode(pt).altitude == worldCreator.map.getMapDataAt(MapLayer::Altitude, pt.x, pt.y)); + BOOST_TEST_REQUIRE(world.getNode(pt).altitude == worldCreator.map.getMapDataAt(MapLayer::Altitude, pt.x, pt.y)); } } @@ -107,13 +107,13 @@ BOOST_FIXTURE_TEST_CASE(SameBQasInS2, WorldLoadedWithS2MapFixture) using libsiedler2::MapLayer; // Init BQ world.InitAfterLoad(); - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { BOOST_TEST_INFO("pt " << pt); const auto original = worldCreator.map.getMapDataAt(MapLayer::BuildingQuality, pt.x, pt.y); BOOST_TEST_INFO(" original: " << static_cast(original)); - BuildingQuality bq = world.GetNode(pt).bq; + BuildingQuality bq = world.getNode(pt).bq; BOOST_TEST(bq == convertS2Bq(original)); } } @@ -133,20 +133,20 @@ BOOST_AUTO_TEST_CASE(HQPlacement) BOOST_TEST_REQUIRE(loader.Load(testMapPath)); auto& hqsMap = randStartPos ? hqsShuffledMap : hqsOriginalMap; auto& hqsWorld = randStartPos ? hqsShuffledWorld : hqsOriginalWorld; - hqsWorld.resize(world.GetNumPlayers()); - for(unsigned i = 0; i < world.GetNumPlayers(); i++) + hqsWorld.resize(world.getNumPlayers()); + for(unsigned i = 0; i < world.getNumPlayers(); i++) { BOOST_TEST_INFO_SCOPE("Player: " << i); - GamePlayer& player = world.GetPlayer(i); + GamePlayer& player = world.getPlayer(i); BOOST_TEST_REQUIRE(player.isUsed()); - auto hqPos = loader.GetOriginalHQPos(i); + auto hqPos = loader.getOriginalHQPos(i); BOOST_TEST_REQUIRE(hqPos.isValid()); BOOST_TEST(!helpers::contains(hqsMap, hqPos)); // Unique position hqsMap.push_back(hqPos); - BOOST_TEST(world.GetNO(hqPos)->GetGOT() == GO_Type::NobHq); + BOOST_TEST(world.getNO(hqPos)->getGOT() == GO_Type::NobHq); - hqPos = world.GetPlayer(i).GetHQPos(); + hqPos = world.getPlayer(i).getHQPos(); BOOST_TEST_REQUIRE(hqPos.isValid()); BOOST_TEST(!helpers::contains(hqsWorld, hqPos)); // Unique position hqsWorld[i] = hqPos; @@ -168,14 +168,14 @@ BOOST_AUTO_TEST_CASE(HQPlacement) BOOST_FIXTURE_TEST_CASE(CloseHarborSpots, WorldFixture) { - loadGameData(world.GetDescriptionWriteable()); - const auto tWater = GetWaterTerrain(world.GetDescription()); - const auto tLand = GetLandTerrain(world.GetDescription()); + loadGameData(world.getDescriptionWriteable()); + const auto tWater = GetWaterTerrain(world.getDescription()); + const auto tLand = GetLandTerrain(world.getDescription()); world.Init(MapExtent(30, 30)); - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - MapNode& node = world.GetNodeWriteable(pt); + MapNode& node = world.getNodeWriteable(pt); node.t1 = node.t2 = tWater; } @@ -186,21 +186,21 @@ BOOST_FIXTURE_TEST_CASE(CloseHarborSpots, WorldFixture{}) setRightTerrain(world, curPt, dir, tLand); @@ -209,12 +209,12 @@ BOOST_FIXTURE_TEST_CASE(CloseHarborSpots, WorldFixture waterPts; - waterPts.push_back(world.GetNeighbour2(hbPos[0], 10)); - waterPts.push_back(world.GetNeighbour2(hbPos[0], 8)); - waterPts.push_back(world.GetNeighbour2(hbPos[3], 4)); - waterPts.push_back(world.GetNeighbour2(hbPos[5], 6)); - waterPts.push_back(world.GetNeighbour2(hbPos[7], 10)); - waterPts.push_back(world.GetNeighbour2(hbPos[9], 8)); + waterPts.push_back(world.getNeighbour2(hbPos[0], 10)); + waterPts.push_back(world.getNeighbour2(hbPos[0], 8)); + waterPts.push_back(world.getNeighbour2(hbPos[3], 4)); + waterPts.push_back(world.getNeighbour2(hbPos[5], 6)); + waterPts.push_back(world.getNeighbour2(hbPos[7], 10)); + waterPts.push_back(world.getNeighbour2(hbPos[9], 8)); for(const MapPoint& pt : waterPts) { @@ -225,23 +225,23 @@ BOOST_FIXTURE_TEST_CASE(CloseHarborSpots, WorldFixture(world.GetNumHarborPoints())) + BOOST_TEST_REQUIRE(world.getNumHarborPoints() == hbPos.size()); + for(const auto startHb : helpers::idRange(world.getNumHarborPoints())) { for(const auto dir : helpers::EnumRange{}) { - SeaId seaId = world.GetSeaId(startHb, dir); + SeaId seaId = world.getSeaId(startHb, dir); if(!seaId) continue; - MapPoint startPt = world.GetCoastalPoint(startHb, seaId); - BOOST_TEST_REQUIRE(startPt == world.GetNeighbour(world.GetHarborPoint(startHb), dir)); - for(const auto targetHb : helpers::idRange(world.GetNumHarborPoints())) + MapPoint startPt = world.getCoastalPoint(startHb, seaId); + BOOST_TEST_REQUIRE(startPt == world.getNeighbour(world.getHarborPoint(startHb), dir)); + for(const auto targetHb : helpers::idRange(world.getNumHarborPoints())) { - MapPoint destPt = world.GetCoastalPoint(targetHb, seaId); + MapPoint destPt = world.getCoastalPoint(targetHb, seaId); BOOST_TEST_REQUIRE(destPt.isValid()); std::vector route; BOOST_TEST_REQUIRE((startPt == destPt || world.FindShipPath(startPt, destPt, 10000, &route, nullptr))); - BOOST_TEST_REQUIRE(route.size() == world.GetMinHarborDistance(startHb, targetHb)); + BOOST_TEST_REQUIRE(route.size() == world.getMinHarborDistance(startHb, targetHb)); } } } @@ -249,17 +249,17 @@ BOOST_FIXTURE_TEST_CASE(CloseHarborSpots, WorldFixtureGetGOT() == GO_Type::NobHq); - BOOST_TEST(world.GetGOT(hqPos) == GO_Type::NobHq); - - const MapPoint emptySpot = world.GetNeighbour(hqPos, Direction::SouthWest); - BOOST_TEST(world.GetNode(emptySpot).obj == nullptr); - BOOST_TEST_REQUIRE(world.GetNO(emptySpot)); - BOOST_TEST(world.GetNO(emptySpot)->GetGOT() == GO_Type::Nothing); - BOOST_TEST(world.GetGOT(emptySpot) == GO_Type::Nothing); + const MapPoint hqPos = world.getPlayer(0).getHQPos(); + BOOST_TEST(world.getNode(hqPos).obj != nullptr); + BOOST_TEST_REQUIRE(world.getNO(hqPos)); + BOOST_TEST(world.getNO(hqPos)->getGOT() == GO_Type::NobHq); + BOOST_TEST(world.getGOT(hqPos) == GO_Type::NobHq); + + const MapPoint emptySpot = world.getNeighbour(hqPos, Direction::SouthWest); + BOOST_TEST(world.getNode(emptySpot).obj == nullptr); + BOOST_TEST_REQUIRE(world.getNO(emptySpot)); + BOOST_TEST(world.getNO(emptySpot)->getGOT() == GO_Type::Nothing); + BOOST_TEST(world.getGOT(emptySpot) == GO_Type::Nothing); } BOOST_FIXTURE_TEST_CASE(LoadLua, WorldFixture) @@ -272,70 +272,70 @@ BOOST_FIXTURE_TEST_CASE(LoadLua, WorldFixture) { rttr::test::LogAccessor logAcc; BOOST_TEST_REQUIRE(!loader.LoadLuaScript(*game, lgs, invalidLuaFile.filePath)); - BOOST_TEST(!world.HasLua()); + BOOST_TEST(!world.hasLua()); RTTR_REQUIRE_LOG_CONTAINS("getRequiredLuaVersion()", false); // Should show a warning } TmpFile validLuaFile(".lua"); - validLuaFile.getStream() << "function getRequiredLuaVersion()\n return " << LuaInterfaceGameBase::GetVersion() + validLuaFile.getStream() << "function getRequiredLuaVersion()\n return " << LuaInterfaceGameBase::getVersion() << "\n end"; validLuaFile.close(); BOOST_TEST_REQUIRE(loader.LoadLuaScript(*game, lgs, validLuaFile.filePath)); - BOOST_TEST(world.HasLua()); + BOOST_TEST(world.hasLua()); } BOOST_AUTO_TEST_CASE(GetTerrainReturnsCorrectValues) { using TerrainIdx = DescIdx; TestWorld world(MapExtent(6, 4)); - const auto calcT1 = [&world](MapPoint pt) { return TerrainIdx(world.GetIdx(pt) * 2); }; - const auto calcT2 = [&world](MapPoint pt) { return TerrainIdx(world.GetIdx(pt) * 2 + 1); }; - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + const auto calcT1 = [&world](MapPoint pt) { return TerrainIdx(world.getIdx(pt) * 2); }; + const auto calcT2 = [&world](MapPoint pt) { return TerrainIdx(world.getIdx(pt) * 2 + 1); }; + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - auto& node = world.GetNodeInt(pt); + auto& node = world.getNodeInt(pt); node.t1 = calcT1(pt); node.t2 = calcT2(pt); } { const MapPoint testPt(1, 1); // t1 (idx) is the triangle directly below, t2 (idx+1) on right lower - auto terrain = world.GetTerrain(testPt, Direction::SouthEast); + auto terrain = world.getTerrain(testPt, Direction::SouthEast); BOOST_TEST(terrain.left == calcT2(testPt)); BOOST_TEST(terrain.right == calcT1(testPt)); - terrain = world.GetTerrain(testPt, Direction::West); + terrain = world.getTerrain(testPt, Direction::West); // right lower from previous point BOOST_TEST(terrain.left == calcT2(MapPoint(0, 1))); // below and right lower from upper point BOOST_TEST(terrain.right == calcT1(MapPoint(1, 0))); - terrain = world.GetTerrain(testPt, Direction::NorthEast); + terrain = world.getTerrain(testPt, Direction::NorthEast); BOOST_TEST(terrain.left == calcT2(MapPoint(1, 0))); // below of the point next to it BOOST_TEST(terrain.right == calcT1(MapPoint(2, 0))); } { const MapPoint testPt(5, 3); // Last point -> check borders - auto terrain = world.GetTerrain(testPt, Direction::SouthEast); + auto terrain = world.getTerrain(testPt, Direction::SouthEast); BOOST_TEST(terrain.left == calcT2(testPt)); BOOST_TEST(terrain.right == calcT1(testPt)); - terrain = world.GetTerrain(testPt, Direction::West); + terrain = world.getTerrain(testPt, Direction::West); BOOST_TEST(terrain.left == calcT2(MapPoint(4, 3))); BOOST_TEST(terrain.right == calcT1(MapPoint(5, 2))); - terrain = world.GetTerrain(testPt, Direction::NorthEast); + terrain = world.getTerrain(testPt, Direction::NorthEast); BOOST_TEST(terrain.left == calcT2(MapPoint(5, 2))); BOOST_TEST(terrain.right == calcT1(MapPoint(0, 2))); } // Now assume GetTerrain works and only check for consistency: - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { BOOST_TEST_CONTEXT(pt) { - const auto terrains = world.GetTerrainsAround(pt); + const auto terrains = world.getTerrainsAround(pt); for(const auto dir : helpers::enumRange()) { - const auto terrain = world.GetTerrain(pt, dir); + const auto terrain = world.getTerrain(pt, dir); BOOST_TEST(terrain.left == terrains[dir - 1u]); BOOST_TEST(terrain.right == terrains[dir]); } diff --git a/tests/s25Main/integration/testWorldCreation.cpp b/tests/s25Main/integration/testWorldCreation.cpp index 59d15cba8d..a4bf70f42a 100644 --- a/tests/s25Main/integration/testWorldCreation.cpp +++ b/tests/s25Main/integration/testWorldCreation.cpp @@ -13,23 +13,23 @@ using WorldFixtureEmpty1P = WorldFixture; BOOST_FIXTURE_TEST_CASE(HQPlacement, WorldFixtureEmpty1P) { - GamePlayer& player = world.GetPlayer(0); + GamePlayer& player = world.getPlayer(0); BOOST_TEST_REQUIRE(player.isUsed()); - const MapPoint hqPos = player.GetHQPos(); + const MapPoint hqPos = player.getHQPos(); BOOST_TEST_REQUIRE(hqPos.isValid()); - BOOST_TEST_REQUIRE(world.GetNO(player.GetHQPos())->GetGOT() == GO_Type::NobHq); + BOOST_TEST_REQUIRE(world.getNO(player.getHQPos())->getGOT() == GO_Type::NobHq); // Check ownership of points - std::vector ownerPts = world.GetPointsInRadius(hqPos, HQ_RADIUS); + std::vector ownerPts = world.getPointsInRadius(hqPos, HQ_RADIUS); for(MapPoint pt : ownerPts) { // This should be ensured by `GetPointsInRadius` BOOST_TEST_REQUIRE(world.CalcDistance(pt, hqPos) <= HQ_RADIUS); // We must own this point - BOOST_TEST_REQUIRE(world.GetNode(pt).owner == 1); + BOOST_TEST_REQUIRE(world.getNode(pt).owner == 1); // Points at radius are border nodes, others player territory if(world.CalcDistance(pt, hqPos) == HQ_RADIUS) - BOOST_TEST_REQUIRE(world.IsBorderNode(pt, 1)); + BOOST_TEST_REQUIRE(world.isBorderNode(pt, 1)); else - BOOST_TEST_REQUIRE(world.IsPlayerTerritory(pt)); + BOOST_TEST_REQUIRE(world.isPlayerTerritory(pt)); } } diff --git a/tests/s25Main/integration/testWorldFixtures.cpp b/tests/s25Main/integration/testWorldFixtures.cpp index c39001972c..a8b06833d8 100644 --- a/tests/s25Main/integration/testWorldFixtures.cpp +++ b/tests/s25Main/integration/testWorldFixtures.cpp @@ -12,7 +12,7 @@ struct TestGO : GameObject // LCOV_EXCL_START void Destroy() override final{}; void Serialize(SerializedGameData&) const override final{}; - GO_Type GetGOT() const override final { return GO_Type::Animal; } + GO_Type getGOT() const override final { return GO_Type::Animal; } // LCOV_EXCL_STOP void HandleEvent(unsigned) override final { handled = true; } @@ -24,24 +24,24 @@ using WorldFixtureEmpty = WorldFixture; BOOST_FIXTURE_TEST_CASE(SkipGFs_Works, WorldFixtureEmpty) { // No events -> Nothing to do - BOOST_TEST(em.GetNumActiveEvents() == 0u); + BOOST_TEST(em.getNumActiveEvents() == 0u); RTTR_SKIP_GFS(0); - BOOST_TEST(em.GetCurrentGF() == 0u); + BOOST_TEST(em.getCurrentGF() == 0u); BOOST_TEST(em.ExecuteNextEvent(0) == 0u); - BOOST_TEST(em.GetCurrentGF() == 0u); + BOOST_TEST(em.getCurrentGF() == 0u); RTTR_SKIP_GFS(10); - BOOST_TEST(em.GetCurrentGF() == 10u); + BOOST_TEST(em.getCurrentGF() == 10u); BOOST_TEST(em.ExecuteNextEvent(5) == 0u); BOOST_TEST(em.ExecuteNextEvent(10) == 0u); - BOOST_TEST(em.GetCurrentGF() == 10u); + BOOST_TEST(em.getCurrentGF() == 10u); TestGO go; em.AddEvent(&go, 10); RTTR_SKIP_GFS(5); // No event triggered - BOOST_TEST(em.GetCurrentGF() == 15u); + BOOST_TEST(em.getCurrentGF() == 15u); BOOST_TEST(!go.handled); RTTR_SKIP_GFS(7); // event triggered - BOOST_TEST(em.GetCurrentGF() == 22u); + BOOST_TEST(em.getCurrentGF() == 22u); BOOST_TEST(go.handled); go.handled = false; @@ -49,6 +49,6 @@ BOOST_FIXTURE_TEST_CASE(SkipGFs_Works, WorldFixtureEmpty) unsigned numGF; RTTR_EXEC_TILL_CT_GF(100, go.handled, numGF); - BOOST_TEST(em.GetCurrentGF() == 30u); + BOOST_TEST(em.getCurrentGF() == 30u); BOOST_TEST(numGF == 8u); } diff --git a/tests/s25Main/lua/GameWithLuaAccess.h b/tests/s25Main/lua/GameWithLuaAccess.h index 8f50783a74..61599809e9 100644 --- a/tests/s25Main/lua/GameWithLuaAccess.h +++ b/tests/s25Main/lua/GameWithLuaAccess.h @@ -35,12 +35,12 @@ class GameWithLuaAccess : public Game void executeAICommands() { - AIPlayer* ai = GetAIPlayer(1); + AIPlayer* ai = getAIPlayer(1); std::vector aiGcs = ai->FetchGameCommands(); for(unsigned i = 0; i < 5; i++) { em_->ExecuteNextGF(); - ai->RunGF(em_->GetCurrentGF(), i == 0); + ai->RunGF(em_->getCurrentGF(), i == 0); } for(gc::GameCommandPtr& gc : aiGcs) { @@ -80,8 +80,8 @@ struct LuaTestsFixture : public rttr::test::LogAccessor, public LuaBaseFixture, LuaTestsFixture() : world(game.world_) { - game.SetLua(std::make_unique(game, localGameState)); - setLua(&world.GetLua()); + game.setLua(std::make_unique(game, localGameState)); + setLua(&world.getLua()); } void initWorld() @@ -89,22 +89,22 @@ struct LuaTestsFixture : public rttr::test::LogAccessor, public LuaBaseFixture, // For consistent results initGameRNG(0); - loadGameData(world.GetDescriptionWriteable()); + loadGameData(world.getDescriptionWriteable()); world.Init(MapExtent(24, 32)); hqPositions.push_back(MapPoint(0, 1)); - hqPositions.push_back(MapPoint(world.GetSize() / 2u + hqPositions[0])); + hqPositions.push_back(MapPoint(world.getSize() / 2u + hqPositions[0])); std::vector playerNations; - playerNations.push_back(world.GetPlayer(0).nation); - playerNations.push_back(world.GetPlayer(1).nation); + playerNations.push_back(world.getPlayer(0).nation); + playerNations.push_back(world.getPlayer(1).nation); BOOST_TEST_REQUIRE(MapLoader::PlaceHQs(world, hqPositions, false)); - for(unsigned id = 0; id < world.GetNumPlayers(); id++) + for(unsigned id = 0; id < world.getNumPlayers(); id++) { - GamePlayer& player = world.GetPlayer(id); + GamePlayer& player = world.getPlayer(id); if(!player.isHuman() && player.isUsed()) - game.AddAIPlayer(AIFactory::Create(world.GetPlayer(id).aiInfo, id, world)); + game.AddAIPlayer(AIFactory::Create(world.getPlayer(id).aiInfo, id, world)); } } - GameWorld& GetWorld() override { return world; } + GameWorld& getWorld() override { return world; } }; diff --git a/tests/s25Main/lua/testLua.cpp b/tests/s25Main/lua/testLua.cpp index 944174a12d..5790beb713 100644 --- a/tests/s25Main/lua/testLua.cpp +++ b/tests/s25Main/lua/testLua.cpp @@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(ScriptLoading) { LogAccessor logAcc; std::string script = "assert(true)"; - LuaInterfaceGame& lua = world.GetLua(); + LuaInterfaceGame& lua = world.getLua(); BOOST_TEST_REQUIRE(lua.loadScriptString(script)); BOOST_TEST_REQUIRE(lua.getScript() == script); // Load from file @@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE(BaseFunctions) BOOST_TEST_REQUIRE(getLog() == "Hello World\n"); // No getRequiredLuaVersion - LuaInterfaceGameBase& lua = world.GetLua(); + LuaInterfaceGameBase& lua = world.getLua(); BOOST_TEST_REQUIRE(!lua.CheckScriptVersion()); BOOST_TEST_REQUIRE(getLog() != ""); // Wrong version @@ -99,23 +99,23 @@ BOOST_AUTO_TEST_CASE(BaseFunctions) BOOST_TEST_REQUIRE(!lua.CheckScriptVersion()); BOOST_TEST_REQUIRE(getLog() != ""); executeLua(boost::format("function getRequiredLuaVersion()\n return %1%\n end") - % (LuaInterfaceGameBase::GetVersion() + 1)); + % (LuaInterfaceGameBase::getVersion() + 1)); BOOST_TEST_REQUIRE(!lua.CheckScriptVersion()); BOOST_TEST_REQUIRE(getLog() != ""); // Correct version executeLua(boost::format("function getRequiredLuaVersion()\n return %1%\n end") - % LuaInterfaceGameBase::GetVersion()); + % LuaInterfaceGameBase::getVersion()); BOOST_TEST_REQUIRE(lua.CheckScriptVersion()); - BOOST_TEST(isLuaEqual("rttr:GetFeatureLevel()", s25util::toStringClassic(lua.GetFeatureLevel()))); + BOOST_TEST(isLuaEqual("rttr:GetFeatureLevel()", s25util::toStringClassic(lua.getFeatureLevel()))); - MOCK_EXPECT(localGameState.IsHost).once().returns(true); + MOCK_EXPECT(localGameState.isHost).once().returns(true); BOOST_TEST(isLuaEqual("rttr:IsHost()", "true")); - MOCK_EXPECT(localGameState.IsHost).once().returns(false); + MOCK_EXPECT(localGameState.isHost).once().returns(false); BOOST_TEST(isLuaEqual("rttr:IsHost()", "false")); BOOST_TEST(isLuaEqual("rttr:GetNumPlayers()", "3")); - MOCK_EXPECT(localGameState.GetPlayerId).once().returns(1); + MOCK_EXPECT(localGameState.getPlayerId).once().returns(1); BOOST_TEST(isLuaEqual("rttr:GetLocalPlayerIdx()", "1")); } @@ -166,8 +166,8 @@ BOOST_AUTO_TEST_CASE(GameFunctions) { initWorld(); std::array hqs; - hqs[0] = world.GetSpecObj(world.GetPlayer(0).GetHQPos()); - hqs[1] = world.GetSpecObj(world.GetPlayer(1).GetHQPos()); + hqs[0] = world.getSpecObj(world.getPlayer(0).getHQPos()); + hqs[1] = world.getSpecObj(world.getPlayer(1).getHQPos()); // Add some random resources to HQs for(auto* hq : hqs) @@ -187,24 +187,24 @@ BOOST_AUTO_TEST_CASE(GameFunctions) { for(const auto gd : helpers::enumRange()) { - BOOST_TEST_REQUIRE(hq->GetNumRealWares(gd) == 0u); - BOOST_TEST_REQUIRE(hq->GetNumVisualWares(gd) == 0u); + BOOST_TEST_REQUIRE(hq->getNumRealWares(gd) == 0u); + BOOST_TEST_REQUIRE(hq->getNumVisualWares(gd) == 0u); } for(const auto job : helpers::enumRange()) { - BOOST_TEST_REQUIRE(hq->GetNumRealFigures(job) == 0u); - BOOST_TEST_REQUIRE(hq->GetNumVisualFigures(job) == 0u); + BOOST_TEST_REQUIRE(hq->getNumRealFigures(job) == 0u); + BOOST_TEST_REQUIRE(hq->getNumVisualFigures(job) == 0u); } } for([[maybe_unused]] const auto i : helpers::range(2)) { - BOOST_TEST(isLuaEqual("rttr:GetGF()", s25util::toStringClassic(world.GetEvMgr().GetCurrentGF()))); - world.GetEvMgr().ExecuteNextGF(); + BOOST_TEST(isLuaEqual("rttr:GetGF()", s25util::toStringClassic(world.getEvMgr().getCurrentGF()))); + world.getEvMgr().ExecuteNextGF(); } // Set player id - MOCK_EXPECT(localGameState.GetPlayerId).returns(1); + MOCK_EXPECT(localGameState.getPlayerId).returns(1); // Send to other player MOCK_EXPECT(localGameState.SystemChat).never(); executeLua("rttr:Chat(0, 'Hello World')"); @@ -217,23 +217,23 @@ BOOST_AUTO_TEST_CASE(GameFunctions) executeLua("rttr:Chat(-1, 'Hello All')"); MOCK_VERIFY(localGameState.SystemChat); - world.GetPostMgr().AddPostBox(1); - const PostBox& postBox = *world.GetPostMgr().GetPostBox(1); + world.getPostMgr().AddPostBox(1); + const PostBox& postBox = *world.getPostMgr().getPostBox(1); // Send to other player or invalid executeLua("rttr:PostMessage(0, 'Hello World')"); BOOST_REQUIRE_THROW(executeLua("rttr:PostMessage(-1, 'Hello World')"), LuaExecutionError); BOOST_TEST_REQUIRE(getLog() != ""); - BOOST_TEST_REQUIRE(postBox.GetNumMsgs() == 0u); + BOOST_TEST_REQUIRE(postBox.getNumMsgs() == 0u); // Send to this player executeLua("rttr:PostMessage(1, 'Hello World')"); - BOOST_TEST_REQUIRE(postBox.GetNumMsgs() == 1u); - BOOST_TEST_REQUIRE(postBox.GetMsg(0)->GetText() == "Hello World"); - BOOST_TEST_REQUIRE(!postBox.GetMsg(0)->GetPos().isValid()); + BOOST_TEST_REQUIRE(postBox.getNumMsgs() == 1u); + BOOST_TEST_REQUIRE(postBox.getMsg(0)->getText() == "Hello World"); + BOOST_TEST_REQUIRE(!postBox.getMsg(0)->getPos().isValid()); // Location wraps to real world coordinates executeLua("rttr:PostMessageWithLocation(1, 'Hello Pos', 35, -5)"); - BOOST_TEST_REQUIRE(postBox.GetNumMsgs() == 2u); - BOOST_TEST_REQUIRE(postBox.GetMsg(1)->GetText() == "Hello Pos"); - BOOST_TEST_REQUIRE(postBox.GetMsg(1)->GetPos() == MapPoint(35 - world.GetWidth(), world.GetHeight() - 5)); + BOOST_TEST_REQUIRE(postBox.getNumMsgs() == 2u); + BOOST_TEST_REQUIRE(postBox.getMsg(1)->getText() == "Hello Pos"); + BOOST_TEST_REQUIRE(postBox.getMsg(1)->getPos() == MapPoint(35 - world.getWidth(), world.getHeight() - 5)); executeLua("assert(rttr:GetPlayer(0))"); executeLua("assert(rttr:GetPlayer(1))"); @@ -255,26 +255,26 @@ BOOST_AUTO_TEST_CASE(MissionGoal) { initWorld(); - const PostBox& postBox = world.GetPostMgr().AddPostBox(1); - BOOST_TEST_REQUIRE(postBox.GetCurrentMissionGoal().empty()); //-V807 + const PostBox& postBox = world.getPostMgr().AddPostBox(1); + BOOST_TEST_REQUIRE(postBox.getCurrentMissionGoal().empty()); //-V807 // Set goal for non-existing or other player executeLua("rttr:SetMissionGoal(99, 'Goal')"); - BOOST_TEST_REQUIRE(postBox.GetCurrentMissionGoal().empty()); + BOOST_TEST_REQUIRE(postBox.getCurrentMissionGoal().empty()); executeLua("rttr:SetMissionGoal(0, 'Goal')"); - BOOST_TEST_REQUIRE(postBox.GetCurrentMissionGoal().empty()); + BOOST_TEST_REQUIRE(postBox.getCurrentMissionGoal().empty()); // Set correctly executeLua("rttr:SetMissionGoal(1, 'Goal')"); - BOOST_TEST_REQUIRE(postBox.GetCurrentMissionGoal() == "Goal"); + BOOST_TEST_REQUIRE(postBox.getCurrentMissionGoal() == "Goal"); // Delete current goal executeLua("rttr:SetMissionGoal(1, '')"); - BOOST_TEST_REQUIRE(postBox.GetCurrentMissionGoal().empty()); + BOOST_TEST_REQUIRE(postBox.getCurrentMissionGoal().empty()); // Set and delete with default arg -> clear executeLua("rttr:SetMissionGoal(1, 'Goal')"); executeLua("rttr:SetMissionGoal(1)"); - BOOST_TEST_REQUIRE(postBox.GetCurrentMissionGoal().empty()); + BOOST_TEST_REQUIRE(postBox.getCurrentMissionGoal().empty()); } BOOST_AUTO_TEST_CASE(AccessPlayerProperties) @@ -291,7 +291,7 @@ BOOST_AUTO_TEST_CASE(AccessPlayerProperties) BOOST_TEST(isLuaEqual("player:GetAILevel()", "-1")); executeLua("player = rttr:GetPlayer(1)"); - BasePlayerInfo& player = world.GetPlayer(1); + BasePlayerInfo& player = world.getPlayer(1); BOOST_TEST(isLuaEqual("player:GetName()", "'PlayerAI'")); BOOST_TEST(isLuaEqual("player:GetNation()", "NAT_ROMANS")); BOOST_TEST(isLuaEqual("player:GetTeam()", "TM_TEAM2")); @@ -322,7 +322,7 @@ struct CatchConstructionNote std::unique_ptr note_; Subscription sub; - CatchConstructionNote(GameWorld& world) : sub(world.GetNotifications().subscribe(std::ref(*this))) {} + CatchConstructionNote(GameWorld& world) : sub(world.getNotifications().subscribe(std::ref(*this))) {} void operator()(const BuildingNote& note) { note_ = std::make_unique(note); } }; @@ -332,71 +332,71 @@ BOOST_AUTO_TEST_CASE(IngamePlayer) { initWorld(); - const GamePlayer& player = world.GetPlayer(1); - const nobHQ* hq = world.GetSpecObj(player.GetHQPos()); + const GamePlayer& player = world.getPlayer(1); + const nobHQ* hq = world.getSpecObj(player.getHQPos()); executeLua("player = rttr:GetPlayer(1)\nassert(player)"); - BOOST_TEST_REQUIRE(player.IsBuildingEnabled(BuildingType::Woodcutter)); - BOOST_TEST_REQUIRE(player.IsBuildingEnabled(BuildingType::Fortress)); + BOOST_TEST_REQUIRE(player.isBuildingEnabled(BuildingType::Woodcutter)); + BOOST_TEST_REQUIRE(player.isBuildingEnabled(BuildingType::Fortress)); executeLua("player:DisableBuilding(BLD_WOODCUTTER)\nplayer:DisableBuilding(BLD_FORTRESS)"); - BOOST_TEST_REQUIRE(!player.IsBuildingEnabled(BuildingType::Woodcutter)); - BOOST_TEST_REQUIRE(!player.IsBuildingEnabled(BuildingType::Fortress)); + BOOST_TEST_REQUIRE(!player.isBuildingEnabled(BuildingType::Woodcutter)); + BOOST_TEST_REQUIRE(!player.isBuildingEnabled(BuildingType::Fortress)); - world.GetPostMgr().AddPostBox(1); - const PostBox& postBox = *world.GetPostMgr().GetPostBox(1); + world.getPostMgr().AddPostBox(1); + const PostBox& postBox = *world.getPostMgr().getPostBox(1); // Enable without notification executeLua("player:EnableBuilding(BLD_WOODCUTTER)"); - BOOST_TEST_REQUIRE(player.IsBuildingEnabled(BuildingType::Woodcutter)); - BOOST_TEST_REQUIRE(!player.IsBuildingEnabled(BuildingType::Fortress)); - BOOST_TEST_REQUIRE(postBox.GetNumMsgs() == 0u); + BOOST_TEST_REQUIRE(player.isBuildingEnabled(BuildingType::Woodcutter)); + BOOST_TEST_REQUIRE(!player.isBuildingEnabled(BuildingType::Fortress)); + BOOST_TEST_REQUIRE(postBox.getNumMsgs() == 0u); executeLua("player:DisableBuilding(BLD_WOODCUTTER)\nplayer:EnableBuilding(BLD_WOODCUTTER, false)"); - BOOST_TEST_REQUIRE(player.IsBuildingEnabled(BuildingType::Woodcutter)); - BOOST_TEST_REQUIRE(postBox.GetNumMsgs() == 0u); + BOOST_TEST_REQUIRE(player.isBuildingEnabled(BuildingType::Woodcutter)); + BOOST_TEST_REQUIRE(postBox.getNumMsgs() == 0u); // Enable with notification executeLua("player:EnableBuilding(BLD_WOODCUTTER, true)"); - BOOST_TEST_REQUIRE(player.IsBuildingEnabled(BuildingType::Woodcutter)); - BOOST_TEST_REQUIRE(postBox.GetNumMsgs() == 1u); + BOOST_TEST_REQUIRE(player.isBuildingEnabled(BuildingType::Woodcutter)); + BOOST_TEST_REQUIRE(postBox.getNumMsgs() == 1u); executeLua("player:DisableAllBuildings()"); for(const auto bld : helpers::enumRange()) - BOOST_TEST_REQUIRE(!player.IsBuildingEnabled(bld)); + BOOST_TEST_REQUIRE(!player.isBuildingEnabled(bld)); executeLua("player:EnableAllBuildings()"); for(const auto bld : helpers::enumRange()) - BOOST_TEST_REQUIRE(player.IsBuildingEnabled(bld)); + BOOST_TEST_REQUIRE(player.isBuildingEnabled(bld)); std::array numReserveClaimedBefore, numReserveVisualClaimedBefore; for(unsigned rank = 0; rank < SOLDIER_JOBS.size(); rank++) { - numReserveClaimedBefore[rank] = hq->GetReserveClaimed(rank); - numReserveVisualClaimedBefore[rank] = *hq->GetReserveClaimedVisualPointer(rank); + numReserveClaimedBefore[rank] = hq->getReserveClaimed(rank); + numReserveVisualClaimedBefore[rank] = *hq->getReserveClaimedVisualPointer(rank); } executeLua("player:ClearResources()"); - const Inventory& playerInv = player.GetInventory(); + const Inventory& playerInv = player.getInventory(); for(const GoodType gd : helpers::EnumRange{}) BOOST_TEST_CONTEXT("Good: " << rttr::enum_cast(gd)) { - BOOST_TEST(hq->GetNumRealWares(gd) == 0u); - BOOST_TEST(hq->GetNumVisualWares(gd) == 0u); + BOOST_TEST(hq->getNumRealWares(gd) == 0u); + BOOST_TEST(hq->getNumVisualWares(gd) == 0u); BOOST_TEST(playerInv[gd] == 0u); } for(const Job job : helpers::EnumRange{}) BOOST_TEST_CONTEXT("Job: " << rttr::enum_cast(job)) { - BOOST_TEST(hq->GetNumRealFigures(job) == 0u); - BOOST_TEST(hq->GetNumVisualFigures(job) == 0u); + BOOST_TEST(hq->getNumRealFigures(job) == 0u); + BOOST_TEST(hq->getNumVisualFigures(job) == 0u); BOOST_TEST(playerInv[job] == 0u); } for(unsigned rank = 0; rank < SOLDIER_JOBS.size(); rank++) BOOST_TEST_CONTEXT("Rank: " << rank) { // Claimed is not touched - BOOST_TEST(hq->GetReserveClaimed(rank) == numReserveClaimedBefore[rank]); - BOOST_TEST(*hq->GetReserveClaimedVisualPointer(rank) == numReserveVisualClaimedBefore[rank]); + BOOST_TEST(hq->getReserveClaimed(rank) == numReserveClaimedBefore[rank]); + BOOST_TEST(*hq->getReserveClaimedVisualPointer(rank) == numReserveVisualClaimedBefore[rank]); // But available/used ones are reset - BOOST_TEST(*hq->GetReserveAvailablePointer(rank) == 0u); + BOOST_TEST(*hq->getReserveAvailablePointer(rank) == 0u); } executeLua("wares = {[GD_HAMMER]=8,[GD_AXE]=6,[GD_SAW]=3}\n" @@ -405,25 +405,25 @@ BOOST_AUTO_TEST_CASE(IngamePlayer) BOOST_TEST_REQUIRE(playerInv[GoodType::Hammer] == 8u); BOOST_TEST_REQUIRE(playerInv[GoodType::Axe] == 6u); BOOST_TEST_REQUIRE(playerInv[GoodType::Saw] == 3u); - BOOST_TEST(hq->GetNumRealWares(GoodType::Hammer) == 8u); - BOOST_TEST(hq->GetNumRealWares(GoodType::Axe) == 6u); - BOOST_TEST(hq->GetNumRealWares(GoodType::Saw) == 3u); + BOOST_TEST(hq->getNumRealWares(GoodType::Hammer) == 8u); + BOOST_TEST(hq->getNumRealWares(GoodType::Axe) == 6u); + BOOST_TEST(hq->getNumRealWares(GoodType::Saw) == 3u); executeLua("assert(player:AddPeople(people))"); BOOST_TEST_REQUIRE(playerInv[Job::Helper] == 30u); BOOST_TEST_REQUIRE(playerInv[Job::Woodcutter] == 6u); BOOST_TEST_REQUIRE(playerInv[Job::Fisher] == 0u); BOOST_TEST_REQUIRE(playerInv[Job::Forester] == 2u); - BOOST_TEST(hq->GetNumRealFigures(Job::Helper) == 30u); - BOOST_TEST(hq->GetNumRealFigures(Job::Woodcutter) == 6u); - BOOST_TEST(hq->GetNumRealFigures(Job::Fisher) == 0u); - BOOST_TEST(hq->GetNumRealFigures(Job::Forester) == 2u); + BOOST_TEST(hq->getNumRealFigures(Job::Helper) == 30u); + BOOST_TEST(hq->getNumRealFigures(Job::Woodcutter) == 6u); + BOOST_TEST(hq->getNumRealFigures(Job::Fisher) == 0u); + BOOST_TEST(hq->getNumRealFigures(Job::Forester) == 2u); executeLua("assert(player:AddPeople({[JOB_BOATCARRIER] = 3}))"); // Converted to helper and boat BOOST_TEST_REQUIRE(playerInv[Job::Helper] == 33u); BOOST_TEST_REQUIRE(playerInv[GoodType::Boat] == 3u); - BOOST_TEST(hq->GetNumRealFigures(Job::Helper) == 33u); - BOOST_TEST(hq->GetNumRealWares(GoodType::Boat) == 3u); + BOOST_TEST(hq->getNumRealFigures(Job::Helper) == 33u); + BOOST_TEST(hq->getNumRealWares(GoodType::Boat) == 3u); BOOST_TEST_REQUIRE(getLog() == ""); // Invalid ware/player throws @@ -444,8 +444,8 @@ BOOST_AUTO_TEST_CASE(IngamePlayer) BOOST_TEST(isLuaEqual("player:GetNumBuildings(BLD_HEADQUARTERS)", "1")); BOOST_TEST(isLuaEqual("player:GetNumBuildingSites(BLD_HEADQUARTERS)", "0")); BOOST_TEST(isLuaEqual("player:GetNumBuildingSites(BLD_WOODCUTTER)", "0")); - world.SetNO(hq->GetPos() + MapPoint(4, 0), - new noBuildingSite(BuildingType::Woodcutter, hq->GetPos() + MapPoint(4, 0), 1)); + world.setNO(hq->getPos() + MapPoint(4, 0), + new noBuildingSite(BuildingType::Woodcutter, hq->getPos() + MapPoint(4, 0), 1)); BOOST_TEST(isLuaEqual("player:GetNumBuildings(BLD_WOODCUTTER)", "0")); BOOST_TEST(isLuaEqual("player:GetNumBuildingSites(BLD_WOODCUTTER)", "1")); @@ -472,16 +472,16 @@ BOOST_AUTO_TEST_CASE(IngamePlayer) BOOST_TEST(note.note_->pos == MapPoint(12, 13)); executeLua("player:ModifyHQ(true)"); - BOOST_TEST_REQUIRE(hq->IsTent()); + BOOST_TEST_REQUIRE(hq->isTent()); executeLua("player:ModifyHQ(false)"); - BOOST_TEST_REQUIRE(!hq->IsTent()); + BOOST_TEST_REQUIRE(!hq->isTent()); executeLua("hqX, hqY = player:GetHQPos()"); - BOOST_TEST(isLuaEqual("hqX", s25util::toStringClassic(hq->GetPos().x))); - BOOST_TEST(isLuaEqual("hqY", s25util::toStringClassic(hq->GetPos().y))); + BOOST_TEST(isLuaEqual("hqX", s25util::toStringClassic(hq->getPos().x))); + BOOST_TEST(isLuaEqual("hqY", s25util::toStringClassic(hq->getPos().y))); // Destroy players HQ - world.DestroyNO(hq->GetPos()); + world.DestroyNO(hq->getPos()); // HQ-Pos is invalid executeLua("hqX, hqY = player:GetHQPos()"); BOOST_TEST(isLuaEqual("hqX", s25util::toStringClassic(MapPoint::Invalid().x))); @@ -492,23 +492,23 @@ BOOST_AUTO_TEST_CASE(IngamePlayer) // ModifyHQ does not crash executeLua("player:ModifyHQ(true)"); - const GamePlayer& player0 = world.GetPlayer(0); + const GamePlayer& player0 = world.getPlayer(0); executeLua("player = rttr:GetPlayer(0)"); - MapPoint hqPos = player0.GetHQPos(); + MapPoint hqPos = player0.getHQPos(); BOOST_TEST_REQUIRE(hqPos.isValid()); - BOOST_TEST_REQUIRE(world.GetSpecObj(hqPos)); + BOOST_TEST_REQUIRE(world.getSpecObj(hqPos)); BOOST_TEST_REQUIRE(!player0.IsDefeated()); BOOST_TEST(isLuaEqual("player:IsDefeated()", "false")); executeLua("player:Surrender(false)"); BOOST_TEST_REQUIRE(player0.IsDefeated()); BOOST_TEST(isLuaEqual("player:IsDefeated()", "true")); // HQ should still be there - BOOST_TEST_REQUIRE(player0.GetHQPos().isValid()); - BOOST_TEST_REQUIRE(world.GetSpecObj(hqPos)); + BOOST_TEST_REQUIRE(player0.getHQPos().isValid()); + BOOST_TEST_REQUIRE(world.getSpecObj(hqPos)); // Destroy everything executeLua("player:Surrender(true)"); - BOOST_TEST_REQUIRE(!player0.GetHQPos().isValid()); - BOOST_TEST_REQUIRE(!world.GetSpecObj(hqPos)); + BOOST_TEST_REQUIRE(!player0.getHQPos().isValid()); + BOOST_TEST_REQUIRE(!world.getSpecObj(hqPos)); } BOOST_AUTO_TEST_CASE(RestrictedArea) @@ -516,14 +516,14 @@ BOOST_AUTO_TEST_CASE(RestrictedArea) LogAccessor logAcc; initWorld(); - const GamePlayer& player = world.GetPlayer(1); + const GamePlayer& player = world.getPlayer(1); executeLua("player = rttr:GetPlayer(1)\nassert(player)"); // Just a single polygon executeLua("player:SetRestrictedArea(5,7, 5,12, 15,12)"); std::vector expectedRestrictedArea; expectedRestrictedArea = {MapPoint(5, 7), MapPoint(5, 12), MapPoint(15, 12)}; - BOOST_TEST_REQUIRE(player.GetRestrictedArea() == expectedRestrictedArea, boost::test_tools::per_element()); //-V807 + BOOST_TEST_REQUIRE(player.getRestrictedArea() == expectedRestrictedArea, boost::test_tools::per_element()); //-V807 executeLua("assert(not player:IsInRestrictedArea(1, 2))"); executeLua("assert(not player:IsInRestrictedArea(0, 0))"); executeLua("assert(player:IsInRestrictedArea(6, 8))"); @@ -534,31 +534,31 @@ BOOST_AUTO_TEST_CASE(RestrictedArea) expectedRestrictedArea = {MapPoint(0, 0), MapPoint(1, 1), MapPoint(10, 1), MapPoint(10, 10), MapPoint(1, 10), MapPoint(1, 1), MapPoint(0, 0), MapPoint(5, 5), MapPoint(7, 5), MapPoint(7, 7), MapPoint(5, 5), MapPoint(0, 0)}; - BOOST_TEST_REQUIRE(player.GetRestrictedArea() == expectedRestrictedArea, boost::test_tools::per_element()); + BOOST_TEST_REQUIRE(player.getRestrictedArea() == expectedRestrictedArea, boost::test_tools::per_element()); BOOST_TEST_REQUIRE(getLog() == ""); // Some prefer using nils executeLua("player:SetRestrictedArea(nil,nil, 1,1, 10,1, 10,10, 1,10, 1,1, nil,nil, 5,5, 7,5, 7,7, 5,5, nil,nil)"); - BOOST_TEST_REQUIRE(player.GetRestrictedArea() == expectedRestrictedArea, boost::test_tools::per_element()); + BOOST_TEST_REQUIRE(player.getRestrictedArea() == expectedRestrictedArea, boost::test_tools::per_element()); RTTR_REQUIRE_LOG_CONTAINS("don't need leading nils", false); // New API: Single nil and no double point executeLua("player:SetRestrictedArea(1,1, 10,1, 10,10, 1,10, nil, 5,5, 7,5, 7,7)"); - BOOST_TEST_REQUIRE(player.GetRestrictedArea() == expectedRestrictedArea, boost::test_tools::per_element()); + BOOST_TEST_REQUIRE(player.getRestrictedArea() == expectedRestrictedArea, boost::test_tools::per_element()); // Although you could use nil at the end... executeLua("player:SetRestrictedArea(1,1, 10,1, 10,10, 1,10, nil, 5,5, 7,5, 7,7, nil)"); - BOOST_TEST_REQUIRE(player.GetRestrictedArea() == expectedRestrictedArea, boost::test_tools::per_element()); + BOOST_TEST_REQUIRE(player.getRestrictedArea() == expectedRestrictedArea, boost::test_tools::per_element()); // ...or beginning executeLua("player:SetRestrictedArea(nil,1,1, 10,1, 10,10, 1,10, nil, 5,5, 7,5, 7,7)"); - BOOST_TEST_REQUIRE(player.GetRestrictedArea() == expectedRestrictedArea, boost::test_tools::per_element()); + BOOST_TEST_REQUIRE(player.getRestrictedArea() == expectedRestrictedArea, boost::test_tools::per_element()); RTTR_REQUIRE_LOG_CONTAINS("don't need leading nils", false); // Also for single polygon executeLua("player:SetRestrictedArea(5,7, 5,12, 15,12, nil)"); expectedRestrictedArea = {MapPoint(5, 7), MapPoint(5, 12), MapPoint(15, 12)}; - BOOST_TEST_REQUIRE(player.GetRestrictedArea() == expectedRestrictedArea, boost::test_tools::per_element()); + BOOST_TEST_REQUIRE(player.getRestrictedArea() == expectedRestrictedArea, boost::test_tools::per_element()); executeLua("player:SetRestrictedArea()"); - BOOST_TEST_REQUIRE(player.GetRestrictedArea().size() == 0u); + BOOST_TEST_REQUIRE(player.getRestrictedArea().size() == 0u); // Numbers must be pairs BOOST_REQUIRE_THROW(executeLua("player:SetRestrictedArea(1,2, 3)"), std::runtime_error); @@ -578,67 +578,67 @@ BOOST_AUTO_TEST_CASE(World) executeLua("world = rttr:GetWorld()"); const MapPoint envPt(15, 12); - const MapPoint hqPos(world.GetPlayer(1).GetHQPos()); + const MapPoint hqPos(world.getPlayer(1).getHQPos()); executeLua(boost::format("world:AddEnvObject(%1%, %2%, 500)") % envPt.x % envPt.y); - const noEnvObject* obj = world.GetSpecObj(envPt); + const noEnvObject* obj = world.getSpecObj(envPt); BOOST_TEST_REQUIRE(obj); - BOOST_TEST(obj->GetItemID() == 500u); - BOOST_TEST(obj->GetItemFile() == 0xFFFFu); + BOOST_TEST(obj->getItemID() == 500u); + BOOST_TEST(obj->getItemFile() == 0xFFFFu); // Replace and test wrap around (envPt2==envPt1) - const Position envPt2(envPt.x + world.GetWidth(), envPt.y - world.GetHeight()); + const Position envPt2(envPt.x + world.getWidth(), envPt.y - world.getHeight()); BOOST_TEST_REQUIRE(world.MakeMapPoint(envPt2) == envPt); executeLua(boost::format("world:AddEnvObject(%1%, %2%, 1, 2)") % envPt2.x % envPt2.y); - obj = world.GetSpecObj(envPt); + obj = world.getSpecObj(envPt); BOOST_TEST_REQUIRE(obj); - BOOST_TEST(obj->GetItemID() == 1u); - BOOST_TEST(obj->GetItemFile() == 2u); + BOOST_TEST(obj->getItemID() == 1u); + BOOST_TEST(obj->getItemFile() == 2u); // ID only const MapPoint envPt3(envPt.x + 5, envPt.y); executeLua(boost::format("world:AddStaticObject(%1%, %2%, 501)") % envPt3.x % envPt3.y); - const noStaticObject* obj2 = world.GetSpecObj(envPt3); + const noStaticObject* obj2 = world.getSpecObj(envPt3); BOOST_TEST_REQUIRE(obj2); - BOOST_TEST(obj2->GetGOT() == GO_Type::Staticobject); - BOOST_TEST(obj2->GetItemID() == 501u); - BOOST_TEST(obj2->GetItemFile() == 0xFFFFu); - BOOST_TEST(obj2->GetSize() == 1u); - BOOST_TEST(!obj2->IsAnimated()); + BOOST_TEST(obj2->getGOT() == GO_Type::Staticobject); + BOOST_TEST(obj2->getItemID() == 501u); + BOOST_TEST(obj2->getItemFile() == 0xFFFFu); + BOOST_TEST(obj2->getSize() == 1u); + BOOST_TEST(!obj2->isAnimated()); // ID and File (replace env obj) executeLua(boost::format("world:AddStaticObject(%1%, %2%, 5, 3)") % envPt2.x % envPt2.y); - obj2 = world.GetSpecObj(envPt); + obj2 = world.getSpecObj(envPt); BOOST_TEST_REQUIRE(obj2); - BOOST_TEST(obj2->GetGOT() == GO_Type::Staticobject); - BOOST_TEST(obj2->GetItemID() == 5u); - BOOST_TEST(obj2->GetItemFile() == 3u); - BOOST_TEST(obj2->GetSize() == 1u); - BOOST_TEST(!obj2->IsAnimated()); + BOOST_TEST(obj2->getGOT() == GO_Type::Staticobject); + BOOST_TEST(obj2->getItemID() == 5u); + BOOST_TEST(obj2->getItemFile() == 3u); + BOOST_TEST(obj2->getSize() == 1u); + BOOST_TEST(!obj2->isAnimated()); // ID, File and Size (replace static obj) executeLua(boost::format("world:AddStaticObject(%1%, %2%, 5, 3, 2)") % envPt2.x % envPt2.y); - obj2 = world.GetSpecObj(envPt); + obj2 = world.getSpecObj(envPt); BOOST_TEST_REQUIRE(obj2); - BOOST_TEST(obj2->GetGOT() == GO_Type::Staticobject); - BOOST_TEST(obj2->GetItemID() == 5u); - BOOST_TEST(obj2->GetItemFile() == 3u); - BOOST_TEST(obj2->GetSize() == 2u); - BOOST_TEST(!obj2->IsAnimated()); + BOOST_TEST(obj2->getGOT() == GO_Type::Staticobject); + BOOST_TEST(obj2->getItemID() == 5u); + BOOST_TEST(obj2->getItemFile() == 3u); + BOOST_TEST(obj2->getSize() == 2u); + BOOST_TEST(!obj2->isAnimated()); // check static object isAnimated executeLua(boost::format("world:AddStaticObject(%1%, %2%, 561, 0xFFFF, 2)") % envPt2.x % envPt2.y); - obj2 = world.GetSpecObj(envPt); + obj2 = world.getSpecObj(envPt); BOOST_TEST_REQUIRE(obj2); - BOOST_TEST(obj2->GetGOT() == GO_Type::Staticobject); - BOOST_TEST(obj2->GetItemID() == 561u); - BOOST_TEST(obj2->GetItemFile() == 0xFFFFu); - BOOST_TEST(obj2->GetSize() == 2u); - BOOST_TEST(obj2->IsAnimated()); + BOOST_TEST(obj2->getGOT() == GO_Type::Staticobject); + BOOST_TEST(obj2->getItemID() == 561u); + BOOST_TEST(obj2->getItemFile() == 0xFFFFu); + BOOST_TEST(obj2->getSize() == 2u); + BOOST_TEST(obj2->isAnimated()); // check static object not isAnimated executeLua(boost::format("world:AddStaticObject(%1%, %2%, 560, 0xFFFF, 2)") % envPt2.x % envPt2.y); - obj2 = world.GetSpecObj(envPt); + obj2 = world.getSpecObj(envPt); BOOST_TEST_REQUIRE(obj2); - BOOST_TEST(obj2->GetGOT() == GO_Type::Staticobject); - BOOST_TEST(obj2->GetItemID() == 560u); - BOOST_TEST(obj2->GetItemFile() == 0xFFFFu); - BOOST_TEST(obj2->GetSize() == 2u); - BOOST_TEST(!obj2->IsAnimated()); + BOOST_TEST(obj2->getGOT() == GO_Type::Staticobject); + BOOST_TEST(obj2->getItemID() == 560u); + BOOST_TEST(obj2->getItemFile() == 0xFFFFu); + BOOST_TEST(obj2->getSize() == 2u); + BOOST_TEST(!obj2->isAnimated()); // Invalid Size BOOST_CHECK_THROW(executeLua(boost::format("world:AddStaticObject(%1%, %2%, 5, 3, 3)") % envPt2.x % envPt2.y), @@ -655,35 +655,35 @@ BOOST_AUTO_TEST_CASE(World) // Can't replace buildings executeLua(boost::format("world:AddEnvObject(%1%, %2%, 1, 2)") % hqPos.x % hqPos.y); - BOOST_TEST_REQUIRE(!world.GetSpecObj(hqPos)); + BOOST_TEST_REQUIRE(!world.getSpecObj(hqPos)); executeLua(boost::format("world:AddStaticObject(%1%, %2%, 1, 2)") % hqPos.x % hqPos.y); - BOOST_TEST_REQUIRE(!world.GetSpecObj(hqPos)); + BOOST_TEST_REQUIRE(!world.getSpecObj(hqPos)); // But environment obj can also replace static one executeLua(boost::format("world:AddEnvObject(%1%, %2%, 5, 3)") % envPt2.x % envPt2.y); - obj2 = world.GetSpecObj(envPt); + obj2 = world.getSpecObj(envPt); BOOST_TEST_REQUIRE(obj2); - BOOST_TEST(obj2->GetGOT() == GO_Type::Envobject); + BOOST_TEST(obj2->getGOT() == GO_Type::Envobject); MapPoint animalPos(20, 12); - const auto figs = world.GetFigures(animalPos); + const auto figs = world.getFigures(animalPos); BOOST_TEST_REQUIRE(figs.empty()); executeLua(boost::format("world:AddAnimal(%1%, %2%, SPEC_DEER)") % animalPos.x % animalPos.y); BOOST_TEST_REQUIRE(figs.size() == 1u); const noAnimal* animal = dynamic_cast(&*figs.begin()); BOOST_TEST_REQUIRE(animal); - BOOST_TEST(animal->GetSpecies() == Species::Deer); //-V522 + BOOST_TEST(animal->getSpecies() == Species::Deer); //-V522 executeLua(boost::format("world:AddAnimal(%1%, %2%, SPEC_FOX)") % animalPos.x % animalPos.y); BOOST_TEST_REQUIRE(figs.size() == 2u); animal = dynamic_cast(&*(++figs.begin())); BOOST_TEST_REQUIRE(animal); - BOOST_TEST(animal->GetSpecies() == Species::Fox); + BOOST_TEST(animal->getSpecies() == Species::Fox); } BOOST_AUTO_TEST_CASE(WorldEvents) { const MapPoint pt1(3, 4), pt2(5, 1), pt3(7, 6); // All events need to work w/o having them - LuaInterfaceGame& lua = world.GetLua(); + LuaInterfaceGame& lua = world.getLua(); lua.EventStart(true); Serializer serData; BOOST_TEST_REQUIRE(lua.Serialize(serData)); @@ -807,15 +807,15 @@ BOOST_AUTO_TEST_CASE(onOccupied) initWorld(); using Points = std::vector>; std::map gamePtsPerPlayer; - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - uint8_t owner = world.GetNode(pt).owner; + uint8_t owner = world.getNode(pt).owner; if(owner) gamePtsPerPlayer[owner - 1].push_back(std::pair(pt.x, pt.y)); } std::map luaPtsPerPlayer = getLuaState()["occupied"]; BOOST_TEST_REQUIRE(luaPtsPerPlayer.size() == gamePtsPerPlayer.size()); - for(unsigned i = 0; i < world.GetNumPlayers(); i++) + for(unsigned i = 0; i < world.getNumPlayers(); i++) { Points& gamePts = gamePtsPerPlayer[i]; Points& luaPts = luaPtsPerPlayer[i]; @@ -836,10 +836,10 @@ BOOST_AUTO_TEST_CASE(onExplored) initWorld(); using Points = std::vector>; std::map gamePtsPerPlayer; - RTTR_FOREACH_PT(MapPoint, world.GetSize()) + RTTR_FOREACH_PT(MapPoint, world.getSize()) { - const MapNode& node = world.GetNode(pt); - for(unsigned i = 0; i < world.GetNumPlayers(); i++) + const MapNode& node = world.getNode(pt); + for(unsigned i = 0; i < world.getNumPlayers(); i++) { if(node.fow[i].visibility == Visibility::Visible) gamePtsPerPlayer[i].push_back(std::pair(pt.x, pt.y)); @@ -847,7 +847,7 @@ BOOST_AUTO_TEST_CASE(onExplored) } std::map luaPtsPerPlayer = getLuaState()["explored"]; BOOST_TEST_REQUIRE(luaPtsPerPlayer.size() == gamePtsPerPlayer.size()); - for(unsigned i = 0; i < world.GetNumPlayers(); i++) + for(unsigned i = 0; i < world.getNumPlayers(); i++) { Points& gamePts = gamePtsPerPlayer[i]; Points& luaPts = luaPtsPerPlayer[i]; @@ -860,7 +860,7 @@ BOOST_AUTO_TEST_CASE(onExplored) BOOST_AUTO_TEST_CASE(LuaPacts) { initWorld(); - GamePlayer& player = world.GetPlayer(0); + GamePlayer& player = world.getPlayer(0); executeLua("player = rttr:GetPlayer(1)"); // accept every pact from player @@ -874,9 +874,9 @@ BOOST_AUTO_TEST_CASE(LuaPacts) // create alliance and check players state player.SuggestPact(1, PactType::TreatyOfAlliance, DURATION_INFINITE); game.executeAICommands(); - BOOST_TEST_REQUIRE(player.IsAlly(1)); + BOOST_TEST_REQUIRE(player.isAlly(1)); executeLua("assert(player:IsAlly(0))"); - BOOST_TEST_REQUIRE(!player.IsAttackable(1)); + BOOST_TEST_REQUIRE(!player.isAttackable(1)); executeLua("assert(not player:IsAttackable(0))"); // check if callback onPactCreated was executed @@ -886,9 +886,9 @@ BOOST_AUTO_TEST_CASE(LuaPacts) executeLua("player:CancelPact(TREATY_OF_ALLIANCE, 0)"); game.executeAICommands(); player.CancelPact(PactType::TreatyOfAlliance, 1); - BOOST_TEST_REQUIRE(!player.IsAlly(1)); + BOOST_TEST_REQUIRE(!player.isAlly(1)); executeLua("assert(not player:IsAlly(0))"); - BOOST_TEST_REQUIRE(player.IsAttackable(1)); + BOOST_TEST_REQUIRE(player.isAttackable(1)); executeLua("assert(player:IsAttackable(0))"); // check if callback onPactCanceled was executed @@ -899,21 +899,21 @@ BOOST_AUTO_TEST_CASE(LuaPacts) player.SuggestPact(1, PactType::NonAgressionPact, DURATION_INFINITE); game.executeAICommands(); // non aggression was created - BOOST_TEST_REQUIRE(!player.IsAttackable(1)); + BOOST_TEST_REQUIRE(!player.isAttackable(1)); BOOST_TEST_REQUIRE(getLog() == "Pact created\n"); // cancel pact by player and check state player.CancelPact(PactType::NonAgressionPact, 1); - BOOST_TEST_REQUIRE(player.IsAttackable(1)); + BOOST_TEST_REQUIRE(player.isAttackable(1)); BOOST_TEST_REQUIRE(getLog() == "Pact canceled\n"); - const PostBox& postbox = world.GetPostMgr().AddPostBox(0); + const PostBox& postbox = world.getPostMgr().AddPostBox(0); // Suggest Pact from Lua executeLua("player:SuggestPact(0, TREATY_OF_ALLIANCE, DURATION_INFINITE)"); game.executeAICommands(); - const auto* msg = dynamic_cast(postbox.GetMsg(0)); - this->AcceptPact(msg->GetPactId(), PactType::TreatyOfAlliance, 1); - BOOST_TEST_REQUIRE(!player.IsAttackable(1)); + const auto* msg = dynamic_cast(postbox.getMsg(0)); + this->AcceptPact(msg->getPactId(), PactType::TreatyOfAlliance, 1); + BOOST_TEST_REQUIRE(!player.isAttackable(1)); executeLua("assert(not player:IsAttackable(0))"); BOOST_TEST_REQUIRE(getLog() == "Pact created\n"); diff --git a/tests/s25Main/lua/testLuaGUI.cpp b/tests/s25Main/lua/testLuaGUI.cpp index 16626deecd..36d5576c97 100644 --- a/tests/s25Main/lua/testLuaGUI.cpp +++ b/tests/s25Main/lua/testLuaGUI.cpp @@ -22,65 +22,65 @@ BOOST_FIXTURE_TEST_SUITE(LuaGUITestSuite, LuaGuiFixture) BOOST_AUTO_TEST_CASE(MissionStatement) { // Set player - MOCK_EXPECT(localGameState.GetPlayerId).returns(1); + MOCK_EXPECT(localGameState.getPlayerId).returns(1); - BOOST_TEST_REQUIRE(!WINDOWMANAGER.GetTopMostWindow()); + BOOST_TEST_REQUIRE(!WINDOWMANAGER.getTopMostWindow()); // Show mission to non-existing player executeLua("rttr:MissionStatement(99, 'Title', 'Text')"); - BOOST_TEST_REQUIRE(!WINDOWMANAGER.GetTopMostWindow()); + BOOST_TEST_REQUIRE(!WINDOWMANAGER.getTopMostWindow()); // Show mission to other player executeLua("rttr:MissionStatement(0, 'Title', 'Text')"); - BOOST_TEST_REQUIRE(!WINDOWMANAGER.GetTopMostWindow()); + BOOST_TEST_REQUIRE(!WINDOWMANAGER.getTopMostWindow()); // Show it to us executeLua("rttr:MissionStatement(1, 'Title', 'Text')"); - const auto* wnd = dynamic_cast(WINDOWMANAGER.GetTopMostWindow()); + const auto* wnd = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); BOOST_TEST_REQUIRE(wnd); BOOST_TEST(wnd->IsActive()); - BOOST_TEST(wnd->GetTitle() == _("Title")); + BOOST_TEST(wnd->getTitle() == _("Title")); // double windows stack, newest modal goes on top executeLua("rttr:MissionStatement(1, 'Title2', 'Text')"); - const auto* wnd2 = dynamic_cast(WINDOWMANAGER.GetTopMostWindow()); + const auto* wnd2 = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); BOOST_TEST_REQUIRE(wnd2); BOOST_TEST(wnd2 != wnd); - BOOST_TEST(wnd2->GetTitle() == "Title2"); + BOOST_TEST(wnd2->getTitle() == "Title2"); // Close 2nd (topmost) wnd WINDOWMANAGER.CloseNow(const_cast(wnd2)); // 1st shows again - wnd2 = dynamic_cast(WINDOWMANAGER.GetTopMostWindow()); + wnd2 = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); BOOST_TEST_REQUIRE(wnd2); BOOST_TEST(wnd2 == wnd); - BOOST_TEST(wnd2->GetTitle() == _("Title")); + BOOST_TEST(wnd2->getTitle() == _("Title")); // Close wnd WINDOWMANAGER.CloseNow(const_cast(wnd)); - BOOST_TEST_REQUIRE(!WINDOWMANAGER.GetTopMostWindow()); + BOOST_TEST_REQUIRE(!WINDOWMANAGER.getTopMostWindow()); // No image executeLua("rttr:MissionStatement(1, 'Title', 'Text', IM_NONE)"); - wnd = dynamic_cast(WINDOWMANAGER.GetTopMostWindow()); + wnd = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); BOOST_TEST_REQUIRE(wnd); BOOST_TEST(wnd->IsActive()); - BOOST_TEST(wnd->GetTitle() == _("Title")); - BOOST_TEST(wnd->GetCtrls().empty()); + BOOST_TEST(wnd->getTitle() == _("Title")); + BOOST_TEST(wnd->getCtrls().empty()); WINDOWMANAGER.CloseNow(const_cast(wnd)); // Non-default image executeLua("rttr:MissionStatement(1, 'Title', 'Text', IM_AVATAR10)"); - wnd = dynamic_cast(WINDOWMANAGER.GetTopMostWindow()); + wnd = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); BOOST_TEST_REQUIRE(wnd); BOOST_TEST(wnd->IsActive()); - BOOST_TEST(wnd->GetTitle() == _("Title")); - BOOST_TEST(!wnd->GetCtrls().empty()); + BOOST_TEST(wnd->getTitle() == _("Title")); + BOOST_TEST(!wnd->getCtrls().empty()); WINDOWMANAGER.CloseNow(const_cast(wnd)); // Invalid image executeLua("rttr:MissionStatement(1, 'Title', 'Text', 999999)"); - wnd = dynamic_cast(WINDOWMANAGER.GetTopMostWindow()); + wnd = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); BOOST_TEST_REQUIRE(wnd); BOOST_TEST(wnd->IsActive()); - BOOST_TEST(wnd->GetTitle() == _("Title")); - BOOST_TEST(wnd->GetCtrls().empty()); + BOOST_TEST(wnd->getTitle() == _("Title")); + BOOST_TEST(wnd->getCtrls().empty()); WINDOWMANAGER.CloseNow(const_cast(wnd)); } @@ -88,75 +88,75 @@ BOOST_AUTO_TEST_CASE(MessageBoxTest) { // Default Info executeLua("rttr:MsgBox('Title', string.rep('Text\\n', 15))"); - const auto* wnd = dynamic_cast(WINDOWMANAGER.GetTopMostWindow()); + const auto* wnd = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); BOOST_TEST_REQUIRE(wnd); BOOST_TEST(wnd->IsActive()); - BOOST_TEST(wnd->GetTitle() == _("Title")); - BOOST_TEST(!wnd->GetCtrls().empty()); - BOOST_TEST(wnd->GetCtrls().front()->GetImage() - == LOADER.GetImageN("io", rttr::enum_cast(MsgboxIcon::ExclamationGreen))); - BOOST_TEST(!wnd->GetCtrls().empty()); + BOOST_TEST(wnd->getTitle() == _("Title")); + BOOST_TEST(!wnd->getCtrls().empty()); + BOOST_TEST(wnd->getCtrls().front()->getImage() + == LOADER.getImageN("io", rttr::enum_cast(MsgboxIcon::ExclamationGreen))); + BOOST_TEST(!wnd->getCtrls().empty()); // 15 lines of text, button must be below - BOOST_TEST(wnd->GetCtrls().front()->GetPos().y > 15 * NormalFont->getHeight()); + BOOST_TEST(wnd->getCtrls().front()->getPos().y > 15 * NormalFont->getHeight()); // And window higher than button - BOOST_TEST(static_cast(wnd->GetIwSize().y) > wnd->GetCtrls().front()->GetPos().y); + BOOST_TEST(static_cast(wnd->getIwSize().y) > wnd->getCtrls().front()->getPos().y); WINDOWMANAGER.CloseNow(const_cast(wnd)); // Error executeLua("rttr:MsgBox('Title', 'Text', true)"); - wnd = dynamic_cast(WINDOWMANAGER.GetTopMostWindow()); + wnd = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); BOOST_TEST_REQUIRE(wnd); BOOST_TEST(wnd->IsActive()); - BOOST_TEST(wnd->GetTitle() == _("Title")); - BOOST_TEST(!wnd->GetCtrls().empty()); - BOOST_TEST(wnd->GetCtrls().front()->GetImage() - == LOADER.GetImageN("io", rttr::enum_cast(MsgboxIcon::ExclamationRed))); + BOOST_TEST(wnd->getTitle() == _("Title")); + BOOST_TEST(!wnd->getCtrls().empty()); + BOOST_TEST(wnd->getCtrls().front()->getImage() + == LOADER.getImageN("io", rttr::enum_cast(MsgboxIcon::ExclamationRed))); WINDOWMANAGER.CloseNow(const_cast(wnd)); // MsgBoxEx executeLua("rttr:MsgBoxEx('Title', 'Text', 'io', 100)"); - wnd = dynamic_cast(WINDOWMANAGER.GetTopMostWindow()); + wnd = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); BOOST_TEST_REQUIRE(wnd); BOOST_TEST(wnd->IsActive()); - BOOST_TEST(wnd->GetTitle() == _("Title")); - BOOST_TEST(!wnd->GetCtrls().empty()); - BOOST_TEST(wnd->GetCtrls().front()->GetImage() == LOADER.GetImageN("io", 100)); + BOOST_TEST(wnd->getTitle() == _("Title")); + BOOST_TEST(!wnd->getCtrls().empty()); + BOOST_TEST(wnd->getCtrls().front()->getImage() == LOADER.getImageN("io", 100)); WINDOWMANAGER.CloseNow(const_cast(wnd)); // MsgBoxEx with position executeLua("rttr:MsgBoxEx('Title', 'Text', 'io', 101, 500, 200)"); - wnd = dynamic_cast(WINDOWMANAGER.GetTopMostWindow()); + wnd = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); BOOST_TEST_REQUIRE(wnd); BOOST_TEST(wnd->IsActive()); - BOOST_TEST(wnd->GetTitle() == _("Title")); - BOOST_TEST(!wnd->GetCtrls().empty()); - const ctrlImage* img = wnd->GetCtrls().front(); - const ITexture* actImg = img->GetImage(); - const Position imgPos = img->GetPos(); - BOOST_TEST(actImg == LOADER.GetImageN("io", 101)); + BOOST_TEST(wnd->getTitle() == _("Title")); + BOOST_TEST(!wnd->getCtrls().empty()); + const ctrlImage* img = wnd->getCtrls().front(); + const ITexture* actImg = img->getImage(); + const Position imgPos = img->getPos(); + BOOST_TEST(actImg == LOADER.getImageN("io", 101)); BOOST_TEST(imgPos.x == 500); BOOST_TEST(imgPos.y == 200); // Window must be bigger than image pos+size - Position imgEndPos(imgPos + actImg->GetSize() - actImg->GetOrigin()); - BOOST_TEST(static_cast(wnd->GetSize().x) > imgEndPos.x); //-V807 - BOOST_TEST(static_cast(wnd->GetSize().y) > imgEndPos.y); - const ctrlButton* bt = wnd->GetCtrls().front(); + Position imgEndPos(imgPos + actImg->getSize() - actImg->getOrigin()); + BOOST_TEST(static_cast(wnd->getSize().x) > imgEndPos.x); //-V807 + BOOST_TEST(static_cast(wnd->getSize().y) > imgEndPos.y); + const ctrlButton* bt = wnd->getCtrls().front(); // button must be below start of image - BOOST_TEST(bt->GetPos().y > imgPos.y - actImg->GetOrigin().y); //-V807 + BOOST_TEST(bt->getPos().y > imgPos.y - actImg->getOrigin().y); //-V807 // and centered - BOOST_TEST(bt->GetPos().x <= static_cast(wnd->GetSize().x / 2)); - BOOST_TEST(bt->GetPos().x > static_cast(wnd->GetSize().x / 2 - bt->GetSize().x)); + BOOST_TEST(bt->getPos().x <= static_cast(wnd->getSize().x / 2)); + BOOST_TEST(bt->getPos().x > static_cast(wnd->getSize().x / 2 - bt->getSize().x)); // Left, right, top, bottom const std::vector imgPts{DrawPoint(30, 30), DrawPoint(300, 30), DrawPoint(150, 30), DrawPoint(150, 300)}; for(const auto& imgPt : imgPts) { const_cast(wnd)->MoveIcon(imgPt); - Rect imgRect(img->GetPos() - actImg->GetOrigin(), actImg->GetSize()); + Rect imgRect(img->getPos() - actImg->getOrigin(), actImg->getSize()); // Image must be in wnd - BOOST_TEST(static_cast(wnd->GetSize().x) > imgRect.right); - BOOST_TEST(static_cast(wnd->GetSize().y) > imgRect.bottom); + BOOST_TEST(static_cast(wnd->getSize().x) > imgRect.right); + BOOST_TEST(static_cast(wnd->getSize().y) > imgRect.bottom); // Not over button or text - BOOST_TEST(!DoRectsIntersect(imgRect, bt->GetDrawRect())); - const ctrlMultiline* text = wnd->GetCtrls().front(); - BOOST_TEST(!DoRectsIntersect(imgRect, text->GetDrawRect())); + BOOST_TEST(!DoRectsIntersect(imgRect, bt->getDrawRect())); + const ctrlMultiline* text = wnd->getCtrls().front(); + BOOST_TEST(!DoRectsIntersect(imgRect, text->getDrawRect())); } } diff --git a/tests/s25Main/lua/testLuaSettings.cpp b/tests/s25Main/lua/testLuaSettings.cpp index 29917b8786..e58dd02ed3 100644 --- a/tests/s25Main/lua/testLuaSettings.cpp +++ b/tests/s25Main/lua/testLuaSettings.cpp @@ -37,24 +37,24 @@ struct LuaSettingsTestsFixture : public LuaBaseFixture, public IGameLobbyControl MockLocalGameState localGameState; LuaInterfaceSettings lua; - unsigned GetMaxNumPlayers() const override { return players.size(); } - JoinPlayerInfo& GetJoinPlayer(unsigned playerIdx) override { return players.at(playerIdx); } - const GlobalGameSettings& GetGGS() const override { return ggs; } + unsigned getMaxNumPlayers() const override { return players.size(); } + JoinPlayerInfo& getJoinPlayer(unsigned playerIdx) override { return players.at(playerIdx); } + const GlobalGameSettings& getGGS() const override { return ggs; } void ChangeGlobalGameSettings(const GlobalGameSettings& ggs) override { this->ggs = ggs; } - void CloseSlot(unsigned playerIdx) override { GetJoinPlayer(playerIdx).ps = PlayerState::Locked; } - void SetPlayerState(unsigned playerIdx, PlayerState state, const AI::Info& aiInfo) override + void CloseSlot(unsigned playerIdx) override { getJoinPlayer(playerIdx).ps = PlayerState::Locked; } + void setPlayerState(unsigned playerIdx, PlayerState state, const AI::Info& aiInfo) override { - GetJoinPlayer(playerIdx).ps = state; - GetJoinPlayer(playerIdx).aiInfo = aiInfo; + getJoinPlayer(playerIdx).ps = state; + getJoinPlayer(playerIdx).aiInfo = aiInfo; } - void SetName(unsigned playerIdx, const std::string& name) override { GetJoinPlayer(playerIdx).name = name; } - void SetPortrait(unsigned playerIdx, unsigned int portraitIndex) override + void setName(unsigned playerIdx, const std::string& name) override { getJoinPlayer(playerIdx).name = name; } + void setPortrait(unsigned playerIdx, unsigned int portraitIndex) override { - GetJoinPlayer(playerIdx).portraitIndex = portraitIndex; + getJoinPlayer(playerIdx).portraitIndex = portraitIndex; } - void SetColor(unsigned playerIdx, unsigned newColor) override { GetJoinPlayer(playerIdx).color = newColor; } - void SetTeam(unsigned playerIdx, Team newTeam) override { GetJoinPlayer(playerIdx).team = newTeam; } - void SetNation(unsigned playerIdx, Nation newNation) override { GetJoinPlayer(playerIdx).nation = newNation; } + void setColor(unsigned playerIdx, unsigned newColor) override { getJoinPlayer(playerIdx).color = newColor; } + void setTeam(unsigned playerIdx, Team newTeam) override { getJoinPlayer(playerIdx).team = newTeam; } + void setNation(unsigned playerIdx, Nation newNation) override { getJoinPlayer(playerIdx).nation = newNation; } LuaSettingsTestsFixture() : lua(*this, localGameState) { @@ -115,9 +115,9 @@ BOOST_AUTO_TEST_CASE(Events) lua.EventPlayerJoined(0); lua.EventPlayerLeft(0); lua.EventPlayerReady(0); - BOOST_TEST_REQUIRE(lua.IsChangeAllowed("general", true)); - BOOST_TEST_REQUIRE(!lua.IsChangeAllowed("general", false)); - std::vector allowedAddons = lua.GetAllowedAddons(); + BOOST_TEST_REQUIRE(lua.isChangeAllowed("general", true)); + BOOST_TEST_REQUIRE(!lua.isChangeAllowed("general", false)); + std::vector allowedAddons = lua.getAllowedAddons(); BOOST_TEST_REQUIRE(allowedAddons.empty()); clearLog(); @@ -145,31 +145,31 @@ BOOST_AUTO_TEST_CASE(Events) BOOST_TEST_REQUIRE(getLog() == "ready2\n"); executeLua("function getAllowedChanges()\n return {general=true, swapping=true}\nend"); - BOOST_TEST_REQUIRE(lua.IsChangeAllowed("general", false)); - BOOST_TEST_REQUIRE(lua.IsChangeAllowed("swapping", false)); - BOOST_TEST_REQUIRE(!lua.IsChangeAllowed("addonsAll", false)); + BOOST_TEST_REQUIRE(lua.isChangeAllowed("general", false)); + BOOST_TEST_REQUIRE(lua.isChangeAllowed("swapping", false)); + BOOST_TEST_REQUIRE(!lua.isChangeAllowed("addonsAll", false)); executeLua("function getAllowedAddons()\n return {ADDON_LIMIT_CATAPULTS, ADDON_CHARBURNER, ADDON_TRADE}\nend"); - allowedAddons = lua.GetAllowedAddons(); + allowedAddons = lua.getAllowedAddons(); BOOST_TEST_REQUIRE(allowedAddons.size() == 3u); BOOST_TEST_REQUIRE(allowedAddons[0] == AddonId::LIMIT_CATAPULTS); BOOST_TEST_REQUIRE(allowedAddons[1] == AddonId::CHARBURNER); BOOST_TEST_REQUIRE(allowedAddons[2] == AddonId::TRADE); - BOOST_TEST(lua.IsMapPreviewEnabled()); // Not defined in lua -> Default to enabled + BOOST_TEST(lua.isMapPreviewEnabled()); // Not defined in lua -> Default to enabled executeLua("function isMapPreviewEnabled()\n return false\nend"); - BOOST_TEST(!lua.IsMapPreviewEnabled()); + BOOST_TEST(!lua.isMapPreviewEnabled()); executeLua("function isMapPreviewEnabled()\n return true\nend"); - BOOST_TEST(lua.IsMapPreviewEnabled()); + BOOST_TEST(lua.isMapPreviewEnabled()); // Return invalid type -> ignored, but log output clearLog(); executeLua("function getAllowedAddons()\n return {'ADDON_FAIL_ME'}\nend"); - allowedAddons = lua.GetAllowedAddons(); + allowedAddons = lua.getAllowedAddons(); BOOST_TEST_REQUIRE(allowedAddons.empty()); BOOST_TEST_REQUIRE(getLog() != ""); executeLua("function getAllowedAddons()\n return {9999}\nend"); - allowedAddons = lua.GetAllowedAddons(); + allowedAddons = lua.getAllowedAddons(); BOOST_TEST_REQUIRE(allowedAddons.empty()); BOOST_TEST_REQUIRE(getLog() != ""); } @@ -270,7 +270,7 @@ BOOST_AUTO_TEST_CASE(SettingsFunctions) BOOST_AUTO_TEST_CASE(LegacyMineAddons) { LogAccessor logAcc; - const auto behaviorOf = [this](BuildingType bld) { return ggs.getSelection(GetMineResourceBehaviorAddonId(bld)); }; + const auto behaviorOf = [this](BuildingType bld) { return ggs.getSelection(getMineResourceBehaviorAddonId(bld)); }; constexpr auto defaultBehavior = static_cast(MineResourceBehavior::Default); constexpr auto inexhaustible = static_cast(MineResourceBehavior::Inexhaustible); constexpr auto s4Like = static_cast(MineResourceBehavior::S4LikeExhaustion); diff --git a/tests/s25Main/mapGenerator/testAlgorithms.cpp b/tests/s25Main/mapGenerator/testAlgorithms.cpp index 34a12101b6..9b6725ea10 100644 --- a/tests/s25Main/mapGenerator/testAlgorithms.cpp +++ b/tests/s25Main/mapGenerator/testAlgorithms.cpp @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE(Smooth_interpolates_values_around_peak) BOOST_TEST_REQUIRE(nodes[peak] < peakValue); - auto neighbors = nodes.GetPointsInRadius(peak, radius); + auto neighbors = nodes.getPointsInRadius(peak, radius); for(MapPoint p : neighbors) { @@ -167,7 +167,7 @@ BOOST_AUTO_TEST_CASE(Collect_returns_only_connected_positive_map_points) // positive area around target point MapPoint point(3, 4); - auto neighbors = map.GetNeighbours(point); + auto neighbors = map.getNeighbours(point); for(auto neighbor : neighbors) { map[neighbor] = 1; @@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE(Collect_returns_only_connected_positive_map_points) // disconnected, positive area MapPoint other(12, 12); - auto otherNeighbors = map.GetNeighbours(other); + auto otherNeighbors = map.getNeighbours(other); for(auto neighbor : otherNeighbors) { map[neighbor] = 1; @@ -218,7 +218,7 @@ BOOST_AUTO_TEST_CASE(DistancesTo_with_predicate_returns_expected_distance_for_ea return pt == MapPoint(3, 5); // compute distance to P(4/3) }); - BOOST_TEST_REQUIRE(distances.GetSize() == size); + BOOST_TEST_REQUIRE(distances.getSize() == size); RTTR_FOREACH_PT(MapPoint, size) { @@ -247,7 +247,7 @@ BOOST_AUTO_TEST_CASE(DistancesTo_returns_expected_distance_for_each_map_point) std::set flaggedPoints{MapPoint(3, 5)}; auto distances = DistancesTo(flaggedPoints, size); - BOOST_TEST_REQUIRE(distances.GetSize() == size); + BOOST_TEST_REQUIRE(distances.getSize() == size); RTTR_FOREACH_PT(MapPoint, size) { diff --git a/tests/s25Main/mapGenerator/testHarbors.cpp b/tests/s25Main/mapGenerator/testHarbors.cpp index f4570ad700..33814975ea 100644 --- a/tests/s25Main/mapGenerator/testHarbors.cpp +++ b/tests/s25Main/mapGenerator/testHarbors.cpp @@ -16,7 +16,7 @@ BOOST_FIXTURE_TEST_SUITE(HarborsTests, MapGenFixture) BOOST_AUTO_TEST_CASE(PlaceHarborPosition_flattens_ground_around_harbor_position) { Map map = createMap(MapExtent(6, 8)); - auto land = TexturePair(map.textureMap.Find(IsBuildableLand)); + auto land = TexturePair(map.textureMap.Find(isBuildableLand)); map.getTextures().Resize(map.size, land); @@ -25,7 +25,7 @@ BOOST_AUTO_TEST_CASE(PlaceHarborPosition_flattens_ground_around_harbor_position) map.z.Resize(map.size, map.height.maximum); const auto minHeight = map.height.minimum; - const auto neighbors = map.z.GetNeighbours(position); + const auto neighbors = map.z.getNeighbours(position); for(unsigned i = 0; i < neighbors.size(); i++) { @@ -46,8 +46,8 @@ BOOST_AUTO_TEST_CASE(PlaceHarborPosition_applies_buildable_terrain_around_positi { Map map = createMap(MapExtent(6, 8)); - auto coast = TexturePair(map.textureMap.Find(IsCoastTerrain)); - auto buildable = map.textureMap.Find(IsBuildableCoast); + auto coast = TexturePair(map.textureMap.Find(isCoastTerrain)); + auto buildable = map.textureMap.Find(isBuildableCoast); map.getTextures().Resize(map.size, coast); @@ -75,8 +75,8 @@ BOOST_AUTO_TEST_CASE(PlaceHarbors_places_no_harbors_on_coast_below_minimum_size) map.getTextures().Resize(map.size, water); - auto coast = map.textureMap.Find(IsCoastTerrain); - map.textureMap.Set(island, coast); + auto coast = map.textureMap.Find(isCoastTerrain); + map.textureMap.set(island, coast); PlaceHarbors(map, {}, 100); @@ -92,8 +92,8 @@ BOOST_AUTO_TEST_CASE(PlaceHarbors_places_harbor_on_suitable_island) map.getTextures().Resize(map.size, water); - auto coast = map.textureMap.Find(IsCoastTerrain); - map.textureMap.Set(island, coast); + auto coast = map.textureMap.Find(isCoastTerrain); + map.textureMap.set(island, coast); PlaceHarbors(map, {}, 5); @@ -109,8 +109,8 @@ BOOST_AUTO_TEST_CASE(PlaceHarbors_places_no_harbor_near_river) map.getTextures().Resize(map.size, water); - auto coast = map.textureMap.Find(IsCoastTerrain); - map.textureMap.Set(island, coast); + auto coast = map.textureMap.Find(isCoastTerrain); + map.textureMap.set(island, coast); River river{island}; diff --git a/tests/s25Main/mapGenerator/testHeadQuarters.cpp b/tests/s25Main/mapGenerator/testHeadQuarters.cpp index 1203a005a4..5a57febae4 100644 --- a/tests/s25Main/mapGenerator/testHeadQuarters.cpp +++ b/tests/s25Main/mapGenerator/testHeadQuarters.cpp @@ -39,15 +39,15 @@ BOOST_AUTO_TEST_CASE(FindLargestConnectedArea_returns_expected_nodes) Map map = createMap(size); TextureMap& textures = map.textureMap; - const auto water = textures.Find(IsShipableWater); - const auto land = textures.Find(IsBuildableLand); + const auto water = textures.Find(isShipableWater); + const auto land = textures.Find(isBuildableLand); map.getTextures().Resize(size, TexturePair(water)); MapPoint centerOfLargeArea(2, 3); const auto largeArea = map.getTextures().GetPointsInRadiusWithCenter(centerOfLargeArea, 3); for(auto node : largeArea) { - textures.Set(node, land); + textures.set(node, land); } MapPoint centerOfSmallArea(13, 15); @@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(FindLargestConnectedArea_returns_expected_nodes) for(auto node : smallArea) { - textures.Set(node, land); + textures.set(node, land); } const auto result = FindLargestConnectedArea(map); @@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE(FindHqPositions_returns_empty_for_map_without_suitable_posi Map map = createMap(size); const TextureMap& textures = map.textureMap; - map.getTextures().Resize(size, TexturePair(textures.Find(IsShipableWater))); + map.getTextures().Resize(size, TexturePair(textures.Find(isShipableWater))); const auto mntDist = randomMountainDistance(); const auto positions = FindHqPositions(map, getAllPoints(size), mntDist); @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE(FindHqPositions_returns_suitable_position_for_single_player const TextureMap& textures = map.textureMap; const auto water = textures.Find(IsWater); - const auto buildable = textures.Find(IsBuildableLand); + const auto buildable = textures.Find(isBuildableLand); MapPoint obstacle(1, 3); @@ -107,8 +107,8 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarter_with_suitable_position_for_player) Map map = createMap(size); const TextureMap& textures = map.textureMap; - const auto mountain = textures.Find(IsMinableMountain); - const auto buildable = textures.Find(IsBuildableLand); + const auto mountain = textures.Find(isMinableMountain); + const auto buildable = textures.Find(isBuildableLand); MapPoint obstacle(1, 2); MapPoint hq(3, 4); @@ -129,7 +129,7 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarter_with_suitable_position_without_mountain) const TextureMap& textures = map.textureMap; const auto mntDist = randomMountainDistance(); - const auto buildable = textures.Find(IsBuildableLand); + const auto buildable = textures.Find(isBuildableLand); MapPoint hq(4, 4); map.getTextures().Resize(size, TexturePair(buildable)); std::vector area{hq}; @@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarter_places_hq_on_map_at_suitable_position) const MapPoint obstacle(1, 3); const MapPoint hq(4, 5); - map.getTextures().Resize(size, TexturePair(textures.Find(IsBuildableLand))); + map.getTextures().Resize(size, TexturePair(textures.Find(isBuildableLand))); map.getTextures()[obstacle] = TexturePair(textures.Find(IsWater)); std::vector area{hq}; @@ -165,7 +165,7 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarter_with_empty_area_throws_exception) const TextureMap& textures = map.textureMap; const auto mntDist = randomMountainDistance(); - const auto water = textures.Find(IsShipableWater); + const auto water = textures.Find(isShipableWater); map.getTextures().Resize(size, TexturePair(water)); std::vector area; BOOST_CHECK_THROW(PlaceHeadquarter(map, area, mntDist), std::runtime_error); @@ -178,7 +178,7 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarter_without_suitable_position_throws_exception const TextureMap& textures = map.textureMap; const auto mntDist = randomMountainDistance(); - const auto water = textures.Find(IsShipableWater); + const auto water = textures.Find(isShipableWater); map.getTextures().Resize(size, TexturePair(water)); std::vector area{MapPoint(0, 0)}; BOOST_CHECK_THROW(PlaceHeadquarter(map, area, mntDist), std::runtime_error); @@ -193,7 +193,7 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarters_with_suitable_positions_for_all_players) const TextureMap& textures = map.textureMap; const auto mntDist = randomMountainDistance(); - map.getTextures().Resize(size, TexturePair(textures.Find(IsBuildableLand))); + map.getTextures().Resize(size, TexturePair(textures.Find(isBuildableLand))); map.getTextures()[MapPoint(0, 0)] = TexturePair(textures.Find(IsWater)); BOOST_REQUIRE_NO_THROW(PlaceHeadquarters(map, rnd, players, mntDist)); } @@ -207,7 +207,7 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarters_places_hqs_for_any_player_number_on_suita const TextureMap& textures = map.textureMap; const auto mntDist = randomMountainDistance(); - map.getTextures().Resize(size, textures.Find(IsBuildableLand)); + map.getTextures().Resize(size, textures.Find(isBuildableLand)); map.getTextures()[MapPoint(0, 0)] = TexturePair(textures.Find(IsWater)); PlaceHeadquarters(map, rnd, players, mntDist); BOOST_TEST_REQUIRE(map.hqPositions.size() == players); diff --git a/tests/s25Main/mapGenerator/testMap.cpp b/tests/s25Main/mapGenerator/testMap.cpp index 00033d1e58..963597a241 100644 --- a/tests/s25Main/mapGenerator/testMap.cpp +++ b/tests/s25Main/mapGenerator/testMap.cpp @@ -14,12 +14,12 @@ BOOST_FIXTURE_TEST_SUITE(MapTests, MapGenFixture) BOOST_AUTO_TEST_CASE(Constructor_resizes_all_maps) { const Map map = createMap(MapExtent(14, 6)); - BOOST_TEST(map.z.GetSize() == map.size); - BOOST_TEST(map.getTextures().GetSize() == map.size); - BOOST_TEST(map.objectTypes.GetSize() == map.size); - BOOST_TEST(map.objectInfos.GetSize() == map.size); - BOOST_TEST(map.resources.GetSize() == map.size); - BOOST_TEST(map.animals.GetSize() == map.size); + BOOST_TEST(map.z.getSize() == map.size); + BOOST_TEST(map.getTextures().getSize() == map.size); + BOOST_TEST(map.objectTypes.getSize() == map.size); + BOOST_TEST(map.objectInfos.getSize() == map.size); + BOOST_TEST(map.resources.getSize() == map.size); + BOOST_TEST(map.animals.getSize() == map.size); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/mapGenerator/testNodeMapUtilities.cpp b/tests/s25Main/mapGenerator/testNodeMapUtilities.cpp index b1f51ea6a2..03c719d144 100644 --- a/tests/s25Main/mapGenerator/testNodeMapUtilities.cpp +++ b/tests/s25Main/mapGenerator/testNodeMapUtilities.cpp @@ -15,7 +15,7 @@ BOOST_AUTO_TEST_CASE(GetDifference_returns_maximum_difference_between_range) { ValueRange range(4, 20); - BOOST_TEST(range.GetDifference() == 16); + BOOST_TEST(range.getDifference() == 16); } BOOST_AUTO_TEST_CASE(MapValueToIndex_returns_zero_for_minimum_value) diff --git a/tests/s25Main/mapGenerator/testRandomMap.cpp b/tests/s25Main/mapGenerator/testRandomMap.cpp index 7f6aa1083a..9a9db35302 100644 --- a/tests/s25Main/mapGenerator/testRandomMap.cpp +++ b/tests/s25Main/mapGenerator/testRandomMap.cpp @@ -25,7 +25,7 @@ static void ValidateMap(const Map& map, const MapExtent& size, unsigned players) const auto validateHqPos = [&](const MapPoint hqPos) { // All textures around the point must allow a castle - const auto neighbors = map.z.GetNeighbours(hqPos); + const auto neighbors = map.z.getNeighbours(hqPos); for(const MapPoint pt : neighbors) { BOOST_TEST_REQUIRE( diff --git a/tests/s25Main/mapGenerator/testResources.cpp b/tests/s25Main/mapGenerator/testResources.cpp index 52df62649c..96e2e0a6b0 100644 --- a/tests/s25Main/mapGenerator/testResources.cpp +++ b/tests/s25Main/mapGenerator/testResources.cpp @@ -18,9 +18,9 @@ struct ResourceTestFixture : MapGenFixture ResourceTestFixture() : map(createMap(size)) { - auto mountain = map.textureMap.Find(IsMinableMountain); + auto mountain = map.textureMap.Find(isMinableMountain); auto water = map.textureMap.Find(IsWater); - auto land = map.textureMap.Find(IsBuildableCoast); + auto land = map.textureMap.Find(isBuildableCoast); /* * ========== Test Map =========== @@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE(AddObjects_keeps_area_around_hqs_empty) auto& objectTypes = map.objectTypes; auto& objectInfos = map.objectInfos; - auto forbiddenArea = objectTypes.GetPointsInRadius(hq, 5); + auto forbiddenArea = objectTypes.getPointsInRadius(hq, 5); for(const MapPoint& pt : forbiddenArea) { BOOST_TEST_REQUIRE(objectTypes[pt] == OT_Empty); @@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE(AddObjects_keeps_area_around_harbors_empty) auto& objectTypes = map.objectTypes; auto& objectInfos = map.objectInfos; - auto forbiddenArea = objectTypes.GetPointsInRadius(harbor, 5); + auto forbiddenArea = objectTypes.getPointsInRadius(harbor, 5); for(const MapPoint& pt : forbiddenArea) { BOOST_TEST_REQUIRE(objectTypes[pt] == OT_Empty); @@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE(AddResources_updates_resources_according_to_textures) unsigned numMountainWithoutRes = 0; RTTR_FOREACH_PT(MapPoint, map.size) { - if(map.textureMap.All(pt, IsMinableMountain)) + if(map.textureMap.All(pt, isMinableMountain)) { if(map.resources[pt] == R_None) numMountainWithoutRes++; // LCOV_EXCL_LINE diff --git a/tests/s25Main/mapGenerator/testRivers.cpp b/tests/s25Main/mapGenerator/testRivers.cpp index 4c19ef3e89..7d5b577000 100644 --- a/tests/s25Main/mapGenerator/testRivers.cpp +++ b/tests/s25Main/mapGenerator/testRivers.cpp @@ -51,14 +51,14 @@ BOOST_AUTO_TEST_CASE(CreateStream_returns_only_connected_nodes) for(const MapPoint& pt : river) { - BOOST_TEST_REQUIRE(helpers::contains_if(map.z.GetNeighbours(pt), containedByRiver)); + BOOST_TEST_REQUIRE(helpers::contains_if(map.z.getNeighbours(pt), containedByRiver)); } } } BOOST_AUTO_TEST_CASE(CreateStream_returns_only_nodes_covered_by_water) { - auto land = map.textureMap.Find(IsBuildableLand); + auto land = map.textureMap.Find(isBuildableLand); map.getTextures().Resize(map.size, land); const MapPoint source(3, 2); const int length = 7; diff --git a/tests/s25Main/mapGenerator/testTextures.cpp b/tests/s25Main/mapGenerator/testTextures.cpp index f9a0de969b..67456a66f3 100644 --- a/tests/s25Main/mapGenerator/testTextures.cpp +++ b/tests/s25Main/mapGenerator/testTextures.cpp @@ -28,7 +28,7 @@ class TextureMapFixtureWithZ : public TextureMapFixture public: NodeMapBase z; - TextureMapFixtureWithZ() { z.Resize(textures.GetSize()); } + TextureMapFixtureWithZ() { z.Resize(textures.getSize()); } }; BOOST_AUTO_TEST_SUITE(TextureTests) @@ -38,7 +38,7 @@ BOOST_FIXTURE_TEST_CASE(AddTextures_sets_valid_textures_for_entire_map, TextureM const unsigned mountainLevel = 5; const unsigned coastline = 1; - RTTR_FOREACH_PT(MapPoint, z.GetSize()) + RTTR_FOREACH_PT(MapPoint, z.getSize()) { z[pt] = pt.x % 10; } @@ -46,7 +46,7 @@ BOOST_FIXTURE_TEST_CASE(AddTextures_sets_valid_textures_for_entire_map, TextureM Texturizer texturizer(z, textures, textureMap); texturizer.AddTextures(mountainLevel, coastline); - RTTR_FOREACH_PT(MapPoint, textures.GetSize()) + RTTR_FOREACH_PT(MapPoint, textures.getSize()) { BOOST_TEST(textures[pt].rsu); BOOST_TEST(textures[pt].lsd); @@ -58,9 +58,9 @@ BOOST_FIXTURE_TEST_CASE(AddTextures_does_not_override_textures, TextureMapFixtur const unsigned mountainLevel = 5; const unsigned coastline = 1; auto water = textureMap.Find(IsWater); - textures.Resize(textures.GetSize(), TexturePair(water)); + textures.Resize(textures.getSize(), TexturePair(water)); - RTTR_FOREACH_PT(MapPoint, z.GetSize()) + RTTR_FOREACH_PT(MapPoint, z.getSize()) { z[pt] = static_cast(pt.x % 256); } @@ -68,7 +68,7 @@ BOOST_FIXTURE_TEST_CASE(AddTextures_does_not_override_textures, TextureMapFixtur Texturizer texturizer(z, textures, textureMap); texturizer.AddTextures(mountainLevel, coastline); - RTTR_FOREACH_PT(MapPoint, textures.GetSize()) + RTTR_FOREACH_PT(MapPoint, textures.getSize()) { BOOST_TEST_REQUIRE(textures[pt].rsu == water); BOOST_TEST_REQUIRE(textures[pt].lsd == water); @@ -83,7 +83,7 @@ BOOST_FIXTURE_TEST_CASE(AddTextures_sets_water_textures_for_minimum_height, Text Texturizer texturizer(z, textures, textureMap); texturizer.AddTextures(mountainLevel, coastline); - RTTR_FOREACH_PT(MapPoint, textures.GetSize()) + RTTR_FOREACH_PT(MapPoint, textures.getSize()) { BOOST_TEST_REQUIRE(textureMap.Check(Triangle(true, pt), IsWater)); BOOST_TEST_REQUIRE(textureMap.Check(Triangle(false, pt), IsWater)); @@ -94,18 +94,18 @@ BOOST_FIXTURE_TEST_CASE(AddTextures_sets_mountain_textures_above_mountain_level, { const unsigned mountainLevel = 10; const unsigned coastline = 2; - z.Resize(z.GetSize(), mountainLevel); + z.Resize(z.getSize(), mountainLevel); z[0] = 1; // sea Texturizer texturizer(z, textures, textureMap); texturizer.AddTextures(mountainLevel, coastline); - RTTR_FOREACH_PT(MapPoint, textures.GetSize()) + RTTR_FOREACH_PT(MapPoint, textures.getSize()) { if(z[pt] >= mountainLevel) { - BOOST_TEST_REQUIRE(textureMap.Check(Triangle(true, pt), IsMountainOrSnowOrLava)); - BOOST_TEST_REQUIRE(textureMap.Check(Triangle(false, pt), IsMountainOrSnowOrLava)); + BOOST_TEST_REQUIRE(textureMap.Check(Triangle(true, pt), isMountainOrSnowOrLava)); + BOOST_TEST_REQUIRE(textureMap.Check(Triangle(false, pt), isMountainOrSnowOrLava)); } } } @@ -113,21 +113,21 @@ BOOST_FIXTURE_TEST_CASE(AddTextures_sets_mountain_textures_above_mountain_level, BOOST_FIXTURE_TEST_CASE(ReplaceTextureForPoint_replaces_all_textures, TextureMapFixture) { auto source = textureMap.Find(IsWater); - auto target = textureMap.Find(IsSnowOrLava); - auto point = MapPoint(textures.GetWidth() / 2, textures.GetHeight() / 2); - textures.Resize(textures.GetSize(), source); + auto target = textureMap.Find(isSnowOrLava); + auto point = MapPoint(textures.getWidth() / 2, textures.getHeight() / 2); + textures.Resize(textures.getSize(), source); ReplaceTextureForPoint(textures, point, target, {}); - BOOST_TEST(textureMap.All(point, IsSnowOrLava)); + BOOST_TEST(textureMap.All(point, isSnowOrLava)); } BOOST_FIXTURE_TEST_CASE(ReplaceTextureForPoint_does_not_replace_excluded_textures, TextureMapFixture) { auto source = textureMap.Find(IsWater); - auto target = textureMap.Find(IsSnowOrLava); - auto point = MapPoint(textures.GetWidth() / 2, textures.GetHeight() / 2); - textures.Resize(textures.GetSize(), source); + auto target = textureMap.Find(isSnowOrLava); + auto point = MapPoint(textures.getWidth() / 2, textures.getHeight() / 2); + textures.Resize(textures.getSize(), source); ReplaceTextureForPoint(textures, point, target, {source}); @@ -142,10 +142,10 @@ BOOST_FIXTURE_TEST_CASE(ReplaceTextures_replaces_textures_within_radius, Texture }; const auto source = textureMap.Find(IsWater); - const auto target = textureMap.Find(IsSnowOrLava); + const auto target = textureMap.Find(isSnowOrLava); for(unsigned radius = 0; radius < 4; radius++) { - textures.Resize(textures.GetSize(), source); + textures.Resize(textures.getSize(), source); std::set nodes(points); ReplaceTextures(textures, radius, nodes, target, {}); @@ -154,13 +154,13 @@ BOOST_FIXTURE_TEST_CASE(ReplaceTextures_replaces_textures_within_radius, Texture { if(radius > 0) { - for(const MapPoint& p : textures.GetPointsInRadius(pt, radius)) + for(const MapPoint& p : textures.getPointsInRadius(pt, radius)) { - BOOST_TEST_REQUIRE(textureMap.All(p, IsSnowOrLava)); + BOOST_TEST_REQUIRE(textureMap.All(p, isSnowOrLava)); } } else { - BOOST_TEST_REQUIRE(textureMap.All(pt, IsSnowOrLava)); + BOOST_TEST_REQUIRE(textureMap.All(pt, isSnowOrLava)); } } } @@ -174,16 +174,16 @@ BOOST_FIXTURE_TEST_CASE(ReplaceTextures_does_not_replace_excluded_textures, Text }; const auto source = textureMap.Find(IsWater); - const auto target = textureMap.Find(IsSnowOrLava); + const auto target = textureMap.Find(isSnowOrLava); for(unsigned radius = 0; radius < 4; radius++) { - textures.Resize(textures.GetSize(), source); + textures.Resize(textures.getSize(), source); std::set nodes(points); ReplaceTextures(textures, radius, nodes, target, {source}); - RTTR_FOREACH_PT(MapPoint, textures.GetSize()) + RTTR_FOREACH_PT(MapPoint, textures.getSize()) { BOOST_TEST_REQUIRE(textureMap.All(pt, IsWater)); } diff --git a/tests/s25Main/network/testGameClient.cpp b/tests/s25Main/network/testGameClient.cpp index caec924539..252b00e6f9 100644 --- a/tests/s25Main/network/testGameClient.cpp +++ b/tests/s25Main/network/testGameClient.cpp @@ -90,7 +90,7 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS GameClient client; GameMessageInterface& clientMsgInterface = client; MockClientInterface callbacks; - client.SetInterface(&callbacks); + client.setInterface(&callbacks); TestServer server; const auto serverPort = server.tryListen(); BOOST_TEST_REQUIRE(serverPort >= 0); @@ -98,11 +98,11 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS const auto serverType = rttr::test::randomEnum(); MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::Initiated).once(); BOOST_TEST_REQUIRE(client.Connect("localhost", pw, serverType, serverPort, false, false)); - BOOST_TEST_REQUIRE(client.GetState() == ClientState::Connect); + BOOST_TEST_REQUIRE(client.getState() == ClientState::Connect); { MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::VerifyServer).once(); clientMsgInterface.OnGameMessage(GameMessage_Player_Id(1)); - const auto msg = boost::dynamic_pointer_cast(client.GetMainPlayer().sendQueue.pop()); + const auto msg = boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop()); BOOST_TEST_REQUIRE(msg); BOOST_TEST(msg->type == serverType); } @@ -110,16 +110,16 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::QueryPw).once(); clientMsgInterface.OnGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); const auto msg = - boost::dynamic_pointer_cast(client.GetMainPlayer().sendQueue.pop()); + boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop()); BOOST_TEST_REQUIRE(msg); BOOST_TEST(msg->password == pw); } { MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::QueryMapInfo).once(); clientMsgInterface.OnGameMessage(GameMessage_Server_Password("true")); - BOOST_TEST_REQUIRE(dynamic_cast(client.GetMainPlayer().sendQueue.pop().get())); - BOOST_TEST_REQUIRE(dynamic_cast(client.GetMainPlayer().sendQueue.pop().get())); - const auto msg = boost::dynamic_pointer_cast(client.GetMainPlayer().sendQueue.pop()); + BOOST_TEST_REQUIRE(dynamic_cast(client.getMainPlayer().sendQueue.pop().get())); + BOOST_TEST_REQUIRE(dynamic_cast(client.getMainPlayer().sendQueue.pop().get())); + const auto msg = boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop()); BOOST_TEST_REQUIRE(msg); BOOST_TEST(msg->requestInfo); } @@ -137,7 +137,7 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS clientMsgInterface.OnGameMessage(GameMessage_Map_Info(testMapPath.filename().string(), MapType::OldMap, mapInfo.mapData.uncompressedLength, mapDataSize, mapInfo.luaData.uncompressedLength, luaDataSize)); - const auto msg = boost::dynamic_pointer_cast(client.GetMainPlayer().sendQueue.pop()); + const auto msg = boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop()); BOOST_TEST_REQUIRE(msg); BOOST_TEST(!msg->requestInfo); } @@ -149,7 +149,7 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS // First part of map MOCK_EXPECT(callbacks.CI_MapPartReceived).with(10u, totalSize).once(); clientMsgInterface.OnGameMessage(GameMessage_Map_Data(true, 0, mapInfo.mapData.data.data(), 10)); - BOOST_TEST(client.GetMainPlayer().sendQueue.empty()); + BOOST_TEST(client.getMainPlayer().sendQueue.empty()); // Remaining part of map MOCK_EXPECT(callbacks.CI_MapPartReceived).with(mapDataSize, totalSize).once(); if(!usesLuaScript) @@ -161,7 +161,7 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS // First part of lua MOCK_EXPECT(callbacks.CI_MapPartReceived).with(mapDataSize + 5u, totalSize).once(); clientMsgInterface.OnGameMessage(GameMessage_Map_Data(false, 0, mapInfo.luaData.data.data(), 5)); - BOOST_TEST(client.GetMainPlayer().sendQueue.empty()); + BOOST_TEST(client.getMainPlayer().sendQueue.empty()); // Remaining part of lua -> Transmission done MOCK_EXPECT(callbacks.CI_MapPartReceived).with(totalSize, totalSize).once(); MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::VerifyMap).once(); @@ -169,7 +169,7 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS GameMessage_Map_Data(false, 5, mapInfo.luaData.data.data() + 5, luaDataSize - 5)); } - const auto msg = boost::dynamic_pointer_cast(client.GetMainPlayer().sendQueue.pop()); + const auto msg = boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop()); BOOST_TEST_REQUIRE(msg); BOOST_TEST(msg->mapChecksum == mapInfo.mapChecksum); BOOST_TEST(msg->luaChecksum == mapInfo.luaChecksum); @@ -180,25 +180,25 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS { MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::QueryServerName).once(); clientMsgInterface.OnGameMessage(GameMessage_Map_ChecksumOK(true, false)); - BOOST_TEST(client.GetMainPlayer().sendQueue.empty()); + BOOST_TEST(client.getMainPlayer().sendQueue.empty()); } { MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::QueryPlayerList).once(); clientMsgInterface.OnGameMessage(GameMessage_Server_Name(rttr::test::randString(10))); - BOOST_TEST(client.GetMainPlayer().sendQueue.empty()); + BOOST_TEST(client.getMainPlayer().sendQueue.empty()); } { MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::QuerySettings).once(); clientMsgInterface.OnGameMessage(GameMessage_Player_List(std::vector(3))); - BOOST_TEST(client.GetMainPlayer().sendQueue.empty()); + BOOST_TEST(client.getMainPlayer().sendQueue.empty()); } { - BOOST_TEST_REQUIRE(client.GetState() == ClientState::Connect); + BOOST_TEST_REQUIRE(client.getState() == ClientState::Connect); MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::Finished).once(); clientMsgInterface.OnGameMessage(GameMessage_GGSChange()); - BOOST_TEST(client.GetMainPlayer().sendQueue.empty()); + BOOST_TEST(client.getMainPlayer().sendQueue.empty()); // And done - BOOST_TEST_REQUIRE(client.GetState() == ClientState::Config); + BOOST_TEST_REQUIRE(client.getState() == ClientState::Config); } // Reuse existing map (stored after previous connect) @@ -229,10 +229,10 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS GameMessage_Player_Portrait, GameMessage_MapRequest>; boost::mpl::for_each([&client](auto arg) { using msg_type = decltype(arg); - auto msg = client.GetMainPlayer().sendQueue.pop(); + auto msg = client.getMainPlayer().sendQueue.pop(); BOOST_TEST_REQUIRE(boost::dynamic_pointer_cast(std::move(msg))); }); - const auto msg = boost::dynamic_pointer_cast(client.GetMainPlayer().sendQueue.pop()); + const auto msg = boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop()); BOOST_TEST_REQUIRE(msg); BOOST_TEST(msg->mapChecksum == mapInfo.mapChecksum); BOOST_TEST(msg->luaChecksum == mapInfo.luaChecksum); @@ -241,7 +241,7 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS clientMsgInterface.OnGameMessage(GameMessage_Server_Name(rttr::test::randString(10))); clientMsgInterface.OnGameMessage(GameMessage_Player_List(std::vector(3))); clientMsgInterface.OnGameMessage(GameMessage_GGSChange()); - BOOST_TEST_REQUIRE(client.GetState() == ClientState::Config); + BOOST_TEST_REQUIRE(client.getState() == ClientState::Config); } } @@ -259,20 +259,20 @@ BOOST_AUTO_TEST_CASE(ClientStoresReceivedSavegamesInSaveFolder) BOOST_TEST_REQUIRE(client.Connect("localhost", rttr::test::randString(10), rttr::test::randomEnum(), serverPort, false, false)); clientMsgInterface.OnGameMessage(GameMessage_Player_Id(1)); - client.GetMainPlayer().sendQueue.clear(); + client.getMainPlayer().sendQueue.clear(); clientMsgInterface.OnGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); - client.GetMainPlayer().sendQueue.clear(); + client.getMainPlayer().sendQueue.clear(); clientMsgInterface.OnGameMessage(GameMessage_Server_Password("true")); - client.GetMainPlayer().sendQueue.clear(); + client.getMainPlayer().sendQueue.clear(); const auto expectedSavePath = RTTRCONFIG.ExpandPath(s25::folders::save) / "received.sav"; clientMsgInterface.OnGameMessage(GameMessage_Map_Info("received.sav", MapType::Savegame, 1, 1, 0, 0)); - const auto msg = boost::dynamic_pointer_cast(client.GetMainPlayer().sendQueue.pop()); + const auto msg = boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop()); BOOST_TEST_REQUIRE(msg); BOOST_TEST(!msg->requestInfo); - BOOST_TEST(client.GetMapType() == MapType::Savegame); - BOOST_TEST(client.GetMapPath() == expectedSavePath); + BOOST_TEST(client.getMapType() == MapType::Savegame); + BOOST_TEST(client.getMapPath() == expectedSavePath); } static constexpr std::array allServerTypes{ServerType::Local, ServerType::LAN, ServerType::Direct, ServerType::Lobby}; @@ -295,11 +295,11 @@ void ClientTreatsLocalSavegameFilenameVerbatim(ServerType serverType, MapType ma BOOST_TEST_REQUIRE(client.Connect("localhost", rttr::test::randString(10), serverType, serverPort, false, false)); clientMsgInterface.OnGameMessage(GameMessage_Player_Id(1)); - client.GetMainPlayer().sendQueue.clear(); + client.getMainPlayer().sendQueue.clear(); clientMsgInterface.OnGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); - client.GetMainPlayer().sendQueue.clear(); + client.getMainPlayer().sendQueue.clear(); clientMsgInterface.OnGameMessage(GameMessage_Server_Password("true")); - client.GetMainPlayer().sendQueue.clear(); + client.getMainPlayer().sendQueue.clear(); // Only local games (client and server are the same process via loopback) read the savegame // straight off disk, so the filename is already a valid name for the local filesystem and must @@ -313,7 +313,7 @@ void ClientTreatsLocalSavegameFilenameVerbatim(ServerType serverType, MapType ma const bool expectVerbatim = (serverType == ServerType::Local && mapType == MapType::Savegame); const std::string sanitizedName = (mapType == MapType::Savegame) ? "my_save.sav" : "my_map.swd"; const auto targetFolder = (mapType == MapType::Savegame) ? s25::folders::save : s25::folders::mapsPlayed; - BOOST_TEST(client.GetMapPath() == RTTRCONFIG.ExpandPath(targetFolder) / (expectVerbatim ? rawName : sanitizedName)); + BOOST_TEST(client.getMapPath() == RTTRCONFIG.ExpandPath(targetFolder) / (expectVerbatim ? rawName : sanitizedName)); } BOOST_AUTO_TEST_CASE(ClientDetectsMapBufferOverflow) @@ -322,7 +322,7 @@ BOOST_AUTO_TEST_CASE(ClientDetectsMapBufferOverflow) GameClient client; GameMessageInterface& clientMsgInterface = client; MockClientInterface callbacks; - client.SetInterface(&callbacks); + client.setInterface(&callbacks); TestServer server; const auto serverPort = server.tryListen(); BOOST_TEST_REQUIRE(serverPort >= 0); @@ -350,13 +350,13 @@ BOOST_AUTO_TEST_CASE(ClientDetectsMapBufferOverflow) MOCK_EXPECT(callbacks.CI_MapPartReceived).in(s).with(chunkSize, mapDataSize).once(); clientMsgInterface.OnGameMessage(GameMessage_Map_Data(true, 0, mapData.data(), chunkSize)); BOOST_TEST_REQUIRE(mock::verify()); - BOOST_TEST(client.GetState() == ClientState::Connect); + BOOST_TEST(client.getState() == ClientState::Connect); // Remaining part of map but to big/wrong offset MOCK_EXPECT(callbacks.CI_Error).with(ClientError::MapTransmission).once(); const auto remainingSize = mapDataSize - chunkSize; clientMsgInterface.OnGameMessage(GameMessage_Map_Data(true, chunkSize, mapData.data(), remainingSize + 1u)); - BOOST_TEST(client.GetState() == ClientState::Stopped); + BOOST_TEST(client.getState() == ClientState::Stopped); } BOOST_AUTO_TEST_CASE(ClientReportsWrongPasswordResponse) @@ -364,7 +364,7 @@ BOOST_AUTO_TEST_CASE(ClientReportsWrongPasswordResponse) GameClient client; GameMessageInterface& clientMsgInterface = client; MockClientInterface callbacks; - client.SetInterface(&callbacks); + client.setInterface(&callbacks); TestServer server; const auto serverPort = server.tryListen(); BOOST_TEST_REQUIRE(serverPort >= 0); @@ -378,13 +378,13 @@ BOOST_AUTO_TEST_CASE(ClientReportsWrongPasswordResponse) BOOST_TEST_REQUIRE(client.Connect("localhost", rttr::test::randString(10), serverType, serverPort, false, false)); clientMsgInterface.OnGameMessage(GameMessage_Player_Id(1)); clientMsgInterface.OnGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); - BOOST_TEST_REQUIRE(boost::dynamic_pointer_cast(client.GetMainPlayer().sendQueue.pop())); + BOOST_TEST_REQUIRE(boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop())); BOOST_TEST_REQUIRE( - boost::dynamic_pointer_cast(client.GetMainPlayer().sendQueue.pop())); + boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop())); clientMsgInterface.OnGameMessage(GameMessage_Server_Password("false")); - BOOST_TEST(client.GetState() == ClientState::Stopped); + BOOST_TEST(client.getState() == ClientState::Stopped); } using namespace std::chrono_literals; @@ -393,109 +393,109 @@ BOOST_AUTO_TEST_CASE(CanSetNewSpeed) { GameClient client; - client.SetNewSpeed(50ms); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 50ms); - client.SetNewSpeed(40ms); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 40ms); + client.setNewSpeed(50ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 50ms); + client.setNewSpeed(40ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 40ms); } BOOST_AUTO_TEST_CASE(IncreaseSpeed_DecreasesGF_WhenDivisibleBy10_By10) { GameClient client; - client.SetNewSpeed(50ms); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 50ms); + client.setNewSpeed(50ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 50ms); client.IncreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 40ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 40ms); client.IncreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 30ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 30ms); client.IncreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 20ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 20ms); client.IncreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 10ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 10ms); } BOOST_AUTO_TEST_CASE(DecreaseSpeed_IncreasesGF_WhenDivisible10_By10) { GameClient client; - client.SetNewSpeed(10ms); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 10ms); + client.setNewSpeed(10ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 10ms); client.DecreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 20ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 20ms); client.DecreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 30ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 30ms); client.DecreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 40ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 40ms); client.DecreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 50ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 50ms); } BOOST_AUTO_TEST_CASE(IncreaseSpeed_DecreasesGF_WhenNotDivisibleBy10_RoundsDownTo10) { GameClient client; - client.SetNewSpeed(25ms); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 25ms); + client.setNewSpeed(25ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 25ms); client.IncreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 20ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 20ms); - client.SetNewSpeed(12ms); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 12ms); + client.setNewSpeed(12ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 12ms); client.IncreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 10ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 10ms); } BOOST_AUTO_TEST_CASE(DecreaseSpeed_IncreasesGF_WhenNotDivisibleBy10_RoundsUpTo10) { GameClient client; - client.SetNewSpeed(25ms); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 25ms); + client.setNewSpeed(25ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 25ms); client.DecreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 30ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 30ms); - client.SetNewSpeed(12ms); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 12ms); + client.setNewSpeed(12ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 12ms); client.DecreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == 20ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == 20ms); } BOOST_AUTO_TEST_CASE(IncreaseSpeed_WrapsAround_OrCaps) { GameClient client; - client.SetNewSpeed(MAX_SPEED + 2ms); + client.setNewSpeed(MAX_SPEED + 2ms); client.IncreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == MAX_SPEED); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == MAX_SPEED); client.IncreaseSpeed(); #ifndef NDEBUG - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == MAX_SPEED_DEBUG); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == MAX_SPEED_DEBUG); client.IncreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == MAX_SPEED_DEBUG); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == MAX_SPEED_DEBUG); #else - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == MAX_SPEED); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == MAX_SPEED); #endif // Wrap around if request client.IncreaseSpeed(true); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == MIN_SPEED); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED); } BOOST_AUTO_TEST_CASE(DecreaseSpeed_CapsAtMinSpeed) { GameClient client; - client.SetNewSpeed(MIN_SPEED - 2ms); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == (MIN_SPEED - 2ms)); + client.setNewSpeed(MIN_SPEED - 2ms); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == (MIN_SPEED - 2ms)); client.DecreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == MIN_SPEED); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED); client.DecreaseSpeed(); #ifndef NDEBUG - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == MIN_SPEED_DEBUG); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED_DEBUG); client.DecreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == MIN_SPEED_DEBUG); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED_DEBUG); #else - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == MIN_SPEED); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED); #endif } @@ -504,21 +504,21 @@ BOOST_AUTO_TEST_CASE(ChangeSpeed_to_Min_or_Max_directly_when_outside) { GameClient client; - client.SetNewSpeed(MIN_SPEED_DEBUG); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == MIN_SPEED_DEBUG); + client.setNewSpeed(MIN_SPEED_DEBUG); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED_DEBUG); client.IncreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == MIN_SPEED); - client.SetNewSpeed((MIN_SPEED_DEBUG + MIN_SPEED) / 2); // Any speed between + BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED); + client.setNewSpeed((MIN_SPEED_DEBUG + MIN_SPEED) / 2); // Any speed between client.IncreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == MIN_SPEED); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED); - client.SetNewSpeed(MAX_SPEED_DEBUG); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == MAX_SPEED_DEBUG); + client.setNewSpeed(MAX_SPEED_DEBUG); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == MAX_SPEED_DEBUG); client.DecreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == MAX_SPEED); - client.SetNewSpeed((MAX_SPEED_DEBUG + MAX_SPEED) / 2); // Any speed between + BOOST_TEST_REQUIRE(client.getGFLengthReq() == MAX_SPEED); + client.setNewSpeed((MAX_SPEED_DEBUG + MAX_SPEED) / 2); // Any speed between client.DecreaseSpeed(); - BOOST_TEST_REQUIRE(client.GetGFLengthReq() == MAX_SPEED); + BOOST_TEST_REQUIRE(client.getGFLengthReq() == MAX_SPEED); } #endif diff --git a/tests/s25Main/simple/testGameData.cpp b/tests/s25Main/simple/testGameData.cpp index 68a6a24f4f..90cdbcf42a 100644 --- a/tests/s25Main/simple/testGameData.cpp +++ b/tests/s25Main/simple/testGameData.cpp @@ -55,13 +55,13 @@ BOOST_AUTO_TEST_CASE(ProductionBuildingsAreNobUsual) { for(const auto bld : helpers::enumRange()) { - if(!BuildingProperties::IsValid(bld)) + if(!BuildingProperties::isValid(bld)) continue; // Only nobUsuals can produce wares (though not all do) if(!holds_alternative(BLD_WORK_DESC[bld].producedWare)) { BOOST_TEST_INFO("bld: " << bld); - BOOST_TEST(BuildingProperties::IsUsual(bld)); + BOOST_TEST(BuildingProperties::isUsual(bld)); } } } diff --git a/tests/s25Main/simple/testMapBase.cpp b/tests/s25Main/simple/testMapBase.cpp index c4e7722a9f..4a47b9b973 100644 --- a/tests/s25Main/simple/testMapBase.cpp +++ b/tests/s25Main/simple/testMapBase.cpp @@ -15,12 +15,12 @@ BOOST_AUTO_TEST_SUITE(WorldCreationSuite) -BOOST_AUTO_TEST_CASE(GetAllNeighboursUnion) +BOOST_AUTO_TEST_CASE(getAllNeighboursUnion) { MapBase world; // No points -> empty result - BOOST_TEST(world.GetAllNeighboursUnion(std::vector{}).empty()); + BOOST_TEST(world.getAllNeighboursUnion(std::vector{}).empty()); // 3 points where the last 2 share neighbours and are neighbours to each other const std::vector testPoints{MapPoint(1, 1), MapPoint(10, 10), MapPoint(10, 11)}; @@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE(GetAllNeighboursUnion) // Duplicates MapPoint(11, 10), MapPoint(9, 11)}; - auto resultPoints = world.GetAllNeighboursUnion(testPoints); + auto resultPoints = world.getAllNeighboursUnion(testPoints); helpers::sort(resultPoints, MapPointLess()); helpers::sort(expectedResultPoints, MapPointLess()); @@ -73,33 +73,33 @@ BOOST_AUTO_TEST_CASE(NeighbourPts) // Test a simple even and odd point MapPoint(10, 10), MapPoint(10, 9), // Test border points - MapPoint(0, 0), MapPoint(0, world.GetHeight() - 1), MapPoint(world.GetWidth() - 1, 0), - MapPoint(world.GetWidth() - 1, world.GetHeight() - 1), + MapPoint(0, 0), MapPoint(0, world.getHeight() - 1), MapPoint(world.getWidth() - 1, 0), + MapPoint(world.getWidth() - 1, world.getHeight() - 1), // Test border points with 1 offset in Y - MapPoint(0, 1), MapPoint(0, world.GetHeight() - 2), MapPoint(world.GetWidth() - 1, 1), - MapPoint(world.GetWidth() - 1, world.GetHeight() - 2)}; + MapPoint(0, 1), MapPoint(0, world.getHeight() - 2), MapPoint(world.getWidth() - 1, 1), + MapPoint(world.getWidth() - 1, world.getHeight() - 2)}; for(const MapPoint& pt : testPoints) { for(const auto dir : helpers::EnumRange{}) { const bool isEvenRow = pt.y % 2 == 0; const Position targetPointRaw = pt + (isEvenRow ? evenPtMod : oddPtMod)[dir]; - const MapPoint targetPoint((targetPointRaw.x + world.GetWidth()) % world.GetWidth(), - (targetPointRaw.y + world.GetHeight()) % world.GetHeight()); + const MapPoint targetPoint((targetPointRaw.x + world.getWidth()) % world.getWidth(), + (targetPointRaw.y + world.getHeight()) % world.getHeight()); BOOST_TEST_REQUIRE(world.CalcDistance(pt, targetPoint) == 1u); - BOOST_TEST_REQUIRE(world.GetNeighbour(pt, dir) == targetPoint); + BOOST_TEST_REQUIRE(world.getNeighbour(pt, dir) == targetPoint); // Consistency check: The inverse must also match - BOOST_TEST_REQUIRE(world.GetNeighbour(targetPoint, Direction(dir + 3)) == pt); + BOOST_TEST_REQUIRE(world.getNeighbour(targetPoint, Direction(dir + 3)) == pt); // Also the global function must return the same: - BOOST_TEST_REQUIRE(::GetNeighbour(Position(pt), dir) == targetPointRaw); - BOOST_TEST_REQUIRE(world.MakeMapPoint(::GetNeighbour(Position(pt), dir)) == targetPoint); + BOOST_TEST_REQUIRE(::getNeighbour(Position(pt), dir) == targetPointRaw); + BOOST_TEST_REQUIRE(world.MakeMapPoint(::getNeighbour(Position(pt), dir)) == targetPoint); } // Neighbour 2 -> Radius 2, right circle - MapPoint curTargetPoint = world.GetNeighbour(world.GetNeighbour(pt, Direction::West), Direction::West); + MapPoint curTargetPoint = world.getNeighbour(world.getNeighbour(pt, Direction::West), Direction::West); BOOST_TEST_REQUIRE(world.CalcDistance(pt, curTargetPoint) == 2u); - BOOST_TEST_REQUIRE(world.GetNeighbour2(pt, 0) == curTargetPoint); + BOOST_TEST_REQUIRE(world.getNeighbour2(pt, 0) == curTargetPoint); // We now go 2 steps in each direction to describe the circle // (Note: Could iterator over directions, but to easily identify errors and make intentions clear we do it // explicitely) @@ -110,9 +110,9 @@ BOOST_AUTO_TEST_CASE(NeighbourPts) // Note: 0==12 already handled for(unsigned j = 1; j < 12; j++) { - curTargetPoint = world.GetNeighbour(curTargetPoint, steps.at(j - 1)); + curTargetPoint = world.getNeighbour(curTargetPoint, steps.at(j - 1)); BOOST_TEST_REQUIRE(world.CalcDistance(pt, curTargetPoint) == 2u); - BOOST_TEST_REQUIRE(world.GetNeighbour2(pt, j) == curTargetPoint); + BOOST_TEST_REQUIRE(world.getNeighbour2(pt, j) == curTargetPoint); } // And finally the points in radius @@ -120,15 +120,15 @@ BOOST_AUTO_TEST_CASE(NeighbourPts) BOOST_TEST_REQUIRE(radiusPts.size() == 1u + 6u + 12u + 18u); BOOST_TEST_REQUIRE(radiusPts[0] == pt); for(const auto j : helpers::EnumRange{}) - BOOST_TEST_REQUIRE(radiusPts[rttr::enum_cast(j) + 1] == world.GetNeighbour(pt, j)); + BOOST_TEST_REQUIRE(radiusPts[rttr::enum_cast(j) + 1] == world.getNeighbour(pt, j)); for(unsigned j = 0; j < 12; j++) - BOOST_TEST_REQUIRE(radiusPts[j + 7] == world.GetNeighbour2(pt, j)); + BOOST_TEST_REQUIRE(radiusPts[j + 7] == world.getNeighbour2(pt, j)); for(unsigned j = 0; j < 18; j++) BOOST_TEST_REQUIRE(world.CalcDistance(pt, radiusPts[j + 19]) == 3u); - const helpers::EnumArray neighbours = world.GetNeighbours(pt); + const helpers::EnumArray neighbours = world.getNeighbours(pt); for(const auto dir : helpers::EnumRange{}) - BOOST_TEST(neighbours[dir] == world.GetNeighbour(pt, dir)); + BOOST_TEST(neighbours[dir] == world.getNeighbour(pt, dir)); } } @@ -152,23 +152,23 @@ BOOST_AUTO_TEST_CASE(GetMatchingPointsInRadius) BOOST_TEST(firstEvenPt.front() == evenPts.front()); } -BOOST_AUTO_TEST_CASE(GetIdx) +BOOST_AUTO_TEST_CASE(getIdx) { MapBase world; // Small world world.Resize(MapExtent(100, 50)); - BOOST_TEST_REQUIRE(world.GetIdx(MapPoint(0, 0)) == 0u); - BOOST_TEST_REQUIRE(world.GetIdx(MapPoint(99, 0)) == 99u); - BOOST_TEST_REQUIRE(world.GetIdx(MapPoint(0, 1)) == 100u); - BOOST_TEST_REQUIRE(world.GetIdx(MapPoint(1, 1)) == 101u); - BOOST_TEST_REQUIRE(world.GetIdx(MapPoint(99, 49)) == 50u * 100u - 1u); + BOOST_TEST_REQUIRE(world.getIdx(MapPoint(0, 0)) == 0u); + BOOST_TEST_REQUIRE(world.getIdx(MapPoint(99, 0)) == 99u); + BOOST_TEST_REQUIRE(world.getIdx(MapPoint(0, 1)) == 100u); + BOOST_TEST_REQUIRE(world.getIdx(MapPoint(1, 1)) == 101u); + BOOST_TEST_REQUIRE(world.getIdx(MapPoint(99, 49)) == 50u * 100u - 1u); // Big world. world.Resize(MapExtent(MAX_MAP_SIZE, MAX_MAP_SIZE - 2)); - BOOST_TEST_REQUIRE(world.GetIdx(MapPoint(0, 0)) == 0u); - BOOST_TEST_REQUIRE(world.GetIdx(MapPoint(MAX_MAP_SIZE - 1, 0)) == MAX_MAP_SIZE - 1); - BOOST_TEST_REQUIRE(world.GetIdx(MapPoint(0, 1)) == MAX_MAP_SIZE); - BOOST_TEST_REQUIRE(world.GetIdx(MapPoint(1, 1)) == MAX_MAP_SIZE + 1u); - BOOST_TEST_REQUIRE(world.GetIdx(MapPoint(MAX_MAP_SIZE - 1, MAX_MAP_SIZE - 3)) + BOOST_TEST_REQUIRE(world.getIdx(MapPoint(0, 0)) == 0u); + BOOST_TEST_REQUIRE(world.getIdx(MapPoint(MAX_MAP_SIZE - 1, 0)) == MAX_MAP_SIZE - 1); + BOOST_TEST_REQUIRE(world.getIdx(MapPoint(0, 1)) == MAX_MAP_SIZE); + BOOST_TEST_REQUIRE(world.getIdx(MapPoint(1, 1)) == MAX_MAP_SIZE + 1u); + BOOST_TEST_REQUIRE(world.getIdx(MapPoint(MAX_MAP_SIZE - 1, MAX_MAP_SIZE - 3)) == MAX_MAP_SIZE * (MAX_MAP_SIZE - 2u) - 1u); } diff --git a/tests/s25Main/simple/testPostBox.cpp b/tests/s25Main/simple/testPostBox.cpp index 86a474e16a..70e6d681a2 100644 --- a/tests/s25Main/simple/testPostBox.cpp +++ b/tests/s25Main/simple/testPostBox.cpp @@ -13,65 +13,65 @@ BOOST_AUTO_TEST_CASE(AddMsg) { PostBox box; std::vector msgs; - BOOST_TEST_REQUIRE(box.GetNumMsgs() == 0u); - BOOST_TEST_REQUIRE(!box.GetMsg(0u)); - for(unsigned i = 0; i < PostBox::GetMaxMsgs(); i++) + BOOST_TEST_REQUIRE(box.getNumMsgs() == 0u); + BOOST_TEST_REQUIRE(!box.getMsg(0u)); + for(unsigned i = 0; i < PostBox::getMaxMsgs(); i++) { auto msg = std::make_unique(0, "Test", PostCategory::General); const auto* msgPtr = msg.get(); box.AddMsg(std::move(msg)); - BOOST_TEST_REQUIRE(box.GetNumMsgs() == i + 1); - BOOST_TEST_REQUIRE(box.GetMsg(i) == msgPtr); - BOOST_TEST_REQUIRE(!box.GetMsg(i + 1)); + BOOST_TEST_REQUIRE(box.getNumMsgs() == i + 1); + BOOST_TEST_REQUIRE(box.getMsg(i) == msgPtr); + BOOST_TEST_REQUIRE(!box.getMsg(i + 1)); msgs.push_back(msgPtr); } // Check that messages are still in their correct positions - for(unsigned i = 0; i < PostBox::GetMaxMsgs(); i++) - BOOST_TEST_REQUIRE(box.GetMsg(i) == msgs[i]); + for(unsigned i = 0; i < PostBox::getMaxMsgs(); i++) + BOOST_TEST_REQUIRE(box.getMsg(i) == msgs[i]); // Overfill auto msg = std::make_unique(0, "Test2", PostCategory::General); const auto* msgPtr = msg.get(); box.AddMsg(std::move(msg)); - BOOST_TEST_REQUIRE(box.GetNumMsgs() == box.GetMaxMsgs()); - BOOST_TEST_REQUIRE(box.GetMsg(box.GetMaxMsgs() - 1) == msgPtr); + BOOST_TEST_REQUIRE(box.getNumMsgs() == box.getMaxMsgs()); + BOOST_TEST_REQUIRE(box.getMsg(box.getMaxMsgs() - 1) == msgPtr); // Check that messages have been shifted - for(unsigned i = 0; i + 1 < PostBox::GetMaxMsgs(); i++) - BOOST_TEST_REQUIRE(box.GetMsg(i) == msgs[i + 1]); + for(unsigned i = 0; i + 1 < PostBox::getMaxMsgs(); i++) + BOOST_TEST_REQUIRE(box.getMsg(i) == msgs[i + 1]); } BOOST_AUTO_TEST_CASE(DeleteMsg) { PostBox box; BOOST_TEST_REQUIRE(box.DeleteMsg(0u) == false); - BOOST_TEST_REQUIRE(box.DeleteMsg(box.GetMaxMsgs()) == false); + BOOST_TEST_REQUIRE(box.DeleteMsg(box.getMaxMsgs()) == false); // Add 1 msg box.AddMsg(std::make_unique(0, "", PostCategory::General)); // Deleting only this msg should succeed - for(unsigned i = 1; i < PostBox::GetMaxMsgs(); i++) + for(unsigned i = 1; i < PostBox::getMaxMsgs(); i++) BOOST_TEST_REQUIRE(box.DeleteMsg(i) == false); - BOOST_TEST_REQUIRE(box.GetNumMsgs() == 1u); + BOOST_TEST_REQUIRE(box.getNumMsgs() == 1u); BOOST_TEST_REQUIRE(box.DeleteMsg(0u) == true); - BOOST_TEST_REQUIRE(box.GetNumMsgs() == 0u); + BOOST_TEST_REQUIRE(box.getNumMsgs() == 0u); auto msg = std::make_unique(0, "", PostCategory::General); const auto* msgPtr = msg.get(); box.AddMsg(std::move(msg)); BOOST_TEST_REQUIRE(box.DeleteMsg(msgPtr) == true); - BOOST_TEST_REQUIRE(box.GetNumMsgs() == 0u); + BOOST_TEST_REQUIRE(box.getNumMsgs() == 0u); // Now fill it - for(unsigned i = 0; i < PostBox::GetMaxMsgs(); i++) + for(unsigned i = 0; i < PostBox::getMaxMsgs(); i++) box.AddMsg(std::make_unique(i, "Test", PostCategory::General)); BOOST_TEST_REQUIRE(box.DeleteMsg(0u) == true); BOOST_TEST_REQUIRE(box.DeleteMsg(5u) == true); - BOOST_TEST_REQUIRE(box.DeleteMsg(box.GetMaxMsgs() - 3) == true); - BOOST_TEST_REQUIRE(box.GetNumMsgs() == box.GetMaxMsgs() - 3); + BOOST_TEST_REQUIRE(box.DeleteMsg(box.getMaxMsgs() - 3) == true); + BOOST_TEST_REQUIRE(box.getNumMsgs() == box.getMaxMsgs() - 3); unsigned expected = 1; - for(unsigned i = 0; i < box.GetNumMsgs(); i++, expected++) + for(unsigned i = 0; i < box.getNumMsgs(); i++, expected++) { if(i == 5) expected++; // This one was also deleted - BOOST_TEST_REQUIRE(box.GetMsg(i)->GetSendFrame() == expected); + BOOST_TEST_REQUIRE(box.getMsg(i)->getSendFrame() == expected); } - BOOST_TEST_REQUIRE(!box.GetMsg(box.GetMaxMsgs() - 3)); + BOOST_TEST_REQUIRE(!box.getMsg(box.getMaxMsgs() - 3)); } struct CallbackChecker @@ -82,12 +82,12 @@ struct CallbackChecker void OnNew(const PostMsg& /*msg*/, unsigned ct) { newCalls++; - BOOST_TEST_REQUIRE(box.GetNumMsgs() == ct); + BOOST_TEST_REQUIRE(box.getNumMsgs() == ct); } void OnDel(unsigned ct) { delCalls++; - BOOST_TEST_REQUIRE(box.GetNumMsgs() == ct); + BOOST_TEST_REQUIRE(box.getNumMsgs() == ct); } }; @@ -97,14 +97,14 @@ BOOST_AUTO_TEST_CASE(MsgCallbacks) CallbackChecker cb(box); box.ObserveNewMsg([&cb](const auto& msg, auto ct) { cb.OnNew(msg, ct); }); box.ObserveDeletedMsg([&cb](auto ct) { cb.OnDel(ct); }); - for(unsigned i = 0; i < PostBox::GetMaxMsgs(); i++) + for(unsigned i = 0; i < PostBox::getMaxMsgs(); i++) box.AddMsg(std::make_unique(i, "Test", PostCategory::General)); - BOOST_TEST_REQUIRE(cb.newCalls == box.GetMaxMsgs()); + BOOST_TEST_REQUIRE(cb.newCalls == box.getMaxMsgs()); BOOST_TEST_REQUIRE(cb.delCalls == 0u); - for(unsigned i = 0; i < PostBox::GetMaxMsgs(); i++) + for(unsigned i = 0; i < PostBox::getMaxMsgs(); i++) box.DeleteMsg(0u); - BOOST_TEST_REQUIRE(cb.newCalls == box.GetMaxMsgs()); - BOOST_TEST_REQUIRE(cb.delCalls == box.GetMaxMsgs()); + BOOST_TEST_REQUIRE(cb.newCalls == box.getMaxMsgs()); + BOOST_TEST_REQUIRE(cb.delCalls == box.getMaxMsgs()); } BOOST_AUTO_TEST_CASE(ClearMsgs) @@ -112,12 +112,12 @@ BOOST_AUTO_TEST_CASE(ClearMsgs) PostBox box; CallbackChecker cb(box); box.ObserveDeletedMsg([&cb](auto ct) { cb.OnDel(ct); }); - for(unsigned i = 0; i < PostBox::GetMaxMsgs(); i++) + for(unsigned i = 0; i < PostBox::getMaxMsgs(); i++) box.AddMsg(std::make_unique(i, "Test", PostCategory::General)); // Deleting should delete all messages and call delete callback for each one box.Clear(); - BOOST_TEST_REQUIRE(box.GetNumMsgs() == 0u); - BOOST_TEST_REQUIRE(cb.delCalls == box.GetMaxMsgs()); + BOOST_TEST_REQUIRE(box.getNumMsgs() == 0u); + BOOST_TEST_REQUIRE(cb.delCalls == box.getMaxMsgs()); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/simple/testRandom.cpp b/tests/s25Main/simple/testRandom.cpp index d4ae17d737..e829bd5995 100644 --- a/tests/s25Main/simple/testRandom.cpp +++ b/tests/s25Main/simple/testRandom.cpp @@ -29,7 +29,7 @@ BOOST_FIXTURE_TEST_SUITE(RNG_Tests, SeedFixture) BOOST_AUTO_TEST_CASE(RandomTest) { - const auto GetObjId = []() { return 0u; }; // Fake function for RANDOM_RAND + const auto getObjId = []() { return 0u; }; // Fake function for RANDOM_RAND for(unsigned seed : seeds) { RANDOM.Init(seed); @@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(RandomTest) BOOST_AUTO_TEST_CASE(RandomSameSeq) { - const auto GetObjId = []() { return 0u; }; // Fake function for RANDOM_RAND + const auto getObjId = []() { return 0u; }; // Fake function for RANDOM_RAND // The rng must return the same sequence of values for a given seed RANDOM.Init(0x1337); std::vector results = {623, 453, 927, 305, 478, 933, 230, 491, 968, 623, 418}; @@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(ValueRangeValid, T_RNG, TestedRNGS) BOOST_AUTO_TEST_CASE(EmptyRange) { - const auto GetObjId = []() { return 0u; }; // Fake function for RANDOM_RAND + const auto getObjId = []() { return 0u; }; // Fake function for RANDOM_RAND for(unsigned seed : seeds) { RANDOM.Init(seed); @@ -231,7 +231,7 @@ constexpr auto maxEnumValue(TestEnum) BOOST_AUTO_TEST_CASE(RandomEnum) { - const auto GetObjId = []() { return 0u; }; // Fake function for RANDOM_ENUM + const auto getObjId = []() { return 0u; }; // Fake function for RANDOM_ENUM helpers::EnumArray triggered{}; for(unsigned seed : seeds) { @@ -247,7 +247,7 @@ BOOST_AUTO_TEST_CASE(RandomEnum) BOOST_AUTO_TEST_CASE(RandomElement) { - const auto GetObjId = []() { return 0u; }; // Fake function for RANDOM_ENUM + const auto getObjId = []() { return 0u; }; // Fake function for RANDOM_ENUM std::array triggered{}; const std::array indices{0, 1, 2}; for(unsigned seed : seeds) diff --git a/tests/s25Main/worldFixtures/CreateEmptyWorld.cpp b/tests/s25Main/worldFixtures/CreateEmptyWorld.cpp index 5e956573e5..cec0d21f16 100644 --- a/tests/s25Main/worldFixtures/CreateEmptyWorld.cpp +++ b/tests/s25Main/worldFixtures/CreateEmptyWorld.cpp @@ -18,13 +18,13 @@ void WorldFixtureBase::addStartResources() { - for(unsigned i = 0; i < world.GetNumPlayers(); i++) + for(unsigned i = 0; i < world.getNumPlayers(); i++) addStartResources(i); } void WorldFixtureBase::addStartResources(unsigned playerIdx) { - world.GetPlayer(playerIdx).GetHQ()->addStartWares(); + world.getPlayer(playerIdx).getHQ()->addStartWares(); } CreateEmptyWorld::CreateEmptyWorld(const MapExtent& size) : size_(size) {} @@ -34,16 +34,16 @@ bool CreateEmptyWorld::operator()(GameWorld& world) const // For consistent results initGameRNG(0); - loadGameData(world.GetDescriptionWriteable()); + loadGameData(world.getDescriptionWriteable()); world.Init(size_); // Set everything to buildable land - DescIdx t = GetLandTerrain(world.GetDescription(), ETerrain::Buildable); + DescIdx t = GetLandTerrain(world.getDescription(), ETerrain::Buildable); RTTR_FOREACH_PT(MapPoint, size_) { - MapNode& node = world.GetNodeWriteable(pt); + MapNode& node = world.getNodeWriteable(pt); node.t1 = node.t2 = t; } - unsigned numPlayers = world.GetNumPlayers(); + unsigned numPlayers = world.getNumPlayers(); if(numPlayers > 0) { // Distribute player HQs evenly across map @@ -77,12 +77,12 @@ void setRightTerrain(GameWorld& world, const MapPoint& pt, Direction dir, DescId { switch(dir) { - case Direction::West: world.GetNodeWriteable(world.GetNeighbour(pt, Direction::NorthWest)).t1 = t; break; - case Direction::NorthWest: world.GetNodeWriteable(world.GetNeighbour(pt, Direction::NorthWest)).t2 = t; break; - case Direction::NorthEast: world.GetNodeWriteable(world.GetNeighbour(pt, Direction::NorthEast)).t1 = t; break; - case Direction::East: world.GetNodeWriteable(pt).t2 = t; break; - case Direction::SouthEast: world.GetNodeWriteable(pt).t1 = t; break; - case Direction::SouthWest: world.GetNodeWriteable(world.GetNeighbour(pt, Direction::West)).t2 = t; break; + case Direction::West: world.getNodeWriteable(world.getNeighbour(pt, Direction::NorthWest)).t1 = t; break; + case Direction::NorthWest: world.getNodeWriteable(world.getNeighbour(pt, Direction::NorthWest)).t2 = t; break; + case Direction::NorthEast: world.getNodeWriteable(world.getNeighbour(pt, Direction::NorthEast)).t1 = t; break; + case Direction::East: world.getNodeWriteable(pt).t2 = t; break; + case Direction::SouthEast: world.getNodeWriteable(pt).t1 = t; break; + case Direction::SouthWest: world.getNodeWriteable(world.getNeighbour(pt, Direction::West)).t2 = t; break; } } diff --git a/tests/s25Main/worldFixtures/CreateSeaWorld.cpp b/tests/s25Main/worldFixtures/CreateSeaWorld.cpp index 01b00df968..453f2f074c 100644 --- a/tests/s25Main/worldFixtures/CreateSeaWorld.cpp +++ b/tests/s25Main/worldFixtures/CreateSeaWorld.cpp @@ -22,18 +22,18 @@ bool PlaceHarbor(MapPoint pt, GameWorldBase& world, std::vector& harbo { // Harbor only at castles world.RecalcBQ(curPt); - if(world.GetNode(curPt).bq != BuildingQuality::Castle) + if(world.getNode(curPt).bq != BuildingQuality::Castle) continue; // We must have a coast around - for(const MapPoint posCoastPt : world.GetNeighbours(curPt)) + for(const MapPoint posCoastPt : world.getNeighbours(curPt)) { // Coast must not be water - if(world.IsWaterPoint(posCoastPt)) + if(world.isWaterPoint(posCoastPt)) continue; // LCOV_EXCL_LINE // But somewhere around must be a sea - for(const MapPoint posSeaPt : world.GetNeighbours(posCoastPt)) + for(const MapPoint posSeaPt : world.getNeighbours(posCoastPt)) { - if(world.IsSeaPoint(posSeaPt)) + if(world.isSeaPoint(posSeaPt)) { harbors.push_back(curPt); return true; @@ -50,13 +50,13 @@ bool CreateSeaWorld::operator()(GameWorld& world) const // For consistent results initGameRNG(0); - loadGameData(world.GetDescriptionWriteable()); + loadGameData(world.getDescriptionWriteable()); world.Init(size_); // Set everything to water - auto t = GetWaterTerrain(world.GetDescription()); + auto t = GetWaterTerrain(world.getDescription()); RTTR_FOREACH_PT(MapPoint, size_) { - MapNode& node = world.GetNodeWriteable(pt); + MapNode& node = world.getNodeWriteable(pt); node.t1 = node.t2 = t; } @@ -90,18 +90,18 @@ bool CreateSeaWorld::operator()(GameWorld& world) const if(minMapSide < minSize) throw std::runtime_error("World to small"); // LCOV_EXCL_LINE } - t = GetLandTerrain(world.GetDescription(), ETerrain::Buildable); + t = GetLandTerrain(world.getDescription(), ETerrain::Buildable); // Vertical for(MapPoint pt(offset, offset); pt.y < size_.y - offset; ++pt.y) { for(pt.x = offset; pt.x < offset + landSize; ++pt.x) { - MapNode& node = world.GetNodeWriteable(pt); + MapNode& node = world.getNodeWriteable(pt); node.t1 = node.t2 = t; } for(pt.x = size_.x - offset - landSize; pt.x < size_.x - offset; ++pt.x) { - MapNode& node = world.GetNodeWriteable(pt); + MapNode& node = world.getNodeWriteable(pt); node.t1 = node.t2 = t; } } @@ -110,12 +110,12 @@ bool CreateSeaWorld::operator()(GameWorld& world) const { for(pt.y = offset; pt.y < offset + landSize; ++pt.y) { - MapNode& node = world.GetNodeWriteable(pt); + MapNode& node = world.getNodeWriteable(pt); node.t1 = node.t2 = t; } for(pt.y = size_.y - offset - landSize; pt.y < size_.y - offset; ++pt.y) { - MapNode& node = world.GetNodeWriteable(pt); + MapNode& node = world.getNodeWriteable(pt); node.t1 = node.t2 = t; } } @@ -167,29 +167,29 @@ CreateWaterWorld::CreateWaterWorld(const MapExtent& size) : size_(size) {} bool CreateWaterWorld::operator()(GameWorld& world) const { // Only 2 players supported - RTTR_Assert(world.GetNumPlayers() <= 2u); - loadGameData(world.GetDescriptionWriteable()); + RTTR_Assert(world.getNumPlayers() <= 2u); + loadGameData(world.getDescriptionWriteable()); world.Init(size_); // Set everything to water - auto t = GetWaterTerrain(world.GetDescription()); + auto t = GetWaterTerrain(world.getDescription()); RTTR_FOREACH_PT(MapPoint, size_) { - MapNode& node = world.GetNodeWriteable(pt); + MapNode& node = world.getNodeWriteable(pt); node.t1 = node.t2 = t; } const unsigned landRadius = 8; std::vector hqPositions; hqPositions.push_back(MapPoint(10, 10)); - if(world.GetNumPlayers() > 1) + if(world.getNumPlayers() > 1) hqPositions.push_back(world.MakeMapPoint(hqPositions.front() + size_ / 2)); // LCOV_EXCL_LINE - t = GetLandTerrain(world.GetDescription(), ETerrain::Buildable); + t = GetLandTerrain(world.getDescription(), ETerrain::Buildable); for(MapPoint hqPos : hqPositions) { std::vector pts = world.GetPointsInRadiusWithCenter(hqPos, landRadius); for(MapPoint curPt : pts) { - MapNode& node = world.GetNodeWriteable(curPt); + MapNode& node = world.getNodeWriteable(curPt); node.t1 = node.t2 = t; } } diff --git a/tests/s25Main/worldFixtures/GCExecutor.cpp b/tests/s25Main/worldFixtures/GCExecutor.cpp index 334194f637..04982c8e5c 100644 --- a/tests/s25Main/worldFixtures/GCExecutor.cpp +++ b/tests/s25Main/worldFixtures/GCExecutor.cpp @@ -5,11 +5,11 @@ void GCExecutor::BuildRoadForBlds(const MapPoint bldPosFrom, const MapPoint bldPosTo) { - auto& world = GetWorld(); - const MapPoint start = world.GetNeighbour(bldPosFrom, Direction::SouthEast); - const MapPoint end = world.GetNeighbour(bldPosTo, Direction::SouthEast); + auto& world = getWorld(); + const MapPoint start = world.getNeighbour(bldPosFrom, Direction::SouthEast); + const MapPoint end = world.getNeighbour(bldPosTo, Direction::SouthEast); std::vector road = FindPathForRoad(world, start, end, false); BOOST_TEST_REQUIRE(!road.empty()); this->BuildRoad(start, false, road); - BOOST_TEST_REQUIRE(world.GetPointRoad(start, road.front()) == PointRoad::Normal); + BOOST_TEST_REQUIRE(world.getPointRoad(start, road.front()) == PointRoad::Normal); } diff --git a/tests/s25Main/worldFixtures/GCExecutor.h b/tests/s25Main/worldFixtures/GCExecutor.h index b949e8b6ed..44d880ce61 100644 --- a/tests/s25Main/worldFixtures/GCExecutor.h +++ b/tests/s25Main/worldFixtures/GCExecutor.h @@ -27,12 +27,12 @@ class GCExecutor : public GameCommandFactory gc->Serialize(ser2); BOOST_TEST_REQUIRE(ser2.GetLength() == ser.GetLength()); BOOST_TEST_REQUIRE(memcmp(ser2.GetData(), ser.GetData(), ser.GetLength()) == 0); - gc->Execute(GetWorld(), curPlayer); + gc->Execute(getWorld(), curPlayer); return true; } /// Constructs a road connecting 2 buildings and checks for success void BuildRoadForBlds(MapPoint bldPosFrom, MapPoint bldPosTo); - virtual GameWorld& GetWorld() = 0; + virtual GameWorld& getWorld() = 0; }; diff --git a/tests/s25Main/worldFixtures/MockLocalGameState.h b/tests/s25Main/worldFixtures/MockLocalGameState.h index 3840ca0929..0f6cc9c6cd 100644 --- a/tests/s25Main/worldFixtures/MockLocalGameState.h +++ b/tests/s25Main/worldFixtures/MockLocalGameState.h @@ -9,8 +9,8 @@ MOCK_BASE_CLASS(MockLocalGameState, ILocalGameState) { - MOCK_CONST_METHOD(GetPlayerId, 0); - MOCK_CONST_METHOD(IsHost, 0); + MOCK_CONST_METHOD(getPlayerId, 0); + MOCK_CONST_METHOD(isHost, 0); MOCK_CONST_METHOD(FormatGFTime, 1); MOCK_NON_CONST_METHOD(SystemChat, 1); }; diff --git a/tests/s25Main/worldFixtures/SeaWorldWithGCExecution.h b/tests/s25Main/worldFixtures/SeaWorldWithGCExecution.h index a556bb6b07..a08072b50e 100644 --- a/tests/s25Main/worldFixtures/SeaWorldWithGCExecution.h +++ b/tests/s25Main/worldFixtures/SeaWorldWithGCExecution.h @@ -16,5 +16,5 @@ class SeaWorldWithGCExecution : public WorldFixture::world; protected: - GameWorld& GetWorld() override { return world; } + GameWorld& getWorld() override { return world; } }; diff --git a/tests/s25Main/worldFixtures/TestEventManager.cpp b/tests/s25Main/worldFixtures/TestEventManager.cpp index b2f5f967d2..1cd80e91dc 100644 --- a/tests/s25Main/worldFixtures/TestEventManager.cpp +++ b/tests/s25Main/worldFixtures/TestEventManager.cpp @@ -9,22 +9,22 @@ unsigned TestEventManager::doExecuteNextEvent(unsigned maxGF) { - if(GetCurrentGF() >= maxGF) + if(getCurrentGF() >= maxGF) return 0; if(events.empty()) { - unsigned numGFs = maxGF - GetCurrentGF(); + unsigned numGFs = maxGF - getCurrentGF(); currentGF = maxGF; return numGFs; } auto itEvents = events.begin(); if(itEvents->first > maxGF) { - unsigned numGFs = maxGF - GetCurrentGF(); + unsigned numGFs = maxGF - getCurrentGF(); currentGF = maxGF; return numGFs; } - unsigned numGFs = itEvents->first - GetCurrentGF(); + unsigned numGFs = itEvents->first - getCurrentGF(); currentGF = itEvents->first; ExecuteEvents(itEvents); DestroyCurrentObjects(); @@ -48,7 +48,7 @@ unsigned TestEventManager::ExecuteNextEvent(unsigned maxGF) return numGFs; } -std::vector TestEventManager::GetObjEvents(const GameObject& obj) const +std::vector TestEventManager::getObjEvents(const GameObject& obj) const { std::vector objEvnts; for(const auto& event : events) @@ -62,7 +62,7 @@ std::vector TestEventManager::GetObjEvents(const GameObject& o return objEvnts; } -bool TestEventManager::IsEventActive(const GameObject& obj, const unsigned id) const +bool TestEventManager::isEventActive(const GameObject& obj, const unsigned id) const { for(const auto& event : events) { @@ -84,7 +84,7 @@ const GameEvent* TestEventManager::RescheduleEvent(const GameEvent* event, unsig return AddEventToQueue(event); } -std::vector TestEventManager::GetEvents() const +std::vector TestEventManager::getEvents() const { - return EventManager::GetEvents(); + return EventManager::getEvents(); } diff --git a/tests/s25Main/worldFixtures/TestEventManager.h b/tests/s25Main/worldFixtures/TestEventManager.h index 6902252b83..2cdb945a39 100644 --- a/tests/s25Main/worldFixtures/TestEventManager.h +++ b/tests/s25Main/worldFixtures/TestEventManager.h @@ -21,11 +21,11 @@ class TestEventManager : public EventManager /// no event was executed Returns the number of GFs executed unsigned ExecuteNextEvent(unsigned maxGF = std::numeric_limits::max()); /// Return all events of the given object - std::vector GetObjEvents(const GameObject& obj) const; + std::vector getObjEvents(const GameObject& obj) const; /// Check if there is already an event of the given id for this object - bool IsEventActive(const GameObject& obj, unsigned id) const; + bool isEventActive(const GameObject& obj, unsigned id) const; /// Remove the event and add a copy that is executed at the given GF const GameEvent* RescheduleEvent(const GameEvent* event, unsigned targetGF); - std::vector GetEvents() const; + std::vector getEvents() const; void setWorld(GameWorldBase& world) { world_ = &world; } }; diff --git a/tests/s25Main/worldFixtures/WorldFixture.h b/tests/s25Main/worldFixtures/WorldFixture.h index af630533bc..96b3822aa0 100644 --- a/tests/s25Main/worldFixtures/WorldFixture.h +++ b/tests/s25Main/worldFixtures/WorldFixture.h @@ -24,7 +24,7 @@ template unsigned rttr_exec_till_ct_gf(TestEventManager& em, unsigned maxGFs, T&& cond) { - const unsigned endGf = em.GetCurrentGF() + maxGFs; + const unsigned endGf = em.getCurrentGF() + maxGFs; unsigned gfsExecuted = 0; while(!cond()) { @@ -94,7 +94,7 @@ struct WorldFixtureBase GameWorld& world; WorldFixtureBase(unsigned numPlayers) : game(std::make_shared(GlobalGameSettings(), std::make_unique(), - std::vector(numPlayers, GetPlayer()))), + std::vector(numPlayers, getPlayer()))), em(static_cast(*game->em_)), ggs(const_cast(game->ggs_)), world(game->world_) { @@ -109,7 +109,7 @@ struct WorldFixtureBase /// Add start resources to HQ of the given player void addStartResources(unsigned playerIdx); - static PlayerInfo GetPlayer() + static PlayerInfo getPlayer() { PlayerInfo result; result.ps = PlayerState::Occupied; @@ -125,7 +125,7 @@ struct WorldFixture : WorldFixtureBase WorldFixture() : WorldFixtureBase(T_numPlayers), worldCreator(MapExtent(T_width, T_height)) { BOOST_TEST_REQUIRE(worldCreator(world)); - BOOST_TEST_REQUIRE(world.GetNumPlayers() == T_numPlayers); + BOOST_TEST_REQUIRE(world.getNumPlayers() == T_numPlayers); } }; @@ -134,7 +134,7 @@ class TestWorld : public World public: TestWorld() = default; TestWorld(const MapExtent size, DescIdx lt = DescIdx{1}) { Init(size, lt); } - using World::GetNodeInt; + using World::getNodeInt; protected: // LCOV_EXCL_START diff --git a/tests/s25Main/worldFixtures/WorldWithGCExecution.h b/tests/s25Main/worldFixtures/WorldWithGCExecution.h index 7578ea03ea..df8b7766c7 100644 --- a/tests/s25Main/worldFixtures/WorldWithGCExecution.h +++ b/tests/s25Main/worldFixtures/WorldWithGCExecution.h @@ -18,10 +18,10 @@ class WorldWithGCExecution : public WorldFixture; From c2229649e53655a71511cc23df395ff906d2b2cb Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Mon, 16 Nov 2026 12:46:38 +0100 Subject: [PATCH 5/7] Rename remaining methods to lowerCamelCase --- extras/ai-battle/HeadlessGame.cpp | 48 +- extras/ai-battle/HeadlessGame.h | 10 +- extras/ai-battle/main.cpp | 8 +- extras/audioDrivers/SDL/AudioSDL.cpp | 34 +- extras/audioDrivers/SDL/AudioSDL.h | 22 +- extras/replay-player/main.cpp | 2 +- extras/videoDrivers/SDL2/VideoSDL2.cpp | 78 +-- extras/videoDrivers/SDL2/VideoSDL2.h | 30 +- extras/videoDrivers/WinAPI/WinAPI.cpp | 72 +-- extras/videoDrivers/WinAPI/WinAPI.h | 34 +- libs/common/include/CollisionDetection.h | 2 +- libs/common/include/Point.h | 4 +- libs/common/src/CollisionDetection.cpp | 2 +- libs/driver/include/driver/AudioDriver.h | 10 +- libs/driver/include/driver/AudioInterface.h | 22 +- libs/driver/include/driver/VideoDriver.h | 2 +- .../driver/VideoDriverLoaderInterface.h | 2 +- libs/driver/include/driver/VideoInterface.h | 16 +- libs/driver/src/AudioDriver.cpp | 14 +- libs/driver/src/VideoDriver.cpp | 6 +- libs/libGamedata/lua/CampaignDataLoader.cpp | 4 +- libs/libGamedata/lua/CampaignDataLoader.h | 2 +- libs/libGamedata/lua/GameDataLoader.cpp | 16 +- libs/libGamedata/lua/GameDataLoader.h | 8 +- libs/s25client/s25client.cpp | 16 +- libs/s25main/AsyncChecksum.cpp | 2 +- libs/s25main/BuildingRegister.cpp | 46 +- libs/s25main/BuildingRegister.h | 16 +- libs/s25main/CatapultStone.cpp | 36 +- libs/s25main/CatapultStone.h | 6 +- libs/s25main/Cheats.cpp | 8 +- libs/s25main/DataChangedObservable.cpp | 10 +- libs/s25main/DataChangedObservable.h | 6 +- libs/s25main/Debug.cpp | 70 +-- libs/s25main/Debug.h | 20 +- libs/s25main/EconomyModeHandler.cpp | 20 +- libs/s25main/EconomyModeHandler.h | 10 +- libs/s25main/EventManager.cpp | 52 +- libs/s25main/EventManager.h | 26 +- libs/s25main/FOWObjects.cpp | 56 +- libs/s25main/FOWObjects.h | 12 +- libs/s25main/FileChecksum.cpp | 4 +- libs/s25main/FileChecksum.h | 12 +- libs/s25main/FoWObject.h | 2 +- libs/s25main/FramesInfo.cpp | 10 +- libs/s25main/FramesInfo.h | 4 +- libs/s25main/Game.cpp | 32 +- libs/s25main/Game.h | 10 +- libs/s25main/GameCommand.h | 2 +- libs/s25main/GameCommands.cpp | 108 ++-- libs/s25main/GameCommands.h | 70 +-- libs/s25main/GameEvent.cpp | 4 +- libs/s25main/GameLobbyController.cpp | 12 +- libs/s25main/GameLobbyController.h | 12 +- libs/s25main/GameManager.cpp | 50 +- libs/s25main/GameManager.h | 12 +- libs/s25main/GameObject.cpp | 14 +- libs/s25main/GameObject.h | 20 +- libs/s25main/GamePlayer.cpp | 444 +++++++------- libs/s25main/GamePlayer.h | 150 ++--- libs/s25main/GameSetup.cpp | 14 +- libs/s25main/GlobalGameSettings.cpp | 4 +- libs/s25main/GlobalGameSettings.h | 4 +- libs/s25main/HeadlessReplay.cpp | 14 +- libs/s25main/HeadlessReplay.h | 4 +- libs/s25main/IDataChangedListener.h | 2 +- libs/s25main/ILobbyClient.hpp | 8 +- libs/s25main/ILocalGameState.h | 8 +- libs/s25main/IngameMinimap.cpp | 52 +- libs/s25main/IngameMinimap.h | 20 +- libs/s25main/JoinPlayerInfo.cpp | 6 +- libs/s25main/JoinPlayerInfo.h | 4 +- libs/s25main/Loader.cpp | 46 +- libs/s25main/Loader.h | 24 +- libs/s25main/Messenger.cpp | 12 +- libs/s25main/Messenger.h | 4 +- libs/s25main/Minimap.cpp | 16 +- libs/s25main/Minimap.h | 10 +- libs/s25main/MusicPlayer.cpp | 18 +- libs/s25main/MusicPlayer.h | 8 +- libs/s25main/Pathfinding.cpp | 32 +- libs/s25main/Playlist.cpp | 8 +- libs/s25main/Playlist.h | 4 +- libs/s25main/PreviewMinimap.cpp | 24 +- libs/s25main/PreviewMinimap.h | 6 +- libs/s25main/QuickStartGame.cpp | 14 +- libs/s25main/QuickStartGame.h | 2 +- libs/s25main/Replay.cpp | 44 +- libs/s25main/Replay.h | 18 +- libs/s25main/ReplayPlayback.cpp | 6 +- libs/s25main/RoadSegment.cpp | 74 +-- libs/s25main/RoadSegment.h | 20 +- libs/s25main/RttrLobbyClient.cpp | 8 +- libs/s25main/RttrLobbyClient.hpp | 8 +- libs/s25main/SavedFile.cpp | 36 +- libs/s25main/SavedFile.h | 24 +- libs/s25main/Savegame.cpp | 36 +- libs/s25main/Savegame.h | 12 +- libs/s25main/SerializedGameData.cpp | 38 +- libs/s25main/SerializedGameData.h | 70 +-- libs/s25main/Settings.cpp | 26 +- libs/s25main/Settings.h | 14 +- libs/s25main/SignalHandler.cpp | 4 +- libs/s25main/SignalHandler.h | 4 +- libs/s25main/SoundManager.cpp | 24 +- libs/s25main/TerrainRenderer.cpp | 148 ++--- libs/s25main/TerrainRenderer.h | 40 +- libs/s25main/TradePathCache.cpp | 4 +- libs/s25main/Ware.cpp | 114 ++-- libs/s25main/Ware.h | 36 +- libs/s25main/Window.cpp | 208 +++---- libs/s25main/Window.h | 104 ++-- libs/s25main/WindowManager.cpp | 124 ++-- libs/s25main/WindowManager.h | 56 +- libs/s25main/addons/Addon.cpp | 4 +- libs/s25main/addons/AddonBool.cpp | 4 +- libs/s25main/addons/AddonList.cpp | 6 +- libs/s25main/ai/AIEventManager.cpp | 2 +- libs/s25main/ai/AIEventManager.h | 4 +- libs/s25main/ai/AIInterface.cpp | 26 +- libs/s25main/ai/AIInterface.h | 30 +- libs/s25main/ai/AIPlayer.h | 4 +- libs/s25main/ai/DummyAI.h | 4 +- libs/s25main/ai/aijh/AIConstruction.cpp | 92 +-- libs/s25main/ai/aijh/AIConstruction.h | 32 +- libs/s25main/ai/aijh/AIPlayerJH.cpp | 480 +++++++-------- libs/s25main/ai/aijh/AIPlayerJH.h | 126 ++-- libs/s25main/ai/aijh/AIResourceMap.cpp | 24 +- libs/s25main/ai/aijh/BuildingPlanner.cpp | 30 +- libs/s25main/ai/aijh/BuildingPlanner.h | 12 +- libs/s25main/ai/aijh/Jobs.cpp | 88 +-- libs/s25main/ai/aijh/Jobs.h | 18 +- libs/s25main/ai/aijh/PositionSearch.cpp | 2 +- libs/s25main/buildings/BurnedWarehouse.cpp | 24 +- libs/s25main/buildings/BurnedWarehouse.h | 6 +- libs/s25main/buildings/noBaseBuilding.cpp | 38 +- libs/s25main/buildings/noBaseBuilding.h | 12 +- libs/s25main/buildings/noBuilding.cpp | 22 +- libs/s25main/buildings/noBuilding.h | 14 +- libs/s25main/buildings/noBuildingSite.cpp | 102 ++-- libs/s25main/buildings/noBuildingSite.h | 22 +- libs/s25main/buildings/nobBaseMilitary.cpp | 108 ++-- libs/s25main/buildings/nobBaseMilitary.h | 38 +- libs/s25main/buildings/nobBaseWarehouse.cpp | 552 +++++++++--------- libs/s25main/buildings/nobBaseWarehouse.h | 94 +-- libs/s25main/buildings/nobHQ.cpp | 24 +- libs/s25main/buildings/nobHQ.h | 4 +- libs/s25main/buildings/nobHarborBuilding.cpp | 360 ++++++------ libs/s25main/buildings/nobHarborBuilding.h | 54 +- libs/s25main/buildings/nobMilitary.cpp | 392 ++++++------- libs/s25main/buildings/nobMilitary.h | 80 +-- libs/s25main/buildings/nobShipYard.cpp | 4 +- libs/s25main/buildings/nobStorehouse.cpp | 10 +- libs/s25main/buildings/nobStorehouse.h | 4 +- libs/s25main/buildings/nobTemple.cpp | 4 +- libs/s25main/buildings/nobUsual.cpp | 126 ++-- libs/s25main/buildings/nobUsual.h | 36 +- libs/s25main/controls/ctrlBaseImage.cpp | 10 +- libs/s25main/controls/ctrlBaseImage.h | 6 +- libs/s25main/controls/ctrlBaseTooltip.cpp | 12 +- libs/s25main/controls/ctrlBaseTooltip.h | 8 +- libs/s25main/controls/ctrlBuildingIcon.cpp | 8 +- libs/s25main/controls/ctrlBuildingIcon.h | 4 +- libs/s25main/controls/ctrlButton.cpp | 12 +- libs/s25main/controls/ctrlButton.h | 4 +- libs/s25main/controls/ctrlChat.cpp | 48 +- libs/s25main/controls/ctrlChat.h | 10 +- libs/s25main/controls/ctrlCheck.cpp | 14 +- libs/s25main/controls/ctrlCheck.h | 2 +- libs/s25main/controls/ctrlColorButton.cpp | 4 +- libs/s25main/controls/ctrlColorButton.h | 2 +- libs/s25main/controls/ctrlColorDeepening.cpp | 4 +- libs/s25main/controls/ctrlColorDeepening.h | 2 +- libs/s25main/controls/ctrlComboBox.cpp | 66 +-- libs/s25main/controls/ctrlComboBox.h | 10 +- libs/s25main/controls/ctrlDeepening.cpp | 6 +- libs/s25main/controls/ctrlDeepening.h | 4 +- libs/s25main/controls/ctrlEdit.cpp | 66 +-- libs/s25main/controls/ctrlEdit.h | 16 +- libs/s25main/controls/ctrlGroup.cpp | 16 +- libs/s25main/controls/ctrlGroup.h | 2 +- libs/s25main/controls/ctrlImage.cpp | 8 +- libs/s25main/controls/ctrlImage.h | 2 +- libs/s25main/controls/ctrlImageButton.cpp | 6 +- libs/s25main/controls/ctrlImageButton.h | 2 +- libs/s25main/controls/ctrlImageDeepening.cpp | 4 +- libs/s25main/controls/ctrlImageDeepening.h | 2 +- libs/s25main/controls/ctrlIngameMinimap.cpp | 22 +- libs/s25main/controls/ctrlIngameMinimap.h | 8 +- libs/s25main/controls/ctrlList.cpp | 38 +- libs/s25main/controls/ctrlList.h | 10 +- libs/s25main/controls/ctrlMapSelection.cpp | 16 +- libs/s25main/controls/ctrlMapSelection.h | 2 +- libs/s25main/controls/ctrlMinimap.cpp | 14 +- libs/s25main/controls/ctrlMinimap.h | 8 +- .../s25main/controls/ctrlMultiSelectGroup.cpp | 26 +- libs/s25main/controls/ctrlMultiSelectGroup.h | 6 +- libs/s25main/controls/ctrlMultiline.cpp | 42 +- libs/s25main/controls/ctrlMultiline.h | 14 +- libs/s25main/controls/ctrlOptionGroup.cpp | 14 +- libs/s25main/controls/ctrlPercent.cpp | 8 +- libs/s25main/controls/ctrlPercent.h | 2 +- libs/s25main/controls/ctrlPreviewMinimap.cpp | 10 +- libs/s25main/controls/ctrlPreviewMinimap.h | 2 +- libs/s25main/controls/ctrlProgress.cpp | 34 +- libs/s25main/controls/ctrlProgress.h | 6 +- libs/s25main/controls/ctrlScrollBar.cpp | 58 +- libs/s25main/controls/ctrlScrollBar.h | 12 +- libs/s25main/controls/ctrlTab.cpp | 30 +- libs/s25main/controls/ctrlTab.h | 6 +- libs/s25main/controls/ctrlTable.cpp | 50 +- libs/s25main/controls/ctrlTable.h | 14 +- libs/s25main/controls/ctrlText.cpp | 4 +- libs/s25main/controls/ctrlText.h | 2 +- libs/s25main/controls/ctrlTextButton.cpp | 10 +- libs/s25main/controls/ctrlTextButton.h | 4 +- libs/s25main/controls/ctrlTextDeepening.cpp | 12 +- libs/s25main/controls/ctrlTextDeepening.h | 6 +- libs/s25main/controls/ctrlTimer.cpp | 8 +- libs/s25main/controls/ctrlTimer.h | 8 +- libs/s25main/controls/ctrlVarDeepening.cpp | 4 +- libs/s25main/controls/ctrlVarDeepening.h | 2 +- libs/s25main/controls/ctrlVarText.cpp | 4 +- libs/s25main/controls/ctrlVarText.h | 2 +- libs/s25main/customborderbuilder.cpp | 40 +- libs/s25main/customborderbuilder.h | 8 +- libs/s25main/desktops/Desktop.cpp | 20 +- libs/s25main/desktops/Desktop.h | 4 +- libs/s25main/desktops/dskBenchmark.cpp | 40 +- .../desktops/dskCampaignMissionSelection.cpp | 50 +- .../desktops/dskCampaignMissionSelection.h | 6 +- .../s25main/desktops/dskCampaignSelection.cpp | 42 +- libs/s25main/desktops/dskCampaignSelection.h | 4 +- libs/s25main/desktops/dskCredits.cpp | 68 +-- libs/s25main/desktops/dskCredits.h | 12 +- libs/s25main/desktops/dskDirectIP.cpp | 14 +- libs/s25main/desktops/dskGameInterface.cpp | 410 ++++++------- libs/s25main/desktops/dskGameInterface.h | 38 +- libs/s25main/desktops/dskGameLoader.cpp | 32 +- libs/s25main/desktops/dskGameLoader.h | 2 +- libs/s25main/desktops/dskGameLobby.cpp | 302 +++++----- libs/s25main/desktops/dskGameLobby.h | 22 +- libs/s25main/desktops/dskIntro.cpp | 4 +- libs/s25main/desktops/dskLAN.cpp | 42 +- libs/s25main/desktops/dskLAN.h | 6 +- libs/s25main/desktops/dskLobby.cpp | 78 +-- libs/s25main/desktops/dskLobby.h | 6 +- libs/s25main/desktops/dskMainMenu.cpp | 26 +- libs/s25main/desktops/dskMenuBase.cpp | 12 +- libs/s25main/desktops/dskMenuBase.h | 2 +- libs/s25main/desktops/dskMultiPlayer.cpp | 12 +- libs/s25main/desktops/dskOptions.cpp | 186 +++--- libs/s25main/desktops/dskSelectMap.cpp | 108 ++-- libs/s25main/desktops/dskSelectMap.h | 12 +- libs/s25main/desktops/dskSinglePlayer.cpp | 34 +- libs/s25main/desktops/dskSinglePlayer.h | 4 +- libs/s25main/desktops/dskSplash.cpp | 16 +- libs/s25main/desktops/dskSplash.h | 2 +- libs/s25main/desktops/dskTest.cpp | 48 +- libs/s25main/desktops/dskTest.h | 2 +- libs/s25main/desktops/dskTextureTest.cpp | 18 +- libs/s25main/drivers/AudioDriverWrapper.cpp | 52 +- libs/s25main/drivers/AudioDriverWrapper.h | 24 +- libs/s25main/drivers/DriverWrapper.cpp | 12 +- libs/s25main/drivers/DriverWrapper.h | 6 +- libs/s25main/drivers/VideoDriverWrapper.cpp | 84 +-- libs/s25main/drivers/VideoDriverWrapper.h | 36 +- libs/s25main/factories/AIFactory.cpp | 2 +- libs/s25main/factories/AIFactory.h | 2 +- libs/s25main/factories/BuildingFactory.cpp | 4 +- libs/s25main/factories/BuildingFactory.h | 2 +- libs/s25main/factories/GameCommandFactory.cpp | 78 +-- libs/s25main/factories/GameCommandFactory.h | 6 +- libs/s25main/factories/JobFactory.cpp | 2 +- libs/s25main/factories/JobFactory.h | 2 +- libs/s25main/figures/noFigure.cpp | 324 +++++----- libs/s25main/figures/noFigure.h | 80 +-- libs/s25main/figures/nofActiveSoldier.cpp | 120 ++-- libs/s25main/figures/nofActiveSoldier.h | 46 +- .../s25main/figures/nofAggressiveDefender.cpp | 106 ++-- libs/s25main/figures/nofAggressiveDefender.h | 30 +- libs/s25main/figures/nofArmorer.cpp | 22 +- libs/s25main/figures/nofArmorer.h | 8 +- libs/s25main/figures/nofAttacker.cpp | 356 +++++------ libs/s25main/figures/nofAttacker.h | 62 +- libs/s25main/figures/nofBaker.cpp | 20 +- libs/s25main/figures/nofBaker.h | 4 +- libs/s25main/figures/nofBrewer.cpp | 8 +- libs/s25main/figures/nofBrewer.h | 4 +- libs/s25main/figures/nofBuilder.cpp | 84 +-- libs/s25main/figures/nofBuilder.h | 20 +- libs/s25main/figures/nofBuildingWorker.cpp | 124 ++-- libs/s25main/figures/nofBuildingWorker.h | 38 +- libs/s25main/figures/nofButcher.cpp | 8 +- libs/s25main/figures/nofButcher.h | 4 +- libs/s25main/figures/nofCarpenter.cpp | 8 +- libs/s25main/figures/nofCarpenter.h | 4 +- libs/s25main/figures/nofCarrier.cpp | 242 ++++---- libs/s25main/figures/nofCarrier.h | 36 +- libs/s25main/figures/nofCatapultMan.cpp | 38 +- libs/s25main/figures/nofCatapultMan.h | 8 +- libs/s25main/figures/nofCharburner.cpp | 46 +- libs/s25main/figures/nofCharburner.h | 14 +- libs/s25main/figures/nofDefender.cpp | 56 +- libs/s25main/figures/nofDefender.h | 24 +- libs/s25main/figures/nofDonkeybreeder.cpp | 26 +- libs/s25main/figures/nofDonkeybreeder.h | 6 +- libs/s25main/figures/nofFarmer.cpp | 28 +- libs/s25main/figures/nofFarmer.h | 8 +- libs/s25main/figures/nofFarmhand.cpp | 72 +-- libs/s25main/figures/nofFarmhand.h | 20 +- libs/s25main/figures/nofFisher.cpp | 18 +- libs/s25main/figures/nofFisher.h | 6 +- libs/s25main/figures/nofFlagWorker.cpp | 40 +- libs/s25main/figures/nofFlagWorker.h | 8 +- libs/s25main/figures/nofForester.cpp | 16 +- libs/s25main/figures/nofForester.h | 6 +- libs/s25main/figures/nofGeologist.cpp | 96 +-- libs/s25main/figures/nofGeologist.h | 14 +- libs/s25main/figures/nofHunter.cpp | 160 ++--- libs/s25main/figures/nofHunter.h | 32 +- libs/s25main/figures/nofIronfounder.cpp | 8 +- libs/s25main/figures/nofIronfounder.h | 4 +- libs/s25main/figures/nofLeatherWorker.cpp | 12 +- libs/s25main/figures/nofLeatherWorker.h | 6 +- libs/s25main/figures/nofMetalworker.cpp | 34 +- libs/s25main/figures/nofMetalworker.h | 10 +- libs/s25main/figures/nofMiller.cpp | 24 +- libs/s25main/figures/nofMiller.h | 4 +- libs/s25main/figures/nofMiner.cpp | 32 +- libs/s25main/figures/nofMiner.h | 8 +- libs/s25main/figures/nofMinter.cpp | 10 +- libs/s25main/figures/nofMinter.h | 4 +- libs/s25main/figures/nofPassiveSoldier.cpp | 50 +- libs/s25main/figures/nofPassiveSoldier.h | 20 +- libs/s25main/figures/nofPassiveWorker.cpp | 14 +- libs/s25main/figures/nofPassiveWorker.h | 10 +- libs/s25main/figures/nofPigbreeder.cpp | 14 +- libs/s25main/figures/nofPigbreeder.h | 6 +- libs/s25main/figures/nofPlaner.cpp | 62 +- libs/s25main/figures/nofPlaner.h | 12 +- libs/s25main/figures/nofScout_Free.cpp | 48 +- libs/s25main/figures/nofScout_Free.h | 14 +- .../s25main/figures/nofScout_LookoutTower.cpp | 18 +- libs/s25main/figures/nofScout_LookoutTower.h | 12 +- libs/s25main/figures/nofShipWright.cpp | 88 +-- libs/s25main/figures/nofShipWright.h | 22 +- libs/s25main/figures/nofSkinner.cpp | 108 ++-- libs/s25main/figures/nofSkinner.h | 24 +- libs/s25main/figures/nofSoldier.cpp | 12 +- libs/s25main/figures/nofSoldier.h | 8 +- libs/s25main/figures/nofStonemason.cpp | 16 +- libs/s25main/figures/nofStonemason.h | 6 +- libs/s25main/figures/nofTanner.cpp | 12 +- libs/s25main/figures/nofTanner.h | 6 +- libs/s25main/figures/nofTempleServant.cpp | 20 +- libs/s25main/figures/nofTempleServant.h | 6 +- libs/s25main/figures/nofTradeDonkey.cpp | 48 +- libs/s25main/figures/nofTradeDonkey.h | 18 +- libs/s25main/figures/nofTradeLeader.cpp | 50 +- libs/s25main/figures/nofTradeLeader.h | 18 +- libs/s25main/figures/nofVintner.cpp | 12 +- libs/s25main/figures/nofVintner.h | 6 +- libs/s25main/figures/nofWarehouseWorker.cpp | 66 +-- libs/s25main/figures/nofWarehouseWorker.h | 18 +- libs/s25main/figures/nofWellguy.cpp | 38 +- libs/s25main/figures/nofWellguy.h | 8 +- libs/s25main/figures/nofWinegrower.cpp | 46 +- libs/s25main/figures/nofWinegrower.h | 16 +- libs/s25main/figures/nofWoodcutter.cpp | 22 +- libs/s25main/figures/nofWoodcutter.h | 8 +- libs/s25main/figures/nofWorkman.cpp | 38 +- libs/s25main/figures/nofWorkman.h | 18 +- libs/s25main/gameData/ApplicationLoader.cpp | 2 +- libs/s25main/gameData/GameLoader.cpp | 2 +- libs/s25main/gameTypes/CompressedData.cpp | 8 +- libs/s25main/gameTypes/CompressedData.h | 6 +- libs/s25main/gameTypes/FoWNode.cpp | 8 +- libs/s25main/gameTypes/Inventory.h | 12 +- libs/s25main/gameTypes/InventorySetting.h | 32 +- libs/s25main/gameTypes/MapInfo.cpp | 8 +- libs/s25main/gameTypes/MapInfo.h | 2 +- libs/s25main/gameTypes/MapNode.cpp | 10 +- libs/s25main/gameTypes/VirtualInventory.h | 36 +- libs/s25main/ingameWindows/IngameWindow.cpp | 106 ++-- libs/s25main/ingameWindows/IngameWindow.h | 22 +- .../TransmitSettingsIgwAdapter.cpp | 16 +- .../TransmitSettingsIgwAdapter.h | 6 +- libs/s25main/ingameWindows/iwAIDebug.cpp | 56 +- libs/s25main/ingameWindows/iwAction.cpp | 174 +++--- libs/s25main/ingameWindows/iwAction.h | 10 +- libs/s25main/ingameWindows/iwAddonPresets.cpp | 66 +-- libs/s25main/ingameWindows/iwAddonPresets.h | 14 +- libs/s25main/ingameWindows/iwAddons.cpp | 54 +- libs/s25main/ingameWindows/iwAddons.h | 4 +- .../s25main/ingameWindows/iwBaseWarehouse.cpp | 66 +-- libs/s25main/ingameWindows/iwBaseWarehouse.h | 8 +- libs/s25main/ingameWindows/iwBuildOrder.cpp | 32 +- libs/s25main/ingameWindows/iwBuildOrder.h | 4 +- libs/s25main/ingameWindows/iwBuilding.cpp | 56 +- .../iwBuildingProductivities.cpp | 16 +- .../ingameWindows/iwBuildingProductivities.h | 2 +- libs/s25main/ingameWindows/iwBuildingSite.cpp | 26 +- libs/s25main/ingameWindows/iwBuildings.cpp | 26 +- libs/s25main/ingameWindows/iwBuildings.h | 2 +- libs/s25main/ingameWindows/iwChat.cpp | 14 +- libs/s25main/ingameWindows/iwChat.h | 2 +- libs/s25main/ingameWindows/iwConnecting.cpp | 20 +- libs/s25main/ingameWindows/iwConnecting.h | 2 +- .../ingameWindows/iwDemolishBuilding.cpp | 18 +- libs/s25main/ingameWindows/iwDiplomacy.cpp | 48 +- .../ingameWindows/iwDirectIPConnect.cpp | 36 +- .../s25main/ingameWindows/iwDirectIPConnect.h | 2 +- .../ingameWindows/iwDirectIPCreate.cpp | 28 +- libs/s25main/ingameWindows/iwDistribution.cpp | 34 +- libs/s25main/ingameWindows/iwDistribution.h | 8 +- .../ingameWindows/iwEconomicProgress.cpp | 28 +- .../ingameWindows/iwEconomicProgress.h | 2 +- libs/s25main/ingameWindows/iwEndgame.cpp | 12 +- libs/s25main/ingameWindows/iwHQ.cpp | 14 +- .../ingameWindows/iwHarborBuilding.cpp | 22 +- libs/s25main/ingameWindows/iwHarborBuilding.h | 4 +- libs/s25main/ingameWindows/iwHelp.cpp | 10 +- libs/s25main/ingameWindows/iwLobbyConnect.cpp | 36 +- libs/s25main/ingameWindows/iwLobbyConnect.h | 2 +- .../ingameWindows/iwLobbyServerInfo.cpp | 20 +- .../s25main/ingameWindows/iwLobbyServerInfo.h | 2 +- libs/s25main/ingameWindows/iwMainMenu.cpp | 66 +-- libs/s25main/ingameWindows/iwMapDebug.cpp | 54 +- libs/s25main/ingameWindows/iwMapGenerator.cpp | 100 ++-- libs/s25main/ingameWindows/iwMapGenerator.h | 4 +- .../ingameWindows/iwMerchandiseStatistics.cpp | 118 ++-- .../ingameWindows/iwMerchandiseStatistics.h | 8 +- libs/s25main/ingameWindows/iwMilitary.cpp | 36 +- libs/s25main/ingameWindows/iwMilitary.h | 6 +- .../ingameWindows/iwMilitaryBuilding.cpp | 88 +-- .../ingameWindows/iwMilitaryBuilding.h | 4 +- libs/s25main/ingameWindows/iwMinimap.cpp | 24 +- libs/s25main/ingameWindows/iwMinimap.h | 2 +- .../ingameWindows/iwMissionStatement.cpp | 14 +- libs/s25main/ingameWindows/iwMsgbox.cpp | 40 +- libs/s25main/ingameWindows/iwMsgbox.h | 4 +- libs/s25main/ingameWindows/iwMusicPlayer.cpp | 116 ++-- libs/s25main/ingameWindows/iwMusicPlayer.h | 12 +- libs/s25main/ingameWindows/iwObservate.cpp | 78 +-- libs/s25main/ingameWindows/iwObservate.h | 6 +- .../s25main/ingameWindows/iwOptionsWindow.cpp | 62 +- libs/s25main/ingameWindows/iwPlayReplay.cpp | 62 +- libs/s25main/ingameWindows/iwPlayReplay.h | 4 +- libs/s25main/ingameWindows/iwPleaseWait.cpp | 2 +- libs/s25main/ingameWindows/iwPostWindow.cpp | 112 ++-- libs/s25main/ingameWindows/iwPostWindow.h | 8 +- libs/s25main/ingameWindows/iwRoadWindow.cpp | 6 +- libs/s25main/ingameWindows/iwSave.cpp | 54 +- libs/s25main/ingameWindows/iwSave.h | 8 +- libs/s25main/ingameWindows/iwSettings.cpp | 60 +- libs/s25main/ingameWindows/iwShip.cpp | 60 +- libs/s25main/ingameWindows/iwShip.h | 4 +- libs/s25main/ingameWindows/iwSkipGFs.cpp | 24 +- libs/s25main/ingameWindows/iwSkipGFs.h | 2 +- libs/s25main/ingameWindows/iwStatistics.cpp | 84 +-- libs/s25main/ingameWindows/iwStatistics.h | 12 +- libs/s25main/ingameWindows/iwSurrender.cpp | 12 +- .../ingameWindows/iwTempleBuilding.cpp | 2 +- libs/s25main/ingameWindows/iwTextfile.cpp | 6 +- libs/s25main/ingameWindows/iwTools.cpp | 48 +- libs/s25main/ingameWindows/iwTools.h | 10 +- libs/s25main/ingameWindows/iwTrade.cpp | 32 +- libs/s25main/ingameWindows/iwTransport.cpp | 42 +- libs/s25main/ingameWindows/iwTransport.h | 4 +- libs/s25main/ingameWindows/iwVictory.cpp | 18 +- libs/s25main/ingameWindows/iwWares.cpp | 32 +- libs/s25main/ingameWindows/iwWares.h | 2 +- libs/s25main/lua/LuaInterfaceGame.cpp | 70 +-- libs/s25main/lua/LuaInterfaceGame.h | 36 +- libs/s25main/lua/LuaInterfaceGameBase.cpp | 20 +- libs/s25main/lua/LuaInterfaceGameBase.h | 10 +- libs/s25main/lua/LuaInterfaceSettings.cpp | 26 +- libs/s25main/lua/LuaInterfaceSettings.h | 14 +- libs/s25main/lua/LuaPlayer.cpp | 54 +- libs/s25main/lua/LuaPlayer.h | 18 +- libs/s25main/lua/LuaServerPlayer.cpp | 6 +- libs/s25main/lua/LuaServerPlayer.h | 2 +- libs/s25main/lua/LuaWorld.cpp | 30 +- libs/s25main/lua/LuaWorld.h | 6 +- libs/s25main/mapGenerator/Algorithms.cpp | 4 +- libs/s25main/mapGenerator/Algorithms.h | 14 +- libs/s25main/mapGenerator/Harbors.cpp | 18 +- libs/s25main/mapGenerator/Harbors.h | 4 +- libs/s25main/mapGenerator/HeadQuarters.cpp | 10 +- libs/s25main/mapGenerator/HeadQuarters.h | 8 +- libs/s25main/mapGenerator/Islands.cpp | 12 +- libs/s25main/mapGenerator/Islands.h | 2 +- libs/s25main/mapGenerator/Map.cpp | 14 +- libs/s25main/mapGenerator/Map.h | 2 +- libs/s25main/mapGenerator/MapSettings.cpp | 2 +- libs/s25main/mapGenerator/MapSettings.h | 2 +- libs/s25main/mapGenerator/RandomMap.cpp | 112 ++-- libs/s25main/mapGenerator/RandomMap.h | 18 +- libs/s25main/mapGenerator/RandomUtility.cpp | 12 +- libs/s25main/mapGenerator/RandomUtility.h | 12 +- libs/s25main/mapGenerator/Resources.cpp | 46 +- libs/s25main/mapGenerator/Resources.h | 6 +- libs/s25main/mapGenerator/Rivers.cpp | 10 +- libs/s25main/mapGenerator/Rivers.h | 2 +- libs/s25main/mapGenerator/Terrain.cpp | 10 +- libs/s25main/mapGenerator/Terrain.h | 4 +- libs/s25main/mapGenerator/TextureHelper.cpp | 2 +- libs/s25main/mapGenerator/TextureHelper.h | 2 +- libs/s25main/mapGenerator/Textures.cpp | 52 +- libs/s25main/mapGenerator/Textures.h | 36 +- libs/s25main/mapGenerator/Triangles.cpp | 2 +- libs/s25main/mapGenerator/Triangles.h | 2 +- libs/s25main/network/ClientError.cpp | 2 +- libs/s25main/network/ClientError.h | 2 +- libs/s25main/network/GameClient.cpp | 386 ++++++------ libs/s25main/network/GameClient.h | 158 ++--- libs/s25main/network/GameClientCommands.cpp | 4 +- libs/s25main/network/GameClientGF_Game.cpp | 8 +- libs/s25main/network/GameClientGF_Replay.cpp | 2 +- libs/s25main/network/GameMessage.cpp | 2 +- libs/s25main/network/GameMessage.h | 2 +- libs/s25main/network/GameMessageInterface.h | 2 +- libs/s25main/network/GameMessage_Chat.cpp | 4 +- libs/s25main/network/GameMessage_Chat.h | 2 +- .../network/GameMessage_GameCommand.cpp | 4 +- .../s25main/network/GameMessage_GameCommand.h | 2 +- libs/s25main/network/GameMessages.cpp | 4 +- libs/s25main/network/GameMessages.h | 128 ++-- libs/s25main/network/GameServer.cpp | 338 +++++------ libs/s25main/network/GameServer.h | 108 ++-- libs/s25main/network/IGameLobbyController.h | 4 +- libs/s25main/nodeObjs/noAnimal.cpp | 92 +-- libs/s25main/nodeObjs/noAnimal.h | 34 +- libs/s25main/nodeObjs/noBase.cpp | 6 +- libs/s25main/nodeObjs/noBase.h | 4 +- libs/s25main/nodeObjs/noCharburnerPile.cpp | 60 +- libs/s25main/nodeObjs/noCharburnerPile.h | 8 +- libs/s25main/nodeObjs/noCoordBase.cpp | 2 +- .../nodeObjs/noDisappearingEnvObject.cpp | 22 +- .../nodeObjs/noDisappearingEnvObject.h | 4 +- .../nodeObjs/noDisappearingMapEnvObject.cpp | 6 +- .../nodeObjs/noDisappearingMapEnvObject.h | 2 +- libs/s25main/nodeObjs/noExtension.cpp | 4 +- libs/s25main/nodeObjs/noExtension.h | 4 +- libs/s25main/nodeObjs/noFighting.cpp | 74 +-- libs/s25main/nodeObjs/noFighting.h | 8 +- libs/s25main/nodeObjs/noFire.cpp | 28 +- libs/s25main/nodeObjs/noFire.h | 6 +- libs/s25main/nodeObjs/noFlag.cpp | 56 +- libs/s25main/nodeObjs/noFlag.h | 18 +- libs/s25main/nodeObjs/noGrainfield.cpp | 44 +- libs/s25main/nodeObjs/noGrainfield.h | 10 +- libs/s25main/nodeObjs/noGranite.cpp | 10 +- libs/s25main/nodeObjs/noGranite.h | 8 +- libs/s25main/nodeObjs/noGrapefield.cpp | 44 +- libs/s25main/nodeObjs/noGrapefield.h | 10 +- libs/s25main/nodeObjs/noMovable.cpp | 30 +- libs/s25main/nodeObjs/noMovable.h | 12 +- libs/s25main/nodeObjs/noNothing.h | 4 +- libs/s25main/nodeObjs/noRoadNode.cpp | 22 +- libs/s25main/nodeObjs/noRoadNode.h | 6 +- libs/s25main/nodeObjs/noShip.cpp | 290 ++++----- libs/s25main/nodeObjs/noShip.h | 56 +- libs/s25main/nodeObjs/noShipBuildingSite.cpp | 30 +- libs/s25main/nodeObjs/noShipBuildingSite.h | 6 +- libs/s25main/nodeObjs/noSign.cpp | 6 +- libs/s25main/nodeObjs/noSign.h | 2 +- libs/s25main/nodeObjs/noSkeleton.cpp | 22 +- libs/s25main/nodeObjs/noSkeleton.h | 6 +- libs/s25main/nodeObjs/noStaticObject.cpp | 14 +- libs/s25main/nodeObjs/noStaticObject.h | 4 +- libs/s25main/nodeObjs/noTree.cpp | 58 +- libs/s25main/nodeObjs/noTree.h | 20 +- libs/s25main/ogl/DummyRenderer.h | 8 +- libs/s25main/ogl/IRenderer.h | 8 +- libs/s25main/ogl/ITexture.h | 4 +- libs/s25main/ogl/MusicItem.cpp | 4 +- libs/s25main/ogl/MusicItem.h | 2 +- libs/s25main/ogl/OpenGLRenderer.cpp | 14 +- libs/s25main/ogl/OpenGLRenderer.h | 8 +- libs/s25main/ogl/SoundEffectItem.cpp | 4 +- libs/s25main/ogl/SoundEffectItem.h | 2 +- libs/s25main/ogl/constants.h | 2 +- libs/s25main/ogl/glArchivItem_Bitmap.cpp | 28 +- libs/s25main/ogl/glArchivItem_Bitmap.h | 16 +- libs/s25main/ogl/glArchivItem_BitmapBase.cpp | 20 +- libs/s25main/ogl/glArchivItem_BitmapBase.h | 8 +- .../ogl/glArchivItem_Bitmap_Direct.cpp | 2 +- .../ogl/glArchivItem_Bitmap_Player.cpp | 26 +- libs/s25main/ogl/glArchivItem_Bitmap_Player.h | 14 +- libs/s25main/ogl/glArchivItem_Bob.cpp | 6 +- libs/s25main/ogl/glArchivItem_Bob.h | 2 +- libs/s25main/ogl/glArchivItem_Sound_Midi.cpp | 2 +- libs/s25main/ogl/glArchivItem_Sound_Other.cpp | 2 +- libs/s25main/ogl/glArchivItem_Sound_Wave.cpp | 2 +- libs/s25main/ogl/glArchivItem_Sound_XMidi.cpp | 2 +- libs/s25main/ogl/glFont.cpp | 30 +- libs/s25main/ogl/glFont.h | 12 +- libs/s25main/ogl/glSmartBitmap.cpp | 10 +- libs/s25main/ogl/glSmartBitmap.h | 4 +- libs/s25main/ogl/glTexturePacker.cpp | 10 +- libs/s25main/pathfinding/FindPathForRoad.cpp | 2 +- .../s25main/pathfinding/FindPathReachable.cpp | 4 +- libs/s25main/pathfinding/FindPathReachable.h | 2 +- libs/s25main/pathfinding/FreePathFinder.cpp | 16 +- libs/s25main/pathfinding/FreePathFinder.h | 8 +- libs/s25main/pathfinding/FreePathFinderImpl.h | 10 +- libs/s25main/pathfinding/OpenListBinaryHeap.h | 26 +- libs/s25main/pathfinding/RoadPathFinder.cpp | 28 +- libs/s25main/pathfinding/RoadPathFinder.h | 6 +- libs/s25main/pathfinding/ShipPathData.cpp | 2 +- .../postSystem/DiplomacyPostQuestion.cpp | 2 +- libs/s25main/postSystem/PostBox.cpp | 18 +- libs/s25main/postSystem/PostBox.h | 14 +- libs/s25main/postSystem/PostManager.cpp | 8 +- libs/s25main/postSystem/PostManager.h | 6 +- libs/s25main/postSystem/PostMsg.cpp | 4 +- libs/s25main/postSystem/PostMsgWithBuilding.h | 2 +- libs/s25main/random/Random.cpp | 10 +- libs/s25main/random/Random.h | 12 +- libs/s25main/world/GameWorld.cpp | 198 +++---- libs/s25main/world/GameWorld.h | 52 +- libs/s25main/world/GameWorldBase.cpp | 60 +- libs/s25main/world/GameWorldBase.h | 28 +- libs/s25main/world/GameWorldView.cpp | 166 +++--- libs/s25main/world/GameWorldView.h | 60 +- libs/s25main/world/GameWorldViewer.cpp | 58 +- libs/s25main/world/GameWorldViewer.h | 18 +- libs/s25main/world/MapBase.cpp | 16 +- libs/s25main/world/MapBase.h | 18 +- libs/s25main/world/MapGeometry.cpp | 2 +- libs/s25main/world/MapGeometry.h | 2 +- libs/s25main/world/MapLoader.cpp | 64 +- libs/s25main/world/MapLoader.h | 26 +- libs/s25main/world/MapSerializer.cpp | 16 +- libs/s25main/world/MilitarySquares.cpp | 6 +- libs/s25main/world/MilitarySquares.h | 6 +- libs/s25main/world/NodeMapBase.h | 12 +- libs/s25main/world/TerritoryRegion.cpp | 34 +- libs/s25main/world/TerritoryRegion.h | 16 +- libs/s25main/world/TradePath.cpp | 6 +- libs/s25main/world/TradeRoute.cpp | 16 +- libs/s25main/world/TradeRoute.h | 4 +- libs/s25main/world/World.cpp | 56 +- libs/s25main/world/World.h | 36 +- tests/common/testCollisionDetection.cpp | 40 +- tests/common/testMathHelpers.cpp | 2 +- tests/legacyFiles/src/legacy/TerrainData.cpp | 4 +- tests/legacyFiles/src/legacy/TerrainData.h | 4 +- tests/mockupDrivers/MockupAudioDriver.h | 18 +- tests/mockupDrivers/MockupVideoDriver.cpp | 14 +- tests/mockupDrivers/MockupVideoDriver.h | 18 +- tests/s25Main/UI/testAnimations.cpp | 16 +- tests/s25Main/UI/testComboBox.cpp | 26 +- tests/s25Main/UI/testControls.cpp | 30 +- tests/s25Main/UI/testDskGameLobby.cpp | 22 +- tests/s25Main/UI/testFont.cpp | 12 +- tests/s25Main/UI/testImageButton.cpp | 20 +- tests/s25Main/UI/testIngameWindow.cpp | 62 +- tests/s25Main/UI/testSmartBitmap.cpp | 2 +- tests/s25Main/UI/testTerrainRenderer.cpp | 24 +- tests/s25Main/UI/testTexturePacker.cpp | 2 +- tests/s25Main/UI/testVideoDriver.cpp | 40 +- tests/s25Main/UI/testWindowManager.cpp | 364 ++++++------ tests/s25Main/UI/testWindows.cpp | 16 +- .../UI/uiHelper/uiHelper/uiHelpers.cpp | 12 +- tests/s25Main/audio/LoadMockupAudio.h | 4 +- tests/s25Main/audio/testPlaylist.cpp | 2 +- tests/s25Main/audio/testSoundManager.cpp | 14 +- tests/s25Main/audio/testSounds.cpp | 74 +-- tests/s25Main/autoplay/main.cpp | 2 +- .../s25Main/benchmarks/RealWorld_MapTests.cpp | 6 +- tests/s25Main/drivers/testDriverWrapper.cpp | 14 +- tests/s25Main/integration/testAI.cpp | 122 ++-- tests/s25Main/integration/testArmor.cpp | 8 +- tests/s25Main/integration/testAttacking.cpp | 294 +++++----- .../s25Main/integration/testBaseWarehouse.cpp | 44 +- .../integration/testBoundaryStones.cpp | 2 +- tests/s25Main/integration/testBuilding.cpp | 32 +- .../s25Main/integration/testBuildingProps.cpp | 6 +- .../integration/testBuildingRadius.cpp | 32 +- .../integration/testCheatCommandTracker.cpp | 2 +- tests/s25Main/integration/testCheats.cpp | 4 +- .../testDisappearingMapObjects.cpp | 30 +- .../integration/testDskGameInterface.cpp | 22 +- tests/s25Main/integration/testEconomyMode.cpp | 36 +- .../integration/testEmergencyProtocol.cpp | 12 +- tests/s25Main/integration/testFarmer.cpp | 8 +- tests/s25Main/integration/testFigures.cpp | 18 +- .../integration/testFrontierDistance.cpp | 54 +- .../s25Main/integration/testGameCommands.cpp | 44 +- tests/s25Main/integration/testGameEvents.cpp | 86 +-- tests/s25Main/integration/testGamePlayer.cpp | 46 +- .../s25Main/integration/testGameWorldView.cpp | 20 +- tests/s25Main/integration/testHarbor.cpp | 8 +- .../integration/testHeadlessReplay.cpp | 16 +- tests/s25Main/integration/testPacts.cpp | 18 +- tests/s25Main/integration/testPathfinding.cpp | 24 +- tests/s25Main/integration/testProduction.cpp | 64 +- .../s25Main/integration/testSeaAttacking.cpp | 152 ++--- .../integration/testSeaWorldCreation.cpp | 4 +- tests/s25Main/integration/testSeafaring.cpp | 134 ++--- .../s25Main/integration/testSerialization.cpp | 136 ++--- .../integration/testTerritoryRegion.cpp | 42 +- tests/s25Main/integration/testTrading.cpp | 18 +- tests/s25Main/integration/testWorld.cpp | 10 +- .../s25Main/integration/testWorldCreation.cpp | 4 +- .../s25Main/integration/testWorldFixtures.cpp | 14 +- tests/s25Main/lua/GameWithLuaAccess.h | 10 +- tests/s25Main/lua/testLua.cpp | 80 +-- tests/s25Main/lua/testLuaGUI.cpp | 24 +- tests/s25Main/lua/testLuaSettings.cpp | 26 +- tests/s25Main/mapGenerator/testAlgorithms.cpp | 30 +- tests/s25Main/mapGenerator/testHarbors.cpp | 22 +- .../s25Main/mapGenerator/testHeadQuarters.cpp | 28 +- tests/s25Main/mapGenerator/testIslands.cpp | 6 +- .../s25Main/mapGenerator/testMapSettings.cpp | 12 +- .../mapGenerator/testNodeMapUtilities.cpp | 4 +- tests/s25Main/mapGenerator/testRandomMap.cpp | 14 +- .../mapGenerator/testRandomUtility.cpp | 6 +- tests/s25Main/mapGenerator/testResources.cpp | 16 +- tests/s25Main/mapGenerator/testRivers.cpp | 20 +- tests/s25Main/mapGenerator/testTerrain.cpp | 12 +- tests/s25Main/mapGenerator/testTextures.cpp | 50 +- tests/s25Main/network/testGameClient.cpp | 138 ++--- tests/s25Main/simple/testMapBase.cpp | 18 +- tests/s25Main/simple/testPostBox.cpp | 48 +- .../worldFixtures/CreateEmptyWorld.cpp | 4 +- .../s25Main/worldFixtures/CreateSeaWorld.cpp | 22 +- tests/s25Main/worldFixtures/GCExecutor.cpp | 2 +- tests/s25Main/worldFixtures/GCExecutor.h | 6 +- .../worldFixtures/MockLocalGameState.h | 4 +- .../worldFixtures/TestEventManager.cpp | 16 +- .../s25Main/worldFixtures/TestEventManager.h | 4 +- tests/s25Main/worldFixtures/WorldFixture.h | 6 +- 736 files changed, 11767 insertions(+), 11767 deletions(-) diff --git a/extras/ai-battle/HeadlessGame.cpp b/extras/ai-battle/HeadlessGame.cpp index 47365f1f1f..d3faaeb324 100644 --- a/extras/ai-battle/HeadlessGame.cpp +++ b/extras/ai-battle/HeadlessGame.cpp @@ -45,21 +45,21 @@ HeadlessGame::HeadlessGame(const GlobalGameSettings& ggs, const bfs::path& map, } for(unsigned playerId = 0; playerId < world_.getNumPlayers(); ++playerId) - players_.push_back(AIFactory::Create(world_.getPlayer(playerId).aiInfo, playerId, world_)); + players_.push_back(AIFactory::create(world_.getPlayer(playerId).aiInfo, playerId, world_)); } HeadlessGame::~HeadlessGame() { - Close(); + close(); } -void HeadlessGame::Run(unsigned maxGF) +void HeadlessGame::run(unsigned maxGF) { AsyncChecksum checksum; gameStartTime_ = std::chrono::steady_clock::now(); auto nextReport = gameStartTime_ + std::chrono::seconds(1); - game_.Start(false); + game_.start(false); while(em_.getCurrentGF() < maxGF && !game_.isGameFinished()) { @@ -80,45 +80,45 @@ void HeadlessGame::Run(unsigned maxGF) if(replay_.isRecording() && !cmds.gcs.empty()) { cmds.checksum = checksum; - replay_.AddGameCommand(em_.getCurrentGF(), playerId, cmds); + replay_.addGameCommand(em_.getCurrentGF(), playerId, cmds); } for(const gc::GameCommandPtr& gc : cmds.gcs) - gc->Execute(world_, player->getPlayerId()); + gc->execute(world_, player->getPlayerId()); } } for(auto& player : players_) - player->RunGF(em_.getCurrentGF(), isnfw); + player->runGF(em_.getCurrentGF(), isnfw); - game_.RunGF(); + game_.runGF(); if(replay_.isRecording()) - replay_.UpdateLastGF(em_.getCurrentGF()); + replay_.updateLastGF(em_.getCurrentGF()); if(std::chrono::steady_clock::now() > nextReport) { nextReport += std::chrono::seconds(1); - PrintState(); + printState(); } } - PrintState(); + printState(); } -void HeadlessGame::Close() +void HeadlessGame::close() { bnw::cout << '\n'; if(replay_.isRecording()) { - replay_.StopRecording(); + replay_.stopRecording(); bnw::cout << "Replay written to " << canonical(replayPath_) << '\n'; } - replay_.Close(); + replay_.close(); } -void HeadlessGame::RecordReplay(const bfs::path& path, unsigned random_init) +void HeadlessGame::recordReplay(const bfs::path& path, unsigned random_init) { // Remove old replay bfs::remove(path); @@ -127,40 +127,40 @@ void HeadlessGame::RecordReplay(const bfs::path& path, unsigned random_init) MapInfo mapInfo; mapInfo.filepath = map_; - mapInfo.mapData.CompressFromFile(mapInfo.filepath, &mapInfo.mapChecksum); + mapInfo.mapData.compressFromFile(mapInfo.filepath, &mapInfo.mapChecksum); mapInfo.type = MapType::OldMap; if(!luaPath_.empty() && bfs::exists(luaPath_)) { mapInfo.luaFilepath = luaPath_; - mapInfo.luaData.CompressFromFile(luaPath_, &mapInfo.luaChecksum); + mapInfo.luaData.compressFromFile(luaPath_, &mapInfo.luaChecksum); } for(auto& player : world_.getPlayers()) - replay_.AddPlayer(player); + replay_.addPlayer(player); replay_.ggs = game_.ggs_; - if(!replay_.StartRecording(path, mapInfo, random_init)) + if(!replay_.startRecording(path, mapInfo, random_init)) throw std::runtime_error("Replayfile could not be opened!"); } -void HeadlessGame::SaveGame(const bfs::path& path) const +void HeadlessGame::saveGame(const bfs::path& path) const { // Remove old savegame bfs::remove(path); Savegame save; for(auto& player : world_.getPlayers()) - save.AddPlayer(player); + save.addPlayer(player); save.ggs = game_.ggs_; save.ggs.exploration = Exploration::Disabled; // no FOW save.start_gf = em_.getCurrentGF(); - save.sgd.MakeSnapshot(game_); - save.Save(path, "AI Battle"); + save.sgd.makeSnapshot(game_); + save.save(path, "AI Battle"); bnw::cout << "Savegame written to " << canonical(path) << '\n'; } -void HeadlessGame::PrintState() +void HeadlessGame::printState() { HeadlessStats stats; stats.currentGF = em_.getCurrentGF(); diff --git a/extras/ai-battle/HeadlessGame.h b/extras/ai-battle/HeadlessGame.h index 3714970bf5..c75c3c9298 100644 --- a/extras/ai-battle/HeadlessGame.h +++ b/extras/ai-battle/HeadlessGame.h @@ -30,14 +30,14 @@ class HeadlessGame const boost::filesystem::path& luaPath = {}, const std::vector& teams = {}); ~HeadlessGame(); - void Run(unsigned maxGF = std::numeric_limits::max()); - void Close(); + void run(unsigned maxGF = std::numeric_limits::max()); + void close(); - void RecordReplay(const boost::filesystem::path& path, unsigned random_init); - void SaveGame(const boost::filesystem::path& path) const; + void recordReplay(const boost::filesystem::path& path, unsigned random_init); + void saveGame(const boost::filesystem::path& path) const; private: - void PrintState(); + void printState(); NullLocalGameState localState_; boost::filesystem::path map_; diff --git a/extras/ai-battle/main.cpp b/extras/ai-battle/main.cpp index a5bd93f9de..fd323b5d04 100644 --- a/extras/ai-battle/main.cpp +++ b/extras/ai-battle/main.cpp @@ -256,12 +256,12 @@ int main(int argc, char** argv) HeadlessGame game(ggs, mapPath, ais, opts.lua_path ? RTTRCONFIG.ExpandPath(*opts.lua_path) : bfs::path{}, teams); if(opts.replay_path) - game.RecordReplay(RTTRCONFIG.ExpandPath(*opts.replay_path), opts.random_init); + game.recordReplay(RTTRCONFIG.ExpandPath(*opts.replay_path), opts.random_init); - game.Run(opts.maxGF); - game.Close(); + game.run(opts.maxGF); + game.close(); if(opts.savegame_path) - game.SaveGame(RTTRCONFIG.ExpandPath(*opts.savegame_path)); + game.saveGame(RTTRCONFIG.ExpandPath(*opts.savegame_path)); } catch(const std::exception& e) { bnw::cerr << e.what() << std::endl; diff --git a/extras/audioDrivers/SDL/AudioSDL.cpp b/extras/audioDrivers/SDL/AudioSDL.cpp index b6c00f151b..d438856041 100644 --- a/extras/audioDrivers/SDL/AudioSDL.cpp +++ b/extras/audioDrivers/SDL/AudioSDL.cpp @@ -52,7 +52,7 @@ AudioSDL::AudioSDL(IAudioDriverCallback* adli) : AudioDriver(adli), master_effec AudioSDL::~AudioSDL() { - CleanUp(); + cleanUp(); } /** @@ -67,7 +67,7 @@ const char* AudioSDL::getName() const static AudioSDL* currentInstance = nullptr; -bool AudioSDL::Initialize() +bool AudioSDL::initialize() { initialized = false; // SDL_thread leaks a mutex on regular runs and SDL_mixer a lot on initialization error @@ -93,14 +93,14 @@ bool AudioSDL::Initialize() setNumChannels(Mix_AllocateChannels(DEFAULT_NUM_CHANNELS)); Mix_SetMusicCMD(nullptr); currentInstance = this; - Mix_HookMusicFinished(AudioSDL::MusicFinished); + Mix_HookMusicFinished(AudioSDL::musicFinished); initialized = true; return true; } -void AudioSDL::MusicFinished() +void AudioSDL::musicFinished() { if(currentInstance) currentInstance->driverCallback->msgMusicFinished(); @@ -109,10 +109,10 @@ void AudioSDL::MusicFinished() /** * Treiberaufräumfunktion. */ -void AudioSDL::CleanUp() +void AudioSDL::cleanUp() { // Unload sounds - AudioDriver::CleanUp(); + AudioDriver::cleanUp(); Mix_CloseAudio(); currentInstance = nullptr; @@ -130,7 +130,7 @@ void AudioSDL::CleanUp() * * @return Sounddeskriptor bei Erfolg, @p nullptr bei Fehler */ -driver::RawSoundHandle AudioSDL::LoadEffect(const std::string& filepath) +driver::RawSoundHandle AudioSDL::loadEffect(const std::string& filepath) { Mix_Chunk* sound = Mix_LoadWAV(filepath.c_str()); @@ -140,7 +140,7 @@ driver::RawSoundHandle AudioSDL::LoadEffect(const std::string& filepath) return createRawSoundHandle(sound, driver::SoundType::Effect); } -driver::RawSoundHandle AudioSDL::LoadEffect(const std::vector& data, const std::string& /*ext*/) +driver::RawSoundHandle AudioSDL::loadEffect(const std::vector& data, const std::string& /*ext*/) { SDL_RWops* rwOps = SDL_RWFromConstMem(data.data(), static_cast(data.size())); Mix_Chunk* sound = Mix_LoadWAV_RW(rwOps, true); //-V601 @@ -156,7 +156,7 @@ driver::RawSoundHandle AudioSDL::LoadEffect(const std::vector& data, const * @return Sounddeskriptor bei Erfolg, @p nullptr bei Fehler */ -driver::RawSoundHandle AudioSDL::LoadMusic(const std::string& filepath) +driver::RawSoundHandle AudioSDL::loadMusic(const std::string& filepath) { Mix_Music* music = Mix_LoadMUS(filepath.c_str()); @@ -169,7 +169,7 @@ driver::RawSoundHandle AudioSDL::LoadMusic(const std::string& filepath) return createRawSoundHandle(new SDLMusicData(music), driver::SoundType::Music); } -driver::RawSoundHandle AudioSDL::LoadMusic(const std::vector& data, const std::string& /*ext*/) +driver::RawSoundHandle AudioSDL::loadMusic(const std::vector& data, const std::string& /*ext*/) { // Need to copy data as it is used by SDL auto handle = std::make_unique(data); @@ -191,11 +191,11 @@ int AudioSDL::doPlayEffect(driver::RawSoundHandle::DriverData driverData, uint8_ int channel = Mix_PlayChannel(-1, static_cast(driverData), (loop) ? -1 : 0); if(channel < 0) return -1; - Mix_Volume(channel, CalcEffectVolume(volume)); + Mix_Volume(channel, calcEffectVolume(volume)); return channel; } -void AudioSDL::PlayMusic(const driver::RawSoundHandle& sound, int repeats) +void AudioSDL::playMusic(const driver::RawSoundHandle& sound, int repeats) { if(!sound.getDriverData()) return; @@ -213,7 +213,7 @@ void AudioSDL::PlayMusic(const driver::RawSoundHandle& sound, int repeats) /** * Stoppt die Musik. */ -void AudioSDL::StopMusic() +void AudioSDL::stopMusic() { // Musik anhalten Mix_FadeOutMusic(1000); @@ -231,15 +231,15 @@ bool AudioSDL::isEffectPlaying(EffectPlayId play_id) return false; if(Mix_Playing(channel)) return true; - RemoveEffect(play_id); + removeEffect(play_id); return false; } -void AudioSDL::ChangeVolume(EffectPlayId play_id, uint8_t volume) +void AudioSDL::changeVolume(EffectPlayId play_id, uint8_t volume) { int channel = getEffectChannel(play_id); if(channel >= 0) - Mix_Volume(channel, CalcEffectVolume(volume)); + Mix_Volume(channel, calcEffectVolume(volume)); } void AudioSDL::setMasterEffectVolume(uint8_t volume) @@ -255,7 +255,7 @@ void AudioSDL::setMusicVolume(uint8_t volume) Mix_VolumeMusic(volume / 2); } -uint8_t AudioSDL::CalcEffectVolume(uint8_t volume) const +uint8_t AudioSDL::calcEffectVolume(uint8_t volume) const { // Scale by master_effects_volume and scale down to SDL_Mixer range [0, 127] return (static_cast(master_effects_volume) * volume) / 255 / 2; diff --git a/extras/audioDrivers/SDL/AudioSDL.h b/extras/audioDrivers/SDL/AudioSDL.h index 6b101b233d..7e5ac21733 100644 --- a/extras/audioDrivers/SDL/AudioSDL.h +++ b/extras/audioDrivers/SDL/AudioSDL.h @@ -23,28 +23,28 @@ class AudioSDL final : public driver::AudioDriver /// Return the name of the driver const char* getName() const override; - bool Initialize() override; + bool initialize() override; /// Closes all open handles of the driver (stops and unloads music and effects) - void CleanUp() override; + void cleanUp() override; - driver::RawSoundHandle LoadEffect(const std::string& filepath) override; - driver::RawSoundHandle LoadEffect(const std::vector& data, const std::string& ext) override; - driver::RawSoundHandle LoadMusic(const std::string& filepath) override; - driver::RawSoundHandle LoadMusic(const std::vector& data, const std::string& ext) override; + driver::RawSoundHandle loadEffect(const std::string& filepath) override; + driver::RawSoundHandle loadEffect(const std::vector& data, const std::string& ext) override; + driver::RawSoundHandle loadMusic(const std::string& filepath) override; + driver::RawSoundHandle loadMusic(const std::vector& data, const std::string& ext) override; /// Plays an effect at the given volume. If loop is true, effect is looped indefinitely int doPlayEffect(driver::RawSoundHandle::DriverData driverData, uint8_t volume, bool loop) override; /// Plays the given music. Only 1 music will be played. /// If repeats is less than 0 it will loop indefinitely, otherwise it will be repeated that many times. - void PlayMusic(const driver::RawSoundHandle& sound, int repeats) override; + void playMusic(const driver::RawSoundHandle& sound, int repeats) override; /// Stop the music - void StopMusic() override; + void stopMusic() override; /// Stop the effect on this channel void doStopEffect(int channel) override; /// Is the effect still being played bool isEffectPlaying(EffectPlayId play_id) override; /// Changes volume [0..256) of a played sound (if it is still playing) relative to the master effect volume - void ChangeVolume(EffectPlayId play_id, uint8_t volume) override; + void changeVolume(EffectPlayId play_id, uint8_t volume) override; /// Set the master effect volume [0..256) at which all effects will be played. Changing the volume of an effect will /// be relative to this void setMasterEffectVolume(uint8_t volume) override; @@ -56,7 +56,7 @@ class AudioSDL final : public driver::AudioDriver private: /// Calculates the volume at which the effect should be played using the master volume and the passed volume - uint8_t CalcEffectVolume(uint8_t volume) const; + uint8_t calcEffectVolume(uint8_t volume) const; /// Callback für Audiotreiber - static void MusicFinished(); + static void musicFinished(); }; diff --git a/extras/replay-player/main.cpp b/extras/replay-player/main.cpp index 4298c23d8d..29a603beb1 100644 --- a/extras/replay-player/main.cpp +++ b/extras/replay-player/main.cpp @@ -115,7 +115,7 @@ int main(int argc, char** argv) lastReportGF = stats.currentGF; }; - replay.Run([&](const HeadlessReplay&) { + replay.run([&](const HeadlessReplay&) { const auto now = std::chrono::steady_clock::now(); if(now >= nextReport) { diff --git a/extras/videoDrivers/SDL2/VideoSDL2.cpp b/extras/videoDrivers/SDL2/VideoSDL2.cpp index 7d220f45a2..73ac2081f4 100644 --- a/extras/videoDrivers/SDL2/VideoSDL2.cpp +++ b/extras/videoDrivers/SDL2/VideoSDL2.cpp @@ -40,7 +40,7 @@ bool CHECK_SDL(int sdlResult) { if(sdlResult >= 0) return true; - VideoSDL2::PrintError(); + VideoSDL2::printError(); return false; } @@ -88,7 +88,7 @@ VideoSDL2::VideoSDL2(VideoDriverLoaderInterface* CallBack) : VideoDriver(CallBac VideoSDL2::~VideoSDL2() { - CleanUp(); + cleanUp(); } const char* VideoSDL2::getName() const @@ -96,7 +96,7 @@ const char* VideoSDL2::getName() const return GetDriverName(); } -bool VideoSDL2::Initialize() +bool VideoSDL2::initialize() { initialized = false; rttr::ScopedLeakDisabler _; @@ -108,7 +108,7 @@ bool VideoSDL2::Initialize() return initialized; } -void VideoSDL2::CleanUp() +void VideoSDL2::cleanUp() { if(!initialized) return; @@ -121,7 +121,7 @@ void VideoSDL2::CleanUp() initialized = false; } -void VideoSDL2::UpdateCurrentSizes() +void VideoSDL2::updateCurrentSizes() { int w, h, w2, h2; SDL_GetWindowSize(window, &w, &h); @@ -138,7 +138,7 @@ static VideoMode getDesktopSize(SDL_Window* window, VideoMode fallback) return fallback; } -bool VideoSDL2::CreateScreen(const std::string& title, const VideoMode size, DisplayMode displayMode) +bool VideoSDL2::createScreen(const std::string& title, const VideoMode size, DisplayMode displayMode) { if(!initialized) return false; @@ -172,7 +172,7 @@ bool VideoSDL2::CreateScreen(const std::string& title, const VideoMode size, Dis if(displayMode == DisplayMode::Fullscreen) { windowTypeFlag = SDL_WINDOW_FULLSCREEN; - requestedSize = FindClosestVideoMode(size); + requestedSize = findClosestVideoMode(size); } else if(displayMode == DisplayMode::BorderlessWindow) { windowTypeFlag = SDL_WINDOW_BORDERLESS; @@ -185,22 +185,22 @@ bool VideoSDL2::CreateScreen(const std::string& title, const VideoMode size, Dis if(!window) { - PrintError(); + printError(); // Fallback to borderless fullscreen if unable to set resolution if(displayMode == DisplayMode::Fullscreen) - return CreateScreen(title, size, DisplayMode::BorderlessWindow); + return createScreen(title, size, DisplayMode::BorderlessWindow); // No borderless -> Resizable window as last fallback to at least show something if(displayMode == DisplayMode::BorderlessWindow) - return CreateScreen(title, size, DisplayMode::Windowed); - PrintError(); + return createScreen(title, size, DisplayMode::Windowed); + printError(); return false; } - UpdateCurrentDisplayMode(); - UpdateCurrentSizes(); + updateCurrentDisplayMode(); + updateCurrentSizes(); if(displayMode != DisplayMode::Fullscreen) - MoveWindowToCenter(); + moveWindowToCenter(); SDL_Surface* iconSurf = SDL_CreateRGBSurfaceFrom(image.data(), 48, 48, 32, 48 * 4, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF); @@ -209,7 +209,7 @@ bool VideoSDL2::CreateScreen(const std::string& title, const VideoMode size, Dis SDL_SetWindowIcon(window, iconSurf); SDL_FreeSurface(iconSurf); } else - PrintError(); + printError(); context = SDL_GL_CreateContext(window); @@ -224,7 +224,7 @@ bool VideoSDL2::CreateScreen(const std::string& title, const VideoMode size, Dis return true; } -bool VideoSDL2::ResizeScreen(VideoMode newSize, DisplayMode displayMode) +bool VideoSDL2::resizeScreen(VideoMode newSize, DisplayMode displayMode) { if(!initialized) return false; @@ -246,7 +246,7 @@ bool VideoSDL2::ResizeScreen(VideoMode newSize, DisplayMode displayMode) static_cast(displayMode == DisplayMode::Windowed && displayMode.resizeable)); SDL_SetWindowBordered(window, static_cast(displayMode == DisplayMode::Windowed)); - UpdateCurrentDisplayMode(); + updateCurrentDisplayMode(); centerWindow = true; } if(displayMode_ == DisplayMode::BorderlessWindow) @@ -255,7 +255,7 @@ bool VideoSDL2::ResizeScreen(VideoMode newSize, DisplayMode displayMode) { if(displayMode_ == DisplayMode::Fullscreen) { - auto const targetMode = FindClosestVideoMode(newSize); + auto const targetMode = findClosestVideoMode(newSize); SDL_DisplayMode target; target.w = targetMode.width; target.h = targetMode.height; @@ -271,25 +271,25 @@ bool VideoSDL2::ResizeScreen(VideoMode newSize, DisplayMode displayMode) SDL_SetWindowSize(window, newSize.width, newSize.height); centerWindow = true; } - UpdateCurrentSizes(); + updateCurrentSizes(); } if(centerWindow) - MoveWindowToCenter(); + moveWindowToCenter(); return true; } -void VideoSDL2::PrintError() +void VideoSDL2::printError() { - PrintError(SDL_GetError()); + printError(SDL_GetError()); } -void VideoSDL2::PrintError(const std::string& msg) +void VideoSDL2::printError(const std::string& msg) { boost::nowide::cerr << msg << std::endl; } -void VideoSDL2::ShowErrorMessage(const std::string& title, const std::string& message) +void VideoSDL2::showErrorMessage(const std::string& title, const std::string& message) { // window==nullptr is okay too ("no parent") #ifdef __linux__ @@ -302,31 +302,31 @@ void VideoSDL2::ShowErrorMessage(const std::string& title, const std::string& me #endif } -void VideoSDL2::HandlePaste() +void VideoSDL2::handlePaste() { if(!SDL_HasClipboardText()) return; SDL_memory text(SDL_GetClipboardText()); if(!text || *text == '\0') // empty string indicates error - PrintError(text ? SDL_GetError() : "Paste failed."); + printError(text ? SDL_GetError() : "Paste failed."); for(const char32_t c : s25util::utf8to32(text.get())) CallBack->msgKeyDown(KeyEvent(c)); } -void VideoSDL2::DestroyScreen() +void VideoSDL2::destroyScreen() { - CleanUp(); + cleanUp(); } -bool VideoSDL2::SwapBuffers() +bool VideoSDL2::swapBuffers() { SDL_GL_SwapWindow(window); return true; } -bool VideoSDL2::MessageLoop() +bool VideoSDL2::messageLoop() { SDL_Event ev; while(SDL_PollEvent(&ev)) @@ -340,12 +340,12 @@ bool VideoSDL2::MessageLoop() { if(ev.window.event == SDL_WINDOWEVENT_RESIZED) { - UpdateCurrentDisplayMode(); + updateCurrentDisplayMode(); VideoMode newSize(ev.window.data1, ev.window.data2); if(newSize != getWindowSize()) { - UpdateCurrentSizes(); - CallBack->WindowResized(); + updateCurrentSizes(); + CallBack->windowResized(); } } } @@ -383,7 +383,7 @@ bool VideoSDL2::MessageLoop() case SDLK_v: if(SDL_GetModState() & KMOD_CTRL) { - HandlePaste(); + handlePaste(); continue; } break; @@ -538,7 +538,7 @@ unsigned long VideoSDL2::getTickCount() const return SDL_GetTicks(); } -std::vector VideoSDL2::ListVideoModes() const +std::vector VideoSDL2::listVideoModes() const { int display = SDL_GetWindowDisplayIndex(window); if(display < 0) @@ -548,7 +548,7 @@ std::vector VideoSDL2::ListVideoModes() const { SDL_DisplayMode mode; if(SDL_GetDisplayMode(display, i, &mode) != 0) - PrintError(); + printError(); else { VideoMode vm(mode.w, mode.h); @@ -595,7 +595,7 @@ void* VideoSDL2::getMapPointer() const #endif } -void VideoSDL2::MoveWindowToCenter() +void VideoSDL2::moveWindowToCenter() { SDL_PumpEvents(); // Let window system run update events/initialization const int display = window ? std::max(0, SDL_GetWindowDisplayIndex(window)) : 0; @@ -611,7 +611,7 @@ void VideoSDL2::MoveWindowToCenter() if(usableBounds.w < wndOuterSize.width || usableBounds.h < wndOuterSize.height) { SDL_SetWindowSize(window, usableBounds.w - left - right, usableBounds.h - top - bottom); - UpdateCurrentSizes(); + updateCurrentSizes(); wndOuterSize.width = usableBounds.w; wndOuterSize.height = usableBounds.h; } @@ -620,7 +620,7 @@ void VideoSDL2::MoveWindowToCenter() SDL_SetWindowPosition(window, x, y); } -void VideoSDL2::UpdateCurrentDisplayMode() +void VideoSDL2::updateCurrentDisplayMode() { RTTR_Assert(window); const auto flags = SDL_GetWindowFlags(window); diff --git a/extras/videoDrivers/SDL2/VideoSDL2.h b/extras/videoDrivers/SDL2/VideoSDL2.h index f1b4537e4f..8be65e706a 100644 --- a/extras/videoDrivers/SDL2/VideoSDL2.h +++ b/extras/videoDrivers/SDL2/VideoSDL2.h @@ -12,7 +12,7 @@ struct VideoMode; class VideoSDL2 final : public VideoDriver { - void CleanUp(); + void cleanUp(); public: VideoSDL2(VideoDriverLoaderInterface* CallBack); @@ -22,19 +22,19 @@ class VideoSDL2 final : public VideoDriver /// Get the name of the driver const char* getName() const override; - bool Initialize() override; + bool initialize() override; - bool CreateScreen(const std::string& title, VideoMode size, DisplayMode displayMode) override; - bool ResizeScreen(VideoMode newSize, DisplayMode displayMode) override; + bool createScreen(const std::string& title, VideoMode size, DisplayMode displayMode) override; + bool resizeScreen(VideoMode newSize, DisplayMode displayMode) override; - void DestroyScreen() override; + void destroyScreen() override; /// Swap the OpenGL buffer - bool SwapBuffers() override; + bool swapBuffers() override; - bool MessageLoop() override; + bool messageLoop() override; - void ShowErrorMessage(const std::string& title, const std::string& message) override; + void showErrorMessage(const std::string& title, const std::string& message) override; /// Get a timestamp unsigned long getTickCount() const override; @@ -42,7 +42,7 @@ class VideoSDL2 final : public VideoDriver OpenGL_Loader_Proc getLoaderFunction() const override; /// Get supported video modes - std::vector ListVideoModes() const override; + std::vector listVideoModes() const override; /// Set mouse position void setMousePos(Position pos) override; @@ -53,14 +53,14 @@ class VideoSDL2 final : public VideoDriver /// Get (device-dependent!) window pointer, HWND in Windows void* getMapPointer() const override; - static void PrintError(); - static void PrintError(const std::string& msg); + static void printError(); + static void printError(const std::string& msg); private: - void HandlePaste(); - void UpdateCurrentSizes(); - void MoveWindowToCenter(); - void UpdateCurrentDisplayMode(); + void handlePaste(); + void updateCurrentSizes(); + void moveWindowToCenter(); + void updateCurrentDisplayMode(); SDL_Window* window; SDL_GLContext context; diff --git a/extras/videoDrivers/WinAPI/WinAPI.cpp b/extras/videoDrivers/WinAPI/WinAPI.cpp index bcf045ec55..103562aa1e 100644 --- a/extras/videoDrivers/WinAPI/WinAPI.cpp +++ b/extras/videoDrivers/WinAPI/WinAPI.cpp @@ -53,7 +53,7 @@ VideoWinAPI::VideoWinAPI(VideoDriverLoaderInterface* CallBack) VideoWinAPI::~VideoWinAPI() { - DestroyScreen(); + destroyScreen(); pVideoWinAPI = nullptr; } @@ -62,7 +62,7 @@ const char* VideoWinAPI::getName() const return GetDriverName(); } -bool VideoWinAPI::Initialize() +bool VideoWinAPI::initialize() { screen = nullptr; screen_dc = nullptr; @@ -74,25 +74,25 @@ bool VideoWinAPI::Initialize() return initialized; } -void VideoWinAPI::CleanUp() +void VideoWinAPI::cleanUp() { - DestroyScreen(); + destroyScreen(); initialized = false; } -bool VideoWinAPI::CreateScreen(const std::string& title, const VideoMode newSize, DisplayMode displayMode) +bool VideoWinAPI::createScreen(const std::string& title, const VideoMode newSize, DisplayMode displayMode) { if(!initialized) return false; - if(!RegisterAndCreateWindow(title, newSize, displayMode)) + if(!registerAndCreateWindow(title, newSize, displayMode)) return false; - if(displayMode == DisplayMode::Fullscreen && !MakeFullscreen(getWindowSize())) + if(displayMode == DisplayMode::Fullscreen && !makeFullscreen(getWindowSize())) return false; displayMode_ = displayMode; - if(!InitOGL()) + if(!initOGL()) return false; // Hide mouse cursor by resetting the texture. This way we still have the resize mouse cursor etc. @@ -105,7 +105,7 @@ bool VideoWinAPI::CreateScreen(const std::string& title, const VideoMode newSize return true; } -bool VideoWinAPI::ResizeScreen(const VideoMode newSize, DisplayMode displayMode) +bool VideoWinAPI::resizeScreen(const VideoMode newSize, DisplayMode displayMode) { if(!initialized || !isDisplayModeChangeable) return false; @@ -113,7 +113,7 @@ bool VideoWinAPI::ResizeScreen(const VideoMode newSize, DisplayMode displayMode) if(displayMode == displayMode_ && newSize == getWindowSize()) return true; - VideoMode windowSize = (displayMode == DisplayMode::Fullscreen) ? FindClosestVideoMode(newSize) : newSize; + VideoMode windowSize = (displayMode == DisplayMode::Fullscreen) ? findClosestVideoMode(newSize) : newSize; // Try to switch full screen first if(displayMode_ == DisplayMode::Fullscreen && displayMode != DisplayMode::Fullscreen) { @@ -126,7 +126,7 @@ bool VideoWinAPI::ResizeScreen(const VideoMode newSize, DisplayMode displayMode) } else if(displayMode == DisplayMode::Fullscreen) { ShowWindow(screen, SW_HIDE); - if(!MakeFullscreen(windowSize)) + if(!makeFullscreen(windowSize)) { ShowWindow(screen, SW_SHOW); return false; @@ -139,7 +139,7 @@ bool VideoWinAPI::ResizeScreen(const VideoMode newSize, DisplayMode displayMode) SetWindowLongPtr(screen, GWL_EXSTYLE, exStyle); displayMode_ = displayMode; - const auto [wndArea, adjustedSize] = CalculateWindowRect(displayMode, windowSize); + const auto [wndArea, adjustedSize] = calculateWindowRect(displayMode, windowSize); // Set size and position UINT flags = SWP_SHOWWINDOW | SWP_DRAWFRAME | SWP_FRAMECHANGED; @@ -174,13 +174,13 @@ std::pair VideoWinAPI::getStyleFlags(const DisplayMode mode) const } } -std::pair VideoWinAPI::CalculateWindowRect(const DisplayMode mode, VideoMode requestedSize) const +std::pair VideoWinAPI::calculateWindowRect(const DisplayMode mode, VideoMode requestedSize) const { switch(mode.type) { case DisplayMode::Fullscreen: { - const auto size = FindClosestVideoMode(requestedSize); + const auto size = findClosestVideoMode(requestedSize); return std::make_pair(Rect(Position::all(0), size.width, size.height), size); }; case DisplayMode::BorderlessWindow: @@ -215,7 +215,7 @@ std::pair VideoWinAPI::CalculateWindowRect(const DisplayMode mo BOOST_UNREACHABLE_RETURN(std::make_pair(RECT{0, 0, requestedSize.width, requestedSize.height}, requestedSize)); } -bool VideoWinAPI::RegisterAndCreateWindow(const std::string& title, const VideoMode wndSize, DisplayMode displayMode) +bool VideoWinAPI::registerAndCreateWindow(const std::string& title, const VideoMode wndSize, DisplayMode displayMode) { std::wstring wTitle = boost::nowide::widen(title); windowClassName = wTitle.substr(0, wTitle.find(' ')); @@ -223,7 +223,7 @@ bool VideoWinAPI::RegisterAndCreateWindow(const std::string& title, const VideoM // Register window class WNDCLASSW wc; wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; - wc.lpfnWndProc = WindowProc; + wc.lpfnWndProc = windowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = GetModuleHandle(nullptr); @@ -237,7 +237,7 @@ bool VideoWinAPI::RegisterAndCreateWindow(const std::string& title, const VideoM return false; // Create window - const auto [wndArea, adjustedSize] = CalculateWindowRect(displayMode, wndSize); + const auto [wndArea, adjustedSize] = calculateWindowRect(displayMode, wndSize); const auto [style, exStyle] = getStyleFlags(displayMode); screen = CreateWindowExW(exStyle, windowClassName.c_str(), wTitle.c_str(), style, wndArea.left, wndArea.top, @@ -255,7 +255,7 @@ bool VideoWinAPI::RegisterAndCreateWindow(const std::string& title, const VideoM return true; } -bool VideoWinAPI::InitOGL() +bool VideoWinAPI::initOGL() { RTTR_Assert(!screen_dc && !screen_rc); // Pixelformat zuweisen @@ -311,7 +311,7 @@ bool VideoWinAPI::InitOGL() return true; } -bool VideoWinAPI::MakeFullscreen(const VideoMode resolution) +bool VideoWinAPI::makeFullscreen(const VideoMode resolution) { DEVMODE dm; memset(&dm, 0, sizeof(dm)); @@ -349,7 +349,7 @@ VideoMode VideoWinAPI::getDesktopSize(const VideoMode fallback) const return fallback; } -void VideoWinAPI::DestroyScreen() +void VideoWinAPI::destroyScreen() { EndDialog(screen, 0); @@ -380,7 +380,7 @@ void VideoWinAPI::DestroyScreen() UnregisterClassW(windowClassName.c_str(), GetModuleHandle(nullptr)); } -bool VideoWinAPI::SwapBuffers() +bool VideoWinAPI::swapBuffers() { if(!screen_dc) return false; @@ -389,7 +389,7 @@ bool VideoWinAPI::SwapBuffers() return true; } -bool VideoWinAPI::MessageLoop() +bool VideoWinAPI::messageLoop() { MSG msg; if(PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) @@ -403,7 +403,7 @@ bool VideoWinAPI::MessageLoop() return true; } -void VideoWinAPI::ShowErrorMessage(const std::string& title, const std::string& message) +void VideoWinAPI::showErrorMessage(const std::string& title, const std::string& message) { MessageBoxA(nullptr, message.c_str(), title.c_str(), MB_OK | MB_ICONEXCLAMATION); } @@ -429,7 +429,7 @@ OpenGL_Loader_Proc VideoWinAPI::getLoaderFunction() const return wglGetProcAddress_Wrapper; } -std::vector VideoWinAPI::ListVideoModes() const +std::vector VideoWinAPI::listVideoModes() const { DEVMODE dm; memset(&dm, 0, sizeof(dm)); @@ -457,7 +457,7 @@ void VideoWinAPI::setMousePos(Position pos) } } -void VideoWinAPI::OnWMChar(unsigned c, bool disablepaste, LPARAM lParam) +void VideoWinAPI::onWMChar(unsigned c, bool disablepaste, LPARAM lParam) { KeyEvent ke(c); setSpecialKeys(ke, lParam); @@ -466,7 +466,7 @@ void VideoWinAPI::OnWMChar(unsigned c, bool disablepaste, LPARAM lParam) { if(!disablepaste && ke.ctrl) { - OnWMPaste(); + onWMPaste(); return; } } @@ -474,7 +474,7 @@ void VideoWinAPI::OnWMChar(unsigned c, bool disablepaste, LPARAM lParam) CallBack->msgKeyDown(ke); } -void VideoWinAPI::OnWMKeyDown(unsigned c, LPARAM lParam) +void VideoWinAPI::onWMKeyDown(unsigned c, LPARAM lParam) { KeyEvent ke; setSpecialKeys(ke, lParam); @@ -515,7 +515,7 @@ void VideoWinAPI::OnWMKeyDown(unsigned c, LPARAM lParam) CallBack->msgKeyDown(ke); } -void VideoWinAPI::OnWMPaste() +void VideoWinAPI::onWMPaste() { if(!IsClipboardFormatAvailable(CF_UNICODETEXT)) return; @@ -528,19 +528,19 @@ void VideoWinAPI::OnWMPaste() while(pData && *pData) { wchar_t c = *(pData++); - OnWMKeyDown(c); - OnWMChar(c, true); + onWMKeyDown(c); + onWMChar(c, true); } GlobalUnlock(hData); CloseClipboard(); } -LRESULT CALLBACK VideoWinAPI::WindowProc(HWND window, UINT msg, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK VideoWinAPI::windowProc(HWND window, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { - case WM_PASTE: pVideoWinAPI->OnWMPaste(); break; + case WM_PASTE: pVideoWinAPI->onWMPaste(); break; case WM_CLOSE: PostQuitMessage(0); return 0; case WM_SIZE: { @@ -554,7 +554,7 @@ LRESULT CALLBACK VideoWinAPI::WindowProc(HWND window, UINT msg, WPARAM wParam, L pVideoWinAPI->setNewSize(newSize, Extent(newSize.width, newSize.height)); pVideoWinAPI->isDisplayModeChangeable = false; - pVideoWinAPI->CallBack->WindowResized(); + pVideoWinAPI->CallBack->windowResized(); pVideoWinAPI->isDisplayModeChangeable = true; } pVideoWinAPI->isMinimized = false; @@ -566,7 +566,7 @@ LRESULT CALLBACK VideoWinAPI::WindowProc(HWND window, UINT msg, WPARAM wParam, L case SC_SCREENSAVE: case SC_MONITORPOWER: return 0; case SC_KEYMENU: // F10-Fehler beheben -> will sonst Fenster verschieben, was das Zeichnen unterbindet - pVideoWinAPI->OnWMKeyDown(VK_F10, 0); // pretend we got a F10 stroke + pVideoWinAPI->onWMKeyDown(VK_F10, 0); // pretend we got a F10 stroke return 0; } break; @@ -625,11 +625,11 @@ LRESULT CALLBACK VideoWinAPI::WindowProc(HWND window, UINT msg, WPARAM wParam, L break; case WM_KEYDOWN: // case WM_SYSKEYDOWN: // auch abfangen, wenn linkes ALT mit gedrückt wurde - pVideoWinAPI->OnWMKeyDown((unsigned)wParam, lParam); + pVideoWinAPI->onWMKeyDown((unsigned)wParam, lParam); return 0; case WM_CHAR: case WM_SYSCHAR: // auch abfangen, wenn linkes ALT mit gedrückt wurde - pVideoWinAPI->OnWMChar((unsigned)wParam, false, lParam); + pVideoWinAPI->onWMChar((unsigned)wParam, false, lParam); return 0; } return DefWindowProcW(window, msg, wParam, lParam); diff --git a/extras/videoDrivers/WinAPI/WinAPI.h b/extras/videoDrivers/WinAPI/WinAPI.h index 0c147e1e49..c1c012800c 100644 --- a/extras/videoDrivers/WinAPI/WinAPI.h +++ b/extras/videoDrivers/WinAPI/WinAPI.h @@ -16,7 +16,7 @@ class VideoWinAPI final : public VideoDriver { - void CleanUp(); + void cleanUp(); public: VideoWinAPI(VideoDriverLoaderInterface* CallBack); @@ -26,25 +26,25 @@ class VideoWinAPI final : public VideoDriver const char* getName() const override; /// Initialize the driver, return true on success - bool Initialize() override; + bool initialize() override; /// Create window/rendering context with given title, size and display mode, return true on success - bool CreateScreen(const std::string& title, const VideoMode newSize, DisplayMode displayMode) override; + bool createScreen(const std::string& title, const VideoMode newSize, DisplayMode displayMode) override; /// Change window/resolution, return true on success - bool ResizeScreen(VideoMode newSize, DisplayMode displayMode) override; + bool resizeScreen(VideoMode newSize, DisplayMode displayMode) override; /// Close window - void DestroyScreen() override; + void destroyScreen() override; /// Swap OpenGL buffers - bool SwapBuffers() override; + bool swapBuffers() override; /// Process messages/events, return false when the application should quit - bool MessageLoop() override; + bool messageLoop() override; /// Popup Window - void ShowErrorMessage(const std::string& title, const std::string& message) override; + void showErrorMessage(const std::string& title, const std::string& message) override; /// Return the current tick count (time since epoch in ms) unsigned long getTickCount() const override; @@ -53,7 +53,7 @@ class VideoWinAPI final : public VideoDriver OpenGL_Loader_Proc getLoaderFunction() const override; /// Return supported resolutions - std::vector ListVideoModes() const override; + std::vector listVideoModes() const override; /// Set position of the mouse cursor in screen coordinates void setMousePos(Position pos) override; @@ -69,21 +69,21 @@ class VideoWinAPI final : public VideoDriver std::pair getStyleFlags(DisplayMode mode) const; /// Calculate the rect for the window of the requested size at the display mode /// Returns the final rect (position&size) for the window and the possibly adjusted size of the render region - std::pair CalculateWindowRect(DisplayMode mode, VideoMode requestedSize) const; - bool RegisterAndCreateWindow(const std::string& title, VideoMode wndSize, DisplayMode displayMode); - bool InitOGL(); - static bool MakeFullscreen(VideoMode resolution); + std::pair calculateWindowRect(DisplayMode mode, VideoMode requestedSize) const; + bool registerAndCreateWindow(const std::string& title, VideoMode wndSize, DisplayMode displayMode); + bool initOGL(); + static bool makeFullscreen(VideoMode resolution); VideoMode getDesktopSize(VideoMode fallback) const; /// Callback for pressed character keys - void OnWMChar(unsigned c, bool disablepaste = false, LPARAM lParam = 0); - void OnWMKeyDown(unsigned c, LPARAM lParam = 0); + void onWMChar(unsigned c, bool disablepaste = false, LPARAM lParam = 0); + void onWMKeyDown(unsigned c, LPARAM lParam = 0); /// Handle paste from clipboard (CTRL+V) - void OnWMPaste(); + void onWMPaste(); /// Window callback function - static LRESULT CALLBACK WindowProc(HWND window, UINT msg, WPARAM wParam, LPARAM lParam); + static LRESULT CALLBACK windowProc(HWND window, UINT msg, WPARAM wParam, LPARAM lParam); private: int mouse_z; /// Scrolling position for mouse wheel. diff --git a/libs/common/include/CollisionDetection.h b/libs/common/include/CollisionDetection.h index bc444efb1d..3065a6f8bc 100644 --- a/libs/common/include/CollisionDetection.h +++ b/libs/common/include/CollisionDetection.h @@ -10,4 +10,4 @@ bool IsPointInRect(const Position& pt, const Rect& rect); bool IsPointInRect(int x, int y, const Rect& rect); bool IsPointInRect(int x, int y, int rx, int ry, int rwidth, int rheight); -bool DoRectsIntersect(const Rect& rect1, const Rect& rect2); +bool doRectsIntersect(const Rect& rect1, const Rect& rect2); diff --git a/libs/common/include/Point.h b/libs/common/include/Point.h index 0971f9ed15..c77f3fc085 100644 --- a/libs/common/include/Point.h +++ b/libs/common/include/Point.h @@ -52,10 +52,10 @@ struct Point //-V690 constexpr Point(const Point&) = default; constexpr Point& operator=(const Point&) = default; - static constexpr Point Invalid() noexcept { return Point(); } + static constexpr Point invalid() noexcept { return Point(); } /// Create a new point with all coordinates set to value static constexpr Point all(const T value) noexcept { return Point(value, value); } - constexpr bool isValid() const noexcept { return *this != Invalid(); } + constexpr bool isValid() const noexcept { return *this != invalid(); } constexpr bool operator==(const Point& second) const noexcept; constexpr bool operator!=(const Point& second) const noexcept; diff --git a/libs/common/src/CollisionDetection.cpp b/libs/common/src/CollisionDetection.cpp index 8fb6c5532c..8449eda31c 100644 --- a/libs/common/src/CollisionDetection.cpp +++ b/libs/common/src/CollisionDetection.cpp @@ -19,7 +19,7 @@ bool IsPointInRect(const int x, const int y, const int rx, const int ry, const i return IsPointInRect(Position(x, y), Rect(Position(rx, ry), Extent(rwidth, rheight))); } -bool DoRectsIntersect(const Rect& rect1, const Rect& rect2) +bool doRectsIntersect(const Rect& rect1, const Rect& rect2) { // Size = 0 -> No intersection possible if(rect1.getSize() == Extent(0, 0) || rect2.getSize() == Extent(0, 0)) diff --git a/libs/driver/include/driver/AudioDriver.h b/libs/driver/include/driver/AudioDriver.h index 5c1d211b48..ebb68b7105 100644 --- a/libs/driver/include/driver/AudioDriver.h +++ b/libs/driver/include/driver/AudioDriver.h @@ -20,10 +20,10 @@ class AudioDriver : public IAudioDriver /// prüft auf Initialisierung. bool isInitialized() final override { return initialized; } - void CleanUp() override; + void cleanUp() override; - EffectPlayId PlayEffect(const RawSoundHandle& sound, uint8_t volume, bool loop) final override; - void StopEffect(EffectPlayId play_id) final override; + EffectPlayId playEffect(const RawSoundHandle& sound, uint8_t volume, bool loop) final override; + void stopEffect(EffectPlayId play_id) final override; void unloadSound(RawSoundHandle handle) final override; /// Register this handle pointer so that the driverData is reset when the sound gets unloaded @@ -36,7 +36,7 @@ class AudioDriver : public IAudioDriver /// Get the channel an effect is being played at or -1 if not found int getEffectChannel(EffectPlayId playId) const; /// Removes the effect from the channel list - void RemoveEffect(EffectPlayId playId); + void removeEffect(EffectPlayId playId); /// Add the sound to the list of loaded sounds and return a RawSoundHandle RawSoundHandle createRawSoundHandle(RawSoundHandle::DriverData driverData, SoundType type); @@ -54,7 +54,7 @@ class AudioDriver : public IAudioDriver private: /// Generates a play id - EffectPlayId GeneratePlayID(); + EffectPlayId generatePlayID(); /// Next play id EffectPlayId nextPlayID_; std::vector loadedSounds_; diff --git a/libs/driver/include/driver/AudioInterface.h b/libs/driver/include/driver/AudioInterface.h index 6797631632..ef7da545e2 100644 --- a/libs/driver/include/driver/AudioInterface.h +++ b/libs/driver/include/driver/AudioInterface.h @@ -23,14 +23,14 @@ class BOOST_SYMBOL_VISIBLE IAudioDriver virtual const char* getName() const = 0; /// True iff the driver is initialized virtual bool isInitialized() = 0; - virtual bool Initialize() = 0; + virtual bool initialize() = 0; /// Closes all open handles of the driver (stops and unloads music and effects) - virtual void CleanUp() = 0; + virtual void cleanUp() = 0; - virtual RawSoundHandle LoadEffect(const std::string& filepath) = 0; - virtual RawSoundHandle LoadEffect(const std::vector& data, const std::string& ext) = 0; - virtual RawSoundHandle LoadMusic(const std::string& filepath) = 0; - virtual RawSoundHandle LoadMusic(const std::vector& data, const std::string& ext) = 0; + virtual RawSoundHandle loadEffect(const std::string& filepath) = 0; + virtual RawSoundHandle loadEffect(const std::vector& data, const std::string& ext) = 0; + virtual RawSoundHandle loadMusic(const std::string& filepath) = 0; + virtual RawSoundHandle loadMusic(const std::vector& data, const std::string& ext) = 0; /// Unload the sound virtual void unloadSound(RawSoundHandle handle) = 0; @@ -38,18 +38,18 @@ class BOOST_SYMBOL_VISIBLE IAudioDriver virtual void registerForUnload(RawSoundHandle* handlePtr) = 0; /// Plays an effect at the given volume. If loop is true, effect is looped indefinitely - virtual EffectPlayId PlayEffect(const RawSoundHandle& sound, uint8_t volume, bool loop) = 0; + virtual EffectPlayId playEffect(const RawSoundHandle& sound, uint8_t volume, bool loop) = 0; /// Plays the given music. Only 1 music will be played. /// If repeats is less than 0 it will loop indefinitely, otherwise it will be repeated that many times. - virtual void PlayMusic(const RawSoundHandle& sound, int repeats) = 0; + virtual void playMusic(const RawSoundHandle& sound, int repeats) = 0; /// Stop the music - virtual void StopMusic() = 0; + virtual void stopMusic() = 0; /// Stop the effect with the given id (if it is still playing) - virtual void StopEffect(EffectPlayId play_id) = 0; + virtual void stopEffect(EffectPlayId play_id) = 0; /// Is the effect still being played virtual bool isEffectPlaying(EffectPlayId play_id) = 0; /// Changes volume [0..256) of a played sound (if it is still playing) relative to the master effect volume - virtual void ChangeVolume(EffectPlayId play_id, uint8_t volume) = 0; + virtual void changeVolume(EffectPlayId play_id, uint8_t volume) = 0; /// Set the master effect volume [0..256) at which all effects will be played. Changing the volume of an effect will /// be relative to this virtual void setMasterEffectVolume(uint8_t volume) = 0; diff --git a/libs/driver/include/driver/VideoDriver.h b/libs/driver/include/driver/VideoDriver.h index 9f991f71d6..701ccb0a04 100644 --- a/libs/driver/include/driver/VideoDriver.h +++ b/libs/driver/include/driver/VideoDriver.h @@ -46,7 +46,7 @@ class VideoDriver : public IVideoDriver bool isOpenGL() const override { return true; } protected: - VideoMode FindClosestVideoMode(VideoMode mode) const; + VideoMode findClosestVideoMode(VideoMode mode) const; void setNewSize(VideoMode windowSize, Extent renderSize); VideoDriverLoaderInterface* CallBack; /// DriverCallback to notify on player input diff --git a/libs/driver/include/driver/VideoDriverLoaderInterface.h b/libs/driver/include/driver/VideoDriverLoaderInterface.h index be278fc01e..fddfa364eb 100644 --- a/libs/driver/include/driver/VideoDriverLoaderInterface.h +++ b/libs/driver/include/driver/VideoDriverLoaderInterface.h @@ -25,5 +25,5 @@ class BOOST_SYMBOL_VISIBLE VideoDriverLoaderInterface virtual void msgKeyDown(const KeyEvent& ke) = 0; - virtual void WindowResized() = 0; + virtual void windowResized() = 0; }; diff --git a/libs/driver/include/driver/VideoInterface.h b/libs/driver/include/driver/VideoInterface.h index 87343e8a9a..e545a34df3 100644 --- a/libs/driver/include/driver/VideoInterface.h +++ b/libs/driver/include/driver/VideoInterface.h @@ -24,21 +24,21 @@ class BOOST_SYMBOL_VISIBLE IVideoDriver /// Funktion zum Auslesen des Treibernamens. virtual const char* getName() const = 0; - virtual bool Initialize() = 0; + virtual bool initialize() = 0; /// Erstellt das Fenster mit entsprechenden Werten. - virtual bool CreateScreen(const std::string& title, VideoMode newSize, DisplayMode displayMode) = 0; + virtual bool createScreen(const std::string& title, VideoMode newSize, DisplayMode displayMode) = 0; - virtual bool ResizeScreen(VideoMode newSize, DisplayMode displayMode) = 0; + virtual bool resizeScreen(VideoMode newSize, DisplayMode displayMode) = 0; /// Schliesst das Fenster. - virtual void DestroyScreen() = 0; + virtual void destroyScreen() = 0; /// Wechselt die OpenGL-Puffer. - virtual bool SwapBuffers() = 0; + virtual bool swapBuffers() = 0; /// Die Nachrichtenschleife. - virtual bool MessageLoop() = 0; + virtual bool messageLoop() = 0; /// Return the current tick count (time since epoch in ms) virtual unsigned long getTickCount() const = 0; @@ -46,7 +46,7 @@ class BOOST_SYMBOL_VISIBLE IVideoDriver /// Funktion zum Holen einer Subfunktion. virtual OpenGL_Loader_Proc getLoaderFunction() const = 0; - virtual std::vector ListVideoModes() const = 0; + virtual std::vector listVideoModes() const = 0; /// Funktion zum Auslesen der Mauskoordinaten. virtual Position getMousePos() const = 0; @@ -90,7 +90,7 @@ class BOOST_SYMBOL_VISIBLE IVideoDriver virtual bool isOpenGL() const = 0; // Display the problem to the gamer - virtual void ShowErrorMessage(const std::string& title, const std::string& message) = 0; + virtual void showErrorMessage(const std::string& title, const std::string& message) = 0; }; class VideoDriverLoaderInterface; diff --git a/libs/driver/src/AudioDriver.cpp b/libs/driver/src/AudioDriver.cpp index ef5385e88a..430ec7a72e 100644 --- a/libs/driver/src/AudioDriver.cpp +++ b/libs/driver/src/AudioDriver.cpp @@ -25,7 +25,7 @@ AudioDriver::~AudioDriver() RTTR_Assert(loadedSounds_.empty()); } -void AudioDriver::CleanUp() +void AudioDriver::cleanUp() { const auto soundsCopy = loadedSounds_; for(const auto& sound : soundsCopy) @@ -33,7 +33,7 @@ void AudioDriver::CleanUp() initialized = false; } -EffectPlayId AudioDriver::PlayEffect(const RawSoundHandle& sound, uint8_t volume, bool loop) +EffectPlayId AudioDriver::playEffect(const RawSoundHandle& sound, uint8_t volume, bool loop) { if(!sound.getDriverData()) return EffectPlayId::Invalid; @@ -44,18 +44,18 @@ EffectPlayId AudioDriver::PlayEffect(const RawSoundHandle& sound, uint8_t volume const int channel = doPlayEffect(sound.getDriverData(), volume, loop); if(channel < 0 || static_cast(channel) >= channels_.size()) return EffectPlayId::Invalid; - const EffectPlayId newId = GeneratePlayID(); + const EffectPlayId newId = generatePlayID(); channels_[channel] = newId; return newId; } -void AudioDriver::StopEffect(EffectPlayId play_id) +void AudioDriver::stopEffect(EffectPlayId play_id) { const int channel = getEffectChannel(play_id); if(channel >= 0) { doStopEffect(channel); - RemoveEffect(play_id); + removeEffect(play_id); } } @@ -95,7 +95,7 @@ int AudioDriver::getEffectChannel(EffectPlayId playId) const return (it == channels_.end()) ? -1 : static_cast(std::distance(channels_.begin(), it)); } -void AudioDriver::RemoveEffect(EffectPlayId playId) +void AudioDriver::removeEffect(EffectPlayId playId) { int channel = getEffectChannel(playId); if(channel >= 0) @@ -110,7 +110,7 @@ RawSoundHandle AudioDriver::createRawSoundHandle(RawSoundHandle::DriverData driv return handle; } -EffectPlayId AudioDriver::GeneratePlayID() +EffectPlayId AudioDriver::generatePlayID() { using intType = std::underlying_type_t; diff --git a/libs/driver/src/VideoDriver.cpp b/libs/driver/src/VideoDriver.cpp index 4153d599e8..9a73d7e228 100644 --- a/libs/driver/src/VideoDriver.cpp +++ b/libs/driver/src/VideoDriver.cpp @@ -60,9 +60,9 @@ bool VideoDriver::isTouchEvent() const return mouse_xy.num_tfingers > 0; } -VideoMode VideoDriver::FindClosestVideoMode(const VideoMode mode) const +VideoMode VideoDriver::findClosestVideoMode(const VideoMode mode) const { - std::vector avModes = ListVideoModes(); + std::vector avModes = listVideoModes(); if(avModes.empty()) throw std::runtime_error("No supported video modes found!"); unsigned minSizeDiff = std::numeric_limits::max(); @@ -109,7 +109,7 @@ void VideoDriver::setGuiScalePercent(unsigned percent) guiScale_ = GuiScale(percent); scaledRenderSize_ = guiScale_.screenToView(renderSize_); - CallBack->WindowResized(); + CallBack->windowResized(); // move cursor to new position in view space // must happen after window resize event to avoid drawing spurious hover events diff --git a/libs/libGamedata/lua/CampaignDataLoader.cpp b/libs/libGamedata/lua/CampaignDataLoader.cpp index 02acda3bc3..dd5af9f64a 100644 --- a/libs/libGamedata/lua/CampaignDataLoader.cpp +++ b/libs/libGamedata/lua/CampaignDataLoader.cpp @@ -29,7 +29,7 @@ CampaignDataLoader::CampaignDataLoader(CampaignDescription& campaignDesc, const CampaignDataLoader::~CampaignDataLoader() = default; -bool CampaignDataLoader::CheckScriptVersion() +bool CampaignDataLoader::checkScriptVersion() { kaguya::LuaRef func = lua["getRequiredLuaVersion"]; if(func.type() == LUA_TFUNCTION) @@ -57,7 +57,7 @@ bool CampaignDataLoader::Load() if(!loadScript(curFile_)) return false; - if(!CheckScriptVersion()) + if(!checkScriptVersion()) throw std::runtime_error("Wrong lua script version."); kaguya::LuaRef entry = lua["campaign"]; diff --git a/libs/libGamedata/lua/CampaignDataLoader.h b/libs/libGamedata/lua/CampaignDataLoader.h index 70646e483a..615f477d07 100644 --- a/libs/libGamedata/lua/CampaignDataLoader.h +++ b/libs/libGamedata/lua/CampaignDataLoader.h @@ -29,5 +29,5 @@ class CampaignDataLoader : public LuaInterfaceBase CampaignDescription& campaignDesc_; boost::filesystem::path basePath_; - bool CheckScriptVersion(); + bool checkScriptVersion(); }; diff --git a/libs/libGamedata/lua/GameDataLoader.cpp b/libs/libGamedata/lua/GameDataLoader.cpp index e034d54060..56e492c1e0 100644 --- a/libs/libGamedata/lua/GameDataLoader.cpp +++ b/libs/libGamedata/lua/GameDataLoader.cpp @@ -25,7 +25,7 @@ GameDataLoader::GameDataLoader(WorldDescription& worldDesc, const boost::filesys Register(lua); lua["rttr"] = this; - lua["include"] = kaguya::function([this](const std::string& file) { Include(file); }); + lua["include"] = kaguya::function([this](const std::string& file) { include(file); }); } GameDataLoader::GameDataLoader(WorldDescription& worldDesc) @@ -44,9 +44,9 @@ bool GameDataLoader::Load() void GameDataLoader::Register(kaguya::State& state) { state["RTTRGameData"].setClass(kaguya::UserdataMetatable() - .addFunction("AddLandscape", &GameDataLoader::AddLandscape) - .addFunction("AddTerrainEdge", &GameDataLoader::AddTerrainEdge) - .addFunction("AddTerrain", &GameDataLoader::AddTerrain)); + .addFunction("AddLandscape", &GameDataLoader::addLandscape) + .addFunction("AddTerrainEdge", &GameDataLoader::addTerrainEdge) + .addFunction("AddTerrain", &GameDataLoader::addTerrain)); } class LuaIncludeError : public std::runtime_error @@ -55,7 +55,7 @@ class LuaIncludeError : public std::runtime_error using std::runtime_error::runtime_error; }; -void GameDataLoader::Include(const std::string& filepath) +void GameDataLoader::include(const std::string& filepath) { try { @@ -96,17 +96,17 @@ void GameDataLoader::Include(const std::string& filepath) } } -void GameDataLoader::AddLandscape(const kaguya::LuaTable& data) +void GameDataLoader::addLandscape(const kaguya::LuaTable& data) { worldDesc_.landscapes.add(LandscapeDesc(data, worldDesc_)); } -void GameDataLoader::AddTerrainEdge(const kaguya::LuaTable& data) +void GameDataLoader::addTerrainEdge(const kaguya::LuaTable& data) { worldDesc_.edges.add(EdgeDesc(data, worldDesc_)); } -void GameDataLoader::AddTerrain(const kaguya::LuaTable& data) +void GameDataLoader::addTerrain(const kaguya::LuaTable& data) { worldDesc_.terrain.add(TerrainDesc(data, worldDesc_)); } diff --git a/libs/libGamedata/lua/GameDataLoader.h b/libs/libGamedata/lua/GameDataLoader.h index 01967574d4..747e94b291 100644 --- a/libs/libGamedata/lua/GameDataLoader.h +++ b/libs/libGamedata/lua/GameDataLoader.h @@ -25,10 +25,10 @@ class GameDataLoader : public LuaInterfaceBase static void Register(kaguya::State& state); private: - void Include(const std::string& filepath); - void AddLandscape(const kaguya::LuaTable& data); - void AddTerrainEdge(const kaguya::LuaTable& data); - void AddTerrain(const kaguya::LuaTable& data); + void include(const std::string& filepath); + void addLandscape(const kaguya::LuaTable& data); + void addTerrainEdge(const kaguya::LuaTable& data); + void addTerrain(const kaguya::LuaTable& data); WorldDescription& worldDesc_; boost::filesystem::path basePath_, curFile_; diff --git a/libs/s25client/s25client.cpp b/libs/s25client/s25client.cpp index 5924135090..9f795cba57 100644 --- a/libs/s25client/s25client.cpp +++ b/libs/s25client/s25client.cpp @@ -186,8 +186,8 @@ void handleException(void* pCtx = nullptr) noexcept if(shouldSendDebugData()) { DebugInfo di; - di.SendReplay(); - di.SendStackTrace(stacktrace); + di.sendReplay(); + di.sendStackTrace(stacktrace); } } catch(...) { //-V565 @@ -215,10 +215,10 @@ LONG WINAPI ExceptionHandler(LPEXCEPTION_POINTERS info) void InstallSignalHandlers() { #ifdef _WIN32 - SetConsoleCtrlHandler(ConsoleSignalHandler, TRUE); + SetConsoleCtrlHandler(consoleSignalHandler, TRUE); #else struct sigaction sa; - sa.sa_handler = ConsoleSignalHandler; + sa.sa_handler = consoleSignalHandler; sa.sa_flags = 0; // SA_RESTART would not allow to interrupt connect call; sigemptyset(&sa.sa_mask); @@ -404,7 +404,7 @@ bool InitGame(GameManager& gameManager) } // Spiel starten - if(!gameManager.Start()) + if(!gameManager.start()) { s25util::error("Failed to start the game"); return false; @@ -456,13 +456,13 @@ int RunProgram(po::variables_map& options) if(options.count("ai")) aiPlayers = options["ai"].as>(); - if(!QuickStartGame(options["map"].as(), aiPlayers)) + if(!quickStartGame(options["map"].as(), aiPlayers)) return 1; } // Hauptschleife - while(gameManager.Run()) + while(gameManager.run()) { #ifndef _WIN32 killme = false; @@ -470,7 +470,7 @@ int RunProgram(po::variables_map& options) } // Spiel beenden - gameManager.Stop(); + gameManager.stop(); libsiedler2::setAllocator(nullptr); } catch(const RTTR_AssertError& error) { diff --git a/libs/s25main/AsyncChecksum.cpp b/libs/s25main/AsyncChecksum.cpp index 81ea8c739f..5a7fa3e70a 100644 --- a/libs/s25main/AsyncChecksum.cpp +++ b/libs/s25main/AsyncChecksum.cpp @@ -40,7 +40,7 @@ unsigned AsyncChecksum::getHash() const { Serializer ser; Serialize(ser); - return CalcChecksumOfBuffer(ser.GetData(), ser.GetLength()); + return calcChecksumOfBuffer(ser.GetData(), ser.GetLength()); } AsyncChecksum AsyncChecksum::create(const Game& game) diff --git a/libs/s25main/BuildingRegister.cpp b/libs/s25main/BuildingRegister.cpp index 9cfe037be7..7519602a19 100644 --- a/libs/s25main/BuildingRegister.cpp +++ b/libs/s25main/BuildingRegister.cpp @@ -19,21 +19,21 @@ void BuildingRegister::Serialize(SerializedGameData& sgd) const { - sgd.PushObjectContainer(warehouses); - sgd.PushObjectContainer(harbors, true); + sgd.pushObjectContainer(warehouses); + sgd.pushObjectContainer(harbors, true); for(const auto bld : helpers::enumRange()) { if(BuildingProperties::isUsual(bld)) - sgd.PushObjectContainer(buildings[bld], true); + sgd.pushObjectContainer(buildings[bld], true); } - sgd.PushObjectContainer(building_sites, true); - sgd.PushObjectContainer(military_buildings, true); + sgd.pushObjectContainer(building_sites, true); + sgd.pushObjectContainer(military_buildings, true); } void BuildingRegister::Deserialize(SerializedGameData& sgd) { - sgd.PopObjectContainer(warehouses); - sgd.PopObjectContainer(harbors, GO_Type::NobHarborbuilding); + sgd.popObjectContainer(warehouses); + sgd.popObjectContainer(harbors, GO_Type::NobHarborbuilding); if(sgd.getGameDataVersion() >= 6) { @@ -46,36 +46,36 @@ void BuildingRegister::Deserialize(SerializedGameData& sgd) continue; if(BuildingProperties::isUsual(bld)) - sgd.PopObjectContainer(buildings[bld], GO_Type::NobUsual); + sgd.popObjectContainer(buildings[bld], GO_Type::NobUsual); } - sgd.PopObjectContainer(building_sites, GO_Type::Buildingsite); - sgd.PopObjectContainer(military_buildings, GO_Type::NobMilitary); + sgd.popObjectContainer(building_sites, GO_Type::Buildingsite); + sgd.popObjectContainer(military_buildings, GO_Type::NobMilitary); } else if(sgd.getGameDataVersion() >= 2) - Deserialize2(sgd); + deserialize2(sgd); } -void BuildingRegister::Deserialize2(SerializedGameData& sgd) +void BuildingRegister::deserialize2(SerializedGameData& sgd) { // Pop all buildings starting at the first usual building for(unsigned i = static_cast(BuildingType::GraniteMine); i < helpers::NumEnumValues_v; ++i) - sgd.PopObjectContainer(buildings[BuildingType(i)], GO_Type::NobUsual); - sgd.PopObjectContainer(building_sites, GO_Type::Buildingsite); - sgd.PopObjectContainer(military_buildings, GO_Type::NobMilitary); + sgd.popObjectContainer(buildings[BuildingType(i)], GO_Type::NobUsual); + sgd.popObjectContainer(building_sites, GO_Type::Buildingsite); + sgd.popObjectContainer(military_buildings, GO_Type::NobMilitary); } -void BuildingRegister::Add(noBuildingSite* building_site) +void BuildingRegister::add(noBuildingSite* building_site) { RTTR_Assert(!helpers::contains(building_sites, building_site)); building_sites.push_back(building_site); } -void BuildingRegister::Remove(noBuildingSite* building_site) +void BuildingRegister::remove(noBuildingSite* building_site) { RTTR_Assert(helpers::contains(building_sites, building_site)); building_sites.remove(building_site); } -void BuildingRegister::Add(noBuilding* bld, BuildingType bldType) +void BuildingRegister::add(noBuilding* bld, BuildingType bldType) { if(BuildingProperties::isMilitary(bldType)) { @@ -97,7 +97,7 @@ void BuildingRegister::Add(noBuilding* bld, BuildingType bldType) } } -void BuildingRegister::Remove(noBuilding* bld, BuildingType bldType) +void BuildingRegister::remove(noBuilding* bld, BuildingType bldType) { if(BuildingProperties::isMilitary(bldType)) { @@ -146,16 +146,16 @@ BuildingCount BuildingRegister::getBuildingNums() const return bc; } -helpers::EnumArray BuildingRegister::CalcProductivities() const +helpers::EnumArray BuildingRegister::calcProductivities() const { helpers::EnumArray productivities; for(const auto bld : helpers::enumRange()) - productivities[bld] = static_cast(CalcAverageProductivity(bld)); + productivities[bld] = static_cast(calcAverageProductivity(bld)); return productivities; } -unsigned BuildingRegister::CalcAverageProductivity(BuildingType bldType) const +unsigned BuildingRegister::calcAverageProductivity(BuildingType bldType) const { if(holds_alternative(BLD_WORK_DESC[bldType].producedWare)) return 0; @@ -171,7 +171,7 @@ unsigned BuildingRegister::CalcAverageProductivity(BuildingType bldType) const return productivity; } -unsigned short BuildingRegister::CalcAverageProductivity() const +unsigned short BuildingRegister::calcAverageProductivity() const { unsigned totalProductivity = 0; unsigned numBlds = 0; diff --git a/libs/s25main/BuildingRegister.h b/libs/s25main/BuildingRegister.h index 2051c2c182..ce09200b78 100644 --- a/libs/s25main/BuildingRegister.h +++ b/libs/s25main/BuildingRegister.h @@ -24,12 +24,12 @@ class BuildingRegister // Deserialisieren void Deserialize(SerializedGameData& sgd); /// Compatibility with old savegames - void Deserialize2(SerializedGameData& sgd); + void deserialize2(SerializedGameData& sgd); - void Add(noBuildingSite* building_site); - void Remove(noBuildingSite* building_site); - void Add(noBuilding* bld, BuildingType bldType); - void Remove(noBuilding* bld, BuildingType bldType); + void add(noBuildingSite* building_site); + void remove(noBuildingSite* building_site); + void add(noBuilding* bld, BuildingType bldType); + void remove(noBuilding* bld, BuildingType bldType); const std::list& getBuildingSites() const { return building_sites; } const std::list& getBuildings(BuildingType type) const; @@ -40,11 +40,11 @@ class BuildingRegister /// Liefert die Anzahl aller Gebäude einzeln BuildingCount getBuildingNums() const; /// Calculate and fill the average productivities for all buildings. - helpers::EnumArray CalcProductivities() const; + helpers::EnumArray calcProductivities() const; /// Calculate the average productivity for a building type - unsigned CalcAverageProductivity(BuildingType bldType) const; + unsigned calcAverageProductivity(BuildingType bldType) const; /// Calculate the average productivity for all buildings - unsigned short CalcAverageProductivity() const; + unsigned short calcAverageProductivity() const; private: std::list building_sites; diff --git a/libs/s25main/CatapultStone.cpp b/libs/s25main/CatapultStone.cpp index 6fe4de97f6..f0b1b38ea8 100644 --- a/libs/s25main/CatapultStone.cpp +++ b/libs/s25main/CatapultStone.cpp @@ -22,13 +22,13 @@ CatapultStone::CatapultStone(const MapPoint dest_building, const MapPoint dest_m const DrawPoint dest, const unsigned fly_duration) : dest_building(dest_building), dest_map(dest_map), startPos(start), destPos(dest), explode(false) { - event = getEvMgr().AddEvent(this, fly_duration); + event = getEvMgr().addEvent(this, fly_duration); } CatapultStone::CatapultStone(SerializedGameData& sgd, const unsigned obj_id) - : GameObject(sgd, obj_id), dest_building(sgd.PopMapPoint()), dest_map(sgd.PopMapPoint()), + : GameObject(sgd, obj_id), dest_building(sgd.popMapPoint()), dest_map(sgd.popMapPoint()), startPos(helpers::popPoint(sgd)), destPos(helpers::popPoint(sgd)), explode(sgd.PopBool()), - event(sgd.PopEvent()) + event(sgd.popEvent()) {} /// Serialisierungsfunktionen @@ -39,12 +39,12 @@ void CatapultStone::Serialize(SerializedGameData& sgd) const helpers::pushPoint(sgd, startPos); helpers::pushPoint(sgd, destPos); sgd.PushBool(explode); - sgd.PushEvent(event); + sgd.pushEvent(event); } -void CatapultStone::Destroy() {} +void CatapultStone::destroy() {} -void CatapultStone::Draw(DrawPoint drawOffset) +void CatapultStone::draw(DrawPoint drawOffset) { const DrawPoint worldSize = DrawPoint(world->getWidth() * TR_W, world->getHeight() * TR_H); @@ -54,21 +54,21 @@ void CatapultStone::Draw(DrawPoint drawOffset) DrawPoint drawPos = destPos - drawOffset + worldSize; drawPos.x %= worldSize.x; drawPos.y %= worldSize.y; - LOADER.getMapTexture(3102 + GAMECLIENT.Interpolate(4, event))->DrawFull(drawPos); + LOADER.getMapTexture(3102 + GAMECLIENT.interpolate(4, event))->drawFull(drawPos); } else { // Linear interpolieren zwischen Ausgangs- und Zielpunkt - Position curPos(GAMECLIENT.Interpolate(startPos.x, destPos.x, event), - GAMECLIENT.Interpolate(startPos.y, destPos.y, event)); + Position curPos(GAMECLIENT.interpolate(startPos.x, destPos.x, event), + GAMECLIENT.interpolate(startPos.y, destPos.y, event)); DrawPoint drawPos = curPos - drawOffset + worldSize; drawPos.x %= worldSize.x; drawPos.y %= worldSize.y; // Schatten auf linearer Linie zeichnen - LOADER.getMapTexture(3101)->DrawFull(drawPos, COLOR_SHADOW); + LOADER.getMapTexture(3101)->drawFull(drawPos, COLOR_SHADOW); Position distance = destPos - startPos; double whole = std::sqrt(double(distance.x * distance.x + distance.y * distance.y)); - unsigned s = GAMECLIENT.Interpolate(static_cast(whole), event); + unsigned s = GAMECLIENT.interpolate(static_cast(whole), event); double dx = double(s) / whole - 0.5; @@ -80,21 +80,21 @@ void CatapultStone::Draw(DrawPoint drawOffset) // Stein auf Parabel zeichnen drawPos.y = (drawPos.y + diff) % worldSize.y; - LOADER.getMapTexture(3100)->DrawFull(drawPos); + LOADER.getMapTexture(3100)->drawFull(drawPos); } } -void CatapultStone::HandleEvent(const unsigned /*id*/) +void CatapultStone::handleEvent(const unsigned /*id*/) { if(explode) { // Explodiert --> mich zerstören - world->RemoveCatapultStone(this); - getEvMgr().AddToKillList(this); + world->removeCatapultStone(this); + getEvMgr().addToKillList(this); } else { // Stein ist aufgeschlagen --> Explodierevent anmelden - event = getEvMgr().AddEvent(this, 10); + event = getEvMgr().addEvent(this, 10); explode = true; // Trifft der Stein? @@ -104,10 +104,10 @@ void CatapultStone::HandleEvent(const unsigned /*id*/) auto* milBld = world->getSpecObj(dest_building); if(milBld) { - milBld->HitOfCatapultStone(); + milBld->hitOfCatapultStone(); // If there are no troops left, destroy it if(milBld->getNumTroops() == 0) - world->DestroyNO(milBld->getPos()); + world->destroyNO(milBld->getPos()); } } else { diff --git a/libs/s25main/CatapultStone.h b/libs/s25main/CatapultStone.h index ba49b51026..8c0ebf4d2b 100644 --- a/libs/s25main/CatapultStone.h +++ b/libs/s25main/CatapultStone.h @@ -36,14 +36,14 @@ class CatapultStone : public GameObject CatapultStone(SerializedGameData& sgd, unsigned obj_id); /// Zerstören - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; // Zeichnet den fliegenden Stein - void Draw(DrawPoint drawOffset); + void draw(DrawPoint drawOffset); /// Event-Handler - void HandleEvent(unsigned id) override; + void handleEvent(unsigned id) override; GO_Type getGOT() const final { return GO_Type::Catapultstone; } }; diff --git a/libs/s25main/Cheats.cpp b/libs/s25main/Cheats.cpp index 2a5a61cfbd..19e59c34e9 100644 --- a/libs/s25main/Cheats.cpp +++ b/libs/s25main/Cheats.cpp @@ -77,9 +77,9 @@ void Cheats::placeCheatBuilding(const MapPoint& mp, const GamePlayer& player) if(!canPlaceCheatBuilding(mp)) return; - world_.DestroyNO(mp, false); // if CanPlaceCheatBuilding is true then this must be safe to destroy + world_.destroyNO(mp, false); // if CanPlaceCheatBuilding is true then this must be safe to destroy auto* hq = - BuildingFactory::CreateBuilding(world_, BuildingType::Headquarters, mp, player.getPlayerId(), player.nation); + BuildingFactory::createBuilding(world_, BuildingType::Headquarters, mp, player.getPlayerId(), player.nation); checkedCast(hq)->setIsTent(player.isHQTent()); } @@ -87,7 +87,7 @@ void Cheats::toggleHumanAIPlayer() { if(isCheatModeOn() && !GAMECLIENT.isReplayModeOn()) { - GAMECLIENT.ToggleHumanAIPlayer(AI::Info{AI::Type::Default, AI::Level::Easy}); + GAMECLIENT.toggleHumanAIPlayer(AI::Info{AI::Type::Default, AI::Level::Easy}); isHumanAIPlayer_ = !isHumanAIPlayer_; } } @@ -122,7 +122,7 @@ void Cheats::destroyBuildings(const PlayerIDSet& playerIds) RTTR_FOREACH_PT(MapPoint, world_.getSize()) { if(world_.getNO(pt)->getType() == NodalObjectType::Building && playerIds.count(world_.getNode(pt).owner - 1)) - world_.DestroyNO(pt); + world_.destroyNO(pt); } } diff --git a/libs/s25main/DataChangedObservable.cpp b/libs/s25main/DataChangedObservable.cpp index d240cd57f6..90bd26186f 100644 --- a/libs/s25main/DataChangedObservable.cpp +++ b/libs/s25main/DataChangedObservable.cpp @@ -7,21 +7,21 @@ DataChangedObservable::~DataChangedObservable() { - NotifyListeners(0); + notifyListeners(0); } -void DataChangedObservable::AddListener(IDataChangedListener* listener) +void DataChangedObservable::addListener(IDataChangedListener* listener) { listeners.push_back(listener); } -void DataChangedObservable::RemoveListener(IDataChangedListener* listener) +void DataChangedObservable::removeListener(IDataChangedListener* listener) { listeners.remove(listener); } -void DataChangedObservable::NotifyListeners(unsigned changeId) +void DataChangedObservable::notifyListeners(unsigned changeId) { for(auto* listener : listeners) - listener->OnChange(changeId); + listener->onChange(changeId); } diff --git a/libs/s25main/DataChangedObservable.h b/libs/s25main/DataChangedObservable.h index cdeb1268f6..b9d8f702d4 100644 --- a/libs/s25main/DataChangedObservable.h +++ b/libs/s25main/DataChangedObservable.h @@ -13,12 +13,12 @@ class DataChangedObservable std::list listeners; public: - void AddListener(IDataChangedListener* listener); - void RemoveListener(IDataChangedListener* listener); + void addListener(IDataChangedListener* listener); + void removeListener(IDataChangedListener* listener); protected: virtual ~DataChangedObservable(); /// Notifies all registered listeners /// ID=0 means, this is removed and should no longer be referenced - void NotifyListeners(unsigned changeId); + void notifyListeners(unsigned changeId); }; diff --git a/libs/s25main/Debug.cpp b/libs/s25main/Debug.cpp index ee3b28b8a5..454fb2713a 100644 --- a/libs/s25main/Debug.cpp +++ b/libs/s25main/Debug.cpp @@ -150,35 +150,35 @@ DebugInfo::DebugInfo() { sock.Connect("debug.rttr.info", 4123, false, SETTINGS.proxy); - Send("RTTRDBG", 7); + send("RTTRDBG", 7); // Protocol Version - SendUnsigned(2); + sendUnsigned(2); // OS #if defined _WIN32 || defined __CYGWIN__ - SendString("WIN"); + sendString("WIN"); // TODO: These should be based on uname(3) output. #elif defined __APPLE__ - SendString("MAC"); + sendString("MAC"); #elif defined __FreeBSD__ - SendString("BSD"); + sendString("BSD"); #else - SendString("LNX"); + sendString("LNX"); #endif // Bits - SendUnsigned(sizeof(void*) * 8u); + sendUnsigned(sizeof(void*) * 8u); - SendString(rttr::version::getVersion()); - SendString(rttr::version::getRevision()); + sendString(rttr::version::getVersion()); + sendString(rttr::version::getRevision()); - SendUnsigned(GAMECLIENT.getGFNumber()); + sendUnsigned(GAMECLIENT.getGFNumber()); } DebugInfo::~DebugInfo() { - SendString("DONE"); + sendString("DONE"); sock.Close(); } @@ -193,7 +193,7 @@ DebugInfo::stacktrace_t DebugInfo::getStackTrace(void* ctx) noexcept(false) return stacktrace; } -bool DebugInfo::Send(const void* buffer, size_t length) +bool DebugInfo::send(const void* buffer, size_t length) { const auto* ptr = (const char*)buffer; @@ -218,44 +218,44 @@ bool DebugInfo::Send(const void* buffer, size_t length) return true; } -bool DebugInfo::SendUnsigned(uint32_t i) +bool DebugInfo::sendUnsigned(uint32_t i) { // Debug server does not handle endianness and is little endian... TODO: Fix server boost::endian::native_to_little_inplace(i); - return (Send(&i, 4)); + return (send(&i, 4)); } -bool DebugInfo::SendSigned(int32_t i) +bool DebugInfo::sendSigned(int32_t i) { // Debug server does not handle endianness and is little endian... TODO: Fix server boost::endian::native_to_little_inplace(i); - return (Send(&i, 4)); + return (send(&i, 4)); } -bool DebugInfo::SendString(const char* str, size_t len) +bool DebugInfo::sendString(const char* str, size_t len) { if(len == 0) len = strlen(str) + 1; - if(!SendUnsigned(len)) + if(!sendUnsigned(len)) return false; - return (Send(str, len)); + return (send(str, len)); } -bool DebugInfo::SendString(const std::string& str) +bool DebugInfo::sendString(const std::string& str) { - return SendString(str.c_str(), str.length() + 1); // +1 to include nullptr terminator + return sendString(str.c_str(), str.length() + 1); // +1 to include nullptr terminator } -bool DebugInfo::SendStackTrace(const stacktrace_t& stacktrace) +bool DebugInfo::sendStackTrace(const stacktrace_t& stacktrace) { if(stacktrace.empty()) return false; LOG.write("Will now send %1% stack frames\n") % stacktrace.size(); - if(!SendString("StackTrace")) + if(!sendString("StackTrace")) return false; using littleVoid_t = @@ -267,10 +267,10 @@ bool DebugInfo::SendStackTrace(const stacktrace_t& stacktrace) endStacktrace.push_back(reinterpret_cast(ptr)); unsigned stacktraceLen = sizeof(littleVoid_t) * endStacktrace.size(); - return SendString(reinterpret_cast(endStacktrace.data()), stacktraceLen); + return sendString(reinterpret_cast(endStacktrace.data()), stacktraceLen); } -bool DebugInfo::SendReplay() +bool DebugInfo::sendReplay() { LOG.write("Sending replay...\n"); @@ -282,18 +282,18 @@ bool DebugInfo::SendReplay() if(!rpl || !rpl->isRecording()) return true; const auto replayPath = rpl->getPath(); - rpl->Close(); + rpl->close(); BinaryFile f; if(f.Open(replayPath, OpenFileMode::Read)) { - if(!SendString("Replay")) + if(!sendString("Replay")) return false; - if(SendFile(f)) + if(sendFile(f)) return true; } // Empty replay - SendUnsigned(0); + sendUnsigned(0); return false; } else { @@ -303,23 +303,23 @@ bool DebugInfo::SendReplay() return true; } -bool DebugInfo::SendAsyncLog(const boost::filesystem::path& asyncLogFilepath) +bool DebugInfo::sendAsyncLog(const boost::filesystem::path& asyncLogFilepath) { BinaryFile file; if(!file.Open(asyncLogFilepath, OpenFileMode::Read)) return false; - if(!SendString("AsyncLog")) + if(!sendString("AsyncLog")) return false; - if(SendFile(file)) + if(sendFile(file)) return true; // Empty - SendUnsigned(0); + sendUnsigned(0); return false; } -bool DebugInfo::SendFile(BinaryFile& file) +bool DebugInfo::sendFile(BinaryFile& file) { file.Seek(0, SEEK_END); unsigned fileSize = file.Tell(); @@ -338,7 +338,7 @@ bool DebugInfo::SendFile(BinaryFile& file) { LOG.write("- Sending...\n"); - if(SendString(compressed.get(), compressed_len)) + if(sendString(compressed.get(), compressed_len)) { LOG.write("-> success\n"); return true; diff --git a/libs/s25main/Debug.h b/libs/s25main/Debug.h index f469f4679c..61ef042114 100644 --- a/libs/s25main/Debug.h +++ b/libs/s25main/Debug.h @@ -23,14 +23,14 @@ class DebugInfo static stacktrace_t getStackTrace(void* ctx = nullptr) noexcept(false); - bool Send(const void* buffer, size_t length); - bool SendSigned(int32_t i); - bool SendUnsigned(uint32_t i); - bool SendString(const char* str, size_t len = 0); - bool SendString(const std::string& str); - - bool SendStackTrace(const stacktrace_t& stacktrace); - bool SendReplay(); - bool SendAsyncLog(const boost::filesystem::path& asyncLogFilepath); - bool SendFile(BinaryFile& file); + bool send(const void* buffer, size_t length); + bool sendSigned(int32_t i); + bool sendUnsigned(uint32_t i); + bool sendString(const char* str, size_t len = 0); + bool sendString(const std::string& str); + + bool sendStackTrace(const stacktrace_t& stacktrace); + bool sendReplay(); + bool sendAsyncLog(const boost::filesystem::path& asyncLogFilepath); + bool sendFile(BinaryFile& file); }; diff --git a/libs/s25main/EconomyModeHandler.cpp b/libs/s25main/EconomyModeHandler.cpp index 531af61ed0..971f3156e1 100644 --- a/libs/s25main/EconomyModeHandler.cpp +++ b/libs/s25main/EconomyModeHandler.cpp @@ -62,10 +62,10 @@ EconomyModeHandler::EconomyModeHandler(unsigned endFrame) : endFrame(endFrame), // Schedule end game event and trust the event manager to keep track of it if(!isInfinite()) - getEvMgr().AddEvent(this, endFrame); + getEvMgr().addEvent(this, endFrame); // Find and set up Teams and trackers - DetermineTeams(); + determineTeams(); amountsThePlayersCollected.resize(goodsToCollect.size()); maxAmountsATeamCollected.resize(goodsToCollect.size()); @@ -103,7 +103,7 @@ EconomyModeHandler::EconomyModeHandler(SerializedGameData& sgd, unsigned objId) maxAmountsATeamCollected.resize(goodsToCollect.size()); } -void EconomyModeHandler::Destroy() {} +void EconomyModeHandler::destroy() {} /// Serialisierungsfunktion void EconomyModeHandler::Serialize(SerializedGameData& sgd) const @@ -119,7 +119,7 @@ void EconomyModeHandler::Serialize(SerializedGameData& sgd) const helpers::pushContainer(sgd, teamBitMasks); } -void EconomyModeHandler::DetermineTeams() +void EconomyModeHandler::determineTeams() { RTTR_Assert(economyModeTeams.empty()); for(unsigned i = 0; i < world->getNumPlayers(); ++i) @@ -153,7 +153,7 @@ void EconomyModeHandler::DetermineTeams() } } -unsigned EconomyModeHandler::SumUpGood(GoodType good, const Inventory& Inventory) +unsigned EconomyModeHandler::sumUpGood(GoodType good, const Inventory& Inventory) { unsigned retVal = Inventory.goods[good]; @@ -178,7 +178,7 @@ unsigned EconomyModeHandler::SumUpGood(GoodType good, const Inventory& Inventory return retVal; } -void EconomyModeHandler::UpdateAmounts() +void EconomyModeHandler::updateAmounts() { // Return if the game is over or we already updated the amounts this game frame if(isOver() || gfLastUpdated == getEvMgr().getCurrentGF()) @@ -193,7 +193,7 @@ void EconomyModeHandler::UpdateAmounts() Inventory playerInventory = player.getInventory(); for(unsigned g = 0; g < goodsToCollect.size(); g++) { - amountsThePlayersCollected[g][i] = SumUpGood(goodsToCollect[g], playerInventory); + amountsThePlayersCollected[g][i] = sumUpGood(goodsToCollect[g], playerInventory); } } @@ -238,7 +238,7 @@ void EconomyModeHandler::UpdateAmounts() gfLastUpdated = getEvMgr().getCurrentGF(); } -void EconomyModeHandler::HandleEvent(const unsigned) +void EconomyModeHandler::handleEvent(const unsigned) { if(isOver()) { @@ -248,7 +248,7 @@ void EconomyModeHandler::HandleEvent(const unsigned) // Handle game end event // Update one last time - UpdateAmounts(); + updateAmounts(); // Determine bitmask of all players in teams with the most good type wins std::bitset bestMask; @@ -272,7 +272,7 @@ void EconomyModeHandler::HandleEvent(const unsigned) } } - world->MakeWholeMapVisibleForAllPlayers(); + world->makeWholeMapVisibleForAllPlayers(); world->getGameInterface()->GI_UpdateMapVisibility(); } diff --git a/libs/s25main/EconomyModeHandler.h b/libs/s25main/EconomyModeHandler.h index 6d080329f8..38483f5741 100644 --- a/libs/s25main/EconomyModeHandler.h +++ b/libs/s25main/EconomyModeHandler.h @@ -64,27 +64,27 @@ class EconomyModeHandler : public GameObject /// Sum up all forms of the given good in the inventory (tools, weapons and beer are also counted in the hands of /// workers and soldiers) - unsigned SumUpGood(GoodType good, const Inventory& Inventory); + unsigned sumUpGood(GoodType good, const Inventory& Inventory); /// Determine the teams for the economy mode (only called at game start) - void DetermineTeams(); + void determineTeams(); public: EconomyModeHandler(unsigned endFrame); EconomyModeHandler(SerializedGameData& sgd, unsigned objId); - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; /// Event-Handler - void HandleEvent(unsigned id) override; + void handleEvent(unsigned id) override; /// Return vector of the teams (and their collected amounts) const std::vector& getTeams() const { return economyModeTeams; } /// Method to update the ware trackers - void UpdateAmounts(); + void updateAmounts(); /// Get the amounts collected by a player unsigned getAmount(unsigned goodNumber, unsigned playerId) const diff --git a/libs/s25main/EventManager.cpp b/libs/s25main/EventManager.cpp index 5c06bd51ff..58e16327b0 100644 --- a/libs/s25main/EventManager.cpp +++ b/libs/s25main/EventManager.cpp @@ -16,10 +16,10 @@ EventManager::EventManager(unsigned startGF) EventManager::~EventManager() { - Clear(); + clear(); } -void EventManager::Clear() +void EventManager::clear() { for(const auto& event : events) { @@ -47,7 +47,7 @@ void EventManager::Clear() eventInstanceCtr = 1u; } -const GameEvent* EventManager::AddEventToQueue(const GameEvent* event) +const GameEvent* EventManager::addEventToQueue(const GameEvent* event) { // Should be in the future! RTTR_Assert(event->getTargetGF() > currentGF); @@ -56,20 +56,20 @@ const GameEvent* EventManager::AddEventToQueue(const GameEvent* event) return event; } -const GameEvent* EventManager::AddEvent(GameObject* obj, unsigned gf_length, unsigned id) +const GameEvent* EventManager::addEvent(GameObject* obj, unsigned gf_length, unsigned id) { RTTR_Assert(obj); RTTR_Assert(gf_length); - return AddEventToQueue(new GameEvent(getNextEventInstanceId(), obj, currentGF, gf_length, id)); + return addEventToQueue(new GameEvent(getNextEventInstanceId(), obj, currentGF, gf_length, id)); } -const GameEvent* EventManager::AddEvent(GameObject* obj, unsigned gf_length, unsigned id, unsigned gf_elapsed) +const GameEvent* EventManager::addEvent(GameObject* obj, unsigned gf_length, unsigned id, unsigned gf_elapsed) { RTTR_Assert(gf_length > gf_elapsed); // Anfang des Events in die Vergangenheit zurückverlegen RTTR_Assert(currentGF >= gf_elapsed); - return AddEventToQueue(new GameEvent(getNextEventInstanceId(), obj, currentGF - gf_elapsed, gf_length, id)); + return addEventToQueue(new GameEvent(getNextEventInstanceId(), obj, currentGF - gf_elapsed, gf_length, id)); } unsigned EventManager::getNextEventInstanceId() @@ -80,15 +80,15 @@ unsigned EventManager::getNextEventInstanceId() return result; } -void EventManager::ExecuteNextGF() +void EventManager::executeNextGF() { currentGF++; - ExecuteCurrentEvents(); - DestroyCurrentObjects(); + executeCurrentEvents(); + destroyCurrentObjects(); } -void EventManager::DestroyCurrentObjects() +void EventManager::destroyCurrentObjects() { // Remove all objects for(auto& it : killList) @@ -96,8 +96,8 @@ void EventManager::DestroyCurrentObjects() GameObject* obj = it; // Object is no longer in the kill list (some may check this upon destruction) it = nullptr; - obj->Destroy(); - RTTR_Assert(!ObjectHasEvents(*obj)); + obj->destroy(); + RTTR_Assert(!objectHasEvents(*obj)); delete obj; } @@ -112,7 +112,7 @@ std::vector EventManager::getEvents() const return nextEv; } -void EventManager::ExecuteCurrentEvents() +void EventManager::executeCurrentEvents() { if(events.empty()) return; @@ -122,10 +122,10 @@ void EventManager::ExecuteCurrentEvents() RTTR_Assert(itCurEvents->first >= currentGF); if(itCurEvents->first == currentGF) - ExecuteEvents(itCurEvents); + executeEvents(itCurEvents); } -void EventManager::ExecuteEvents(const EventMap::iterator& itEvents) +void EventManager::executeEvents(const EventMap::iterator& itEvents) { EventList& curEvents = itEvents->second; // We have to allow 2 cases: @@ -138,7 +138,7 @@ void EventManager::ExecuteEvents(const EventMap::iterator& itEvents) RTTR_Assert(ev->obj->getObjId() <= GameObject::getObjIDCounter()); curActiveEvent = ev; - ev->obj->HandleEvent(ev->id); + ev->obj->handleEvent(ev->id); delete ev; --numActiveEvents; @@ -162,7 +162,7 @@ void EventManager::Serialize(SerializedGameData& sgd) const sgd.PushUnsignedInt(saveEvents.size()); for(const GameEvent* ev : saveEvents) - sgd.PushEvent(ev); + sgd.pushEvent(ev); sgd.PushUnsignedInt(eventInstanceCtr); } @@ -173,7 +173,7 @@ void EventManager::Deserialize(SerializedGameData& sgd) unsigned numEvents = sgd.PopUnsignedInt(); for(unsigned i = 0; i < numEvents; ++i) - AddEventToQueue(sgd.PopEvent()); + addEventToQueue(sgd.popEvent()); eventInstanceCtr = sgd.PopUnsignedInt(); @@ -196,7 +196,7 @@ void EventManager::Deserialize(SerializedGameData& sgd) } } -bool EventManager::ObjectHasEvents(const GameObject& obj) +bool EventManager::objectHasEvents(const GameObject& obj) { for(const auto& event : events) { @@ -214,7 +214,7 @@ bool EventManager::isObjectInKillList(const GameObject& obj) return helpers::contains(killList, &obj); } -void EventManager::RemoveEvent(const GameEvent*& ep) +void EventManager::removeEvent(const GameEvent*& ep) { if(!ep) return; @@ -226,11 +226,11 @@ void EventManager::RemoveEvent(const GameEvent*& ep) ep = nullptr; return; } - RemoveEventFromQueue(*ep); + removeEventFromQueue(*ep); deletePtr(ep); } -void EventManager::RemoveEventFromQueue(const GameEvent& event) +void EventManager::removeEventFromQueue(const GameEvent& event) { RTTR_Assert(curActiveEvent != &event); auto itEventsAtTime = events.find(event.getTargetGF()); @@ -260,13 +260,13 @@ void EventManager::RemoveEventFromQueue(const GameEvent& event) } } -void EventManager::AddToKillList(GameObject* obj) +void EventManager::addToKillList(GameObject* obj) { RTTR_Assert(!isObjectInKillList(assertNonNull(obj))); killList.emplace_back(obj); } -void EventManager::AddToKillList(std::unique_ptr obj) +void EventManager::addToKillList(std::unique_ptr obj) { - AddToKillList(obj.release()); + addToKillList(obj.release()); } diff --git a/libs/s25main/EventManager.h b/libs/s25main/EventManager.h index bbf54e6c27..29551fdbe9 100644 --- a/libs/s25main/EventManager.h +++ b/libs/s25main/EventManager.h @@ -20,26 +20,26 @@ class EventManager ~EventManager(); /// Deletes all events and objects to be killed. Then resets counters - void Clear(); + void clear(); unsigned getNumActiveEvents() const { return numActiveEvents; } unsigned getEventInstanceCtr() const { return eventInstanceCtr; } /// Increase the GF# and execute all events of that GF - void ExecuteNextGF(); + void executeNextGF(); /// Add an event for the given object /// @param length Number of GFs after which it is executed (>0) /// @param id ID of the event (passed to OnEvent) - const GameEvent* AddEvent(GameObject* obj, unsigned gf_length, unsigned id = 0); + const GameEvent* addEvent(GameObject* obj, unsigned gf_length, unsigned id = 0); /// Add an event that was started before, but paused (e.g. removed as someone stopped walking due to an obstacle) /// @param elapsed Number of GFs that have already elapsed of the length. Passing 0 is equal to adding a regular /// event - const GameEvent* AddEvent(GameObject* obj, unsigned gf_length, unsigned id, unsigned gf_elapsed); + const GameEvent* addEvent(GameObject* obj, unsigned gf_length, unsigned id, unsigned gf_elapsed); /// Remove an event and sets the pointer to nullptr - void RemoveEvent(const GameEvent*& ep); + void removeEvent(const GameEvent*& ep); /// Add an object to be destroyed after current GF - void AddToKillList(GameObject* obj); - void AddToKillList(std::unique_ptr obj); + void addToKillList(GameObject* obj); + void addToKillList(std::unique_ptr obj); void Serialize(SerializedGameData& sgd) const; void Deserialize(SerializedGameData& sgd); @@ -49,7 +49,7 @@ class EventManager unsigned getCurrentGF() const { return currentGF; } /// Return true if the object has any active events. SLOW! - bool ObjectHasEvents(const GameObject& obj); + bool objectHasEvents(const GameObject& obj); /// Return true if the object will be destroyed after the current GF bool isObjectInKillList(const GameObject& obj); @@ -67,14 +67,14 @@ class EventManager GameObjList killList; /// Objects that will be killed after current GF const GameEvent* curActiveEvent; - const GameEvent* AddEventToQueue(const GameEvent* event); - void RemoveEventFromQueue(const GameEvent& event); + const GameEvent* addEventToQueue(const GameEvent* event); + void removeEventFromQueue(const GameEvent& event); /// Execute all events of the current GF - void ExecuteCurrentEvents(); + void executeCurrentEvents(); /// Execute the events from the given iterator - void ExecuteEvents(const EventMap::iterator& itEvents); + void executeEvents(const EventMap::iterator& itEvents); /// Destroy all objects in the kill list - void DestroyCurrentObjects(); + void destroyCurrentObjects(); /// Get all events in the order they will be processed std::vector getEvents() const; }; diff --git a/libs/s25main/FOWObjects.cpp b/libs/s25main/FOWObjects.cpp index 455dd034ba..acecf6b114 100644 --- a/libs/s25main/FOWObjects.cpp +++ b/libs/s25main/FOWObjects.cpp @@ -11,7 +11,7 @@ #include "s25util/colors.h" /// Berechnet die dunklere Spielerfarbe zum Zeichnen -unsigned CalcPlayerFOWDrawColor(const unsigned color) +unsigned calcPlayerFOWDrawColor(const unsigned color) { // Farbkomponenten extrahieren unsigned red = GetRed(color), green = GetGreen(color), blue = GetBlue(color); @@ -30,17 +30,17 @@ unsigned CalcPlayerFOWDrawColor(const unsigned color) fowBuilding::fowBuilding(const BuildingType type, const Nation nation) : type(type), nation(nation) {} -fowBuilding::fowBuilding(SerializedGameData& sgd) : type(sgd.Pop()), nation(sgd.Pop()) {} +fowBuilding::fowBuilding(SerializedGameData& sgd) : type(sgd.pop()), nation(sgd.pop()) {} void fowBuilding::Serialize(SerializedGameData& sgd) const { - sgd.PushEnum(type); - sgd.PushEnum(nation); + sgd.pushEnum(type); + sgd.pushEnum(nation); } -void fowBuilding::Draw(DrawPoint drawPt) const +void fowBuilding::draw(DrawPoint drawPt) const { - noBaseBuilding::getBuildingImage(type, nation).DrawFull(drawPt, FOW_DRAW_COLOR); + noBaseBuilding::getBuildingImage(type, nation).drawFull(drawPt, FOW_DRAW_COLOR); } //////////////////////////////////////////////////////////////////////////////////// @@ -52,30 +52,30 @@ fowBuildingSite::fowBuildingSite(const bool planing, const BuildingType type, co {} fowBuildingSite::fowBuildingSite(SerializedGameData& sgd) - : planing(sgd.PopBool()), type(sgd.Pop()), nation(sgd.Pop()), + : planing(sgd.PopBool()), type(sgd.pop()), nation(sgd.pop()), build_progress(sgd.PopUnsignedChar()) {} void fowBuildingSite::Serialize(SerializedGameData& sgd) const { sgd.PushBool(planing); - sgd.PushEnum(type); - sgd.PushEnum(nation); + sgd.pushEnum(type); + sgd.pushEnum(nation); sgd.PushUnsignedChar(build_progress); } -void fowBuildingSite::Draw(DrawPoint drawPt) const +void fowBuildingSite::draw(DrawPoint drawPt) const { if(planing) { // Baustellenschild mit Schatten zeichnen - LOADER.getNationImage(nation, 450)->DrawFull(drawPt, FOW_DRAW_COLOR); - LOADER.getNationImage(nation, 451)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getNationImage(nation, 450)->drawFull(drawPt, FOW_DRAW_COLOR); + LOADER.getNationImage(nation, 451)->drawFull(drawPt, COLOR_SHADOW); } else { // Baustellenstein und -schatten zeichnen - LOADER.getNationImage(nation, 455)->DrawFull(drawPt, FOW_DRAW_COLOR); - LOADER.getNationImage(nation, 456)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getNationImage(nation, 455)->drawFull(drawPt, FOW_DRAW_COLOR); + LOADER.getNationImage(nation, 456)->drawFull(drawPt, COLOR_SHADOW); // bis dahin gebautes Haus zeichnen @@ -107,21 +107,21 @@ void fowBuildingSite::Draw(DrawPoint drawPt) const // fowFlag fowFlag::fowFlag(const unsigned playerColor, const Nation nation, const FlagType flag_type) - : color(CalcPlayerFOWDrawColor(playerColor)), nation(nation), flag_type(flag_type) + : color(calcPlayerFOWDrawColor(playerColor)), nation(nation), flag_type(flag_type) {} fowFlag::fowFlag(SerializedGameData& sgd) - : color(sgd.PopUnsignedInt()), nation(sgd.Pop()), flag_type(sgd.Pop()) + : color(sgd.PopUnsignedInt()), nation(sgd.pop()), flag_type(sgd.pop()) {} void fowFlag::Serialize(SerializedGameData& sgd) const { sgd.PushUnsignedInt(color); - sgd.PushEnum(nation); - sgd.PushEnum(flag_type); + sgd.pushEnum(nation); + sgd.pushEnum(flag_type); } -void fowFlag::Draw(DrawPoint drawPt) const +void fowFlag::draw(DrawPoint drawPt) const { LOADER.flag_cache[nation][flag_type][0].draw(drawPt, FOW_DRAW_COLOR, color); } @@ -139,17 +139,17 @@ void fowTree::Serialize(SerializedGameData& sgd) const sgd.PushUnsignedChar(size); } -void fowTree::Draw(DrawPoint drawPt) const +void fowTree::draw(DrawPoint drawPt) const { if(size == 3) { // Ausgewachsen - LOADER.getMapTexture(200 + type * 15)->DrawFull(drawPt, FOW_DRAW_COLOR); - LOADER.getMapTexture(350 + type * 15)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getMapTexture(200 + type * 15)->drawFull(drawPt, FOW_DRAW_COLOR); + LOADER.getMapTexture(350 + type * 15)->drawFull(drawPt, COLOR_SHADOW); } else { - LOADER.getMapTexture(208 + type * 15 + size)->DrawFull(drawPt, FOW_DRAW_COLOR); - LOADER.getMapTexture(358 + type * 15 + size)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getMapTexture(208 + type * 15 + size)->drawFull(drawPt, FOW_DRAW_COLOR); + LOADER.getMapTexture(358 + type * 15 + size)->drawFull(drawPt, COLOR_SHADOW); } } @@ -158,15 +158,15 @@ void fowTree::Draw(DrawPoint drawPt) const fowGranite::fowGranite(const GraniteType type, const unsigned char state) : type(type), state(state) {} -fowGranite::fowGranite(SerializedGameData& sgd) : type(sgd.Pop()), state(sgd.PopUnsignedChar()) {} +fowGranite::fowGranite(SerializedGameData& sgd) : type(sgd.pop()), state(sgd.PopUnsignedChar()) {} void fowGranite::Serialize(SerializedGameData& sgd) const { - sgd.PushEnum(type); + sgd.pushEnum(type); sgd.PushUnsignedChar(state); } -void fowGranite::Draw(DrawPoint drawPt) const +void fowGranite::draw(DrawPoint drawPt) const { - LOADER.granite_cache[type][state].DrawFull(drawPt, FOW_DRAW_COLOR); + LOADER.granite_cache[type][state].drawFull(drawPt, FOW_DRAW_COLOR); } diff --git a/libs/s25main/FOWObjects.h b/libs/s25main/FOWObjects.h index 98675e9027..6f443bb0ae 100644 --- a/libs/s25main/FOWObjects.h +++ b/libs/s25main/FOWObjects.h @@ -15,7 +15,7 @@ const unsigned FOW_DRAW_COLOR_BRIGHTNESS = 0x80; const unsigned FOW_DRAW_COLOR = 0xFF808080; /// Berechnet die dunklere Spielerfarbe zum Zeichnen -unsigned CalcPlayerFOWDrawColor(unsigned color); +unsigned calcPlayerFOWDrawColor(unsigned color); /// Gebäude im Nebel class fowBuilding : public FOWObject @@ -30,7 +30,7 @@ class fowBuilding : public FOWObject fowBuilding(BuildingType type, Nation nation); fowBuilding(SerializedGameData& sgd); void Serialize(SerializedGameData& sgd) const override; - void Draw(DrawPoint drawPt) const override; + void draw(DrawPoint drawPt) const override; FoW_Type getType() const override { return FoW_Type::Building; } BuildingType getBuildingType() const { return type; } }; @@ -52,7 +52,7 @@ class fowBuildingSite : public FOWObject fowBuildingSite(bool planing, BuildingType type, Nation nation, unsigned char build_progress); fowBuildingSite(SerializedGameData& sgd); void Serialize(SerializedGameData& sgd) const override; - void Draw(DrawPoint drawPt) const override; + void draw(DrawPoint drawPt) const override; FoW_Type getType() const override { return FoW_Type::Buildingsite; } }; @@ -69,7 +69,7 @@ class fowFlag : public FOWObject fowFlag(unsigned playerColor, Nation nation, FlagType flag_type); fowFlag(SerializedGameData& sgd); void Serialize(SerializedGameData& sgd) const override; - void Draw(DrawPoint drawPt) const override; + void draw(DrawPoint drawPt) const override; FoW_Type getType() const override { return FoW_Type::Flag; } }; @@ -86,7 +86,7 @@ class fowTree : public FOWObject fowTree(unsigned char type, unsigned char size); fowTree(SerializedGameData& sgd); void Serialize(SerializedGameData& sgd) const override; - void Draw(DrawPoint drawPt) const override; + void draw(DrawPoint drawPt) const override; FoW_Type getType() const override { return FoW_Type::Tree; } }; @@ -101,6 +101,6 @@ class fowGranite : public FOWObject fowGranite(GraniteType type, unsigned char state); fowGranite(SerializedGameData& sgd); void Serialize(SerializedGameData& sgd) const override; - void Draw(DrawPoint drawPt) const override; + void draw(DrawPoint drawPt) const override; FoW_Type getType() const override { return FoW_Type::Granite; } }; diff --git a/libs/s25main/FileChecksum.cpp b/libs/s25main/FileChecksum.cpp index cf571dfdda..5e708431df 100644 --- a/libs/s25main/FileChecksum.cpp +++ b/libs/s25main/FileChecksum.cpp @@ -5,7 +5,7 @@ #include "FileChecksum.h" #include -uint32_t CalcChecksumOfFile(const boost::filesystem::path& path) +uint32_t calcChecksumOfFile(const boost::filesystem::path& path) { boost::nowide::ifstream file(path); if(!file) @@ -18,7 +18,7 @@ uint32_t CalcChecksumOfFile(const boost::filesystem::path& path) return checksum; } -uint32_t CalcChecksumOfBuffer(const uint8_t* buffer, size_t size) +uint32_t calcChecksumOfBuffer(const uint8_t* buffer, size_t size) { if(!buffer || size == 0) return 0; diff --git a/libs/s25main/FileChecksum.h b/libs/s25main/FileChecksum.h index cc960abcbb..827f82304e 100644 --- a/libs/s25main/FileChecksum.h +++ b/libs/s25main/FileChecksum.h @@ -6,16 +6,16 @@ #include -uint32_t CalcChecksumOfFile(const boost::filesystem::path& path); -uint32_t CalcChecksumOfBuffer(const uint8_t* buffer, size_t size); +uint32_t calcChecksumOfFile(const boost::filesystem::path& path); +uint32_t calcChecksumOfBuffer(const uint8_t* buffer, size_t size); -inline uint32_t CalcChecksumOfBuffer(const char* buffer, size_t size) +inline uint32_t calcChecksumOfBuffer(const char* buffer, size_t size) { - return CalcChecksumOfBuffer(reinterpret_cast(buffer), size); + return calcChecksumOfBuffer(reinterpret_cast(buffer), size); } template -inline uint32_t CalcChecksumOfBuffer(const T& buffer) +inline uint32_t calcChecksumOfBuffer(const T& buffer) { - return CalcChecksumOfBuffer(buffer.data(), buffer.size()); + return calcChecksumOfBuffer(buffer.data(), buffer.size()); } diff --git a/libs/s25main/FoWObject.h b/libs/s25main/FoWObject.h index f9ab166241..759af63f3b 100644 --- a/libs/s25main/FoWObject.h +++ b/libs/s25main/FoWObject.h @@ -29,7 +29,7 @@ class FOWObject { public: virtual ~FOWObject() = default; - virtual void Draw(DrawPoint drawPt) const = 0; + virtual void draw(DrawPoint drawPt) const = 0; virtual void Serialize(SerializedGameData& sgd) const = 0; virtual FoW_Type getType() const = 0; }; diff --git a/libs/s25main/FramesInfo.cpp b/libs/s25main/FramesInfo.cpp index ae33509519..9a3b441185 100644 --- a/libs/s25main/FramesInfo.cpp +++ b/libs/s25main/FramesInfo.cpp @@ -6,10 +6,10 @@ FramesInfo::FramesInfo() { - Clear(); + clear(); } -void FramesInfo::Clear() +void FramesInfo::clear() { using namespace std::chrono_literals; // Default GF len @@ -23,12 +23,12 @@ void FramesInfo::Clear() FramesInfoClient::FramesInfoClient() { - Clear(); + clear(); } -void FramesInfoClient::Clear() +void FramesInfoClient::clear() { - FramesInfo::Clear(); + FramesInfo::clear(); forcePauseStart = UsedClock::time_point(); forcePauseLen = forcePauseLen.zero(); } diff --git a/libs/s25main/FramesInfo.h b/libs/s25main/FramesInfo.h index df8fc46bb4..22b2e4979d 100644 --- a/libs/s25main/FramesInfo.h +++ b/libs/s25main/FramesInfo.h @@ -12,7 +12,7 @@ struct FramesInfo using UsedClock = std::chrono::steady_clock; FramesInfo(); - void Clear(); + void clear(); /// Length of one GF in ms (~ 1/speed of the game) std::chrono::milliseconds gf_length; @@ -32,7 +32,7 @@ struct FramesInfo struct FramesInfoClient : public FramesInfo { FramesInfoClient(); - void Clear(); + void clear(); /// Force pause the game (start TS and length) e.g. to compensate for lags UsedClock::time_point forcePauseStart; diff --git a/libs/s25main/Game.cpp b/libs/s25main/Game.cpp index 77994b8243..704cd08e25 100644 --- a/libs/s25main/Game.cpp +++ b/libs/s25main/Game.cpp @@ -25,13 +25,13 @@ Game::Game(GlobalGameSettings settings, std::unique_ptr em, const Game::~Game() = default; -void Game::Start(bool startFromSave) +void Game::start(bool startFromSave) { if(started_) return; started_ = true; if(startFromSave) - CheckObjective(); + checkObjective(); else { if(ggs_.objective == GameObjective::EconomyMode) @@ -40,13 +40,13 @@ void Game::Start(bool startFromSave) world_.setEconHandler( std::make_unique(duration_to_gfs(AddonEconomyModeGameLengthList[selection]))); } - StatisticStep(); + statisticStep(); } if(world_.hasLua()) - world_.getLua().EventStart(!startFromSave); + world_.getLua().eventStart(!startFromSave); } -void Game::AddAIPlayer(std::unique_ptr newAI) +void Game::addAIPlayer(std::unique_ptr newAI) { aiPlayers_.push_back(std::move(newAI)); } @@ -70,42 +70,42 @@ unsigned getNumAlivePlayers(const GameWorldBase& world) } } // namespace -void Game::RunGF() +void Game::runGF() { unsigned numPlayersAlive = getNumAlivePlayers(world_); // EventManager Bescheid sagen - em_->ExecuteNextGF(); + em_->executeNextGF(); // Notfallprogramm durchlaufen lassen for(GamePlayer& player : world_.getPlayers()) { if(player.isUsed()) { // Auf Notfall testen (Wenige Bretter/Steine und keine Holzindustrie) - player.TestForEmergencyProgramm(); - player.TestPacts(); + player.testForEmergencyProgramm(); + player.testPacts(); } } if(world_.hasLua()) - world_.getLua().EventGameFrame(em_->getCurrentGF()); + world_.getLua().eventGameFrame(em_->getCurrentGF()); // Update statistic every 30 seconds constexpr auto GFsIn30s = static_cast(duration_to_gfs(30s)); if(em_->getCurrentGF() % GFsIn30s == 0) - StatisticStep(); + statisticStep(); // If some players got defeated check objective if(getNumAlivePlayers(world_) < numPlayersAlive) - CheckObjective(); + checkObjective(); } -void Game::StatisticStep() +void Game::statisticStep() { for(auto& player : world_.getPlayers()) - player.StatisticStep(); + player.statisticStep(); - CheckObjective(); + checkObjective(); } -void Game::CheckObjective() +void Game::checkObjective() { // Check objective if there is one if(finished_ || (ggs_.objective != GameObjective::Conquer3_4 && ggs_.objective != GameObjective::TotalDomination)) diff --git a/libs/s25main/Game.h b/libs/s25main/Game.h index 289ccf838c..4f73c5fdc8 100644 --- a/libs/s25main/Game.h +++ b/libs/s25main/Game.h @@ -25,19 +25,19 @@ class Game boost::ptr_vector aiPlayers_; /// Does the remaining initializations for starting the game - void Start(bool startFromSave); - void RunGF(); + void start(bool startFromSave); + void runGF(); bool isStarted() const { return started_; } bool isGameFinished() const { return finished_; } AIPlayer* getAIPlayer(unsigned id); - void AddAIPlayer(std::unique_ptr newAI); + void addAIPlayer(std::unique_ptr newAI); void setLua(std::unique_ptr newLua); private: /// Updates the statistics - void StatisticStep(); + void statisticStep(); /// Check if the objective was reached (if set) - void CheckObjective(); + void checkObjective(); bool started_, finished_; std::unique_ptr lua; diff --git a/libs/s25main/GameCommand.h b/libs/s25main/GameCommand.h index faa1d662c9..30d915ab5c 100644 --- a/libs/s25main/GameCommand.h +++ b/libs/s25main/GameCommand.h @@ -97,7 +97,7 @@ class GameCommand virtual void Serialize(Serializer& ser) const; /// Execute this GameCommand - virtual void Execute(GameWorld& world, uint8_t playerId) = 0; + virtual void execute(GameWorld& world, uint8_t playerId) = 0; protected: GameCommand(const GCType gcType) : gcType(gcType), refCounter_(0) {} diff --git a/libs/s25main/GameCommands.cpp b/libs/s25main/GameCommands.cpp index 5e3a39b75e..76897c533f 100644 --- a/libs/s25main/GameCommands.cpp +++ b/libs/s25main/GameCommands.cpp @@ -24,12 +24,12 @@ namespace gc { -void SetFlag::Execute(GameWorld& world, uint8_t playerId) +void SetFlag::execute(GameWorld& world, uint8_t playerId) { world.SetFlag(pt_, playerId); } -void DestroyFlag::Execute(GameWorld& world, uint8_t playerId) +void DestroyFlag::execute(GameWorld& world, uint8_t playerId) { world.DestroyFlag(pt_, playerId); } @@ -51,7 +51,7 @@ void BuildRoad::Serialize(Serializer& ser) const helpers::pushEnum(ser, i); } -void BuildRoad::Execute(GameWorld& world, uint8_t playerId) +void BuildRoad::execute(GameWorld& world, uint8_t playerId) { world.BuildRoad(playerId, boat_road, pt_, route); } @@ -67,7 +67,7 @@ void DestroyRoad::Serialize(Serializer& ser) const helpers::pushEnum(ser, start_dir); } -void DestroyRoad::Execute(GameWorld& world, uint8_t playerId) +void DestroyRoad::execute(GameWorld& world, uint8_t playerId) { auto* flag = world.getSpecObj(pt_); if(flag && flag->getPlayer() == playerId) @@ -84,7 +84,7 @@ void UpgradeRoad::Serialize(Serializer& ser) const helpers::pushEnum(ser, start_dir); } -void UpgradeRoad::Execute(GameWorld& world, uint8_t playerId) +void UpgradeRoad::execute(GameWorld& world, uint8_t playerId) { auto* flag = world.getSpecObj(pt_); if(flag && flag->getPlayer() == playerId) @@ -135,7 +135,7 @@ ChangeDistribution::ChangeDistribution(Deserializer& ser) : GameCommand(GCType:: } } -void ChangeDistribution::Execute(GameWorld& world, uint8_t playerId) +void ChangeDistribution::execute(GameWorld& world, uint8_t playerId) { world.getPlayer(playerId).ChangeDistribution(data); } @@ -169,17 +169,17 @@ ChangeBuildOrder::ChangeBuildOrder(Deserializer& ser) } } -void ChangeBuildOrder::Execute(GameWorld& world, uint8_t playerId) +void ChangeBuildOrder::execute(GameWorld& world, uint8_t playerId) { world.getPlayer(playerId).ChangeBuildOrder(useCustomBuildOrder, data); } -void SetBuildingSite::Execute(GameWorld& world, uint8_t playerId) +void SetBuildingSite::execute(GameWorld& world, uint8_t playerId) { world.SetBuildingSite(bt, pt_, playerId); } -void DestroyBuilding::Execute(GameWorld& world, uint8_t playerId) +void DestroyBuilding::execute(GameWorld& world, uint8_t playerId) { world.DestroyBuilding(pt_, playerId); } @@ -205,14 +205,14 @@ ChangeTransport::ChangeTransport(Deserializer& ser) : GameCommand(GCType::Change } } -void ChangeTransport::Execute(GameWorld& world, uint8_t playerId) +void ChangeTransport::execute(GameWorld& world, uint8_t playerId) { - world.getPlayer(playerId).ConvertTransportData(data); + world.getPlayer(playerId).convertTransportData(data); } -void ChangeMilitary::Execute(GameWorld& world, uint8_t playerId) +void ChangeMilitary::execute(GameWorld& world, uint8_t playerId) { - world.getPlayer(playerId).ChangeMilitarySettings(data); + world.getPlayer(playerId).changeMilitarySettings(data); } ChangeTools::ChangeTools(const ToolSettings& data, const int8_t* order_delta) @@ -222,55 +222,55 @@ ChangeTools::ChangeTools(const ToolSettings& data, const int8_t* order_delta) std::copy_n(order_delta, orders.size(), orders.begin()); } -void ChangeTools::Execute(GameWorld& world, uint8_t playerId) +void ChangeTools::execute(GameWorld& world, uint8_t playerId) { - world.getPlayer(playerId).ChangeToolsSettings(data, orders); + world.getPlayer(playerId).changeToolsSettings(data, orders); } -void CallSpecialist::Execute(GameWorld& world, uint8_t playerId) +void CallSpecialist::execute(GameWorld& world, uint8_t playerId) { - world.getPlayer(playerId).CallFlagWorker(pt_, job); + world.getPlayer(playerId).callFlagWorker(pt_, job); } -void Attack::Execute(GameWorld& world, uint8_t playerId) +void Attack::execute(GameWorld& world, uint8_t playerId) { world.Attack(playerId, pt_, soldiers_count, strong_soldiers); } -void SeaAttack::Execute(GameWorld& world, uint8_t playerId) +void SeaAttack::execute(GameWorld& world, uint8_t playerId) { - world.AttackViaSea(playerId, pt_, soldiers_count, strong_soldiers); + world.attackViaSea(playerId, pt_, soldiers_count, strong_soldiers); } -void SetCoinsAllowed::Execute(GameWorld& world, uint8_t playerId) +void SetCoinsAllowed::execute(GameWorld& world, uint8_t playerId) { auto* const bld = world.getSpecObj(pt_); if(bld && bld->getPlayer() == playerId) bld->SetCoinsAllowed(enabled); } -void SetArmorAllowed::Execute(GameWorld& world, uint8_t playerId) +void SetArmorAllowed::execute(GameWorld& world, uint8_t playerId) { auto* const bld = world.getSpecObj(pt_); if(bld && bld->getPlayer() == playerId) bld->SetArmorAllowed(enabled); } -void SetTroopLimit::Execute(GameWorld& world, uint8_t playerId) +void SetTroopLimit::execute(GameWorld& world, uint8_t playerId) { auto* const bld = world.getSpecObj(pt_); if(bld && bld->getPlayer() == playerId) bld->SetTroopLimit(rank, count); } -void SetProductionEnabled::Execute(GameWorld& world, uint8_t playerId) +void SetProductionEnabled::execute(GameWorld& world, uint8_t playerId) { auto* const bld = world.getSpecObj(pt_); if(bld && bld->getPlayer() == playerId) bld->SetProductionEnabled(enabled); } -void SetInventorySetting::Execute(GameWorld& world, uint8_t playerId) +void SetInventorySetting::execute(GameWorld& world, uint8_t playerId) { auto* const bld = world.getSpecObj(pt_); if(bld && bld->getPlayer() == playerId) @@ -322,94 +322,94 @@ SetAllInventorySettings::SetAllInventorySettings(Deserializer& ser) } } -void SetAllInventorySettings::Execute(GameWorld& world, uint8_t playerId) +void SetAllInventorySettings::execute(GameWorld& world, uint8_t playerId) { auto* const bld = world.getSpecObj(pt_); if(bld && bld->getPlayer() == playerId) bld->SetAllInventorySettings(isJob, states); } -void ChangeReserve::Execute(GameWorld& world, uint8_t playerId) +void ChangeReserve::execute(GameWorld& world, uint8_t playerId) { auto* const bld = world.getSpecObj(pt_); if(bld && bld->getPlayer() == playerId) bld->setRealReserve(rank, count); } -void Surrender::Execute(GameWorld& world, uint8_t playerId) +void Surrender::execute(GameWorld& world, uint8_t playerId) { world.getPlayer(playerId).Surrender(); } -void CheatArmageddon::Execute(GameWorld& world, unsigned char /*playerId*/) +void CheatArmageddon::execute(GameWorld& world, unsigned char /*playerId*/) { - world.Armageddon(); + world.armageddon(); } -void DestroyAll::Execute(GameWorld& world, uint8_t playerId) +void DestroyAll::execute(GameWorld& world, uint8_t playerId) { - world.Armageddon(playerId); + world.armageddon(playerId); } -void SuggestPact::Execute(GameWorld& world, uint8_t playerId) +void SuggestPact::execute(GameWorld& world, uint8_t playerId) { world.getPlayer(playerId).SuggestPact(targetPlayer, pt, duration); } -void AcceptPact::Execute(GameWorld& world, uint8_t playerId) +void AcceptPact::execute(GameWorld& world, uint8_t playerId) { world.getPlayer(fromPlayer).AcceptPact(id, pt, playerId); } -void CancelPact::Execute(GameWorld& world, uint8_t playerId) +void CancelPact::execute(GameWorld& world, uint8_t playerId) { world.getPlayer(playerId).CancelPact(pt, otherPlayer); } -void NotifyAlliesOfLocation::Execute(GameWorld& world, uint8_t playerId) +void NotifyAlliesOfLocation::execute(GameWorld& world, uint8_t playerId) { world.getPlayer(playerId).NotifyAlliesOfLocation(pt_); } -void SetShipYardMode::Execute(GameWorld& world, uint8_t playerId) +void SetShipYardMode::execute(GameWorld& world, uint8_t playerId) { auto* const bld = world.getSpecObj(pt_); if(bld && bld->getPlayer() == playerId) bld->setMode(buildShips ? nobShipYard::Mode::Ships : nobShipYard::Mode::Boats); } -void SetTempleProductionMode::Execute(GameWorld& world, uint8_t playerId) +void SetTempleProductionMode::execute(GameWorld& world, uint8_t playerId) { auto* const bld = world.getSpecObj(pt_); if(bld && bld->getPlayer() == playerId) bld->setProductionMode(productionMode); } -void StartStopExpedition::Execute(GameWorld& world, uint8_t playerId) +void StartStopExpedition::execute(GameWorld& world, uint8_t playerId) { auto* const bld = world.getSpecObj(pt_); if(bld && bld->getPlayer() == playerId) { if(start) - bld->StartExpedition(); + bld->startExpedition(); else - bld->StopExpedition(); + bld->stopExpedition(); } } -void StartStopExplorationExpedition::Execute(GameWorld& world, uint8_t playerId) +void StartStopExplorationExpedition::execute(GameWorld& world, uint8_t playerId) { auto* const bld = world.getSpecObj(pt_); if(bld && bld->getPlayer() == playerId) { if(start) - bld->StartExplorationExpedition(); + bld->startExplorationExpedition(); else - bld->StopExplorationExpedition(); + bld->stopExplorationExpedition(); } } -void ExpeditionCommand::Execute(GameWorld& world, uint8_t playerId) +void ExpeditionCommand::execute(GameWorld& world, uint8_t playerId) { noShip* ship = world.getPlayer(playerId).getShipByID(this->ship_id); if(!ship) @@ -417,23 +417,23 @@ void ExpeditionCommand::Execute(GameWorld& world, uint8_t playerId) switch(action) { - case Action::FoundColony: ship->FoundColony(); break; + case Action::FoundColony: ship->foundColony(); break; case Action::CancelExpedition: ship->CancelExpedition(); break; - case Action::North: ship->ContinueExpedition(ShipDirection::North); break; - case Action::NorthEast: ship->ContinueExpedition(ShipDirection::NorthEast); break; - case Action::SouthEast: ship->ContinueExpedition(ShipDirection::SouthEast); break; - case Action::South: ship->ContinueExpedition(ShipDirection::South); break; - case Action::SouthWest: ship->ContinueExpedition(ShipDirection::SouthWest); break; - case Action::NorthWest: ship->ContinueExpedition(ShipDirection::NorthWest); break; + case Action::North: ship->continueExpedition(ShipDirection::North); break; + case Action::NorthEast: ship->continueExpedition(ShipDirection::NorthEast); break; + case Action::SouthEast: ship->continueExpedition(ShipDirection::SouthEast); break; + case Action::South: ship->continueExpedition(ShipDirection::South); break; + case Action::SouthWest: ship->continueExpedition(ShipDirection::SouthWest); break; + case Action::NorthWest: ship->continueExpedition(ShipDirection::NorthWest); break; } } /// Fuehrt das GameCommand aus -void TradeOverLand::Execute(GameWorld& world, uint8_t playerId) +void TradeOverLand::execute(GameWorld& world, uint8_t playerId) { auto* const bld = world.getSpecObj(pt_); if(bld) - world.getPlayer(playerId).Trade(bld, what, count); + world.getPlayer(playerId).trade(bld, what, count); } } // namespace gc diff --git a/libs/s25main/GameCommands.h b/libs/s25main/GameCommands.h index 0243830829..72f45d210e 100644 --- a/libs/s25main/GameCommands.h +++ b/libs/s25main/GameCommands.h @@ -65,7 +65,7 @@ class SetFlag : public Coords SetFlag(Serializer& ser) : Coords(GCType::SetFlag, ser) {} public: - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Flagge zerstören @@ -78,7 +78,7 @@ class DestroyFlag : public Coords DestroyFlag(Serializer& ser) : Coords(GCType::DestroyFlag, ser) {} public: - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Straße bauen @@ -99,7 +99,7 @@ class BuildRoad : public Coords public: void Serialize(Serializer& ser) const override; - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Straße zerstören @@ -116,7 +116,7 @@ class DestroyRoad : public Coords public: void Serialize(Serializer& ser) const override; - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Straße aufwerten @@ -133,7 +133,7 @@ class UpgradeRoad : public Coords public: void Serialize(Serializer& ser) const override; - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Warenverteilung ändern @@ -154,7 +154,7 @@ class ChangeDistribution : public GameCommand helpers::pushContainer(ser, data); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Baureihenfolge ändern @@ -181,7 +181,7 @@ class ChangeBuildOrder : public GameCommand helpers::pushEnum(ser, i); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Baustelle setzen @@ -203,7 +203,7 @@ class SetBuildingSite : public Coords helpers::pushEnum(ser, bt); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Gebäude zerstören @@ -216,7 +216,7 @@ class DestroyBuilding : public Coords DestroyBuilding(Serializer& ser) : Coords(GCType::DestroyBuilding, ser) {} public: - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Set the desired garrison size of a military building @@ -243,7 +243,7 @@ class SetTroopLimit : public Coords ser.PushUnsignedInt(count); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Transportreihenfolge ändern @@ -264,7 +264,7 @@ class ChangeTransport : public GameCommand helpers::pushContainer(ser, data); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Transportreihenfolge ändern @@ -285,7 +285,7 @@ class ChangeMilitary : public GameCommand helpers::pushContainer(ser, data); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Werkzeugeinstellungen ändern @@ -313,7 +313,7 @@ class ChangeTools : public GameCommand helpers::pushContainer(ser, orders); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Geologen rufen @@ -332,7 +332,7 @@ class CallSpecialist : public Coords Coords::Serialize(ser); helpers::pushEnum(ser, job); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Basisklasse für beide Angriffstypen @@ -375,7 +375,7 @@ class Attack : public BaseAttack Attack(Serializer& ser) : BaseAttack(GCType::Attack, ser) {} public: - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// See-Angriff starten @@ -390,7 +390,7 @@ class SeaAttack : public BaseAttack SeaAttack(Serializer& ser) : BaseAttack(GCType::SeaAttack, ser) {} public: - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Goldzufuhr in einem Gebäude stoppen/erlauben @@ -409,7 +409,7 @@ class SetCoinsAllowed : public Coords Coords::Serialize(ser); ser.PushBool(enabled); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Allow/stop armor delivery to building @@ -428,7 +428,7 @@ class SetArmorAllowed : public Coords Coords::Serialize(ser); ser.PushBool(enabled); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Produktivität in einem Gebäude deaktivieren/aktivieren @@ -448,7 +448,7 @@ class SetProductionEnabled : public Coords Coords::Serialize(ser); ser.PushBool(enabled); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Produktivität in einem Gebäude deaktivieren/aktivieren @@ -461,7 +461,7 @@ class NotifyAlliesOfLocation : public Coords NotifyAlliesOfLocation(Serializer& ser) : Coords(GCType::NotifyAlliesOfLocation, ser) {} public: - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Einlagerungseinstellungen von einem Lagerhaus verändern @@ -495,7 +495,7 @@ class SetInventorySetting : public Coords ser.PushUnsignedChar(static_cast(state)); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Alle Einlagerungseinstellungen (für alle Menschen oder Waren) von einem Lagerhaus verändern @@ -523,7 +523,7 @@ class SetAllInventorySettings : public Coords ser.PushUnsignedChar(static_cast(state)); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Verändert die Reserve im HQ auf einen bestimmten Wert @@ -552,7 +552,7 @@ class ChangeReserve : public Coords ser.PushUnsignedInt(count); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Alle Fahnen zerstören @@ -565,7 +565,7 @@ class CheatArmageddon : public GameCommand CheatArmageddon(Serializer& /*ser*/) : GameCommand(GCType::CheatArmageddon) {} public: - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Aufgeben @@ -578,7 +578,7 @@ class Surrender : public GameCommand Surrender(Serializer& /*ser*/) : GameCommand(GCType::Surrender) {} public: - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Alle eigenen Fahnen zerstören @@ -591,7 +591,7 @@ class DestroyAll : public GameCommand DestroyAll(Serializer& /*ser*/) : GameCommand(GCType::DestroyAll) {} public: - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Unterbreitet anderen Spielern einen Bündnisvertrag @@ -623,7 +623,7 @@ class SuggestPact : public GameCommand ser.PushUnsignedInt(duration); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Antwortet auf einen Bündnisvorschlag mit Annehmen oder Ablehnung @@ -655,7 +655,7 @@ class AcceptPact : public GameCommand ser.PushUnsignedChar(fromPlayer); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Bündnis abbrechen bzw. das Angebot zurücknehmen, falls dieses schon gestellt wurde @@ -683,7 +683,7 @@ class CancelPact : public GameCommand ser.PushUnsignedChar(otherPlayer); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; /// Zwischen Boote und Schiffen beim Schiffsbauer hin- und herschalten @@ -697,7 +697,7 @@ class SetShipYardMode : public Coords SetShipYardMode(Serializer& ser) : Coords(GCType::SetShipyardMode, ser), buildShips(ser.PopBool()) {} public: - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; void Serialize(Serializer& ser) const override { Coords::Serialize(ser); @@ -720,7 +720,7 @@ class SetTempleProductionMode : public Coords {} public: - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; void Serialize(Serializer& ser) const override { Coords::Serialize(ser); @@ -739,7 +739,7 @@ class StartStopExpedition : public Coords StartStopExpedition(Serializer& ser) : Coords(GCType::StartStopExpedition, ser), start(ser.PopBool()) {} public: - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; void Serialize(Serializer& ser) const override { Coords::Serialize(ser); @@ -762,7 +762,7 @@ class StartStopExplorationExpedition : public Coords {} public: - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; void Serialize(Serializer& ser) const override { Coords::Serialize(ser); @@ -806,7 +806,7 @@ class ExpeditionCommand : public GameCommand ser.PushUnsignedInt(ship_id); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; private: /// Die Aktion, die ausgeführt werden soll @@ -847,7 +847,7 @@ class TradeOverLand : public Coords ser.PushUnsignedInt(count); } - void Execute(GameWorld& world, uint8_t playerId) override; + void execute(GameWorld& world, uint8_t playerId) override; }; } // namespace gc diff --git a/libs/s25main/GameEvent.cpp b/libs/s25main/GameEvent.cpp index 9c6320d8cb..81cd5d2c31 100644 --- a/libs/s25main/GameEvent.cpp +++ b/libs/s25main/GameEvent.cpp @@ -14,7 +14,7 @@ GameEvent::GameEvent(unsigned instanceId, GameObject* obj, unsigned startGF, uns } GameEvent::GameEvent(SerializedGameData& sgd, const unsigned instanceId) - : instanceId(sgd.AddEvent(instanceId, this)), obj(sgd.PopObject()), startGF(sgd.PopUnsignedInt()), + : instanceId(sgd.addEvent(instanceId, this)), obj(sgd.popObject()), startGF(sgd.PopUnsignedInt()), length(sgd.PopUnsignedInt()), id(sgd.PopUnsignedInt()) { RTTR_Assert(obj); @@ -22,7 +22,7 @@ GameEvent::GameEvent(SerializedGameData& sgd, const unsigned instanceId) void GameEvent::Serialize(SerializedGameData& sgd) const { - sgd.PushObject(obj); + sgd.pushObject(obj); sgd.PushUnsignedInt(startGF); sgd.PushUnsignedInt(length); sgd.PushUnsignedInt(id); diff --git a/libs/s25main/GameLobbyController.cpp b/libs/s25main/GameLobbyController.cpp index 459e5857eb..49dffada7e 100644 --- a/libs/s25main/GameLobbyController.cpp +++ b/libs/s25main/GameLobbyController.cpp @@ -25,7 +25,7 @@ JoinPlayerInfo& GameLobbyController::getJoinPlayer(unsigned playerIdx) return lobby->getPlayer(playerIdx); } -void GameLobbyController::CloseSlot(unsigned playerIdx) +void GameLobbyController::closeSlot(unsigned playerIdx) { setPlayerState(playerIdx, PlayerState::Locked, AI::Info()); } @@ -35,7 +35,7 @@ void GameLobbyController::setPlayerState(unsigned playerIdx, PlayerState state, mainPlayer_.sendMsgAsync(new GameMessage_Player_State(playerIdx, state, aiInfo)); } -void GameLobbyController::TogglePlayerState(unsigned playerIdx) +void GameLobbyController::togglePlayerState(unsigned playerIdx) { const JoinPlayerInfo& player = lobby->getPlayer(playerIdx); @@ -92,19 +92,19 @@ const GlobalGameSettings& GameLobbyController::getGGS() const return lobby->getSettings(); } -void GameLobbyController::ChangeGlobalGameSettings(const GlobalGameSettings& ggs) +void GameLobbyController::changeGlobalGameSettings(const GlobalGameSettings& ggs) { // Already change this here or future changes will be ignored before the server acknowledges the change lobby->getSettings() = ggs; mainPlayer_.sendMsgAsync(new GameMessage_GGSChange(ggs)); } -void GameLobbyController::SwapPlayers(unsigned player1, unsigned player2) +void GameLobbyController::swapPlayers(unsigned player1, unsigned player2) { mainPlayer_.sendMsgAsync(new GameMessage_Player_Swap(player1, player2)); } -void GameLobbyController::StartCountdown(unsigned numSecs) +void GameLobbyController::startCountdown(unsigned numSecs) { mainPlayer_.sendMsgAsync(new GameMessage_Countdown(numSecs)); } @@ -114,7 +114,7 @@ void GameLobbyController::cancelCountdown() mainPlayer_.sendMsgAsync(new GameMessage_CancelCountdown()); } -void GameLobbyController::RemoveLuaScript() +void GameLobbyController::removeLuaScript() { mainPlayer_.sendMsgAsync(new GameMessage_RemoveLua()); } diff --git a/libs/s25main/GameLobbyController.h b/libs/s25main/GameLobbyController.h index 3de8396c28..d7dbaa8ac9 100644 --- a/libs/s25main/GameLobbyController.h +++ b/libs/s25main/GameLobbyController.h @@ -24,18 +24,18 @@ class GameLobbyController : public IGameLobbyController unsigned getMaxNumPlayers() const override; JoinPlayerInfo& getJoinPlayer(unsigned playerIdx) override; - void CloseSlot(unsigned playerIdx) override; + void closeSlot(unsigned playerIdx) override; void setPlayerState(unsigned playerIdx, PlayerState state, const AI::Info& aiInfo) override; - void TogglePlayerState(unsigned playerIdx); + void togglePlayerState(unsigned playerIdx); void setName(unsigned playerIdx, const std::string& name) override; void setPortrait(unsigned playerIdx, unsigned portraitIndex) override; void setColor(unsigned playerIdx, unsigned newColor) override; void setTeam(unsigned playerIdx, Team newTeam) override; void setNation(unsigned playerIdx, Nation newNation) override; const GlobalGameSettings& getGGS() const override; - void ChangeGlobalGameSettings(const GlobalGameSettings& ggs) override; - void SwapPlayers(unsigned player1, unsigned player2); - void StartCountdown(unsigned numSecs); + void changeGlobalGameSettings(const GlobalGameSettings& ggs) override; + void swapPlayers(unsigned player1, unsigned player2); + void startCountdown(unsigned numSecs); void cancelCountdown(); - void RemoveLuaScript(); + void removeLuaScript(); }; diff --git a/libs/s25main/GameManager.cpp b/libs/s25main/GameManager.cpp index 7290ec0c8e..0f24815e4e 100644 --- a/libs/s25main/GameManager.cpp +++ b/libs/s25main/GameManager.cpp @@ -30,19 +30,19 @@ GameManager::GameManager(Log& log, Settings& settings, VideoDriverWrapper& video : log_(log), settings_(settings), videoDriver_(videoDriver), audioDriver_(audioDriver), windowManager_(windowManager) { - ResetAverageGFPS(); + resetAverageGFPS(); } /** * Spiel starten */ -bool GameManager::Start() +bool GameManager::start() { // Einstellungen laden settings_.Load(); /// Videotreiber laden - if(!videoDriver_.LoadDriver(settings_.driver.video)) + if(!videoDriver_.loadDriver(settings_.driver.video)) { s25util::error(_("Video driver couldn't be loaded!")); return false; @@ -51,14 +51,14 @@ bool GameManager::Start() // Fenster erstellen const auto screenSize = (settings_.video.displayMode == DisplayMode::Fullscreen) ? settings_.video.fullscreenSize : settings_.video.windowedSize; - if(!videoDriver_.CreateScreen(screenSize, settings_.video.displayMode)) + if(!videoDriver_.createScreen(screenSize, settings_.video.displayMode)) return false; videoDriver_.setTargetFramerate(settings_.video.framerate); videoDriver_.setMouseWarping(settings_.global.smartCursor); videoDriver_.setGuiScalePercent(settings_.video.guiScale); /// Audiodriver laden - if(!audioDriver_.LoadDriver(settings_.driver.audio)) + if(!audioDriver_.loadDriver(settings_.driver.audio)) { s25util::warning(_("Audio driver couldn't be loaded!")); // return false; @@ -69,42 +69,42 @@ bool GameManager::Start() audioDriver_.setMusicVolume(settings_.sound.musicVolume); // Treibereinstellungen abspeichern - settings_.Save(); + settings_.save(); log_.write(_("\nStarting the game\n")); - return ShowSplashscreen(); + return showSplashscreen(); } /** * Spiel beenden. */ -void GameManager::Stop() +void GameManager::stop() { - GAMECLIENT.Stop(); - GAMESERVER.Stop(); + GAMECLIENT.stop(); + GAMESERVER.stop(); LOBBYCLIENT.Stop(); // Global Einstellungen speichern - settings_.Save(); + settings_.save(); // Fenster beenden - videoDriver_.DestroyScreen(); + videoDriver_.destroyScreen(); } /** * Hauptschleife. */ -bool GameManager::Run() +bool GameManager::run() { // Nachrichtenschleife - if(!videoDriver_.Run()) + if(!videoDriver_.run()) GLOBALVARS.notdone = false; LOBBYCLIENT.Run(); // Get this before the run so we know if we are currently skipping const unsigned targetSkipGF = GAMECLIENT.skiptogf; - GAMECLIENT.Run(); - GAMESERVER.Run(); + GAMECLIENT.run(); + GAMESERVER.run(); if(targetSkipGF) { @@ -145,20 +145,20 @@ bool GameManager::Run() } } else { - videoDriver_.ClearScreen(); - windowManager_.Draw(); - videoDriver_.SwapBuffers(); + videoDriver_.clearScreen(); + windowManager_.draw(); + videoDriver_.swapBuffers(); } gfCounter_.update(); // Fenstermanager aufräumen if(!GLOBALVARS.notdone) - windowManager_.CleanUp(); + windowManager_.cleanUp(); return GLOBALVARS.notdone; } -bool GameManager::ShowSplashscreen() +bool GameManager::showSplashscreen() { libsiedler2::Archiv arSplash; if(!LOADER.Load(arSplash, RTTRCONFIG.ExpandPath(s25::files::splash))) @@ -176,10 +176,10 @@ bool GameManager::ShowSplashscreen() /** * zeigt das Hauptmenü. */ -bool GameManager::ShowMenu() +bool GameManager::showMenu() { - GAMECLIENT.Stop(); - GAMESERVER.Stop(); + GAMECLIENT.stop(); + GAMESERVER.stop(); if(LOBBYCLIENT.IsLoggedIn()) // Lobby zeigen @@ -191,7 +191,7 @@ bool GameManager::ShowMenu() return true; } -void GameManager::ResetAverageGFPS() +void GameManager::resetAverageGFPS() { gfCounter_ = FrameCounter(FrameCounter::clock::duration::max()); // Never update } diff --git a/libs/s25main/GameManager.h b/libs/s25main/GameManager.h index 410497fa35..7b044931ef 100644 --- a/libs/s25main/GameManager.h +++ b/libs/s25main/GameManager.h @@ -20,20 +20,20 @@ class GameManager GameManager(Log& log, Settings& settings, VideoDriverWrapper& videoDriver, AudioDriverWrapper& audioDriver, WindowManager& windowManager); - bool Start(); - void Stop(); - bool Run(); + bool start(); + void stop(); + bool run(); - bool ShowMenu(); + bool showMenu(); /// Average FPS Zähler zurücksetzen. - void ResetAverageGFPS(); + void resetAverageGFPS(); FrameCounter::clock::duration getRuntime() { return gfCounter_.getCurIntervalLength(); } unsigned getNumFrames() { return gfCounter_.getCurNumFrames(); } unsigned getAverageGFPS() { return gfCounter_.getCurFrameRate(); } private: - bool ShowSplashscreen(); + bool showSplashscreen(); Log& log_; Settings& settings_; diff --git a/libs/s25main/GameObject.cpp b/libs/s25main/GameObject.cpp index fe14f35ab0..f5a2edebc9 100644 --- a/libs/s25main/GameObject.cpp +++ b/libs/s25main/GameObject.cpp @@ -27,7 +27,7 @@ GameObject::GameObject(SerializedGameData& sgd, const unsigned obj_id) : objId(o { // ein Objekt mehr ++objCounter_; - sgd.AddObject(this); + sgd.addObject(this); } GameObject::GameObject(const GameObject& go) : objId(go.objId) @@ -36,7 +36,7 @@ GameObject::GameObject(const GameObject& go) : objId(go.objId) ++objCounter_; } -void GameObject::Destroy() {} +void GameObject::destroy() {} GameObject::~GameObject() { @@ -51,23 +51,23 @@ EventManager& GameObject::getEvMgr() return world->getEvMgr(); } -void GameObject::SendPostMessage(unsigned player, std::unique_ptr msg) +void GameObject::sendPostMessage(unsigned player, std::unique_ptr msg) { - world->getPostMgr().SendMsg(player, std::move(msg)); + world->getPostMgr().sendMsg(player, std::move(msg)); } -void GameObject::DetachWorld(GameWorld* gameWorld) +void GameObject::detachWorld(GameWorld* gameWorld) { if(world == gameWorld) world = nullptr; } -void GameObject::AttachWorld(GameWorld* gameWorld) +void GameObject::attachWorld(GameWorld* gameWorld) { world = gameWorld; } -std::string GameObject::ToString() const +std::string GameObject::toString() const { return "GameObject(" + std::to_string(objId) + ")"; } diff --git a/libs/s25main/GameObject.h b/libs/s25main/GameObject.h index c00355085d..292610f9e7 100644 --- a/libs/s25main/GameObject.h +++ b/libs/s25main/GameObject.h @@ -31,10 +31,10 @@ class GameObject GameObject& operator=(const GameObject&) = delete; /// Handle destruction before deleting the instance - virtual void Destroy() = 0; + virtual void destroy() = 0; /// Called for each expiring event (i.e. target GF reached) that this instance has registered - virtual void HandleEvent(unsigned /*id*/) {} + virtual void handleEvent(unsigned /*id*/) {} /// Return the unique ID of an object. Always non-zero! unsigned getObjId() const { return objId; } @@ -42,13 +42,13 @@ class GameObject virtual void Serialize(SerializedGameData& sgd) const = 0; virtual GO_Type getGOT() const = 0; - virtual std::string ToString() const; + virtual std::string toString() const; protected: // Following are some "sandbox methods". They avoid dependencies of subclasses to commonly used functions static EventManager& getEvMgr(); /// Send the msg to given player - static void SendPostMessage(unsigned player, std::unique_ptr msg); + static void sendPostMessage(unsigned player, std::unique_ptr msg); private: unsigned objId; /// unique ID @@ -56,21 +56,21 @@ class GameObject // Static members public: /// Set the currently active world for all game objects - static void AttachWorld(GameWorld* gameWorld); + static void attachWorld(GameWorld* gameWorld); /// Remove the world from all game objects - static void DetachWorld(GameWorld* gameWorld); + static void detachWorld(GameWorld* gameWorld); /// Return the number of objects alive static unsigned getNumObjs() { return objCounter_; } /// Return ID counter, i.e. the last object ID used static unsigned getObjIDCounter() { return objIdCounter_; } /// Reset the object counter and the object ID counter to 0 - static void ResetCounters() + static void resetCounters() { objIdCounter_ = 0; objCounter_ = 0; } /// Set the objIdCounter to the given value and resets the object counter to 1 (noNodeObj) - static void ResetCounters(unsigned objIdCounter) + static void resetCounters(unsigned objIdCounter) { objIdCounter_ = objIdCounter; objCounter_ = 1; @@ -89,13 +89,13 @@ class GameObject template void destroyAndDelete(T*& obj) { - obj->Destroy(); + obj->destroy(); deletePtr(obj); } /// Same but for smart pointers template void destroyAndDelete(T& obj) { - obj->Destroy(); + obj->destroy(); obj.reset(); } diff --git a/libs/s25main/GamePlayer.cpp b/libs/s25main/GamePlayer.cpp index 2df2df620d..d631945109 100644 --- a/libs/s25main/GamePlayer.cpp +++ b/libs/s25main/GamePlayer.cpp @@ -51,16 +51,16 @@ #include GamePlayer::GamePlayer(unsigned playerId, const PlayerInfo& playerInfo, GameWorld& world) - : GamePlayerInfo(playerId, playerInfo), world(world), hqPos(MapPoint::Invalid()), emergency(false) + : GamePlayerInfo(playerId, playerInfo), world(world), hqPos(MapPoint::invalid()), emergency(false) { std::fill(building_enabled.begin(), building_enabled.end(), true); - LoadStandardDistribution(); + loadStandardDistribution(); useCustomBuildOrder_ = false; build_order = getStandardBuildOrder(); transportPrio = STD_TRANSPORT_PRIO; - LoadStandardMilitarySettings(); - LoadStandardToolSettings(); + loadStandardMilitarySettings(); + loadStandardToolSettings(); // Inventur nullen global_inventory.clear(); @@ -70,10 +70,10 @@ GamePlayer::GamePlayer(unsigned playerId, const PlayerInfo& playerInfo, GameWorl statisticCurrentData = {}; statisticCurrentMerchandiseData = {}; - RecalcDistribution(); + recalcDistribution(); } -void GamePlayer::LoadStandardToolSettings() +void GamePlayer::loadStandardToolSettings() { // metalwork tool request @@ -96,7 +96,7 @@ void GamePlayer::LoadStandardToolSettings() toolsSettings_[Tool::Bow] = 1; } -void GamePlayer::LoadStandardMilitarySettings() +void GamePlayer::loadStandardMilitarySettings() { // military settings (military-window-slider, in 10th percent) militarySettings_[0] = MILITARY_SETTINGS_SCALE[0]; //-V525 @@ -128,7 +128,7 @@ BuildOrders GamePlayer::getStandardBuildOrder() return ordering; } -void GamePlayer::LoadStandardDistribution() +void GamePlayer::loadStandardDistribution() { // Verteilung mit Standardwerten füllen bei Waren mit nur einem Ziel (wie z.B. Mehl, Holz...) distribution[GoodType::Flour].client_buildings.push_back(BuildingType::Bakery); @@ -162,7 +162,7 @@ GamePlayer::~GamePlayer() = default; void GamePlayer::Serialize(SerializedGameData& sgd) const { // PlayerStatus speichern, ehemalig - sgd.PushEnum(ps); + sgd.pushEnum(ps); // Nur richtige Spieler serialisieren if(ps != PlayerState::Occupied && ps != PlayerState::AI) @@ -172,18 +172,18 @@ void GamePlayer::Serialize(SerializedGameData& sgd) const buildings.Serialize(sgd); - sgd.PushObjectContainer(roads, true); + sgd.pushObjectContainer(roads, true); sgd.PushUnsignedInt(jobs_wanted.size()); for(const JobNeeded& job : jobs_wanted) { - sgd.PushEnum(job.job); - sgd.PushObject(job.workplace); + sgd.pushEnum(job.job); + sgd.pushObject(job.workplace); } - sgd.PushObjectContainer(ware_list, true); - sgd.PushObjectContainer(flagworkers); - sgd.PushObjectContainer(ships, true); + sgd.pushObjectContainer(ware_list, true); + sgd.pushObjectContainer(flagworkers); + sgd.pushObjectContainer(ships, true); helpers::pushContainer(sgd, shouldSendDefenderList); helpers::pushPoint(sgd, hqPos); @@ -238,7 +238,7 @@ void GamePlayer::Deserialize(SerializedGameData& sgd) std::fill(building_enabled.begin(), building_enabled.end(), true); // Ehemaligen PS auslesen - auto origin_ps = sgd.Pop(); + auto origin_ps = sgd.pop(); // Nur richtige Spieler serialisieren if(origin_ps != PlayerState::Occupied && origin_ps != PlayerState::AI) return; @@ -246,25 +246,25 @@ void GamePlayer::Deserialize(SerializedGameData& sgd) isDefeated = sgd.PopBool(); buildings.Deserialize(sgd); - sgd.PopObjectContainer(roads, GO_Type::Roadsegment); + sgd.popObjectContainer(roads, GO_Type::Roadsegment); jobs_wanted.resize(sgd.PopUnsignedInt()); for(JobNeeded& job : jobs_wanted) { - job.job = sgd.Pop(); - job.workplace = sgd.PopObject(); + job.job = sgd.pop(); + job.workplace = sgd.popObject(); } if(sgd.getGameDataVersion() < 2) - buildings.Deserialize2(sgd); + buildings.deserialize2(sgd); - sgd.PopObjectContainer(ware_list, GO_Type::Ware); - sgd.PopObjectContainer(flagworkers); - sgd.PopObjectContainer(ships, GO_Type::Ship); + sgd.popObjectContainer(ware_list, GO_Type::Ware); + sgd.popObjectContainer(flagworkers); + sgd.popObjectContainer(ships, GO_Type::Ship); - sgd.PopContainer(shouldSendDefenderList); + sgd.popContainer(shouldSendDefenderList); - hqPos = sgd.PopMapPoint(); + hqPos = sgd.popMapPoint(); for(const auto i : helpers::enumRange()) { @@ -394,7 +394,7 @@ void GamePlayer::Deserialize(SerializedGameData& sgd) } template -nobBaseWarehouse* GamePlayer::FindWarehouse(const noRoadNode& start, const T_IsWarehouseGood& isWarehouseGood, +nobBaseWarehouse* GamePlayer::findWarehouse(const noRoadNode& start, const T_IsWarehouseGood& isWarehouseGood, bool to_wh, bool use_boat_roads, unsigned* length, const RoadSegment* forbidden) const { @@ -418,12 +418,12 @@ nobBaseWarehouse* GamePlayer::FindWarehouse(const noRoadNode& start, const T_IsW // now check if there is at least a chance that the next wh is closer than current best because pathfinding // takes time - if(world.CalcDistance(start.getPos(), wh->getPos()) > best_length) + if(world.calcDistance(start.getPos(), wh->getPos()) > best_length) continue; // Bei der erlaubten Benutzung von Bootsstraßen Waren-Pathfinding benutzen wenns zu nem Lagerhaus gehn soll // start <-> ziel tauschen bei der wegfindung unsigned tlength; - if(world.getRoadPathFinder().FindPath(to_wh ? start : *wh, to_wh ? *wh : start, use_boat_roads, best_length, + if(world.getRoadPathFinder().findPath(to_wh ? start : *wh, to_wh ? *wh : start, use_boat_roads, best_length, forbidden, &tlength)) { if(tlength < best_length || !best) @@ -440,16 +440,16 @@ nobBaseWarehouse* GamePlayer::FindWarehouse(const noRoadNode& start, const T_IsW return best; } -void GamePlayer::AddBuildingSite(noBuildingSite* bldSite) +void GamePlayer::addBuildingSite(noBuildingSite* bldSite) { RTTR_Assert(bldSite->getPlayer() == getPlayerId()); - buildings.Add(bldSite); + buildings.add(bldSite); } -void GamePlayer::RemoveBuildingSite(noBuildingSite* bldSite) +void GamePlayer::removeBuildingSite(noBuildingSite* bldSite) { RTTR_Assert(bldSite->getPlayer() == getPlayerId()); - buildings.Remove(bldSite); + buildings.remove(bldSite); } bool GamePlayer::isHQTent() const @@ -465,24 +465,24 @@ void GamePlayer::setHQIsTent(bool isTent) hq->setIsTent(isTent); } -void GamePlayer::AddBuilding(noBuilding* bld, BuildingType bldType) +void GamePlayer::addBuilding(noBuilding* bld, BuildingType bldType) { RTTR_Assert(bld->getPlayer() == getPlayerId()); - buildings.Add(bld, bldType); - ChangeStatisticValue(StatisticType::Buildings, 1); + buildings.add(bld, bldType); + changeStatisticValue(StatisticType::Buildings, 1); // Order a worker if needed const auto& description = BLD_WORK_DESC[bldType]; if(description.job && !isSoldier(*description.job)) { - AddJobWanted(*description.job, bld); + addJobWanted(*description.job, bld); } if(bldType == BuildingType::HarborBuilding) { // Schiff durchgehen und denen Bescheid sagen for(noShip* ship : ships) - ship->NewHarborBuilt(static_cast(bld)); + ship->newHarborBuilt(static_cast(bld)); } else if(bldType == BuildingType::Headquarters) { // If there is more than one HQ, keep the original position. @@ -493,22 +493,22 @@ void GamePlayer::AddBuilding(noBuilding* bld, BuildingType bldType) auto* milBld = static_cast(bld); // New built? -> Calculate frontier distance if(milBld->isNewBuilt()) - milBld->LookForEnemyBuildings(); + milBld->lookForEnemyBuildings(); } } -void GamePlayer::RemoveBuilding(noBuilding* bld, BuildingType bldType) +void GamePlayer::removeBuilding(noBuilding* bld, BuildingType bldType) { RTTR_Assert(bld->getPlayer() == getPlayerId()); - buildings.Remove(bld, bldType); - ChangeStatisticValue(StatisticType::Buildings, -1); + buildings.remove(bld, bldType); + changeStatisticValue(StatisticType::Buildings, -1); if(bldType == BuildingType::HarborBuilding) { // Schiffen Bescheid sagen for(noShip* ship : ships) - ship->HarborDestroyed(static_cast(bld)); + ship->harborDestroyed(static_cast(bld)); } else if(bldType == BuildingType::Headquarters && bld->getPos() == hqPos) { - hqPos = MapPoint::Invalid(); + hqPos = MapPoint::invalid(); for(const noBaseBuilding* bld : buildings.getStorehouses()) { if(bld->getBuildingType() == BuildingType::Headquarters) @@ -519,65 +519,65 @@ void GamePlayer::RemoveBuilding(noBuilding* bld, BuildingType bldType) } } if(BuildingProperties::isWareHouse(bldType) || BuildingProperties::isMilitary(bldType)) - TestDefeat(); + testDefeat(); } -void GamePlayer::NewRoadConnection(RoadSegment* rs) +void GamePlayer::newRoadConnection(RoadSegment* rs) { // Zu den Straßen hinzufgen, da's ja ne neue ist roads.push_back(rs); // Alle Straßen müssen nun gucken, ob sie einen Weg zu einem Warehouse finden - FindCarrierForAllRoads(); + findCarrierForAllRoads(); // Alle Straßen müssen gucken, ob sie einen Esel bekommen können for(RoadSegment* rs : roads) - rs->TryGetDonkey(); + rs->tryGetDonkey(); // Alle Arbeitsplätze müssen nun gucken, ob sie einen Weg zu einem Lagerhaus mit entsprechender Arbeitskraft finden - FindWarehouseForAllJobs(); + findWarehouseForAllJobs(); // Alle Baustellen müssen nun gucken, ob sie ihr benötigtes Baumaterial bekommen (evtl war vorher die Straße zum // Lagerhaus unterbrochen - FindMaterialForBuildingSites(); + findMaterialForBuildingSites(); // Alle Lost-Wares müssen gucken, ob sie ein Lagerhaus finden - FindClientForLostWares(); + findClientForLostWares(); // Alle Militärgebäude müssen ihre Truppen überprüfen und können nun ggf. neue bestellen // und müssen prüfen, ob sie evtl Gold bekommen for(nobMilitary* mil : buildings.getMilitaryBuildings()) { - mil->RegulateTroops(); - mil->SearchCoins(); + mil->regulateTroops(); + mil->searchCoins(); } } -void GamePlayer::AddRoad(RoadSegment* rs) +void GamePlayer::addRoad(RoadSegment* rs) { roads.push_back(rs); } -void GamePlayer::DeleteRoad(RoadSegment* rs) +void GamePlayer::deleteRoad(RoadSegment* rs) { RTTR_Assert(helpers::contains(roads, rs)); roads.remove(rs); } -void GamePlayer::FindClientForLostWares() +void GamePlayer::findClientForLostWares() { // Alle Lost-Wares müssen gucken, ob sie ein Lagerhaus finden for(Ware* ware : ware_list) { if(ware->isLostWare()) { - if(ware->FindRouteToWarehouse() && ware->isWaitingAtFlag()) - ware->CallCarrier(); + if(ware->findRouteToWarehouse() && ware->isWaitingAtFlag()) + ware->callCarrier(); } } } -void GamePlayer::RoadDestroyed() +void GamePlayer::roadDestroyed() { // Alle Waren, die an Flagge liegen und in Lagerhäusern, müssen gucken, ob sie ihr Ziel noch erreichen können, jetzt // wo eine Straße fehlt @@ -587,7 +587,7 @@ void GamePlayer::RoadDestroyed() if(ware->isWaitingAtFlag()) // Liegt die Flagge an einer Flagge, muss ihr Weg neu berechnet werden { RoadPathDirection last_next_dir = ware->getNextDir(); - ware->RecalcRoute(); + ware->recalcRoute(); // special case: ware was lost some time ago and the new goal is at this flag and not a warehouse,hq,harbor // and the "flip-route" picked so a carrier would pick up the ware carry it away from goal then back and // drop it off at the goal was just destroyed? @@ -617,8 +617,8 @@ void GamePlayer::RoadDestroyed() ware->setNextDir(toRoadPathDirection(newWareDir)); } else // no route to goal -> notify goal, try to send ware to a warehouse { - ware->NotifyGoalAboutLostWare(); - ware->FindRouteToWarehouse(); + ware->notifyGoalAboutLostWare(); + ware->findRouteToWarehouse(); } } // end of special case @@ -627,16 +627,16 @@ void GamePlayer::RoadDestroyed() if(ware->getNextDir() != last_next_dir) { // notify current flag that transport in the old direction might not longer be required - ware->RemoveWareJobForDir(last_next_dir); + ware->removeWareJobForDir(last_next_dir); if(ware->getNextDir() != RoadPathDirection::None) - ware->CallCarrier(); + ware->callCarrier(); } } else if(ware->isWaitingInWarehouse()) { if(!ware->isRouteToGoal()) { // Das Ziel wird nun nich mehr beliefert - ware->NotifyGoalAboutLostWare(); + ware->notifyGoalAboutLostWare(); // Ware aus der Warteliste des Lagerhauses entfernen static_cast(ware->getLocation())->cancelWare(ware); // Ware aus der Liste raus @@ -646,7 +646,7 @@ void GamePlayer::RoadDestroyed() } else if(ware->isWaitingForShip()) { // Weg neu berechnen - ware->RecalcRoute(); + ware->recalcRoute(); } ++it; @@ -655,11 +655,11 @@ void GamePlayer::RoadDestroyed() // Alle Häfen müssen ihre Figuren den Weg überprüfen lassen for(nobHarborBuilding* hb : buildings.getHarbors()) { - hb->ExamineShipRouteOfPeople(); + hb->examineShipRouteOfPeople(); } } -bool GamePlayer::FindCarrierForRoad(RoadSegment& rs) const +bool GamePlayer::findCarrierForRoad(RoadSegment& rs) const { RTTR_Assert(rs.getF1() != nullptr && rs.getF2() != nullptr); std::array length; @@ -669,25 +669,25 @@ bool GamePlayer::FindCarrierForRoad(RoadSegment& rs) const if(rs.getRoadType() == RoadType::Water) { // dann braucht man Träger UND Boot - best[0] = FindWarehouse(*rs.getF1(), FW::HasWareAndFigure(GoodType::Boat, Job::Helper, false), false, false, + best[0] = findWarehouse(*rs.getF1(), FW::HasWareAndFigure(GoodType::Boat, Job::Helper, false), false, false, length.data(), &rs); // 2. Flagge des Weges - best[1] = FindWarehouse(*rs.getF2(), FW::HasWareAndFigure(GoodType::Boat, Job::Helper, false), false, false, + best[1] = findWarehouse(*rs.getF2(), FW::HasWareAndFigure(GoodType::Boat, Job::Helper, false), false, false, &length[1], &rs); } else { // 1. Flagge des Weges - best[0] = FindWarehouse(*rs.getF1(), FW::HasFigure(Job::Helper, false), false, false, length.data(), &rs); + best[0] = findWarehouse(*rs.getF1(), FW::HasFigure(Job::Helper, false), false, false, length.data(), &rs); // 2. Flagge des Weges - best[1] = FindWarehouse(*rs.getF2(), FW::HasFigure(Job::Helper, false), false, false, &length[1], &rs); + best[1] = findWarehouse(*rs.getF2(), FW::HasFigure(Job::Helper, false), false, false, &length[1], &rs); } // überhaupt nen Weg gefunden? // Welche Flagge benutzen? if(best[0] && (!best[1] || length[0] < length[1])) - best[0]->OrderCarrier(*rs.getF1(), rs); + best[0]->orderCarrier(*rs.getF1(), rs); else if(best[1]) - best[1]->OrderCarrier(*rs.getF2(), rs); + best[1]->orderCarrier(*rs.getF2(), rs); else return false; return true; @@ -698,7 +698,7 @@ bool GamePlayer::isWarehouseValid(nobBaseWarehouse* wh) const return helpers::contains(buildings.getStorehouses(), wh); } -void GamePlayer::RecalcDistribution() +void GamePlayer::recalcDistribution() { GoodType lastWare = GoodType::Nothing; for(const DistributionMapping& mapping : distributionMap) @@ -706,11 +706,11 @@ void GamePlayer::RecalcDistribution() if(lastWare == std::get<0>(mapping)) continue; lastWare = std::get<0>(mapping); - RecalcDistributionOfWare(std::get<0>(mapping)); + recalcDistributionOfWare(std::get<0>(mapping)); } } -void GamePlayer::RecalcDistributionOfWare(const GoodType ware) +void GamePlayer::recalcDistributionOfWare(const GoodType ware) { // Punktesystem zur Verteilung, in der Liste alle Gebäude sammeln, die die Ware wollen distribution[ware].client_buildings.clear(); @@ -753,31 +753,31 @@ void GamePlayer::RecalcDistributionOfWare(const GoodType ware) distribution[ware].selected_goal = 0; } -void GamePlayer::FindCarrierForAllRoads() +void GamePlayer::findCarrierForAllRoads() { for(RoadSegment* rs : roads) { if(!rs->hasCarrier(0)) - FindCarrierForRoad(*rs); + findCarrierForRoad(*rs); } } -void GamePlayer::FindMaterialForBuildingSites() +void GamePlayer::findMaterialForBuildingSites() { for(noBuildingSite* bldSite : buildings.getBuildingSites()) - bldSite->OrderConstructionMaterial(); + bldSite->orderConstructionMaterial(); } -void GamePlayer::AddJobWanted(const Job job, noRoadNode* workplace) +void GamePlayer::addJobWanted(const Job job, noRoadNode* workplace) { - if(!FindWarehouseForJob(job, *workplace)) + if(!findWarehouseForJob(job, *workplace)) { JobNeeded jn = {job, workplace}; jobs_wanted.push_back(jn); } } -void GamePlayer::JobNotWanted(noRoadNode* workplace, bool all) +void GamePlayer::jobNotWanted(noRoadNode* workplace, bool all) { for(auto it = jobs_wanted.begin(); it != jobs_wanted.end();) { @@ -793,7 +793,7 @@ void GamePlayer::JobNotWanted(noRoadNode* workplace, bool all) } } -void GamePlayer::OneJobNotWanted(const Job job, noRoadNode* workplace) +void GamePlayer::oneJobNotWanted(const Job job, noRoadNode* workplace) { const auto it = helpers::find_if( jobs_wanted, [workplace, job](const auto& it) { return it.workplace == workplace && it.job == job; }); @@ -801,9 +801,9 @@ void GamePlayer::OneJobNotWanted(const Job job, noRoadNode* workplace) jobs_wanted.erase(it); } -void GamePlayer::SendPostMessage(std::unique_ptr msg) +void GamePlayer::sendPostMessage(std::unique_ptr msg) { - world.getPostMgr().SendMsg(getPlayerId(), std::move(msg)); + world.getPostMgr().sendMsg(getPlayerId(), std::move(msg)); } unsigned GamePlayer::getToolsOrderedVisual(Tool tool) const @@ -816,7 +816,7 @@ unsigned GamePlayer::getToolsOrdered(Tool tool) const return tools_ordered[tool]; } -bool GamePlayer::ChangeToolOrderVisual(Tool tool, int changeAmount) const +bool GamePlayer::changeToolOrderVisual(Tool tool, int changeAmount) const { if(std::abs(changeAmount) > 100) return false; @@ -832,7 +832,7 @@ unsigned GamePlayer::getToolPriority(Tool tool) const return toolsSettings_[tool]; } -void GamePlayer::ToolOrderProcessed(Tool tool) +void GamePlayer::toolOrderProcessed(Tool tool) { if(tools_ordered[tool]) { @@ -841,7 +841,7 @@ void GamePlayer::ToolOrderProcessed(Tool tool) } } -bool GamePlayer::FindWarehouseForJob(const Job job, noRoadNode& goal) const +bool GamePlayer::findWarehouseForJob(const Job job, noRoadNode& goal) const { // Optimization: return early if building is isolated if(goal.getType() == NodalObjectType::Building || goal.getType() == NodalObjectType::Buildingsite) @@ -850,36 +850,36 @@ bool GamePlayer::FindWarehouseForJob(const Job job, noRoadNode& goal) const return false; } - nobBaseWarehouse* wh = FindWarehouse(goal, FW::HasFigure(job, true), false, false); + nobBaseWarehouse* wh = findWarehouse(goal, FW::HasFigure(job, true), false, false); if(wh) { // Es wurde ein Lagerhaus gefunden, wo es den geforderten Beruf gibt, also den Typen zur Arbeit rufen - wh->OrderJob(job, goal, true); + wh->orderJob(job, goal, true); return true; } return false; } -void GamePlayer::FindWarehouseForAllJobs() +void GamePlayer::findWarehouseForAllJobs() { for(auto it = jobs_wanted.begin(); it != jobs_wanted.end();) { - if(FindWarehouseForJob(it->job, *it->workplace)) + if(findWarehouseForJob(it->job, *it->workplace)) it = jobs_wanted.erase(it); else ++it; } } -void GamePlayer::FindWarehouseForAllJobs(const Job job) +void GamePlayer::findWarehouseForAllJobs(const Job job) { for(auto it = jobs_wanted.begin(); it != jobs_wanted.end();) { if(it->job == job) { - if(FindWarehouseForJob(it->job, *it->workplace)) + if(findWarehouseForJob(it->job, *it->workplace)) it = jobs_wanted.erase(it); else ++it; @@ -894,21 +894,21 @@ static bool IsWareFineWithEmergencyProtocol(GoodType goodType, const noBaseBuild || goal.getBuildingType() == BuildingType::Woodcutter || goal.getBuildingType() == BuildingType::Sawmill; } -Ware* GamePlayer::OrderWare(const GoodType ware, noBaseBuilding& goal) +Ware* GamePlayer::orderWare(const GoodType ware, noBaseBuilding& goal) { /// Gibt es ein Lagerhaus mit dieser Ware? - nobBaseWarehouse* wh = FindWarehouse(goal, FW::HasMinWares(ware, 1), false, true); + nobBaseWarehouse* wh = findWarehouse(goal, FW::HasMinWares(ware, 1), false, true); if(wh) { // Prüfe ob Notfallprogramm aktiv if(!emergency) - return wh->OrderWare(ware, goal); + return wh->orderWare(ware, goal); else { // Wenn Notfallprogramm aktiv nur an Holzfäller und Sägewerke Bretter/Steine liefern if(IsWareFineWithEmergencyProtocol(ware, goal)) - return wh->OrderWare(ware, goal); + return wh->orderWare(ware, goal); else return nullptr; } @@ -921,7 +921,7 @@ Ware* GamePlayer::OrderWare(const GoodType ware, noBaseBuilding& goal) if(curWare->isLostWare() && curWare->type == ware) { // got a lost ware with a road to goal -> find best - unsigned curLength = curWare->CheckNewGoalForLostWare(goal); + unsigned curLength = curWare->checkNewGoalForLostWare(goal); if(curLength < bestLength) { bestLength = curLength; @@ -938,27 +938,27 @@ Ware* GamePlayer::OrderWare(const GoodType ware, noBaseBuilding& goal) return nullptr; } -nofCarrier* GamePlayer::OrderDonkey(RoadSegment& road) const +nofCarrier* GamePlayer::orderDonkey(RoadSegment& road) const { std::array length; std::array best; // 1. Flagge des Weges - best[0] = FindWarehouse(*road.getF1(), FW::HasFigure(Job::PackDonkey, false), false, false, length.data(), &road); + best[0] = findWarehouse(*road.getF1(), FW::HasFigure(Job::PackDonkey, false), false, false, length.data(), &road); // 2. Flagge des Weges - best[1] = FindWarehouse(*road.getF2(), FW::HasFigure(Job::PackDonkey, false), false, false, &length[1], &road); + best[1] = findWarehouse(*road.getF2(), FW::HasFigure(Job::PackDonkey, false), false, false, &length[1], &road); // überhaupt nen Weg gefunden? // Welche Flagge benutzen? if(best[0] && (!best[1] || length[0] < length[1])) - return best[0]->OrderDonkey(road, *road.getF1()); + return best[0]->orderDonkey(road, *road.getF1()); else if(best[1]) - return best[1]->OrderDonkey(road, *road.getF2()); + return best[1]->orderDonkey(road, *road.getF2()); else return nullptr; } -RoadSegment* GamePlayer::FindRoadForDonkey(noRoadNode& start, noRoadNode** goal) +RoadSegment* GamePlayer::findRoadForDonkey(noRoadNode& start, noRoadNode** goal) { // Bisher höchste Trägerproduktivität und die entsprechende Straße dazu unsigned best_productivity = 0; @@ -969,15 +969,15 @@ RoadSegment* GamePlayer::FindRoadForDonkey(noRoadNode& start, noRoadNode** goal) for(RoadSegment* roadSeg : roads) { // Braucht die Straße einen Esel? - if(roadSeg->NeedDonkey()) + if(roadSeg->needDonkey()) { // Beste Flagge von diesem Weg, und beste Wegstrecke noRoadNode* current_best_goal = nullptr; // Weg zu beiden Flaggen berechnen unsigned length1, length2; - bool isF1Reachable = world.FindHumanPathOnRoads(start, *roadSeg->getF1(), &length1, nullptr, roadSeg) + bool isF1Reachable = world.findHumanPathOnRoads(start, *roadSeg->getF1(), &length1, nullptr, roadSeg) != RoadPathDirection::None; - bool isF2Reachable = world.FindHumanPathOnRoads(start, *roadSeg->getF2(), &length2, nullptr, roadSeg) + bool isF2Reachable = world.findHumanPathOnRoads(start, *roadSeg->getF2(), &length2, nullptr, roadSeg) != RoadPathDirection::None; // Wenn man zu einer Flagge nich kommt, die jeweils andere nehmen @@ -1038,13 +1038,13 @@ struct ClientForWare } }; -noBaseBuilding* GamePlayer::FindClientForWare(const Ware& ware) +noBaseBuilding* GamePlayer::findClientForWare(const Ware& ware) { // If the ware is a coin or an armor, the goal is determined by another logic if(ware.type == GoodType::Coins) - return FindClientForCoin(ware); + return findClientForCoin(ware); else if(ware.type == GoodType::Armor) - return FindClientForArmor(ware); + return findClientForArmor(ware); // Warentyp herausfinden GoodType gt = ware.type; @@ -1061,12 +1061,12 @@ noBaseBuilding* GamePlayer::FindClientForWare(const Ware& ware) { for(nobHarborBuilding* harbor : buildings.getHarbors()) { - unsigned points = harbor->CalcDistributionPoints(gt); + unsigned points = harbor->calcDistributionPoints(gt); if(!points) continue; points += 10 * 30; // Verteilung existiert nicht, Expeditionen haben allerdings hohe Priorität - unsigned distance = world.CalcDistance(start->getPos(), harbor->getPos()) / 2; + unsigned distance = world.calcDistance(start->getPos(), harbor->getPos()) / 2; possibleClients.push_back(ClientForWare(harbor, points > distance ? points - distance : 0, points)); } } @@ -1083,12 +1083,12 @@ noBaseBuilding* GamePlayer::FindClientForWare(const Ware& ware) if(!bldSite->isConnected()) continue; - unsigned points = bldSite->CalcDistributionPoints(gt); + unsigned points = bldSite->calcDistributionPoints(gt); if(!points) continue; points += wareDistribution.percent_buildings[BuildingType::Headquarters] * 30; - unsigned distance = world.CalcDistance(start->getPos(), bldSite->getPos()) / 2; + unsigned distance = world.calcDistance(start->getPos(), bldSite->getPos()) / 2; possibleClients.push_back(ClientForWare(bldSite, points > distance ? points - distance : 0, points)); } } else @@ -1100,7 +1100,7 @@ noBaseBuilding* GamePlayer::FindClientForWare(const Ware& ware) if(!bld->isConnected()) continue; - unsigned points = bld->CalcDistributionPoints(gt); + unsigned points = bld->calcDistributionPoints(gt); if(!points) continue; // Ware not needed @@ -1115,7 +1115,7 @@ noBaseBuilding* GamePlayer::FindClientForWare(const Ware& ware) points = 0; } - unsigned distance = world.CalcDistance(start->getPos(), bld->getPos()) / 2; + unsigned distance = world.calcDistance(start->getPos(), bld->getPos()) / 2; possibleClients.push_back(ClientForWare(bld, points > distance ? points - distance : 0, points)); } } @@ -1149,7 +1149,7 @@ noBaseBuilding* GamePlayer::FindClientForWare(const Ware& ware) // Find path ONLY if it may be better. Pathfinding is limited to the worst path score that would lead to a // better score. This eliminates the worst case scenario where all nodes in a split road network would be hit by // the pathfinding only to conclude that there is no possible path. - if(world.FindPathForWareOnRoads(*start, *possibleClient.bld, &path_length, nullptr, + if(world.findPathForWareOnRoads(*start, *possibleClient.bld, &path_length, nullptr, (possibleClient.points - best_points) * 2 - 1) != RoadPathDirection::None) { @@ -1171,30 +1171,30 @@ noBaseBuilding* GamePlayer::FindClientForWare(const Ware& ware) // Wenn kein Abnehmer gefunden wurde, muss es halt in ein Lagerhaus if(!bestBld) - bestBld = FindWarehouseForWare(ware); + bestBld = findWarehouseForWare(ware); return bestBld; } -nobBaseWarehouse* GamePlayer::FindWarehouseForWare(const Ware& ware) const +nobBaseWarehouse* GamePlayer::findWarehouseForWare(const Ware& ware) const { // Check whs that collect this ware - nobBaseWarehouse* wh = FindWarehouse(*ware.getLocation(), FW::CollectsWare(ware.type), true, true); + nobBaseWarehouse* wh = findWarehouse(*ware.getLocation(), FW::CollectsWare(ware.type), true, true); // If there is none, check those that accept it if(!wh) { // First find the ones, that do not send it right away (IMPORTANT: This avoids sending a ware to the wh that is // sending the ware out) - wh = FindWarehouse(*ware.getLocation(), FW::AcceptsWareButNoSend(ware.type), true, true); + wh = findWarehouse(*ware.getLocation(), FW::AcceptsWareButNoSend(ware.type), true, true); // The others only if this fails if(!wh) - wh = FindWarehouse(*ware.getLocation(), FW::AcceptsWare(ware.type), true, true); + wh = findWarehouse(*ware.getLocation(), FW::AcceptsWare(ware.type), true, true); } return wh; } template -typename T_Buildings::value_type GamePlayer::FindClientImpl(const Ware& ware, T_GetPriority&& getPriority, +typename T_Buildings::value_type GamePlayer::findClientImpl(const Ware& ware, T_GetPriority&& getPriority, const T_Buildings& buildings) const { // TODO(replay): Unify with FindClientForWare: Sort by estimated priority first for less path finding. @@ -1216,11 +1216,11 @@ typename T_Buildings::value_type GamePlayer::FindClientImpl(const Ware& ware, T_ if(points > bestPoints) { const unsigned maxPathCosts = points - bestPoints - 1; - const unsigned distance = world.CalcDistance(warePos, bld->getPos()); + const unsigned distance = world.calcDistance(warePos, bld->getPos()); if(distance > maxPathCosts) continue; unsigned pathCosts; - if(world.FindPathForWareOnRoads(wareLocation, *bld, &pathCosts, nullptr, maxPathCosts) + if(world.findPathForWareOnRoads(wareLocation, *bld, &pathCosts, nullptr, maxPathCosts) != RoadPathDirection::None) { RTTR_Assert(points > pathCosts && points - pathCosts > bestPoints); @@ -1232,24 +1232,24 @@ typename T_Buildings::value_type GamePlayer::FindClientImpl(const Ware& ware, T_ return bestClient; } -nobBaseMilitary* GamePlayer::FindClientForCoin(const Ware& ware) const +nobBaseMilitary* GamePlayer::findClientForCoin(const Ware& ware) const { - nobBaseMilitary* result = FindClientImpl( - ware, [](const nobMilitary& bld) { return bld.CalcCoinsPoints(); }, buildings.getMilitaryBuildings()); + nobBaseMilitary* result = findClientImpl( + ware, [](const nobMilitary& bld) { return bld.calcCoinsPoints(); }, buildings.getMilitaryBuildings()); // Send to warehouse if no military building needs the coins if(!result) - result = FindWarehouseForWare(ware); + result = findWarehouseForWare(ware); return result; } -nobBaseMilitary* GamePlayer::FindClientForArmor(const Ware& ware) const +nobBaseMilitary* GamePlayer::findClientForArmor(const Ware& ware) const { - nobBaseMilitary* result = FindClientImpl( - ware, [](const nobMilitary& bld) { return bld.CalcArmorPoints(); }, buildings.getMilitaryBuildings()); + nobBaseMilitary* result = findClientImpl( + ware, [](const nobMilitary& bld) { return bld.calcArmorPoints(); }, buildings.getMilitaryBuildings()); // Send to warehouse if no military building needs the coins if(!result) - result = FindWarehouseForWare(ware); + result = findWarehouseForWare(ware); return result; } @@ -1284,7 +1284,7 @@ unsigned GamePlayer::getBuidingSitePriority(const noBuildingSite* building_site) return std::numeric_limits::max() / 1000; } -void GamePlayer::ConvertTransportData(const TransportOrders& transport_data) +void GamePlayer::convertTransportData(const TransportOrders& transport_data) { for(const auto ware : helpers::EnumRange{}) transportPrio[ware] = getTransportPrioFromOrdering(transport_data, ware); @@ -1309,7 +1309,7 @@ bool GamePlayer::isAttackable(const unsigned char playerId) const return getPactState(PactType::NonAgressionPact, playerId) != PactState::Accepted; } -void GamePlayer::OrderTroops(nobMilitary& goal, std::array counts, +void GamePlayer::orderTroops(nobMilitary& goal, std::array counts, unsigned total_max) const { // Solange Lagerhäuser nach Soldaten absuchen, bis entweder keins mehr übrig ist oder alle Soldaten bestellt sind @@ -1321,28 +1321,28 @@ void GamePlayer::OrderTroops(nobMilitary& goal, std::array 0; - wh = FindWarehouse(goal, FW::HasAnyMatchingSoldier(desiredRanks), false, false); + wh = findWarehouse(goal, FW::HasAnyMatchingSoldier(desiredRanks), false, false); if(wh) { - wh->OrderTroops(goal, counts, total_max); + wh->orderTroops(goal, counts, total_max); sum = std::accumulate(counts.begin(), counts.end(), 0u); } } while(total_max && sum && wh); } -void GamePlayer::RegulateAllTroops() +void GamePlayer::regulateAllTroops() { for(nobMilitary* milBld : buildings.getMilitaryBuildings()) - milBld->RegulateTroops(); + milBld->regulateTroops(); } -void GamePlayer::RecalcMilitaryFlags() +void GamePlayer::recalcMilitaryFlags() { for(nobMilitary* milBld : buildings.getMilitaryBuildings()) - milBld->LookForEnemyBuildings(nullptr); + milBld->lookForEnemyBuildings(nullptr); } -void GamePlayer::NewSoldiersAvailable(const unsigned& soldier_count) +void GamePlayer::newSoldiersAvailable(const unsigned& soldier_count) { RTTR_Assert(soldier_count > 0); // solange laufen lassen, bis soldier_count = 0, d.h. der Soldat irgendwohin geschickt wurde @@ -1351,7 +1351,7 @@ void GamePlayer::NewSoldiersAvailable(const unsigned& soldier_count) { if(milBld->isNewBuilt()) { - milBld->RegulateTroops(); + milBld->regulateTroops(); // Used that soldier? Go out if(!soldier_count) return; @@ -1363,7 +1363,7 @@ void GamePlayer::NewSoldiersAvailable(const unsigned& soldier_count) { if(milBld->getFrontierDistance() == FrontierDistance::Near) { - milBld->RegulateTroops(); + milBld->regulateTroops(); // Used that soldier? Go out if(!soldier_count) return; @@ -1376,22 +1376,22 @@ void GamePlayer::NewSoldiersAvailable(const unsigned& soldier_count) // already checked? -> skip if(milBld->getFrontierDistance() == FrontierDistance::Near || milBld->isNewBuilt()) continue; - milBld->RegulateTroops(); + milBld->regulateTroops(); if(!soldier_count) // used the soldier? return; } } -void GamePlayer::CallFlagWorker(const MapPoint pt, const Job job) +void GamePlayer::callFlagWorker(const MapPoint pt, const Job job) { auto* flag = world.getSpecObj(pt); if(!flag) return; /// Find wh with given job type (e.g. geologist, scout, ...) - nobBaseWarehouse* wh = FindWarehouse(*flag, FW::HasFigure(job, true), false, false); + nobBaseWarehouse* wh = findWarehouse(*flag, FW::HasFigure(job, true), false, false); if(wh) - wh->OrderJob(job, *flag, true); + wh->orderJob(job, *flag, true); } bool GamePlayer::isFlagWorker(const nofFlagWorker* flagworker) @@ -1399,21 +1399,21 @@ bool GamePlayer::isFlagWorker(const nofFlagWorker* flagworker) return helpers::contains(flagworkers, flagworker); } -void GamePlayer::FlagDestroyed(noFlag* flag) +void GamePlayer::flagDestroyed(noFlag* flag) { // Alle durchgehen und ggf. sagen, dass sie keine Flagge mehr haben, wenn das ihre Flagge war, die zerstört wurde for(auto it = flagworkers.begin(); it != flagworkers.end();) { if((*it)->getFlag() == flag) { - (*it)->LostWork(); + (*it)->lostWork(); it = flagworkers.erase(it); } else ++it; } } -void GamePlayer::RefreshDefenderList() +void GamePlayer::refreshDefenderList() { shouldSendDefenderList.clear(); // Add as many true values as set in the settings, the rest will be false @@ -1423,7 +1423,7 @@ void GamePlayer::RefreshDefenderList() RANDOM_SHUFFLE2(shouldSendDefenderList, 0); } -void GamePlayer::ChangeMilitarySettings(const MilitarySettings& military_settings) +void GamePlayer::changeMilitarySettings(const MilitarySettings& military_settings) { for(unsigned i = 0; i < military_settings.size(); ++i) { @@ -1432,12 +1432,12 @@ void GamePlayer::ChangeMilitarySettings(const MilitarySettings& military_setting this->militarySettings_[i] = military_settings[i]; } /// Truppen müssen neu kalkuliert werden - RegulateAllTroops(); + regulateAllTroops(); /// Die Verteidigungsliste muss erneuert werden - RefreshDefenderList(); + refreshDefenderList(); } -void GamePlayer::ChangeToolsSettings(const ToolSettings& tools_settings, +void GamePlayer::changeToolsSettings(const ToolSettings& tools_settings, const helpers::EnumArray& orderChanges) { const bool settingsChanged = toolsSettings_ != tools_settings; @@ -1467,7 +1467,7 @@ void GamePlayer::ChangeDistribution(const Distributions& distribution_settings) distribution[std::get<0>(mapping)].percent_buildings[std::get<1>(mapping)] = distribution_settings[idx++]; } - RecalcDistribution(); + recalcDistribution(); } void GamePlayer::ChangeBuildOrder(bool useCustomBuildOrder, const BuildOrders& order_data) @@ -1476,18 +1476,18 @@ void GamePlayer::ChangeBuildOrder(bool useCustomBuildOrder, const BuildOrders& o this->build_order = order_data; } -bool GamePlayer::ShouldSendDefender() +bool GamePlayer::shouldSendDefender() { // Wenn wir schon am Ende sind, muss die Verteidgungsliste erneuert werden if(shouldSendDefenderList.empty()) - RefreshDefenderList(); + refreshDefenderList(); bool result = shouldSendDefenderList.back(); shouldSendDefenderList.pop_back(); return result; } -void GamePlayer::TestDefeat() +void GamePlayer::testDefeat() { // Nicht schon besiegt? // Keine Militärgebäude, keine Lagerhäuser (HQ,Häfen) -> kein Land --> verloren @@ -1522,13 +1522,13 @@ void GamePlayer::setStatisticValue(StatisticType type, unsigned value) statisticCurrentData[type] = value; } -void GamePlayer::ChangeStatisticValue(StatisticType type, int change) +void GamePlayer::changeStatisticValue(StatisticType type, int change) { RTTR_Assert(change >= 0 || statisticCurrentData[type] >= static_cast(-change)); statisticCurrentData[type] += change; } -void GamePlayer::IncreaseMerchandiseStatistic(GoodType type) +void GamePlayer::increaseMerchandiseStatistic(GoodType type) { // Einsortieren... switch(type) @@ -1568,7 +1568,7 @@ void GamePlayer::IncreaseMerchandiseStatistic(GoodType type) } } -void GamePlayer::CalcStatistics() +void GamePlayer::calcStatistics() { // Waren aus der Inventur zählen statisticCurrentData[StatisticType::Merchandise] = 0; @@ -1587,16 +1587,16 @@ void GamePlayer::CalcStatistics() + global_inventory.people[Job::General] * 5; // Produktivität berechnen - statisticCurrentData[StatisticType::Productivity] = buildings.CalcAverageProductivity(); + statisticCurrentData[StatisticType::Productivity] = buildings.calcAverageProductivity(); // Total points for tournament games statisticCurrentData[StatisticType::Tournament] = statisticCurrentData[StatisticType::Military] + 3 * statisticCurrentData[StatisticType::Vanquished]; } -void GamePlayer::StatisticStep() +void GamePlayer::statisticStep() { - CalcStatistics(); + calcStatistics(); // 15-min-Statistik ein Feld weiterschieben for(const auto i : helpers::enumRange()) @@ -1662,10 +1662,10 @@ void GamePlayer::Pact::Serialize(SerializedGameData& sgd) const sgd.PushBool(want_cancel); } -void GamePlayer::PactChanged(const PactType pt) +void GamePlayer::pactChanged(const PactType pt) { // Recheck military flags as the border (to an enemy) might have changed - RecalcMilitaryFlags(); + recalcMilitaryFlags(); // Ggf. den GUI Bescheid sagen, um Sichtbarkeiten etc. neu zu berechnen if(pt == PactType::TreatyOfAlliance) @@ -1687,10 +1687,10 @@ void GamePlayer::SuggestPact(const unsigned char targetPlayerId, const PactType pacts[targetPlayerId][pt].start = world.getEvMgr().getCurrentGF(); GamePlayer targetPlayer = world.getPlayer(targetPlayerId); if(targetPlayer.isHuman()) - targetPlayer.SendPostMessage(std::make_unique( + targetPlayer.sendPostMessage(std::make_unique( world.getEvMgr().getCurrentGF(), pt, pacts[targetPlayerId][pt].start, *this, duration)); else if(world.hasLua()) - world.getLua().EventSuggestPact(pt, getPlayerId(), targetPlayerId, duration); + world.getLua().eventSuggestPact(pt, getPlayerId(), targetPlayerId, duration); } } @@ -1698,23 +1698,23 @@ void GamePlayer::AcceptPact(const unsigned id, const PactType pt, const unsigned { if(!pacts[targetPlayer][pt].accepted && pacts[targetPlayer][pt].duration > 0 && pacts[targetPlayer][pt].start == id) { - MakePact(pt, targetPlayer, pacts[targetPlayer][pt].duration); - world.getPlayer(targetPlayer).MakePact(pt, getPlayerId(), pacts[targetPlayer][pt].duration); - PactChanged(pt); - world.getPlayer(targetPlayer).PactChanged(pt); + makePact(pt, targetPlayer, pacts[targetPlayer][pt].duration); + world.getPlayer(targetPlayer).makePact(pt, getPlayerId(), pacts[targetPlayer][pt].duration); + pactChanged(pt); + world.getPlayer(targetPlayer).pactChanged(pt); if(world.hasLua()) - world.getLua().EventPactCreated(pt, getPlayerId(), targetPlayer, pacts[targetPlayer][pt].duration); + world.getLua().eventPactCreated(pt, getPlayerId(), targetPlayer, pacts[targetPlayer][pt].duration); } } -void GamePlayer::MakePact(const PactType pt, const unsigned char other_player, const unsigned duration) +void GamePlayer::makePact(const PactType pt, const unsigned char other_player, const unsigned duration) { pacts[other_player][pt].accepted = true; pacts[other_player][pt].start = world.getEvMgr().getCurrentGF(); pacts[other_player][pt].duration = duration; pacts[other_player][pt].want_cancel = false; - SendPostMessage( + sendPostMessage( std::make_unique(world.getEvMgr().getCurrentGF(), pt, world.getPlayer(other_player), true)); } @@ -1739,7 +1739,7 @@ void GamePlayer::NotifyAlliesOfLocation(const MapPoint pt) for(unsigned i = 0; i < world.getNumPlayers(); ++i) { if(i != getPlayerId() && isAlly(i)) - world.getPlayer(i).SendPostMessage(std::make_unique( + world.getPlayer(i).sendPostMessage(std::make_unique( world.getEvMgr().getCurrentGF(), _("Your ally wishes to notify you of this location"), PostCategory::Diplomacy, pt)); } @@ -1789,20 +1789,20 @@ void GamePlayer::CancelPact(const PactType pt, const unsigned char otherPlayerId // Den Spielern eine Informationsnachricht schicken world.getPlayer(otherPlayerIdx) - .SendPostMessage(std::make_unique(world.getEvMgr().getCurrentGF(), pt, *this, false)); - SendPostMessage( + .sendPostMessage(std::make_unique(world.getEvMgr().getCurrentGF(), pt, *this, false)); + sendPostMessage( std::make_unique(world.getEvMgr().getCurrentGF(), pt, world.getPlayer(otherPlayerIdx), false)); - PactChanged(pt); - otherPlayer.PactChanged(pt); + pactChanged(pt); + otherPlayer.pactChanged(pt); if(world.hasLua()) - world.getLua().EventPactCanceled(pt, getPlayerId(), otherPlayerIdx); + world.getLua().eventPactCanceled(pt, getPlayerId(), otherPlayerIdx); } else { // Ansonsten den anderen Spieler fragen, ob der das auch so sieht if(otherPlayer.isHuman()) - otherPlayer.SendPostMessage(std::make_unique( + otherPlayer.sendPostMessage(std::make_unique( world.getEvMgr().getCurrentGF(), pt, pacts[otherPlayerIdx][pt].start, *this)); - else if(!world.hasLua() || world.getLua().EventCancelPactRequest(pt, getPlayerId(), otherPlayerIdx)) + else if(!world.hasLua() || world.getLua().eventCancelPactRequest(pt, getPlayerId(), otherPlayerIdx)) { // AI accepts cancels, if there is no lua-interace pacts[otherPlayerIdx][pt].accepted = false; @@ -1814,7 +1814,7 @@ void GamePlayer::CancelPact(const PactType pt, const unsigned char otherPlayerId otherPlayer.pacts[getPlayerId()][pt].want_cancel = false; if(world.hasLua()) - world.getLua().EventPactCanceled(pt, getPlayerId(), otherPlayerIdx); + world.getLua().eventPactCanceled(pt, getPlayerId(), otherPlayerIdx); } } } else @@ -1824,7 +1824,7 @@ void GamePlayer::CancelPact(const PactType pt, const unsigned char otherPlayerId } } -void GamePlayer::MakeStartPacts() +void GamePlayer::makeStartPacts() { // Reset pacts for(unsigned i = 0; i < world.getNumPlayers(); ++i) @@ -1869,17 +1869,17 @@ bool GamePlayer::isWareDependent(const Ware& ware) return false; } -void GamePlayer::IncreaseInventoryWare(const GoodType ware, const unsigned count) +void GamePlayer::increaseInventoryWare(const GoodType ware, const unsigned count) { - global_inventory.Add(ConvertShields(ware), count); + global_inventory.add(ConvertShields(ware), count); } -void GamePlayer::DecreaseInventoryWare(const GoodType ware, const unsigned count) +void GamePlayer::decreaseInventoryWare(const GoodType ware, const unsigned count) { - global_inventory.Remove(ConvertShields(ware), count); + global_inventory.remove(ConvertShields(ware), count); } -void GamePlayer::RegisterShip(noShip& ship) +void GamePlayer::registerShip(noShip& ship) { ships.push_back(&ship); getJobForShip(ship); @@ -1898,7 +1898,7 @@ struct ShipForHarbor } }; -bool GamePlayer::OrderShip(nobHarborBuilding& hb) +bool GamePlayer::orderShip(nobHarborBuilding& hb) { std::vector sfh; @@ -1908,7 +1908,7 @@ bool GamePlayer::OrderShip(nobHarborBuilding& hb) for(noShip* ship : ships) { if(ship->isIdling() && world.isHarborAtSea(world.getHarborPointID(hb.getPos()), ship->getSeaID())) - sfh.push_back(ShipForHarbor(ship, world.CalcDistance(hb.getPos(), ship->getPos()))); + sfh.push_back(ShipForHarbor(ship, world.calcDistance(hb.getPos(), ship->getPos()))); } } else { @@ -1917,7 +1917,7 @@ bool GamePlayer::OrderShip(nobHarborBuilding& hb) if((ship->isIdling() && world.isHarborAtSea(world.getHarborPointID(hb.getPos()), ship->getSeaID())) || ship->isGoingToHarbor(hb)) { - sfh.push_back(ShipForHarbor(ship, world.CalcDistance(hb.getPos(), ship->getPos()))); + sfh.push_back(ShipForHarbor(ship, world.calcDistance(hb.getPos(), ship->getPos()))); } } } @@ -1940,12 +1940,12 @@ bool GamePlayer::OrderShip(nobHarborBuilding& hb) noShip& ship = *it.ship; - if(world.FindShipPathToHarbor(ship.getPos(), hb.getHarborPosID(), ship.getSeaID(), &route, &distance)) + if(world.findShipPathToHarbor(ship.getPos(), hb.getHarborPosID(), ship.getSeaID(), &route, &distance)) { // ship already there? if(distance == 0) { - hb.ShipArrived(ship); + hb.shipArrived(ship); return true; } @@ -1961,7 +1961,7 @@ bool GamePlayer::OrderShip(nobHarborBuilding& hb) // only order ships not already on their way if(best_ship && best_ship->isIdling()) { - best_ship->GoToHarbor(hb, best_route); + best_ship->goToHarbor(hb, best_route); return true; } @@ -1969,7 +1969,7 @@ bool GamePlayer::OrderShip(nobHarborBuilding& hb) return false; } -void GamePlayer::RemoveShip(noShip* ship) +void GamePlayer::removeShip(noShip* ship) { auto it = helpers::find(ships, ship); RTTR_Assert(it != ships.end()); @@ -2002,12 +2002,12 @@ void GamePlayer::getJobForShip(noShip& ship) unsigned length; std::vector route; - if(world.FindShipPathToHarbor(ship.getPos(), harbor->getHarborPosID(), ship.getSeaID(), &route, &length)) + if(world.findShipPathToHarbor(ship.getPos(), harbor->getHarborPosID(), ship.getSeaID(), &route, &length)) { // ship already there? if(length == 0) { - harbor->ShipArrived(ship); + harbor->shipArrived(ship); return; } @@ -2025,7 +2025,7 @@ void GamePlayer::getJobForShip(noShip& ship) // Einen Hafen gefunden? if(best) - ship.GoToHarbor(*best, best_route); + ship.goToHarbor(*best, best_route); } unsigned GamePlayer::getShipID(const noShip& ship) const @@ -2053,7 +2053,7 @@ unsigned GamePlayer::getShipsToHarbor(const nobHarborBuilding& hb) const return count; } -bool GamePlayer::FindHarborForUnloading(noShip* ship, const MapPoint start, HarborId* goalHarborId, +bool GamePlayer::findHarborForUnloading(noShip* ship, const MapPoint start, HarborId* goalHarborId, std::vector* route, nobHarborBuilding* exception) { nobHarborBuilding* best = nullptr; @@ -2070,7 +2070,7 @@ bool GamePlayer::FindHarborForUnloading(noShip* ship, const MapPoint start, Harb continue; // Distanz ermitteln zwischen Schiff und Hafen, Schiff kann natürlich auch über Kartenränder fahren - unsigned distance = world.CalcDistance(ship->getPos(), hb->getPos()); + unsigned distance = world.calcDistance(ship->getPos(), hb->getPos()); // Kürzerer Weg als bisher bestes Ziel? if(distance < best_distance) @@ -2086,7 +2086,7 @@ bool GamePlayer::FindHarborForUnloading(noShip* ship, const MapPoint start, Harb // Weg dorthin suchen route->clear(); *goalHarborId = best->getHarborPosID(); - if(world.FindShipPathToHarbor(start, best->getHarborPosID(), ship->getSeaID(), route, nullptr)) + if(world.findShipPathToHarbor(start, best->getHarborPosID(), ship->getSeaID(), route, nullptr)) return true; } @@ -2101,7 +2101,7 @@ void GamePlayer::cancelWaresForEmergencyProtocol() if(ware->isWaitingInWarehouse() && ware->getGoal() && !IsWareFineWithEmergencyProtocol(ware->type, *ware->getGoal())) { - ware->NotifyGoalAboutLostWare(); + ware->notifyGoalAboutLostWare(); static_cast(ware->getLocation())->cancelWare(ware); it = ware_list.erase(it); continue; @@ -2110,7 +2110,7 @@ void GamePlayer::cancelWaresForEmergencyProtocol() } } -void GamePlayer::TestForEmergencyProgramm() +void GamePlayer::testForEmergencyProgramm() { // we are already defeated, do not even think about an emergency program - it's too late :-( if(isDefeated) @@ -2137,7 +2137,7 @@ void GamePlayer::TestForEmergencyProgramm() if(!emergency) { emergency = true; - SendPostMessage(std::make_unique( + sendPostMessage(std::make_unique( world.getEvMgr().getCurrentGF(), _("The emergency program has been activated."), PostCategory::Economy)); // Handle wares already ordered @@ -2149,15 +2149,15 @@ void GamePlayer::TestForEmergencyProgramm() if(emergency) { emergency = false; - SendPostMessage(std::make_unique(world.getEvMgr().getCurrentGF(), + sendPostMessage(std::make_unique(world.getEvMgr().getCurrentGF(), _("The emergency program has been deactivated."), PostCategory::Economy)); - FindMaterialForBuildingSites(); + findMaterialForBuildingSites(); } } } -void GamePlayer::TestPacts() +void GamePlayer::testPacts() { for(unsigned i = 0; i < world.getNumPlayers(); ++i) { @@ -2180,8 +2180,8 @@ void GamePlayer::TestPacts() otherPlayer.pacts[getPlayerId()][pact].duration = 0; otherPlayer.pacts[getPlayerId()][pact].accepted = false; // And notify - PactChanged(pact); - otherPlayer.PactChanged(pact); + pactChanged(pact); + otherPlayer.pactChanged(pact); } } } @@ -2211,12 +2211,12 @@ bool GamePlayer::canBuildCatapult() const return bc.buildings[BuildingType::Catapult] + bc.buildingSites[BuildingType::Catapult] < max; } -bool GamePlayer::ShipDiscoveredHostileTerritory(const MapPoint location) +bool GamePlayer::shipDiscoveredHostileTerritory(const MapPoint location) { // Prüfen, ob Abstand zu bisherigen Punkten nicht zu klein for(const auto& enemies_discovered_by_ship : enemies_discovered_by_ships) { - if(world.CalcDistance(enemies_discovered_by_ship, location) < 30) + if(world.calcDistance(enemies_discovered_by_ship, location) < 30) return false; } @@ -2270,13 +2270,13 @@ struct WarehouseDistanceComparator bool operator()(nobBaseWarehouse* const wh1, nobBaseWarehouse* const wh2) const { - unsigned dist1 = gwg_.CalcDistance(wh1->getPos(), refWareHousePos_); - unsigned dist2 = gwg_.CalcDistance(wh2->getPos(), refWareHousePos_); + unsigned dist1 = gwg_.calcDistance(wh1->getPos(), refWareHousePos_); + unsigned dist2 = gwg_.calcDistance(wh2->getPos(), refWareHousePos_); return (dist1 < dist2) || (dist1 == dist2 && wh1->getObjId() < wh2->getObjId()); } }; -void GamePlayer::Trade(nobBaseWarehouse* goalWh, const boost_variant2& what, unsigned count) const +void GamePlayer::trade(nobBaseWarehouse* goalWh, const boost_variant2& what, unsigned count) const { if(!world.getGGS().isEnabled(AddonId::TRADE)) return; @@ -2318,7 +2318,7 @@ void GamePlayer::Trade(nobBaseWarehouse* goalWh, const boost_variant2StartTradeCaravane(what, actualCount, tr, goalWh); + wh->startTradeCaravane(what, actualCount, tr, goalWh); count -= actualCount; if(count == 0) return; @@ -2334,7 +2334,7 @@ bool GamePlayer::isBuildingEnabled(BuildingType type) const && world.getGameInterface()->GI_GetCheats().areAllBuildingsEnabled()); } -void GamePlayer::FillVisualSettings(VisualSettings& visualSettings) const +void GamePlayer::fillVisualSettings(VisualSettings& visualSettings) const { Distributions& visDistribution = visualSettings.distribution; unsigned visIdx = 0; @@ -2353,7 +2353,7 @@ void GamePlayer::FillVisualSettings(VisualSettings& visualSettings) const } #define INSTANTIATE_FINDWH(Cond) \ - template nobBaseWarehouse* GamePlayer::FindWarehouse(const noRoadNode&, const Cond&, bool, bool, unsigned*, \ + template nobBaseWarehouse* GamePlayer::findWarehouse(const noRoadNode&, const Cond&, bool, bool, unsigned*, \ const RoadSegment*) const INSTANTIATE_FINDWH(FW::HasMinWares); diff --git a/libs/s25main/GamePlayer.h b/libs/s25main/GamePlayer.h index 8824fefe79..b75d0598df 100644 --- a/libs/s25main/GamePlayer.h +++ b/libs/s25main/GamePlayer.h @@ -98,22 +98,22 @@ class GamePlayer : public GamePlayerInfo bool isHQTent() const; void setHQIsTent(bool isTent); - void AddBuilding(noBuilding* bld, BuildingType bldType); - void RemoveBuilding(noBuilding* bld, BuildingType bldType); - void AddBuildingSite(noBuildingSite* bldSite); - void RemoveBuildingSite(noBuildingSite* bldSite); + void addBuilding(noBuilding* bld, BuildingType bldType); + void removeBuilding(noBuilding* bld, BuildingType bldType); + void addBuildingSite(noBuildingSite* bldSite); + void removeBuildingSite(noBuildingSite* bldSite); const BuildingRegister& getBuildingRegister() const { return buildings; } /// Notify that a new road connection exists (not only an existing road splitted) - void NewRoadConnection(RoadSegment* rs); + void newRoadConnection(RoadSegment* rs); /// Neue Straße hinzufügen - void AddRoad(RoadSegment* rs); + void addRoad(RoadSegment* rs); /// Gibt dem Spieler bekannt, das eine Straße abgerissen wurde - void RoadDestroyed(); + void roadDestroyed(); /// (Unbesetzte) Straße aus der Liste entfernen - void DeleteRoad(RoadSegment* rs); + void deleteRoad(RoadSegment* rs); /// Sucht einen Träger für die Straße und ruft ggf den Träger aus dem jeweiligen nächsten Lagerhaus - bool FindCarrierForRoad(RoadSegment& rs) const; + bool findCarrierForRoad(RoadSegment& rs) const; /// Returns true if the given wh does still exist and hence the ptr is valid bool isWarehouseValid(nobBaseWarehouse* wh) const; /// Gibt erstes Lagerhaus zurück @@ -126,56 +126,56 @@ class GamePlayer : public GamePlayerInfo /// warehouse should be considered - to_wh true if path to wh is searched, false for path from wh - length is /// optional for the path length - forbidden optional roadSegment that must not be used template - nobBaseWarehouse* FindWarehouse(const noRoadNode& start, const T_IsWarehouseGood& isWarehouseGood, bool to_wh, + nobBaseWarehouse* findWarehouse(const noRoadNode& start, const T_IsWarehouseGood& isWarehouseGood, bool to_wh, bool use_boat_roads, unsigned* length = nullptr, const RoadSegment* forbidden = nullptr) const; /// Für alle unbesetzen Straßen Weg neu berechnen - void FindCarrierForAllRoads(); + void findCarrierForAllRoads(); /// Versucht für alle Arbeitsplätze eine Arbeitskraft zu suchen - void FindWarehouseForAllJobs(); - void FindWarehouseForAllJobs(Job job); + void findWarehouseForAllJobs(); + void findWarehouseForAllJobs(Job job); /// Lässt alle Baustellen ggf. noch vorhandenes Baumaterial bestellen - void FindMaterialForBuildingSites(); + void findMaterialForBuildingSites(); /// Fügt ein RoadNode hinzu, der einen bestimmten Job braucht - void AddJobWanted(Job job, noRoadNode* workplace); + void addJobWanted(Job job, noRoadNode* workplace); /// Entfernt ihn wieder aus der Liste (wenn er dann doch nich mehr gebraucht wird) - void JobNotWanted(noRoadNode* workplace, bool all = false); + void jobNotWanted(noRoadNode* workplace, bool all = false); /// Entfernt einen ausgesuchten Job wieder aus der Liste (wenn er dann doch nich mehr gebraucht wird) - void OneJobNotWanted(Job job, noRoadNode* workplace); + void oneJobNotWanted(Job job, noRoadNode* workplace); /// Versucht für alle verlorenen Waren ohne Ziel Lagerhaus zu finden - void FindClientForLostWares(); + void findClientForLostWares(); /// Bestellt eine Ware und gibt sie zurück, falls es eine gibt, ansonsten 0 - Ware* OrderWare(GoodType ware, noBaseBuilding& goal); + Ware* orderWare(GoodType ware, noBaseBuilding& goal); /// Versucht einen Esel zu bestellen, gibt 0 zurück, falls keinen gefunden - nofCarrier* OrderDonkey(RoadSegment& road) const; + nofCarrier* orderDonkey(RoadSegment& road) const; /// Versucht für einen Esel eine Straße zu finden, in goal wird die Zielflagge zurückgegeben, /// sofern eine Straße gefunden wurde, ansonsten ist das ein Lagerhaus oder 0, falls auch das nich gefunden wurde - RoadSegment* FindRoadForDonkey(noRoadNode& start, noRoadNode** goal); + RoadSegment* findRoadForDonkey(noRoadNode& start, noRoadNode** goal); /// Sucht für eine (neuproduzierte) Ware einen Abnehmer (wenns keinen gibt, wird ein Lagerhaus gesucht, wenn /// es auch dorthin keinen Weg gibt, wird 0 zurückgegeben - noBaseBuilding* FindClientForWare(const Ware& ware); - nobBaseWarehouse* FindWarehouseForWare(const Ware& ware) const; + noBaseBuilding* findClientForWare(const Ware& ware); + nobBaseWarehouse* findWarehouseForWare(const Ware& ware) const; /// Sucht einen Abnehmer (sprich Militärgebäude), wenn es keinen findet, wird ein Warenhaus zurückgegeben bzw. 0 - nobBaseMilitary* FindClientForCoin(const Ware& ware) const; - nobBaseMilitary* FindClientForArmor(const Ware& ware) const; + nobBaseMilitary* findClientForCoin(const Ware& ware) const; + nobBaseMilitary* findClientForArmor(const Ware& ware) const; /// Gibt Priorität der Baustelle zurück (entscheidet selbständig, welche Reihenfolge usw) /// je kleiner die Rückgabe, destro größer die Priorität! unsigned getBuidingSitePriority(const noBuildingSite* building_site); /// Berechnet die Verteilung der Waren auf die einzelnen Gebäude neu - void RecalcDistribution(); + void recalcDistribution(); /// Berechnet die Verteilung einer (bestimmten) Ware - void RecalcDistributionOfWare(GoodType ware); + void recalcDistributionOfWare(GoodType ware); /// Konvertiert die Daten vom wp_transport in "unser" Prioritäten-Format und setzt es - void ConvertTransportData(const TransportOrders& transport_data); + void convertTransportData(const TransportOrders& transport_data); /// Ware zur globalen Warenliste hinzufügen und entfernen - void RegisterWare(Ware& ware) { ware_list.push_back(&ware); } - void RemoveWare(Ware& ware) + void registerWare(Ware& ware) { ware_list.push_back(&ware); } + void removeWare(Ware& ware) { RTTR_Assert(isWareRegistred(ware)); ware_list.remove(&ware); @@ -184,20 +184,20 @@ class GamePlayer : public GamePlayerInfo bool isWareDependent(const Ware& ware); /// Fügt Waren zur Inventur hinzu - void IncreaseInventoryWare(GoodType ware, unsigned count); - void DecreaseInventoryWare(GoodType ware, unsigned count); - void IncreaseInventoryJob(const Job job, unsigned count) { global_inventory.Add(job, count); } - void DecreaseInventoryJob(const Job job, unsigned count) { global_inventory.Remove(job, count); } - void IncreaseInventoryJob(const ArmoredSoldier job, unsigned count) { global_inventory.Add(job, count); } - void DecreaseInventoryJob(const ArmoredSoldier job, unsigned count) { global_inventory.Remove(job, count); } + void increaseInventoryWare(GoodType ware, unsigned count); + void decreaseInventoryWare(GoodType ware, unsigned count); + void increaseInventoryJob(const Job job, unsigned count) { global_inventory.add(job, count); } + void decreaseInventoryJob(const Job job, unsigned count) { global_inventory.remove(job, count); } + void increaseInventoryJob(const ArmoredSoldier job, unsigned count) { global_inventory.add(job, count); } + void decreaseInventoryJob(const ArmoredSoldier job, unsigned count) { global_inventory.remove(job, count); } /// Gibt Inventory-Settings zurück const Inventory& getInventory() const { return global_inventory; } /// Setzt neue Militäreinstellungen - void ChangeMilitarySettings(const MilitarySettings& military_settings); + void changeMilitarySettings(const MilitarySettings& military_settings); /// Setzt neue Werkzeugeinstellungen - void ChangeToolsSettings(const ToolSettings& tools_settings, const helpers::EnumArray& orderChanges); + void changeToolsSettings(const ToolSettings& tools_settings, const helpers::EnumArray& orderChanges); /// Setzt neue Verteilungseinstellungen void ChangeDistribution(const Distributions& distribution_settings); /// Setzt neue Baureihenfolge-Einstellungen @@ -208,26 +208,26 @@ class GamePlayer : public GamePlayerInfo /// Are these players allied? (-> Teamview, attack support, ...) bool isAlly(unsigned char playerId) const; /// Order troops of each rank according to `counts` without exceeding `total_max` in total - void OrderTroops(nobMilitary& goal, std::array counts, unsigned total_max) const; + void orderTroops(nobMilitary& goal, std::array counts, unsigned total_max) const; /// Prüft die Besatzung von allen Militärgebäuden und reguliert entsprechend (bei Veränderung der /// Militäreinstellungen) - void RegulateAllTroops(); + void regulateAllTroops(); /// Prüft von allen Militärgebäuden die Fahnen neu - void RecalcMilitaryFlags(); + void recalcMilitaryFlags(); /// Sucht für Soldaten ein neues Militärgebäude, als Argument wird Referenz auf die /// entsprechende Soldatenanzahl im Lagerhaus verlangt - void NewSoldiersAvailable(const unsigned& soldier_count); + void newSoldiersAvailable(const unsigned& soldier_count); /// Aktualisiert die Verteidiger-Liste - void RefreshDefenderList(); + void refreshDefenderList(); /// Prüft, ob für einen angreifenden Soldaten ein Verteidger geschickt werden soll - bool ShouldSendDefender(); + bool shouldSendDefender(); /// Ruft einen Geologen - void CallFlagWorker(MapPoint pt, Job job); + void callFlagWorker(MapPoint pt, Job job); /// Registriert einen Geologen bzw. einen Späher an einer bestimmten Flagge, damit diese informiert werden, /// wenn die Flagge abgerissen wird - void RegisterFlagWorker(nofFlagWorker* flagworker) { flagworkers.push_back(flagworker); } - void RemoveFlagWorker(nofFlagWorker* flagworker) + void registerFlagWorker(nofFlagWorker* flagworker) { flagworkers.push_back(flagworker); } + void removeFlagWorker(nofFlagWorker* flagworker) { RTTR_Assert(isFlagWorker(flagworker)); flagworkers.remove(flagworker); @@ -235,16 +235,16 @@ class GamePlayer : public GamePlayerInfo bool isFlagWorker(const nofFlagWorker* flagworker); /// Wird aufgerufen, wenn eine Flagge abgerissen wurde, damit das den Flaggen-Arbeitern gesagt werden kann - void FlagDestroyed(noFlag* flag); + void flagDestroyed(noFlag* flag); /// Registriert ein Schiff beim Einwohnermeldeamt - void RegisterShip(noShip& ship); + void registerShip(noShip& ship); /// Meldet das Schiff wieder ab - void RemoveShip(noShip* ship); + void removeShip(noShip* ship); /// Versucht, für ein untätiges Schiff eine Arbeit zu suchen void getJobForShip(noShip& ship); /// Schiff für Hafen bestellen. Wenn ein Schiff kommt, true. - bool OrderShip(nobHarborBuilding& hb); + bool orderShip(nobHarborBuilding& hb); /// Gibt die ID eines Schiffes zurück unsigned getShipID(const noShip& ship) const; /// Gibt ein Schiff anhand der ID zurück bzw. nullptr, wenn keines mit der ID existiert @@ -258,12 +258,12 @@ class GamePlayer : public GamePlayerInfo /// Sucht einen Hafen in der Nähe, wo dieses Schiff seine Waren abladen kann /// gibt true zurück, falls erfolgreich /// If starting point equals the coastal point of target harbor, return true and an empty `route`. - bool FindHarborForUnloading(noShip* ship, MapPoint start, HarborId* goalHarborId, std::vector* route, + bool findHarborForUnloading(noShip* ship, MapPoint start, HarborId* goalHarborId, std::vector* route, nobHarborBuilding* exception); /// A ship has discovered new hostile territory --> determines if this is new /// i.e. there is a sufficient distance to older locations /// Returns true if yes and false if not - bool ShipDiscoveredHostileTerritory(MapPoint location); + bool shipDiscoveredHostileTerritory(MapPoint location); /// Er gibt auf void Surrender(); @@ -282,35 +282,35 @@ class GamePlayer : public GamePlayerInfo /// Gibt die verbleibende Dauer zurück, die ein Bündnis noch laufen wird (DURATION_INFINITE = für immer) unsigned getRemainingPactTime(PactType pt, unsigned char other_player) const; /// Setzt die initialen Bündnisse anhand der Teams - void MakeStartPacts(); + void makeStartPacts(); /// Testet die Bündnisse, ob sie nicht schon abgelaufen sind - void TestPacts(); + void testPacts(); /// Returns all warehouses that can trade with the given goal /// IMPORTANT: Warehouses can be destroyed. So check them first before using! std::vector getWarehousesForTrading(const nobBaseWarehouse& goalWh) const; /// Send wares to warehouse wh - void Trade(nobBaseWarehouse* goalWh, const boost_variant2& what, unsigned count) const; + void trade(nobBaseWarehouse* goalWh, const boost_variant2& what, unsigned count) const; - void EnableBuilding(BuildingType type) { building_enabled[type] = true; } - void DisableBuilding(BuildingType type) { building_enabled[type] = false; } + void enableBuilding(BuildingType type) { building_enabled[type] = true; } + void disableBuilding(BuildingType type) { building_enabled[type] = false; } bool isBuildingEnabled(BuildingType type) const; /// Set the area the player may have territory in /// Nothing means all is allowed. See Lua description std::vector& getRestrictedArea() { return restricted_area; } const std::vector& getRestrictedArea() const { return restricted_area; } - void SendPostMessage(std::unique_ptr msg); + void sendPostMessage(std::unique_ptr msg); /// Returns number of tools ordered for the given tool including visual orders (not yet committed) unsigned getToolsOrderedVisual(Tool tool) const; unsigned getToolsOrdered(Tool tool) const; /// Changes the current visual tool order by the given amount. Return true if anything was changed (tool order is /// clamped to [0,100]) - bool ChangeToolOrderVisual(Tool tool, int changeAmount) const; + bool changeToolOrderVisual(Tool tool, int changeAmount) const; unsigned getToolPriority(Tool tool) const; /// Called when a ordered tool was finished - void ToolOrderProcessed(Tool tool); + void toolOrderProcessed(Tool tool); /// Get a military setting. TODO: Use named type instead of index unsigned char getMilitarySetting(unsigned type) const { return militarySettings_[type]; } @@ -320,13 +320,13 @@ class GamePlayer : public GamePlayerInfo // Statistik-Sachen void setStatisticValue(StatisticType type, unsigned value); - void ChangeStatisticValue(StatisticType type, int change); + void changeStatisticValue(StatisticType type, int change); - void IncreaseMerchandiseStatistic(GoodType type); + void increaseMerchandiseStatistic(GoodType type); /// Calculates current statistics - void CalcStatistics(); - void StatisticStep(); + void calcStatistics(); + void statisticStep(); const Statistic& getStatistic(StatisticTime time) const { return statistic[time]; }; unsigned getStatisticCurrentValue(StatisticType idx) const { return statisticCurrentData[idx]; } @@ -334,14 +334,14 @@ class GamePlayer : public GamePlayerInfo // Stop wares restricted in emergency mode that are waiting in warehouse to be transported already void cancelWaresForEmergencyProtocol(); // Testet ob Notfallprogramm aktiviert werden muss und tut dies dann - void TestForEmergencyProgramm(); + void testForEmergencyProgramm(); bool hasEmergency() const { return emergency; } /// Testet ob der Spieler noch mehr Katapulte bauen darf bool canBuildCatapult() const; /// For debug only bool isDependentFigure(const noFigure& fig); - void FillVisualSettings(VisualSettings& visualSettings) const; + void fillVisualSettings(VisualSettings& visualSettings) const; static BuildOrders getStandardBuildOrder(); @@ -426,26 +426,26 @@ class GamePlayer : public GamePlayerInfo // Notfall-Programm aktiviert ja/nein (Es gehen nur noch Res an Holzfäller- und Sägewerk-Baustellen raus) bool emergency; - void LoadStandardToolSettings(); - void LoadStandardMilitarySettings(); - void LoadStandardDistribution(); + void loadStandardToolSettings(); + void loadStandardMilitarySettings(); + void loadStandardDistribution(); /// Bündnis (real, d.h. spielentscheidend) abschließen - void MakePact(PactType pt, unsigned char other_player, unsigned duration); + void makePact(PactType pt, unsigned char other_player, unsigned duration); /// Called after a pact was changed(added/removed) in both players - void PactChanged(PactType pt); + void pactChanged(PactType pt); // Sucht Weg für Job zu entsprechenden noRoadNode - bool FindWarehouseForJob(Job job, noRoadNode& goal) const; + bool findWarehouseForJob(Job job, noRoadNode& goal) const; /// Find best building for the ware according to the priority reduced by the distance. /// T_GetPriority must be a functor taking a "const noBaseBuilding&" and returning an unsigned priority. /// A zero priority means that the building is not suitable for this ware. /// Returns nullptr if no building was found template - typename T_Buildings::value_type FindClientImpl(const Ware& ware, T_GetPriority&& getPriority, + typename T_Buildings::value_type findClientImpl(const Ware& ware, T_GetPriority&& getPriority, const T_Buildings& buildings) const; /// Prüft, ob der Spieler besiegt wurde - void TestDefeat(); + void testDefeat(); ////////////////////////////////////////////////////////////////////////// /// Unsynchronized state (e.g. lua, gui...) diff --git a/libs/s25main/GameSetup.cpp b/libs/s25main/GameSetup.cpp index c5f34ded2e..704c97007a 100644 --- a/libs/s25main/GameSetup.cpp +++ b/libs/s25main/GameSetup.cpp @@ -33,7 +33,7 @@ namespace { void removeLeatherAddonDistributions(Game& game, unsigned localPlayerId) { VisualSettings settings; - game.world_.getPlayer(localPlayerId).FillVisualSettings(settings); + game.world_.getPlayer(localPlayerId).fillVisualSettings(settings); Distributions newDistributions = settings.distribution; unsigned idx = 0; @@ -53,12 +53,12 @@ void setupGameWorld(Game& game, const MapInfo& mapInfo, ILocalGameState& localGa { GameWorld& gameWorld = game.world_; if(mapInfo.savegame) - mapInfo.savegame->sgd.ReadSnapshot(game, localGameState); + mapInfo.savegame->sgd.readSnapshot(game, localGameState); else { RTTR_Assert(mapInfo.type != MapType::Savegame); for(auto& player : gameWorld.getPlayers()) - player.MakeStartPacts(); + player.makeStartPacts(); // Kept until the loader has read them std::optional tmpMap, tmpLua; @@ -73,14 +73,14 @@ void setupGameWorld(Game& game, const MapInfo& mapInfo, ILocalGameState& localGa { tmpMap.emplace(); tmpMap->close(); - if(!mapInfo.mapData.DecompressToFile(tmpMap->filePath)) + if(!mapInfo.mapData.decompressToFile(tmpMap->filePath)) throw GameSetupError("Could not decompress the map data"); mapFilePath = tmpMap->filePath; if(mapInfo.luaData.uncompressedLength > 0) { tmpLua.emplace(".lua"); tmpLua->close(); - if(!mapInfo.luaData.DecompressToFile(tmpLua->filePath)) + if(!mapInfo.luaData.decompressToFile(tmpLua->filePath)) throw GameSetupError("Could not decompress the Lua script"); luaFilePath = tmpLua->filePath; } @@ -89,14 +89,14 @@ void setupGameWorld(Game& game, const MapInfo& mapInfo, ILocalGameState& localGa MapLoader loader(gameWorld); if(!loader.Load(mapFilePath)) throw GameSetupError("Could not load the map " + mapFilePath.string()); - if(!luaFilePath.empty() && !loader.LoadLuaScript(game, localGameState, luaFilePath)) + if(!luaFilePath.empty() && !loader.loadLuaScript(game, localGameState, luaFilePath)) throw GameSetupError("Could not load the Lua script " + luaFilePath.string()); MapLoader::setupResources(gameWorld, !replay || replay->usesFishFix()); } if(replay) gameWorld.setReplayCompatVersion(replay->getMinorVersion()); - gameWorld.InitAfterLoad(); + gameWorld.initAfterLoad(); if(replay && !mapInfo.savegame && replay->getMinorVersion() < 2) removeLeatherAddonDistributions(game, localGameState.getPlayerId()); diff --git a/libs/s25main/GlobalGameSettings.cpp b/libs/s25main/GlobalGameSettings.cpp index bcede8c845..c9a4f82a4f 100644 --- a/libs/s25main/GlobalGameSettings.cpp +++ b/libs/s25main/GlobalGameSettings.cpp @@ -213,7 +213,7 @@ void GlobalGameSettings::registerAddon(std::unique_ptr addon) /** * loads the saved addon configuration from the SETTINGS. */ -void GlobalGameSettings::LoadSettings() +void GlobalGameSettings::loadSettings() { resetAddons(); @@ -237,7 +237,7 @@ void GlobalGameSettings::LoadSettings() /** * saves the current addon configuration to the SETTINGS. */ -void GlobalGameSettings::SaveSettings() const +void GlobalGameSettings::saveSettings() const { SETTINGS.addons.configuration.clear(); for(const AddonWithState& addon : addons) diff --git a/libs/s25main/GlobalGameSettings.h b/libs/s25main/GlobalGameSettings.h index 92d7cb681d..a6012d71b3 100644 --- a/libs/s25main/GlobalGameSettings.h +++ b/libs/s25main/GlobalGameSettings.h @@ -54,9 +54,9 @@ class GlobalGameSettings void applyLegacyInexhaustibleMines(); /// loads the saved addon configuration from the SETTINGS. - void LoadSettings(); + void loadSettings(); /// saves the current addon configuration to the SETTINGS. - void SaveSettings() const; + void saveSettings() const; /// Get current maximum rank for soldiers /// 0 = Private, 1 = Private First Class, ... diff --git a/libs/s25main/HeadlessReplay.cpp b/libs/s25main/HeadlessReplay.cpp index 5fbfba8e56..2eb266f19b 100644 --- a/libs/s25main/HeadlessReplay.cpp +++ b/libs/s25main/HeadlessReplay.cpp @@ -16,7 +16,7 @@ HeadlessReplay::HeadlessReplay(const boost::filesystem::path& replayPath) { - if(!replay_.LoadHeader(replayPath) || !replay_.LoadGameData(mapInfo_)) + if(!replay_.loadHeader(replayPath) || !replay_.LoadGameData(mapInfo_)) { const std::string reason = replay_.getLastErrorMsg().empty() ? std::string("Unknown error") : replay_.getLastErrorMsg(); @@ -39,8 +39,8 @@ HeadlessReplay::HeadlessReplay(const boost::filesystem::path& replayPath) if(game_->world_.hasLua()) game_->world_.getLua().setSuppressStdout(true); - game_->Start(isFromSavegame()); - nextGF_ = replay_.ReadGF(); + game_->start(isFromSavegame()); + nextGF_ = replay_.readGF(); } HeadlessReplay::~HeadlessReplay() = default; @@ -55,7 +55,7 @@ unsigned HeadlessReplay::getCurrentGF() const return game_->em_->getCurrentGF(); } -bool HeadlessReplay::RunGF() +bool HeadlessReplay::runGF() { const unsigned curGF = getCurrentGF(); if(desync_ || curGF > replay_.getLastGF()) @@ -71,16 +71,16 @@ bool HeadlessReplay::RunGF() // Stop at a desync so the world and the RNG log still show the state that produced it if(desync_) return false; - game_->RunGF(); + game_->runGF(); return getCurrentGF() <= replay_.getLastGF(); } -bool HeadlessReplay::Run(const std::function& onGameFrame) +bool HeadlessReplay::run(const std::function& onGameFrame) { bool hasMoreFrames; do { - hasMoreFrames = RunGF(); + hasMoreFrames = runGF(); if(onGameFrame) onGameFrame(*this); } while(hasMoreFrames); diff --git a/libs/s25main/HeadlessReplay.h b/libs/s25main/HeadlessReplay.h index b408bcf57a..1256e6668a 100644 --- a/libs/s25main/HeadlessReplay.h +++ b/libs/s25main/HeadlessReplay.h @@ -38,10 +38,10 @@ class HeadlessReplay /// The game then stays at the desynced GF: every following frame would desync too, so there is /// nothing left to learn from continuing. /// Throws std::runtime_error if the replay is corrupt, i.e. holds a command for a GF that already passed. - bool RunGF(); + bool runGF(); /// Play back the whole replay, calling onGameFrame after each frame. /// Returns false if a desync was found. - bool Run(const std::function& onGameFrame = {}); + bool run(const std::function& onGameFrame = {}); private: NullLocalGameState localGameState_; diff --git a/libs/s25main/IDataChangedListener.h b/libs/s25main/IDataChangedListener.h index ba5e84d48d..b59942c61b 100644 --- a/libs/s25main/IDataChangedListener.h +++ b/libs/s25main/IDataChangedListener.h @@ -12,5 +12,5 @@ class IDataChangedListener public: /// Handles a change, changeId is the type of the change (object dependent) - virtual void OnChange(unsigned changeId) = 0; + virtual void onChange(unsigned changeId) = 0; }; diff --git a/libs/s25main/ILobbyClient.hpp b/libs/s25main/ILobbyClient.hpp index c0088d4e70..9d0c657bf7 100644 --- a/libs/s25main/ILobbyClient.hpp +++ b/libs/s25main/ILobbyClient.hpp @@ -14,8 +14,8 @@ class ILobbyClient public: virtual ~ILobbyClient() = default; virtual bool IsLoggedIn() const = 0; - virtual void AddListener(LobbyInterface* listener) = 0; - virtual void RemoveListener(LobbyInterface* listener) = 0; - virtual void SendServerJoinRequest() = 0; - virtual void SendChat(const std::string& text) = 0; + virtual void addListener(LobbyInterface* listener) = 0; + virtual void removeListener(LobbyInterface* listener) = 0; + virtual void sendServerJoinRequest() = 0; + virtual void sendChat(const std::string& text) = 0; }; diff --git a/libs/s25main/ILocalGameState.h b/libs/s25main/ILocalGameState.h index 908fa40d5e..a48a2b49a0 100644 --- a/libs/s25main/ILocalGameState.h +++ b/libs/s25main/ILocalGameState.h @@ -14,9 +14,9 @@ class ILocalGameState /// Return true if the local player is the host virtual bool isHost() const = 0; /// Convert a number of GameFrames into real time (HH:MM:SS or MM:SS if hours = 0) - virtual std::string FormatGFTime(unsigned numGFs) const = 0; + virtual std::string formatGFTime(unsigned numGFs) const = 0; /// Send a chat message to the local player - virtual void SystemChat(const std::string& text) = 0; + virtual void systemChat(const std::string& text) = 0; }; /// For headless contexts: acts as the host playing as player 0 and discards all output. @@ -24,6 +24,6 @@ struct NullLocalGameState : ILocalGameState { unsigned getPlayerId() const override { return 0; } bool isHost() const override { return true; } - std::string FormatGFTime(unsigned) const override { return ""; } - void SystemChat(const std::string&) override {} + std::string formatGFTime(unsigned) const override { return ""; } + void systemChat(const std::string&) override {} }; diff --git a/libs/s25main/IngameMinimap.cpp b/libs/s25main/IngameMinimap.cpp index a48fa861c4..a27f07a585 100644 --- a/libs/s25main/IngameMinimap.cpp +++ b/libs/s25main/IngameMinimap.cpp @@ -16,10 +16,10 @@ IngameMinimap::IngameMinimap(const GameWorldViewer& gwv) : Minimap(gwv.getWorld().getSize()), gwv(gwv), nodes_updated(getMapSize().x * getMapSize().y, false), dos(getMapSize().x * getMapSize().y, DrawnObject::Invalid), territory(true), houses(true), roads(true) { - CreateMapTexture(); + createMapTexture(); } -unsigned IngameMinimap::CalcPixelColor(const MapPoint pt, const unsigned t) +unsigned IngameMinimap::calcPixelColor(const MapPoint pt, const unsigned t) { unsigned color = 0; @@ -56,27 +56,27 @@ unsigned IngameMinimap::CalcPixelColor(const MapPoint pt, const unsigned t) // Baum an dieser Stelle? if((!fow && noType == NodalObjectType::Tree) || (fow && fot == FoW_Type::Tree)) //-V807 { - color = VaryBrightness(TREE_COLOR, VARY_TREE_COLOR); + color = varyBrightness(TREE_COLOR, VARY_TREE_COLOR); drawn_object = DrawnObject::Terrain; // Ggf. mit Spielerfarbe if(owner) { drawn_object = DrawnObject::Player; if(territory) - color = CombineWithPlayerColor(color, owner); + color = combineWithPlayerColor(color, owner); } } // Granit an dieser Stelle? else if((!fow && noType == NodalObjectType::Granite) || (fow && fot == FoW_Type::Granite)) { - color = VaryBrightness(GRANITE_COLOR, VARY_GRANITE_COLOR); + color = varyBrightness(GRANITE_COLOR, VARY_GRANITE_COLOR); drawn_object = DrawnObject::Terrain; // Ggf. mit Spielerfarbe if(owner) { drawn_object = DrawnObject::Player; if(territory) - color = CombineWithPlayerColor(color, owner); + color = combineWithPlayerColor(color, owner); } } // Ansonsten die jeweilige Terrainfarbe nehmen @@ -104,14 +104,14 @@ unsigned IngameMinimap::CalcPixelColor(const MapPoint pt, const unsigned t) // ansonsten normales Territorium? else if(territory) // Normales Terrain und Spielerfarbe berechnen - color = CombineWithPlayerColor(CalcTerrainColor(pt, t), owner); + color = combineWithPlayerColor(calcTerrainColor(pt, t), owner); else // Normales Terrain berechnen - color = CalcTerrainColor(pt, t); + color = calcTerrainColor(pt, t); } else { // Normales Terrain berechnen - color = CalcTerrainColor(pt, t); + color = calcTerrainColor(pt, t); drawn_object = DrawnObject::Terrain; } } @@ -129,7 +129,7 @@ unsigned IngameMinimap::CalcPixelColor(const MapPoint pt, const unsigned t) /** * Calculate the normal terrain color for a given point and triangle */ -unsigned IngameMinimap::CalcTerrainColor(const MapPoint pt, const unsigned t) +unsigned IngameMinimap::calcTerrainColor(const MapPoint pt, const unsigned t) { unsigned color = gwv.getWorld().getDescription().get((t == 0) ? gwv.getNode(pt).t1 : gwv.getNode(pt).t2).minimapColor; //-V807 @@ -174,7 +174,7 @@ bool IngameMinimap::isRoad(const MapPoint pt, const Visibility visibility) * Berechnet Spielerfarbe mit in eine gegebene Farbe mit ein * (player muss mit +1 gegeben sein!) */ -unsigned IngameMinimap::CombineWithPlayerColor(const unsigned color, const unsigned char player) const +unsigned IngameMinimap::combineWithPlayerColor(const unsigned color, const unsigned char player) const { // Spielerfarbe mit einberechnen unsigned player_color = gwv.getWorld().getPlayer(player - 1).color; @@ -183,7 +183,7 @@ unsigned IngameMinimap::CombineWithPlayerColor(const unsigned color, const unsig (GetBlue(color) + GetBlue(player_color)) / 2); } -void IngameMinimap::UpdateNode(const MapPoint pt) +void IngameMinimap::updateNode(const MapPoint pt) { if(!nodes_updated[getMMIdx(pt)]) { @@ -195,7 +195,7 @@ void IngameMinimap::UpdateNode(const MapPoint pt) /** * Additional stuff we need to do before drawing (in this case: update the map) */ -void IngameMinimap::BeforeDrawing() +void IngameMinimap::beforeDrawing() { // Ab welcher Knotenanzahl (Teil der Gesamtknotenanzahl) die Textur komplett neu erstellt werden soll static const unsigned MAX_NODES_UPDATE_DENOMINATOR = 2; // (2 = 1/2, 3 = 1/3 usw.) @@ -206,7 +206,7 @@ void IngameMinimap::BeforeDrawing() if(nodesToUpdate.size() >= nodes_updated.size() / MAX_NODES_UPDATE_DENOMINATOR) { // Ja, alles neu erzeugen - UpdateAll(); + updateAll(); std::fill(nodes_updated.begin(), nodes_updated.end(), false); } else { @@ -216,7 +216,7 @@ void IngameMinimap::BeforeDrawing() { for(unsigned t = 0; t < 2; ++t) { - unsigned color = CalcPixelColor(it, t); + unsigned color = calcPixelColor(it, t); DrawPoint texPos((it.x * 2 + t + (it.y & 1)) % (getMapSize().x * 2), it.y); map.updatePixel(texPos, libsiedler2::ColorBGRA(color)); } @@ -232,16 +232,16 @@ void IngameMinimap::BeforeDrawing() /** * Updatet die gesamte Minimap */ -void IngameMinimap::UpdateAll() +void IngameMinimap::updateAll() { - map.DeleteTexture(); - CreateMapTexture(); + map.deleteTexture(); + createMapTexture(); } /** * Update all nodes with the given drawn object */ -void IngameMinimap::UpdateAll(const DrawnObject drawn_object) +void IngameMinimap::updateAll(const DrawnObject drawn_object) { map.beginUpdate(); // Gesamte Karte neu berechnen @@ -255,7 +255,7 @@ void IngameMinimap::UpdateAll(const DrawnObject drawn_object) ((dos[getMMIdx(pt)] == DrawnObject::Buidling && !houses) || (dos[getMMIdx(pt)] == DrawnObject::Road && !roads)))) { - unsigned color = CalcPixelColor(pt, t); + unsigned color = calcPixelColor(pt, t); DrawPoint texPos((pt.x * 2 + t + (pt.y & 1)) % (getMapSize().x * 2), pt.y); map.updatePixel(texPos, libsiedler2::ColorBGRA(color)); } @@ -264,20 +264,20 @@ void IngameMinimap::UpdateAll(const DrawnObject drawn_object) map.endUpdate(); } -void IngameMinimap::ToggleTerritory() +void IngameMinimap::toggleTerritory() { territory = !territory; - UpdateAll(DrawnObject::Player); + updateAll(DrawnObject::Player); } -void IngameMinimap::ToggleHouses() +void IngameMinimap::toggleHouses() { houses = !houses; - UpdateAll(DrawnObject::Buidling); + updateAll(DrawnObject::Buidling); } -void IngameMinimap::ToggleRoads() +void IngameMinimap::toggleRoads() { roads = !roads; - UpdateAll(DrawnObject::Road); + updateAll(DrawnObject::Road); } diff --git a/libs/s25main/IngameMinimap.h b/libs/s25main/IngameMinimap.h index aadccdb890..578cde86b6 100644 --- a/libs/s25main/IngameMinimap.h +++ b/libs/s25main/IngameMinimap.h @@ -42,28 +42,28 @@ class IngameMinimap : public Minimap IngameMinimap(const GameWorldViewer& gwv); /// Merkt, vor dass ein bestimmter Punkt aktualisiert werden soll - void UpdateNode(MapPoint pt); + void updateNode(MapPoint pt); /// Updatet die gesamte Minimap - void UpdateAll(); + void updateAll(); /// Die einzelnen Dinge umschalten - void ToggleTerritory(); - void ToggleHouses(); - void ToggleRoads(); + void toggleTerritory(); + void toggleHouses(); + void toggleRoads(); protected: /// Berechnet die Farbe für einen bestimmten Pixel der Minimap (t = Terrain1 oder 2) - unsigned CalcPixelColor(MapPoint pt, unsigned t) override; + unsigned calcPixelColor(MapPoint pt, unsigned t) override; /// Berechnet für einen bestimmten Punkt und ein Dreieck die normale Terrainfarbe - unsigned CalcTerrainColor(MapPoint pt, unsigned t); + unsigned calcTerrainColor(MapPoint pt, unsigned t); /// Prüft ob an einer Stelle eine Straße gezeichnet werden muss bool isRoad(MapPoint pt, Visibility visibility); /// Berechnet Spielerfarbe mit in eine gegebene Farbe mit ein (player muss mit +1 gegeben sein!) - unsigned CombineWithPlayerColor(unsigned color, unsigned char player) const; + unsigned combineWithPlayerColor(unsigned color, unsigned char player) const; /// Zusätzliche Dinge, die die einzelnen Maps vor dem Zeichenvorgang zu tun haben /// in dem Falle: Karte aktualisieren - void BeforeDrawing() override; + void beforeDrawing() override; /// Alle Punkte Updaten, bei denen das DrawnObject gleich dem übergebenen drawn_object ist - void UpdateAll(DrawnObject drawn_object); + void updateAll(DrawnObject drawn_object); }; diff --git a/libs/s25main/JoinPlayerInfo.cpp b/libs/s25main/JoinPlayerInfo.cpp index f1f9ba446b..a2622e602d 100644 --- a/libs/s25main/JoinPlayerInfo.cpp +++ b/libs/s25main/JoinPlayerInfo.cpp @@ -25,7 +25,7 @@ void JoinPlayerInfo::Serialize(Serializer& ser) const ser.PushBool(isReady); } -void JoinPlayerInfo::FixSwappedSaveSlot(JoinPlayerInfo& other) +void JoinPlayerInfo::fixSwappedSaveSlot(JoinPlayerInfo& other) { // TODO: This has a code smell. // Probably some composition instead of inheritance required? @@ -41,10 +41,10 @@ void JoinPlayerInfo::FixSwappedSaveSlot(JoinPlayerInfo& other) void JoinPlayerInfo::setAIName(unsigned playerId) { RTTR_Assert(ps == PlayerState::AI); - name = MakeAIName(aiInfo, playerId); + name = makeAIName(aiInfo, playerId); } -std::string JoinPlayerInfo::MakeAIName(const AI::Info& aiInfo, unsigned playerId) +std::string JoinPlayerInfo::makeAIName(const AI::Info& aiInfo, unsigned playerId) { std::string name = (boost::format((aiInfo.type == AI::Type::Dummy) ? _("Dummy %u") : _("Computer %u")) % playerId).str(); diff --git a/libs/s25main/JoinPlayerInfo.h b/libs/s25main/JoinPlayerInfo.h index 1d9db3f7c5..4f4a632f3b 100644 --- a/libs/s25main/JoinPlayerInfo.h +++ b/libs/s25main/JoinPlayerInfo.h @@ -22,7 +22,7 @@ struct JoinPlayerInfo : public PlayerInfo void setAIName(unsigned playerId); // Recovers fixed data in savegames after player slots are swapped - void FixSwappedSaveSlot(JoinPlayerInfo& other); + void fixSwappedSaveSlot(JoinPlayerInfo& other); - static std::string MakeAIName(const AI::Info& aiInfo, unsigned playerId); + static std::string makeAIName(const AI::Info& aiInfo, unsigned playerId); }; diff --git a/libs/s25main/Loader.cpp b/libs/s25main/Loader.cpp index 6ff0686e94..803075f155 100644 --- a/libs/s25main/Loader.cpp +++ b/libs/s25main/Loader.cpp @@ -233,15 +233,15 @@ glArchivItem_Bitmap_Player* Loader::getMapPlayerImage(unsigned nr) * * @return @p true on success, @p false on error. */ -bool Loader::LoadFilesAtStart() +bool Loader::loadFilesAtStart() { namespace res = s25::resources; // Palettes - if(!LoadFiles({res::pal5, res::pal6, res::pal7, res::paletti0, res::paletti1, res::paletti8}) + if(!loadFiles({res::pal5, res::pal6, res::pal7, res::paletti0, res::paletti1, res::paletti8}) || !Load(ResourceId("colors"))) return false; - if(!LoadFonts()) + if(!loadFonts()) return false; std::vector files = {res::resource, @@ -259,16 +259,16 @@ bool Loader::LoadFilesAtStart() files.push_back((loadScreenFolders[1] / filename).string()); } - if(!LoadFiles(files)) + if(!loadFiles(files)) return false; - if(!LoadSounds()) + if(!loadSounds()) return false; - return LoadResources({"io_new", "client", "languages", "logo", "menu", "rttr"}); + return loadResources({"io_new", "client", "languages", "logo", "menu", "rttr"}); } -bool Loader::LoadSounds() +bool Loader::loadSounds() { if(!Load(config_.ExpandPath(s25::files::soundOrig))) return false; @@ -315,7 +315,7 @@ bool Loader::LoadSounds() return true; } -bool Loader::LoadFonts() +bool Loader::loadFonts() { if(!Load(ResourceId("fonts"), getPaletteN("pal5"))) return false; @@ -334,7 +334,7 @@ bool Loader::LoadFonts() return true; } -void Loader::LoadDummyGUIFiles() +void Loader::loadDummyGUIFiles() { // Palettes { @@ -402,7 +402,7 @@ void Loader::LoadDummyGUIFiles() } } -void Loader::LoadDummyMapFiles() +void Loader::loadDummyMapFiles() { libsiedler2::Archiv& map = files_["map_0_z"].archive; if(!map.empty()) @@ -444,7 +444,7 @@ void Loader::LoadDummyMapFiles() } } -void Loader::LoadDummySoundFiles() +void Loader::loadDummySoundFiles() { libsiedler2::Archiv& archive = files_["sound"].archive; archive.alloc(116); @@ -498,7 +498,7 @@ NationResourcesSource getNationResourcesSource(const Nation nation, bool isWinte * * @return @p true on success */ -bool Loader::LoadFilesAtGame(const std::string& mapGfxPath, bool isWinterGFX, const std::vector& nations, +bool Loader::loadFilesAtGame(const std::string& mapGfxPath, bool isWinterGFX, const std::vector& nations, const std::vector& enabledAddons) { initResourceFolders(nations, enabledAddons); @@ -510,7 +510,7 @@ bool Loader::LoadFilesAtGame(const std::string& mapGfxPath, bool isWinterGFX, co const libsiedler2::ArchivItem_Palette* pal5 = getPaletteN("pal5"); - if(!LoadFiles(files) || !Load(ResourceId("map_new"), pal5)) + if(!loadFiles(files) || !Load(ResourceId("map_new"), pal5)) return false; // Load nation building and icon graphics @@ -525,13 +525,13 @@ bool Loader::LoadFilesAtGame(const std::string& mapGfxPath, bool isWinterGFX, co } // TODO: Move to addon folder and make it overwrite existing file - if(!LoadResources({"charburner", "charburner_bobs"})) + if(!loadResources({"charburner", "charburner_bobs"})) return false; - if(!LoadResources({"wine_bobs"})) + if(!loadResources({"wine_bobs"})) return false; - if(!LoadResources({"leather_bobs"})) + if(!loadResources({"leather_bobs"})) return false; const bfs::path mapGFXFile = config_.ExpandPath(mapGfxPath); @@ -544,7 +544,7 @@ bool Loader::LoadFilesAtGame(const std::string& mapGfxPath, bool isWinterGFX, co return true; } -bool Loader::LoadFiles(const std::vector& files) +bool Loader::loadFiles(const std::vector& files) { const libsiedler2::ArchivItem_Palette* pal5 = getPaletteN("pal5"); // load the files @@ -561,7 +561,7 @@ bool Loader::LoadFiles(const std::vector& files) return true; } -bool Loader::LoadResources(const std::vector& resources) +bool Loader::loadResources(const std::vector& resources) { const libsiedler2::ArchivItem_Palette* pal5 = getPaletteN("pal5"); for(const ResourceId& curResource : resources) @@ -1022,7 +1022,7 @@ void Loader::fillCaches() /** * Extrahiert eine Textur aus den Daten. */ -std::unique_ptr Loader::ExtractTexture(const glArchivItem_Bitmap& srcImg, const Rect& rect) +std::unique_ptr Loader::extractTexture(const glArchivItem_Bitmap& srcImg, const Rect& rect) { Extent texSize = rect.getSize(); if(texSize.x == 0 && rect.right < srcImg.getWidth()) @@ -1045,7 +1045,7 @@ std::unique_ptr Loader::ExtractTexture(const glArchivItem_B /** * Extrahiert mehrere (animierte) Texturen aus den Daten. */ -std::unique_ptr Loader::ExtractAnimatedTexture(const glArchivItem_Bitmap& srcImg, const Rect& rect, +std::unique_ptr Loader::extractAnimatedTexture(const glArchivItem_Bitmap& srcImg, const Rect& rect, uint8_t start_index, uint8_t color_count) { Extent texSize = rect.getSize(); @@ -1108,7 +1108,7 @@ bool Loader::Load(libsiedler2::Archiv& archive, const ResourceId& resId, const l } template -bool Loader::LoadImpl(const T& resIdOrPath, const libsiedler2::ArchivItem_Palette* palette) +bool Loader::loadImpl(const T& resIdOrPath, const libsiedler2::ArchivItem_Palette* palette) { const auto resolvedFile = archiveLocator_->resolve(resIdOrPath); if(!resolvedFile) @@ -1136,12 +1136,12 @@ bool Loader::LoadImpl(const T& resIdOrPath, const libsiedler2::ArchivItem_Palett bool Loader::Load(const bfs::path& path, const libsiedler2::ArchivItem_Palette* palette) { - return LoadImpl(path, palette); + return loadImpl(path, palette); } bool Loader::Load(const ResourceId& resId, const libsiedler2::ArchivItem_Palette* palette) { - return LoadImpl(resId, palette); + return loadImpl(resId, palette); } void addDefaultResourceFolders(const RttrConfig& config, ArchiveLocator& locator, diff --git a/libs/s25main/Loader.h b/libs/s25main/Loader.h index 91afd82362..b4945e6d13 100644 --- a/libs/s25main/Loader.h +++ b/libs/s25main/Loader.h @@ -75,19 +75,19 @@ class Loader void initResourceFolders(const std::vector& usedNations, const std::vector& enabledAddons); /// Load general files required also outside of games - bool LoadFilesAtStart(); - bool LoadFonts(); + bool loadFilesAtStart(); + bool loadFonts(); /// Load files required during a game - bool LoadFilesAtGame(const std::string& mapGfxPath, bool isWinterGFX, const std::vector& nations, + bool loadFilesAtGame(const std::string& mapGfxPath, bool isWinterGFX, const std::vector& nations, const std::vector& enabledAddons); /// Load all given files with the default palette - bool LoadFiles(const std::vector& files); - bool LoadResources(const std::vector& resources); + bool loadFiles(const std::vector& files); + bool loadResources(const std::vector& resources); /// Creates archives with empty files for the GUI (for testing purposes) - void LoadDummyGUIFiles(); - void LoadDummyMapFiles(); - void LoadDummySoundFiles(); + void loadDummyGUIFiles(); + void loadDummyMapFiles(); + void loadDummySoundFiles(); /// Load a file and save it into the loader repo bool Load(const boost::filesystem::path& path, const libsiedler2::ArchivItem_Palette* palette = nullptr); bool Load(const ResourceId& resId, const libsiedler2::ArchivItem_Palette* palette = nullptr); @@ -98,8 +98,8 @@ class Loader const libsiedler2::ArchivItem_Palette* palette = nullptr); void fillCaches(); - static std::unique_ptr ExtractTexture(const glArchivItem_Bitmap& srcImg, const Rect& rect); - static std::unique_ptr ExtractAnimatedTexture(const glArchivItem_Bitmap& srcImg, + static std::unique_ptr extractTexture(const glArchivItem_Bitmap& srcImg, const Rect& rect); + static std::unique_ptr extractAnimatedTexture(const glArchivItem_Bitmap& srcImg, const Rect& rect, uint8_t start_index, uint8_t color_count); @@ -216,10 +216,10 @@ class Loader private: /// Load all sounds - bool LoadSounds(); + bool loadSounds(); template - bool LoadImpl(const T& resIdOrPath, const libsiedler2::ArchivItem_Palette* palette); + bool loadImpl(const T& resIdOrPath, const libsiedler2::ArchivItem_Palette* palette); Log& logger_; const RttrConfig& config_; diff --git a/libs/s25main/Messenger.cpp b/libs/s25main/Messenger.cpp index 2d856e0d9c..e2f91dcf64 100644 --- a/libs/s25main/Messenger.cpp +++ b/libs/s25main/Messenger.cpp @@ -22,7 +22,7 @@ const helpers::EnumArray CD_COLORS = {{0, COLOR_WHITE Messenger::~Messenger() = default; /// Zeit, die -void Messenger::Draw() +void Messenger::draw() { const unsigned curTime = VIDEODRIVER.getTickCount(); DrawPoint textPos(20, 100); @@ -43,16 +43,16 @@ void Messenger::Draw() std::string cd_str = (it->cd == ChatDestination::System) ? "" : _(CD_STRINGS[it->cd]); DrawPoint curTextPos(textPos); - LargeFont->Draw(curTextPos, it->author, FontStyle::LEFT, SetAlpha(it->color_author, transparency)); + LargeFont->draw(curTextPos, it->author, FontStyle::LEFT, SetAlpha(it->color_author, transparency)); curTextPos.x += LargeFont->getWidth(it->author); - LargeFont->Draw(curTextPos, cd_str, FontStyle::LEFT, SetAlpha(CD_COLORS[it->cd], transparency)); + LargeFont->draw(curTextPos, cd_str, FontStyle::LEFT, SetAlpha(CD_COLORS[it->cd], transparency)); curTextPos.x += LargeFont->getWidth(cd_str); - LargeFont->Draw(curTextPos, it->msg, FontStyle::LEFT, SetAlpha(it->color_msg, transparency)); + LargeFont->draw(curTextPos, it->msg, FontStyle::LEFT, SetAlpha(it->color_msg, transparency)); ++it; } } -void Messenger::AddMessage(const std::string& author, const unsigned color_author, const ChatDestination cd, +void Messenger::addMessage(const std::string& author, const unsigned color_author, const ChatDestination cd, const std::string& msg, const unsigned color_msg) { if(!author.empty()) @@ -68,7 +68,7 @@ void Messenger::AddMessage(const std::string& author, const unsigned color_autho VIDEODRIVER.getRenderSize().x - 60); // Message-Strings erzeugen aus den WrapInfo - std::vector strings = wi.CreateSingleStrings(msg); + std::vector strings = wi.createSingleStrings(msg); for(unsigned i = 0; i < strings.size(); ++i) { diff --git a/libs/s25main/Messenger.h b/libs/s25main/Messenger.h index 5724f4b467..51b26420ec 100644 --- a/libs/s25main/Messenger.h +++ b/libs/s25main/Messenger.h @@ -27,7 +27,7 @@ class Messenger public: ~Messenger(); - void Draw(); - void AddMessage(const std::string& author, unsigned color_author, ChatDestination cd, const std::string& msg, + void draw(); + void addMessage(const std::string& author, unsigned color_author, ChatDestination cd, const std::string& msg, unsigned color_msg = COLOR_YELLOW); }; diff --git a/libs/s25main/Minimap.cpp b/libs/s25main/Minimap.cpp index 4f1010146e..3c6ab90784 100644 --- a/libs/s25main/Minimap.cpp +++ b/libs/s25main/Minimap.cpp @@ -8,9 +8,9 @@ Minimap::Minimap(const MapExtent& mapSize) : mapSize(mapSize) {} -void Minimap::CreateMapTexture() +void Minimap::createMapTexture() { - map.DeleteTexture(); + map.deleteTexture(); /// Buffer für die Daten erzeugen libsiedler2::PixelBufferBGRA buffer(mapSize.x * 2, mapSize.y); @@ -20,7 +20,7 @@ void Minimap::CreateMapTexture() // Die 2. Terraindreiecke durchgehen for(unsigned t = 0; t < 2; ++t) { - libsiedler2::ColorBGRA color(CalcPixelColor(pt, t)); + libsiedler2::ColorBGRA color(calcPixelColor(pt, t)); unsigned xCoord = (pt.x * 2 + t + (pt.y & 1)) % buffer.getWidth(); buffer.set(xCoord, pt.y, color); } @@ -30,19 +30,19 @@ void Minimap::CreateMapTexture() map.create(buffer); } -void Minimap::Draw(const Rect& rect) +void Minimap::draw(const Rect& rect) { - BeforeDrawing(); + beforeDrawing(); if(rect.getSize().x > 0u && rect.getSize().y > 0) - map.DrawFull(rect); + map.drawFull(rect); } -void Minimap::BeforeDrawing() {} +void Minimap::beforeDrawing() {} /** * Variiert die übergebene Farbe zufällig in der Helligkeit */ -unsigned Minimap::VaryBrightness(const unsigned color, const int range) +unsigned Minimap::varyBrightness(const unsigned color, const int range) { int add = 100 - rand() % (2 * range); diff --git a/libs/s25main/Minimap.h b/libs/s25main/Minimap.h index e1c46605d1..059466e53a 100644 --- a/libs/s25main/Minimap.h +++ b/libs/s25main/Minimap.h @@ -23,7 +23,7 @@ class Minimap virtual ~Minimap() = default; /// Draw the minimap in the given rectangle (stretching if required) - void Draw(const Rect& rect); + void draw(const Rect& rect); /// Gibt Größe der Map zurück MapExtent getMapSize() const { return mapSize; } @@ -34,10 +34,10 @@ class Minimap return static_cast(pt.y) * mapSize.x + static_cast(pt.x); } /// Variiert die übergebene Farbe zufällig in der Helligkeit - static unsigned VaryBrightness(unsigned color, int range); + static unsigned varyBrightness(unsigned color, int range); /// Erstellt die Textur - void CreateMapTexture(); - virtual unsigned CalcPixelColor(MapPoint pt, unsigned t) = 0; + void createMapTexture(); + virtual unsigned calcPixelColor(MapPoint pt, unsigned t) = 0; /// Zusätzliche Dinge, die die einzelnen Maps vor dem Zeichenvorgang zu tun haben - virtual void BeforeDrawing(); + virtual void beforeDrawing(); }; diff --git a/libs/s25main/MusicPlayer.cpp b/libs/s25main/MusicPlayer.cpp index d0f0f3b0a7..61435edc74 100644 --- a/libs/s25main/MusicPlayer.cpp +++ b/libs/s25main/MusicPlayer.cpp @@ -18,32 +18,32 @@ MusicPlayer::MusicPlayer() : playing(false) {} /** * Startet Abspielvorgang */ -void MusicPlayer::Play() +void MusicPlayer::play() { playing = true; - PlayNext(); + playNext(); } /** * Stoppt Abspielvorgang */ -void MusicPlayer::Stop() +void MusicPlayer::stop() { - AUDIODRIVER.StopMusic(); + AUDIODRIVER.stopMusic(); playing = false; } /** * Spielt nächstes Stück ab */ -void MusicPlayer::PlayNext() +void MusicPlayer::playNext() { std::string song = list.getNextSong(); // Am Ende der Liste angekommen? if(song.empty()) { - Stop(); + stop(); return; } @@ -52,7 +52,7 @@ void MusicPlayer::PlayNext() { unsigned nr = s25util::fromStringClassicDef(song.substr(1), 999u); if(nr > 0 && nr <= LOADER.sng_lst.size()) - LOADER.sng_lst[nr - 1]->Play(); + LOADER.sng_lst[nr - 1]->play(); return; } @@ -66,7 +66,7 @@ void MusicPlayer::PlayNext() if(int ec = libsiedler2::loader::LoadSND(song, sng)) { LOG.write(_("Error: %1%\n")) % libsiedler2::getErrorString(ec); - Stop(); + stop(); return; } LOG.write(_("OK\n")); @@ -74,5 +74,5 @@ void MusicPlayer::PlayNext() // Und abspielen auto* curSong = dynamic_cast(sng[0]); if(curSong) - curSong->Play(); + curSong->play(); } diff --git a/libs/s25main/MusicPlayer.h b/libs/s25main/MusicPlayer.h index a0f780e35c..a1e6b4ee89 100644 --- a/libs/s25main/MusicPlayer.h +++ b/libs/s25main/MusicPlayer.h @@ -19,19 +19,19 @@ class MusicPlayer : public Singleton /// Findet einen Weg für Figuren -helpers::OptionalEnum GameWorldBase::FindHumanPath(const MapPoint start, const MapPoint dest, +helpers::OptionalEnum GameWorldBase::findHumanPath(const MapPoint start, const MapPoint dest, const unsigned max_route, const bool random_route, unsigned* length, std::vector* route) const { Direction first_dir{}; - if(getFreePathFinder().FindPath(start, dest, random_route, max_route, route, length, &first_dir, + if(getFreePathFinder().findPath(start, dest, random_route, max_route, route, length, &first_dir, PathConditionHuman(*this))) return first_dir; else @@ -30,11 +30,11 @@ helpers::OptionalEnum GameWorldBase::FindHumanPath(const MapPoint sta } /// Wegfindung für Menschen im Straßennetz -RoadPathDirection GameWorld::FindHumanPathOnRoads(const noRoadNode& start, const noRoadNode& goal, unsigned* length, +RoadPathDirection GameWorld::findHumanPathOnRoads(const noRoadNode& start, const noRoadNode& goal, unsigned* length, MapPoint* firstPt, const RoadSegment* const forbidden) { RoadPathDirection first_dir; - if(getRoadPathFinder().FindPath(start, goal, false, std::numeric_limits::max(), forbidden, length, + if(getRoadPathFinder().findPath(start, goal, false, std::numeric_limits::max(), forbidden, length, &first_dir, firstPt)) return first_dir; else @@ -42,17 +42,17 @@ RoadPathDirection GameWorld::FindHumanPathOnRoads(const noRoadNode& start, const } /// Wegfindung für Waren im Straßennetz -RoadPathDirection GameWorld::FindPathForWareOnRoads(const noRoadNode& start, const noRoadNode& goal, unsigned* length, +RoadPathDirection GameWorld::findPathForWareOnRoads(const noRoadNode& start, const noRoadNode& goal, unsigned* length, MapPoint* firstPt, unsigned max) { RoadPathDirection first_dir; - if(getRoadPathFinder().FindPath(start, goal, true, max, nullptr, length, &first_dir, firstPt)) + if(getRoadPathFinder().findPath(start, goal, true, max, nullptr, length, &first_dir, firstPt)) return first_dir; else return RoadPathDirection::None; } -bool GameWorldBase::FindShipPathToHarbor(const MapPoint start, HarborId harborId, SeaId seaId, +bool GameWorldBase::findShipPathToHarbor(const MapPoint start, HarborId harborId, SeaId seaId, std::vector* route, unsigned* length) const { const MapPoint coastalPoint = getCoastalPoint(harborId, seaId); @@ -102,7 +102,7 @@ bool GameWorldBase::FindShipPathToHarbor(const MapPoint start, HarborId harborId // Not in cache -> compute full path and add std::vector newRoute; - if(!FindShipPath(start, coastalPoint, std::numeric_limits::max(), &newRoute, length)) + if(!findShipPath(start, coastalPoint, std::numeric_limits::max(), &newRoute, length)) return false; shipPathData.addToCache(start, coastalPoint, newRoute); if(route) @@ -111,22 +111,22 @@ bool GameWorldBase::FindShipPathToHarbor(const MapPoint start, HarborId harborId return true; } -bool GameWorldBase::FindShipPath(const MapPoint start, const MapPoint dest, unsigned maxDistance, +bool GameWorldBase::findShipPath(const MapPoint start, const MapPoint dest, unsigned maxDistance, std::vector* route, unsigned* length) const { - return getFreePathFinder().FindPath(start, dest, true, maxDistance, route, length, nullptr, + return getFreePathFinder().findPath(start, dest, true, maxDistance, route, length, nullptr, PathConditionShip(*this)); } /// Prüft, ob eine Schiffsroute noch Gültigkeit hat -bool GameWorld::CheckShipRoute(const MapPoint start, const std::vector& route, const unsigned pos, +bool GameWorld::checkShipRoute(const MapPoint start, const std::vector& route, const unsigned pos, MapPoint* dest) const { - return getFreePathFinder().CheckRoute(start, route, pos, PathConditionShip(*this), dest); + return getFreePathFinder().checkRoute(start, route, pos, PathConditionShip(*this), dest); } /// Find a route for trade caravanes -helpers::OptionalEnum GameWorld::FindTradePath(const MapPoint start, const MapPoint dest, +helpers::OptionalEnum GameWorld::findTradePath(const MapPoint start, const MapPoint dest, unsigned char player, unsigned max_route, bool random_route, std::vector* route, unsigned* length) const { @@ -140,15 +140,15 @@ helpers::OptionalEnum GameWorld::FindTradePath(const MapPoint start, return std::nullopt; Direction first_dir{}; - if(getFreePathFinder().FindPath(start, dest, random_route, max_route, route, length, &first_dir, + if(getFreePathFinder().findPath(start, dest, random_route, max_route, route, length, &first_dir, PathConditionTrade(*this, player))) return first_dir; else return std::nullopt; } -bool GameWorld::CheckTradeRoute(const MapPoint start, const std::vector& route, unsigned pos, +bool GameWorld::checkTradeRoute(const MapPoint start, const std::vector& route, unsigned pos, unsigned char player, MapPoint* dest) const { - return getFreePathFinder().CheckRoute(start, route, pos, PathConditionTrade(*this, player), dest); + return getFreePathFinder().checkRoute(start, route, pos, PathConditionTrade(*this, player), dest); } diff --git a/libs/s25main/Playlist.cpp b/libs/s25main/Playlist.cpp index ae82e22637..05522b2a67 100644 --- a/libs/s25main/Playlist.cpp +++ b/libs/s25main/Playlist.cpp @@ -24,7 +24,7 @@ Playlist::Playlist(std::vector songs, unsigned numRepeats, bool ran throw std::invalid_argument("Empty song passed"); } -void Playlist::Prepare() +void Playlist::prepare() { currentSong_.clear(); order_.clear(); @@ -39,7 +39,7 @@ void Playlist::Prepare() std::shuffle(order_.begin(), order_.end(), std::mt19937(std::random_device()())); } -bool Playlist::SaveAs(const boost::filesystem::path& filepath) const +bool Playlist::saveAs(const boost::filesystem::path& filepath) const { s25util::ClassicImbuedStream out(filepath); if(!out) @@ -89,7 +89,7 @@ bool Playlist::Load(Log& logger, const boost::filesystem::path& filepath) void Playlist::setStartSong(const unsigned id) { if(order_.empty()) - Prepare(); + prepare(); const auto itEl = helpers::find(order_, id); if(itEl != order_.end()) std::swap(order_.front(), *itEl); @@ -99,7 +99,7 @@ const std::string& Playlist::getNextSong() { // Playlist not started, yet or full played? if(order_.empty()) - Prepare(); + prepare(); // Still no songs? (I.e. empty playlist) if(order_.empty()) diff --git a/libs/s25main/Playlist.h b/libs/s25main/Playlist.h index d8d3666b0c..e5d9991f1e 100644 --- a/libs/s25main/Playlist.h +++ b/libs/s25main/Playlist.h @@ -28,7 +28,7 @@ class Playlist const std::string& getNextSong(); /// Save playlist to file - bool SaveAs(const boost::filesystem::path& filepath) const; + bool saveAs(const boost::filesystem::path& filepath) const; /// Load playlist from file bool Load(Log& logger, const boost::filesystem::path& filepath); @@ -42,7 +42,7 @@ class Playlist private: /// Get the playlist ready for playing - void Prepare(); + void prepare(); std::vector songs_; /// Filenames of titles to play unsigned numRepeats_ = 1; /// How often to repeat each song diff --git a/libs/s25main/PreviewMinimap.cpp b/libs/s25main/PreviewMinimap.cpp index 8481f7949b..533d45ccc9 100644 --- a/libs/s25main/PreviewMinimap.cpp +++ b/libs/s25main/PreviewMinimap.cpp @@ -36,7 +36,7 @@ void PreviewMinimap::setMap(const libsiedler2::ArchivItem_Map& s2map) if(s2map.hasLayer(MapLayer::Shadows)) shadows = s2map.getLayer(MapLayer::Shadows); else - CalcShadows(s2map.getLayer(MapLayer::Altitude)); + calcShadows(s2map.getLayer(MapLayer::Altitude)); WorldDescription worldDesc; GameDataLoader gdLoader(worldDesc); @@ -52,19 +52,19 @@ void PreviewMinimap::setMap(const libsiedler2::ArchivItem_Map& s2map) } } - CreateMapTexture(); + createMapTexture(); } -unsigned PreviewMinimap::CalcPixelColor(const MapPoint pt, const unsigned t) +unsigned PreviewMinimap::calcPixelColor(const MapPoint pt, const unsigned t) { unsigned color = 0; // Baum an dieser Stelle? unsigned char landscape_obj = objects[getMMIdx(pt)]; if(landscape_obj >= 0xC4 && landscape_obj <= 0xC6) - color = VaryBrightness(TREE_COLOR, VARY_TREE_COLOR); + color = varyBrightness(TREE_COLOR, VARY_TREE_COLOR); // Granit an dieser Stelle? else if(landscape_obj == 0xCC || landscape_obj == 0xCD) - color = VaryBrightness(GRANITE_COLOR, VARY_GRANITE_COLOR); + color = varyBrightness(GRANITE_COLOR, VARY_GRANITE_COLOR); // Ansonsten die jeweilige Terrainfarbe nehmen else { @@ -85,16 +85,16 @@ unsigned PreviewMinimap::CalcPixelColor(const MapPoint pt, const unsigned t) return color; } -unsigned char PreviewMinimap::CalcShading(const MapPoint pt, const std::vector& altitudes) const +unsigned char PreviewMinimap::calcShading(const MapPoint pt, const std::vector& altitudes) const { int altitude = altitudes[getMMIdx(pt)]; - MapPoint tmp = MakeMapPoint(getNeighbour(Position(pt), Direction::NorthEast), getMapSize()); + MapPoint tmp = makeMapPoint(getNeighbour(Position(pt), Direction::NorthEast), getMapSize()); int A = altitudes[getMMIdx(tmp)] - altitude; - tmp = MakeMapPoint(getNeighbour2(Position(pt), 0), getMapSize()); + tmp = makeMapPoint(getNeighbour2(Position(pt), 0), getMapSize()); int B = altitudes[getMMIdx(tmp)] - altitude; - tmp = MakeMapPoint(getNeighbour(Position(pt), Direction::West), getMapSize()); + tmp = makeMapPoint(getNeighbour(Position(pt), Direction::West), getMapSize()); int C = altitudes[getMMIdx(tmp)] - altitude; - tmp = MakeMapPoint(getNeighbour2(Position(pt), 7), getMapSize()); + tmp = makeMapPoint(getNeighbour2(Position(pt), 7), getMapSize()); int D = altitudes[getMMIdx(tmp)] - altitude; int shadingS2 = 64 + 9 * A - 3 * B - 6 * C - 9 * D; @@ -106,9 +106,9 @@ unsigned char PreviewMinimap::CalcShading(const MapPoint pt, const std::vector& altitudes) +void PreviewMinimap::calcShadows(const std::vector& altitudes) { shadows.resize(altitudes.size()); RTTR_FOREACH_PT(MapPoint, getMapSize()) - shadows[getMMIdx(pt)] = CalcShading(pt, altitudes); + shadows[getMMIdx(pt)] = calcShading(pt, altitudes); } diff --git a/libs/s25main/PreviewMinimap.h b/libs/s25main/PreviewMinimap.h index aa82144b49..9e8787e511 100644 --- a/libs/s25main/PreviewMinimap.h +++ b/libs/s25main/PreviewMinimap.h @@ -23,9 +23,9 @@ class PreviewMinimap : public Minimap protected: /// Berechnet die Farbe für einen bestimmten Pixel der Minimap (t = Terrain1 oder 2) - unsigned CalcPixelColor(MapPoint pt, unsigned t) override; + unsigned calcPixelColor(MapPoint pt, unsigned t) override; private: - unsigned char CalcShading(MapPoint pt, const std::vector& altitudes) const; - void CalcShadows(const std::vector& altitudes); + unsigned char calcShading(MapPoint pt, const std::vector& altitudes) const; + void calcShadows(const std::vector& altitudes); }; diff --git a/libs/s25main/QuickStartGame.cpp b/libs/s25main/QuickStartGame.cpp index 9e0be51d20..c76bf2dfa6 100644 --- a/libs/s25main/QuickStartGame.cpp +++ b/libs/s25main/QuickStartGame.cpp @@ -24,7 +24,7 @@ class SwitchOnStart : public ClientInterface { public: SwitchOnStart() { GAMECLIENT.setInterface(this); } - ~SwitchOnStart() override { GAMECLIENT.RemoveInterface(this); } + ~SwitchOnStart() override { GAMECLIENT.removeInterface(this); } void CI_GameLoading(std::shared_ptr game) override { @@ -51,7 +51,7 @@ std::vector ParseAIOptions(const std::vector& aiOptions) return aiInfos; } -bool QuickStartGame(const boost::filesystem::path& mapOrReplayPath, const std::vector& ais) +bool quickStartGame(const boost::filesystem::path& mapOrReplayPath, const std::vector& ais) { if(!exists(mapOrReplayPath)) { @@ -65,7 +65,7 @@ bool QuickStartGame(const boost::filesystem::path& mapOrReplayPath, const std::v if(loader.getPlaylist()) MUSICPLAYER.setPlaylist(std::move(*loader.getPlaylist())); if(SETTINGS.sound.musicEnabled) - MUSICPLAYER.Play(); + MUSICPLAYER.play(); // An AI-battle is a single-player game. const bool isSinglePlayer = !ais.empty(); @@ -87,16 +87,16 @@ bool QuickStartGame(const boost::filesystem::path& mapOrReplayPath, const std::v WINDOWMANAGER.Switch(std::make_unique(csi)); - if((extension == ".sav" && GAMECLIENT.HostGame(csi, {mapOrReplayPath, MapType::Savegame})) + if((extension == ".sav" && GAMECLIENT.hostGame(csi, {mapOrReplayPath, MapType::Savegame})) || ((extension == ".swd" || extension == ".wld") - && GAMECLIENT.HostGame(csi, {mapOrReplayPath, MapType::OldMap}))) + && GAMECLIENT.hostGame(csi, {mapOrReplayPath, MapType::OldMap}))) { GAMECLIENT.setAIBattlePlayers(std::move(aiInfos)); - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(csi.type, nullptr)); + WINDOWMANAGER.showAfterSwitch(std::make_unique(csi.type, nullptr)); return true; } else { SwitchOnStart switchOnStart; - return GAMECLIENT.StartReplay(mapOrReplayPath); + return GAMECLIENT.startReplay(mapOrReplayPath); } } diff --git a/libs/s25main/QuickStartGame.h b/libs/s25main/QuickStartGame.h index b11753a654..bf7e721170 100644 --- a/libs/s25main/QuickStartGame.h +++ b/libs/s25main/QuickStartGame.h @@ -13,4 +13,4 @@ std::vector ParseAIOptions(const std::vector& aiOptions); /// Tries to start a game (map, savegame, replay, or ai-battle) and returns whether this was successfull -bool QuickStartGame(const boost::filesystem::path& mapOrReplayPath, const std::vector& ais); +bool quickStartGame(const boost::filesystem::path& mapOrReplayPath, const std::vector& ais); diff --git a/libs/s25main/Replay.cpp b/libs/s25main/Replay.cpp index 0d56a17059..487158923b 100644 --- a/libs/s25main/Replay.cpp +++ b/libs/s25main/Replay.cpp @@ -57,16 +57,16 @@ uint8_t Replay::getLatestMajorVersion() const Replay::Replay() = default; Replay::~Replay() = default; -void Replay::Close() +void Replay::close() { file_.Close(); uncompressedDataFile_.reset(); isRecording_ = false; filepath_.clear(); - ClearPlayers(); + clearPlayers(); } -bool Replay::StopRecording() +bool Replay::stopRecording() { if(!isRecording_) return true; @@ -129,7 +129,7 @@ bool Replay::StopRecording() } } -bool Replay::StartRecording(const boost::filesystem::path& filepath, const MapInfo& mapInfo, const unsigned randomSeed) +bool Replay::startRecording(const boost::filesystem::path& filepath, const MapInfo& mapInfo, const unsigned randomSeed) { // Deny overwrite, also avoids double-opening by different processes if(boost::filesystem::exists(filepath)) @@ -144,7 +144,7 @@ bool Replay::StartRecording(const boost::filesystem::path& filepath, const MapIn mapType_ = mapInfo.type; randomSeed_ = randomSeed; - WriteAllHeaderData(file_, mapInfo.title); + writeAllHeaderData(file_, mapInfo.title); file_.WriteUnsignedChar(rttr::enum_cast(mapType_)); // TODO(Replay): Move before mapType file_.WriteUnsignedChar(subVersion_ = currentReplayDataVersion); @@ -153,15 +153,15 @@ bool Replay::StartRecording(const boost::filesystem::path& filepath, const MapIn // For (savegame) format validation if(mapType_ == MapType::Savegame) - mapInfo.savegame->WriteFileHeader(file_); + mapInfo.savegame->writeFileHeader(file_); // store position to update it later lastGfFilePos_ = file_.Tell(); file_.WriteUnsignedInt(lastGF_); file_.WriteUnsignedChar(0); // Compressed flag - WritePlayerData(file_); - WriteGGS(file_); + writePlayerData(file_); + writeGGS(file_); // Game data file_.WriteUnsignedInt(randomSeed_); @@ -180,7 +180,7 @@ bool Replay::StartRecording(const boost::filesystem::path& filepath, const MapIn if(!mapInfo.luaData.data.empty()) file_.WriteRawData(mapInfo.luaData.data.data(), mapInfo.luaData.data.size()); break; - case MapType::Savegame: mapInfo.savegame->Save(file_, getMapName()); break; + case MapType::Savegame: mapInfo.savegame->save(file_, getMapName()); break; } // Flush now to not loose any information file_.Flush(); @@ -194,9 +194,9 @@ const boost::filesystem::path& Replay::getPath() const return filepath_; } -bool Replay::LoadHeader(const boost::filesystem::path& filepath) +bool Replay::loadHeader(const boost::filesystem::path& filepath) { - Close(); + close(); if(!file_.Open(filepath, OpenFileMode::Read)) { lastErrorMsg = _("File could not be opened."); @@ -207,7 +207,7 @@ bool Replay::LoadHeader(const boost::filesystem::path& filepath) try { // Check file header - if(!ReadAllHeaderData(file_)) + if(!readAllHeaderData(file_)) return false; mapType_ = static_cast(file_.ReadUnsignedChar()); @@ -238,7 +238,7 @@ bool Replay::LoadHeader(const boost::filesystem::path& filepath) { // Validate savegame Savegame save; - if(!save.ReadFileHeader(file_)) + if(!save.readFileHeader(file_)) { lastErrorMsg = std::string(_("Savegame error: ")) + save.getLastErrorMsg(); return false; @@ -269,16 +269,16 @@ bool Replay::LoadGameData(MapInfo& mapInfo) file_.ReadRawData(compressedData.data.data(), compressedSize); uncompressedDataFile_ = std::make_unique(".rpl"); uncompressedDataFile_->close(); - compressedData.DecompressToFile(uncompressedDataFile_->filePath); + compressedData.decompressToFile(uncompressedDataFile_->filePath); file_.Close(); file_.Open(uncompressedDataFile_->filePath, OpenFileMode::Read); } - ReadPlayerData(file_); - ReadGGS(file_); + readPlayerData(file_); + readGGS(file_); randomSeed_ = file_.ReadUnsignedInt(); - mapInfo.Clear(); + mapInfo.clear(); mapInfo.type = mapType_; mapInfo.title = getMapName(); mapInfo.filepath = file_.ReadLongString(); @@ -311,7 +311,7 @@ bool Replay::LoadGameData(MapInfo& mapInfo) return true; } -void Replay::AddChatCommand(unsigned gf, uint8_t player, ChatDestination dest, const std::string& str) +void Replay::addChatCommand(unsigned gf, uint8_t player, ChatDestination dest, const std::string& str) { RTTR_Assert(isRecording()); if(!file_.IsOpen()) @@ -328,7 +328,7 @@ void Replay::AddChatCommand(unsigned gf, uint8_t player, ChatDestination dest, c file_.Flush(); } -void Replay::AddGameCommand(unsigned gf, uint8_t player, const PlayerGameCommands& cmds) +void Replay::addGameCommand(unsigned gf, uint8_t player, const PlayerGameCommands& cmds) { RTTR_Assert(isRecording()); if(!file_.IsOpen()) @@ -346,7 +346,7 @@ void Replay::AddGameCommand(unsigned gf, uint8_t player, const PlayerGameCommand file_.Flush(); } -std::optional Replay::ReadGF() +std::optional Replay::readGF() { RTTR_Assert(isReplaying()); try @@ -360,7 +360,7 @@ std::optional Replay::ReadGF() } } -boost_variant2 Replay::ReadCommand() +boost_variant2 Replay::readCommand() { RTTR_Assert(isReplaying()); const auto type = static_cast(file_.ReadUnsignedChar() - (subVersion_ == 0 ? 1 : 0)); @@ -372,7 +372,7 @@ boost_variant2 Replay::ReadCommand() } } -void Replay::UpdateLastGF(unsigned last_gf) +void Replay::updateLastGF(unsigned last_gf) { RTTR_Assert(isRecording()); if(!file_.IsOpen()) diff --git a/libs/s25main/Replay.h b/libs/s25main/Replay.h index 86cc40319d..af71120f83 100644 --- a/libs/s25main/Replay.h +++ b/libs/s25main/Replay.h @@ -48,16 +48,16 @@ class Replay : public SavedFile Replay(); ~Replay() override; - void Close(); + void close(); std::string getSignature() const override; uint8_t getLatestMinorVersion() const override; uint8_t getLatestMajorVersion() const override; /// Opens the replay for recording - bool StartRecording(const boost::filesystem::path& filepath, const MapInfo& mapInfo, unsigned randomSeed); + bool startRecording(const boost::filesystem::path& filepath, const MapInfo& mapInfo, unsigned randomSeed); /// Stop recording. Will compress the data and return true if that succeeded. The file will be closed in any case - bool StopRecording(); + bool stopRecording(); /// Is the replay in the state for accepting commands to record bool isRecording() const { return isRecording_ && file_.IsOpen(); } @@ -66,21 +66,21 @@ class Replay : public SavedFile const boost::filesystem::path& getPath() const; /// Load the header (containing map and player names) - bool LoadHeader(const boost::filesystem::path& filepath); + bool loadHeader(const boost::filesystem::path& filepath); /// Load the remaining data into the mapInfo bool LoadGameData(MapInfo& mapInfo); /// Record a chat message - void AddChatCommand(unsigned gf, uint8_t player, ChatDestination dest, const std::string& str); + void addChatCommand(unsigned gf, uint8_t player, ChatDestination dest, const std::string& str); /// Record game commands (player actions) - void AddGameCommand(unsigned gf, uint8_t player, const PlayerGameCommands& cmds); + void addGameCommand(unsigned gf, uint8_t player, const PlayerGameCommands& cmds); /// Read the next GameFrame to which the following replay command applies if there are any left - std::optional ReadGF(); - boost_variant2 ReadCommand(); + std::optional readGF(); + boost_variant2 readCommand(); /// Update the (currently) last GameFrame in the file - void UpdateLastGF(unsigned last_gf); + void updateLastGF(unsigned last_gf); unsigned getSeed() const { return randomSeed_; } unsigned getLastGF() const { return lastGF_; } diff --git a/libs/s25main/ReplayPlayback.cpp b/libs/s25main/ReplayPlayback.cpp index 479534d2e8..7b87167391 100644 --- a/libs/s25main/ReplayPlayback.cpp +++ b/libs/s25main/ReplayPlayback.cpp @@ -19,7 +19,7 @@ ReplayCommandsResult ExecuteReplayCommands(Replay& replay, std::optionalExecute(game.world_, gameCmd.player); + gc->execute(game.world_, gameCmd.player); const AsyncChecksum& expected = gameCmd.cmds.checksum; // A zero checksum means the recording did not store one @@ -36,7 +36,7 @@ ReplayCommandsResult ExecuteReplayCommands(Replay& replay, std::optional()), f1(sgd.PopObject()), f2(sgd.PopObject()) + : GameObject(sgd, obj_id), rt(sgd.pop()), f1(sgd.popObject()), f2(sgd.popObject()) { if(sgd.getGameDataVersion() < 7) route.resize(sgd.PopUnsignedShort()); else helpers::popContainer(sgd, route); - carriers_[0] = sgd.PopObject(GO_Type::NofCarrier); - carriers_[1] = sgd.PopObject(GO_Type::NofCarrier); + carriers_[0] = sgd.popObject(GO_Type::NofCarrier); + carriers_[1] = sgd.popObject(GO_Type::NofCarrier); if(sgd.getGameDataVersion() < 7) helpers::popContainer(sgd, route, true); @@ -48,18 +48,18 @@ bool RoadSegment::getNodeID(const noRoadNode& rn) const return (&rn == f2); } -void RoadSegment::Destroy() +void RoadSegment::destroy() { // This can be the road segment from the flag to the building (always in this order!) // Those are not considered "roads" and therefore never registered RTTR_Assert(f1->getGOT() == GO_Type::Flag); if(f2->getGOT() == GO_Type::Flag) - world->getPlayer(f1->getPlayer()).DeleteRoad(this); + world->getPlayer(f1->getPlayer()).deleteRoad(this); if(carriers_[0]) - carriers_[0]->LostWork(); + carriers_[0]->lostWork(); if(carriers_[1]) - carriers_[1]->LostWork(); + carriers_[1]->lostWork(); if(!route.empty()) { @@ -76,13 +76,13 @@ void RoadSegment::Destroy() auto& figure = static_cast(object); if(figure.getCurrentRoad() == this) { - figure.Abrogate(); - figure.StartWandering(); + figure.abrogate(); + figure.startWandering(); } } } - world->RoadNodeAvailable(pt); + world->roadNodeAvailable(pt); if(i != route.size()) { @@ -96,18 +96,18 @@ void RoadSegment::Destroy() void RoadSegment::Serialize(SerializedGameData& sgd) const { - sgd.PushEnum(rt); - sgd.PushObject(f1); - sgd.PushObject(f2); + sgd.pushEnum(rt); + sgd.pushObject(f1); + sgd.pushObject(f2); helpers::pushContainer(sgd, route); - sgd.PushObject(carriers_[0], true); - sgd.PushObject(carriers_[1], true); + sgd.pushObject(carriers_[0], true); + sgd.pushObject(carriers_[1], true); } /** * zerteilt die Straße in 2 Teile. */ -void RoadSegment::SplitRoad(noFlag* splitflag) +void RoadSegment::splitRoad(noFlag* splitflag) { // Flag 1 _________ This flag _________ Flag 2 // | broken road | @@ -136,7 +136,7 @@ void RoadSegment::SplitRoad(noFlag* splitflag) // donkey road? Then upgrade flag, since it will be between donkey roads if(rt == RoadType::Donkey) - splitflag->Upgrade(); + splitflag->upgrade(); // create 1st section from F1 to this F (1st section is this road!) route.resize(length1); @@ -162,7 +162,7 @@ void RoadSegment::SplitRoad(noFlag* splitflag) { auto& figure = static_cast(object); if(figure.getCurrentRoad() == this) - figure.CorrectSplitData(second); + figure.correctSplitData(second); } } @@ -172,16 +172,16 @@ void RoadSegment::SplitRoad(noFlag* splitflag) } } - world->getPlayer(f1->getPlayer()).AddRoad(second); + world->getPlayer(f1->getPlayer()).addRoad(second); for(unsigned char i = 0; i < 2; ++i) { if(carriers_[i]) - carriers_[i]->RoadSplitted(this, second); + carriers_[i]->roadSplitted(this, second); else if(i == 0) // If road was unoccupied before then add 2nd part to the unoccupied roads // (1st is already included) - world->getPlayer(f1->getPlayer()).FindCarrierForRoad(*second); + world->getPlayer(f1->getPlayer()).findCarrierForRoad(*second); } } @@ -189,7 +189,7 @@ void RoadSegment::SplitRoad(noFlag* splitflag) * Überprüft ob es an den Flaggen noch Waren zu tragen gibt für den Träger. * Nur bei Straßen mit 2 Flagge aufrufen, nicht bei Hauseingängen etc. !! */ -bool RoadSegment::AreWareJobs(const bool flag, CarrierType ct, const bool take_ware_immediately) const +bool RoadSegment::areWareJobs(const bool flag, CarrierType ct, const bool take_ware_immediately) const { unsigned jobs_count; @@ -239,7 +239,7 @@ bool RoadSegment::AreWareJobs(const bool flag, CarrierType ct, const bool take_w * * rn ist die Flagge, von der sie kommt */ -void RoadSegment::AddWareJob(const noRoadNode* rn) +void RoadSegment::addWareJob(const noRoadNode* rn) { // Wenn das eine Straße zu einer Gebäudetür ist, muss dem entsprechenden Gebäude Bescheid gesagt werden (momentan // nur Lagerhäuser!) @@ -248,7 +248,7 @@ void RoadSegment::AddWareJob(const noRoadNode* rn) if(f2->getType() == NodalObjectType::Building) { if(BuildingProperties::isWareHouse(static_cast(f2)->getBuildingType())) - static_cast(f2)->FetchWare(); + static_cast(f2)->fetchWare(); else LOG.write("RoadSegment::AddWareJob: WARNING: Ware in front of building at %i,%i (gf: %u)!\n") % f2->getPos().x % f2->getPos().y % getEvMgr().getCurrentGF(); @@ -263,7 +263,7 @@ void RoadSegment::AddWareJob(const noRoadNode* rn) { if(carriers_[(i + first) % 2]) { - if(carriers_[(i + first) % 2]->AddWareJob(rn)) + if(carriers_[(i + first) % 2]->addWareJob(rn)) // Ja, hat Zeit, dann brauchen wir den anderen nicht zu fragen break; } @@ -273,20 +273,20 @@ void RoadSegment::AddWareJob(const noRoadNode* rn) /** * Eine Ware will nicht mehr befördert werden. */ -void RoadSegment::WareJobRemoved(const noFigure* const exception) +void RoadSegment::wareJobRemoved(const noFigure* const exception) { // Allen Trägern Bescheid sagen for(unsigned char i = 0; i < 2; ++i) { if(carriers_[i] && carriers_[i] != exception) - carriers_[i]->RemoveWareJob(); + carriers_[i]->removeWareJob(); } } /** * Baut die Straße zu einer Eselstraße aus. */ -void RoadSegment::UpgradeDonkeyRoad() +void RoadSegment::upgradeDonkeyRoad() { // Nur normale Straße können Eselstraßen werden if(rt != RoadType::Normal) @@ -306,38 +306,38 @@ void RoadSegment::UpgradeDonkeyRoad() RTTR_Assert(f1->getGOT() == GO_Type::Flag); RTTR_Assert(f2->getGOT() == GO_Type::Flag); - static_cast(f1)->Upgrade(); - static_cast(f2)->Upgrade(); + static_cast(f1)->upgrade(); + static_cast(f2)->upgrade(); // Esel rufen (falls es einen gibt) - TryGetDonkey(); + tryGetDonkey(); } /** * Soll versuchen einen Esel zu bekommen. */ -void RoadSegment::TryGetDonkey() +void RoadSegment::tryGetDonkey() { // Nur rufen, falls es eine Eselstraße ist, noch kein Esel da ist, aber schon ein Träger da ist - if(NeedDonkey()) - carriers_[1] = world->getPlayer(f1->getPlayer()).OrderDonkey(*this); + if(needDonkey()) + carriers_[1] = world->getPlayer(f1->getPlayer()).orderDonkey(*this); } /** * Ein Träger muss kündigen, aus welchen Gründen auch immer. */ -void RoadSegment::CarrierAbrogated(nofCarrier* carrier) +void RoadSegment::carrierAbrogated(nofCarrier* carrier) { // Gucken, ob Träger und Esel gekündigt hat if(carrier->getCarrierType() == CarrierType::Normal || carrier->getCarrierType() == CarrierType::Boat) { // Straße wieder unbesetzt, bzw. nur noch Esel this->carriers_[0] = nullptr; - world->getPlayer(f1->getPlayer()).FindCarrierForRoad(*this); + world->getPlayer(f1->getPlayer()).findCarrierForRoad(*this); } else { // Kein Esel mehr da, versuchen, neuen zu bestellen - this->carriers_[1] = world->getPlayer(f1->getPlayer()).OrderDonkey(*this); + this->carriers_[1] = world->getPlayer(f1->getPlayer()).orderDonkey(*this); } } /** diff --git a/libs/s25main/RoadSegment.h b/libs/s25main/RoadSegment.h index 572b6cecb7..9bfb52113c 100644 --- a/libs/s25main/RoadSegment.h +++ b/libs/s25main/RoadSegment.h @@ -34,7 +34,7 @@ class RoadSegment : public GameObject RoadSegment(SerializedGameData& sgd, unsigned obj_id); /// zerstört das Objekt. - void Destroy() override; + void destroy() override; /// serialisiert das Objekt. void Serialize(SerializedGameData& sgd) const override; /// liefert den GO-Type. @@ -69,9 +69,9 @@ class RoadSegment : public GameObject /// haben wir den Carrier "nr"? bool hasCarrier(unsigned char nr) const { return (carriers_[nr] != nullptr); } /// Braucht die Straße einen Esel? Nur wenn sie auch einen Träger schon hat! - bool NeedDonkey() const { return (rt == RoadType::Donkey && carriers_[0] && !carriers_[1]); } + bool needDonkey() const { return (rt == RoadType::Donkey && carriers_[0] && !carriers_[1]); } /// Hat einen Esel als Arbeiter dazubekommen. - void GotDonkey(nofCarrier* donkey) + void gotDonkey(nofCarrier* donkey) { RTTR_Assert(!carriers_[1]); carriers_[1] = donkey; @@ -89,19 +89,19 @@ class RoadSegment : public GameObject } /// zerteilt die Straße in 2 Teile. - void SplitRoad(noFlag* splitflag); + void splitRoad(noFlag* splitflag); /// Überprüft ob es an den Flaggen noch Waren zu tragen gibt für den Träger. - bool AreWareJobs(bool flag, CarrierType ct, bool take_ware_immediately) const; + bool areWareJobs(bool flag, CarrierType ct, bool take_ware_immediately) const; /// Eine Ware sagt Bescheid, dass sie über dem Weg getragen werden will. - void AddWareJob(const noRoadNode* rn); + void addWareJob(const noRoadNode* rn); /// Eine Ware will nicht mehr befördert werden. - void WareJobRemoved(const noFigure* exception); + void wareJobRemoved(const noFigure* exception); /// Baut die Straße zu einer Eselstraße aus. - void UpgradeDonkeyRoad(); + void upgradeDonkeyRoad(); /// Soll versuchen einen Esel zu bekommen. - void TryGetDonkey(); + void tryGetDonkey(); /// Ein Träger muss kündigen, aus welchen Gründen auch immer. - void CarrierAbrogated(nofCarrier* carrier); + void carrierAbrogated(nofCarrier* carrier); /// given a flag returns the flag at the other end const noFlag& getOtherFlag(const noFlag& flag) const; /// given a flag returns last direction of the route towards the other flag diff --git a/libs/s25main/RttrLobbyClient.cpp b/libs/s25main/RttrLobbyClient.cpp index 5a24bbe92f..4ebcbaca05 100644 --- a/libs/s25main/RttrLobbyClient.cpp +++ b/libs/s25main/RttrLobbyClient.cpp @@ -12,22 +12,22 @@ bool RttrLobbyClient::IsLoggedIn() const return client_.IsLoggedIn(); } -void RttrLobbyClient::AddListener(LobbyInterface* listener) +void RttrLobbyClient::addListener(LobbyInterface* listener) { client_.AddListener(listener); } -void RttrLobbyClient::RemoveListener(LobbyInterface* listener) +void RttrLobbyClient::removeListener(LobbyInterface* listener) { client_.RemoveListener(listener); } -void RttrLobbyClient::SendServerJoinRequest() +void RttrLobbyClient::sendServerJoinRequest() { client_.SendServerJoinRequest(); } -void RttrLobbyClient::SendChat(const std::string& text) +void RttrLobbyClient::sendChat(const std::string& text) { client_.SendChat(text); } diff --git a/libs/s25main/RttrLobbyClient.hpp b/libs/s25main/RttrLobbyClient.hpp index 5e310ba5f9..e08feee94b 100644 --- a/libs/s25main/RttrLobbyClient.hpp +++ b/libs/s25main/RttrLobbyClient.hpp @@ -16,8 +16,8 @@ class RttrLobbyClient : public ILobbyClient public: explicit RttrLobbyClient(LobbyClient& client); bool IsLoggedIn() const override; - void AddListener(LobbyInterface* listener) override; - void RemoveListener(LobbyInterface* listener) override; - void SendServerJoinRequest() override; - void SendChat(const std::string& text) override; + void addListener(LobbyInterface* listener) override; + void removeListener(LobbyInterface* listener) override; + void sendServerJoinRequest() override; + void sendChat(const std::string& text) override; }; diff --git a/libs/s25main/SavedFile.cpp b/libs/s25main/SavedFile.cpp index 3434e2a051..80438e48b9 100644 --- a/libs/s25main/SavedFile.cpp +++ b/libs/s25main/SavedFile.cpp @@ -34,7 +34,7 @@ uint8_t SavedFile::getMajorVersion() const return majorVersion_.value(); } -void SavedFile::WriteFileHeader(BinaryFile& file) const +void SavedFile::writeFileHeader(BinaryFile& file) const { // Signature const std::string signature = getSignature(); @@ -44,7 +44,7 @@ void SavedFile::WriteFileHeader(BinaryFile& file) const file.WriteUnsignedChar(getLatestMinorVersion()); } -void SavedFile::WriteExtHeader(BinaryFile& file, const std::string& mapName) +void SavedFile::writeExtHeader(BinaryFile& file, const std::string& mapName) { // Store data in struct saveTime_ = s25util::Time::CurrentTime(); @@ -60,7 +60,7 @@ void SavedFile::WriteExtHeader(BinaryFile& file, const std::string& mapName) file.WriteShortString(name); } -bool SavedFile::ReadFileHeader(BinaryFile& file) +bool SavedFile::readFileHeader(BinaryFile& file) { lastErrorMsg.clear(); @@ -103,7 +103,7 @@ bool SavedFile::ReadFileHeader(BinaryFile& file) return true; } -bool SavedFile::ReadExtHeader(BinaryFile& file) +bool SavedFile::readExtHeader(BinaryFile& file) { file.ReadRawData(revision.data(), revision.size()); file.ReadRawData(&saveTime_, sizeof(saveTime_)); @@ -115,23 +115,23 @@ bool SavedFile::ReadExtHeader(BinaryFile& file) return true; } -void SavedFile::WriteAllHeaderData(BinaryFile& file, const std::string& mapName) +void SavedFile::writeAllHeaderData(BinaryFile& file, const std::string& mapName) { // Versionszeug schreiben - WriteFileHeader(file); - WriteExtHeader(file, mapName); + writeFileHeader(file); + writeExtHeader(file, mapName); } -bool SavedFile::ReadAllHeaderData(BinaryFile& file) +bool SavedFile::readAllHeaderData(BinaryFile& file) { - if(!ReadFileHeader(file)) + if(!readFileHeader(file)) return false; - if(!ReadExtHeader(file)) + if(!readExtHeader(file)) return false; return true; } -void SavedFile::WritePlayerData(BinaryFile& file) +void SavedFile::writePlayerData(BinaryFile& file) { Serializer ser; ser.PushUnsignedChar(players.size()); @@ -141,9 +141,9 @@ void SavedFile::WritePlayerData(BinaryFile& file) ser.WriteToFile(file); } -void SavedFile::ReadPlayerData(BinaryFile& file) +void SavedFile::readPlayerData(BinaryFile& file) { - ClearPlayers(); + clearPlayers(); Serializer ser; ser.ReadFromFile(file); const unsigned playerCt = ser.PopUnsignedChar(); @@ -162,14 +162,14 @@ void SavedFile::ReadPlayerData(BinaryFile& file) player.team = Team(rttr::enum_cast(player.team) - 3); // Was random team 2-4 else if(player.team == Team::Random) player.team = Team::Team1; // Was random team 1 - AddPlayer(player); + addPlayer(player); } } /** * schreibt die GlobalGameSettings in die Datei. */ -void SavedFile::WriteGGS(BinaryFile& file) const +void SavedFile::writeGGS(BinaryFile& file) const { Serializer ser; ggs.Serialize(ser); @@ -179,7 +179,7 @@ void SavedFile::WriteGGS(BinaryFile& file) const /** * liest die GlobalGameSettings aus der Datei. */ -void SavedFile::ReadGGS(BinaryFile& file) +void SavedFile::readGGS(BinaryFile& file) { Serializer ser; ser.ReadFromFile(file); @@ -196,14 +196,14 @@ unsigned SavedFile::getNumPlayers() return players.size(); } -void SavedFile::AddPlayer(const BasePlayerInfo& player) +void SavedFile::addPlayer(const BasePlayerInfo& player) { players.push_back(player); if(player.isUsed()) playerNames_.push_back(player.name); } -void SavedFile::ClearPlayers() +void SavedFile::clearPlayers() { players.clear(); playerNames_.clear(); diff --git a/libs/s25main/SavedFile.h b/libs/s25main/SavedFile.h index 829ac4a0f9..705ccb29cf 100644 --- a/libs/s25main/SavedFile.h +++ b/libs/s25main/SavedFile.h @@ -33,31 +33,31 @@ class SavedFile uint8_t getMajorVersion() const; /// Schreibt Signatur und Version der Datei - void WriteFileHeader(BinaryFile& file) const; + void writeFileHeader(BinaryFile& file) const; /// Reads and validates the file header. On error false is returned and lastErrorMsg is set - bool ReadFileHeader(BinaryFile& file); + bool readFileHeader(BinaryFile& file); /// Write common information (program version, map name, time and player names) - virtual void WriteExtHeader(BinaryFile& file, const std::string& mapName); - virtual bool ReadExtHeader(BinaryFile& file); + virtual void writeExtHeader(BinaryFile& file, const std::string& mapName); + virtual bool readExtHeader(BinaryFile& file); - void WriteAllHeaderData(BinaryFile& file, const std::string& mapName); - bool ReadAllHeaderData(BinaryFile& file); + void writeAllHeaderData(BinaryFile& file, const std::string& mapName); + bool readAllHeaderData(BinaryFile& file); /// Schreibt Spielerdaten - void WritePlayerData(BinaryFile& file); + void writePlayerData(BinaryFile& file); /// Liest Spielerdaten aus - void ReadPlayerData(BinaryFile& file); + void readPlayerData(BinaryFile& file); /// schreibt die GlobalGameSettings in die Datei. - void WriteGGS(BinaryFile& file) const; + void writeGGS(BinaryFile& file) const; /// liest die GlobalGameSettings aus der Datei. - void ReadGGS(BinaryFile& file); + void readGGS(BinaryFile& file); const BasePlayerInfo& getPlayer(unsigned idx) const; unsigned getNumPlayers(); - void AddPlayer(const BasePlayerInfo& player); - void ClearPlayers(); + void addPlayer(const BasePlayerInfo& player); + void clearPlayers(); const std::string& getLastErrorMsg() const { return lastErrorMsg; } diff --git a/libs/s25main/Savegame.cpp b/libs/s25main/Savegame.cpp index 5a102e043b..b68a5ac662 100644 --- a/libs/s25main/Savegame.cpp +++ b/libs/s25main/Savegame.cpp @@ -33,19 +33,19 @@ Savegame::Savegame() : start_gf(0) {} Savegame::~Savegame() = default; -bool Savegame::Save(const boost::filesystem::path& filepath, const std::string& mapName) +bool Savegame::save(const boost::filesystem::path& filepath, const std::string& mapName) { BinaryFile file; - return file.Open(filepath, OpenFileMode::Write) && Save(file, mapName); + return file.Open(filepath, OpenFileMode::Write) && save(file, mapName); } -bool Savegame::Save(BinaryFile& file, const std::string& mapName) +bool Savegame::save(BinaryFile& file, const std::string& mapName) { - WriteAllHeaderData(file, mapName); - WritePlayerData(file); - WriteGGS(file); - WriteGameData(file); + writeAllHeaderData(file, mapName); + writePlayerData(file); + writeGGS(file); + writeGameData(file); return true; } @@ -61,21 +61,21 @@ bool Savegame::Load(BinaryFile& file, const SaveGameDataToLoad what) { try { - ClearPlayers(); + clearPlayers(); sgd.Clear(); - if(!ReadAllHeaderData(file)) + if(!readAllHeaderData(file)) return false; if(what == SaveGameDataToLoad::Header) return true; - ReadPlayerData(file); - ReadGGS(file); + readPlayerData(file); + readGGS(file); if(what == SaveGameDataToLoad::HeaderAndSettings) return true; - ReadGameData(file); + readGameData(file); } catch(const std::runtime_error& e) { lastErrorMsg = e.what(); @@ -85,21 +85,21 @@ bool Savegame::Load(BinaryFile& file, const SaveGameDataToLoad what) return true; } -void Savegame::WriteExtHeader(BinaryFile& file, const std::string& mapName) +void Savegame::writeExtHeader(BinaryFile& file, const std::string& mapName) { - SavedFile::WriteExtHeader(file, mapName); + SavedFile::writeExtHeader(file, mapName); file.WriteUnsignedInt(start_gf); } -bool Savegame::ReadExtHeader(BinaryFile& file) +bool Savegame::readExtHeader(BinaryFile& file) { - if(!SavedFile::ReadExtHeader(file)) + if(!SavedFile::readExtHeader(file)) return false; start_gf = file.ReadUnsignedInt(); return true; } -void Savegame::WriteGameData(BinaryFile& file) +void Savegame::writeGameData(BinaryFile& file) { file.WriteUnsignedInt(1); // Compressed flag for compatibility std::vector data(sgd.GetData(), sgd.GetData() + sgd.GetLength()); @@ -110,7 +110,7 @@ void Savegame::WriteGameData(BinaryFile& file) file.WriteRawData(data.data(), data.size()); } -bool Savegame::ReadGameData(BinaryFile& file) +bool Savegame::readGameData(BinaryFile& file) { std::vector data; const auto compressedFlagOrSize = file.ReadUnsignedInt(); diff --git a/libs/s25main/Savegame.h b/libs/s25main/Savegame.h index 51f901b6c2..9e6e192a13 100644 --- a/libs/s25main/Savegame.h +++ b/libs/s25main/Savegame.h @@ -28,15 +28,15 @@ class Savegame : public SavedFile uint8_t getLatestMajorVersion() const override; /// Schreibst Savegame oder Teile davon - bool Save(const boost::filesystem::path& filepath, const std::string& mapName); - bool Save(BinaryFile& file, const std::string& mapName); + bool save(const boost::filesystem::path& filepath, const std::string& mapName); + bool save(BinaryFile& file, const std::string& mapName); /// Lädt Savegame oder Teile davon bool Load(const boost::filesystem::path& filePath, SaveGameDataToLoad what); bool Load(BinaryFile& file, SaveGameDataToLoad what); - void WriteExtHeader(BinaryFile& file, const std::string& mapName) override; - bool ReadExtHeader(BinaryFile& file) override; + void writeExtHeader(BinaryFile& file, const std::string& mapName) override; + bool readExtHeader(BinaryFile& file) override; /// Start-GF unsigned start_gf; @@ -44,6 +44,6 @@ class Savegame : public SavedFile SerializedGameData sgd; protected: - void WriteGameData(BinaryFile& file); - bool ReadGameData(BinaryFile& file); + void writeGameData(BinaryFile& file); + bool readGameData(BinaryFile& file); }; diff --git a/libs/s25main/SerializedGameData.cpp b/libs/s25main/SerializedGameData.cpp index 659e8d3727..c91c110a22 100644 --- a/libs/s25main/SerializedGameData.cpp +++ b/libs/s25main/SerializedGameData.cpp @@ -215,7 +215,7 @@ SerializedGameData::SerializedGameData() : debugMode(false), expectedNumObjects(0), em(nullptr), writeEm(nullptr), isReading(false) {} -void SerializedGameData::Prepare(bool reading) +void SerializedGameData::prepare(bool reading) { static const std::array versionID = {"VER"}; if(reading) @@ -238,9 +238,9 @@ void SerializedGameData::Prepare(bool reading) isReading = reading; } -void SerializedGameData::MakeSnapshot(const Game& game) +void SerializedGameData::makeSnapshot(const Game& game) { - Prepare(false); + prepare(false); const GameWorldBase& gw = game.world_; writeEm = &gw.getEvMgr(); @@ -255,7 +255,7 @@ void SerializedGameData::MakeSnapshot(const Game& game) writeEm->Serialize(*this); if(game.ggs_.objective == GameObjective::EconomyMode) { - PushObject(gw.getEconHandler(), true); + pushObject(gw.getEconHandler(), true); } // Spieler serialisieren for(const auto& player : gw.getPlayers()) @@ -284,9 +284,9 @@ void SerializedGameData::MakeSnapshot(const Game& game) writtenEventIds.clear(); } -void SerializedGameData::ReadSnapshot(Game& game, ILocalGameState& localGameState) +void SerializedGameData::readSnapshot(Game& game, ILocalGameState& localGameState) { - Prepare(true); + prepare(true); GameWorld& gw = game.world_; em = &gw.getEvMgr(); @@ -298,7 +298,7 @@ void SerializedGameData::ReadSnapshot(Game& game, ILocalGameState& localGameStat if(gw.getGGS().objective == GameObjective::EconomyMode) { gw.setEconHandler( - std::unique_ptr(PopObject(GO_Type::Economymodehandler))); + std::unique_ptr(popObject(GO_Type::Economymodehandler))); } for(auto& player : gw.getPlayers()) @@ -336,7 +336,7 @@ void SerializedGameData::ReadSnapshot(Game& game, ILocalGameState& localGameStat readEvents.clear(); } -void SerializedGameData::PushObject_(const GameObject* go, const bool known) +void SerializedGameData::pushObjectImpl(const GameObject* go, const bool known) { RTTR_Assert(!isReading); @@ -378,7 +378,7 @@ void SerializedGameData::PushObject_(const GameObject* go, const bool known) // Objekt nich bekannt? Dann Type-ID noch mit drauf if(!known) - PushEnum(go->getGOT()); + pushEnum(go->getGOT()); // Objekt serialisieren if(debugMode) @@ -391,7 +391,7 @@ void SerializedGameData::PushObject_(const GameObject* go, const bool known) PushUnsignedShort(getSafetyCode(*go)); } -void SerializedGameData::PushEvent(const GameEvent* event) +void SerializedGameData::pushEvent(const GameEvent* event) { if(!event) { @@ -412,7 +412,7 @@ void SerializedGameData::PushEvent(const GameEvent* event) PushUnsignedShort(getSafetyCode(*event)); } -const GameEvent* SerializedGameData::PopEvent() +const GameEvent* SerializedGameData::popEvent() { unsigned instanceId = PopUnsignedInt(); if(!instanceId) @@ -436,7 +436,7 @@ const GameEvent* SerializedGameData::PopEvent() } /// FoW-Objekt -void SerializedGameData::PushFOWObject(const FOWObject* fowobj) +void SerializedGameData::pushFOWObject(const FOWObject* fowobj) { // Gibts das Objekt gar nich? if(!fowobj) @@ -447,16 +447,16 @@ void SerializedGameData::PushFOWObject(const FOWObject* fowobj) } // Objekt-Typ - PushEnum(fowobj->getType()); + pushEnum(fowobj->getType()); // Objekt serialisieren fowobj->Serialize(*this); } -std::unique_ptr SerializedGameData::PopFOWObject() +std::unique_ptr SerializedGameData::popFOWObject() { // Typ auslesen - auto type = Pop(); + auto type = pop(); // Kein Objekt? if(type == FoW_Type::Nothing) @@ -466,7 +466,7 @@ std::unique_ptr SerializedGameData::PopFOWObject() return createFOWObject(type); } -GameObject* SerializedGameData::PopObject_(helpers::OptionalEnum got) +GameObject* SerializedGameData::popObjectImpl(helpers::OptionalEnum got) { RTTR_Assert(isReading); // Obj-ID holen @@ -481,7 +481,7 @@ GameObject* SerializedGameData::PopObject_(helpers::OptionalEnum got) // Objekt nich bekannt? Dann in den heiligen Schriften lesen if(!got) - got = Pop(); + got = pop(); // und erzeugen std::unique_ptr go = createGameObject(*got, objId); @@ -515,7 +515,7 @@ SerializedGameData::Error SerializedGameData::makeOutOfRange(unsigned value, uns return Error(helpers::format("%s is out of range. Maximum allowed value: %s", value, maxValue)); } -void SerializedGameData::AddObject(GameObject* go) +void SerializedGameData::addObject(GameObject* go) { RTTR_Assert(isReading); RTTR_Assert(!readObjects[go->getObjId()]); // Do not call this multiple times per GameObject @@ -523,7 +523,7 @@ void SerializedGameData::AddObject(GameObject* go) RTTR_Assert(readObjects.size() < expectedNumObjects); } -unsigned SerializedGameData::AddEvent(unsigned instanceId, GameEvent* ev) +unsigned SerializedGameData::addEvent(unsigned instanceId, GameEvent* ev) { RTTR_Assert(isReading); RTTR_Assert(!readEvents[instanceId]); // Do not call this multiple times per GameObject diff --git a/libs/s25main/SerializedGameData.h b/libs/s25main/SerializedGameData.h index 8b7970a53c..5db6b86be7 100644 --- a/libs/s25main/SerializedGameData.h +++ b/libs/s25main/SerializedGameData.h @@ -79,10 +79,10 @@ class SerializedGameData : public Serializer SerializedGameData(); /// Nimmt das gesamte Spiel auf und speichert es im Buffer - void MakeSnapshot(const Game& game); + void makeSnapshot(const Game& game); /// Reads the snapshot from the internal buffer - void ReadSnapshot(Game& game, ILocalGameState& localGameState); + void readSnapshot(Game& game, ILocalGameState& localGameState); /// Get the format version the data is saved in. Deserializing methods can use this to support /// loading data saved in an earlier format. @@ -95,42 +95,42 @@ class SerializedGameData : public Serializer /// Write a GameObject template - void PushObject(const T* go, bool known = false) + void pushObject(const T* go, bool known = false) { /* The assert below basically checks the virtual function table. If the dynamic_cast fails, we tried to push an object of another type or it was deleted */ const auto* goTmp = static_cast(go); RTTR_Assert(dynamic_cast(goTmp) == go); //-V547 - PushObject_(goTmp, known); + pushObjectImpl(goTmp, known); } template - void PushObject(const std::unique_ptr& go, bool known = false) + void pushObject(const std::unique_ptr& go, bool known = false) { - PushObject(go.get(), known); + pushObject(go.get(), known); } - void PushEvent(const GameEvent* event); + void pushEvent(const GameEvent* event); /// Write a container of GameObjects template - void PushObjectContainer(const T& gos, bool known = false); + void pushObjectContainer(const T& gos, bool known = false); /// FoW-Objekt - void PushFOWObject(const FOWObject* fowobj); + void pushFOWObject(const FOWObject* fowobj); /// Serialize an enum as T_SavedType which must be the underlying type (as that is what is deserialized by Pop) /// Requires MaxEnumValue to be specialized and T_SavedType to be able to hold all enumerators (checked only for /// max value) template - void PushEnum(const T val) + void pushEnum(const T val) { helpers::pushEnum(*this, val); } template - void PushOptionalEnum(const helpers::OptionalEnum val) + void pushOptionalEnum(const helpers::OptionalEnum val) { if(val) - PushEnum(*val); + pushEnum(*val); else Push(helpers::OptionalEnum::invalidValue); } @@ -145,39 +145,39 @@ class SerializedGameData : public Serializer /// Read a GameObject template RTTR_ATTRIBUTE_NO_UBSAN(vptr) - T* PopObject(helpers::OptionalEnum got = {}) + T* popObject(helpers::OptionalEnum got = {}) { - return static_cast(PopObject_(got)); + return static_cast(popObjectImpl(got)); } - const GameEvent* PopEvent(); + const GameEvent* popEvent(); /// FoW-Objekt - std::unique_ptr PopFOWObject(); + std::unique_ptr popFOWObject(); /// Read a container of GameObjects template - void PopObjectContainer(T& gos, helpers::OptionalEnum got = {}); + void popObjectContainer(T& gos, helpers::OptionalEnum got = {}); /// Read a container of values. Values must have fixed-width types! template - void PopContainer(T& result); + void popContainer(T& result); template - helpers::OptionalEnum PopOptionalEnum(); + helpers::OptionalEnum popOptionalEnum(); /// Read a trivial type (integral, enum, ...) template - std::enable_if_t, T> Pop(); + std::enable_if_t, T> pop(); template - std::enable_if_t, T> Pop(); + std::enable_if_t, T> pop(); - MapPoint PopMapPoint() { return helpers::popPoint(*this); } + MapPoint popMapPoint() { return helpers::popPoint(*this); } /// Adds a deserialized object to the storage. Must be called exactly once per read GameObject - void AddObject(GameObject* go); + void addObject(GameObject* go); /// Adds a deserialized event to the storage. Return instanceId. Must be called exactly once per read event - unsigned AddEvent(unsigned instanceId, GameEvent* ev); + unsigned addEvent(unsigned instanceId, GameEvent* ev); /// Only valid during writing bool isEventSerialized(unsigned evInstanceid) const; bool debugMode; @@ -208,15 +208,15 @@ class SerializedGameData : public Serializer bool isReading; /// Starts reading or writing according to the param - void Prepare(bool reading); + void prepare(bool reading); /// Erzeugt GameObject std::unique_ptr createGameObject(GO_Type got, unsigned obj_id); /// Erzeugt FOWObject std::unique_ptr createFOWObject(FoW_Type fowtype); - void PushObject_(const GameObject* go, bool known); + void pushObjectImpl(const GameObject* go, bool known); /// Objekt(referenzen) lesen - GameObject* PopObject_(helpers::OptionalEnum got); + GameObject* popObjectImpl(helpers::OptionalEnum got); /// Returns the object with the given id when it was read, nullptr otherwise (only valid during reading) GameObject* getReadGameObject(unsigned obj_id) const; @@ -229,17 +229,17 @@ class SerializedGameData : public Serializer //////////////////////////////////////////////////////////////////////////////// template -void SerializedGameData::PushObjectContainer(const T& gos, bool known) +void SerializedGameData::pushObjectContainer(const T& gos, bool known) { // Anzahl PushVarSize(gos.size()); // einzelne Objekte for(const auto& go : gos) - PushObject(go, known); + pushObject(go, known); } template -void SerializedGameData::PopObjectContainer(T& gos, helpers::OptionalEnum got) +void SerializedGameData::popObjectContainer(T& gos, helpers::OptionalEnum got) { using Elements = typename T::value_type; using Object = std::remove_reference_t; @@ -251,11 +251,11 @@ void SerializedGameData::PopObjectContainer(T& gos, helpers::OptionalEnum(got)); // Conversion required to support unique_ptr + *it = Elements(popObject(got)); // Conversion required to support unique_ptr } template -void SerializedGameData::PopContainer(T& result) +void SerializedGameData::popContainer(T& result) { // Remove this method after raising GameDataVersion if(getGameDataVersion() >= 2) @@ -268,7 +268,7 @@ void SerializedGameData::PopContainer(T& result) } template -helpers::OptionalEnum SerializedGameData::PopOptionalEnum() +helpers::OptionalEnum SerializedGameData::popOptionalEnum() { using Integral = std::underlying_type_t; const auto value = Serializer::Pop(); @@ -279,7 +279,7 @@ helpers::OptionalEnum SerializedGameData::PopOptionalEnum() } template -std::enable_if_t, T> SerializedGameData::Pop() +std::enable_if_t, T> SerializedGameData::pop() { try { @@ -290,7 +290,7 @@ std::enable_if_t, T> SerializedGameData::Pop() } } template -std::enable_if_t, T> SerializedGameData::Pop() +std::enable_if_t, T> SerializedGameData::pop() { return Serializer::Pop(); } diff --git a/libs/s25main/Settings.cpp b/libs/s25main/Settings.cpp index 3bb892eb72..bf1ed5231a 100644 --- a/libs/s25main/Settings.cpp +++ b/libs/s25main/Settings.cpp @@ -77,10 +77,10 @@ bool checkPort(int port) Settings::Settings() //-V730 { - LoadDefaults(); + loadDefaults(); } -void Settings::LoadDefaults() +void Settings::loadDefaults() { // global // { @@ -166,10 +166,10 @@ void Settings::LoadDefaults() addons.configuration.clear(); // } - LoadIngameDefaults(); + loadIngameDefaults(); } -void Settings::LoadIngameDefaults() +void Settings::loadIngameDefaults() { // ingame // { @@ -361,18 +361,18 @@ void Settings::Load() s25util::fromStringClassic(item->getText()))); } - LoadIngame(); + loadIngame(); // } } catch(const std::runtime_error& e) { s25util::warning(std::string("Could not use settings from \"") + settingsPath.string() + "\", using default values. Reason: " + e.what()); - LoadDefaults(); - Save(); + loadDefaults(); + save(); } } -void Settings::LoadIngame() +void Settings::loadIngame() { libsiedler2::Archiv settingsIngame; const auto settingsPathIngame = RTTRCONFIG.ExpandPath(s25::resources::ingameOptions); @@ -412,14 +412,14 @@ void Settings::LoadIngame() { s25util::warning(std::string("Could not use ingame settings from \"") + settingsPathIngame.string() + "\", using default values. Reason: " + e.what()); - LoadIngameDefaults(); - SaveIngame(); + loadIngameDefaults(); + saveIngame(); } } /////////////////////////////////////////////////////////////////////////////// // Routine for saving the configuration -void Settings::Save() +void Settings::save() { libsiedler2::Archiv settings; settings.alloc(SECTION_NAMES.size()); @@ -528,10 +528,10 @@ void Settings::Save() if(libsiedler2::Write(settingsPath, settings) == 0) bfs::permissions(settingsPath, bfs::owner_read | bfs::owner_write); - SaveIngame(); + saveIngame(); } -void Settings::SaveIngame() +void Settings::saveIngame() { libsiedler2::Archiv settingsIngame; settingsIngame.alloc(1 + persistentWindows.size()); diff --git a/libs/s25main/Settings.h b/libs/s25main/Settings.h index ec41bc33a0..86ae7c0fc9 100644 --- a/libs/s25main/Settings.h +++ b/libs/s25main/Settings.h @@ -25,8 +25,8 @@ bool checkPort(int port); struct PersistentWindowSettings { - DrawPoint lastPos = DrawPoint::Invalid(); - DrawPoint restorePos = DrawPoint::Invalid(); + DrawPoint lastPos = DrawPoint::invalid(); + DrawPoint restorePos = DrawPoint::invalid(); bool isOpen = false; bool isPinned = false; bool isMinimized = false; @@ -59,14 +59,14 @@ class Settings : public Singleton Settings(); void Load(); - void Save(); + void save(); protected: - void LoadDefaults(); - void LoadIngameDefaults(); + void loadDefaults(); + void loadIngameDefaults(); - void LoadIngame(); - void SaveIngame(); + void loadIngame(); + void saveIngame(); public: struct diff --git a/libs/s25main/SignalHandler.cpp b/libs/s25main/SignalHandler.cpp index 77ace116bf..1a9b648ad9 100644 --- a/libs/s25main/SignalHandler.cpp +++ b/libs/s25main/SignalHandler.cpp @@ -15,7 +15,7 @@ * Signal-Handler */ #ifdef _WIN32 -BOOL WINAPI ConsoleSignalHandler(DWORD dwCtrlType) +BOOL WINAPI consoleSignalHandler(DWORD dwCtrlType) { switch(dwCtrlType) { @@ -32,7 +32,7 @@ BOOL WINAPI ConsoleSignalHandler(DWORD dwCtrlType) } #else bool killme = false; -void ConsoleSignalHandler(int sig) +void consoleSignalHandler(int sig) { if(sig == SIGINT) { diff --git a/libs/s25main/SignalHandler.h b/libs/s25main/SignalHandler.h index a93fea1661..62dd3402e6 100644 --- a/libs/s25main/SignalHandler.h +++ b/libs/s25main/SignalHandler.h @@ -6,9 +6,9 @@ #ifdef _WIN32 # include -BOOL WINAPI ConsoleSignalHandler(DWORD dwCtrlType); +BOOL WINAPI consoleSignalHandler(DWORD dwCtrlType); #else /// Kill instantly on CTRL-C or just terminate extern bool killme; -void ConsoleSignalHandler(int sig); +void consoleSignalHandler(int sig); #endif // _WIN32 diff --git a/libs/s25main/SoundManager.cpp b/libs/s25main/SoundManager.cpp index 71a232e2d3..262c351f96 100644 --- a/libs/s25main/SoundManager.cpp +++ b/libs/s25main/SoundManager.cpp @@ -46,7 +46,7 @@ void SoundManager::playNOSound(unsigned soundLstId, const noBase& obj, unsigned if(numPlayedCt >= maxPlayCtPerSound) return; - EffectPlayId playId = LOADER.getSoundN("sound", soundLstId)->Play(volume, false); + EffectPlayId playId = LOADER.getSoundN("sound", soundLstId)->play(volume, false); if(playId != EffectPlayId::Invalid) noSounds.push_back(NOSound{soundLstId, &obj, id, playId}); @@ -59,7 +59,7 @@ void SoundManager::stopSounds(const noBase& obj) { if(it->obj == &obj) { - AUDIODRIVER.StopEffect(it->playId); + AUDIODRIVER.stopEffect(it->playId); it = noSounds.erase(it); } else ++it; @@ -88,7 +88,7 @@ void SoundManager::playAnimalSound(unsigned soundLstId) return; const unsigned volume = helpers::randomValue(getSoundRng(), 50u, 70u); - EffectPlayId playId = LOADER.getSoundN("sound", soundLstId)->Play(volume, false); + EffectPlayId playId = LOADER.getSoundN("sound", soundLstId)->play(volume, false); if(playId != EffectPlayId::Invalid) animalSounds.push_back(AnimalSound{soundLstId, playId}); @@ -115,7 +115,7 @@ void SoundManager::playBirdSounds(const unsigned treeCount) { const unsigned soundIdx = helpers::randomValue(getSoundRng(), 87u, 91u); const unsigned volume = helpers::randomValue(getSoundRng(), 50u, 70u); - birdPlayId = LOADER.getSoundN("sound", soundIdx)->Play(volume, false); + birdPlayId = LOADER.getSoundN("sound", soundIdx)->play(volume, false); } minNextBirdSound = now + milliseconds(helpers::randomValue(getSoundRng(), 150u, 1000u)); } @@ -137,27 +137,27 @@ void SoundManager::playOceanBrawling(const unsigned waterPercent) // SDL Mixer may wrongly return that the sound is not playing, so make sure the old effect is stopped. // DO NOT REMOVE - THIS PREVENTS A BUG! if(oceanPlayId != EffectPlayId::Invalid) - AUDIODRIVER.StopEffect(oceanPlayId); + AUDIODRIVER.stopEffect(oceanPlayId); const unsigned soundIdx = helpers::randomValue(getSoundRng(), 98u, 100u); - oceanPlayId = LOADER.getSoundN("sound", soundIdx)->Play(volume, true); + oceanPlayId = LOADER.getSoundN("sound", soundIdx)->play(volume, true); } else - AUDIODRIVER.ChangeVolume(oceanPlayId, volume); + AUDIODRIVER.changeVolume(oceanPlayId, volume); } else if(oceanPlayId != EffectPlayId::Invalid) - AUDIODRIVER.StopEffect(oceanPlayId); + AUDIODRIVER.stopEffect(oceanPlayId); } void SoundManager::stopAll() { if(oceanPlayId != EffectPlayId::Invalid) - AUDIODRIVER.StopEffect(oceanPlayId); + AUDIODRIVER.stopEffect(oceanPlayId); if(birdPlayId != EffectPlayId::Invalid) - AUDIODRIVER.StopEffect(birdPlayId); + AUDIODRIVER.stopEffect(birdPlayId); for(auto& sound : noSounds) - AUDIODRIVER.StopEffect(sound.playId); + AUDIODRIVER.stopEffect(sound.playId); noSounds.clear(); for(auto& sound : animalSounds) - AUDIODRIVER.StopEffect(sound.playId); + AUDIODRIVER.stopEffect(sound.playId); animalSounds.clear(); } diff --git a/libs/s25main/TerrainRenderer.cpp b/libs/s25main/TerrainRenderer.cpp index 78408905b4..dc576cd878 100644 --- a/libs/s25main/TerrainRenderer.cpp +++ b/libs/s25main/TerrainRenderer.cpp @@ -73,7 +73,7 @@ PointF TerrainRenderer::getNeighbourVertexPos(MapPoint pt, const Direction dir) Position ptNb = ::getNeighbour(Position(pt), dir); Position offset; - MapPoint t = ConvertCoords(ptNb, &offset); + MapPoint t = convertCoords(ptNb, &offset); return getVertexPos(t) + PointF(offset); } @@ -85,12 +85,12 @@ PointF TerrainRenderer::getNeighbourBorderPos(const MapPoint pt, const unsigned Position ptNb = ::getNeighbour(Position(pt), dir); Position offset; - MapPoint t = ConvertCoords(ptNb, &offset); + MapPoint t = convertCoords(ptNb, &offset); return getBorderPos(t, triangle) + PointF(offset); } -void TerrainRenderer::LoadTextures(const WorldDescription& desc) +void TerrainRenderer::loadTextures(const WorldDescription& desc) { terrainTextures.clear(); edgeTextures.clear(); @@ -133,11 +133,11 @@ void TerrainRenderer::LoadTextures(const WorldDescription& desc) if(!texBmp->getPalette() || !animItem || animItem->getBobType() != libsiedler2::BobType::PaletteAnim) { LOG.write("Invalid palette animation '%1%' for '%2%'") % unsigned(cur.palAnimIdx) % cur.name; - terrainTextures[curIdx].textures.push_back(LOADER.ExtractTexture(*texBmp, cur.posInTexture)); + terrainTextures[curIdx].textures.push_back(LOADER.extractTexture(*texBmp, cur.posInTexture)); } else { auto& anim = static_cast(*animItem); - std::unique_ptr textures = LOADER.ExtractAnimatedTexture( + std::unique_ptr textures = LOADER.extractAnimatedTexture( *texBmp, cur.posInTexture, anim.firstClr, anim.lastClr - anim.firstClr + 1); for(unsigned i = 0; i < textures->size(); i++) { @@ -147,7 +147,7 @@ void TerrainRenderer::LoadTextures(const WorldDescription& desc) } } else { - terrainTextures[curIdx].textures.push_back(LOADER.ExtractTexture(*texBmp, cur.posInTexture)); + terrainTextures[curIdx].textures.push_back(LOADER.extractTexture(*texBmp, cur.posInTexture)); } // Initialize OpenGL textures for(glArchivItem_Bitmap& bmp : terrainTextures[curIdx].textures) @@ -180,7 +180,7 @@ void TerrainRenderer::LoadTextures(const WorldDescription& desc) glArchivItem_Bitmap* texBmp = LOADER.getImageN(textureName, 0); if(!texBmp) throw std::runtime_error("Invalid texture '" + cur.texturePath + "' for edge '" + cur.name + "'"); - edgeTextures[curIdx] = LOADER.ExtractTexture(*texBmp, cur.posInTexture); + edgeTextures[curIdx] = LOADER.extractTexture(*texBmp, cur.posInTexture); edgeTextures[curIdx]->getTexture(); // Init texture } for(DescIdx curIdx : usedLandscapes) @@ -193,33 +193,33 @@ void TerrainRenderer::LoadTextures(const WorldDescription& desc) if(!texBmp) throw std::runtime_error("Invalid texture '" + cur.roadTexDesc[i].texturePath + "' for road in landscape '" + cur.name + "'"); - roadTextures[getFlatIndex(curIdx, i)] = LOADER.ExtractTexture(*texBmp, cur.roadTexDesc[i].posInTexture); + roadTextures[getFlatIndex(curIdx, i)] = LOADER.extractTexture(*texBmp, cur.roadTexDesc[i].posInTexture); roadTextures[getFlatIndex(curIdx, i)]->getTexture(); // Init texture } } } -void TerrainRenderer::GenerateVertices(const GameWorldViewer& gwv) +void TerrainRenderer::generateVertices(const GameWorldViewer& gwv) { // Terrain generieren RTTR_FOREACH_PT(MapPoint, size_) { - UpdateVertexPos(pt, gwv); - UpdateVertexColor(pt, gwv); - LoadVertexTerrain(pt, gwv); + updateVertexPos(pt, gwv); + updateVertexColor(pt, gwv); + loadVertexTerrain(pt, gwv); } // Ränder generieren RTTR_FOREACH_PT(MapPoint, size_) - UpdateBorderVertex(pt); + updateBorderVertex(pt); } -void TerrainRenderer::UpdateVertexPos(const MapPoint pt, const GameWorldViewer& gwv) +void TerrainRenderer::updateVertexPos(const MapPoint pt, const GameWorldViewer& gwv) { getVertex(pt).pos = PointF(gwv.getWorld().getNodePos(pt)); } -void TerrainRenderer::UpdateVertexColor(const MapPoint pt, const GameWorldViewer& gwv) +void TerrainRenderer::updateVertexColor(const MapPoint pt, const GameWorldViewer& gwv) { auto shadow = static_cast(gwv.getNode(pt).shadow); float clr = -1.f / (256.f * 256.f) * shadow * shadow + 1.f / 90.f * shadow + 0.38f; @@ -240,14 +240,14 @@ void TerrainRenderer::UpdateVertexColor(const MapPoint pt, const GameWorldViewer } } -void TerrainRenderer::LoadVertexTerrain(const MapPoint pt, const GameWorldViewer& gwv) +void TerrainRenderer::loadVertexTerrain(const MapPoint pt, const GameWorldViewer& gwv) { const MapNode& node = gwv.getNode(pt); terrain[getVertexIdx(pt)][0] = node.t1; terrain[getVertexIdx(pt)][1] = node.t2; } -void TerrainRenderer::UpdateBorderVertex(const MapPoint pt) +void TerrainRenderer::updateBorderVertex(const MapPoint pt) { Vertex& vertex = getVertex(pt); vertex.borderPos[0] = (getNeighbourVertexPos(pt, Direction::SouthWest) + getVertexPos(pt) @@ -297,14 +297,14 @@ static DescIdx getEdgeType(const TerrainDesc& t1, const TerrainDesc& t /** * erzeugt die OpenGL-Vertices. */ -void TerrainRenderer::GenerateOpenGL(const GameWorldViewer& gwv) +void TerrainRenderer::generateOpenGL(const GameWorldViewer& gwv) { const GameWorldBase& world = gwv.getWorld(); Init(world.getSize()); - GenerateVertices(gwv); + generateVertices(gwv); const WorldDescription& desc = world.getDescription(); - LoadTextures(desc); + loadTextures(desc); // Add extra vertices for borders unsigned numTriangles = gl_vertices.size(); @@ -339,17 +339,17 @@ void TerrainRenderer::GenerateOpenGL(const GameWorldViewer& gwv) // Normales Terrain erzeugen RTTR_FOREACH_PT(MapPoint, size_) { - UpdateTrianglePos(pt, false); - UpdateTriangleColor(pt, false); - UpdateTriangleTerrain(pt, false); + updateTrianglePos(pt, false); + updateTriangleColor(pt, false); + updateTriangleTerrain(pt, false); } // Ränder erzeugen RTTR_FOREACH_PT(MapPoint, size_) { - UpdateBorderTrianglePos(pt, false); - UpdateBorderTriangleColor(pt, false); - UpdateBorderTriangleTerrain(pt, false); + updateBorderTrianglePos(pt, false); + updateBorderTriangleColor(pt, false); + updateBorderTriangleTerrain(pt, false); } if(SETTINGS.video.vbo) @@ -369,7 +369,7 @@ void TerrainRenderer::GenerateOpenGL(const GameWorldViewer& gwv) } } -void TerrainRenderer::UpdateTrianglePos(const MapPoint pt, bool updateVBO) +void TerrainRenderer::updateTrianglePos(const MapPoint pt, bool updateVBO) { unsigned pos = getTriangleIdx(pt); @@ -390,7 +390,7 @@ void TerrainRenderer::UpdateTrianglePos(const MapPoint pt, bool updateVBO) } } -void TerrainRenderer::UpdateTriangleColor(const MapPoint pt, bool updateVBO) +void TerrainRenderer::updateTriangleColor(const MapPoint pt, bool updateVBO) { unsigned pos = getTriangleIdx(pt); @@ -417,7 +417,7 @@ void TerrainRenderer::UpdateTriangleColor(const MapPoint pt, bool updateVBO) } } -void TerrainRenderer::UpdateTriangleTerrain(const MapPoint pt, bool updateVBO) +void TerrainRenderer::updateTriangleTerrain(const MapPoint pt, bool updateVBO) { const unsigned nodeIdx = getVertexIdx(pt); const DescIdx t1 = terrain[nodeIdx][0]; @@ -435,7 +435,7 @@ void TerrainRenderer::UpdateTriangleTerrain(const MapPoint pt, bool updateVBO) } /// Erzeugt die Dreiecke für die Ränder -void TerrainRenderer::UpdateBorderTrianglePos(const MapPoint pt, bool updateVBO) +void TerrainRenderer::updateBorderTrianglePos(const MapPoint pt, bool updateVBO) { unsigned pos = getVertexIdx(pt); @@ -511,7 +511,7 @@ void TerrainRenderer::UpdateBorderTrianglePos(const MapPoint pt, bool updateVBO) } } -void TerrainRenderer::UpdateBorderTriangleColor(const MapPoint pt, bool updateVBO) +void TerrainRenderer::updateBorderTriangleColor(const MapPoint pt, bool updateVBO) { unsigned pos = getVertexIdx(pt); @@ -595,7 +595,7 @@ void TerrainRenderer::UpdateBorderTriangleColor(const MapPoint pt, bool updateVB } } -void TerrainRenderer::UpdateBorderTriangleTerrain(const MapPoint pt, bool updateVBO) +void TerrainRenderer::updateBorderTriangleTerrain(const MapPoint pt, bool updateVBO) { unsigned pos = getVertexIdx(pt); @@ -676,7 +676,7 @@ void TerrainRenderer::UpdateBorderTriangleTerrain(const MapPoint pt, bool update } } -void TerrainRenderer::Draw(const Position& firstPt, const Position& lastPt, const GameWorldViewer& gwv, +void TerrainRenderer::draw(const Position& firstPt, const Position& lastPt, const GameWorldViewer& gwv, unsigned* water) const { RTTR_Assert(!gl_vertices.empty()); @@ -698,7 +698,7 @@ void TerrainRenderer::Draw(const Position& firstPt, const Position& lastPt, cons for(auto const x : helpers::range(firstPt.x, lastPt.x + 1)) { Position posOffset; - MapPoint tP = ConvertCoords(Position(x, y), &posOffset); + MapPoint tP = convertCoords(Position(x, y), &posOffset); auto t = terrain[getVertexIdx(tP)][0]; if(posOffset != lastOffset) @@ -754,7 +754,7 @@ void TerrainRenderer::Draw(const Position& firstPt, const Position& lastPt, cons sorted_borders[lastBorder].push_back(tmp); } - PrepareWaysPoint(sorted_roads, gwv, tP, posOffset); + prepareWaysPoint(sorted_roads, gwv, tP, posOffset); lastOffset = posOffset; } @@ -826,7 +826,7 @@ void TerrainRenderer::Draw(const Position& firstPt, const Position& lastPt, cons else animationFrame = 0; - VIDEODRIVER.BindTexture(terrainTextures[t].textures[animationFrame].getTextureNoCreate()); + VIDEODRIVER.bindTexture(terrainTextures[t].textures[animationFrame].getTextureNoCreate()); for(const auto& texture : sorted_textures[t]) { @@ -852,7 +852,7 @@ void TerrainRenderer::Draw(const Position& firstPt, const Position& lastPt, cons { if(sorted_borders[i].empty()) continue; - VIDEODRIVER.BindTexture(edgeTextures[i]->getTextureNoCreate()); + VIDEODRIVER.bindTexture(edgeTextures[i]->getTextureNoCreate()); for(const auto& texture : sorted_borders[i]) { @@ -873,16 +873,16 @@ void TerrainRenderer::Draw(const Position& firstPt, const Position& lastPt, cons if(vbo_vertices.isValid()) vbo_vertices.unbind(); - DrawWays(sorted_roads); + drawWays(sorted_roads); glDisableClientState(GL_COLOR_ARRAY); // Switch back to modulation glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); } -MapPoint TerrainRenderer::ConvertCoords(const Position pt, Position* offset) const +MapPoint TerrainRenderer::convertCoords(const Position pt, Position* offset) const { - MapPoint ptOut = MakeMapPoint(pt, size_); + MapPoint ptOut = makeMapPoint(pt, size_); RTTR_Assert(ptOut.x < size_.x); RTTR_Assert(ptOut.y < size_.y); if(offset) @@ -893,7 +893,7 @@ MapPoint TerrainRenderer::ConvertCoords(const Position pt, Position* offset) con return ptOut; } -void TerrainRenderer::PrepareWaysPoint(PreparedRoads& sorted_roads, const GameWorldViewer& gwViewer, MapPoint pt, +void TerrainRenderer::prepareWaysPoint(PreparedRoads& sorted_roads, const GameWorldViewer& gwViewer, MapPoint pt, const Position& offset) const { const WorldDescription& desc = gwViewer.getWorld().getDescription(); @@ -971,7 +971,7 @@ struct Tex2C3Ver2 GLfloat x, y; }; -void TerrainRenderer::DrawWays(const PreparedRoads& sorted_roads) const +void TerrainRenderer::drawWays(const PreparedRoads& sorted_roads) const { static constexpr helpers::EnumArray, RoadDir> begin_end_coords = {{ {{Position(0, -3), Position(0, 3), Position(3, 3), Position(3, -3)}}, @@ -1041,95 +1041,95 @@ void TerrainRenderer::DrawWays(const PreparedRoads& sorted_roads) const curVertexData++; } - VIDEODRIVER.BindTexture(texture.getTextureNoCreate()); + VIDEODRIVER.bindTexture(texture.getTextureNoCreate()); glDrawArrays(GL_QUADS, 0, itRoad.value().size() * 4); } // Note: No glDisableClientState as we did not enable it } -void TerrainRenderer::AltitudeChanged(const MapPoint pt, const GameWorldViewer& gwv) +void TerrainRenderer::altitudeChanged(const MapPoint pt, const GameWorldViewer& gwv) { // den selbst sowieso die Punkte darum updaten, da sich bei letzteren die Schattierung geändert haben könnte - UpdateVertexPos(pt, gwv); - UpdateVertexColor(pt, gwv); + updateVertexPos(pt, gwv); + updateVertexColor(pt, gwv); for(const MapPoint nb : gwv.getNeighbours(pt)) - UpdateVertexColor(nb, gwv); + updateVertexColor(nb, gwv); // und für die Ränder - UpdateBorderVertex(pt); + updateBorderVertex(pt); for(const MapPoint nb : gwv.getNeighbours(pt)) - UpdateBorderVertex(nb); + updateBorderVertex(nb); // den selbst sowieso die Punkte darum updaten, da sich bei letzteren die Schattierung geändert haben könnte - UpdateTrianglePos(pt, true); - UpdateTriangleColor(pt, true); + updateTrianglePos(pt, true); + updateTriangleColor(pt, true); for(const MapPoint nb : gwv.getNeighbours(pt)) { - UpdateTrianglePos(nb, true); - UpdateTriangleColor(nb, true); + updateTrianglePos(nb, true); + updateTriangleColor(nb, true); } // Auch im zweiten Kreis drumherum die Dreiecke neu berechnen, da die durch die Schattenänderung der umliegenden // Punkte auch geändert werden könnten for(unsigned i = 0; i < 12; ++i) - UpdateTriangleColor(gwv.getWorld().getNeighbour2(pt, i), true); + updateTriangleColor(gwv.getWorld().getNeighbour2(pt, i), true); // und für die Ränder - UpdateBorderTrianglePos(pt, true); - UpdateBorderTriangleColor(pt, true); + updateBorderTrianglePos(pt, true); + updateBorderTriangleColor(pt, true); for(const MapPoint nb : gwv.getNeighbours(pt)) { - UpdateBorderTrianglePos(nb, true); - UpdateBorderTriangleColor(nb, true); + updateBorderTrianglePos(nb, true); + updateBorderTriangleColor(nb, true); } for(unsigned i = 0; i < 12; ++i) - UpdateBorderTriangleColor(gwv.getWorld().getNeighbour2(pt, i), true); + updateBorderTriangleColor(gwv.getWorld().getNeighbour2(pt, i), true); } -void TerrainRenderer::VisibilityChanged(const MapPoint pt, const GameWorldViewer& gwv) +void TerrainRenderer::visibilityChanged(const MapPoint pt, const GameWorldViewer& gwv) { /// Noch kein Terrain gebaut? abbrechen if(vertices.empty()) return; - UpdateVertexColor(pt, gwv); + updateVertexColor(pt, gwv); for(const MapPoint nb : gwv.getNeighbours(pt)) - UpdateVertexColor(nb, gwv); + updateVertexColor(nb, gwv); // und für die Ränder - UpdateBorderVertex(pt); + updateBorderVertex(pt); for(const MapPoint nb : gwv.getNeighbours(pt)) - UpdateBorderVertex(nb); + updateBorderVertex(nb); // den selbst sowieso die Punkte darum updaten, da sich bei letzteren die Schattierung geändert haben könnte - UpdateTriangleColor(pt, true); + updateTriangleColor(pt, true); for(const MapPoint nb : gwv.getNeighbours(pt)) - UpdateTriangleColor(nb, true); + updateTriangleColor(nb, true); // und für die Ränder - UpdateBorderTriangleColor(pt, true); + updateBorderTriangleColor(pt, true); for(const MapPoint nb : gwv.getNeighbours(pt)) - UpdateBorderTriangleColor(nb, true); + updateBorderTriangleColor(nb, true); } -void TerrainRenderer::UpdateAllColors(const GameWorldViewer& gwv) +void TerrainRenderer::updateAllColors(const GameWorldViewer& gwv) { RTTR_FOREACH_PT(MapPoint, size_) - UpdateVertexColor(pt, gwv); + updateVertexColor(pt, gwv); RTTR_FOREACH_PT(MapPoint, size_) - UpdateBorderVertex(pt); + updateBorderVertex(pt); RTTR_FOREACH_PT(MapPoint, size_) - UpdateTriangleColor(pt, false); + updateTriangleColor(pt, false); RTTR_FOREACH_PT(MapPoint, size_) - UpdateBorderTriangleColor(pt, false); + updateBorderTriangleColor(pt, false); if(vbo_colors.isValid()) { @@ -1140,5 +1140,5 @@ void TerrainRenderer::UpdateAllColors(const GameWorldViewer& gwv) MapPoint TerrainRenderer::getNeighbour(const MapPoint& pt, const Direction dir) const { - return MakeMapPoint(::getNeighbour(Position(pt), dir), size_); + return makeMapPoint(::getNeighbour(Position(pt), dir), size_); } diff --git a/libs/s25main/TerrainRenderer.h b/libs/s25main/TerrainRenderer.h index b06fc10abf..660e33e02f 100644 --- a/libs/s25main/TerrainRenderer.h +++ b/libs/s25main/TerrainRenderer.h @@ -35,14 +35,14 @@ class TerrainRenderer : private boost::noncopyable /// Generates data structures (uninitialized) void Init(const MapExtent& size); /// Generate OpenGL structs and init data (also calls Init) - void GenerateOpenGL(const GameWorldViewer& gwv); + void generateOpenGL(const GameWorldViewer& gwv); /// Draws the map between the given points. Optionally returns percentage of water drawn - void Draw(const Position& firstPt, const Position& lastPt, const GameWorldViewer& gwv, unsigned* water) const; + void draw(const Position& firstPt, const Position& lastPt, const GameWorldViewer& gwv, unsigned* water) const; /// Converts given point into a MapPoint (0 <= x < width and 0 <= y < height) /// Optionally returns offset of returned point to original point in pixels (for drawing) - MapPoint ConvertCoords(Position pt, Position* offset = nullptr) const; + MapPoint convertCoords(Position pt, Position* offset = nullptr) const; /// Get position of node in pixels (VertexPos) PointF getVertexPos(const MapPoint pt) const { return getVertex(pt).pos; } /// Get neighbour position of a node (VertexPos) potentially shifted so that the returned value is next to @@ -50,12 +50,12 @@ class TerrainRenderer : private boost::noncopyable PointF getNeighbourVertexPos(MapPoint pt, Direction dir) const; /// Callback function for altitude changes - void AltitudeChanged(MapPoint pt, const GameWorldViewer& gwv); + void altitudeChanged(MapPoint pt, const GameWorldViewer& gwv); /// Callback function for visibility changes - void VisibilityChanged(MapPoint pt, const GameWorldViewer& gwv); + void visibilityChanged(MapPoint pt, const GameWorldViewer& gwv); /// Recalculates all colors on the map - void UpdateAllColors(const GameWorldViewer& gwv); + void updateAllColors(const GameWorldViewer& gwv); private: struct MapTile @@ -158,25 +158,25 @@ class TerrainRenderer : private boost::noncopyable Vertex& getVertex(const MapPoint pt) { return vertices[getVertexIdx(pt)]; } const Vertex& getVertex(const MapPoint pt) const { return vertices[getVertexIdx(pt)]; } - void LoadTextures(const WorldDescription& desc); + void loadTextures(const WorldDescription& desc); /// Creates and initializes (map-)vertices for the viewer - void GenerateVertices(const GameWorldViewer& gwv); + void generateVertices(const GameWorldViewer& gwv); /// Updates (map-)vertex attributes - void UpdateVertexPos(MapPoint pt, const GameWorldViewer& gwv); - void UpdateVertexColor(MapPoint pt, const GameWorldViewer& gwv); - void LoadVertexTerrain(MapPoint pt, const GameWorldViewer& gwv); + void updateVertexPos(MapPoint pt, const GameWorldViewer& gwv); + void updateVertexColor(MapPoint pt, const GameWorldViewer& gwv); + void loadVertexTerrain(MapPoint pt, const GameWorldViewer& gwv); /// Update (map-)border vertex attributes - void UpdateBorderVertex(MapPoint pt); + void updateBorderVertex(MapPoint pt); /// Fills OGL vertex data from map vertex data (updateVBO = true updates also VBO if used) - void UpdateTrianglePos(MapPoint pt, bool updateVBO); - void UpdateTriangleColor(MapPoint pt, bool updateVBO); - void UpdateTriangleTerrain(MapPoint pt, bool updateVBO); + void updateTrianglePos(MapPoint pt, bool updateVBO); + void updateTriangleColor(MapPoint pt, bool updateVBO); + void updateTriangleTerrain(MapPoint pt, bool updateVBO); /// Fills OGL border vertex data from map vertex data - void UpdateBorderTrianglePos(MapPoint pt, bool updateVBO); - void UpdateBorderTriangleColor(MapPoint pt, bool updateVBO); - void UpdateBorderTriangleTerrain(MapPoint pt, bool updateVBO); + void updateBorderTrianglePos(MapPoint pt, bool updateVBO); + void updateBorderTriangleColor(MapPoint pt, bool updateVBO); + void updateBorderTriangleTerrain(MapPoint pt, bool updateVBO); /// liefert den Vertex-Farbwert an der Stelle X,Y float getColor(const MapPoint pt) const { return getVertex(pt).color; } @@ -192,8 +192,8 @@ class TerrainRenderer : private boost::noncopyable } /// Adds possible roads from the given point to the prepared data struct - void PrepareWaysPoint(PreparedRoads& sorted_roads, const GameWorldViewer& gwViewer, MapPoint pt, + void prepareWaysPoint(PreparedRoads& sorted_roads, const GameWorldViewer& gwViewer, MapPoint pt, const Position& offset) const; /// Draw the prepared roads - void DrawWays(const PreparedRoads& sorted_roads) const; + void drawWays(const PreparedRoads& sorted_roads) const; }; diff --git a/libs/s25main/TradePathCache.cpp b/libs/s25main/TradePathCache.cpp index 97c77f1a63..3fa97679cb 100644 --- a/libs/s25main/TradePathCache.cpp +++ b/libs/s25main/TradePathCache.cpp @@ -17,7 +17,7 @@ bool TradePathCache::pathExists(const MapPoint start, const MapPoint goal, const { // Found an entry --> Check if the route is still valid MapPoint checkedGoal; - if(world.CheckTradeRoute(paths[entryIdx].path.start, paths[entryIdx].path.route, 0, player, &checkedGoal)) + if(world.checkTradeRoute(paths[entryIdx].path.start, paths[entryIdx].path.route, 0, player, &checkedGoal)) { RTTR_Assert(checkedGoal == start || checkedGoal == goal); paths[entryIdx].lastUse = world.getEvMgr().getCurrentGF(); @@ -32,7 +32,7 @@ bool TradePathCache::pathExists(const MapPoint start, const MapPoint goal, const } std::vector route; - if(!world.FindTradePath(start, goal, player, std::numeric_limits::max(), false, &route)) + if(!world.findTradePath(start, goal, player, std::numeric_limits::max(), false, &route)) return false; addEntry(TradePath(start, goal, std::move(route)), player); diff --git a/libs/s25main/Ware.cpp b/libs/s25main/Ware.cpp index 96e2e566a6..133457a5d6 100644 --- a/libs/s25main/Ware.cpp +++ b/libs/s25main/Ware.cpp @@ -24,18 +24,18 @@ Ware::Ware(const GoodType type, noBaseBuilding* goal, noRoadNode* location) : next_dir(RoadPathDirection::None), state(State::WaitInWarehouse), location(location), type(convertShieldToNation(type, world->getPlayer(location->getPlayer()).nation)), // Use nation specific shield - goal(goal), next_harbor(MapPoint::Invalid()) + goal(goal), next_harbor(MapPoint::invalid()) { RTTR_Assert(location); // Ware in den Index mit eintragen - world->getPlayer(location->getPlayer()).RegisterWare(*this); + world->getPlayer(location->getPlayer()).registerWare(*this); if(goal) - goal->TakeWare(this); + goal->takeWare(this); } Ware::~Ware() = default; -void Ware::Destroy() +void Ware::destroy() { RTTR_Assert(!goal); RTTR_Assert(!location); @@ -50,11 +50,11 @@ void Ware::Destroy() void Ware::Serialize(SerializedGameData& sgd) const { - sgd.PushEnum(next_dir); - sgd.PushEnum(state); - sgd.PushObject(location); - sgd.PushEnum(type); - sgd.PushObject(goal); + sgd.pushEnum(next_dir); + sgd.pushEnum(state); + sgd.pushObject(location); + sgd.pushEnum(type); + sgd.pushObject(goal); helpers::pushPoint(sgd, next_harbor); } @@ -71,14 +71,14 @@ static RoadPathDirection PopRoadPathDirection(SerializedGameData& sgd) throw SerializedGameData::Error("Invalid RoadPathDirection"); return RoadPathDirection(iDir); } else - return sgd.Pop(); + return sgd.pop(); } Ware::Ware(SerializedGameData& sgd, const unsigned obj_id) - : GameObject(sgd, obj_id), next_dir(PopRoadPathDirection(sgd)), state(sgd.Pop()), - location(sgd.PopObject()), type([&]() { + : GameObject(sgd, obj_id), next_dir(PopRoadPathDirection(sgd)), state(sgd.pop()), + location(sgd.popObject()), type([&]() { // GoodType::Nothing is moved because of adding new wares due addons - auto ware = sgd.Pop(); + auto ware = sgd.pop(); if(sgd.getGameDataVersion() < 11) { // The old GoodType::Nothing is now GoodType::Grapes @@ -92,21 +92,21 @@ Ware::Ware(SerializedGameData& sgd, const unsigned obj_id) } return ware; }()), - goal(sgd.PopObject()), next_harbor(sgd.PopMapPoint()) + goal(sgd.popObject()), next_harbor(sgd.popMapPoint()) {} void Ware::setGoal(noBaseBuilding* newGoal) { goal = newGoal; if(goal) - goal->TakeWare(this); + goal->takeWare(this); } -void Ware::RecalcRoute() +void Ware::recalcRoute() { // Nächste Richtung nehmen if(location && goal) - next_dir = world->FindPathForWareOnRoads(*location, *goal, nullptr, &next_harbor); + next_dir = world->findPathForWareOnRoads(*location, *goal, nullptr, &next_harbor); else next_dir = RoadPathDirection::None; @@ -115,7 +115,7 @@ void Ware::RecalcRoute() { RTTR_Assert(location); // Tell goal about this - NotifyGoalAboutLostWare(); + notifyGoalAboutLostWare(); if(state == State::WaitForShip) { // Ware was waiting for a ship so send the ware into the harbor @@ -123,11 +123,11 @@ void Ware::RecalcRoute() state = State::WaitInWarehouse; setGoal(static_cast(location)); // but not going by ship - static_cast(goal)->WareDontWantToTravelByShip(this); + static_cast(goal)->wareDontWantToTravelByShip(this); } else { // TODO(Replay) This should calculate the next dir even when carried - FindRouteToWarehouse(); + findRouteToWarehouse(); } } else { @@ -138,12 +138,12 @@ void Ware::RecalcRoute() RTTR_Assert(location); RTTR_Assert(location->getGOT() == GO_Type::NobHarborbuilding); state = State::WaitInWarehouse; - static_cast(location)->WareDontWantToTravelByShip(this); + static_cast(location)->wareDontWantToTravelByShip(this); } } } -void Ware::GoalDestroyed() +void Ware::goalDestroyed() { if(state == State::WaitInWarehouse) { @@ -168,10 +168,10 @@ void Ware::GoalDestroyed() // This also adds the ware to the harbors inventory auto ownedWare = static_cast(location)->cancelWareForShip(this); // Kill the ware - world->getPlayer(location->getPlayer()).RemoveWare(*this); + world->getPlayer(location->getPlayer()).removeWare(*this); goal = nullptr; location = nullptr; - getEvMgr().AddToKillList(std::move(ownedWare)); + getEvMgr().addToKillList(std::move(ownedWare)); } else { // Ware ist unterwegs, Lagerhaus finden und Ware dort einliefern @@ -196,14 +196,14 @@ void Ware::GoalDestroyed() { goal = nullptr; const auto oldNextDir = next_dir; - FindRouteToWarehouse(); + findRouteToWarehouse(); if(oldNextDir != next_dir) { - RemoveWareJobForDir(oldNextDir); + removeWareJobForDir(oldNextDir); if(next_dir != RoadPathDirection::None) { RTTR_Assert(goal); // Having a nextDir implies having a goal - CallCarrier(); + callCarrier(); } else RTTR_Assert(!goal); // Can only have a goal with a valid path } @@ -227,7 +227,7 @@ void Ware::GoalDestroyed() } else { goal = nullptr; - FindRouteToWarehouse(); + findRouteToWarehouse(); } } else { @@ -239,49 +239,49 @@ void Ware::GoalDestroyed() } } -void Ware::WaitAtFlag(noFlag& flag) +void Ware::waitAtFlag(noFlag& flag) { state = State::WaitAtFlag; location = &flag; } -void Ware::WaitInWarehouse(nobBaseWarehouse& wh) +void Ware::waitInWarehouse(nobBaseWarehouse& wh) { state = State::WaitInWarehouse; location = &wh; } -void Ware::Carry(noRoadNode& nextGoal) +void Ware::carry(noRoadNode& nextGoal) { state = State::Carried; location = &nextGoal; } /// Gibt dem Ziel der Ware bekannt, dass diese nicht mehr kommen kann -void Ware::NotifyGoalAboutLostWare() +void Ware::notifyGoalAboutLostWare() { // Meinem Ziel Bescheid sagen, dass ich weg vom Fenster bin (falls ich ein Ziel habe!) if(goal) { - goal->WareLost(*this); + goal->wareLost(*this); goal = nullptr; next_dir = RoadPathDirection::None; } } /// Wenn die Ware vernichtet werden muss -void Ware::WareLost(const unsigned char player) +void Ware::wareLost(const unsigned char player) { location = nullptr; // Inventur verringern - world->getPlayer(player).DecreaseInventoryWare(type, 1); + world->getPlayer(player).decreaseInventoryWare(type, 1); // Ziel der Ware Bescheid sagen - NotifyGoalAboutLostWare(); + notifyGoalAboutLostWare(); // Zentrale Registrierung der Ware löschen - world->getPlayer(player).RemoveWare(*this); + world->getPlayer(player).removeWare(*this); } -void Ware::RemoveWareJobForDir(const RoadPathDirection last_next_dir) +void Ware::removeWareJobForDir(const RoadPathDirection last_next_dir) { // last_next_dir war die letzte Richtung, in die die Ware eigentlich wollte, // aber nun nicht mehr will, deshalb muss dem Träger Bescheid gesagt werden @@ -294,29 +294,29 @@ void Ware::RemoveWareJobForDir(const RoadPathDirection last_next_dir) if(!location->getRoute(lastDir)) return; // Den Trägern Bescheid sagen - location->getRoute(lastDir)->WareJobRemoved(nullptr); + location->getRoute(lastDir)->wareJobRemoved(nullptr); // Wenn nicht, könntes ja sein, dass die Straße in ein Lagerhaus führt, dann muss dort Bescheid gesagt werden if(location->getRoute(lastDir)->getF2()->getType() == NodalObjectType::Building) { auto* bld = static_cast(location->getRoute(Direction::NorthWest)->getF2()); if(BuildingProperties::isWareHouse(bld->getBuildingType())) - static_cast(bld)->DontFetchNextWare(); + static_cast(bld)->dontFetchNextWare(); } } -void Ware::CallCarrier() +void Ware::callCarrier() { RTTR_Assert(isWaitingAtFlag()); RTTR_Assert(next_dir != RoadPathDirection::None && next_dir != RoadPathDirection::Ship); RTTR_Assert(location); - location->getRoute(toDirection(next_dir))->AddWareJob(location); + location->getRoute(toDirection(next_dir))->addWareJob(location); } -bool Ware::FindRouteToWarehouse() +bool Ware::findRouteToWarehouse() { RTTR_Assert(location); RTTR_Assert(!goal); // Goal should have been notified and therefore reset - setGoal(world->getPlayer(location->getPlayer()).FindWarehouseForWare(*this)); + setGoal(world->getPlayer(location->getPlayer()).findWarehouseForWare(*this)); if(goal) { @@ -327,7 +327,7 @@ bool Ware::FindRouteToWarehouse() next_dir = RoadPathDirection::None; // Warehouse will detect this else { - next_dir = world->FindPathForWareOnRoads(*location, *goal, nullptr, &next_harbor); + next_dir = world->findPathForWareOnRoads(*location, *goal, nullptr, &next_harbor); RTTR_Assert(next_dir != RoadPathDirection::None); } } @@ -337,18 +337,18 @@ bool Ware::FindRouteToWarehouse() } /// a lost ware got ordered -unsigned Ware::CheckNewGoalForLostWare(const noBaseBuilding& newgoal) const +unsigned Ware::checkNewGoalForLostWare(const noBaseBuilding& newgoal) const { if(!isWaitingAtFlag()) // todo: check all special cases for wares being carried right now and where possible allow // them to be ordered return 0xFFFFFFFF; - return CalcPathToGoal(newgoal).length; + return calcPathToGoal(newgoal).length; } -Ware::RouteParams Ware::CalcPathToGoal(const noBaseBuilding& newgoal) const +Ware::RouteParams Ware::calcPathToGoal(const noBaseBuilding& newgoal) const { unsigned length; - RoadPathDirection possibledir = world->FindPathForWareOnRoads(assertNonNull(location), newgoal, &length); + RoadPathDirection possibledir = world->findPathForWareOnRoads(assertNonNull(location), newgoal, &length); if(possibledir != RoadPathDirection::None) // there is a valid path to the goal? -> ordered! { // in case the ware is right in front of the goal building the ware has to be moved away 1 flag and then back @@ -374,12 +374,12 @@ Ware::RouteParams Ware::CalcPathToGoal(const noBaseBuilding& newgoal) const /// this assumes that the ware is at a flag (todo: handle carried wares) and that there is a valid path to the goal void Ware::setNewGoalForLostWare(noBaseBuilding& newgoal) { - const auto newDir = CalcPathToGoal(newgoal).dir; + const auto newDir = calcPathToGoal(newgoal).dir; if(newDir != RoadPathDirection::None) // there is a valid path to the goal? -> ordered! { next_dir = newDir; setGoal(&newgoal); - CallCarrier(); + callCarrier(); } } @@ -390,18 +390,18 @@ bool Ware::isRouteToGoal() return false; if(location == goal) return true; // We are at our goal. All ok - return world->FindPathForWareOnRoads(*location, *goal) != RoadPathDirection::None; + return world->findPathForWareOnRoads(*location, *goal) != RoadPathDirection::None; } /// Informiert Ware, dass eine Schiffsreise beginnt -void Ware::StartShipJourney() +void Ware::startShipJourney() { state = State::OnShip; location = nullptr; } /// Informiert Ware, dass Schiffsreise beendet ist und die Ware nun in einem Hafengebäude liegt -void Ware::ShipJorneyEnded(nobHarborBuilding* hb) +void Ware::shipJorneyEnded(nobHarborBuilding* hb) { RTTR_Assert(hb); state = State::WaitInWarehouse; @@ -409,17 +409,17 @@ void Ware::ShipJorneyEnded(nobHarborBuilding* hb) } /// Beginnt damit auf ein Schiff im Hafen zu warten -void Ware::WaitForShip(nobHarborBuilding* hb) +void Ware::waitForShip(nobHarborBuilding* hb) { RTTR_Assert(hb); state = State::WaitForShip; location = hb; } -std::string Ware::ToString() const +std::string Ware::toString() const { std::stringstream s; - s << "Ware(" << getObjId() << "): type=" << GoodType2String(type) << ", location=" << location->getX() << "," + s << "Ware(" << getObjId() << "): type=" << goodType2String(type) << ", location=" << location->getX() << "," << location->getY(); return s.str(); } diff --git a/libs/s25main/Ware.h b/libs/s25main/Ware.h index f38e963c47..7a09850965 100644 --- a/libs/s25main/Ware.h +++ b/libs/s25main/Ware.h @@ -53,7 +53,7 @@ class Ware : public GameObject ~Ware() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Ware; } @@ -65,36 +65,36 @@ class Ware : public GameObject /// Sets the new goal and notifies it void setGoal(noBaseBuilding* newGoal); /// Berechnet den Weg neu zu ihrem Ziel - void RecalcRoute(); + void recalcRoute(); /// set new next dir void setNextDir(RoadPathDirection newNextDir) { next_dir = newNextDir; } void setNextDir(Direction newNextDir) { next_dir = toRoadPathDirection(newNextDir); } /// Wird aufgerufen, wenn es das Ziel der Ware nicht mehr gibt und sie wieder "nach Hause" getragen werden muss - void GoalDestroyed(); + void goalDestroyed(); /// Changes the state of the ware - void WaitAtFlag(noFlag& flag); - void WaitInWarehouse(nobBaseWarehouse& wh); - void Carry(noRoadNode& nextGoal); + void waitAtFlag(noFlag& flag); + void waitInWarehouse(nobBaseWarehouse& wh); + void carry(noRoadNode& nextGoal); /// Gibt dem Ziel der Ware bekannt, dass diese nicht mehr kommen kann - void NotifyGoalAboutLostWare(); + void notifyGoalAboutLostWare(); /// Wenn die Ware vernichtet werden muss - void WareLost(unsigned char player); + void wareLost(unsigned char player); /// Gibt Status der Ware zurück bool isWaitingAtFlag() const { return (state == State::WaitAtFlag); } bool isWaitingInWarehouse() const { return (state == State::WaitInWarehouse); } bool isWaitingForShip() const { return (state == State::WaitForShip); } bool isCarried() const { return (state == State::Carried); } /// Sagt dem Träger Bescheid, dass sie in die aktuelle (next_dir) Richtung nicht mehr getragen werden will - void RemoveWareJobForDir(RoadPathDirection last_next_dir); + void removeWareJobForDir(RoadPathDirection last_next_dir); /// Überprüft, ob es noch ein Weg zum Ziel gibt bool isRouteToGoal(); /// Tells the ware that it should look for a warehouse to go to and notifies that (if found) /// Sets nextDir to the next direction or invalid of no warehouse found - bool FindRouteToWarehouse(); + bool findRouteToWarehouse(); /// Tells a carrier that we want to be carried - void CallCarrier(); + void callCarrier(); /// a building is looking for a ware - check if this lost ware can be send to the building and then do it - unsigned CheckNewGoalForLostWare(const noBaseBuilding& newgoal) const; + unsigned checkNewGoalForLostWare(const noBaseBuilding& newgoal) const; void setNewGoalForLostWare(noBaseBuilding& newgoal); /// Gibt Ort der Ware zurück noRoadNode* getLocation() { return location; } @@ -102,15 +102,15 @@ class Ware : public GameObject /// Ist die Ware eine LostWare (Ware, die kein Ziel mehr hat und irgendwo sinnlos rumliegt)? bool isLostWare() const { return ((goal == nullptr) && state != State::OnShip); } /// Informiert Ware, dass eine Schiffsreise beginnt - void StartShipJourney(); + void startShipJourney(); /// Informiert Ware, dass Schiffsreise beendet ist und die Ware nun in einem Hafengebäude liegt - void ShipJorneyEnded(nobHarborBuilding* hb); + void shipJorneyEnded(nobHarborBuilding* hb); /// Beginnt damit auf ein Schiff im Hafen zu warten - void WaitForShip(nobHarborBuilding* hb); + void waitForShip(nobHarborBuilding* hb); - std::string ToString() const override; + std::string toString() const override; - static std::string GoodType2String(GoodType value) + static std::string goodType2String(GoodType value) { switch(value) { @@ -166,5 +166,5 @@ class Ware : public GameObject unsigned length; RoadPathDirection dir; }; - RouteParams CalcPathToGoal(const noBaseBuilding& newgoal) const; + RouteParams calcPathToGoal(const noBaseBuilding& newgoal) const; }; diff --git a/libs/s25main/Window.cpp b/libs/s25main/Window.cpp index 2096b664cc..88cc97b08c 100644 --- a/libs/s25main/Window.cpp +++ b/libs/s25main/Window.cpp @@ -27,10 +27,10 @@ Window::~Window() RTTR_Assert(!isInMouseRelay); } -void Window::Draw() +void Window::draw() { if(visible_) - Draw_(); + drawImpl(); } DrawPoint Window::getPos() const @@ -69,7 +69,7 @@ Rect Window::getBoundaryRect() const return getDrawRect(); } -bool Window::RelayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& ke) +bool Window::relayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& ke) { // Ask derived classes whether relaying messages is allowed // (For example, ingame windows might not want to receive keyboard messages when they are minimized) @@ -85,7 +85,7 @@ bool Window::RelayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& ke) return false; } -bool Window::RelayMouseMessage(MouseMsgHandler msg, const MouseCoords& mc) +bool Window::relayMouseMessage(MouseMsgHandler msg, const MouseCoords& mc) { // Ask derived classes whether relaying messages is allowed if(!isMessageRelayAllowed()) @@ -120,7 +120,7 @@ bool Window::RelayMouseMessage(MouseMsgHandler msg, const MouseCoords& mc) void Window::setActive(bool activate) { active_ = activate; - ActivateControls(activate); + activateControls(activate); } /** @@ -128,7 +128,7 @@ void Window::setActive(bool activate) * * @param[in] activate Steuerelemente aktivieren? */ -void Window::ActivateControls(bool activate) +void Window::activateControls(bool activate) { for(auto& it : childIdToWnd_) it.second->setActive(activate); @@ -140,7 +140,7 @@ void Window::ActivateControls(bool activate) * @param[in] window das Fenster, welches die Region sperrt. * @param[in] rect das Rechteck, welches die Region beschreibt. */ -void Window::LockRegion(Window* window, const Rect& rect) +void Window::lockRegion(Window* window, const Rect& rect) { lockedAreas_[window] = rect; auto it = helpers::find(tofreeAreas_, window); @@ -149,7 +149,7 @@ void Window::LockRegion(Window* window, const Rect& rect) // Also lock the region for all parents if(getParent()) - getParent()->LockRegion(this, rect); + getParent()->lockRegion(this, rect); } /** @@ -157,7 +157,7 @@ void Window::LockRegion(Window* window, const Rect& rect) * * @param[in] window das Fenster, welches die Region sperrt. */ -void Window::FreeRegion(Window* window) +void Window::freeRegion(Window* window) { // We need to keep all locked areas otherwise a closed dropdown will enable "click-through" to below control if(isInMouseRelay) @@ -167,7 +167,7 @@ void Window::FreeRegion(Window* window) // Also free the locked region for all parents if(getParent()) - getParent()->FreeRegion(this); + getParent()->freeRegion(this); } void Window::setPos(const DrawPoint& newPos) @@ -180,261 +180,261 @@ bool Window::isMessageRelayAllowed() const return true; } -void Window::DeleteCtrl(unsigned id) +void Window::deleteCtrl(unsigned id) { childIdToWnd_.erase(id); } -ctrlBuildingIcon* Window::AddBuildingIcon(unsigned id, const DrawPoint& pos, BuildingType type, const Nation nation, +ctrlBuildingIcon* Window::addBuildingIcon(unsigned id, const DrawPoint& pos, BuildingType type, const Nation nation, unsigned short size, const std::string& tooltip) { - return AddCtrl( - std::make_unique(this, id, ScaleIf(pos), type, nation, ScaleIf(Extent(size, 0)).x, tooltip)); + return addCtrl( + std::make_unique(this, id, scaleIf(pos), type, nation, scaleIf(Extent(size, 0)).x, tooltip)); } -ctrlButton* Window::AddTextButton(unsigned id, const DrawPoint& pos, const Extent& size, const TextureColor tc, +ctrlButton* Window::addTextButton(unsigned id, const DrawPoint& pos, const Extent& size, const TextureColor tc, const std::string& text, const glFont* font, const std::string& tooltip) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, text, font, tooltip)); + return addCtrl(std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, text, font, tooltip)); } -ctrlButton* Window::AddColorButton(unsigned id, const DrawPoint& pos, const Extent& size, const TextureColor tc, +ctrlButton* Window::addColorButton(unsigned id, const DrawPoint& pos, const Extent& size, const TextureColor tc, const unsigned fillColor, const std::string& tooltip) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, fillColor, tooltip)); + return addCtrl(std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, fillColor, tooltip)); } -ctrlButton* Window::AddImageButton(unsigned id, const DrawPoint& pos, const Extent& size, const TextureColor tc, +ctrlButton* Window::addImageButton(unsigned id, const DrawPoint& pos, const Extent& size, const TextureColor tc, ITexture* const image, const std::string& tooltip) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, image, tooltip)); + return addCtrl(std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, image, tooltip)); } -ctrlButton* Window::AddImageButton(unsigned id, const DrawPoint& pos, const Extent& size, const TextureColor tc, +ctrlButton* Window::addImageButton(unsigned id, const DrawPoint& pos, const Extent& size, const TextureColor tc, glArchivItem_Bitmap* const image, const std::string& tooltip) { - return AddImageButton(id, pos, size, tc, static_cast(image), tooltip); + return addImageButton(id, pos, size, tc, static_cast(image), tooltip); } -ctrlChat* Window::AddChatCtrl(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, +ctrlChat* Window::addChatCtrl(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, font)); + return addCtrl(std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, font)); } -ctrlCheck* Window::AddCheckBox(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, +ctrlCheck* Window::addCheckBox(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const std::string& text, const glFont* font, bool readonly) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, text, font, readonly)); + return addCtrl(std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, text, font, readonly)); } -ctrlComboBox* Window::AddComboBox(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, +ctrlComboBox* Window::addComboBox(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, unsigned short max_list_height, bool readonly) { - return AddCtrl( - std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, font, max_list_height, readonly)); + return addCtrl( + std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, font, max_list_height, readonly)); } -ctrlDeepening* Window::AddTextDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, +ctrlDeepening* Window::addTextDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const std::string& text, const glFont* font, unsigned color, FontStyle style) { - return AddCtrl( - std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, text, font, color, style)); + return addCtrl( + std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, text, font, color, style)); } -ctrlDeepening* Window::AddColorDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, +ctrlDeepening* Window::addColorDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, unsigned fillColor) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, fillColor)); + return addCtrl(std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, fillColor)); } -ctrlDeepening* Window::AddImageDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, +ctrlDeepening* Window::addImageDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, ITexture* image) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, image)); + return addCtrl(std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, image)); } -ctrlDeepening* Window::AddImageDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, +ctrlDeepening* Window::addImageDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, glArchivItem_Bitmap* image) { - return AddImageDeepening(id, pos, size, tc, static_cast(image)); + return addImageDeepening(id, pos, size, tc, static_cast(image)); } -ctrlEdit* Window::AddEdit(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, +ctrlEdit* Window::addEdit(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, unsigned short maxlength, bool password, bool disabled, bool notify) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, font, maxlength, password, + return addCtrl(std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, font, maxlength, password, disabled, notify)); } -ctrlGroup* Window::AddGroup(unsigned id) +ctrlGroup* Window::addGroup(unsigned id) { - return AddCtrl(std::make_unique(this, id)); + return addCtrl(std::make_unique(this, id)); } -ctrlImage* Window::AddImage(unsigned id, const DrawPoint& pos, ITexture* image, const std::string& tooltip) +ctrlImage* Window::addImage(unsigned id, const DrawPoint& pos, ITexture* image, const std::string& tooltip) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), image, tooltip)); + return addCtrl(std::make_unique(this, id, scaleIf(pos), image, tooltip)); } -ctrlImage* Window::AddImage(unsigned id, const DrawPoint& pos, glArchivItem_Bitmap* image, const std::string& tooltip) +ctrlImage* Window::addImage(unsigned id, const DrawPoint& pos, glArchivItem_Bitmap* image, const std::string& tooltip) { - return AddImage(id, pos, static_cast(image), tooltip); + return addImage(id, pos, static_cast(image), tooltip); } -ctrlList* Window::AddList(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font) +ctrlList* Window::addList(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, font)); + return addCtrl(std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, font)); } -ctrlMultiline* Window::AddMultiline(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, +ctrlMultiline* Window::addMultiline(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, FontStyle format) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, font, format)); + return addCtrl(std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, font, format)); } -ctrlOptionGroup* Window::AddOptionGroup(unsigned id, GroupSelectType select_type) +ctrlOptionGroup* Window::addOptionGroup(unsigned id, GroupSelectType select_type) { - return AddCtrl(std::make_unique(this, id, select_type)); + return addCtrl(std::make_unique(this, id, select_type)); } -ctrlMultiSelectGroup* Window::AddMultiSelectGroup(unsigned id, GroupSelectType select_type) +ctrlMultiSelectGroup* Window::addMultiSelectGroup(unsigned id, GroupSelectType select_type) { - return AddCtrl(std::make_unique(this, id, select_type)); + return addCtrl(std::make_unique(this, id, select_type)); } -ctrlPercent* Window::AddPercent(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, +ctrlPercent* Window::addPercent(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, unsigned text_color, const glFont* font, const unsigned short* percentage) { - return AddCtrl( - std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, text_color, font, percentage)); + return addCtrl( + std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, text_color, font, percentage)); } -ctrlProgress* Window::AddProgress(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, +ctrlProgress* Window::addProgress(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, unsigned short button_minus, unsigned short button_plus, unsigned short maximum, const std::string& tooltip, const Extent& padding, unsigned force_color, const std::string& button_minus_tooltip, const std::string& button_plus_tooltip) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, button_minus, button_plus, + return addCtrl(std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, button_minus, button_plus, maximum, padding, force_color, tooltip, button_minus_tooltip, button_plus_tooltip)); } -ctrlScrollBar* Window::AddScrollBar(unsigned id, const DrawPoint& pos, const Extent& size, unsigned short button_height, +ctrlScrollBar* Window::addScrollBar(unsigned id, const DrawPoint& pos, const Extent& size, unsigned short button_height, TextureColor tc, unsigned short page_size) { - button_height = ScaleIf(Extent(0, button_height)).y; + button_height = scaleIf(Extent(0, button_height)).y; - return AddCtrl( - std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), button_height, tc, page_size)); + return addCtrl( + std::make_unique(this, id, scaleIf(pos), scaleIf(size), button_height, tc, page_size)); } -ctrlTab* Window::AddTabCtrl(unsigned id, const DrawPoint& pos, unsigned short width) +ctrlTab* Window::addTabCtrl(unsigned id, const DrawPoint& pos, unsigned short width) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), ScaleIf(Extent(width, 0)).x)); + return addCtrl(std::make_unique(this, id, scaleIf(pos), scaleIf(Extent(width, 0)).x)); } -ctrlTable* Window::AddTable(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, +ctrlTable* Window::addTable(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, std::vector columns) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, font, std::move(columns))); + return addCtrl(std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, font, std::move(columns))); } -ctrlTimer* Window::AddTimer(unsigned id, std::chrono::milliseconds timeout) +ctrlTimer* Window::addTimer(unsigned id, std::chrono::milliseconds timeout) { - return AddCtrl(std::make_unique(this, id, timeout)); + return addCtrl(std::make_unique(this, id, timeout)); } -ctrlText* Window::AddText(unsigned id, const DrawPoint& pos, const std::string& text, unsigned color, FontStyle format, +ctrlText* Window::addText(unsigned id, const DrawPoint& pos, const std::string& text, unsigned color, FontStyle format, const glFont* font) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), text, color, format, font)); + return addCtrl(std::make_unique(this, id, scaleIf(pos), text, color, format, font)); } -ctrlMapSelection* Window::AddMapSelection(unsigned id, const DrawPoint& pos, const Extent& size, +ctrlMapSelection* Window::addMapSelection(unsigned id, const DrawPoint& pos, const Extent& size, const SelectionMapInputData& inputData) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), inputData)); + return addCtrl(std::make_unique(this, id, scaleIf(pos), scaleIf(size), inputData)); } -TextFormatSetter Window::AddFormattedText(unsigned id, const DrawPoint& pos, const std::string& text, unsigned color, +TextFormatSetter Window::addFormattedText(unsigned id, const DrawPoint& pos, const std::string& text, unsigned color, FontStyle format, const glFont* font) { - return AddText(id, pos, text, color, format, font); + return addText(id, pos, text, color, format, font); } -ctrlVarDeepening* Window::AddVarDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, +ctrlVarDeepening* Window::addVarDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const std::string& formatstr, const glFont* font, unsigned color, unsigned parameters, ...) { va_list liste; va_start(liste, parameters); - auto ctrl = std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), tc, formatstr, font, color, + auto ctrl = std::make_unique(this, id, scaleIf(pos), scaleIf(size), tc, formatstr, font, color, parameters, liste); va_end(liste); - return AddCtrl(std::move(ctrl)); + return addCtrl(std::move(ctrl)); } -ctrlVarText* Window::AddVarText(unsigned id, const DrawPoint& pos, const std::string& formatstr, unsigned color, +ctrlVarText* Window::addVarText(unsigned id, const DrawPoint& pos, const std::string& formatstr, unsigned color, FontStyle format, const glFont* font, unsigned parameters, ...) { va_list liste; va_start(liste, parameters); auto ctrl = - std::make_unique(this, id, ScaleIf(pos), formatstr, color, format, font, parameters, liste); + std::make_unique(this, id, scaleIf(pos), formatstr, color, format, font, parameters, liste); va_end(liste); - return AddCtrl(std::move(ctrl)); + return addCtrl(std::move(ctrl)); } -ctrlPreviewMinimap* Window::AddPreviewMinimap(const unsigned id, const DrawPoint& pos, const Extent& size, +ctrlPreviewMinimap* Window::addPreviewMinimap(const unsigned id, const DrawPoint& pos, const Extent& size, libsiedler2::ArchivItem_Map* const map) { - return AddCtrl(std::make_unique(this, id, ScaleIf(pos), ScaleIf(size), map)); + return addCtrl(std::make_unique(this, id, scaleIf(pos), scaleIf(size), map)); } -void Window::Draw3D(const Rect& rect, TextureColor tc, bool elevated, bool highlighted, bool illuminated, +void Window::draw3D(const Rect& rect, TextureColor tc, bool elevated, bool highlighted, bool illuminated, unsigned contentColor) { const Extent rectSize = rect.getSize(); if(rectSize.x < 4 || rectSize.y < 4) return; - Draw3DBorder(rect, tc, elevated); + draw3DBorder(rect, tc, elevated); // Move content inside border Rect contentRect(rect.getOrigin() + Position(2, 2), rectSize - Extent(4, 4)); - Draw3DContent(contentRect, tc, elevated, highlighted, illuminated, contentColor); + draw3DContent(contentRect, tc, elevated, highlighted, illuminated, contentColor); } -void Window::Draw3DBorder(const Rect& rect, TextureColor tc, bool elevated) +void Window::draw3DBorder(const Rect& rect, TextureColor tc, bool elevated) { if(tc == TextureColor::Invisible) return; glArchivItem_Bitmap* borderImg = LOADER.getImageN("io", 12 + rttr::enum_cast(tc)); - VIDEODRIVER.getRenderer()->Draw3DBorder(rect, elevated, *borderImg); + VIDEODRIVER.getRenderer()->draw3DBorder(rect, elevated, *borderImg); } -void Window::Draw3DContent(const Rect& rect, TextureColor tc, bool elevated, bool highlighted, bool illuminated, +void Window::draw3DContent(const Rect& rect, TextureColor tc, bool elevated, bool highlighted, bool illuminated, unsigned contentColor) { if(tc == TextureColor::Invisible) return; glArchivItem_Bitmap* contentImg = LOADER.getImageN("io", rttr::enum_cast(tc) * 2 + (highlighted ? 0 : 1)); - VIDEODRIVER.getRenderer()->Draw3DContent(rect, elevated, *contentImg, illuminated, contentColor); + VIDEODRIVER.getRenderer()->draw3DContent(rect, elevated, *contentImg, illuminated, contentColor); } -void Window::DrawRectangle(const Rect& rect, unsigned color) +void Window::drawRectangle(const Rect& rect, unsigned color) { - VIDEODRIVER.getRenderer()->DrawRect(rect, color); + VIDEODRIVER.getRenderer()->drawRect(rect, color); } -void Window::DrawLine(DrawPoint pt1, DrawPoint pt2, unsigned short width, unsigned color) +void Window::drawLine(DrawPoint pt1, DrawPoint pt2, unsigned short width, unsigned color) { - VIDEODRIVER.getRenderer()->DrawLine(pt1, pt2, width, color); + VIDEODRIVER.getRenderer()->drawLine(pt1, pt2, width, color); } void Window::msgPaintBefore() @@ -450,10 +450,10 @@ void Window::msgPaintAfter() control->msgPaintAfter(); } -void Window::Draw_() +void Window::drawImpl() { for(auto& control : childIdToWnd_ | boost::adaptors::map_values) - control->Draw(); + control->draw(); } void Window::msgScreenResize(const ScreenResizeEvent& sr) @@ -468,28 +468,28 @@ void Window::msgScreenResize(const ScreenResizeEvent& sr) Extent newSize = rescale(ctrl->getSize()); ctrl->setPos(rescale(ctrl->getPos())); ctrl->msgScreenResize(sr); - ctrl->Resize(newSize); + ctrl->resize(newSize); } animations_.onRescale(sr); } template -T_Pt Window::Scale(const T_Pt& pt) +T_Pt Window::scale(const T_Pt& pt) { return ScaleWindowPropUp::scale(pt, VIDEODRIVER.getRenderSize()); } template -T_Pt Window::ScaleIf(const T_Pt& pt) const +T_Pt Window::scaleIf(const T_Pt& pt) const { - return scale_ ? Scale(pt) : pt; + return scale_ ? scale(pt) : pt; } // Explicit template instantiations for the used types to avoid linker errors -template DrawPoint Window::Scale(const DrawPoint&); -template Extent Window::Scale(const Extent&); -template DrawPoint Window::ScaleIf(const DrawPoint&) const; -template Extent Window::ScaleIf(const Extent&) const; +template DrawPoint Window::scale(const DrawPoint&); +template Extent Window::scale(const Extent&); +template DrawPoint Window::scaleIf(const DrawPoint&) const; +template Extent Window::scaleIf(const Extent&) const; bool Window::isInLockedRegion(const Position& pos, const Window* exception) const { diff --git a/libs/s25main/Window.h b/libs/s25main/Window.h index f2154db2b0..ff47e15a03 100644 --- a/libs/s25main/Window.h +++ b/libs/s25main/Window.h @@ -69,7 +69,7 @@ class Window Window(Window* parent, unsigned id, const DrawPoint& pos, const Extent& size = Extent(0, 0)); virtual ~Window(); /// Draw all contained controls if the window is visible - void Draw(); + void draw(); /// Get the current position relative to the parent window DrawPoint getPos() const; /// Get the absolute position for drawing @@ -82,24 +82,24 @@ class Window /// (might be different to the draw rect if the window resizes according to content) virtual Rect getBoundaryRect() const; /// Change the size - virtual void Resize(const Extent& newSize) { size_ = newSize; } + virtual void resize(const Extent& newSize) { size_ = newSize; } /// Change only the width - void setWidth(unsigned width) { Resize(Extent(width, size_.y)); } + void setWidth(unsigned width) { resize(Extent(width, size_.y)); } /// Change only the height - void setHeight(unsigned height) { Resize(Extent(size_.x, height)); } + void setHeight(unsigned height) { resize(Extent(size_.x, height)); } /// Send a keyboard message to all controls, return true if handled - bool RelayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& ke); + bool relayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& ke); /// Send a mouse message to all controls, return true if handled - bool RelayMouseMessage(MouseMsgHandler msg, const MouseCoords& mc); + bool relayMouseMessage(MouseMsgHandler msg, const MouseCoords& mc); /// Make the window active or inactive. Inactive controls e.g. don't react to events virtual void setActive(bool activate = true); /// Activate/deactivate only the elements of the window - void ActivateControls(bool activate = true); + void activateControls(bool activate = true); /// Lock a region which won't react to mouse events anymore except for the given window/control. /// Only a single region can be locked per window. - void LockRegion(Window* window, const Rect& rect); + void lockRegion(Window* window, const Rect& rect); /// Release the region locked for the given window/control. - void FreeRegion(Window* window); + void freeRegion(Window* window); /// Check if the given point is in a region locked by any window other than exception bool isInLockedRegion(const Position& pos, const Window* exception = nullptr) const; /// Check if the mouse is hovering over this control, i.e. inside its boundary. @@ -131,92 +131,92 @@ class Window template std::vector getCtrls() const; - void DeleteCtrl(unsigned id); + void deleteCtrl(unsigned id); AnimationManager& getAnimationManager() { return animations_; } template - T* AddCtrl(std::unique_ptr ctrl); + T* addCtrl(std::unique_ptr ctrl); - ctrlBuildingIcon* AddBuildingIcon(unsigned id, const DrawPoint& pos, BuildingType type, Nation nation, + ctrlBuildingIcon* addBuildingIcon(unsigned id, const DrawPoint& pos, BuildingType type, Nation nation, unsigned short size = 36, const std::string& tooltip = ""); - ctrlButton* AddTextButton(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, + ctrlButton* addTextButton(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const std::string& text, const glFont* font, const std::string& tooltip = ""); - ctrlButton* AddColorButton(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, + ctrlButton* addColorButton(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, unsigned fillColor, const std::string& tooltip = ""); - ctrlButton* AddImageButton(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, ITexture* image, + ctrlButton* addImageButton(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, ITexture* image, const std::string& tooltip = ""); - ctrlButton* AddImageButton(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, + ctrlButton* addImageButton(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, glArchivItem_Bitmap* image, const std::string& tooltip = ""); - ctrlChat* AddChatCtrl(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font); - ctrlCheck* AddCheckBox(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, + ctrlChat* addChatCtrl(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font); + ctrlCheck* addCheckBox(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const std::string& text, const glFont* font, bool readonly = false); - ctrlComboBox* AddComboBox(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, + ctrlComboBox* addComboBox(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, unsigned short max_list_height, bool readonly = false); - ctrlDeepening* AddTextDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, + ctrlDeepening* addTextDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const std::string& text, const glFont* font, unsigned color, FontStyle style = FontStyle::CENTER | FontStyle::VCENTER); - ctrlDeepening* AddColorDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, + ctrlDeepening* addColorDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, unsigned fillColor); - ctrlDeepening* AddImageDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, + ctrlDeepening* addImageDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, ITexture* image); - ctrlDeepening* AddImageDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, + ctrlDeepening* addImageDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, glArchivItem_Bitmap* image); - ctrlEdit* AddEdit(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, + ctrlEdit* addEdit(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, unsigned short maxlength = 0, bool password = false, bool disabled = false, bool notify = false); - ctrlGroup* AddGroup(unsigned id); - ctrlImage* AddImage(unsigned id, const DrawPoint& pos, ITexture* image, const std::string& tooltip = ""); - ctrlImage* AddImage(unsigned id, const DrawPoint& pos, glArchivItem_Bitmap* image, const std::string& tooltip = ""); - ctrlList* AddList(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font); - ctrlMultiline* AddMultiline(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, + ctrlGroup* addGroup(unsigned id); + ctrlImage* addImage(unsigned id, const DrawPoint& pos, ITexture* image, const std::string& tooltip = ""); + ctrlImage* addImage(unsigned id, const DrawPoint& pos, glArchivItem_Bitmap* image, const std::string& tooltip = ""); + ctrlList* addList(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font); + ctrlMultiline* addMultiline(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, FontStyle format = {}); - ctrlOptionGroup* AddOptionGroup(unsigned id, GroupSelectType select_type); - ctrlMultiSelectGroup* AddMultiSelectGroup(unsigned id, GroupSelectType select_type); - ctrlPercent* AddPercent(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, unsigned text_color, + ctrlOptionGroup* addOptionGroup(unsigned id, GroupSelectType select_type); + ctrlMultiSelectGroup* addMultiSelectGroup(unsigned id, GroupSelectType select_type); + ctrlPercent* addPercent(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, unsigned text_color, const glFont* font, const unsigned short* percentage); - ctrlProgress* AddProgress(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, + ctrlProgress* addProgress(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, unsigned short button_minus, unsigned short button_plus, unsigned short maximum, const std::string& tooltip = "", const Extent& padding = Extent(0, 0), unsigned force_color = 0, const std::string& button_minus_tooltip = "", const std::string& button_plus_tooltip = ""); - ctrlScrollBar* AddScrollBar(unsigned id, const DrawPoint& pos, const Extent& size, unsigned short button_height, + ctrlScrollBar* addScrollBar(unsigned id, const DrawPoint& pos, const Extent& size, unsigned short button_height, TextureColor tc, unsigned short page_size); - ctrlTab* AddTabCtrl(unsigned id, const DrawPoint& pos, unsigned short width); - ctrlTable* AddTable(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, + ctrlTab* addTabCtrl(unsigned id, const DrawPoint& pos, unsigned short width); + ctrlTable* addTable(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, std::vector columns); /// Add text /// @param color Text color (ARGB) /// @param format can be a combination of FontStyle::LEFT/CENTER/RIGHT and FontStyle::TOP/VCENTER/BOTTOM and /// FontStyle::OUTLINE/NO_OUTLINE /// Alignment specifies how the position is treated, i.e. where relative to the text it will be. - ctrlText* AddText(unsigned id, const DrawPoint& pos, const std::string& text, unsigned color, FontStyle format, + ctrlText* addText(unsigned id, const DrawPoint& pos, const std::string& text, unsigned color, FontStyle format, const glFont* font); - ctrlMapSelection* AddMapSelection(unsigned id, const DrawPoint& pos, const Extent& size, + ctrlMapSelection* addMapSelection(unsigned id, const DrawPoint& pos, const Extent& size, const SelectionMapInputData& inputData); - TextFormatSetter AddFormattedText(unsigned id, const DrawPoint& pos, const std::string& text, unsigned color, + TextFormatSetter addFormattedText(unsigned id, const DrawPoint& pos, const std::string& text, unsigned color, FontStyle format, const glFont* font); - ctrlTimer* AddTimer(unsigned id, std::chrono::milliseconds timeout); + ctrlTimer* addTimer(unsigned id, std::chrono::milliseconds timeout); /// Add a 3D text control with a variable text. The text is formatted like printf but with pointers /// to int (%d), unsigned (%u) or const char (%s) which must be valid for the lifetime of the var text! - ctrlVarDeepening* AddVarDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, + ctrlVarDeepening* addVarDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const std::string& formatstr, const glFont* font, unsigned color, unsigned parameters, ...); /// Add a text control with a variable text. The text is formatted like printf but with pointers /// to int (%d), unsigned (%u) or const char (%s) which must be valid for the lifetime of the var text! - ctrlVarText* AddVarText(unsigned id, const DrawPoint& pos, const std::string& formatstr, unsigned color, + ctrlVarText* addVarText(unsigned id, const DrawPoint& pos, const std::string& formatstr, unsigned color, FontStyle format, const glFont* font, unsigned parameters, ...); - ctrlPreviewMinimap* AddPreviewMinimap(unsigned id, const DrawPoint& pos, const Extent& size, + ctrlPreviewMinimap* addPreviewMinimap(unsigned id, const DrawPoint& pos, const Extent& size, libsiedler2::ArchivItem_Map* map); /// Draw a 3D rectangle (e.g. button) - static void Draw3D(const Rect& rect, TextureColor tc, bool elevated, bool highlighted = false, + static void draw3D(const Rect& rect, TextureColor tc, bool elevated, bool highlighted = false, bool illuminated = false, unsigned contentColor = COLOR_WHITE); - static void Draw3DBorder(const Rect& rect, TextureColor tc, bool elevated); - static void Draw3DContent(const Rect& rect, TextureColor tc, bool elevated, bool highlighted = false, + static void draw3DBorder(const Rect& rect, TextureColor tc, bool elevated); + static void draw3DContent(const Rect& rect, TextureColor tc, bool elevated, bool highlighted = false, bool illuminated = false, unsigned contentColor = COLOR_WHITE); - static void DrawRectangle(const Rect& rect, unsigned color); - static void DrawLine(DrawPoint pt1, DrawPoint pt2, unsigned short width, unsigned color); + static void drawRectangle(const Rect& rect, unsigned color); + static void drawLine(DrawPoint pt1, DrawPoint pt2, unsigned short width, unsigned color); // GUI-Notify-Messages @@ -293,14 +293,14 @@ class Window /// Scale the value from the reference coordinates to current render size template - static T_Pt Scale(const T_Pt& pt); + static T_Pt scale(const T_Pt& pt); /// Scales the value when scale_ is true, else returns the value unchanged template - T_Pt ScaleIf(const T_Pt& pt) const; + T_Pt scaleIf(const T_Pt& pt) const; /// Set whether controls of this window shall be scaled void setScale(bool scale = true) { scale_ = scale; } /// Implementation of drawing the window, derived classes can override this to draw custom backgrounds or similar - virtual void Draw_(); + virtual void drawImpl(); /// Shall messages be relayed to the controls of this window? virtual bool isMessageRelayAllowed() const; @@ -325,7 +325,7 @@ class Window }; template -T* Window::AddCtrl(std::unique_ptr ctrl) +T* Window::addCtrl(std::unique_ptr ctrl) { RTTR_Assert(ctrl); RTTR_Assert(childIdToWnd_.find(ctrl->getID()) == childIdToWnd_.end()); diff --git a/libs/s25main/WindowManager.cpp b/libs/s25main/WindowManager.cpp index a2fc07da96..c3488bd0ab 100644 --- a/libs/s25main/WindowManager.cpp +++ b/libs/s25main/WindowManager.cpp @@ -39,13 +39,13 @@ constexpr std::make_unsigned_t square(T x) } // namespace WindowManager::WindowManager() - : cursor_(Cursor::Hand), disable_mouse(false), lastMousePos(Position::Invalid()), curRenderSize(0, 0), + : cursor_(Cursor::Hand), disable_mouse(false), lastMousePos(Position::invalid()), curRenderSize(0, 0), lastLeftClickTime(0), lastLeftClickPos(0, 0) {} WindowManager::~WindowManager() = default; -void WindowManager::CleanUp() +void WindowManager::cleanUp() { windows.clear(); curDesktop.reset(); @@ -57,51 +57,51 @@ void WindowManager::setCursor(Cursor cursor) cursor_ = cursor; } -void WindowManager::DrawCursor() +void WindowManager::drawCursor() { auto resId = static_cast(cursor_); switch(cursor_) { case Cursor::Hand: - case Cursor::Remove: resId += VIDEODRIVER.isLeftDown() ? 1 : 0; break; + case Cursor::remove: resId += VIDEODRIVER.isLeftDown() ? 1 : 0; break; default: break; } if(resId) - LOADER.getImageN("resource", resId)->DrawFull(VIDEODRIVER.getMousePos()); + LOADER.getImageN("resource", resId)->drawFull(VIDEODRIVER.getMousePos()); } /** * Zeichenfunktion WindowManager-Klasse. * Zeichnet Desktop und alle Fenster. */ -void WindowManager::Draw() +void WindowManager::draw() { // ist ein neuer Desktop eingetragen? Wenn ja, wechseln if(nextdesktop) - DoDesktopSwitch(); + doDesktopSwitch(); if(!curDesktop) return; curDesktop->msgPaintBefore(); - curDesktop->Draw(); + curDesktop->draw(); curDesktop->msgPaintAfter(); // First close all marked windows - CloseMarkedIngameWnds(); + closeMarkedIngameWnds(); for(auto& wnd : windows) { // If the window is not minimized, call paintAfter if(!wnd->isMinimized()) wnd->msgPaintBefore(); - wnd->Draw(); + wnd->draw(); // If the window is not minimized, call paintAfter if(!wnd->isMinimized()) wnd->msgPaintAfter(); } - DrawToolTip(); - DrawCursor(); + drawToolTip(); + drawCursor(); } bool WindowManager::isDesktopActive() const @@ -111,7 +111,7 @@ bool WindowManager::isDesktopActive() const return false; } -void WindowManager::RelayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& ke) +void WindowManager::relayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& ke) { // When there is no desktop, don't check it or any window if(!curDesktop) @@ -120,7 +120,7 @@ void WindowManager::RelayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& { // Desktop active -> relay msg to desktop CALL_MEMBER_FN(*curDesktop, msg)(ke); - curDesktop->RelayKeyboardMessage(msg, ke); + curDesktop->relayKeyboardMessage(msg, ke); return; } @@ -134,30 +134,30 @@ void WindowManager::RelayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& // Find one which isn't yet marked for closing so multiple ESC in between draw calls can close multiple windows // ESC doesn't close pinned windows const auto itActiveWnd = std::find_if(windows.rbegin(), windows.rend(), [escape](const auto& wnd) { - return !wnd->ShouldBeClosed() && !(escape && wnd->isPinned()); + return !wnd->shouldBeClosed() && !(escape && wnd->isPinned()); }); if(itActiveWnd != windows.rend() && (*itActiveWnd)->getCloseBehavior() != CloseBehavior::Custom) - (*itActiveWnd)->Close(); + (*itActiveWnd)->close(); } else if(!CALL_MEMBER_FN(*windows.back(), msg)(ke)) // send to active window { // If not handled yet, relay to active window - if(!windows.back()->RelayKeyboardMessage(msg, ke)) + if(!windows.back()->relayKeyboardMessage(msg, ke)) { // If message was not handled send to desktop CALL_MEMBER_FN(*curDesktop, msg)(ke); - curDesktop->RelayKeyboardMessage(msg, ke); + curDesktop->relayKeyboardMessage(msg, ke); } } } -void WindowManager::RelayMouseMessage(MouseMsgHandler msg, const MouseCoords& mc, Window* window) +void WindowManager::relayMouseMessage(MouseMsgHandler msg, const MouseCoords& mc, Window* window) { if(!window) window = getActiveWindow(); if(window) { // If no sub-window/control handled the message, let the window itself handle it - if(!window->RelayMouseMessage(msg, mc)) + if(!window->relayMouseMessage(msg, mc)) CALL_MEMBER_FN(*window, msg)(mc); } } @@ -165,7 +165,7 @@ void WindowManager::RelayMouseMessage(MouseMsgHandler msg, const MouseCoords& mc /** * Öffnet ein IngameWindow und fügt es zur Fensterliste hinzu. */ -IngameWindow& WindowManager::DoShow(std::unique_ptr window, bool mouse) +IngameWindow& WindowManager::doShow(std::unique_ptr window, bool mouse) { RTTR_Assert(window); RTTR_Assert(!helpers::contains(windows, window)); @@ -190,7 +190,7 @@ IngameWindow& WindowManager::DoShow(std::unique_ptr window, bool m return result; } -IngameWindow* WindowManager::ShowAfterSwitch(std::unique_ptr window) +IngameWindow* WindowManager::showAfterSwitch(std::unique_ptr window) { RTTR_Assert(window); nextWnds.emplace_back(std::move(window)); @@ -211,7 +211,7 @@ Desktop* WindowManager::Switch(std::unique_ptr desktop) return nextdesktop.get(); } -IngameWindow* WindowManager::FindWindowAtPos(const Position& pos) const +IngameWindow* WindowManager::findWindowAtPos(const Position& pos) const { // Fenster durchgehen ( von hinten nach vorn, da die vordersten ja zuerst geprüft werden müssen !! ) for(const auto& window : helpers::reverse(windows)) @@ -231,10 +231,10 @@ IngameWindow* WindowManager::FindWindowAtPos(const Position& pos) const return nullptr; } -IngameWindow* WindowManager::FindNonModalWindow(unsigned id) const +IngameWindow* WindowManager::findNonModalWindow(unsigned id) const { auto itWnd = helpers::find_if( - windows, [id](const auto& wnd) { return !wnd->ShouldBeClosed() && !wnd->isModal() && wnd->getID() == id; }); + windows, [id](const auto& wnd) { return !wnd->shouldBeClosed() && !wnd->isModal() && wnd->getID() == id; }); return itWnd == windows.end() ? nullptr : itWnd->get(); } @@ -246,7 +246,7 @@ Window* WindowManager::findAndActivateWindow(const Position mousePos) if(windows.back()->isModal()) activeWindow = windows.back().get(); else - activeWindow = FindWindowAtPos(mousePos); + activeWindow = findWindowAtPos(mousePos); } if(!activeWindow) activeWindow = curDesktop.get(); @@ -269,12 +269,12 @@ void WindowManager::msgLeftDown(MouseCoords mc) // play click sound SoundEffectItem* sound = LOADER.getSoundN("sound", 112); if(sound) - sound->Play(255, false); + sound->play(255, false); Window* activeWindow = findAndActivateWindow(mc.pos); // Ignore mouse message, e.g. right after switching desktop, to avoid unwanted clicks if(!disable_mouse && activeWindow) - RelayMouseMessage(&Window::msgLeftDown, mc, activeWindow); + relayMouseMessage(&Window::msgLeftDown, mc, activeWindow); } void WindowManager::msgLeftUp(MouseCoords mc) @@ -307,7 +307,7 @@ void WindowManager::msgLeftUp(MouseCoords mc) // Don't relay message if mouse is disabled (e.g. right after desktop switch) if(!disable_mouse) - RelayMouseMessage(&Window::msgLeftUp, mc); + relayMouseMessage(&Window::msgLeftUp, mc); else if(!nextdesktop) disable_mouse = false; } @@ -320,7 +320,7 @@ void WindowManager::msgRightDown(const MouseCoords& mc) // Right-click closes (most) windows, so handle that first if(!windows.empty()) { - IngameWindow* foundWindow = FindWindowAtPos(mc.pos); + IngameWindow* foundWindow = findWindowAtPos(mc.pos); if(windows.back()->isModal()) { // We have a modal window -> Activate it @@ -335,17 +335,17 @@ void WindowManager::msgRightDown(const MouseCoords& mc) if(foundWindow->getCloseBehavior() == CloseBehavior::Regular) { if(!foundWindow->isPinned()) - foundWindow->Close(); + foundWindow->close(); return; } } } - RelayMouseMessage(&Window::msgRightDown, mc, findAndActivateWindow(mc.pos)); + relayMouseMessage(&Window::msgRightDown, mc, findAndActivateWindow(mc.pos)); } void WindowManager::msgRightUp(const MouseCoords& mc) { - RelayMouseMessage(&Window::msgRightUp, mc); + relayMouseMessage(&Window::msgRightUp, mc); } void WindowManager::msgMiddleDown(const MouseCoords& mc) @@ -353,28 +353,28 @@ void WindowManager::msgMiddleDown(const MouseCoords& mc) Window* activeWindow = findAndActivateWindow(mc.pos); if(activeWindow) - RelayMouseMessage(&Window::msgMiddleDown, mc, activeWindow); + relayMouseMessage(&Window::msgMiddleDown, mc, activeWindow); } void WindowManager::msgMiddleUp(const MouseCoords& mc) { - RelayMouseMessage(&Window::msgMiddleUp, mc); + relayMouseMessage(&Window::msgMiddleUp, mc); } void WindowManager::msgWheelUp(const MouseCoords& mc) { - RelayMouseMessage(&Window::msgWheelUp, mc, findAndActivateWindow(mc.pos)); + relayMouseMessage(&Window::msgWheelUp, mc, findAndActivateWindow(mc.pos)); } void WindowManager::msgWheelDown(const MouseCoords& mc) { - RelayMouseMessage(&Window::msgWheelDown, mc, findAndActivateWindow(mc.pos)); + relayMouseMessage(&Window::msgWheelDown, mc, findAndActivateWindow(mc.pos)); } void WindowManager::msgMouseMove(const MouseCoords& mc) { lastMousePos = mc.pos; - RelayMouseMessage(&Window::msgMouseMove, mc); + relayMouseMessage(&Window::msgMouseMove, mc); } void WindowManager::msgKeyDown(const KeyEvent& ke) @@ -386,21 +386,21 @@ void WindowManager::msgKeyDown(const KeyEvent& ke) (SETTINGS.video.displayMode == DisplayMode::Fullscreen) ? DisplayMode::Windowed : DisplayMode::Fullscreen; const auto newScreenSize = (newMode == DisplayMode::Fullscreen) ? SETTINGS.video.fullscreenSize : SETTINGS.video.windowedSize; - VIDEODRIVER.ResizeScreen(newScreenSize, newMode); + VIDEODRIVER.resizeScreen(newScreenSize, newMode); SETTINGS.video.displayMode = VIDEODRIVER.getDisplayMode(); } else if(ke.kt == KeyType::Print) - TakeScreenshot(); + takeScreenshot(); else - RelayKeyboardMessage(&Window::msgKeyDown, ke); + relayKeyboardMessage(&Window::msgKeyDown, ke); } /** * Handle resize of the window or change of resolution */ -void WindowManager::WindowResized() +void WindowManager::windowResized() { - VIDEODRIVER.RenewViewport(); + VIDEODRIVER.renewViewport(); msgScreenResize(VIDEODRIVER.getRenderSize()); } @@ -445,7 +445,7 @@ IngameWindow* WindowManager::getTopMostWindow() const return windows.back().get(); } -void WindowManager::DoClose(IngameWindow* window) +void WindowManager::doClose(IngameWindow* window) { const auto it = helpers::findPtr(windows, window); @@ -474,29 +474,29 @@ void WindowManager::DoClose(IngameWindow* window) * * @param[in] id ID of the window to be closed */ -void WindowManager::Close(unsigned id) +void WindowManager::close(unsigned id) { for(auto& wnd : windows) { - if(wnd->getID() == id && !wnd->ShouldBeClosed()) - wnd->Close(); + if(wnd->getID() == id && !wnd->shouldBeClosed()) + wnd->close(); } } -void WindowManager::CloseNow(IngameWindow* window) +void WindowManager::closeNow(IngameWindow* window) { - if(!window->ShouldBeClosed()) - window->Close(); - DoClose(window); + if(!window->shouldBeClosed()) + window->close(); + doClose(window); } /** * Actually process the desktop change */ -void WindowManager::DoDesktopSwitch() +void WindowManager::doDesktopSwitch() { RTTR_Assert(nextdesktop); - VIDEODRIVER.ClearScreen(); + VIDEODRIVER.clearScreen(); setToolTip(nullptr, ""); @@ -509,7 +509,7 @@ void WindowManager::DoDesktopSwitch() curDesktop->setActive(true); for(auto& nextWnd : nextWnds) - Show(std::move(nextWnd)); + show(std::move(nextWnd)); nextWnds.clear(); if(!VIDEODRIVER.isLeftDown()) @@ -519,13 +519,13 @@ void WindowManager::DoDesktopSwitch() msgMouseMove(MouseCoords(VIDEODRIVER.getMousePos())); } -void WindowManager::CloseMarkedIngameWnds() +void WindowManager::closeMarkedIngameWnds() { - auto isWndMarkedForClose = [](const auto& wnd) { return wnd->ShouldBeClosed(); }; + auto isWndMarkedForClose = [](const auto& wnd) { return wnd->shouldBeClosed(); }; auto it = helpers::find_if(windows, isWndMarkedForClose); while(it != windows.end()) { - DoClose(it->get()); + doClose(it->get()); it = helpers::find_if(windows, isWndMarkedForClose); } } @@ -560,7 +560,7 @@ void WindowManager::setActiveWindow(Window& wnd) SetActiveWindowImpl(wnd, *nextdesktop, nextWnds); } -void WindowManager::TakeScreenshot() const +void WindowManager::takeScreenshot() const { const auto windowSize = VIDEODRIVER.getWindowSize(); libsiedler2::PixelBufferBGRA buffer(windowSize.width, windowSize.height); @@ -599,7 +599,7 @@ class WindowManager::Tooltip void setText(const std::string& text) { - lines = font->getWrapInfo(text, maxWidth, maxWidth).CreateSingleStrings(text); + lines = font->getWrapInfo(text, maxWidth, maxWidth).createSingleStrings(text); if(lines.empty()) return; width = 0; @@ -611,12 +611,12 @@ class WindowManager::Tooltip void draw(DrawPoint pos) const { - Window::DrawRectangle(Rect(pos, width, height), 0x9F000000); + Window::drawRectangle(Rect(pos, width, height), 0x9F000000); pos += DrawPoint::all(BORDER_SIZE); const auto fontHeight = font->getHeight(); for(const auto& line : lines) { - font->Draw(pos, line, FontStyle::TOP, COLOR_YELLOW); + font->draw(pos, line, FontStyle::TOP, COLOR_YELLOW); pos.y += fontHeight; } } @@ -639,7 +639,7 @@ void WindowManager::setToolTip(const ctrlBaseTooltip* ttw, const std::string& to curTooltip = std::make_unique(ttw, tooltip, MAX_TOOLTIP_WIDTH); } -void WindowManager::DrawToolTip() +void WindowManager::drawToolTip() { // Tooltip zeichnen if(curTooltip && lastMousePos.isValid()) diff --git a/libs/s25main/WindowManager.h b/libs/s25main/WindowManager.h index 5da8508b92..87900e93f3 100644 --- a/libs/s25main/WindowManager.h +++ b/libs/s25main/WindowManager.h @@ -28,7 +28,7 @@ enum class Cursor : unsigned Hand = 30, Scroll = 32, Moon = 33, - Remove = 34 + remove = 34 }; /// Verwaltet alle (offenen) Fenster bzw Desktops samt ihren Controls und Messages @@ -40,51 +40,51 @@ class WindowManager : public Singleton, public VideoDriverLoaderI WindowManager(); ~WindowManager(); - void CleanUp(); + void cleanUp(); /// Zeichnet Desktop und alle Fenster. - void Draw(); + void draw(); /// liefert ob der aktuelle Desktop den Focus besitzt oder nicht. bool isDesktopActive() const; /// schickt eine Nachricht an das aktive Fenster bzw den aktiven Desktop. /// Sendet eine Tastaturnachricht an die Steuerelemente. - void RelayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& ke); + void relayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& ke); /// Sendet eine Mausnachricht weiter an alle Steuerelemente - void RelayMouseMessage(MouseMsgHandler msg, const MouseCoords& mc, Window* window = nullptr); + void relayMouseMessage(MouseMsgHandler msg, const MouseCoords& mc, Window* window = nullptr); /// Öffnet ein IngameWindow und fügt es zur Fensterliste hinzu. - IngameWindow& DoShow(std::unique_ptr window, bool mouse = false); + IngameWindow& doShow(std::unique_ptr window, bool mouse = false); template - T& Show(std::unique_ptr window, bool mouse = false) + T& show(std::unique_ptr window, bool mouse = false) { - return static_cast(DoShow(std::move(window), mouse)); + return static_cast(doShow(std::move(window), mouse)); } template - T& ReplaceWindow(std::unique_ptr window) + T& replaceWindow(std::unique_ptr window) { - auto* oldWnd = FindNonModalWindow(window->getID()); + auto* oldWnd = findNonModalWindow(window->getID()); if(oldWnd) - oldWnd->Close(); - return Show(std::move(window)); + oldWnd->close(); + return show(std::move(window)); } template - T* ToggleWindow(std::unique_ptr window) + T* toggleWindow(std::unique_ptr window) { - auto* oldWnd = FindNonModalWindow(window->getID()); + auto* oldWnd = findNonModalWindow(window->getID()); if(oldWnd) { - oldWnd->Close(); + oldWnd->close(); return nullptr; } else - return &Show(std::move(window)); + return &show(std::move(window)); } /// Registers a window to be shown after a desktop switch - IngameWindow* ShowAfterSwitch(std::unique_ptr window); + IngameWindow* showAfterSwitch(std::unique_ptr window); /// Sucht ein Fenster mit der entsprechenden Fenster-ID und schließt es (falls es so eins gibt) - void Close(unsigned id); + void close(unsigned id); /// Close the window right away and free it. - void CloseNow(IngameWindow* window); + void closeNow(IngameWindow* window); /// merkt einen Desktop zum Wechsel vor. Desktop* Switch(std::unique_ptr desktop); /// Process press of left mouse button @@ -114,15 +114,15 @@ class WindowManager : public Singleton, public VideoDriverLoaderI void setToolTip(const ctrlBaseTooltip* ttw, const std::string& tooltip, bool updateCurrent = false); /// Verarbeitung Spielfenstergröße verändert (vom Betriebssystem aus) - void WindowResized() override; + void windowResized() override; /// Verarbeitung Spielfenstergröße verändert (vom Spiel aus) // Achtung: nicht dieselbe Nachricht, die die Window-Klasse empfängt void msgScreenResize(const Extent& newSize); /// Return the window currently on the top (probably active) IngameWindow* getTopMostWindow() const; - IngameWindow* FindWindowAtPos(const Position& pos) const; - IngameWindow* FindNonModalWindow(unsigned id) const; + IngameWindow* findWindowAtPos(const Position& pos) const; + IngameWindow* findNonModalWindow(unsigned id) const; Desktop* getCurrentDesktop() { return curDesktop.get(); } /// Makes the given window (desktop or ingame window) active and all others inactive @@ -142,16 +142,16 @@ class WindowManager : public Singleton, public VideoDriverLoaderI /// Get the active window (desktop or ingame window) Window* getActiveWindow() const; - void DrawCursor(); - void DrawToolTip(); + void drawCursor(); + void drawToolTip(); - void TakeScreenshot() const; + void takeScreenshot() const; /// wechselt einen Desktop - void DoDesktopSwitch(); + void doDesktopSwitch(); /// Actually close all ingame windows marked for closing - void CloseMarkedIngameWnds(); + void closeMarkedIngameWnds(); /// Close the window and remove it from the window list - void DoClose(IngameWindow* window); + void doClose(IngameWindow* window); Cursor cursor_; std::unique_ptr curDesktop; /// aktueller Desktop diff --git a/libs/s25main/addons/Addon.cpp b/libs/s25main/addons/Addon.cpp index 0637806082..3d6ec0d6d6 100644 --- a/libs/s25main/addons/Addon.cpp +++ b/libs/s25main/addons/Addon.cpp @@ -10,7 +10,7 @@ AddonGui::AddonGui(const Addon& addon, Window& window, bool /*readonly*/) : addon_(addon), window_(window) { DrawPoint btPos(20, 0), txtPos(52, 4); - window.AddText(0, txtPos, addon.getName(), COLOR_YELLOW, FontStyle{}, NormalFont); - window.AddImageButton(1, btPos, Extent(22, 22), TextureColor::Grey, LOADER.getImageN("io", 21), + window.addText(0, txtPos, addon.getName(), COLOR_YELLOW, FontStyle{}, NormalFont); + window.addImageButton(1, btPos, Extent(22, 22), TextureColor::Grey, LOADER.getImageN("io", 21), addon.getDescription()); } diff --git a/libs/s25main/addons/AddonBool.cpp b/libs/s25main/addons/AddonBool.cpp index b851c1f34a..cf27c01ea8 100644 --- a/libs/s25main/addons/AddonBool.cpp +++ b/libs/s25main/addons/AddonBool.cpp @@ -25,10 +25,10 @@ unsigned AddonBool::getNumOptions() const AddonBool::Gui::Gui(const Addon& addon, Window& window, bool readonly) : AddonGui(addon, window, readonly), cb_(assertNonNull( - window.AddCheckBox(2, DrawPoint(430, 0), Extent(220, 20), TextureColor::Grey, _("Use"), NormalFont, readonly))) + window.addCheckBox(2, DrawPoint(430, 0), Extent(220, 20), TextureColor::Grey, _("Use"), NormalFont, readonly))) { if(readonly) - window.AddImage(3, cb_.getPos() - DrawPoint(1, 0), LOADER.getImageN("io_new", 14), _("Locked")); + window.addImage(3, cb_.getPos() - DrawPoint(1, 0), LOADER.getImageN("io_new", 14), _("Locked")); } void AddonBool::Gui::setStatus(unsigned status) diff --git a/libs/s25main/addons/AddonList.cpp b/libs/s25main/addons/AddonList.cpp index c4acc40500..803073a430 100644 --- a/libs/s25main/addons/AddonList.cpp +++ b/libs/s25main/addons/AddonList.cpp @@ -35,12 +35,12 @@ const std::string& AddonList::getOptionName(unsigned status) const AddonList::Gui::Gui(const AddonList& addon, Window& window, bool readonly) : AddonGui(addon, window, readonly), cb_(assertNonNull( - window.AddComboBox(2, DrawPoint(430, 0), Extent(220, 20), TextureColor::Grey, NormalFont, 100, readonly))) + window.addComboBox(2, DrawPoint(430, 0), Extent(220, 20), TextureColor::Grey, NormalFont, 100, readonly))) { for(const auto& option : addon.options) - cb_.AddItem(option); + cb_.addItem(option); if(readonly) - window.AddImage(3, cb_.getPos() - DrawPoint(1, 0), LOADER.getImageN("io_new", 14), _("Locked")); + window.addImage(3, cb_.getPos() - DrawPoint(1, 0), LOADER.getImageN("io_new", 14), _("Locked")); } void AddonList::Gui::setStatus(unsigned status) diff --git a/libs/s25main/ai/AIEventManager.cpp b/libs/s25main/ai/AIEventManager.cpp index c53efe1c0e..015cb772b4 100644 --- a/libs/s25main/ai/AIEventManager.cpp +++ b/libs/s25main/ai/AIEventManager.cpp @@ -8,7 +8,7 @@ AIEventManager::AIEventManager() = default; AIEventManager::~AIEventManager() = default; -void AIEventManager::AddAIEvent(std::unique_ptr ev) +void AIEventManager::addAIEvent(std::unique_ptr ev) { events.push(std::move(ev)); } diff --git a/libs/s25main/ai/AIEventManager.h b/libs/s25main/ai/AIEventManager.h index bfaaf4233a..7f4952551b 100644 --- a/libs/s25main/ai/AIEventManager.h +++ b/libs/s25main/ai/AIEventManager.h @@ -16,9 +16,9 @@ class AIEventManager public: AIEventManager(); ~AIEventManager(); - void AddAIEvent(std::unique_ptr ev); + void addAIEvent(std::unique_ptr ev); std::unique_ptr getEvent(); - bool EventAvailable() const { return !events.empty(); } + bool eventAvailable() const { return !events.empty(); } unsigned getEventNum() const { return events.size(); } protected: diff --git a/libs/s25main/ai/AIInterface.cpp b/libs/s25main/ai/AIInterface.cpp index 2475ecc9b2..e56b575b81 100644 --- a/libs/s25main/ai/AIInterface.cpp +++ b/libs/s25main/ai/AIInterface.cpp @@ -113,7 +113,7 @@ AISurfaceResource AIInterface::getSurfaceResource(const MapPoint pt) const if(no == NodalObjectType::Tree) { // exclude pineapple because it's not a real tree - if(static_cast(node.obj)->ProducesWood()) + if(static_cast(node.obj)->producesWood()) return AISurfaceResource::Wood; else return AISurfaceResource::Blocked; @@ -203,7 +203,7 @@ bool AIInterface::isMineResourceWorkEverywhere(const AIResource res) const && getMineResourceBehavior(gwb.getGGS(), *mineBuildingType) == MineResourceBehavior::WorkEverywhere; } -int AIInterface::CalcResourceValue(const MapPoint pt, AIResource res, helpers::OptionalEnum direction, +int AIInterface::calcResourceValue(const MapPoint pt, AIResource res, helpers::OptionalEnum direction, int lastval) const { const unsigned resRadius = RES_RADIUS[res]; @@ -261,16 +261,16 @@ int AIInterface::CalcResourceValue(const MapPoint pt, AIResource res, helpers::O // lastval); } -bool AIInterface::FindFreePathForNewRoad(MapPoint start, MapPoint target, std::vector* route /*= nullptr*/, +bool AIInterface::findFreePathForNewRoad(MapPoint start, MapPoint target, std::vector* route /*= nullptr*/, unsigned* length /*= nullptr*/) const { bool boat = false; - return gwb.getFreePathFinder().FindPathAlternatingConditions(start, target, false, 100, route, length, nullptr, + return gwb.getFreePathFinder().findPathAlternatingConditions(start, target, false, 100, route, length, nullptr, IsPointOK_RoadPath, IsPointOK_RoadPathEvenStep, nullptr, (void*)&boat); } -bool AIInterface::CalcBQSumDifference(const MapPoint pt1, const MapPoint pt2) const +bool AIInterface::calcBQSumDifference(const MapPoint pt1, const MapPoint pt2) const { return getBuildingQuality(pt2) < getBuildingQuality(pt1); } @@ -285,13 +285,13 @@ BuildingQuality AIInterface::getBuildingQualityAnyOwner(const MapPoint pt) const return gwb.getNode(pt).bq; } -bool AIInterface::FindPathOnRoads(const noRoadNode& start, const noRoadNode& target, unsigned* length) const +bool AIInterface::findPathOnRoads(const noRoadNode& start, const noRoadNode& target, unsigned* length) const { if(length) - return gwb.getRoadPathFinder().FindPath(start, target, false, std::numeric_limits::max(), nullptr, + return gwb.getRoadPathFinder().findPath(start, target, false, std::numeric_limits::max(), nullptr, length); else - return gwb.getRoadPathFinder().PathExists(start, target, false); + return gwb.getRoadPathFinder().pathExists(start, target, false); } const nobHQ* AIInterface::getHeadquarter() const @@ -303,14 +303,14 @@ bool AIInterface::isBuildingNearby(BuildingType bldType, const MapPoint pt, unsi { for(const nobUsual* bld : getBuildings(bldType)) { - if(gwb.CalcDistance(pt, bld->getPos()) <= maxDistance) + if(gwb.calcDistance(pt, bld->getPos()) <= maxDistance) return true; } for(const noBuildingSite* bldSite : getBuildingSites()) { if(bldSite->getBuildingType() == bldType) { - if(gwb.CalcDistance(pt, bldSite->getPos()) <= maxDistance) + if(gwb.calcDistance(pt, bldSite->getPos()) <= maxDistance) return true; } } @@ -322,7 +322,7 @@ bool AIInterface::isHarborPosClose(const MapPoint pt, unsigned maxDistance, bool for(const auto id : helpers::idRange(gwb.getNumHarborPoints())) { const MapPoint harborPoint = gwb.getHarborPoint(id); - if(gwb.CalcDistance(pt, harborPoint) <= maxDistance && helpers::contains(usableHarbors_, id)) + if(gwb.calcDistance(pt, harborPoint) <= maxDistance && helpers::contains(usableHarbors_, id)) { if(!onlyempty || !isBuildingOnNode(harborPoint, BuildingType::HarborBuilding)) return true; @@ -368,12 +368,12 @@ bool AIInterface::CallSpecialist(const noFlag* flag, Job job) return CallSpecialist(flag->getPos(), job); } -void AIInterface::Chat(const std::string& message, ChatDestination destination) +void AIInterface::chat(const std::string& message, ChatDestination destination) { pendingChatMsgs_.push_back(std::make_unique(playerID_, destination, message)); } -std::vector> AIInterface::FetchChatMessages() +std::vector> AIInterface::fetchChatMessages() { std::vector> tmp; std::swap(tmp, pendingChatMsgs_); diff --git a/libs/s25main/ai/AIInterface.h b/libs/s25main/ai/AIInterface.h index 7df520b2ec..7d5baefe1f 100644 --- a/libs/s25main/ai/AIInterface.h +++ b/libs/s25main/ai/AIInterface.h @@ -48,7 +48,7 @@ class AIInterface : public GameCommandFactory AISurfaceResource getSurfaceResource(MapPoint pt) const; /// Calculate the surface resource value on a given spot (wood/ stones/ farmland) /// when given a direction and lastvalue the calculation will be much faster O(n) vs O(n^2) - int CalcResourceValue(MapPoint pt, AIResource res, helpers::OptionalEnum direction = std::nullopt, + int calcResourceValue(MapPoint pt, AIResource res, helpers::OptionalEnum direction = std::nullopt, int lastval = 0xffff) const; /// Calculate the resource value for a given point int getResourceRating(MapPoint pt, AIResource res) const; @@ -79,18 +79,18 @@ class AIInterface : public GameCommandFactory /// Test whether the ai player can see a point bool isVisible(const MapPoint pt) const { - return gwb.CalcVisiblityWithAllies(pt, playerID_) == Visibility::Visible; + return gwb.calcVisiblityWithAllies(pt, playerID_) == Visibility::Visible; } /// Return true when the building quality at the 2nd point is lower than the bq on the first point - bool CalcBQSumDifference(MapPoint pt1, MapPoint pt2) const; + bool calcBQSumDifference(MapPoint pt1, MapPoint pt2) const; /// Return building quality on a given spot BuildingQuality getBuildingQuality(MapPoint pt) const; BuildingQuality getBuildingQualityAnyOwner(MapPoint pt) const; /// Tries to find a free path for a road and return length and the route - bool FindFreePathForNewRoad(MapPoint start, MapPoint target, std::vector* route = nullptr, + bool findFreePathForNewRoad(MapPoint start, MapPoint target, std::vector* route = nullptr, unsigned* length = nullptr) const; /// Tries to find a route from start to target, returning length of that route if it exists - bool FindPathOnRoads(const noRoadNode& start, const noRoadNode& target, unsigned* length = nullptr) const; + bool findPathOnRoads(const noRoadNode& start, const noRoadNode& target, unsigned* length = nullptr) const; /// Checks if it is allowed to build catapults bool canBuildCatapult() const { return player_.canBuildCatapult(); } /// checks if the player is allowed to build the building type (lua maybe later addon?) @@ -99,11 +99,11 @@ class AIInterface : public GameCommandFactory bool isPlayerAttackable(unsigned char playerID) const { return player_.isAttackable(playerID); } /// player.FindWarehouse template - nobBaseWarehouse* FindWarehouse(const noRoadNode& start, const T_IsWarehouseGood& isWarehouseGood, bool to_wh, + nobBaseWarehouse* findWarehouse(const noRoadNode& start, const T_IsWarehouseGood& isWarehouseGood, bool to_wh, bool use_boat_roads, unsigned* length = nullptr, const RoadSegment* forbidden = nullptr) const { - return player_.FindWarehouse(start, isWarehouseGood, to_wh, use_boat_roads, length, forbidden); + return player_.findWarehouse(start, isWarehouseGood, to_wh, use_boat_roads, length, forbidden); } /// Return the headquarter of the player (or null if destroyed) const nobHQ* getHeadquarter() const; @@ -167,14 +167,14 @@ class AIInterface : public GameCommandFactory bool StartStopExpedition(const nobHarborBuilding* hb, bool start); using GameCommandFactory::StartStopExpedition; - bool FoundColony(const noShip& ship) { return FoundColony(getShipID(ship)); } - using GameCommandFactory::FoundColony; + bool foundColony(const noShip& ship) { return foundColony(getShipID(ship)); } + using GameCommandFactory::foundColony; - bool TravelToNextSpot(ShipDirection direction, const noShip& ship) + bool travelToNextSpot(ShipDirection direction, const noShip& ship) { - return TravelToNextSpot(direction, getShipID(ship)); + return travelToNextSpot(direction, getShipID(ship)); } - using GameCommandFactory::TravelToNextSpot; + using GameCommandFactory::travelToNextSpot; bool CancelExpedition(const noShip& ship) { return CancelExpedition(getShipID(ship)); } using GameCommandFactory::CancelExpedition; @@ -192,15 +192,15 @@ class AIInterface : public GameCommandFactory using GameCommandFactory::CallSpecialist; /// Sends a chat messsage to all players - void Chat(const std::string& message, ChatDestination destination = ChatDestination::All); + void chat(const std::string& message, ChatDestination destination = ChatDestination::All); - std::vector> FetchChatMessages(); + std::vector> fetchChatMessages(); /// Pointer to GameWorld, containing all information about the world const GameWorldBase& gwb; private: - bool AddGC(gc::GameCommandPtr gc) override + bool addGC(gc::GameCommandPtr gc) override { gcs.push_back(gc); return true; diff --git a/libs/s25main/ai/AIPlayer.h b/libs/s25main/ai/AIPlayer.h index e549657426..2328bff47c 100644 --- a/libs/s25main/ai/AIPlayer.h +++ b/libs/s25main/ai/AIPlayer.h @@ -24,8 +24,8 @@ class AIPlayer virtual ~AIPlayer() = default; /// Called for every GF - virtual void RunGF(unsigned gf, bool gfisnwf) = 0; - virtual void OnChatMessage(unsigned sendPlayerId, ChatDestination, const std::string& msg) = 0; + virtual void runGF(unsigned gf, bool gfisnwf) = 0; + virtual void onChatMessage(unsigned sendPlayerId, ChatDestination, const std::string& msg) = 0; const std::string& getPlayerName() const { return player.name; } unsigned char getPlayerId() const { return playerId; } diff --git a/libs/s25main/ai/DummyAI.h b/libs/s25main/ai/DummyAI.h index ac064b1abf..8577adc32d 100644 --- a/libs/s25main/ai/DummyAI.h +++ b/libs/s25main/ai/DummyAI.h @@ -14,7 +14,7 @@ class DummyAI final : public AIPlayer public: DummyAI(unsigned char playerId, const GameWorldBase& gwb, const AI::Level level) : AIPlayer(playerId, gwb, level) {} - void RunGF(unsigned /*gf*/, bool /*gfisnwf*/) override {} + void runGF(unsigned /*gf*/, bool /*gfisnwf*/) override {} - void OnChatMessage(unsigned /*sendPlayerId*/, ChatDestination, const std::string& /*msg*/) override {} + void onChatMessage(unsigned /*sendPlayerId*/, ChatDestination, const std::string& /*msg*/) override {} }; diff --git a/libs/s25main/ai/aijh/AIConstruction.cpp b/libs/s25main/ai/aijh/AIConstruction.cpp index aaa5345d13..d33de6b08e 100644 --- a/libs/s25main/ai/aijh/AIConstruction.cpp +++ b/libs/s25main/ai/aijh/AIConstruction.cpp @@ -43,7 +43,7 @@ AIConstruction::AIConstruction(AIPlayerJH& aijh) AIConstruction::~AIConstruction() = default; -void AIConstruction::AddBuildJob(std::unique_ptr job, bool front) +void AIConstruction::addBuildJob(std::unique_ptr job, bool front) { if(job->getType() == BuildingType::Shipyard && aijh.isInvalidShipyardPosition(job->getAround())) return; @@ -84,7 +84,7 @@ void AIConstruction::AddBuildJob(std::unique_ptr job, bool front) }*/ -void AIConstruction::ExecuteJobs(unsigned limit) +void AIConstruction::executeJobs(unsigned limit) { unsigned i = 0; // count up to limit unsigned initconjobs = std::min(connectJobs.size(), 5); @@ -94,7 +94,7 @@ void AIConstruction::ExecuteJobs(unsigned limit) { auto job = std::move(connectJobs.front()); connectJobs.pop_front(); - job->ExecuteJob(); + job->executeJob(); if(job->getState() != JobState::Finished && job->getState() != JobState::Failed) // couldnt do job? -> move to back of list { @@ -104,7 +104,7 @@ void AIConstruction::ExecuteJobs(unsigned limit) for(; i < limit && !buildJobs.empty() && i < (initconjobs + initbuildjobs); i++) { auto job = getBuildJob(); - job->ExecuteJob(); + job->executeJob(); if(job->getState() != JobState::Finished && job->getState() != JobState::Failed) // couldnt do job? -> move to back of list { @@ -141,7 +141,7 @@ std::unique_ptr AIConstruction::getBuildJob() return job; } -void AIConstruction::AddConnectFlagJob(const noFlag* flag) +void AIConstruction::addConnectFlagJob(const noFlag* flag) { // already in list? for(auto& connectJob : connectJobs) @@ -157,13 +157,13 @@ bool AIConstruction::canStillConstructHere(const MapPoint pt) const { for(const auto& constructionlocation : constructionlocations) { - if(aii.gwb.CalcDistance(pt, constructionlocation) < 12) + if(aii.gwb.calcDistance(pt, constructionlocation) < 12) return false; } return true; } -void AIConstruction::ConstructionOrdered(const BuildJob& job) +void AIConstruction::constructionOrdered(const BuildJob& job) { RTTR_Assert(job.getTarget().isValid()); // add new construction area to the list of active orders in the current nwf @@ -171,7 +171,7 @@ void AIConstruction::ConstructionOrdered(const BuildJob& job) constructionorders[job.getType()]++; } -void AIConstruction::ConstructionsExecuted() +void AIConstruction::constructionsExecuted() { constructionlocations.clear(); std::fill(constructionorders.begin(), constructionorders.end(), 0u); @@ -193,7 +193,7 @@ namespace { }; } // namespace -std::vector AIConstruction::FindFlags(const MapPoint pt, unsigned short radius) +std::vector AIConstruction::findFlags(const MapPoint pt, unsigned short radius) { std::vector flags = aii.gwb.getPointsInRadius<30>(pt, radius, Point2FlagAI(aii.gwb), IsValidFlag(aii.getPlayerId())); @@ -231,7 +231,7 @@ std::vector AIConstruction::FindFlags(const MapPoint pt, unsigned return flags; } -bool AIConstruction::MilitaryBuildingWantsRoad(const nobMilitary& milbld) +bool AIConstruction::militaryBuildingWantsRoad(const nobMilitary& milbld) { if(milbld.getFrontierDistance() != FrontierDistance::Far) // close to front or harbor? connect! return true; @@ -246,7 +246,7 @@ bool AIConstruction::MilitaryBuildingWantsRoad(const nobMilitary& milbld) > static_cast(aii.getMilitaryBuildings().size() - aijh.getNumPlannedConnectedInlandMilitaryBlds()); } -bool AIConstruction::ConnectFlagToRoadSytem(const noFlag* flag, std::vector& route, +bool AIConstruction::connectFlagToRoadSytem(const noFlag* flag, std::vector& route, unsigned maxSearchRadius /*= 14*/) { // TODO: die methode kann ganz schön böse Laufzeiten bekommen... Optimieren? @@ -258,19 +258,19 @@ bool AIConstruction::ConnectFlagToRoadSytem(const noFlag* flag, std::vectorgetPos(), Direction::NorthWest); if(const auto* milBld = aii.gwb.getSpecObj(bldPos)) { - if(!MilitaryBuildingWantsRoad(*milBld)) + if(!militaryBuildingWantsRoad(*milBld)) return false; } // Ziel, das möglichst schnell erreichbar sein soll // noFlag *targetFlag = gwb->GetSpecObj(player->hqPos)->GetFlag(); - noFlag* targetFlag = FindTargetStoreHouseFlag(flag->getPos()); + noFlag* targetFlag = findTargetStoreHouseFlag(flag->getPos()); // Falls kein Lager mehr vorhanden ist, brauchen wir auch keinen Weg suchen if(!targetFlag) return false; // Flaggen in der Umgebung holen - std::vector flags = FindFlags(flag->getPos(), maxSearchRadius); + std::vector flags = findFlags(flag->getPos(), maxSearchRadius); #ifdef DEBUG_AI std::cout << "FindFlagsNum: " << flags.size() << std::endl; @@ -289,7 +289,7 @@ bool AIConstruction::ConnectFlagToRoadSytem(const noFlag* flag, std::vectorgetPos(), Direction::NorthWest), true)) continue; // Gibts überhaupt einen Pfad zu dieser Flagge - if(!aii.FindFreePathForNewRoad(flag->getPos(), curFlag->getPos(), &tmpRoute, &length)) + if(!aii.findFreePathForNewRoad(flag->getPos(), curFlag->getPos(), &tmpRoute, &length)) continue; // Wenn ja, dann gucken ob dieser Pfad möglichst kurz zum "höheren" Ziel (allgemeines Lager im Moment) ist @@ -317,14 +317,14 @@ bool AIConstruction::ConnectFlagToRoadSytem(const noFlag* flag, std::vectorGetPlayer(), flag->GetPos()); - if(!MinorRoadImprovements(flag, shortest, route)) + if(!minorRoadImprovements(flag, shortest, route)) return false; // add new construction area to the list of active orders in the current nwf // to wait till path is constructed @@ -351,7 +351,7 @@ bool AIConstruction::ConnectFlagToRoadSytem(const noFlag* flag, std::vector& route) { return BuildRoad(start, target, route); @@ -370,7 +370,7 @@ bool AIConstruction::MinorRoadImprovements(const noRoadNode* start, const noRoad if(aii.gwb.isRoadAvailable(false, t) && aii.isOwnTerritory(t)) { // does the alternative road block a lower buildingquality point than the normal planned route? - if(aii.CalcBQSumDifference(pStart, t)) + if(aii.calcBQSumDifference(pStart, t)) { // LOG.write(("AIConstruction::road improvements p%i from %i,%i moved node %i,%i to %i,%i i:%i, // i+1:%i\n",playerID, start->GetX(), start->GetY(), ptx, pt.y, t.x, t.y,route[i],route[i+1]); @@ -392,7 +392,7 @@ bool AIConstruction::BuildRoad(const noRoadNode* start, const noRoadNode* target // Gucken obs einen Weg gibt if(route.empty()) { - foundPath = aii.FindFreePathForNewRoad(start->getPos(), target->getPos(), &route); + foundPath = aii.findFreePathForNewRoad(start->getPos(), target->getPos(), &route); } else { // Wenn Route übergeben wurde, davon ausgehen dass diese auch existiert @@ -422,9 +422,9 @@ bool AIConstruction::BuildRoad(const noRoadNode* start, const noRoadNode* target bool AIConstruction::isConnectedToRoadSystem(const noFlag* flag) const { - noFlag* targetFlag = FindTargetStoreHouseFlag(flag->getPos()); + noFlag* targetFlag = findTargetStoreHouseFlag(flag->getPos()); if(targetFlag) - return (targetFlag == flag) || aii.FindPathOnRoads(*flag, *targetFlag); + return (targetFlag == flag) || aii.findPathOnRoads(*flag, *targetFlag); else return false; } @@ -449,7 +449,7 @@ helpers::OptionalEnum AIConstruction::getBiggestAllowedMilBuilding return std::nullopt; } -helpers::OptionalEnum AIConstruction::ChooseMilitaryBuilding(const MapPoint pt) +helpers::OptionalEnum AIConstruction::chooseMilitaryBuilding(const MapPoint pt) { // default : 2 barracks for each guardhouse // stones & low soldiers -> only guardhouse (no stones -> only barracks) @@ -478,7 +478,7 @@ helpers::OptionalEnum AIConstruction::ChooseMilitaryBuilding(const } if(biggestBld == BuildingType::Watchtower || biggestBld == BuildingType::Fortress) { - if(!aijh.UpdateUpgradeBuilding() && bldPlanner.getNumBuildingSites(biggestBld) < 1 + if(!aijh.updateUpgradeBuilding() && bldPlanner.getNumBuildingSites(biggestBld) < 1 && (inventory.goods[GoodType::Stones] > 20 || bldPlanner.getNumBuildings(BuildingType::Quarry) > 0) && !AI::randomChance(10)) { @@ -487,10 +487,10 @@ helpers::OptionalEnum AIConstruction::ChooseMilitaryBuilding(const } uint8_t playerId = aii.getPlayerId(); - sortedMilitaryBlds military = aii.gwb.LookForMilitaryBuildings(pt, 3); + sortedMilitaryBlds military = aii.gwb.lookForMilitaryBuildings(pt, 3); for(const nobBaseMilitary* milBld : military) { - const unsigned distance = aii.gwb.CalcDistance(milBld->getPos(), pt); + const unsigned distance = aii.gwb.calcDistance(milBld->getPos(), pt); // Check for close enemy if(milBld->getPlayer() != playerId && distance < 35) @@ -499,13 +499,13 @@ helpers::OptionalEnum AIConstruction::ChooseMilitaryBuilding(const && bldPlanner.getNumAdditionalBuildingsWanted(BuildingType::Catapult) > 0; // another catapult within this radius? ->dont build here! constexpr unsigned minCatapultDist = 16; - if(buildCatapult && aii.gwb.CalcDistance(pt, aii.getStorehouses().front()->getPos()) < minCatapultDist) + if(buildCatapult && aii.gwb.calcDistance(pt, aii.getStorehouses().front()->getPos()) < minCatapultDist) buildCatapult = false; if(buildCatapult) { for(const nobUsual* catapult : aii.getBuildings(BuildingType::Catapult)) { - if(aii.gwb.CalcDistance(pt, catapult->getPos()) < minCatapultDist) + if(aii.gwb.calcDistance(pt, catapult->getPos()) < minCatapultDist) { buildCatapult = false; break; @@ -517,7 +517,7 @@ helpers::OptionalEnum AIConstruction::ChooseMilitaryBuilding(const for(const noBuildingSite* bldSite : aii.getBuildingSites()) { if(bldSite->getBuildingType() == bld - && aii.gwb.CalcDistance(pt, bldSite->getPos()) < minCatapultDist) + && aii.gwb.calcDistance(pt, bldSite->getPos()) < minCatapultDist) { buildCatapult = false; break; @@ -551,23 +551,23 @@ helpers::OptionalEnum AIConstruction::ChooseMilitaryBuilding(const return bld; } -bool AIConstruction::Wanted(BuildingType type) const +bool AIConstruction::wanted(BuildingType type) const { if(!aii.canBuildBuildingtype(type)) return false; if(type == BuildingType::Catapult && !aii.canBuildCatapult()) return false; if(BuildingProperties::isMilitary(type) || type == BuildingType::Storehouse) - return bldPlanner.WantMoreMilitaryBlds(aijh); + return bldPlanner.wantMoreMilitaryBlds(aijh); if(type == BuildingType::Sawmill && bldPlanner.getNumBuildings(BuildingType::Sawmill) > 1) { - if(aijh.AmountInStorage(GoodType::Wood) < 15 * (bldPlanner.getNumBuildingSites(BuildingType::Sawmill) + 1)) + if(aijh.amountInStorage(GoodType::Wood) < 15 * (bldPlanner.getNumBuildingSites(BuildingType::Sawmill) + 1)) return false; } return constructionorders[type] < bldPlanner.getNumAdditionalBuildingsWanted(type); } -bool AIConstruction::BuildAlternativeRoad(const noFlag* flag, std::vector& route) +bool AIConstruction::buildAlternativeRoad(const noFlag* flag, std::vector& route) { // LOG.write(("ai build alt road player %i at %i %i\n", flag->GetPlayer(), flag->GetPos()); // Radius in dem nach würdigen Fahnen gesucht wird @@ -576,7 +576,7 @@ bool AIConstruction::BuildAlternativeRoad(const noFlag* flag, std::vector flags = FindFlags(flag->getPos(), maxRoadLength); + std::vector flags = findFlags(flag->getPos(), maxRoadLength); std::vector mainroad = route; // targetflag for mainroad MapPoint t = flag->getPos(); @@ -605,7 +605,7 @@ bool AIConstruction::BuildAlternativeRoad(const noFlag* flag, std::vectorgetPos(), curFlag.getPos(), &route, &newLength)) + if(!aii.findFreePathForNewRoad(flag->getPos(), curFlag.getPos(), &route, &newLength)) continue; // Wenn ja, dann gucken ob unser momentaner Weg zu dieser Flagge vielleicht voll weit ist und sich eine Straße @@ -613,10 +613,10 @@ bool AIConstruction::BuildAlternativeRoad(const noFlag* flag, std::vectorgetPos(), pt) < radius) + if(aii.gwb.calcDistance(bld->getPos(), pt) < radius) return true; } for(const noBuildingSite* bldSite : aii.getBuildingSites()) { if(bldSite->getBuildingType() == bt) { - if(aii.gwb.CalcDistance(bldSite->getPos(), pt) < radius) + if(aii.gwb.calcDistance(bldSite->getPos(), pt) < radius) return true; } } return false; } -bool AIConstruction::OtherStoreInRadius(MapPoint pt, unsigned radius) +bool AIConstruction::otherStoreInRadius(MapPoint pt, unsigned radius) { for(const nobBaseWarehouse* wh : aii.getStorehouses()) { - if(aii.gwb.CalcDistance(wh->getPos(), pt) < radius) + if(aii.gwb.calcDistance(wh->getPos(), pt) < radius) return true; } for(const noBuildingSite* bldSite : aii.getBuildingSites()) { if(BuildingProperties::isWareHouse(bldSite->getBuildingType())) { - if(aii.gwb.CalcDistance(bldSite->getPos(), pt) < radius) + if(aii.gwb.calcDistance(bldSite->getPos(), pt) < radius) return true; } } return false; } -noFlag* AIConstruction::FindTargetStoreHouseFlag(const MapPoint pt) const +noFlag* AIConstruction::findTargetStoreHouseFlag(const MapPoint pt) const { unsigned minDistance = std::numeric_limits::max(); const nobBaseWarehouse* minTarget = nullptr; for(const nobBaseWarehouse* wh : aii.getStorehouses()) { - unsigned dist = aii.gwb.CalcDistance(pt, wh->getPos()); + unsigned dist = aii.gwb.calcDistance(pt, wh->getPos()); if(dist < minDistance) { minDistance = dist; diff --git a/libs/s25main/ai/aijh/AIConstruction.h b/libs/s25main/ai/aijh/AIConstruction.h index 2ecb41c933..7d03205ea6 100644 --- a/libs/s25main/ai/aijh/AIConstruction.h +++ b/libs/s25main/ai/aijh/AIConstruction.h @@ -35,54 +35,54 @@ class AIConstruction ~AIConstruction(); /// Adds a build job to the queue - void AddBuildJob(std::unique_ptr job, bool front); + void addBuildJob(std::unique_ptr job, bool front); std::unique_ptr getBuildJob(); unsigned getBuildJobNum() const { return buildJobs.size(); } unsigned getConnectJobNum() const { return connectJobs.size(); } - void AddConnectFlagJob(const noFlag* flag); + void addConnectFlagJob(const noFlag* flag); - bool BuildJobAvailable() const { return !buildJobs.empty(); } + bool buildJobAvailable() const { return !buildJobs.empty(); } /// Finds flags in the area around pt - std::vector FindFlags(MapPoint pt, unsigned short radius); + std::vector findFlags(MapPoint pt, unsigned short radius); /// returns true if the military building should be connected to the roadsystem - bool MilitaryBuildingWantsRoad(const nobMilitary& milbld); + bool militaryBuildingWantsRoad(const nobMilitary& milbld); /// Connects a specific flag to a roadsystem nearby and returns true if succesful. Also returns the route of the /// future road. - bool ConnectFlagToRoadSytem(const noFlag* flag, std::vector& route, unsigned maxSearchRadius = 14); + bool connectFlagToRoadSytem(const noFlag* flag, std::vector& route, unsigned maxSearchRadius = 14); /// Builds a street between two roadnodes and sets flags on it, if route is empty, it will be calculated bool BuildRoad(const noRoadNode* start, const noRoadNode* target, std::vector& route); /// whenever a given route contains 2 segment alternatives these get tested for their buildquality and the one with /// the lower bq is picked for the final path - bool MinorRoadImprovements(const noRoadNode* start, const noRoadNode* target, std::vector& route); + bool minorRoadImprovements(const noRoadNode* start, const noRoadNode* target, std::vector& route); /// Checks whether a flag is connected to the road system or not (connected = has path to HQ) bool isConnectedToRoadSystem(const noFlag* flag) const; helpers::OptionalEnum getSmallestAllowedMilBuilding() const; helpers::OptionalEnum getBiggestAllowedMilBuilding() const; /// Randomly chooses a military building, preferring bigger buildings if enemy nearby - helpers::OptionalEnum ChooseMilitaryBuilding(MapPoint pt); + helpers::OptionalEnum chooseMilitaryBuilding(MapPoint pt); /// Checks whether a building type is wanted atm - bool Wanted(BuildingType type) const; + bool wanted(BuildingType type) const; /// Tries to build a second road to a flag, which is in any way better than the first one - bool BuildAlternativeRoad(const noFlag* flag, std::vector& route); + bool buildAlternativeRoad(const noFlag* flag, std::vector& route); - bool OtherStoreInRadius(MapPoint pt, unsigned radius); + bool otherStoreInRadius(MapPoint pt, unsigned radius); - bool OtherUsualBuildingInRadius(MapPoint pt, unsigned radius, BuildingType bt); + bool otherUsualBuildingInRadius(MapPoint pt, unsigned radius, BuildingType bt); - noFlag* FindTargetStoreHouseFlag(MapPoint pt) const; + noFlag* findTargetStoreHouseFlag(MapPoint pt) const; bool canStillConstructHere(MapPoint pt) const; - void ExecuteJobs(unsigned limit); + void executeJobs(unsigned limit); /// Set flags along the road starting at the given node in the given direction void setFlagsAlongRoad(const noRoadNode& roadNode, Direction dir); /// To be called after a new construction site was added - void ConstructionOrdered(const BuildJob& job); + void constructionOrdered(const BuildJob& job); /// To be called when the current pending construction orders were processed (usually on NWF) - void ConstructionsExecuted(); + void constructionsExecuted(); private: AIPlayerJH& aijh; diff --git a/libs/s25main/ai/aijh/AIPlayerJH.cpp b/libs/s25main/ai/aijh/AIPlayerJH.cpp index df2b70fa04..2fd459f075 100644 --- a/libs/s25main/ai/aijh/AIPlayerJH.cpp +++ b/libs/s25main/ai/aijh/AIPlayerJH.cpp @@ -76,34 +76,34 @@ void HandleBuildingNote(AIEventManager& eventMgr, const BuildingNote& note) break; default: RTTR_Assert(false); return; } - eventMgr.AddAIEvent(std::move(ev)); + eventMgr.addAIEvent(std::move(ev)); } void HandleExpeditionNote(AIEventManager& eventMgr, const ExpeditionNote& note) { switch(note.type) { case ExpeditionNote::Waiting: - eventMgr.AddAIEvent(std::make_unique(AIEvent::EventType::ExpeditionWaiting, note.pos)); + eventMgr.addAIEvent(std::make_unique(AIEvent::EventType::ExpeditionWaiting, note.pos)); break; case ExpeditionNote::ColonyFounded: - eventMgr.AddAIEvent(std::make_unique(AIEvent::EventType::NewColonyFounded, note.pos)); + eventMgr.addAIEvent(std::make_unique(AIEvent::EventType::NewColonyFounded, note.pos)); break; } } void HandleResourceNote(AIEventManager& eventMgr, const ResourceNote& note) { - eventMgr.AddAIEvent(std::make_unique(AIEvent::EventType::ResourceFound, note.pos, note.res)); + eventMgr.addAIEvent(std::make_unique(AIEvent::EventType::ResourceFound, note.pos, note.res)); } void HandleRoadNote(AIEventManager& eventMgr, const RoadNote& note) { switch(note.type) { case RoadNote::Constructed: - eventMgr.AddAIEvent(std::make_unique(AIEvent::EventType::RoadConstructionComplete, + eventMgr.addAIEvent(std::make_unique(AIEvent::EventType::RoadConstructionComplete, note.pos, note.route.front())); break; case RoadNote::ConstructionFailed: - eventMgr.AddAIEvent(std::make_unique(AIEvent::EventType::RoadConstructionFailed, + eventMgr.addAIEvent(std::make_unique(AIEvent::EventType::RoadConstructionFailed, note.pos, note.route.front())); break; } @@ -111,7 +111,7 @@ void HandleRoadNote(AIEventManager& eventMgr, const RoadNote& note) void HandleShipNote(AIEventManager& eventMgr, const ShipNote& note) { if(note.type == ShipNote::Constructed) - eventMgr.AddAIEvent(std::make_unique(AIEvent::EventType::ShipBuilt, note.pos)); + eventMgr.addAIEvent(std::make_unique(AIEvent::EventType::ShipBuilt, note.pos)); } } // namespace @@ -127,12 +127,12 @@ Subscription recordBQsToUpdate(const GameWorldBase& gw, std::vector& b if(note.type == NodeNote::BQ) { // Need to check surrounding nodes for possible/impossible flags (e.g. near border) - gw.CheckPointsInRadius(note.pos, 1, addToBqsToUpdate, true); + gw.checkPointsInRadius(note.pos, 1, addToBqsToUpdate, true); } else if(note.type == NodeNote::Owner) { // Owner changes border, which changes where buildings can be placed next to it // And as flags are need for buildings we need range 2 (e.g. range 1 is flag, range 2 building) - gw.CheckPointsInRadius(note.pos, 2, addToBqsToUpdate, true); + gw.checkPointsInRadius(note.pos, 2, addToBqsToUpdate, true); } }); } @@ -163,14 +163,14 @@ static auto createResourceMaps(const AIInterface& aii, const AIMap& aiMap) } AIPlayerJH::AIPlayerJH(const unsigned char playerId, const GameWorldBase& gwb, const AI::Level level) - : AIPlayer(playerId, gwb, level), UpgradeBldPos(MapPoint::Invalid()), resourceMaps(createResourceMaps(aii, aiMap)), + : AIPlayer(playerId, gwb, level), UpgradeBldPos(MapPoint::invalid()), resourceMaps(createResourceMaps(aii, aiMap)), isInitGfCompleted(false), defeated(player.IsDefeated()), bldPlanner(std::make_unique(*this)), construction(std::make_unique(*this)) { - InitNodes(); - InitResourceMaps(); + initNodes(); + initResourceMaps(); #ifdef DEBUG_AI - SaveResourceMapsToFile(); + saveResourceMapsToFile(); #endif switch(level) @@ -217,17 +217,17 @@ AIPlayerJH::AIPlayerJH(const unsigned char playerId, const GameWorldBase& gwb, c AIPlayerJH::~AIPlayerJH() = default; /// Wird jeden GF aufgerufen und die KI kann hier entsprechende Handlungen vollziehen -void AIPlayerJH::RunGF(const unsigned gf, bool gfisnwf) +void AIPlayerJH::runGF(const unsigned gf, bool gfisnwf) { if(defeated) return; - if(TestDefeat()) + if(testDefeat()) return; if(!isInitGfCompleted) { - InitStoreAndMilitarylists(); - InitDistribution(); + initStoreAndMilitarylists(); + initDistribution(); } if(isInitGfCompleted < 10) { @@ -237,7 +237,7 @@ void AIPlayerJH::RunGF(const unsigned gf, bool gfisnwf) if(gf == 100) { if(aii.getMilitaryBuildings().empty() && aii.getStorehouses().size() < 2) - aii.Chat(_("Hi, I'm an artifical player and I'm not very good yet!")); + aii.chat(_("Hi, I'm an artifical player and I'm not very good yet!")); } if(!nodesWithOutdatedBQ.empty()) @@ -248,42 +248,42 @@ void AIPlayerJH::RunGF(const unsigned gf, bool gfisnwf) nodesWithOutdatedBQ.clear(); } - bldPlanner->Update(gf, *this); + bldPlanner->update(gf, *this); if(gfisnwf) // nwf -> now the orders have been executed -> new constructions can be started - construction->ConstructionsExecuted(); + construction->constructionsExecuted(); // LOG.write(("ai doing stuff %i \n",playerId); if(gf % 100 == 0) - bldPlanner->UpdateBuildingsWanted(*this); - ExecuteAIJob(); + bldPlanner->updateBuildingsWanted(*this); + executeAIJob(); if((gf + playerId * 17) % attack_interval == 0) { // CheckExistingMilitaryBuildings(); - TryToAttack(); + tryToAttack(); } if(((gf + playerId * 17) % 73 == 0) && (level != AI::Level::Easy)) { - MilUpgradeOptim(); + milUpgradeOptim(); } if((gf + 41 + playerId * 17) % attack_interval == 0) { if(ggs.isEnabled(AddonId::SEA_ATTACK)) - TrySeaAttack(); + trySeaAttack(); } if((gf + playerId * 13) % 1500 == 0) { - CheckExpeditions(); - CheckForester(); - CheckGranitMine(); + checkExpeditions(); + checkForester(); + checkGranitMine(); } if((gf + playerId * 11) % 150 == 0) { - AdjustSettings(); + adjustSettings(); // check for useless sawmills const std::list& sawMills = aii.getBuildings(BuildingType::Sawmill); if(sawMills.size() > 3) @@ -292,10 +292,10 @@ void AIPlayerJH::RunGF(const unsigned gf, bool gfisnwf) for(const nobUsual* sawmill : sawMills) { if(sawmill->getProductivity() < 1 && sawmill->hasWorker() && sawmill->getNumWares(0) < 1 - && (sawMills.size() - burns) > 3 && !sawmill->AreThereAnyOrderedWares()) + && (sawMills.size() - burns) > 3 && !sawmill->areThereAnyOrderedWares()) { aii.DestroyBuilding(sawmill); - RemoveUnusedRoad(*sawmill->getFlag(), Direction::NorthWest, true); + removeUnusedRoad(*sawmill->getFlag(), Direction::NorthWest, true); burns++; } } @@ -304,16 +304,16 @@ void AIPlayerJH::RunGF(const unsigned gf, bool gfisnwf) if((gf + playerId * 7) % build_interval == 0) // plan new buildings { - CheckForUnconnectedBuildingSites(); - PlanNewBuildings(gf); + checkForUnconnectedBuildingSites(); + planNewBuildings(gf); } } -void AIPlayerJH::OnChatMessage(unsigned /*sendPlayerId*/, ChatDestination, const std::string& /*msg*/) {} +void AIPlayerJH::onChatMessage(unsigned /*sendPlayerId*/, ChatDestination, const std::string& /*msg*/) {} -void AIPlayerJH::PlanNewBuildings(const unsigned gf) +void AIPlayerJH::planNewBuildings(const unsigned gf) { - bldPlanner->UpdateBuildingsWanted(*this); + bldPlanner->updateBuildingsWanted(*this); // pick a random storehouse and try to build one of these buildings around it (checks if we actually want more of // the building type) @@ -340,24 +340,24 @@ void AIPlayerJH::PlanNewBuildings(const unsigned gf) setGatheringForUpgradeWarehouse(wh); if(ggs.getMaxMilitaryRank() > 0) // there is more than 1 rank available -> distribute - DistributeMaxRankSoldiersByBlocking(5, wh); + distributeMaxRankSoldiersByBlocking(5, wh); // 30 boards amd 50 stones for each warehouse - block after that - should speed up expansion and limit losses in // case a warehouse is destroyed unlimited when every warehouse has at least that amount - DistributeGoodsByBlocking(GoodType::Boards, 30); - DistributeGoodsByBlocking(GoodType::Stones, 50); + distributeGoodsByBlocking(GoodType::Boards, 30); + distributeGoodsByBlocking(GoodType::Stones, 50); // go to the picked random warehouse and try to build around it const auto* storehouse = AI::randomElement(storehouses); const MapPoint whPos = storehouse->getPos(); - UpdateNodesAround(whPos, 15); // update the area we want to build in first + updateNodesAround(whPos, 15); // update the area we want to build in first for(const BuildingType i : bldToTest) { - if(construction->Wanted(i)) + if(construction->wanted(i)) { - AddBuildJobAroundEveryWarehouse(i); // add a buildorder for the picked buildingtype at every warehouse + addBuildJobAroundEveryWarehouse(i); // add a buildorder for the picked buildingtype at every warehouse } } if(gf > 1500 || aii.getInventory().goods[GoodType::Boards] > 11) - AddMilitaryBuildJob(whPos); + addMilitaryBuildJob(whPos); } // end of construction around & orders for warehouses @@ -367,30 +367,30 @@ void AIPlayerJH::PlanNewBuildings(const unsigned gf) return; const auto* randomMiliBld = AI::randomElement(militaryBuildings); MapPoint bldPos = randomMiliBld->getPos(); - UpdateNodesAround(bldPos, 15); + updateNodesAround(bldPos, 15); // resource gathering buildings only around military; processing only close to warehouses for(unsigned i = 0; i < numResGatherBlds; i++) { - if(construction->Wanted(bldToTest[i])) + if(construction->wanted(bldToTest[i])) { - AddBuildJobAroundEveryMilBld(bldToTest[i]); + addBuildJobAroundEveryMilBld(bldToTest[i]); } } - AddMilitaryBuildJob(bldPos); - if(randomMiliBld->isUseless() && randomMiliBld->isDemolitionAllowed() && randomMiliBld != UpdateUpgradeBuilding()) + addMilitaryBuildJob(bldPos); + if(randomMiliBld->isUseless() && randomMiliBld->isDemolitionAllowed() && randomMiliBld != updateUpgradeBuilding()) { aii.DestroyBuilding(bldPos); } } -bool AIPlayerJH::TestDefeat() +bool AIPlayerJH::testDefeat() { if(isInitGfCompleted >= 10 && aii.getStorehouses().empty()) { // LOG.write(("ai defeated player %i \n",playerId); defeated = true; aii.Surrender(); - aii.Chat(_("You win")); + aii.chat(_("You win")); return true; } return false; @@ -408,45 +408,45 @@ nobBaseWarehouse* AIPlayerJH::getUpgradeBuildingWarehouse() const std::list& storehouses = aii.getStorehouses(); if(storehouses.empty()) return nullptr; - const auto* upgradeBld = UpdateUpgradeBuilding(); + const auto* upgradeBld = updateUpgradeBuilding(); if(upgradeBld) // upgrade building exists -> find warehouse closest to the upgrade building, // gather stuff there and deactivate gathering in the previous one { // which warehouse is closest to the upgrade building? -> train troops there and block max ranks - auto* wh = aii.FindWarehouse(*upgradeBld, FW::NoCondition(), false, false); + auto* wh = aii.findWarehouse(*upgradeBld, FW::NoCondition(), false, false); if(wh) return wh; } return storehouses.front(); } -void AIPlayerJH::AddMilitaryBuildJob(MapPoint pt) +void AIPlayerJH::addMilitaryBuildJob(MapPoint pt) { - const auto milBld = construction->ChooseMilitaryBuilding(pt); + const auto milBld = construction->chooseMilitaryBuilding(pt); if(milBld) - AddBuildJob(*milBld, pt); + addBuildJob(*milBld, pt); } -void AIPlayerJH::AddBuildJob(BuildingType type, const MapPoint pt, bool front, bool searchPosition) +void AIPlayerJH::addBuildJob(BuildingType type, const MapPoint pt, bool front, bool searchPosition) { - construction->AddBuildJob( + construction->addBuildJob( std::make_unique(*this, type, pt, searchPosition ? SearchMode::Radius : SearchMode::None), front); } -void AIPlayerJH::AddBuildJobAroundEveryWarehouse(BuildingType bt) +void AIPlayerJH::addBuildJobAroundEveryWarehouse(BuildingType bt) { for(const nobBaseWarehouse* wh : aii.getStorehouses()) { - AddBuildJob(bt, wh->getPos(), false); + addBuildJob(bt, wh->getPos(), false); } } -void AIPlayerJH::AddBuildJobAroundEveryMilBld(BuildingType bt) +void AIPlayerJH::addBuildJobAroundEveryMilBld(BuildingType bt) { for(const nobMilitary* milBld : aii.getMilitaryBuildings()) { - AddBuildJob(bt, milBld->getPos(), false); + addBuildJob(bt, milBld->getPos(), false); } } @@ -505,7 +505,7 @@ void AIPlayerJH::setGatheringForUpgradeWarehouse(nobBaseWarehouse* upgradewareho } } -AINodeResource AIPlayerJH::CalcResource(MapPoint pt) +AINodeResource AIPlayerJH::calcResource(MapPoint pt) { const AISubSurfaceResource subRes = aii.getSubsurfaceResource(pt); const AISurfaceResource surfRes = aii.getSurfaceResource(pt); @@ -538,7 +538,7 @@ AINodeResource AIPlayerJH::CalcResource(MapPoint pt) } } -void AIPlayerJH::InitReachableNodes() +void AIPlayerJH::initReachableNodes() { std::queue toCheck; @@ -556,10 +556,10 @@ void AIPlayerJH::InitReachableNodes() } } - IterativeReachableNodeChecker(toCheck); + iterativeReachableNodeChecker(toCheck); } -void AIPlayerJH::IterativeReachableNodeChecker(std::queue toCheck) +void AIPlayerJH::iterativeReachableNodeChecker(std::queue toCheck) { // TODO auch mal bootswege bauen können @@ -595,7 +595,7 @@ void AIPlayerJH::IterativeReachableNodeChecker(std::queue toCheck) } } -void AIPlayerJH::UpdateReachableNodes(const std::vector& pts) +void AIPlayerJH::updateReachableNodes(const std::vector& pts) { std::queue toCheck; @@ -609,31 +609,31 @@ void AIPlayerJH::UpdateReachableNodes(const std::vector& pts) } else aiMap[curPt].reachable = false; } - IterativeReachableNodeChecker(toCheck); + iterativeReachableNodeChecker(toCheck); } -void AIPlayerJH::InitNodes() +void AIPlayerJH::initNodes() { - aiMap.Resize(gwb.getSize()); + aiMap.resize(gwb.getSize()); - InitReachableNodes(); + initReachableNodes(); RTTR_FOREACH_PT(MapPoint, aiMap.getSize()) { Node& node = aiMap[pt]; node.bq = aii.getBuildingQuality(pt); - node.res = CalcResource(pt); + node.res = calcResource(pt); node.owned = aii.isOwnTerritory(pt); node.border = aii.isBorder(pt); node.farmed = false; } } -void AIPlayerJH::UpdateNodesAround(const MapPoint pt, unsigned radius) +void AIPlayerJH::updateNodesAround(const MapPoint pt, unsigned radius) { std::vector pts = gwb.getPointsInRadius(pt, radius); - UpdateReachableNodes(pts); + updateReachableNodes(pts); for(const MapPoint& pt : pts) { Node& node = aiMap[pt]; @@ -644,7 +644,7 @@ void AIPlayerJH::UpdateNodesAround(const MapPoint pt, unsigned radius) } } -void AIPlayerJH::InitResourceMaps() +void AIPlayerJH::initResourceMaps() { for(auto& resMap : resourceMaps) resMap.init(); @@ -661,14 +661,14 @@ void AIPlayerJH::setFarmedNodes(const MapPoint pt, bool set) aiMap[curPt].farmed = set; } -MapPoint AIPlayerJH::FindBestPosition(const MapPoint& pt, AIResource res, BuildingQuality size, unsigned radius, +MapPoint AIPlayerJH::findBestPosition(const MapPoint& pt, AIResource res, BuildingQuality size, unsigned radius, int minimum) { resourceMaps[res].updateAround(pt, radius); return resourceMaps[res].findBestPosition(pt, size, radius, minimum); } -void AIPlayerJH::ExecuteAIJob() +void AIPlayerJH::executeAIJob() { // Check whether current job is finished... /*if (currentJob) @@ -692,12 +692,12 @@ void AIPlayerJH::ExecuteAIJob() } }*/ unsigned quota = 10; // limit the amount of events to handle - while(eventManager.EventAvailable() + while(eventManager.eventAvailable() && quota) // handle all new events - some will add new orders but they can all be handled instantly { quota--; currentJob = std::make_unique(*this, eventManager.getEvent()); - currentJob->ExecuteJob(); + currentJob->executeJob(); } // how many construction & connect jobs the ai will attempt every gf, the ai gets new orders from events and every // 200 gf @@ -705,7 +705,7 @@ void AIPlayerJH::ExecuteAIJob() if(quota > 40) quota = 40; - construction->ExecuteJobs(quota); // try to execute up to quota connect & construction jobs + construction->executeJobs(quota); // try to execute up to quota connect & construction jobs /* // if no current job available, take next one! events first, then constructions if (!currentJob) @@ -721,7 +721,7 @@ void AIPlayerJH::ExecuteAIJob() */ } -void AIPlayerJH::DistributeGoodsByBlocking(const GoodType good, unsigned limit) +void AIPlayerJH::distributeGoodsByBlocking(const GoodType good, unsigned limit) { const std::list& storehouses = aii.getStorehouses(); if(aii.getHarbors().size() >= storehouses.size() / 2) @@ -732,7 +732,7 @@ void AIPlayerJH::DistributeGoodsByBlocking(const GoodType good, unsigned limit) { if(wh->isInventorySetting(good, EInventorySetting::Stop)) // not unblocked then issue command to unblock aii.SetInventorySetting(wh->getPos(), good, - wh->getInventorySetting(good).Toggle(EInventorySetting::Stop)); + wh->getInventorySetting(good).toggle(EInventorySetting::Stop)); } return; } @@ -746,7 +746,7 @@ void AIPlayerJH::DistributeGoodsByBlocking(const GoodType good, unsigned limit) bool foundConnectedWh = false; for(std::vector& whGroup : whsByReachability) { - if(aii.FindPathOnRoads(*wh, *whGroup.front())) + if(aii.findPathOnRoads(*wh, *whGroup.front())) { whGroup.push_back(wh); foundConnectedWh = true; @@ -778,7 +778,7 @@ void AIPlayerJH::DistributeGoodsByBlocking(const GoodType good, unsigned limit) { if(wh->isInventorySetting(good, EInventorySetting::Stop)) // not unblocked then issue command to unblock aii.SetInventorySetting(wh->getPos(), good, - wh->getInventorySetting(good).Toggle(EInventorySetting::Stop)); + wh->getInventorySetting(good).toggle(EInventorySetting::Stop)); } } else { @@ -790,20 +790,20 @@ void AIPlayerJH::DistributeGoodsByBlocking(const GoodType good, unsigned limit) if(wh->isInventorySetting(good, EInventorySetting::Stop)) // not unblocked then issue command to unblock aii.SetInventorySetting(wh->getPos(), good, - wh->getInventorySetting(good).Toggle(EInventorySetting::Stop)); + wh->getInventorySetting(good).toggle(EInventorySetting::Stop)); } else // at limit - block it { if(!wh->isInventorySetting(good, EInventorySetting::Stop)) // not blocked then issue command to block aii.SetInventorySetting(wh->getPos(), good, - wh->getInventorySetting(good).Toggle(EInventorySetting::Stop)); + wh->getInventorySetting(good).toggle(EInventorySetting::Stop)); } } } } } -void AIPlayerJH::DistributeMaxRankSoldiersByBlocking(unsigned limit, nobBaseWarehouse* upwh) +void AIPlayerJH::distributeMaxRankSoldiersByBlocking(unsigned limit, nobBaseWarehouse* upwh) { const std::list& storehouses = aii.getStorehouses(); unsigned numCompleteWh = storehouses.size(); @@ -818,7 +818,7 @@ void AIPlayerJH::DistributeMaxRankSoldiersByBlocking(unsigned limit, nobBaseWare nobBaseWarehouse& wh = *storehouses.front(); if(wh.isInventorySetting(maxRankJob, EInventorySetting::Stop)) aii.SetInventorySetting(wh.getPos(), maxRankJob, - wh.getInventorySetting(maxRankJob).Toggle(EInventorySetting::Stop)); + wh.getInventorySetting(maxRankJob).toggle(EInventorySetting::Stop)); return; } // rest applies for at least 2 complete warehouses! @@ -834,7 +834,7 @@ void AIPlayerJH::DistributeMaxRankSoldiersByBlocking(unsigned limit, nobBaseWare { for(const nobMilitary* milBld : frontierMils) { - if(gwb.CalcDistance(wh->getPos(), milBld->getPos()) < 12) + if(gwb.calcDistance(wh->getPos(), milBld->getPos()) < 12) { frontierWhs.push_back(wh); break; @@ -863,7 +863,7 @@ void AIPlayerJH::DistributeMaxRankSoldiersByBlocking(unsigned limit, nobBaseWare || (hasUnderstaffedWh && wh->getInventory().people[maxRankJob] >= limit); if(shouldBlock != wh->isInventorySetting(maxRankJob, EInventorySetting::Stop)) aii.SetInventorySetting(wh->getPos(), maxRankJob, - wh->getInventorySetting(maxRankJob).Toggle(EInventorySetting::Stop)); + wh->getInventorySetting(maxRankJob).toggle(EInventorySetting::Stop)); } } else // there are no frontier whs! { @@ -895,11 +895,11 @@ void AIPlayerJH::DistributeMaxRankSoldiersByBlocking(unsigned limit, nobBaseWare shouldBlock = false; if(shouldBlock != wh->isInventorySetting(maxRankJob, EInventorySetting::Stop)) aii.SetInventorySetting(wh->getPos(), maxRankJob, - wh->getInventorySetting(maxRankJob).Toggle(EInventorySetting::Stop)); + wh->getInventorySetting(maxRankJob).toggle(EInventorySetting::Stop)); } } } -MapPoint AIPlayerJH::SimpleFindPosition(const MapPoint& pt, BuildingQuality size, unsigned radius) const +MapPoint AIPlayerJH::simpleFindPosition(const MapPoint& pt, BuildingQuality size, unsigned radius) const { std::vector pts = gwb.getPointsInRadius(pt, radius); for(const MapPoint& curPt : pts) @@ -916,42 +916,42 @@ MapPoint AIPlayerJH::SimpleFindPosition(const MapPoint& pt, BuildingQuality size return curPt; } - return MapPoint::Invalid(); + return MapPoint::invalid(); } -MapPoint AIPlayerJH::FindPositionForBuildingAround(BuildingType type, const MapPoint& around) +MapPoint AIPlayerJH::findPositionForBuildingAround(BuildingType type, const MapPoint& around) { constexpr unsigned searchRadius = 11; - MapPoint foundPos = MapPoint::Invalid(); + MapPoint foundPos = MapPoint::invalid(); switch(type) { case BuildingType::Woodcutter: { - foundPos = FindBestPosition(around, AIResource::Wood, BUILDING_SIZE[type], searchRadius, 20); + foundPos = findBestPosition(around, AIResource::Wood, BUILDING_SIZE[type], searchRadius, 20); break; } case BuildingType::Forester: // ensure some distance to other foresters and an minimal amount of plantspace - if(!construction->OtherUsualBuildingInRadius(around, 12, BuildingType::Forester) + if(!construction->otherUsualBuildingInRadius(around, 12, BuildingType::Forester) && getDensity(around, AIResource::Plantspace, 7) > 15) - foundPos = FindBestPosition(around, AIResource::Wood, BUILDING_SIZE[type], searchRadius, 0); + foundPos = findBestPosition(around, AIResource::Wood, BUILDING_SIZE[type], searchRadius, 0); break; case BuildingType::Hunter: { // check if there are any animals in range - if(HuntablesInRange(around, (2 << getBldPlanner().getNumBuildings(BuildingType::Hunter)))) - foundPos = SimpleFindPosition(around, BUILDING_SIZE[type], searchRadius); + if(huntablesInRange(around, (2 << getBldPlanner().getNumBuildings(BuildingType::Hunter)))) + foundPos = simpleFindPosition(around, BUILDING_SIZE[type], searchRadius); break; } case BuildingType::Quarry: { unsigned numQuarries = getBldPlanner().getNumBuildings(BuildingType::Quarry); - foundPos = FindBestPosition(around, AIResource::Stones, BUILDING_SIZE[type], searchRadius, + foundPos = findBestPosition(around, AIResource::Stones, BUILDING_SIZE[type], searchRadius, std::min(40u, 1 + numQuarries * 10)); - if(foundPos.isValid() && !ValidStoneinRange(foundPos)) + if(foundPos.isValid() && !validStoneinRange(foundPos)) { resourceMaps[AIResource::Stones].avoidPosition(foundPos); - foundPos = MapPoint::Invalid(); + foundPos = MapPoint::invalid(); } break; } @@ -959,54 +959,54 @@ MapPoint AIPlayerJH::FindPositionForBuildingAround(BuildingType type, const MapP case BuildingType::Guardhouse: case BuildingType::Watchtower: case BuildingType::Fortress: - foundPos = FindBestPosition(around, AIResource::Borderland, BUILDING_SIZE[type], searchRadius); + foundPos = findBestPosition(around, AIResource::Borderland, BUILDING_SIZE[type], searchRadius); break; case BuildingType::GoldMine: - foundPos = FindBestPosition(around, AIResource::Gold, BuildingQuality::Mine, searchRadius); + foundPos = findBestPosition(around, AIResource::Gold, BuildingQuality::Mine, searchRadius); break; case BuildingType::CoalMine: - foundPos = FindBestPosition(around, AIResource::Coal, BuildingQuality::Mine, searchRadius); + foundPos = findBestPosition(around, AIResource::Coal, BuildingQuality::Mine, searchRadius); break; case BuildingType::IronMine: - foundPos = FindBestPosition(around, AIResource::Ironore, BuildingQuality::Mine, searchRadius); + foundPos = findBestPosition(around, AIResource::Ironore, BuildingQuality::Mine, searchRadius); break; case BuildingType::GraniteMine: - foundPos = FindBestPosition(around, AIResource::Granite, BuildingQuality::Mine, searchRadius); + foundPos = findBestPosition(around, AIResource::Granite, BuildingQuality::Mine, searchRadius); break; case BuildingType::Fishery: - foundPos = FindBestPosition(around, AIResource::Fish, BUILDING_SIZE[type], searchRadius); - if(foundPos.isValid() && !ValidFishInRange(foundPos)) + foundPos = findBestPosition(around, AIResource::Fish, BUILDING_SIZE[type], searchRadius); + if(foundPos.isValid() && !validFishInRange(foundPos)) { resourceMaps[AIResource::Fish].avoidPosition(foundPos); - foundPos = MapPoint::Invalid(); + foundPos = MapPoint::invalid(); } break; case BuildingType::Storehouse: - if(!construction->OtherStoreInRadius(around, 15)) - foundPos = SimpleFindPosition(around, BUILDING_SIZE[type], searchRadius); + if(!construction->otherStoreInRadius(around, 15)) + foundPos = simpleFindPosition(around, BUILDING_SIZE[type], searchRadius); break; case BuildingType::HarborBuilding: - foundPos = SimpleFindPosition(around, BUILDING_SIZE[type], searchRadius); + foundPos = simpleFindPosition(around, BUILDING_SIZE[type], searchRadius); if(foundPos.isValid() - && !HarborPosRelevant(getWorld().getHarborPointID(foundPos))) // bad harborspot detected DO NOT USE - foundPos = MapPoint::Invalid(); + && !harborPosRelevant(getWorld().getHarborPointID(foundPos))) // bad harborspot detected DO NOT USE + foundPos = MapPoint::invalid(); break; case BuildingType::Shipyard: - foundPos = SimpleFindPosition(around, BUILDING_SIZE[type], searchRadius); + foundPos = simpleFindPosition(around, BUILDING_SIZE[type], searchRadius); if(foundPos.isValid() && isInvalidShipyardPosition(foundPos)) - foundPos = MapPoint::Invalid(); + foundPos = MapPoint::invalid(); break; case BuildingType::Farm: - foundPos = FindBestPosition(around, AIResource::Plantspace, BUILDING_SIZE[type], searchRadius, 85); + foundPos = findBestPosition(around, AIResource::Plantspace, BUILDING_SIZE[type], searchRadius, 85); if(foundPos.isValid()) - foundPos = FindBestPosition(around, AIResource::Plantspace, BUILDING_SIZE[type], searchRadius, 85); + foundPos = findBestPosition(around, AIResource::Plantspace, BUILDING_SIZE[type], searchRadius, 85); break; case BuildingType::Catapult: - foundPos = SimpleFindPosition(around, BUILDING_SIZE[type], searchRadius); + foundPos = simpleFindPosition(around, BUILDING_SIZE[type], searchRadius); if(foundPos.isValid() && aii.isBuildingNearby(BuildingType::Catapult, foundPos, 7)) - foundPos = MapPoint::Invalid(); + foundPos = MapPoint::invalid(); break; - default: foundPos = SimpleFindPosition(around, BUILDING_SIZE[type], searchRadius); break; + default: foundPos = simpleFindPosition(around, BUILDING_SIZE[type], searchRadius); break; } return foundPos; } @@ -1022,17 +1022,17 @@ unsigned AIPlayerJH::getDensity(MapPoint pt, AIResource res, int radius) const auto hasResource = [this, res](const MapPoint& curPt) { // TODO: Fix // return aiMap[curPt].res == res; - return CalcResource(curPt) == res; + return calcResource(curPt) == res; }; const unsigned numGoodPts = helpers::count_if(pts, hasResource); return (numGoodPts * 100) / numAllPTs; } -void AIPlayerJH::HandleNewMilitaryBuildingOccupied(const MapPoint pt) +void AIPlayerJH::handleNewMilitaryBuildingOccupied(const MapPoint pt) { // kill bad flags we find - RemoveAllUnusedRoads(pt); - bldPlanner->UpdateBuildingsWanted(*this); + removeAllUnusedRoads(pt); + bldPlanner->updateBuildingsWanted(*this); const auto* mil = gwb.getSpecObj(pt); if(!mil) return; @@ -1048,11 +1048,11 @@ void AIPlayerJH::HandleNewMilitaryBuildingOccupied(const MapPoint pt) aii.SetCoinsAllowed(pt, false); } - AddBuildJob(BuildingType::HarborBuilding, pt); + addBuildJob(BuildingType::HarborBuilding, pt); if(!isInvalidShipyardPosition(pt)) - AddBuildJob(BuildingType::Shipyard, pt); - if(SoldierAvailable()) - AddMilitaryBuildJob(pt); + addBuildJob(BuildingType::Shipyard, pt); + if(soldierAvailable()) + addMilitaryBuildJob(pt); // try to build one the following buildings around the new military building @@ -1064,7 +1064,7 @@ void AIPlayerJH::HandleNewMilitaryBuildingOccupied(const MapPoint pt) // remove the storehouse from the building test list if we are close to another storehouse already for(const nobBaseWarehouse* bldSite : aii.getStorehouses()) { - if(gwb.CalcDistance(bldSite->getPos(), pt) < 20) + if(gwb.calcDistance(bldSite->getPos(), pt) < 20) { bldToTestStartIdx = 1; break; @@ -1075,7 +1075,7 @@ void AIPlayerJH::HandleNewMilitaryBuildingOccupied(const MapPoint pt) { if(BuildingProperties::isWareHouse(bldSite->getBuildingType())) { - if(gwb.CalcDistance(bldSite->getPos(), pt) < 20) + if(gwb.calcDistance(bldSite->getPos(), pt) < 20) { bldToTestStartIdx = 1; break; @@ -1085,14 +1085,14 @@ void AIPlayerJH::HandleNewMilitaryBuildingOccupied(const MapPoint pt) for(unsigned i = bldToTestStartIdx; i < bldToTest.size(); ++i) { - if(construction->Wanted(bldToTest[i])) + if(construction->wanted(bldToTest[i])) { - AddBuildJob(bldToTest[i], pt); + addBuildJob(bldToTest[i], pt); } } } -void AIPlayerJH::HandleBuilingDestroyed(MapPoint pt, BuildingType bld) +void AIPlayerJH::handleBuilingDestroyed(MapPoint pt, BuildingType bld) { switch(bld) { @@ -1119,7 +1119,7 @@ void AIPlayerJH::HandleBuilingDestroyed(MapPoint pt, BuildingType bld) } } -void AIPlayerJH::HandleRoadConstructionComplete(MapPoint pt, Direction dir) +void AIPlayerJH::handleRoadConstructionComplete(MapPoint pt, Direction dir) { // todo: detect "bad" roads and handle them const auto* flag = gwb.getSpecObj(pt); @@ -1145,7 +1145,7 @@ void AIPlayerJH::HandleRoadConstructionComplete(MapPoint pt, Direction dir) } } -void AIPlayerJH::HandleRoadConstructionFailed(const MapPoint pt, Direction) +void AIPlayerJH::handleRoadConstructionFailed(const MapPoint pt, Direction) { const auto* flag = gwb.getSpecObj(pt); // does the flag still exist? @@ -1155,28 +1155,28 @@ void AIPlayerJH::HandleRoadConstructionFailed(const MapPoint pt, Direction) if(flag->getPlayer() != playerId) return; // if it isnt a useless flag AND it has no current road connection then retry to build a road. - if(RemoveUnusedRoad(*flag, std::nullopt, true, false)) - construction->AddConnectFlagJob(flag); + if(removeUnusedRoad(*flag, std::nullopt, true, false)) + construction->addConnectFlagJob(flag); } -void AIPlayerJH::HandleMilitaryBuilingLost(const MapPoint pt) +void AIPlayerJH::handleMilitaryBuilingLost(const MapPoint pt) { // For now, this is the same as losing land. - HandleLostLand(pt); + handleLostLand(pt); } -void AIPlayerJH::HandleBuildingFinished(const MapPoint pt, BuildingType bld) +void AIPlayerJH::handleBuildingFinished(const MapPoint pt, BuildingType bld) { switch(bld) { case BuildingType::HarborBuilding: - UpdateNodesAround(pt, 8); // todo: fix radius - RemoveAllUnusedRoads( + updateNodesAround(pt, 8); // todo: fix radius + removeAllUnusedRoads( pt); // repair & reconnect road system - required when a colony gets a new harbor by expedition aii.ChangeReserve(pt, 0, 1); // order 1 defender to stay in the harborbuilding // if there are positions free start an expedition! - if(HarborPosRelevant(gwb.getHarborPointID(pt), true)) + if(harborPosRelevant(gwb.getHarborPointID(pt), true)) { aii.StartStopExpedition(pt, true); } @@ -1185,29 +1185,29 @@ void AIPlayerJH::HandleBuildingFinished(const MapPoint pt, BuildingType bld) case BuildingType::Shipyard: aii.SetShipYardMode(pt, true); break; case BuildingType::Storehouse: break; - case BuildingType::Woodcutter: AddBuildJob(BuildingType::Sawmill, pt); break; + case BuildingType::Woodcutter: addBuildJob(BuildingType::Sawmill, pt); break; default: break; } } -void AIPlayerJH::HandleNewColonyFounded(const MapPoint pt) +void AIPlayerJH::handleNewColonyFounded(const MapPoint pt) { - construction->AddConnectFlagJob(gwb.getSpecObj(gwb.getNeighbour(pt, Direction::SouthEast))); + construction->addConnectFlagJob(gwb.getSpecObj(gwb.getNeighbour(pt, Direction::SouthEast))); } -void AIPlayerJH::HandleExpedition(const noShip& ship) +void AIPlayerJH::handleExpedition(const noShip& ship) { if(!ship.isWaitingForExpeditionInstructions()) return; if(ship.isAbleToFoundColony()) - aii.FoundColony(ship); + aii.foundColony(ship); else { for(auto dir : helpers::enumRange(AI::randomEnum())) { if(aii.isExplorationDirectionPossible(ship.getPos(), ship.getCurrentHarbor(), dir)) { - aii.TravelToNextSpot(dir, ship); + aii.travelToNextSpot(dir, ship); return; } } @@ -1216,7 +1216,7 @@ void AIPlayerJH::HandleExpedition(const noShip& ship) } } -void AIPlayerJH::HandleExpedition(const MapPoint pt) +void AIPlayerJH::handleExpedition(const MapPoint pt) { const noShip* ship = nullptr; @@ -1234,25 +1234,25 @@ void AIPlayerJH::HandleExpedition(const MapPoint pt) } if(ship) { - HandleExpedition(*ship); + handleExpedition(*ship); } } -void AIPlayerJH::HandleTreeChopped(const MapPoint pt) +void AIPlayerJH::handleTreeChopped(const MapPoint pt) { // std::cout << "Tree chopped." << std::endl; aiMap[pt].reachable = true; - UpdateNodesAround(pt, 3); + updateNodesAround(pt, 3); if(AI::randomChance()) - AddMilitaryBuildJob(pt); + addMilitaryBuildJob(pt); else // if (random % 12 == 0) - AddBuildJob(BuildingType::Woodcutter, pt); + addBuildJob(BuildingType::Woodcutter, pt); } -void AIPlayerJH::HandleNoMoreResourcesReachable(const MapPoint pt, BuildingType bld) +void AIPlayerJH::handleNoMoreResourcesReachable(const MapPoint pt, BuildingType bld) { // Destroy old building (once) @@ -1264,10 +1264,10 @@ void AIPlayerJH::HandleNoMoreResourcesReachable(const MapPoint pt, BuildingType for(const nobUsual* forester : aii.getBuildings(BuildingType::Forester)) { // is the forester somewhat close? - if(gwb.CalcDistance(pt, forester->getPos()) <= RES_RADIUS[AIResource::Wood]) + if(gwb.calcDistance(pt, forester->getPos()) <= RES_RADIUS[AIResource::Wood]) { // then find it's 2 woodcutters - unsigned maxdist = gwb.CalcDistance(pt, forester->getPos()); + unsigned maxdist = gwb.calcDistance(pt, forester->getPos()); int betterwoodcutters = 0; for(const nobUsual* woodcutter : aii.getBuildings(BuildingType::Woodcutter)) { @@ -1277,10 +1277,10 @@ void AIPlayerJH::HandleNoMoreResourcesReachable(const MapPoint pt, BuildingType // TODO: We currently don't take the distance to the forester into account when placing a woodcutter // This leads to points beeing equally good for placing but later it will be destroyed. Avoid that // by checking only close woddcutters - if(gwb.CalcDistance(woodcutter->getPos(), pt) > RES_RADIUS[AIResource::Wood]) + if(gwb.calcDistance(woodcutter->getPos(), pt) > RES_RADIUS[AIResource::Wood]) continue; // closer or equally close to forester than woodcutter in question? - if(gwb.CalcDistance(woodcutter->getPos(), forester->getPos()) <= maxdist) + if(gwb.calcDistance(woodcutter->getPos(), forester->getPos()) <= maxdist) { betterwoodcutters++; if(betterwoodcutters >= 2) @@ -1299,21 +1299,21 @@ void AIPlayerJH::HandleNoMoreResourcesReachable(const MapPoint pt, BuildingType if(bld == BuildingType::Fishery) resourceMaps[AIResource::Fish].avoidPosition(pt); - UpdateNodesAround(pt, 11); // todo: fix radius - RemoveUnusedRoad(*gwb.getSpecObj(gwb.getNeighbour(pt, Direction::SouthEast)), Direction::NorthWest, true); + updateNodesAround(pt, 11); // todo: fix radius + removeUnusedRoad(*gwb.getSpecObj(gwb.getNeighbour(pt, Direction::SouthEast)), Direction::NorthWest, true); // try to expand, maybe res blocked a passage - AddMilitaryBuildJob(pt); + addMilitaryBuildJob(pt); // and try to rebuild the same building if(bld != BuildingType::Hunter) - AddBuildJob(bld, pt); + addBuildJob(bld, pt); // farm is always good! - AddBuildJob(BuildingType::Farm, pt); + addBuildJob(BuildingType::Farm, pt); } -void AIPlayerJH::HandleShipBuilt(const MapPoint pt) +void AIPlayerJH::handleShipBuilt(const MapPoint pt) { // Stop building ships if reached a maximum (TODO: make variable) const std::list& shipyards = aii.getBuildings(BuildingType::Shipyard); @@ -1335,7 +1335,7 @@ void AIPlayerJH::HandleShipBuilt(const MapPoint pt) const nobUsual* creatingShipyard = nullptr; for(const nobUsual* shipyard : shipyards) { - unsigned distance = gwb.CalcDistance(shipyard->getPos(), pt); + unsigned distance = gwb.calcDistance(shipyard->getPos(), pt); if(distance < mindist) { mindist = distance; @@ -1347,9 +1347,9 @@ void AIPlayerJH::HandleShipBuilt(const MapPoint pt) } } -void AIPlayerJH::HandleBorderChanged(const MapPoint pt) +void AIPlayerJH::handleBorderChanged(const MapPoint pt) { - UpdateNodesAround(pt, 11); // todo: fix radius + updateNodesAround(pt, 11); // todo: fix radius const auto* mil = gwb.getSpecObj(pt); if(mil) @@ -1368,24 +1368,24 @@ void AIPlayerJH::HandleBorderChanged(const MapPoint pt) } if(mil->getBuildingType() != construction->getBiggestAllowedMilBuilding()) { - AddMilitaryBuildJob(pt); + addMilitaryBuildJob(pt); } } } -void AIPlayerJH::HandleLostLand(const MapPoint pt) +void AIPlayerJH::handleLostLand(const MapPoint pt) { if(aii.getStorehouses() .empty()) // check if we have a storehouse left - if we dont have one trying to find a path to one will crash { return; } - RemoveAllUnusedRoads(pt); + removeAllUnusedRoads(pt); } -void AIPlayerJH::MilUpgradeOptim() +void AIPlayerJH::milUpgradeOptim() { - const auto* upgradeBld = UpdateUpgradeBuilding(); + const auto* upgradeBld = updateUpgradeBuilding(); const std::list& militaryBuildings = aii.getMilitaryBuildings(); const auto numPlannedConnectedInlandMilitaryBlds = getNumPlannedConnectedInlandMilitaryBlds(); unsigned count = 0; @@ -1402,7 +1402,7 @@ void AIPlayerJH::MilUpgradeOptim() // For dedicated inland buildings send out troops until 1 private is left, then cancel road // Connect frontier buildings to road system. if(milBld->getFrontierDistance() != FrontierDistance::Far) - construction->AddConnectFlagJob(milBld->getFlag()); + construction->addConnectFlagJob(milBld->getFlag()); else if(count + numPlannedConnectedInlandMilitaryBlds < militaryBuildings.size()) { if(milBld->getNumTroops() > 1) // more than 1 soldier remaining? -> send out order @@ -1420,14 +1420,14 @@ void AIPlayerJH::MilUpgradeOptim() // 0-1 soldier remains and the building has had at least 1 soldier // at some point and the building is not new on the list // -> cancel road (and fix roadsystem if necessary) - RemoveUnusedRoad(*milBld->getFlag(), Direction::NorthWest, true, true, true); + removeUnusedRoad(*milBld->getFlag(), Direction::NorthWest, true, true, true); } } } else // upgrade building { if(!construction->isConnectedToRoadSystem(milBld->getFlag())) { - construction->AddConnectFlagJob(milBld->getFlag()); + construction->addConnectFlagJob(milBld->getFlag()); continue; } if(milBld->isGoldDisabled()) // activate gold @@ -1452,12 +1452,12 @@ bool AIPlayerJH::hasFrontierBuildings() return false; } -void AIPlayerJH::CheckExpeditions() +void AIPlayerJH::checkExpeditions() { const std::list& harbors = aii.getHarbors(); for(const nobHarborBuilding* harbor : harbors) { - bool isHarborRelevant = HarborPosRelevant(harbor->getHarborPosID(), true); + bool isHarborRelevant = harborPosRelevant(harbor->getHarborPosID(), true); if(harbor->isExpeditionActive() != isHarborRelevant) // harbor is collecting for expedition and shouldn't // OR not collecting and should -> toggle expedition { @@ -1470,11 +1470,11 @@ void AIPlayerJH::CheckExpeditions() for(const noShip* ship : ships) { if(ship->isWaitingForExpeditionInstructions()) - HandleExpedition(*ship); + handleExpedition(*ship); } } -void AIPlayerJH::CheckForester() +void AIPlayerJH::checkForester() { const std::list& foresters = aii.getBuildings(BuildingType::Forester); if(!foresters.empty() && foresters.size() < 2 && aii.getMilitaryBuildings().size() < 3 @@ -1490,11 +1490,11 @@ void AIPlayerJH::CheckForester() } } -void AIPlayerJH::CheckGranitMine() +void AIPlayerJH::checkGranitMine() { // stop production in granite mines when the ai has many stones (100+ and at least 15 for each warehouse) bool enableProduction = - AmountInStorage(GoodType::Stones) < 100 || AmountInStorage(GoodType::Stones) < 15 * aii.getStorehouses().size(); + amountInStorage(GoodType::Stones) < 100 || amountInStorage(GoodType::Stones) < 15 * aii.getStorehouses().size(); for(const nobUsual* mine : aii.getBuildings(BuildingType::GraniteMine)) { // !productionDisabled != enableProduction @@ -1503,7 +1503,7 @@ void AIPlayerJH::CheckGranitMine() } } -void AIPlayerJH::TryToAttack() +void AIPlayerJH::tryToAttack() { unsigned hq_or_harbor_without_soldiers = 0; std::vector potentialTargets; @@ -1527,7 +1527,7 @@ void AIPlayerJH::TryToAttack() // get nearby enemy buildings and store in set of potential attacking targets MapPoint src = milBld->getPos(); - sortedMilitaryBlds buildings = gwb.LookForMilitaryBuildings(src, 2); + sortedMilitaryBlds buildings = gwb.lookForMilitaryBuildings(src, 2); for(const nobBaseMilitary* target : buildings) { if(helpers::contains(potentialTargets, target)) @@ -1535,10 +1535,10 @@ void AIPlayerJH::TryToAttack() if(target->getGOT() == GO_Type::NobMilitary && static_cast(target)->isNewBuilt()) continue; MapPoint dest = target->getPos(); - if(gwb.CalcDistance(src, dest) < BASE_ATTACKING_DISTANCE && aii.isPlayerAttackable(target->getPlayer()) + if(gwb.calcDistance(src, dest) < BASE_ATTACKING_DISTANCE && aii.isPlayerAttackable(target->getPlayer()) && aii.isVisible(dest)) { - if(target->getGOT() != GO_Type::NobMilitary && !target->DefendersAvailable()) + if(target->getGOT() != GO_Type::NobMilitary && !target->defendersAvailable()) { // headquarter or harbor without any troops :) hq_or_harbor_without_soldiers++; @@ -1562,7 +1562,7 @@ void AIPlayerJH::TryToAttack() unsigned attackersStrength = 0; // ask each of nearby own military buildings for soldiers to contribute to the potential attack - sortedMilitaryBlds myBuildings = gwb.LookForMilitaryBuildings(dest, 2); + sortedMilitaryBlds myBuildings = gwb.lookForMilitaryBuildings(dest, 2); for(const nobBaseMilitary* otherMilBld : myBuildings) { if(otherMilBld->getPlayer() == playerId) @@ -1592,7 +1592,7 @@ void AIPlayerJH::TryToAttack() } } -void AIPlayerJH::TrySeaAttack() +void AIPlayerJH::trySeaAttack() { if(aii.getNumShips() < 1) return; @@ -1643,7 +1643,7 @@ void AIPlayerJH::TrySeaAttack() gwb.getFilteredSeaIDsForAttack(gwb.getHarborPoint(i), seaidswithattackers, playerId); if(!testseaidswithattackers.empty()) // harbor can be attacked? { - if(!hb->DefendersAvailable()) // no defenders? + if(!hb->defendersAvailable()) // no defenders? undefendedTargets.push_back(hb); else // todo: maybe only attack this when there is a fair win chance for the attackers? potentialTargets.push_back(hb); @@ -1687,7 +1687,7 @@ void AIPlayerJH::TrySeaAttack() { limit--; // now add all military buildings around the harbor spot to our list of potential targets - sortedMilitaryBlds buildings = gwb.LookForMilitaryBuildings(gwb.getHarborPoint(searcharoundharborspots[i]), 2); + sortedMilitaryBlds buildings = gwb.lookForMilitaryBuildings(gwb.getHarborPoint(searcharoundharborspots[i]), 2); for(const nobBaseMilitary* milBld : buildings) { if(aii.isPlayerAttackable(milBld->getPlayer()) && aii.isVisible(milBld->getPos())) @@ -1697,7 +1697,7 @@ void AIPlayerJH::TrySeaAttack() if(enemyTarget && enemyTarget->isNewBuilt()) continue; if((milBld->getGOT() != GO_Type::NobMilitary) - && (!milBld->DefendersAvailable())) // undefended headquarter(or unlikely as it is a harbor...) - + && (!milBld->defendersAvailable())) // undefended headquarter(or unlikely as it is a harbor...) - // priority list! { const std::vector testseaidswithattackers = @@ -1751,7 +1751,7 @@ void AIPlayerJH::TrySeaAttack() } } -void AIPlayerJH::RecalcGround(const MapPoint buildingPos, std::vector& route_road) +void AIPlayerJH::recalcGround(const MapPoint buildingPos, std::vector& route_road) { // building itself if(aiMap[buildingPos].res == AIResource::Plantspace) @@ -1772,7 +1772,7 @@ void AIPlayerJH::RecalcGround(const MapPoint buildingPos, std::vector } } -void AIPlayerJH::SaveResourceMapsToFile() +void AIPlayerJH::saveResourceMapsToFile() { for(const auto res : helpers::enumRange()) { @@ -1798,9 +1798,9 @@ const AIResourceMap& AIPlayerJH::getResMap(AIResource res) const return resourceMaps[res]; } -void AIPlayerJH::SendAIEvent(std::unique_ptr ev) +void AIPlayerJH::sendAIEvent(std::unique_ptr ev) { - eventManager.AddAIEvent(std::move(ev)); + eventManager.addAIEvent(std::move(ev)); } bool AIPlayerJH::isFlagPartofCircle(const noFlag& startFlag, unsigned maxlen, const noFlag& curFlag, @@ -1839,22 +1839,22 @@ bool AIPlayerJH::isFlagPartofCircle(const noFlag& startFlag, unsigned maxlen, co return false; } -void AIPlayerJH::RemoveAllUnusedRoads(const MapPoint pt) +void AIPlayerJH::removeAllUnusedRoads(const MapPoint pt) { - std::vector flags = construction->FindFlags(pt, 25); + std::vector flags = construction->findFlags(pt, 25); // Jede Flagge testen... std::vector reconnectflags; for(const noFlag* flag : flags) { - if(RemoveUnusedRoad(*flag, std::nullopt, true, false)) + if(removeUnusedRoad(*flag, std::nullopt, true, false)) reconnectflags.push_back(flag); } - UpdateNodesAround(pt, 25); + updateNodesAround(pt, 25); for(const noFlag* flag : reconnectflags) - construction->AddConnectFlagJob(flag); + construction->addConnectFlagJob(flag); } -void AIPlayerJH::CheckForUnconnectedBuildingSites() +void AIPlayerJH::checkForUnconnectedBuildingSites() { if(construction->getConnectJobNum() > 0 || construction->getBuildJobNum() > 0) return; @@ -1873,11 +1873,11 @@ void AIPlayerJH::CheckForUnconnectedBuildingSites() } } if(!foundRoute) - construction->AddConnectFlagJob(flag); + construction->addConnectFlagJob(flag); } } -bool AIPlayerJH::RemoveUnusedRoad(const noFlag& startFlag, helpers::OptionalEnum excludeDir, +bool AIPlayerJH::removeUnusedRoad(const noFlag& startFlag, helpers::OptionalEnum excludeDir, bool firstflag /*= true*/, bool allowcircle /*= true*/, bool keepstartflag /*= false*/) { @@ -1935,17 +1935,17 @@ bool AIPlayerJH::RemoveUnusedRoad(const noFlag& startFlag, helpers::OptionalEnum return false; // at least 1 road exists Direction revDir1 = startFlag.getRoute(*foundDir)->getOtherFlagDir(startFlag) + 3u; - RemoveUnusedRoad(startFlag.getRoute(*foundDir)->getOtherFlag(startFlag), revDir1, false); + removeUnusedRoad(startFlag.getRoute(*foundDir)->getOtherFlag(startFlag), revDir1, false); // 2 roads exist if(foundDir2) { Direction revDir2 = startFlag.getRoute(*foundDir2)->getOtherFlagDir(startFlag) + 3u; - RemoveUnusedRoad(startFlag.getRoute(*foundDir2)->getOtherFlag(startFlag), revDir2, false); + removeUnusedRoad(startFlag.getRoute(*foundDir2)->getOtherFlag(startFlag), revDir2, false); } return false; } -unsigned AIPlayerJH::SoldierAvailable(int rank) +unsigned AIPlayerJH::soldierAvailable(int rank) { unsigned freeSoldiers = 0; for(const nobBaseWarehouse* wh : aii.getStorehouses()) @@ -1961,7 +1961,7 @@ unsigned AIPlayerJH::SoldierAvailable(int rank) return freeSoldiers; } -bool AIPlayerJH::HuntablesInRange(const MapPoint pt, unsigned min) +bool AIPlayerJH::huntablesInRange(const MapPoint pt, unsigned min) { // check first if no other hunter (or hunter buildingsite) is nearby if(aii.isBuildingNearby(BuildingType::Hunter, pt, 14)) @@ -1969,7 +1969,7 @@ bool AIPlayerJH::HuntablesInRange(const MapPoint pt, unsigned min) return nofHunter::getHuntableAnimalsInRange(gwb, pt).size() >= min; } -void AIPlayerJH::InitStoreAndMilitarylists() +void AIPlayerJH::initStoreAndMilitarylists() { for(const nobUsual* farm : aii.getBuildings(BuildingType::Farm)) { @@ -1980,10 +1980,10 @@ void AIPlayerJH::InitStoreAndMilitarylists() setFarmedNodes(charburner->getPos(), true); } // find the upgrade building - UpdateUpgradeBuilding(); + updateUpgradeBuilding(); } -const nobMilitary* AIPlayerJH::UpdateUpgradeBuilding() +const nobMilitary* AIPlayerJH::updateUpgradeBuilding() { std::vector backup; if(!aii.getStorehouses().empty()) @@ -2007,13 +2007,13 @@ const nobMilitary* AIPlayerJH::UpdateUpgradeBuilding() // no valid upgrade building yet - try to reconnect correctly flagged buildings for(const nobMilitary* milBld : backup) { - construction->AddConnectFlagJob(milBld->getFlag()); + construction->addConnectFlagJob(milBld->getFlag()); } - UpgradeBldPos = MapPoint::Invalid(); + UpgradeBldPos = MapPoint::invalid(); return nullptr; } // set default start values for the ai for distribution & military settings -void AIPlayerJH::InitDistribution() +void AIPlayerJH::initDistribution() { // set good distribution settings Distributions goodSettings; @@ -2056,7 +2056,7 @@ void AIPlayerJH::InitDistribution() aii.ChangeDistribution(goodSettings); } -bool AIPlayerJH::ValidTreeinRange(const MapPoint pt) +bool AIPlayerJH::validTreeinRange(const MapPoint pt) { unsigned max_radius = 6; for(MapCoord tx = gwb.getXA(pt, Direction::West), r = 1; r <= max_radius; @@ -2071,9 +2071,9 @@ bool AIPlayerJH::ValidTreeinRange(const MapPoint pt) if(gwb.getNO(t2)->getType() == NodalObjectType::Tree) { // not already getting cut down or a freaking pineapple thingy? - if(!gwb.getNode(t2).reserved && gwb.getSpecObj(t2)->ProducesWood()) + if(!gwb.getNode(t2).reserved && gwb.getSpecObj(t2)->producesWood()) { - if(gwb.FindHumanPath(pt, t2, 20)) + if(gwb.findHumanPath(pt, t2, 20)) return true; } } @@ -2083,7 +2083,7 @@ bool AIPlayerJH::ValidTreeinRange(const MapPoint pt) return false; } -bool AIPlayerJH::ValidStoneinRange(const MapPoint pt) +bool AIPlayerJH::validStoneinRange(const MapPoint pt) { unsigned max_radius = 8; for(MapCoord tx = gwb.getXA(pt, Direction::West), r = 1; r <= max_radius; @@ -2097,7 +2097,7 @@ bool AIPlayerJH::ValidStoneinRange(const MapPoint pt) // point has tree & path is available? if(gwb.getNO(t2)->getType() == NodalObjectType::Granite) { - if(gwb.FindHumanPath(pt, t2, 20)) + if(gwb.findHumanPath(pt, t2, 20)) return true; } } @@ -2106,7 +2106,7 @@ bool AIPlayerJH::ValidStoneinRange(const MapPoint pt) return false; } -void AIPlayerJH::ExecuteLuaConstructionOrder(const MapPoint pt, BuildingType bt, bool forced) +void AIPlayerJH::executeLuaConstructionOrder(const MapPoint pt, BuildingType bt, bool forced) { if(!aii.canBuildBuildingtype(bt)) // not allowed to build this buildingtype? -> do nothing! return; @@ -2117,19 +2117,19 @@ void AIPlayerJH::ExecuteLuaConstructionOrder(const MapPoint pt, BuildingType bt, auto j = std::make_unique(*this, bt, pt); j->setState(JobState::ExecutingRoad1); j->setTarget(pt); - construction->AddBuildJob(std::move(j), true); // connects the buildingsite to roadsystem + construction->addBuildJob(std::move(j), true); // connects the buildingsite to roadsystem } else { - if(construction->Wanted(bt)) + if(construction->wanted(bt)) { - construction->AddBuildJob(std::make_unique(*this, bt, pt), + construction->addBuildJob(std::make_unique(*this, bt, pt), true); // add build job to the front of the list } } } /// returns the percentage*100 of possible normal+ building places -unsigned AIPlayerJH::BQsurroundcheck(const MapPoint pt, unsigned range, bool includeexisting, unsigned limit) +unsigned AIPlayerJH::bQsurroundcheck(const MapPoint pt, unsigned range, bool includeexisting, unsigned limit) { unsigned maxvalue = 6 * (2 << (range - 1)) - 5; // 1,7,19,43,91,... = 6*2^range -5 unsigned count = 0; @@ -2180,7 +2180,7 @@ unsigned AIPlayerJH::BQsurroundcheck(const MapPoint pt, unsigned range, bool inc return ((count * 100) / maxvalue); } -bool AIPlayerJH::HarborPosRelevant(HarborId harborId, bool onlyempty) const +bool AIPlayerJH::harborPosRelevant(HarborId harborId, bool onlyempty) const { if(!harborId || harborId.value() > gwb.getNumHarborPoints()) // not a real harbor - shouldnt happen... { @@ -2209,7 +2209,7 @@ bool AIPlayerJH::HarborPosRelevant(HarborId harborId, bool onlyempty) const return false; } -bool AIPlayerJH::NoEnemyHarbor() +bool AIPlayerJH::noEnemyHarbor() { for(const auto i : helpers::idRange(gwb.getNumHarborPoints())) { @@ -2228,7 +2228,7 @@ bool AIPlayerJH::isInvalidShipyardPosition(const MapPoint pt) return aii.isBuildingNearby(BuildingType::Shipyard, pt, 19) || !aii.isHarborPosClose(pt, 7); } -unsigned AIPlayerJH::AmountInStorage(GoodType good) const +unsigned AIPlayerJH::amountInStorage(GoodType good) const { unsigned counter = 0; for(const nobBaseWarehouse* wh : aii.getStorehouses()) @@ -2236,7 +2236,7 @@ unsigned AIPlayerJH::AmountInStorage(GoodType good) const return counter; } -unsigned AIPlayerJH::AmountInStorage(::Job job) const +unsigned AIPlayerJH::amountInStorage(::Job job) const { unsigned counter = 0; for(const nobBaseWarehouse* wh : aii.getStorehouses()) @@ -2244,10 +2244,10 @@ unsigned AIPlayerJH::AmountInStorage(::Job job) const return counter; } -bool AIPlayerJH::ValidFishInRange(const MapPoint pt) +bool AIPlayerJH::validFishInRange(const MapPoint pt) { unsigned max_radius = 5; - return gwb.CheckPointsInRadius( + return gwb.checkPointsInRadius( pt, max_radius, [this, pt](const MapPoint curPt, unsigned) { if(gwb.getNode(curPt).resources.has(ResourceType::Fish)) // fish on current spot? @@ -2255,7 +2255,7 @@ bool AIPlayerJH::ValidFishInRange(const MapPoint pt) // try to find a path to a neighboring node on the coast for(const MapPoint nb : gwb.getNeighbours(curPt)) { - if(gwb.FindHumanPath(pt, nb, 10)) + if(gwb.findHumanPath(pt, nb, 10)) return true; } } @@ -2292,7 +2292,7 @@ unsigned AIPlayerJH::getNumAIRelevantSeaIds() const return validseaids.size(); } -void AIPlayerJH::AdjustSettings() +void AIPlayerJH::adjustSettings() { const Inventory& inventory = aii.getInventory(); // update tool creation settings @@ -2378,7 +2378,7 @@ void AIPlayerJH::AdjustSettings() milSettings[2] = 4; milSettings[3] = 5; // interior 0bar full if we have an upgrade building and gold(or produce gold) else 1 soldier each - milSettings[4] = UpdateUpgradeBuilding() + milSettings[4] = updateUpgradeBuilding() && (inventory[GoodType::Coins] > 0 || (inventory[GoodType::Gold] > 0 && inventory[GoodType::Coal] > 0 && !aii.getBuildings(BuildingType::Mint).empty())) ? @@ -2386,7 +2386,7 @@ void AIPlayerJH::AdjustSettings() 0; milSettings[6] = ggs.isEnabled(AddonId::SEA_ATTACK) ? 8 : 0; // harbor flag: no sea attacks?->no soldiers else 50% to 100% - milSettings[5] = CalcMilSettings(); // inland 1bar min 50% max 100% depending on how many soldiers are available + milSettings[5] = calcMilSettings(); // inland 1bar min 50% max 100% depending on how many soldiers are available milSettings[7] = 8; // front: 100% if(player.getMilitarySetting(5) != milSettings[5] || player.getMilitarySetting(6) != milSettings[6] || player.getMilitarySetting(4) != milSettings[4] @@ -2394,7 +2394,7 @@ void AIPlayerJH::AdjustSettings() aii.ChangeMilitary(milSettings); } -unsigned AIPlayerJH::CalcMilSettings() +unsigned AIPlayerJH::calcMilSettings() { std::array InlandTroops = { 0, 0, 0, 0, 0}; // how many troops are required to fill inland buildings at settings 4,5,6,7,8 @@ -2407,7 +2407,7 @@ unsigned AIPlayerJH::CalcMilSettings() const unsigned numShouldStayConnected = getNumPlannedConnectedInlandMilitaryBlds(); unsigned count = 0; unsigned soldierInUseFixed = 0; - const auto* upgradeBld = UpdateUpgradeBuilding(); + const auto* upgradeBld = updateUpgradeBuilding(); const std::list& militaryBuildings = aii.getMilitaryBuildings(); for(const nobMilitary* milBld : militaryBuildings) { @@ -2417,11 +2417,11 @@ unsigned AIPlayerJH::CalcMilSettings() && (count + numShouldStayConnected > militaryBuildings.size() || milBld == upgradeBld))) // front or connected interior { - soldierInUseFixed += milBld->CalcRequiredNumTroops(FrontierDistance::Mid, 8); + soldierInUseFixed += milBld->calcRequiredNumTroops(FrontierDistance::Mid, 8); } else if(milBld->getFrontierDistance() == FrontierDistance::Mid) // 1 bar (inland) { for(int i = 0; i < 5; i++) - InlandTroops[i] += milBld->CalcRequiredNumTroops(FrontierDistance::Mid, 4 + i); + InlandTroops[i] += milBld->calcRequiredNumTroops(FrontierDistance::Mid, 4 + i); } else // setting should be 0 so add 1 soldier soldierInUseFixed++; diff --git a/libs/s25main/ai/aijh/AIPlayerJH.h b/libs/s25main/ai/aijh/AIPlayerJH.h index b93dc482b2..d026d9c5b1 100644 --- a/libs/s25main/ai/aijh/AIPlayerJH.h +++ b/libs/s25main/ai/aijh/AIPlayerJH.h @@ -47,17 +47,17 @@ class AIPlayerJH final : public AIPlayer const AIJob* getCurrentJob() const { return currentJob.get(); } unsigned getNumJobs() const; - void RunGF(unsigned gf, bool gfisnwf) override; - void OnChatMessage(unsigned sendPlayerId, ChatDestination, const std::string& msg) override; + void runGF(unsigned gf, bool gfisnwf) override; + void onChatMessage(unsigned sendPlayerId, ChatDestination, const std::string& msg) override; /// Test whether the player should resign or not - bool TestDefeat(); + bool testDefeat(); /// calculates the values the ai should pick for harbor flag & 1 bar buildings between 50% and 100% /// return value is whatever has to be added to 4(=50%) for harbor and if anything is left that has to be added to 1 /// bar setting - unsigned CalcMilSettings(); + unsigned calcMilSettings(); /// military & tool production settings - void AdjustSettings(); + void adjustSettings(); /// return number of seaIds with at least 2 harbor spots unsigned getNumAIRelevantSeaIds() const; @@ -74,35 +74,35 @@ class AIPlayerJH final : public AIPlayer return std::max(6u, aii.getMilitaryBuildings().size() / 5u); } /// returns the percentage*100 of possible normal building places - unsigned BQsurroundcheck(MapPoint pt, unsigned range, bool includeexisting, unsigned limit = 0); + unsigned bQsurroundcheck(MapPoint pt, unsigned range, bool includeexisting, unsigned limit = 0); /// returns the building the AI uses for troop upgrades - const nobMilitary* UpdateUpgradeBuilding(); + const nobMilitary* updateUpgradeBuilding(); /// returns amount of good/people stored in warehouses right now - unsigned AmountInStorage(GoodType good) const; - unsigned AmountInStorage(Job job) const; + unsigned amountInStorage(GoodType good) const; + unsigned amountInStorage(Job job) const; - void PlanNewBuildings(unsigned gf); + void planNewBuildings(unsigned gf); - void SendAIEvent(std::unique_ptr ev); + void sendAIEvent(std::unique_ptr ev); /// Executes a job form the job queue - void ExecuteAIJob(); + void executeAIJob(); /// Tries to build a bld of the given type at that point. /// If front is true, then the job is enqueued at the front, else the back /// If searchPosition is true, then the point is searched for a good position (around that pt) otherwise the point /// is taken - void AddBuildJob(BuildingType type, MapPoint pt, bool front = false, bool searchPosition = true); + void addBuildJob(BuildingType type, MapPoint pt, bool front = false, bool searchPosition = true); /// Build a new military building at that position - void AddMilitaryBuildJob(MapPoint pt); + void addMilitaryBuildJob(MapPoint pt); /// adds buildjobs for a buildingtype around every warehouse or military building - void AddBuildJobAroundEveryWarehouse(BuildingType bt); - void AddBuildJobAroundEveryMilBld(BuildingType bt); + void addBuildJobAroundEveryWarehouse(BuildingType bt); + void addBuildJobAroundEveryMilBld(BuildingType bt); /// blocks goods in each warehouse that has at least limit amount of that good - if all warehouses have enough they /// unblock - void DistributeGoodsByBlocking(GoodType good, unsigned limit); + void distributeGoodsByBlocking(GoodType good, unsigned limit); /// blocks max rank soldiers in warehouse 1 (hq most often), then balances soldiers among frontier warehouses - if /// there are no frontier warehouses just pick anything but 1 if there is just 1 then dont block - void DistributeMaxRankSoldiersByBlocking(unsigned limit, nobBaseWarehouse* upwh); + void distributeMaxRankSoldiersByBlocking(unsigned limit, nobBaseWarehouse* upwh); /// returns true if at least 1 military building has a flag > 0 bool hasFrontierBuildings(); /// returns the warehouse closest to the upgradebuilding or if it cant find a way the first warehouse and if there @@ -111,107 +111,107 @@ class AIPlayerJH final : public AIPlayer /// activate gathering of swords,shields,beer,privates(if there is an upgrade building), helpers(if necessary) void setGatheringForUpgradeWarehouse(nobBaseWarehouse* upgradewarehouse); /// Initializes the nodes on start of the game - void InitNodes(); + void initNodes(); /// Updates the nodes around a position - void UpdateNodesAround(MapPoint pt, unsigned radius); + void updateNodesAround(MapPoint pt, unsigned radius); /// Returns the resource on a specific point - AINodeResource CalcResource(MapPoint pt); + AINodeResource calcResource(MapPoint pt); /// Initialize the resource maps - void InitResourceMaps(); + void initResourceMaps(); /// Initialize the Store and Military building lists (only required when loading games but the AI doesnt know /// whether its a load game or new game so this runs when the ai starts in both cases) // now used to init farm space around farms ... lazy legacy - void InitStoreAndMilitarylists(); + void initStoreAndMilitarylists(); // set default start values for the ai for distribution - void InitDistribution(); + void initDistribution(); // returns true if we can get to the startflag in excludeDir, std::vector oldFlags); /// Finds the best position for a specific resource in an area using the resource maps, /// satisfying the minimum value, returns false if no such position is found - MapPoint FindBestPosition(const MapPoint& pt, AIResource res, BuildingQuality size, unsigned radius, + MapPoint findBestPosition(const MapPoint& pt, AIResource res, BuildingQuality size, unsigned radius, int minimum = 1); /// Finds a position for the desired building size - MapPoint SimpleFindPosition(const MapPoint& pt, BuildingQuality size, unsigned radius) const; + MapPoint simpleFindPosition(const MapPoint& pt, BuildingQuality size, unsigned radius) const; /// Find a position for a specific building around a given point - MapPoint FindPositionForBuildingAround(BuildingType type, const MapPoint& around); + MapPoint findPositionForBuildingAround(BuildingType type, const MapPoint& around); /// Density in percent (0-100) unsigned getDensity(MapPoint pt, AIResource res, int radius); /// Does some actions after a new military building is occupied - void HandleNewMilitaryBuildingOccupied(MapPoint pt); + void handleNewMilitaryBuildingOccupied(MapPoint pt); /// Does some actions after a military building is lost - void HandleMilitaryBuilingLost(MapPoint pt); + void handleMilitaryBuilingLost(MapPoint pt); /// Does some actions after a building is destroyed - void HandleBuilingDestroyed(MapPoint pt, BuildingType bld); + void handleBuilingDestroyed(MapPoint pt, BuildingType bld); // Handle event "no more resources" - void HandleNoMoreResourcesReachable(MapPoint pt, BuildingType bld); + void handleNoMoreResourcesReachable(MapPoint pt, BuildingType bld); // A new ship has been built -> handle it - void HandleShipBuilt(MapPoint pt); + void handleShipBuilt(MapPoint pt); // A new road has been built -> handle it - void HandleRoadConstructionComplete(MapPoint pt, Direction dir); + void handleRoadConstructionComplete(MapPoint pt, Direction dir); // A road construction has failed -> handle it - void HandleRoadConstructionFailed(MapPoint pt, Direction dir); + void handleRoadConstructionFailed(MapPoint pt, Direction dir); // Handle border event - void HandleBorderChanged(MapPoint pt); + void handleBorderChanged(MapPoint pt); // Handle usual building finished - void HandleBuildingFinished(MapPoint pt, BuildingType bld); + void handleBuildingFinished(MapPoint pt, BuildingType bld); - void HandleExpedition(MapPoint pt); - void HandleExpedition(const noShip& ship); + void handleExpedition(MapPoint pt); + void handleExpedition(const noShip& ship); // Handle chopped tree, test for new space - void HandleTreeChopped(MapPoint pt); + void handleTreeChopped(MapPoint pt); // Handle new colony - void HandleNewColonyFounded(MapPoint pt); + void handleNewColonyFounded(MapPoint pt); /// Lost land to another player - void HandleLostLand(MapPoint pt); + void handleLostLand(MapPoint pt); /// check expeditions (order new / cancel) - void CheckExpeditions(); + void checkExpeditions(); /// if we have 1 complete forester but less than 1 military building and less than 2 buildingsites stop production - void CheckForester(); + void checkForester(); /// stop/resume granitemine production - void CheckGranitMine(); + void checkGranitMine(); /// Tries to attack the enemy - void TryToAttack(); + void tryToAttack(); /// sea attack - void TrySeaAttack(); + void trySeaAttack(); /// checks if there is at least 1 sea id connected to the harbor spot with at least 2 harbor spots! when /// onlyempty=true there has to be at least 1 other free harborId - bool HarborPosRelevant(HarborId harborId, bool onlyempty = false) const; + bool harborPosRelevant(HarborId harborId, bool onlyempty = false) const; /// Update BQ and farming ground around new building site + road - void RecalcGround(MapPoint buildingPos, std::vector& route_road); + void recalcGround(MapPoint buildingPos, std::vector& route_road); - void SaveResourceMapsToFile(); + void saveResourceMapsToFile(); - void InitReachableNodes(); - void IterativeReachableNodeChecker(std::queue toCheck); - void UpdateReachableNodes(const std::vector& pts); + void initReachableNodes(); + void iterativeReachableNodeChecker(std::queue toCheck); + void updateReachableNodes(const std::vector& pts); /// disconnects 'inland' military buildings from road system(and sends out soldiers), sets stop gold, uses the /// upgrade building (order new private, kick out general) - void MilUpgradeOptim(); + void milUpgradeOptim(); void setFarmedNodes(MapPoint pt, bool set); // removes a no longer used road(and its flags) returns true when there is a building at the flag that might need a // new connection - bool RemoveUnusedRoad(const noFlag& startFlag, helpers::OptionalEnum excludeDir, bool firstflag = true, + bool removeUnusedRoad(const noFlag& startFlag, helpers::OptionalEnum excludeDir, bool firstflag = true, bool allowcircle = true, bool keepstartflag = false); // finds all unused flags and roads, removes flags or reconnects them as neccessary - void RemoveAllUnusedRoads(MapPoint pt); - void CheckForUnconnectedBuildingSites(); + void removeAllUnusedRoads(MapPoint pt); + void checkForUnconnectedBuildingSites(); // check if there are free soldiers (in hq/storehouses) - unsigned SoldierAvailable(int rank = -1); + unsigned soldierAvailable(int rank = -1); - bool HuntablesInRange(MapPoint pt, unsigned min); + bool huntablesInRange(MapPoint pt, unsigned min); - bool ValidTreeinRange(MapPoint pt); + bool validTreeinRange(MapPoint pt); - bool ValidStoneinRange(MapPoint pt); + bool validStoneinRange(MapPoint pt); - bool ValidFishInRange(MapPoint pt); + bool validFishInRange(MapPoint pt); - void ExecuteLuaConstructionOrder(MapPoint pt, BuildingType bt, bool forced = false); + void executeLuaConstructionOrder(MapPoint pt, BuildingType bt, bool forced = false); - bool NoEnemyHarbor(); + bool noEnemyHarbor(); MapPoint UpgradeBldPos; diff --git a/libs/s25main/ai/aijh/AIResourceMap.cpp b/libs/s25main/ai/aijh/AIResourceMap.cpp index 79c3c62df3..98c6dd8514 100644 --- a/libs/s25main/ai/aijh/AIResourceMap.cpp +++ b/libs/s25main/ai/aijh/AIResourceMap.cpp @@ -40,7 +40,7 @@ void AIResourceMap::init() { const MapExtent mapSize = aiMap.getSize(); - map.Resize(mapSize); + map.resize(mapSize); // Calculate value for each point. // This is quite expensive so do just for the diminishable resources to sort out ones where there will never be // anything, which allows to skip calculating the value when updating the resource map @@ -61,7 +61,7 @@ void AIResourceMap::init() // Calculate only if we can build there const bool isValid = aii.gwb.isOfTerrain(pt, [requiredTerrain](const TerrainDesc& desc) { return desc.Is(requiredTerrain); }); - map[pt] = isValid ? aii.CalcResourceValue(pt, res) : 0; + map[pt] = isValid ? aii.calcResourceValue(pt, res) : 0; } } } @@ -76,7 +76,7 @@ void AIResourceMap::updateAround(const MapPoint& pt, int radius) MapPoint AIResourceMap::findBestPosition(const MapPoint& pt, BuildingQuality size, unsigned radius, int minimum) const { - MapPoint best = MapPoint::Invalid(); + MapPoint best = MapPoint::invalid(); int best_value = (minimum == std::numeric_limits::min()) ? minimum : minimum - 1; std::vector pts = aii.gwb.GetPointsInRadiusWithCenter(pt, radius); @@ -139,7 +139,7 @@ void AIResourceMap::updateAroundDiminishable(const MapPoint& pt, const int radiu // unknown if((r < 2 || !lastCircleValueCalculated) && step < 1 && curDir == Direction::NorthEast && resMapVal) { - resMapVal = aii.CalcResourceValue(curPt, res); + resMapVal = aii.calcResourceValue(curPt, res); circleStartValue = resMapVal; lastCircleValueCalculated = true; lastValueCalculated = true; @@ -151,17 +151,17 @@ void AIResourceMap::updateAroundDiminishable(const MapPoint& pt, const int radiu } else if(step < 1 && curDir == Direction::NorthEast) // circle not yet started? -> last direction was // outward (left=0) { - resMapVal = aii.CalcResourceValue(curPt, res, Direction::West, circleStartValue); + resMapVal = aii.calcResourceValue(curPt, res, Direction::West, circleStartValue); circleStartValue = resMapVal; } else if(lastValueCalculated) { if(step > 0) // we moved direction i%6 - resMapVal = aii.CalcResourceValue(curPt, res, curDir, resMapVal); + resMapVal = aii.calcResourceValue(curPt, res, curDir, resMapVal); else // last step was the previous direction - resMapVal = aii.CalcResourceValue(curPt, res, curDir - 1u, resMapVal); + resMapVal = aii.calcResourceValue(curPt, res, curDir - 1u, resMapVal); } else { - resMapVal = aii.CalcResourceValue(curPt, res); + resMapVal = aii.calcResourceValue(curPt, res); lastValueCalculated = true; } } @@ -187,17 +187,17 @@ void AIResourceMap::updateAroundReplinishable(const MapPoint& pt, const int radi if(r == 1 && step == 0 && curDir == Direction::NorthEast) { // only do a complete calculation for the first point! - resValue = aii.CalcResourceValue(curPt, res); + resValue = aii.calcResourceValue(curPt, res); circleStartValue = resValue; } else if(step == 0 && curDir == Direction::NorthEast) { // circle not yet started? -> last direction was outward - resValue = aii.CalcResourceValue(curPt, res, Direction::West, circleStartValue); + resValue = aii.calcResourceValue(curPt, res, Direction::West, circleStartValue); circleStartValue = resValue; } else if(step > 0) // we moved direction i%6 - resValue = aii.CalcResourceValue(curPt, res, curDir, resValue); + resValue = aii.calcResourceValue(curPt, res, curDir, resValue); else // last step was the previous direction - resValue = aii.CalcResourceValue(curPt, res, curDir - 1u, resValue); + resValue = aii.calcResourceValue(curPt, res, curDir - 1u, resValue); map[curPt] = resValue; } } diff --git a/libs/s25main/ai/aijh/BuildingPlanner.cpp b/libs/s25main/ai/aijh/BuildingPlanner.cpp index 17334b6f3d..770da44a38 100644 --- a/libs/s25main/ai/aijh/BuildingPlanner.cpp +++ b/libs/s25main/ai/aijh/BuildingPlanner.cpp @@ -27,23 +27,23 @@ namespace { BuildingPlanner::BuildingPlanner(const AIPlayerJH& aijh) : buildingsWanted(), expansionRequired(false) { - RefreshBuildingNums(aijh); - InitBuildingsWanted(aijh); - UpdateBuildingsWanted(aijh); + refreshBuildingNums(aijh); + initBuildingsWanted(aijh); + updateBuildingsWanted(aijh); } -void BuildingPlanner::Update(unsigned gf, AIPlayerJH& aijh) +void BuildingPlanner::update(unsigned gf, AIPlayerJH& aijh) { - RefreshBuildingNums(aijh); - expansionRequired = CalcIsExpansionRequired(aijh, gf > 500 && gf % 500 == 0); + refreshBuildingNums(aijh); + expansionRequired = calcIsExpansionRequired(aijh, gf > 500 && gf % 500 == 0); } -void BuildingPlanner::RefreshBuildingNums(const AIPlayerJH& aijh) +void BuildingPlanner::refreshBuildingNums(const AIPlayerJH& aijh) { buildingNums = aijh.player.getBuildingRegister().getBuildingNums(); } -bool BuildingPlanner::CalcIsExpansionRequired(AIPlayerJH& aijh, bool recalc) const +bool BuildingPlanner::calcIsExpansionRequired(AIPlayerJH& aijh, bool recalc) const { if(!expansionRequired && !recalc) return false; @@ -66,11 +66,11 @@ bool BuildingPlanner::CalcIsExpansionRequired(AIPlayerJH& aijh, bool recalc) con for(const noBuilding* bld : blds) { if(!hasWood) - hasWood = aijh.FindPositionForBuildingAround(BuildingType::Woodcutter, bld->getPos()).isValid(); + hasWood = aijh.findPositionForBuildingAround(BuildingType::Woodcutter, bld->getPos()).isValid(); if(!hasBoards) - hasBoards = aijh.FindPositionForBuildingAround(BuildingType::Sawmill, bld->getPos()).isValid(); + hasBoards = aijh.findPositionForBuildingAround(BuildingType::Sawmill, bld->getPos()).isValid(); if(!hasStone) - hasStone = aijh.FindPositionForBuildingAround(BuildingType::Quarry, bld->getPos()).isValid(); + hasStone = aijh.findPositionForBuildingAround(BuildingType::Quarry, bld->getPos()).isValid(); } return !(hasWood && hasBoards && hasStone); } @@ -103,7 +103,7 @@ unsigned BuildingPlanner::getNumMilitaryBldSites() const return result; } -void BuildingPlanner::InitBuildingsWanted(const AIPlayerJH& aijh) +void BuildingPlanner::initBuildingsWanted(const AIPlayerJH& aijh) { std::fill(buildingsWanted.begin(), buildingsWanted.end(), 0u); buildingsWanted[BuildingType::Forester] = 1; @@ -128,7 +128,7 @@ void BuildingPlanner::InitBuildingsWanted(const AIPlayerJH& aijh) } } -void BuildingPlanner::UpdateBuildingsWanted(const AIPlayerJH& aijh) +void BuildingPlanner::updateBuildingsWanted(const AIPlayerJH& aijh) { // no military buildings -> usually start only const unsigned numMilitaryBlds = aijh.player.getBuildingRegister().getMilitaryBuildings().size(); @@ -345,7 +345,7 @@ void BuildingPlanner::UpdateBuildingsWanted(const AIPlayerJH& aijh) buildingsWanted[BuildingType::Charburner] = std::min(1, resourcelimit); } if(getNumBuildings(BuildingType::Quarry) + 1 < buildingsWanted[BuildingType::Quarry] - && aijh.AmountInStorage(GoodType::Stones) < 100) // no quarry and low stones -> try granitemines. + && aijh.amountInStorage(GoodType::Stones) < 100) // no quarry and low stones -> try granitemines. { if(inventory.people[Job::Miner] > 6) { @@ -377,7 +377,7 @@ int BuildingPlanner::getNumAdditionalBuildingsWanted(BuildingType type) const return static_cast(buildingsWanted[type]) - static_cast(getNumBuildings(type)); } -bool BuildingPlanner::WantMoreMilitaryBlds(const AIPlayerJH& aijh) const +bool BuildingPlanner::wantMoreMilitaryBlds(const AIPlayerJH& aijh) const { if(getNumMilitaryBldSites() >= getNumMilitaryBlds() + 3) return false; diff --git a/libs/s25main/ai/aijh/BuildingPlanner.h b/libs/s25main/ai/aijh/BuildingPlanner.h index 9491d34dc8..21100efde2 100644 --- a/libs/s25main/ai/aijh/BuildingPlanner.h +++ b/libs/s25main/ai/aijh/BuildingPlanner.h @@ -17,7 +17,7 @@ class BuildingPlanner public: BuildingPlanner(const AIPlayerJH& aijh); /// Refresh the number of buildings by asking the GameClientPlayer - void Update(unsigned gf, AIPlayerJH& aijh); + void update(unsigned gf, AIPlayerJH& aijh); /// Return the number of buildings and buildingsites of a specific type (refresh with RefreshBuildingCount()) unsigned getNumBuildings(BuildingType type) const; @@ -28,13 +28,13 @@ class BuildingPlanner /// Get amount of construction sites of military buildings unsigned getNumMilitaryBldSites() const; - void InitBuildingsWanted(const AIPlayerJH& aijh); - void UpdateBuildingsWanted(const AIPlayerJH& aijh); + void initBuildingsWanted(const AIPlayerJH& aijh); + void updateBuildingsWanted(const AIPlayerJH& aijh); /// Return the number of buildings that we want to build of the current type int getNumAdditionalBuildingsWanted(BuildingType type) const; /// Checks whether the ai wants to construct more mil buildings atm - bool WantMoreMilitaryBlds(const AIPlayerJH& aijh) const; + bool wantMoreMilitaryBlds(const AIPlayerJH& aijh) const; bool isExpansionRequired() const { return expansionRequired; } private: @@ -44,7 +44,7 @@ class BuildingPlanner helpers::EnumArray buildingsWanted; bool expansionRequired; - void RefreshBuildingNums(const AIPlayerJH& aijh); - bool CalcIsExpansionRequired(AIPlayerJH& aijh, bool recalc) const; + void refreshBuildingNums(const AIPlayerJH& aijh); + bool calcIsExpansionRequired(AIPlayerJH& aijh, bool recalc) const; }; } // namespace AIJH diff --git a/libs/s25main/ai/aijh/Jobs.cpp b/libs/s25main/ai/aijh/Jobs.cpp index 25d499511f..cab4770f8d 100644 --- a/libs/s25main/ai/aijh/Jobs.cpp +++ b/libs/s25main/ai/aijh/Jobs.cpp @@ -20,7 +20,7 @@ namespace AIJH { AIJob::AIJob(AIPlayerJH& aijh) : aijh(aijh), state(JobState::Waiting) {} -void BuildJob::ExecuteJob() +void BuildJob::executeJob() { // are we allowed to plan construction work in the area in this nwf? if(!aijh.getConstruction().canStillConstructHere(around)) @@ -31,14 +31,14 @@ void BuildJob::ExecuteJob() switch(state) { - case JobState::Start: TryToBuild(); break; + case JobState::Start: tryToBuild(); break; - case JobState::ExecutingRoad1: BuildMainRoad(); break; + case JobState::ExecutingRoad1: buildMainRoad(); break; - case JobState::ExecutingRoad2: TryToBuildSecondaryRoad(); break; + case JobState::ExecutingRoad2: tryToBuildSecondaryRoad(); break; case JobState::ExecutingRoad2_2: // evtl noch prüfen ob auch dieser Straßenbau erfolgreich war? - aijh.RecalcGround(target, route); + aijh.recalcGround(target, route); state = JobState::Finished; break; @@ -61,7 +61,7 @@ void BuildJob::ExecuteJob() } } -void BuildJob::TryToBuild() +void BuildJob::tryToBuild() { AIConstruction& aiConstruction = aijh.getConstruction(); @@ -70,7 +70,7 @@ void BuildJob::TryToBuild() return; } - if(!aiConstruction.Wanted(type)) + if(!aiConstruction.wanted(type)) { state = JobState::Finished; return; @@ -92,10 +92,10 @@ void BuildJob::TryToBuild() searchMode = SearchMode::Radius; } - MapPoint foundPos = MapPoint::Invalid(); + MapPoint foundPos = MapPoint::invalid(); if(searchMode == SearchMode::Radius) { - foundPos = aijh.FindPositionForBuildingAround(type, around); + foundPos = aijh.findPositionForBuildingAround(type, around); if(BuildingProperties::isMilitary(type)) { if(foundPos.isValid()) @@ -106,7 +106,7 @@ void BuildJob::TryToBuild() RTTR_Assert(aiInterface.getBuildingQuality(foundPos) == aijh.getAINode(foundPos).bq); if(type != BuildingType::Fortress && aiInterface.getBuildingQuality(foundPos) != BuildingQuality::Mine && aiInterface.getBuildingQuality(foundPos) > BUILDING_SIZE[type] - && aijh.BQsurroundcheck(foundPos, 6, true, 10) < 10) + && aijh.bQsurroundcheck(foundPos, 6, true, 10) < 10) { // more than 80% is unbuildable in range 7 -> upgrade for(BuildingType bld : BuildingProperties::militaryBldTypes) @@ -125,7 +125,7 @@ void BuildJob::TryToBuild() { if(BUILDING_SIZE[bld] < BUILDING_SIZE[type] && aijh.getInterface().canBuildBuildingtype(bld)) { - aijh.AddBuildJob(bld, around); + aijh.addBuildJob(bld, around); break; } } @@ -157,10 +157,10 @@ void BuildJob::TryToBuild() } target = foundPos; state = JobState::ExecutingRoad1; - aiConstruction.ConstructionOrdered(*this); + aiConstruction.constructionOrdered(*this); } -void BuildJob::BuildMainRoad() +void BuildJob::buildMainRoad() { AIInterface& aiInterface = aijh.getInterface(); const auto* bld = aiInterface.gwb.getSpecObj(target); @@ -178,7 +178,7 @@ void BuildJob::BuildMainRoad() << BUILDING_NAMES[type] << " at " << target.x << "/" << target.y << ". Retrying..." << std::endl; #endif aijh.getAINode(target).bq = bq; - aijh.AddBuildJob(type, around); + aijh.addBuildJob(type, around); } return; } @@ -198,7 +198,7 @@ void BuildJob::BuildMainRoad() if(!aiConstruction.isConnectedToRoadSystem(houseFlag)) { // Bau unmöglich? - if(!aiConstruction.ConnectFlagToRoadSytem(houseFlag, route)) + if(!aiConstruction.connectFlagToRoadSytem(houseFlag, route)) { state = JobState::Failed; #ifdef DEBUG_AI @@ -211,7 +211,7 @@ void BuildJob::BuildMainRoad() aijh.getAINode(target).failed_penalty = 20; aiInterface.DestroyBuilding(target); aiInterface.DestroyFlag(houseFlag->getPos()); - aijh.AddBuildJob(type, around); + aijh.addBuildJob(type, around); return; } } @@ -222,14 +222,14 @@ void BuildJob::BuildMainRoad() switch(type) { - case BuildingType::Forester: aijh.AddBuildJob(BuildingType::Woodcutter, target); break; + case BuildingType::Forester: aijh.addBuildJob(BuildingType::Woodcutter, target); break; case BuildingType::Charburner: case BuildingType::Farm: aijh.setFarmedNodes(target, true); break; - case BuildingType::Mill: aijh.AddBuildJob(BuildingType::Bakery, target); break; - case BuildingType::PigFarm: aijh.AddBuildJob(BuildingType::Slaughterhouse, target); break; + case BuildingType::Mill: aijh.addBuildJob(BuildingType::Bakery, target); break; + case BuildingType::PigFarm: aijh.addBuildJob(BuildingType::Slaughterhouse, target); break; case BuildingType::Bakery: case BuildingType::Slaughterhouse: - case BuildingType::Brewery: aijh.AddBuildJob(BuildingType::Well, target); break; + case BuildingType::Brewery: aijh.addBuildJob(BuildingType::Well, target); break; default: break; } @@ -241,14 +241,14 @@ void BuildJob::BuildMainRoad() if(!BuildingProperties::isMilitary(type)) // not a military building? -> build secondary road now { state = JobState::ExecutingRoad2; - return TryToBuildSecondaryRoad(); + return tryToBuildSecondaryRoad(); } else // military buildings only get 1 road { state = JobState::Finished; } } -void BuildJob::TryToBuildSecondaryRoad() +void BuildJob::tryToBuildSecondaryRoad() { const auto* houseFlag = aijh.getWorld().getSpecObj(aijh.getWorld().getNeighbour(target, Direction::SouthEast)); @@ -261,11 +261,11 @@ void BuildJob::TryToBuildSecondaryRoad() std::cout << "Player " << (unsigned)aijh.getPlayerId() << ", Job failed: House flag is gone, " << BUILDING_NAMES[type] << " at " << target.x << "/" << target.y << ". Retrying..." << std::endl; #endif - aijh.AddBuildJob(type, around); + aijh.addBuildJob(type, around); return; } - if(aijh.getConstruction().BuildAlternativeRoad(houseFlag, route)) + if(aijh.getConstruction().buildAlternativeRoad(houseFlag, route)) { state = JobState::ExecutingRoad2_2; } else @@ -276,7 +276,7 @@ EventJob::EventJob(AIPlayerJH& aijh, std::unique_ptr ev) : AIJob( EventJob::~EventJob() = default; -void EventJob::ExecuteJob() +void EventJob::executeJob() { // for now it is assumed that all these will be finished or failed after execution (no wait or progress) using AIEvent::EventType; @@ -285,21 +285,21 @@ void EventJob::ExecuteJob() case EventType::BuildingConquered: { const auto& evb = *checkedCast(ev.get()); - aijh.HandleNewMilitaryBuildingOccupied(evb.getPos()); + aijh.handleNewMilitaryBuildingOccupied(evb.getPos()); state = JobState::Finished; } break; case EventType::BuildingLost: { const auto& evb = *checkedCast(ev.get()); - aijh.HandleMilitaryBuilingLost(evb.getPos()); + aijh.handleMilitaryBuilingLost(evb.getPos()); state = JobState::Finished; } break; case EventType::LostLand: { const auto& evb = *checkedCast(ev.get()); - aijh.HandleLostLand(evb.getPos()); + aijh.handleLostLand(evb.getPos()); state = JobState::Finished; } break; @@ -307,77 +307,77 @@ void EventJob::ExecuteJob() { // todo maybe do sth about it? const auto& evb = *checkedCast(ev.get()); - aijh.HandleBuilingDestroyed(evb.getPos(), evb.getBuildingType()); + aijh.handleBuilingDestroyed(evb.getPos(), evb.getBuildingType()); state = JobState::Finished; } break; case EventType::NoMoreResourcesReachable: { const auto& evb = *checkedCast(ev.get()); - aijh.HandleNoMoreResourcesReachable(evb.getPos(), evb.getBuildingType()); + aijh.handleNoMoreResourcesReachable(evb.getPos(), evb.getBuildingType()); state = JobState::Finished; } break; case EventType::BorderChanged: { const auto& evb = *checkedCast(ev.get()); - aijh.HandleBorderChanged(evb.getPos()); + aijh.handleBorderChanged(evb.getPos()); state = JobState::Finished; } break; case EventType::BuildingFinished: { const auto& evb = *checkedCast(ev.get()); - aijh.HandleBuildingFinished(evb.getPos(), evb.getBuildingType()); + aijh.handleBuildingFinished(evb.getPos(), evb.getBuildingType()); state = JobState::Finished; } break; case EventType::ExpeditionWaiting: { const auto& lvb = *checkedCast(ev.get()); - aijh.HandleExpedition(lvb.getPos()); + aijh.handleExpedition(lvb.getPos()); state = JobState::Finished; } break; case EventType::TreeChopped: { const auto& lvb = *checkedCast(ev.get()); - aijh.HandleTreeChopped(lvb.getPos()); + aijh.handleTreeChopped(lvb.getPos()); state = JobState::Finished; } break; case EventType::NewColonyFounded: { const auto& lvb = *checkedCast(ev.get()); - aijh.HandleNewColonyFounded(lvb.getPos()); + aijh.handleNewColonyFounded(lvb.getPos()); state = JobState::Finished; } break; case EventType::ShipBuilt: { const auto& lvb = *checkedCast(ev.get()); - aijh.HandleShipBuilt(lvb.getPos()); + aijh.handleShipBuilt(lvb.getPos()); state = JobState::Finished; } break; case EventType::RoadConstructionComplete: { const auto& dvb = *checkedCast(ev.get()); - aijh.HandleRoadConstructionComplete(dvb.getPos(), dvb.getDirection()); + aijh.handleRoadConstructionComplete(dvb.getPos(), dvb.getDirection()); state = JobState::Finished; } break; case EventType::RoadConstructionFailed: { const auto& dvb = *checkedCast(ev.get()); - aijh.HandleRoadConstructionFailed(dvb.getPos(), dvb.getDirection()); + aijh.handleRoadConstructionFailed(dvb.getPos(), dvb.getDirection()); state = JobState::Finished; } break; case EventType::LuaConstructionOrder: { const auto& evb = *checkedCast(ev.get()); - aijh.ExecuteLuaConstructionOrder(evb.getPos(), evb.getBuildingType(), true); + aijh.executeLuaConstructionOrder(evb.getPos(), evb.getBuildingType(), true); state = JobState::Finished; } break; @@ -390,7 +390,7 @@ void EventJob::ExecuteJob() state = JobState::Finished; } -void ConnectJob::ExecuteJob() +void ConnectJob::executeJob() { #ifdef DEBUG_AI std::cout << "Player " << (unsigned)aijh.getPlayerId() << ", ConnectJob executed..." << std::endl; @@ -434,7 +434,7 @@ void ConnectJob::ExecuteJob() std::cout << "Flag is not connected..." << std::endl; #endif // building road possible? - if(!construction.ConnectFlagToRoadSytem(flag, route, 24)) + if(!construction.connectFlagToRoadSytem(flag, route, 24)) { #ifdef DEBUG_AI std::cout << "Flag is not connectable." << std::endl; @@ -451,12 +451,12 @@ void ConnectJob::ExecuteJob() #ifdef DEBUG_AI std::cout << "Flag is connected." << std::endl; #endif - aijh.RecalcGround(flagPos, route); + aijh.recalcGround(flagPos, route); state = JobState::Finished; } } -void SearchJob::ExecuteJob() +void SearchJob::executeJob() { state = JobState::Failed; PositionSearchState searchState = search->execute(aijh); @@ -468,7 +468,7 @@ void SearchJob::ExecuteJob() else { state = JobState::Finished; - aijh.AddBuildJob(search->getBld(), search->getResultPt(), true, false); + aijh.addBuildJob(search->getBld(), search->getResultPt(), true, false); } } diff --git a/libs/s25main/ai/aijh/Jobs.h b/libs/s25main/ai/aijh/Jobs.h index e8ef057e88..bf5b66be47 100644 --- a/libs/s25main/ai/aijh/Jobs.h +++ b/libs/s25main/ai/aijh/Jobs.h @@ -44,7 +44,7 @@ class AIJob public: AIJob(AIPlayerJH& aijh); virtual ~AIJob() = default; - virtual void ExecuteJob() = 0; + virtual void executeJob() = 0; JobState getState() const { return state; } void setState(JobState s) { state = s; } @@ -56,7 +56,7 @@ class AIJob class JobWithTarget { public: - JobWithTarget() : target(MapPoint::Invalid()) {} + JobWithTarget() : target(MapPoint::invalid()) {} MapPoint getTarget() const { return target; } void setTarget(MapPoint newTarget) { target = newTarget; } @@ -71,7 +71,7 @@ class BuildJob : public AIJob, public JobWithTarget : AIJob(aijh), type(type), around(around), searchMode(searchMode) {} - void ExecuteJob() override; + void executeJob() override; BuildingType getType() const { return type; } MapPoint getAround() const { return around; } @@ -81,16 +81,16 @@ class BuildJob : public AIJob, public JobWithTarget SearchMode searchMode; std::vector route; - void TryToBuild(); - void BuildMainRoad(); - void TryToBuildSecondaryRoad(); + void tryToBuild(); + void buildMainRoad(); + void tryToBuildSecondaryRoad(); }; class ConnectJob : public AIJob, public JobWithTarget { public: ConnectJob(AIPlayerJH& aijh, MapPoint flagPos) : AIJob(aijh), flagPos(flagPos) {} - void ExecuteJob() override; + void executeJob() override; MapPoint getFlag() const { return flagPos; } private: @@ -103,7 +103,7 @@ class EventJob : public AIJob public: EventJob(AIPlayerJH& aijh, std::unique_ptr ev); ~EventJob() override; - void ExecuteJob() override; + void executeJob() override; const AIEvent::Base& getEvent() const { return *ev; } private: @@ -115,7 +115,7 @@ class SearchJob : public AIJob public: SearchJob(AIPlayerJH& aijh, PositionSearch* search) : AIJob(aijh), search(search) {} ~SearchJob() override; - void ExecuteJob() override; + void executeJob() override; private: PositionSearch* search; diff --git a/libs/s25main/ai/aijh/PositionSearch.cpp b/libs/s25main/ai/aijh/PositionSearch.cpp index 3e98265d6d..1c6a0018c7 100644 --- a/libs/s25main/ai/aijh/PositionSearch.cpp +++ b/libs/s25main/ai/aijh/PositionSearch.cpp @@ -10,7 +10,7 @@ AIJH::PositionSearch::PositionSearch(const AIPlayerJH& player, const MapPoint pt BuildingType bld, bool searchGlobalOptimum /*= false*/) : startPt(pt), res(res), minimum(minimum), size(BUILDING_SIZE[bld]), bld(bld), searchGlobalOptimum(searchGlobalOptimum), nodesPerStep(25), // TODO: Make it depend on something... - resultPt(MapPoint::Invalid()), resultValue(0) + resultPt(MapPoint::invalid()), resultValue(0) { tested.resize(prodOfComponents(player.getWorld().getSize())); diff --git a/libs/s25main/buildings/BurnedWarehouse.cpp b/libs/s25main/buildings/BurnedWarehouse.cpp index 0f98a4ba38..a94fa4f7da 100644 --- a/libs/s25main/buildings/BurnedWarehouse.cpp +++ b/libs/s25main/buildings/BurnedWarehouse.cpp @@ -23,7 +23,7 @@ BurnedWarehouse::BurnedWarehouse(const MapPoint pos, const unsigned char player, : noCoordBase(NodalObjectType::BurnedWarehouse, pos), player(player), go_out_phase(0), people(people) { // First event - getEvMgr().AddEvent(this, PHASE_LENGTH, 0); + getEvMgr().addEvent(this, PHASE_LENGTH, 0); } BurnedWarehouse::BurnedWarehouse(SerializedGameData& sgd, const unsigned obj_id) @@ -38,9 +38,9 @@ BurnedWarehouse::BurnedWarehouse(SerializedGameData& sgd, const unsigned obj_id) BurnedWarehouse::~BurnedWarehouse() = default; -void BurnedWarehouse::Destroy() +void BurnedWarehouse::destroy() { - noCoordBase::Destroy(); + noCoordBase::destroy(); } void BurnedWarehouse::Serialize(SerializedGameData& sgd) const @@ -53,7 +53,7 @@ void BurnedWarehouse::Serialize(SerializedGameData& sgd) const helpers::pushContainer(sgd, people.armoredSoldiers); } -void BurnedWarehouse::HandleEvent(const unsigned /*id*/) +void BurnedWarehouse::handleEvent(const unsigned /*id*/) { RTTR_Assert(go_out_phase != GO_OUT_PHASES); @@ -69,12 +69,12 @@ void BurnedWarehouse::HandleEvent(const unsigned /*id*/) if(possibleDirs.empty()) { // No way out for figures -> all die and we can remove this object - getEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); + getEvMgr().addToKillList(world->RemoveFigure(pos, *this)); auto& currentPlayer = world->getPlayer(player); for(const auto i : helpers::enumRange()) - currentPlayer.DecreaseInventoryJob(i, people[i]); + currentPlayer.decreaseInventoryJob(i, people[i]); for(const auto i : helpers::enumRange()) - currentPlayer.DecreaseInventoryJob(i, people[i]); + currentPlayer.decreaseInventoryJob(i, people[i]); return; } @@ -108,7 +108,7 @@ void BurnedWarehouse::HandleEvent(const unsigned /*id*/) for([[maybe_unused]] const auto z : helpers::range(curNumPeople)) { // Create job and send moving into the current direction - auto& figure = world->AddFigure(pos, std::make_unique(job, pos, player, nullptr)); + auto& figure = world->addFigure(pos, std::make_unique(job, pos, player, nullptr)); if(isSoldier(job)) { auto const armoredSoldier = jobEnumToAmoredSoldierEnum(job); @@ -118,8 +118,8 @@ void BurnedWarehouse::HandleEvent(const unsigned /*id*/) people[armoredSoldier]--; } } - figure.StartWandering(getObjId()); - figure.StartWalking(curDir); + figure.startWandering(getObjId()); + figure.startWalking(curDir); } } } @@ -129,12 +129,12 @@ void BurnedWarehouse::HandleEvent(const unsigned /*id*/) if(go_out_phase == GO_OUT_PHASES) { // All done - getEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); + getEvMgr().addToKillList(world->RemoveFigure(pos, *this)); // There shouldn't be any more for(unsigned int num : people.people) RTTR_Assert(num == 0); for(unsigned int num : people.armoredSoldiers) RTTR_Assert(num == 0); } else // Not done yet - getEvMgr().AddEvent(this, PHASE_LENGTH, 0); + getEvMgr().addEvent(this, PHASE_LENGTH, 0); } diff --git a/libs/s25main/buildings/BurnedWarehouse.h b/libs/s25main/buildings/BurnedWarehouse.h index e897e96e87..76ddf0ae60 100644 --- a/libs/s25main/buildings/BurnedWarehouse.h +++ b/libs/s25main/buildings/BurnedWarehouse.h @@ -17,15 +17,15 @@ class BurnedWarehouse : public noCoordBase ~BurnedWarehouse() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Burnedwarehouse; } /// Benachrichtigen, wenn neuer GF erreicht wurde. - void HandleEvent(unsigned id) override; + void handleEvent(unsigned id) override; - void Draw(DrawPoint /*drawPt*/) override {} + void draw(DrawPoint /*drawPt*/) override {} private: /// Spieler des ehemaligen Lagerhauses diff --git a/libs/s25main/buildings/noBaseBuilding.cpp b/libs/s25main/buildings/noBaseBuilding.cpp index ab6646ae78..b3e97b3f7e 100644 --- a/libs/s25main/buildings/noBaseBuilding.cpp +++ b/libs/s25main/buildings/noBaseBuilding.cpp @@ -29,7 +29,7 @@ noBaseBuilding::noBaseBuilding(const NodalObjectType nop, const BuildingType typ // Evtl Flagge setzen, wenn noch keine da ist if(world->getNO(flagPt)->getType() != NodalObjectType::Flag) { - world->DestroyNO(flagPt, false); + world->destroyNO(flagPt, false); world->setNO(flagPt, new noFlag(flagPt, player)); } @@ -73,7 +73,7 @@ noBaseBuilding::noBaseBuilding(const NodalObjectType nop, const BuildingType typ continue; } - world->DestroyNO(neighbor, false); + world->destroyNO(neighbor, false); world->setNO(neighbor, new noExtension(this)); } } @@ -81,16 +81,16 @@ noBaseBuilding::noBaseBuilding(const NodalObjectType nop, const BuildingType typ noBaseBuilding::~noBaseBuilding() = default; -void noBaseBuilding::Destroy() +void noBaseBuilding::destroy() { - DestroyAllRoads(); + destroyAllRoads(); world->getNotifications().publish(BuildingNote(BuildingNote::Destroyed, player, pos, bldType_)); if(world->getGameInterface()) world->getGameInterface()->GI_UpdateMinimap(pos); // evtl Anbauten wieder abreißen - DestroyBuildingExtensions(); + destroyBuildingExtensions(); // Baukosten zurückerstatten (nicht bei Baustellen) const GlobalGameSettings& settings = world->getGGS(); @@ -126,15 +126,15 @@ void noBaseBuilding::Destroy() { // Ware erzeugen auto ware = std::make_unique(goods[which], nullptr, flag); - ware->WaitAtFlag(*flag); + ware->waitAtFlag(*flag); // Inventur anpassen - world->getPlayer(player).IncreaseInventoryWare(goods[which], 1); + world->getPlayer(player).increaseInventoryWare(goods[which], 1); // Abnehmer für Ware finden - ware->setGoal(world->getPlayer(player).FindClientForWare(*ware)); + ware->setGoal(world->getPlayer(player).findClientForWare(*ware)); // Ware soll ihren weiteren Weg berechnen - ware->RecalcRoute(); + ware->recalcRoute(); // Ware ablegen - flag->AddWare(std::move(ware)); + flag->addWare(std::move(ware)); if(!which) --boards; @@ -147,21 +147,21 @@ void noBaseBuilding::Destroy() } } - noRoadNode::Destroy(); + noRoadNode::destroy(); } void noBaseBuilding::Serialize(SerializedGameData& sgd) const { noRoadNode::Serialize(sgd); - sgd.PushEnum(bldType_); - sgd.PushEnum(nation); + sgd.pushEnum(bldType_); + sgd.pushEnum(nation); sgd.PushSignedInt(door_point_x); sgd.PushSignedInt(door_point_y); } noBaseBuilding::noBaseBuilding(SerializedGameData& sgd, const unsigned obj_id) - : noRoadNode(sgd, obj_id), bldType_(sgd.Pop()), nation(sgd.Pop()), + : noRoadNode(sgd, obj_id), bldType_(sgd.pop()), nation(sgd.pop()), door_point_x(sgd.PopSignedInt()), door_point_y(sgd.PopSignedInt()) {} @@ -224,7 +224,7 @@ bool noBaseBuilding::isConnected() const return false; } -void noBaseBuilding::WareNotNeeded(Ware* ware) +void noBaseBuilding::wareNotNeeded(Ware* ware) { if(!ware) { @@ -236,13 +236,13 @@ void noBaseBuilding::WareNotNeeded(Ware* ware) if(ware->isWaitingInWarehouse()) { // Bestellung im Lagerhaus stornieren - world->getPlayer(player).RemoveWare(*ware); + world->getPlayer(player).removeWare(*ware); static_cast(ware->getLocation())->cancelWare(ware); } else - ware->GoalDestroyed(); + ware->goalDestroyed(); } -void noBaseBuilding::DestroyBuildingExtensions() +void noBaseBuilding::destroyBuildingExtensions() { // Nur bei großen Gebäuden gibts diese Anbauten if(getSize() == BuildingQuality::Castle || getSize() == BuildingQuality::Harbor) @@ -251,7 +251,7 @@ void noBaseBuilding::DestroyBuildingExtensions() { const MapPoint neighbor = world->getNeighbour(pos, i); if(world->getNO(neighbor)->getType() == NodalObjectType::Extension) - world->DestroyNO(neighbor); + world->destroyNO(neighbor); } } } diff --git a/libs/s25main/buildings/noBaseBuilding.h b/libs/s25main/buildings/noBaseBuilding.h index 49f5013f38..6b3e224619 100644 --- a/libs/s25main/buildings/noBaseBuilding.h +++ b/libs/s25main/buildings/noBaseBuilding.h @@ -29,9 +29,9 @@ class noBaseBuilding : public noRoadNode int door_point_y; /// Ware Bescheid sagen, dass sie nicht mehr hierher kommen brauch - void WareNotNeeded(Ware* ware); + void wareNotNeeded(Ware* ware); /// Zerstört Anbauten, falls es sich um ein großes Gebäude handelt (wo es diese auch gibt) - void DestroyBuildingExtensions(); + void destroyBuildingExtensions(); public: noBaseBuilding(NodalObjectType nop, BuildingType type, MapPoint pos, unsigned char player); @@ -39,11 +39,11 @@ class noBaseBuilding : public noRoadNode ~noBaseBuilding() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; /// Eine bestellte Ware konnte doch nicht kommen - virtual void WareLost(Ware& ware) = 0; + virtual void wareLost(Ware& ware) = 0; BuildingQuality getSize() const; BuildingType getBuildingType() const { return bldType_; } @@ -69,9 +69,9 @@ class noBaseBuilding : public noRoadNode /*/// Gibt die Warenverteilungspunkte zurück (bei 0 wurde kein Weg gefunden) virtual unsigned CalcDistributionPoints(noRoadNode * start,const GoodType type) = 0;*/ /// Wird aufgerufen, wenn eine neue Ware zum dem Gebäude geliefert wird (nicht wenn sie bestellt wurde vom Gebäude!) - virtual void TakeWare(Ware* ware) = 0; + virtual void takeWare(Ware* ware) = 0; /// Wird aufgerufen, wenn ein bestimmter Arbeiter für das hier gerufen wurde - virtual void GotWorker(Job /*job*/, noFigure& /*worker*/){}; + virtual void gotWorker(Job /*job*/, noFigure& /*worker*/){}; /// Gibt ein Bild zurück für das normale Gebäude ITexture& getBuildingImage() const; diff --git a/libs/s25main/buildings/noBuilding.cpp b/libs/s25main/buildings/noBuilding.cpp index ab83f22379..c3755203aa 100644 --- a/libs/s25main/buildings/noBuilding.cpp +++ b/libs/s25main/buildings/noBuilding.cpp @@ -16,16 +16,16 @@ noBuilding::noBuilding(const BuildingType type, const MapPoint pos, const unsign : noBaseBuilding(NodalObjectType::Building, type, pos, player), opendoor(0) {} -void noBuilding::Destroy() +void noBuilding::destroy() { // First we have to remove the building from the map and the player // Replace by fire (huts and mines become small fire, rest big) world->setNO(pos, new noFire(pos, getSize() != BuildingQuality::Hut && getSize() != BuildingQuality::Mine), true); - world->getPlayer(player).RemoveBuilding(this, bldType_); + world->getPlayer(player).removeBuilding(this, bldType_); // Destroy derived buildings DestroyBuilding(); // Then go further down the chain - noBaseBuilding::Destroy(); + noBaseBuilding::destroy(); } void noBuilding::Serialize(SerializedGameData& sgd) const @@ -45,31 +45,31 @@ noBuilding::noBuilding(SerializedGameData& sgd, const unsigned obj_id) } } -void noBuilding::DrawBaseBuilding(DrawPoint drawPt) const +void noBuilding::drawBaseBuilding(DrawPoint drawPt) const { - getBuildingImage().DrawFull(drawPt); - DrawDoor(drawPt); + getBuildingImage().drawFull(drawPt); + drawDoor(drawPt); } -void noBuilding::DrawDoor(DrawPoint drawPt) const +void noBuilding::drawDoor(DrawPoint drawPt) const { if(!isDoorOpen()) return; - getDoorImage().DrawFull(drawPt); + getDoorImage().drawFull(drawPt); } -void noBuilding::OpenDoor() +void noBuilding::openDoor() { ++opendoor; } -void noBuilding::CloseDoor() +void noBuilding::closeDoor() { RTTR_Assert(isDoorOpen()); --opendoor; } -std::unique_ptr noBuilding::CreateFOWObject() const +std::unique_ptr noBuilding::createFOWObject() const { return std::make_unique(bldType_, nation); } diff --git a/libs/s25main/buildings/noBuilding.h b/libs/s25main/buildings/noBuilding.h index 491ce2ffc6..f5d94ff2ec 100644 --- a/libs/s25main/buildings/noBuilding.h +++ b/libs/s25main/buildings/noBuilding.h @@ -21,21 +21,21 @@ class noBuilding : public noBaseBuilding virtual void DestroyBuilding() = 0; public: - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; /// Draws the basic building (no fires etc.) with the door - void DrawBaseBuilding(DrawPoint drawPt) const; + void drawBaseBuilding(DrawPoint drawPt) const; /// Draws the door only (if building is drawn at x, y) - void DrawDoor(DrawPoint drawPt) const; + void drawDoor(DrawPoint drawPt) const; - void OpenDoor(); - void CloseDoor(); + void openDoor(); + void closeDoor(); bool isDoorOpen() const { return opendoor > 0; } /// Wird aufgerufen, wenn von der Fahne vor dem Gebäude ein Rohstoff aufgenommen wurde - virtual bool FreePlaceAtFlag() = 0; + virtual bool freePlaceAtFlag() = 0; /// Erzeugt von ihnen selbst ein FOW Objekt als visuelle "Erinnerung" für den Fog of War - std::unique_ptr CreateFOWObject() const override; + std::unique_ptr createFOWObject() const override; }; diff --git a/libs/s25main/buildings/noBuildingSite.cpp b/libs/s25main/buildings/noBuildingSite.cpp index 9285a9eff8..725cf7af84 100644 --- a/libs/s25main/buildings/noBuildingSite.cpp +++ b/libs/s25main/buildings/noBuildingSite.cpp @@ -44,13 +44,13 @@ noBuildingSite::noBuildingSite(const BuildingType type, const MapPoint pos, cons } // Wir hätten gerne einen Planierer/Bauarbeiter... - world->getPlayer(player).AddJobWanted((state == BuildingSiteState::Planing) ? Job::Planer : Job::Builder, this); + world->getPlayer(player).addJobWanted((state == BuildingSiteState::Planing) ? Job::Planer : Job::Builder, this); // Bauwaren anfordern - OrderConstructionMaterial(); + orderConstructionMaterial(); // Baustelle in den Index eintragen, damit die Wirtschaft auch Bescheid weiß - world->getPlayer(player).AddBuildingSite(this); + world->getPlayer(player).addBuildingSite(this); } /// Konstruktor für Hafenbaustellen vom Schiff aus @@ -61,40 +61,40 @@ noBuildingSite::noBuildingSite(const MapPoint pos, const unsigned char player) { GamePlayer& owner = world->getPlayer(player); // Baustelle in den Index eintragen, damit die Wirtschaft auch Bescheid weiß - owner.AddBuildingSite(this); + owner.addBuildingSite(this); // Bauarbeiter auch auf der Karte auftragen - builder = &world->AddFigure(pos, std::make_unique(pos, player, this)); + builder = &world->addFigure(pos, std::make_unique(pos, player, this)); // Baumaterialien in der Inventur verbuchen - owner.DecreaseInventoryWare(GoodType::Boards, boards); - owner.DecreaseInventoryWare(GoodType::Stones, stones); + owner.decreaseInventoryWare(GoodType::Boards, boards); + owner.decreaseInventoryWare(GoodType::Stones, stones); } noBuildingSite::~noBuildingSite() = default; -void noBuildingSite::Destroy() +void noBuildingSite::destroy() { // Bauarbeiter/Planierer Bescheid sagen if(builder) { - builder->LostWork(); + builder->lostWork(); builder = nullptr; } else if(planer) { - planer->LostWork(); + planer->lostWork(); planer = nullptr; } else - world->getPlayer(player).JobNotWanted(this); + world->getPlayer(player).jobNotWanted(this); RTTR_Assert(!builder); RTTR_Assert(!planer); // Bestellte Waren Bescheid sagen for(Ware* ordered_board : ordered_boards) - WareNotNeeded(ordered_board); + wareNotNeeded(ordered_board); ordered_boards.clear(); for(Ware* ordered_stone : ordered_stones) - WareNotNeeded(ordered_stone); + wareNotNeeded(ordered_stone); ordered_stones.clear(); // und Feld wird leer @@ -102,47 +102,47 @@ void noBuildingSite::Destroy() // Baustelle wieder aus der Liste entfernen - dont forget about expedition harbor status bool expeditionharbor = isHarborBuildingSiteFromSea(); - world->getPlayer(player).RemoveBuildingSite(this); + world->getPlayer(player).removeBuildingSite(this); - noBaseBuilding::Destroy(); + noBaseBuilding::destroy(); // Hafenbaustelle? if(expeditionharbor) { - world->RemoveHarborBuildingSiteFromSea(this); + world->removeHarborBuildingSiteFromSea(this); // Land neu berechnen nach zerstören weil da schon straßen etc entfernt werden - world->RecalcTerritory(*this, TerritoryChangeReason::Destroyed); + world->recalcTerritory(*this, TerritoryChangeReason::Destroyed); } - world->RecalcBQAroundPointBig(pos); + world->recalcBQAroundPointBig(pos); } void noBuildingSite::Serialize(SerializedGameData& sgd) const { noBaseBuilding::Serialize(sgd); - sgd.PushEnum(state); - sgd.PushObject(planer, true); - sgd.PushObject(builder, true); + sgd.pushEnum(state); + sgd.pushObject(planer, true); + sgd.pushObject(builder, true); sgd.PushUnsignedChar(boards); sgd.PushUnsignedChar(stones); sgd.PushUnsignedChar(used_boards); sgd.PushUnsignedChar(used_stones); sgd.PushUnsignedChar(build_progress); - sgd.PushObjectContainer(ordered_boards, true); - sgd.PushObjectContainer(ordered_stones, true); + sgd.pushObjectContainer(ordered_boards, true); + sgd.pushObjectContainer(ordered_stones, true); } noBuildingSite::noBuildingSite(SerializedGameData& sgd, const unsigned obj_id) - : noBaseBuilding(sgd, obj_id), state(sgd.Pop()), - planer(sgd.PopObject(GO_Type::NofPlaner)), builder(sgd.PopObject(GO_Type::NofBuilder)), + : noBaseBuilding(sgd, obj_id), state(sgd.pop()), + planer(sgd.popObject(GO_Type::NofPlaner)), builder(sgd.popObject(GO_Type::NofBuilder)), boards(sgd.PopUnsignedChar()), stones(sgd.PopUnsignedChar()), used_boards(sgd.PopUnsignedChar()), used_stones(sgd.PopUnsignedChar()), build_progress(sgd.PopUnsignedChar()) { - sgd.PopObjectContainer(ordered_boards, GO_Type::Ware); - sgd.PopObjectContainer(ordered_stones, GO_Type::Ware); + sgd.popObjectContainer(ordered_boards, GO_Type::Ware); + sgd.popObjectContainer(ordered_stones, GO_Type::Ware); } -void noBuildingSite::OrderConstructionMaterial() +void noBuildingSite::orderConstructionMaterial() { // Bei Planieren keine Waren bestellen if(state == BuildingSiteState::Planing) @@ -156,7 +156,7 @@ void noBuildingSite::OrderConstructionMaterial() GamePlayer& owner = world->getPlayer(player); for(int i = used_boards + boards + ordered_boards.size(); i < BUILDING_COSTS[bldType_].boards; ++i) { - Ware* w = owner.OrderWare(GoodType::Boards, *this); + Ware* w = owner.orderWare(GoodType::Boards, *this); if(!w) break; RTTR_Assert(helpers::contains(ordered_boards, w)); @@ -164,7 +164,7 @@ void noBuildingSite::OrderConstructionMaterial() // Steine for(int i = used_stones + stones + ordered_stones.size(); i < BUILDING_COSTS[bldType_].stones; ++i) { - Ware* w = owner.OrderWare(GoodType::Stones, *this); + Ware* w = owner.orderWare(GoodType::Stones, *this); if(!w) break; RTTR_Assert(helpers::contains(ordered_stones, w)); @@ -178,28 +178,28 @@ unsigned noBuildingSite::getMilitaryRadius() const return bldType_ == BuildingType::HarborBuilding ? HARBOR_RADIUS : 0; } -void noBuildingSite::Draw(DrawPoint drawPt) +void noBuildingSite::draw(DrawPoint drawPt) { if(state == BuildingSiteState::Planing) { // Baustellenschild mit Schatten zeichnen - LOADER.getNationImage(world->getPlayer(player).nation, 450)->DrawFull(drawPt); - LOADER.getNationImage(world->getPlayer(player).nation, 451)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getNationImage(world->getPlayer(player).nation, 450)->drawFull(drawPt); + LOADER.getNationImage(world->getPlayer(player).nation, 451)->drawFull(drawPt, COLOR_SHADOW); } else { // Baustellenstein und -schatten zeichnen - LOADER.getNationImage(world->getPlayer(player).nation, 455)->DrawFull(drawPt); - LOADER.getNationImage(world->getPlayer(player).nation, 456)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getNationImage(world->getPlayer(player).nation, 455)->drawFull(drawPt); + LOADER.getNationImage(world->getPlayer(player).nation, 456)->drawFull(drawPt, COLOR_SHADOW); // Waren auf der Baustelle // Bretter DrawPoint doorPos = drawPt + DrawPoint(getDoorPointX(), getDoorPointY()); for(unsigned char i = 0; i < boards; ++i) - LOADER.getWareStackTex(GoodType::Boards)->DrawFull(doorPos - DrawPoint(5, 10 + i * 4)); + LOADER.getWareStackTex(GoodType::Boards)->drawFull(doorPos - DrawPoint(5, 10 + i * 4)); // Steine for(unsigned char i = 0; i < stones; ++i) - LOADER.getWareStackTex(GoodType::Stones)->DrawFull(doorPos + DrawPoint(8, -12 - i * 4)); + LOADER.getWareStackTex(GoodType::Stones)->drawFull(doorPos + DrawPoint(8, -12 - i * 4)); // bis dahin gebautes Haus zeichnen @@ -228,12 +228,12 @@ void noBuildingSite::Draw(DrawPoint drawPt) } /// Erzeugt von ihnen selbst ein FOW Objekt als visuelle "Erinnerung" für den Fog of War -std::unique_ptr noBuildingSite::CreateFOWObject() const +std::unique_ptr noBuildingSite::createFOWObject() const { return std::make_unique(state == BuildingSiteState::Planing, bldType_, nation, build_progress); } -void noBuildingSite::GotWorker(Job /*job*/, noFigure& worker) +void noBuildingSite::gotWorker(Job /*job*/, noFigure& worker) { // Aha, wir haben nen Planierer/Bauarbeiter bekommen if(state == BuildingSiteState::Planing) @@ -247,15 +247,15 @@ void noBuildingSite::GotWorker(Job /*job*/, noFigure& worker) } } -void noBuildingSite::Abrogate() +void noBuildingSite::abrogate() { planer = nullptr; builder = nullptr; - world->getPlayer(player).AddJobWanted((state == BuildingSiteState::Planing) ? Job::Planer : Job::Builder, this); + world->getPlayer(player).addJobWanted((state == BuildingSiteState::Planing) ? Job::Planer : Job::Builder, this); } -unsigned noBuildingSite::CalcDistributionPoints(const GoodType goodtype) +unsigned noBuildingSite::calcDistributionPoints(const GoodType goodtype) { // Beim Planieren brauchen wir noch gar nichts if(state == BuildingSiteState::Planing) @@ -297,7 +297,7 @@ unsigned noBuildingSite::CalcDistributionPoints(const GoodType goodtype) return points; } -void noBuildingSite::AddWare(std::unique_ptr ware) +void noBuildingSite::addWare(std::unique_ptr ware) { RTTR_Assert(state == BuildingSiteState::Building); @@ -315,11 +315,11 @@ void noBuildingSite::AddWare(std::unique_ptr ware) throw std::logic_error("Wrong ware type " + helpers::toString(ware->type)); // Inventur entsprechend verringern - world->getPlayer(player).DecreaseInventoryWare(ware->type, 1); - world->getPlayer(player).RemoveWare(*ware); + world->getPlayer(player).decreaseInventoryWare(ware->type, 1); + world->getPlayer(player).removeWare(*ware); } -void noBuildingSite::WareLost(Ware& ware) +void noBuildingSite::wareLost(Ware& ware) { RTTR_Assert(state == BuildingSiteState::Building); @@ -334,10 +334,10 @@ void noBuildingSite::WareLost(Ware& ware) } else throw std::logic_error("Wrong ware type lost " + helpers::toString(ware.type)); - OrderConstructionMaterial(); + orderConstructionMaterial(); } -void noBuildingSite::TakeWare(Ware* ware) +void noBuildingSite::takeWare(Ware* ware) { RTTR_Assert(state == BuildingSiteState::Building); @@ -371,17 +371,17 @@ unsigned char noBuildingSite::getBuildProgress(bool percent) const } /// Aufgerufen, wenn Planierung beendet wurde -void noBuildingSite::PlaningFinished() +void noBuildingSite::planingFinished() { /// Normale Baustelle state = BuildingSiteState::Building; planer = nullptr; // Wir hätten gerne einen Bauarbeiter... - world->getPlayer(player).AddJobWanted(Job::Builder, this); + world->getPlayer(player).addJobWanted(Job::Builder, this); // Bauwaren anfordern - OrderConstructionMaterial(); + orderConstructionMaterial(); } /// Gibt zurück, ob eine bestimmte Baustellen eine Baustelle ist, die vom Schiff aus errichtet wurde diff --git a/libs/s25main/buildings/noBuildingSite.h b/libs/s25main/buildings/noBuildingSite.h index 41512d21cc..6a59090816 100644 --- a/libs/s25main/buildings/noBuildingSite.h +++ b/libs/s25main/buildings/noBuildingSite.h @@ -56,38 +56,38 @@ class noBuildingSite : public noBaseBuilding ~noBuildingSite() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Buildingsite; } unsigned getMilitaryRadius() const override; - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; /// Erzeugt von ihnen selbst ein FOW Objekt als visuelle "Erinnerung" für den Fog of War - std::unique_ptr CreateFOWObject() const override; + std::unique_ptr createFOWObject() const override; - void AddWare(std::unique_ptr ware) override; - void GotWorker(Job job, noFigure& worker) override; + void addWare(std::unique_ptr ware) override; + void gotWorker(Job job, noFigure& worker) override; /// Fordert Baumaterial an - void OrderConstructionMaterial(); + void orderConstructionMaterial(); /// Wird aufgerufen, wenn der Bauarbeiter kündigt - void Abrogate(); + void abrogate(); /// Eine bestellte Ware konnte doch nicht kommen - void WareLost(Ware& ware) override; + void wareLost(Ware& ware) override; /// Gibt den Bau-Fortschritt zurück unsigned char getBuildProgress(bool percent = true) const; - unsigned CalcDistributionPoints(GoodType goodtype); + unsigned calcDistributionPoints(GoodType goodtype); /// Wird aufgerufen, wenn eine neue Ware zum dem Gebäude geliefert wird (nicht wenn sie bestellt wurde vom Gebäude!) - void TakeWare(Ware* ware) override; + void takeWare(Ware* ware) override; /// Gibt zurück, ob die Baustelle fertiggestellt ist bool isBuildingComplete(); /// Aufgerufen, wenn Planierung beendet wurde - void PlaningFinished(); + void planingFinished(); /// Gibt zurück, ob eine bestimmte Baustellen eine Baustelle ist, die vom Schiff aus errichtet wurde bool isHarborBuildingSiteFromSea() const; }; diff --git a/libs/s25main/buildings/nobBaseMilitary.cpp b/libs/s25main/buildings/nobBaseMilitary.cpp index 8d701f54bb..79b7b9611c 100644 --- a/libs/s25main/buildings/nobBaseMilitary.cpp +++ b/libs/s25main/buildings/nobBaseMilitary.cpp @@ -33,55 +33,55 @@ void nobBaseMilitary::DestroyBuilding() // ATTENTION: iterators can be deleted in HomeDestroyed, -> copy first std::vector tmpTroopsOnMission(troops_on_mission.begin(), troops_on_mission.end()); for(auto* it : tmpTroopsOnMission) - it->HomeDestroyed(); + it->homeDestroyed(); troops_on_mission.clear(); // Notify soldiers attacking this building // ATTENTION: iterators can be deleted in AttackedGoalDestroyed, -> copy first std::vector tmpAggressors(aggressors.begin(), aggressors.end()); for(auto* tmpAggressor : tmpAggressors) - tmpAggressor->AttackedGoalDestroyed(); + tmpAggressor->attackedGoalDestroyed(); aggressors.clear(); // Notify soldiers from other buildings defending this std::vector tmpDefenders(aggressive_defenders.begin(), aggressive_defenders.end()); for(auto* tmpDefender : tmpDefenders) - tmpDefender->AttackedGoalDestroyed(); + tmpDefender->attackedGoalDestroyed(); aggressive_defenders.clear(); if(defender_) { - defender_->HomeDestroyed(); + defender_->homeDestroyed(); defender_ = nullptr; } - getEvMgr().RemoveEvent(leaving_event); + getEvMgr().removeEvent(leaving_event); // Put all leaving figures outside for(auto& fig : leave_house) { - noFigure& figRef = world->AddFigure(pos, std::move(fig)); + noFigure& figRef = world->addFigure(pos, std::move(fig)); // DoJobWorks implies ActiveSoldier or TradeDonkey // Notify the soldier if(figRef.isDoingJobWorks() && dynamic_cast(&figRef)) - static_cast(figRef).HomeDestroyedAtBegin(); + static_cast(figRef).homeDestroyedAtBegin(); else { - figRef.Abrogate(); - figRef.StartWandering(); - figRef.StartWalking(RANDOM_ENUM(Direction)); + figRef.abrogate(); + figRef.startWandering(); + figRef.startWalking(RANDOM_ENUM(Direction)); } } leave_house.clear(); // Let close military buildings recalculate distances to update flags etc. - sortedMilitaryBlds buildings = world->LookForMilitaryBuildings(pos, 3); + sortedMilitaryBlds buildings = world->lookForMilitaryBuildings(pos, 3); for(auto* building : buildings) { if(building->getPlayer() != player && BuildingProperties::isMilitary(building->getBuildingType())) - static_cast(building)->LookForEnemyBuildings(this); + static_cast(building)->lookForEnemyBuildings(this); } } @@ -89,44 +89,44 @@ void nobBaseMilitary::Serialize(SerializedGameData& sgd) const { noBuilding::Serialize(sgd); - sgd.PushObjectContainer(leave_house); - sgd.PushEvent(leaving_event); + sgd.pushObjectContainer(leave_house); + sgd.pushEvent(leaving_event); sgd.PushBool(go_out); - sgd.PushObjectContainer(troops_on_mission); - sgd.PushObjectContainer(aggressors, true); - sgd.PushObjectContainer(aggressive_defenders, true); - sgd.PushObject(defender_, true); + sgd.pushObjectContainer(troops_on_mission); + sgd.pushObjectContainer(aggressors, true); + sgd.pushObjectContainer(aggressive_defenders, true); + sgd.pushObject(defender_, true); } nobBaseMilitary::nobBaseMilitary(SerializedGameData& sgd, const unsigned obj_id) : noBuilding(sgd, obj_id) { - sgd.PopObjectContainer(leave_house); - leaving_event = sgd.PopEvent(); + sgd.popObjectContainer(leave_house); + leaving_event = sgd.popEvent(); go_out = sgd.PopBool(); if(sgd.getGameDataVersion() < 14) sgd.PopUnsignedInt(); // former age - sgd.PopObjectContainer(troops_on_mission); - sgd.PopObjectContainer(aggressors, GO_Type::NofAttacker); - sgd.PopObjectContainer(aggressive_defenders, GO_Type::NofAggressivedefender); - defender_ = sgd.PopObject(GO_Type::NofDefender); + sgd.popObjectContainer(troops_on_mission); + sgd.popObjectContainer(aggressors, GO_Type::NofAttacker); + sgd.popObjectContainer(aggressive_defenders, GO_Type::NofAggressivedefender); + defender_ = sgd.popObject(GO_Type::NofDefender); } -void nobBaseMilitary::AddLeavingEvent() +void nobBaseMilitary::addLeavingEvent() { if(!go_out) { - leaving_event = getEvMgr().AddEvent(this, 20 + RANDOM_RAND(10)); + leaving_event = getEvMgr().addEvent(this, 20 + RANDOM_RAND(10)); go_out = true; } } -void nobBaseMilitary::AddLeavingFigure(std::unique_ptr fig) +void nobBaseMilitary::addLeavingFigure(std::unique_ptr fig) { - AddLeavingEvent(); + addLeavingEvent(); leave_house.push_back(std::move(fig)); } -nofAttacker* nobBaseMilitary::FindAggressor(nofAggressiveDefender& defender) +nofAttacker* nobBaseMilitary::findAggressor(nofAggressiveDefender& defender) { // Look for other attackers on this building that are close and ready to fight for(nofAttacker* aggressor : aggressors) @@ -140,16 +140,16 @@ nofAttacker* nobBaseMilitary::FindAggressor(nofAggressiveDefender& defender) if(attackerPos == defenderPos) { // Both are at same pos --> Go! - aggressor->LetsFight(defender); + aggressor->letsFight(defender); return aggressor; } // Check roughly the distance - if(world->CalcDistance(attackerPos, defenderPos) <= 5) + if(world->calcDistance(attackerPos, defenderPos) <= 5) { // Check it further (e.g. if they have to walk around a river...) - if(world->FindHumanPath(attackerPos, defenderPos, 5)) + if(world->findHumanPath(attackerPos, defenderPos, 5)) { - aggressor->LetsFight(defender); + aggressor->letsFight(defender); return aggressor; } } @@ -158,7 +158,7 @@ nofAttacker* nobBaseMilitary::FindAggressor(nofAggressiveDefender& defender) return nullptr; } -MapPoint nobBaseMilitary::FindAnAttackerPlace(unsigned short& ret_radius, const nofAttacker& soldier) +MapPoint nobBaseMilitary::findAnAttackerPlace(unsigned short& ret_radius, const nofAttacker& soldier) { const MapPoint flagPos = getFlagPos(); const MapPoint soldierPos = soldier.getPos(); @@ -173,7 +173,7 @@ MapPoint nobBaseMilitary::FindAnAttackerPlace(unsigned short& ret_radius, const // Also check if we can reach this. // If not, still consider the other points as the flag could become reachable by then. // TODO(Replay) Limit distance by MAX_ATTACKING_RUN_DISTANCE - if(soldierPos == flagPos || world->FindHumanPath(soldierPos, flagPos) != std::nullopt) + if(soldierPos == flagPos || world->findHumanPath(soldierPos, flagPos) != std::nullopt) { ret_radius = 0; return flagPos; @@ -182,7 +182,7 @@ MapPoint nobBaseMilitary::FindAnAttackerPlace(unsigned short& ret_radius, const // Check all points around the flag and take shortest unsigned min_length = std::numeric_limits::max(); - MapPoint minPt = MapPoint::Invalid(); + MapPoint minPt = MapPoint::invalid(); constexpr auto MAX_RADIUS = 3; ret_radius = MAX_RADIUS; for(const auto& node : world->getPointsInRadius(flagPos, MAX_RADIUS, ReturnMapPointWithRadius{})) @@ -191,7 +191,7 @@ MapPoint nobBaseMilitary::FindAnAttackerPlace(unsigned short& ret_radius, const if(node.second > ret_radius) break; - if(!world->ValidWaitingAroundBuildingPoint(node.first, pos)) + if(!world->validWaitingAroundBuildingPoint(node.first, pos)) continue; // If this is where the soldier currently is, it is already the shortest possible distance @@ -204,7 +204,7 @@ MapPoint nobBaseMilitary::FindAnAttackerPlace(unsigned short& ret_radius, const unsigned length = 0; // Is there a path at all? // TODO(Replay) Limit distance by MAX_ATTACKING_RUN_DISTANCE instead of 100 - if(world->FindHumanPath(soldierPos, node.first, 100, false, &length)) + if(world->findHumanPath(soldierPos, node.first, 100, false, &length)) { // Take if shorter if(length < min_length) @@ -218,7 +218,7 @@ MapPoint nobBaseMilitary::FindAnAttackerPlace(unsigned short& ret_radius, const return minPt; } -bool nobBaseMilitary::CallDefender(nofAttacker& attacker) +bool nobBaseMilitary::callDefender(nofAttacker& attacker) { // Stop attacking soldiers (including aggressive defenders) from leaving this building for(auto it = leave_house.begin(); it != leave_house.end();) @@ -230,10 +230,10 @@ bool nobBaseMilitary::CallDefender(nofAttacker& attacker) // At this point there shouldn't be a defender leaving as we are just requesting one RTTR_Assert(soldier->getGOT() != GO_Type::NofDefender); it = leave_house.erase(it); - FigureLeft(*soldier); + figureLeft(*soldier); - soldier->InformTargetsAboutCancelling(); - AddActiveSoldier(std::move(soldier)); + soldier->informTargetsAboutCancelling(); + addActiveSoldier(std::move(soldier)); } else { // If a leaving active soldier is not on a mission he doesn't belong to this building. @@ -245,20 +245,20 @@ bool nobBaseMilitary::CallDefender(nofAttacker& attacker) // Use existing defender (e.g. just going back in) if possible if(defender_) { - defender_->NewAttacker(attacker); + defender_->newAttacker(attacker); return true; } - auto defender = ProvideDefender(attacker); + auto defender = provideDefender(attacker); if(!defender) return false; // Building empty -> Can be conquered // Soldat muss noch rauskommen defender_ = defender.get(); - AddLeavingFigure(std::move(defender)); + addLeavingFigure(std::move(defender)); return true; } -nofAttacker* nobBaseMilitary::FindAttackerNearBuilding() +nofAttacker* nobBaseMilitary::findAttackerNearBuilding() { nofAttacker* best_attacker = nullptr; do @@ -280,13 +280,13 @@ nofAttacker* nobBaseMilitary::FindAttackerNearBuilding() } // Return the attacker if found and he starts attacking, else try again // The current one will be removed from aggressors or not be ready again - if(best_attacker && best_attacker->AttackDefenderAtFlag()) + if(best_attacker && best_attacker->attackDefenderAtFlag()) return best_attacker; } while(best_attacker); // Stop if we didn't found any attacker at all return nullptr; } -void nobBaseMilitary::CheckArrestedAttackers() +void nobBaseMilitary::checkArrestedAttackers() { for(nofAttacker* aggressor : aggressors) { @@ -294,16 +294,16 @@ void nobBaseMilitary::CheckArrestedAttackers() if(aggressor->isAttackerReady()) { // Can he still reach the flag? Could be blocked by other soldiers - if(world->FindHumanPath(aggressor->getPos(), world->getNeighbour(pos, Direction::SouthEast), 5, false)) + if(world->findHumanPath(aggressor->getPos(), world->getNeighbour(pos, Direction::SouthEast), 5, false)) { - aggressor->AttackFlag(); + aggressor->attackFlag(); return; } } } } -bool nobBaseMilitary::SendSuccessor(const MapPoint pt, const unsigned short radius) +bool nobBaseMilitary::sendSuccessor(const MapPoint pt, const unsigned short radius) { for(nofAttacker* aggressor : aggressors) { @@ -312,9 +312,9 @@ bool nobBaseMilitary::SendSuccessor(const MapPoint pt, const unsigned short radi // Only move closer if(aggressor->getRadius() > radius) { - if(world->FindHumanPath(aggressor->getPos(), pt, 50, false)) + if(world->findHumanPath(aggressor->getPos(), pt, 50, false)) { - aggressor->StartSucceeding(pt, radius); + aggressor->startSucceeding(pt, radius); return true; } } @@ -331,7 +331,7 @@ bool nobBaseMilitary::isAttackable(unsigned playerIdx) const return false; // If we cannot be seen by the player -> not attackable - if(world->CalcVisiblityWithAllies(pos, playerIdx) != Visibility::Visible) + if(world->calcVisiblityWithAllies(pos, playerIdx) != Visibility::Visible) return false; // Else it depends on the team settings return world->getPlayer(player).isAttackable(playerIdx); diff --git a/libs/s25main/buildings/nobBaseMilitary.h b/libs/s25main/buildings/nobBaseMilitary.h index 16994128e1..38f8afa2d6 100644 --- a/libs/s25main/buildings/nobBaseMilitary.h +++ b/libs/s25main/buildings/nobBaseMilitary.h @@ -60,56 +60,56 @@ class nobBaseMilitary : public noBuilding /// Meldet ein neues "Rausgeh"-Event an, falls gerade keiner rausgeht /// (damit nicht alle auf einmal rauskommen), für Lager- und Militärhäuser) - void AddLeavingEvent(); + void addLeavingEvent(); /// Fügt aktiven Soldaten (der aus von einer Mission) zum Militärgebäude hinzu - virtual void AddActiveSoldier(std::unique_ptr soldier) = 0; + virtual void addActiveSoldier(std::unique_ptr soldier) = 0; /// Schickt einen Verteidiger raus, der einem Angreifer in den Weg rennt - virtual nofAggressiveDefender* SendAggressiveDefender(nofAttacker& attacker) = 0; + virtual nofAggressiveDefender* sendAggressiveDefender(nofAttacker& attacker) = 0; /// Soldaten zur Angreifer-Liste hinzufügen und wieder entfernen - void LinkAggressor(nofAttacker& soldier) { aggressors.push_back(&soldier); } - virtual void UnlinkAggressor(nofAttacker& soldier) + void linkAggressor(nofAttacker& soldier) { aggressors.push_back(&soldier); } + virtual void unlinkAggressor(nofAttacker& soldier) { RTTR_Assert(isAggressor(soldier)); aggressors.remove(&soldier); } /// Soldaten zur Aggressiven-Verteidiger-Liste hinzufügen und wieder entfernen - void LinkAggressiveDefender(nofAggressiveDefender& soldier) { aggressive_defenders.push_back(&soldier); } - void UnlinkAggressiveDefender(nofAggressiveDefender& soldier) + void linkAggressiveDefender(nofAggressiveDefender& soldier) { aggressive_defenders.push_back(&soldier); } + void unlinkAggressiveDefender(nofAggressiveDefender& soldier) { RTTR_Assert(isAggressiveDefender(soldier)); aggressive_defenders.remove(&soldier); } /// Wird aufgerufen, wenn ein Soldat nicht mehr kommen kann - virtual void SoldierLost(nofSoldier* soldier) = 0; + virtual void soldierLost(nofSoldier* soldier) = 0; /// Sucht einen Angreifer auf das Gebäude, der gerade nichts zu tun hat und Lust hat zum Kämpfen /// und in der Nähe von x,y ist (wird von aggressiven Verteidigern aufgerufen), wenn keiner gefunden wird, wird 0 /// zurückgegeben - nofAttacker* FindAggressor(nofAggressiveDefender& defender); + nofAttacker* findAggressor(nofAggressiveDefender& defender); /// Sucht für einen Angreifer den nächsten (bzw. genau den) Platz zur Fahne, damit die sich darum postieren und /// warten - MapPoint FindAnAttackerPlace(unsigned short& ret_radius, const nofAttacker& soldier); + MapPoint findAnAttackerPlace(unsigned short& ret_radius, const nofAttacker& soldier); /// Sucht einen Nachrücker, der weiter hinten steht, auf diesen Posten und schickt diesen auch los - bool SendSuccessor(MapPoint pt, unsigned short radius); + bool sendSuccessor(MapPoint pt, unsigned short radius); /// Gibt zurück, ob es noch einenen Verteidiger in dieser Hütte gibt, wenn ja wird dieser losgeschickt, /// aggressor ist der Angreifer an der Fahne, mit dem er kämpfen soll - bool CallDefender(nofAttacker& attacker); + bool callDefender(nofAttacker& attacker); /// Sucht einen Angreifer auf dieses Gebäude und schickt ihn ggf. zur Flagge zum Kämpfen - nofAttacker* FindAttackerNearBuilding(); + nofAttacker* findAttackerNearBuilding(); /// Wird aufgerufen nach einem Kampf an einer Flagge, der evtl. die anderen Soldaten gehindert hat, zur Flagge /// zu kommen, diese Funktion sucht nach solchen Soldaten schickt einen ggf. zur Flagge, um anzugreifen - void CheckArrestedAttackers(); + void checkArrestedAttackers(); /// Der Verteidiger ist entweder tot oder wieder reingegegangen - void ResetDefender() { defender_ = nullptr; } + void resetDefender() { defender_ = nullptr; } /// Sind noch Truppen drinne, die dieses Gebäude verteidigen können - virtual bool DefendersAvailable() const = 0; + virtual bool defendersAvailable() const = 0; /// Return the list of all current aggressors, that is enemy soldiers currently attacking this military building. const std::list& getAggressors() const { return aggressors; } @@ -137,11 +137,11 @@ class nobBaseMilitary : public noBuilding protected: /// The building shall provide a soldier for defense. Return nullptr if none available - virtual std::unique_ptr ProvideDefender(nofAttacker& attacker) = 0; + virtual std::unique_ptr provideDefender(nofAttacker& attacker) = 0; /// Add a figure that will leave the house - void AddLeavingFigure(std::unique_ptr fig); + void addLeavingFigure(std::unique_ptr fig); /// Called when a figure has left the building, i.e. the leave queue - virtual void FigureLeft(const noFigure& fig) = 0; + virtual void figureLeft(const noFigure& fig) = 0; }; class sortedMilitaryBlds : public boost::container::flat_set diff --git a/libs/s25main/buildings/nobBaseWarehouse.cpp b/libs/s25main/buildings/nobBaseWarehouse.cpp index 5a5da957e7..1542f5f62c 100644 --- a/libs/s25main/buildings/nobBaseWarehouse.cpp +++ b/libs/s25main/buildings/nobBaseWarehouse.cpp @@ -55,7 +55,7 @@ nobBaseWarehouse::nobBaseWarehouse(const BuildingType type, const MapPoint pos, : nobBaseMilitary(type, pos, player, nation), fetch_double_protection(false), recruiting_event(nullptr), empty_event(nullptr), store_event(nullptr) { - producinghelpers_event = getEvMgr().AddEvent(this, PRODUCE_HELPERS_GF + RANDOM_RAND(PRODUCE_HELPERS_RANDOM_GF), 1); + producinghelpers_event = getEvMgr().addEvent(this, PRODUCE_HELPERS_GF + RANDOM_RAND(PRODUCE_HELPERS_RANDOM_GF), 1); // Reserve nullen reserve_soldiers_available.fill(0); reserve_soldiers_available_with_armor.fill(0); @@ -74,47 +74,47 @@ void nobBaseWarehouse::DestroyBuilding() if(dependent_figure->getPos() == getPos()) { dependent_figure->setGoalTonullptr(); - dependent_figure->CutCurrentRoad(); - dependent_figure->StartWandering(); + dependent_figure->cutCurrentRoad(); + dependent_figure->startWandering(); } else - dependent_figure->GoHome(); + dependent_figure->goHome(); } dependent_figures.clear(); for(Ware* dependent_ware : dependent_wares) - WareNotNeeded(dependent_ware); + wareNotNeeded(dependent_ware); dependent_wares.clear(); // ggf. Events abmelden - getEvMgr().RemoveEvent(recruiting_event); - getEvMgr().RemoveEvent(producinghelpers_event); - getEvMgr().RemoveEvent(empty_event); - getEvMgr().RemoveEvent(store_event); + getEvMgr().removeEvent(recruiting_event); + getEvMgr().removeEvent(producinghelpers_event); + getEvMgr().removeEvent(empty_event); + getEvMgr().removeEvent(store_event); // Waiting Wares löschen for(auto& waiting_ware : waiting_wares) { - waiting_ware->WareLost(player); - waiting_ware->Destroy(); + waiting_ware->wareLost(player); + waiting_ware->destroy(); } waiting_wares.clear(); // restliche Warenbestände von der Inventur wieder abziehen for(const auto good : helpers::enumRange()) - world->getPlayer(player).DecreaseInventoryWare(good, inventory[good]); + world->getPlayer(player).decreaseInventoryWare(good, inventory[good]); // move soldiers from reserve to inventory. for(unsigned rank = 0; rank < world->getGGS().getMaxMilitaryRank(); ++rank) { if(reserve_soldiers_available[rank] > 0) { - inventory.real.Add(SOLDIER_JOBS[rank], reserve_soldiers_available[rank]); - inventory.real.Add(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[rank]), + inventory.real.add(SOLDIER_JOBS[rank], reserve_soldiers_available[rank]); + inventory.real.add(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[rank]), reserve_soldiers_available_with_armor[rank]); } } // Objekt, das die flüchtenden Leute nach und nach ausspuckt, erzeugen - world->AddFigure(pos, std::make_unique(pos, player, inventory.real.peopleOnly())); + world->addFigure(pos, std::make_unique(pos, player, inventory.real.peopleOnly())); nobBaseMilitary::DestroyBuilding(); } @@ -123,14 +123,14 @@ void nobBaseWarehouse::Serialize(SerializedGameData& sgd) const { nobBaseMilitary::Serialize(sgd); - sgd.PushObjectContainer(waiting_wares, true); + sgd.pushObjectContainer(waiting_wares, true); sgd.PushBool(fetch_double_protection); - sgd.PushObjectContainer(dependent_figures); - sgd.PushObjectContainer(dependent_wares, true); - sgd.PushEvent(producinghelpers_event); - sgd.PushEvent(recruiting_event); - sgd.PushEvent(empty_event); - sgd.PushEvent(store_event); + sgd.pushObjectContainer(dependent_figures); + sgd.pushObjectContainer(dependent_wares, true); + sgd.pushEvent(producinghelpers_event); + sgd.pushEvent(recruiting_event); + sgd.pushEvent(empty_event); + sgd.pushEvent(store_event); for(unsigned i = 0; i < 5; ++i) { @@ -159,15 +159,15 @@ void nobBaseWarehouse::Serialize(SerializedGameData& sgd) const nobBaseWarehouse::nobBaseWarehouse(SerializedGameData& sgd, const unsigned obj_id) : nobBaseMilitary(sgd, obj_id) { - sgd.PopObjectContainer(waiting_wares, GO_Type::Ware); + sgd.popObjectContainer(waiting_wares, GO_Type::Ware); fetch_double_protection = sgd.PopBool(); - sgd.PopObjectContainer(dependent_figures); - sgd.PopObjectContainer(dependent_wares, GO_Type::Ware); + sgd.popObjectContainer(dependent_figures); + sgd.popObjectContainer(dependent_wares, GO_Type::Ware); - producinghelpers_event = sgd.PopEvent(); - recruiting_event = sgd.PopEvent(); - empty_event = sgd.PopEvent(); - store_event = sgd.PopEvent(); + producinghelpers_event = sgd.popEvent(); + recruiting_event = sgd.popEvent(); + empty_event = sgd.popEvent(); + store_event = sgd.popEvent(); reserve_soldiers_available_with_armor.fill(0); for(unsigned i = 0; i < 5; ++i) @@ -187,8 +187,8 @@ nobBaseWarehouse::nobBaseWarehouse(SerializedGameData& sgd, const unsigned obj_i if(sgd.getGameDataVersion() < 12 && leatheraddon::isLeatherAddonGoodType(i)) continue; - inventory.visual.Add(i, sgd.PopUnsignedInt()); - inventory.real.Add(i, sgd.PopUnsignedInt()); + inventory.visual.add(i, sgd.PopUnsignedInt()); + inventory.real.add(i, sgd.PopUnsignedInt()); inventorySettings[i] = inventorySettingsVisual[i] = static_cast(sgd.PopUnsignedChar()); } for(const auto i : helpers::enumRange()) @@ -199,8 +199,8 @@ nobBaseWarehouse::nobBaseWarehouse(SerializedGameData& sgd, const unsigned obj_i if(sgd.getGameDataVersion() < 12 && leatheraddon::isLeatherAddonJobType(i)) continue; - inventory.visual.Add(i, sgd.PopUnsignedInt()); - inventory.real.Add(i, sgd.PopUnsignedInt()); + inventory.visual.add(i, sgd.PopUnsignedInt()); + inventory.real.add(i, sgd.PopUnsignedInt()); inventorySettings[i] = inventorySettingsVisual[i] = static_cast(sgd.PopUnsignedChar()); } if(sgd.getGameDataVersion() >= 12) @@ -210,38 +210,38 @@ nobBaseWarehouse::nobBaseWarehouse(SerializedGameData& sgd, const unsigned obj_i } } -void nobBaseWarehouse::Clear() +void nobBaseWarehouse::clear() { // Add reserve soldiers back for(unsigned i = 0; i < reserve_soldiers_available.size(); i++) { - inventory.Add(SOLDIER_JOBS[i], reserve_soldiers_available[i]); - inventory.Add(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i]), reserve_soldiers_available_with_armor[i]); + inventory.add(SOLDIER_JOBS[i], reserve_soldiers_available[i]); + inventory.add(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i]), reserve_soldiers_available_with_armor[i]); } reserve_soldiers_available.fill(0); reserve_soldiers_available_with_armor.fill(0); GamePlayer& owner = world->getPlayer(player); for(const auto i : helpers::enumRange()) - owner.DecreaseInventoryWare(i, inventory[i]); + owner.decreaseInventoryWare(i, inventory[i]); for(const auto i : helpers::enumRange()) - owner.DecreaseInventoryJob(i, inventory[i]); + owner.decreaseInventoryJob(i, inventory[i]); for(const auto i : helpers::enumRange()) - owner.DecreaseInventoryJob(i, inventory[i]); + owner.decreaseInventoryJob(i, inventory[i]); inventory.clear(); for(auto& waiting_ware : waiting_wares) { - waiting_ware->WareLost(player); - waiting_ware->Destroy(); + waiting_ware->wareLost(player); + waiting_ware->destroy(); } waiting_wares.clear(); } -void nobBaseWarehouse::OrderCarrier(noRoadNode& goal, RoadSegment& workplace) +void nobBaseWarehouse::orderCarrier(noRoadNode& goal, RoadSegment& workplace) { RTTR_Assert(workplace.getCarrier(0) == nullptr); const bool isBoatRequired = workplace.getRoadType() == RoadType::Water; @@ -255,53 +255,53 @@ void nobBaseWarehouse::OrderCarrier(noRoadNode& goal, RoadSegment& workplace) isBoatRequired ? CarrierType::Boat : CarrierType::Normal, pos, player, &workplace, &goal); workplace.setCarrier(0, static_cast(carrier.get())); - if(!UseFigureAtOnce(carrier, goal)) - AddLeavingFigure(std::move(carrier)); + if(!useFigureAtOnce(carrier, goal)) + addLeavingFigure(std::move(carrier)); - inventory.real.Remove(Job::Helper); + inventory.real.remove(Job::Helper); if(isBoatRequired) - inventory.real.Remove(GoodType::Boat); + inventory.real.remove(GoodType::Boat); // Evtl. kein Gehilfe mehr, sodass das Rekrutieren gestoppt werden muss - TryStopRecruiting(); + tryStopRecruiting(); } -bool nobBaseWarehouse::OrderJob(const Job job, noRoadNode& goal, const bool allow_recruiting) +bool nobBaseWarehouse::orderJob(const Job job, noRoadNode& goal, const bool allow_recruiting) { // Maybe we have to recruit one if(!inventory[job]) { - if(!allow_recruiting || !TryRecruitJob(job)) + if(!allow_recruiting || !tryRecruitJob(job)) return false; } - std::unique_ptr fig = JobFactory::CreateJob(job, pos, player, goal); + std::unique_ptr fig = JobFactory::createJob(job, pos, player, goal); if(isSoldier(fig->getJobType())) { if(inventory.real[jobEnumToAmoredSoldierEnum(job)] > 0) { - inventory.real.Remove(jobEnumToAmoredSoldierEnum(job)); + inventory.real.remove(jobEnumToAmoredSoldierEnum(job)); fig->setArmor(true); } } // Ziel Bescheid sagen, dass dortin ein neuer Arbeiter kommt (bei Flaggen als das anders machen) if(goal.getType() != NodalObjectType::Flag) - checkedCast(goal).GotWorker(job, *fig); + checkedCast(goal).gotWorker(job, *fig); // Wenn Figur nicht sofort von abgeleiteter Klasse verwenet wird, fügen wir die zur Leave-Liste hinzu - if(!UseFigureAtOnce(fig, goal)) - AddLeavingFigure(std::move(fig)); + if(!useFigureAtOnce(fig, goal)) + addLeavingFigure(std::move(fig)); - inventory.real.Remove(job); + inventory.real.remove(job); // Evtl. kein Gehilfe mehr da, sodass das Rekrutieren gestoppt werden muss - TryStopRecruiting(); + tryStopRecruiting(); return true; } -nofCarrier* nobBaseWarehouse::OrderDonkey(RoadSegment& road, noRoadNode& goal_flag) +nofCarrier* nobBaseWarehouse::orderDonkey(RoadSegment& road, noRoadNode& goal_flag) { // Überhaupt ein Esel vorhanden? if(!inventory[Job::PackDonkey]) @@ -309,40 +309,40 @@ nofCarrier* nobBaseWarehouse::OrderDonkey(RoadSegment& road, noRoadNode& goal_fl auto donkey = std::make_unique(CarrierType::Donkey, pos, player, &road, &goal_flag); nofCarrier* donkeyRef = donkey.get(); - AddLeavingFigure(std::move(donkey)); - inventory.real.Remove(Job::PackDonkey); + addLeavingFigure(std::move(donkey)); + inventory.real.remove(Job::PackDonkey); return donkeyRef; } -void nobBaseWarehouse::HandleBaseEvent(const unsigned id) +void nobBaseWarehouse::handleBaseEvent(const unsigned id) { switch(id) { case 0: leaving_event = nullptr; - HandleLeaveEvent(); + handleLeaveEvent(); break; case 1: producinghelpers_event = nullptr; - HandleProduceHelperEvent(); + handleProduceHelperEvent(); break; case 2: recruiting_event = nullptr; - HandleRecrutingEvent(); + handleRecrutingEvent(); break; case 3: empty_event = nullptr; - HandleSendoutEvent(); + handleSendoutEvent(); break; case 4: store_event = nullptr; - HandleCollectEvent(); + handleCollectEvent(); break; } } -void nobBaseWarehouse::HandleCollectEvent() +void nobBaseWarehouse::handleCollectEvent() { // Storing wares done? bool storing_done = false; @@ -359,12 +359,12 @@ void nobBaseWarehouse::HandleCollectEvent() storing_wanted = true; // Lagerhaus suchen, das diese Ware enthält - nobBaseWarehouse* wh = world->getPlayer(player).FindWarehouse(*this, FW::HasWareButNoCollect(i), false, false); + nobBaseWarehouse* wh = world->getPlayer(player).findWarehouse(*this, FW::HasWareButNoCollect(i), false, false); // Gefunden? if(wh) { // Dann bestellen - Ware* ware = wh->OrderWare(i, *this); + Ware* ware = wh->orderWare(i, *this); if(ware) { RTTR_Assert(isWareDependent(*ware)); @@ -387,12 +387,12 @@ void nobBaseWarehouse::HandleCollectEvent() // Lagerhaus suchen, das diesen Job enthält nobBaseWarehouse* wh = - world->getPlayer(player).FindWarehouse(*this, FW::HasFigureButNoCollect(i, false), false, false); + world->getPlayer(player).findWarehouse(*this, FW::HasFigureButNoCollect(i, false), false, false); // Gefunden? if(wh) { // Dann bestellen - if(wh->OrderJob(i, *this, false)) + if(wh->orderJob(i, *this, false)) break; } } @@ -401,15 +401,15 @@ void nobBaseWarehouse::HandleCollectEvent() // Storing still wanted? // Then continue ordering new stuff if(storing_wanted) - store_event = getEvMgr().AddEvent(this, STORE_INTERVAL, 4); + store_event = getEvMgr().addEvent(this, STORE_INTERVAL, 4); } -void nobBaseWarehouse::HandleSendoutEvent() +void nobBaseWarehouse::handleSendoutEvent() { // Fight or something in front of the house? Try again later! if(!world->isRoadNodeForFigures(world->getNeighbour(pos, Direction::SouthEast))) { - empty_event = getEvMgr().AddEvent(this, empty_INTERVAL, 3); + empty_event = getEvMgr().addEvent(this, empty_INTERVAL, 3); return; } @@ -445,7 +445,7 @@ void nobBaseWarehouse::HandleSendoutEvent() // Ware const auto goodType = get(selectedId); auto ware = std::make_unique(goodType, nullptr, this); - noBaseBuilding* wareGoal = world->getPlayer(player).FindClientForWare(*ware); + noBaseBuilding* wareGoal = world->getPlayer(player).findClientForWare(*ware); if(wareGoal != this) { ware->setGoal(wareGoal); @@ -453,20 +453,20 @@ void nobBaseWarehouse::HandleSendoutEvent() // Ware zur Liste hinzufügen, damit sie dann rausgetragen wird waiting_wares.push_back(std::move(ware)); - AddLeavingEvent(); + addLeavingEvent(); // Ware aus Inventar entfernen - inventory.real.Remove(goodType); + inventory.real.remove(goodType); // Evtl. kein Schwert/Schild/Bier mehr da, sodass das Rekrutieren gestoppt werden muss - TryStopRecruiting(); + tryStopRecruiting(); } else - world->getPlayer(player).RemoveWare(*ware); + world->getPlayer(player).removeWare(*ware); } else { const auto jobType = get(selectedId); nobBaseWarehouse* wh = - world->getPlayer(player).FindWarehouse(*this, FW::AcceptsFigureButNoSend(jobType), true, false); + world->getPlayer(player).findWarehouse(*this, FW::AcceptsFigureButNoSend(jobType), true, false); if(wh != this) { auto fig = std::make_unique(jobType, pos, player, nullptr); @@ -474,31 +474,31 @@ void nobBaseWarehouse::HandleSendoutEvent() if(isSoldier(jobType) && inventory.real[jobEnumToAmoredSoldierEnum(jobType)] > 0) { fig->setArmor(true); - inventory.real.Remove(jobEnumToAmoredSoldierEnum(jobType)); + inventory.real.remove(jobEnumToAmoredSoldierEnum(jobType)); } if(wh) - fig->GoHome(wh); + fig->goHome(wh); else - fig->StartWandering(); + fig->startWandering(); - AddLeavingFigure(std::move(fig)); + addLeavingFigure(std::move(fig)); // Person aus Inventar entfernen - inventory.real.Remove(jobType); + inventory.real.remove(jobType); // Evtl. kein Gehilfe mehr da, sodass das Rekrutieren gestoppt werden muss - TryStopRecruiting(); + tryStopRecruiting(); } } // Weitere Waren/Figuren zum Auslagern? - if(AreWaresToEmpty()) + if(areWaresToEmpty()) // --> Nächstes Event - empty_event = getEvMgr().AddEvent(this, empty_INTERVAL, 3); + empty_event = getEvMgr().addEvent(this, empty_INTERVAL, 3); } -void nobBaseWarehouse::HandleRecrutingEvent() +void nobBaseWarehouse::handleRecrutingEvent() { // Wir wollen so viele der Soldaten rekrutieren, // wie in den military_settings angegeben. @@ -519,71 +519,71 @@ void nobBaseWarehouse::HandleRecrutingEvent() else if(real_recruits == 0) return; // Nothing to do - inventory.Add(Job::Private, real_recruits); - owner.IncreaseInventoryJob(Job::Private, real_recruits); + inventory.add(Job::Private, real_recruits); + owner.increaseInventoryJob(Job::Private, real_recruits); - inventory.Remove(Job::Helper, real_recruits); - owner.DecreaseInventoryJob(Job::Helper, real_recruits); + inventory.remove(Job::Helper, real_recruits); + owner.decreaseInventoryJob(Job::Helper, real_recruits); - inventory.Remove(GoodType::Sword, real_recruits); - owner.DecreaseInventoryWare(GoodType::Sword, real_recruits); + inventory.remove(GoodType::Sword, real_recruits); + owner.decreaseInventoryWare(GoodType::Sword, real_recruits); - inventory.Remove(GoodType::ShieldRomans, real_recruits); - owner.DecreaseInventoryWare(GoodType::ShieldRomans, real_recruits); + inventory.remove(GoodType::ShieldRomans, real_recruits); + owner.decreaseInventoryWare(GoodType::ShieldRomans, real_recruits); - inventory.Remove(GoodType::Beer, real_recruits); - owner.DecreaseInventoryWare(GoodType::Beer, real_recruits); + inventory.remove(GoodType::Beer, real_recruits); + owner.decreaseInventoryWare(GoodType::Beer, real_recruits); // Evtl. versuchen nächsten zu rekrutieren - TryRecruiting(); + tryRecruiting(); // If there were no soldiers before if(inventory[Job::Private] == real_recruits) { // Check reserve - this->RefreshReserve(0); + this->refreshReserve(0); // And check if we need the new ones (if any left) e.g. for military buildings if(inventory[Job::Private] > 0) - owner.NewSoldiersAvailable(inventory[Job::Private]); + owner.newSoldiersAvailable(inventory[Job::Private]); } } -void nobBaseWarehouse::HandleProduceHelperEvent() +void nobBaseWarehouse::handleProduceHelperEvent() { // Nur bei unter 100 Trägern, weitere "produzieren" if(inventory[Job::Helper] < 100) { - inventory.Add(Job::Helper); + inventory.add(Job::Helper); GamePlayer& owner = world->getPlayer(player); - owner.IncreaseInventoryJob(Job::Helper, 1); + owner.increaseInventoryJob(Job::Helper, 1); if(inventory[Job::Helper] == 1) { // Wenn vorher keine Träger da waren, müssen alle unbesetzen Wege gucken, ob sie nen Weg hierher finden, // könnte ja sein, dass vorher nich genug Träger da waren - owner.FindCarrierForAllRoads(); + owner.findCarrierForAllRoads(); // evtl Träger mit Werkzeug kombiniert -> neuer Beruf - owner.FindWarehouseForAllJobs(); + owner.findWarehouseForAllJobs(); } } else if(inventory[Job::Helper] > 100) { // Bei Überbevölkerung Träger vernichten - inventory.Remove(Job::Helper); + inventory.remove(Job::Helper); - world->getPlayer(player).DecreaseInventoryJob(Job::Helper, 1); + world->getPlayer(player).decreaseInventoryJob(Job::Helper, 1); } - producinghelpers_event = getEvMgr().AddEvent(this, PRODUCE_HELPERS_GF + RANDOM_RAND(PRODUCE_HELPERS_RANDOM_GF), 1); + producinghelpers_event = getEvMgr().addEvent(this, PRODUCE_HELPERS_GF + RANDOM_RAND(PRODUCE_HELPERS_RANDOM_GF), 1); // Evtl. genau der Gehilfe, der zum Rekrutieren notwendig ist - TryRecruiting(); + tryRecruiting(); // Evtl die Typen gleich wieder auslagern, falls erforderlich - CheckOuthousing(Job::Helper); + checkOuthousing(Job::Helper); } -void nobBaseWarehouse::HandleLeaveEvent() +void nobBaseWarehouse::handleLeaveEvent() { #if RTTR_ENABLE_ASSERTS // Harbors have more queues. Ignore for now @@ -593,12 +593,12 @@ void nobBaseWarehouse::HandleLeaveEvent() for(auto& it : leave_house) { // Don't count warehouse workers - if(!it->MemberOfWarehouse()) + if(!it->memberOfWarehouse()) { if(it->getJobType() == Job::BoatCarrier) - should.Add(Job::Helper); + should.add(Job::Helper); else - should.Add(it->getJobType()); + should.add(it->getJobType()); } } RTTR_Assert(should.people == inventory.visual.people); @@ -625,7 +625,7 @@ void nobBaseWarehouse::HandleLeaveEvent() if(it == leave_house.end()) { go_out = false; - AddLeavingEvent(); + addLeavingEvent(); return; } // Move defender to front to make him leave first @@ -636,15 +636,15 @@ void nobBaseWarehouse::HandleLeaveEvent() // Figures first, then wares if(!leave_house.empty()) { - noFigure& fig = world->AddFigure(pos, std::move(leave_house.front())); + noFigure& fig = world->addFigure(pos, std::move(leave_house.front())); leave_house.pop_front(); // Init road walking for figures walking on roads if(fig.isWalkingOnRoad()) - fig.InitializeRoadWalking(getRoute(Direction::SouthEast), 0, true); + fig.initializeRoadWalking(getRoute(Direction::SouthEast), 0, true); - fig.ActAtFirst(); - FigureLeft(fig); + fig.actAtFirst(); + figureLeft(fig); } else { if(getFlag()->hasSpaceForWare()) @@ -652,10 +652,10 @@ void nobBaseWarehouse::HandleLeaveEvent() // Send first ware auto ware = std::move(waiting_wares.front()); waiting_wares.pop_front(); - inventory.visual.Remove(ConvertShields(ware->type)); - ware->Carry(*getFlag()); - world->AddFigure(pos, std::make_unique(pos, player, std::move(ware), false)) - .WalkToGoal(); + inventory.visual.remove(ConvertShields(ware->type)); + ware->carry(*getFlag()); + world->addFigure(pos, std::make_unique(pos, player, std::move(ware), false)) + .walkToGoal(); } else { // No space and no figures (checked above) @@ -668,26 +668,26 @@ void nobBaseWarehouse::HandleLeaveEvent() go_out = false; if(go_out) - leaving_event = getEvMgr().AddEvent(this, LEAVE_INTERVAL + RANDOM_RAND(LEAVE_INTERVAL_RAND)); + leaving_event = getEvMgr().addEvent(this, LEAVE_INTERVAL + RANDOM_RAND(LEAVE_INTERVAL_RAND)); } -void nobBaseWarehouse::FigureLeft(const noFigure& fig) +void nobBaseWarehouse::figureLeft(const noFigure& fig) { // Adapt inventory for non-warehouse workers - if(fig.MemberOfWarehouse()) + if(fig.memberOfWarehouse()) return; - RemoveFromVisualInventory(fig); + removeFromVisualInventory(fig); if(fig.getGOT() == GO_Type::NofTradedonkey) { // Trade donkey carrying wares? const auto& carriedWare = static_cast(fig).getCarriedWare(); if(carriedWare) - inventory.visual.Remove(*carriedWare); + inventory.visual.remove(*carriedWare); } } -Ware* nobBaseWarehouse::OrderWare(const GoodType good, noBaseBuilding& goal) +Ware* nobBaseWarehouse::orderWare(const GoodType good, noBaseBuilding& goal) { // Ware überhaupt hier vorhanden (Abfrage eigentlich nicht nötig, aber erstmal zur Sicherheit) if(!inventory[good]) @@ -698,69 +698,69 @@ Ware* nobBaseWarehouse::OrderWare(const GoodType good, noBaseBuilding& goal) } auto ware = std::make_unique(good, &goal, this); - inventory.Remove(good); + inventory.remove(good); // Copy pointer so functions below can take ownership Ware* wareRef = ware.get(); // If we don't want to use the ware right away we add it to the waiting wares - if(!UseWareAtOnce(ware, goal)) - AddWaitingWare(std::move(ware)); + if(!useWareAtOnce(ware, goal)) + addWaitingWare(std::move(ware)); RTTR_Assert(!ware); // Evtl. keine Waffen/Bier mehr da, sodass das Rekrutieren gestoppt werden muss - TryStopRecruiting(); + tryStopRecruiting(); return wareRef; } -void nobBaseWarehouse::AddWaitingWare(std::unique_ptr ware) +void nobBaseWarehouse::addWaitingWare(std::unique_ptr ware) { - inventory.visual.Add(ConvertShields(ware->type)); - ware->WaitInWarehouse(*this); + inventory.visual.add(ConvertShields(ware->type)); + ware->waitInWarehouse(*this); waiting_wares.push_back(std::move(ware)); - AddLeavingEvent(); + addLeavingEvent(); } -bool nobBaseWarehouse::FreePlaceAtFlag() +bool nobBaseWarehouse::freePlaceAtFlag() { if(!waiting_wares.empty()) { - AddLeavingEvent(); + addLeavingEvent(); return true; } else { // Evtl. war die Flagge voll und das Auslagern musste gestoppt werden // Weitere Waren/Figuren zum Auslagern und kein Event angemeldet? - if(AreWaresToEmpty() && !empty_event) + if(areWaresToEmpty() && !empty_event) // --> Nächstes Event - empty_event = getEvMgr().AddEvent(this, empty_INTERVAL, 3); + empty_event = getEvMgr().addEvent(this, empty_INTERVAL, 3); return false; } } -void nobBaseWarehouse::AddWare(std::unique_ptr ware) +void nobBaseWarehouse::addWare(std::unique_ptr ware) { // Ware not dependent anymore (only if we had a goal) if(ware->getGoal()) { RTTR_Assert(ware->getGoal() == this); // The goal should be here - RemoveDependentWare(*ware); + removeDependentWare(*ware); } else RTTR_Assert(!isWareDependent(*ware)); // Die Schilde der verschiedenen Nation in eine "Schild-Sorte" (den der Römer) umwandeln! GoodType type = ConvertShields(ware->type); - world->getPlayer(player).RemoveWare(*ware); + world->getPlayer(player).removeWare(*ware); - inventory.Add(type); + inventory.add(type); - CheckUsesForNewWare(type); + checkUsesForNewWare(type); } -void nobBaseWarehouse::CheckUsesForNewWare(const GoodType gt) +void nobBaseWarehouse::checkUsesForNewWare(const GoodType gt) { // Wenn es ein Werkzeug war, evtl neuen Job suchen, der jetzt erzeugt werden könnte.. if(gt >= GoodType::Tongs && gt <= GoodType::Boat) @@ -768,35 +768,35 @@ void nobBaseWarehouse::CheckUsesForNewWare(const GoodType gt) for(const auto job : helpers::EnumRange{}) { if(JOB_CONSTS[job].tool == gt) - world->getPlayer(player).FindWarehouseForAllJobs(job); + world->getPlayer(player).findWarehouseForAllJobs(job); } } // Wars Baumaterial? Dann den Baustellen Bescheid sagen if(gt == GoodType::Boards || gt == GoodType::Stones) - world->getPlayer(player).FindMaterialForBuildingSites(); + world->getPlayer(player).findMaterialForBuildingSites(); // Evtl wurden Bier oder Waffen reingetragen --> versuchen zu rekrutieren - TryRecruiting(); + tryRecruiting(); // Evtl die Ware gleich wieder auslagern, falls erforderlich - CheckOuthousing(gt); + checkOuthousing(gt); } -void nobBaseWarehouse::CheckJobsForNewFigure(const Job job) +void nobBaseWarehouse::checkJobsForNewFigure(const Job job) { // Evtl ging ein Gehilfe rein --> versuchen zu rekrutieren if(job == Job::Helper) - TryRecruiting(); + tryRecruiting(); if(isSoldier(job)) { // Reserve prüfen - RefreshReserve(getSoldierRank(job)); + refreshReserve(getSoldierRank(job)); if(inventory[job] > 0) { // Truppen prüfen in allen Häusern - world->getPlayer(player).NewSoldiersAvailable(inventory[job]); + world->getPlayer(player).newSoldiersAvailable(inventory[job]); } } else { @@ -804,104 +804,104 @@ void nobBaseWarehouse::CheckJobsForNewFigure(const Job job) { // Straße für Esel suchen noRoadNode* goal; - if(RoadSegment* road = world->getPlayer(player).FindRoadForDonkey(*this, &goal)) - road->GotDonkey(OrderDonkey(*road, *goal)); + if(RoadSegment* road = world->getPlayer(player).findRoadForDonkey(*this, &goal)) + road->gotDonkey(orderDonkey(*road, *goal)); } else { // Evtl. Abnehmer für die Figur wieder finden GamePlayer& owner = world->getPlayer(player); - owner.FindWarehouseForAllJobs(job); + owner.findWarehouseForAllJobs(job); // Wenns ein Träger war, auch Wege prüfen if(job == Job::Helper && inventory[Job::Helper] == 1) { // evtl als Träger auf Straßen schicken - owner.FindCarrierForAllRoads(); + owner.findCarrierForAllRoads(); // evtl Träger mit Werkzeug kombiniert -> neuer Beruf - owner.FindWarehouseForAllJobs(); + owner.findWarehouseForAllJobs(); } } } // Evtl den Typen gleich wieder auslagern, falls erforderlich - CheckOuthousing(job); + checkOuthousing(job); } -void nobBaseWarehouse::AddFigure(std::unique_ptr figure, const bool increase_visual_counts) +void nobBaseWarehouse::addFigure(std::unique_ptr figure, const bool increase_visual_counts) { // Warenhausarbeiter werden nicht gezählt! - if(!figure->MemberOfWarehouse()) + if(!figure->memberOfWarehouse()) { - AddToRealInventory(*figure); + addToRealInventory(*figure); if(increase_visual_counts) - AddToVisualInventory(*figure); + addToVisualInventory(*figure); } // Check if we were actually waiting for this figure or if it was just added (e.g. builder that constructed it) to // not confuse implementations of Remove... if(isDependentFigure(*figure)) - RemoveDependentFigure(*figure); + removeDependentFigure(*figure); - CheckJobsForNewFigure(figure->getJobType()); - getEvMgr().AddToKillList(std::move(figure)); + checkJobsForNewFigure(figure->getJobType()); + getEvMgr().addToKillList(std::move(figure)); } -void nobBaseWarehouse::RemoveFromVisualInventory(const noFigure& figure) +void nobBaseWarehouse::removeFromVisualInventory(const noFigure& figure) { const auto job = figure.getJobType(); if(job == Job::BoatCarrier) { // Remove helper and boat separately - inventory.visual.Remove(Job::Helper); - inventory.visual.Remove(GoodType::Boat); + inventory.visual.remove(Job::Helper); + inventory.visual.remove(GoodType::Boat); } else { - inventory.visual.Remove(job); + inventory.visual.remove(job); if(isSoldier(job) && figure.hasArmor()) - inventory.visual.Remove(jobEnumToAmoredSoldierEnum(job)); + inventory.visual.remove(jobEnumToAmoredSoldierEnum(job)); } } -static void addToInventory(Inventory& inventory, const noFigure& figure) +static void addFigureToInventory(Inventory& inventory, const noFigure& figure) { const auto job = figure.getJobType(); if(job == Job::BoatCarrier) { - inventory.Add(Job::Helper); - inventory.Add(GoodType::Boat); + inventory.add(Job::Helper); + inventory.add(GoodType::Boat); } else { - inventory.Add(job); + inventory.add(job); if(isSoldier(job) && figure.hasArmor()) - inventory.Add(jobEnumToAmoredSoldierEnum(job)); + inventory.add(jobEnumToAmoredSoldierEnum(job)); } } -void nobBaseWarehouse::AddToVisualInventory(const noFigure& figure) +void nobBaseWarehouse::addToVisualInventory(const noFigure& figure) { - addToInventory(inventory.visual, figure); + addFigureToInventory(inventory.visual, figure); } -void nobBaseWarehouse::AddToRealInventory(const noFigure& figure) +void nobBaseWarehouse::addToRealInventory(const noFigure& figure) { - addToInventory(inventory.real, figure); + addFigureToInventory(inventory.real, figure); } -void nobBaseWarehouse::FetchWare() +void nobBaseWarehouse::fetchWare() { if(!fetch_double_protection) - AddLeavingFigure(std::make_unique(pos, player, nullptr, true)); + addLeavingFigure(std::make_unique(pos, player, nullptr, true)); fetch_double_protection = false; } -void nobBaseWarehouse::WareLost(Ware& ware) +void nobBaseWarehouse::wareLost(Ware& ware) { - RemoveDependentWare(ware); + removeDependentWare(ware); } void nobBaseWarehouse::cancelWare(Ware*& ware) { - inventory.real.Add(ConvertShields(ware->type)); + inventory.real.add(ConvertShields(ware->type)); helpers::extractPtr(waiting_wares, ware); ware = nullptr; } @@ -912,18 +912,18 @@ void nobBaseWarehouse::cancelFigure(noFigure* figure) RTTR_Assert(it != leave_house.end()); // Figure aus den Waiting-Wares entfernen - AddFigure(std::move(*it), false); + addFigure(std::move(*it), false); leave_house.erase(it); } -void nobBaseWarehouse::TakeWare(Ware* ware) +void nobBaseWarehouse::takeWare(Ware* ware) { // Ware zur Abhängigkeitsliste hinzufügen, damit sie benachrichtigt wird, wenn dieses Lagerhaus zerstört wird RTTR_Assert(!helpers::contains(dependent_wares, ware)); dependent_wares.push_back(ware); } -void nobBaseWarehouse::OrderTroops(nobMilitary& goal, std::array& counts, unsigned& max) +void nobBaseWarehouse::orderTroops(nobMilitary& goal, std::array& counts, unsigned& max) { unsigned start, limit; int step; @@ -949,21 +949,21 @@ void nobBaseWarehouse::OrderTroops(nobMilitary& goal, std::array(pos, player, &goal, &goal, i - 1); - inventory.real.Remove(curRank); + inventory.real.remove(curRank); if(inventory.real[jobEnumToAmoredSoldierEnum(curRank)] > 0) { - inventory.real.Remove(jobEnumToAmoredSoldierEnum(curRank)); + inventory.real.remove(jobEnumToAmoredSoldierEnum(curRank)); soldier->setArmor(true); } - goal.GotWorker(curRank, *soldier); - AddLeavingFigure(std::move(soldier)); + goal.gotWorker(curRank, *soldier); + addLeavingFigure(std::move(soldier)); --max; --counts[i - 1]; } } } -nofAggressiveDefender* nobBaseWarehouse::SendAggressiveDefender(nofAttacker& attacker) +nofAggressiveDefender* nobBaseWarehouse::sendAggressiveDefender(nofAttacker& attacker) { // Sind noch Soldaten da? unsigned char rank; @@ -980,20 +980,20 @@ nofAggressiveDefender* nobBaseWarehouse::SendAggressiveDefender(nofAttacker& att // Dann den Stärksten rausschicken auto soldier = std::make_unique(pos, player, *this, rank - 1, attacker); nofAggressiveDefender& soldierRef = *soldier; - inventory.real.Remove(SOLDIER_JOBS[rank - 1]); + inventory.real.remove(SOLDIER_JOBS[rank - 1]); if(inventory.real[jobEnumToAmoredSoldierEnum(soldier->getJobType())] > 0) { soldier->setArmor(true); - inventory.real.Remove(jobEnumToAmoredSoldierEnum(soldier->getJobType())); + inventory.real.remove(jobEnumToAmoredSoldierEnum(soldier->getJobType())); } - AddLeavingFigure(std::move(soldier)); + addLeavingFigure(std::move(soldier)); troops_on_mission.push_back(&soldierRef); return &soldierRef; } -void nobBaseWarehouse::SoldierLost(nofSoldier* soldier) +void nobBaseWarehouse::soldierLost(nofSoldier* soldier) { // Soldat konnte nicht (mehr) kommen --> rauswerfen RTTR_Assert(dynamic_cast(soldier)); @@ -1001,21 +1001,21 @@ void nobBaseWarehouse::SoldierLost(nofSoldier* soldier) troops_on_mission.remove(static_cast(soldier)); } -void nobBaseWarehouse::AddActiveSoldier(std::unique_ptr soldier) +void nobBaseWarehouse::addActiveSoldier(std::unique_ptr soldier) { - inventory.Add(soldier->getJobType()); + inventory.add(soldier->getJobType()); if(soldier->hasArmor()) - inventory.Add(jobEnumToAmoredSoldierEnum(soldier->getJobType())); + inventory.add(jobEnumToAmoredSoldierEnum(soldier->getJobType())); // Evtl. geht der Soldat wieder in die Reserve - RefreshReserve(soldier->getRank()); + refreshReserve(soldier->getRank()); // Truppen prüfen in allen Häusern - world->getPlayer(player).RegulateAllTroops(); + world->getPlayer(player).regulateAllTroops(); // Returned home if(soldier.get() == defender_) - ResetDefender(); + resetDefender(); else { // Ggf. war er auf Mission @@ -1024,11 +1024,11 @@ void nobBaseWarehouse::AddActiveSoldier(std::unique_ptr soldie } // und Soldat vernichten - soldier->ResetHome(); - getEvMgr().AddToKillList(std::move(soldier)); + soldier->resetHome(); + getEvMgr().addToKillList(std::move(soldier)); } -std::unique_ptr nobBaseWarehouse::ProvideDefender(nofAttacker& attacker) +std::unique_ptr nobBaseWarehouse::provideDefender(nofAttacker& attacker) { // Ränge zählen unsigned rank_count = 0; @@ -1055,11 +1055,11 @@ std::unique_ptr nobBaseWarehouse::ProvideDefender(nofAttacker& atta { // diesen Soldaten wollen wir auto defender = std::make_unique(pos, player, *this, i, attacker); - inventory.real.Remove(SOLDIER_JOBS[i]); + inventory.real.remove(SOLDIER_JOBS[i]); if(inventory.real[jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])] > 0) { defender->setArmor(true); - inventory.real.Remove(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])); + inventory.real.remove(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])); } return defender; } @@ -1073,12 +1073,12 @@ std::unique_ptr nobBaseWarehouse::ProvideDefender(nofAttacker& atta --reserve_soldiers_available[i]; // bei der visuellen Warenanzahl wieder hinzufügen, da er dann wiederrum von der abgezogen wird, // wenn er rausgeht und es so ins minus rutschen würde - inventory.visual.Add(SOLDIER_JOBS[i]); + inventory.visual.add(SOLDIER_JOBS[i]); if(reserve_soldiers_available_with_armor[i] > 0) { defender->setArmor(true); --reserve_soldiers_available_with_armor[i]; - inventory.visual.Add(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])); + inventory.visual.add(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[i])); } return defender; } @@ -1095,11 +1095,11 @@ std::unique_ptr nobBaseWarehouse::ProvideDefender(nofAttacker& atta std::unique_ptr soldier = boost::static_pointer_cast(std::move(*it)); leave_house.erase(it); // Only allowed in the loop as we return now - soldier->Abrogate(); + soldier->abrogate(); auto defender = std::make_unique(pos, player, *this, soldier->getRank(), attacker); defender->setArmor(soldier->hasArmor()); - soldier->Destroy(); + soldier->destroy(); return defender; } } @@ -1114,17 +1114,17 @@ bool nobBaseWarehouse::canRecruitSoldiers() && inventory[GoodType::Beer]); } -void nobBaseWarehouse::TryRecruiting() +void nobBaseWarehouse::tryRecruiting() { if(!recruiting_event && canRecruitSoldiers()) - recruiting_event = getEvMgr().AddEvent(this, RECRUITE_GF + RANDOM_RAND(RECRUITE_RANDOM_GF), 2); + recruiting_event = getEvMgr().addEvent(this, RECRUITE_GF + RANDOM_RAND(RECRUITE_RANDOM_GF), 2); } -void nobBaseWarehouse::TryStopRecruiting() +void nobBaseWarehouse::tryStopRecruiting() { // Remove existing event if we have not enough recruits/wares if(recruiting_event && !canRecruitSoldiers()) - getEvMgr().RemoveEvent(recruiting_event); + getEvMgr().removeEvent(recruiting_event); } const Inventory& nobBaseWarehouse::getInventory() const @@ -1132,13 +1132,13 @@ const Inventory& nobBaseWarehouse::getInventory() const return inventory.visual; } -void nobBaseWarehouse::AddToInventory(const GoodsAndPeopleCounts& what, bool addToPlayer) +void nobBaseWarehouse::addToInventory(const GoodsAndPeopleCounts& what, bool addToPlayer) { - AddToInventory(static_cast(what), addToPlayer); - AddToInventory(static_cast(what), addToPlayer); + addToInventory(static_cast(what), addToPlayer); + addToInventory(static_cast(what), addToPlayer); } -void nobBaseWarehouse::AddToInventory(const GoodCounts& goods, bool addToPlayer) +void nobBaseWarehouse::addToInventory(const GoodCounts& goods, bool addToPlayer) { GamePlayer& owner = world->getPlayer(player); for(const auto i : helpers::enumRange()) @@ -1148,14 +1148,14 @@ void nobBaseWarehouse::AddToInventory(const GoodCounts& goods, bool addToPlayer) // Can only add canonical shields (romans) RTTR_Assert(i == GoodType::ShieldRomans || ConvertShields(i) != GoodType::ShieldRomans); - inventory.Add(i, goods[i]); + inventory.add(i, goods[i]); if(addToPlayer) - owner.IncreaseInventoryWare(i, goods[i]); - CheckUsesForNewWare(i); + owner.increaseInventoryWare(i, goods[i]); + checkUsesForNewWare(i); } } -void nobBaseWarehouse::AddToInventory(const PeopleCounts& people, bool addToPlayer) +void nobBaseWarehouse::addToInventory(const PeopleCounts& people, bool addToPlayer) { GamePlayer& owner = world->getPlayer(player); for(const auto i : helpers::enumRange()) @@ -1165,21 +1165,21 @@ void nobBaseWarehouse::AddToInventory(const PeopleCounts& people, bool addToPlay // Boatcarriers are added as carriers and boat individually RTTR_Assert(i != Job::BoatCarrier); - inventory.Add(i, people[i]); + inventory.add(i, people[i]); if(addToPlayer) - owner.IncreaseInventoryJob(i, people[i]); + owner.increaseInventoryJob(i, people[i]); if(isSoldier(i)) { const auto armoredSoldier = jobEnumToAmoredSoldierEnum(i); if(people[armoredSoldier]) { - inventory.Add(armoredSoldier, people[armoredSoldier]); + inventory.add(armoredSoldier, people[armoredSoldier]); if(addToPlayer) - owner.IncreaseInventoryJob(armoredSoldier, people[armoredSoldier]); + owner.increaseInventoryJob(armoredSoldier, people[armoredSoldier]); } } - CheckJobsForNewFigure(i); + checkJobsForNewFigure(i); } } @@ -1193,7 +1193,7 @@ bool nobBaseWarehouse::canRecruit(const Job job) const return false; } -bool nobBaseWarehouse::TryRecruitJob(const Job job) +bool nobBaseWarehouse::tryRecruitJob(const Job job) { RTTR_Assert(!helpers::contains(SOLDIER_JOBS, job) && job != Job::PackDonkey); if(!canRecruit(job)) @@ -1204,15 +1204,15 @@ bool nobBaseWarehouse::TryRecruitJob(const Job job) const GoodType requiredTool = *JOB_CONSTS[job].tool; // Validity checked in CanRecruit if(requiredTool != GoodType::Nothing) { - inventory.Remove(requiredTool); - owner.DecreaseInventoryWare(requiredTool, 1); + inventory.remove(requiredTool); + owner.decreaseInventoryWare(requiredTool, 1); } - inventory.Remove(Job::Helper); - owner.DecreaseInventoryJob(Job::Helper, 1); + inventory.remove(Job::Helper); + owner.decreaseInventoryJob(Job::Helper, 1); - inventory.Add(job); - owner.IncreaseInventoryJob(job, 1); + inventory.add(job); + owner.increaseInventoryJob(job, 1); return true; } @@ -1238,15 +1238,15 @@ InventorySetting nobBaseWarehouse::getInventorySetting(const GoodType ware) cons void nobBaseWarehouse::setInventorySettingVisual(const boost_variant2& what, InventorySetting state) { - state.MakeValid(); + state.makeValid(); visit([this, state](auto type) { inventorySettingsVisual[type] = state; }, what); - NotifyListeners(1); + notifyListeners(1); } void nobBaseWarehouse::SetInventorySetting(const boost_variant2& what, InventorySetting state) { - state.MakeValid(); + state.makeValid(); InventorySetting& selectedSetting = visit([this](auto type) -> InventorySetting& { return inventorySettings[type]; }, what); @@ -1262,7 +1262,7 @@ void nobBaseWarehouse::SetInventorySetting(const boost_variant2& && !state.isSet(EInventorySetting::Stop)) { // Evtl gabs verlorene Waren, die jetzt in das HQ wieder reinkönnen - world->getPlayer(player).FindClientForLostWares(); + world->getPlayer(player).findClientForLostWares(); } // No else here! if(!oldState.isSet(EInventorySetting::Send) && state.isSet(EInventorySetting::Send)) { @@ -1270,14 +1270,14 @@ void nobBaseWarehouse::SetInventorySetting(const boost_variant2& // anmelden auto getWaresOrJobs = [this](auto type) { return inventory[type]; }; if(!empty_event && visit(getWaresOrJobs, what)) - empty_event = getEvMgr().AddEvent(this, empty_INTERVAL, 3); + empty_event = getEvMgr().addEvent(this, empty_INTERVAL, 3); } else if(!oldState.isSet(EInventorySetting::Collect) && state.isSet(EInventorySetting::Collect)) { // Sollen Waren eingelagert werden? Dann müssen wir neue bestellen if(!store_event) - store_event = getEvMgr().AddEvent(this, STORE_INTERVAL, 4); + store_event = getEvMgr().addEvent(this, STORE_INTERVAL, 4); } - NotifyListeners(1); + notifyListeners(1); } void nobBaseWarehouse::SetAllInventorySettings(const bool isJob, const std::vector& states) @@ -1291,7 +1291,7 @@ void nobBaseWarehouse::SetAllInventorySettings(const bool isJob, const std::vect for(InventorySetting state : states) { - state.MakeValid(); + state.makeValid(); *(settings++) = state; isUnstopped |= !state.isSet(EInventorySetting::Stop); isCollectSet |= state.isSet(EInventorySetting::Collect); @@ -1299,15 +1299,15 @@ void nobBaseWarehouse::SetAllInventorySettings(const bool isJob, const std::vect // Evtl gabs verlorene Waren, die jetzt in das HQ wieder reinkönnen if(isUnstopped) - world->getPlayer(player).FindClientForLostWares(); + world->getPlayer(player).findClientForLostWares(); // no else! // Sind Waren vorhanden, die ausgelagert werden müssen und ist noch kein Auslagerungsevent vorhanden --> neues // anmelden - if(AreWaresToEmpty() && !empty_event) - empty_event = getEvMgr().AddEvent(this, empty_INTERVAL, 3); + if(areWaresToEmpty() && !empty_event) + empty_event = getEvMgr().addEvent(this, empty_INTERVAL, 3); // Sollen Waren eingelagert werden? Dann müssen wir neue bestellen if(isCollectSet && !store_event) - store_event = getEvMgr().AddEvent(this, STORE_INTERVAL, 4); + store_event = getEvMgr().addEvent(this, STORE_INTERVAL, 4); } bool nobBaseWarehouse::isWareDependent(const Ware& ware) @@ -1315,7 +1315,7 @@ bool nobBaseWarehouse::isWareDependent(const Ware& ware) return helpers::contains(dependent_wares, &ware); } -bool nobBaseWarehouse::AreWaresToEmpty() const +bool nobBaseWarehouse::areWaresToEmpty() const { // Prüfen, ob Warentyp ausgelagert werden soll und ob noch Waren davon vorhanden sind // Waren überprüfen @@ -1335,7 +1335,7 @@ bool nobBaseWarehouse::AreWaresToEmpty() const return false; } -bool nobBaseWarehouse::DefendersAvailable() const +bool nobBaseWarehouse::defendersAvailable() const { const auto isNonZero = [](const unsigned ct) { return ct != 0; }; if(helpers::contains_if(reserve_soldiers_available, isNonZero)) @@ -1363,10 +1363,10 @@ void nobBaseWarehouse::setRealReserve(const unsigned rank, const unsigned count) reserve_soldiers_claimed_visual[rank] = count; // Geforderte Soldaten ggf. einbeziehen - RefreshReserve(rank); + refreshReserve(rank); } -void nobBaseWarehouse::RefreshReserve(unsigned rank) +void nobBaseWarehouse::refreshReserve(unsigned rank) { // Zuviele oder zuwenig Soldaten einkassiert? if(reserve_soldiers_available[rank] < reserve_soldiers_claimed_real[rank]) @@ -1384,8 +1384,8 @@ void nobBaseWarehouse::RefreshReserve(unsigned rank) reserve_soldiers_available[rank] += add; reserve_soldiers_available_with_armor[rank] += armor; // vom Warenbestand abziehen - inventory.Remove(SOLDIER_JOBS[rank], add); - inventory.Remove(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[rank]), armor); + inventory.remove(SOLDIER_JOBS[rank], add); + inventory.remove(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[rank]), armor); } } else if(reserve_soldiers_available[rank] > reserve_soldiers_claimed_real[rank]) { @@ -1399,17 +1399,17 @@ void nobBaseWarehouse::RefreshReserve(unsigned rank) reserve_soldiers_available[rank] -= subtract; reserve_soldiers_available_with_armor[rank] -= subtractArmor; // beim Warenbestand hinzufügen - inventory.Add(SOLDIER_JOBS[rank], subtract); - inventory.Add(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[rank]), subtractArmor); + inventory.add(SOLDIER_JOBS[rank], subtract); + inventory.add(jobEnumToAmoredSoldierEnum(SOLDIER_JOBS[rank]), subtractArmor); // if the rank is supposed to be send away, do it! - CheckOuthousing(SOLDIER_JOBS[rank]); + checkOuthousing(SOLDIER_JOBS[rank]); // Ggf. Truppen in die Militärgebäude schicken - world->getPlayer(player).RegulateAllTroops(); + world->getPlayer(player).regulateAllTroops(); } // ansonsten ists gleich und alles ist in Ordnung! } -void nobBaseWarehouse::CheckOuthousing(const boost_variant2& what) +void nobBaseWarehouse::checkOuthousing(const boost_variant2& what) { // Check if we need to send this ware or figure and register an event for this // If we already have an event, we don't need to do anything @@ -1425,7 +1425,7 @@ void nobBaseWarehouse::CheckOuthousing(const boost_variant2& what what); if(setting.isSet(EInventorySetting::Send)) - empty_event = getEvMgr().AddEvent(this, empty_INTERVAL, 3); + empty_event = getEvMgr().addEvent(this, empty_INTERVAL, 3); } bool nobBaseWarehouse::isDependentFigure(const noFigure& fig) const @@ -1454,12 +1454,12 @@ unsigned nobBaseWarehouse::getAvailableFiguresForTrading(const Job job) const return inventory[job]; } -void nobBaseWarehouse::StartTradeCaravane(const boost_variant2& what, const unsigned count, +void nobBaseWarehouse::startTradeCaravane(const boost_variant2& what, const unsigned count, const TradeRoute& tr, nobBaseWarehouse* goal) { auto tlOwned = std::make_unique(pos, player, tr, this->getPos(), goal->getPos()); auto& tl = *tlOwned; - AddLeavingFigure(std::move(tlOwned)); + addLeavingFigure(std::move(tlOwned)); GamePlayer& owner = world->getPlayer(player); @@ -1475,8 +1475,8 @@ void nobBaseWarehouse::StartTradeCaravane(const boost_variant2& w if(inventory.real[jobEnumToAmoredSoldierEnum(job)] > 0) { next->setArmor(true); - inventory.real.Remove(jobEnumToAmoredSoldierEnum(job), 1); - owner.DecreaseInventoryJob(jobEnumToAmoredSoldierEnum(job), 1); + inventory.real.remove(jobEnumToAmoredSoldierEnum(job), 1); + owner.decreaseInventoryJob(jobEnumToAmoredSoldierEnum(job), 1); } } @@ -1486,27 +1486,27 @@ void nobBaseWarehouse::StartTradeCaravane(const boost_variant2& w tl.setSuccessor(next.get()); last = next.get(); - AddLeavingFigure(std::move(next)); + addLeavingFigure(std::move(next)); } // Remove leader - inventory.real.Remove(Job::Helper); - owner.DecreaseInventoryJob(Job::Helper, 1); + inventory.real.remove(Job::Helper); + owner.decreaseInventoryJob(Job::Helper, 1); // Also diminish the count of donkeys visit(composeVisitor( [&](const Job job) { // remove the jobs - inventory.real.Remove(job, count); - owner.DecreaseInventoryJob(job, count); + inventory.real.remove(job, count); + owner.decreaseInventoryJob(job, count); }, [&](const GoodType gt) { // Diminish the goods in the warehouse - inventory.real.Remove(gt, count); - owner.DecreaseInventoryWare(gt, count); + inventory.real.remove(gt, count); + owner.decreaseInventoryWare(gt, count); // now that we have removed the goods lets remove the donkeys - inventory.real.Remove(Job::PackDonkey, count); - owner.DecreaseInventoryJob(Job::PackDonkey, count); + inventory.real.remove(Job::PackDonkey, count); + owner.decreaseInventoryJob(Job::PackDonkey, count); }), what); } diff --git a/libs/s25main/buildings/nobBaseWarehouse.h b/libs/s25main/buildings/nobBaseWarehouse.h index 299175d35e..f1b6b28522 100644 --- a/libs/s25main/buildings/nobBaseWarehouse.h +++ b/libs/s25main/buildings/nobBaseWarehouse.h @@ -85,14 +85,14 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable bool canRecruitSoldiers(); /// Derived classes may use ordered wares immediately, e.g. for sending via ship instead of by road /// Return true if so and take ownership of the ware - virtual bool UseWareAtOnce(std::unique_ptr& /*ware*/, noBaseBuilding& /*goal*/) { return false; } + virtual bool useWareAtOnce(std::unique_ptr& /*ware*/, noBaseBuilding& /*goal*/) { return false; } /// Derived classes may use ordered figures immediately, e.g. for sending via ship instead of by road /// Return true if so and take ownership of the figure - virtual bool UseFigureAtOnce(std::unique_ptr& /*fig*/, noRoadNode& /*goal*/) { return false; } + virtual bool useFigureAtOnce(std::unique_ptr& /*fig*/, noRoadNode& /*goal*/) { return false; } /// Prüft verschiedene Verwendungszwecke für eine neuangekommende Ware - void CheckUsesForNewWare(GoodType gt); + void checkUsesForNewWare(GoodType gt); /// Prüft verschiedene Sachen, falls ein neuer Mensch das Haus betreten hat - void CheckJobsForNewFigure(Job job); + void checkJobsForNewFigure(Job job); friend class gc::SetInventorySetting; friend class gc::SetAllInventorySettings; @@ -103,37 +103,37 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable void SetAllInventorySettings(bool isJob, const std::vector& states); /// Lässt einen bestimmten Waren/Job-Typ ggf auslagern - void CheckOuthousing(const boost_variant2& what); - void HandleCollectEvent(); - void HandleSendoutEvent(); - void HandleRecrutingEvent(); - void HandleProduceHelperEvent(); - void HandleLeaveEvent(); + void checkOuthousing(const boost_variant2& what); + void handleCollectEvent(); + void handleSendoutEvent(); + void handleRecrutingEvent(); + void handleProduceHelperEvent(); + void handleLeaveEvent(); protected: /// Stellt Verteidiger zur Verfügung - std::unique_ptr ProvideDefender(nofAttacker& attacker) override; + std::unique_ptr provideDefender(nofAttacker& attacker) override; - void HandleBaseEvent(unsigned id); + void handleBaseEvent(unsigned id); /// Versucht ein Rekrutierungsevent anzumelden, falls ausreichend Waffen und Bier sowie genügend Gehilfen /// vorhanden sind (je nach Militäreinstellungen) - void TryRecruiting(); + void tryRecruiting(); /// Versucht Rekrutierungsevent abzumeldne, falls die Bedingungen nicht mehr erfüllt sind (z.B. wenn Ware /// rausgetragen wurde o.ä.) - void TryStopRecruiting(); + void tryStopRecruiting(); /// Recruts a worker of the given job if possible - bool TryRecruitJob(Job job); + bool tryRecruitJob(Job job); - void RemoveFromVisualInventory(const noFigure& figure); - void AddToVisualInventory(const noFigure& figure); - void AddToRealInventory(const noFigure& figure); + void removeFromVisualInventory(const noFigure& figure); + void addToVisualInventory(const noFigure& figure); + void addToRealInventory(const noFigure& figure); nobBaseWarehouse(BuildingType type, MapPoint pos, unsigned char player, Nation nation); nobBaseWarehouse(SerializedGameData& sgd, unsigned obj_id); public: - void Clear(); + void clear(); ~nobBaseWarehouse() override; @@ -148,9 +148,9 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable /// Adds specified goods and people. If addToPlayer is true, /// then they are also added to the owners inventory (for newly created/arrived goods) /// Use false for goods, that are only moved between players units - void AddToInventory(const GoodsAndPeopleCounts& what, bool addToPlayer); - void AddToInventory(const PeopleCounts& people, bool addToPlayer); - void AddToInventory(const GoodCounts& goods, bool addToPlayer); + void addToInventory(const GoodsAndPeopleCounts& what, bool addToPlayer); + void addToInventory(const PeopleCounts& people, bool addToPlayer); + void addToInventory(const GoodCounts& goods, bool addToPlayer); /// Gibt Anzahl der Waren bzw. Figuren zurück unsigned getNumRealWares(GoodType type) const { return inventory.real[type]; } @@ -186,63 +186,63 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable void setInventorySettingVisual(const boost_variant2& what, InventorySetting state); /// Bestellt einen Träger - void OrderCarrier(noRoadNode& goal, RoadSegment& workplace); + void orderCarrier(noRoadNode& goal, RoadSegment& workplace); /// Bestellt irgendeinen Beruf (ggf. stellt er ihn noch mit einem Werkzeug her) - bool OrderJob(Job job, noRoadNode& goal, bool allow_recruiting); + bool orderJob(Job job, noRoadNode& goal, bool allow_recruiting); /// Bestellt einen Esel - nofCarrier* OrderDonkey(RoadSegment& road, noRoadNode& goal_flag); + nofCarrier* orderDonkey(RoadSegment& road, noRoadNode& goal_flag); /// "Bestellt" eine Ware --> gibt den Pointer auf die Ware zurück - Ware* OrderWare(GoodType good, noBaseBuilding& goal); + Ware* orderWare(GoodType good, noBaseBuilding& goal); /// Returns true, if the given job can be recruited. Excludes soldiers and carriers! bool canRecruit(Job job) const; /// Wird von den Lagerhaus-Arbeitern aufgerufen, wenn sie ein Ware wieder zurückbringen, die sie vorne nicht ablegen /// konnten - void AddWaitingWare(std::unique_ptr ware); + void addWaitingWare(std::unique_ptr ware); /// Wird aufgerufen, wenn von der Fahne vor dem Gebäude ein Rohstoff aufgenommen wurde - bool FreePlaceAtFlag() override; + bool freePlaceAtFlag() override; // Eine Ware liegt vor der Flagge des Warenhauses und will rein --> ein Warenhausmitarbeiter muss kommen und sie // holen - void FetchWare(); + void fetchWare(); // Soll die nächste Ware nicht holen - void DontFetchNextWare() { fetch_double_protection = true; } + void dontFetchNextWare() { fetch_double_protection = true; } /// Legt eine Ware im Lagerhaus ab - void AddWare(std::unique_ptr ware) override; + void addWare(std::unique_ptr ware) override; /// Eine Figur geht ins Lagerhaus - virtual void AddFigure(std::unique_ptr figure, bool increase_visual_counts = true); + virtual void addFigure(std::unique_ptr figure, bool increase_visual_counts = true); /// Eine bestellte Ware konnte doch nicht kommen - void WareLost(Ware& ware) override; + void wareLost(Ware& ware) override; /// Bestellte Ware, die sich noch hier drin befindet, storniert ihre Auslieferung void cancelWare(Ware*& ware); /// Bestellte Figur, die sich noch ind er Warteschlange befindet, kommt nicht mehr und will rausgehauen werden virtual void cancelFigure(noFigure* figure); /// Wird aufgerufen, wenn eine neue Ware zum dem Gebäude geliefert wird (nicht wenn sie bestellt wurde vom Gebäude!) - void TakeWare(Ware* ware) override; + void takeWare(Ware* ware) override; /// Fügt eine Figur hinzu, die auf dem Weg zum Lagerhaus ist - void AddDependentFigure(noFigure& figure) + void addDependentFigure(noFigure& figure) { RTTR_Assert(!isDependentFigure(figure)); dependent_figures.push_back(&figure); } //// Entfernt eine abhängige Figur wieder aus der Liste - virtual void RemoveDependentFigure(noFigure& figure) + virtual void removeDependentFigure(noFigure& figure) { RTTR_Assert(isDependentFigure(figure)); dependent_figures.remove(&figure); } /// Wird aufgerufen, wenn ein Arbeiter hierher kommt - void GotWorker(Job /*job*/, noFigure& worker) override + void gotWorker(Job /*job*/, noFigure& worker) override { RTTR_Assert(!isDependentFigure(worker)); dependent_figures.push_back(&worker); } //// Entfernt eine abhängige Ware wieder aus der Liste (wird mit TakeWare hinzugefügt) - void RemoveDependentWare(Ware& ware) + void removeDependentWare(Ware& ware) { RTTR_Assert(isWareDependent(ware)); dependent_wares.remove(&ware); @@ -250,11 +250,11 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable /// Überprüft, ob Ware abhängig ist bool isWareDependent(const Ware& ware); /// Prüft, ob es Waren zum Auslagern gibt - bool AreWaresToEmpty() const; + bool areWaresToEmpty() const; - void FigureLeft(const noFigure& fig) override; + void figureLeft(const noFigure& fig) override; /// Fügt aktiven Soldaten (der aus von einer Mission) zum Militärgebäude hinzu - void AddActiveSoldier(std::unique_ptr soldier) override; + void addActiveSoldier(std::unique_ptr soldier) override; /// Gibt Gesamtanzahl aller im Lager befindlichen Soldaten zurück unsigned getNumSoldiers() const { @@ -263,22 +263,22 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable } /// Order troops of each rank according to `counts` without exceeding `max` in total. The number of soldiers /// of each rank that is sent out is subtracted from the corresponding count in `counts` and from `max`. - void OrderTroops(nobMilitary& goal, std::array& counts, unsigned& max); + void orderTroops(nobMilitary& goal, std::array& counts, unsigned& max); /// Schickt einen Verteidiger raus, der einem Angreifer in den Weg rennt - nofAggressiveDefender* SendAggressiveDefender(nofAttacker& attacker) override; + nofAggressiveDefender* sendAggressiveDefender(nofAttacker& attacker) override; /// Wird aufgerufen, wenn ein Soldat nicht mehr kommen kann - void SoldierLost(nofSoldier* soldier) override; + void soldierLost(nofSoldier* soldier) override; /// Sind noch Truppen drinne, die dieses Gebäude verteidigen könnten? - bool DefendersAvailable() const override; + bool defendersAvailable() const override; /// Verändert Reserveeinstellung void setReserveVisual(unsigned rank, unsigned count); void setRealReserve(unsigned rank, unsigned count); /// Versucht, die geforderten Reserve-Soldaten bereitzustellen - void RefreshReserve(unsigned rank); + void refreshReserve(unsigned rank); /// Gibt Zeiger auf dir Reserve zurück für das GUI const unsigned* getReserveAvailablePointer(unsigned rank) const { return &reserve_soldiers_available[rank]; } @@ -297,7 +297,7 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable /// Available figures of a specific type that can be used for trading unsigned getAvailableFiguresForTrading(Job job) const; /// Starts a trade caravane from this warehouse - void StartTradeCaravane(const boost_variant2& what, unsigned count, const TradeRoute& tr, + void startTradeCaravane(const boost_variant2& what, unsigned count, const TradeRoute& tr, nobBaseWarehouse* goal); /// For debug only diff --git a/libs/s25main/buildings/nobHQ.cpp b/libs/s25main/buildings/nobHQ.cpp index 11682b2120..9a75265479 100644 --- a/libs/s25main/buildings/nobHQ.cpp +++ b/libs/s25main/buildings/nobHQ.cpp @@ -20,15 +20,15 @@ nobHQ::nobHQ(const MapPoint pos, const unsigned char player, const Nation nation for(unsigned i = 0; i <= world->getGGS().getMaxMilitaryRank(); ++i) { reserve_soldiers_claimed_visual[i] = reserve_soldiers_claimed_real[i] = 1; - RefreshReserve(i); + refreshReserve(i); } // Evtl. liegen am Anfang Waffen im HQ, sodass rekrutiert werden muss - TryRecruiting(); + tryRecruiting(); // ins Militärquadrat einfügen - world->getMilitarySquares().Add(this); - world->RecalcTerritory(*this, TerritoryChangeReason::Build); + world->getMilitarySquares().add(this); + world->recalcTerritory(*this, TerritoryChangeReason::Build); } GoodsAndPeopleCounts nobHQ::getStartInventory(StartWares setting) @@ -319,16 +319,16 @@ GoodsAndPeopleCounts nobHQ::getStartInventory(StartWares setting) void nobHQ::addStartWares() { - AddToInventory(getStartInventory(world->getGGS().startWares), true); + addToInventory(getStartInventory(world->getGGS().startWares), true); } void nobHQ::DestroyBuilding() { nobBaseWarehouse::DestroyBuilding(); // Wieder aus dem Militärquadrat rauswerfen - world->getMilitarySquares().Remove(this); + world->getMilitarySquares().remove(this); // Recalc territory. AFTER calling base destroy as otherwise figures might get stuck here - world->RecalcTerritory(*this, TerritoryChangeReason::Destroyed); + world->recalcTerritory(*this, TerritoryChangeReason::Destroyed); } void nobHQ::Serialize(SerializedGameData& sgd) const @@ -339,16 +339,16 @@ void nobHQ::Serialize(SerializedGameData& sgd) const nobHQ::nobHQ(SerializedGameData& sgd, const unsigned obj_id) : nobBaseWarehouse(sgd, obj_id), isTent_(sgd.PopBool()) { - world->getMilitarySquares().Add(this); + world->getMilitarySquares().add(this); } -void nobHQ::Draw(DrawPoint drawPt) +void nobHQ::draw(DrawPoint drawPt) { if(isTent_) LOADER.building_cache[nation][BuildingType::Headquarters].skeleton.draw(drawPt); else { - DrawBaseBuilding(drawPt); + drawBaseBuilding(drawPt); // Draw at most 4 flags const unsigned numSoldiers = @@ -364,7 +364,7 @@ void nobHQ::Draw(DrawPoint drawPt) } } -void nobHQ::HandleEvent(const unsigned id) +void nobHQ::handleEvent(const unsigned id) { - HandleBaseEvent(id); + handleBaseEvent(id); } diff --git a/libs/s25main/buildings/nobHQ.h b/libs/s25main/buildings/nobHQ.h index 6e11ab73fb..88290be43f 100644 --- a/libs/s25main/buildings/nobHQ.h +++ b/libs/s25main/buildings/nobHQ.h @@ -25,11 +25,11 @@ class nobHQ : public nobBaseWarehouse GO_Type getGOT() const final { return GO_Type::NobHq; } - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; unsigned getMilitaryRadius() const override { return HQ_RADIUS; } - void HandleEvent(unsigned id) override; + void handleEvent(unsigned id) override; bool isTent() const { return isTent_; } void setIsTent(const bool isTent) { isTent_ = isTent; } diff --git a/libs/s25main/buildings/nobHarborBuilding.cpp b/libs/s25main/buildings/nobHarborBuilding.cpp index e6d6bf48ca..f0a603d77a 100644 --- a/libs/s25main/buildings/nobHarborBuilding.cpp +++ b/libs/s25main/buildings/nobHarborBuilding.cpp @@ -56,14 +56,14 @@ nobHarborBuilding::nobHarborBuilding(const MapPoint pos, const unsigned char pla : nobBaseWarehouse(BuildingType::HarborBuilding, pos, player, nation), orderware_ev(nullptr) { // ins Militärquadrat einfügen - world->getMilitarySquares().Add(this); - world->RecalcTerritory(*this, TerritoryChangeReason::Build); + world->getMilitarySquares().add(this); + world->recalcTerritory(*this, TerritoryChangeReason::Build); // Take 1 as the reserve per rank for(unsigned i = 0; i <= world->getGGS().getMaxMilitaryRank(); ++i) { reserve_soldiers_claimed_visual[i] = reserve_soldiers_claimed_real[i] = 1; - RefreshReserve(i); + refreshReserve(i); } /// Die Meere herausfinden, an die dieser Hafen grenzt @@ -71,14 +71,14 @@ nobHarborBuilding::nobHarborBuilding(const MapPoint pos, const unsigned char pla seaIds[dir] = world->getSeaFromCoastalPoint(world->getNeighbour(pos, dir)); // Post versenden - SendPostMessage(player, + sendPostMessage(player, std::make_unique(getEvMgr().getCurrentGF(), _("New harbor building finished"), PostCategory::Economy, *this)); } void nobHarborBuilding::DestroyBuilding() { - getEvMgr().RemoveEvent(orderware_ev); + getEvMgr().removeEvent(orderware_ev); // Der Wirtschaftsverwaltung Bescheid sagen GamePlayer& owner = world->getPlayer(player); @@ -86,61 +86,61 @@ void nobHarborBuilding::DestroyBuilding() // Baumaterialien in der Inventur verbuchen if(expedition.active) { - owner.DecreaseInventoryWare(GoodType::Boards, expedition.boards); - owner.DecreaseInventoryWare(GoodType::Stones, expedition.stones); + owner.decreaseInventoryWare(GoodType::Boards, expedition.boards); + owner.decreaseInventoryWare(GoodType::Stones, expedition.stones); // Und Bauarbeiter (später) rausschicken if(expedition.builder) - inventory.Add(Job::Builder); + inventory.add(Job::Builder); else - owner.OneJobNotWanted(Job::Builder, this); + owner.oneJobNotWanted(Job::Builder, this); } // cancel order for scouts if(exploration_expedition.active) { - inventory.real.Add(Job::Scout, exploration_expedition.scouts); + inventory.real.add(Job::Scout, exploration_expedition.scouts); for(unsigned i = exploration_expedition.scouts; i < world->getGGS().getNumScoutsExpedition(); i++) - owner.OneJobNotWanted(Job::Scout, this); + owner.oneJobNotWanted(Job::Scout, this); } // cancel all jobs wanted for this building - owner.JobNotWanted(this, true); + owner.jobNotWanted(this, true); // Waiting Wares löschen for(auto& wares_for_ship : wares_for_ships) { - wares_for_ship->WareLost(player); - wares_for_ship->Destroy(); + wares_for_ship->wareLost(player); + wares_for_ship->destroy(); } wares_for_ships.clear(); // Leute, die noch aufs Schiff warten, rausschicken for(auto& figures_for_ship : figures_for_ships) { - noFigure& figure = world->AddFigure(pos, std::move(figures_for_ship.fig)); + noFigure& figure = world->addFigure(pos, std::move(figures_for_ship.fig)); - figure.Abrogate(); - figure.StartWandering(); - figure.StartWalking(RANDOM_ENUM(Direction)); + figure.abrogate(); + figure.startWandering(); + figure.startWalking(RANDOM_ENUM(Direction)); } figures_for_ships.clear(); for(auto& soldiers_for_ship : soldiers_for_ships) { - nofAttacker& soldier = world->AddFigure(pos, std::move(soldiers_for_ship.attacker)); + nofAttacker& soldier = world->addFigure(pos, std::move(soldiers_for_ship.attacker)); soldier.cancelSeaAttack(); RTTR_Assert(!soldier.getAttackedGoal()); RTTR_Assert(!soldier.getHomeBld()); RTTR_Assert(!soldier.getGoal()); - soldier.StartWandering(); - soldier.StartWalking(RANDOM_ENUM(Direction)); + soldier.startWandering(); + soldier.startWalking(RANDOM_ENUM(Direction)); } soldiers_for_ships.clear(); nobBaseWarehouse::DestroyBuilding(); - world->getMilitarySquares().Remove(this); + world->getMilitarySquares().remove(this); // Recalc territory. AFTER calling base destroy as otherwise figures might get stuck here - world->RecalcTerritory(*this, TerritoryChangeReason::Destroyed); + world->recalcTerritory(*this, TerritoryChangeReason::Destroyed); } void nobHarborBuilding::Serialize(SerializedGameData& sgd) const @@ -148,46 +148,46 @@ void nobHarborBuilding::Serialize(SerializedGameData& sgd) const nobBaseWarehouse::Serialize(sgd); expedition.Serialize(sgd); exploration_expedition.Serialize(sgd); - sgd.PushEvent(orderware_ev); + sgd.pushEvent(orderware_ev); helpers::pushContainer(sgd, seaIds); - sgd.PushObjectContainer(wares_for_ships, true); + sgd.pushObjectContainer(wares_for_ships, true); sgd.PushUnsignedInt(figures_for_ships.size()); for(const auto& figures_for_ship : figures_for_ships) { helpers::pushPoint(sgd, figures_for_ship.dest); - sgd.PushObject(figures_for_ship.fig); + sgd.pushObject(figures_for_ship.fig); } sgd.PushUnsignedInt(soldiers_for_ships.size()); for(const auto& soldiers_for_ship : soldiers_for_ships) { helpers::pushPoint(sgd, soldiers_for_ship.dest); - sgd.PushObject(soldiers_for_ship.attacker, true); + sgd.pushObject(soldiers_for_ship.attacker, true); } } nobHarborBuilding::nobHarborBuilding(SerializedGameData& sgd, const unsigned obj_id) - : nobBaseWarehouse(sgd, obj_id), expedition(sgd), exploration_expedition(sgd), orderware_ev(sgd.PopEvent()) + : nobBaseWarehouse(sgd, obj_id), expedition(sgd), exploration_expedition(sgd), orderware_ev(sgd.popEvent()) { // ins Militärquadrat einfügen - world->getMilitarySquares().Add(this); + world->getMilitarySquares().add(this); helpers::popContainer(sgd, seaIds); - sgd.PopObjectContainer(wares_for_ships, GO_Type::Ware); + sgd.popObjectContainer(wares_for_ships, GO_Type::Ware); unsigned count = sgd.PopUnsignedInt(); for(unsigned i = 0; i < count; ++i) { - const MapPoint dest = sgd.PopMapPoint(); - auto* fig = sgd.PopObject(); + const MapPoint dest = sgd.popMapPoint(); + auto* fig = sgd.popObject(); figures_for_ships.emplace_back(FigureForShip{std::unique_ptr(fig), dest}); } count = sgd.PopUnsignedInt(); for(unsigned i = 0; i < count; ++i) { - const MapPoint dest = sgd.PopMapPoint(); - auto* fig = sgd.PopObject(GO_Type::NofAttacker); + const MapPoint dest = sgd.popMapPoint(); + auto* fig = sgd.popObject(GO_Type::NofAttacker); soldiers_for_ships.emplace_back(SoldierForShip{std::unique_ptr(fig), dest}); } } @@ -208,27 +208,27 @@ constexpr helpers::EnumArray FIRE_POS = { constexpr helpers::EnumArray EXTRAFIRE_POS = { {Position(0, 0), Position(0, 0), Position(8, -115), Position(0, 0), Position(0, 0)}}; -void nobHarborBuilding::Draw(DrawPoint drawPt) +void nobHarborBuilding::draw(DrawPoint drawPt) { // Gebäude an sich zeichnen - DrawBaseBuilding(drawPt); + drawBaseBuilding(drawPt); // Hafenfeuer zeichnen // TODO auch für nicht-römer machen if(nation == Nation::Romans || nation == Nation::Japanese || nation == Nation::Babylonians) { LOADER.getNationImage(nation, 500 + 5 * GAMECLIENT.getGlobalAnimation(8, 2, 1, getObjId() + getX() + getY())) - ->DrawFull(drawPt + FIRE_POS[nation]); + ->drawFull(drawPt + FIRE_POS[nation]); } else if(nation == Nation::Africans || nation == Nation::Vikings) { LOADER.getMapTexture(740 + GAMECLIENT.getGlobalAnimation(8, 5, 2, getObjId() + getX() + getY())) - ->DrawFull(drawPt + FIRE_POS[nation]); + ->drawFull(drawPt + FIRE_POS[nation]); } if(nation == Nation::Romans) { // Zusätzliches Feuer LOADER.getMapTexture(740 + GAMECLIENT.getGlobalAnimation(8, 5, 2, getObjId() + getX() + getY())) - ->DrawFull(drawPt + EXTRAFIRE_POS[nation]); + ->drawFull(drawPt + EXTRAFIRE_POS[nation]); } // Läuft gerade eine Expedition? @@ -239,11 +239,11 @@ void nobHarborBuilding::Draw(DrawPoint drawPt) // Bretter DrawPoint boardsPos = drawPt + BOARDS_POS[nation]; for(unsigned char i = 0; i < expedition.boards; ++i) - LOADER.getWareStackTex(GoodType::Boards)->DrawFull(boardsPos - DrawPoint(0, i * 4)); + LOADER.getWareStackTex(GoodType::Boards)->drawFull(boardsPos - DrawPoint(0, i * 4)); DrawPoint stonesPos = drawPt + STONES_POS[nation]; // Steine for(unsigned char i = 0; i < expedition.stones; ++i) - LOADER.getWareStackTex(GoodType::Stones)->DrawFull(stonesPos - DrawPoint(0, i * 4)); + LOADER.getWareStackTex(GoodType::Stones)->drawFull(stonesPos - DrawPoint(0, i * 4)); // Und den Bauarbeiter, falls er schon da ist if(expedition.builder) @@ -269,7 +269,7 @@ void nobHarborBuilding::Draw(DrawPoint drawPt) } } -void nobHarborBuilding::HandleEvent(const unsigned id) +void nobHarborBuilding::handleEvent(const unsigned id) { switch(id) { @@ -277,14 +277,14 @@ void nobHarborBuilding::HandleEvent(const unsigned id) // Waren-Bestell-Event this->orderware_ev = nullptr; // Mal wieder schauen, ob es Waren für unsere Expedition gibt - OrderExpeditionWares(); + orderExpeditionWares(); break; - default: HandleBaseEvent(id); break; + default: handleBaseEvent(id); break; } } /// Startet eine Expedition -void nobHarborBuilding::StartExpedition() +void nobHarborBuilding::startExpedition() { // Schon eine Expedition gestartet? if(expedition.active) @@ -299,13 +299,13 @@ void nobHarborBuilding::StartExpedition() std::min(unsigned(BUILDING_COSTS[BuildingType::HarborBuilding].boards), inventory[GoodType::Boards]); expedition.stones = std::min(unsigned(BUILDING_COSTS[BuildingType::HarborBuilding].stones), inventory[GoodType::Stones]); - inventory.Remove(GoodType::Boards, expedition.boards); - inventory.Remove(GoodType::Stones, expedition.stones); + inventory.remove(GoodType::Boards, expedition.boards); + inventory.remove(GoodType::Stones, expedition.stones); if(inventory[Job::Builder]) { expedition.builder = true; - inventory.Remove(Job::Builder); + inventory.remove(Job::Builder); } else { bool convert = true; @@ -323,28 +323,28 @@ void nobHarborBuilding::StartExpedition() if(convert && inventory[GoodType::Hammer] && inventory[Job::Helper] > 1) // maybe have a hammer & helper to create our own builder? { - inventory.Remove(GoodType::Hammer); - owner.DecreaseInventoryWare(GoodType::Hammer, 1); - inventory.Remove(Job::Helper); - owner.DecreaseInventoryJob(Job::Helper, 1); + inventory.remove(GoodType::Hammer); + owner.decreaseInventoryWare(GoodType::Hammer, 1); + inventory.remove(Job::Helper); + owner.decreaseInventoryJob(Job::Helper, 1); - owner.IncreaseInventoryJob(Job::Builder, 1); + owner.increaseInventoryJob(Job::Builder, 1); expedition.builder = true; } // not in harbor, and didnt have to or couldnt convert so order a builder if(!expedition.builder) - owner.AddJobWanted(Job::Builder, this); + owner.addJobWanted(Job::Builder, this); } // Ggf. Waren bestellen, die noch fehlen - OrderExpeditionWares(); + orderExpeditionWares(); // Ggf. ist jetzt alles benötigte schon da // Dann Schiff rufen - CheckExpeditionReady(); + checkExpeditionReady(); } -void nobHarborBuilding::StopExpedition() +void nobHarborBuilding::stopExpedition() { if(!expedition.active) return; @@ -353,23 +353,23 @@ void nobHarborBuilding::StopExpedition() expedition.active = false; // Waren zurücktransferieren - inventory.Add(GoodType::Boards, expedition.boards); - inventory.Add(GoodType::Stones, expedition.stones); + inventory.add(GoodType::Boards, expedition.boards); + inventory.add(GoodType::Stones, expedition.stones); if(expedition.builder) { - inventory.Add(Job::Builder); + inventory.add(Job::Builder); // Evtl. Abnehmer für die Figur wieder finden - world->getPlayer(player).FindWarehouseForAllJobs(Job::Builder); + world->getPlayer(player).findWarehouseForAllJobs(Job::Builder); } else // todo falls noch nicht da - unterscheiden ob unterwegs oder nur bestellt - falls bestellt stornieren sonst // informieren damit kein ersatz geschickt wird falls was nicht klappt aufm weg { - world->getPlayer(player).OneJobNotWanted(Job::Builder, this); + world->getPlayer(player).oneJobNotWanted(Job::Builder, this); } } /// Startet eine Erkundungs-Expedition oder stoppt sie, wenn bereits eine stattfindet -void nobHarborBuilding::StartExplorationExpedition() +void nobHarborBuilding::startExplorationExpedition() { // Schon eine Expedition gestartet? if(exploration_expedition.active) @@ -397,22 +397,22 @@ void nobHarborBuilding::StartExplorationExpedition() missing -= numScouts; } // Recruit missing ones if possible - while(missing > 0 && TryRecruitJob(Job::Scout)) + while(missing > 0 && tryRecruitJob(Job::Scout)) missing--; // Order scouts, we still requires for(unsigned i = inventory[Job::Scout]; i < numScoutsRequired; ++i) - owner.AddJobWanted(Job::Scout, this); + owner.addJobWanted(Job::Scout, this); } if(inventory[Job::Scout]) { exploration_expedition.scouts = std::min(inventory[Job::Scout], numScoutsRequired); - inventory.real.Remove(Job::Scout, exploration_expedition.scouts); + inventory.real.remove(Job::Scout, exploration_expedition.scouts); } - CheckExplorationExpeditionReady(); + checkExplorationExpeditionReady(); } -void nobHarborBuilding::StopExplorationExpedition() +void nobHarborBuilding::stopExplorationExpedition() { if(!exploration_expedition.active) return; @@ -421,20 +421,20 @@ void nobHarborBuilding::StopExplorationExpedition() // cancel order for scouts for(unsigned i = exploration_expedition.scouts; i < world->getGGS().getNumScoutsExpedition(); i++) { - world->getPlayer(player).OneJobNotWanted(Job::Scout, this); + world->getPlayer(player).oneJobNotWanted(Job::Scout, this); } // Erkunder zurücktransferieren if(exploration_expedition.scouts) { - inventory.real.Add(Job::Scout, exploration_expedition.scouts); + inventory.real.add(Job::Scout, exploration_expedition.scouts); exploration_expedition.scouts = 0; // Evtl. Abnehmer für die Figur wieder finden - world->getPlayer(player).FindWarehouseForAllJobs(Job::Scout); + world->getPlayer(player).findWarehouseForAllJobs(Job::Scout); } } /// Bestellt die zusätzlichen erforderlichen Waren für eine Expedition -void nobHarborBuilding::OrderExpeditionWares() +void nobHarborBuilding::orderExpeditionWares() { RTTR_Assert(!isBeingDestroyedNow()); // Wares should already be canceled! if(this->isBeingDestroyedNow()) // don't order new stuff if we are about to be destroyed @@ -461,7 +461,7 @@ void nobHarborBuilding::OrderExpeditionWares() Ware* ware; do { - ware = world->getPlayer(player).OrderWare(GoodType::Boards, *this); + ware = world->getPlayer(player).orderWare(GoodType::Boards, *this); if(ware) { RTTR_Assert(isWareDependent(*ware)); @@ -477,7 +477,7 @@ void nobHarborBuilding::OrderExpeditionWares() Ware* ware; do { - ware = world->getPlayer(player).OrderWare(GoodType::Stones, *this); + ware = world->getPlayer(player).orderWare(GoodType::Stones, *this); if(ware) { RTTR_Assert(isWareDependent(*ware)); @@ -488,21 +488,21 @@ void nobHarborBuilding::OrderExpeditionWares() // Wenn immer noch nicht alles da ist, später noch einmal bestellen if(!orderware_ev) - orderware_ev = getEvMgr().AddEvent(this, 210, 10); + orderware_ev = getEvMgr().addEvent(this, 210, 10); } /// Eine bestellte Ware konnte doch nicht kommen -void nobHarborBuilding::WareLost(Ware& ware) +void nobHarborBuilding::wareLost(Ware& ware) { RTTR_Assert(!isBeingDestroyedNow()); // ggf. neue Waren für Expedition bestellen if(expedition.active && (ware.type == GoodType::Boards || ware.type == GoodType::Stones)) - OrderExpeditionWares(); - nobBaseWarehouse::WareLost(ware); + orderExpeditionWares(); + nobBaseWarehouse::wareLost(ware); } /// Schiff ist angekommen -void nobHarborBuilding::ShipArrived(noShip& ship) +void nobHarborBuilding::shipArrived(noShip& ship) { // get a new job - priority is given according to this list: attack,expedition,exploration,transport // any attackers ready? @@ -516,14 +516,14 @@ void nobHarborBuilding::ShipArrived(noShip& ship) { if(it->dest == ship_dest) { - RemoveFromVisualInventory(*it->attacker); + removeFromVisualInventory(*it->attacker); attackers.push_back(std::move(it->attacker)); it = soldiers_for_ships.erase(it); } else ++it; } - ship.PrepareSeaAttack(getHarborPosID(), ship_dest, std::move(attackers)); + ship.prepareSeaAttack(getHarborPosID(), ship_dest, std::move(attackers)); return; } // Expedition ready? @@ -534,7 +534,7 @@ void nobHarborBuilding::ShipArrived(noShip& ship) // Aufräumen am Hafen expedition.active = false; // Expedition starten - ship.StartExpedition(getHarborPosID()); + ship.startExpedition(getHarborPosID()); return; } // Exploration-Expedition ready? @@ -543,8 +543,8 @@ void nobHarborBuilding::ShipArrived(noShip& ship) // Aufräumen am Hafen exploration_expedition.active = false; // Expedition starten - ship.StartExplorationExpedition(getHarborPosID()); - inventory.visual.Remove(Job::Scout, exploration_expedition.scouts); + ship.startExplorationExpedition(getHarborPosID()); + inventory.visual.remove(Job::Scout, exploration_expedition.scouts); return; } @@ -588,8 +588,8 @@ void nobHarborBuilding::ShipArrived(noShip& ship) { if(it->dest == dest) { - it->fig->StartShipJourney(); - RemoveFromVisualInventory(*it->fig); + it->fig->startShipJourney(); + removeFromVisualInventory(*it->fig); figures.push_back(std::move(it->fig)); it = figures_for_ships.erase(it); } else @@ -603,8 +603,8 @@ void nobHarborBuilding::ShipArrived(noShip& ship) { if((*it)->getNextHarbor() == dest) { - (*it)->StartShipJourney(); - inventory.visual.Remove(ConvertShields((*it)->type)); + (*it)->startShipJourney(); + inventory.visual.remove(ConvertShields((*it)->type)); wares.push_back(std::move(*it)); it = wares_for_ships.erase(it); } else @@ -612,29 +612,29 @@ void nobHarborBuilding::ShipArrived(noShip& ship) } // Und das Schiff starten lassen - ship.PrepareTransport(getHarborPosID(), dest, std::move(figures), std::move(wares)); + ship.prepareTransport(getHarborPosID(), dest, std::move(figures), std::move(wares)); } } } -void nobHarborBuilding::AddWare(std::unique_ptr ware) +void nobHarborBuilding::addWare(std::unique_ptr ware) { if(ware->getGoal() && ware->getGoal() != this) { // This is not the goal but we have one -> Get new route - ware->RecalcRoute(); + ware->recalcRoute(); // Go by ship next? if(ware->getNextDir() == RoadPathDirection::Ship) { - AddWareForShip(std::move(ware)); + addWareForShip(std::move(ware)); return; } if(ware->getNextDir() != RoadPathDirection::None) { // Travel on roads -> Carry out RTTR_Assert(ware->getGoal() != this); - AddWaitingWare(std::move(ware)); + addWaitingWare(std::move(ware)); return; } // No next dir means the ware reached its goal, i.e. us, @@ -652,13 +652,13 @@ void nobHarborBuilding::AddWare(std::unique_ptr ware) // RTTR_Assert(!ware->GetGoal() || ware->GetGoal() == this) RTTR_Assert(ware->isCarried()); // Explicitly calculate the route which now should set it. - ware->RecalcRoute(); + ware->recalcRoute(); RTTR_Assert(ware->getGoal()); RTTR_Assert(ware->getNextDir() != RoadPathDirection::None); if(ware->getNextDir() == RoadPathDirection::Ship) - AddWareForShip(std::move(ware)); + addWareForShip(std::move(ware)); else - AddWaitingWare(std::move(ware)); + addWaitingWare(std::move(ware)); return; } } @@ -674,53 +674,53 @@ void nobHarborBuilding::AddWare(std::unique_ptr ware) // Don't wait for it any longer if it had a goal, i.e. us. // Without a goal it was a "lost" ware. if(ware->getGoal()) - RemoveDependentWare(*ware); + removeDependentWare(*ware); // Add to expedition - world->getPlayer(player).RemoveWare(*ware); + world->getPlayer(player).removeWare(*ware); if(ware->type == GoodType::Boards) ++expedition.boards; else ++expedition.stones; // Could be ready now - CheckExpeditionReady(); + checkExpeditionReady(); return; } } - nobBaseWarehouse::AddWare(std::move(ware)); + nobBaseWarehouse::addWare(std::move(ware)); } /// Eine Figur geht ins Lagerhaus -void nobHarborBuilding::AddFigure(std::unique_ptr figure, const bool increase_visual_counts) +void nobHarborBuilding::addFigure(std::unique_ptr figure, const bool increase_visual_counts) { // Brauchen wir einen Bauarbeiter für die Expedition? if(figure->getJobType() == Job::Builder && expedition.active && !expedition.builder) { // Make sure the figure came from outside and was not already here waiting for a ship if(isDependentFigure(*figure)) - nobBaseWarehouse::RemoveDependentFigure(*figure); - getEvMgr().AddToKillList(std::move(figure)); + nobBaseWarehouse::removeDependentFigure(*figure); + getEvMgr().addToKillList(std::move(figure)); expedition.builder = true; // Ggf. ist jetzt alles benötigte da - CheckExpeditionReady(); + checkExpeditionReady(); } // Brauchen wir einen Spähter für die Expedition? else if(figure->getJobType() == Job::Scout && exploration_expedition.active && !isExplorationExpeditionReady()) { // Make sure the figure came from outside and was not already here waiting for a ship if(isDependentFigure(*figure)) - nobBaseWarehouse::RemoveDependentFigure(*figure); - getEvMgr().AddToKillList(std::move(figure)); + nobBaseWarehouse::removeDependentFigure(*figure); + getEvMgr().addToKillList(std::move(figure)); ++exploration_expedition.scouts; - inventory.visual.Add(Job::Scout); + inventory.visual.add(Job::Scout); // Ggf. ist jetzt alles benötigte da - CheckExplorationExpeditionReady(); + checkExplorationExpeditionReady(); } else // ansonsten weiterdelegieren - nobBaseWarehouse::AddFigure(std::move(figure), increase_visual_counts); + nobBaseWarehouse::addFigure(std::move(figure), increase_visual_counts); } /// Gibt zurück, ob Expedition vollständig ist @@ -752,28 +752,28 @@ bool nobHarborBuilding::isExplorationExpeditionReady() const } /// Prüft, ob eine Expedition von den Waren her vollständig ist und ruft ggf. das Schiff -void nobHarborBuilding::CheckExpeditionReady() +void nobHarborBuilding::checkExpeditionReady() { // Alles da? // Dann bestellen wir mal das Schiff if(isExpeditionReady()) - OrderShip(); + orderShip(); } /// Prüft, ob eine Expedition von den Spähern her vollständig ist und ruft ggf. das Schiff -void nobHarborBuilding::CheckExplorationExpeditionReady() +void nobHarborBuilding::checkExplorationExpeditionReady() { // Alles da? // Dann bestellen wir mal das Schiff if(isExplorationExpeditionReady()) - OrderShip(); + orderShip(); } /// Schiff konnte nicht mehr kommen -void nobHarborBuilding::ShipLost(noShip* /*ship*/) +void nobHarborBuilding::shipLost(noShip* /*ship*/) { // Neues Schiff bestellen - OrderShip(); + orderShip(); } /// Gibt die Hafenplatz-ID zurück, auf der der Hafen steht @@ -784,9 +784,9 @@ HarborId nobHarborBuilding::getHarborPosID() const /// Abfangen, wenn ein Mann nicht mehr kommen kann --> könnte ein Bauarbeiter sein und /// wenn wir einen benötigen, müssen wir einen neuen bestellen -void nobHarborBuilding::RemoveDependentFigure(noFigure& figure) +void nobHarborBuilding::removeDependentFigure(noFigure& figure) { - nobBaseWarehouse::RemoveDependentFigure(figure); + nobBaseWarehouse::removeDependentFigure(figure); // Ist das ein Bauarbeiter und brauchen wir noch einen if(figure.getJobType() == Job::Builder && expedition.active && !expedition.builder) { @@ -800,7 +800,7 @@ void nobHarborBuilding::RemoveDependentFigure(noFigure& figure) } // Keinen gefunden, also müssen wir noch einen bestellen - world->getPlayer(player).AddJobWanted(Job::Builder, this); + world->getPlayer(player).addJobWanted(Job::Builder, this); } // Ist das ein Erkunder und brauchen wir noch welche? @@ -815,7 +815,7 @@ void nobHarborBuilding::RemoveDependentFigure(noFigure& figure) // Wenn nicht genug Erkunder mehr kommen, müssen wir einen neuen bestellen if(exploration_expedition.scouts + scouts_coming < world->getGGS().getNumScoutsExpedition()) - world->getPlayer(player).AddJobWanted(Job::Scout, this); + world->getPlayer(player).addJobWanted(Job::Scout, this); } } @@ -864,22 +864,22 @@ std::vector nobHarborBuilding::getShipConnect } /// Fügt einen Mensch hinzu, der mit dem Schiff irgendwo hin fahren will -void nobHarborBuilding::AddFigureForShip(std::unique_ptr fig, MapPoint dest) +void nobHarborBuilding::addFigureForShip(std::unique_ptr fig, MapPoint dest) { RTTR_Assert(!world->hasFigureAt(fig->getPos(), *fig)); // Figure is in the harbor, so it cannot be outside - AddToVisualInventory(*fig); + addToVisualInventory(*fig); figures_for_ships.emplace_back(FigureForShip{std::move(fig), dest}); - OrderShip(); + orderShip(); } /// Fügt eine Ware hinzu, die mit dem Schiff verschickt werden soll -void nobHarborBuilding::AddWareForShip(std::unique_ptr ware) +void nobHarborBuilding::addWareForShip(std::unique_ptr ware) { // Anzahl visuell erhöhen - inventory.visual.Add(ConvertShields(ware->type)); - ware->WaitForShip(this); + inventory.visual.add(ConvertShields(ware->type)); + ware->waitForShip(this); wares_for_ships.emplace_back(std::move(ware)); - OrderShip(); + orderShip(); // Take ownership ware = nullptr; } @@ -972,19 +972,19 @@ int nobHarborBuilding::getNeedForShip(unsigned ships_coming) const } // try to order any ship that might be needed and is not ordered yet -void nobHarborBuilding::OrderShip() +void nobHarborBuilding::orderShip() { unsigned needed = getNumNeededShips(); GamePlayer& owner = world->getPlayer(player); // Order (possibly) remaining ships for(unsigned ordered = owner.getShipsToHarbor(*this); ordered < needed; ++ordered) - owner.OrderShip(*this); + owner.orderShip(*this); } /// Abgeleitete kann eine gerade erzeugte Ware ggf. sofort verwenden /// (muss in dem Fall true zurückgeben) -bool nobHarborBuilding::UseWareAtOnce(std::unique_ptr& ware, noBaseBuilding& goal) +bool nobHarborBuilding::useWareAtOnce(std::unique_ptr& ware, noBaseBuilding& goal) { // If the ware is coming to us, there is nothing to do if(&goal == this) @@ -992,20 +992,20 @@ bool nobHarborBuilding::UseWareAtOnce(std::unique_ptr& ware, noBaseBuildin // Evtl. muss die Ware gleich das Schiff nehmen -> dann zum Schiffsreservoir hinzufügen // Assert: This is a ware that got ordered. There MUST be a path to the goal // Otherwise the ware will notify the goal which will order a new ware resulting in an infinite loop - RTTR_Assert(world->getRoadPathFinder().PathExists(*this, goal, true)); - ware->RecalcRoute(); // Also sets nextHarbor! + RTTR_Assert(world->getRoadPathFinder().pathExists(*this, goal, true)); + ware->recalcRoute(); // Also sets nextHarbor! RTTR_Assert(ware->getNextDir() != RoadPathDirection::None); if(ware->getNextDir() == RoadPathDirection::Ship) { // Dann fügen wir die mal bei uns hinzu - AddWareForShip(std::move(ware)); + addWareForShip(std::move(ware)); return true; } else return false; } /// Dasselbe für Menschen -bool nobHarborBuilding::UseFigureAtOnce(std::unique_ptr& fig, noRoadNode& goal) +bool nobHarborBuilding::useFigureAtOnce(std::unique_ptr& fig, noRoadNode& goal) { // If the figure needs to take a ship, add it to the ships inventory @@ -1014,13 +1014,13 @@ bool nobHarborBuilding::UseFigureAtOnce(std::unique_ptr& fig, noRoadNo return false; MapPoint next_harbor; - if(world->FindHumanPathOnRoads(*this, goal, nullptr, &next_harbor) == RoadPathDirection::Ship) + if(world->findHumanPathOnRoads(*this, goal, nullptr, &next_harbor) == RoadPathDirection::Ship) { // Reduce figure count because figures don't go through the house leaving process // And therefore the visual count reducement - RemoveFromVisualInventory(*fig); + removeFromVisualInventory(*fig); // Dann fügen wir die mal bei uns hinzu - AddFigureForShip(std::move(fig), next_harbor); + addFigureForShip(std::move(fig), next_harbor); return true; } @@ -1028,42 +1028,42 @@ bool nobHarborBuilding::UseFigureAtOnce(std::unique_ptr& fig, noRoadNo } /// Erhält die Waren von einem Schiff und nimmt diese in den Warenbestand auf -void nobHarborBuilding::ReceiveGoodsFromShip(std::list>& figures, +void nobHarborBuilding::receiveGoodsFromShip(std::list>& figures, std::list>& wares) { // Menschen zur Ausgehliste hinzufügen for(auto& figure : figures) { - figure->ArrivedByShip(pos); + figure->arrivedByShip(pos); // Wenn es kein Ziel mehr hat, sprich keinen weiteren Weg, kann es direkt hier gelagert werden if(figure->getGoal() == this) { figure->setGoalTonullptr(); - AddFigure(std::move(figure), true); + addFigure(std::move(figure), true); } else if(!figure->getGoal()) { - AddDependentFigure(*figure); // No goal? We take it - AddFigure(std::move(figure), true); + addDependentFigure(*figure); // No goal? We take it + addFigure(std::move(figure), true); } else { RoadPathDirection nextDir; - MapPoint next_harbor = figure->ExamineRouteBeforeShipping(nextDir); //-V821 + MapPoint next_harbor = figure->examineRouteBeforeShipping(nextDir); //-V821 if(nextDir == RoadPathDirection::SouthEast) { - AddToVisualInventory(*figure); - AddLeavingFigure(std::move(figure)); + addToVisualInventory(*figure); + addLeavingFigure(std::move(figure)); } else if(nextDir == RoadPathDirection::Ship) { - AddFigureForShip(std::move(figure), next_harbor); + addFigureForShip(std::move(figure), next_harbor); } else { // No or invalid path -> Store here RTTR_Assert(nextDir == RoadPathDirection::None); figure->setGoalTonullptr(); - AddDependentFigure(*figure); - AddFigure(std::move(figure), true); + addDependentFigure(*figure); + addFigure(std::move(figure), true); } } } @@ -1072,13 +1072,13 @@ void nobHarborBuilding::ReceiveGoodsFromShip(std::list // Waren zur Warteliste hinzufügen for(auto& ware : wares) { - ware->ShipJorneyEnded(this); - AddWare(std::move(ware)); + ware->shipJorneyEnded(this); + addWare(std::move(ware)); } wares.clear(); } -nofAggressiveDefender* nobHarborBuilding::SendAggressiveDefender(nofAttacker& attacker) +nofAggressiveDefender* nobHarborBuilding::sendAggressiveDefender(nofAttacker& attacker) { // Don't sent out last soldier unsigned numSoldiers = 0; @@ -1090,14 +1090,14 @@ nofAggressiveDefender* nobHarborBuilding::SendAggressiveDefender(nofAttacker& at } if(numSoldiers <= 1) return nullptr; - return nobBaseWarehouse::SendAggressiveDefender(attacker); + return nobBaseWarehouse::sendAggressiveDefender(attacker); } /// Storniert die Bestellung für eine bestimmte Ware, die mit einem Schiff transportiert werden soll std::unique_ptr nobHarborBuilding::cancelWareForShip(Ware* ware) { // Ware zur Inventur hinzufügen - inventory.real.Add(ConvertShields(ware->type)); + inventory.real.add(ConvertShields(ware->type)); return helpers::extractPtr(wares_for_ships, ware); } @@ -1111,7 +1111,7 @@ void nobHarborBuilding::cancelFigure(noFigure* figure) if(it != figures_for_ships.end()) { // Dann zu unserem Inventar hinzufügen - AddFigure(std::move(it->fig), false); + addFigure(std::move(it->fig), false); figures_for_ships.erase(it); } // An Basisklasse weiterdelegieren @@ -1123,7 +1123,7 @@ void nobHarborBuilding::cancelFigure(noFigure* figure) std::vector nobHarborBuilding::getAttackerBuildingsForSeaIdAttack() { std::vector buildings; - sortedMilitaryBlds all_buildings = world->LookForMilitaryBuildings(pos, 3); + sortedMilitaryBlds all_buildings = world->lookForMilitaryBuildings(pos, 3); // Und zählen for(nobBaseMilitary* all_building : all_buildings) { @@ -1132,7 +1132,7 @@ std::vector nobHarborBuilding::getAttack // Liegt er auch im groben Raster und handelt es sich um den gleichen Besitzer? if(all_building->getPlayer() != player - || world->CalcDistance(all_building->getPos(), pos) > BASE_ATTACKING_DISTANCE) + || world->calcDistance(all_building->getPos(), pos) > BASE_ATTACKING_DISTANCE) continue; // Gebäude suchen, vielleicht schon vorhanden? Dann können wir uns den pathfinding Aufwand sparen! if(helpers::contains(buildings, static_cast(all_building))) @@ -1141,7 +1141,7 @@ std::vector nobHarborBuilding::getAttack continue; } // Weg vom Hafen zum Militärgebäude berechnen - if(!world->FindHumanPath(all_building->getPos(), pos, MAX_ATTACKING_RUN_DISTANCE)) + if(!world->findHumanPath(all_building->getPos(), pos, MAX_ATTACKING_RUN_DISTANCE)) continue; // neues Gebäude mit weg und allem -> in die Liste! SeaAttackerBuilding sab = {static_cast(all_building), this, 0}; @@ -1154,7 +1154,7 @@ std::vector nobHarborBuilding::getAttackerBuildingsForSeaAttack(const std::vector& defender_harbors) { std::vector buildings; - sortedMilitaryBlds all_buildings = world->LookForMilitaryBuildings(pos, 3); + sortedMilitaryBlds all_buildings = world->lookForMilitaryBuildings(pos, 3); // Und zählen for(nobBaseMilitary* all_building : all_buildings) { @@ -1163,11 +1163,11 @@ nobHarborBuilding::getAttackerBuildingsForSeaAttack(const std::vector& // Liegt er auch im groben Raster und handelt es sich um den gleichen Besitzer? if(all_building->getPlayer() != player - || world->CalcDistance(all_building->getPos(), pos) > BASE_ATTACKING_DISTANCE) + || world->calcDistance(all_building->getPos(), pos) > BASE_ATTACKING_DISTANCE) continue; // Weg vom Hafen zum Militärgebäude berechnen - if(!world->FindHumanPath(all_building->getPos(), pos, MAX_ATTACKING_RUN_DISTANCE)) + if(!world->findHumanPath(all_building->getPos(), pos, MAX_ATTACKING_RUN_DISTANCE)) continue; // Entfernung zwischen Hafen und möglichen Zielhafenpunkt ausrechnen @@ -1198,7 +1198,7 @@ nobHarborBuilding::getAttackerBuildingsForSeaAttack(const std::vector& } /// Fügt einen Schiffs-Angreifer zum Hafen hinzu -void nobHarborBuilding::AddSeaAttacker(std::unique_ptr attacker) +void nobHarborBuilding::addSeaAttacker(std::unique_ptr attacker) { unsigned best_distance = 0xffffffff; HarborId best_harbor_point; @@ -1219,20 +1219,20 @@ void nobHarborBuilding::AddSeaAttacker(std::unique_ptr attacker) if(!best_harbor_point) { // notify target about noShow, notify home that soldier wont return, add to inventory - attacker->SeaAttackFailedBeforeLaunch(); // set state, remove target & home + attacker->seaAttackFailedBeforeLaunch(); // set state, remove target & home RTTR_Assert(!attacker->getAttackedGoal()); RTTR_Assert(!attacker->getHomeBld()); RTTR_Assert(!attacker->getGoal()); - AddFigure(std::move(attacker), true); + addFigure(std::move(attacker), true); return; } - inventory.visual.Add(attacker->getJobType()); + inventory.visual.add(attacker->getJobType()); if(attacker->hasArmor()) - inventory.visual.Add(jobEnumToAmoredSoldierEnum(attacker->getJobType())); + inventory.visual.add(jobEnumToAmoredSoldierEnum(attacker->getJobType())); soldiers_for_ships.emplace_back(SoldierForShip{std::move(attacker), world->getHarborPoint(best_harbor_point)}); - OrderShip(); + orderShip(); } void nobHarborBuilding::cancelSeaAttacker(nofAttacker* attacker) @@ -1244,14 +1244,14 @@ void nobHarborBuilding::cancelSeaAttacker(nofAttacker* attacker) if(!attacker->getGoal()) { // No goal? We take it - AddDependentFigure(*attacker); - AddFigure(std::move(it->attacker), false); + addDependentFigure(*attacker); + addFigure(std::move(it->attacker), false); } else - AddLeavingFigure(std::move(it->attacker)); // Just let him leave so he can go home + addLeavingFigure(std::move(it->attacker)); // Just let him leave so he can go home soldiers_for_ships.erase(it); } -unsigned nobHarborBuilding::CalcDistributionPoints(const GoodType type) const +unsigned nobHarborBuilding::calcDistributionPoints(const GoodType type) const { // Ist überhaupt eine Expedition im Gang und ein entsprechender Warentyp if(!expedition.active || (type != GoodType::Boards && type != GoodType::Stones)) @@ -1288,7 +1288,7 @@ unsigned nobHarborBuilding::CalcDistributionPoints(const GoodType type) const } /// A ware changed its route and doesn't want to use the ship anymore -void nobHarborBuilding::WareDontWantToTravelByShip(Ware* ware) +void nobHarborBuilding::wareDontWantToTravelByShip(Ware* ware) { // Maybe this building is already destroyed if(world->getGOT(pos) != GO_Type::NobHarborbuilding) @@ -1296,16 +1296,16 @@ void nobHarborBuilding::WareDontWantToTravelByShip(Ware* ware) // Move to waiting_wares waiting_wares.push_back(helpers::extractPtr(wares_for_ships, ware)); - ware->WaitInWarehouse(*this); + ware->waitInWarehouse(*this); // Carry out. If it would want to go back to this building, then this will be handled by the carrier - AddLeavingEvent(); + addLeavingEvent(); } /// Stellt Verteidiger zur Verfügung -std::unique_ptr nobHarborBuilding::ProvideDefender(nofAttacker& attacker) +std::unique_ptr nobHarborBuilding::provideDefender(nofAttacker& attacker) { // Versuchen, zunächst auf konventionelle Weise Angreifer zu bekoommen - std::unique_ptr defender = nobBaseWarehouse::ProvideDefender(attacker); + std::unique_ptr defender = nobBaseWarehouse::provideDefender(attacker); // Wenn das nicht geklappt hat und noch Soldaten in der Warteschlange für den Seeangriff sind // zweigen wir einfach diese ab if(!defender && !soldiers_for_ships.empty()) @@ -1315,32 +1315,32 @@ std::unique_ptr nobHarborBuilding::ProvideDefender(nofAttacker& att defender = std::make_unique(pos, player, *this, defender_attacker->getRank(), attacker); defender->setArmor(defender_attacker->hasArmor()); defender_attacker->cancelSeaAttack(); - defender_attacker->Destroy(); + defender_attacker->destroy(); } return defender; } /// People waiting for a ship have to examine their route if a road was destroyed -void nobHarborBuilding::ExamineShipRouteOfPeople() +void nobHarborBuilding::examineShipRouteOfPeople() { for(auto it = figures_for_ships.begin(); it != figures_for_ships.end();) { auto& fig = it->fig; RoadPathDirection nextDir; - it->dest = fig->ExamineRouteBeforeShipping(nextDir); + it->dest = fig->examineRouteBeforeShipping(nextDir); if(nextDir == RoadPathDirection::None) { // No route found! // I.E. insert the worker in this harbor - AddDependentFigure(*fig); - AddFigure(std::move(fig), false); + addDependentFigure(*fig); + addFigure(std::move(fig), false); it = figures_for_ships.erase(it); } else if(nextDir != RoadPathDirection::Ship) { // Figure want to continue walking to its goal but not on ship anymore - this->AddLeavingFigure(std::move(fig)); + this->addLeavingFigure(std::move(fig)); it = figures_for_ships.erase(it); } else // Otherwise figure want to travel by ship, do nothing! diff --git a/libs/s25main/buildings/nobHarborBuilding.h b/libs/s25main/buildings/nobHarborBuilding.h index ffb59fdb15..09b4fcfaec 100644 --- a/libs/s25main/buildings/nobHarborBuilding.h +++ b/libs/s25main/buildings/nobHarborBuilding.h @@ -73,27 +73,27 @@ class nobHarborBuilding : public nobBaseWarehouse private: /// Bestellt die zusätzlichen erforderlichen Waren für eine Expedition - void OrderExpeditionWares(); + void orderExpeditionWares(); /// Prüft, ob eine Expedition von den Waren her vollständig ist und ruft ggf. das Schiff - void CheckExpeditionReady(); + void checkExpeditionReady(); /// Prüft, ob eine Expedition von den Spähern her vollständig ist und ruft ggf. das Schiff - void CheckExplorationExpeditionReady(); + void checkExplorationExpeditionReady(); /// Gibt zurück, ob Expedition vollständig ist bool isExpeditionReady() const; /// Gibt zurück, ob Erkundungs-Expedition vollständig ist bool isExplorationExpeditionReady() const; /// Abgeleitete kann eine gerade erzeugte Ware ggf. sofort verwenden /// (muss in dem Fall true zurückgeben) - bool UseWareAtOnce(std::unique_ptr& ware, noBaseBuilding& goal) override; + bool useWareAtOnce(std::unique_ptr& ware, noBaseBuilding& goal) override; /// Dasselbe für Menschen - bool UseFigureAtOnce(std::unique_ptr& fig, noRoadNode& goal) override; + bool useFigureAtOnce(std::unique_ptr& fig, noRoadNode& goal) override; /// Bestellte Figur, die sich noch inder Warteschlange befindet, kommt nicht mehr und will rausgehauen werden void cancelFigure(noFigure* figure) override; /// Bestellt ein Schiff zum Hafen, sofern dies nötig ist - void OrderShip(); + void orderShip(); /// Stellt Verteidiger zur Verfügung - std::unique_ptr ProvideDefender(nofAttacker& attacker) override; + std::unique_ptr provideDefender(nofAttacker& attacker) override; friend class SerializedGameData; friend class BuildingFactory; @@ -109,42 +109,42 @@ class nobHarborBuilding : public nobBaseWarehouse /// Serialisierung void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NobHarborbuilding; } - void Draw(DrawPoint drawPt) override; - void HandleEvent(unsigned id) override; + void draw(DrawPoint drawPt) override; + void handleEvent(unsigned id) override; /// Eine bestellte Ware konnte doch nicht kommen - void WareLost(Ware& ware) override; + void wareLost(Ware& ware) override; /// Legt eine Ware im Lagerhaus ab - void AddWare(std::unique_ptr ware) override; + void addWare(std::unique_ptr ware) override; /// Eine Figur geht ins Lagerhaus - void AddFigure(std::unique_ptr figure, bool increase_visual_counts) override; + void addFigure(std::unique_ptr figure, bool increase_visual_counts) override; /// Berechnet Wichtigkeit einer neuen Ware für den Hafen (Waren werden für Expeditionen /// benötigt!) - unsigned CalcDistributionPoints(GoodType type) const; + unsigned calcDistributionPoints(GoodType type) const; /// Storniert die Bestellung für eine bestimmte Ware, die mit einem Schiff transportiert werden soll std::unique_ptr cancelWareForShip(Ware* ware); /// Startet eine Expedition - void StartExpedition(); - void StopExpedition(); + void startExpedition(); + void stopExpedition(); /// Startet eine Erkundungs-Expedition - void StartExplorationExpedition(); - void StopExplorationExpedition(); + void startExplorationExpedition(); + void stopExplorationExpedition(); /// Ist Expedition in Vorbereitung? bool isExpeditionActive() const { return expedition.active; } /// Ist Erkundungs-Expedition in Vorbereitung? bool isExplorationExpeditionActive() const { return exploration_expedition.active; } /// Schiff ist angekommen - void ShipArrived(noShip& ship); + void shipArrived(noShip& ship); /// Schiff konnte nicht mehr kommen - void ShipLost(noShip* ship); + void shipLost(noShip* ship); /// Abfangen, wenn ein Mann nicht mehr kommen kann --> könnte ein Bauarbeiter sein und /// wenn wir einen benötigen, müssen wir einen neuen bestellen - void RemoveDependentFigure(noFigure& figure) override; + void removeDependentFigure(noFigure& figure) override; /// Gibt die Hafenplatz-ID zurück, auf der der Hafen steht HarborId getHarborPosID() const; @@ -160,12 +160,12 @@ class nobHarborBuilding : public nobBaseWarehouse std::vector getShipConnections() const; /// Fügt einen Mensch hinzu, der mit dem Schiff irgendwo hin fahren will - void AddFigureForShip(std::unique_ptr fig, MapPoint dest); + void addFigureForShip(std::unique_ptr fig, MapPoint dest); /// Fügt eine Ware hinzu, die mit dem Schiff verschickt werden soll - void AddWareForShip(std::unique_ptr ware); + void addWareForShip(std::unique_ptr ware); /// A ware changed its route and doesn't want to use the ship anymore - void WareDontWantToTravelByShip(Ware* ware); + void wareDontWantToTravelByShip(Ware* ware); /// Gibt Anzahl der Schiffe zurück, die noch für ausstehende Aufgaben benötigt werden unsigned getNumNeededShips() const; @@ -173,9 +173,9 @@ class nobHarborBuilding : public nobBaseWarehouse int getNeedForShip(unsigned ships_coming) const; /// Erhält die Waren von einem Schiff und nimmt diese in den Warenbestand auf - void ReceiveGoodsFromShip(std::list>& figures, std::list>& wares); + void receiveGoodsFromShip(std::list>& figures, std::list>& wares); - nofAggressiveDefender* SendAggressiveDefender(nofAttacker& attacker) override; + nofAggressiveDefender* sendAggressiveDefender(nofAttacker& attacker) override; struct SeaAttackerBuilding { @@ -203,12 +203,12 @@ class nobHarborBuilding : public nobBaseWarehouse std::vector getAttackerBuildingsForSeaIdAttack(); /// Fügt einen Schiffs-Angreifer zum Hafen hinzu - void AddSeaAttacker(std::unique_ptr attacker); + void addSeaAttacker(std::unique_ptr attacker); /// Attacker does not want to attack anymore void cancelSeaAttacker(nofAttacker* attacker); /// People waiting for a ship have to examine their route if a road was destroyed - void ExamineShipRouteOfPeople(); + void examineShipRouteOfPeople(); /// Is the harbor just being destroyed right now? bool isBeingDestroyedNow() const; diff --git a/libs/s25main/buildings/nobMilitary.cpp b/libs/s25main/buildings/nobMilitary.cpp index 296737bfb9..01e7e8cb18 100644 --- a/libs/s25main/buildings/nobMilitary.cpp +++ b/libs/s25main/buildings/nobMilitary.cpp @@ -46,7 +46,7 @@ nobMilitary::nobMilitary(const BuildingType type, const MapPoint pos, const unsi armor_upgrade_event(nullptr), is_regulating_troops(false) { // Gebäude entsprechend als Militärgebäude registrieren und in ein Militärquadrat eintragen - world->getMilitarySquares().Add(this); + world->getMilitarySquares().add(this); // Größe ermitteln switch(type) @@ -63,7 +63,7 @@ nobMilitary::nobMilitary(const BuildingType type, const MapPoint pos, const unsi troop_limits.fill(getMaxTroopsCt()); // Tür aufmachen, bis Gebäude besetzt ist - OpenDoor(); + openDoor(); // Wenn kein Gold in neu gebaute Militärgebäude eingeliefert werden soll, wird die Goldzufuhr gestoppt if(world->getGGS().isEnabled(AddonId::NO_COINS_DEFAULT)) @@ -109,7 +109,7 @@ std::array nobMilitary::getTotalSoldiersByRank() co void nobMilitary::DestroyBuilding() { // Remove from military square and buildings first, to avoid e.g. sending canceled soldiers back to this building - world->getMilitarySquares().Remove(this); + world->getMilitarySquares().remove(this); // Bestellungen stornieren cancelOrders(); @@ -117,32 +117,32 @@ void nobMilitary::DestroyBuilding() // Soldaten rausschicken for(auto& troop : troops) { - troop->LeftBuilding(); - auto& soldier = world->AddFigure(pos, std::move(troop)); - soldier.StartWandering(); - soldier.StartWalking(RANDOM_ENUM(Direction)); + troop->leftBuilding(); + auto& soldier = world->addFigure(pos, std::move(troop)); + soldier.startWandering(); + soldier.startWalking(RANDOM_ENUM(Direction)); } troops.clear(); // Inform far-away capturers for(auto* far_away_capturer : far_away_capturers) - far_away_capturer->AttackedGoalDestroyed(); + far_away_capturer->attackedGoalDestroyed(); far_away_capturers.clear(); // Events ggf. entfernen - getEvMgr().RemoveEvent(gold_order_event); - getEvMgr().RemoveEvent(armor_order_event); - getEvMgr().RemoveEvent(upgrade_event); - getEvMgr().RemoveEvent(armor_upgrade_event); + getEvMgr().removeEvent(gold_order_event); + getEvMgr().removeEvent(armor_order_event); + getEvMgr().removeEvent(upgrade_event); + getEvMgr().removeEvent(armor_upgrade_event); // übriggebliebene Goldmünzen in der Inventur abmelden - world->getPlayer(player).DecreaseInventoryWare(GoodType::Coins, numCoins); - world->getPlayer(player).DecreaseInventoryWare(GoodType::Armor, numArmor); + world->getPlayer(player).decreaseInventoryWare(GoodType::Coins, numCoins); + world->getPlayer(player).decreaseInventoryWare(GoodType::Armor, numArmor); nobBaseMilitary::DestroyBuilding(); // If this was occupied, recalc territory. AFTER calling base destroy as otherwise figures might get stuck here if(!new_built) - world->RecalcTerritory(*this, TerritoryChangeReason::Destroyed); + world->recalcTerritory(*this, TerritoryChangeReason::Destroyed); world->getNotifications().publish(BuildingNote(BuildingNote::Lost, player, pos, bldType_)); } @@ -153,36 +153,36 @@ void nobMilitary::Serialize(SerializedGameData& sgd) const sgd.PushBool(new_built); sgd.PushUnsignedChar(numCoins); sgd.PushBool(coinsDisabled); - sgd.PushEnum(frontier_distance); + sgd.pushEnum(frontier_distance); sgd.PushUnsignedChar(size); sgd.PushBool(capturing); sgd.PushUnsignedInt(capturing_soldiers); - sgd.PushEvent(gold_order_event); - sgd.PushEvent(upgrade_event); + sgd.pushEvent(gold_order_event); + sgd.pushEvent(upgrade_event); - sgd.PushObjectContainer(ordered_troops, true); - sgd.PushObjectContainer(ordered_coins, true); - sgd.PushObjectContainer(troops, true); - sgd.PushObjectContainer(far_away_capturers, true); + sgd.pushObjectContainer(ordered_troops, true); + sgd.pushObjectContainer(ordered_coins, true); + sgd.pushObjectContainer(troops, true); + sgd.pushObjectContainer(far_away_capturers, true); helpers::pushContainer(sgd, troop_limits); sgd.PushUnsignedChar(numArmor); sgd.PushBool(armorAllowed); - sgd.PushEvent(armor_order_event); - sgd.PushEvent(armor_upgrade_event); - sgd.PushObjectContainer(ordered_armor, true); + sgd.pushEvent(armor_order_event); + sgd.pushEvent(armor_upgrade_event); + sgd.pushObjectContainer(ordered_armor, true); } nobMilitary::nobMilitary(SerializedGameData& sgd, const unsigned obj_id) : nobBaseMilitary(sgd, obj_id), new_built(sgd.PopBool()), numCoins(sgd.PopUnsignedChar()), - coinsDisabled(sgd.PopBool()), coinsDisabledVirtual(coinsDisabled), frontier_distance(sgd.Pop()), + coinsDisabled(sgd.PopBool()), coinsDisabledVirtual(coinsDisabled), frontier_distance(sgd.pop()), size(sgd.PopUnsignedChar()), capturing(sgd.PopBool()), capturing_soldiers(sgd.PopUnsignedInt()), - gold_order_event(sgd.PopEvent()), upgrade_event(sgd.PopEvent()), is_regulating_troops(false) + gold_order_event(sgd.popEvent()), upgrade_event(sgd.popEvent()), is_regulating_troops(false) { - sgd.PopObjectContainer(ordered_troops, GO_Type::NofPassivesoldier); - sgd.PopObjectContainer(ordered_coins, GO_Type::Ware); - sgd.PopObjectContainer(troops, GO_Type::NofPassivesoldier); - sgd.PopObjectContainer(far_away_capturers, GO_Type::NofAttacker); + sgd.popObjectContainer(ordered_troops, GO_Type::NofPassivesoldier); + sgd.popObjectContainer(ordered_coins, GO_Type::Ware); + sgd.popObjectContainer(troops, GO_Type::NofPassivesoldier); + sgd.popObjectContainer(far_away_capturers, GO_Type::NofAttacker); if(sgd.getGameDataVersion() < 10) troop_limits.fill(getMaxTroopsCt()); @@ -193,9 +193,9 @@ nobMilitary::nobMilitary(SerializedGameData& sgd, const unsigned obj_id) { numArmor = sgd.PopUnsignedChar(); armorAllowedVirtual = armorAllowed = sgd.PopBool(); - armor_order_event = sgd.PopEvent(); - armor_upgrade_event = sgd.PopEvent(); - sgd.PopObjectContainer(ordered_armor, GO_Type::Ware); + armor_order_event = sgd.popEvent(); + armor_upgrade_event = sgd.popEvent(); + sgd.popObjectContainer(ordered_armor, GO_Type::Ware); } else { numArmor = 0; @@ -205,7 +205,7 @@ nobMilitary::nobMilitary(SerializedGameData& sgd, const unsigned obj_id) } // ins Militärquadrat einfügen - world->getMilitarySquares().Add(this); + world->getMilitarySquares().add(this); if(capturing && capturing_soldiers == 0 && aggressors.empty()) { @@ -216,10 +216,10 @@ nobMilitary::nobMilitary(SerializedGameData& sgd, const unsigned obj_id) } } -void nobMilitary::Draw(DrawPoint drawPt) +void nobMilitary::draw(DrawPoint drawPt) { // Gebäude an sich zeichnen - DrawBaseBuilding(drawPt); + drawBaseBuilding(drawPt); // (max 4) Besatzungs-Fähnchen zeichnen auto flags = std::min(troops.size() + this->leave_house.size(), 4); @@ -250,7 +250,7 @@ void nobMilitary::Draw(DrawPoint drawPt) bitmap = LOADER.getMapTexture(3150 + rttr::enum_cast(frontier_distance_tmp) * 4 + animationFrame); } if(bitmap) - bitmap->DrawFull(drawPt + BORDER_FLAG_OFFSET[nation][size]); + bitmap->drawFull(drawPt + BORDER_FLAG_OFFSET[nation][size]); // If coins or armor delivery disabled, show sign at building if(leatheraddon::isAddonActive(world->getPlayer(player).getGameWorld())) @@ -258,22 +258,22 @@ void nobMilitary::Draw(DrawPoint drawPt) if(coinsDisabledVirtual) { LOADER.getImageN("leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::StopCoinsXSignOverride]) - ->DrawFull(drawPt + BUILDING_SIGN_CONSTS[nation][bldType_]); + ->drawFull(drawPt + BUILDING_SIGN_CONSTS[nation][bldType_]); } if(!armorAllowedVirtual) { LOADER.getImageN("leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::StopArmorXSign]) - ->DrawFull(drawPt + BUILDING_ARMOR_SIGN_CONSTS[nation][bldType_]); + ->drawFull(drawPt + BUILDING_ARMOR_SIGN_CONSTS[nation][bldType_]); } } else // Without leather addon use original graphic { if(coinsDisabledVirtual) - LOADER.getMapTexture(46)->DrawFull(drawPt + BUILDING_SIGN_CONSTS[nation][bldType_]); + LOADER.getMapTexture(46)->drawFull(drawPt + BUILDING_SIGN_CONSTS[nation][bldType_]); } } -void nobMilitary::HandleEvent(const unsigned id) +void nobMilitary::handleEvent(const unsigned id) { switch(id) { @@ -286,19 +286,19 @@ void nobMilitary::HandleEvent(const unsigned id) if(!leave_house.empty()) { // Dann raus mit denen - noFigure& soldier = world->AddFigure(pos, std::move(leave_house.front())); + noFigure& soldier = world->addFigure(pos, std::move(leave_house.front())); leave_house.pop_front(); - FigureLeft(soldier); - soldier.ActAtFirst(); + figureLeft(soldier); + soldier.actAtFirst(); } // Wenn noch weitere drin sind, die müssen auch noch raus if(!leave_house.empty()) - leaving_event = getEvMgr().AddEvent(this, 30 + RANDOM_RAND(10)); + leaving_event = getEvMgr().addEvent(this, 30 + RANDOM_RAND(10)); else go_out = false; - RegulateTroops(); + regulateTroops(); } break; // Goldbestell-Event @@ -307,7 +307,7 @@ void nobMilitary::HandleEvent(const unsigned id) gold_order_event = nullptr; // ggf. nach neuen Goldmünzen suchen - SearchCoins(); + searchCoins(); } break; // Beförderungs-Event @@ -357,21 +357,21 @@ void nobMilitary::HandleEvent(const unsigned id) // Reinsert upgraded soldiers for(auto& upgradedSoldier : soldiersToUpgrade) { - upgradedSoldier->Upgrade(); + upgradedSoldier->upgrade(); troops.insert(std::move(upgradedSoldier)); } // Goldmünze verbrauchen --numCoins; - world->getPlayer(player).DecreaseInventoryWare(GoodType::Coins, 1); + world->getPlayer(player).decreaseInventoryWare(GoodType::Coins, 1); - RegulateTroops(); + regulateTroops(); // Evtl neues Beförderungsevent anmelden - PrepareUpgrading(); + prepareUpgrading(); // Ggf. neue Goldmünzen bestellen - SearchCoins(); + searchCoins(); } } break; @@ -379,7 +379,7 @@ void nobMilitary::HandleEvent(const unsigned id) case 3: { armor_order_event = nullptr; - SearchArmor(); + searchArmor(); } break; // Armor upgrade event @@ -396,11 +396,11 @@ void nobMilitary::HandleEvent(const unsigned id) soldier->setArmor(true); --numArmor; - world->getPlayer(player).DecreaseInventoryWare(GoodType::Armor, 1); - world->getPlayer(player).IncreaseInventoryJob(jobEnumToAmoredSoldierEnum(soldier->getJobType()), 1); + world->getPlayer(player).decreaseInventoryWare(GoodType::Armor, 1); + world->getPlayer(player).increaseInventoryJob(jobEnumToAmoredSoldierEnum(soldier->getJobType()), 1); - PrepareArmorUpgrading(); - SearchArmor(); + prepareArmorUpgrading(); + searchArmor(); } } break; @@ -427,10 +427,10 @@ unsigned nobMilitary::getMaxTroopsCt() const return NUM_TROOPS[nation][size]; } -void nobMilitary::LookForEnemyBuildings(const nobBaseMilitary* const exception) +void nobMilitary::lookForEnemyBuildings(const nobBaseMilitary* const exception) { // Umgebung nach Militärgebäuden absuchen - sortedMilitaryBlds buildings = world->LookForMilitaryBuildings(pos, 3); + sortedMilitaryBlds buildings = world->lookForMilitaryBuildings(pos, 3); frontier_distance = FrontierDistance::Far; const bool frontierDistanceCheck = world->getGGS().isEnabled(AddonId::FRONTIER_DISTANCE_REACHABLE); @@ -441,7 +441,7 @@ void nobMilitary::LookForEnemyBuildings(const nobBaseMilitary* const exception) if(building != exception && building->getPlayer() != player && world->getPlayer(building->getPlayer()).isAttackable(player)) { - unsigned distance = world->CalcDistance(pos, building->getPos()); + unsigned distance = world->calcDistance(pos, building->getPos()); FrontierDistance newFrontierDistance = FrontierDistance::Far; if(distance <= getMilitaryRadius() + building->getMilitaryRadius()) @@ -463,7 +463,7 @@ void nobMilitary::LookForEnemyBuildings(const nobBaseMilitary* const exception) // if new frontier distance is in military range, check if its reachable. if(frontierDistanceCheck && newFrontierDistance >= FrontierDistance::Mid - && !DoesReachablePathExist(*world, building->getPos(), pos, MAX_ATTACKING_RUN_DISTANCE)) + && !doesReachablePathExist(*world, building->getPos(), pos, MAX_ATTACKING_RUN_DISTANCE)) { // building is not reachable, so its "far" away. newFrontierDistance = FrontierDistance::Far; @@ -475,19 +475,19 @@ void nobMilitary::LookForEnemyBuildings(const nobBaseMilitary* const exception) // set calculated frontier distance to checked building. if(BuildingProperties::isMilitary(building->getBuildingType())) - static_cast(building)->NewEnemyMilitaryBuilding(newFrontierDistance); + static_cast(building)->newEnemyMilitaryBuilding(newFrontierDistance); } } // check for harbor points if(frontier_distance <= FrontierDistance::Mid && world->getGGS().isEnabled(AddonId::SEA_ATTACK) - && world->CalcDistanceToNearestHarbor(pos) < SEAATTACK_DISTANCE + 2) + && world->calcDistanceToNearestHarbor(pos) < SEAATTACK_DISTANCE + 2) frontier_distance = FrontierDistance::Harbor; // send troops - RegulateTroops(); + regulateTroops(); } -void nobMilitary::NewEnemyMilitaryBuilding(const FrontierDistance distance) +void nobMilitary::newEnemyMilitaryBuilding(const FrontierDistance distance) { // Neues Grenzgebäude in der Nähe --> Distanz entsprechend setzen if(distance == FrontierDistance::Near) @@ -502,10 +502,10 @@ void nobMilitary::NewEnemyMilitaryBuilding(const FrontierDistance distance) if(frontier_distance == FrontierDistance::Far) frontier_distance = FrontierDistance::Mid; } - RegulateTroops(); + regulateTroops(); } -void nobMilitary::RegulateTroops() +void nobMilitary::regulateTroops() { RTTR_Assert(helpers::contains(world->getPlayer(player).getBuildingRegister().getMilitaryBuildings(), this)); // If this fails, the building is Being destroyed! @@ -529,7 +529,7 @@ void nobMilitary::RegulateTroops() if(hasReturnWarehouse < 0) { hasReturnWarehouse = - owner.FindWarehouse(*this, FW::AcceptsFigure(soldier.getJobType()), true, false) ? 1 : 0; + owner.findWarehouse(*this, FW::AcceptsFigure(soldier.getJobType()), true, false) ? 1 : 0; } return hasReturnWarehouse != 0; }; @@ -558,7 +558,7 @@ void nobMilitary::RegulateTroops() } } for(auto* notNeededSoldier : notNeededSoldiers) - notNeededSoldier->NotNeeded(); + notNeededSoldier->notNeeded(); } else { // This bit is for ordering troops later @@ -570,8 +570,8 @@ void nobMilitary::RegulateTroops() { if((*it)->getRank() == rank && canReturnHome(**it)) { - (*it)->LeaveBuilding(); - AddLeavingFigure(std::move(*it)); + (*it)->leaveBuilding(); + addLeavingFigure(std::move(*it)); it = troops.erase(it); --excess; } else @@ -583,7 +583,7 @@ void nobMilitary::RegulateTroops() } // Zu viele oder zu wenig Truppen? - int diff = static_cast(CalcRequiredNumTroops()) - static_cast(getTotalSoldiers()); + int diff = static_cast(calcRequiredNumTroops()) - static_cast(getTotalSoldiers()); if(diff < 0) { // Zu viel --> überflüssige Truppen nach Hause schicken @@ -625,7 +625,7 @@ void nobMilitary::RegulateTroops() // send the not-needed-soldiers away for(auto* notNeededSoldier : notNeededSoldiers) { - notNeededSoldier->NotNeeded(); + notNeededSoldier->notNeeded(); } // Dann den Rest (einer muss immer noch drinbleiben!) @@ -636,8 +636,8 @@ void nobMilitary::RegulateTroops() { if(canReturnHome(**it)) { - (*it)->LeaveBuilding(); - AddLeavingFigure(std::move(*it)); + (*it)->leaveBuilding(); + addLeavingFigure(std::move(*it)); it = troops.erase(it); ++diff; } else @@ -653,8 +653,8 @@ void nobMilitary::RegulateTroops() { if(canReturnHome(**it)) { - (*it)->LeaveBuilding(); - AddLeavingFigure(std::move(*it)); + (*it)->leaveBuilding(); + addLeavingFigure(std::move(*it)); it = helpers::erase_reverse(troops, it); ++diff; } else @@ -688,19 +688,19 @@ void nobMilitary::RegulateTroops() } } if(mightHaveRoad) - world->getPlayer(player).OrderTroops(*this, lack, diff); + world->getPlayer(player).orderTroops(*this, lack, diff); } is_regulating_troops = false; } -unsigned nobMilitary::CalcRequiredNumTroops() const +unsigned nobMilitary::calcRequiredNumTroops() const { - return CalcRequiredNumTroops(frontier_distance, + return calcRequiredNumTroops(frontier_distance, world->getPlayer(player).getMilitarySetting(4 + rttr::enum_cast(frontier_distance))); } -unsigned nobMilitary::CalcRequiredNumTroops(FrontierDistance assumedFrontierDistance, unsigned settingValue) const +unsigned nobMilitary::calcRequiredNumTroops(FrontierDistance assumedFrontierDistance, unsigned settingValue) const { return (getMaxTroopsCt() - 1) * settingValue / MILITARY_SETTINGS_SCALE[4 + rttr::enum_cast(assumedFrontierDistance)] + 1; @@ -710,14 +710,14 @@ void nobMilitary::SetTroopLimit(const unsigned rank, const unsigned limit) { RTTR_Assert(rank < troop_limits.size()); troop_limits[rank] = limit; - RegulateTroops(); + regulateTroops(); } bool nobMilitary::isUseless() const { if(frontier_distance != FrontierDistance::Far || new_built) return false; - return !world->DoesDestructionChangeTerritory(*this); + return !world->doesDestructionChangeTerritory(*this); } bool nobMilitary::isAttackable(unsigned playerIdx) const @@ -731,7 +731,7 @@ bool nobMilitary::isInTroops(const nofPassiveSoldier& soldier) const return helpers::containsPtr(troops, &soldier); } -void nobMilitary::TakeWare(Ware* ware) +void nobMilitary::takeWare(Ware* ware) { // Goldmünze in Bestellliste aufnehmen if(ware->type == GoodType::Coins) @@ -746,7 +746,7 @@ void nobMilitary::TakeWare(Ware* ware) } } -void nobMilitary::AddWare(std::unique_ptr ware) +void nobMilitary::addWare(std::unique_ptr ware) { if(ware->type == GoodType::Coins) { @@ -757,25 +757,25 @@ void nobMilitary::AddWare(std::unique_ptr ware) ordered_coins.remove(ware.get()); // Ware vernichten - world->getPlayer(player).RemoveWare(*ware); + world->getPlayer(player).removeWare(*ware); ware.reset(); // Evtl. Soldaten befördern - PrepareUpgrading(); + prepareUpgrading(); } else { ++numArmor; RTTR_Assert(helpers::contains(ordered_armor, ware.get())); ordered_armor.remove(ware.get()); - world->getPlayer(player).RemoveWare(*ware); + world->getPlayer(player).removeWare(*ware); ware.reset(); - PrepareArmorUpgrading(); + prepareArmorUpgrading(); } } -void nobMilitary::WareLost(Ware& ware) +void nobMilitary::wareLost(Ware& ware) { if(ware.type == GoodType::Coins) { @@ -789,11 +789,11 @@ void nobMilitary::WareLost(Ware& ware) } } -bool nobMilitary::FreePlaceAtFlag() +bool nobMilitary::freePlaceAtFlag() { return false; } -void nobMilitary::GotWorker(Job /*job*/, noFigure& worker) +void nobMilitary::gotWorker(Job /*job*/, noFigure& worker) { RTTR_Assert(dynamic_cast(&worker)); auto& soldier = static_cast(worker); @@ -805,35 +805,35 @@ void nobMilitary::cancelOrders() { // Soldaten zurückschicken for(auto* ordered_troop : ordered_troops) - ordered_troop->NotNeeded(); + ordered_troop->notNeeded(); ordered_troops.clear(); // Goldmünzen zurückschicken for(auto* ordered_coin : ordered_coins) - WareNotNeeded(ordered_coin); + wareNotNeeded(ordered_coin); ordered_coins.clear(); for(auto* ordered_armor : ordered_armor) - WareNotNeeded(ordered_armor); + wareNotNeeded(ordered_armor); ordered_armor.clear(); } -void nobMilitary::AddActiveSoldier(std::unique_ptr soldier) +void nobMilitary::addActiveSoldier(std::unique_ptr soldier) { // aktiver Soldat, eingetroffen werden --> dieser muss erst in einen passiven Soldaten // umoperiert werden (neu erzeugt und alter zerstört) werden - AddPassiveSoldier(std::make_unique(*soldier)); + addPassiveSoldier(std::make_unique(*soldier)); - soldier->ResetHome(); + soldier->resetHome(); RTTR_Assert(soldier->getPlayer() == player); // Returned home if(soldier.get() == defender_) - ResetDefender(); + resetDefender(); else if(helpers::contains(troops_on_mission, soldier.get())) { troops_on_mission.remove(soldier.get()); @@ -842,16 +842,16 @@ void nobMilitary::AddActiveSoldier(std::unique_ptr soldier) RTTR_Assert(dynamic_cast(soldier.get())); if(isBeingCaptured() || isFarAwayCapturer(static_cast(*soldier))) { - getEvMgr().AddToKillList(std::move(soldier)); + getEvMgr().addToKillList(std::move(soldier)); return; } } - getEvMgr().AddToKillList(std::move(soldier)); + getEvMgr().addToKillList(std::move(soldier)); // Do only if not capturing - RegulateTroops(); + regulateTroops(); } -void nobMilitary::AddPassiveSoldier(std::unique_ptr soldier) +void nobMilitary::addPassiveSoldier(std::unique_ptr soldier) { RTTR_Assert(soldier->getPlayer() == player); RTTR_Assert(troops.size() < getMaxTroopsCt()); @@ -862,29 +862,29 @@ void nobMilitary::AddPassiveSoldier(std::unique_ptr soldier) // Wurde dieses Gebäude zum ersten Mal besetzt? if(new_built) { - SendPostMessage( + sendPostMessage( player, std::make_unique(getEvMgr().getCurrentGF(), _("Military building occupied"), PostCategory::Military, *this, SoundEffect::Fanfare)); // Ist nun besetzt new_built = false; // Landgrenzen verschieben - world->RecalcTerritory(*this, TerritoryChangeReason::Build); + world->recalcTerritory(*this, TerritoryChangeReason::Build); // Tür zumachen - CloseDoor(); + closeDoor(); world->getNotifications().publish(BuildingNote(BuildingNote::Captured, player, pos, bldType_)); } else { // Evtl. Soldaten befördern - PrepareUpgrading(); - PrepareArmorUpgrading(); + prepareUpgrading(); + prepareArmorUpgrading(); } // Goldmünzen suchen, evtl sinds ja neue Soldaten - SearchCoins(); - SearchArmor(); + searchCoins(); + searchArmor(); } -void nobMilitary::SoldierLost(nofSoldier* soldier) +void nobMilitary::soldierLost(nofSoldier* soldier) { // Soldat konnte nicht (mehr) kommen --> rauswerfen und ggf. neue Soldaten rufen if(soldier->getGOT() == GO_Type::NofPassivesoldier) @@ -898,21 +898,21 @@ void nobMilitary::SoldierLost(nofSoldier* soldier) RTTR_Assert(helpers::contains(troops_on_mission, actSoldier)); troops_on_mission.remove(actSoldier); } - RegulateTroops(); + regulateTroops(); } -void nobMilitary::SendAttacker(nofPassiveSoldier*& passive_soldier, nobBaseMilitary& goal, +void nobMilitary::sendAttacker(nofPassiveSoldier*& passive_soldier, nobBaseMilitary& goal, const nobHarborBuilding* harbor) { auto attacker = std::make_unique(*passive_soldier, goal, harbor); - passive_soldier->LeftBuilding(); - helpers::extractPtr(troops, passive_soldier)->Destroy(); + passive_soldier->leftBuilding(); + helpers::extractPtr(troops, passive_soldier)->destroy(); passive_soldier = nullptr; troops_on_mission.push_back(attacker.get()); - AddLeavingFigure(std::move(attacker)); + addLeavingFigure(std::move(attacker)); } -nofPassiveSoldier* nobMilitary::ChooseSoldier() +nofPassiveSoldier* nobMilitary::chooseSoldier() { if(troops.empty()) return nullptr; @@ -952,21 +952,21 @@ nofPassiveSoldier* nobMilitary::ChooseSoldier() return nullptr; } -nofAggressiveDefender* nobMilitary::SendAggressiveDefender(nofAttacker& attacker) +nofAggressiveDefender* nobMilitary::sendAggressiveDefender(nofAttacker& attacker) { // Don't send last soldier if(getNumTroops() <= 1) return nullptr; - nofPassiveSoldier* soldier = ChooseSoldier(); + nofPassiveSoldier* soldier = chooseSoldier(); if(soldier) { // neuen aggressiven Verteidiger daraus erzeugen auto defender = std::make_unique(*soldier, attacker); - soldier->LeftBuilding(); - helpers::extractPtr(troops, soldier)->Destroy(); + soldier->leftBuilding(); + helpers::extractPtr(troops, soldier)->destroy(); troops_on_mission.push_back(defender.get()); nofAggressiveDefender* result = defender.get(); - AddLeavingFigure(std::move(defender)); + addLeavingFigure(std::move(defender)); return result; } else return nullptr; @@ -983,7 +983,7 @@ unsigned nobMilitary::getNumSoldiersForAttack(const MapPoint dest) const ((getNumTroops() - 1) * world->getPlayer(getPlayer()).getMilitarySetting(3) / MILITARY_SETTINGS_SCALE[3]) : 0; - unsigned distance = world->CalcDistance(pos, dest); + unsigned distance = world->calcDistance(pos, dest); // Falls Entfernung größer als Basisreichweite, Soldaten subtrahieren if(distance > BASE_ATTACKING_DISTANCE) @@ -998,7 +998,7 @@ unsigned nobMilitary::getNumSoldiersForAttack(const MapPoint dest) const } // und auch der Weg zu Fuß darf dann nicht so weit sein, wenn das alles bestanden ist, können wir ihn nehmen.. - if(soldiers_count && world->FindHumanPath(pos, dest, MAX_ATTACKING_RUN_DISTANCE)) + if(soldiers_count && world->findHumanPath(pos, dest, MAX_ATTACKING_RUN_DISTANCE)) // Soldaten davon nehmen return soldiers_count; else @@ -1057,47 +1057,47 @@ bool nobMilitary::hasMaxRankSoldier() const [maxRank](const auto& it) { return it->getRank() >= maxRank; }); } -std::unique_ptr nobMilitary::ProvideDefender(nofAttacker& attacker) +std::unique_ptr nobMilitary::provideDefender(nofAttacker& attacker) { - nofPassiveSoldier* soldier = ChooseSoldier(); + nofPassiveSoldier* soldier = chooseSoldier(); if(!soldier) return nullptr; auto defender = std::make_unique(*soldier, attacker); auto oldSoldier = helpers::extractPtr(troops, soldier); - oldSoldier->LeftBuilding(); - oldSoldier->Destroy(); + oldSoldier->leftBuilding(); + oldSoldier->destroy(); return defender; } -void nobMilitary::Capture(const unsigned char new_owner) +void nobMilitary::capture(const unsigned char new_owner) { RTTR_Assert(isBeingCaptured()); // Goldmünzen in der Inventur vom alten Spieler abziehen und dem neuen hinzufügen - world->getPlayer(player).DecreaseInventoryWare(GoodType::Coins, numCoins); - world->getPlayer(new_owner).IncreaseInventoryWare(GoodType::Coins, numCoins); + world->getPlayer(player).decreaseInventoryWare(GoodType::Coins, numCoins); + world->getPlayer(new_owner).increaseInventoryWare(GoodType::Coins, numCoins); - world->getPlayer(player).DecreaseInventoryWare(GoodType::Armor, numArmor); - world->getPlayer(new_owner).IncreaseInventoryWare(GoodType::Armor, numArmor); + world->getPlayer(player).decreaseInventoryWare(GoodType::Armor, numArmor); + world->getPlayer(new_owner).increaseInventoryWare(GoodType::Armor, numArmor); // Reset desired troop setting troop_limits.fill(getMaxTroopsCt()); // Soldaten, die auf Mission sind, Bescheid sagen for(auto* it : troops_on_mission) - it->HomeDestroyed(); + it->homeDestroyed(); // Bestellungen die hierher unterwegs sind canceln cancelOrders(); // Tell agressive defending soldiers and far away capturers that their goal is gone for(auto* soldier : aggressive_defenders) - soldier->AttackedGoalDestroyed(); + soldier->attackedGoalDestroyed(); for(auto* soldier : far_away_capturers) - soldier->AttackedGoalDestroyed(); + soldier->attackedGoalDestroyed(); troops_on_mission.clear(); aggressive_defenders.clear(); @@ -1105,32 +1105,32 @@ void nobMilitary::Capture(const unsigned char new_owner) // Alten Besitzer merken unsigned char old_player = player; - world->getPlayer(old_player).RemoveBuilding(this, bldType_); + world->getPlayer(old_player).removeBuilding(this, bldType_); // neuer Spieler player = new_owner; // In der Wirtschaftsverwaltung dieses Gebäude jetzt zum neuen Spieler zählen und beim alten raushauen - world->getPlayer(new_owner).AddBuilding(this, bldType_); + world->getPlayer(new_owner).addBuilding(this, bldType_); // Flagge davor auch übernehmen - getFlag()->Capture(new_owner); + getFlag()->capture(new_owner); // Territorium neu berechnen - world->RecalcTerritory(*this, TerritoryChangeReason::Captured); + world->recalcTerritory(*this, TerritoryChangeReason::Captured); // Sichtbarkeiten berechnen für alten Spieler - world->RecalcVisibilitiesAroundPoint(pos, getMilitaryRadius() + VISUALRANGE_MILITARY + 1, old_player, nullptr); + world->recalcVisibilitiesAroundPoint(pos, getMilitaryRadius() + VISUALRANGE_MILITARY + 1, old_player, nullptr); // Grenzflagge entsprechend neu setzen von den Feinden - LookForEnemyBuildings(); + lookForEnemyBuildings(); // und von den Verbündeten (da ja ein Feindgebäude weg ist)! - sortedMilitaryBlds buildings = world->LookForMilitaryBuildings(pos, 4); + sortedMilitaryBlds buildings = world->lookForMilitaryBuildings(pos, 4); for(auto* building : buildings) { // verbündetes Gebäude? if(world->getPlayer(building->getPlayer()).isAttackable(old_player) && BuildingProperties::isMilitary(building->getBuildingType())) // Grenzflaggen von dem neu berechnen - static_cast(building)->LookForEnemyBuildings(); + static_cast(building)->lookForEnemyBuildings(); } // ehemalige Leute dieses Gebäudes nach Hause schicken, die ggf. grad auf dem Weg rein/raus waren @@ -1144,8 +1144,8 @@ void nobMilitary::Capture(const unsigned char new_owner) auto& figure = static_cast(baseFigure); if(figure.getCurrentRoad() == getRoute(Direction::SouthEast) && figure.getPlayer() != new_owner) { - figure.Abrogate(); - figure.StartWandering(); + figure.abrogate(); + figure.startWandering(); } } } @@ -1160,16 +1160,16 @@ void nobMilitary::Capture(const unsigned char new_owner) if(attPlayer != player && !world->getPlayer(attPlayer).isAttackable(player)) { it = aggressors.erase(it); - attacker->CapturedBuildingFull(); + attacker->capturedBuildingFull(); } else ++it; } // Post verschicken, an den alten Besitzer und an den neuen Besitzer - SendPostMessage(old_player, + sendPostMessage(old_player, std::make_unique(getEvMgr().getCurrentGF(), _("Military building lost"), PostCategory::Military, *this)); - SendPostMessage(player, + sendPostMessage(player, std::make_unique(getEvMgr().getCurrentGF(), _("Military building captured"), PostCategory::Military, *this)); @@ -1203,7 +1203,7 @@ void nobMilitary::Capture(const unsigned char new_owner) } } -void nobMilitary::NeedOccupyingTroops() +void nobMilitary::needOccupyingTroops() { RTTR_Assert(isBeingCaptured()); // Only valid during capturing // Check if we need more soldiers from the attacking soldiers @@ -1212,7 +1212,7 @@ void nobMilitary::NeedOccupyingTroops() nofAttacker* best_attacker = nullptr; unsigned best_radius = std::numeric_limits::max(); - unsigned needed_soldiers = CalcRequiredNumTroops(); + unsigned needed_soldiers = calcRequiredNumTroops(); unsigned currentSoldiers = troops.size() + capturing_soldiers + troops_on_mission.size(); if(needed_soldiers > currentSoldiers) @@ -1228,7 +1228,7 @@ void nobMilitary::NeedOccupyingTroops() continue; // Und kommt er überhaupt zur Flagge (könnte ja in der 2. Reihe stehen, sodass die vor ihm ihn den Weg // versperren)? - if(world->FindHumanPath(aggressor->getPos(), world->getNeighbour(pos, Direction::SouthEast), 10, false)) + if(world->findHumanPath(aggressor->getPos(), world->getNeighbour(pos, Direction::SouthEast), 10, false)) { // Dann is das der bisher beste best_attacker = aggressor; @@ -1240,7 +1240,7 @@ void nobMilitary::NeedOccupyingTroops() if(best_attacker) { // Dann soll der hingehen - best_attacker->CaptureBuilding(); + best_attacker->captureBuilding(); ++capturing_soldiers; // und raus hier return; @@ -1278,7 +1278,7 @@ void nobMilitary::NeedOccupyingTroops() && !world->getPlayer(attacker->getPlayer()).isAttackable(player)) { it = aggressors.erase(it); - attacker->CapturedBuildingFull(); + attacker->capturedBuildingFull(); } else ++it; } @@ -1296,7 +1296,7 @@ void nobMilitary::SetCoinsAllowed(const bool enabled) coinsDisabledVirtual = coinsDisabled; if(!coinsDisabled) - SearchCoins(); // Order coins if we just enabled it + searchCoins(); // Order coins if we just enabled it else { // send coins back if just deactivated @@ -1305,7 +1305,7 @@ void nobMilitary::SetCoinsAllowed(const bool enabled) // But only those, that are not just Being carried in if((*it)->getLocation() != this) { - WareNotNeeded(*it); + wareNotNeeded(*it); it = ordered_coins.erase(it); } else ++it; @@ -1323,7 +1323,7 @@ void nobMilitary::SetArmorAllowed(const bool enabled) armorAllowedVirtual = armorAllowed; if(armorAllowed) - SearchArmor(); + searchArmor(); else { // send armor back if just deactivated @@ -1332,7 +1332,7 @@ void nobMilitary::SetArmorAllowed(const bool enabled) // But only those, that are not just Being carried in if((*it)->getLocation() != this) { - WareNotNeeded(*it); + wareNotNeeded(*it); it = ordered_armor.erase(it); } else ++it; @@ -1340,10 +1340,10 @@ void nobMilitary::SetArmorAllowed(const bool enabled) } } -unsigned nobMilitary::CalcCoinsPoints() const +unsigned nobMilitary::calcCoinsPoints() const { // Will ich überhaupt Goldmünzen, wenn nich, sofort raus - if(!WantCoins()) + if(!wantCoins()) return 0; // 10000 als Basis wählen, damit man auch noch was abziehen kann @@ -1368,9 +1368,9 @@ unsigned nobMilitary::CalcCoinsPoints() const return static_cast(points); } -unsigned nobMilitary::CalcArmorPoints() const +unsigned nobMilitary::calcArmorPoints() const { - if(!WantArmor()) + if(!wantArmor()) return 0; // choose 10000 as basic, so we can stil subtract something @@ -1390,24 +1390,24 @@ unsigned nobMilitary::CalcArmorPoints() const return static_cast(points); } -bool nobMilitary::WantCoins() const +bool nobMilitary::wantCoins() const { // Wenn die Goldzufuhr gestoppt wurde oder Münzvorrat voll ist, will ich gar keine Goldmünzen return (!coinsDisabled && numCoins + ordered_coins.size() != getMaxCoinCt() && !new_built); } -void nobMilitary::SearchCoins() +void nobMilitary::searchCoins() { // Brauche ich überhaupt Goldmünzen bzw. hab ich vielleicht schon ein Event angemeldet? - if(WantCoins() && !gold_order_event) + if(wantCoins() && !gold_order_event) { // Lagerhaus mit Goldmünzen suchen nobBaseWarehouse* wh = - world->getPlayer(player).FindWarehouse(*this, FW::HasMinWares(GoodType::Coins), false, false); + world->getPlayer(player).findWarehouse(*this, FW::HasMinWares(GoodType::Coins), false, false); if(wh) { // Wenns eins gibt, dort eine Goldmünze bestellen - Ware* ware = wh->OrderWare(GoodType::Coins, *this); + Ware* ware = wh->orderWare(GoodType::Coins, *this); if(!ware) { @@ -1420,29 +1420,29 @@ void nobMilitary::SearchCoins() RTTR_Assert(helpers::contains(ordered_coins, ware)); // Nach einer Weile nochmal nach evtl neuen Goldmünzen gucken - gold_order_event = getEvMgr().AddEvent(this, 200 + RANDOM_RAND(400), 1); + gold_order_event = getEvMgr().addEvent(this, 200 + RANDOM_RAND(400), 1); } } } -bool nobMilitary::WantArmor() const +bool nobMilitary::wantArmor() const { // If armor delivery stopped or stock already full, we do not want any armor return (armorAllowed && numArmor + ordered_armor.size() < getMaxArmorCt() && !new_built); } -void nobMilitary::SearchArmor() +void nobMilitary::searchArmor() { if(!leatheraddon::isAddonActive(world->getPlayer(player).getGameWorld())) return; - if(WantArmor() && !armor_order_event) + if(wantArmor() && !armor_order_event) { nobBaseWarehouse* wh = - world->getPlayer(player).FindWarehouse(*this, FW::HasMinWares(GoodType::Armor), false, false); + world->getPlayer(player).findWarehouse(*this, FW::HasMinWares(GoodType::Armor), false, false); if(wh) { - Ware* ware = wh->OrderWare(GoodType::Armor, *this); + Ware* ware = wh->orderWare(GoodType::Armor, *this); if(!ware) { @@ -1454,12 +1454,12 @@ void nobMilitary::SearchArmor() RTTR_Assert(helpers::contains(ordered_armor, ware)); // After some time, try to order new armor - armor_order_event = getEvMgr().AddEvent(this, 200 + RANDOM_RAND(400), 3); + armor_order_event = getEvMgr().addEvent(this, 200 + RANDOM_RAND(400), 3); } } } -void nobMilitary::PrepareUpgrading() +void nobMilitary::prepareUpgrading() { // Goldmünzen da? if(!numCoins) @@ -1487,10 +1487,10 @@ void nobMilitary::PrepareUpgrading() return; // Alles da --> Beförderungsevent anmelden - upgrade_event = getEvMgr().AddEvent(this, UPGRADE_TIME + RANDOM_RAND(UPGRADE_TIME_RANDOM), 2); + upgrade_event = getEvMgr().addEvent(this, UPGRADE_TIME + RANDOM_RAND(UPGRADE_TIME_RANDOM), 2); } -void nobMilitary::PrepareArmorUpgrading() +void nobMilitary::prepareArmorUpgrading() { if(!numArmor) return; @@ -1503,10 +1503,10 @@ void nobMilitary::PrepareArmorUpgrading() return; // All here --> Trigger armor upgrade event - armor_upgrade_event = getEvMgr().AddEvent(this, UPGRADE_TIME + RANDOM_RAND(UPGRADE_TIME_RANDOM), 4); + armor_upgrade_event = getEvMgr().addEvent(this, UPGRADE_TIME + RANDOM_RAND(UPGRADE_TIME_RANDOM), 4); } -void nobMilitary::HitOfCatapultStone() +void nobMilitary::hitOfCatapultStone() { // Ein Soldat weniger, falls es noch welche gibt if(!troops.empty()) @@ -1519,23 +1519,23 @@ void nobMilitary::HitOfCatapultStone() if(!survived) { // Shortcut for Die(): No need to remove from world as it is inside and we can delete it right away - soldier->RemoveFromInventory(); - soldier->LeftBuilding(); - soldier->Destroy(); + soldier->removeFromInventory(); + soldier->leftBuilding(); + soldier->destroy(); } else { soldier->setArmor(false); - world->getPlayer(player).DecreaseInventoryJob(jobEnumToAmoredSoldierEnum(soldier->getJobType()), 1); + world->getPlayer(player).decreaseInventoryJob(jobEnumToAmoredSoldierEnum(soldier->getJobType()), 1); troops.insert(std::move(soldier)); } } // If there are troops left, order some more, else this will be destroyed if(!troops.empty()) - RegulateTroops(); + regulateTroops(); // Post verschicken - SendPostMessage(player, + sendPostMessage(player, std::make_unique(getEvMgr().getCurrentGF(), _("A catapult is firing upon us!"), PostCategory::Military, *this)); } @@ -1568,17 +1568,17 @@ bool nobMilitary::isDemolitionAllowed() const return true; } -void nobMilitary::UnlinkAggressor(nofAttacker& soldier) +void nobMilitary::unlinkAggressor(nofAttacker& soldier) { RTTR_Assert(isAggressor(soldier) || isFarAwayCapturer(soldier)); aggressors.remove(&soldier); far_away_capturers.remove(&soldier); if(aggressors.empty()) - RegulateTroops(); + regulateTroops(); } -void nobMilitary::CapturingSoldierArrived() +void nobMilitary::capturingSoldierArrived() { RTTR_Assert(isBeingCaptured()); RTTR_Assert(capturing_soldiers > 0); @@ -1586,17 +1586,17 @@ void nobMilitary::CapturingSoldierArrived() if(capturing_soldiers == 0) { // Search again - NeedOccupyingTroops(); + needOccupyingTroops(); if(capturing_soldiers > 0) return; // Found more // Einnahme beendet capturing = false; // Nun die Besetzung prüfen - RegulateTroops(); + regulateTroops(); } } -void nobMilitary::FarAwayCapturerReachedGoal(nofAttacker& attacker, bool walkingIntoBld) +void nobMilitary::farAwayCapturerReachedGoal(nofAttacker& attacker, bool walkingIntoBld) { RTTR_Assert(isFarAwayCapturer(attacker)); if(isBeingCaptured()) @@ -1610,7 +1610,7 @@ void nobMilitary::FarAwayCapturerReachedGoal(nofAttacker& attacker, bool walking // Otherwise we are in a kind of "normal" working state of the building and will just add him when he gets in // Call the next one unless we are not actually walking into the building, i.e. we ware only waiting until we // can do so Avoids e.g. https://github.com/Return-To-The-Roots/s25client/issues/1405 - CallNextFarAwayCapturer(attacker); + callNextFarAwayCapturer(attacker); } } @@ -1619,7 +1619,7 @@ bool nobMilitary::isFarAwayCapturer(const nofAttacker& attacker) return helpers::contains(far_away_capturers, &attacker); } -void nobMilitary::CallNextFarAwayCapturer(nofAttacker& attacker) +void nobMilitary::callNextFarAwayCapturer(nofAttacker& attacker) { const MapPoint flagPos = getFlagPos(); unsigned minLength = std::numeric_limits::max(); @@ -1633,7 +1633,7 @@ void nobMilitary::CallNextFarAwayCapturer(nofAttacker& attacker) continue; RTTR_Assert(far_away_capturer->getPos() != flagPos); // Impossible. This should be the current attacker unsigned length; - if(!world->FindHumanPath(far_away_capturer->getPos(), flagPos, MAX_FAR_AWAY_CAPTURING_DISTANCE, false, &length)) + if(!world->findHumanPath(far_away_capturer->getPos(), flagPos, MAX_FAR_AWAY_CAPTURING_DISTANCE, false, &length)) continue; if(length < minLength) { @@ -1642,5 +1642,5 @@ void nobMilitary::CallNextFarAwayCapturer(nofAttacker& attacker) } } if(bestAttacker) - bestAttacker->AttackFlag(); + bestAttacker->attackFlag(); } diff --git a/libs/s25main/buildings/nobMilitary.h b/libs/s25main/buildings/nobMilitary.h index aca9acd190..251f65dd57 100644 --- a/libs/s25main/buildings/nobMilitary.h +++ b/libs/s25main/buildings/nobMilitary.h @@ -81,22 +81,22 @@ class nobMilitary : public nobBaseMilitary /// Bestellungen (sowohl Truppen als auch Goldmünzen) zurücknehmen void cancelOrders(); /// Wählt je nach Militäreinstellungen (Verteidigerstärke) einen passenden Soldaten aus - nofPassiveSoldier* ChooseSoldier(); + nofPassiveSoldier* chooseSoldier(); /// Stellt Verteidiger zur Verfügung - std::unique_ptr ProvideDefender(nofAttacker& attacker) override; - void FigureLeft(const noFigure& /*fig*/) override {} + std::unique_ptr provideDefender(nofAttacker& attacker) override; + void figureLeft(const noFigure& /*fig*/) override {} /// Will/kann das Gebäude noch Münzen bekommen? - bool WantCoins() const; - bool WantArmor() const; + bool wantCoins() const; + bool wantArmor() const; /// Prüft, ob Goldmünzen und Soldaten, die befördert werden können, vorhanden sind und meldet ggf. ein /// Beförderungsevent an - void PrepareUpgrading(); - void PrepareArmorUpgrading(); + void prepareUpgrading(); + void prepareArmorUpgrading(); /// Gets the total amount of soldiers (ordered, stationed, on mission) size_t getTotalSoldiers() const; std::array getTotalSoldiersByRank() const; /// Looks for the next far-away-capturer waiting around and calls it to the flag - void CallNextFarAwayCapturer(nofAttacker& attacker); + void callNextFarAwayCapturer(nofAttacker& attacker); friend class SerializedGameData; friend class BuildingFactory; @@ -114,8 +114,8 @@ class nobMilitary : public nobBaseMilitary GO_Type getGOT() const final { return GO_Type::NobMilitary; } - void Draw(DrawPoint drawPt) override; - void HandleEvent(unsigned id) override; + void draw(DrawPoint drawPt) override; + void handleEvent(unsigned id) override; /// Wurde das Militärgebäude neu gebaut und noch nicht besetzt und kann somit abgerissen werden bei Land-verlust? bool isNewBuilt() const { return new_built; } @@ -128,22 +128,22 @@ class nobMilitary : public nobBaseMilitary /// Sucht feindliche Miitärgebäude im Umkreis und setzt die frontier_distance entsprechend (sowohl selber als /// auch von den feindlichen Gebäuden) und bestellt somit ggf. neue Soldaten, exception wird nicht mit einbezogen - void LookForEnemyBuildings(const nobBaseMilitary* exception = nullptr); + void lookForEnemyBuildings(const nobBaseMilitary* exception = nullptr); /// Wird von gegnerischem Gebäude aufgerufen, wenn sie neu gebaut worden sind und es so ein neues Gebäude im Umkreis /// gibt setzt frontier_distance neu falls möglich und sendet ggf. Verstärkung - void NewEnemyMilitaryBuilding(FrontierDistance distance); + void newEnemyMilitaryBuilding(FrontierDistance distance); bool isUseless() const; bool isAttackable(unsigned playerIdx) const override; /// Gibt Distanz zurück FrontierDistance getFrontierDistance() const { return frontier_distance; } /// Berechnet die gewünschte Besatzung je nach Grenznähe - unsigned CalcRequiredNumTroops() const; + unsigned calcRequiredNumTroops() const; /// Calculate the required troop count for the given setting - unsigned CalcRequiredNumTroops(FrontierDistance assumedFrontierDistance, unsigned settingValue) const; + unsigned calcRequiredNumTroops(FrontierDistance assumedFrontierDistance, unsigned settingValue) const; /// Reguliert die Besatzung des Gebäudes je nach Grenznähe, bestellt neue Soldaten und schickt überflüssige raus - void RegulateTroops(); + void regulateTroops(); /// Gibt aktuelle Besetzung zurück unsigned getNumTroops() const { return troops.size(); } auto getTroops() const { return helpers::nonNullPtrSpan(troops); } @@ -154,32 +154,32 @@ class nobMilitary : public nobBaseMilitary void SetTroopLimit(unsigned rank, unsigned limit); /// Wird aufgerufen, wenn eine neue Ware zum dem Gebäude geliefert wird (in dem Fall nur Goldstücke) - void TakeWare(Ware* ware) override; + void takeWare(Ware* ware) override; /// Legt eine Ware am Objekt ab (an allen Straßenknoten (Gebäude, Baustellen und Flaggen) kann man Waren ablegen - void AddWare(std::unique_ptr ware) override; + void addWare(std::unique_ptr ware) override; /// Eine bestellte Ware konnte doch nicht kommen - void WareLost(Ware& ware) override; + void wareLost(Ware& ware) override; /// Wird aufgerufen, wenn von der Fahne vor dem Gebäude ein Rohstoff aufgenommen wurde - bool FreePlaceAtFlag() override; + bool freePlaceAtFlag() override; /// Berechnet, wie dringend eine Goldmünze gebraucht wird, in Punkten, je höher desto dringender - unsigned CalcCoinsPoints() const; - unsigned CalcArmorPoints() const; + unsigned calcCoinsPoints() const; + unsigned calcArmorPoints() const; /// Wird aufgerufen, wenn ein Soldat kommt - void GotWorker(Job job, noFigure& worker) override; + void gotWorker(Job job, noFigure& worker) override; /// Fügt aktiven Soldaten (der aus von einer Mission) zum Militärgebäude hinzu - void AddActiveSoldier(std::unique_ptr soldier) override; + void addActiveSoldier(std::unique_ptr soldier) override; /// Fügt passiven Soldaten (der aus einem Lagerhaus kommt) zum Militärgebäude hinzu - void AddPassiveSoldier(std::unique_ptr soldier); + void addPassiveSoldier(std::unique_ptr soldier); /// Soldat konnte nicht kommen - void SoldierLost(nofSoldier* soldier) override; + void soldierLost(nofSoldier* soldier) override; /// Send the given passive soldier from this building to attack the goal, optionally via the given harbor - void SendAttacker(nofPassiveSoldier*& passive_soldier, nobBaseMilitary& goal, + void sendAttacker(nofPassiveSoldier*& passive_soldier, nobBaseMilitary& goal, const nobHarborBuilding* harbor = nullptr); /// Schickt einen Verteidiger raus, der einem Angreifer in den Weg rennt - nofAggressiveDefender* SendAggressiveDefender(nofAttacker& attacker) override; + nofAggressiveDefender* sendAggressiveDefender(nofAttacker& attacker) override; /// Gibt die Anzahl der Soldaten zurück, die für einen Angriff auf ein bestimmtes Ziel zur Verfügung stehen unsigned getNumSoldiersForAttack(MapPoint dest) const; @@ -191,13 +191,13 @@ class nobMilitary : public nobBaseMilitary unsigned getSoldiersStrength() const; /// Gebäude wird vom Gegner eingenommen, player ist die neue Spieler-ID - void Capture(unsigned char new_owner); + void capture(unsigned char new_owner); /// Das Gebäude wurde bereits eingenommen, hier wird geprüft, ob noch weitere Soldaten für die Besetzung /// notwendig sind, wenn ja wird ein neuer Soldat gerufen, wenn nein, werden alle restlichen nach Hause geschickt - void NeedOccupyingTroops(); + void needOccupyingTroops(); /// Sagt dem Gebäude schonmal, dass es eingenommen wird, wenn er erste Eroberer gerade in das Gebäude reinläuft /// (also noch bevor er drinnen ist!) - damit da nicht zusätzliche Soldaten reinlaufen - void PrepareCapturing() + void prepareCapturing() { RTTR_Assert(!isBeingCaptured()); capturing = true; @@ -207,20 +207,20 @@ class nobMilitary : public nobBaseMilitary /// Wird das Gebäude gerade eingenommen? bool isBeingCaptured() const { return capturing; } /// Gebäude wird nicht mehr eingenommen (falls anderer Soldat zuvor reingekommen ist beim Einnehmen) - void StopCapturing() + void stopCapturing() { capturing_soldiers = 0; capturing = false; } /// Sagt, dass ein erobernder Soldat das Militärgebäude erreicht hat - void CapturingSoldierArrived(); + void capturingSoldierArrived(); /// A far-away capturer arrived at the flag and starts the capturing or is waiting around it - void FarAwayCapturerReachedGoal(nofAttacker& attacker, bool walkingIntoBld); + void farAwayCapturerReachedGoal(nofAttacker& attacker, bool walkingIntoBld); bool isFarAwayCapturer(const nofAttacker& attacker); /// Stoppt/Erlaubt Goldzufuhr (visuell) - void ToggleCoinsVirtual() { coinsDisabledVirtual = !coinsDisabledVirtual; } + void toggleCoinsVirtual() { coinsDisabledVirtual = !coinsDisabledVirtual; } /// Stoppt/Erlaubt Goldzufuhr (real) void SetCoinsAllowed(bool enabled); /// Fragt ab, ob Goldzufuhr ausgeschaltet ist (visuell) @@ -229,7 +229,7 @@ class nobMilitary : public nobBaseMilitary bool isGoldDisabled() const { return coinsDisabled; } unsigned char getNumCoins() const { return numCoins; } - void ToggleArmorVirtual() { armorAllowedVirtual = !armorAllowedVirtual; } + void toggleArmorVirtual() { armorAllowedVirtual = !armorAllowedVirtual; } void SetArmorAllowed(bool enabled); bool isArmorAllowedVirtual() const { return armorAllowedVirtual; } bool isArmorAllowed() const { return armorAllowed; } @@ -239,17 +239,17 @@ class nobMilitary : public nobBaseMilitary bool hasMaxRankSoldier() const; /// Sucht sämtliche Lagerhäuser nach Goldmünzen ab und bestellt ggf. eine, falls eine gebraucht wird - void SearchCoins(); - void SearchArmor(); + void searchCoins(); + void searchArmor(); /// Gebäude wird von einem Katapultstein getroffen - void HitOfCatapultStone(); + void hitOfCatapultStone(); /// Sind noch Truppen drinne, die dieses Gebäude verteidigen können - bool DefendersAvailable() const override { return getNumTroops() > 0; } + bool defendersAvailable() const override { return getNumTroops() > 0; } /// Darf das Militärgebäude abgerissen werden (Abriss-Verbot berücksichtigen)? bool isDemolitionAllowed() const; - void UnlinkAggressor(nofAttacker& soldier) override; + void unlinkAggressor(nofAttacker& soldier) override; }; diff --git a/libs/s25main/buildings/nobShipYard.cpp b/libs/s25main/buildings/nobShipYard.cpp index f1491e8e33..0626b6fee5 100644 --- a/libs/s25main/buildings/nobShipYard.cpp +++ b/libs/s25main/buildings/nobShipYard.cpp @@ -10,7 +10,7 @@ nobShipYard::nobShipYard(const MapPoint pos, const unsigned char player, const N {} nobShipYard::nobShipYard(SerializedGameData& sgd, const unsigned obj_id) - : nobUsual(sgd, obj_id), mode(sgd.Pop()) + : nobUsual(sgd, obj_id), mode(sgd.pop()) {} /// Serialisierungsfunktionen @@ -18,7 +18,7 @@ void nobShipYard::Serialize(SerializedGameData& sgd) const { nobUsual::Serialize(sgd); - sgd.PushEnum(mode); + sgd.pushEnum(mode); } /// Schaltet Modus entsprechend um diff --git a/libs/s25main/buildings/nobStorehouse.cpp b/libs/s25main/buildings/nobStorehouse.cpp index 1a207b9e4f..5abcb1785d 100644 --- a/libs/s25main/buildings/nobStorehouse.cpp +++ b/libs/s25main/buildings/nobStorehouse.cpp @@ -10,19 +10,19 @@ nobStorehouse::nobStorehouse(const MapPoint pos, const unsigned char player, con : nobBaseWarehouse(BuildingType::Storehouse, pos, player, nation) { // Post versenden - SendPostMessage(player, std::make_unique( + sendPostMessage(player, std::make_unique( getEvMgr().getCurrentGF(), _("New storehouse finished"), PostCategory::Economy, *this)); } nobStorehouse::nobStorehouse(SerializedGameData& sgd, const unsigned obj_id) : nobBaseWarehouse(sgd, obj_id) {} -void nobStorehouse::Draw(DrawPoint drawPt) +void nobStorehouse::draw(DrawPoint drawPt) { // Gebäude an sich zeichnen - DrawBaseBuilding(drawPt); + drawBaseBuilding(drawPt); } -void nobStorehouse::HandleEvent(const unsigned id) +void nobStorehouse::handleEvent(const unsigned id) { - HandleBaseEvent(id); + handleBaseEvent(id); } diff --git a/libs/s25main/buildings/nobStorehouse.h b/libs/s25main/buildings/nobStorehouse.h index ba7ce5a55c..06825ebf35 100644 --- a/libs/s25main/buildings/nobStorehouse.h +++ b/libs/s25main/buildings/nobStorehouse.h @@ -19,7 +19,7 @@ class nobStorehouse : public nobBaseWarehouse unsigned getMilitaryRadius() const override { return 0; } bool isAttackable(unsigned /*playerIdx*/) const override { return false; } - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; - void HandleEvent(unsigned id) override; + void handleEvent(unsigned id) override; }; diff --git a/libs/s25main/buildings/nobTemple.cpp b/libs/s25main/buildings/nobTemple.cpp index 2f9092ba40..f5513d0c49 100644 --- a/libs/s25main/buildings/nobTemple.cpp +++ b/libs/s25main/buildings/nobTemple.cpp @@ -15,13 +15,13 @@ nobTemple::nobTemple(const MapPoint pos, const unsigned char player, const Natio {} nobTemple::nobTemple(SerializedGameData& sgd, const unsigned obj_id) - : nobUsual(sgd, obj_id), productionMode(sgd.Pop()) + : nobUsual(sgd, obj_id), productionMode(sgd.pop()) {} void nobTemple::Serialize(SerializedGameData& sgd) const { nobUsual::Serialize(sgd); - sgd.PushEnum(productionMode); + sgd.pushEnum(productionMode); } void nobTemple::setProductionMode(ProductionMode newProductionMode) diff --git a/libs/s25main/buildings/nobUsual.cpp b/libs/s25main/buildings/nobUsual.cpp index dc0eb82aa1..4911c9e35a 100644 --- a/libs/s25main/buildings/nobUsual.cpp +++ b/libs/s25main/buildings/nobUsual.cpp @@ -42,19 +42,19 @@ nobUsual::nobUsual(BuildingType type, MapPoint pos, unsigned char player, Nation orderedWares.resize(BLD_WORK_DESC[bldType_].waresNeeded.size()); // Tür aufmachen,bis Gebäude besetzt ist - OpenDoor(); + openDoor(); GamePlayer& owner = world->getPlayer(player); // New building gets half the average productivity from all buildings of the same type - productivity = owner.getBuildingRegister().CalcAverageProductivity(type) / 2u; + productivity = owner.getBuildingRegister().calcAverageProductivity(type) / 2u; // Set last productivities to current to avoid resetting it on first recalculation event std::fill(lastProductivities.begin(), lastProductivities.end(), productivity); } nobUsual::nobUsual(SerializedGameData& sgd, const unsigned obj_id) - : noBuilding(sgd, obj_id), worker(sgd.PopObject()), productivity(sgd.PopUnsignedShort()), + : noBuilding(sgd, obj_id), worker(sgd.popObject()), productivity(sgd.PopUnsignedShort()), disableProduction(sgd.PopBool()), disableProductionVirtual(disableProduction), - lastOrderedWare(sgd.PopUnsignedChar()), orderware_ev(sgd.PopEvent()), productivity_ev(sgd.PopEvent()), + lastOrderedWare(sgd.PopUnsignedChar()), orderware_ev(sgd.popEvent()), productivity_ev(sgd.popEvent()), numGfNotWorking(sgd.PopUnsignedShort()), sinceNotWorking(sgd.PopUnsignedInt()), outOfRessourcesMsgSent(sgd.PopBool()), is_working(sgd.PopBool()) { @@ -63,7 +63,7 @@ nobUsual::nobUsual(SerializedGameData& sgd, const unsigned obj_id) orderedWares.resize(BLD_WORK_DESC[bldType_].waresNeeded.size()); for(std::list& orderedWare : orderedWares) - sgd.PopObjectContainer(orderedWare, GO_Type::Ware); + sgd.popObjectContainer(orderedWare, GO_Type::Ware); helpers::popContainer(sgd, lastProductivities); } @@ -71,12 +71,12 @@ void nobUsual::Serialize(SerializedGameData& sgd) const { noBuilding::Serialize(sgd); - sgd.PushObject(worker); + sgd.pushObject(worker); sgd.PushUnsignedShort(productivity); sgd.PushBool(disableProduction); sgd.PushUnsignedChar(lastOrderedWare); - sgd.PushEvent(orderware_ev); - sgd.PushEvent(productivity_ev); + sgd.pushEvent(orderware_ev); + sgd.pushEvent(productivity_ev); sgd.PushUnsignedShort(numGfNotWorking); sgd.PushUnsignedInt(sinceNotWorking); sgd.PushBool(outOfRessourcesMsgSent); @@ -84,7 +84,7 @@ void nobUsual::Serialize(SerializedGameData& sgd) const helpers::pushContainer(sgd, numWares); for(const std::list& orderedWare : orderedWares) - sgd.PushObjectContainer(orderedWare, true); + sgd.pushObjectContainer(orderedWare, true); helpers::pushContainer(sgd, lastProductivities); } @@ -95,40 +95,40 @@ void nobUsual::DestroyBuilding() // Arbeiter Bescheid sagen if(worker) { - worker->LostWork(); + worker->lostWork(); worker = nullptr; } else - world->getPlayer(player).JobNotWanted(this); + world->getPlayer(player).jobNotWanted(this); // Bestellte Waren Bescheid sagen for(std::list& orderedWare : orderedWares) { for(Ware* ware : orderedWare) - WareNotNeeded(ware); + wareNotNeeded(ware); orderedWare.clear(); } // Events löschen - getEvMgr().RemoveEvent(orderware_ev); - getEvMgr().RemoveEvent(productivity_ev); + getEvMgr().removeEvent(orderware_ev); + getEvMgr().removeEvent(productivity_ev); // Inventur entsprechend verringern wegen den Waren, die vernichtetet werden for(unsigned i = 0; i < BLD_WORK_DESC[bldType_].waresNeeded.size(); ++i) { const GoodType ware = BLD_WORK_DESC[bldType_].waresNeeded[i]; RTTR_Assert(ware != GoodType::Nothing); - world->getPlayer(player).DecreaseInventoryWare(ware, numWares[i]); + world->getPlayer(player).decreaseInventoryWare(ware, numWares[i]); } } -void nobUsual::Draw(DrawPoint drawPt) +void nobUsual::draw(DrawPoint drawPt) { // Gebäude an sich zeichnen - DrawBaseBuilding(drawPt); + drawBaseBuilding(drawPt); // Wenn Produktion gestoppt ist, Schild außen am Gebäude zeichnen zeichnen if(disableProductionVirtual) - LOADER.getMapTexture(46)->DrawFull(drawPt + BUILDING_SIGN_CONSTS[nation][bldType_]); + LOADER.getMapTexture(46)->drawFull(drawPt + BUILDING_SIGN_CONSTS[nation][bldType_]); // Rauch zeichnen @@ -139,7 +139,7 @@ void nobUsual::Draw(DrawPoint drawPt) LOADER .getMapTexture(692 + BUILDING_SMOKE_CONSTS[nation][bldType_].type * 8 + GAMECLIENT.getGlobalAnimation(8, 5, 2, (getX() + getY()) * 100)) - ->DrawFull(drawPt + BUILDING_SMOKE_CONSTS[nation][bldType_].offset, 0x99EEEEEE); + ->drawFull(drawPt + BUILDING_SMOKE_CONSTS[nation][bldType_].offset, 0x99EEEEEE); } // TODO: zusätzliche Dinge wie Mühlenräder, Schweinchen etc bei bestimmten Gebäuden zeichnen @@ -148,9 +148,9 @@ void nobUsual::Draw(DrawPoint drawPt) if(bldType_ == BuildingType::Mill && !is_working) { // Flügel der Mühle - LOADER.getNationImage(nation, 250 + 5 * 49)->DrawFull(drawPt); + LOADER.getNationImage(nation, 250 + 5 * 49)->drawFull(drawPt); // Schatten der Flügel - LOADER.getNationImage(nation, 250 + 5 * 49 + 1)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getNationImage(nation, 250 + 5 * 49 + 1)->drawFull(drawPt, COLOR_SHADOW); } // Esel in den Kammer bei Eselzucht zeichnen else if(bldType_ == BuildingType::DonkeyBreeder) @@ -178,13 +178,13 @@ void nobUsual::Draw(DrawPoint drawPt) { unsigned animationFrame = DONKEY_ANIMATION[GAMECLIENT.getGlobalAnimation( DONKEY_ANIMATION.size(), 5, 2, getX() * (player + 2) + getY() * i)]; - LOADER.getMapTexture(2180 + animationFrame)->DrawFull(drawPt + DONKEY_OFFSETS[nation][i]); + LOADER.getMapTexture(2180 + animationFrame)->drawFull(drawPt + DONKEY_OFFSETS[nation][i]); } } // Bei Katapulthaus Katapult oben auf dem Dach zeichnen, falls er nicht "arbeitet" else if(bldType_ == BuildingType::Catapult && !is_working) { - LOADER.getPlayerImage("rom_bobs", 1776)->DrawFull(drawPt - DrawPoint(7, 19)); + LOADER.getPlayerImage("rom_bobs", 1776)->drawFull(drawPt - DrawPoint(7, 19)); } // Bei Schweinefarm Schweinchen auf dem Hof zeichnen @@ -201,9 +201,9 @@ void nobUsual::Draw(DrawPoint drawPt) }}; /// Großes Schwein zeichnen - LOADER.getMapTexture(2160)->DrawFull(drawPt + PIG_POSITIONS[nation][0], COLOR_SHADOW); + LOADER.getMapTexture(2160)->drawFull(drawPt + PIG_POSITIONS[nation][0], COLOR_SHADOW); LOADER.getMapTexture(2100 + GAMECLIENT.getGlobalAnimation(12, 3, 1, getX() + getY() + getObjId())) - ->DrawFull(drawPt + PIG_POSITIONS[nation][0]); + ->drawFull(drawPt + PIG_POSITIONS[nation][0]); // Die 4 kleinen Schweinchen, je nach Produktivität for(unsigned i = 1; i < std::min(unsigned(productivity) / 20u + 1u, 5u); ++i) @@ -215,13 +215,13 @@ void nobUsual::Draw(DrawPoint drawPt) 2, 0, 0, 2, 2, 0, 1, 0, 3, 1, 2, 0, 1, 2, 2, 0, 0, 0, 3, 0, 2, 0, 3, 0, 3, 0, 1, 1, 0, 3, 0}; const unsigned short animpos = GAMECLIENT.getGlobalAnimation(63 * 12, 63 * 4 - i * 5, 1, 183 * i + getX() * getObjId() + getY() * i); - LOADER.getMapTexture(2160)->DrawFull(drawPt + PIG_POSITIONS[nation][i], COLOR_SHADOW); + LOADER.getMapTexture(2160)->drawFull(drawPt + PIG_POSITIONS[nation][i], COLOR_SHADOW); LOADER.getMapTexture(2112 + smallpig_animations[animpos / 12] * 12 + animpos % 12) - ->DrawFull(drawPt + PIG_POSITIONS[nation][i]); + ->drawFull(drawPt + PIG_POSITIONS[nation][i]); } // Ggf. Sounds abspielen (oink oink), da soll sich der Schweinezüchter drum kümmen - dynamic_cast(worker)->MakePigSounds(); //-V522 + dynamic_cast(worker)->makePigSounds(); //-V522 } // Bei nubischen Bergwerken das Feuer vor dem Bergwerk zeichnen else if(BuildingProperties::isMine(bldType_) && worker && nation == Nation::Africans) @@ -236,15 +236,15 @@ void nobUsual::Draw(DrawPoint drawPt) default: RTTR_Assert_Msg(false, "Not a mine"); } LOADER.getMapTexture(740 + GAMECLIENT.getGlobalAnimation(8, 5, 2, getObjId() + getX() + getY())) - ->DrawFull(drawPt + offset); + ->drawFull(drawPt + offset); } } -void nobUsual::HandleEvent(const unsigned id) +void nobUsual::handleEvent(const unsigned id) { if(id) { - const unsigned short currentProductivity = CalcCurrentProductivity(); + const unsigned short currentProductivity = calcCurrentProductivity(); // Sum over all last productivities and current (as start value) productivity = std::accumulate(lastProductivities.begin(), lastProductivities.end(), currentProductivity); // And average over those N+1 values @@ -255,7 +255,7 @@ void nobUsual::HandleEvent(const unsigned id) lastProductivities.front() = currentProductivity; // Add next event - productivity_ev = getEvMgr().AddEvent(this, numProductivityGFs, 1); + productivity_ev = getEvMgr().addEvent(this, numProductivityGFs, 1); } else { // Ware bestellen (falls noch Platz ist) und nicht an Betriebe, die stillgelegt wurden! @@ -268,7 +268,7 @@ void nobUsual::HandleEvent(const unsigned id) if(numWares[lastOrderedWare] + orderedWares[lastOrderedWare].size() < wareSpaces) { - Ware* w = world->getPlayer(player).OrderWare(workDesc.waresNeeded[lastOrderedWare], *this); + Ware* w = world->getPlayer(player).orderWare(workDesc.waresNeeded[lastOrderedWare], *this); if(w) RTTR_Assert(helpers::contains(orderedWares[lastOrderedWare], w)); } @@ -279,11 +279,11 @@ void nobUsual::HandleEvent(const unsigned id) } // Nach ner bestimmten Zeit dann nächste Ware holen - orderware_ev = getEvMgr().AddEvent(this, 210); + orderware_ev = getEvMgr().addEvent(this, 210); } } -void nobUsual::AddWare(std::unique_ptr ware) +void nobUsual::addWare(std::unique_ptr ware) { // Gucken, um was für einen Warentyp es sich handelt und dann dort hinzufügen const BldWorkDescription& workDesc = BLD_WORK_DESC[bldType_]; @@ -299,23 +299,23 @@ void nobUsual::AddWare(std::unique_ptr ware) } // Ware vernichten - world->getPlayer(player).RemoveWare(*ware); + world->getPlayer(player).removeWare(*ware); // Arbeiter Bescheid sagen, dass es neue Waren gibt if(worker) - worker->GotWareOrProductionAllowed(); + worker->gotWareOrProductionAllowed(); } -bool nobUsual::FreePlaceAtFlag() +bool nobUsual::freePlaceAtFlag() { // Arbeiter Bescheid sagen, falls es noch keinen gibt, brauch keine Ware rausgetragen werden if(worker) - return worker->FreePlaceAtFlag(); + return worker->freePlaceAtFlag(); else return false; } -void nobUsual::WareLost(Ware& ware) +void nobUsual::wareLost(Ware& ware) { // Ware konnte nicht kommen --> raus damit const BldWorkDescription& workDesc = BLD_WORK_DESC[bldType_]; @@ -330,16 +330,16 @@ void nobUsual::WareLost(Ware& ware) } } -void nobUsual::GotWorker(Job /*job*/, noFigure& worker) +void nobUsual::gotWorker(Job /*job*/, noFigure& worker) { this->worker = checkedCast(&worker); if(!BLD_WORK_DESC[bldType_].waresNeeded.empty()) // erste Ware bestellen - HandleEvent(0); + handleEvent(0); } -void nobUsual::WorkerLost() +void nobUsual::workerLost() { // Check if worker is or was here (e.g. hunter could currently be outside) if(hasWorker()) @@ -347,20 +347,20 @@ void nobUsual::WorkerLost() // If we have a worker, we must be producing something RTTR_Assert(productivity_ev); // Open the door till we get a new worker - OpenDoor(); + openDoor(); } // Produktivitätsevent ggf. abmelden - getEvMgr().RemoveEvent(productivity_ev); + getEvMgr().removeEvent(productivity_ev); // Waren-Bestell-Event abmelden - getEvMgr().RemoveEvent(orderware_ev); + getEvMgr().removeEvent(orderware_ev); // neuen Arbeiter bestellen worker = nullptr; - world->getPlayer(player).AddJobWanted(BLD_WORK_DESC[bldType_].job.value(), this); + world->getPlayer(player).addJobWanted(BLD_WORK_DESC[bldType_].job.value(), this); } -bool nobUsual::WaresAvailable() +bool nobUsual::waresAvailable() { const BldWorkDescription& workDesc = BLD_WORK_DESC[bldType_]; if(workDesc.useOneWareEach) @@ -386,7 +386,7 @@ bool nobUsual::WaresAvailable() } } -void nobUsual::ConsumeWares() +void nobUsual::consumeWares() { const BldWorkDescription& workDesc = BLD_WORK_DESC[bldType_]; unsigned numWaresNeeded = workDesc.waresNeeded.size(); @@ -418,12 +418,12 @@ void nobUsual::ConsumeWares() // Bestand verringern --numWares[wareIdxToUse]; // Inventur entsprechend verringern - owner.DecreaseInventoryWare(workDesc.waresNeeded[wareIdxToUse], 1); + owner.decreaseInventoryWare(workDesc.waresNeeded[wareIdxToUse], 1); // try to get ware from warehouses if(numWares[wareIdxToUse] < 2) { - Ware* w = world->getPlayer(player).OrderWare(workDesc.waresNeeded[wareIdxToUse], *this); + Ware* w = world->getPlayer(player).orderWare(workDesc.waresNeeded[wareIdxToUse], *this); if(w) RTTR_Assert(helpers::contains(orderedWares[wareIdxToUse], w)); } @@ -432,7 +432,7 @@ void nobUsual::ConsumeWares() } } -unsigned nobUsual::CalcDistributionPoints(const GoodType type) +unsigned nobUsual::calcDistributionPoints(const GoodType type) { // No production -> nothing needed if(disableProduction) @@ -468,7 +468,7 @@ unsigned nobUsual::CalcDistributionPoints(const GoodType type) return points; } -void nobUsual::TakeWare(Ware* ware) +void nobUsual::takeWare(Ware* ware) { // Ware in die Bestellliste aufnehmen const BldWorkDescription& workDesc = BLD_WORK_DESC[bldType_]; @@ -483,14 +483,14 @@ void nobUsual::TakeWare(Ware* ware) } } -bool nobUsual::AreThereAnyOrderedWares() const +bool nobUsual::areThereAnyOrderedWares() const { return helpers::contains_if(orderedWares, [](const auto& wareList) { return !wareList.empty(); }); } -void nobUsual::WorkerArrived() +void nobUsual::workerArrived() { - productivity_ev = getEvMgr().AddEvent(this, numProductivityGFs, 1); + productivity_ev = getEvMgr().addEvent(this, numProductivityGFs, 1); } void nobUsual::SetProductionEnabled(const bool enabled) @@ -508,12 +508,12 @@ void nobUsual::SetProductionEnabled(const bool enabled) // Wenn sie deaktiviert wurde, dem Arbeiter Bescheid sagen, damit er entsprechend stoppt, falls er schon // auf die Arbeit warteet if(worker) - worker->ProductionStopped(); + worker->productionStopped(); } else { // Wenn sie wieder aktiviert wurde, evtl wieder mit arbeiten anfangen, falls es einen Arbeiter gibt if(worker) - worker->GotWareOrProductionAllowed(); + worker->gotWareOrProductionAllowed(); } } @@ -533,7 +533,7 @@ unsigned short nobUsual::getProductivity() const (static_cast(productivity) * getS4LikeMineProductionChance(resourceAmount)) / 100u); } -void nobUsual::OnOutOfResources() +void nobUsual::onOutOfResources() { // Post verschicken, keine Rohstoffe mehr da if(outOfRessourcesMsgSent) @@ -554,7 +554,7 @@ void nobUsual::OnOutOfResources() else return; - SendPostMessage( + sendPostMessage( player, std::make_unique(getEvMgr().getCurrentGF(), error, PostCategory::Economy, *this)); world->getNotifications().publish(BuildingNote(BuildingNote::NoRessources, player, getPos(), getBuildingType())); @@ -564,14 +564,14 @@ void nobUsual::OnOutOfResources() } } -void nobUsual::StartNotWorking() +void nobUsual::startNotWorking() { // If we haven't stopped working already, then this is the GF since we are not working anymore if(sinceNotWorking == isWorkingMarker) sinceNotWorking = getEvMgr().getCurrentGF(); } -void nobUsual::StopNotWorking() +void nobUsual::stopNotWorking() { // Record the number of GFs we haven't worked, if any if(sinceNotWorking != isWorkingMarker) @@ -581,7 +581,7 @@ void nobUsual::StopNotWorking() } } -unsigned short nobUsual::CalcCurrentProductivity() +unsigned short nobUsual::calcCurrentProductivity() { if(outOfRessourcesMsgSent) return 0; diff --git a/libs/s25main/buildings/nobUsual.h b/libs/s25main/buildings/nobUsual.h index e5a6ebe985..b2d4219721 100644 --- a/libs/s25main/buildings/nobUsual.h +++ b/libs/s25main/buildings/nobUsual.h @@ -64,46 +64,46 @@ class nobUsual : public noBuilding GO_Type getGOT() const override { return GO_Type::NobUsual; } unsigned getMilitaryRadius() const override { return 0; } - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; bool hasWorker() const; /// Event-Handler - void HandleEvent(unsigned id) override; + void handleEvent(unsigned id) override; /// Legt eine Ware am Objekt ab (an allen Straßenknoten (Gebäude, Baustellen und Flaggen) kann man Waren ablegen - void AddWare(std::unique_ptr ware) override; + void addWare(std::unique_ptr ware) override; /// Wird aufgerufen, wenn von der Fahne vor dem Gebäude ein Rohstoff aufgenommen wurde - bool FreePlaceAtFlag() override; + bool freePlaceAtFlag() override; /// Eine bestellte Ware konnte doch nicht kommen - void WareLost(Ware& ware) override; + void wareLost(Ware& ware) override; /// Wird aufgerufen, wenn ein Arbeiter für das Gebäude gefunden werden konnte - void GotWorker(Job job, noFigure& worker) override; + void gotWorker(Job job, noFigure& worker) override; /// Wird vom Arbeiter aufgerufen, wenn er im Gebäude angekommen ist - void WorkerArrived(); + void workerArrived(); /// Wird vom Arbeiter aufgerufen, wenn er nicht (mehr) zur Arbeit kommen kann - void WorkerLost(); + void workerLost(); /// Gibt den Warenbestand (eingehende Waren - Rohstoffe) zurück unsigned char getNumWares(unsigned id) const { return numWares[id]; } /// Prüft, ob Waren für einen Arbeitsschritt vorhanden sind - bool WaresAvailable(); + bool waresAvailable(); /// Verbraucht Waren - void ConsumeWares(); + void consumeWares(); /// Berechnet Punktewertung für Ware type - unsigned CalcDistributionPoints(GoodType type); + unsigned calcDistributionPoints(GoodType type); /// Wird aufgerufen, wenn eine neue Ware zum dem Gebäude geliefert wird (nicht wenn sie bestellt wurde vom Gebäude!) - void TakeWare(Ware* ware) override; + void takeWare(Ware* ware) override; /// Bestellte Waren - bool AreThereAnyOrderedWares() const; + bool areThereAnyOrderedWares() const; unsigned short getProductivity() const; const nofBuildingWorker* getWorker() const { return worker; } /// Stoppt/Erlaubt Produktion (visuell) - void ToggleProductionVirtual() { disableProductionVirtual = !disableProductionVirtual; } + void toggleProductionVirtual() { disableProductionVirtual = !disableProductionVirtual; } /// Stoppt/Erlaubt Produktion (real) void SetProductionEnabled(bool enabled); /// Fragt ab, ob Produktion ausgeschaltet ist (visuell) @@ -111,13 +111,13 @@ class nobUsual : public noBuilding /// Fragt ab, ob Produktion ausgeschaltet ist (real) bool isProductionDisabled() const { return disableProduction; } /// Called when there are no more resources - void OnOutOfResources(); + void onOutOfResources(); /// Fängt an NICHT zu arbeiten (wird gemessen fürs Ausrechnen der Produktivität) - void StartNotWorking(); + void startNotWorking(); /// Hört auf, nicht zu arbeiten, sprich fängt an zu arbeiten (fürs Ausrechnen der Produktivität) - void StopNotWorking(); + void stopNotWorking(); private: /// Calculates the productivity and resets the counter - unsigned short CalcCurrentProductivity(); + unsigned short calcCurrentProductivity(); }; diff --git a/libs/s25main/controls/ctrlBaseImage.cpp b/libs/s25main/controls/ctrlBaseImage.cpp index 6df4512d30..24c159bcab 100644 --- a/libs/s25main/controls/ctrlBaseImage.cpp +++ b/libs/s25main/controls/ctrlBaseImage.cpp @@ -8,7 +8,7 @@ ctrlBaseImage::ctrlBaseImage(ITexture* img /*= nullptr*/) : img_(img), modulationColor_(COLOR_WHITE) {} -void ctrlBaseImage::SwapImage(ctrlBaseImage& other) +void ctrlBaseImage::swapImage(ctrlBaseImage& other) { std::swap(img_, other.img_); } @@ -20,12 +20,12 @@ Rect ctrlBaseImage::getImageRect() const return Rect(-img_->getOrigin(), img_->getSize()); } -void ctrlBaseImage::DrawImage(const Rect& dstArea) const +void ctrlBaseImage::drawImage(const Rect& dstArea) const { - DrawImage(dstArea, modulationColor_); + drawImage(dstArea, modulationColor_); } -void ctrlBaseImage::DrawImage(const Rect& dstArea, unsigned color) const +void ctrlBaseImage::drawImage(const Rect& dstArea, unsigned color) const { if(img_ == nullptr) return; @@ -59,5 +59,5 @@ void ctrlBaseImage::DrawImage(const Rect& dstArea, unsigned color) const dst.bottom -= halfDelta; } - img_->Draw(dst, srcArea, color); + img_->draw(dst, srcArea, color); } diff --git a/libs/s25main/controls/ctrlBaseImage.h b/libs/s25main/controls/ctrlBaseImage.h index 52e666aafb..ea5193c18d 100644 --- a/libs/s25main/controls/ctrlBaseImage.h +++ b/libs/s25main/controls/ctrlBaseImage.h @@ -22,12 +22,12 @@ class ctrlBaseImage unsigned getModulationColor() const { return modulationColor_; } /// Swap the images of those controls - void SwapImage(ctrlBaseImage& other); + void swapImage(ctrlBaseImage& other); Rect getImageRect() const; /// Draw the image on specified rectangular area. The image is centered inside dstArea and cropped to its size. - void DrawImage(const Rect& dstArea) const; - void DrawImage(const Rect& dstArea, unsigned color) const; + void drawImage(const Rect& dstArea) const; + void drawImage(const Rect& dstArea, unsigned color) const; private: ITexture* img_; diff --git a/libs/s25main/controls/ctrlBaseTooltip.cpp b/libs/s25main/controls/ctrlBaseTooltip.cpp index 23ead8f7ee..1e32ab2f07 100644 --- a/libs/s25main/controls/ctrlBaseTooltip.cpp +++ b/libs/s25main/controls/ctrlBaseTooltip.cpp @@ -7,7 +7,7 @@ ctrlBaseTooltip::~ctrlBaseTooltip() { - HideTooltip(); + hideTooltip(); } void ctrlBaseTooltip::setTooltip(const std::string& tooltip) @@ -16,22 +16,22 @@ void ctrlBaseTooltip::setTooltip(const std::string& tooltip) WINDOWMANAGER.setToolTip(this, tooltip_, true); } -void ctrlBaseTooltip::SwapTooltip(ctrlBaseTooltip& other) +void ctrlBaseTooltip::swapTooltip(ctrlBaseTooltip& other) { std::swap(tooltip_, other.tooltip_); } -void ctrlBaseTooltip::ShowTooltip() const +void ctrlBaseTooltip::showTooltip() const { - ShowTooltip(tooltip_); + showTooltip(tooltip_); } -void ctrlBaseTooltip::ShowTooltip(const std::string& tooltip) const +void ctrlBaseTooltip::showTooltip(const std::string& tooltip) const { WINDOWMANAGER.setToolTip(this, tooltip); } -void ctrlBaseTooltip::HideTooltip() const +void ctrlBaseTooltip::hideTooltip() const { WINDOWMANAGER.setToolTip(this, ""); } diff --git a/libs/s25main/controls/ctrlBaseTooltip.h b/libs/s25main/controls/ctrlBaseTooltip.h index 0401d02b0c..6df9bdf20c 100644 --- a/libs/s25main/controls/ctrlBaseTooltip.h +++ b/libs/s25main/controls/ctrlBaseTooltip.h @@ -18,12 +18,12 @@ class ctrlBaseTooltip void setTooltip(const std::string& tooltip); const std::string& getTooltip() const { return tooltip_; } /// Swap the tooltips of those controls - void SwapTooltip(ctrlBaseTooltip& other); + void swapTooltip(ctrlBaseTooltip& other); - void ShowTooltip() const; + void showTooltip() const; /// Show a temporary tooltip - void ShowTooltip(const std::string& tooltip) const; - void HideTooltip() const; + void showTooltip(const std::string& tooltip) const; + void hideTooltip() const; protected: std::string tooltip_; diff --git a/libs/s25main/controls/ctrlBuildingIcon.cpp b/libs/s25main/controls/ctrlBuildingIcon.cpp index 7101901581..738fc84303 100644 --- a/libs/s25main/controls/ctrlBuildingIcon.cpp +++ b/libs/s25main/controls/ctrlBuildingIcon.cpp @@ -19,16 +19,16 @@ ctrlBuildingIcon::ctrlBuildingIcon(Window* const parent, const unsigned id, cons /** * zeichnet das Fenster. */ -void ctrlBuildingIcon::Draw_() +void ctrlBuildingIcon::drawImpl() { if(state == ButtonState::Hover || state == ButtonState::Pressed) - LOADER.getImageN("io", 0)->DrawPart(getDrawRect()); + LOADER.getImageN("io", 0)->drawPart(getDrawRect()); glArchivItem_Bitmap* image = LOADER.getNationIcon(nation, type); if(image) - image->DrawFull(getDrawPos() + getSize() / 2, (state == ButtonState::Pressed ? COLOR_YELLOW : COLOR_WHITE)); + image->drawFull(getDrawPos() + getSize() / 2, (state == ButtonState::Pressed ? COLOR_YELLOW : COLOR_WHITE)); } -void ctrlBuildingIcon::DrawContent() const {} +void ctrlBuildingIcon::drawContent() const {} bool ctrlBuildingIcon::msgMouseMove(const MouseCoords& mc) { diff --git a/libs/s25main/controls/ctrlBuildingIcon.h b/libs/s25main/controls/ctrlBuildingIcon.h index 3e5815d871..d8fa806777 100644 --- a/libs/s25main/controls/ctrlBuildingIcon.h +++ b/libs/s25main/controls/ctrlBuildingIcon.h @@ -23,8 +23,8 @@ class ctrlBuildingIcon : public ctrlButton protected: /// zeichnet das Fenster. - void Draw_() override; - void DrawContent() const override; + void drawImpl() override; + void drawContent() const override; bool msgMouseMove(const MouseCoords& mc) override; const BuildingType type; /// der GebäudeType des Icons. diff --git a/libs/s25main/controls/ctrlButton.cpp b/libs/s25main/controls/ctrlButton.cpp index ce06921e49..c6a6dff123 100644 --- a/libs/s25main/controls/ctrlButton.cpp +++ b/libs/s25main/controls/ctrlButton.cpp @@ -37,12 +37,12 @@ bool ctrlButton::msgMouseMove(const MouseCoords& mc) if(state != ButtonState::Pressed) state = ButtonState::Hover; - ShowTooltip(); + showTooltip(); return true; } else { state = ButtonState::Up; - HideTooltip(); + hideTooltip(); return false; } } @@ -77,7 +77,7 @@ bool ctrlButton::msgLeftUp(const MouseCoords& mc) /** * zeichnet das Fenster. */ -void ctrlButton::Draw_() +void ctrlButton::drawImpl() { if(getSize().x == 0 || getSize().y == 0) return; @@ -89,11 +89,11 @@ void ctrlButton::Draw_() bool isElevated = !isChecked && state != ButtonState::Pressed; bool isHighlighted = isEnabled && !isChecked && state == ButtonState::Hover; if(hasBorder) - Draw3D(getDrawRect(), tc, isElevated, isHighlighted, isCurIlluminated, color); + draw3D(getDrawRect(), tc, isElevated, isHighlighted, isCurIlluminated, color); else - Draw3DContent(getDrawRect(), tc, isElevated, isHighlighted, isCurIlluminated, color); + draw3DContent(getDrawRect(), tc, isElevated, isHighlighted, isCurIlluminated, color); } /// Inhalt malen (Text, Bilder usw.) - DrawContent(); + drawContent(); } diff --git a/libs/s25main/controls/ctrlButton.h b/libs/s25main/controls/ctrlButton.h index 07da6b8f60..ee887f3ebd 100644 --- a/libs/s25main/controls/ctrlButton.h +++ b/libs/s25main/controls/ctrlButton.h @@ -40,9 +40,9 @@ class ctrlButton : public Window, public ctrlBaseTooltip protected: /// Zeichnet Grundstruktur des Buttons - void Draw_() override; + void drawImpl() override; /// Abgeleitete Klassen müssen erweiterten Button-Inhalt zeichnen - virtual void DrawContent() const = 0; + virtual void drawContent() const = 0; /// Texturfarbe des Buttons TextureColor tc; diff --git a/libs/s25main/controls/ctrlChat.cpp b/libs/s25main/controls/ctrlChat.cpp index c7105cd6a9..ebe2aed74c 100644 --- a/libs/s25main/controls/ctrlChat.cpp +++ b/libs/s25main/controls/ctrlChat.cpp @@ -33,7 +33,7 @@ ctrlChat::ctrlChat(Window* parent, unsigned id, const DrawPoint& pos, const Exte page_size = (size.y - 4) / (font->getHeight() + 2); // Scrollbalken hinzufügen - AddScrollBar(0, DrawPoint(size.x - SCROLLBAR_WIDTH, 0), Extent(SCROLLBAR_WIDTH, size.y), SCROLLBAR_WIDTH, tc, + addScrollBar(0, DrawPoint(size.x - SCROLLBAR_WIDTH, 0), Extent(SCROLLBAR_WIDTH, size.y), SCROLLBAR_WIDTH, tc, page_size); // Breite der Klammern <> um die Spielernamen berechnen @@ -46,14 +46,14 @@ ctrlChat::~ctrlChat() = default; /** * Größe ändern */ -void ctrlChat::Resize(const Extent& newSize) +void ctrlChat::resize(const Extent& newSize) { const bool x_changed = (getSize().x != newSize.x && !chat_lines.empty()); - Window::Resize(newSize); + Window::resize(newSize); auto* scroll = getCtrl(0); scroll->setPos(DrawPoint(newSize.x - SCROLLBAR_WIDTH, 0)); - scroll->Resize(Extent(SCROLLBAR_WIDTH, newSize.y)); + scroll->resize(Extent(SCROLLBAR_WIDTH, newSize.y)); // Remember some things const bool was_on_bottom = (scroll->getScrollPos() + page_size == chat_lines.size()); @@ -68,7 +68,7 @@ void ctrlChat::Resize(const Extent& newSize) { chat_lines.clear(); for(unsigned short i = 0; i < raw_chat_lines.size(); ++i) - WrapLine(i); + wrapLine(i); } // Zeilen pro Seite festlegen errechnen @@ -100,12 +100,12 @@ void ctrlChat::Resize(const Extent& newSize) /** * Zeichnet das Chat-Control. */ -void ctrlChat::Draw_() +void ctrlChat::drawImpl() { // Box malen - Draw3D(Rect(getDrawPos(), getSize()), tc, false); + draw3D(Rect(getDrawPos(), getSize()), tc, false); - Window::Draw_(); + Window::drawImpl(); // Wieviele Linien anzeigen? unsigned show_lines = (page_size > unsigned(chat_lines.size()) ? unsigned(chat_lines.size()) : page_size); @@ -122,33 +122,33 @@ void ctrlChat::Draw_() // Zeit, Spieler und danach Textnachricht if(!line->time_string.empty()) { - font->Draw(curTextPos, line->time_string, FontStyle{}, time_color); + font->draw(curTextPos, line->time_string, FontStyle{}, time_color); curTextPos.x += font->getWidth(line->time_string); } if(!line->player.empty()) { // Klammer 1 (<) - font->Draw(curTextPos, "<", FontStyle{}, line->player_color); + font->draw(curTextPos, "<", FontStyle{}, line->player_color); curTextPos.x += bracket1_size; // Spielername - font->Draw(curTextPos, line->player, FontStyle{}, line->player_color); + font->draw(curTextPos, line->player, FontStyle{}, line->player_color); curTextPos.x += font->getWidth(line->player); // Klammer 2 (>) - font->Draw(curTextPos, "> ", FontStyle{}, line->player_color); + font->draw(curTextPos, "> ", FontStyle{}, line->player_color); curTextPos.x += bracket2_size; } } visit( [this, curTextPos](const auto& line) { // Draw msg - this->font->Draw(curTextPos, line.msg, FontStyle{}, line.msg_color); + this->font->draw(curTextPos, line.msg, FontStyle{}, line.msg_color); }, chat_lines[i + pos]); textPos.y += font->getHeight() + 2; } } -void ctrlChat::WrapLine(unsigned short i) +void ctrlChat::wrapLine(unsigned short i) { const RawChatLine& line = raw_chat_lines[i]; @@ -169,7 +169,7 @@ void ctrlChat::WrapLine(unsigned short i) font->getWrapInfo(line.msg, getSize().x - prefix_width - 2 - SCROLLBAR_WIDTH, getSize().x - 2 - SCROLLBAR_WIDTH); // Message-Strings erzeugen aus den WrapInfo - std::vector strings = wi.CreateSingleStrings(line.msg); + std::vector strings = wi.createSingleStrings(line.msg); // Zeilen hinzufügen for(unsigned i = 0; i < strings.size(); ++i) @@ -186,7 +186,7 @@ void ctrlChat::WrapLine(unsigned short i) } } -void ctrlChat::AddMessage(const std::string& time_string, const std::string& player, const unsigned player_color, +void ctrlChat::addMessage(const std::string& time_string, const std::string& player, const unsigned player_color, const std::string& msg, const unsigned msg_color) { RawChatLine line; @@ -207,7 +207,7 @@ void ctrlChat::AddMessage(const std::string& time_string, const std::string& pla LOG.write("\n"); // Umbrechen - WrapLine(raw_chat_lines.size() - 1); + wrapLine(raw_chat_lines.size() - 1); // Scrollbar Bescheid sagen auto* scrollbar = getCtrl(0); @@ -220,17 +220,17 @@ void ctrlChat::AddMessage(const std::string& time_string, const std::string& pla bool ctrlChat::msgMouseMove(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgMouseMove, mc); + return relayMouseMessage(&Window::msgMouseMove, mc); } bool ctrlChat::msgLeftDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgLeftDown, mc); + return relayMouseMessage(&Window::msgLeftDown, mc); } bool ctrlChat::msgLeftUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgLeftUp, mc); + return relayMouseMessage(&Window::msgLeftUp, mc); } bool ctrlChat::msgWheelUp(const MouseCoords& mc) @@ -238,7 +238,7 @@ bool ctrlChat::msgWheelUp(const MouseCoords& mc) if(IsPointInRect(mc.pos, Rect(getDrawPos() + DrawPoint(2, 2), getSize() - Extent(2, 4)))) { auto* scrollbar = getCtrl(0); - scrollbar->Scroll(-3); + scrollbar->scroll(-3); return true; } else return false; @@ -249,15 +249,15 @@ bool ctrlChat::msgWheelDown(const MouseCoords& mc) if(IsPointInRect(mc.pos, Rect(getDrawPos() + DrawPoint(2, 2), getSize() - Extent(2, 4)))) { auto* scrollbar = getCtrl(0); - scrollbar->Scroll(+3); + scrollbar->scroll(+3); return true; } else return false; } -unsigned ctrlChat::CalcUniqueColor(const std::string& name) +unsigned ctrlChat::calcUniqueColor(const std::string& name) { - unsigned checksum = CalcChecksumOfBuffer(name.c_str(), name.length()) * name.length(); + unsigned checksum = calcChecksumOfBuffer(name.c_str(), name.length()) * name.length(); unsigned color = checksum | (checksum << 12) | 0xff000000; return color; } diff --git a/libs/s25main/controls/ctrlChat.h b/libs/s25main/controls/ctrlChat.h index c57f395f23..a90dd7665f 100644 --- a/libs/s25main/controls/ctrlChat.h +++ b/libs/s25main/controls/ctrlChat.h @@ -19,9 +19,9 @@ class ctrlChat : public Window ~ctrlChat() override; /// Größe ändern - void Resize(const Extent& newSize) override; + void resize(const Extent& newSize) override; /// Fügt eine Chatnachricht hinzu. - void AddMessage(const std::string& time_string, const std::string& player, unsigned player_color, + void addMessage(const std::string& time_string, const std::string& player, unsigned player_color, const std::string& msg, unsigned msg_color); /// Setzt Farbe der Zeitangaben. void setTimeColor(unsigned color) { time_color = color; } @@ -33,13 +33,13 @@ class ctrlChat : public Window bool msgWheelDown(const MouseCoords& mc) override; /// Create a (almost) unique color for the given name - static unsigned CalcUniqueColor(const std::string& name); + static unsigned calcUniqueColor(const std::string& name); protected: /// Zeichnet das Chat-Control. - void Draw_() override; + void drawImpl() override; /// Converts an unwrapped line into a wrapped one and appends it - void WrapLine(unsigned short i); + void wrapLine(unsigned short i); private: // Struktur für eine Chatzeile. diff --git a/libs/s25main/controls/ctrlCheck.cpp b/libs/s25main/controls/ctrlCheck.cpp index 887d2a9d6a..d9f85c49ce 100644 --- a/libs/s25main/controls/ctrlCheck.cpp +++ b/libs/s25main/controls/ctrlCheck.cpp @@ -33,16 +33,16 @@ bool ctrlCheck::msgMouseMove(const MouseCoords& mc) { if(isMouseOver(mc.pos)) { - ShowTooltip(); + showTooltip(); return true; } else { - HideTooltip(); + hideTooltip(); return false; } } -void ctrlCheck::Draw_() +void ctrlCheck::drawImpl() { const unsigned short boxSize = 20; short spacing = (getSize().y - boxSize) / 2; @@ -60,22 +60,22 @@ void ctrlCheck::Draw_() if(boxStartOffsetX < 0) boxStartOffsetX = 0; - Draw3D(drawRect, tc, false); + draw3D(drawRect, tc, false); if(drawText) { int availableWidth = boxStartOffsetX - 4; if(availableWidth < 0) availableWidth = 0; - font->Draw(drawRect.getOrigin() + DrawPoint(4, getSize().y / 2), text, FontStyle::VCENTER, + font->draw(drawRect.getOrigin() + DrawPoint(4, getSize().y / 2), text, FontStyle::VCENTER, (check ? COLOR_YELLOW : 0xFFBBBBBB), availableWidth); } DrawPoint boxPos = drawRect.getOrigin() + DrawPoint(boxStartOffsetX, spacing); if(!readonly) - Draw3D(Rect(boxPos, Extent::all(boxSize)), tc, false); + draw3D(Rect(boxPos, Extent::all(boxSize)), tc, false); if(check) - LOADER.getImageN("io", 32)->DrawFull(boxPos + DrawPoint(boxSize, boxSize) / 2); + LOADER.getImageN("io", 32)->drawFull(boxPos + DrawPoint(boxSize, boxSize) / 2); } diff --git a/libs/s25main/controls/ctrlCheck.h b/libs/s25main/controls/ctrlCheck.h index 0f89c8e461..5c3f699e61 100644 --- a/libs/s25main/controls/ctrlCheck.h +++ b/libs/s25main/controls/ctrlCheck.h @@ -33,7 +33,7 @@ class ctrlCheck : public Window, public ctrlBaseTooltip bool msgMouseMove(const MouseCoords& mc) override; protected: - void Draw_() override; + void drawImpl() override; private: TextureColor tc; diff --git a/libs/s25main/controls/ctrlColorButton.cpp b/libs/s25main/controls/ctrlColorButton.cpp index e115081329..0a5ea605d5 100644 --- a/libs/s25main/controls/ctrlColorButton.cpp +++ b/libs/s25main/controls/ctrlColorButton.cpp @@ -9,8 +9,8 @@ ctrlColorButton::ctrlColorButton(Window* parent, unsigned id, const DrawPoint& p : ctrlButton(parent, id, pos, size, tc, tooltip), ctrlBaseColor(fillColor) {} -void ctrlColorButton::DrawContent() const +void ctrlColorButton::drawContent() const { Extent rectSize = getSize() - Extent(6, 6); - DrawRectangle(Rect(getDrawPos() + DrawPoint(3, 3), rectSize), color_); + drawRectangle(Rect(getDrawPos() + DrawPoint(3, 3), rectSize), color_); } diff --git a/libs/s25main/controls/ctrlColorButton.h b/libs/s25main/controls/ctrlColorButton.h index 2d634ccb04..e5db924cb9 100644 --- a/libs/s25main/controls/ctrlColorButton.h +++ b/libs/s25main/controls/ctrlColorButton.h @@ -15,5 +15,5 @@ class ctrlColorButton : public ctrlButton, public ctrlBaseColor unsigned fillColor, const std::string& tooltip); protected: - void DrawContent() const override; + void drawContent() const override; }; diff --git a/libs/s25main/controls/ctrlColorDeepening.cpp b/libs/s25main/controls/ctrlColorDeepening.cpp index dc67202bf3..cf60d568a6 100644 --- a/libs/s25main/controls/ctrlColorDeepening.cpp +++ b/libs/s25main/controls/ctrlColorDeepening.cpp @@ -9,7 +9,7 @@ ctrlColorDeepening::ctrlColorDeepening(Window* parent, unsigned id, DrawPoint po : ctrlDeepening(parent, id, pos, size, tc), ctrlBaseColor(fillColor) {} -void ctrlColorDeepening::DrawContent() const +void ctrlColorDeepening::drawContent() const { - DrawRectangle(Rect(getDrawPos() + DrawPoint(3, 3), getSize() - Extent(6, 6)), color_); + drawRectangle(Rect(getDrawPos() + DrawPoint(3, 3), getSize() - Extent(6, 6)), color_); } diff --git a/libs/s25main/controls/ctrlColorDeepening.h b/libs/s25main/controls/ctrlColorDeepening.h index c363f040af..d1ed5164f6 100644 --- a/libs/s25main/controls/ctrlColorDeepening.h +++ b/libs/s25main/controls/ctrlColorDeepening.h @@ -15,5 +15,5 @@ class ctrlColorDeepening : public ctrlDeepening, public ctrlBaseColor unsigned fillColor); protected: - void DrawContent() const override; + void drawContent() const override; }; diff --git a/libs/s25main/controls/ctrlComboBox.cpp b/libs/s25main/controls/ctrlComboBox.cpp index 06d44e9a7e..3fd262fc5a 100644 --- a/libs/s25main/controls/ctrlComboBox.cpp +++ b/libs/s25main/controls/ctrlComboBox.cpp @@ -17,23 +17,23 @@ ctrlComboBox::ctrlComboBox(Window* parent, unsigned id, const DrawPoint& pos, co : Window(parent, id, pos, size), tc(tc), font(font), max_list_height(max_list_height), readonly(readonly), suppressSelectEvent(false) { - AddList(0, DrawPoint(0, size.y), Extent(size.x, 4), tc, font)->setVisible(false); + addList(0, DrawPoint(0, size.y), Extent(size.x, 4), tc, font)->setVisible(false); if(!readonly) - AddImageButton(1, DrawPoint(size.x - size.y, 0), Extent(size.y, size.y), tc, LOADER.getImageN("io", 34)); + addImageButton(1, DrawPoint(size.x - size.y, 0), Extent(size.y, size.y), tc, LOADER.getImageN("io", 34)); - Resize(size); + resize(size); } -void ctrlComboBox::Resize(const Extent& newSize) +void ctrlComboBox::resize(const Extent& newSize) { - Window::Resize(newSize); + Window::resize(newSize); auto* button = getCtrl(1); if(button) { button->setPos(DrawPoint(newSize.x - newSize.y, 0)); - button->Resize(Extent(newSize.y, newSize.y)); + button->resize(Extent(newSize.y, newSize.y)); } auto* list = getCtrl(0); @@ -45,7 +45,7 @@ void ctrlComboBox::Resize(const Extent& newSize) { // zu große geworden? listSize.y += font->getHeight(); - unsigned short scaledMaxHeight = ScaleIf(Extent(0, max_list_height)).y; + unsigned short scaledMaxHeight = scaleIf(Extent(0, max_list_height)).y; if(listSize.y > scaledMaxHeight) { @@ -60,7 +60,7 @@ void ctrlComboBox::Resize(const Extent& newSize) } list->setPos(DrawPoint(0, newSize.y)); - list->Resize(listSize); + list->resize(listSize); } std::optional ctrlComboBox::getSelectedText() const @@ -75,7 +75,7 @@ std::optional ctrlComboBox::getSelectedText() const bool ctrlComboBox::msgMouseMove(const MouseCoords& mc) { // Für Button und Liste weiterleiten - return RelayMouseMessage(&Window::msgMouseMove, mc); + return relayMouseMessage(&Window::msgMouseMove, mc); } bool ctrlComboBox::msgLeftDown(const MouseCoords& mc) @@ -86,25 +86,25 @@ bool ctrlComboBox::msgLeftDown(const MouseCoords& mc) if(!readonly && !IsPointInRect(mc.pos, getFullDrawRect(list))) { // Liste wieder ausblenden - ShowList(false); + showList(false); return false; } if(!readonly && IsPointInRect(mc.pos, getDrawRect())) { // Liste wieder ein/ausblenden - ShowList(!list->isVisible()); + showList(!list->isVisible()); return true; } // Für Button und Liste weiterleiten - return RelayMouseMessage(&Window::msgLeftDown, mc); + return relayMouseMessage(&Window::msgLeftDown, mc); } bool ctrlComboBox::msgLeftUp(const MouseCoords& mc) { // Für Button und Liste weiterleiten - return RelayMouseMessage(&Window::msgLeftUp, mc); + return relayMouseMessage(&Window::msgLeftUp, mc); } bool ctrlComboBox::msgRightDown(const MouseCoords& mc) @@ -112,13 +112,13 @@ bool ctrlComboBox::msgRightDown(const MouseCoords& mc) auto* list = getCtrl(0); // Für Button und Liste weiterleiten (und danach erst schließen) - bool ret = RelayMouseMessage(&Window::msgRightDown, mc); + bool ret = relayMouseMessage(&Window::msgRightDown, mc); // Clicked on list -> close it if(!readonly && IsPointInRect(mc.pos, list->getDrawRect())) { // Liste wieder ausblenden - ShowList(false); + showList(false); } return ret; @@ -131,7 +131,7 @@ bool ctrlComboBox::msgWheelUp(const MouseCoords& mc) auto* list = getCtrl(0); if(list->isVisible() && IsPointInRect(mc.pos, list->getDrawRect())) - return RelayMouseMessage(&Window::msgWheelUp, mc); + return relayMouseMessage(&Window::msgWheelUp, mc); if(IsPointInRect(mc.pos, getDrawRect())) { @@ -154,7 +154,7 @@ bool ctrlComboBox::msgWheelDown(const MouseCoords& mc) if(list->isVisible() && IsPointInRect(mc.pos, list->getDrawRect())) { // Scrolled in opened list -> - return RelayMouseMessage(&Window::msgWheelDown, mc); + return relayMouseMessage(&Window::msgWheelDown, mc); } if(IsPointInRect(mc.pos, getDrawRect())) @@ -177,7 +177,7 @@ Rect ctrlComboBox::getFullDrawRect(const ctrlList* list) void ctrlComboBox::msgListSelectItem(unsigned, const int selection) { // Liste wieder ausblenden - ShowList(false); + showList(false); // ist in der Liste überhaupt was drin? if(selection >= 0 && !suppressSelectEvent) @@ -187,16 +187,16 @@ void ctrlComboBox::msgListSelectItem(unsigned, const int selection) } } -void ctrlComboBox::AddItem(const std::string& text) +void ctrlComboBox::addItem(const std::string& text) { - getCtrl(0)->AddItem(text); - Resize(getSize()); + getCtrl(0)->addItem(text); + resize(getSize()); } -void ctrlComboBox::DeleteAllItems() +void ctrlComboBox::deleteAllItems() { - getCtrl(0)->DeleteAllItems(); - Resize(getSize()); + getCtrl(0)->deleteAllItems(); + resize(getSize()); } void ctrlComboBox::setSelection(unsigned selection) @@ -207,33 +207,33 @@ void ctrlComboBox::setSelection(unsigned selection) suppressSelectEvent = false; } -void ctrlComboBox::Draw_() +void ctrlComboBox::drawImpl() { auto* liste = getCtrl(0); - Draw3D(Rect(getDrawPos(), getSize()), tc, false); + draw3D(Rect(getDrawPos(), getSize()), tc, false); // Show selected item in the box if(liste->getNumLines() > 0) { - font->Draw(getDrawPos() + DrawPoint(2, getSize().y / 2), liste->getSelItemText(), FontStyle::VCENTER, + font->draw(getDrawPos() + DrawPoint(2, getSize().y / 2), liste->getSelItemText(), FontStyle::VCENTER, COLOR_YELLOW, getSize().x - 2 - getSize().y, ""); } // Draw button manually as we can't use DrawControls which would draw the list we do in Msg_PaintAfter auto* button = getCtrl(1); if(button) - button->Draw(); + button->draw(); } void ctrlComboBox::msgPaintAfter() { // Draw list now so it is on top of everything - getCtrl(0)->Draw(); + getCtrl(0)->draw(); Window::msgPaintAfter(); } -void ctrlComboBox::ShowList(bool show) +void ctrlComboBox::showList(bool show) { auto* list = getCtrl(0); if(list->isVisible() == show) @@ -246,9 +246,9 @@ void ctrlComboBox::ShowList(bool show) // Lock/unlock region of extended list if(show) - getParent()->LockRegion(this, list->getDrawRect()); + getParent()->lockRegion(this, list->getDrawRect()); else - getParent()->FreeRegion(this); + getParent()->freeRegion(this); - LOADER.getSoundN("sound", 113)->Play(255, false); + LOADER.getSoundN("sound", 113)->play(255, false); } diff --git a/libs/s25main/controls/ctrlComboBox.h b/libs/s25main/controls/ctrlComboBox.h index c30a6741b3..da5233d06f 100644 --- a/libs/s25main/controls/ctrlComboBox.h +++ b/libs/s25main/controls/ctrlComboBox.h @@ -15,12 +15,12 @@ class ctrlComboBox final : public Window ctrlComboBox(Window* parent, unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, unsigned short max_list_height, bool readonly); - void Resize(const Extent& newSize) override; + void resize(const Extent& newSize) override; bool isReadOnly() const { return readonly; } - void AddItem(const std::string& text); - void DeleteAllItems(); + void addItem(const std::string& text); + void deleteAllItems(); /// Set selection to an item if within bounds. Does not trigger a notification. void setSelection(unsigned selection); const std::optional& getSelection() const { return getCtrl(0)->getSelection(); }; @@ -40,9 +40,9 @@ class ctrlComboBox final : public Window void msgListSelectItem(unsigned ctrl_id, int selection) override; protected: - void Draw_() override; + void drawImpl() override; /// Show or hide the list. - void ShowList(bool show); + void showList(bool show); Rect getFullDrawRect(const ctrlList* list); private: diff --git a/libs/s25main/controls/ctrlDeepening.cpp b/libs/s25main/controls/ctrlDeepening.cpp index 3c70e8660c..981fdf7620 100644 --- a/libs/s25main/controls/ctrlDeepening.cpp +++ b/libs/s25main/controls/ctrlDeepening.cpp @@ -11,8 +11,8 @@ ctrlDeepening::ctrlDeepening(Window* parent, unsigned id, DrawPoint pos, const E /** * zeichnet das Fenster. */ -void ctrlDeepening::Draw_() +void ctrlDeepening::drawImpl() { - Draw3D(Rect(getDrawPos(), getSize()), tc, false); - DrawContent(); + draw3D(Rect(getDrawPos(), getSize()), tc, false); + drawContent(); } diff --git a/libs/s25main/controls/ctrlDeepening.h b/libs/s25main/controls/ctrlDeepening.h index ee5874df4d..7451ca4f0d 100644 --- a/libs/s25main/controls/ctrlDeepening.h +++ b/libs/s25main/controls/ctrlDeepening.h @@ -16,9 +16,9 @@ class ctrlDeepening : public Window ctrlDeepening(Window* parent, unsigned id, DrawPoint pos, const Extent& size, TextureColor tc); protected: - void Draw_() override; + void drawImpl() override; /// Derived classes have to draw the content - virtual void DrawContent() const = 0; + virtual void drawContent() const = 0; private: TextureColor tc; diff --git a/libs/s25main/controls/ctrlEdit.cpp b/libs/s25main/controls/ctrlEdit.cpp index 1f3fec3d9d..13af3cad80 100644 --- a/libs/s25main/controls/ctrlEdit.cpp +++ b/libs/s25main/controls/ctrlEdit.cpp @@ -24,8 +24,8 @@ ctrlEdit::ctrlEdit(Window* parent, unsigned id, const DrawPoint& pos, const Exte notify_(notify) { txtCtrl = static_cast( - AddTextDeepening(0, DrawPoint(0, 0), size, tc, "", font, COLOR_YELLOW, FontStyle::LEFT | FontStyle::VCENTER)); - UpdateInternalText(); + addTextDeepening(0, DrawPoint(0, 0), size, tc, "", font, COLOR_YELLOW, FontStyle::LEFT | FontStyle::VCENTER)); + updateInternalText(); } /** @@ -45,8 +45,8 @@ void ctrlEdit::setText(const std::string& text) viewStart_ = 0; cursorPos_ = text_.length(); - UpdateInternalText(); - Notify(); + updateInternalText(); + notify(); } void ctrlEdit::setText(const unsigned text) @@ -101,7 +101,7 @@ static void removeFirstCharFromString(std::string& str) str.erase(str.begin(), it); } -void ctrlEdit::UpdateInternalText() +void ctrlEdit::updateInternalText() { if(text_.empty()) { @@ -147,20 +147,20 @@ void ctrlEdit::UpdateInternalText() } } -inline void ctrlEdit::CursorLeft() +inline void ctrlEdit::cursorLeft() { if(cursorPos_ == 0) return; --cursorPos_; - UpdateInternalText(); + updateInternalText(); } -inline void ctrlEdit::CursorRight() +inline void ctrlEdit::cursorRight() { if(cursorPos_ == text_.length()) return; ++cursorPos_; - UpdateInternalText(); + updateInternalText(); } /** @@ -168,9 +168,9 @@ inline void ctrlEdit::CursorRight() * * @todo muss alles überarbeitet werden */ -void ctrlEdit::Draw_() +void ctrlEdit::drawImpl() { - Window::Draw_(); + Window::drawImpl(); // Alle 500ms Cursor für 500ms anzeigen if(focus_ && !isDisabled_ && VIDEODRIVER.getTickCount() % 1000 < 500) { @@ -179,7 +179,7 @@ void ctrlEdit::Draw_() cursorDrawPos.x += cursorOffsetX_ + ctrlTextDeepening::borderSize.x; cursorDrawPos.y += (getSize().y - (fontHeight + 2)) / 2; - DrawRectangle(Rect(cursorDrawPos, Extent(1, fontHeight + 2)), 0xFFFFA000); + drawRectangle(Rect(cursorDrawPos, Extent(1, fontHeight + 2)), 0xFFFFA000); } } @@ -188,7 +188,7 @@ void ctrlEdit::Draw_() * * @param[in] text Das Zeichen */ -void ctrlEdit::AddChar(char32_t c) +void ctrlEdit::addChar(char32_t c) { if(editType_ == EditType::Number && (c < '0' || c > '9')) return; @@ -199,14 +199,14 @@ void ctrlEdit::AddChar(char32_t c) return; text_.insert(cursorPos_, 1, c); - CursorRight(); - Notify(); + cursorRight(); + notify(); } /** * entfernt ein Zeichen */ -void ctrlEdit::RemoveChar() +void ctrlEdit::removeChar() { if(cursorPos_ > 0 && !text_.empty()) { @@ -216,15 +216,15 @@ void ctrlEdit::RemoveChar() while(!text_.empty() && text_.length() <= viewStart_) --viewStart_; - CursorLeft(); - Notify(); + cursorLeft(); + notify(); } } /** * benachrichtigt das Parent ("OnChange") */ -void ctrlEdit::Notify() +void ctrlEdit::notify() { if(!notify_ || !getParent()) return; @@ -232,10 +232,10 @@ void ctrlEdit::Notify() getParent()->msgEditChange(getID()); } -void ctrlEdit::Resize(const Extent& newSize) +void ctrlEdit::resize(const Extent& newSize) { - Window::Resize(newSize); - UpdateInternalText(); + Window::resize(newSize); + updateInternalText(); } /** @@ -284,9 +284,9 @@ bool ctrlEdit::msgKeyDown(const KeyEvent& ke) { --cursorPos_; } - UpdateInternalText(); + updateInternalText(); } else - CursorLeft(); // just one step + cursorLeft(); // just one step break; case KeyType::Right: // Cursor nach Rechts @@ -303,26 +303,26 @@ bool ctrlEdit::msgKeyDown(const KeyEvent& ke) { ++cursorPos_; } - UpdateInternalText(); + updateInternalText(); } else - CursorRight(); // just one step + cursorRight(); // just one step break; case KeyType::Char: // Zeichen eingegeben - if(!isDisabled_ && txtCtrl->getFont()->CharExist(ke.c)) - AddChar(ke.c); + if(!isDisabled_ && txtCtrl->getFont()->charExist(ke.c)) + addChar(ke.c); break; case KeyType::Backspace: // Backspace gedrückt if(!isDisabled_) - RemoveChar(); + removeChar(); break; case KeyType::Delete: // Entfernen gedrückt if(!isDisabled_ && cursorPos_ < text_.length()) { - CursorRight(); - RemoveChar(); + cursorRight(); + removeChar(); } break; @@ -335,7 +335,7 @@ bool ctrlEdit::msgKeyDown(const KeyEvent& ke) if(cursorPos_ > 0) { cursorPos_ = 0; - UpdateInternalText(); + updateInternalText(); } break; @@ -343,7 +343,7 @@ bool ctrlEdit::msgKeyDown(const KeyEvent& ke) if(cursorPos_ < text_.length()) { cursorPos_ = text_.length(); - UpdateInternalText(); + updateInternalText(); } break; } diff --git a/libs/s25main/controls/ctrlEdit.h b/libs/s25main/controls/ctrlEdit.h index 7ad9afc98b..18854e609c 100644 --- a/libs/s25main/controls/ctrlEdit.h +++ b/libs/s25main/controls/ctrlEdit.h @@ -50,22 +50,22 @@ class ctrlEdit : public Window void setNotify(bool notify = true) { this->notify_ = notify; } void setType(EditType type) { this->editType_ = type; } - void Resize(const Extent& newSize) override; + void resize(const Extent& newSize) override; bool msgLeftDown(const MouseCoords& mc) override; bool msgKeyDown(const KeyEvent& ke) override; protected: - void Draw_() override; + void drawImpl() override; private: - void AddChar(char32_t c); - void RemoveChar(); - void Notify(); - void UpdateInternalText(); + void addChar(char32_t c); + void removeChar(); + void notify(); + void updateInternalText(); - void CursorLeft(); - void CursorRight(); + void cursorLeft(); + void cursorRight(); unsigned short maxLength_; ctrlTextDeepening* txtCtrl; diff --git a/libs/s25main/controls/ctrlGroup.cpp b/libs/s25main/controls/ctrlGroup.cpp index fa29b1689e..3b7dec8af7 100644 --- a/libs/s25main/controls/ctrlGroup.cpp +++ b/libs/s25main/controls/ctrlGroup.cpp @@ -81,42 +81,42 @@ void ctrlGroup::msgTableLeftButton(const unsigned ctrl_id, const std::optionalgetOrigin(); @@ -32,7 +32,7 @@ void ctrlImageButton::DrawContent() const Rect drawRect(pos, size); if(!isEnabled && getModulationColor() == COLOR_WHITE) - DrawImage(drawRect, 0xFF555555); + drawImage(drawRect, 0xFF555555); else - DrawImage(drawRect); + drawImage(drawRect); } diff --git a/libs/s25main/controls/ctrlImageButton.h b/libs/s25main/controls/ctrlImageButton.h index a0a205309d..e2caa641c3 100644 --- a/libs/s25main/controls/ctrlImageButton.h +++ b/libs/s25main/controls/ctrlImageButton.h @@ -15,5 +15,5 @@ class ctrlImageButton : public ctrlButton, public ctrlBaseImage ITexture* image, const std::string& tooltip); protected: - void DrawContent() const override; + void drawContent() const override; }; diff --git a/libs/s25main/controls/ctrlImageDeepening.cpp b/libs/s25main/controls/ctrlImageDeepening.cpp index 77d6fa22de..d571c01057 100644 --- a/libs/s25main/controls/ctrlImageDeepening.cpp +++ b/libs/s25main/controls/ctrlImageDeepening.cpp @@ -10,8 +10,8 @@ ctrlImageDeepening::ctrlImageDeepening(Window* parent, unsigned id, DrawPoint po : ctrlDeepening(parent, id, pos, size, tc), ctrlBaseImage(image) {} -void ctrlImageDeepening::DrawContent() const +void ctrlImageDeepening::drawContent() const { // Adding of origin compensates for its substraction inside ITexture::Draw() - DrawImage(Rect(getDrawPos() + getImage()->getOrigin(), getSize())); + drawImage(Rect(getDrawPos() + getImage()->getOrigin(), getSize())); } diff --git a/libs/s25main/controls/ctrlImageDeepening.h b/libs/s25main/controls/ctrlImageDeepening.h index eb94f6bf8e..adecfb6065 100644 --- a/libs/s25main/controls/ctrlImageDeepening.h +++ b/libs/s25main/controls/ctrlImageDeepening.h @@ -15,5 +15,5 @@ class ctrlImageDeepening : public ctrlDeepening, public ctrlBaseImage ITexture* image); protected: - void DrawContent() const override; + void drawContent() const override; }; diff --git a/libs/s25main/controls/ctrlIngameMinimap.cpp b/libs/s25main/controls/ctrlIngameMinimap.cpp index 889744b184..a3156fb9d6 100644 --- a/libs/s25main/controls/ctrlIngameMinimap.cpp +++ b/libs/s25main/controls/ctrlIngameMinimap.cpp @@ -19,15 +19,15 @@ ctrlIngameMinimap::ctrlIngameMinimap(Window* parent, const unsigned id, const Dr /** * Zeichnet die MapPreview */ -void ctrlIngameMinimap::Draw_() +void ctrlIngameMinimap::drawImpl() { - DrawMap(minimap); + drawMap(minimap); // Mittleren Punkt berechnen und dort hinscrollen Position middlePt = (gwv.getLastPt() + gwv.getFirstPt()) / 2; // Koordinaten korrigieren - DrawPoint middle_corrected(MakeMapPoint(middlePt, minimap.getMapSize())); + DrawPoint middle_corrected(makeMapPoint(middlePt, minimap.getMapSize())); // Scroll-Auswahl-Bild holen glArchivItem_Bitmap* image = LOADER.getMapImage(23); @@ -64,7 +64,7 @@ void ctrlIngameMinimap::Draw_() drawSize.y -= overDrawSize.y; // Zeichnen - image->DrawPart(Rect(getMapDrawArea().getOrigin() + pos, drawSize), srcOffset); + image->drawPart(Rect(getMapDrawArea().getOrigin() + pos, drawSize), srcOffset); } bool ctrlIngameMinimap::msgLeftDown(const MouseCoords& mc) @@ -83,7 +83,7 @@ bool ctrlIngameMinimap::msgMouseMove(const MouseCoords& mc) DrawPoint mapCoord = (mc.pos - DrawPoint(getMapDrawArea().getOrigin())) * DrawPoint(minimap.getMapSize()) / DrawPoint(getCurMapSize()); - gwv.MoveToMapPt(MapPoint(mapCoord)); + gwv.moveToMapPt(MapPoint(mapCoord)); return true; } @@ -92,17 +92,17 @@ bool ctrlIngameMinimap::msgMouseMove(const MouseCoords& mc) return false; } -void ctrlIngameMinimap::ToggleTerritory() +void ctrlIngameMinimap::toggleTerritory() { - minimap.ToggleTerritory(); + minimap.toggleTerritory(); } -void ctrlIngameMinimap::ToggleHouses() +void ctrlIngameMinimap::toggleHouses() { - minimap.ToggleHouses(); + minimap.toggleHouses(); } -void ctrlIngameMinimap::ToggleRoads() +void ctrlIngameMinimap::toggleRoads() { - minimap.ToggleRoads(); + minimap.toggleRoads(); } diff --git a/libs/s25main/controls/ctrlIngameMinimap.h b/libs/s25main/controls/ctrlIngameMinimap.h index 69d17cc52e..f5f213c7fd 100644 --- a/libs/s25main/controls/ctrlIngameMinimap.h +++ b/libs/s25main/controls/ctrlIngameMinimap.h @@ -24,13 +24,13 @@ class ctrlIngameMinimap : public ctrlMinimap IngameMinimap& minimap, GameWorldView& gwv); /// Zeichnet die MapPreview - void Draw_() override; + void drawImpl() override; bool msgLeftDown(const MouseCoords& mc) override; bool msgMouseMove(const MouseCoords& mc) override; /// Die einzelnen Dinge umschalten - void ToggleTerritory(); - void ToggleHouses(); - void ToggleRoads(); + void toggleTerritory(); + void toggleHouses(); + void toggleRoads(); }; diff --git a/libs/s25main/controls/ctrlList.cpp b/libs/s25main/controls/ctrlList.cpp index e6e5a80323..5d3219911a 100644 --- a/libs/s25main/controls/ctrlList.cpp +++ b/libs/s25main/controls/ctrlList.cpp @@ -14,12 +14,12 @@ ctrlList::ctrlList(Window* parent, unsigned id, const DrawPoint& pos, const Exte { pagesize = (getSize().y - 4) / font->getHeight(); - AddScrollBar(0, DrawPoint(getSize().x - 20, 0), Extent(20, getSize().y), 20, tc, pagesize); + addScrollBar(0, DrawPoint(getSize().x - 20, 0), Extent(20, getSize().y), 20, tc, pagesize); } ctrlList::~ctrlList() { - DeleteAllItems(); + deleteAllItems(); } void ctrlList::setSelection(const std::optional& selection) @@ -41,11 +41,11 @@ bool ctrlList::msgMouseMove(const MouseCoords& mc) if(mouseover_) { const std::string itemTxt = getItemText(*mouseover_); - tooltip_.ShowTooltip((font->getWidth(itemTxt) > getListDrawArea().getSize().x) ? itemTxt : ""); + tooltip_.showTooltip((font->getWidth(itemTxt) > getListDrawArea().getSize().x) ? itemTxt : ""); return true; } - tooltip_.HideTooltip(); + tooltip_.hideTooltip(); // Für die Scrollbar weiterleiten return scrollbar->msgMouseMove(mc); @@ -58,7 +58,7 @@ bool ctrlList::msgLeftDown(const MouseCoords& mc) const auto itemIdx = getItemFromPos(mc.pos); if(itemIdx) { - tooltip_.HideTooltip(); + tooltip_.hideTooltip(); setSelection(*itemIdx); return true; } @@ -74,7 +74,7 @@ bool ctrlList::msgRightDown(const MouseCoords& mc) auto itemIdx = getItemFromPos(mc.pos); if(itemIdx) { - tooltip_.HideTooltip(); + tooltip_.hideTooltip(); setSelection(*itemIdx); return true; } @@ -107,7 +107,7 @@ bool ctrlList::msgWheelUp(const MouseCoords& mc) if(IsPointInRect(mc.pos, getFullDrawArea())) { auto* scrollbar = getCtrl(0); - scrollbar->Scroll(-1); + scrollbar->scroll(-1); return true; } @@ -120,23 +120,23 @@ bool ctrlList::msgWheelDown(const MouseCoords& mc) if(IsPointInRect(mc.pos, getFullDrawArea())) { auto* scrollbar = getCtrl(0); - scrollbar->Scroll(+1); + scrollbar->scroll(+1); return true; } return false; } -void ctrlList::Draw_() +void ctrlList::drawImpl() { if(lines.empty()) return; // Box malen - Draw3D(Rect(getDrawPos(), getSize()), tc, false); + draw3D(Rect(getDrawPos(), getSize()), tc, false); // Scrolleiste zeichnen - Window::Draw_(); + Window::drawImpl(); // Wieviele Linien anzeigen? const unsigned show_lines = (pagesize > lines.size() ? unsigned(lines.size()) : pagesize); @@ -148,16 +148,16 @@ void ctrlList::Draw_() { // Schwarze Markierung, wenn die Maus drauf ist if(i + scrollbarPos == mouseover_) - DrawRectangle(Rect(curPos, Extent(getSize().x - 22, font->getHeight())), 0x80000000); + drawRectangle(Rect(curPos, Extent(getSize().x - 22, font->getHeight())), 0x80000000); // Text an sich - font->Draw(curPos, lines[i + scrollbarPos], FontStyle{}, + font->draw(curPos, lines[i + scrollbarPos], FontStyle{}, (selection_ == i + scrollbarPos ? 0xFFFFAA00 : COLOR_YELLOW), getSize().x - 22); curPos.y += font->getHeight(); } } -void ctrlList::AddItem(const std::string& text) +void ctrlList::addItem(const std::string& text) { // lines-Array ggf vergrößern lines.push_back(text); @@ -170,7 +170,7 @@ void ctrlList::setItemText(const unsigned id, const std::string& text) lines.at(id) = text; } -void ctrlList::DeleteAllItems() +void ctrlList::deleteAllItems() { lines.clear(); selection_ = std::nullopt; @@ -191,11 +191,11 @@ const std::string& ctrlList::getSelItemText() const return EMPTY; } -void ctrlList::Resize(const Extent& newSize) +void ctrlList::resize(const Extent& newSize) { auto* scrollbar = getCtrl(0); scrollbar->setPos(DrawPoint(newSize.x - 20, 0)); - scrollbar->Resize(Extent(20, newSize.y)); + scrollbar->resize(Extent(20, newSize.y)); pagesize = (newSize.y - 4) / font->getHeight(); @@ -207,7 +207,7 @@ void ctrlList::Resize(const Extent& newSize) while(lines.size() - scrollbar->getScrollPos() < pagesize && scrollbar->getScrollPos() > 0) scrollbar->setScrollPos(scrollbar->getScrollPos() - 1); - Window::Resize(newSize); + Window::resize(newSize); } void ctrlList::Swap(unsigned first, unsigned second) @@ -222,7 +222,7 @@ void ctrlList::Swap(unsigned first, unsigned second) std::swap(lines[first], lines[second]); } -void ctrlList::Remove(const unsigned index) +void ctrlList::remove(const unsigned index) { if(index < lines.size()) { diff --git a/libs/s25main/controls/ctrlList.h b/libs/s25main/controls/ctrlList.h index 3a0423feb9..77ec774a8e 100644 --- a/libs/s25main/controls/ctrlList.h +++ b/libs/s25main/controls/ctrlList.h @@ -21,20 +21,20 @@ class ctrlList : public Window ~ctrlList() override; /// Change size - void Resize(const Extent& newSize) override; + void resize(const Extent& newSize) override; /// Add item to listbox. - void AddItem(const std::string& text); + void addItem(const std::string& text); /// Change text of an item. void setItemText(unsigned id, const std::string& text); - void DeleteAllItems(); + void deleteAllItems(); const std::string& getItemText(unsigned line) const; /// Get the value of the currently selected item const std::string& getSelItemText() const; /// Exchange the text of 2 items void Swap(unsigned first, unsigned second); /// Deletes an item. If the deleted item is selected then the selection is cleared. - void Remove(unsigned index); + void remove(unsigned index); unsigned getNumLines() const { return static_cast(lines.size()); } const std::optional& getSelection() const { return selection_; }; @@ -48,7 +48,7 @@ class ctrlList : public Window bool msgWheelDown(const MouseCoords& mc) override; protected: - void Draw_() override; + void drawImpl() override; private: std::optional getItemFromPos(const Position& pos) const; diff --git a/libs/s25main/controls/ctrlMapSelection.cpp b/libs/s25main/controls/ctrlMapSelection.cpp index 107a7181ef..46683f9ed2 100644 --- a/libs/s25main/controls/ctrlMapSelection.cpp +++ b/libs/s25main/controls/ctrlMapSelection.cpp @@ -32,7 +32,7 @@ ctrlMapSelection::MapImages::MapImages(const SelectionMapInputData& data) std::vector pathsToLoad; for(const auto& res : {data.background, data.map, data.missionMapMask, data.marker, data.conquered}) pathsToLoad.push_back(res.filePath); - LOADER.LoadFiles(pathsToLoad); + LOADER.loadFiles(pathsToLoad); } background = getImage(data.background); @@ -97,7 +97,7 @@ void ctrlMapSelection::setSelection(size_t select) if(missionStatus[select].playable) currentSelectionPos = inputData.missionSelectionInfos[select].ankerPos; } else - currentSelectionPos = Position::Invalid(); + currentSelectionPos = Position::invalid(); } std::optional ctrlMapSelection::getSelection() const @@ -165,18 +165,18 @@ DrawPoint ctrlMapSelection::getMapPosition() void ctrlMapSelection::drawImageOnMap(glArchivItem_Bitmap* image, const Position& drawPos) { const auto originCorrection = image->getOrigin() - scale(image->getOrigin()); - image->DrawFull(Rect(getMapPosition() + scale(drawPos) + originCorrection, scale(image->getSize()))); + image->drawFull(Rect(getMapPosition() + scale(drawPos) + originCorrection, scale(image->getSize()))); } -void ctrlMapSelection::Draw_() +void ctrlMapSelection::drawImpl() { - Window::Draw_(); + Window::drawImpl(); - mapImages.background->DrawFull(Rect(getBackgroundPosition(), scale(mapImages.background->getSize()))); + mapImages.background->drawFull(Rect(getBackgroundPosition(), scale(mapImages.background->getSize()))); const Rect mapRect = Rect(getMapPosition(), scale(mapImages.map->getSize())); - mapImages.map->DrawFull(mapRect); - mapImages.enabledMask->DrawFull(mapRect); + mapImages.map->drawFull(mapRect); + mapImages.enabledMask->drawFull(mapRect); for(const auto idx : helpers::range(missionStatus.size())) { diff --git a/libs/s25main/controls/ctrlMapSelection.h b/libs/s25main/controls/ctrlMapSelection.h index 82732d5c24..7100371e10 100644 --- a/libs/s25main/controls/ctrlMapSelection.h +++ b/libs/s25main/controls/ctrlMapSelection.h @@ -35,7 +35,7 @@ class ctrlMapSelection : public Window bool msgLeftUp(const MouseCoords& mc) override; protected: - void Draw_() override; + void drawImpl() override; void updateEnabledMask(); diff --git a/libs/s25main/controls/ctrlMinimap.cpp b/libs/s25main/controls/ctrlMinimap.cpp index 55fe9299a8..7355eac811 100644 --- a/libs/s25main/controls/ctrlMinimap.cpp +++ b/libs/s25main/controls/ctrlMinimap.cpp @@ -36,9 +36,9 @@ void ctrlMinimap::setPadding(const Extent& padding) setMapSize(mapSize); } -void ctrlMinimap::Resize(const Extent& newSize) +void ctrlMinimap::resize(const Extent& newSize) { - Window::Resize(newSize); + Window::resize(newSize); setMapSize(mapSize); } @@ -71,23 +71,23 @@ void ctrlMinimap::setMapSize(const Extent& newMapSize) } } -DrawPoint ctrlMinimap::CalcMapCoord(MapPoint pt) const +DrawPoint ctrlMinimap::calcMapCoord(MapPoint pt) const { DrawPoint result = getMapArea().getOrigin(); result += DrawPoint(drawnMapSize * Extent(pt) / mapSize); return result; } -void ctrlMinimap::DrawMap(Minimap& map) const +void ctrlMinimap::drawMap(Minimap& map) const { // Map an sich zeichnen - map.Draw(getMapDrawArea()); + map.draw(getMapDrawArea()); } -void ctrlMinimap::RemoveBoundingBox(const Extent& minSize) +void ctrlMinimap::removeBoundingBox(const Extent& minSize) { Extent newSize = drawnMapSize + padding * 2u; newSize = elMax(newSize, minSize); padding = Extent(0, 0); - Resize(newSize); + resize(newSize); } diff --git a/libs/s25main/controls/ctrlMinimap.h b/libs/s25main/controls/ctrlMinimap.h index 45530b0b1a..2109c3119c 100644 --- a/libs/s25main/controls/ctrlMinimap.h +++ b/libs/s25main/controls/ctrlMinimap.h @@ -25,18 +25,18 @@ class ctrlMinimap : public Window void setPadding(const Extent& padding); /// Größe ändern - void Resize(const Extent& newSize) override; + void resize(const Extent& newSize) override; void setMapSize(const Extent& newMapSize); /// Liefert für einen gegebenen Map-Punkt die Pixel-Koordinaten relativ zur Bounding-Box - DrawPoint CalcMapCoord(MapPoint pt) const; + DrawPoint calcMapCoord(MapPoint pt) const; /// Verkleinert Minimap soweit es geht (entfernt Bounding-Box) - void RemoveBoundingBox(const Extent& minSize); + void removeBoundingBox(const Extent& minSize); protected: /// Zeichnet die Minimap an sich - void DrawMap(Minimap& map) const; + void drawMap(Minimap& map) const; /// Real size of the minimap (gets scaled with retained aspect ratio) Extent drawnMapSize; diff --git a/libs/s25main/controls/ctrlMultiSelectGroup.cpp b/libs/s25main/controls/ctrlMultiSelectGroup.cpp index 9471a6923e..94cd89bd6c 100644 --- a/libs/s25main/controls/ctrlMultiSelectGroup.cpp +++ b/libs/s25main/controls/ctrlMultiSelectGroup.cpp @@ -12,7 +12,7 @@ ctrlMultiSelectGroup::ctrlMultiSelectGroup(Window* parent, unsigned id, GroupSel /** * Selektiert einen neuen Button aus der Gruppe. */ -void ctrlMultiSelectGroup::AddSelection(unsigned selection, bool notify) +void ctrlMultiSelectGroup::addSelection(unsigned selection, bool notify) { // Neuen Button auswählen auto* button = getCtrl(selection); @@ -21,7 +21,7 @@ void ctrlMultiSelectGroup::AddSelection(unsigned selection, bool notify) { case GroupSelectType::Illuminate: button->setIlluminated(true); break; case GroupSelectType::Check: button->setChecked(true); break; - case GroupSelectType::Show: button->setVisible(false); break; + case GroupSelectType::show: button->setVisible(false); break; } this->selectedItems_.insert(selection); @@ -33,7 +33,7 @@ void ctrlMultiSelectGroup::AddSelection(unsigned selection, bool notify) /** * Entfernt die Selektion eines Buttons aus der Gruppe. */ -void ctrlMultiSelectGroup::RemoveSelection(unsigned selection, bool notify) +void ctrlMultiSelectGroup::removeSelection(unsigned selection, bool notify) { // Neuen Button auswählen auto* button = getCtrl(selection); @@ -42,7 +42,7 @@ void ctrlMultiSelectGroup::RemoveSelection(unsigned selection, bool notify) { case GroupSelectType::Illuminate: button->setIlluminated(false); break; case GroupSelectType::Check: button->setChecked(false); break; - case GroupSelectType::Show: button->setVisible(true); break; + case GroupSelectType::show: button->setVisible(true); break; } this->selectedItems_.erase(selection); @@ -54,12 +54,12 @@ void ctrlMultiSelectGroup::RemoveSelection(unsigned selection, bool notify) /** * Wechselt zwischen selektiert/nicht selektiert */ -void ctrlMultiSelectGroup::ToggleSelection(unsigned selection, bool notify) +void ctrlMultiSelectGroup::toggleSelection(unsigned selection, bool notify) { if(isSelected(selection)) - RemoveSelection(selection, notify); + removeSelection(selection, notify); else - AddSelection(selection, notify); + addSelection(selection, notify); } bool ctrlMultiSelectGroup::isSelected(unsigned selection) const @@ -69,30 +69,30 @@ bool ctrlMultiSelectGroup::isSelected(unsigned selection) const void ctrlMultiSelectGroup::msgButtonClick(const unsigned ctrl_id) { - ToggleSelection(ctrl_id, true); + toggleSelection(ctrl_id, true); } bool ctrlMultiSelectGroup::msgLeftDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgLeftDown, mc); + return relayMouseMessage(&Window::msgLeftDown, mc); } bool ctrlMultiSelectGroup::msgLeftUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgLeftUp, mc); + return relayMouseMessage(&Window::msgLeftUp, mc); } bool ctrlMultiSelectGroup::msgWheelUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgWheelUp, mc); + return relayMouseMessage(&Window::msgWheelUp, mc); } bool ctrlMultiSelectGroup::msgWheelDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgWheelDown, mc); + return relayMouseMessage(&Window::msgWheelDown, mc); } bool ctrlMultiSelectGroup::msgMouseMove(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgMouseMove, mc); + return relayMouseMessage(&Window::msgMouseMove, mc); } diff --git a/libs/s25main/controls/ctrlMultiSelectGroup.h b/libs/s25main/controls/ctrlMultiSelectGroup.h index c02bcec22d..8e245a228c 100644 --- a/libs/s25main/controls/ctrlMultiSelectGroup.h +++ b/libs/s25main/controls/ctrlMultiSelectGroup.h @@ -17,11 +17,11 @@ class ctrlMultiSelectGroup : public ctrlGroup ctrlMultiSelectGroup(Window* parent, unsigned id, GroupSelectType select_type); /// Selektiert einen neuen Button - void AddSelection(unsigned selection, bool notify = false); + void addSelection(unsigned selection, bool notify = false); /// Entfernt einen selektierten Button aus der Selektion - void RemoveSelection(unsigned selection, bool notify = false); + void removeSelection(unsigned selection, bool notify = false); /// Wechselt zwischen selektiert/nicht selektiert - void ToggleSelection(unsigned selection, bool notify = false); + void toggleSelection(unsigned selection, bool notify = false); /// Gibt Liste der aktuell selektierten Buttons zurück const std::set& getSelection() const { return selectedItems_; } /// Prüft ob ein Button ausgewählt ist diff --git a/libs/s25main/controls/ctrlMultiline.cpp b/libs/s25main/controls/ctrlMultiline.cpp index 27b712f1a1..23519c2a4d 100644 --- a/libs/s25main/controls/ctrlMultiline.cpp +++ b/libs/s25main/controls/ctrlMultiline.cpp @@ -14,39 +14,39 @@ ctrlMultiline::ctrlMultiline(Window* parent, unsigned id, const DrawPoint& pos, : Window(parent, id, pos, size), tc_(tc), font(font), format_(format), showBackground_(true), scrollbarAllowed_(true), cachedContentWidth(0) { - RecalcVisibleLines(); - AddScrollBar(0, DrawPoint(size.x - SCROLLBAR_WIDTH, 0), Extent(SCROLLBAR_WIDTH, size.y), SCROLLBAR_WIDTH, tc, + recalcVisibleLines(); + addScrollBar(0, DrawPoint(size.x - SCROLLBAR_WIDTH, 0), Extent(SCROLLBAR_WIDTH, size.y), SCROLLBAR_WIDTH, tc, maxNumVisibleLines); } /** * fügt eine Zeile hinzu. */ -void ctrlMultiline::AddString(const std::string& str, unsigned color, bool scroll) +void ctrlMultiline::addString(const std::string& str, unsigned color, bool scroll) { lines.push_back(Line(str, color)); - RecalcWrappedLines(); + recalcWrappedLines(); auto* scrollbar = getCtrl(0); if(scroll && scrollbar->getScrollPos() + 1 + maxNumVisibleLines == lines.size()) scrollbar->setScrollPos(scrollbar->getScrollPos() + 1); } -void ctrlMultiline::Clear() +void ctrlMultiline::clear() { lines.clear(); - RecalcWrappedLines(); + recalcWrappedLines(); } /** * zeichnet das Fenster. */ -void ctrlMultiline::Draw_() +void ctrlMultiline::drawImpl() { if(showBackground_) - Draw3D(Rect(getDrawPos(), getSize()), tc_, false); + draw3D(Rect(getDrawPos(), getSize()), tc_, false); - Window::Draw_(); + Window::drawImpl(); unsigned numVisibleLines = std::min(maxNumVisibleLines, drawLines.size()); @@ -54,12 +54,12 @@ void ctrlMultiline::Draw_() DrawPoint curPos = getDrawPos() + DrawPoint(PADDING, PADDING); for(unsigned i = 0; i < numVisibleLines; ++i) { - font->Draw(curPos, drawLines[i + scrollbarPos].str, format_, drawLines[i + scrollbarPos].color); + font->draw(curPos, drawLines[i + scrollbarPos].str, format_, drawLines[i + scrollbarPos].color); curPos.y += font->getHeight(); } } -void ctrlMultiline::RecalcVisibleLines() +void ctrlMultiline::recalcVisibleLines() { if(getSize().y < 2 * PADDING) maxNumVisibleLines = 0; @@ -67,7 +67,7 @@ void ctrlMultiline::RecalcVisibleLines() maxNumVisibleLines = (getSize().y - 2 * PADDING) / font->getHeight(); } -void ctrlMultiline::RecalcWrappedLines() +void ctrlMultiline::recalcWrappedLines() { drawLines.clear(); cachedContentWidth = 0; @@ -115,7 +115,7 @@ void ctrlMultiline::RecalcWrappedLines() else { // Break it - const std::vector newLines = wrapInfos[i].CreateSingleStrings(lines[i].str); + const std::vector newLines = wrapInfos[i].createSingleStrings(lines[i].str); for(const std::string& line : newLines) drawLines.push_back(Line(line, lines[i].color)); } @@ -131,7 +131,7 @@ void ctrlMultiline::setScrollBarAllowed(bool allowed) if(scrollbarAllowed_ != allowed) { scrollbarAllowed_ = allowed; - RecalcWrappedLines(); + recalcWrappedLines(); } } @@ -150,7 +150,7 @@ bool ctrlMultiline::msgWheelUp(const MouseCoords& mc) if(IsPointInRect(mc.pos, Rect(getDrawPos() + DrawPoint(padding), getSize() - padding * 2u))) { auto* scrollbar = getCtrl(0); - scrollbar->Scroll(-3); + scrollbar->scroll(-3); return true; } else return false; @@ -162,7 +162,7 @@ bool ctrlMultiline::msgWheelDown(const MouseCoords& mc) if(IsPointInRect(mc.pos, Rect(getDrawPos() + DrawPoint(padding), getSize() - padding * 2u))) { auto* scrollbar = getCtrl(0); - scrollbar->Scroll(+3); + scrollbar->scroll(+3); return true; } else return false; @@ -173,13 +173,13 @@ bool ctrlMultiline::msgMouseMove(const MouseCoords& mc) return getCtrl(0)->msgMouseMove(mc); } -void ctrlMultiline::Resize(const Extent& newSize) +void ctrlMultiline::resize(const Extent& newSize) { const Extent oldSize(getSize()); const unsigned oldMaxNumVisLines = maxNumVisibleLines; - Window::Resize(newSize); + Window::resize(newSize); - RecalcVisibleLines(); + recalcVisibleLines(); auto* scrollBar = getCtrl(0); scrollBar->setPageSize(maxNumVisibleLines); scrollBar->setHeight(getSize().y); @@ -190,7 +190,7 @@ void ctrlMultiline::Resize(const Extent& newSize) const bool oldNeedScrollbar = oldMaxNumVisLines < drawLines.size(); const bool newNeedScrollbar = maxNumVisibleLines < drawLines.size(); if(oldNeedScrollbar != newNeedScrollbar || getSize().x > oldSize.x || getSize().x < getContentWidth()) - RecalcWrappedLines(); + recalcWrappedLines(); } /// Textzeile ersetzen. Klappt bestimmt nicht mit Scrollbar-Kram @@ -199,7 +199,7 @@ void ctrlMultiline::setLine(const unsigned index, const std::string& str, unsign if(index < lines.size()) { lines[index] = Line(str, color); - RecalcWrappedLines(); + recalcWrappedLines(); } } diff --git a/libs/s25main/controls/ctrlMultiline.h b/libs/s25main/controls/ctrlMultiline.h index e894671c7f..aaafa8cd5d 100644 --- a/libs/s25main/controls/ctrlMultiline.h +++ b/libs/s25main/controls/ctrlMultiline.h @@ -24,10 +24,10 @@ class ctrlMultiline : public Window ctrlMultiline(Window* parent, unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, FontStyle format); - void Resize(const Extent& newSize) override; - void AddString(const std::string& str, unsigned color, bool scroll = true); + void resize(const Extent& newSize) override; + void addString(const std::string& str, unsigned color, bool scroll = true); /// Deletes all lines - void Clear(); + void clear(); unsigned getNumLines() const { return static_cast(lines.size()); } /// Gibt den index-ten Eintrag zurück const std::string& getLine(unsigned index) const { return lines[index].str; } @@ -38,7 +38,7 @@ class ctrlMultiline : public Window Extent getContentSize() const; /// Schaltet Box ein und aus - void ShowBackground(bool showBackground) { showBackground_ = showBackground; } + void showBackground(bool showBackground) { showBackground_ = showBackground; } /// (Dis-)allows a scrollbar. If scrollbar is disabled, text will be restricted by the current height and succeeding /// lines won't be shown void setScrollBarAllowed(bool allowed); @@ -50,7 +50,7 @@ class ctrlMultiline : public Window bool msgMouseMove(const MouseCoords& mc) override; protected: - void Draw_() override; + void drawImpl() override; private: struct Line @@ -77,6 +77,6 @@ class ctrlMultiline : public Window /// Width of content as last calculated or 0 mutable unsigned cachedContentWidth; - void RecalcVisibleLines(); - void RecalcWrappedLines(); + void recalcVisibleLines(); + void recalcWrappedLines(); }; diff --git a/libs/s25main/controls/ctrlOptionGroup.cpp b/libs/s25main/controls/ctrlOptionGroup.cpp index e9576c7235..5c2152cb7e 100644 --- a/libs/s25main/controls/ctrlOptionGroup.cpp +++ b/libs/s25main/controls/ctrlOptionGroup.cpp @@ -22,7 +22,7 @@ void ctrlOptionGroup::setSelection(unsigned selection, bool notify) { case GroupSelectType::Illuminate: button->setIlluminated(false); break; case GroupSelectType::Check: button->setChecked(false); break; - case GroupSelectType::Show: button->setVisible(true); break; + case GroupSelectType::show: button->setVisible(true); break; } } @@ -33,7 +33,7 @@ void ctrlOptionGroup::setSelection(unsigned selection, bool notify) { case GroupSelectType::Illuminate: button->setIlluminated(true); break; case GroupSelectType::Check: button->setChecked(true); break; - case GroupSelectType::Show: button->setVisible(false); break; + case GroupSelectType::show: button->setVisible(false); break; } this->selection_ = selection; @@ -56,25 +56,25 @@ void ctrlOptionGroup::msgButtonClick(const unsigned ctrl_id) bool ctrlOptionGroup::msgLeftDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgLeftDown, mc); + return relayMouseMessage(&Window::msgLeftDown, mc); } bool ctrlOptionGroup::msgLeftUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgLeftUp, mc); + return relayMouseMessage(&Window::msgLeftUp, mc); } bool ctrlOptionGroup::msgWheelUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgWheelUp, mc); + return relayMouseMessage(&Window::msgWheelUp, mc); } bool ctrlOptionGroup::msgWheelDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgWheelDown, mc); + return relayMouseMessage(&Window::msgWheelDown, mc); } bool ctrlOptionGroup::msgMouseMove(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgMouseMove, mc); + return relayMouseMessage(&Window::msgMouseMove, mc); } diff --git a/libs/s25main/controls/ctrlPercent.cpp b/libs/s25main/controls/ctrlPercent.cpp index 7f8c4d30dd..97d645fe3b 100644 --- a/libs/s25main/controls/ctrlPercent.cpp +++ b/libs/s25main/controls/ctrlPercent.cpp @@ -17,7 +17,7 @@ ctrlPercent::ctrlPercent(Window* parent, unsigned id, const DrawPoint& pos, cons * * @return @p true bei Erfolg, @p false bei Fehler */ -void ctrlPercent::Draw_() +void ctrlPercent::drawImpl() { unsigned short percentage = getPercentage(); @@ -36,14 +36,14 @@ void ctrlPercent::Draw_() color = COLOR_0_PERCENT; // Box zeichnen - Draw3D(Rect(getDrawPos(), getSize()), tc, false); + draw3D(Rect(getDrawPos(), getSize()), tc, false); // Fortschritt zeichnen Extent progSize = getSize() - Extent(8, 8); progSize.x = (progSize.x * percentage) / 100; - DrawRectangle(Rect(getDrawPos() + DrawPoint(4, 4), progSize), color); + drawRectangle(Rect(getDrawPos() + DrawPoint(4, 4), progSize), color); // Text zeichnen std::string caption = helpers::toString(percentage) + "%"; - font->Draw(getDrawPos() + DrawPoint(getSize()) / 2, caption, FontStyle::CENTER | FontStyle::VCENTER, text_color); + font->draw(getDrawPos() + DrawPoint(getSize()) / 2, caption, FontStyle::CENTER | FontStyle::VCENTER, text_color); } diff --git a/libs/s25main/controls/ctrlPercent.h b/libs/s25main/controls/ctrlPercent.h index a3655a5e4c..9725d8448c 100644 --- a/libs/s25main/controls/ctrlPercent.h +++ b/libs/s25main/controls/ctrlPercent.h @@ -17,7 +17,7 @@ class ctrlPercent : public Window protected: /// Zeichenmethode. - void Draw_() override; + void drawImpl() override; private: TextureColor tc; diff --git a/libs/s25main/controls/ctrlPreviewMinimap.cpp b/libs/s25main/controls/ctrlPreviewMinimap.cpp index 96d0dbce3d..74e325bddd 100644 --- a/libs/s25main/controls/ctrlPreviewMinimap.cpp +++ b/libs/s25main/controls/ctrlPreviewMinimap.cpp @@ -18,16 +18,16 @@ ctrlPreviewMinimap::ctrlPreviewMinimap(Window* parent, const unsigned id, const /** * Zeichnet die MapPreview */ -void ctrlPreviewMinimap::Draw_() +void ctrlPreviewMinimap::drawImpl() { if(mapSize == Extent::all(0)) return; // Button drumrum zeichnen - Draw3DBorder(getBoundaryRect(), TextureColor::Grey, true); + draw3DBorder(getBoundaryRect(), TextureColor::Grey, true); // Map ansich zeichnen - DrawMap(minimap); + drawMap(minimap); const Extent playerPxlSize(4, 4); const DrawPoint basePos = getDrawPos(); @@ -36,7 +36,7 @@ void ctrlPreviewMinimap::Draw_() { // Spieler anwesend? if(player.pos.isValid()) - DrawRectangle(Rect(basePos + CalcMapCoord(player.pos), playerPxlSize), player.color); + drawRectangle(Rect(basePos + calcMapCoord(player.pos), playerPxlSize), player.color); } } @@ -50,7 +50,7 @@ Rect ctrlPreviewMinimap::getBoundaryRect() const void ctrlPreviewMinimap::setMap(const libsiedler2::ArchivItem_Map* const s2map) { for(auto& player : players) - player.pos = MapPoint::Invalid(); + player.pos = MapPoint::invalid(); if(!s2map) { setMapSize(Extent::all(0)); diff --git a/libs/s25main/controls/ctrlPreviewMinimap.h b/libs/s25main/controls/ctrlPreviewMinimap.h index b487428e6f..01abf2a6af 100644 --- a/libs/s25main/controls/ctrlPreviewMinimap.h +++ b/libs/s25main/controls/ctrlPreviewMinimap.h @@ -32,7 +32,7 @@ class ctrlPreviewMinimap : public ctrlMinimap libsiedler2::ArchivItem_Map* s2map); /// Zeichnet die MapPreview - void Draw_() override; + void drawImpl() override; Rect getBoundaryRect() const override; /// Setzt die (Start-)Farbe eines Spielers bzw. löscht diesen (color = 0) diff --git a/libs/s25main/controls/ctrlProgress.cpp b/libs/s25main/controls/ctrlProgress.cpp index 98a1a0c5c5..18fb7002c7 100644 --- a/libs/s25main/controls/ctrlProgress.cpp +++ b/libs/s25main/controls/ctrlProgress.cpp @@ -31,9 +31,9 @@ ctrlProgress::ctrlProgress(Window* parent, const unsigned id, const DrawPoint& p } Extent btSize = Extent::all(size.y); - AddImageButton(0, DrawPoint(0, 0), btSize, tc, LOADER.getImageN(btMinusRes, button_minus), + addImageButton(0, DrawPoint(0, 0), btSize, tc, LOADER.getImageN(btMinusRes, button_minus), (!button_minus_tooltip.empty() ? button_minus_tooltip : _("Less"))); - AddImageButton(1, DrawPoint(size.x - btSize.x, 0), btSize, tc, LOADER.getImageN(btPlusRes, button_plus), + addImageButton(1, DrawPoint(size.x - btSize.x, 0), btSize, tc, LOADER.getImageN(btPlusRes, button_plus), (!button_plus_tooltip.empty() ? button_plus_tooltip : _("More"))); // Hide left and right 3D border by making the buttons overlap the bar @@ -53,20 +53,20 @@ void ctrlProgress::setPosition(unsigned short position) * * @return @p true bei Erfolg, @p false bei Fehler */ -void ctrlProgress::Draw_() +void ctrlProgress::drawImpl() { DrawPoint barPos = getDrawPos() + DrawPoint(padding_); // Offset by button size barPos.x += getSize().y; - Extent barSize(CalcBarWidth(), getSize().y - 2 * padding_.y); - Draw3D(Rect(barPos, barSize), tc, false); + Extent barSize(calcBarWidth(), getSize().y - 2 * padding_.y); + draw3D(Rect(barPos, barSize), tc, false); // Buttons - Window::Draw_(); + Window::drawImpl(); const DrawPoint innerPadding(4, 4); unsigned percentage = position * 100 / maximum; - unsigned progress = (CalcBarWidth() - innerPadding.x * 2) * position / maximum; + unsigned progress = (calcBarWidth() - innerPadding.x * 2) * position / maximum; // Farbe herausfinden unsigned color = 0xFFD70000; @@ -86,26 +86,26 @@ void ctrlProgress::Draw_() } // Leiste - DrawRectangle(Rect(barPos + innerPadding, progress, getSize().y - 2 * (innerPadding.y + padding_.y)), color); + drawRectangle(Rect(barPos + innerPadding, progress, getSize().y - 2 * (innerPadding.y + padding_.y)), color); // Prozentzahlen zeichnen - SmallFont->Draw(getDrawPos() + DrawPoint(getSize()) / 2, std::to_string(percentage) + "%", + SmallFont->draw(getDrawPos() + DrawPoint(getSize()) / 2, std::to_string(percentage) + "%", FontStyle::CENTER | FontStyle::VCENTER, COLOR_YELLOW); } -void ctrlProgress::Resize(const Extent& newSize) +void ctrlProgress::resize(const Extent& newSize) { - Window::Resize(newSize); + Window::resize(newSize); auto* lessBt = getCtrl(0); auto* moreBt = getCtrl(1); Extent btSize(newSize.y, newSize.y); - lessBt->Resize(btSize); - moreBt->Resize(btSize); + lessBt->resize(btSize); + moreBt->resize(btSize); moreBt->setPos(DrawPoint(newSize.x - btSize.x, 0)); } -unsigned ctrlProgress::CalcBarWidth() const +unsigned ctrlProgress::calcBarWidth() const { return getSize().x - 2 * (padding_.x + getSize().y); } @@ -147,12 +147,12 @@ bool ctrlProgress::msgLeftDown(const MouseCoords& mc) getParent()->msgProgressChange(getID(), position); return true; } else - return RelayMouseMessage(&Window::msgLeftDown, mc); + return relayMouseMessage(&Window::msgLeftDown, mc); } bool ctrlProgress::msgLeftUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgLeftUp, mc); + return relayMouseMessage(&Window::msgLeftUp, mc); } bool ctrlProgress::msgWheelUp(const MouseCoords& mc) @@ -180,7 +180,7 @@ bool ctrlProgress::msgWheelDown(const MouseCoords& mc) bool ctrlProgress::msgMouseMove(const MouseCoords& mc) { // an Buttons weiterleiten - RelayMouseMessage(&Window::msgMouseMove, mc); + relayMouseMessage(&Window::msgMouseMove, mc); Extent offset(getSize().y + padding_.x, 0); DrawPoint rectOrig = getDrawPos() + DrawPoint(offset); diff --git a/libs/s25main/controls/ctrlProgress.h b/libs/s25main/controls/ctrlProgress.h index 0102c597b3..dd77ac285d 100644 --- a/libs/s25main/controls/ctrlProgress.h +++ b/libs/s25main/controls/ctrlProgress.h @@ -16,7 +16,7 @@ class ctrlProgress : public Window, public ctrlBaseTooltip unsigned force_color, const std::string& tooltip, const std::string& button_minus_tooltip = "", const std::string& button_plus_tooltip = "", unsigned short* write_val = nullptr); - void Resize(const Extent& newSize) override; + void resize(const Extent& newSize) override; void setPosition(unsigned short position); const unsigned short& getPosition() const { return position; } @@ -28,7 +28,7 @@ class ctrlProgress : public Window, public ctrlBaseTooltip bool msgMouseMove(const MouseCoords& mc) override; protected: - void Draw_() override; + void drawImpl() override; private: TextureColor tc; @@ -42,5 +42,5 @@ class ctrlProgress : public Window, public ctrlBaseTooltip /// Falls der Balken immer eine bestimmte Farben haben soll, ansonsten 0 setzen! unsigned force_color; - unsigned CalcBarWidth() const; + unsigned calcBarWidth() const; }; diff --git a/libs/s25main/controls/ctrlScrollBar.cpp b/libs/s25main/controls/ctrlScrollBar.cpp index 40ecbadeb8..f0855a56e3 100644 --- a/libs/s25main/controls/ctrlScrollBar.cpp +++ b/libs/s25main/controls/ctrlScrollBar.cpp @@ -15,14 +15,14 @@ ctrlScrollBar::ctrlScrollBar(Window* parent, unsigned id, const DrawPoint& pos, { setVisible(false); - AddImageButton(0, DrawPoint(0, 0), Extent(size.x, button_height), tc, LOADER.getImageN("io", 33)); - AddImageButton(1, DrawPoint(0, (size.y > button_height) ? size.y - button_height : 1), + addImageButton(0, DrawPoint(0, 0), Extent(size.x, button_height), tc, LOADER.getImageN("io", 33)); + addImageButton(1, DrawPoint(0, (size.y > button_height) ? size.y - button_height : 1), Extent(size.x, button_height), tc, LOADER.getImageN("io", 34)); - Resize(size); + resize(size); } -void ctrlScrollBar::Scroll(int distance) +void ctrlScrollBar::scroll(int distance) { if(distance == 0 || scroll_range == 0) return; @@ -36,7 +36,7 @@ void ctrlScrollBar::Scroll(int distance) if(scroll_pos != static_cast(newScrollPos)) { scroll_pos = static_cast(newScrollPos); - UpdateSliderFromPos(); + updateSliderFromPos(); getParent()->msgScrollChange(getID(), scroll_pos); } } @@ -46,7 +46,7 @@ bool ctrlScrollBar::msgLeftUp(const MouseCoords& mc) isMouseScrolling = false; // ButtonMessages weiterleiten - return RelayMouseMessage(&Window::msgLeftUp, mc); + return relayMouseMessage(&Window::msgLeftUp, mc); } bool ctrlScrollBar::msgLeftDown(const MouseCoords& mc) @@ -65,7 +65,7 @@ bool ctrlScrollBar::msgLeftDown(const MouseCoords& mc) else sliderPos -= sliderHeight / 2; - UpdatePosFromSlider(); + updatePosFromSlider(); return true; } else { @@ -83,12 +83,12 @@ bool ctrlScrollBar::msgLeftDown(const MouseCoords& mc) sliderPos = scroll_height - sliderHeight; } - UpdatePosFromSlider(); + updatePosFromSlider(); return true; } } - return RelayMouseMessage(&Window::msgLeftDown, mc); + return relayMouseMessage(&Window::msgLeftDown, mc); } bool ctrlScrollBar::msgMouseMove(const MouseCoords& mc) @@ -100,12 +100,12 @@ bool ctrlScrollBar::msgMouseMove(const MouseCoords& mc) if(sliderPos + sliderHeight > scroll_height) sliderPos = moveDist < 0 ? 0 : (scroll_height - sliderHeight); - UpdatePosFromSlider(); + updatePosFromSlider(); } last_y = mc.pos.y; // ButtonMessages weiterleiten - return RelayMouseMessage(&Window::msgMouseMove, mc); + return relayMouseMessage(&Window::msgMouseMove, mc); } void ctrlScrollBar::msgButtonClick(const unsigned ctrl_id) @@ -113,10 +113,10 @@ void ctrlScrollBar::msgButtonClick(const unsigned ctrl_id) switch(ctrl_id) { case 0: // Upwards - Scroll(-1); + scroll(-1); break; case 1: // Downwards - Scroll(+1); + scroll(+1); break; } } @@ -129,7 +129,7 @@ void ctrlScrollBar::setScrollPos(unsigned short scroll_pos) if(this->scroll_pos != scroll_pos) { this->scroll_pos = scroll_pos; - UpdateSliderFromPos(); + updateSliderFromPos(); } } @@ -141,7 +141,7 @@ void ctrlScrollBar::setRange(unsigned short scroll_range) if(this->scroll_range != scroll_range) { this->scroll_range = scroll_range; - RecalculateSizes(); + recalculateSizes(); } } @@ -153,20 +153,20 @@ void ctrlScrollBar::setPageSize(unsigned short pagesize) if(this->pagesize != pagesize) { this->pagesize = pagesize; - RecalculateSizes(); + recalculateSizes(); } } -void ctrlScrollBar::Resize(const Extent& newSize) +void ctrlScrollBar::resize(const Extent& newSize) { - Window::Resize(newSize); + Window::resize(newSize); // Up button Extent btSize = Extent(newSize.x, button_height); - getCtrl(0)->Resize(btSize); + getCtrl(0)->resize(btSize); // Down button auto* downButton = getCtrl(1); - downButton->Resize(btSize); + downButton->resize(btSize); if(newSize.y >= button_height) { @@ -175,7 +175,7 @@ void ctrlScrollBar::Resize(const Extent& newSize) } else downButton->setVisible(false); - RecalculateSizes(); + recalculateSizes(); } /** @@ -183,23 +183,23 @@ void ctrlScrollBar::Resize(const Extent& newSize) * * @return @p true bei Erfolg, @p false bei Fehler */ -void ctrlScrollBar::Draw_() +void ctrlScrollBar::drawImpl() { RTTR_Assert(scroll_range > pagesize); // Don't show unneccessary scrollbars, otherwise invariants might be violated. if(scroll_height == 0) return; DrawPoint pos = getDrawPos(); // Leiste - Draw3D(Rect(pos + DrawPoint(0, button_height - 2), getSize().x, getSize().y - button_height * 2 + 4), tc, false); + draw3D(Rect(pos + DrawPoint(0, button_height - 2), getSize().x, getSize().y - button_height * 2 + 4), tc, false); // Buttons - Window::Draw_(); + Window::drawImpl(); // Scrollbar - Draw3D(Rect(pos + DrawPoint(0, button_height + sliderPos), getSize().x, sliderHeight), tc, true); + draw3D(Rect(pos + DrawPoint(0, button_height + sliderPos), getSize().x, sliderHeight), tc, true); } -void ctrlScrollBar::UpdatePosFromSlider() +void ctrlScrollBar::updatePosFromSlider() { RTTR_Assert(sliderPos + sliderHeight <= scroll_height); // Slider must be inside bar unsigned short newScrollPos = (sliderPos * scroll_range) / scroll_height; @@ -211,7 +211,7 @@ void ctrlScrollBar::UpdatePosFromSlider() } } -void ctrlScrollBar::UpdateSliderFromPos() +void ctrlScrollBar::updateSliderFromPos() { if(scroll_pos + pagesize >= scroll_range) sliderPos = scroll_height - sliderHeight; @@ -222,7 +222,7 @@ void ctrlScrollBar::UpdateSliderFromPos() /** * berechnet die Werte für die Scrollbar. */ -void ctrlScrollBar::RecalculateSizes() +void ctrlScrollBar::recalculateSizes() { scroll_height = ((getSize().y > 2u * button_height) ? getSize().y - 2u * button_height : 0); @@ -230,7 +230,7 @@ void ctrlScrollBar::RecalculateSizes() { sliderHeight = (scroll_height * pagesize) / scroll_range; - UpdateSliderFromPos(); + updateSliderFromPos(); if(!isVisible()) { diff --git a/libs/s25main/controls/ctrlScrollBar.h b/libs/s25main/controls/ctrlScrollBar.h index 95f8034437..c63c54e636 100644 --- a/libs/s25main/controls/ctrlScrollBar.h +++ b/libs/s25main/controls/ctrlScrollBar.h @@ -12,7 +12,7 @@ class ctrlScrollBar final : public Window public: ctrlScrollBar(Window* parent, unsigned id, const DrawPoint& pos, const Extent& size, unsigned short button_height, TextureColor tc, unsigned short pagesize); - void Resize(const Extent& newSize) override; + void resize(const Extent& newSize) override; void setScrollPos(unsigned short scroll_pos); void setRange(unsigned short scroll_range); void setPageSize(unsigned short pagesize); @@ -20,7 +20,7 @@ class ctrlScrollBar final : public Window unsigned short getPageSize() const { return pagesize; } unsigned short getScrollPos() const { return scroll_pos; } /// Scrolls by the given distance (less than 0 = up, else down) - void Scroll(int distance); + void scroll(int distance); bool msgLeftUp(const MouseCoords& mc) override; bool msgLeftDown(const MouseCoords& mc) override; @@ -28,12 +28,12 @@ class ctrlScrollBar final : public Window void msgButtonClick(unsigned ctrl_id) override; protected: - void Draw_() override; + void drawImpl() override; private: - void UpdatePosFromSlider(); - void UpdateSliderFromPos(); - void RecalculateSizes(); + void updatePosFromSlider(); + void updateSliderFromPos(); + void recalculateSizes(); unsigned short button_height; TextureColor tc; diff --git a/libs/s25main/controls/ctrlTab.cpp b/libs/s25main/controls/ctrlTab.cpp index 37e9e3c420..0e95bff683 100644 --- a/libs/s25main/controls/ctrlTab.cpp +++ b/libs/s25main/controls/ctrlTab.cpp @@ -20,40 +20,40 @@ void ctrlTab::msgButtonClick(const unsigned ctrl_id) bool ctrlTab::msgLeftDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgLeftDown, mc); + return relayMouseMessage(&Window::msgLeftDown, mc); } bool ctrlTab::msgLeftUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgLeftUp, mc); + return relayMouseMessage(&Window::msgLeftUp, mc); } bool ctrlTab::msgWheelUp(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgWheelUp, mc); + return relayMouseMessage(&Window::msgWheelUp, mc); } bool ctrlTab::msgWheelDown(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgWheelDown, mc); + return relayMouseMessage(&Window::msgWheelDown, mc); } bool ctrlTab::msgMouseMove(const MouseCoords& mc) { - return RelayMouseMessage(&Window::msgMouseMove, mc); + return relayMouseMessage(&Window::msgMouseMove, mc); } /** * fügt eine Tab hinzu. */ -ctrlGroup* ctrlTab::AddTab(glArchivItem_Bitmap* image, const std::string& tooltip, const unsigned id) +ctrlGroup* ctrlTab::addTab(glArchivItem_Bitmap* image, const std::string& tooltip, const unsigned id) { if(tab_count < tabs.size()) { - if(AddImageButton(tab_count, DrawPoint(36 * tab_count, 0), Extent(36, 45), TextureColor::Red1, image, tooltip)) + if(addImageButton(tab_count, DrawPoint(36 * tab_count, 0), Extent(36, 45), TextureColor::Red1, image, tooltip)) { tabs[tab_count++] = id; - ctrlGroup* group = AddGroup(tabs.size() + 1 + id); + ctrlGroup* group = addGroup(tabs.size() + 1 + id); group->setVisible(false); return group; @@ -66,10 +66,10 @@ ctrlGroup* ctrlTab::AddTab(glArchivItem_Bitmap* image, const std::string& toolti /** * löscht alle Tabs. */ -void ctrlTab::DeleteAllTabs() +void ctrlTab::deleteAllTabs() { for(unsigned i = 0; i < tab_count; ++i) - DeleteCtrl(i); + deleteCtrl(i); tab_selection = 0; tab_count = 0; @@ -121,20 +121,20 @@ ctrlGroup* ctrlTab::getGroup(const unsigned tab_id) * * @return @p true bei Erfolg, @p false bei Fehler */ -void ctrlTab::Draw_() +void ctrlTab::drawImpl() { - Window::Draw_(); + Window::drawImpl(); // TODO: What is this really? int headerSize = tab_count * 36; - LOADER.getImageN("io", 3)->DrawPart( + LOADER.getImageN("io", 3)->drawPart( Rect(getDrawPos() + DrawPoint(headerSize, 0), Extent(getSize().x - headerSize, 45))); - Draw3D(Rect(getDrawPos() + DrawPoint(0, 32), Extent(getSize().x, 13)), TextureColor::Green1, true); + draw3D(Rect(getDrawPos() + DrawPoint(0, 32), Extent(getSize().x, 13)), TextureColor::Green1, true); auto* button = getCtrl(tab_selection); if(button) - button->Draw(); + button->draw(); } void ctrlTab::msgGroupButtonClick(const unsigned /*group_id*/, const unsigned ctrl_id) diff --git a/libs/s25main/controls/ctrlTab.h b/libs/s25main/controls/ctrlTab.h index e8c0c125de..25504f0de8 100644 --- a/libs/s25main/controls/ctrlTab.h +++ b/libs/s25main/controls/ctrlTab.h @@ -17,9 +17,9 @@ class ctrlTab : public Window ctrlTab(Window* parent, unsigned id, const DrawPoint& pos, unsigned short width); /// fügt eine Tab hinzu. - ctrlGroup* AddTab(glArchivItem_Bitmap* image, const std::string& tooltip, unsigned id); + ctrlGroup* addTab(glArchivItem_Bitmap* image, const std::string& tooltip, unsigned id); /// löscht alle Tabs. - void DeleteAllTabs(); + void deleteAllTabs(); /// aktiviert eine bestimmte Tabseite. void setSelection(unsigned short nr, bool notify = false); /// Gibt ID des aktuell gewählten Tabs zurück @@ -54,7 +54,7 @@ class ctrlTab : public Window bool msgMouseMove(const MouseCoords& mc) override; protected: - void Draw_() override; + void drawImpl() override; private: unsigned short tab_count; diff --git a/libs/s25main/controls/ctrlTable.cpp b/libs/s25main/controls/ctrlTable.cpp index bc395f3402..2d8eb8f743 100644 --- a/libs/s25main/controls/ctrlTable.cpp +++ b/libs/s25main/controls/ctrlTable.cpp @@ -137,23 +137,23 @@ ctrlTable::ctrlTable(Window* parent, unsigned id, const DrawPoint& pos, const Ex line_count = (getSize().y - header_height - 2) / font->getHeight(); // Scrollbar hinzufügen - AddScrollBar(0, DrawPoint(getSize().x - 20, 0), Extent(20, getSize().y), 20, tc, line_count); + addScrollBar(0, DrawPoint(getSize().x - 20, 0), Extent(20, getSize().y), 20, tc, line_count); for(unsigned i = 0; i < columns_.size(); ++i) { - AddTextButton(i + 1, DrawPoint(0, 0), Extent(0, header_height), tc, columns_[i].title, font); + addTextButton(i + 1, DrawPoint(0, 0), Extent(0, header_height), tc, columns_[i].title, font); } - ResetButtonWidths(); + resetButtonWidths(); } /** * Größe verändern */ -void ctrlTable::Resize(const Extent& newSize) +void ctrlTable::resize(const Extent& newSize) { const bool heightIncreased = newSize.y > getSize().y; - Window::Resize(newSize); + Window::resize(newSize); // Make header buttons keep their size for(unsigned i = 1; i <= columns_.size(); ++i) getCtrl(i)->setHeight(header_height); @@ -162,7 +162,7 @@ void ctrlTable::Resize(const Extent& newSize) // changed height - scrollbar->Resize(Extent(20, newSize.y)); + scrollbar->resize(Extent(20, newSize.y)); scrollbar->setPos(DrawPoint(newSize.x - scrollbar->getSize().x, 0)); line_count = (newSize.y - header_height - 2) / font->getHeight(); @@ -176,7 +176,7 @@ void ctrlTable::Resize(const Extent& newSize) // changed width - ResetButtonWidths(); + resetButtonWidths(); if(scrollbar->isVisible()) msgScrollShow(0, true); } @@ -184,7 +184,7 @@ void ctrlTable::Resize(const Extent& newSize) /** * löscht alle Items. */ -void ctrlTable::DeleteAllItems() +void ctrlTable::deleteAllItems() { rows_.clear(); @@ -221,7 +221,7 @@ void ctrlTable::setSelection(const std::optional& selection) getParent()->msgTableSelectItem(getID(), selection_); } -void ctrlTable::AddRow(std::vector row) +void ctrlTable::addRow(std::vector row) { // We use unsigned short when handling the row count if(rows_.size() == std::numeric_limits::max()) @@ -237,7 +237,7 @@ void ctrlTable::AddRow(std::vector row) getCtrl(0)->setRange(getNumRows()); } -void ctrlTable::RemoveRow(unsigned rowIdx) +void ctrlTable::removeRow(unsigned rowIdx) { if(rowIdx >= rows_.size()) return; @@ -278,7 +278,7 @@ const std::string& ctrlTable::getItemText(unsigned short row, unsigned short col * @p true - A-Z, * @p false - Z-A */ -void ctrlTable::SortRows(unsigned column, const TableSortDir sortDir) +void ctrlTable::sortRows(unsigned column, const TableSortDir sortDir) { sortDir_ = sortDir; sortColumn_ = column; @@ -304,11 +304,11 @@ void ctrlTable::SortRows(unsigned column, const TableSortDir sortDir) * * @return @p true bei Erfolg, @p false bei Fehler */ -void ctrlTable::Draw_() +void ctrlTable::drawImpl() { - Draw3D(Rect(getDrawPos(), getSize()), tc, false); + draw3D(Rect(getDrawPos(), getSize()), tc, false); - Window::Draw_(); + Window::drawImpl(); const auto lines = static_cast(line_count > rows_.size() ? rows_.size() : line_count); const auto* scroll = getCtrl(0); @@ -321,7 +321,7 @@ void ctrlTable::Draw_() if(isSelected) { // durchsichtig schwarze Markierung malen - DrawRectangle(Rect(curPos, getSize().x - 4 - (scroll->isVisible() ? 24 : 0), font->getHeight()), + drawRectangle(Rect(curPos, getSize().x - 4 - (scroll->isVisible() ? 24 : 0), font->getHeight()), 0x80000000); } @@ -332,7 +332,7 @@ void ctrlTable::Draw_() continue; const auto* bt = getCtrl(c + 1); - font->Draw(colPos, rows_[curRow].columns[c], FontStyle{}, (isSelected ? 0xFFFFAA00 : COLOR_YELLOW), + font->draw(colPos, rows_[curRow].columns[c], FontStyle{}, (isSelected ? 0xFFFFAA00 : COLOR_YELLOW), bt->getSize().x, ""); colPos.x += bt->getSize().x; } @@ -344,7 +344,7 @@ void ctrlTable::msgButtonClick(const unsigned ctrl_id) { RTTR_Assert(ctrl_id > 0); const int column = ctrl_id - 1; - SortRows(column, column == getSortColumn() && getSortDirection() == TableSortDir::Ascending ? + sortRows(column, column == getSortColumn() && getSortDirection() == TableSortDir::Ascending ? TableSortDir::Descending : TableSortDir::Ascending); setSelection(selection_); @@ -375,7 +375,7 @@ bool ctrlTable::msgLeftDown(const MouseCoords& mc) return true; } else - return RelayMouseMessage(&Window::msgLeftDown, mc); + return relayMouseMessage(&Window::msgLeftDown, mc); } bool ctrlTable::msgRightDown(const MouseCoords& mc) @@ -388,7 +388,7 @@ bool ctrlTable::msgRightDown(const MouseCoords& mc) return true; } else - return RelayMouseMessage(&Window::msgRightDown, mc); + return relayMouseMessage(&Window::msgRightDown, mc); } std::optional ctrlTable::getSelectionFromMouse(const MouseCoords& mc) const @@ -408,7 +408,7 @@ bool ctrlTable::msgWheelUp(const MouseCoords& mc) if(IsPointInRect(mc.pos, getFullDrawArea())) { auto* scrollbar = getCtrl(0); - scrollbar->Scroll(-1); + scrollbar->scroll(-1); return true; } else return false; @@ -419,7 +419,7 @@ bool ctrlTable::msgWheelDown(const MouseCoords& mc) if(IsPointInRect(mc.pos, getFullDrawArea())) { auto* scrollbar = getCtrl(0); - scrollbar->Scroll(+1); + scrollbar->scroll(+1); return true; } else return false; @@ -440,21 +440,21 @@ bool ctrlTable::msgLeftUp(const MouseCoords& mc) } } } - return RelayMouseMessage(&Window::msgLeftUp, mc); + return relayMouseMessage(&Window::msgLeftUp, mc); } bool ctrlTable::msgMouseMove(const MouseCoords& mc) { // ButtonMessages weiterleiten - return RelayMouseMessage(&Window::msgMouseMove, mc); + return relayMouseMessage(&Window::msgMouseMove, mc); } void ctrlTable::msgScrollShow(const unsigned /*ctrl_id*/, const bool /*visible*/) { - ResetButtonWidths(); + resetButtonWidths(); } -void ctrlTable::ResetButtonWidths() +void ctrlTable::resetButtonWidths() { auto addColumnWidth = [](unsigned cur, const Column& c) { return cur + c.width; }; const unsigned sumWidth = std::max(1u, std::accumulate(columns_.begin(), columns_.end(), 0u, addColumnWidth)); diff --git a/libs/s25main/controls/ctrlTable.h b/libs/s25main/controls/ctrlTable.h index 6c6413a100..bd0a840c27 100644 --- a/libs/s25main/controls/ctrlTable.h +++ b/libs/s25main/controls/ctrlTable.h @@ -46,16 +46,16 @@ class ctrlTable : public Window ctrlTable(Window* parent, unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font, Columns columns); - void Resize(const Extent& newSize) override; + void resize(const Extent& newSize) override; /// löscht alle Items. - void DeleteAllItems(); + void deleteAllItems(); /// fügt eine Zeile hinzu. - void AddRow(std::vector row); - void RemoveRow(unsigned rowIdx); + void addRow(std::vector row); + void removeRow(unsigned rowIdx); /// liefert den Wert eines Feldes. const std::string& getItemText(unsigned short row, unsigned short column) const; /// sortiert die Zeilen. - void SortRows(unsigned column, TableSortDir sortDir); + void sortRows(unsigned column, TableSortDir sortDir); int getSortColumn() const { return sortColumn_; } TableSortDir getSortDirection() const { return sortDir_; } unsigned short getNumRows() const { return static_cast(rows_.size()); } @@ -74,10 +74,10 @@ class ctrlTable : public Window bool msgKeyDown(const KeyEvent& ke) override; protected: - void Draw_() override; + void drawImpl() override; /// Setzt die Breite und Position der Buttons ohne Scrolleiste - void ResetButtonWidths(); + void resetButtonWidths(); std::optional getSelectionFromMouse(const MouseCoords& mc) const; /// Get the area of the content (table itself w/o header) Rect getContentDrawArea() const; diff --git a/libs/s25main/controls/ctrlText.cpp b/libs/s25main/controls/ctrlText.cpp index 8f5ce5b1a3..2d76a32255 100644 --- a/libs/s25main/controls/ctrlText.cpp +++ b/libs/s25main/controls/ctrlText.cpp @@ -40,8 +40,8 @@ Rect ctrlText::getBoundaryRect() const } } -void ctrlText::Draw_() +void ctrlText::drawImpl() { if(!text.empty()) - font->Draw(getDrawPos(), text, format_, color_, maxWidth_); + font->draw(getDrawPos(), text, format_, color_, maxWidth_); } diff --git a/libs/s25main/controls/ctrlText.h b/libs/s25main/controls/ctrlText.h index a3e4773b3c..55aeeff2c8 100644 --- a/libs/s25main/controls/ctrlText.h +++ b/libs/s25main/controls/ctrlText.h @@ -20,7 +20,7 @@ class ctrlText : public Window, public ctrlBaseText void setMaxWidth(unsigned short maxWidth) { maxWidth_ = maxWidth; } protected: - void Draw_() override; + void drawImpl() override; FontStyle format_; unsigned short maxWidth_; diff --git a/libs/s25main/controls/ctrlTextButton.cpp b/libs/s25main/controls/ctrlTextButton.cpp index f0776e80b7..c9ad1b3fce 100644 --- a/libs/s25main/controls/ctrlTextButton.cpp +++ b/libs/s25main/controls/ctrlTextButton.cpp @@ -15,13 +15,13 @@ ctrlTextButton::ctrlTextButton(Window* parent, unsigned id, const DrawPoint& pos : ctrlButton(parent, id, pos, size, tc, tooltip), ctrlBaseText(text, COLOR_YELLOW, font) {} -void ctrlTextButton::ResizeForMaxChars(unsigned numChars) +void ctrlTextButton::resizeForMaxChars(unsigned numChars) { const auto maxTextWidth = font->getDx() * numChars; - Resize(Extent(maxTextWidth + contentOffset * 2, getSize().y)); + resize(Extent(maxTextWidth + contentOffset * 2, getSize().y)); } -void ctrlTextButton::DrawContent() const +void ctrlTextButton::drawContent() const { const bool isPressed = state == ButtonState::Pressed || isChecked; unsigned color; @@ -39,10 +39,10 @@ void ctrlTextButton::DrawContent() const unsigned maxNumChars; font->getWidth(text, maxTextWidth, &maxNumChars); if(maxNumChars < text.length()) - ShowTooltip(text); + showTooltip(text); } const unsigned short offset = isPressed ? contentOffset : 0; - font->Draw(getDrawPos() + getSize() / 2u + DrawPoint(offset, offset), text, FontStyle::CENTER | FontStyle::VCENTER, + font->draw(getDrawPos() + getSize() / 2u + DrawPoint(offset, offset), text, FontStyle::CENTER | FontStyle::VCENTER, color, maxTextWidth); } diff --git a/libs/s25main/controls/ctrlTextButton.h b/libs/s25main/controls/ctrlTextButton.h index 8a6eadb000..05c1623292 100644 --- a/libs/s25main/controls/ctrlTextButton.h +++ b/libs/s25main/controls/ctrlTextButton.h @@ -15,9 +15,9 @@ class ctrlTextButton : public ctrlButton, public ctrlBaseText const std::string& text, const glFont* font, const std::string& tooltip); /// Changes width so at most this many chars can be shown - void ResizeForMaxChars(unsigned numChars); + void resizeForMaxChars(unsigned numChars); protected: /// Draw actual content (text here) - void DrawContent() const override; + void drawContent() const override; }; diff --git a/libs/s25main/controls/ctrlTextDeepening.cpp b/libs/s25main/controls/ctrlTextDeepening.cpp index de8e73172a..dda6ccf250 100644 --- a/libs/s25main/controls/ctrlTextDeepening.cpp +++ b/libs/s25main/controls/ctrlTextDeepening.cpp @@ -13,7 +13,7 @@ ctrlTextDeepening::ctrlTextDeepening(Window* parent, unsigned id, DrawPoint pos, Rect ctrlTextDeepening::getBoundaryRect() const { - const Rect txtRect = font->getBounds(CalcTextPos(), text, style_); + const Rect txtRect = font->getBounds(calcTextPos(), text, style_); const Rect parentRect = ctrlDeepening::getBoundaryRect(); Rect result; result.left = std::min(txtRect.left, parentRect.left); @@ -23,7 +23,7 @@ Rect ctrlTextDeepening::getBoundaryRect() const return result; } -DrawPoint ctrlTextDeepening::CalcTextPos() const +DrawPoint ctrlTextDeepening::calcTextPos() const { DrawPoint pos = getDrawPos(); if(style_.is(FontStyle::CENTER)) @@ -41,13 +41,13 @@ DrawPoint ctrlTextDeepening::CalcTextPos() const return pos; } -void ctrlTextDeepening::ResizeForMaxChars(unsigned numChars) +void ctrlTextDeepening::resizeForMaxChars(unsigned numChars) { const auto maxTextWidth = font->getDx() * numChars; - Resize(Extent(maxTextWidth + borderSize.x * 2, getSize().y)); + resize(Extent(maxTextWidth + borderSize.x * 2, getSize().y)); } -void ctrlTextDeepening::DrawContent() const +void ctrlTextDeepening::drawContent() const { - font->Draw(CalcTextPos(), text, style_, color_, getSize().x - 2 * ctrlTextDeepening::borderSize.x); + font->draw(calcTextPos(), text, style_, color_, getSize().x - 2 * ctrlTextDeepening::borderSize.x); } diff --git a/libs/s25main/controls/ctrlTextDeepening.h b/libs/s25main/controls/ctrlTextDeepening.h index d8ac1c7ec6..bd242eb6f7 100644 --- a/libs/s25main/controls/ctrlTextDeepening.h +++ b/libs/s25main/controls/ctrlTextDeepening.h @@ -19,12 +19,12 @@ class ctrlTextDeepening : public ctrlDeepening, public ctrlBaseText Rect getBoundaryRect() const override; /// Changes width so at most this many chars can be shown - void ResizeForMaxChars(unsigned numChars); + void resizeForMaxChars(unsigned numChars); protected: - void DrawContent() const override; + void drawContent() const override; private: - DrawPoint CalcTextPos() const; + DrawPoint calcTextPos() const; FontStyle style_; }; diff --git a/libs/s25main/controls/ctrlTimer.cpp b/libs/s25main/controls/ctrlTimer.cpp index c7940a2215..9dd947edf6 100644 --- a/libs/s25main/controls/ctrlTimer.cpp +++ b/libs/s25main/controls/ctrlTimer.cpp @@ -13,13 +13,13 @@ ctrlTimer::ctrlTimer(Window* parent, unsigned id, std::chrono::milliseconds time /** * start the timer */ -void ctrlTimer::Start(std::chrono::milliseconds timeout) +void ctrlTimer::start(std::chrono::milliseconds timeout) { timeout_ = timeout; - Start(); + start(); } -void ctrlTimer::Start() +void ctrlTimer::start() { timer_.restart(); } @@ -27,7 +27,7 @@ void ctrlTimer::Start() /** * stop the timer */ -void ctrlTimer::Stop() +void ctrlTimer::stop() { timer_.stop(); } diff --git a/libs/s25main/controls/ctrlTimer.h b/libs/s25main/controls/ctrlTimer.h index b041766391..4b978f05d8 100644 --- a/libs/s25main/controls/ctrlTimer.h +++ b/libs/s25main/controls/ctrlTimer.h @@ -12,16 +12,16 @@ class ctrlTimer : public Window public: ctrlTimer(Window* parent, unsigned id, std::chrono::milliseconds timeout); - void Start(); - void Start(std::chrono::milliseconds timeout); - void Stop(); + void start(); + void start(std::chrono::milliseconds timeout); + void stop(); bool isRunning() const { return timer_.isRunning(); } Timer::duration getElapsed() const { return timer_.getElapsed(); } void msgPaintBefore() override; protected: - void Draw_() override{}; + void drawImpl() override{}; private: std::chrono::milliseconds timeout_; diff --git a/libs/s25main/controls/ctrlVarDeepening.cpp b/libs/s25main/controls/ctrlVarDeepening.cpp index 7010577699..524cc33335 100644 --- a/libs/s25main/controls/ctrlVarDeepening.cpp +++ b/libs/s25main/controls/ctrlVarDeepening.cpp @@ -12,7 +12,7 @@ ctrlVarDeepening::ctrlVarDeepening(Window* parent, unsigned id, const DrawPoint& : ctrlDeepening(parent, id, pos, size, tc), ctrlBaseVarText(fmtString, color, font, count, fmtArgs) {} -void ctrlVarDeepening::DrawContent() const +void ctrlVarDeepening::drawContent() const { - font->Draw(getDrawPos() + getSize() / 2, getFormatedText(), FontStyle::CENTER | FontStyle::VCENTER, color_); + font->draw(getDrawPos() + getSize() / 2, getFormatedText(), FontStyle::CENTER | FontStyle::VCENTER, color_); } diff --git a/libs/s25main/controls/ctrlVarDeepening.h b/libs/s25main/controls/ctrlVarDeepening.h index 7ba0e2d555..a0e917fd5d 100644 --- a/libs/s25main/controls/ctrlVarDeepening.h +++ b/libs/s25main/controls/ctrlVarDeepening.h @@ -19,5 +19,5 @@ class ctrlVarDeepening : public ctrlDeepening, public ctrlBaseVarText const std::string& fmtString, const glFont* font, unsigned color, unsigned count, va_list fmtArgs); protected: - void DrawContent() const override; + void drawContent() const override; }; diff --git a/libs/s25main/controls/ctrlVarText.cpp b/libs/s25main/controls/ctrlVarText.cpp index 8e74ebd11e..7e92013430 100644 --- a/libs/s25main/controls/ctrlVarText.cpp +++ b/libs/s25main/controls/ctrlVarText.cpp @@ -31,7 +31,7 @@ Rect ctrlVarText::getBoundaryRect() const return font->getBounds(getDrawPos(), getFormatedText(), format_); } -void ctrlVarText::Draw_() +void ctrlVarText::drawImpl() { - font->Draw(getDrawPos(), getFormatedText(), format_, color_); + font->draw(getDrawPos(), getFormatedText(), format_, color_); } diff --git a/libs/s25main/controls/ctrlVarText.h b/libs/s25main/controls/ctrlVarText.h index 612fc00db8..85e9866e2c 100644 --- a/libs/s25main/controls/ctrlVarText.h +++ b/libs/s25main/controls/ctrlVarText.h @@ -23,7 +23,7 @@ class ctrlVarText : public Window, public ctrlBaseVarText Rect getBoundaryRect() const override; protected: - void Draw_() override; + void drawImpl() override; FontStyle format_; }; diff --git a/libs/s25main/customborderbuilder.cpp b/libs/s25main/customborderbuilder.cpp index b87341ad24..32eb35452e 100644 --- a/libs/s25main/customborderbuilder.cpp +++ b/libs/s25main/customborderbuilder.cpp @@ -59,7 +59,7 @@ int CustomBorderBuilder::loadEdges(const libsiedler2::Archiv& archiveInfo) // palette = dynamic_cast(archiveInfo[4])->getPalette(); // 640x480 { - Bitmap2BdrBitmap(dynamic_cast(*archiveInfo[4]), tempBMP); + bitmap2BdrBitmap(dynamic_cast(*archiveInfo[4]), tempBMP); corners[0] = tempBMP.get(ImgPos(0, 0), Extent(584, 12)); corners[1] = tempBMP.get(ImgPos(584, 0), Extent(56, 12)); corners[2] = tempBMP.get(ImgPos(0, 468), Extent(202, 12)); @@ -76,7 +76,7 @@ int CustomBorderBuilder::loadEdges(const libsiedler2::Archiv& archiveInfo) } // 800x600 { - Bitmap2BdrBitmap(dynamic_cast(*archiveInfo[7]), tempBMP); + bitmap2BdrBitmap(dynamic_cast(*archiveInfo[7]), tempBMP); edgesTop[0] = tempBMP.get(ImgPos(584, 0), Extent(160, 12)); edgesBottom[0] = tempBMP.get(ImgPos(508, 588), Extent(160, 12)); edgesLeft[0] = tempBMP.get(ImgPos(0, 364), Extent(12, 120)); @@ -85,7 +85,7 @@ int CustomBorderBuilder::loadEdges(const libsiedler2::Archiv& archiveInfo) } // 1024x768 { - Bitmap2BdrBitmap(dynamic_cast(*archiveInfo[10]), tempBMP); + bitmap2BdrBitmap(dynamic_cast(*archiveInfo[10]), tempBMP); edgesTop[1] = tempBMP.get(ImgPos(644, 0), Extent(224, 12)); edgesBottom[1] = tempBMP.get(ImgPos(668, 756), Extent(224, 12)); edgesLeft[1] = tempBMP.get(ImgPos(0, 484), Extent(12, 168)); @@ -108,13 +108,13 @@ int CustomBorderBuilder::loadEdges(const libsiedler2::Archiv& archiveInfo) // 1280x1024 links { BdrBitmap pic1(Extent(640, 1024)); - Bitmap2BdrBitmap(dynamic_cast(*archiveInfo[13]), pic1); + bitmap2BdrBitmap(dynamic_cast(*archiveInfo[13]), pic1); tempBMP.put(ImgPos(0, 0), pic1); } // und rechts { BdrBitmap pic2(Extent(640, 1024)); - Bitmap2BdrBitmap(dynamic_cast(*archiveInfo[14]), pic2); + bitmap2BdrBitmap(dynamic_cast(*archiveInfo[14]), pic2); tempBMP.put(ImgPos(pic2.size.x, 0), pic2); edgesTop[2] = tempBMP.get(ImgPos(968, 0), Extent(256, 12)); edgesBottom[2] = tempBMP.get(ImgPos(892, 1012), Extent(256, 12)); @@ -169,16 +169,16 @@ int CustomBorderBuilder::buildBorder(const Extent& size, std::arrayinit(customEdges[i].size.x, customEdges[i].size.y, libsiedler2::TextureFormat::Paletted, &palette); - BdrBitmap2Bitmap(customEdges[i], *customEdgeBmp); + bdrBitmap2Bitmap(customEdges[i], *customEdgeBmp); borderInfo[i] = customEdgeBmp; } return 0; } -void CustomBorderBuilder::Bitmap2BdrBitmap(const glArchivItem_Bitmap& bitmapRLE, BdrBitmap& bdrBitmap) +void CustomBorderBuilder::bitmap2BdrBitmap(const glArchivItem_Bitmap& bitmapRLE, BdrBitmap& bdrBitmap) { RTTR_FOREACH_PT(ImgPos, bitmapRLE.getSize()) bdrBitmap.put(pt, bitmapRLE.getPixelClrIdx(pt.x, pt.y, &palette)); } -void CustomBorderBuilder::BdrBitmap2Bitmap(BdrBitmap& bdrBitmap, glArchivItem_Bitmap& bitmapRLE) +void CustomBorderBuilder::bdrBitmap2Bitmap(BdrBitmap& bdrBitmap, glArchivItem_Bitmap& bitmapRLE) { RTTR_FOREACH_PT(ImgPos, bdrBitmap.size) bitmapRLE.setPixel(pt.x, pt.y, bdrBitmap.get(pt)); } -void CustomBorderBuilder::FindEdgeDistribution(unsigned toFill, std::array& lengths, +void CustomBorderBuilder::findEdgeDistribution(unsigned toFill, std::array& lengths, std::array& shouldCounts) { // Die should-Variablen speichern die bisher als am besten befundene Kombination; die would-Variablen die gerade zu @@ -278,7 +278,7 @@ void CustomBorderBuilder::FindEdgeDistribution(unsigned toFill, std::array -void CustomBorderBuilder::WriteEdgeDistribution(const ImgPos& pos, const unsigned toFill, +void CustomBorderBuilder::writeEdgeDistribution(const ImgPos& pos, const unsigned toFill, const bool direction, // false = waagerecht, true = senkrecht const std::array& edgeLengths, std::array& edgeCounts, diff --git a/libs/s25main/customborderbuilder.h b/libs/s25main/customborderbuilder.h index e08b16bb87..19492f9688 100644 --- a/libs/s25main/customborderbuilder.h +++ b/libs/s25main/customborderbuilder.h @@ -43,13 +43,13 @@ class CustomBorderBuilder std::vector values; }; - void Bitmap2BdrBitmap(const glArchivItem_Bitmap& bitmapRLE, BdrBitmap& bdrBitmap); - static void BdrBitmap2Bitmap(BdrBitmap& bdrBitmap, glArchivItem_Bitmap& bitmapRLE); + void bitmap2BdrBitmap(const glArchivItem_Bitmap& bitmapRLE, BdrBitmap& bdrBitmap); + static void bdrBitmap2Bitmap(BdrBitmap& bdrBitmap, glArchivItem_Bitmap& bitmapRLE); - static void FindEdgeDistribution(unsigned toFill, std::array& lengths, + static void findEdgeDistribution(unsigned toFill, std::array& lengths, std::array& shouldCounts); template - void WriteEdgeDistribution(const ImgPos& pos, unsigned toFill, + void writeEdgeDistribution(const ImgPos& pos, unsigned toFill, bool direction, // false = waagerecht, true = senkrecht const std::array& edgeLengths, std::array& edgeCounts, // wird verändert, nicht weiterbenutzen diff --git a/libs/s25main/desktops/Desktop.cpp b/libs/s25main/desktops/Desktop.cpp index 22c0980c04..a87a5b2a09 100644 --- a/libs/s25main/desktops/Desktop.cpp +++ b/libs/s25main/desktops/Desktop.cpp @@ -28,45 +28,45 @@ Desktop::Desktop(glArchivItem_Bitmap* background) VIDEODRIVER.setTargetFramerate(60); else VIDEODRIVER.setTargetFramerate(SETTINGS.video.framerate); - UpdateFps(VIDEODRIVER.getFPS()); + updateFps(VIDEODRIVER.getFPS()); } Desktop::~Desktop() = default; -void Desktop::Draw_() +void Desktop::drawImpl() { unsigned curFPS = VIDEODRIVER.getFPS(); if(curFPS != lastFPS_) - UpdateFps(curFPS); + updateFps(curFPS); if(background) - background->DrawFull(getDrawRect()); + background->drawFull(getDrawRect()); - Window::Draw_(); + Window::drawImpl(); } void Desktop::msgScreenResize(const ScreenResizeEvent& sr) { Window::msgScreenResize(sr); // Resize to new screen size - Resize(sr.newSize); + resize(sr.newSize); auto* fpsDisplay = getCtrl(fpsDisplayId); if(fpsDisplay) - fpsDisplay->setPos(Scale(fpsDisplayPos)); + fpsDisplay->setPos(scale(fpsDisplayPos)); } void Desktop::setFpsDisplay(bool show) { if(!show) - DeleteCtrl(fpsDisplayId); + deleteCtrl(fpsDisplayId); else if(!getCtrl(fpsDisplayId) && SmallFont) { - AddText(fpsDisplayId, fpsDisplayPos, helpers::toString(lastFPS_) + " fps", COLOR_YELLOW, FontStyle::RIGHT, + addText(fpsDisplayId, fpsDisplayPos, helpers::toString(lastFPS_) + " fps", COLOR_YELLOW, FontStyle::RIGHT, SmallFont); } } -void Desktop::UpdateFps(unsigned newFps) +void Desktop::updateFps(unsigned newFps) { auto* fpsDisplay = getCtrl(fpsDisplayId); if(fpsDisplay) diff --git a/libs/s25main/desktops/Desktop.h b/libs/s25main/desktops/Desktop.h index dee5c6b26f..6eec4884dd 100644 --- a/libs/s25main/desktops/Desktop.h +++ b/libs/s25main/desktops/Desktop.h @@ -26,12 +26,12 @@ class Desktop : public Window static const unsigned fpsDisplayId; protected: - void Draw_() override; + void drawImpl() override; glArchivItem_Bitmap* background; private: - void UpdateFps(unsigned newFps); + void updateFps(unsigned newFps); unsigned lastFPS_; }; diff --git a/libs/s25main/desktops/dskBenchmark.cpp b/libs/s25main/desktops/dskBenchmark.cpp index 33d5611d4f..0c81d9e66c 100644 --- a/libs/s25main/desktops/dskBenchmark.cpp +++ b/libs/s25main/desktops/dskBenchmark.cpp @@ -50,10 +50,10 @@ struct dskBenchmark::GameView GameWorldView view; GameView(GameWorldBase& gw, Extent size) : viewer(0u, gw), view(viewer, Position(0, 0), size) { - viewer.InitTerrainRenderer(); - view.MoveToMapPt(MapPoint(0, 0)); - view.ToggleShowBQ(); - view.ToggleShowNames(); + viewer.initTerrainRenderer(); + view.moveToMapPt(MapPoint(0, 0)); + view.toggleShowBQ(); + view.toggleShowNames(); } }; @@ -62,9 +62,9 @@ dskBenchmark::dskBenchmark() { for(std::chrono::milliseconds& t : testDurations_) t = std::chrono::milliseconds::zero(); - AddText(ID_txtHelp, DrawPoint(5, 5), "Use F1-F5 to start benchmark, F10 for all, NUM_n to set amount of instances", + addText(ID_txtHelp, DrawPoint(5, 5), "Use F1-F5 to start benchmark, F10 for all, NUM_n to set amount of instances", COLOR_YELLOW, FontStyle::LEFT, LargeFont); - AddText(ID_txtAmount, DrawPoint(795, 5), "Instances: default", COLOR_YELLOW, FontStyle::RIGHT, LargeFont); + addText(ID_txtAmount, DrawPoint(795, 5), "Instances: default", COLOR_YELLOW, FontStyle::RIGHT, LargeFont); } dskBenchmark::~dskBenchmark() @@ -108,14 +108,14 @@ bool dskBenchmark::msgKeyDown(const KeyEvent& ke) void dskBenchmark::msgPaintAfter() { for(const ColoredRect& rect : rects_) - DrawRectangle(rect.rect, rect.clr); + drawRectangle(rect.rect, rect.clr); for(const ColoredLine& line : lines_) - DrawLine(line.p1, line.p2, line.width, line.clr); + drawLine(line.p1, line.p2, line.width, line.clr); if(gameView_) { RoadBuildState roadState; roadState.mode = RoadBuildMode::Disabled; - gameView_->view.Draw(roadState, MapPoint::Invalid(), false); + gameView_->view.draw(roadState, MapPoint::invalid(), false); } if(curTest_ != Benchmark::None) { @@ -131,7 +131,7 @@ void dskBenchmark::msgPaintAfter() void dskBenchmark::setActive(bool activate) { if(!IsActive() && activate) - VIDEODRIVER.ResizeScreen(VideoMode(1600, 900), DisplayMode::Windowed); + VIDEODRIVER.resizeScreen(VideoMode(1600, 900), DisplayMode::Windowed); dskMenuBase::setActive(activate); } @@ -164,7 +164,7 @@ void dskBenchmark::startTest(Benchmark test) if(pt.x >= 780) pt.x = distrMove(rng); } - AddText(ID_first + i, pt, txt, COLOR_YELLOW, FontStyle::LEFT, fnt); + addText(ID_first + i, pt, txt, COLOR_YELLOW, FontStyle::LEFT, fnt); } break; } @@ -220,7 +220,7 @@ void dskBenchmark::startTest(Benchmark test) return; std::vector hqs(2, MapPoint(0, 0)); hqs[1].x += 30; - MapLoader::PlaceHQs(game_->world_, hqs); + MapLoader::placeHQs(game_->world_, hqs); break; } case Benchmark::FullGame: @@ -230,7 +230,7 @@ void dskBenchmark::startTest(Benchmark test) return; std::vector hqs(2, MapPoint(0, 0)); hqs[1].x += 30; - MapLoader::PlaceHQs(game_->world_, hqs); + MapLoader::placeHQs(game_->world_, hqs); for(unsigned i = 0; i < hqs.size(); i++) { std::vector pts = game_->world_.getPointsInRadius(hqs[i], 15); @@ -247,17 +247,17 @@ void dskBenchmark::startTest(Benchmark test) if(game_->world_.getNode(pt).obj || game_->world_.getNode(flagPt).obj || !dist(rng)) continue; BuildingType bldType = blds[getBld(rng)]; - noBuilding* bld = BuildingFactory::CreateBuilding( + noBuilding* bld = BuildingFactory::createBuilding( game_->world_, bldType, pt, i, distEqual(rng) ? Nation::Africans : Nation::Japanese); if(bldType == BuildingType::Barracks) { auto* mil = static_cast(bld); - mil->AddPassiveSoldier(std::make_unique(pt, i, mil, mil, 0)); + mil->addPassiveSoldier(std::make_unique(pt, i, mil, mil, 0)); } - auto& figure = game_->world_.AddFigure( + auto& figure = game_->world_.addFigure( flagPt, std::make_unique(Job(getJob(rng)), flagPt, i, nullptr)); - figure.StartWandering(); - figure.StartWalking(Direction(getDir(rng))); + figure.startWandering(); + figure.startWalking(Direction(getDir(rng))); } } break; @@ -288,7 +288,7 @@ void dskBenchmark::finishTest() for(Window* ctrl : ctrls) { if(ctrl->getID() >= ID_first) - DeleteCtrl(ctrl->getID()); + deleteCtrl(ctrl->getID()); } rects_.clear(); lines_.clear(); @@ -356,7 +356,7 @@ void dskBenchmark::createGame() lastHeight = helpers::clamp(lastHeight + uniform_int_distribution(-1, 1)(rng), 8, 13); node.altitude = lastHeight; } - MapLoader::InitShadows(world); + MapLoader::initShadows(world); MapLoader::setMapExplored(world); GameLoader loader(LOADER, game_); diff --git a/libs/s25main/desktops/dskCampaignMissionSelection.cpp b/libs/s25main/desktops/dskCampaignMissionSelection.cpp index 450b0f65e2..a291d2c625 100644 --- a/libs/s25main/desktops/dskCampaignMissionSelection.cpp +++ b/libs/s25main/desktops/dskCampaignMissionSelection.cpp @@ -68,18 +68,18 @@ dskCampaignMissionSelection::dskCampaignMissionSelection(CreateServerInfo csi, c { constexpr Extent buttonSize(200, buttonHeight); auto* btStart = - AddTextButton(ID_btStart, DrawPoint(300, 530), buttonSize, TextureColor::Red1, _("Start"), NormalFont); - AddTextButton(ID_btBack, DrawPoint(300, 530 + buttonSize.y + spacingBetweenButtons), buttonSize, + addTextButton(ID_btStart, DrawPoint(300, 530), buttonSize, TextureColor::Red1, _("Start"), NormalFont); + addTextButton(ID_btBack, DrawPoint(300, 530 + buttonSize.y + spacingBetweenButtons), buttonSize, TextureColor::Red1, _("Back"), NormalFont); auto* mapSelection = - AddMapSelection(ID_MapSelection, DrawPoint(0, 0), Extent(800, 508), *campaign_->selectionMapData); + addMapSelection(ID_MapSelection, DrawPoint(0, 0), Extent(800, 508), *campaign_->selectionMapData); mapSelection->setMissionsStatus(std::vector(campaign_->getNumMaps(), {true, true})); btStart->setEnabled(static_cast(mapSelection->getSelection())); } else { constexpr Extent buttonSize(22, buttonHeight); - AddText(ID_lblChooseMission, DrawPoint(400, startOffsetY), _("Choose mission"), COLOR_YELLOW, FontStyle::CENTER, + addText(ID_lblChooseMission, DrawPoint(400, startOffsetY), _("Choose mission"), COLOR_YELLOW, FontStyle::CENTER, LargeFont); // Add navigation controls @@ -92,25 +92,25 @@ dskCampaignMissionSelection::dskCampaignMissionSelection(CreateServerInfo csi, c // width of one button as space around the label center, 2 buttons per side // |bt|s|bt|s|(bt)|label|(bt)|s|bt|s|bt DrawPoint btPos(pageLabelPos.x - buttonSize.x * 3 - 2 * spacingBetweenButtons, btOffset); - AddImageButton(ID_btFirstPage, btPos, buttonSize, TextureColor::Green2, LOADER.getImageN("io", 102)); + addImageButton(ID_btFirstPage, btPos, buttonSize, TextureColor::Green2, LOADER.getImageN("io", 102)); btPos.x += buttonSize.x + spacingBetweenButtons; - AddImageButton(ID_btPrevPage, btPos, buttonSize, TextureColor::Green2, LOADER.getImageN("io", 103)); + addImageButton(ID_btPrevPage, btPos, buttonSize, TextureColor::Green2, LOADER.getImageN("io", 103)); - AddText(ID_lblPage, pageLabelPos, "0/0", COLOR_YELLOW, FontStyle::CENTER | FontStyle::VCENTER, LargeFont); + addText(ID_lblPage, pageLabelPos, "0/0", COLOR_YELLOW, FontStyle::CENTER | FontStyle::VCENTER, LargeFont); btPos.x = pageLabelPos.x + buttonSize.x + spacingBetweenButtons; - AddImageButton(ID_btNextPage, btPos, buttonSize, TextureColor::Green2, LOADER.getImageN("io", 104)); + addImageButton(ID_btNextPage, btPos, buttonSize, TextureColor::Green2, LOADER.getImageN("io", 104)); btPos.x += buttonSize.x + spacingBetweenButtons; - AddImageButton(ID_btLastPage, btPos, buttonSize, TextureColor::Green2, LOADER.getImageN("io", 105)); + addImageButton(ID_btLastPage, btPos, buttonSize, TextureColor::Green2, LOADER.getImageN("io", 105)); - AddTextButton(ID_btBack, DrawPoint(300, 560), Extent(200, 22), TextureColor::Red1, _("Back"), NormalFont); + addTextButton(ID_btBack, DrawPoint(300, 560), Extent(200, 22), TextureColor::Red1, _("Back"), NormalFont); - UpdateStateOfNavigationButtons(); - UpdateMissionPage(); + updateStateOfNavigationButtons(); + updateMissionPage(); } } -void dskCampaignMissionSelection::UpdateMissionPage() +void dskCampaignMissionSelection::updateMissionPage() { // Hide all groups for(const auto i : helpers::range(lastPage_ + 1)) @@ -126,7 +126,7 @@ void dskCampaignMissionSelection::UpdateMissionPage() else { // Create group (once) - group = AddGroup(grpIdCurrentPage); + group = addGroup(grpIdCurrentPage); constexpr Extent missionBtSize(300, buttonHeight); DrawPoint curBtPos(250, getStartOffsetMissionButtonsY()); @@ -147,7 +147,7 @@ void dskCampaignMissionSelection::UpdateMissionPage() const auto& header = checkedCast(map[0])->getHeader(); - group->AddTextButton(i, curBtPos, missionBtSize, TextureColor::Grey, s25util::ansiToUTF8(header.getName()), + group->addTextButton(i, curBtPos, missionBtSize, TextureColor::Grey, s25util::ansiToUTF8(header.getName()), NormalFont); curBtPos.y += missionBtSize.y + distanceBetweenMissionButtonsY; } @@ -155,24 +155,24 @@ void dskCampaignMissionSelection::UpdateMissionPage() getCtrl(ID_lblPage)->setText(std::to_string(currentPage_ + 1) + "/" + std::to_string(lastPage_ + 1)); } -void dskCampaignMissionSelection::StartServer(unsigned missionIdx) +void dskCampaignMissionSelection::startServer(unsigned missionIdx) { MapDescription map{campaign_->getMapFilePath(missionIdx), MapType::OldMap, campaign_->getLuaFilePath(missionIdx)}; - if(!GAMECLIENT.HostGame(csi_, map)) + if(!GAMECLIENT.hostGame(csi_, map)) { - WINDOWMANAGER.Show(std::make_unique(_("Error"), _("Hosting of game not possible"), this, + WINDOWMANAGER.show(std::make_unique(_("Error"), _("Hosting of game not possible"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, ID_msgBoxError)); } else { - iwConnecting& wnd = WINDOWMANAGER.Show(std::make_unique(csi_.type, nullptr)); + iwConnecting& wnd = WINDOWMANAGER.show(std::make_unique(csi_.type, nullptr)); onErrorConnection_ = wnd.onError.connect([this](ClientError error) { - WINDOWMANAGER.Show(std::make_unique(_("Error"), ClientErrorToStr(error), this, MsgboxButton::Ok, + WINDOWMANAGER.show(std::make_unique(_("Error"), clientErrorToStr(error), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, ID_msgBoxError)); }); } } -void dskCampaignMissionSelection::UpdateStateOfNavigationButtons() +void dskCampaignMissionSelection::updateStateOfNavigationButtons() { getCtrl(ID_btFirstPage)->setEnabled(currentPage_ > 0); getCtrl(ID_btPrevPage)->setEnabled(currentPage_ > 0); @@ -184,7 +184,7 @@ void dskCampaignMissionSelection::msgGroupButtonClick(unsigned group_id, unsigne { const auto page = group_id - ID_FirstPageGrp; RTTR_Assert(page == currentPage_); - StartServer(page * missionsPerPage_ + ctrl_id); + startServer(page * missionsPerPage_ + ctrl_id); } void dskCampaignMissionSelection::msgButtonClick(unsigned ctrl_id) @@ -195,7 +195,7 @@ void dskCampaignMissionSelection::msgButtonClick(unsigned ctrl_id) { const auto selectedMission = getCtrl(ID_MapSelection)->getSelection(); if(selectedMission) - StartServer(*selectedMission); + startServer(*selectedMission); } else if(ctrl_id == ID_MapSelection) { auto* btStart = getCtrl(ID_btStart); @@ -216,7 +216,7 @@ void dskCampaignMissionSelection::msgButtonClick(unsigned ctrl_id) break; case ID_btLastPage: currentPage_ = lastPage_; break; } - UpdateMissionPage(); - UpdateStateOfNavigationButtons(); + updateMissionPage(); + updateStateOfNavigationButtons(); } } diff --git a/libs/s25main/desktops/dskCampaignMissionSelection.h b/libs/s25main/desktops/dskCampaignMissionSelection.h index 8c41020a6f..467557bf58 100644 --- a/libs/s25main/desktops/dskCampaignMissionSelection.h +++ b/libs/s25main/desktops/dskCampaignMissionSelection.h @@ -16,11 +16,11 @@ class dskCampaignMissionSelection : public Desktop dskCampaignMissionSelection(CreateServerInfo csi, const CampaignDescription& campaign); private: - void UpdateMissionPage(); + void updateMissionPage(); void msgButtonClick(unsigned ctrl_id) override; void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; - void StartServer(unsigned missionIdx); - void UpdateStateOfNavigationButtons(); + void startServer(unsigned missionIdx); + void updateStateOfNavigationButtons(); CreateServerInfo csi_; std::unique_ptr campaign_; const unsigned missionsPerPage_; diff --git a/libs/s25main/desktops/dskCampaignSelection.cpp b/libs/s25main/desktops/dskCampaignSelection.cpp index 3cb9e0a7b5..911b71edb0 100644 --- a/libs/s25main/desktops/dskCampaignSelection.cpp +++ b/libs/s25main/desktops/dskCampaignSelection.cpp @@ -64,11 +64,11 @@ int getColumnOffsetY() dskCampaignSelection::dskCampaignSelection(CreateServerInfo csi) : Desktop(LOADER.getImageN("setup015", 0)), csi_(std::move(csi)) { - AddText(ID_Label, DrawPoint(250, startOffsetY), _("Campaigns"), COLOR_YELLOW, FontStyle::CENTER, LargeFont); + addText(ID_Label, DrawPoint(250, startOffsetY), _("Campaigns"), COLOR_YELLOW, FontStyle::CENTER, LargeFont); // The table for the campaigns using SRT = ctrlTable::SortType; - AddTable(ID_Table, DrawPoint(padding, getColumnOffsetY()), Extent(firstColumnExtentX, columnExtentY), + addTable(ID_Table, DrawPoint(padding, getColumnOffsetY()), Extent(firstColumnExtentX, columnExtentY), TextureColor::Grey, NormalFont, ctrlTable::Columns{{_("Title"), 100, SRT::String}, {_("Description"), 150, SRT::String}, @@ -78,21 +78,21 @@ dskCampaignSelection::dskCampaignSelection(CreateServerInfo csi) {"", 0, SRT::Default}}); const int previewTitleOffsetY = getColumnOffsetY() + campaignImageExtentY + padding; - AddText(ID_PreviewTitle, DrawPoint(640, previewTitleOffsetY), "", COLOR_YELLOW, FontStyle::CENTER, LargeFont); + addText(ID_PreviewTitle, DrawPoint(640, previewTitleOffsetY), "", COLOR_YELLOW, FontStyle::CENTER, LargeFont); int const multilineOffsetY = previewTitleOffsetY + LargeFont->getHeight(); int const mutlilineExtentY = columnExtentY - (multilineOffsetY - getColumnOffsetY()); - AddMultiline(ID_PreviewDescription, DrawPoint(secondColumnOffsetX, multilineOffsetY), + addMultiline(ID_PreviewDescription, DrawPoint(secondColumnOffsetX, multilineOffsetY), Extent(secondColumnExtentX, mutlilineExtentY), TextureColor::Grey, NormalFont); - AddTextButton(ID_btBack, DrawPoint(380, 560), Extent(200, 22), TextureColor::Red1, _("Back"), NormalFont); - AddTextButton(ID_Next, DrawPoint(590, 560), Extent(200, 22), TextureColor::Green2, _("Continue"), NormalFont) + addTextButton(ID_btBack, DrawPoint(380, 560), Extent(200, 22), TextureColor::Red1, _("Back"), NormalFont); + addTextButton(ID_Next, DrawPoint(590, 560), Extent(200, 22), TextureColor::Green2, _("Continue"), NormalFont) ->setEnabled(false); showCampaignInfo(false); // Delay loading until screen is shown such that possible error message boxes are shown after switching to this - AddTimer(ID_TimerFillCampaignTable, 1ms); + addTimer(ID_TimerFillCampaignTable, 1ms); } dskCampaignSelection::~dskCampaignSelection() noexcept = default; @@ -108,7 +108,7 @@ void dskCampaignSelection::msgTableSelectItem(const unsigned ctrl_id, const std: if(ctrl_id != ID_Table) return; - DeleteCtrl(ID_MapSelection); // Needs to be either hidden or recreated as it doesn't support updating + deleteCtrl(ID_MapSelection); // Needs to be either hidden or recreated as it doesn't support updating auto& btContinue = *getCtrl(ID_Next); if(!selection) { @@ -122,8 +122,8 @@ void dskCampaignSelection::msgTableSelectItem(const unsigned ctrl_id, const std: const auto& campaign = campaigns_.at(*selection); auto& campaignDescription = *getCtrl(ID_PreviewDescription); - campaignDescription.Clear(); - campaignDescription.AddString(campaign.longDescription, COLOR_YELLOW); + campaignDescription.clear(); + campaignDescription.addString(campaign.longDescription, COLOR_YELLOW); auto& campaignTitle = *getCtrl(ID_PreviewTitle); campaignTitle.setText(campaign.name); @@ -132,7 +132,7 @@ void dskCampaignSelection::msgTableSelectItem(const unsigned ctrl_id, const std: { campaignImage_ = nullptr; auto* mapSelection = - AddMapSelection(ID_MapSelection, DrawPoint(secondColumnOffsetX, getColumnOffsetY()), + addMapSelection(ID_MapSelection, DrawPoint(secondColumnOffsetX, getColumnOffsetY()), Extent(secondColumnExtentX, campaignImageExtentY), *campaign.selectionMapData); mapSelection->setMissionsStatus(std::vector(campaign.getNumMaps(), {true, true})); mapSelection->setPreview(true); @@ -167,7 +167,7 @@ void dskCampaignSelection::msgButtonClick(unsigned ctrl_id) void dskCampaignSelection::msgTimer(unsigned ctrl_id) { - getCtrl(ctrl_id)->Stop(); + getCtrl(ctrl_id)->stop(); loadCampaigns(); std::set resourcesToLoad; for(const auto& campaign : campaigns_) @@ -175,29 +175,29 @@ void dskCampaignSelection::msgTimer(unsigned ctrl_id) if(campaign.image) resourcesToLoad.insert(*campaign.image); } - LOADER.LoadFiles({resourcesToLoad.begin(), resourcesToLoad.end()}); - FillCampaignsTable(); + LOADER.loadFiles({resourcesToLoad.begin(), resourcesToLoad.end()}); + fillCampaignsTable(); } -void dskCampaignSelection::FillCampaignsTable() +void dskCampaignSelection::fillCampaignsTable() { auto* table = getCtrl(ID_Table); for(const auto& campaign : campaigns_) { - table->AddRow({campaign.name, campaign.shortDescription, campaign.author, std::to_string(campaign.getNumMaps()), + table->addRow({campaign.name, campaign.shortDescription, campaign.author, std::to_string(campaign.getNumMaps()), _(campaign.difficulty)}); } } -void dskCampaignSelection::Draw_() +void dskCampaignSelection::drawImpl() { - Desktop::Draw_(); + Desktop::drawImpl(); // replace this by AddImageButton as soon as it can handle this scenario correctly if(campaignImage_) { - campaignImage_->DrawFull(Rect(ScaleIf(DrawPoint(secondColumnOffsetX, getColumnOffsetY())), - ScaleIf(Extent(secondColumnExtentX, campaignImageExtentY)))); + campaignImage_->drawFull(Rect(scaleIf(DrawPoint(secondColumnOffsetX, getColumnOffsetY())), + scaleIf(Extent(secondColumnExtentX, campaignImageExtentY)))); } } @@ -256,7 +256,7 @@ void dskCampaignSelection::loadCampaigns() { const std::string errorTxt = helpers::format(_("%1% campaign(s) could not be loaded. Check the log for details"), numBroken); - WINDOWMANAGER.Show( + WINDOWMANAGER.show( std::make_unique(_("Error"), errorTxt, this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, 1)); } } diff --git a/libs/s25main/desktops/dskCampaignSelection.h b/libs/s25main/desktops/dskCampaignSelection.h index 276d2bac2d..0dff487e2c 100644 --- a/libs/s25main/desktops/dskCampaignSelection.h +++ b/libs/s25main/desktops/dskCampaignSelection.h @@ -18,7 +18,7 @@ class dskCampaignSelection : public Desktop ~dskCampaignSelection() noexcept; protected: - void Draw_() override; + void drawImpl() override; private: class CampaignDataHolder; @@ -27,7 +27,7 @@ class dskCampaignSelection : public Desktop void msgTableSelectItem(unsigned ctrl_id, const std::optional& selection) override; void msgButtonClick(unsigned ctrl_id) override; void msgTimer(unsigned ctrl_id) override; - void FillCampaignsTable(); + void fillCampaignsTable(); void showCampaignInfo(bool show); void showCampaignMissionSelectionScreen(); void loadCampaigns(); diff --git a/libs/s25main/desktops/dskCredits.cpp b/libs/s25main/desktops/dskCredits.cpp index dceeee8367..f14d7c2f29 100644 --- a/libs/s25main/desktops/dskCredits.cpp +++ b/libs/s25main/desktops/dskCredits.cpp @@ -43,12 +43,12 @@ enum dskCredits::dskCredits() : Desktop(LOADER.getImageN("setup013", 0)), itCurEntry(entries.end()) { - AddTextButton(ID_btBack, DrawPoint(300, 550), Extent(200, 22), TextureColor::Red1, _("Back"), NormalFont); - AddText(ID_txtRttr, DrawPoint(400, 10), _("Return To The Roots"), COLOR_YELLOW, FontStyle::CENTER, LargeFont); - AddText(ID_txtCredits, DrawPoint(400, 33), _("Credits"), COLOR_YELLOW, FontStyle::CENTER, LargeFont); - AddTimer(ID_tmrBobAnim, 40ms); - pageTimer = AddTimer(ID_tmrPage, PAGE_TIME); - pageTimer->Stop(); + addTextButton(ID_btBack, DrawPoint(300, 550), Extent(200, 22), TextureColor::Red1, _("Back"), NormalFont); + addText(ID_txtRttr, DrawPoint(400, 10), _("Return To The Roots"), COLOR_YELLOW, FontStyle::CENTER, LargeFont); + addText(ID_txtCredits, DrawPoint(400, 33), _("Credits"), COLOR_YELLOW, FontStyle::CENTER, LargeFont); + addTimer(ID_tmrBobAnim, 40ms); + pageTimer = addTimer(ID_tmrPage, PAGE_TIME); + pageTimer->stop(); LOADER.Load(ResourceId("credits")); // Ignore failure @@ -274,7 +274,7 @@ dskCredits::dskCredits() : Desktop(LOADER.getImageN("setup013", 0)), itCurEntry( GameDataLoader gdLoader(worldDesc); if(!gdLoader.Load()) { - WINDOWMANAGER.Show(std::make_unique(_("Error"), _("Failed to load game data"), this, MsgboxButton::Ok, + WINDOWMANAGER.show(std::make_unique(_("Error"), _("Failed to load game data"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, 0)); return; } @@ -283,9 +283,9 @@ dskCredits::dskCredits() : Desktop(LOADER.getImageN("setup013", 0)), itCurEntry( for(unsigned i = 0; i < NUM_NATIVE_NATIONS; i++) nations[i] = Nation(i); - if(!LOADER.LoadFilesAtGame(worldDesc.get(DescIdx(0)).mapGfxPath, false, nations, {})) + if(!LOADER.loadFilesAtGame(worldDesc.get(DescIdx(0)).mapGfxPath, false, nations, {})) { - WINDOWMANAGER.Show(std::make_unique(_("Error"), _("Failed to load game resources"), this, + WINDOWMANAGER.show(std::make_unique(_("Error"), _("Failed to load game resources"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, 0)); return; } @@ -293,39 +293,39 @@ dskCredits::dskCredits() : Desktop(LOADER.getImageN("setup013", 0)), itCurEntry( this->itCurEntry = entries.begin(); if(LOADER.sng_lst.size() > 8) - LOADER.sng_lst[8]->Play(-1); + LOADER.sng_lst[8]->play(-1); } dskCredits::~dskCredits() = default; -void dskCredits::Draw_() +void dskCredits::drawImpl() { - Desktop::Draw_(); + Desktop::drawImpl(); if(itCurEntry != entries.end()) { - DrawBobs(); - DrawCredit(); + drawBobs(); + drawCredit(); } } -void dskCredits::GotoNextPage() +void dskCredits::gotoNextPage() { ++itCurEntry; if(itCurEntry == entries.end()) itCurEntry = entries.begin(); - pageTimer->Start(); + pageTimer->start(); } -void dskCredits::GotoPrevPage() +void dskCredits::gotoPrevPage() { if(itCurEntry == entries.begin()) itCurEntry = std::prev(entries.end()); else --itCurEntry; - pageTimer->Start(); + pageTimer->start(); } -void dskCredits::DrawCredit() +void dskCredits::drawCredit() { const auto elapsedPageTime = std::chrono::duration_cast(pageTimer->getElapsed()); @@ -336,22 +336,22 @@ void dskCredits::DrawCredit() helpers::interpolate(0u, 0xFFu, elapsedPageTime, FADING_TIME); // draw text - LargeFont->Draw(DrawPoint(40, 100), itCurEntry->title, FontStyle{}, SetAlpha(COLOR_RED, transparency)); + LargeFont->draw(DrawPoint(40, 100), itCurEntry->title, FontStyle{}, SetAlpha(COLOR_RED, transparency)); std::array columnToY = {{150, 150}}; for(const auto& line : itCurEntry->lines) { - LargeFont->Draw(DrawPoint(60 + line.column * 350, columnToY[line.column]), line.line, FontStyle{}, + LargeFont->draw(DrawPoint(60 + line.column * 350, columnToY[line.column]), line.line, FontStyle{}, SetAlpha(COLOR_YELLOW, transparency)); columnToY[line.column] += LargeFont->getHeight() + 5; } - LargeFont->Draw(DrawPoint(40, columnToY[0] + 20), itCurEntry->lastLine, FontStyle{}, + LargeFont->draw(DrawPoint(40, columnToY[0] + 20), itCurEntry->lastLine, FontStyle{}, SetAlpha(COLOR_RED, transparency)); if(itCurEntry->pic) - itCurEntry->pic->DrawFull(DrawPoint(VIDEODRIVER.getRenderSize().x - 300, 70), + itCurEntry->pic->drawFull(DrawPoint(VIDEODRIVER.getRenderSize().x - 300, 70), SetAlpha(COLOR_WHITE, transparency)); } @@ -361,7 +361,7 @@ T randEnum() return T(rand() % helpers::NumEnumValues_v); } -void dskCredits::DrawBobs() +void dskCredits::drawBobs() { using namespace std::chrono_literals; auto bobSpawnInterval = 200ms; @@ -447,9 +447,9 @@ void dskCredits::DrawBobs() for(const auto& bob : bobs) { if(!bob.hasWare) - LOADER.getBob("jobs")->Draw(bob.id, bob.direction, bob.isFat, bob.animationStep, bob.pos, bob.color); + LOADER.getBob("jobs")->draw(bob.id, bob.direction, bob.isFat, bob.animationStep, bob.pos, bob.color); else - LOADER.getBob("carrier")->Draw(bob.id, bob.direction, bob.isFat, bob.animationStep, bob.pos, bob.color); + LOADER.getBob("carrier")->draw(bob.id, bob.direction, bob.isFat, bob.animationStep, bob.pos, bob.color); } } @@ -477,11 +477,11 @@ void dskCredits::msgTimer(unsigned timerId) } } else if(timerId == ID_tmrPage) { - GotoNextPage(); + gotoNextPage(); } } -bool dskCredits::Close() +bool dskCredits::close() { WINDOWMANAGER.Switch(std::make_unique()); return true; @@ -497,31 +497,31 @@ glArchivItem_Bitmap* dskCredits::getCreditsImgOrDefault(const std::string& name) bool dskCredits::msgKeyDown(const KeyEvent&) { - GotoNextPage(); + gotoNextPage(); return true; } bool dskCredits::msgLeftUp(const MouseCoords&) { - GotoNextPage(); + gotoNextPage(); bobSpawnTimer.restart(); // Little easteregg return true; } bool dskCredits::msgRightUp(const MouseCoords&) { - GotoPrevPage(); + gotoPrevPage(); return true; } void dskCredits::msgButtonClick(const unsigned) { - Close(); + close(); } void dskCredits::msgMsgBoxResult(unsigned, MsgboxResult) { - Close(); + close(); } void dskCredits::setActive(bool active) @@ -529,7 +529,7 @@ void dskCredits::setActive(bool active) Desktop::setActive(active); if(active && !pageTimer->isRunning()) { - pageTimer->Start(); + pageTimer->start(); bobSpawnTimer.start(); } } diff --git a/libs/s25main/desktops/dskCredits.h b/libs/s25main/desktops/dskCredits.h index 748ac1c369..b9f62e87d7 100644 --- a/libs/s25main/desktops/dskCredits.h +++ b/libs/s25main/desktops/dskCredits.h @@ -25,18 +25,18 @@ class dskCredits : public Desktop bool msgRightUp(const MouseCoords& mc) override; bool msgKeyDown(const KeyEvent& ke) override; void msgTimer(unsigned timerId) override; - void Draw_() override; + void drawImpl() override; void msgButtonClick(unsigned ctrl_id) override; void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult) override; void setActive(bool active) override; - static bool Close(); + static bool close(); private: - void GotoNextPage(); - void GotoPrevPage(); + void gotoNextPage(); + void gotoPrevPage(); - void DrawCredit(); - void DrawBobs(); + void drawCredit(); + void drawBobs(); static glArchivItem_Bitmap* getCreditsImgOrDefault(const std::string& name); struct CreditsEntry diff --git a/libs/s25main/desktops/dskDirectIP.cpp b/libs/s25main/desktops/dskDirectIP.cpp index 8f3c83d881..ae51d3b238 100644 --- a/libs/s25main/desktops/dskDirectIP.cpp +++ b/libs/s25main/desktops/dskDirectIP.cpp @@ -23,14 +23,14 @@ enum dskDirectIP::dskDirectIP() { - AddTextButton(ID_btCreateGame, DrawPoint(115, 180), Extent(220, 22), TextureColor::Green2, _("Create Game"), + addTextButton(ID_btCreateGame, DrawPoint(115, 180), Extent(220, 22), TextureColor::Green2, _("Create Game"), NormalFont); - AddTextButton(ID_btJoinGame, DrawPoint(115, 210), Extent(220, 22), TextureColor::Green2, _("Join Game"), + addTextButton(ID_btJoinGame, DrawPoint(115, 210), Extent(220, 22), TextureColor::Green2, _("Join Game"), NormalFont); - AddTextButton(ID_btBack, DrawPoint(115, 250), Extent(220, 22), TextureColor::Red1, _("Back"), NormalFont); + addTextButton(ID_btBack, DrawPoint(115, 250), Extent(220, 22), TextureColor::Red1, _("Back"), NormalFont); - AddImage(ID_imgLogo, DrawPoint(20, 20), LOADER.getImageN("logo", 0)); + addImage(ID_imgLogo, DrawPoint(20, 20), LOADER.getImageN("logo", 0)); } void dskDirectIP::msgButtonClick(const unsigned ctrl_id) @@ -41,14 +41,14 @@ void dskDirectIP::msgButtonClick(const unsigned ctrl_id) // Hosten geht nur ohne aktiven Proxy if(SETTINGS.proxy.type != ProxyType::None) { - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Sorry!"), _("You can't create a game while a proxy server is active\nDisable the use of a proxy server first!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationGreen, 1)); } else - WINDOWMANAGER.ReplaceWindow(std::make_unique(ServerType::Direct)); + WINDOWMANAGER.replaceWindow(std::make_unique(ServerType::Direct)); break; - case ID_btJoinGame: WINDOWMANAGER.ReplaceWindow(std::make_unique(ServerType::Direct)); break; + case ID_btJoinGame: WINDOWMANAGER.replaceWindow(std::make_unique(ServerType::Direct)); break; case ID_btBack: WINDOWMANAGER.Switch(std::make_unique()); break; } } diff --git a/libs/s25main/desktops/dskGameInterface.cpp b/libs/s25main/desktops/dskGameInterface.cpp index 01fbf55a5a..4668bdb5a6 100644 --- a/libs/s25main/desktops/dskGameInterface.cpp +++ b/libs/s25main/desktops/dskGameInterface.cpp @@ -140,21 +140,21 @@ dskGameInterface::dskGameInterface(std::shared_ptr game, std::shared_ptrsetBorder(false); barPos.x += btSize.x; - AddImageButton(ID_btOptions, barPos, btSize, TextureColor::Green1, LOADER.getImageN("io", 192), _("Main selection")) + addImageButton(ID_btOptions, barPos, btSize, TextureColor::Green1, LOADER.getImageN("io", 192), _("Main selection")) ->setBorder(false); barPos.x += btSize.x; - AddImageButton(ID_btConstructionAid, barPos, btSize, TextureColor::Green1, LOADER.getImageN("io", 83), + addImageButton(ID_btConstructionAid, barPos, btSize, TextureColor::Green1, LOADER.getImageN("io", 83), _("Construction aid mode")) ->setBorder(false); barPos.x += btSize.x; - AddImageButton(ID_btPost, barPos, btSize, TextureColor::Green1, LOADER.getImageN("io", 62), _("Post office")) + addImageButton(ID_btPost, barPos, btSize, TextureColor::Green1, LOADER.getImageN("io", 62), _("Post office")) ->setBorder(false); barPos += DrawPoint(18, 24); - AddText(ID_txtNumMsg, barPos, "", COLOR_YELLOW, FontStyle::CENTER | FontStyle::VCENTER, SmallFont); + addText(ID_txtNumMsg, barPos, "", COLOR_YELLOW, FontStyle::CENTER | FontStyle::VCENTER, SmallFont); const_cast(*game_).world_.setGameInterface(this); @@ -162,34 +162,34 @@ dskGameInterface::dskGameInterface(std::shared_ptr game, std::shared_ptr([this](const auto& note) { if(note.player == worldViewer.getPlayerId()) - this->OnBuildingNote(note); + this->onBuildingNote(note); }); PostBox& postBox = getPostBox(); - postBox.ObserveNewMsg([this](const auto& msg, auto msgCt) { this->NewPostMessage(msg, msgCt); }); - postBox.ObserveDeletedMsg([this](auto msgCt) { this->PostMessageDeleted(msgCt); }); - UpdatePostIcon(postBox.getNumMsgs(), true); + postBox.observeNewMsg([this](const auto& msg, auto msgCt) { this->newPostMessage(msg, msgCt); }); + postBox.observeDeletedMsg([this](auto msgCt) { this->postMessageDeleted(msgCt); }); + updatePostIcon(postBox.getNumMsgs(), true); } PostBox& dskGameInterface::getPostBox() { PostBox* postBox = worldViewer.getWorld().getPostMgr().getPostBox(worldViewer.getPlayerId()); if(!postBox) - postBox = &worldViewer.getWorldNonConst().getPostMgr().AddPostBox(worldViewer.getPlayerId()); + postBox = &worldViewer.getWorldNonConst().getPostMgr().addPostBox(worldViewer.getPlayerId()); RTTR_Assert(postBox != nullptr); return *postBox; } @@ -198,7 +198,7 @@ dskGameInterface::~dskGameInterface() { for(auto& border : borders) deletePtr(border); - GAMECLIENT.RemoveInterface(this); + GAMECLIENT.removeInterface(this); LOBBYCLIENT.RemoveListener(this); } @@ -211,7 +211,7 @@ void dskGameInterface::setActive(bool activate) // Stay active if scrolling and no modal window is open const IngameWindow* wnd = WINDOWMANAGER.getTopMostWindow(); if(wnd && wnd->isModal()) - StopScrolling(); + stopScrolling(); else return; } @@ -223,83 +223,83 @@ void dskGameInterface::setActive(bool activate) LOBBYCLIENT.AddListener(this); if(!game_->isStarted()) { - GAMECLIENT.OnGameStart(); + GAMECLIENT.onGameStart(); - ShowPersistentWindowsAfterSwitch(); + showPersistentWindowsAfterSwitch(); } } } -void dskGameInterface::StopScrolling() +void dskGameInterface::stopScrolling() { isScrolling = false; - WINDOWMANAGER.setCursor(road.mode == RoadBuildMode::Disabled ? Cursor::Hand : Cursor::Remove); + WINDOWMANAGER.setCursor(road.mode == RoadBuildMode::Disabled ? Cursor::Hand : Cursor::remove); } -void dskGameInterface::StartScrolling(const Position& mousePos) +void dskGameInterface::startScrolling(const Position& mousePos) { startScrollPt = mousePos; isScrolling = true; WINDOWMANAGER.setCursor(Cursor::Scroll); } -void dskGameInterface::ToggleFoW() +void dskGameInterface::toggleFoW() { - DisableFoW(!GAMECLIENT.isReplayFOWDisabled()); + disableFoW(!GAMECLIENT.isReplayFOWDisabled()); } -void dskGameInterface::DisableFoW(const bool hideFOW) +void dskGameInterface::disableFoW(const bool hideFOW) { GAMECLIENT.setReplayFOW(hideFOW); // Notify viewer and minimap to recalculate the visibility - worldViewer.RecalcAllColors(); - minimap.UpdateAll(); + worldViewer.recalcAllColors(); + minimap.updateAll(); } -void dskGameInterface::ShowPersistentWindowsAfterSwitch() +void dskGameInterface::showPersistentWindowsAfterSwitch() { auto& windows = SETTINGS.windows.persistentSettings; if(windows[CGI_CHAT].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(this)); + WINDOWMANAGER.showAfterSwitch(std::make_unique(this)); if(windows[CGI_POSTOFFICE].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv, getPostBox())); + WINDOWMANAGER.showAfterSwitch(std::make_unique(gwv, getPostBox())); if(windows[CGI_DISTRIBUTION].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer(), GAMECLIENT)); + WINDOWMANAGER.showAfterSwitch(std::make_unique(gwv.getViewer(), GAMECLIENT)); if(windows[CGI_BUILDORDER].isOpen && gwv.getWorld().getGGS().isEnabled(AddonId::CUSTOM_BUILD_SEQUENCE)) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer())); + WINDOWMANAGER.showAfterSwitch(std::make_unique(gwv.getViewer())); if(windows[CGI_TRANSPORT].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer(), GAMECLIENT)); + WINDOWMANAGER.showAfterSwitch(std::make_unique(gwv.getViewer(), GAMECLIENT)); if(windows[CGI_MILITARY].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer(), GAMECLIENT)); + WINDOWMANAGER.showAfterSwitch(std::make_unique(gwv.getViewer(), GAMECLIENT)); if(windows[CGI_TOOLS].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer(), GAMECLIENT)); + WINDOWMANAGER.showAfterSwitch(std::make_unique(gwv.getViewer(), GAMECLIENT)); if(windows[CGI_INVENTORY].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer().getPlayer())); + WINDOWMANAGER.showAfterSwitch(std::make_unique(gwv.getViewer().getPlayer())); if(windows[CGI_MINIMAP].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(minimap, gwv)); + WINDOWMANAGER.showAfterSwitch(std::make_unique(minimap, gwv)); if(windows[CGI_BUILDINGS].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv, GAMECLIENT)); + WINDOWMANAGER.showAfterSwitch(std::make_unique(gwv, GAMECLIENT)); if(windows[CGI_BUILDINGSPRODUCTIVITY].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer().getPlayer())); + WINDOWMANAGER.showAfterSwitch(std::make_unique(gwv.getViewer().getPlayer())); if(windows[CGI_MUSICPLAYER].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique()); + WINDOWMANAGER.showAfterSwitch(std::make_unique()); if(windows[CGI_STATISTICS].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer())); + WINDOWMANAGER.showAfterSwitch(std::make_unique(gwv.getViewer())); if(windows[CGI_ECONOMICPROGRESS].isOpen && gwv.getWorld().getEconHandler()) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer())); + WINDOWMANAGER.showAfterSwitch(std::make_unique(gwv.getViewer())); if(windows[CGI_DIPLOMACY].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer(), GAMECLIENT)); + WINDOWMANAGER.showAfterSwitch(std::make_unique(gwv.getViewer(), GAMECLIENT)); if(windows[CGI_SHIP].isOpen) - WINDOWMANAGER.ShowAfterSwitch( + WINDOWMANAGER.showAfterSwitch( std::make_unique(gwv, GAMECLIENT, gwv.getViewer().getPlayer().getShipByID(0))); if(windows[CGI_MERCHANDISE_STATISTICS].isOpen) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(gwv.getViewer().getPlayer())); + WINDOWMANAGER.showAfterSwitch(std::make_unique(gwv.getViewer().getPlayer())); } -void dskGameInterface::Resize(const Extent& newSize) +void dskGameInterface::resize(const Extent& newSize) { - Window::Resize(newSize); + Window::resize(newSize); // recreate borders for(auto& border : borders) @@ -332,22 +332,22 @@ void dskGameInterface::Resize(const Extent& newSize) auto* text = getCtrl(ID_txtNumMsg); text->setPos(barPos); - gwv.Resize(newSize); + gwv.resize(newSize); } void dskGameInterface::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { - case ID_btMap: WINDOWMANAGER.ToggleWindow(std::make_unique(minimap, gwv)); break; - case ID_btOptions: WINDOWMANAGER.ToggleWindow(std::make_unique(gwv, GAMECLIENT)); break; + case ID_btMap: WINDOWMANAGER.toggleWindow(std::make_unique(minimap, gwv)); break; + case ID_btOptions: WINDOWMANAGER.toggleWindow(std::make_unique(gwv, GAMECLIENT)); break; case ID_btConstructionAid: if(WINDOWMANAGER.isDesktopActive()) - gwv.ToggleShowBQ(); + gwv.toggleShowBQ(); break; case ID_btPost: - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv, getPostBox())); - UpdatePostIcon(getPostBox().getNumMsgs(), false); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv, getPostBox())); + updatePostIcon(getPostBox().getNumMsgs(), false); break; } } @@ -357,29 +357,29 @@ void dskGameInterface::msgPaintBefore() Desktop::msgPaintBefore(); // Spiel ausführen - Run(); + run(); /// Padding of the figures const DrawPoint figPadding(12, 12); const DrawPoint screenSize(VIDEODRIVER.getRenderSize()); // Rahmen zeichnen - borders[0]->DrawFull(DrawPoint(0, 0)); // oben (mit Ecken) - borders[1]->DrawFull(DrawPoint(0, screenSize.y - figPadding.y)); // unten (mit Ecken) - borders[2]->DrawFull(DrawPoint(0, figPadding.y)); // links - borders[3]->DrawFull(DrawPoint(screenSize.x - figPadding.x, figPadding.y)); // rechts + borders[0]->drawFull(DrawPoint(0, 0)); // oben (mit Ecken) + borders[1]->drawFull(DrawPoint(0, screenSize.y - figPadding.y)); // unten (mit Ecken) + borders[2]->drawFull(DrawPoint(0, figPadding.y)); // links + borders[3]->drawFull(DrawPoint(screenSize.x - figPadding.x, figPadding.y)); // rechts // The figure/statues and the button bar glArchivItem_Bitmap& imgFigLeftTop = *LOADER.getImageN("resource", 17); glArchivItem_Bitmap& imgFigRightTop = *LOADER.getImageN("resource", 18); glArchivItem_Bitmap& imgFigLeftBot = *LOADER.getImageN("resource", 19); glArchivItem_Bitmap& imgFigRightBot = *LOADER.getImageN("resource", 20); - imgFigLeftTop.DrawFull(figPadding); - imgFigRightTop.DrawFull(DrawPoint(screenSize.x - figPadding.x - imgFigRightTop.getWidth(), figPadding.y)); - imgFigLeftBot.DrawFull(DrawPoint(figPadding.x, screenSize.y - figPadding.y - imgFigLeftBot.getHeight())); - imgFigRightBot.DrawFull(screenSize - figPadding - imgFigRightBot.getSize()); + imgFigLeftTop.drawFull(figPadding); + imgFigRightTop.drawFull(DrawPoint(screenSize.x - figPadding.x - imgFigRightTop.getWidth(), figPadding.y)); + imgFigLeftBot.drawFull(DrawPoint(figPadding.x, screenSize.y - figPadding.y - imgFigLeftBot.getHeight())); + imgFigRightBot.drawFull(screenSize - figPadding - imgFigRightBot.getSize()); glArchivItem_Bitmap& imgButtonBar = *LOADER.getImageN("resource", 29); - imgButtonBar.DrawFull( + imgButtonBar.drawFull( DrawPoint((screenSize.x - imgButtonBar.getWidth()) / 2, screenSize.y - imgButtonBar.getHeight())); } @@ -407,7 +407,7 @@ void dskGameInterface::msgPaintAfter() world.getEvMgr().getCurrentGF(), gfLenMs, GAMECLIENT.getNWFLength(), nwfLenMs, worldViewer.getPlayer().ping); } - NormalFont->Draw(DrawPoint(30, 1), nwf_string.data(), FontStyle{}, COLOR_YELLOW); + NormalFont->draw(DrawPoint(30, 1), nwf_string.data(), FontStyle{}, COLOR_YELLOW); } // tournament mode? @@ -421,16 +421,16 @@ void dskGameInterface::msgPaintAfter() else { tournamentNotice = - helpers::format("Tournament mode: %1% remaining", GAMECLIENT.FormatGFTime(tournamentDuration - curGF)); + helpers::format("Tournament mode: %1% remaining", GAMECLIENT.formatGFTime(tournamentDuration - curGF)); } - NormalFont->Draw(DrawPoint(VIDEODRIVER.getRenderSize().x - 30, 1), tournamentNotice, FontStyle::AlignH::RIGHT, + NormalFont->draw(DrawPoint(VIDEODRIVER.getRenderSize().x - 30, 1), tournamentNotice, FontStyle::AlignH::RIGHT, COLOR_YELLOW); } // Replaydateianzeige in der linken unteren Ecke if(GAMECLIENT.isReplayModeOn()) { - NormalFont->Draw(DrawPoint(0, VIDEODRIVER.getRenderSize().y), GAMECLIENT.getReplayFilename().string(), + NormalFont->draw(DrawPoint(0, VIDEODRIVER.getRenderSize().y), GAMECLIENT.getReplayFilename().string(), FontStyle::BOTTOM, COLOR_YELLOW); } else { @@ -440,7 +440,7 @@ void dskGameInterface::msgPaintAfter() { if(player.isLagging) { - LOADER.getPlayerImage("rttr", 0)->DrawFull(Rect(snailPos, 30, 30), COLOR_WHITE, + LOADER.getPlayerImage("rttr", 0)->drawFull(Rect(snailPos, 30, 30), COLOR_WHITE, game_->world_.getPlayer(player.id).color); snailPos.x -= 40; } @@ -454,7 +454,7 @@ void dskGameInterface::msgPaintAfter() if(cheats_.isCheatModeOn()) { glArchivItem_Bitmap* cheatingImg = LOADER.getImageN("io", 75); - cheatingImg->DrawFull(iconPos); + cheatingImg->drawFull(iconPos); iconPos -= DrawPoint(cheatingImg->getWidth() + 6, 0); } @@ -465,12 +465,12 @@ void dskGameInterface::msgPaintAfter() { glArchivItem_Bitmap* runnerImg = LOADER.getImageN("io", 164); - runnerImg->DrawFull(iconPos); + runnerImg->drawFull(iconPos); if(speedStep != 1) { std::string multiplier = helpers::toString(std::abs(speedStep)); - NormalFont->Draw(iconPos - runnerImg->getOrigin() + DrawPoint(19, 6), multiplier, FontStyle::LEFT, + NormalFont->draw(iconPos - runnerImg->getOrigin() + DrawPoint(19, 6), multiplier, FontStyle::LEFT, speedStep > 0 ? COLOR_YELLOW : COLOR_RED); } iconPos -= DrawPoint(runnerImg->getWidth() + 4, 0); @@ -481,16 +481,16 @@ void dskGameInterface::msgPaintAfter() { glArchivItem_Bitmap* magnifierImg = LOADER.getImageN("io", 36); - magnifierImg->DrawFull(iconPos); + magnifierImg->drawFull(iconPos); std::string zoom_percent = helpers::toString((int)(gwv.getCurrentTargetZoomFactor() * 100)) + "%"; - NormalFont->Draw(iconPos - magnifierImg->getOrigin() + DrawPoint(9, 7), zoom_percent, FontStyle::CENTER, + NormalFont->draw(iconPos - magnifierImg->getOrigin() + DrawPoint(9, 7), zoom_percent, FontStyle::CENTER, COLOR_YELLOW); iconPos -= DrawPoint(magnifierImg->getWidth() + 4, 0); } } -bool dskGameInterface::ContextClick(const MouseCoords& mc) +bool dskGameInterface::contextClick(const MouseCoords& mc) { // Handle road building mode if active if(road.mode != RoadBuildMode::Disabled) @@ -501,55 +501,55 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) if(selPt == road.point) { // Selektierter Punkt ist der gleiche wie der Straßenpunkt --> Fenster mit Wegbau abbrechen - ShowRoadWindow(mc.pos); + showRoadWindow(mc.pos); } else { // altes Roadwindow schließen - WINDOWMANAGER.Close((unsigned)CGI_ROADWINDOW); + WINDOWMANAGER.close((unsigned)CGI_ROADWINDOW); // Ist das ein gültiger neuer Wegpunkt? if(worldViewer.isRoadAvailable(road.mode == RoadBuildMode::Boat, selPt) && worldViewer.isPlayerTerritory(selPt)) { MapPoint targetPt = selPt; - if(!BuildRoadPart(targetPt)) - ShowRoadWindow(mc.pos); + if(!buildRoadPart(targetPt)) + showRoadWindow(mc.pos); } else if(worldViewer.GetBQ(selPt) != BuildingQuality::Nothing) { // Wurde bereits auf das gebaute Stück geklickt? unsigned idOnRoad = getIdInCurBuildRoad(selPt); if(idOnRoad) - DemolishRoad(idOnRoad); + demolishRoad(idOnRoad); else { MapPoint targetPt = selPt; - if(BuildRoadPart(targetPt)) + if(buildRoadPart(targetPt)) { // Ist der Zielpunkt der gleiche geblieben? if(selPt == targetPt) GI_BuildRoad(); } else if(selPt == targetPt) - ShowRoadWindow(mc.pos); + showRoadWindow(mc.pos); } } // Wurde auf eine Flagge geklickt und ist diese Flagge nicht der Weganfangspunkt? else if(worldViewer.getWorld().getNO(selPt)->getType() == NodalObjectType::Flag && selPt != road.start) { MapPoint targetPt = selPt; - if(BuildRoadPart(targetPt)) + if(buildRoadPart(targetPt)) { if(selPt == targetPt) GI_BuildRoad(); } else if(selPt == targetPt) - ShowRoadWindow(mc.pos); + showRoadWindow(mc.pos); } else { unsigned tbr = getIdInCurBuildRoad(selPt); // Wurde bereits auf das gebaute Stück geklickt? if(tbr) - DemolishRoad(tbr); + demolishRoad(tbr); else - ShowRoadWindow(mc.pos); + showRoadWindow(mc.pos); } } } else // Not in road building mode @@ -563,7 +563,7 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) // Vielleicht steht hier auch ein Schiff? if(const noShip* ship = worldViewer.getShip(cSel)) { - WINDOWMANAGER.Show(std::make_unique(gwv, GAMECLIENT, ship)); + WINDOWMANAGER.show(std::make_unique(gwv, GAMECLIENT, ship)); return true; } @@ -571,7 +571,7 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) const noBase& selObj = *worldViewer.getWorld().getNO(cSel); if(selObj.getType() == NodalObjectType::Building && worldViewer.isOwner(cSel)) { - if(auto* wnd = WINDOWMANAGER.FindNonModalWindow(CGI_BUILDING + MapBase::CreateGUIID(cSel))) + if(auto* wnd = WINDOWMANAGER.findNonModalWindow(CGI_BUILDING + MapBase::createGUIID(cSel))) { WINDOWMANAGER.setActiveWindow(*wnd); return true; @@ -579,33 +579,33 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) BuildingType bt = static_cast(selObj).getBuildingType(); // HQ if(bt == BuildingType::Headquarters) - WINDOWMANAGER.Show( + WINDOWMANAGER.show( std::make_unique(gwv, GAMECLIENT, worldViewer.getWorldNonConst().getSpecObj(cSel))); // Lagerhäuser else if(bt == BuildingType::Storehouse) - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( gwv, GAMECLIENT, worldViewer.getWorldNonConst().getSpecObj(cSel))); // Hafengebäude else if(bt == BuildingType::HarborBuilding) - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( gwv, GAMECLIENT, worldViewer.getWorldNonConst().getSpecObj(cSel))); // Militärgebäude else if(BuildingProperties::isMilitary(bt)) - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( gwv, GAMECLIENT, worldViewer.getWorldNonConst().getSpecObj(cSel))); else if(bt == BuildingType::Temple) - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( gwv, GAMECLIENT, worldViewer.getWorldNonConst().getSpecObj(cSel))); else - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( gwv, GAMECLIENT, worldViewer.getWorldNonConst().getSpecObj(cSel))); return true; } // oder vielleicht eine Baustelle? else if(selObj.getType() == NodalObjectType::Buildingsite && worldViewer.isOwner(cSel)) { - if(!WINDOWMANAGER.FindNonModalWindow(CGI_BUILDING + MapBase::CreateGUIID(cSel))) - WINDOWMANAGER.Show( + if(!WINDOWMANAGER.findNonModalWindow(CGI_BUILDING + MapBase::createGUIID(cSel))) + WINDOWMANAGER.show( std::make_unique(gwv, worldViewer.getWorld().getSpecObj(cSel))); return true; } @@ -671,7 +671,7 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) // Allied warehouse? -> Show trade window if(BuildingProperties::isWareHouse(bt) && worldViewer.getPlayer().isAlly(building->getPlayer())) { - WINDOWMANAGER.Show(std::make_unique(*static_cast(building), + WINDOWMANAGER.show(std::make_unique(*static_cast(building), worldViewer, GAMECLIENT)); return true; } @@ -695,10 +695,10 @@ bool dskGameInterface::ContextClick(const MouseCoords& mc) // Bisheriges Actionfenster schließen, falls es eins gab // aktuelle Mausposition merken, da diese durch das Schließen verändert werden kann if(actionwindow) - actionwindow->Close(); + actionwindow->close(); VIDEODRIVER.setMousePos(mc.pos); - ShowActionWindow(action_tabs, cSel, mc.pos, enable_military_buildings); + showActionWindow(action_tabs, cSel, mc.pos, enable_military_buildings); } return true; @@ -721,14 +721,14 @@ bool dskGameInterface::msgLeftDown(const MouseCoords& mc) msgRightDown(mc); return true; } else if(isScrolling) - StopScrolling(); + stopScrolling(); - return ContextClick(mc); + return contextClick(mc); } else if(mc.num_tfingers < 2) touchDuration = VIDEODRIVER.getTickCount(); else if(isScrolling) // 2 fingers down -> zoom mode. Do not click or scroll map - StopScrolling(); + stopScrolling(); return true; } @@ -737,14 +737,14 @@ bool dskGameInterface::msgLeftUp(const MouseCoords& mc) { if(isScrolling) { - StopScrolling(); + stopScrolling(); return true; } // num_tfingers is reduced after this function to check if it's still a touch event // Was touch duration short enough to trigger conext click? if(mc.num_tfingers == 1 && (VIDEODRIVER.getTickCount() - touchDuration) < TOUCH_MAX_CLICK_INTERVAL) - return ContextClick(mc); + return contextClick(mc); return false; } @@ -761,8 +761,8 @@ bool dskGameInterface::msgMouseMove(const MouseCoords& mc) if(SETTINGS.interface.mapScrollMode == MapScrollMode::GrabAndDrag) { - const Position mapPos = gwv.ViewPosToMap(mc.pos); - gwv.MoveBy(-(mapPos - startScrollPt)); + const Position mapPos = gwv.viewPosToMap(mc.pos); + gwv.moveBy(-(mapPos - startScrollPt)); startScrollPt = mapPos; } else { @@ -771,7 +771,7 @@ bool dskGameInterface::msgMouseMove(const MouseCoords& mc) if(SETTINGS.interface.mapScrollMode == MapScrollMode::ScrollSame) acceleration = -acceleration; - gwv.MoveBy((mc.pos - startScrollPt) * acceleration); + gwv.moveBy((mc.pos - startScrollPt) * acceleration); VIDEODRIVER.setMousePos(startScrollPt); if(!SETTINGS.global.smartCursor) @@ -784,16 +784,16 @@ bool dskGameInterface::msgMouseMove(const MouseCoords& mc) bool dskGameInterface::msgRightDown(const MouseCoords& mc) { if(SETTINGS.interface.mapScrollMode == MapScrollMode::GrabAndDrag) - StartScrolling(gwv.ViewPosToMap(mc.pos)); + startScrolling(gwv.viewPosToMap(mc.pos)); else - StartScrolling(mc.pos); + startScrolling(mc.pos); return true; } bool dskGameInterface::msgRightUp(const MouseCoords& /*mc*/) //-V524 { if(isScrolling) - StopScrolling(); + stopScrolling(); return false; } @@ -805,45 +805,45 @@ bool dskGameInterface::msgKeyDown(const KeyEvent& ke) { default: break; case KeyType::Return: // Open chat - WINDOWMANAGER.Show(std::make_unique(this)); + WINDOWMANAGER.show(std::make_unique(this)); return true; case KeyType::Left: // Scroll left - gwv.MoveBy({-30, 0}); + gwv.moveBy({-30, 0}); return true; case KeyType::Right: // Scroll right - gwv.MoveBy({30, 0}); + gwv.moveBy({30, 0}); return true; case KeyType::Up: // Scroll up - gwv.MoveBy({0, -30}); + gwv.moveBy({0, -30}); return true; case KeyType::Down: // Scroll down - gwv.MoveBy({0, 30}); + gwv.moveBy({0, 30}); return true; case KeyType::F2: // Open save game window - WINDOWMANAGER.ToggleWindow(std::make_unique()); + WINDOWMANAGER.toggleWindow(std::make_unique()); return true; case KeyType::F3: // Map debug window { const bool replayMode = GAMECLIENT.isReplayModeOn(); if(replayMode) - DisableFoW(true); - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv, game_->world_.isSinglePlayer() || replayMode)); + disableFoW(true); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv, game_->world_.isSinglePlayer() || replayMode)); return true; } case KeyType::F8: - WINDOWMANAGER.ToggleWindow(std::make_unique("keyboardlayout.txt", _("Keyboard layout"))); + WINDOWMANAGER.toggleWindow(std::make_unique("keyboardlayout.txt", _("Keyboard layout"))); return true; case KeyType::F9: - WINDOWMANAGER.ToggleWindow(std::make_unique("readme.txt", _("Readme!"))); + WINDOWMANAGER.toggleWindow(std::make_unique("readme.txt", _("Readme!"))); return true; - case KeyType::F10: WINDOWMANAGER.ToggleWindow(std::make_unique()); return true; + case KeyType::F10: WINDOWMANAGER.toggleWindow(std::make_unique()); return true; case KeyType::F11: // Music player (midi files) - WINDOWMANAGER.ToggleWindow(std::make_unique()); + WINDOWMANAGER.toggleWindow(std::make_unique()); return true; case KeyType::F12: // Ingame options - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getSoundMgr())); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv.getSoundMgr())); return true; } @@ -851,11 +851,11 @@ bool dskGameInterface::msgKeyDown(const KeyEvent& ke) { case '+': if(GAMECLIENT.isReplayModeOn() || game_->world_.isSinglePlayer()) - GAMECLIENT.IncreaseSpeed(); + GAMECLIENT.increaseSpeed(); return true; case '-': if(GAMECLIENT.isReplayModeOn() || game_->world_.isSinglePlayer()) - GAMECLIENT.DecreaseSpeed(); + GAMECLIENT.decreaseSpeed(); return true; // Switch to specific player @@ -872,7 +872,7 @@ bool dskGameInterface::msgKeyDown(const KeyEvent& ke) if(GAMECLIENT.isReplayModeOn()) { unsigned oldPlayerId = worldViewer.getPlayerId(); - GAMECLIENT.ChangePlayerIngame(worldViewer.getPlayerId(), playerIdx); + GAMECLIENT.changePlayerIngame(worldViewer.getPlayerId(), playerIdx); RTTR_Assert(worldViewer.getPlayerId() == oldPlayerId || worldViewer.getPlayerId() == playerIdx); } else if(playerIdx < worldViewer.getWorld().getNumPlayers()) { @@ -882,61 +882,61 @@ bool dskGameInterface::msgKeyDown(const KeyEvent& ke) { const GamePlayer& player = worldViewer.getWorld().getPlayer(playerIdx); if(player.ps == PlayerState::AI && player.aiInfo.type == AI::Type::Dummy) - GAMECLIENT.RequestSwapToPlayer(playerIdx); + GAMECLIENT.requestSwapToPlayer(playerIdx); } } return true; } - case 'b': gwv.MoveToLastPosition(); return true; + case 'b': gwv.moveToLastPosition(); return true; case 'v': if(game_->world_.isSinglePlayer()) - GAMECLIENT.IncreaseSpeed(true); + GAMECLIENT.increaseSpeed(true); return true; case 'c': // Show/hide building names - gwv.ToggleShowNames(); + gwv.toggleShowNames(); return true; case 'd': // Enable/Disable fog of war (in replay mode) - ToggleFoW(); + toggleFoW(); return true; case 'h': // Go to HQ { const GamePlayer& player = worldViewer.getPlayer(); // HQ might not exist anymore if(player.getHQPos().isValid()) - gwv.MoveToMapPt(player.getHQPos()); + gwv.moveToMapPt(player.getHQPos()); } return true; case 'i': // Show inventory - WINDOWMANAGER.ToggleWindow(std::make_unique(worldViewer.getPlayer())); + WINDOWMANAGER.toggleWindow(std::make_unique(worldViewer.getPlayer())); return true; case 'j': // Skip GFs (fast forward) if(game_->world_.isSinglePlayer() || GAMECLIENT.isReplayModeOn()) - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv)); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv)); return true; case 'l': // Show minimap - WINDOWMANAGER.ToggleWindow(std::make_unique(minimap, gwv)); + WINDOWMANAGER.toggleWindow(std::make_unique(minimap, gwv)); return true; case 'm': // Show main menu - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv, GAMECLIENT)); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv, GAMECLIENT)); return true; case 'n': // Show message window - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv, getPostBox())); - UpdatePostIcon(getPostBox().getNumMsgs(), false); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv, getPostBox())); + updatePostIcon(getPostBox().getNumMsgs(), false); return true; case 'p': // Pause - GAMECLIENT.TogglePause(); + GAMECLIENT.togglePause(); return true; case 'q': // Quit game (dialog) if(ke.alt) - WINDOWMANAGER.ToggleWindow(std::make_unique()); + WINDOWMANAGER.toggleWindow(std::make_unique()); return true; case 's': // Show/hide productivity overlay - gwv.ToggleShowProductivity(); + gwv.toggleShowProductivity(); return true; case ' ': // Show/hide construction aid // workaround for Wayland which does not capture SDLK_SPACE when SDL_StartTextInput() was called - gwv.ToggleShowBQ(); + gwv.toggleShowBQ(); return true; case 26: // ctrl+z gwv.setZoomFactor(ZOOM_FACTORS[ZOOM_DEFAULT_INDEX]); @@ -957,16 +957,16 @@ bool dskGameInterface::msgKeyDown(const KeyEvent& ke) bool dskGameInterface::msgWheelUp(const MouseCoords&) { - WheelZoom(ZOOM_WHEEL_INCREMENT); + wheelZoom(ZOOM_WHEEL_INCREMENT); return true; } bool dskGameInterface::msgWheelDown(const MouseCoords&) { - WheelZoom(-ZOOM_WHEEL_INCREMENT); + wheelZoom(-ZOOM_WHEEL_INCREMENT); return true; } -void dskGameInterface::WheelZoom(const float step) +void dskGameInterface::wheelZoom(const float step) { auto targetZoomFactor = gwv.getCurrentTargetZoomFactor() * (1 + step); targetZoomFactor = std::clamp(targetZoomFactor, ZOOM_FACTORS.front(), ZOOM_FACTORS.back()); @@ -976,7 +976,7 @@ void dskGameInterface::WheelZoom(const float step) gwv.setZoomFactor(targetZoomFactor); } -void dskGameInterface::OnBuildingNote(const BuildingNote& note) +void dskGameInterface::onBuildingNote(const BuildingNote& note) { switch(note.type) { @@ -985,34 +985,34 @@ void dskGameInterface::OnBuildingNote(const BuildingNote& note) case BuildingNote::Lost: // Close the related window as the building does not exist anymore // In "Constructed" this means the buildingsite - WINDOWMANAGER.Close(CGI_BUILDING + MapBase::CreateGUIID(note.pos)); + WINDOWMANAGER.close(CGI_BUILDING + MapBase::createGUIID(note.pos)); break; default: break; } } -void dskGameInterface::Run() +void dskGameInterface::run() { // Reset draw counter of the trees before drawing - noTree::ResetDrawCounter(); + noTree::resetDrawCounter(); unsigned water_percent; // Draw mouse only if not on window - bool drawMouse = WINDOWMANAGER.FindWindowAtPos(VIDEODRIVER.getMousePos()) == nullptr; - gwv.Draw(road, actionwindow != nullptr ? actionwindow->getSelectedPt() : MapPoint::Invalid(), drawMouse, + bool drawMouse = WINDOWMANAGER.findWindowAtPos(VIDEODRIVER.getMousePos()) == nullptr; + gwv.draw(road, actionwindow != nullptr ? actionwindow->getSelectedPt() : MapPoint::invalid(), drawMouse, &water_percent); // Indicate that the game is paused by darkening the screen (dark semi-transparent overlay) if(GAMECLIENT.isPaused()) - DrawRectangle(Rect(DrawPoint(0, 0), VIDEODRIVER.getRenderSize()), COLOR_SHADOW); + drawRectangle(Rect(DrawPoint(0, 0), VIDEODRIVER.getRenderSize()), COLOR_SHADOW); else { // Play ambient sounds if game is not paused worldViewer.getSoundMgr().playOceanBrawling(water_percent); - worldViewer.getSoundMgr().playBirdSounds(noTree::QueryDrawCounter()); + worldViewer.getSoundMgr().playBirdSounds(noTree::queryDrawCounter()); } - messenger.Draw(); + messenger.draw(); } void dskGameInterface::GI_StartRoadBuilding(const MapPoint startPt, bool waterRoad) @@ -1024,7 +1024,7 @@ void dskGameInterface::GI_StartRoadBuilding(const MapPoint startPt, bool waterRo road.mode = waterRoad ? RoadBuildMode::Boat : RoadBuildMode::Normal; road.route.clear(); road.start = road.point = startPt; - WINDOWMANAGER.setCursor(Cursor::Remove); + WINDOWMANAGER.setCursor(Cursor::remove); } void dskGameInterface::GI_CancelRoadBuilding() @@ -1032,11 +1032,11 @@ void dskGameInterface::GI_CancelRoadBuilding() if(road.mode == RoadBuildMode::Disabled) return; road.mode = RoadBuildMode::Disabled; - worldViewer.RemoveVisualRoad(road.start, road.route); + worldViewer.removeVisualRoad(road.start, road.route); WINDOWMANAGER.setCursor(isScrolling ? Cursor::Scroll : Cursor::Hand); } -bool dskGameInterface::BuildRoadPart(MapPoint& cSel) +bool dskGameInterface::buildRoadPart(MapPoint& cSel) { std::vector new_route = FindPathForRoad(worldViewer, road.point, cSel, road.mode == RoadBuildMode::Boat, 100); @@ -1071,10 +1071,10 @@ bool dskGameInterface::BuildRoadPart(MapPoint& cSel) { worldViewer.setVisiblePointRoad(road.point, dir, (road.mode == RoadBuildMode::Boat) ? PointRoad::Boat : PointRoad::Normal); - worldViewer.RecalcBQForRoad(road.point); + worldViewer.recalcBQForRoad(road.point); road.point = worldViewer.getWorld().getNeighbour(road.point, dir); } - worldViewer.RecalcBQForRoad(road.point); + worldViewer.recalcBQForRoad(road.point); // Zielpunkt updaten (für Wasserweg) cSel = road.point; @@ -1097,13 +1097,13 @@ unsigned dskGameInterface::getIdInCurBuildRoad(const MapPoint pt) return 0; } -void dskGameInterface::ShowRoadWindow(const Position& mousePos) +void dskGameInterface::showRoadWindow(const Position& mousePos) { - roadwindow = &WINDOWMANAGER.Show( + roadwindow = &WINDOWMANAGER.show( std::make_unique(*this, worldViewer.GetBQ(road.point) != BuildingQuality::Nothing, mousePos), true); } -void dskGameInterface::ShowActionWindow(const iwAction::Tabs& action_tabs, MapPoint cSel, const DrawPoint& mousePos, +void dskGameInterface::showActionWindow(const iwAction::Tabs& action_tabs, MapPoint cSel, const DrawPoint& mousePos, const bool enable_military_buildings) { const GameWorldBase& world = worldViewer.getWorld(); @@ -1136,18 +1136,18 @@ void dskGameInterface::ShowActionWindow(const iwAction::Tabs& action_tabs, MapPo params = worldViewer.getNumSoldiersForAttack(cSel); } - actionwindow = &WINDOWMANAGER.Show( + actionwindow = &WINDOWMANAGER.show( std::make_unique(*this, gwv, action_tabs, cSel, mousePos, params, enable_military_buildings), true); } -void dskGameInterface::OnChatCommand(const std::string& cmd) +void dskGameInterface::onChatCommand(const std::string& cmd) { cheatCommandTracker_.onChatCommand(cmd); if(cmd == "surrender") GAMECLIENT.Surrender(); else if(cmd == "async") - (void)RANDOM.Rand(RANDOM_CONTEXT2(0), 255); + (void)RANDOM.rand(RANDOM_CONTEXT2(0), 255); else if(cmd == "segfault") { char* x = nullptr; @@ -1159,7 +1159,7 @@ void dskGameInterface::OnChatCommand(const std::string& cmd) if(gdLoader.Load()) { const_cast(game_->world_).getDescriptionWriteable() = newDesc; - worldViewer.InitTerrainRenderer(); + worldViewer.initTerrainRenderer(); } } } @@ -1193,7 +1193,7 @@ void dskGameInterface::GI_FlagDestroyed(const MapPoint pt) if(actionwindow) { if(actionwindow->getSelectedPt() == pt) - actionwindow->Close(); + actionwindow->close(); } } @@ -1202,56 +1202,56 @@ void dskGameInterface::CI_PlayerLeft(const unsigned playerId) // Info-Meldung ausgeben std::string text = helpers::format(_("Player '%s' left the game!"), worldViewer.getWorld().getPlayer(playerId).name); - messenger.AddMessage("", 0, ChatDestination::System, text, COLOR_RED); + messenger.addMessage("", 0, ChatDestination::System, text, COLOR_RED); // Im Spiel anzeigen, dass die KI das Spiel betreten hat text = helpers::format(_("Player '%s' joined the game!"), "KI"); - messenger.AddMessage("", 0, ChatDestination::System, text, COLOR_GREEN); + messenger.addMessage("", 0, ChatDestination::System, text, COLOR_GREEN); } void dskGameInterface::CI_GGSChanged(const GlobalGameSettings& /*ggs*/) { // TODO: print what has changed const std::string text = helpers::format(_("Note: Game settings changed by the server%s"), ""); - messenger.AddMessage("", 0, ChatDestination::System, text); + messenger.addMessage("", 0, ChatDestination::System, text); } void dskGameInterface::CI_Chat(const unsigned playerId, const ChatDestination cd, const std::string& msg) { - messenger.AddMessage(worldViewer.getWorld().getPlayer(playerId).name, + messenger.addMessage(worldViewer.getWorld().getPlayer(playerId).name, worldViewer.getWorld().getPlayer(playerId).color, cd, msg); } void dskGameInterface::CI_Async(const std::string& checksums_list) { - messenger.AddMessage("", 0, ChatDestination::System, + messenger.addMessage("", 0, ChatDestination::System, _("The Game is not in sync. Checksums of some players don't match."), COLOR_RED); - messenger.AddMessage("", 0, ChatDestination::System, checksums_list, COLOR_YELLOW); - messenger.AddMessage("", 0, ChatDestination::System, _("A auto-savegame is created..."), COLOR_RED); + messenger.addMessage("", 0, ChatDestination::System, checksums_list, COLOR_YELLOW); + messenger.addMessage("", 0, ChatDestination::System, _("A auto-savegame is created..."), COLOR_RED); } void dskGameInterface::CI_ReplayAsync(const std::string& msg) { - messenger.AddMessage("", 0, ChatDestination::System, msg, COLOR_RED); + messenger.addMessage("", 0, ChatDestination::System, msg, COLOR_RED); } void dskGameInterface::CI_ReplayEndReached(const std::string& msg) { - messenger.AddMessage("", 0, ChatDestination::System, msg, COLOR_BLUE); + messenger.addMessage("", 0, ChatDestination::System, msg, COLOR_BLUE); } void dskGameInterface::CI_GamePaused() { - messenger.AddMessage(_("SYSTEM"), COLOR_GREY, ChatDestination::System, _("Game was paused.")); + messenger.addMessage(_("SYSTEM"), COLOR_GREY, ChatDestination::System, _("Game was paused.")); } void dskGameInterface::CI_GameResumed() { - messenger.AddMessage(_("SYSTEM"), COLOR_GREY, ChatDestination::System, _("Game was resumed.")); + messenger.addMessage(_("SYSTEM"), COLOR_GREY, ChatDestination::System, _("Game was resumed.")); } void dskGameInterface::CI_Error(const ClientError ce) { - messenger.AddMessage("", 0, ChatDestination::System, ClientErrorToStr(ce), COLOR_RED); + messenger.addMessage("", 0, ChatDestination::System, clientErrorToStr(ce), COLOR_RED); GAMECLIENT.setPause(true); } @@ -1260,7 +1260,7 @@ void dskGameInterface::CI_Error(const ClientError ce) */ void dskGameInterface::LC_Status_ConnectionLost() { - messenger.AddMessage("", 0, ChatDestination::System, _("Lost connection to lobby!"), COLOR_RED); + messenger.addMessage("", 0, ChatDestination::System, _("Lost connection to lobby!"), COLOR_RED); } /** @@ -1268,7 +1268,7 @@ void dskGameInterface::LC_Status_ConnectionLost() */ void dskGameInterface::LC_Status_Error(const std::string& error) { - messenger.AddMessage("", 0, ChatDestination::System, error, COLOR_RED); + messenger.addMessage("", 0, ChatDestination::System, error, COLOR_RED); } void dskGameInterface::CI_PlayersSwapped(const unsigned player1, const unsigned player2) @@ -1276,17 +1276,17 @@ void dskGameInterface::CI_PlayersSwapped(const unsigned player1, const unsigned // Meldung anzeigen std::string text = "Player '" + worldViewer.getWorld().getPlayer(player1).name + "' switched to player '" + worldViewer.getWorld().getPlayer(player2).name + "'"; - messenger.AddMessage("", 0, ChatDestination::System, text, COLOR_YELLOW); + messenger.addMessage("", 0, ChatDestination::System, text, COLOR_YELLOW); // Sichtbarkeiten und Minimap neu berechnen, wenn wir ein von den beiden Spielern sind const unsigned localPlayerId = worldViewer.getPlayerId(); if(player1 == localPlayerId || player2 == localPlayerId) { - worldViewer.ChangePlayer(player1 == localPlayerId ? player2 : player1); + worldViewer.changePlayer(player1 == localPlayerId ? player2 : player1); // Set visual settings back to the actual ones - GAMECLIENT.ResetVisualSettings(); - minimap.UpdateAll(); - InitPlayer(); + GAMECLIENT.resetVisualSettings(); + minimap.updateAll(); + initPlayer(); } } @@ -1297,30 +1297,30 @@ void dskGameInterface::GI_PlayerDefeated(const unsigned playerId) { const std::string text = helpers::format(_("Player '%s' was defeated!"), worldViewer.getWorld().getPlayer(playerId).name); - messenger.AddMessage("", 0, ChatDestination::System, text, COLOR_ORANGE); + messenger.addMessage("", 0, ChatDestination::System, text, COLOR_ORANGE); /// Lokaler Spieler? if(playerId == worldViewer.getPlayerId()) { /// Sichtbarkeiten neu berechnen - worldViewer.RecalcAllColors(); + worldViewer.recalcAllColors(); // Minimap updaten - minimap.UpdateAll(); + minimap.updateAll(); } } void dskGameInterface::GI_UpdateMinimap(const MapPoint pt) { // Minimap Bescheid sagen - minimap.UpdateNode(pt); + minimap.updateNode(pt); } void dskGameInterface::GI_UpdateMapVisibility() { // recalculate visibility - worldViewer.RecalcAllColors(); + worldViewer.recalcAllColors(); // update minimap - minimap.UpdateAll(); + minimap.updateAll(); } /** @@ -1332,16 +1332,16 @@ void dskGameInterface::GI_TreatyOfAllianceChanged(unsigned playerId) if(playerId == worldViewer.getPlayerId() && worldViewer.getWorld().getGGS().teamView) { /// Sichtbarkeiten neu berechnen - worldViewer.RecalcAllColors(); + worldViewer.recalcAllColors(); // Minimap updaten - minimap.UpdateAll(); + minimap.updateAll(); } } /** * Baut Weg zurück von Ende bis zu start_id */ -void dskGameInterface::DemolishRoad(const unsigned start_id) +void dskGameInterface::demolishRoad(const unsigned start_id) { RTTR_Assert(start_id > 0); for(unsigned i = road.route.size(); i >= start_id; --i) @@ -1349,7 +1349,7 @@ void dskGameInterface::DemolishRoad(const unsigned start_id) MapPoint t = road.point; road.point = worldViewer.getWorld().getNeighbour(road.point, road.route[i - 1] + 3u); worldViewer.setVisiblePointRoad(road.point, road.route[i - 1], PointRoad::None); - worldViewer.RecalcBQForRoad(t); + worldViewer.recalcBQForRoad(t); } road.route.resize(start_id - 1); @@ -1358,7 +1358,7 @@ void dskGameInterface::DemolishRoad(const unsigned start_id) /** * Updatet das Post-Icon mit der Nachrichtenanzahl und der Taube */ -void dskGameInterface::UpdatePostIcon(const unsigned postmessages_count, bool showPigeon) +void dskGameInterface::updatePostIcon(const unsigned postmessages_count, bool showPigeon) { // Taube setzen oder nicht (Post) if(postmessages_count == 0 || !showPigeon) @@ -1377,23 +1377,23 @@ void dskGameInterface::UpdatePostIcon(const unsigned postmessages_count, bool sh /** * Neue Post-Nachricht eingetroffen */ -void dskGameInterface::NewPostMessage(const PostMsg& msg, const unsigned msgCt) +void dskGameInterface::newPostMessage(const PostMsg& msg, const unsigned msgCt) { - UpdatePostIcon(msgCt, true); + updatePostIcon(msgCt, true); SoundEffect soundEffect = msg.getSoundEffect(); switch(soundEffect) { - case SoundEffect::Pidgeon: LOADER.getSoundN("sound", 114)->Play(100, false); break; - case SoundEffect::Fanfare: LOADER.getSoundN("sound", 110)->Play(100, false); + case SoundEffect::Pidgeon: LOADER.getSoundN("sound", 114)->play(100, false); break; + case SoundEffect::Fanfare: LOADER.getSoundN("sound", 110)->play(100, false); } } /** * Es wurde eine Postnachricht vom Spieler gelöscht */ -void dskGameInterface::PostMessageDeleted(const unsigned msgCt) +void dskGameInterface::postMessageDeleted(const unsigned msgCt) { - UpdatePostIcon(msgCt, false); + updatePostIcon(msgCt, false); } /** @@ -1403,8 +1403,8 @@ void dskGameInterface::GI_Winner(const unsigned playerId) { const std::string name = worldViewer.getWorld().getPlayer(playerId).name; const std::string text = (boost::format(_("Player '%s' is the winner!")) % name).str(); - messenger.AddMessage("", 0, ChatDestination::System, text, COLOR_ORANGE); - WINDOWMANAGER.Show(std::make_unique(std::vector(1, name))); + messenger.addMessage("", 0, ChatDestination::System, text, COLOR_ORANGE); + WINDOWMANAGER.show(std::make_unique(std::vector(1, name))); } /** @@ -1421,6 +1421,6 @@ void dskGameInterface::GI_TeamWinner(const unsigned playerMask) } const std::string text = (boost::format(_("%1% are the winners!")) % helpers::join(winners, ", ", _(" and "))).str(); - messenger.AddMessage("", 0, ChatDestination::System, text, COLOR_ORANGE); - WINDOWMANAGER.Show(std::make_unique(winners)); + messenger.addMessage("", 0, ChatDestination::System, text, COLOR_ORANGE); + WINDOWMANAGER.show(std::make_unique(winners)); } diff --git a/libs/s25main/desktops/dskGameInterface.h b/libs/s25main/desktops/dskGameInterface.h index d87d15c104..42aad2a56c 100644 --- a/libs/s25main/desktops/dskGameInterface.h +++ b/libs/s25main/desktops/dskGameInterface.h @@ -44,7 +44,7 @@ class dskGameInterface : bool initOGL = true); ~dskGameInterface() override; - void Resize(const Extent& newSize) override; + void resize(const Extent& newSize) override; void setActive(bool activate = true) override; void LC_Status_ConnectionLost() override; @@ -63,8 +63,8 @@ class dskGameInterface : void CI_Error(ClientError ce) override; void CI_PlayersSwapped(unsigned player1, unsigned player2) override; - void NewPostMessage(const PostMsg& msg, unsigned msgCt); - void PostMessageDeleted(unsigned msgCt); + void newPostMessage(const PostMsg& msg, unsigned msgCt); + void postMessageDeleted(unsigned msgCt); /// Wird aufgerufen, wann immer eine Flagge zerstört wurde, da so evtl der Wegbau abgebrochen werden muss void GI_FlagDestroyed(MapPoint pt) override; @@ -90,35 +90,35 @@ class dskGameInterface : // Bei Wasserwegen kann die Reichweite nicht bis zum gewünschten // Punkt reichen. Dann werden die Zielkoordinaten geändert, daher // call-by-reference - bool BuildRoadPart(MapPoint& cSel); + bool buildRoadPart(MapPoint& cSel); // Return the id (index + 1) of the point in the currently build road (1 = startPt) // If pt is not on the road, return 0 unsigned getIdInCurBuildRoad(MapPoint pt); /// Baut Weg zurück von Ende bis zu start_id - void DemolishRoad(unsigned start_id); + void demolishRoad(unsigned start_id); // Zeigt das Straäcnfenster an und entscheidet selbststäcdig, ob man eine Flagge an road_point_x/y bauen kann, // ansonsten gibt's nur nen Button zum Abbrechen - void ShowRoadWindow(const Position& mousePos); + void showRoadWindow(const Position& mousePos); /// Zeigt das Actionwindow an, bei Flaggen werden z.B. noch berücksichtigt, obs ne besondere Flagge ist usw - void ShowActionWindow(const iwAction::Tabs& action_tabs, MapPoint cSel, const DrawPoint& mousePos, + void showActionWindow(const iwAction::Tabs& action_tabs, MapPoint cSel, const DrawPoint& mousePos, bool enable_military_buildings); const GameWorldView& getView() const { return gwv; } - void OnChatCommand(const std::string& cmd) override; + void onChatCommand(const std::string& cmd) override; protected: /// Initializes player specific stuff after start or player swap - void InitPlayer(); + void initPlayer(); /// Lässt das Spiel laufen (zeichnen) - void Run(); + void run(); /// Updatet das Post-Icon mit der Nachrichtenanzahl und der Taube - void UpdatePostIcon(unsigned postmessages_count, bool showPigeon); + void updatePostIcon(unsigned postmessages_count, bool showPigeon); /// Executed during left click. Checks click pos for buildings/roads - bool ContextClick(const MouseCoords& mc); + bool contextClick(const MouseCoords& mc); void msgButtonClick(unsigned ctrl_id) override; void msgPaintBefore() override; @@ -132,17 +132,17 @@ class dskGameInterface : bool msgWheelUp(const MouseCoords& mc) override; bool msgWheelDown(const MouseCoords& mc) override; - void WheelZoom(float step); + void wheelZoom(float step); void msgWindowClosed(IngameWindow& wnd) override; - void OnBuildingNote(const BuildingNote& note); + void onBuildingNote(const BuildingNote& note); - void StopScrolling(); - void StartScrolling(const Position& mousePos); - void ToggleFoW(); // Switch Fog of War mode if possible - void DisableFoW(bool hideFOW); // Set Fog of War mode if possible - void ShowPersistentWindowsAfterSwitch(); + void stopScrolling(); + void startScrolling(const Position& mousePos); + void toggleFoW(); // Switch Fog of War mode if possible + void disableFoW(bool hideFOW); // Set Fog of War mode if possible + void showPersistentWindowsAfterSwitch(); PostBox& getPostBox(); std::shared_ptr game_; diff --git a/libs/s25main/desktops/dskGameLoader.cpp b/libs/s25main/desktops/dskGameLoader.cpp index 108f535eb1..09f96d5e17 100644 --- a/libs/s25main/desktops/dskGameLoader.cpp +++ b/libs/s25main/desktops/dskGameLoader.cpp @@ -31,12 +31,12 @@ dskGameLoader::dskGameLoader(std::shared_ptr game) WINDOWMANAGER.setCursor(Cursor::None); using namespace std::chrono_literals; - AddTimer(1, 50ms); + addTimer(1, 50ms); - AddText(10, DrawPoint(800 / 2, 600 - 50), "", COLOR_YELLOW, FontStyle::CENTER, LargeFont); + addText(10, DrawPoint(800 / 2, 600 - 50), "", COLOR_YELLOW, FontStyle::CENTER, LargeFont); for(unsigned i = 0; i < 8; ++i) - AddText(11 + i, DrawPoint(30, 30 + i * 20), "", COLOR_GREEN, FontStyle{}, LargeFont); + addText(11 + i, DrawPoint(30, 30 + i * 20), "", COLOR_GREEN, FontStyle{}, LargeFont); LOBBYCLIENT.AddListener(this); GAMECLIENT.setInterface(this); @@ -46,14 +46,14 @@ dskGameLoader::~dskGameLoader() { WINDOWMANAGER.setCursor(); LOBBYCLIENT.RemoveListener(this); - GAMECLIENT.RemoveInterface(this); + GAMECLIENT.removeInterface(this); } void dskGameLoader::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult /*mbr*/) { if(msgbox_id == 0) // Verbindung zu Server verloren? { - GAMECLIENT.Stop(); + GAMECLIENT.stop(); if(LOBBYCLIENT.IsLoggedIn()) // steht die Lobbyverbindung noch? WINDOWMANAGER.Switch(std::make_unique()); @@ -71,7 +71,7 @@ void dskGameLoader::msgTimer(const unsigned /*ctrl_id*/) using namespace std::chrono_literals; const auto interval = 50ms; - timer->Stop(); + timer->stop(); switch(position) { @@ -94,7 +94,7 @@ void dskGameLoader::msgTimer(const unsigned /*ctrl_id*/) loader_.initTextures(); if(!loader_.loadTextures()) { - ShowErrorMsg(_("Failed to load game resources")); + showErrorMsg(_("Failed to load game resources")); return; // Don't restart timer! } @@ -109,13 +109,13 @@ void dskGameLoader::msgTimer(const unsigned /*ctrl_id*/) GAMECLIENT.getPlayerId()); } catch(const std::runtime_error& e) { - ShowErrorMsg(std::string(_("Failed to init GUI: ")) + e.what()); + showErrorMsg(std::string(_("Failed to init GUI: ")) + e.what()); return; } // TODO: richtige Messages senden, um das zu laden /*GetMap()->GenerateOpenGL();*/ // We are done, wait for others - GAMECLIENT.GameLoaded(); + GAMECLIENT.gameLoaded(); text->setText(_("World was put together and glued...")); break; @@ -127,17 +127,17 @@ void dskGameLoader::msgTimer(const unsigned /*ctrl_id*/) } ++position; - timer->Start(interval); + timer->start(interval); } -void dskGameLoader::ShowErrorMsg(const std::string& error) +void dskGameLoader::showErrorMsg(const std::string& error) { auto wnd = std::make_unique(_("Error"), error, this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, 0); if(IsActive()) - WINDOWMANAGER.Show(std::move(wnd)); + WINDOWMANAGER.show(std::move(wnd)); else - WINDOWMANAGER.ShowAfterSwitch(std::move(wnd)); - getCtrl(1)->Stop(); + WINDOWMANAGER.showAfterSwitch(std::move(wnd)); + getCtrl(1)->stop(); } /** @@ -145,7 +145,7 @@ void dskGameLoader::ShowErrorMsg(const std::string& error) */ void dskGameLoader::LC_Status_Error(const std::string& error) { - ShowErrorMsg(error); + showErrorMsg(error); } void dskGameLoader::CI_GameStarted() @@ -156,5 +156,5 @@ void dskGameLoader::CI_GameStarted() void dskGameLoader::CI_Error(const ClientError ce) { - ShowErrorMsg(ClientErrorToStr(ce)); + showErrorMsg(clientErrorToStr(ce)); } diff --git a/libs/s25main/desktops/dskGameLoader.h b/libs/s25main/desktops/dskGameLoader.h index 0a36d44a43..eab65b0a60 100644 --- a/libs/s25main/desktops/dskGameLoader.h +++ b/libs/s25main/desktops/dskGameLoader.h @@ -25,7 +25,7 @@ class dskGameLoader : public Desktop, public ClientInterface, public LobbyInterf private: void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; void msgTimer(unsigned ctrl_id) override; - void ShowErrorMsg(const std::string& error); + void showErrorMsg(const std::string& error); unsigned position; GameLoader loader_; diff --git a/libs/s25main/desktops/dskGameLobby.cpp b/libs/s25main/desktops/dskGameLobby.cpp index 27716b62ac..1adfc5b96c 100644 --- a/libs/s25main/desktops/dskGameLobby.cpp +++ b/libs/s25main/desktops/dskGameLobby.cpp @@ -146,17 +146,17 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam lua = std::make_unique(*lobbyController, GAMECLIENT); if(!lua->loadScript(GAMECLIENT.getLuaFilePath())) { - WINDOWMANAGER.ShowAfterSwitch(std::make_unique( + WINDOWMANAGER.showAfterSwitch(std::make_unique( _("Error"), _("Lua script was found but failed to load. Map might not work as expected!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, ID_mbLuaLoadError)); lua.reset(); - } else if(!lua->CheckScriptVersion()) + } else if(!lua->checkScriptVersion()) { - WINDOWMANAGER.ShowAfterSwitch(std::make_unique( + WINDOWMANAGER.showAfterSwitch(std::make_unique( _("Error"), _("Lua script uses a different version and cannot be used. Map might not work as expected!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, ID_mbLuaVersionError)); lua.reset(); - } else if(!lua->EventSettingsInit(serverType == ServerType::Local, gameLobby_->isSavegame())) + } else if(!lua->eventSettingsInit(serverType == ServerType::Local, gameLobby_->isSavegame())) { // This should have been detected for the host so others won't even see the script RTTR_Assert(gameLobby_->isHost()); @@ -164,112 +164,112 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam lua.reset(); } if(!lua && gameLobby_->isHost()) - lobbyController->RemoveLuaScript(); + lobbyController->removeLuaScript(); } const bool readonlySettings = !gameLobby_->isHost() || gameLobby_->isSavegame() || !isChangeAllowed("general"); allowAddonChange = gameLobby_->isHost() && !gameLobby_->isSavegame() && (isChangeAllowed("addonsAll") || isChangeAllowed("addonsSome")); - AddText(ID_txtGameName, DrawPoint(400, 5), GAMECLIENT.getGameName(), COLOR_YELLOW, FontStyle::CENTER, LargeFont); + addText(ID_txtGameName, DrawPoint(400, 5), GAMECLIENT.getGameName(), COLOR_YELLOW, FontStyle::CENTER, LargeFont); - AddText(ID_txtColName, DrawPoint(125, 40), _("Player Name"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); - AddText(ID_txtColRace, DrawPoint(262, 40), _("Race"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); - AddText(ID_txtColColor, DrawPoint(369, 40), _("Color"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); - AddText(ID_txtColTeam, DrawPoint(419, 40), _("Team"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); + addText(ID_txtColName, DrawPoint(125, 40), _("Player Name"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); + addText(ID_txtColRace, DrawPoint(262, 40), _("Race"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); + addText(ID_txtColColor, DrawPoint(369, 40), _("Color"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); + addText(ID_txtColTeam, DrawPoint(419, 40), _("Team"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); if(!isSinglePlayer()) { - AddText(ID_txtColReady, DrawPoint(479, 40), _("Ready?"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); - AddText(ID_txtColPing, DrawPoint(530, 40), _("Ping"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); + addText(ID_txtColReady, DrawPoint(479, 40), _("Ready?"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); + addText(ID_txtColPing, DrawPoint(530, 40), _("Ping"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); } if(gameLobby_->isHost() && !gameLobby_->isSavegame()) - AddText(ID_txtColSwap, DrawPoint(0, 40), _("Swap"), COLOR_YELLOW, FontStyle::LEFT, NormalFont); + addText(ID_txtColSwap, DrawPoint(0, 40), _("Swap"), COLOR_YELLOW, FontStyle::LEFT, NormalFont); if(gameLobby_->isSavegame()) - AddText(ID_txtColPastPlayer, DrawPoint(645, 40), _("Past player"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); + addText(ID_txtColPastPlayer, DrawPoint(645, 40), _("Past player"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); if(!isSinglePlayer()) { // Enable lobby chat when we are logged in if(lobbyClient_ && lobbyClient_->IsLoggedIn()) { - ctrlOptionGroup* chatTab = AddOptionGroup(ID_optChatTab, GroupSelectType::Check); - chatTab->AddTextButton(ID_btChatGame, DrawPoint(20, 320), Extent(178, 22), TextureColor::Green2, + ctrlOptionGroup* chatTab = addOptionGroup(ID_optChatTab, GroupSelectType::Check); + chatTab->addTextButton(ID_btChatGame, DrawPoint(20, 320), Extent(178, 22), TextureColor::Green2, _("Game Chat"), NormalFont); - chatTab->AddTextButton(ID_btChatLobby, DrawPoint(202, 320), Extent(178, 22), TextureColor::Green2, + chatTab->addTextButton(ID_btChatLobby, DrawPoint(202, 320), Extent(178, 22), TextureColor::Green2, _("Lobby Chat"), NormalFont); gameChat = - AddChatCtrl(ID_chatGame, DrawPoint(20, 345), Extent(360, 218 - 25), TextureColor::Grey, NormalFont); + addChatCtrl(ID_chatGame, DrawPoint(20, 345), Extent(360, 218 - 25), TextureColor::Grey, NormalFont); lobbyChat = - AddChatCtrl(ID_chatLobby, DrawPoint(20, 345), Extent(360, 218 - 25), TextureColor::Grey, NormalFont); + addChatCtrl(ID_chatLobby, DrawPoint(20, 345), Extent(360, 218 - 25), TextureColor::Grey, NormalFont); chatTab->setSelection(ID_btChatGame, true); } else { - gameChat = AddChatCtrl(ID_chatGame, DrawPoint(20, 320), Extent(360, 218), TextureColor::Grey, NormalFont); + gameChat = addChatCtrl(ID_chatGame, DrawPoint(20, 320), Extent(360, 218), TextureColor::Grey, NormalFont); } - AddEdit(ID_edtChatMsg, DrawPoint(20, 540), Extent(360, 22), TextureColor::Grey, NormalFont); + addEdit(ID_edtChatMsg, DrawPoint(20, 540), Extent(360, 22), TextureColor::Grey, NormalFont); } - AddTextButton(ID_btStartGame, DrawPoint(600, 560), Extent(180, 22), TextureColor::Green2, + addTextButton(ID_btStartGame, DrawPoint(600, 560), Extent(180, 22), TextureColor::Green2, (gameLobby_->isHost() ? _("Start game") : _("Ready")), NormalFont); - AddTextButton(ID_btReturn, DrawPoint(400, 560), Extent(180, 22), TextureColor::Red1, _("Return"), NormalFont); + addTextButton(ID_btReturn, DrawPoint(400, 560), Extent(180, 22), TextureColor::Red1, _("Return"), NormalFont); - AddCheckBox(ID_chkLockTeams, DrawPoint(400, 460), Extent(180, 26), TextureColor::Grey, _("Lock teams:"), NormalFont, + addCheckBox(ID_chkLockTeams, DrawPoint(400, 460), Extent(180, 26), TextureColor::Grey, _("Lock teams:"), NormalFont, readonlySettings); - AddCheckBox(ID_chkSharedView, DrawPoint(600, 460), Extent(180, 26), TextureColor::Grey, _("Shared team view"), + addCheckBox(ID_chkSharedView, DrawPoint(600, 460), Extent(180, 26), TextureColor::Grey, _("Shared team view"), NormalFont, readonlySettings); - AddCheckBox(ID_chkRandomSpawn, DrawPoint(600, 430), Extent(180, 26), TextureColor::Grey, + addCheckBox(ID_chkRandomSpawn, DrawPoint(600, 430), Extent(180, 26), TextureColor::Grey, _("Random start locations"), NormalFont, readonlySettings); - AddText(ID_txtAddons, DrawPoint(400, 499), _("Addons:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddTextButton(ID_btSettings, DrawPoint(600, 495), Extent(180, 22), TextureColor::Green2, + addText(ID_txtAddons, DrawPoint(400, 499), _("Addons:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addTextButton(ID_btSettings, DrawPoint(600, 495), Extent(180, 22), TextureColor::Green2, allowAddonChange ? _("Change Settings...") : _("View Settings..."), NormalFont); ctrlComboBox* combo; // umgedrehte Reihenfolge, damit die Listen nicht dahinter sind - AddText(ID_txtExploration, DrawPoint(400, 405), _("Exploration:"), COLOR_YELLOW, FontStyle{}, NormalFont); - combo = AddComboBox(ID_cbExploration, DrawPoint(600, 400), Extent(180, 20), TextureColor::Grey, NormalFont, 100, + addText(ID_txtExploration, DrawPoint(400, 405), _("Exploration:"), COLOR_YELLOW, FontStyle{}, NormalFont); + combo = addComboBox(ID_cbExploration, DrawPoint(600, 400), Extent(180, 20), TextureColor::Grey, NormalFont, 100, readonlySettings); - combo->AddItem(_("Off (all visible)")); - combo->AddItem(_("Classic (Settlers 2)")); - combo->AddItem(_("Fog of War")); - combo->AddItem(_("FoW - all explored")); + combo->addItem(_("Off (all visible)")); + combo->addItem(_("Classic (Settlers 2)")); + combo->addItem(_("Fog of War")); + combo->addItem(_("FoW - all explored")); - AddText(ID_txtGoods, DrawPoint(400, 375), _("Goods at start:"), COLOR_YELLOW, FontStyle{}, NormalFont); - combo = AddComboBox(ID_cbGoods, DrawPoint(600, 370), Extent(180, 20), TextureColor::Grey, NormalFont, 100, + addText(ID_txtGoods, DrawPoint(400, 375), _("Goods at start:"), COLOR_YELLOW, FontStyle{}, NormalFont); + combo = addComboBox(ID_cbGoods, DrawPoint(600, 370), Extent(180, 20), TextureColor::Grey, NormalFont, 100, readonlySettings); - combo->AddItem(_("Very Low")); - combo->AddItem(_("Low")); - combo->AddItem(_("Normal")); - combo->AddItem(_("A lot")); + combo->addItem(_("Very Low")); + combo->addItem(_("Low")); + combo->addItem(_("Normal")); + combo->addItem(_("A lot")); - AddText(ID_txtGoals, DrawPoint(400, 345), _("Goals:"), COLOR_YELLOW, FontStyle{}, NormalFont); - combo = AddComboBox(ID_cbGoals, DrawPoint(600, 340), Extent(180, 20), TextureColor::Grey, NormalFont, 100, + addText(ID_txtGoals, DrawPoint(400, 345), _("Goals:"), COLOR_YELLOW, FontStyle{}, NormalFont); + combo = addComboBox(ID_cbGoals, DrawPoint(600, 340), Extent(180, 20), TextureColor::Grey, NormalFont, 100, readonlySettings); - combo->AddItem(_("None")); - combo->AddItem(_("Conquer 3/4 of map")); - combo->AddItem(_("Total domination")); - combo->AddItem(_("Economy mode")); + combo->addItem(_("None")); + combo->addItem(_("Conquer 3/4 of map")); + combo->addItem(_("Total domination")); + combo->addItem(_("Economy mode")); // Lobby game? if(lobbyClient_ && lobbyClient_->IsLoggedIn()) { // Then add tournament modes as possible "objectives" for(const auto duration : TOURNAMENT_MODES_DURATION) - combo->AddItem(helpers::format(_("Tournament: %u minutes"), duration / 1min)); + combo->addItem(helpers::format(_("Tournament: %u minutes"), duration / 1min)); } - AddText(ID_txtSpeed, DrawPoint(400, 315), _("Speed:"), COLOR_YELLOW, FontStyle{}, NormalFont); - combo = AddComboBox(ID_cbSpeed, DrawPoint(600, 310), Extent(180, 20), TextureColor::Grey, NormalFont, 100, + addText(ID_txtSpeed, DrawPoint(400, 315), _("Speed:"), COLOR_YELLOW, FontStyle{}, NormalFont); + combo = addComboBox(ID_cbSpeed, DrawPoint(600, 310), Extent(180, 20), TextureColor::Grey, NormalFont, 100, !gameLobby_->isHost()); - combo->AddItem(_("Very slow")); - combo->AddItem(_("Slow")); - combo->AddItem(_("Normal")); - combo->AddItem(_("Fast")); - combo->AddItem(_("Very fast")); + combo->addItem(_("Very slow")); + combo->addItem(_("Slow")); + combo->addItem(_("Normal")); + combo->addItem(_("Fast")); + combo->addItem(_("Very fast")); // Karte laden, um Kartenvorschau anzuzeigen if(!gameLobby_->isSavegame()) @@ -277,9 +277,9 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam const bool isMapPreviewEnabled = !lua || lua->isMapPreviewEnabled(); if(!isMapPreviewEnabled) { - AddTextDeepening(ID_txtNoPreview, DrawPoint(560, 40), Extent(220, 220), TextureColor::Grey, _("No preview"), + addTextDeepening(ID_txtNoPreview, DrawPoint(560, 40), Extent(220, 220), TextureColor::Grey, _("No preview"), LargeFont, COLOR_YELLOW); - AddText(ID_txtMapName, DrawPoint(670, 40 + 220 + 10), _("Map: ") + GAMECLIENT.getMapTitle(), COLOR_YELLOW, + addText(ID_txtMapName, DrawPoint(670, 40 + 220 + 10), _("Map: ") + GAMECLIENT.getMapTitle(), COLOR_YELLOW, FontStyle::CENTER, NormalFont); } else { @@ -288,17 +288,17 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam // Karteninformationen laden if(int ec = libsiedler2::loader::LoadMAP(GAMECLIENT.getMapPath(), mapArchiv)) { - WINDOWMANAGER.ShowAfterSwitch( + WINDOWMANAGER.showAfterSwitch( std::make_unique(_("Error"), _("Could not load map:\n") + libsiedler2::getErrorString(ec), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, ID_mbMapLoadError)); } else { auto* map = static_cast(mapArchiv.get(0)); - ctrlPreviewMinimap* preview = AddPreviewMinimap(ID_miniMap, DrawPoint(560, 40), Extent(220, 220), map); + ctrlPreviewMinimap* preview = addPreviewMinimap(ID_miniMap, DrawPoint(560, 40), Extent(220, 220), map); // Titel der Karte, Y-Position relativ je nach Höhe der Minimap festlegen, daher nochmals danach // verschieben, da diese Position sonst skaliert wird! - ctrlText* text = AddText(ID_txtMapName, DrawPoint(670, 0), _("Map: ") + GAMECLIENT.getMapTitle(), + ctrlText* text = addText(ID_txtMapName, DrawPoint(670, 0), _("Map: ") + GAMECLIENT.getMapTitle(), COLOR_YELLOW, FontStyle::CENTER, NormalFont); text->setPos(DrawPoint(text->getPos().x, preview->getPos().y + preview->getMapArea().bottom + 10)); } @@ -315,13 +315,13 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam if(i < aiBattlePlayers.size()) lobbyController->setPlayerState(i, PlayerState::AI, aiBattlePlayers[i]); else - lobbyController->CloseSlot(i); // Close remaining slots + lobbyController->closeSlot(i); // Close remaining slots } // Set name of host to the corresponding AI for local player if(localPlayerId_ < aiBattlePlayers.size()) lobbyController->setName(localPlayerId_, - JoinPlayerInfo::MakeAIName(aiBattlePlayers[localPlayerId_], localPlayerId_)); + JoinPlayerInfo::makeAIName(aiBattlePlayers[localPlayerId_], localPlayerId_)); } else if(isSinglePlayer() && !gameLobby_->isSavegame()) { // Setze initial auf KI @@ -334,7 +334,7 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam // Alle Spielercontrols erstellen for(unsigned i = 0; i < gameLobby_->getNumPlayers(); i++) - UpdatePlayerRow(i); + updatePlayerRow(i); // swap buttons erstellen if(gameLobby_->isHost() && !gameLobby_->isSavegame() && isChangeAllowed("swapping")) { @@ -342,7 +342,7 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam { int rowPos = getCtrl(ID_grpPlayerStart + i)->getCtrl(ID_btPlayerState)->getPos().y; ctrlButton* bt = - AddTextButton(ID_btSwap + i, DrawPoint(5, 0), Extent(22, 22), TextureColor::Red1, _("-"), NormalFont); + addTextButton(ID_btSwap + i, DrawPoint(5, 0), Extent(22, 22), TextureColor::Red1, _("-"), NormalFont); bt->setPos(DrawPoint(bt->getPos().x, rowPos)); } } @@ -350,8 +350,8 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam if(serverType == ServerType::Lobby && lobbyClient_ && lobbyClient_->IsLoggedIn()) { - lobbyClient_->AddListener(this); - lobbyClient_->SendServerJoinRequest(); + lobbyClient_->addListener(this); + lobbyClient_->sendServerJoinRequest(); } GAMECLIENT.setInterface(this); @@ -360,16 +360,16 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam dskGameLobby::~dskGameLobby() { if(lobbyClient_) - lobbyClient_->RemoveListener(this); - GAMECLIENT.RemoveInterface(this); + lobbyClient_->removeListener(this); + GAMECLIENT.removeInterface(this); } /** * Größe ändern-Reaktionen die nicht vom Skaling-Mechanismus erfasst werden. */ -void dskGameLobby::Resize(const Extent& newSize) +void dskGameLobby::resize(const Extent& newSize) { - Window::Resize(newSize); + Window::resize(newSize); // Text unter der PreviewMinimap verschieben, dessen Höhe von der Höhe der // PreviewMinimap abhängt, welche sich gerade geändert hat. @@ -391,10 +391,10 @@ void dskGameLobby::setActive(bool activate /*= true*/) wasActivated = true; try { - lua->EventSettingsReady(); + lua->eventSettingsReady(); } catch(const LuaExecutionError&) { - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Error"), _("Lua script was found but failed to load. Map might not work as expected!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, ID_mbLuaLoadError)); lua.reset(); @@ -402,7 +402,7 @@ void dskGameLobby::setActive(bool activate /*= true*/) } } -void dskGameLobby::UpdatePlayerRow(const unsigned row) +void dskGameLobby::updatePlayerRow(const unsigned row) { const JoinPlayerInfo& player = gameLobby_->getPlayer(row); @@ -410,9 +410,9 @@ void dskGameLobby::UpdatePlayerRow(const unsigned row) TextureColor tc = (row & 1 ? TextureColor::Grey : TextureColor::Green2); // Alle Controls erstmal zerstören (die ganze Gruppe) - DeleteCtrl(ID_grpPlayerStart + row); + deleteCtrl(ID_grpPlayerStart + row); // und neu erzeugen - ctrlGroup* group = AddGroup(ID_grpPlayerStart + row); + ctrlGroup* group = addGroup(ID_grpPlayerStart + row); std::string name; switch(player.ps) @@ -436,9 +436,9 @@ void dskGameLobby::UpdatePlayerRow(const unsigned row) // Spielername, beim Hosts Spielerbuttons, aber nich beim ihm selber, er kann sich ja nich selber kicken! if(gameLobby_->isHost() && !player.isHost && isChangeAllowed("playerState")) - group->AddTextButton(ID_btPlayerState, DrawPoint(30, cy), Extent(180, 22), tc, name, NormalFont); + group->addTextButton(ID_btPlayerState, DrawPoint(30, cy), Extent(180, 22), tc, name, NormalFont); else - group->AddTextDeepening(ID_btPlayerState, DrawPoint(30, cy), Extent(180, 22), tc, name, NormalFont, + group->addTextDeepening(ID_btPlayerState, DrawPoint(30, cy), Extent(180, 22), tc, name, NormalFont, COLOR_YELLOW); auto* text = group->getCtrl(ID_btPlayerState); @@ -474,43 +474,43 @@ void dskGameLobby::UpdatePlayerRow(const unsigned row) } if(allowNationChange) - group->AddTextButton(ID_btNation, DrawPoint(215, cy), Extent(95, 22), tc, _(NationNames[NATION_ORDER[0]]), + group->addTextButton(ID_btNation, DrawPoint(215, cy), Extent(95, 22), tc, _(NationNames[NATION_ORDER[0]]), NormalFont); else - group->AddTextDeepening(ID_btNation, DrawPoint(215, cy), Extent(95, 22), tc, + group->addTextDeepening(ID_btNation, DrawPoint(215, cy), Extent(95, 22), tc, _(NationNames[NATION_ORDER[0]]), NormalFont, COLOR_YELLOW); const auto& portrait = Portraits[player.portraitIndex]; if(allowPortraitChange) - group->AddImageButton(ID_btPortrait, DrawPoint(315, cy), Extent(34, 22), tc, + group->addImageButton(ID_btPortrait, DrawPoint(315, cy), Extent(34, 22), tc, LOADER.getImageN(portrait.resourceId, portrait.resourceIndex), _(portrait.name)); else - group->AddImageDeepening(ID_btPortrait, DrawPoint(315, cy), Extent(34, 22), tc, + group->addImageDeepening(ID_btPortrait, DrawPoint(315, cy), Extent(34, 22), tc, LOADER.getImageN(portrait.resourceId, portrait.resourceIndex)); if(allowColorChange) - group->AddColorButton(ID_btColor, DrawPoint(354, cy), Extent(30, 22), tc, 0); + group->addColorButton(ID_btColor, DrawPoint(354, cy), Extent(30, 22), tc, 0); else - group->AddColorDeepening(ID_btColor, DrawPoint(354, cy), Extent(30, 22), tc, 0); + group->addColorDeepening(ID_btColor, DrawPoint(354, cy), Extent(30, 22), tc, 0); if(allowTeamChange) - group->AddTextButton(ID_btTeam, DrawPoint(394, cy), Extent(50, 22), tc, _("-"), NormalFont); + group->addTextButton(ID_btTeam, DrawPoint(394, cy), Extent(50, 22), tc, _("-"), NormalFont); else - group->AddTextDeepening(ID_btTeam, DrawPoint(394, cy), Extent(50, 22), tc, _("-"), NormalFont, + group->addTextDeepening(ID_btTeam, DrawPoint(394, cy), Extent(50, 22), tc, _("-"), NormalFont, COLOR_YELLOW); // Ready (not for AIs and Host) if(player.ps == PlayerState::Occupied && !player.isHost) - group->AddCheckBox(ID_chkReady, DrawPoint(464, cy), Extent(22, 22), tc, "", nullptr, + group->addCheckBox(ID_chkReady, DrawPoint(464, cy), Extent(22, 22), tc, "", nullptr, (localPlayerId_ != row)); - ctrlVarDeepening* ping = group->AddVarDeepening(ID_txtPing, DrawPoint(505, cy), Extent(50, 22), tc, _("%d"), + ctrlVarDeepening* ping = group->addVarDeepening(ID_txtPing, DrawPoint(505, cy), Extent(50, 22), tc, _("%d"), NormalFont, COLOR_YELLOW, 1, &player.ping); //-V111 // Move (not for Save games and Host) if(gameLobby_->isSavegame() && player.ps == PlayerState::Occupied) { - ctrlComboBox* combo = group->AddComboBox(ID_cbMove, DrawPoint(560, cy), Extent(160, 22), tc, NormalFont, + ctrlComboBox* combo = group->addComboBox(ID_cbMove, DrawPoint(560, cy), Extent(160, 22), tc, NormalFont, 150, !gameLobby_->isHost()); // Mit den alten Namen füllen @@ -518,7 +518,7 @@ void dskGameLobby::UpdatePlayerRow(const unsigned row) { if(!gameLobby_->getPlayer(i).originName.empty()) { - combo->AddItem(gameLobby_->getPlayer(i).originName); + combo->addItem(gameLobby_->getPlayer(i).originName); if(i == row) combo->setSelection(combo->getNumItems() - 1u); } @@ -530,12 +530,12 @@ void dskGameLobby::UpdatePlayerRow(const unsigned row) ping->setVisible(false); // Fill fields - ChangeNation(row, player.nation); - ChangePortrait(row, player.portraitIndex); - ChangeTeam(row, player.team); - ChangePing(row); - ChangeReady(row, player.isReady); - ChangeColor(row, player.color); + changeNation(row, player.nation); + changePortrait(row, player.portraitIndex); + changeTeam(row, player.team); + changePing(row); + changeReady(row, player.isReady); + changeColor(row, player.color); } group->setActive(IsActive()); } @@ -560,7 +560,7 @@ void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned c case ID_btPlayerState: { if(gameLobby_->isHost()) - lobbyController->TogglePlayerState(playerId); + lobbyController->togglePlayerState(playerId); } break; @@ -576,7 +576,7 @@ void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned c lobbyController->setNation(playerId, player.nation); else GAMECLIENT.commandSetNation(player.nation); - ChangeNation(playerId, player.nation); + changeNation(playerId, player.nation); } } break; @@ -593,7 +593,7 @@ void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned c lobbyController->setPortrait(playerId, player.portraitIndex); else GAMECLIENT.commandSetPortrait(player.portraitIndex); - ChangePortrait(playerId, player.portraitIndex); + changePortrait(playerId, player.portraitIndex); } } break; @@ -629,7 +629,7 @@ void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned c lobbyController->setColor(playerId, player.color); else GAMECLIENT.commandSetColor(player.color); - ChangeColor(playerId, player.color); + changeColor(playerId, player.color); } // Start-Farbe der Minimap ändern @@ -648,7 +648,7 @@ void dskGameLobby::msgGroupButtonClick(const unsigned group_id, const unsigned c lobbyController->setTeam(playerId, player.team); else GAMECLIENT.commandSetTeam(player.team); - ChangeTeam(playerId, player.team); + changeTeam(playerId, player.team); } } break; @@ -685,10 +685,10 @@ void dskGameLobby::msgGroupComboSelectItem(const unsigned group_id, const unsign if(player2 < 0) LOG.write("dskHostGame: ERROR: Selected player not found, stop swapping!\n"); else - lobbyController->SwapPlayers(playerId, static_cast(player2)); + lobbyController->swapPlayers(playerId, static_cast(player2)); } -void dskGameLobby::GoBack() +void dskGameLobby::goBack() { if(isSinglePlayer()) WINDOWMANAGER.Switch(std::make_unique()); @@ -711,14 +711,14 @@ void dskGameLobby::msgButtonClick(const unsigned ctrl_id) { unsigned targetPlayer = ctrl_id - ID_btSwap; if(targetPlayer != localPlayerId_ && gameLobby_->isHost()) - lobbyController->SwapPlayers(localPlayerId_, targetPlayer); + lobbyController->swapPlayers(localPlayerId_, targetPlayer); return; } switch(ctrl_id) { case ID_btReturn: - GAMECLIENT.Stop(); - GoBack(); + GAMECLIENT.stop(); + goBack(); break; case ID_btStartGame: @@ -731,9 +731,9 @@ void dskGameLobby::msgButtonClick(const unsigned ctrl_id) setPlayerReady(localPlayerId_, true); if(lua) - lua->EventPlayerReady(localPlayerId_); + lua->eventPlayerReady(localPlayerId_); if(ready->getText() == _("Start game")) - lobbyController->StartCountdown(5); + lobbyController->startCountdown(5); else lobbyController->cancelCountdown(); } else @@ -747,8 +747,8 @@ void dskGameLobby::msgButtonClick(const unsigned ctrl_id) break; case ID_btSettings: // Addons { - if(auto* wnd = WINDOWMANAGER.FindNonModalWindow(CGI_ADDONS)) - wnd->Close(); + if(auto* wnd = WINDOWMANAGER.findNonModalWindow(CGI_ADDONS)) + wnd->close(); else { std::unique_ptr w; @@ -762,7 +762,7 @@ void dskGameLobby::msgButtonClick(const unsigned ctrl_id) w = std::make_unique(gameLobby_->getSettings(), this, AddonChangeAllowed::WhitelistOnly, lua->getAllowedAddons()); } - WINDOWMANAGER.Show(std::move(w)); + WINDOWMANAGER.show(std::move(w)); } } break; @@ -779,7 +779,7 @@ void dskGameLobby::msgEditEnter(const unsigned ctrl_id) if(gameChat->isVisible()) GAMECLIENT.commandChat(msg, ChatDestination::All); else if(lobbyClient_ && lobbyClient_->IsLoggedIn() && lobbyChat->isVisible()) - lobbyClient_->SendChat(msg); + lobbyClient_->sendChat(msg); } void dskGameLobby::CI_Countdown(unsigned remainingTimeInSec) @@ -790,16 +790,16 @@ void dskGameLobby::CI_Countdown(unsigned remainingTimeInSec) if(!hasCountdown_) { const std::string startMsg = helpers::format(_("You have %u seconds until game starts"), remainingTimeInSec); - gameChat->AddMessage("", "", 0, startMsg, COLOR_RED); - gameChat->AddMessage("", "", 0, _("Don't forget to check the addon configuration!"), 0xFFFFDD00); - gameChat->AddMessage("", "", 0, "", 0xFFFFCC00); + gameChat->addMessage("", "", 0, startMsg, COLOR_RED); + gameChat->addMessage("", "", 0, _("Don't forget to check the addon configuration!"), 0xFFFFDD00); + gameChat->addMessage("", "", 0, "", 0xFFFFCC00); hasCountdown_ = true; } const std::string message = (remainingTimeInSec > 0) ? " " + std::to_string(remainingTimeInSec) : _("Starting game, please wait"); - gameChat->AddMessage("", "", 0, message, 0xFFFFBB00); + gameChat->addMessage("", "", 0, message, 0xFFFFBB00); } void dskGameLobby::CI_CancelCountdown(bool error) @@ -807,26 +807,26 @@ void dskGameLobby::CI_CancelCountdown(bool error) if(hasCountdown_) { hasCountdown_ = false; - gameChat->AddMessage("", "", 0xFFCC2222, _("Start aborted"), 0xFFFFCC00); - FlashGameChat(); + gameChat->addMessage("", "", 0xFFCC2222, _("Start aborted"), 0xFFFFCC00); + flashGameChat(); } if(gameLobby_->isHost()) { if(error) { - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Error"), _("Game can only be started as soon as everybody has a unique color,everyone is " "ready and all free slots are closed."), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, ID_mbStartErrror)); } - ChangeReady(localPlayerId_, true); + changeReady(localPlayerId_, true); } } -void dskGameLobby::FlashGameChat() +void dskGameLobby::flashGameChat() { if(!gameChat->isVisible()) { @@ -844,15 +844,15 @@ void dskGameLobby::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult case ID_mbMapLoadError: case ID_mbError: { - GAMECLIENT.Stop(); + GAMECLIENT.stop(); - GoBack(); + goBack(); } break; case CGI_ADDONS: // addon-window applied settings? { if(mbr == MsgboxResult::Yes) - UpdateGGS(); + updateGGS(); } break; case ID_mbQuestionEconomy: // Economy Mode - change Addon Setttings @@ -863,7 +863,7 @@ void dskGameLobby::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult gameLobby_->getSettings().setSelection(AddonId::NO_COINS_DEFAULT, true); gameLobby_->getSettings().setSelection(AddonId::NO_ARMOR_DEFAULT, true); gameLobby_->getSettings().setSelection(AddonId::LIMIT_CATAPULTS, 2); - UpdateGGS(); + updateGGS(); } else if(mbr == MsgboxResult::No) { forceOptions = true; @@ -898,7 +898,7 @@ void dskGameLobby::msgComboSelectItem(const unsigned ctrl_id, const unsigned /*s case ID_cbExploration: { // GameSettings wurden verändert, resetten - UpdateGGS(); + updateGGS(); } break; } @@ -914,7 +914,7 @@ void dskGameLobby::msgCheckboxChange(const unsigned ctrl_id, const bool /*checke case ID_chkRandomSpawn: { // GameSettings wurden verändert, resetten - UpdateGGS(); + updateGGS(); } break; } @@ -940,7 +940,7 @@ void dskGameLobby::msgOptionGroupChange(const unsigned ctrl_id, const unsigned s } } -void dskGameLobby::UpdateGGS() +void dskGameLobby::updateGGS() { RTTR_Assert(gameLobby_->isHost()); @@ -955,17 +955,17 @@ void dskGameLobby::UpdateGGS() ggs.randomStartPosition = getCtrl(ID_chkRandomSpawn)->isChecked(); // An Server übermitteln - lobbyController->ChangeGlobalGameSettings(ggs); + lobbyController->changeGlobalGameSettings(ggs); } -void dskGameLobby::ChangeTeam(const unsigned player, const Team team) +void dskGameLobby::changeTeam(const unsigned player, const Team team) { constexpr helpers::EnumArray teams = {"-", "?", "1", "2", "3", "4", "1-2", "1-3", "1-4"}; getCtrl(ID_grpPlayerStart + player)->getCtrl(ID_btTeam)->setText(teams[team]); } -void dskGameLobby::ChangeReady(const unsigned player, const bool ready) +void dskGameLobby::changeReady(const unsigned player, const bool ready) { auto* check = getCtrl(ID_grpPlayerStart + player)->getCtrl(ID_chkReady); if(check) @@ -981,12 +981,12 @@ void dskGameLobby::ChangeReady(const unsigned player, const bool ready) } } -void dskGameLobby::ChangeNation(const unsigned player, const Nation nation) +void dskGameLobby::changeNation(const unsigned player, const Nation nation) { getCtrl(ID_grpPlayerStart + player)->getCtrl(ID_btNation)->setText(_(NationNames[nation])); } -void dskGameLobby::ChangePortrait(const unsigned player, const unsigned portraitIndex) +void dskGameLobby::changePortrait(const unsigned player, const unsigned portraitIndex) { RTTR_Assert(portraitIndex < Portraits.size()); const auto& portrait = Portraits[portraitIndex]; @@ -997,7 +997,7 @@ void dskGameLobby::ChangePortrait(const unsigned player, const unsigned portrait ctrlButton->setTooltip(_(portrait.name)); } -void dskGameLobby::ChangePing(unsigned playerId) +void dskGameLobby::changePing(unsigned playerId) { unsigned color = COLOR_RED; @@ -1011,7 +1011,7 @@ void dskGameLobby::ChangePing(unsigned playerId) getCtrl(ID_grpPlayerStart + playerId)->getCtrl(ID_txtPing)->setTextColor(color); } -void dskGameLobby::ChangeColor(const unsigned player, const unsigned color) +void dskGameLobby::changeColor(const unsigned player, const unsigned color) { getCtrl(ID_grpPlayerStart + player)->getCtrl(ID_btColor)->setColor(color); @@ -1031,22 +1031,22 @@ void dskGameLobby::setPlayerReady(unsigned char player, bool ready) gameLobby_->getPlayer(player).isReady = ready; GAMECLIENT.commandSetReady(ready); } - ChangeReady(player, ready); + changeReady(player, ready); } void dskGameLobby::CI_NewPlayer(const unsigned playerId) { - UpdatePlayerRow(playerId); + updatePlayerRow(playerId); if(lua && gameLobby_->isHost()) - lua->EventPlayerJoined(playerId); + lua->eventPlayerJoined(playerId); } void dskGameLobby::CI_PlayerLeft(const unsigned playerId) { - UpdatePlayerRow(playerId); + updatePlayerRow(playerId); if(lua && gameLobby_->isHost()) - lua->EventPlayerLeft(playerId); + lua->eventPlayerLeft(playerId); } void dskGameLobby::CI_GameLoading(std::shared_ptr game) @@ -1056,21 +1056,21 @@ void dskGameLobby::CI_GameLoading(std::shared_ptr game) void dskGameLobby::CI_PlayerDataChanged(unsigned playerId) { - UpdatePlayerRow(playerId); + updatePlayerRow(playerId); } void dskGameLobby::CI_PingChanged(const unsigned playerId, const unsigned short /*ping*/) { - ChangePing(playerId); + changePing(playerId); } void dskGameLobby::CI_ReadyChanged(const unsigned playerId, const bool ready) { - ChangeReady(playerId, ready); + changeReady(playerId, ready); // Event only called for other players (host ready is done in start game) // Also only for host and non-savegames if(ready && lua && gameLobby_->isHost() && playerId != localPlayerId_) - lua->EventPlayerReady(playerId); + lua->eventPlayerReady(playerId); } void dskGameLobby::CI_PlayersSwapped(const unsigned player1, const unsigned player2) @@ -1080,8 +1080,8 @@ void dskGameLobby::CI_PlayersSwapped(const unsigned player1, const unsigned play else if(localPlayerId_ == player2) localPlayerId_ = player1; // Spieler wurden vertauscht, beide Reihen updaten - UpdatePlayerRow(player1); - UpdatePlayerRow(player2); + updatePlayerRow(player1); + updatePlayerRow(player2); } void dskGameLobby::CI_GGSChanged(const GlobalGameSettings& /*ggs*/) @@ -1105,15 +1105,15 @@ void dskGameLobby::CI_Chat(const unsigned playerId, const ChatDestination /*cd*/ { std::string time = s25util::Time::FormatTime("(%H:%i:%s)"); - gameChat->AddMessage(time, gameLobby_->getPlayer(playerId).name, gameLobby_->getPlayer(playerId).color, msg, + gameChat->addMessage(time, gameLobby_->getPlayer(playerId).name, gameLobby_->getPlayer(playerId).color, msg, 0xFFFFFF00); //-V810 - FlashGameChat(); + flashGameChat(); } } void dskGameLobby::CI_Error(const ClientError ce) { - WINDOWMANAGER.Show(std::make_unique(_("Error"), ClientErrorToStr(ce), this, MsgboxButton::Ok, + WINDOWMANAGER.show(std::make_unique(_("Error"), clientErrorToStr(ce), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, ID_mbError)); } @@ -1122,7 +1122,7 @@ void dskGameLobby::CI_Error(const ClientError ce) */ void dskGameLobby::LC_Status_Error(const std::string& error) { - WINDOWMANAGER.Show( + WINDOWMANAGER.show( std::make_unique(_("Error"), error, this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, ID_mbError)); } @@ -1130,7 +1130,7 @@ void dskGameLobby::LC_Chat(const std::string& player, const std::string& text) { if(!lobbyChat) return; - lobbyChat->AddMessage("", player, ctrlChat::CalcUniqueColor(player), text, COLOR_YELLOW); + lobbyChat->addMessage("", player, ctrlChat::calcUniqueColor(player), text, COLOR_YELLOW); if(!lobbyChat->isVisible()) { auto* tab = getCtrl(ID_optChatTab); @@ -1147,7 +1147,7 @@ bool dskGameLobby::checkOptions() const GlobalGameSettings& ggs = gameLobby_->getSettings(); if(ggs.objective == GameObjective::EconomyMode && !ggs.isEnabled(AddonId::PEACEFULMODE)) { - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Economy mode"), _("You chose the economy mode. In economy mode the player or team that collects the most of certain goods " "wins (check the Economic progress window in game).\n\n" @@ -1162,7 +1162,7 @@ bool dskGameLobby::checkOptions() } else if(ggs.isEnabled(AddonId::PEACEFULMODE) && (ggs.objective == GameObjective::Conquer3_4 || ggs.objective == GameObjective::TotalDomination)) { - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Peaceful mode"), _("You chose a war based victory condition but peaceful mode is still active. Would you like to deactivate " "peaceful mode before you start? Choosing No will start the game, Yes will let you review the changes."), diff --git a/libs/s25main/desktops/dskGameLobby.h b/libs/s25main/desktops/dskGameLobby.h index 0be5dba16c..c5df1bc4c7 100644 --- a/libs/s25main/desktops/dskGameLobby.h +++ b/libs/s25main/desktops/dskGameLobby.h @@ -27,23 +27,23 @@ class dskGameLobby final : public Desktop, public ClientInterface, public LobbyI ~dskGameLobby(); /// Größe ändern-Reaktionen die nicht vom Skaling-Mechanismus erfasst werden. - void Resize(const Extent& newSize) override; + void resize(const Extent& newSize) override; void setActive(bool activate = true) override; private: void setPlayerReady(unsigned char player, bool ready); // GGS von den Controls auslesen - void UpdateGGS(); + void updateGGS(); /// Aktualisiert eine Spielerreihe (löscht Controls und legt neue an) - void UpdatePlayerRow(unsigned row); + void updatePlayerRow(unsigned row); /// Füllt die Felder einer Reihe aus - void ChangeTeam(unsigned player, Team); - void ChangeReady(unsigned player, bool ready); - void ChangeNation(unsigned player, Nation); - void ChangePortrait(unsigned player, unsigned portraitIndex); - void ChangePing(unsigned playerId); - void ChangeColor(unsigned player, unsigned color); + void changeTeam(unsigned player, Team); + void changeReady(unsigned player, bool ready); + void changeNation(unsigned player, Nation); + void changePortrait(unsigned player, unsigned portraitIndex); + void changePing(unsigned playerId); + void changeColor(unsigned player, unsigned color); void msgPaintBefore() override; void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; @@ -73,7 +73,7 @@ class dskGameLobby final : public Desktop, public ClientInterface, public LobbyI void CI_Countdown(unsigned remainingTimeInSec) override; void CI_CancelCountdown(bool error) override; - void FlashGameChat(); + void flashGameChat(); void LC_Status_Error(const std::string& error) override; void LC_Chat(const std::string& player, const std::string& text) override; @@ -82,7 +82,7 @@ class dskGameLobby final : public Desktop, public ClientInterface, public LobbyI bool forceOptions = false; bool checkOptions(); - void GoBack(); + void goBack(); bool isSinglePlayer() const { return serverType == ServerType::Local; } /// Check whether the given setting can be changed, i.e. is not disabled by lua bool isChangeAllowed(const std::string& setting) const; diff --git a/libs/s25main/desktops/dskIntro.cpp b/libs/s25main/desktops/dskIntro.cpp index 60eb2d970f..fd10d1ee83 100644 --- a/libs/s25main/desktops/dskIntro.cpp +++ b/libs/s25main/desktops/dskIntro.cpp @@ -17,9 +17,9 @@ dskIntro::dskIntro() : Desktop(LOADER.getImageN("menu", 0)) { // "Zurück" - AddTextButton(0, DrawPoint(300, 550), Extent(200, 22), TextureColor::Red1, _("Back"), NormalFont); + addTextButton(0, DrawPoint(300, 550), Extent(200, 22), TextureColor::Red1, _("Back"), NormalFont); - AddImage(11, DrawPoint(20, 20), LOADER.getImageN("logo", 0)); + addImage(11, DrawPoint(20, 20), LOADER.getImageN("logo", 0)); } void dskIntro::msgButtonClick(const unsigned ctrl_id) diff --git a/libs/s25main/desktops/dskLAN.cpp b/libs/s25main/desktops/dskLAN.cpp index 28eac5bf93..9e61d452fd 100644 --- a/libs/s25main/desktops/dskLAN.cpp +++ b/libs/s25main/desktops/dskLAN.cpp @@ -32,16 +32,16 @@ enum dskLAN::dskLAN() : dskMenuBase(LOADER.getImageN("setup013", 0)), discovery(LAN_DISCOVERY_CFG) { // "Server hinzufügen" - AddTextButton(ID_btAddServer, DrawPoint(530, 250), Extent(250, 22), TextureColor::Green2, _("Add Server"), + addTextButton(ID_btAddServer, DrawPoint(530, 250), Extent(250, 22), TextureColor::Green2, _("Add Server"), NormalFont); // "Verbinden" - AddTextButton(ID_btConnect, DrawPoint(530, 280), Extent(250, 22), TextureColor::Green2, _("Connect"), NormalFont); + addTextButton(ID_btConnect, DrawPoint(530, 280), Extent(250, 22), TextureColor::Green2, _("Connect"), NormalFont); // "Zurück" - AddTextButton(ID_btBack, DrawPoint(530, 530), Extent(250, 22), TextureColor::Red1, _("Back"), NormalFont); + addTextButton(ID_btBack, DrawPoint(530, 530), Extent(250, 22), TextureColor::Red1, _("Back"), NormalFont); // Gameserver-Tabelle - "ID", "Server", "Karte", "Spieler", "Version" using SRT = ctrlTable::SortType; - AddTable(ID_tblServer, DrawPoint(20, 20), Extent(500, 530), TextureColor::Grey, NormalFont, + addTable(ID_tblServer, DrawPoint(20, 20), Extent(500, 530), TextureColor::Grey, NormalFont, ctrlTable::Columns{{_("ID"), 0, SRT::Number}, {_("Server"), 300, SRT::String}, {_("Map"), 300, SRT::String}, @@ -51,8 +51,8 @@ dskLAN::dskLAN() : dskMenuBase(LOADER.getImageN("setup013", 0)), discovery(LAN_D discovery.Start(); using namespace std::chrono_literals; - AddTimer(ID_tmrRefreshServers, 1min); // Servers broadcast changes, so force a full update only once a minute - AddTimer(ID_tmrRefreshList, 2s); + addTimer(ID_tmrRefreshServers, 1min); // Servers broadcast changes, so force a full update only once a minute + addTimer(ID_tmrRefreshList, 2s); } void dskLAN::msgTimer(const unsigned ctrl_id) @@ -60,7 +60,7 @@ void dskLAN::msgTimer(const unsigned ctrl_id) if(ctrl_id == ID_tmrRefreshServers) discovery.Refresh(); else if(ctrl_id == ID_tmrRefreshList) - UpdateServerList(); + updateServerList(); else RTTR_Assert(false); } @@ -76,16 +76,16 @@ void dskLAN::msgButtonClick(const unsigned ctrl_id) switch(ctrl_id) { case ID_btBack: WINDOWMANAGER.Switch(std::make_unique()); break; - case ID_btConnect: ConnectToSelectedGame(); break; + case ID_btConnect: connectToSelectedGame(); break; case ID_btAddServer: if(SETTINGS.proxy.type != ProxyType::None) - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Sorry!"), _("You can't create a game while a proxy server is active\nDisable the use of a proxy server first!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationGreen, 1)); else { - WINDOWMANAGER.ReplaceWindow(std::make_unique(ServerType::LAN)); + WINDOWMANAGER.replaceWindow(std::make_unique(ServerType::LAN)); } } } @@ -93,10 +93,10 @@ void dskLAN::msgButtonClick(const unsigned ctrl_id) void dskLAN::msgTableChooseItem(const unsigned ctrl_id, const unsigned /*selection*/) { if(ctrl_id == ID_tblServer) - ConnectToSelectedGame(); + connectToSelectedGame(); } -void dskLAN::ReadOpenGames() +void dskLAN::readOpenGames() { openGames.clear(); const LANDiscoveryClient::ServiceMap& services = discovery.GetServices(); @@ -110,9 +110,9 @@ void dskLAN::ReadOpenGames() } } -void dskLAN::UpdateServerList() +void dskLAN::updateServerList() { - ReadOpenGames(); + readOpenGames(); auto* servertable = getCtrl(ID_tblServer); @@ -121,7 +121,7 @@ void dskLAN::UpdateServerList() if(sortColumn == -1) sortColumn = 0; const auto direction = servertable->getSortDirection(); - servertable->DeleteAllItems(); + servertable->deleteAllItems(); unsigned curId = 0; for(const auto& gameInfo : openGames) @@ -130,15 +130,15 @@ void dskLAN::UpdateServerList() std::string name = (gameInfo.info.hasPwd ? "(pwd) " : "") + gameInfo.info.name; //-V807 std::string player = helpers::toString(gameInfo.info.curNumPlayers) + "/" + helpers::toString(gameInfo.info.maxNumPlayers); - servertable->AddRow({id, name, gameInfo.info.map, player, gameInfo.info.version}); + servertable->addRow({id, name, gameInfo.info.map, player, gameInfo.info.version}); } if(sortColumn >= 0) - servertable->SortRows(sortColumn, direction); + servertable->sortRows(sortColumn, direction); servertable->setSelection(selection); } -bool dskLAN::ConnectToSelectedGame() +bool dskLAN::connectToSelectedGame() { if(openGames.empty()) return false; @@ -156,12 +156,12 @@ bool dskLAN::ConnectToSelectedGame() if(game.info.revision == rttr::version::getRevision()) { auto connect = std::make_unique(ServerType::LAN); - connect->Connect(game.ip, game.info.port, game.info.isIPv6, game.info.hasPwd); - WINDOWMANAGER.ReplaceWindow(std::move(connect)); + connect->connect(game.ip, game.info.port, game.info.isIPv6, game.info.hasPwd); + WINDOWMANAGER.replaceWindow(std::move(connect)); return true; } else { - WINDOWMANAGER.Show(std::make_unique(_("Sorry!"), _("You can't join that game with your version!"), + WINDOWMANAGER.show(std::make_unique(_("Sorry!"), _("You can't join that game with your version!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, 1)); return false; } diff --git a/libs/s25main/desktops/dskLAN.h b/libs/s25main/desktops/dskLAN.h index feabc1bf30..2e0f1f0bf7 100644 --- a/libs/s25main/desktops/dskLAN.h +++ b/libs/s25main/desktops/dskLAN.h @@ -28,12 +28,12 @@ class dskLAN : public dskMenuBase /** * Connects to the currently selected game and returns true on success */ - bool ConnectToSelectedGame(); + bool connectToSelectedGame(); private: LANDiscoveryClient discovery; std::vector openGames; - void UpdateServerList(); - void ReadOpenGames(); + void updateServerList(); + void readOpenGames(); }; diff --git a/libs/s25main/desktops/dskLobby.cpp b/libs/s25main/desktops/dskLobby.cpp index b2fdbdfbb5..579add4e72 100644 --- a/libs/s25main/desktops/dskLobby.cpp +++ b/libs/s25main/desktops/dskLobby.cpp @@ -42,36 +42,36 @@ enum dskLobby::dskLobby() : dskMenuBase(LOADER.getImageN("setup013", 0)), serverInfoWnd(nullptr), createServerWnd(nullptr) { - AddTextButton(ID_btBack, DrawPoint(530, 530), Extent(250, 22), TextureColor::Red1, _("Back"), NormalFont); - AddTextButton(ID_btConnect, DrawPoint(530, 470), Extent(250, 22), TextureColor::Green2, _("Connect"), NormalFont); - AddTextButton(ID_btAddServer, DrawPoint(530, 440), Extent(250, 22), TextureColor::Green2, _("Add Server"), + addTextButton(ID_btBack, DrawPoint(530, 530), Extent(250, 22), TextureColor::Red1, _("Back"), NormalFont); + addTextButton(ID_btConnect, DrawPoint(530, 470), Extent(250, 22), TextureColor::Green2, _("Connect"), NormalFont); + addTextButton(ID_btAddServer, DrawPoint(530, 440), Extent(250, 22), TextureColor::Green2, _("Add Server"), NormalFont); using SRT = ctrlTable::SortType; - AddTable(ID_tblGames, DrawPoint(20, 20), Extent(500, 262), TextureColor::Grey, NormalFont, + addTable(ID_tblGames, DrawPoint(20, 20), Extent(500, 262), TextureColor::Grey, NormalFont, ctrlTable::Columns{{_("ID"), 0, SRT::Number}, {_("Server"), 300, SRT::String}, {_("Map"), 300, SRT::String}, {_("Player"), 200, SRT::String}, {_("Version"), 100, SRT::String}, {_("Ping"), 100, SRT::Number}}); - AddTable(ID_tblPlayers, DrawPoint(530, 20), Extent(250, 410), TextureColor::Grey, NormalFont, + addTable(ID_tblPlayers, DrawPoint(530, 20), Extent(250, 410), TextureColor::Grey, NormalFont, ctrlTable::Columns{{_("Name"), 12, SRT::String}, {_("Version"), 10, SRT::String}}); // Chatfenster - AddChatCtrl(ID_Chat, DrawPoint(20, 290), Extent(500, 238), TextureColor::Grey, NormalFont); + addChatCtrl(ID_Chat, DrawPoint(20, 290), Extent(500, 238), TextureColor::Grey, NormalFont); // Chatfenster-Edit - AddEdit(ID_edtChat, DrawPoint(20, 530), Extent(500, 22), TextureColor::Grey, NormalFont); + addEdit(ID_edtChat, DrawPoint(20, 530), Extent(500, 22), TextureColor::Grey, NormalFont); using namespace std::chrono_literals; - AddTimer(ID_tmrUpdateGames, 5s); + addTimer(ID_tmrUpdateGames, 5s); // If we came from an active game, tell the server we quit if(LOBBYCLIENT.IsIngame()) LOBBYCLIENT.SendLeaveServer(); - UpdateServerList(); - UpdatePlayerList(); + updateServerList(); + updatePlayerList(); LOBBYCLIENT.AddListener(this); LOBBYCLIENT.SendServerListRequest(); @@ -92,8 +92,8 @@ void dskLobby::msgTimer(const unsigned /*ctrl_id*/) void dskLobby::msgPaintBefore() { dskMenuBase::msgPaintBefore(); - UpdateServerList(); - UpdatePlayerList(); + updateServerList(); + updatePlayerList(); getCtrl(ID_edtChat)->setFocus(); } @@ -114,17 +114,17 @@ void dskLobby::msgButtonClick(const unsigned ctrl_id) WINDOWMANAGER.Switch(std::make_unique()); } break; - case ID_btConnect: ConnectToSelectedGame(); break; + case ID_btConnect: connectToSelectedGame(); break; case ID_btAddServer: { if(SETTINGS.proxy.type != ProxyType::None) - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Sorry!"), _("You can't create a game while a proxy server is active\nDisable the use of a proxy server first!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationGreen, 1)); else { - createServerWnd = &WINDOWMANAGER.ReplaceWindow(std::make_unique(ServerType::Lobby)); + createServerWnd = &WINDOWMANAGER.replaceWindow(std::make_unique(ServerType::Lobby)); } } break; @@ -157,7 +157,7 @@ void dskLobby::msgTableRightButton(const unsigned ctrl_id, const std::optionalgetServerId() == boost::lexical_cast(item)) return; // Already open -> Nothing to do - serverInfoWnd = &WINDOWMANAGER.ReplaceWindow( + serverInfoWnd = &WINDOWMANAGER.replaceWindow( std::make_unique(boost::lexical_cast(item))); serverInfoWnd->setTitle(table->getItemText(*selection, 1)); } @@ -169,17 +169,17 @@ void dskLobby::msgTableRightButton(const unsigned ctrl_id, const std::optional(ID_tblGames); const auto& selectedRow = table->getSelection(); @@ -223,7 +223,7 @@ bool dskLobby::ConnectToSelectedGame() serverList, [selectedId](const LobbyServerInfo& server) { return server.getId() == selectedId; }); if(itServer == serverList.end()) { - WINDOWMANAGER.Show(std::make_unique(_("Sorry!"), _("The selected game was not found anymore."), this, + WINDOWMANAGER.show(std::make_unique(_("Sorry!"), _("The selected game was not found anymore."), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, 1)); } else { @@ -231,12 +231,12 @@ bool dskLobby::ConnectToSelectedGame() if(isServerVersionValid(*itServer)) { auto connect = std::make_unique(ServerType::Lobby); - connect->Connect(itServer->getHost(), itServer->getPort(), false, itServer->hasPassword()); - WINDOWMANAGER.ReplaceWindow(std::move(connect)); + connect->connect(itServer->getHost(), itServer->getPort(), false, itServer->hasPassword()); + WINDOWMANAGER.replaceWindow(std::move(connect)); return true; } else { - WINDOWMANAGER.Show(std::make_unique(_("Sorry!"), _("You can't join that game with your version!"), + WINDOWMANAGER.show(std::make_unique(_("Sorry!"), _("You can't join that game with your version!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, 1)); } } @@ -256,7 +256,7 @@ void dskLobby::LC_Status_ConnectionLost() */ void dskLobby::LC_Status_IncompleteMessage() { - WINDOWMANAGER.Show(std::make_unique(_("Error"), _("Lost connection to lobby!"), this, MsgboxButton::Ok, + WINDOWMANAGER.show(std::make_unique(_("Error"), _("Lost connection to lobby!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, 0)); } @@ -274,7 +274,7 @@ void dskLobby::LC_Status_Error(const std::string& error) */ void dskLobby::LC_Chat(const std::string& player, const std::string& text) { - unsigned playerColor = ctrlChat::CalcUniqueColor(player); + unsigned playerColor = ctrlChat::calcUniqueColor(player); std::string time = s25util::Time::FormatTime("(%H:%i:%s)"); @@ -288,11 +288,11 @@ void dskLobby::LC_Chat(const std::string& player, const std::string& text) { if(text.substr(self.length() + 1, 2) == ": ") { - WINDOWMANAGER.Show(std::make_unique("LobbyBot", text.substr(self.length() + 3), this, + WINDOWMANAGER.show(std::make_unique("LobbyBot", text.substr(self.length() + 3), this, MsgboxButton::Ok, MsgboxIcon::ExclamationGreen, 2)); } else if(text.substr(self.length() + 1, 2) == ", ") { - getCtrl(ID_Chat)->AddMessage(time, player, playerColor, text.substr(self.length() + 3), + getCtrl(ID_Chat)->addMessage(time, player, playerColor, text.substr(self.length() + 3), COLOR_YELLOW); } } @@ -301,7 +301,7 @@ void dskLobby::LC_Chat(const std::string& player, const std::string& text) } } - getCtrl(ID_Chat)->AddMessage(time, player, playerColor, text, COLOR_YELLOW); + getCtrl(ID_Chat)->addMessage(time, player, playerColor, text, COLOR_YELLOW); } void dskLobby::LC_ServerList(const LobbyServerList& servers) @@ -314,7 +314,7 @@ void dskLobby::LC_ServerList(const LobbyServerList& servers) if(sortColumn == -1) sortColumn = 0; const auto direction = servertable->getSortDirection(); - servertable->DeleteAllItems(); + servertable->deleteAllItems(); std::set ids; for(const LobbyServerInfo& server : servers) @@ -333,12 +333,12 @@ void dskLobby::LC_ServerList(const LobbyServerList& servers) std::string ping = helpers::toString(server.getPing()); std::string player = helpers::toString(server.getCurPlayers()) + "/" + helpers::toString(server.getMaxPlayers()); - servertable->AddRow({id, name, server.getMap(), player, server.getVersion(), ping}); + servertable->addRow({id, name, server.getMap(), player, server.getVersion(), ping}); } if(first) - servertable->SortRows(0, TableSortDir::Ascending); + servertable->sortRows(0, TableSortDir::Ascending); else - servertable->SortRows(sortColumn, direction); + servertable->sortRows(sortColumn, direction); servertable->setSelection(selection); } @@ -349,7 +349,7 @@ void dskLobby::LC_PlayerList(const LobbyPlayerList& players) if((playertable->getNumRows() > 0) && (playertable->getNumRows() < players.size())) { - LOADER.getSoundN("sound", 114)->Play(255, false); + LOADER.getSoundN("sound", 114)->play(255, false); } const unsigned selection = playertable->getSelection().value_or(0u); @@ -357,7 +357,7 @@ void dskLobby::LC_PlayerList(const LobbyPlayerList& players) if(sortColumn == -1) sortColumn = 0; const auto direction = playertable->getSortDirection(); - playertable->DeleteAllItems(); + playertable->deleteAllItems(); for(const LobbyPlayerInfo& player : players) { @@ -366,18 +366,18 @@ void dskLobby::LC_PlayerList(const LobbyPlayerList& players) std::string name = player.getName(); if(player.isIngame) name += _(" (playing)"); - playertable->AddRow({name, player.getVersion()}); + playertable->addRow({name, player.getVersion()}); } } if(first) - playertable->SortRows(0, TableSortDir::Ascending); + playertable->sortRows(0, TableSortDir::Ascending); else - playertable->SortRows(sortColumn, direction); + playertable->sortRows(sortColumn, direction); playertable->setSelection(selection); } void dskLobby::LC_ServerInfo(const LobbyServerInfo&) { if(serverInfoWnd) - serverInfoWnd->UpdateServerInfo(); + serverInfoWnd->updateServerInfo(); } diff --git a/libs/s25main/desktops/dskLobby.h b/libs/s25main/desktops/dskLobby.h index dcbee18389..3f2da3b269 100644 --- a/libs/s25main/desktops/dskLobby.h +++ b/libs/s25main/desktops/dskLobby.h @@ -25,8 +25,8 @@ class dskLobby final : public dskMenuBase, public LobbyInterface dskLobby(); ~dskLobby(); - void UpdatePlayerList(); - void UpdateServerList(); + void updatePlayerList(); + void updateServerList(); void msgWindowClosed(IngameWindow& wnd) override; @@ -51,5 +51,5 @@ class dskLobby final : public dskMenuBase, public LobbyInterface /** * Connects to the currently selected game and returns true on success */ - bool ConnectToSelectedGame(); + bool connectToSelectedGame(); }; diff --git a/libs/s25main/desktops/dskMainMenu.cpp b/libs/s25main/desktops/dskMainMenu.cpp index 4544037c90..ee5c2e5690 100644 --- a/libs/s25main/desktops/dskMainMenu.cpp +++ b/libs/s25main/desktops/dskMainMenu.cpp @@ -36,22 +36,22 @@ dskMainMenu::dskMainMenu() { RTTR_Assert(dskMenuBase::ID_FIRST_FREE <= 3); - AddTextButton(ID_btSingleplayer, DrawPoint(115, 180), Extent(220, 22), TextureColor::Green2, _("Singleplayer"), + addTextButton(ID_btSingleplayer, DrawPoint(115, 180), Extent(220, 22), TextureColor::Green2, _("Singleplayer"), NormalFont); - AddTextButton(ID_btMultiplayer, DrawPoint(115, 210), Extent(220, 22), TextureColor::Green2, _("Multiplayer"), + addTextButton(ID_btMultiplayer, DrawPoint(115, 210), Extent(220, 22), TextureColor::Green2, _("Multiplayer"), NormalFont); - AddTextButton(ID_btOptions, DrawPoint(115, 250), Extent(220, 22), TextureColor::Green2, _("Options"), NormalFont); - AddTextButton(ID_btIntro, DrawPoint(115, 280), Extent(220, 22), TextureColor::Green2, _("Intro"), NormalFont) + addTextButton(ID_btOptions, DrawPoint(115, 250), Extent(220, 22), TextureColor::Green2, _("Options"), NormalFont); + addTextButton(ID_btIntro, DrawPoint(115, 280), Extent(220, 22), TextureColor::Green2, _("Intro"), NormalFont) ->setEnabled(false); - AddTextButton(ID_btReadme, DrawPoint(115, 310), Extent(220, 22), TextureColor::Green2, _("Readme"), NormalFont); - AddTextButton(ID_btCredits, DrawPoint(115, 340), Extent(220, 22), TextureColor::Green2, _("Credits"), NormalFont); - AddTextButton(ID_btQuit, DrawPoint(115, 390), Extent(220, 22), TextureColor::Red1, _("Quit program"), NormalFont); + addTextButton(ID_btReadme, DrawPoint(115, 310), Extent(220, 22), TextureColor::Green2, _("Readme"), NormalFont); + addTextButton(ID_btCredits, DrawPoint(115, 340), Extent(220, 22), TextureColor::Green2, _("Credits"), NormalFont); + addTextButton(ID_btQuit, DrawPoint(115, 390), Extent(220, 22), TextureColor::Red1, _("Quit program"), NormalFont); - AddImage(ID_logo, DrawPoint(20, 20), LOADER.getImageN("logo", 0)); + addImage(ID_logo, DrawPoint(20, 20), LOADER.getImageN("logo", 0)); using namespace std::chrono_literals; if(SETTINGS.global.submitDebugData == SubmitDebugData::AskAtStart) - AddTimer(ID_tmrDebugData, 250ms); + addTimer(ID_tmrDebugData, 250ms); /*AddText(20, DrawPoint(50, 450), _("Font Test"), COLOR_YELLOW, FontStyle::LEFT, SmallFont); AddText(21, DrawPoint(50, 470), _("Font Test"), COLOR_YELLOW, FontStyle::LEFT, NormalFont); @@ -61,8 +61,8 @@ dskMainMenu::dskMainMenu() void dskMainMenu::msgTimer(const unsigned ctrl_id) { - getCtrl(ctrl_id)->Stop(); - WINDOWMANAGER.Show(std::make_unique( + getCtrl(ctrl_id)->stop(); + WINDOWMANAGER.show(std::make_unique( _("Submit debug data?"), _("RttR now supports sending debug data. Would you like to help us improving this game by sending debug data?"), this, MsgboxButton::YesNo, MsgboxIcon::QuestionRed, 100)); @@ -77,7 +77,7 @@ void dskMainMenu::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult m else SETTINGS.global.submitDebugData = SubmitDebugData::AlwaysAsk; - SETTINGS.Save(); + SETTINGS.save(); } } @@ -115,7 +115,7 @@ void dskMainMenu::msgButtonClick(const unsigned ctrl_id) GLOBALVARS.notdone = false; break; case ID_btReadme: // "Readme" - WINDOWMANAGER.ToggleWindow(std::make_unique("readme.txt", _("Readme!"))); + WINDOWMANAGER.toggleWindow(std::make_unique("readme.txt", _("Readme!"))); break; } } diff --git a/libs/s25main/desktops/dskMenuBase.cpp b/libs/s25main/desktops/dskMenuBase.cpp index 01f1583a12..1942f0f55a 100644 --- a/libs/s25main/desktops/dskMenuBase.cpp +++ b/libs/s25main/desktops/dskMenuBase.cpp @@ -10,22 +10,22 @@ dskMenuBase::dskMenuBase() : Desktop(LOADER.getImageN("menu", 0)) { - AddBottomTexts(); + addBottomTexts(); } dskMenuBase::dskMenuBase(glArchivItem_Bitmap* background) : Desktop(background) { - AddBottomTexts(); + addBottomTexts(); } -void dskMenuBase::AddBottomTexts() +void dskMenuBase::addBottomTexts() { - AddFormattedText(ID_txtVersion, DrawPoint(0, 600), "Return To The Roots - %1%", COLOR_YELLOW, + addFormattedText(ID_txtVersion, DrawPoint(0, 600), "Return To The Roots - %1%", COLOR_YELLOW, FontStyle::LEFT | FontStyle::BOTTOM, NormalFont) % rttr::version::getReadableVersion(); - AddText(ID_txtURL, DrawPoint(400, 600), "http://www.siedler25.org", COLOR_GREEN, + addText(ID_txtURL, DrawPoint(400, 600), "http://www.siedler25.org", COLOR_GREEN, FontStyle::CENTER | FontStyle::BOTTOM, NormalFont); - AddFormattedText(ID_txtCopyright, DrawPoint(800, 600), + addFormattedText(ID_txtCopyright, DrawPoint(800, 600), "\xC2\xA9" " 2005 - %s Settlers Freaks", COLOR_YELLOW, FontStyle::RIGHT | FontStyle::BOTTOM, NormalFont) diff --git a/libs/s25main/desktops/dskMenuBase.h b/libs/s25main/desktops/dskMenuBase.h index d3648ff2d3..4c441df5b5 100644 --- a/libs/s25main/desktops/dskMenuBase.h +++ b/libs/s25main/desktops/dskMenuBase.h @@ -28,5 +28,5 @@ class dskMenuBase : public Desktop }; private: - void AddBottomTexts(); + void addBottomTexts(); }; diff --git a/libs/s25main/desktops/dskMultiPlayer.cpp b/libs/s25main/desktops/dskMultiPlayer.cpp index a922988ac5..c73ff38d1e 100644 --- a/libs/s25main/desktops/dskMultiPlayer.cpp +++ b/libs/s25main/desktops/dskMultiPlayer.cpp @@ -22,15 +22,15 @@ dskMultiPlayer::dskMultiPlayer() RTTR_Assert(dskMenuBase::ID_FIRST_FREE <= 3); // "Internet - Lobby" - AddTextButton(3, DrawPoint(115, 180), Extent(220, 22), TextureColor::Green2, _("Internet Lobby"), NormalFont); + addTextButton(3, DrawPoint(115, 180), Extent(220, 22), TextureColor::Green2, _("Internet Lobby"), NormalFont); // "Netzwerk / LAN" - AddTextButton(4, DrawPoint(115, 210), Extent(220, 22), TextureColor::Green2, _("Network/LAN"), NormalFont); + addTextButton(4, DrawPoint(115, 210), Extent(220, 22), TextureColor::Green2, _("Network/LAN"), NormalFont); // "Direkte IP" - AddTextButton(5, DrawPoint(115, 250), Extent(220, 22), TextureColor::Green2, _("Direct IP"), NormalFont); + addTextButton(5, DrawPoint(115, 250), Extent(220, 22), TextureColor::Green2, _("Direct IP"), NormalFont); // "Zurück" - AddTextButton(6, DrawPoint(115, 290), Extent(220, 22), TextureColor::Red1, _("Back"), NormalFont); + addTextButton(6, DrawPoint(115, 290), Extent(220, 22), TextureColor::Red1, _("Back"), NormalFont); - AddImage(11, DrawPoint(20, 20), LOADER.getImageN("logo", 0)); + addImage(11, DrawPoint(20, 20), LOADER.getImageN("logo", 0)); } void dskMultiPlayer::msgButtonClick(const unsigned ctrl_id) @@ -38,7 +38,7 @@ void dskMultiPlayer::msgButtonClick(const unsigned ctrl_id) switch(ctrl_id) { case 3: // Lobby - WINDOWMANAGER.Show(std::make_unique(), true); + WINDOWMANAGER.show(std::make_unique(), true); break; case 4: // Local Area Network WINDOWMANAGER.Switch(std::make_unique()); diff --git a/libs/s25main/desktops/dskOptions.cpp b/libs/s25main/desktops/dskOptions.cpp index f64a05e4c3..4e226069ab 100644 --- a/libs/s25main/desktops/dskOptions.cpp +++ b/libs/s25main/desktops/dskOptions.cpp @@ -155,12 +155,12 @@ ctrlOptionGroup& addOnOffOption(ctrlGroup& parentGroup, DrawPoint pos, unsigned if(btSize == ButtonSize::Half) size.x = (ctrlSize.x - spacing) / 2; - parentGroup.AddText(ID_txtsStart + id, pos, title, COLOR_YELLOW, FontStyle{}, NormalFont); - auto* option = parentGroup.AddOptionGroup(id, GroupSelectType::Check); + parentGroup.addText(ID_txtsStart + id, pos, title, COLOR_YELLOW, FontStyle{}, NormalFont); + auto* option = parentGroup.addOptionGroup(id, GroupSelectType::Check); pos += ctrlOffset; - option->AddTextButton(ID_btOn, pos, size, TextureColor::Grey, _("On"), NormalFont); + option->addTextButton(ID_btOn, pos, size, TextureColor::Grey, _("On"), NormalFont); pos.x += size.x + spacing; - option->AddTextButton(ID_btOff, pos, size, TextureColor::Grey, _("Off"), NormalFont); + option->addTextButton(ID_btOff, pos, size, TextureColor::Grey, _("Off"), NormalFont); option->setSelection(value); return *option; } @@ -169,27 +169,27 @@ ctrlOptionGroup& addOnOffOption(ctrlGroup& parentGroup, DrawPoint pos, unsigned dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) { - AddText(ID_txtOptions, DrawPoint(400, 10), _("Options"), COLOR_YELLOW, FontStyle::CENTER, LargeFont); + addText(ID_txtOptions, DrawPoint(400, 10), _("Options"), COLOR_YELLOW, FontStyle::CENTER, LargeFont); - ctrlOptionGroup* mainGroup = AddOptionGroup(ID_grpOptions, GroupSelectType::Check); + ctrlOptionGroup* mainGroup = addOptionGroup(ID_grpOptions, GroupSelectType::Check); DrawPoint curPos = tabButtonsStartPosition; - mainGroup->AddTextButton(ID_btCommon, DrawPoint(curPos.x, curPos.y), Extent(200, 22), TextureColor::Green2, + mainGroup->addTextButton(ID_btCommon, DrawPoint(curPos.x, curPos.y), Extent(200, 22), TextureColor::Green2, _("Common"), NormalFont); - mainGroup->AddTextButton(ID_btGraphics, DrawPoint(curPos.x + 220, curPos.y), Extent(200, 22), TextureColor::Green2, + mainGroup->addTextButton(ID_btGraphics, DrawPoint(curPos.x + 220, curPos.y), Extent(200, 22), TextureColor::Green2, _("Graphics"), NormalFont); - mainGroup->AddTextButton(ID_btSound, DrawPoint(curPos.x + 440, curPos.y), Extent(200, 22), TextureColor::Green2, + mainGroup->addTextButton(ID_btSound, DrawPoint(curPos.x + 440, curPos.y), Extent(200, 22), TextureColor::Green2, _("Sound/Music"), NormalFont); curPos.y += rowHeight; - AddTextButton(ID_btBack, DrawPoint(curPos.x + 220, curPos.y), Extent(200, 22), TextureColor::Red1, _("Back"), + addTextButton(ID_btBack, DrawPoint(curPos.x + 220, curPos.y), Extent(200, 22), TextureColor::Red1, _("Back"), NormalFont); - AddTextButton(ID_btAddons, DrawPoint(curPos.x + 440, curPos.y), Extent(200, 22), TextureColor::Green2, _("Addons"), + addTextButton(ID_btAddons, DrawPoint(curPos.x + 440, curPos.y), Extent(200, 22), TextureColor::Green2, _("Addons"), NormalFont); - ctrlGroup* groupCommon = AddGroup(ID_grpCommon); - ctrlGroup* groupGraphics = AddGroup(ID_grpGraphics); - ctrlGroup* groupSound = AddGroup(ID_grpSound); + ctrlGroup* groupCommon = addGroup(ID_grpCommon); + ctrlGroup* groupGraphics = addGroup(ID_grpGraphics); + ctrlGroup* groupSound = addGroup(ID_grpSound); ctrlComboBox* combo; // Common @@ -197,38 +197,38 @@ dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) curPos = optionRowsStartPosition; - groupCommon->AddText(ID_txtName, curPos, _("Name in Game:"), COLOR_YELLOW, FontStyle{}, NormalFont); + groupCommon->addText(ID_txtName, curPos, _("Name in Game:"), COLOR_YELLOW, FontStyle{}, NormalFont); ctrlEdit* name = - groupCommon->AddEdit(ID_edtName, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 15); + groupCommon->addEdit(ID_edtName, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 15); name->setText(SETTINGS.lobby.name); const auto& currentPortrait = Portraits[SETTINGS.lobby.portraitIndex]; - groupCommon->AddImageButton(ID_btCommonPortrait, DrawPoint(500, curPos.y + ctrlOffset.y), Extent(40, rowHeight * 2), + groupCommon->addImageButton(ID_btCommonPortrait, DrawPoint(500, curPos.y + ctrlOffset.y), Extent(40, rowHeight * 2), TextureColor::Grey, LOADER.getImageN(currentPortrait.resourceId, currentPortrait.resourceIndex)); curPos.y += rowHeight; - groupCommon->AddText(ID_txtCommonPortrait, curPos, _("Portrait:"), COLOR_YELLOW, FontStyle{}, NormalFont); + groupCommon->addText(ID_txtCommonPortrait, curPos, _("Portrait:"), COLOR_YELLOW, FontStyle{}, NormalFont); combo = - groupCommon->AddComboBox(ID_cbCommonPortrait, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 100); + groupCommon->addComboBox(ID_cbCommonPortrait, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 100); for(unsigned i = 0; i < Portraits.size(); ++i) { - combo->AddItem(_(Portraits[i].name)); + combo->addItem(_(Portraits[i].name)); if(SETTINGS.lobby.portraitIndex == i) combo->setSelection(i); } curPos.y += rowHeight; - groupCommon->AddText(ID_txtLanguage, curPos, _("Language:"), COLOR_YELLOW, FontStyle{}, NormalFont); - combo = groupCommon->AddComboBox(ID_cbLanguage, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 100); + groupCommon->addText(ID_txtLanguage, curPos, _("Language:"), COLOR_YELLOW, FontStyle{}, NormalFont); + combo = groupCommon->addComboBox(ID_cbLanguage, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 100); bool selected = false; for(unsigned i = 0; i < LANGUAGES.size(); ++i) { const Language& l = LANGUAGES.getLanguage(i); - combo->AddItem(_(l.name)); + combo->addItem(_(l.name)); if(SETTINGS.language.language == l.code) { combo->setSelection(static_cast(i)); @@ -239,14 +239,14 @@ dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) combo->setSelection(0); curPos.y += rowHeight; - groupCommon->AddTextButton(ID_btKeyboardLayout, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey, + groupCommon->addTextButton(ID_btKeyboardLayout, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey, _("Keyboard layout"), NormalFont); curPos.y += rowHeight; curPos.y += sectionSpacingCommon; - groupCommon->AddText(ID_txtPort, curPos, _("Local Port:"), COLOR_YELLOW, FontStyle{}, NormalFont); + groupCommon->addText(ID_txtPort, curPos, _("Local Port:"), COLOR_YELLOW, FontStyle{}, NormalFont); ctrlEdit* edtPort = - groupCommon->AddEdit(ID_edtPort, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 15); + groupCommon->addEdit(ID_edtPort, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 15); edtPort->setType(EditType::Number); edtPort->setText(SETTINGS.server.localPort); curPos.y += rowHeight; @@ -261,11 +261,11 @@ dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) curPos.y += sectionSpacingCommon; // Proxy server - groupCommon->AddText(ID_txtProxy, curPos, _("Proxyserver:"), COLOR_YELLOW, FontStyle{}, NormalFont); - ctrlEdit* proxy = groupCommon->AddEdit(ID_edtProxy, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont); + groupCommon->addText(ID_txtProxy, curPos, _("Proxyserver:"), COLOR_YELLOW, FontStyle{}, NormalFont); + ctrlEdit* proxy = groupCommon->addEdit(ID_edtProxy, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont); proxy->setText(SETTINGS.proxy.hostname); proxy = - groupCommon->AddEdit(ID_edtProxyPort, curPos + ctrlOffset2, Extent(50, 22), TextureColor::Grey, NormalFont, 5); + groupCommon->addEdit(ID_edtProxyPort, curPos + ctrlOffset2, Extent(50, 22), TextureColor::Grey, NormalFont, 5); proxy->setType(EditType::Number); proxy->setText(SETTINGS.proxy.port); curPos.y += rowHeight; @@ -274,11 +274,11 @@ dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) curPos.y += rowHeight; // Proxy type - groupCommon->AddText(ID_txtProxyType, curPos, _("Proxytyp:"), COLOR_YELLOW, FontStyle{}, NormalFont); + groupCommon->addText(ID_txtProxyType, curPos, _("Proxytyp:"), COLOR_YELLOW, FontStyle{}, NormalFont); combo = - groupCommon->AddComboBox(ID_cbProxyType, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey, NormalFont, 100); - combo->AddItem(_("No Proxy")); - combo->AddItem(_("Socks v4")); + groupCommon->addComboBox(ID_cbProxyType, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey, NormalFont, 100); + combo->addItem(_("No Proxy")); + combo->addItem(_("Socks v4")); // TODO: not implemented // combo->AddString(_("Socks v5")); @@ -291,13 +291,13 @@ dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) curPos.y += rowHeight; curPos.y += sectionSpacingCommon; - groupCommon->AddText(ID_txtMapScrollMode, curPos, _("Map scroll mode:"), COLOR_YELLOW, FontStyle{}, NormalFont); - combo = groupCommon->AddComboBox(ID_cbMapScrollMode, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey, + groupCommon->addText(ID_txtMapScrollMode, curPos, _("Map scroll mode:"), COLOR_YELLOW, FontStyle{}, NormalFont); + combo = groupCommon->addComboBox(ID_cbMapScrollMode, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey, NormalFont, 100); - combo->AddItem(_("Scroll same (Map moves in the same direction the mouse is moved when scrolling/panning.)")); - combo->AddItem( + combo->addItem(_("Scroll same (Map moves in the same direction the mouse is moved when scrolling/panning.)")); + combo->addItem( _("Scroll opposite (Map moves in the opposite direction the mouse is moved when scrolling/panning.)")); - combo->AddItem(_("Grab and drag (Map moves with your cursor when scrolling/panning.)")); + combo->addItem(_("Grab and drag (Map moves with your cursor when scrolling/panning.)")); combo->setSelection(static_cast(SETTINGS.interface.mapScrollMode)); curPos.y += rowHeight; @@ -317,11 +317,11 @@ dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) curPos.y += rowHeight; curPos.y += sectionSpacingCommon; - groupCommon->AddText(ID_txtDebugData, curPos, _("Submit debug data:"), COLOR_YELLOW, FontStyle{}, NormalFont); - mainGroup = groupCommon->AddOptionGroup(ID_grpDebugData, GroupSelectType::Check); - mainGroup->AddTextButton(ID_btSubmitDebugOn, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, _("On"), + groupCommon->addText(ID_txtDebugData, curPos, _("Submit debug data:"), COLOR_YELLOW, FontStyle{}, NormalFont); + mainGroup = groupCommon->addOptionGroup(ID_grpDebugData, GroupSelectType::Check); + mainGroup->addTextButton(ID_btSubmitDebugOn, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, _("On"), NormalFont); - mainGroup->AddTextButton(ID_btSubmitDebugAsk, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, _("Ask always"), + mainGroup->addTextButton(ID_btSubmitDebugAsk, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, _("Ask always"), NormalFont); mainGroup->setSelection((SETTINGS.global.submitDebugData == SubmitDebugData::Yes) ? ID_btSubmitDebugOn : @@ -332,22 +332,22 @@ dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) curPos = optionRowsStartPosition; - groupGraphics->AddText(ID_txtDisplayMode, curPos, _("Mode:"), COLOR_YELLOW, FontStyle{}, NormalFont); - ctrlComboBox* cbDisplayMode = groupGraphics->AddComboBox(ID_cbDisplayMode, curPos + ctrlOffset, ctrlSizeLarge, + groupGraphics->addText(ID_txtDisplayMode, curPos, _("Mode:"), COLOR_YELLOW, FontStyle{}, NormalFont); + ctrlComboBox* cbDisplayMode = groupGraphics->addComboBox(ID_cbDisplayMode, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey, NormalFont, 100); - cbDisplayMode->AddItem(_("Windowed")); - cbDisplayMode->AddItem(_("Fullscreen")); - cbDisplayMode->AddItem(_("Borderless window")); + cbDisplayMode->addItem(_("Windowed")); + cbDisplayMode->addItem(_("Fullscreen")); + cbDisplayMode->addItem(_("Borderless window")); cbDisplayMode->setSelection(rttr::enum_cast(SETTINGS.video.displayMode.type)); curPos.y += rowHeight; - auto* grpResolution = groupGraphics->AddGroup(ID_grpResolution); - grpResolution->AddText(ID_txtResolution, curPos, _("Fullscreen resolution:"), COLOR_YELLOW, FontStyle{}, + auto* grpResolution = groupGraphics->addGroup(ID_grpResolution); + grpResolution->addText(ID_txtResolution, curPos, _("Fullscreen resolution:"), COLOR_YELLOW, FontStyle{}, NormalFont); - grpResolution->AddComboBox(ID_cbResolution, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 150); - auto* grpWindowSize = groupGraphics->AddGroup(ID_grpWindowSize); - grpWindowSize->AddText(ID_txtWindowSize, curPos, _("Window size:"), COLOR_YELLOW, FontStyle{}, NormalFont); - grpWindowSize->AddComboBox(ID_cbWindowSize, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 150); + grpResolution->addComboBox(ID_cbResolution, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 150); + auto* grpWindowSize = groupGraphics->addGroup(ID_grpWindowSize); + grpWindowSize->addText(ID_txtWindowSize, curPos, _("Window size:"), COLOR_YELLOW, FontStyle{}, NormalFont); + grpWindowSize->addComboBox(ID_cbWindowSize, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 150); curPos.y += rowHeight; addOnOffOption(*grpWindowSize, curPos, ID_grpLockWindowSize, _("Lock window size:"), @@ -355,8 +355,8 @@ dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) curPos.y += rowHeight; curPos.y += sectionSpacing; - groupGraphics->AddText(ID_txtFramerate, curPos, _("Limit Framerate:"), COLOR_YELLOW, FontStyle{}, NormalFont); - groupGraphics->AddComboBox(ID_cbFramerate, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey, NormalFont, 150); + groupGraphics->addText(ID_txtFramerate, curPos, _("Limit Framerate:"), COLOR_YELLOW, FontStyle{}, NormalFont); + groupGraphics->addComboBox(ID_cbFramerate, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey, NormalFont, 150); curPos.y += rowHeight; curPos.y += sectionSpacing; @@ -364,15 +364,15 @@ dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) curPos.y += rowHeight; curPos.y += sectionSpacing; - groupGraphics->AddText(ID_txtVideoDriver, curPos, _("Graphics Driver"), COLOR_YELLOW, FontStyle{}, NormalFont); - combo = groupGraphics->AddComboBox(ID_cbVideoDriver, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey, + groupGraphics->addText(ID_txtVideoDriver, curPos, _("Graphics Driver"), COLOR_YELLOW, FontStyle{}, NormalFont); + combo = groupGraphics->addComboBox(ID_cbVideoDriver, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey, NormalFont, 100); - const auto video_drivers = drivers::DriverWrapper::LoadDriverList(drivers::DriverType::Video); + const auto video_drivers = drivers::DriverWrapper::loadDriverList(drivers::DriverType::Video); for(const auto& video_driver : video_drivers) { - combo->AddItem(video_driver.getName()); + combo->addItem(video_driver.getName()); if(video_driver.getName() == SETTINGS.driver.video) combo->setSelection(combo->getNumItems() - 1); } @@ -383,8 +383,8 @@ dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) curPos.y += rowHeight; curPos.y += sectionSpacing; - groupGraphics->AddText(ID_txtGuiScale, curPos, _("GUI Scale:"), COLOR_YELLOW, FontStyle{}, NormalFont); - groupGraphics->AddComboBox(ID_cbGuiScale, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 100); + groupGraphics->addText(ID_txtGuiScale, curPos, _("GUI Scale:"), COLOR_YELLOW, FontStyle{}, NormalFont); + groupGraphics->addComboBox(ID_cbGuiScale, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 100); updateGuiScale(); curPos = optionRowsStartPosition; @@ -392,7 +392,7 @@ dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) addOnOffOption(*groupSound, curPos, ID_grpEffects, _("Effects"), SETTINGS.sound.effectsEnabled, ButtonSize::Half); ctrlProgress* FXvolume = - groupSound->AddProgress(ID_pgEffectsVol, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, 139, 138, 100); + groupSound->addProgress(ID_pgEffectsVol, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, 139, 138, 100); FXvolume->setPosition((SETTINGS.sound.effectsVolume * 100) / 255); curPos.y += rowHeight; @@ -405,25 +405,25 @@ dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) addOnOffOption(*groupSound, curPos, ID_grpMusic, _("Music"), SETTINGS.sound.musicEnabled, ButtonSize::Half); ctrlProgress* Mvolume = - groupSound->AddProgress(ID_pgMusicVol, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, 139, 138, 100); + groupSound->addProgress(ID_pgMusicVol, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, 139, 138, 100); Mvolume->setPosition((SETTINGS.sound.musicVolume * 100) / 255); //-V807 curPos.y += rowHeight; curPos.y += sectionSpacing; - groupSound->AddTextButton(ID_btMusicPlayer, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, _("Music player"), + groupSound->addTextButton(ID_btMusicPlayer, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, _("Music player"), NormalFont); curPos.y += rowHeight; curPos.y += sectionSpacing; - groupSound->AddText(ID_txtAudioDriver, curPos, _("Sounddriver"), COLOR_YELLOW, FontStyle{}, NormalFont); - combo = groupSound->AddComboBox(ID_cbAudioDriver, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey, + groupSound->addText(ID_txtAudioDriver, curPos, _("Sounddriver"), COLOR_YELLOW, FontStyle{}, NormalFont); + combo = groupSound->addComboBox(ID_cbAudioDriver, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey, NormalFont, 100); - const auto audio_drivers = drivers::DriverWrapper::LoadDriverList(drivers::DriverType::Audio); + const auto audio_drivers = drivers::DriverWrapper::loadDriverList(drivers::DriverType::Audio); for(const auto& audio_driver : audio_drivers) { - combo->AddItem(audio_driver.getName()); + combo->addItem(audio_driver.getName()); if(audio_driver.getName() == SETTINGS.driver.audio) combo->setSelection(combo->getNumItems() - 1); } @@ -450,19 +450,19 @@ dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) str << " "; str << " (" << ratio.width << ":" << ratio.height << ")"; - cbVideoModes.AddItem(str.str()); + cbVideoModes.addItem(str.str()); // Select, if this is the current resolution if(videoMode == SETTINGS.video.fullscreenSize) //-V807 cbVideoModes.setSelection(cbVideoModes.getNumItems() - 1); } ctrlComboBox& cbWindowSize = *grpWindowSize->getCtrl(ID_cbWindowSize); - cbWindowSize.AddItem(""); // Placeholder for current window size + cbWindowSize.addItem(""); // Placeholder for current window size for(const auto& size : windowSizes_) { s25util::ClassicImbuedStream str; str << size.width << "x" << size.height; - cbWindowSize.AddItem(str.str()); + cbWindowSize.addItem(str.str()); } updateWindowSizeComboBox(); updateResolutionGroups(); @@ -470,13 +470,13 @@ dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) // Fill "Limit Framerate" auto* cbFrameRate = groupGraphics->getCtrl(ID_cbFramerate); if(VIDEODRIVER.hasVSync()) - cbFrameRate->AddItem(_("Dynamic (Limits to display refresh rate, works with most drivers)")); + cbFrameRate->addItem(_("Dynamic (Limits to display refresh rate, works with most drivers)")); for(int framerate : Settings::SCREEN_REFRESH_RATES) { if(framerate == -1) - cbFrameRate->AddItem(_("Disabled")); + cbFrameRate->addItem(_("Disabled")); else - cbFrameRate->AddItem(helpers::toString(framerate) + " FPS"); + cbFrameRate->addItem(helpers::toString(framerate) + " FPS"); if(SETTINGS.video.framerate == framerate) cbFrameRate->setSelection(cbFrameRate->getNumItems() - 1); } @@ -495,13 +495,13 @@ dskOptions::dskOptions() : Desktop(LOADER.getImageN("setup013", 0)) // } // Load game settings - ggs.LoadSettings(); + ggs.loadSettings(); } dskOptions::~dskOptions() { // Save game settings - ggs.SaveSettings(); + ggs.saveSettings(); } void dskOptions::msgGroupProgressChange(const unsigned /*group_id*/, const unsigned ctrl_id, @@ -573,7 +573,7 @@ void dskOptions::msgGroupComboSelectItem(const unsigned group_id, const unsigned SETTINGS.video.windowedSize = windowSizes_[selection - 1]; if(SETTINGS.video.displayMode == DisplayMode::Windowed && VIDEODRIVER.getDisplayMode() == DisplayMode::Windowed) - VIDEODRIVER.ResizeScreen(SETTINGS.video.windowedSize, DisplayMode::Windowed); + VIDEODRIVER.resizeScreen(SETTINGS.video.windowedSize, DisplayMode::Windowed); } break; case ID_cbFramerate: @@ -613,7 +613,7 @@ void dskOptions::msgGroupOptionGroupChange(const unsigned /*group_id*/, const un SETTINGS.video.displayMode.resizeable = !enabled; const auto newDisplayMode = SETTINGS.video.displayMode; if(newDisplayMode == DisplayMode::Windowed && VIDEODRIVER.getDisplayMode() == DisplayMode::Windowed) - VIDEODRIVER.ResizeScreen(VIDEODRIVER.getWindowSize(), newDisplayMode); + VIDEODRIVER.resizeScreen(VIDEODRIVER.getWindowSize(), newDisplayMode); } break; case ID_grpVBO: SETTINGS.video.vbo = enabled; break; @@ -623,9 +623,9 @@ void dskOptions::msgGroupOptionGroupChange(const unsigned /*group_id*/, const un case ID_grpMusic: SETTINGS.sound.musicEnabled = enabled; if(enabled) - MUSICPLAYER.Play(); + MUSICPLAYER.play(); else - MUSICPLAYER.Stop(); + MUSICPLAYER.stop(); break; case ID_grpDebugData: // Special case: Uses e.g. ID_btSubmitDebugOn directly @@ -660,7 +660,7 @@ static bool validatePort(const std::string& sPort, uint16_t& outPort) outPort = *port; else { - WINDOWMANAGER.Show(std::make_unique(_("Error"), + WINDOWMANAGER.show(std::make_unique(_("Error"), _("Invalid port. The valid port-range is 1 to 65535!"), nullptr, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, 1)); } @@ -684,7 +684,7 @@ void dskOptions::msgButtonClick(const unsigned ctrl_id) if(!validatePort(groupCommon->getCtrl(ID_edtProxyPort)->getText(), SETTINGS.proxy.port)) return; - SETTINGS.Save(); + SETTINGS.save(); // Is the selected backend required to support GUI scaling to fulfill the user's choice? // If so, warn the user if the backend is unable to support GUI scaling. @@ -695,7 +695,7 @@ void dskOptions::msgButtonClick(const unsigned ctrl_id) && VIDEODRIVER.getGuiScaleRange().recommendedPercent != VIDEODRIVER.getGuiScale().percent())) { - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Sorry!"), _("The selected video driver does not support GUI scaling! Setting won't be used."), this, MsgboxButton::Ok, MsgboxIcon::ExclamationGreen, 1)); } @@ -705,9 +705,9 @@ void dskOptions::msgButtonClick(const unsigned ctrl_id) || VIDEODRIVER.getDisplayMode() != SETTINGS.video.displayMode) { const auto screenSize = fullscreen ? SETTINGS.video.fullscreenSize : SETTINGS.video.windowedSize; - if(!VIDEODRIVER.ResizeScreen(screenSize, SETTINGS.video.displayMode)) + if(!VIDEODRIVER.resizeScreen(screenSize, SETTINGS.video.displayMode)) { - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Sorry!"), _("You need to restart your game to change the screen resolution!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationGreen, 1)); return; @@ -715,7 +715,7 @@ void dskOptions::msgButtonClick(const unsigned ctrl_id) } if(SETTINGS.driver.video != VIDEODRIVER.getName() || SETTINGS.driver.audio != AUDIODRIVER.getName()) { - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Sorry!"), _("You need to restart your game to change the video or audio driver!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationGreen, 1)); return; @@ -724,7 +724,7 @@ void dskOptions::msgButtonClick(const unsigned ctrl_id) WINDOWMANAGER.Switch(std::make_unique()); } break; - case ID_btAddons: WINDOWMANAGER.ToggleWindow(std::make_unique(ggs)); break; + case ID_btAddons: WINDOWMANAGER.toggleWindow(std::make_unique(ggs)); break; } } @@ -737,9 +737,9 @@ void dskOptions::msgGroupButtonClick(const unsigned /*group_id*/, const unsigned SETTINGS.lobby.portraitIndex = (SETTINGS.lobby.portraitIndex + 1) % Portraits.size(); updatePortraitControls(); break; - case ID_btMusicPlayer: WINDOWMANAGER.ToggleWindow(std::make_unique()); break; + case ID_btMusicPlayer: WINDOWMANAGER.toggleWindow(std::make_unique()); break; case ID_btKeyboardLayout: - WINDOWMANAGER.ToggleWindow(std::make_unique("keyboardlayout.txt", _("Keyboard layout"))); + WINDOWMANAGER.toggleWindow(std::make_unique("keyboardlayout.txt", _("Keyboard layout"))); break; } } @@ -758,7 +758,7 @@ void dskOptions::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult /* void dskOptions::loadVideoModes() { // Get available modes - const auto videoModes = VIDEODRIVER.ListVideoModes(); + const auto videoModes = VIDEODRIVER.listVideoModes(); // random access is need for selection videoModes_.assign(videoModes.begin(), videoModes.end()); const auto windowSizes = VIDEODRIVER.getDefaultWindowSizes(); @@ -805,10 +805,10 @@ void dskOptions::updateGuiScale() auto* combo = getCtrl(ID_grpGraphics)->getCtrl(ID_cbGuiScale); guiScales_.clear(); - combo->DeleteAllItems(); + combo->deleteAllItems(); guiScales_.push_back(0); - combo->AddItem(helpers::format(_("Auto (%u%%)"), range.recommendedPercent)); + combo->addItem(helpers::format(_("Auto (%u%%)"), range.recommendedPercent)); if(SETTINGS.video.guiScale == 0) combo->setSelection(0); @@ -818,7 +818,7 @@ void dskOptions::updateGuiScale() recommendedGuiScaleIndex_ = guiScales_.size(); guiScales_.push_back(percent); - combo->AddItem(helpers::toString(percent) + "%"); + combo->addItem(helpers::toString(percent) + "%"); if(percent == SETTINGS.video.guiScale) combo->setSelection(combo->getNumItems() - 1); } diff --git a/libs/s25main/desktops/dskSelectMap.cpp b/libs/s25main/desktops/dskSelectMap.cpp index 255d4a9131..c1adfeced4 100644 --- a/libs/s25main/desktops/dskSelectMap.cpp +++ b/libs/s25main/desktops/dskSelectMap.cpp @@ -71,7 +71,7 @@ dskSelectMap::dskSelectMap(CreateServerInfo csi) // Die Tabelle für die Maps using SRT = ctrlTable::SortType; - AddTable(1, DrawPoint(110, 35), Extent(680, 400), TextureColor::Grey, NormalFont, + addTable(1, DrawPoint(110, 35), Extent(680, 400), TextureColor::Grey, NormalFont, ctrlTable::Columns{{_("Name"), 250, SRT::String}, {_("Author"), 216, SRT::String}, {_("Player"), 170, SRT::Number}, @@ -80,52 +80,52 @@ dskSelectMap::dskSelectMap(CreateServerInfo csi) {"", 0, SRT::Default}}); // "Karten Auswahl" - AddText(2, DrawPoint(400, 5), _("Selection of maps"), COLOR_YELLOW, FontStyle::CENTER, LargeFont); + addText(2, DrawPoint(400, 5), _("Selection of maps"), COLOR_YELLOW, FontStyle::CENTER, LargeFont); // "Zurück" - AddTextButton(3, DrawPoint(380, 560), Extent(200, 22), TextureColor::Red1, _("Back"), NormalFont); + addTextButton(3, DrawPoint(380, 560), Extent(200, 22), TextureColor::Red1, _("Back"), NormalFont); // "Spiel laden..." - AddTextButton(4, DrawPoint(590, 530), Extent(200, 22), TextureColor::Green2, _("Load game..."), NormalFont); + addTextButton(4, DrawPoint(590, 530), Extent(200, 22), TextureColor::Green2, _("Load game..."), NormalFont); // "Weiter" - AddTextButton(5, DrawPoint(590, 560), Extent(200, 22), TextureColor::Green2, _("Continue"), NormalFont); + addTextButton(5, DrawPoint(590, 560), Extent(200, 22), TextureColor::Green2, _("Continue"), NormalFont); // random map generation - AddTextButton(6, DrawPoint(380, 530), Extent(150, 22), TextureColor::Green2, _("Random Map"), NormalFont); + addTextButton(6, DrawPoint(380, 530), Extent(150, 22), TextureColor::Green2, _("Random Map"), NormalFont); // random map settings - AddTextButton(7, DrawPoint(540, 530), Extent(40, 22), TextureColor::Green2, _("..."), NormalFont); + addTextButton(7, DrawPoint(540, 530), Extent(40, 22), TextureColor::Green2, _("..."), NormalFont); - ctrlOptionGroup* optiongroup = AddOptionGroup(10, GroupSelectType::Check); + ctrlOptionGroup* optiongroup = addOptionGroup(10, GroupSelectType::Check); Extent catBtSize = Extent(90, 22); // "Alte" DrawPoint curBtPos = DrawPoint(10, 35); - optiongroup->AddTextButton(0, curBtPos, catBtSize, TextureColor::Grey, _("Old maps"), NormalFont); + optiongroup->addTextButton(0, curBtPos, catBtSize, TextureColor::Grey, _("Old maps"), NormalFont); curBtPos.y += catBtSize.y + 3; // "Neue" - optiongroup->AddTextButton(1, curBtPos, catBtSize, TextureColor::Grey, _("New maps"), NormalFont); + optiongroup->addTextButton(1, curBtPos, catBtSize, TextureColor::Grey, _("New maps"), NormalFont); curBtPos.y += catBtSize.y + 3; // "Eigene" - optiongroup->AddTextButton(2, curBtPos, catBtSize, TextureColor::Grey, _("Own maps"), NormalFont); + optiongroup->addTextButton(2, curBtPos, catBtSize, TextureColor::Grey, _("Own maps"), NormalFont); curBtPos.y += catBtSize.y + 3; // "Kontinente" - optiongroup->AddTextButton(3, curBtPos, catBtSize, TextureColor::Grey, _("Continents"), NormalFont); + optiongroup->addTextButton(3, curBtPos, catBtSize, TextureColor::Grey, _("Continents"), NormalFont); curBtPos.y += catBtSize.y + 3; // "Kampagne" - optiongroup->AddTextButton(4, curBtPos, catBtSize, TextureColor::Grey, _("Campaign"), NormalFont); + optiongroup->addTextButton(4, curBtPos, catBtSize, TextureColor::Grey, _("Campaign"), NormalFont); curBtPos.y += catBtSize.y + 3; // "RTTR" - optiongroup->AddTextButton(5, curBtPos, catBtSize, TextureColor::Grey, _("RTTR"), NormalFont); + optiongroup->addTextButton(5, curBtPos, catBtSize, TextureColor::Grey, _("RTTR"), NormalFont); curBtPos.y += catBtSize.y + 3; // "Andere" - optiongroup->AddTextButton(6, curBtPos, catBtSize, TextureColor::Grey, _("Other"), NormalFont); + optiongroup->addTextButton(6, curBtPos, catBtSize, TextureColor::Grey, _("Other"), NormalFont); curBtPos.y += catBtSize.y + 3; // "Andere" - optiongroup->AddTextButton(7, curBtPos, catBtSize, TextureColor::Grey, _("Sea"), NormalFont); + optiongroup->addTextButton(7, curBtPos, catBtSize, TextureColor::Grey, _("Sea"), NormalFont); curBtPos.y += catBtSize.y + 3; // "Heruntergeladene" - optiongroup->AddTextButton(8, curBtPos, catBtSize, TextureColor::Grey, _("Played"), NormalFont); + optiongroup->addTextButton(8, curBtPos, catBtSize, TextureColor::Grey, _("Played"), NormalFont); - AddPreviewMinimap(11, DrawPoint(110, 445), Extent(140, 140), nullptr); - AddText(12, DrawPoint(260, 470), _("Map: "), COLOR_YELLOW, FontStyle::LEFT, NormalFont); - AddText(13, DrawPoint(260, 490), _("Mapfile: "), COLOR_YELLOW, FontStyle::LEFT, NormalFont); + addPreviewMinimap(11, DrawPoint(110, 445), Extent(140, 140), nullptr); + addText(12, DrawPoint(260, 470), _("Map: "), COLOR_YELLOW, FontStyle::LEFT, NormalFont); + addText(13, DrawPoint(260, 490), _("Mapfile: "), COLOR_YELLOW, FontStyle::LEFT, NormalFont); // "Eigene" auswählen optiongroup->setSelection(5, true); @@ -145,7 +145,7 @@ void dskSelectMap::msgOptionGroupChange(const unsigned /*ctrl_id*/, unsigned sel auto* table = getCtrl(1); // Tabelle leeren - table->DeleteAllItems(); + table->deleteAllItems(); // Old, New, Own, Continents, Campaign, RTTR, Other, Sea, Played static const std::array ids = {{s25::folders::mapsOld, s25::folders::mapsNew, s25::folders::mapsOwn, @@ -155,26 +155,26 @@ void dskSelectMap::msgOptionGroupChange(const unsigned /*ctrl_id*/, unsigned sel const size_t numFaultyMapsPrior = brokenMapPaths.size(); const bfs::path mapPath = RTTRCONFIG.ExpandPath(ids[selection]); - FillTable(ListDir(mapPath, "swd")); - FillTable(ListDir(mapPath, "wld")); + fillTable(ListDir(mapPath, "swd")); + fillTable(ListDir(mapPath, "wld")); // For own maps (WORLDS folder) also use the one in the installation folder as S2 does if(mapPath.filename() == "WORLDS") { const bfs::path worldsPath = RTTRCONFIG.ExpandPath("WORLDS"); - FillTable(ListDir(worldsPath, "swd")); - FillTable(ListDir(worldsPath, "wld")); + fillTable(ListDir(worldsPath, "swd")); + fillTable(ListDir(worldsPath, "wld")); } if(brokenMapPaths.size() > numFaultyMapsPrior) { std::string errorTxt = helpers::format(_("%1% map(s) could not be loaded. Check the log for details"), brokenMapPaths.size() - numFaultyMapsPrior); - WINDOWMANAGER.Show( + WINDOWMANAGER.show( std::make_unique(_("Error"), errorTxt, this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, 1)); } // Dann noch sortieren - table->SortRows(0, TableSortDir::Ascending); + table->sortRows(0, TableSortDir::Ascending); // und Auswahl zurücksetzen table->setSelection(std::nullopt); @@ -232,10 +232,10 @@ void dskSelectMap::msgTableSelectItem(const unsigned ctrl_id, const std::optiona { const std::string errorTxt = helpers::format(_("Could not load map:\n%1%\n%2%"), path, e.what()); LOG.write("%1%\n") % errorTxt; - WINDOWMANAGER.Show(std::make_unique(_("Error"), errorTxt, this, MsgboxButton::Ok, + WINDOWMANAGER.show(std::make_unique(_("Error"), errorTxt, this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, 1)); brokenMapPaths.insert(path); - table.RemoveRow(*selection); + table.removeRow(*selection); } } } @@ -244,7 +244,7 @@ void dskSelectMap::msgTableSelectItem(const unsigned ctrl_id, const std::optiona txtMapPath.setPos(DrawPoint(txtXPos, txtMapPath.getPos().y)); } -void dskSelectMap::GoBack() const +void dskSelectMap::goBack() const { if(csi.type == ServerType::Local) WINDOWMANAGER.Switch(std::make_unique()); @@ -262,18 +262,18 @@ void dskSelectMap::msgButtonClick(const unsigned ctrl_id) { case 3: // "Zurück" { - GoBack(); + goBack(); } break; case 4: // "Spiel laden..." { // Ladefenster aufrufen - WINDOWMANAGER.ToggleWindow(std::make_unique(csi)); + WINDOWMANAGER.toggleWindow(std::make_unique(csi)); } break; case 5: // "Weiter" { - StartServer(); + startServer(); } break; case 6: // random map @@ -282,15 +282,15 @@ void dskSelectMap::msgButtonClick(const unsigned ctrl_id) { newRandMapPath.clear(); randMapGenError.clear(); - waitWnd = &WINDOWMANAGER.Show(std::make_unique()); + waitWnd = &WINDOWMANAGER.show(std::make_unique()); // mapGenThread = new boost::thread(boost::bind(&dskSelectMap::CreateRandomMap, this)); - CreateRandomMap(); + createRandomMap(); } } break; case 7: // random map generator settings { - WINDOWMANAGER.ToggleWindow(std::make_unique(rndMapSettings)); + WINDOWMANAGER.toggleWindow(std::make_unique(rndMapSettings)); } break; } @@ -299,10 +299,10 @@ void dskSelectMap::msgButtonClick(const unsigned ctrl_id) void dskSelectMap::msgTableChooseItem(const unsigned /*ctrl_id*/, const unsigned /*selection*/) { // Doppelklick auf bestimmte Map -> weiter - StartServer(); + startServer(); } -void dskSelectMap::CreateRandomMap() +void dskSelectMap::createRandomMap() { // setup filepath for the random map const auto mapPath = RTTRCONFIG.ExpandPath(s25::folders::mapsPlayed) / "Random.swd"; @@ -310,7 +310,7 @@ void dskSelectMap::CreateRandomMap() try { // create a random map and save filepath - rttr::mapGenerator::CreateRandomMap(mapPath, rndMapSettings); + rttr::mapGenerator::createRandomMap(mapPath, rndMapSettings); newRandMapPath = mapPath; } catch(const std::runtime_error& e) { @@ -318,7 +318,7 @@ void dskSelectMap::CreateRandomMap() } } -void dskSelectMap::OnMapCreated(const boost::filesystem::path& mapPath) +void dskSelectMap::onMapCreated(const boost::filesystem::path& mapPath) { // select the "played maps" entry auto* optionGroup = getCtrl(10); @@ -338,7 +338,7 @@ void dskSelectMap::OnMapCreated(const boost::filesystem::path& mapPath) } /// Startet das Spiel mit einer bestimmten Auswahl in der Tabelle -void dskSelectMap::StartServer() +void dskSelectMap::startServer() { auto* table = getCtrl(1); const auto& selection = table->getSelection(); @@ -350,16 +350,16 @@ void dskSelectMap::StartServer() const std::string& mapPath = table->getItemText(*selection, 5); // Server starten - if(!GAMECLIENT.HostGame(csi, {mapPath, MapType::OldMap})) - GoBack(); + if(!GAMECLIENT.hostGame(csi, {mapPath, MapType::OldMap})) + goBack(); else { std::unique_ptr lobbyClient; if(csi.type == ServerType::Lobby) lobbyClient = std::make_unique(LOBBYCLIENT); - iwConnecting& wnd = WINDOWMANAGER.Show(std::make_unique(csi.type, std::move(lobbyClient))); + iwConnecting& wnd = WINDOWMANAGER.show(std::make_unique(csi.type, std::move(lobbyClient))); onErrorConnection_ = wnd.onError.connect([this](ClientError error) { - WINDOWMANAGER.Show(std::make_unique(_("Error"), ClientErrorToStr(error), this, + WINDOWMANAGER.show(std::make_unique(_("Error"), clientErrorToStr(error), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, ID_msgBoxError)); }); @@ -371,7 +371,7 @@ void dskSelectMap::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult { if(msgbox_id == ID_msgBoxError) { - GAMECLIENT.Stop(); + GAMECLIENT.stop(); if(csi.type == ServerType::Lobby && LOBBYCLIENT.IsLoggedIn()) // steht die Lobbyverbindung noch? WINDOWMANAGER.Switch(std::make_unique()); @@ -389,33 +389,33 @@ void dskSelectMap::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult */ void dskSelectMap::LC_Status_Error(const std::string& error) { - WINDOWMANAGER.Show(std::make_unique(_("Error"), error, this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, + WINDOWMANAGER.show(std::make_unique(_("Error"), error, this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, ID_msgBoxError)); } -void dskSelectMap::Draw_() +void dskSelectMap::drawImpl() { if(!newRandMapPath.empty() || !randMapGenError.empty()) { if(waitWnd) { - waitWnd->Close(); + waitWnd->close(); waitWnd = nullptr; } if(!randMapGenError.empty()) { const std::string errorTxt = _("Failed to generate random map.\nReason: ") + randMapGenError; - WINDOWMANAGER.Show( + WINDOWMANAGER.show( std::make_unique(_("Error"), errorTxt, nullptr, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); } else - OnMapCreated(newRandMapPath); + onMapCreated(newRandMapPath); newRandMapPath.clear(); randMapGenError.clear(); } - Desktop::Draw_(); + Desktop::drawImpl(); } -void dskSelectMap::FillTable(const std::vector& files) +void dskSelectMap::fillTable(const std::vector& files) { auto* table = getCtrl(1); @@ -447,6 +447,6 @@ void dskSelectMap::FillTable(const std::vector& files) name += " (*)"; std::string author = s25util::ansiToUTF8(header.getAuthor()); - table->AddRow({name, author, players, landscapeNames[header.getGfxSet()], size, filePath.string()}); + table->addRow({name, author, players, landscapeNames[header.getGfxSet()], size, filePath.string()}); } } diff --git a/libs/s25main/desktops/dskSelectMap.h b/libs/s25main/desktops/dskSelectMap.h index 196f4f8e8b..811655a00a 100644 --- a/libs/s25main/desktops/dskSelectMap.h +++ b/libs/s25main/desktops/dskSelectMap.h @@ -25,9 +25,9 @@ class dskSelectMap final : public Desktop, public LobbyInterface ~dskSelectMap() override; private: - void Draw_() override; + void drawImpl() override; - void FillTable(const std::vector& files); + void fillTable(const std::vector& files); void msgOptionGroupChange(unsigned ctrl_id, unsigned selection) override; void msgButtonClick(unsigned ctrl_id) override; @@ -40,19 +40,19 @@ class dskSelectMap final : public Desktop, public LobbyInterface /** * Starts a new game with the currently selected map. */ - void StartServer(); + void startServer(); /** * Go back to the previous menu. */ - void GoBack() const; + void goBack() const; /** * Generates a new random map and selects the new map in the table (UI). */ - void CreateRandomMap(); + void createRandomMap(); - void OnMapCreated(const boost::filesystem::path& mapPath); + void onMapCreated(const boost::filesystem::path& mapPath); CreateServerInfo csi; rttr::mapGenerator::MapSettings rndMapSettings; diff --git a/libs/s25main/desktops/dskSinglePlayer.cpp b/libs/s25main/desktops/dskSinglePlayer.cpp index 8b47020432..1d2c273e38 100644 --- a/libs/s25main/desktops/dskSinglePlayer.cpp +++ b/libs/s25main/desktops/dskSinglePlayer.cpp @@ -37,18 +37,18 @@ dskSinglePlayer::dskSinglePlayer() { RTTR_Assert(dskMenuBase::ID_FIRST_FREE <= 3); - AddTextButton(3, DrawPoint(115, 180), Extent(220, 22), TextureColor::Green2, _("Resume last game"), NormalFont); - AddTextButton(7, DrawPoint(115, 210), Extent(220, 22), TextureColor::Green2, _("Load game"), NormalFont); + addTextButton(3, DrawPoint(115, 180), Extent(220, 22), TextureColor::Green2, _("Resume last game"), NormalFont); + addTextButton(7, DrawPoint(115, 210), Extent(220, 22), TextureColor::Green2, _("Load game"), NormalFont); - AddTextButton(5, DrawPoint(115, 250), Extent(220, 22), TextureColor::Green2, std::string(_("Campaigns")), + addTextButton(5, DrawPoint(115, 250), Extent(220, 22), TextureColor::Green2, std::string(_("Campaigns")), NormalFont); - AddTextButton(6, DrawPoint(115, 280), Extent(220, 22), TextureColor::Green2, _("Unlimited Play"), NormalFont); + addTextButton(6, DrawPoint(115, 280), Extent(220, 22), TextureColor::Green2, _("Unlimited Play"), NormalFont); - AddTextButton(4, DrawPoint(115, 320), Extent(220, 22), TextureColor::Green2, _("Play Replay"), NormalFont); + addTextButton(4, DrawPoint(115, 320), Extent(220, 22), TextureColor::Green2, _("Play Replay"), NormalFont); - AddTextButton(8, DrawPoint(115, 390), Extent(220, 22), TextureColor::Red1, _("Back"), NormalFont); + addTextButton(8, DrawPoint(115, 390), Extent(220, 22), TextureColor::Red1, _("Back"), NormalFont); - AddImage(11, DrawPoint(20, 20), LOADER.getImageN("logo", 0)); + addImage(11, DrawPoint(20, 20), LOADER.getImageN("logo", 0)); } void dskSinglePlayer::msgButtonClick(const unsigned ctrl_id) @@ -88,22 +88,22 @@ void dskSinglePlayer::msgButtonClick(const unsigned ctrl_id) WINDOWMANAGER.Switch(std::make_unique(csi)); - if(GAMECLIENT.HostGame(csi, {mostRecentFilepath, MapType::Savegame})) - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(csi.type, nullptr)); + if(GAMECLIENT.hostGame(csi, {mostRecentFilepath, MapType::Savegame})) + WINDOWMANAGER.showAfterSwitch(std::make_unique(csi.type, nullptr)); else { - WINDOWMANAGER.Show(std::make_unique(_("Error"), + WINDOWMANAGER.show(std::make_unique(_("Error"), _("The specified file couldn't be loaded!"), nullptr, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); } } else - WINDOWMANAGER.Show(std::make_unique(_("Error"), _("The specified file couldn't be loaded!"), + WINDOWMANAGER.show(std::make_unique(_("Error"), _("The specified file couldn't be loaded!"), nullptr, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); } break; case 4: // "Replay abspielen" { - WINDOWMANAGER.ToggleWindow(std::make_unique()); + WINDOWMANAGER.toggleWindow(std::make_unique()); } break; case 5: // "Kampagne" @@ -113,12 +113,12 @@ void dskSinglePlayer::msgButtonClick(const unsigned ctrl_id) break; case 6: // "Freies Spiel" { - PrepareSinglePlayerServer(); + prepareSinglePlayerServer(); } break; case 7: // "Spiel laden" { - PrepareLoadGame(); + prepareLoadGame(); } break; case 8: // "Zurück" @@ -129,15 +129,15 @@ void dskSinglePlayer::msgButtonClick(const unsigned ctrl_id) } } -void dskSinglePlayer::PrepareSinglePlayerServer() +void dskSinglePlayer::prepareSinglePlayerServer() { WINDOWMANAGER.Switch(std::make_unique(createLocalGameInfo(_("Unlimited Play")))); } -void dskSinglePlayer::PrepareLoadGame() +void dskSinglePlayer::prepareLoadGame() { CreateServerInfo csi = createLocalGameInfo(_("Unlimited Play")); WINDOWMANAGER.Switch(std::make_unique(csi)); - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(csi)); + WINDOWMANAGER.showAfterSwitch(std::make_unique(csi)); } diff --git a/libs/s25main/desktops/dskSinglePlayer.h b/libs/s25main/desktops/dskSinglePlayer.h index 775aaf36ce..2668c8299a 100644 --- a/libs/s25main/desktops/dskSinglePlayer.h +++ b/libs/s25main/desktops/dskSinglePlayer.h @@ -14,6 +14,6 @@ class dskSinglePlayer : public dskMenuBase private: void msgButtonClick(unsigned ctrl_id) override; - void PrepareSinglePlayerServer(); - void PrepareLoadGame(); + void prepareSinglePlayerServer(); + void prepareLoadGame(); }; diff --git a/libs/s25main/desktops/dskSplash.cpp b/libs/s25main/desktops/dskSplash.cpp index e1622d44c6..9cd6837a47 100644 --- a/libs/s25main/desktops/dskSplash.cpp +++ b/libs/s25main/desktops/dskSplash.cpp @@ -39,18 +39,18 @@ void dskSplash::setActive(bool activate) { Desktop::setActive(activate); if(activate && !getCtrl(0)) - AddTimer(0, 1ms); + addTimer(0, 1ms); } void dskSplash::msgTimer(const unsigned ctrl_id) { - getCtrl(ctrl_id)->Stop(); + getCtrl(ctrl_id)->stop(); if(ctrl_id == 0) - AddTimer(1, 1ms); + addTimer(1, 1ms); else if(ctrl_id == 1 && !isLoaded && !isLoading) { isLoading = true; - LoadFiles(); + loadFiles(); } else if(isLoaded) WINDOWMANAGER.Switch(std::make_unique()); } @@ -63,18 +63,18 @@ bool dskSplash::msgLeftDown(const MouseCoords& /*mc*/) return true; } -void dskSplash::LoadFiles() +void dskSplash::loadFiles() { ApplicationLoader loader(RTTRCONFIG, LOADER, LOG, SETTINGS.sound.playlist); if(loader.load()) { isLoaded = true; - AddTimer(2, 5s); + addTimer(2, 5s); setFpsDisplay(true); if(loader.getPlaylist()) MUSICPLAYER.setPlaylist(std::move(*loader.getPlaylist())); if(SETTINGS.sound.musicEnabled) - MUSICPLAYER.Play(); + MUSICPLAYER.play(); } else { @@ -84,7 +84,7 @@ void dskSplash::LoadFiles() % RTTRCONFIG.ExpandPath("").string(); s25util::error(fmt.str()); - VIDEODRIVER.ShowErrorMessage(_("Missing game files"), fmt.str()); + VIDEODRIVER.showErrorMessage(_("Missing game files"), fmt.str()); GLOBALVARS.notdone = false; } diff --git a/libs/s25main/desktops/dskSplash.h b/libs/s25main/desktops/dskSplash.h index 8624ec8d04..320ab1b737 100644 --- a/libs/s25main/desktops/dskSplash.h +++ b/libs/s25main/desktops/dskSplash.h @@ -20,7 +20,7 @@ class dskSplash : public Desktop private: void msgTimer(unsigned ctrl_id) override; bool msgLeftDown(const MouseCoords& mc) override; - void LoadFiles(); + void loadFiles(); std::unique_ptr splashImg; bool isLoading, isLoaded; diff --git a/libs/s25main/desktops/dskTest.cpp b/libs/s25main/desktops/dskTest.cpp index 018fff8df5..c1dcaf50ce 100644 --- a/libs/s25main/desktops/dskTest.cpp +++ b/libs/s25main/desktops/dskTest.cpp @@ -42,7 +42,7 @@ enum dskTest::dskTest() : curBGIdx(LOAD_SCREENS.size()) { - AddText(ID_txtTitle, DrawPoint(300, 20), _("Internal test screen for developers"), COLOR_ORANGE, FontStyle::CENTER, + addText(ID_txtTitle, DrawPoint(300, 20), _("Internal test screen for developers"), COLOR_ORANGE, FontStyle::CENTER, LargeFont); std::array textures = { {TextureColor::Green1, TextureColor::Green2, TextureColor::Red1, TextureColor::Grey}}; @@ -51,18 +51,18 @@ dskTest::dskTest() : curBGIdx(LOAD_SCREENS.size()) unsigned curId = ID_grpBtStart; for(unsigned i = 0; i < textures.size(); i++) { - AddText(curId, DrawPoint(10, yPos + 3), labels.at(i), COLOR_YELLOW, FontStyle::LEFT, NormalFont); + addText(curId, DrawPoint(10, yPos + 3), labels.at(i), COLOR_YELLOW, FontStyle::LEFT, NormalFont); ctrlButton* bt; - bt = AddTextButton(curId + 1, DrawPoint(120, yPos), Extent(95, 22), textures[i], "Nothing", NormalFont); + bt = addTextButton(curId + 1, DrawPoint(120, yPos), Extent(95, 22), textures[i], "Nothing", NormalFont); bt->setIlluminated(false); bt->setBorder(false); - bt = AddTextButton(curId + 2, DrawPoint(220, yPos), Extent(95, 22), textures[i], "Illuminated", NormalFont); + bt = addTextButton(curId + 2, DrawPoint(220, yPos), Extent(95, 22), textures[i], "Illuminated", NormalFont); bt->setIlluminated(true); bt->setBorder(false); - bt = AddTextButton(curId + 3, DrawPoint(320, yPos), Extent(95, 22), textures[i], "Border", NormalFont); + bt = addTextButton(curId + 3, DrawPoint(320, yPos), Extent(95, 22), textures[i], "Border", NormalFont); bt->setIlluminated(false); bt->setBorder(true); - bt = AddTextButton(curId + 4, DrawPoint(420, yPos), Extent(95, 22), textures[i], "Both", NormalFont); + bt = addTextButton(curId + 4, DrawPoint(420, yPos), Extent(95, 22), textures[i], "Both", NormalFont); bt->setIlluminated(true); bt->setBorder(true); curId += 5; @@ -71,38 +71,38 @@ dskTest::dskTest() : curBGIdx(LOAD_SCREENS.size()) RTTR_Assert(curId == ID_grpBtEnd); DrawPoint btPos(10, yPos); - ctrlButton* bt = AddTextButton(ID_btAniBg, btPos, Extent(700, 40), TextureColor::Green2, "", NormalFont); + ctrlButton* bt = addTextButton(ID_btAniBg, btPos, Extent(700, 40), TextureColor::Green2, "", NormalFont); bt->setBorder(false); bt->setEnabled(false); - bt = AddTextButton(ID_btAni, btPos + DrawPoint(0, 5), Extent(30, 30), TextureColor::Red1, "", NormalFont); + bt = addTextButton(ID_btAni, btPos + DrawPoint(0, 5), Extent(30, 30), TextureColor::Red1, "", NormalFont); bt->setBorder(false); bt->setEnabled(false); bt->setIlluminated(true); btPos.y += 45; - AddEdit(ID_edtTest, btPos, Extent(150, 22), TextureColor::Green2, NormalFont, 0, false, false, true); + addEdit(ID_edtTest, btPos, Extent(150, 22), TextureColor::Green2, NormalFont, 0, false, false, true); btPos.x += 170; - ctrlComboBox* cb = AddComboBox(ID_cbTxtSize, btPos, Extent(100, 22), TextureColor::Green2, NormalFont, 100); - cb->AddItem("Small Font"); - cb->AddItem("Medium Font"); - cb->AddItem("Large Font"); + ctrlComboBox* cb = addComboBox(ID_cbTxtSize, btPos, Extent(100, 22), TextureColor::Green2, NormalFont, 100); + cb->addItem("Small Font"); + cb->addItem("Medium Font"); + cb->addItem("Large Font"); cb->setSelection(0); btPos.x += 110; btPos.y += 11; - AddText(ID_txtTest, btPos, "Enter something", COLOR_YELLOW, FontStyle::VCENTER, SmallFont); + addText(ID_txtTest, btPos, "Enter something", COLOR_YELLOW, FontStyle::VCENTER, SmallFont); - AddTextButton(ID_btDisable, DrawPoint(10, 540), Extent(150, 22), TextureColor::Green1, "Enable/Disable buttons", + addTextButton(ID_btDisable, DrawPoint(10, 540), Extent(150, 22), TextureColor::Green1, "Enable/Disable buttons", NormalFont); - AddTextButton(ID_btAnimate, DrawPoint(165, 540), Extent(80, 22), TextureColor::Green1, "Animate", NormalFont); - AddTextButton(ID_btAnimateRepeat, DrawPoint(250, 540), Extent(110, 22), TextureColor::Green1, "Animate-Repeat", + addTextButton(ID_btAnimate, DrawPoint(165, 540), Extent(80, 22), TextureColor::Green1, "Animate", NormalFont); + addTextButton(ID_btAnimateRepeat, DrawPoint(250, 540), Extent(110, 22), TextureColor::Green1, "Animate-Repeat", NormalFont); - AddTextButton(ID_btAnimateOscillate, DrawPoint(365, 540), Extent(110, 22), TextureColor::Green1, + addTextButton(ID_btAnimateOscillate, DrawPoint(365, 540), Extent(110, 22), TextureColor::Green1, "Animate-Oscillate", NormalFont); - AddTextButton(ID_btHideCtrls, DrawPoint(480, 540), Extent(140, 22), TextureColor::Green1, "Hide all elements (H)", + addTextButton(ID_btHideCtrls, DrawPoint(480, 540), Extent(140, 22), TextureColor::Green1, "Hide all elements (H)", NormalFont); - AddTextButton(ID_btTextureTest, DrawPoint(625, 540), Extent(90, 22), TextureColor::Green1, "Texture test", + addTextButton(ID_btTextureTest, DrawPoint(625, 540), Extent(90, 22), TextureColor::Green1, "Texture test", NormalFont); - AddTextButton(ID_btShowBenchmark, DrawPoint(720, 540), Extent(80, 22), TextureColor::Green1, "Benchmark", + addTextButton(ID_btShowBenchmark, DrawPoint(720, 540), Extent(80, 22), TextureColor::Green1, "Benchmark", NormalFont); } @@ -164,7 +164,7 @@ void dskTest::msgButtonClick(const unsigned ctrl_id) getAnimationManager().addAnimation(new BlinkButtonAnim(getCtrl(ctrl_id))); break; } - case ID_btHideCtrls: ToggleCtrlVisibility(); + case ID_btHideCtrls: toggleCtrlVisibility(); } } @@ -182,7 +182,7 @@ bool dskTest::msgRightUp(const MouseCoords& mc) return dskMenuBase::msgRightUp(mc); } -void dskTest::ToggleCtrlVisibility() +void dskTest::toggleCtrlVisibility() { for(int i = ID_txtTitle; i <= ID_btHideCtrls; i++) { @@ -195,7 +195,7 @@ void dskTest::ToggleCtrlVisibility() bool dskTest::msgKeyDown(const KeyEvent& ke) { if(ke.kt == KeyType::Char && ke.c == 'h') - ToggleCtrlVisibility(); + toggleCtrlVisibility(); else if(ke.kt == KeyType::Left) { curBGIdx = (curBGIdx > 0) ? curBGIdx - 1 : LOAD_SCREENS.size() - 1; diff --git a/libs/s25main/desktops/dskTest.h b/libs/s25main/desktops/dskTest.h index 100e61bf60..c773a1a265 100644 --- a/libs/s25main/desktops/dskTest.h +++ b/libs/s25main/desktops/dskTest.h @@ -17,7 +17,7 @@ class dskTest : public dskMenuBase void msgButtonClick(unsigned ctrl_id) override; bool msgRightUp(const MouseCoords& mc) override; - void ToggleCtrlVisibility(); + void toggleCtrlVisibility(); bool msgKeyDown(const KeyEvent& ke) override; diff --git a/libs/s25main/desktops/dskTextureTest.cpp b/libs/s25main/desktops/dskTextureTest.cpp index f9ad6b7840..181bd1a858 100644 --- a/libs/s25main/desktops/dskTextureTest.cpp +++ b/libs/s25main/desktops/dskTextureTest.cpp @@ -29,10 +29,10 @@ enum dskTextureTest::dskTextureTest() { - AddText(ID_txtTitle, DrawPoint(300, 20), "Test screen for textures", COLOR_ORANGE, FontStyle::CENTER, LargeFont); - AddComboBox(ID_cbTexture, DrawPoint(630, 50), Extent(100, 22), TextureColor::Green2, NormalFont, 100); + addText(ID_txtTitle, DrawPoint(300, 20), "Test screen for textures", COLOR_ORANGE, FontStyle::CENTER, LargeFont); + addComboBox(ID_cbTexture, DrawPoint(630, 50), Extent(100, 22), TextureColor::Green2, NormalFont, 100); Load(); - AddTextButton(ID_btBack, DrawPoint(630, 565), Extent(150, 22), TextureColor::Red1, _("Back"), NormalFont); + addTextButton(ID_btBack, DrawPoint(630, 565), Extent(150, 22), TextureColor::Red1, _("Back"), NormalFont); } dskTextureTest::~dskTextureTest() = default; @@ -43,7 +43,7 @@ void dskTextureTest::Load() GameDataLoader gdLoader(newDesc); if(!gdLoader.Load()) { - WINDOWMANAGER.ShowAfterSwitch(std::make_unique(_("Error"), "Failed to load game data!", nullptr, + WINDOWMANAGER.showAfterSwitch(std::make_unique(_("Error"), "Failed to load game data!", nullptr, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); return; } @@ -51,9 +51,9 @@ void dskTextureTest::Load() auto* cb = getCtrl(ID_cbTexture); const unsigned selection = cb->getSelection().value_or(0); - cb->DeleteAllItems(); + cb->deleteAllItems(); for(const auto& t : desc.terrain) - cb->AddItem(t.name); + cb->addItem(t.name); cb->setSelection(selection); msgComboSelectItem(ID_cbTexture, selection); } @@ -67,7 +67,7 @@ void dskTextureTest::msgComboSelectItem(const unsigned ctrl_id, const unsigned s LOADER.Load(RTTRCONFIG.ExpandPath(cur.texturePath)); const auto textureName = ResourceId::make(bfs::path(cur.texturePath)); glArchivItem_Bitmap* texBmp = LOADER.getImageN(textureName, 0); - curTexture = LOADER.ExtractTexture(*texBmp, cur.posInTexture); + curTexture = LOADER.extractTexture(*texBmp, cur.posInTexture); } void dskTextureTest::msgButtonClick(const unsigned /*ctrl_id*/) @@ -83,8 +83,8 @@ void dskTextureTest::msgPaintAfter() dskMenuBase::msgPaintAfter(); if(!curTexture) return; - DrawRectangle(Rect(0, 50, 800, 550), COLOR_BLACK); - VIDEODRIVER.BindTexture(curTexture->getTexture()); + drawRectangle(Rect(0, 50, 800, 550), COLOR_BLACK); + VIDEODRIVER.bindTexture(curTexture->getTexture()); const TerrainDesc& cur = desc.get(curTerrainIdx); Position texOrigin = cur.posInTexture.getOrigin(); PointF texSize(curTexture->getTexSize()); diff --git a/libs/s25main/drivers/AudioDriverWrapper.cpp b/libs/s25main/drivers/AudioDriverWrapper.cpp index 4febcdd708..a874014e02 100644 --- a/libs/s25main/drivers/AudioDriverWrapper.cpp +++ b/libs/s25main/drivers/AudioDriverWrapper.cpp @@ -20,21 +20,21 @@ AudioDriverWrapper::AudioDriverWrapper() : audiodriver_(nullptr, nullptr) {} AudioDriverWrapper::~AudioDriverWrapper() { - UnloadDriver(); + unloadDriver(); } /// Spielt Midi ab -void AudioDriverWrapper::PlayMusic(const SoundHandle& sound, int repeats) +void AudioDriverWrapper::playMusic(const SoundHandle& sound, int repeats) { if(audiodriver_ && sound) - audiodriver_->PlayMusic(sound.getRawHandle(), repeats); + audiodriver_->playMusic(sound.getRawHandle(), repeats); } /// Stoppt die Musik. -void AudioDriverWrapper::StopMusic() +void AudioDriverWrapper::stopMusic() { if(audiodriver_) - audiodriver_->StopMusic(); + audiodriver_->stopMusic(); } /// Wird ein Sound (noch) abgespielt? @@ -47,10 +47,10 @@ bool AudioDriverWrapper::isEffectPlaying(EffectPlayId play_id) } /// Verändert die Lautstärke von einem abgespielten Sound (falls er noch abgespielt wird) -void AudioDriverWrapper::ChangeVolume(EffectPlayId play_id, uint8_t volume) +void AudioDriverWrapper::changeVolume(EffectPlayId play_id, uint8_t volume) { if(audiodriver_) - audiodriver_->ChangeVolume(play_id, volume); + audiodriver_->changeVolume(play_id, volume); } void AudioDriverWrapper::setMasterEffectVolume(uint8_t volume) @@ -73,9 +73,9 @@ std::string AudioDriverWrapper::getName() const bool AudioDriverWrapper::Init() { - if(!audiodriver_ || !audiodriver_->Initialize()) + if(!audiodriver_ || !audiodriver_->initialize()) { - UnloadDriver(); + unloadDriver(); return false; } @@ -84,13 +84,13 @@ bool AudioDriverWrapper::Init() } /// Lädt den Treiber -bool AudioDriverWrapper::LoadDriver(std::unique_ptr audioDriver) +bool AudioDriverWrapper::loadDriver(std::unique_ptr audioDriver) { audiodriver_ = Handle(audioDriver.release(), [](driver::IAudioDriver* p) { delete p; }); return Init(); } -bool AudioDriverWrapper::LoadDriver(std::string& preference) +bool AudioDriverWrapper::loadDriver(std::string& preference) { RTTR_Assert(!audiodriver_); // DLL laden @@ -106,10 +106,10 @@ bool AudioDriverWrapper::LoadDriver(std::string& preference) return Init(); } -void AudioDriverWrapper::UnloadDriver() +void AudioDriverWrapper::unloadDriver() { audiodriver_.reset(); - driver_wrapper.Unload(); + driver_wrapper.unload(); } /** @@ -117,15 +117,15 @@ void AudioDriverWrapper::UnloadDriver() * * @return Sounddeskriptor bei Erfolg, @p nullptr bei Fehler */ -SoundHandle AudioDriverWrapper::LoadMusic(const std::string& filepath) +SoundHandle AudioDriverWrapper::loadMusic(const std::string& filepath) { if(!audiodriver_) return SoundHandle(); - return createSoundHandle(audiodriver_->LoadMusic(filepath)); + return createSoundHandle(audiodriver_->loadMusic(filepath)); } -SoundHandle AudioDriverWrapper::LoadMusic(const libsiedler2::ArchivItem_Sound& soundArchiv, +SoundHandle AudioDriverWrapper::loadMusic(const libsiedler2::ArchivItem_Sound& soundArchiv, const std::string& extension) { if(!audiodriver_) @@ -133,18 +133,18 @@ SoundHandle AudioDriverWrapper::LoadMusic(const libsiedler2::ArchivItem_Sound& s ovectorstream tmp; if(soundArchiv.write(tmp) != 0) return SoundHandle(); - return createSoundHandle(audiodriver_->LoadMusic(tmp.vector(), extension)); + return createSoundHandle(audiodriver_->loadMusic(tmp.vector(), extension)); } -SoundHandle AudioDriverWrapper::LoadEffect(const std::string& filepath) +SoundHandle AudioDriverWrapper::loadEffect(const std::string& filepath) { if(!audiodriver_) return SoundHandle(); - return createSoundHandle(audiodriver_->LoadEffect(filepath)); + return createSoundHandle(audiodriver_->loadEffect(filepath)); } -SoundHandle AudioDriverWrapper::LoadEffect(const libsiedler2::ArchivItem_Sound& soundArchiv, +SoundHandle AudioDriverWrapper::loadEffect(const libsiedler2::ArchivItem_Sound& soundArchiv, const std::string& extension) { if(!audiodriver_) @@ -152,28 +152,28 @@ SoundHandle AudioDriverWrapper::LoadEffect(const libsiedler2::ArchivItem_Sound& ovectorstream tmp; if(soundArchiv.write(tmp) != 0) return SoundHandle(); - return createSoundHandle(audiodriver_->LoadEffect(tmp.vector(), extension)); + return createSoundHandle(audiodriver_->loadEffect(tmp.vector(), extension)); } -EffectPlayId AudioDriverWrapper::PlayEffect(const SoundHandle& sound, uint8_t volume, const bool loop) +EffectPlayId AudioDriverWrapper::playEffect(const SoundHandle& sound, uint8_t volume, const bool loop) { if(!audiodriver_ || !sound) return EffectPlayId::Invalid; - return audiodriver_->PlayEffect(sound.getRawHandle(), volume, loop); + return audiodriver_->playEffect(sound.getRawHandle(), volume, loop); } -void AudioDriverWrapper::StopEffect(EffectPlayId& playId) +void AudioDriverWrapper::stopEffect(EffectPlayId& playId) { if(audiodriver_) - audiodriver_->StopEffect(playId); + audiodriver_->stopEffect(playId); playId = EffectPlayId::Invalid; } void AudioDriverWrapper::msgMusicFinished() { // MusicManager Bescheid sagen - MUSICPLAYER.MusicFinished(); + MUSICPLAYER.musicFinished(); } /// Wraps the raw handle inside an RAII wrapper diff --git a/libs/s25main/drivers/AudioDriverWrapper.h b/libs/s25main/drivers/AudioDriverWrapper.h index 8490edb20e..f8e2142054 100644 --- a/libs/s25main/drivers/AudioDriverWrapper.h +++ b/libs/s25main/drivers/AudioDriverWrapper.h @@ -34,33 +34,33 @@ class AudioDriverWrapper : ~AudioDriverWrapper(); /// Loads the driver - bool LoadDriver(std::unique_ptr audioDriver); - bool LoadDriver(std::string& preference); + bool loadDriver(std::unique_ptr audioDriver); + bool loadDriver(std::string& preference); /// Unloads the driver resetting all open handles - void UnloadDriver(); + void unloadDriver(); /// Lädt einen Sound. - SoundHandle LoadEffect(const std::string& filepath); - SoundHandle LoadEffect(const libsiedler2::ArchivItem_Sound& soundArchiv, const std::string& extension); - SoundHandle LoadMusic(const std::string& filepath); - SoundHandle LoadMusic(const libsiedler2::ArchivItem_Sound& soundArchiv, const std::string& extension); + SoundHandle loadEffect(const std::string& filepath); + SoundHandle loadEffect(const libsiedler2::ArchivItem_Sound& soundArchiv, const std::string& extension); + SoundHandle loadMusic(const std::string& filepath); + SoundHandle loadMusic(const libsiedler2::ArchivItem_Sound& soundArchiv, const std::string& extension); /// Spielt einen Sound - EffectPlayId PlayEffect(const SoundHandle& sound, uint8_t volume, bool loop); + EffectPlayId playEffect(const SoundHandle& sound, uint8_t volume, bool loop); /// Stops a sound and resets the id to "Invalid" - void StopEffect(EffectPlayId& playId); + void stopEffect(EffectPlayId& playId); /// Spielt Midi ab - void PlayMusic(const SoundHandle& sound, int repeats); + void playMusic(const SoundHandle& sound, int repeats); /// Stoppt die Musik. - void StopMusic(); + void stopMusic(); /// Wird ein Sound (noch) abgespielt? bool isEffectPlaying(EffectPlayId play_id); /// Verändert die Lautstärke von einem abgespielten Sound (falls er noch abgespielt wird) - void ChangeVolume(EffectPlayId play_id, uint8_t volume); + void changeVolume(EffectPlayId play_id, uint8_t volume); void setMasterEffectVolume(uint8_t volume); void setMusicVolume(uint8_t volume); diff --git a/libs/s25main/drivers/DriverWrapper.cpp b/libs/s25main/drivers/DriverWrapper.cpp index e71ff35d11..4c3edc62be 100644 --- a/libs/s25main/drivers/DriverWrapper.cpp +++ b/libs/s25main/drivers/DriverWrapper.cpp @@ -35,7 +35,7 @@ namespace drivers { DriverWrapper::DriverWrapper() = default; DriverWrapper::~DriverWrapper() = default; -void DriverWrapper::Unload() +void DriverWrapper::unload() { dll.unload(); } @@ -43,10 +43,10 @@ void DriverWrapper::Unload() bool DriverWrapper::Load(const DriverType dt, std::string& preference) { // ggf. aufräumen vorher - Unload(); + unload(); /// Verfügbare Treiber auflisten - std::vector drivers = LoadDriverList(dt); + std::vector drivers = loadDriverList(dt); LOG.write("%u %s drivers found!\n") % drivers.size() % getName(dt); @@ -84,7 +84,7 @@ bool DriverWrapper::isLoaded() const return dll.is_loaded(); } -bool DriverWrapper::CheckLibrary(const bfs::path& path, DriverType dt, std::string& nameOrError) +bool DriverWrapper::checkLibrary(const bfs::path& path, DriverType dt, std::string& nameOrError) { auto dll = tryLoadLibrary(path); @@ -128,7 +128,7 @@ bool DriverWrapper::CheckLibrary(const bfs::path& path, DriverType dt, std::stri return true; } -std::vector DriverWrapper::LoadDriverList(const DriverType dt) +std::vector DriverWrapper::loadDriverList(const DriverType dt) { std::vector driver_list; @@ -165,7 +165,7 @@ std::vector DriverWrapper::LoadDriverList(const Drive continue; #endif std::string nameOrError; - if(!CheckLibrary(path, dt, nameOrError)) + if(!checkLibrary(path, dt, nameOrError)) LOG.write(_("Skipping %s: %s\n")) % path % nameOrError; else driver_list.push_back(DriverItem(path, nameOrError)); diff --git a/libs/s25main/drivers/DriverWrapper.h b/libs/s25main/drivers/DriverWrapper.h index 62d9496724..ee90d28200 100644 --- a/libs/s25main/drivers/DriverWrapper.h +++ b/libs/s25main/drivers/DriverWrapper.h @@ -41,7 +41,7 @@ class DriverWrapper /// Läd einen Treiber in die Treiber DLL, versucht, "preference" zu nehmen bool Load(DriverType dt, std::string& preference); /// Gibt eine Treiber-Handle wieder frei - void Unload(); + void unload(); bool isLoaded() const; template T* getFunction(const std::string& name) @@ -50,11 +50,11 @@ class DriverWrapper } /// Läd eine Liste von verfügbaren Treibern - static std::vector LoadDriverList(DriverType dt); + static std::vector loadDriverList(DriverType dt); private: boost::dll::shared_library dll; /// Checks if the library is valid. Puts either the name or the error message into nameOrError - static bool CheckLibrary(const bfs::path& path, DriverType dt, std::string& nameOrError); + static bool checkLibrary(const bfs::path& path, DriverType dt, std::string& nameOrError); }; } // namespace drivers diff --git a/libs/s25main/drivers/VideoDriverWrapper.cpp b/libs/s25main/drivers/VideoDriverWrapper.cpp index 3e26bb090d..f2d77380f7 100644 --- a/libs/s25main/drivers/VideoDriverWrapper.cpp +++ b/libs/s25main/drivers/VideoDriverWrapper.cpp @@ -36,15 +36,15 @@ VideoDriverWrapper::VideoDriverWrapper() VideoDriverWrapper::~VideoDriverWrapper() { - CleanUp(); - UnloadDriver(); + cleanUp(); + unloadDriver(); } -bool VideoDriverWrapper::Initialize() +bool VideoDriverWrapper::initialize() { - if(!videodriver || !videodriver->Initialize()) + if(!videodriver || !videodriver->initialize()) { - UnloadDriver(); + unloadDriver(); return false; } @@ -56,16 +56,16 @@ bool VideoDriverWrapper::Initialize() return true; } -bool VideoDriverWrapper::LoadDriver(IVideoDriver* existingDriver) +bool VideoDriverWrapper::loadDriver(IVideoDriver* existingDriver) { - UnloadDriver(); + unloadDriver(); videodriver = Handle(existingDriver, [](IVideoDriver* p) { delete p; }); - return Initialize(); + return initialize(); } -bool VideoDriverWrapper::LoadDriver(std::string& preference) +bool VideoDriverWrapper::loadDriver(std::string& preference) { - UnloadDriver(); + unloadDriver(); // DLL laden if(!driver_wrapper.Load(drivers::DriverType::Video, preference)) return false; @@ -75,17 +75,17 @@ bool VideoDriverWrapper::LoadDriver(std::string& preference) RTTR_Assert(createVideoInstance && freeVideoInstance); videodriver = Handle(createVideoInstance(&WINDOWMANAGER), freeVideoInstance); - return Initialize(); + return initialize(); } -void VideoDriverWrapper::UnloadDriver() +void VideoDriverWrapper::unloadDriver() { videodriver.reset(); - driver_wrapper.Unload(); + driver_wrapper.unload(); renderer_.reset(); } -bool VideoDriverWrapper::CreateScreen(const VideoMode size, const DisplayMode displayMode) +bool VideoDriverWrapper::createScreen(const VideoMode size, const DisplayMode displayMode) { if(!videodriver) { @@ -93,7 +93,7 @@ bool VideoDriverWrapper::CreateScreen(const VideoMode size, const DisplayMode di return false; } - if(!videodriver->CreateScreen(rttr::version::getTitle(), size, displayMode)) + if(!videodriver->createScreen(rttr::version::getTitle(), size, displayMode)) { s25util::fatal_error("Could not create window!"); return false; @@ -101,16 +101,16 @@ bool VideoDriverWrapper::CreateScreen(const VideoMode size, const DisplayMode di // DriverWrapper Initialisieren // Extensions laden - if(!LoadAllExtensions()) + if(!loadAllExtensions()) { s25util::fatal_error("Failed to initialize the OpenGL context!"); return false; } - RenewViewport(); + renewViewport(); // Buffer swappen um den leeren Buffer darzustellen - SwapBuffers(); + swapBuffers(); // WindowManager informieren WINDOWMANAGER.msgScreenResize(getRenderSize()); @@ -118,7 +118,7 @@ bool VideoDriverWrapper::CreateScreen(const VideoMode size, const DisplayMode di return true; } -bool VideoDriverWrapper::ResizeScreen(const VideoMode size, const DisplayMode displayMode) +bool VideoDriverWrapper::resizeScreen(const VideoMode size, const DisplayMode displayMode) { if(!videodriver) { @@ -126,7 +126,7 @@ bool VideoDriverWrapper::ResizeScreen(const VideoMode size, const DisplayMode di return false; } - const bool result = videodriver->ResizeScreen(size, displayMode); + const bool result = videodriver->resizeScreen(size, displayMode); #ifdef _WIN32 if(videodriver->getDisplayMode() != DisplayMode::Fullscreen) { @@ -138,11 +138,11 @@ bool VideoDriverWrapper::ResizeScreen(const VideoMode size, const DisplayMode di ShowWindow((HWND)getMapPointer(), SW_RESTORE); } #endif - WINDOWMANAGER.WindowResized(); + WINDOWMANAGER.windowResized(); return result; } -bool VideoDriverWrapper::DestroyScreen() +bool VideoDriverWrapper::destroyScreen() { if(!videodriver) { @@ -152,19 +152,19 @@ bool VideoDriverWrapper::DestroyScreen() LOG.write("Clearing textures: "); unsigned ladezeit = getTickCount(); - CleanUp(); + cleanUp(); LOG.write("Finished in %dms\n") % (getTickCount() - ladezeit); // Videotreiber zurücksetzen - videodriver->DestroyScreen(); + videodriver->destroyScreen(); return true; } -void VideoDriverWrapper::ShowErrorMessage(const std::string& title, const std::string& message) +void VideoDriverWrapper::showErrorMessage(const std::string& title, const std::string& message) { if(videodriver) - videodriver->ShowErrorMessage(title, message); + videodriver->showErrorMessage(title, message); } void VideoDriverWrapper::setTargetFramerate(int target) @@ -179,7 +179,7 @@ unsigned VideoDriverWrapper::getFPS() const return frameCtr_->getFrameRate(); } -void VideoDriverWrapper::CleanUp() +void VideoDriverWrapper::cleanUp() { if(!texture_list.empty()) { @@ -188,7 +188,7 @@ void VideoDriverWrapper::CleanUp() } } -unsigned VideoDriverWrapper::GenerateTexture() +unsigned VideoDriverWrapper::generateTexture() { GLuint newTexture = 0; glGenTextures(1, &newTexture); @@ -202,7 +202,7 @@ unsigned VideoDriverWrapper::GenerateTexture() return newTexture; } -void VideoDriverWrapper::BindTexture(unsigned t) +void VideoDriverWrapper::bindTexture(unsigned t) { if(t != texture_current) { @@ -211,7 +211,7 @@ void VideoDriverWrapper::BindTexture(unsigned t) } } -void VideoDriverWrapper::DeleteTexture(unsigned t) +void VideoDriverWrapper::deleteTexture(unsigned t) { if(!t) return; @@ -232,7 +232,7 @@ KeyEvent VideoDriverWrapper::getModKeyState() const return KeyEvent(); } -void VideoDriverWrapper::SwapBuffers() +void VideoDriverWrapper::swapBuffers() { if(!videodriver) { @@ -240,18 +240,18 @@ void VideoDriverWrapper::SwapBuffers() return; } frameLimiter_->sleepTillNextFrame(FrameCounter::clock::now()); - videodriver->SwapBuffers(); + videodriver->swapBuffers(); FrameCounter::clock::time_point now = FrameCounter::clock::now(); frameLimiter_->update(now); frameCtr_->update(now); } -void VideoDriverWrapper::ClearScreen() +void VideoDriverWrapper::clearScreen() { glClear(GL_COLOR_BUFFER_BIT); } -bool VideoDriverWrapper::Run() +bool VideoDriverWrapper::run() { if(!videodriver) { @@ -259,7 +259,7 @@ bool VideoDriverWrapper::Run() return false; } - return videodriver->MessageLoop(); + return videodriver->messageLoop(); } Extent VideoDriverWrapper::calcPreferredTextureSize(const Extent& minSize) const @@ -274,7 +274,7 @@ bool VideoDriverWrapper::setHwVSync(bool enabled) return wglSwapIntervalEXT(enabled ? 1 : 0) != 0; } -void VideoDriverWrapper::RenewViewport() +void VideoDriverWrapper::renewViewport() { if(!videodriver->isOpenGL() || !renderer_) return; @@ -328,10 +328,10 @@ void VideoDriverWrapper::RenewViewport() glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - ClearScreen(); + clearScreen(); } -bool VideoDriverWrapper::LoadAllExtensions() +bool VideoDriverWrapper::loadAllExtensions() { if(videodriver->isOpenGL()) renderer_ = std::make_unique(); @@ -392,7 +392,7 @@ void* VideoDriverWrapper::loadExtension(const std::string& extension) Position VideoDriverWrapper::getMousePos() const { if(!videodriver) - return Position::Invalid(); + return Position::invalid(); return videodriver->getMousePos(); } @@ -428,12 +428,12 @@ void VideoDriverWrapper::setMousePos(const Position& newPos) videodriver->setMousePos(newPos); } -std::set VideoDriverWrapper::ListVideoModes() const +std::set VideoDriverWrapper::listVideoModes() const { if(!videodriver) return {}; - const auto videoModes = videodriver->ListVideoModes(); + const auto videoModes = videodriver->listVideoModes(); std::set result; // Keep only modes larger than the minimum std::copy_if(videoModes.begin(), videoModes.end(), std::inserter(result, result.end()), @@ -457,7 +457,7 @@ std::set VideoDriverWrapper::getDefaultWindowSizes() const VideoMode(1920, 1080) }; // clang-format on - std::set windowSizes = ListVideoModes(); + std::set windowSizes = listVideoModes(); windowSizes.insert(defaultWindowSizes.begin(), defaultWindowSizes.end()); return windowSizes; } diff --git a/libs/s25main/drivers/VideoDriverWrapper.h b/libs/s25main/drivers/VideoDriverWrapper.h index f3222501f7..9c2512fe2a 100644 --- a/libs/s25main/drivers/VideoDriverWrapper.h +++ b/libs/s25main/drivers/VideoDriverWrapper.h @@ -33,37 +33,37 @@ class VideoDriverWrapper : public Singleton ListVideoModes() const; + std::set listVideoModes() const; std::set getDefaultWindowSizes() const; bool hasVSync() const; @@ -97,9 +97,9 @@ class VideoDriverWrapper : public Singleton; diff --git a/libs/s25main/factories/AIFactory.cpp b/libs/s25main/factories/AIFactory.cpp index 3e43654fc7..db893ecef6 100644 --- a/libs/s25main/factories/AIFactory.cpp +++ b/libs/s25main/factories/AIFactory.cpp @@ -7,7 +7,7 @@ #include "ai/aijh/AIPlayerJH.h" #include "gameTypes/AIInfo.h" -std::unique_ptr AIFactory::Create(const AI::Info& aiInfo, unsigned playerId, const GameWorldBase& world) +std::unique_ptr AIFactory::create(const AI::Info& aiInfo, unsigned playerId, const GameWorldBase& world) { switch(aiInfo.type) { diff --git a/libs/s25main/factories/AIFactory.h b/libs/s25main/factories/AIFactory.h index ff1b7c71fb..473a01d27f 100644 --- a/libs/s25main/factories/AIFactory.h +++ b/libs/s25main/factories/AIFactory.h @@ -17,5 +17,5 @@ class AIFactory public: AIFactory() = delete; - static std::unique_ptr Create(const AI::Info& aiInfo, unsigned playerId, const GameWorldBase& world); + static std::unique_ptr create(const AI::Info& aiInfo, unsigned playerId, const GameWorldBase& world); }; diff --git a/libs/s25main/factories/BuildingFactory.cpp b/libs/s25main/factories/BuildingFactory.cpp index e9365e56bc..1f596108be 100644 --- a/libs/s25main/factories/BuildingFactory.cpp +++ b/libs/s25main/factories/BuildingFactory.cpp @@ -13,7 +13,7 @@ #include "buildings/nobUsual.h" #include "world/GameWorldBase.h" -noBuilding* BuildingFactory::CreateBuilding(GameWorldBase& world, const BuildingType type, const MapPoint pt, +noBuilding* BuildingFactory::createBuilding(GameWorldBase& world, const BuildingType type, const MapPoint pt, const unsigned char player, const Nation nation) { noBuilding* bld; @@ -32,7 +32,7 @@ noBuilding* BuildingFactory::CreateBuilding(GameWorldBase& world, const Building } world.setNO(pt, bld); // Don't do this in ctor as building might not be fully initialized yet - world.getPlayer(player).AddBuilding(bld, type); + world.getPlayer(player).addBuilding(bld, type); return bld; } diff --git a/libs/s25main/factories/BuildingFactory.h b/libs/s25main/factories/BuildingFactory.h index ad97916ec8..e44de60cba 100644 --- a/libs/s25main/factories/BuildingFactory.h +++ b/libs/s25main/factories/BuildingFactory.h @@ -20,6 +20,6 @@ class BuildingFactory public: BuildingFactory() = delete; - static noBuilding* CreateBuilding(GameWorldBase& world, BuildingType type, MapPoint pt, unsigned char player, + static noBuilding* createBuilding(GameWorldBase& world, BuildingType type, MapPoint pt, unsigned char player, Nation nation); }; diff --git a/libs/s25main/factories/GameCommandFactory.cpp b/libs/s25main/factories/GameCommandFactory.cpp index c49979f5a3..8b0c8d04bb 100644 --- a/libs/s25main/factories/GameCommandFactory.cpp +++ b/libs/s25main/factories/GameCommandFactory.cpp @@ -8,173 +8,173 @@ bool GameCommandFactory::SetFlag(const MapPoint pt) { - return AddGC(new gc::SetFlag(pt)); + return addGC(new gc::SetFlag(pt)); } bool GameCommandFactory::DestroyFlag(const MapPoint pt) { - return AddGC(new gc::DestroyFlag(pt)); + return addGC(new gc::DestroyFlag(pt)); } bool GameCommandFactory::BuildRoad(const MapPoint pt, bool boat_road, const std::vector& route) { - return AddGC(new gc::BuildRoad(pt, boat_road, route)); + return addGC(new gc::BuildRoad(pt, boat_road, route)); } bool GameCommandFactory::DestroyRoad(const MapPoint pt, Direction start_dir) { - return AddGC(new gc::DestroyRoad(pt, start_dir)); + return addGC(new gc::DestroyRoad(pt, start_dir)); } bool GameCommandFactory::UpgradeRoad(const MapPoint pt, Direction start_dir) { - return AddGC(new gc::UpgradeRoad(pt, start_dir)); + return addGC(new gc::UpgradeRoad(pt, start_dir)); } bool GameCommandFactory::ChangeDistribution(const Distributions& data) { - return AddGC(new gc::ChangeDistribution(data)); + return addGC(new gc::ChangeDistribution(data)); } bool GameCommandFactory::ChangeBuildOrder(bool useCustomBuildOrder, const BuildOrders& data) { - return AddGC(new gc::ChangeBuildOrder(useCustomBuildOrder, data)); + return addGC(new gc::ChangeBuildOrder(useCustomBuildOrder, data)); } bool GameCommandFactory::SetBuildingSite(const MapPoint pt, BuildingType bt) { - return AddGC(new gc::SetBuildingSite(pt, bt)); + return addGC(new gc::SetBuildingSite(pt, bt)); } bool GameCommandFactory::DestroyBuilding(const MapPoint pt) { - return AddGC(new gc::DestroyBuilding(pt)); + return addGC(new gc::DestroyBuilding(pt)); } bool GameCommandFactory::SetTroopLimit(const MapPoint pt, unsigned char rank, unsigned limit) { - return AddGC(new gc::SetTroopLimit(pt, rank, limit)); + return addGC(new gc::SetTroopLimit(pt, rank, limit)); } bool GameCommandFactory::ChangeTransport(const TransportOrders& data) { - return AddGC(new gc::ChangeTransport(data)); + return addGC(new gc::ChangeTransport(data)); } bool GameCommandFactory::ChangeMilitary(const MilitarySettings& data) { - return AddGC(new gc::ChangeMilitary(data)); + return addGC(new gc::ChangeMilitary(data)); } bool GameCommandFactory::ChangeTools(const ToolSettings& data, const int8_t* order_delta) { - return AddGC(new gc::ChangeTools(data, order_delta)); + return addGC(new gc::ChangeTools(data, order_delta)); } bool GameCommandFactory::CallSpecialist(const MapPoint pt, Job job) { RTTR_Assert(job == Job::Geologist || job == Job::Scout); - return AddGC(new gc::CallSpecialist(pt, job)); + return addGC(new gc::CallSpecialist(pt, job)); } bool GameCommandFactory::Attack(const MapPoint pt, unsigned soldiers_count, bool strong_soldiers) { - return AddGC(new gc::Attack(pt, soldiers_count, strong_soldiers)); + return addGC(new gc::Attack(pt, soldiers_count, strong_soldiers)); } bool GameCommandFactory::SeaAttack(const MapPoint pt, unsigned soldiers_count, bool strong_soldiers) { - return AddGC(new gc::SeaAttack(pt, soldiers_count, strong_soldiers)); + return addGC(new gc::SeaAttack(pt, soldiers_count, strong_soldiers)); } bool GameCommandFactory::SetCoinsAllowed(const MapPoint pt, bool enabled) { - return AddGC(new gc::SetCoinsAllowed(pt, enabled)); + return addGC(new gc::SetCoinsAllowed(pt, enabled)); } bool GameCommandFactory::SetArmorAllowed(const MapPoint pt, bool enabled) { - return AddGC(new gc::SetArmorAllowed(pt, enabled)); + return addGC(new gc::SetArmorAllowed(pt, enabled)); } bool GameCommandFactory::SetProductionEnabled(const MapPoint pt, bool enabled) { - return AddGC(new gc::SetProductionEnabled(pt, enabled)); + return addGC(new gc::SetProductionEnabled(pt, enabled)); } bool GameCommandFactory::NotifyAlliesOfLocation(const MapPoint pt) { - return AddGC(new gc::NotifyAlliesOfLocation(pt)); + return addGC(new gc::NotifyAlliesOfLocation(pt)); } bool GameCommandFactory::SetInventorySetting(const MapPoint pt, const boost_variant2& what, InventorySetting state) { - return AddGC(new gc::SetInventorySetting(pt, what, state)); + return addGC(new gc::SetInventorySetting(pt, what, state)); } bool GameCommandFactory::SetAllInventorySettings(const MapPoint pt, bool isJob, const std::vector& states) { - return AddGC(new gc::SetAllInventorySettings(pt, isJob, states)); + return addGC(new gc::SetAllInventorySettings(pt, isJob, states)); } bool GameCommandFactory::ChangeReserve(const MapPoint pt, unsigned char rank, unsigned count) { - return AddGC(new gc::ChangeReserve(pt, rank, count)); + return addGC(new gc::ChangeReserve(pt, rank, count)); } bool GameCommandFactory::CheatArmageddon() { - return AddGC(new gc::CheatArmageddon()); + return addGC(new gc::CheatArmageddon()); } bool GameCommandFactory::Surrender() { - return AddGC(new gc::Surrender()); + return addGC(new gc::Surrender()); } bool GameCommandFactory::DestroyAll() { - return AddGC(new gc::DestroyAll()); + return addGC(new gc::DestroyAll()); } bool GameCommandFactory::SuggestPact(unsigned char player, PactType pt, unsigned duration) { - return AddGC(new gc::SuggestPact(player, pt, duration)); + return addGC(new gc::SuggestPact(player, pt, duration)); } bool GameCommandFactory::AcceptPact(unsigned id, PactType pt, unsigned char player) { - return AddGC(new gc::AcceptPact(id, pt, player)); + return addGC(new gc::AcceptPact(id, pt, player)); } bool GameCommandFactory::CancelPact(const PactType pt, unsigned char player) { - return AddGC(new gc::CancelPact(pt, player)); + return addGC(new gc::CancelPact(pt, player)); } bool GameCommandFactory::SetShipYardMode(const MapPoint pt, bool buildShips) { - return AddGC(new gc::SetShipYardMode(pt, buildShips)); + return addGC(new gc::SetShipYardMode(pt, buildShips)); } bool GameCommandFactory::SetTempleProductionMode(MapPoint pt, ProductionMode mode) { - return AddGC(new gc::SetTempleProductionMode(pt, mode)); + return addGC(new gc::SetTempleProductionMode(pt, mode)); } bool GameCommandFactory::StartStopExpedition(const MapPoint pt, bool start) { - return AddGC(new gc::StartStopExpedition(pt, start)); + return addGC(new gc::StartStopExpedition(pt, start)); } -bool GameCommandFactory::FoundColony(unsigned shipID) +bool GameCommandFactory::foundColony(unsigned shipID) { - return AddGC(new gc::ExpeditionCommand(gc::ExpeditionCommand::Action::FoundColony, shipID)); + return addGC(new gc::ExpeditionCommand(gc::ExpeditionCommand::Action::FoundColony, shipID)); } -bool GameCommandFactory::TravelToNextSpot(ShipDirection direction, unsigned shipID) +bool GameCommandFactory::travelToNextSpot(ShipDirection direction, unsigned shipID) { gc::ExpeditionCommand::Action action; switch(direction) @@ -186,20 +186,20 @@ bool GameCommandFactory::TravelToNextSpot(ShipDirection direction, unsigned ship case ShipDirection::SouthWest: action = gc::ExpeditionCommand::Action::SouthWest; break; case ShipDirection::NorthWest: action = gc::ExpeditionCommand::Action::NorthWest; break; } - return AddGC(new gc::ExpeditionCommand(action, shipID)); + return addGC(new gc::ExpeditionCommand(action, shipID)); } bool GameCommandFactory::CancelExpedition(unsigned shipID) { - return AddGC(new gc::ExpeditionCommand(gc::ExpeditionCommand::Action::CancelExpedition, shipID)); + return addGC(new gc::ExpeditionCommand(gc::ExpeditionCommand::Action::CancelExpedition, shipID)); } bool GameCommandFactory::StartStopExplorationExpedition(const MapPoint pt, bool start) { - return AddGC(new gc::StartStopExplorationExpedition(pt, start)); + return addGC(new gc::StartStopExplorationExpedition(pt, start)); } bool GameCommandFactory::TradeOverLand(const MapPoint pt, const boost_variant2& what, unsigned count) { - return AddGC(new gc::TradeOverLand(pt, what, count)); + return addGC(new gc::TradeOverLand(pt, what, count)); } diff --git a/libs/s25main/factories/GameCommandFactory.h b/libs/s25main/factories/GameCommandFactory.h index 6a3faf3507..63aa2ebb43 100644 --- a/libs/s25main/factories/GameCommandFactory.h +++ b/libs/s25main/factories/GameCommandFactory.h @@ -75,9 +75,9 @@ class GameCommandFactory /// Starts Preparation of an sea expedition in a habor bool StartStopExpedition(MapPoint pt, bool start); /// Lets a ship found a colony - bool FoundColony(unsigned shipID); + bool foundColony(unsigned shipID); /// Lets a ship travel to a new harbor spot in a given direction - bool TravelToNextSpot(ShipDirection direction, unsigned shipID); + bool travelToNextSpot(ShipDirection direction, unsigned shipID); /// Cancels an expedition bool CancelExpedition(unsigned shipID); bool StartStopExplorationExpedition(MapPoint pt, bool start); @@ -86,5 +86,5 @@ class GameCommandFactory protected: virtual ~GameCommandFactory() = default; /// Called for each created GC. Return true iff this is going to be executed - virtual bool AddGC(gc::GameCommandPtr gc) = 0; + virtual bool addGC(gc::GameCommandPtr gc) = 0; }; diff --git a/libs/s25main/factories/JobFactory.cpp b/libs/s25main/factories/JobFactory.cpp index c7dfbdc755..6fcb79ecf1 100644 --- a/libs/s25main/factories/JobFactory.cpp +++ b/libs/s25main/factories/JobFactory.cpp @@ -52,7 +52,7 @@ #include "nodeObjs/noFlag.h" #include -std::unique_ptr JobFactory::CreateJob(const Job job_id, const MapPoint pt, const unsigned char player, +std::unique_ptr JobFactory::createJob(const Job job_id, const MapPoint pt, const unsigned char player, noRoadNode& goal) { if(nobBaseWarehouse::isStorehouseGOT(goal.getGOT())) diff --git a/libs/s25main/factories/JobFactory.h b/libs/s25main/factories/JobFactory.h index cdd2252c4e..4886ad811f 100644 --- a/libs/s25main/factories/JobFactory.h +++ b/libs/s25main/factories/JobFactory.h @@ -18,5 +18,5 @@ class JobFactory JobFactory() = delete; // Erstellt Job anhand der job-id - static std::unique_ptr CreateJob(Job job_id, MapPoint pt, unsigned char player, noRoadNode& goal); + static std::unique_ptr createJob(Job job_id, MapPoint pt, unsigned char player, noRoadNode& goal); }; diff --git a/libs/s25main/figures/noFigure.cpp b/libs/s25main/figures/noFigure.cpp index d0e461a958..e2b402a3c6 100644 --- a/libs/s25main/figures/noFigure.cpp +++ b/libs/s25main/figures/noFigure.cpp @@ -50,7 +50,7 @@ const unsigned short STRANDED_SOLDIER_RETURN_SEARCH_RADIUS_REDUCED = WANDER_RADI noFigure::noFigure(const Job job, const MapPoint pos, const unsigned char player, noRoadNode* const goal) : noMovable(NodalObjectType::Figure, pos), fs(FigureState::GotToGoal), job_(job), player(player), cur_rs(nullptr), rs_pos(0), rs_dir(false), on_ship(false), goal_(goal), waiting_for_free_node(false), wander_way(0), - wander_tryings(0), flagPos_(MapPoint::Invalid()), flag_obj_id(0), burned_wh_id(0xFFFFFFFF), last_id(0xFFFFFFFF), + wander_tryings(0), flagPos_(MapPoint::invalid()), flag_obj_id(0), burned_wh_id(0xFFFFFFFF), last_id(0xFFFFFFFF), hasArmor_(false) { // If the goal is a storehouse we won't work there but go to the new home @@ -61,15 +61,15 @@ noFigure::noFigure(const Job job, const MapPoint pos, const unsigned char player noFigure::noFigure(const Job job, const MapPoint pos, const unsigned char player) : noMovable(NodalObjectType::Figure, pos), fs(FigureState::Job), job_(job), player(player), cur_rs(nullptr), rs_pos(0), rs_dir(false), on_ship(false), goal_(nullptr), waiting_for_free_node(false), wander_way(0), - wander_tryings(0), flagPos_(MapPoint::Invalid()), flag_obj_id(0), burned_wh_id(0xFFFFFFFF), last_id(0xFFFFFFFF), + wander_tryings(0), flagPos_(MapPoint::invalid()), flag_obj_id(0), burned_wh_id(0xFFFFFFFF), last_id(0xFFFFFFFF), hasArmor_(false) {} -void noFigure::Destroy() +void noFigure::destroy() { RTTR_Assert(!goal_); RTTR_Assert(!cur_rs); - noMovable::Destroy(); + noMovable::destroy(); RTTR_Assert(!world->getPlayer(player).isDependentFigure(*this)); } @@ -78,17 +78,17 @@ void noFigure::Serialize(SerializedGameData& sgd) const { noMovable::Serialize(sgd); - sgd.PushEnum(fs); - sgd.PushEnum(job_); + sgd.pushEnum(fs); + sgd.pushEnum(job_); sgd.PushUnsignedChar(player); - sgd.PushObject(cur_rs, true); + sgd.pushObject(cur_rs, true); sgd.PushUnsignedShort(rs_pos); sgd.PushBool(rs_dir); sgd.PushBool(on_ship); sgd.PushBool(hasArmor_); if(fs == FigureState::GotToGoal || fs == FigureState::GoHome) - sgd.PushObject(goal_); + sgd.pushObject(goal_); sgd.PushBool(waiting_for_free_node); @@ -103,12 +103,12 @@ void noFigure::Serialize(SerializedGameData& sgd) const } noFigure::noFigure(SerializedGameData& sgd, const unsigned obj_id) - : noMovable(sgd, obj_id), fs(sgd.Pop()), job_(sgd.Pop()), player(sgd.PopUnsignedChar()), - cur_rs(sgd.PopObject(GO_Type::Roadsegment)), rs_pos(sgd.PopUnsignedShort()), rs_dir(sgd.PopBool()), + : noMovable(sgd, obj_id), fs(sgd.pop()), job_(sgd.pop()), player(sgd.PopUnsignedChar()), + cur_rs(sgd.popObject(GO_Type::Roadsegment)), rs_pos(sgd.PopUnsignedShort()), rs_dir(sgd.PopBool()), on_ship(sgd.PopBool()), last_id(0xFFFFFFFF), hasArmor_(sgd.getGameDataVersion() >= 12 ? sgd.PopBool() : false) { if(fs == FigureState::GotToGoal || fs == FigureState::GoHome) - goal_ = sgd.PopObject(); + goal_ = sgd.popObject(); else goal_ = nullptr; @@ -118,7 +118,7 @@ noFigure::noFigure(SerializedGameData& sgd, const unsigned obj_id) { wander_way = sgd.PopUnsignedShort(); wander_tryings = sgd.PopUnsignedShort(); - flagPos_ = sgd.PopMapPoint(); + flagPos_ = sgd.popMapPoint(); flag_obj_id = sgd.PopUnsignedInt(); burned_wh_id = sgd.PopUnsignedInt(); } @@ -129,15 +129,15 @@ bool noFigure::IsSoldier() const return isSoldier(job_); } -void noFigure::ActAtFirst() +void noFigure::actAtFirst() { // Je nach unserem Status bestimmte Dinge tun switch(fs) { default: break; - case FigureState::GotToGoal: WalkToGoal(); break; + case FigureState::GotToGoal: walkToGoal(); break; case FigureState::Job: - StartWalking(Direction::SouthEast); + startWalking(Direction::SouthEast); break; // erstmal rauslaufen, darum kümmern sich dann die abgeleiteten Klassen case FigureState::GoHome: { @@ -149,14 +149,14 @@ void noFigure::ActAtFirst() auto* wh = checkedCast(goal_); goal_ = nullptr; cur_rs = nullptr; - wh->AddFigure(world->RemoveFigure(pos, *this)); + wh->addFigure(world->RemoveFigure(pos, *this)); } else // ansonsten ganz normal rausgehen - WalkToGoal(); + walkToGoal(); } break; case FigureState::Wander: - StartWalking(Direction::SouthEast); + startWalking(Direction::SouthEast); break; // erstmal rauslaufen, darum kümmern sich dann die Wander-Funktionen } } @@ -168,14 +168,14 @@ unsigned noFigure::getVisualRange() const } /// Legt die Anfangsdaten für das Laufen auf Wegen fest -void noFigure::InitializeRoadWalking(const RoadSegment* const road, const unsigned short rs_pos, const bool rs_dir) +void noFigure::initializeRoadWalking(const RoadSegment* const road, const unsigned short rs_pos, const bool rs_dir) { this->cur_rs = road; this->rs_pos = rs_pos; this->rs_dir = rs_dir; } -DrawPoint noFigure::CalcFigurRelative() const +DrawPoint noFigure::calcFigurRelative() const { MapPoint targetPt = world->getNeighbour(pos, getCurMoveDir()); Position curPt = world->getNodePos(pos); @@ -198,10 +198,10 @@ DrawPoint noFigure::CalcFigurRelative() const offset = bld->getDoorPoint(); } - return offset + CalcRelative(curPt, nextPt); + return offset + calcRelative(curPt, nextPt); } -void noFigure::StartWalking(const Direction dir) +void noFigure::startWalking(const Direction dir) { RTTR_Assert(!(getGOT() == GO_Type::NofPassivesoldier && fs == FigureState::Job)); @@ -209,56 +209,56 @@ void noFigure::StartWalking(const Direction dir) if(dir == Direction::NorthWest && world->getNO(world->getNeighbour(pos, Direction::NorthWest))->getType() == NodalObjectType::Building) world->getSpecObj(world->getNeighbour(pos, Direction::NorthWest)) - ->OpenDoor(); // Dann die Tür aufmachen + ->openDoor(); // Dann die Tür aufmachen // oder aus einem raus? else if(dir == Direction::SouthEast && world->getNO(pos)->getType() == NodalObjectType::Building) - world->getSpecObj(pos)->OpenDoor(); // Dann die Tür aufmachen + world->getSpecObj(pos)->openDoor(); // Dann die Tür aufmachen // Ist der Platz schon besetzt, wo wir hinlaufen wollen und laufen wir auf Straßen? if(!world->isRoadNodeForFigures(world->getNeighbour(pos, dir)) && cur_rs) { // Dann stehen bleiben! - FaceDir(dir); + faceDir(dir); waiting_for_free_node = true; // Andere Figuren stoppen - world->StopOnRoads(pos, dir); + world->stopOnRoads(pos, dir); } else { // Normal hinlaufen - StartMoving(dir, 20); + startMoving(dir, 20); } } -void noFigure::DrawShadow(DrawPoint drawPt, const unsigned char anistep, Direction dir) +void noFigure::drawShadow(DrawPoint drawPt, const unsigned char anistep, Direction dir) { auto* bitmap = LOADER.getMapTexture(calcWalkFrameIndex(900, dir, anistep)); if(bitmap) - bitmap->DrawFull(drawPt, COLOR_SHADOW); + bitmap->drawFull(drawPt, COLOR_SHADOW); } -void noFigure::WalkFigure() +void noFigure::walkFigure() { // Tür hinter sich zumachen, wenn wir aus einem Gebäude kommen if(getCurMoveDir() == Direction::SouthEast && world->getNO(pos)->getType() == NodalObjectType::Building) - world->getSpecObj(pos)->CloseDoor(); + world->getSpecObj(pos)->closeDoor(); - Walk(); + walk(); if(cur_rs) ++rs_pos; // oder in eins reingegangen sind if(getCurMoveDir() == Direction::NorthWest && world->getNO(pos)->getType() == NodalObjectType::Building) - world->getSpecObj(pos)->CloseDoor(); + world->getSpecObj(pos)->closeDoor(); } -void noFigure::WalkToGoal() +void noFigure::walkToGoal() { // Kein Ziel mehr --> Rumirren if(!goal_) { - StartWandering(); - Wander(); + startWandering(); + wander(); return; } @@ -296,12 +296,12 @@ void noFigure::WalkToGoal() if(fs == FigureState::GoHome) { // Mann im Lagerhaus angekommen - static_cast(goal)->AddFigure(world->RemoveFigure(pos, *this)); + static_cast(goal)->addFigure(world->RemoveFigure(pos, *this)); } else { // abgeleiteter Klasse sagen, dass das Ziel erreicht wurde fs = FigureState::Job; - GoalReached(); + goalReached(); } } else @@ -310,20 +310,20 @@ void noFigure::WalkToGoal() // Neuen Weg berechnen auto* const curRoadNode = world->getSpecObj(pos); RoadPathDirection route = curRoadNode ? - world->FindHumanPathOnRoads(*curRoadNode, *goal_, nullptr, &next_harbor) : + world->findHumanPathOnRoads(*curRoadNode, *goal_, nullptr, &next_harbor) : RoadPathDirection::None; // Kein Weg zum Ziel... nächstes Lagerhaus suchen if(route == RoadPathDirection::None) { // Arbeisplatz oder Laghaus Bescheid sagen - Abrogate(); + abrogate(); // Wir gehen jetzt nach Hause - GoHome(); + goHome(); // Evtl wurde kein Lagerhaus gefunden und wir sollen rumirren, dann tun wir das gleich if(fs == FigureState::Wander) - Wander(); + wander(); else - WalkToGoal(); // Nach Hause laufen... + walkToGoal(); // Nach Hause laufen... } // Oder müssen wir das Schiff nehmen? else if(route == RoadPathDirection::Ship) @@ -335,26 +335,26 @@ void noFigure::WalkToGoal() // Es gibt keinen Hafen mehr -> nach Hause gehen // Arbeitsplatz oder Lagerhaus Bescheid sagen - Abrogate(); + abrogate(); // Wir gehen jetzt nach Hause - GoHome(); + goHome(); // Evtl wurde kein Lagerhaus gefunden und wir sollen rumirren, dann tun wir das gleich if(fs == FigureState::Wander) - Wander(); + wander(); else - WalkToGoal(); // Nach Hause laufen... + walkToGoal(); // Nach Hause laufen... } else { // Uns in den Hafen einquartieren cur_rs = nullptr; // wir laufen nicht mehr auf einer Straße - static_cast(hb)->AddFigureForShip(world->RemoveFigure(pos, *this), next_harbor); + static_cast(hb)->addFigureForShip(world->RemoveFigure(pos, *this), next_harbor); } } else { // Get next street we are walking on const Direction walkDir = toDirection(route); cur_rs = curRoadNode->getRoute(walkDir); - StartWalking(walkDir); + startWalking(walkDir); rs_pos = 0; rs_dir = curRoadNode != cur_rs->getF1(); } @@ -362,20 +362,20 @@ void noFigure::WalkToGoal() } else { - StartWalking(cur_rs->getDir(rs_dir, rs_pos)); + startWalking(cur_rs->getDir(rs_dir, rs_pos)); } } -void noFigure::HandleEvent(const unsigned id) +void noFigure::handleEvent(const unsigned id) { // Bei ID = 0 ists ein Laufevent, bei allen anderen an abgeleitete Klassen weiterleiten if(id) { - HandleDerivedEvent(id); + handleDerivedEvent(id); } else { current_ev = nullptr; - WalkFigure(); + walkFigure(); // Alte Richtung und Position für die Berechnung der Sichtbarkeiten merken const Direction old_dir = getCurMoveDir(); @@ -385,10 +385,10 @@ void noFigure::HandleEvent(const unsigned id) switch(fs) { case FigureState::GoHome: - case FigureState::GotToGoal: WalkToGoal(); break; + case FigureState::GotToGoal: walkToGoal(); break; - case FigureState::Job: Walked(); break; - case FigureState::Wander: Wander(); break; + case FigureState::Job: walked(); break; + case FigureState::Wander: wander(); break; } // Ggf. Sichtbereich testen @@ -397,17 +397,17 @@ void noFigure::HandleEvent(const unsigned id) { // Use old position (don't use this->pos because it might be different now // Figure could be in a ship etc.) - world->RecalcMovingVisibilities(old_pos, player, visualRange, old_dir, nullptr); + world->recalcMovingVisibilities(old_pos, player, visualRange, old_dir, nullptr); // Wenn Figur verschwunden ist, muss ihr ehemaliger gesamter Sichtbereich noch einmal // neue berechnet werden if(!world->hasFigureAt(old_pos, *this)) - CalcVisibilities(old_pos); + calcVisibilities(old_pos); } } } -void noFigure::GoHome(noRoadNode* goal) +void noFigure::goHome(noRoadNode* goal) { if(on_ship) { @@ -426,7 +426,7 @@ void noFigure::GoHome(noRoadNode* goal) world->getSpecObj(pos)->cancelFigure(this); return; } else - this->goal_ = world->getPlayer(player).FindWarehouse((rs_dir) ? *cur_rs->getF1() : *cur_rs->getF2(), + this->goal_ = world->getPlayer(player).findWarehouse((rs_dir) ? *cur_rs->getF1() : *cur_rs->getF2(), FW::AcceptsFigure(job_), true, false); } else this->goal_ = goal; @@ -435,25 +435,25 @@ void noFigure::GoHome(noRoadNode* goal) { fs = FigureState::GoHome; // Lagerhaus Bescheid sagen - static_cast(this->goal_)->AddDependentFigure(*this); + static_cast(this->goal_)->addDependentFigure(*this); // Wenn wir stehen, zusätzlich noch loslaufen! if(waiting_for_free_node) { waiting_for_free_node = false; - WalkToGoal(); + walkToGoal(); // anderen Leuten noch ggf Bescheid sagen - world->RoadNodeAvailable(pos); + world->roadNodeAvailable(pos); } } else { // Kein Lagerhaus gefunden --> Rumirren - StartWandering(); + startWandering(); cur_rs = nullptr; } } -void noFigure::StartWandering(const unsigned burned_wh_id) +void noFigure::startWandering(const unsigned burned_wh_id) { RTTR_Assert(!goal_); fs = FigureState::Wander; @@ -472,9 +472,9 @@ void noFigure::StartWandering(const unsigned burned_wh_id) waiting_for_free_node = false; // We should be paused, so just continue moving now if(isStoppedBetweenNodes()) - StartMoving(getCurMoveDir(), getPausedEvent().length); + startMoving(getCurMoveDir(), getPausedEvent().length); else - Wander(); + wander(); } } @@ -531,13 +531,13 @@ unsigned short getStrandedSoldierReturnSearchRadius(const GlobalGameSettings& gg } } -void noFigure::Wander() +void noFigure::wander() { // Sind wir noch auf der Suche nach einer Flagge? if(wander_way == 0xFFFF) { // Wir laufen schon zur Flagge - WanderToFlag(); + wanderToFlag(); return; } @@ -569,14 +569,14 @@ void noFigure::Wander() } // würde die die bisher beste an Weg unterbieten? - unsigned way = world->CalcDistance(pos, flag->getPos()); + unsigned way = world->calcDistance(pos, flag->getPos()); if(way < best_way) { // Are we at that flag or is there a path to it? - if(way == 0 || world->FindHumanPath(pos, flag->getPos(), wander_radius, false, &way)) + if(way == 0 || world->findHumanPath(pos, flag->getPos(), wander_radius, false, &way)) { // gucken, ob ein Weg zu einem Warenhaus führt - if(world->getPlayer(player).FindWarehouse(*flag, FW::AcceptsFigure(job_), true, false)) + if(world->getPlayer(player).findWarehouse(*flag, FW::AcceptsFigure(job_), true, false)) { // dann nehmen wir die doch glatt best_way = way; @@ -592,7 +592,7 @@ void noFigure::Wander() // TODO: Actually it is possible! E.g. between us and the flag is a river, so we won't find a path // within the radius but others (on the other side) could --> Remove ImpossibleForBWU? - flag->ImpossibleForBWU(burned_wh_id); + flag->impossibleForBWU(burned_wh_id); } } } @@ -603,7 +603,7 @@ void noFigure::Wander() wander_way = 0xFFFF; flagPos_ = best_flag->getPos(); flag_obj_id = best_flag->getObjId(); - WanderToFlag(); + wanderToFlag(); return; } @@ -618,23 +618,23 @@ void noFigure::Wander() } else { // Genug rumgeirrt, wir finden halt einfach nichts --> Sterben - Die(); + die(); return; } } - if(WalkInRandomDir()) + if(walkInRandomDir()) { RTTR_Assert(wander_way > 0); --wander_way; } else { // Wir sind eingesperrt! Kein Weg mehr gefunden --> Sterben - Die(); + die(); } } -bool noFigure::WalkInRandomDir() +bool noFigure::walkInRandomDir() { PathConditionHuman pathChecker(*world); // Check all dirs starting with a random one and taking the first possible @@ -642,27 +642,27 @@ bool noFigure::WalkInRandomDir() { if(pathChecker.isNodeOk(world->getNeighbour(pos, dir)) && pathChecker.isEdgeOk(pos, dir)) { - StartWalking(dir); + startWalking(dir); return true; } } return false; } -void noFigure::WanderFailedTrade() +void noFigure::wanderFailedTrade() { - DieFailedTrade(); + dieFailedTrade(); } -void noFigure::WanderToFlag() +void noFigure::wanderToFlag() { // Existiert die Flagge überhaupt noch? noBase* no = world->getNO(flagPos_); if(no->getObjId() != flag_obj_id) { // Wenn nicht, wieder normal weiter rumirren - StartWandering(); - Wander(); + startWandering(); + wander(); return; } @@ -671,7 +671,7 @@ void noFigure::WanderToFlag() { // Gibts noch nen Weg zu einem Lagerhaus? RTTR_Assert(world->getSpecObj(pos)); - if(nobBaseWarehouse* wh = world->getPlayer(player).FindWarehouse(*world->getSpecObj(pos), + if(nobBaseWarehouse* wh = world->getPlayer(player).findWarehouse(*world->getSpecObj(pos), FW::AcceptsFigure(job_), true, false)) { // ja, dann können wir ja hingehen @@ -679,34 +679,34 @@ void noFigure::WanderToFlag() cur_rs = nullptr; rs_pos = 0; fs = FigureState::GoHome; - wh->AddDependentFigure(*this); - WalkToGoal(); + wh->addDependentFigure(*this); + walkToGoal(); return; } else { // Wenn nicht, wieder normal weiter rumirren - StartWandering(); - Wander(); + startWandering(); + wander(); return; } } // Weiter zur Flagge gehen // Gibts noch nen Weg dahin bzw. existiert die Flagge noch? - const auto dir = world->FindHumanPath(pos, flagPos_, 60, false); + const auto dir = world->findHumanPath(pos, flagPos_, 60, false); if(dir) { // weiter hinlaufen - StartWalking(*dir); + startWalking(*dir); } else { // Wenn nicht, wieder normal weiter rumirren - StartWandering(); - Wander(); + startWandering(); + wander(); } } -void noFigure::CorrectSplitData(const RoadSegment* const rs2) +void noFigure::correctSplitData(const RoadSegment* const rs2) { // cur_rs entspricht Teilstück 1 ! @@ -759,10 +759,10 @@ void noFigure::CorrectSplitData(const RoadSegment* const rs2) /// Wird aufgerufen, wenn die Straße unter der Figur geteilt wurde (für abgeleitete Klassen) void noFigure::correctSplitDataDerived() {} -unsigned noFigure::CalcWalkAnimationFrame() const +unsigned noFigure::calcWalkAnimationFrame() const { // If we are waiting for a free node use the 2nd frame, else interpolate - return waiting_for_free_node ? 2 : GAMECLIENT.Interpolate(ASCENT_ANIMATION_STEPS[getAscent()], current_ev) % 8; + return waiting_for_free_node ? 2 : GAMECLIENT.interpolate(ASCENT_ANIMATION_STEPS[getAscent()], current_ev) % 8; } /// Calculate the index of the current frame for a figure walking in the given direction @@ -774,143 +774,143 @@ unsigned noFigure::calcWalkFrameIndex(const unsigned imgSetIndex, const Directio return imgSetIndex + rttr::enum_cast(toImgDir(dir)) * 8 + animationStep; } -DrawPoint noFigure::InterpolateWalkDrawPos(DrawPoint drawPt) const +DrawPoint noFigure::interpolateWalkDrawPos(DrawPoint drawPt) const { // Add an offset relative to the starting point calculated by how far we already walked // Don't if we are waiting on our starting node if(!waiting_for_free_node || isStoppedBetweenNodes()) - drawPt += CalcFigurRelative(); + drawPt += calcFigurRelative(); return drawPt; } -void noFigure::DrawWalkingCarrier(DrawPoint drawPt, helpers::OptionalEnum ware, bool fat) +void noFigure::drawWalkingCarrier(DrawPoint drawPt, helpers::OptionalEnum ware, bool fat) { - const unsigned ani_step = CalcWalkAnimationFrame(); + const unsigned ani_step = calcWalkAnimationFrame(); const GamePlayer& owner = world->getPlayer(player); auto& sprite = ware ? LOADER.getCarrierSprite(*ware, fat, getCurMoveDir(), ani_step) : LOADER.getCarrierBobSprite(owner.nation, fat, getCurMoveDir(), ani_step); - sprite.drawForPlayer(InterpolateWalkDrawPos(drawPt), owner.color); + sprite.drawForPlayer(interpolateWalkDrawPos(drawPt), owner.color); } -void noFigure::DrawWalkingBobJobs(DrawPoint drawPt, Job job) +void noFigure::drawWalkingBobJobs(DrawPoint drawPt, Job job) { - const unsigned ani_step = CalcWalkAnimationFrame(); + const unsigned ani_step = calcWalkAnimationFrame(); const GamePlayer& owner = world->getPlayer(player); LOADER.getBobSprite(owner.nation, job, getCurMoveDir(), ani_step) - .drawForPlayer(InterpolateWalkDrawPos(drawPt), owner.color); + .drawForPlayer(interpolateWalkDrawPos(drawPt), owner.color); if(hasArmor_) - DrawArmor(InterpolateWalkDrawPos(drawPt)); + drawArmor(interpolateWalkDrawPos(drawPt)); } -void noFigure::DrawWalking(DrawPoint drawPt, glArchivItem_Bob* file, unsigned id, bool fat) +void noFigure::drawWalking(DrawPoint drawPt, glArchivItem_Bob* file, unsigned id, bool fat) { - const unsigned ani_step = CalcWalkAnimationFrame(); - drawPt = InterpolateWalkDrawPos(drawPt); + const unsigned ani_step = calcWalkAnimationFrame(); + drawPt = interpolateWalkDrawPos(drawPt); if(file) - file->Draw(id, toImgDir(getCurMoveDir()), fat, ani_step, drawPt, world->getPlayer(player).color); - DrawShadow(drawPt, ani_step, getCurMoveDir()); + file->draw(id, toImgDir(getCurMoveDir()), fat, ani_step, drawPt, world->getPlayer(player).color); + drawShadow(drawPt, ani_step, getCurMoveDir()); } -void noFigure::DrawWalking(DrawPoint drawPt, const ResourceId& file, unsigned id) +void noFigure::drawWalking(DrawPoint drawPt, const ResourceId& file, unsigned id) { - const unsigned ani_step = CalcWalkAnimationFrame(); - drawPt = InterpolateWalkDrawPos(drawPt); + const unsigned ani_step = calcWalkAnimationFrame(); + drawPt = interpolateWalkDrawPos(drawPt); LOADER.getPlayerImage(file, calcWalkFrameIndex(id, getCurMoveDir(), ani_step)) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); - DrawShadow(drawPt, ani_step, getCurMoveDir()); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + drawShadow(drawPt, ani_step, getCurMoveDir()); } -void noFigure::DrawWalking(DrawPoint drawPt) +void noFigure::drawWalking(DrawPoint drawPt) { switch(job_) { case Job::PackDonkey: { - const unsigned ani_step = CalcWalkAnimationFrame(); - drawPt = InterpolateWalkDrawPos(drawPt); + const unsigned ani_step = calcWalkAnimationFrame(); + drawPt = interpolateWalkDrawPos(drawPt); - LOADER.getMapTexture(calcWalkFrameIndex(2000, getCurMoveDir(), ani_step))->DrawFull(drawPt); + LOADER.getMapTexture(calcWalkFrameIndex(2000, getCurMoveDir(), ani_step))->drawFull(drawPt); // donkey shadow - LOADER.getMapTexture(2048 + rttr::enum_cast(getCurMoveDir()) % 3)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getMapTexture(2048 + rttr::enum_cast(getCurMoveDir()) % 3)->drawFull(drawPt, COLOR_SHADOW); } break; - case Job::CharBurner: DrawWalking(drawPt, "charburner_bobs", 53); break; + case Job::CharBurner: drawWalking(drawPt, "charburner_bobs", 53); break; case Job::Vintner: - DrawWalking(drawPt, "wine_bobs", wineaddon::bobIndex[wineaddon::BobTypes::VINTNER_WALKING]); + drawWalking(drawPt, "wine_bobs", wineaddon::bobIndex[wineaddon::BobTypes::VINTNER_WALKING]); break; case Job::Winegrower: - DrawWalking(drawPt, "wine_bobs", wineaddon::bobIndex[wineaddon::BobTypes::WINEGROWER_WALKING_WITH_SHOVEL]); + drawWalking(drawPt, "wine_bobs", wineaddon::bobIndex[wineaddon::BobTypes::WINEGROWER_WALKING_WITH_SHOVEL]); break; case Job::TempleServant: - DrawWalking(drawPt, "wine_bobs", wineaddon::bobIndex[wineaddon::BobTypes::TEMPLESERVANT_WALKING]); + drawWalking(drawPt, "wine_bobs", wineaddon::bobIndex[wineaddon::BobTypes::TEMPLESERVANT_WALKING]); break; case Job::Skinner: - DrawWalking(drawPt, "leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::SkinnerWalking]); + drawWalking(drawPt, "leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::SkinnerWalking]); break; case Job::Tanner: - DrawWalking(drawPt, "leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::TannerWalking]); + drawWalking(drawPt, "leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::TannerWalking]); break; case Job::LeatherWorker: - DrawWalking(drawPt, "leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::LeatherworkerWalking]); + drawWalking(drawPt, "leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::LeatherworkerWalking]); break; - default: DrawWalkingBobJobs(drawPt, job_); break; + default: drawWalkingBobJobs(drawPt, job_); break; } } -void noFigure::DrawArmor(DrawPoint drawPt) +void noFigure::drawArmor(DrawPoint drawPt) { if(world->getGGS().isEnabled(AddonId::MILITARY_HITPOINTS)) { - SmallFont->Draw(drawPt + DrawPoint(7, -20), "+", FontStyle::CENTER, COLOR_RED); - SmallFont->Draw(drawPt + DrawPoint(10, -20), "1", FontStyle::CENTER, COLOR_RED); + SmallFont->draw(drawPt + DrawPoint(7, -20), "+", FontStyle::CENTER, COLOR_RED); + SmallFont->draw(drawPt + DrawPoint(10, -20), "1", FontStyle::CENTER, COLOR_RED); } LOADER.getImageN("leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::ArmorIconAboveArmoredSoldier]) - ->DrawFull(drawPt + DrawPoint(0, -22)); + ->drawFull(drawPt + DrawPoint(0, -22)); } -void noFigure::Die() +void noFigure::die() { // Weg mit mir - getEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); + getEvMgr().addToKillList(world->RemoveFigure(pos, *this)); // ggf. Leiche hinlegen, falls da nix ist if(!world->getSpecObj(pos)) world->setNO(pos, new noSkeleton(pos)); - RemoveFromInventory(); + removeFromInventory(); // Sichtbarkeiten neu berechnen für Erkunder und Soldaten - CalcVisibilities(pos); + calcVisibilities(pos); } -void noFigure::RemoveFromInventory() +void noFigure::removeFromInventory() { // Wars ein Bootmann? Dann Boot und Träger abziehen if(job_ == Job::BoatCarrier) { - world->getPlayer(player).DecreaseInventoryJob(Job::Helper, 1); - world->getPlayer(player).DecreaseInventoryWare(GoodType::Boat, 1); + world->getPlayer(player).decreaseInventoryJob(Job::Helper, 1); + world->getPlayer(player).decreaseInventoryWare(GoodType::Boat, 1); } else { - world->getPlayer(player).DecreaseInventoryJob(job_, 1); + world->getPlayer(player).decreaseInventoryJob(job_, 1); if(isSoldier(getJobType()) && hasArmor_) - world->getPlayer(player).DecreaseInventoryJob(jobEnumToAmoredSoldierEnum(getJobType()), 1); + world->getPlayer(player).decreaseInventoryJob(jobEnumToAmoredSoldierEnum(getJobType()), 1); } } -void noFigure::DieFailedTrade() +void noFigure::dieFailedTrade() { // Weg mit mir - getEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); + getEvMgr().addToKillList(world->RemoveFigure(pos, *this)); // ggf. Leiche hinlegen, falls da nix ist if(!world->getSpecObj(pos)) world->setNO(pos, new noSkeleton(pos)); } -void noFigure::NodeFreed(const MapPoint pt) +void noFigure::nodeFreed(const MapPoint pt) { // Stehen wir gerade aus diesem Grund? if(!waiting_for_free_node || pt != world->getNeighbour(this->pos, getCurMoveDir())) @@ -919,22 +919,22 @@ void noFigure::NodeFreed(const MapPoint pt) // Gehen wir in ein Gebäude? Dann wieder ausgleichen, weil wir die Türen sonst doppelt aufmachen! if(getCurMoveDir() == Direction::NorthWest && world->getNO(world->getNeighbour(this->pos, Direction::NorthWest))->getType() == NodalObjectType::Building) - world->getSpecObj(world->getNeighbour(this->pos, Direction::NorthWest))->CloseDoor(); + world->getSpecObj(world->getNeighbour(this->pos, Direction::NorthWest))->closeDoor(); // oder aus einem raus? if(getCurMoveDir() == Direction::SouthEast && world->getNO(this->pos)->getType() == NodalObjectType::Building) - world->getSpecObj(this->pos)->CloseDoor(); + world->getSpecObj(this->pos)->closeDoor(); // Wir stehen nun nicht mehr waiting_for_free_node = false; // Dann loslaufen - StartWalking(getCurMoveDir()); + startWalking(getCurMoveDir()); // anderen Leuten noch ggf Bescheid sagen - world->RoadNodeAvailable(this->pos); + world->roadNodeAvailable(this->pos); } -void noFigure::Abrogate() +void noFigure::abrogate() { // Arbeisplatz oder Laghaus Bescheid sagen if(fs == FigureState::GoHome) @@ -942,7 +942,7 @@ void noFigure::Abrogate() // goal might by nullptr if goal was a harbor that got destroyed during sea travel if(goal_) { - checkedCast(goal_)->RemoveDependentFigure(*this); + checkedCast(goal_)->removeDependentFigure(*this); goal_ = nullptr; } else { @@ -957,11 +957,11 @@ void noFigure::Abrogate() } else { goal_ = nullptr; - AbrogateWorkplace(); + abrogateWorkplace(); } } -void noFigure::StopIfNecessary(const MapPoint pt) +void noFigure::stopIfNecessary(const MapPoint pt) { // Lauf ich auf Wegen --> wenn man zum Ziel oder Weg läuft oder die Träger, die natürlich auch auf Wegen arbeiten if(fs == FigureState::GoHome || fs == FigureState::GotToGoal @@ -971,34 +971,34 @@ void noFigure::StopIfNecessary(const MapPoint pt) if(current_ev && !waiting_for_free_node && world->getNeighbour(this->pos, getCurMoveDir()) == pt) { // Dann stehenbleiben - PauseWalking(); + pauseWalking(); waiting_for_free_node = true; - world->StopOnRoads(this->pos, getCurMoveDir()); + world->stopOnRoads(this->pos, getCurMoveDir()); } } } /// Sichtbarkeiten berechnen für Figuren mit Sichtradius (Soldaten, Erkunder) vor dem Laufen -void noFigure::CalcVisibilities(const MapPoint pt) +void noFigure::calcVisibilities(const MapPoint pt) { const unsigned visualRange = getVisualRange(); if(visualRange) // An alter Position neu berechnen - world->RecalcVisibilitiesAroundPoint(pt, visualRange, player, nullptr); + world->recalcVisibilitiesAroundPoint(pt, visualRange, player, nullptr); } /// Informiert die Figur, dass für sie eine Schiffsreise beginnt -void noFigure::StartShipJourney() +void noFigure::startShipJourney() { // We should not be in the world, as we start the journey from a harbor -> We are in that harbor RTTR_Assert(!world->hasFigureAt(pos, *this)); RTTR_Assert(!on_ship); - pos = MapPoint::Invalid(); + pos = MapPoint::invalid(); on_ship = true; } -void noFigure::ArrivedByShip(const MapPoint harborPos) +void noFigure::arrivedByShip(const MapPoint harborPos) { RTTR_Assert(on_ship); pos = harborPos; @@ -1006,7 +1006,7 @@ void noFigure::ArrivedByShip(const MapPoint harborPos) } /// Examines the route (maybe harbor, road destroyed?) before start shipping -MapPoint noFigure::ExamineRouteBeforeShipping(RoadPathDirection& newDir) +MapPoint noFigure::examineRouteBeforeShipping(RoadPathDirection& newDir) { MapPoint next_harbor; // Calc new route @@ -1014,10 +1014,10 @@ MapPoint noFigure::ExamineRouteBeforeShipping(RoadPathDirection& newDir) if(!roadNode || !goal_) newDir = RoadPathDirection::None; else - newDir = world->FindHumanPathOnRoads(*roadNode, *goal_, nullptr, &next_harbor); + newDir = world->findHumanPathOnRoads(*roadNode, *goal_, nullptr, &next_harbor); if(newDir == RoadPathDirection::None) - Abrogate(); + abrogate(); // Going by ship? if(newDir == RoadPathDirection::Ship) diff --git a/libs/s25main/figures/noFigure.h b/libs/s25main/figures/noFigure.h index 6579ae417d..3fb7c914b4 100644 --- a/libs/s25main/figures/noFigure.h +++ b/libs/s25main/figures/noFigure.h @@ -111,36 +111,36 @@ class noFigure : public noMovable private: /// abgeleitete Klassen informieren, wenn ... - virtual void GoalReached() = 0; // das Ziel erreicht wurde - virtual void Walked() = 0; // man gelaufen ist + virtual void goalReached() = 0; // das Ziel erreicht wurde + virtual void walked() = 0; // man gelaufen ist /// Für alle restlichen Events, die nicht von noFigure behandelt werden - virtual void HandleDerivedEvent(unsigned id) = 0; + virtual void handleDerivedEvent(unsigned id) = 0; /// Gibt den Sichtradius dieser Figur zurück (0, falls nicht-spähend) virtual unsigned getVisualRange() const; /// Unterfunktion von Wander --> zur Flagge irren - void WanderToFlag(); + void wanderToFlag(); /// Unterfunktion von Wander --> zur Flagge irren // void WanderToFlagFailedTrade(); /// Sichtbarkeiten berechnen für Figuren mit Sichtradius (Soldaten, Erkunder) vor dem Laufen - void CalcVisibilities(MapPoint pt); + void calcVisibilities(MapPoint pt); protected: /// In aktueller Richtung ein Stück zurcklegen - void WalkFigure(); + void walkFigure(); /// Schatten der Figur malen - void DrawShadow(DrawPoint drawPt, unsigned char anistep, Direction dir); + void drawShadow(DrawPoint drawPt, unsigned char anistep, Direction dir); /// Herumirren - void Wander(); + void wander(); /// Herumirren after failed traderoute - void WanderFailedTrade(); + void wanderFailedTrade(); - virtual void AbrogateWorkplace() = 0; + virtual void abrogateWorkplace() = 0; public: /// Konstruktor für Figuren, die auf dem Wegenetz starten @@ -150,10 +150,10 @@ class noFigure : public noMovable noFigure(SerializedGameData& sgd, unsigned obj_id); - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; - void HandleEvent(unsigned id) override; + void handleEvent(unsigned id) override; /// Ziel setzen void setGoalTonullptr() { goal_ = nullptr; } @@ -168,80 +168,80 @@ class noFigure : public noMovable const RoadSegment* getCurrentRoad() const { return cur_rs; } bool isWandering() const { return fs == FigureState::Wander; } /// Tut was, nachdem er rausgehen soll - void ActAtFirst(); + void actAtFirst(); /// Legt die Anfangsdaten für das Laufen auf Wegen fest - void InitializeRoadWalking(const RoadSegment* road, unsigned short rs_pos, bool rs_dir); + void initializeRoadWalking(const RoadSegment* road, unsigned short rs_pos, bool rs_dir); /// Gibt Job-Typ zurück Job getJobType() const { return job_; } /// Returns true if this is a soldier (they get some special handling at some points) bool IsSoldier() const; - unsigned CalcWalkAnimationFrame() const; - DrawPoint InterpolateWalkDrawPos(DrawPoint drawPt) const; + unsigned calcWalkAnimationFrame() const; + DrawPoint interpolateWalkDrawPos(DrawPoint drawPt) const; /// Draw the current walk animation frame from "carrier.bob" - void DrawWalkingCarrier(DrawPoint drawPt, helpers::OptionalEnum ware, bool fat); + void drawWalkingCarrier(DrawPoint drawPt, helpers::OptionalEnum ware, bool fat); /// Draw the current walk animation frame from "jobs.bob" - void DrawWalkingBobJobs(DrawPoint drawPt, Job job); + void drawWalkingBobJobs(DrawPoint drawPt, Job job); /// Draw the current walk animation frame using the start index into the given file - void DrawWalking(DrawPoint drawPt, glArchivItem_Bob* file, unsigned id, bool fat); + void drawWalking(DrawPoint drawPt, glArchivItem_Bob* file, unsigned id, bool fat); /// Draw the current walk animation frame using the start index into the given LST archive /// See @ref calcWalkFrameIndex - void DrawWalking(DrawPoint drawPt, const ResourceId& file, unsigned id); + void drawWalking(DrawPoint drawPt, const ResourceId& file, unsigned id); /// Draw the current walk animation for this figure - void DrawWalking(DrawPoint drawPt); - void DrawArmor(DrawPoint drawPt); + void drawWalking(DrawPoint drawPt); + void drawArmor(DrawPoint drawPt); /// Interpoliert die Positon zwischen zwei Knotenpunkten - DrawPoint CalcFigurRelative() const; + DrawPoint calcFigurRelative() const; /// Anfangen zu laufen (Event anmelden, Tür aufmachen ggf) - void StartWalking(Direction dir); + void startWalking(Direction dir); /// Starts walking in a random dir and returns whether this was possible - bool WalkInRandomDir(); + bool walkInRandomDir(); /// Umherirren starten (frei rumlaufen) - void StartWandering(unsigned burned_wh_id = 0xFFFFFFFF); + void startWandering(unsigned burned_wh_id = 0xFFFFFFFF); /// Auf Straßen(!) nach Hause laufen - void GoHome(noRoadNode* goal = nullptr); + void goHome(noRoadNode* goal = nullptr); /// Aktuellen Weg, auf dem er läuft, fr ungültig erklären - void CutCurrentRoad() { cur_rs = nullptr; } + void cutCurrentRoad() { cur_rs = nullptr; } /// Auf Straßen zur Zielflagge laufen - void WalkToGoal(); + void walkToGoal(); /// Gibt die Straße zurück, auf der man gerade läuft const RoadSegment* getCurrentRoad() { return cur_rs; } /// Wird aufgerufen, wenn die Straße unter der Figur geteilt wurde, setzt vorraus, dass die Figur auf der geteilten /// Straße läuft! - void CorrectSplitData(const RoadSegment* rs2); + void correctSplitData(const RoadSegment* rs2); /// Wird aufgerufen, wenn die Straße unter der Figur geteilt wurde (für abgeleitete Klassen) virtual void correctSplitDataDerived(); /// Lässt die Figur sterben (löst sich auf und hinterlässt ggf. Leiche) - void Die(); + void die(); /// Removes the figure from the players inventory (e.g. when it does not exist anymore) - void RemoveFromInventory(); + void removeFromInventory(); /// Lässt die Figur sterben (löst sich auf und hinterlässt ggf. Leiche) - does not reduce good counts because for /// trade routes they have been reduced already. - void DieFailedTrade(); + void dieFailedTrade(); /// Mitglied von nem Lagerhaus(Lagerhausarbeiter, die die Träger-Bestände nicht beeinflussen?) /// Kann außer bei WarehouseWorker die Default-Definition gelassen werden - virtual bool MemberOfWarehouse() const { return false; } + virtual bool memberOfWarehouse() const { return false; } /// Ein Punkt neben der Figur wurde freigegeben --> wenn sie deswegen angehalten ist, kann sie weiterlaufen - void NodeFreed(MapPoint pt); + void nodeFreed(MapPoint pt); /// Wartet sie auf einen freien Platz? bool isWaitingForFreeNode() const { return waiting_for_free_node; } /// Stoppt, wenn er auf diesen Punkt zuläuft - void StopIfNecessary(MapPoint pt); + void stopIfNecessary(MapPoint pt); unsigned char getPlayer() const { return player; } bool isDoingJobWorks() const { return fs == FigureState::Job; } - void Abrogate(); // beim Arbeitsplatz "kündigen" soll, man das Laufen zum Ziel unterbrechen muss (warum auch immer) + void abrogate(); // beim Arbeitsplatz "kündigen" soll, man das Laufen zum Ziel unterbrechen muss (warum auch immer) /// Informiert die Figur, dass für sie eine Schiffsreise beginnt - void StartShipJourney(); + void startShipJourney(); /// Tells the figure it arrived at a harbor at the given position - void ArrivedByShip(MapPoint harborPos); + void arrivedByShip(MapPoint harborPos); /// Gibt zurück, ob die Figur auf Straßen läuft zu ihrem Arbeitsplatz o.Ä. bool isWalkingOnRoad() const { @@ -258,7 +258,7 @@ class noFigure : public noMovable /// Returns (maybe new) destination harbor ((0,0) if he doesn't go by ship) /// and also the new direction it wants to travel which can be the (otherwise invalid) SHIP_DIR if the figure stays /// on board - MapPoint ExamineRouteBeforeShipping(RoadPathDirection& newDir); + MapPoint examineRouteBeforeShipping(RoadPathDirection& newDir); private: /// Calculate the index of the current frame for a figure walking in the given direction diff --git a/libs/s25main/figures/nofActiveSoldier.cpp b/libs/s25main/figures/nofActiveSoldier.cpp index f46b1c36a7..52c9da036e 100644 --- a/libs/s25main/figures/nofActiveSoldier.cpp +++ b/libs/s25main/figures/nofActiveSoldier.cpp @@ -28,18 +28,18 @@ void nofActiveSoldier::Serialize(SerializedGameData& sgd) const { nofSoldier::Serialize(sgd); - sgd.PushEnum(state); - sgd.PushObject(enemy); + sgd.pushEnum(state); + sgd.pushObject(enemy); helpers::pushPoint(sgd, fightSpot_); } nofActiveSoldier::nofActiveSoldier(SerializedGameData& sgd, const unsigned obj_id) - : nofSoldier(sgd, obj_id), state(sgd.Pop()), enemy(sgd.PopObject()) + : nofSoldier(sgd, obj_id), state(sgd.pop()), enemy(sgd.popObject()) { - fightSpot_ = sgd.PopMapPoint(); + fightSpot_ = sgd.popMapPoint(); } -void nofActiveSoldier::GoalReached() +void nofActiveSoldier::goalReached() { // We reached the military building // Add myself to the building @@ -59,24 +59,24 @@ void nofActiveSoldier::GoalReached() throw std::runtime_error("No building found for soldier"); } } - homeBld->AddActiveSoldier(world->RemoveFigure(pos, *this)); + homeBld->addActiveSoldier(world->RemoveFigure(pos, *this)); } -void nofActiveSoldier::ReturnHome() +void nofActiveSoldier::returnHome() { state = SoldierState::WalkingHome; - WalkingHome(); + walkingHome(); } -void nofActiveSoldier::WalkingHome() +void nofActiveSoldier::walkingHome() { // Is our home military building destroyed? if(!homeBld) { // Start wandering around state = SoldierState::FigureWork; - StartWandering(); - Wander(); + startWandering(); + wander(); return; } @@ -84,35 +84,35 @@ void nofActiveSoldier::WalkingHome() // Walking home to our military building if(getPos() == homeBld->getFlagPos()) // Are we already at the flag? - StartWalking(Direction::NorthWest); // Enter via the door + startWalking(Direction::NorthWest); // Enter via the door else if(getPos() == homeBld->getPos()) // or are we at the building - homeBld->AddActiveSoldier(world->RemoveFigure(pos, *this)); + homeBld->addActiveSoldier(world->RemoveFigure(pos, *this)); else { - const auto dir = world->FindHumanPath(pos, homeBld->getFlagPos(), 100); + const auto dir = world->findHumanPath(pos, homeBld->getFlagPos(), 100); if(dir) { // Find all sorts of enemies (attackers, aggressive defenders..) nearby - if(TryFightingNearbyEnemy()) + if(tryFightingNearbyEnemy()) // Enemy found -> abort, because nofActiveSoldier handles all things now (inclusive one walking step) return; // Start walking - StartWalking(*dir); + startWalking(*dir); } else { // Inform our home building that we're not coming anymore - Abrogate(); + abrogate(); // Start wandering around then - StartWandering(); + startWandering(); state = SoldierState::FigureWork; - Wander(); + wander(); } } } -void nofActiveSoldier::Draw(DrawPoint drawPt) +void nofActiveSoldier::draw(DrawPoint drawPt) { switch(state) { @@ -122,7 +122,7 @@ void nofActiveSoldier::Draw(DrawPoint drawPt) case SoldierState::AttackingWaitingForDefender: case SoldierState::DefendingWaiting: { - DrawSoldierWaiting(drawPt); + drawSoldierWaiting(drawPt); break; } case SoldierState::FigureWork: @@ -138,7 +138,7 @@ void nofActiveSoldier::Draw(DrawPoint drawPt) case SoldierState::SeaattackingGoToHarbor: case SoldierState::SeaattackingReturnToShip: { - DrawWalkingBobJobs(drawPt, job_); + drawWalkingBobJobs(drawPt, job_); break; } } @@ -149,7 +149,7 @@ unsigned nofActiveSoldier::getVisualRange() const return VISUALRANGE_SOLDIER; } -void nofActiveSoldier::ExpelEnemies() const +void nofActiveSoldier::expelEnemies() const { // Collect the figures nearby std::vector figures; @@ -184,29 +184,29 @@ void nofActiveSoldier::ExpelEnemies() const if(!owner.isAlly(fig->getPlayer()) && !fig->IsSoldier() && fig->isWalkingOnRoad()) { // Then he should start wandering around - fig->Abrogate(); - fig->StartWandering(); + fig->abrogate(); + fig->startWandering(); // Not walking? (Could be carriers who are waiting for wares on roads) - if(!fig->isMoving() && !fig->WalkInRandomDir()) + if(!fig->isMoving() && !fig->walkInRandomDir()) { // No possible way found (unlikely but just in case) - fig->Die(); + fig->die(); } } } } -void nofActiveSoldier::Walked() +void nofActiveSoldier::walked() { switch(state) { default: return; - case SoldierState::WalkingHome: WalkingHome(); return; - case SoldierState::MeetEnemy: MeetingEnemy(); return; + case SoldierState::WalkingHome: walkingHome(); return; + case SoldierState::MeetEnemy: meetingEnemy(); return; } } -bool nofActiveSoldier::TryFightingNearbyEnemy(const std::optional& excludedOwner) +bool nofActiveSoldier::tryFightingNearbyEnemy(const std::optional& excludedOwner) { RTTR_Assert(enemy == nullptr); enemy = nullptr; @@ -251,26 +251,26 @@ bool nofActiveSoldier::TryFightingNearbyEnemy(const std::optional // We try to meet now state = SoldierState::MeetEnemy; - enemy->MeetEnemy(*this, fightSpot_); + enemy->meetEnemy(*this, fightSpot_); // Walk to him - MeetingEnemy(); + meetingEnemy(); return true; } -void nofActiveSoldier::IncreaseRank() +void nofActiveSoldier::increaseRank() { if(getRank() < world->getGGS().getMaxMilitaryRank()) { // Promote and adjust inventory accordingly - world->getPlayer(player).DecreaseInventoryJob(job_, 1); + world->getPlayer(player).decreaseInventoryJob(job_, 1); job_ = Job(rttr::enum_cast(job_) + 1); - world->getPlayer(player).IncreaseInventoryJob(job_, 1); + world->getPlayer(player).increaseInventoryJob(job_, 1); } } -void nofActiveSoldier::MeetingEnemy() +void nofActiveSoldier::meetingEnemy() { // At this point we must still have an enemy which we were walking towards RTTR_Assert(enemy); @@ -283,10 +283,10 @@ void nofActiveSoldier::MeetingEnemy() { RTTR_Assert(enemy->getPos() == fightSpot_); // Start fighting - world->AddFigure(pos, std::make_unique(*enemy, *this)); + world->addFigure(pos, std::make_unique(*enemy, *this)); - enemy->FightingStarted(); - FightingStarted(); + enemy->fightingStarted(); + fightingStarted(); } else { // Is fighting point still valid (there could e.g. be another fight already) @@ -298,26 +298,26 @@ void nofActiveSoldier::MeetingEnemy() state = SoldierState::WaitingForFight; } else { - AbortFreeFight(); - Walked(); + abortFreeFight(); + walked(); } } } else { // Not at the fighting spot yet, continue walking there - const auto dir = world->FindHumanPath(pos, fightSpot_, MAX_ATTACKING_RUN_DISTANCE); + const auto dir = world->findHumanPath(pos, fightSpot_, MAX_ATTACKING_RUN_DISTANCE); if(dir) - StartWalking(*dir); + startWalking(*dir); else { // No way from current location to fighting spot -> cancel fight - AbortFreeFight(); - Walked(); + abortFreeFight(); + walked(); } } } -void nofActiveSoldier::AbortFreeFight() +void nofActiveSoldier::abortFreeFight() { const bool enemyWasWaiting = enemy && enemy->state == SoldierState::WaitingForFight; auto* old_enemy = enemy; @@ -328,30 +328,30 @@ void nofActiveSoldier::AbortFreeFight() enemy->enemy = nullptr; enemy = nullptr; } - state = FreeFightAborted(); + state = freeFightAborted(); if(old_enemy) - old_enemy->state = old_enemy->FreeFightAborted(); + old_enemy->state = old_enemy->freeFightAborted(); // Now the (possibly) 2 soldiers are in a state where they could even engage in another fight with each other if(enemyWasWaiting) { // Act as-if the enemy just arrived at his position so he'll start moving again if required RTTR_Assert(!old_enemy->isMoving()); - old_enemy->Walked(); + old_enemy->walked(); } } -void nofActiveSoldier::InformTargetsAboutCancelling() +void nofActiveSoldier::informTargetsAboutCancelling() { if(enemy) - AbortFreeFight(); + abortFreeFight(); } -void nofActiveSoldier::TakeHit() +void nofActiveSoldier::takeHit() { if(hasArmor_) { hasArmor_ = false; - world->getPlayer(player).DecreaseInventoryJob(jobEnumToAmoredSoldierEnum(getJobType()), 1); + world->getPlayer(player).decreaseInventoryJob(jobEnumToAmoredSoldierEnum(getJobType()), 1); } else { RTTR_Assert(hitpoints > 0u); @@ -371,7 +371,7 @@ bool nofActiveSoldier::isReadyForFight() const } } -void nofActiveSoldier::MeetEnemy(nofActiveSoldier& other, const MapPoint figh_spot) +void nofActiveSoldier::meetEnemy(nofActiveSoldier& other, const MapPoint figh_spot) { enemy = &other; fightSpot_ = figh_spot; @@ -381,7 +381,7 @@ void nofActiveSoldier::MeetEnemy(nofActiveSoldier& other, const MapPoint figh_sp // In some cases we have to start walking if(old_state == SoldierState::AttackingWaitingAroundBuilding) - MeetingEnemy(); + meetingEnemy(); } std::optional nofActiveSoldier::getFightSpotNear(const nofActiveSoldier& other) @@ -414,13 +414,13 @@ std::optional nofActiveSoldier::getFightSpotNear(const nofActiveSoldie else middle.y += halfMapHeight; } - RTTR_Assert(world->CalcDistance(otherPos, middle) <= std::max(mapWidth, mapHeight) / 4u); + RTTR_Assert(world->calcDistance(otherPos, middle) <= std::max(mapWidth, mapHeight) / 4u); const auto isGoodFightingSpot = [world = this->world, pos = this->pos, this, &other](MapPoint pt) { return world->isValidPointForFighting(pt, *this, true) - && (pos == pt || world->FindHumanPath(pos, pt, MEET_FOR_FIGHT_DISTANCE * 2, false)) + && (pos == pt || world->findHumanPath(pos, pt, MEET_FOR_FIGHT_DISTANCE * 2, false)) && (other.getPos() == pt - || world->FindHumanPath(other.getPos(), pt, MEET_FOR_FIGHT_DISTANCE * 2, false)); + || world->findHumanPath(other.getPos(), pt, MEET_FOR_FIGHT_DISTANCE * 2, false)); }; const std::vector pts = world->GetMatchingPointsInRadius<1>(middle, MEET_FOR_FIGHT_DISTANCE, isGoodFightingSpot, true); @@ -430,7 +430,7 @@ std::optional nofActiveSoldier::getFightSpotNear(const nofActiveSoldie return pts.front(); } -void nofActiveSoldier::FightingStarted() +void nofActiveSoldier::fightingStarted() { state = SoldierState::Fighting; enemy = nullptr; diff --git a/libs/s25main/figures/nofActiveSoldier.h b/libs/s25main/figures/nofActiveSoldier.h index 27deda498f..a8b3e74008 100644 --- a/libs/s25main/figures/nofActiveSoldier.h +++ b/libs/s25main/figures/nofActiveSoldier.h @@ -59,40 +59,40 @@ class nofActiveSoldier : public nofSoldier protected: /// Start returning home - void ReturnHome(); + void returnHome(); /// Walking home, called after each walking step - void WalkingHome(); + void walkingHome(); /// Examine hostile people on roads and expels them - void ExpelEnemies() const; + void expelEnemies() const; /// Handle walking for nofActiveSoldier specific states - void Walked() override; + void walked() override; /// Look for a nearby enemy which wants to fight with this soldier. /// Return true if one was found and we are going to fight him. - bool TryFightingNearbyEnemy(const std::optional& excludedOwner = std::nullopt); + bool tryFightingNearbyEnemy(const std::optional& excludedOwner = std::nullopt); /// Inform this soldier that another soldier starts meeting him - void MeetEnemy(nofActiveSoldier& other, MapPoint figh_spot); + void meetEnemy(nofActiveSoldier& other, MapPoint figh_spot); /// Handle state "meet enemy" after each walking step - void MeetingEnemy(); + void meetingEnemy(); /// Look for an appropriate fighting spot between the two soldiers /// Return true on success std::optional getFightSpotNear(const nofActiveSoldier& other); /// increase rank if possible - void IncreaseRank(); + void increaseRank(); /// Notify that a free fight (somewhere at the map, not the one at the building flag) cannot be started /// Return state that is able to handle the next walk event - virtual SoldierState FreeFightAborted() = 0; + virtual SoldierState freeFightAborted() = 0; private: /// Soldier reached his military building - void GoalReached() override; + void goalReached() override; /// Get how much of the map/FoW the soldier discovers unsigned getVisualRange() const override; /// Abort a free fight (somewhere at the map, not the one at the building flag) that cannot be started - void AbortFreeFight(); + void abortFreeFight(); public: nofActiveSoldier(MapPoint pos, unsigned char player, nobBaseMilitary& home, unsigned char rank, @@ -101,40 +101,40 @@ class nofActiveSoldier : public nofSoldier nofActiveSoldier(SerializedGameData& sgd, unsigned obj_id); nofActiveSoldier(const nofActiveSoldier&) = delete; - void Destroy() override + void destroy() override { RTTR_Assert(!enemy); - nofSoldier::Destroy(); + nofSoldier::destroy(); } void Serialize(SerializedGameData& sgd) const override; /// Draw soldier (for all types of soldiers done by this base class!) - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; /// Inform the different things that we are not coming anymore - virtual void InformTargetsAboutCancelling(); + virtual void informTargetsAboutCancelling(); /// Is called when our home military building was destroyed - virtual void HomeDestroyed() = 0; + virtual void homeDestroyed() = 0; /// When the soldier is still hanging in the going-out waiting queue in the home military building - virtual void HomeDestroyedAtBegin() = 0; + virtual void homeDestroyedAtBegin() = 0; /// Takes a hit from another soldier. Reduces hitpoints by one - void TakeHit(); + void takeHit(); /// When a fight was won - virtual void WonFighting() = 0; + virtual void wonFighting() = 0; /// When a fight was lost - virtual void LostFighting() = 0; + virtual void lostFighting() = 0; /// Determine if this soldier is ready for a spontaneous fight bool isReadyForFight() const; /// Inform a waiting soldier about the start of a fight - void FightingStarted(); + void fightingStarted(); /// Get the current state SoldierState getState() const { return state; } /// Set the home (building) to nullptr /// e.g. after the soldier was removed from the homes list but it was not destroyed - void ResetHome() { homeBld = nullptr; } - void FightVsDefenderStarted() { state = SoldierState::AttackingFightingVsDefender; } + void resetHome() { homeBld = nullptr; } + void fightVsDefenderStarted() { state = SoldierState::AttackingFightingVsDefender; } // For debugging const nofActiveSoldier* getEnemy() const { return enemy; } diff --git a/libs/s25main/figures/nofAggressiveDefender.cpp b/libs/s25main/figures/nofAggressiveDefender.cpp index e738c9cefd..14a98aed2a 100644 --- a/libs/s25main/figures/nofAggressiveDefender.cpp +++ b/libs/s25main/figures/nofAggressiveDefender.cpp @@ -17,7 +17,7 @@ nofAggressiveDefender::nofAggressiveDefender(const MapPoint pos, const unsigned attacker(&attacker), attacked_goal(attacker.getAttackedGoal()) { // Notify building to protect - attacked_goal->LinkAggressiveDefender(*this); + attacked_goal->linkAggressiveDefender(*this); } nofAggressiveDefender::nofAggressiveDefender(const nofPassiveSoldier& other, nofAttacker& attacker) @@ -25,16 +25,16 @@ nofAggressiveDefender::nofAggressiveDefender(const nofPassiveSoldier& other, nof attacked_goal(attacker.getAttackedGoal()) { // Notify building to protect - attacked_goal->LinkAggressiveDefender(*this); + attacked_goal->linkAggressiveDefender(*this); } nofAggressiveDefender::~nofAggressiveDefender() = default; -void nofAggressiveDefender::Destroy() +void nofAggressiveDefender::destroy() { RTTR_Assert(!attacker); RTTR_Assert(!attacked_goal); - nofActiveSoldier::Destroy(); + nofActiveSoldier::destroy(); } void nofAggressiveDefender::Serialize(SerializedGameData& sgd) const @@ -43,8 +43,8 @@ void nofAggressiveDefender::Serialize(SerializedGameData& sgd) const if(state != SoldierState::WalkingHome && state != SoldierState::FigureWork) { - sgd.PushObject(attacker, true); - sgd.PushObject(attacked_goal); + sgd.pushObject(attacker, true); + sgd.pushObject(attacked_goal); } } @@ -53,8 +53,8 @@ nofAggressiveDefender::nofAggressiveDefender(SerializedGameData& sgd, const unsi { if(state != SoldierState::WalkingHome && state != SoldierState::FigureWork) { - attacker = sgd.PopObject(GO_Type::NofAttacker); - attacked_goal = sgd.PopObject(); + attacker = sgd.popObject(GO_Type::NofAttacker); + attacked_goal = sgd.popObject(); } else { attacker = nullptr; @@ -62,83 +62,83 @@ nofAggressiveDefender::nofAggressiveDefender(SerializedGameData& sgd, const unsi } } -void nofAggressiveDefender::Walked() +void nofAggressiveDefender::walked() { if(state == SoldierState::AggressivedefendingWalkingToAggressor) - MissAggressiveDefendingWalk(); + missAggressiveDefendingWalk(); else - nofActiveSoldier::Walked(); + nofActiveSoldier::walked(); } -void nofAggressiveDefender::HomeDestroyed() +void nofAggressiveDefender::homeDestroyed() { homeBld = nullptr; } -void nofAggressiveDefender::HomeDestroyedAtBegin() +void nofAggressiveDefender::homeDestroyedAtBegin() { homeBld = nullptr; // angegriffenem Gebäude Bescheid sagen, dass wir doch nicht mehr kommen - InformTargetsAboutCancelling(); + informTargetsAboutCancelling(); state = SoldierState::FigureWork; // Rumirren - StartWandering(); - StartWalking(RANDOM_ENUM(Direction)); + startWandering(); + startWalking(RANDOM_ENUM(Direction)); } void nofAggressiveDefender::cancelAtAttackedBld() { if(attacked_goal) { - attacked_goal->UnlinkAggressiveDefender(*this); + attacked_goal->unlinkAggressiveDefender(*this); attacked_goal = nullptr; } } -void nofAggressiveDefender::WonFighting() +void nofAggressiveDefender::wonFighting() { // addon BattlefieldPromotion active? -> increase rank! if(world->getGGS().isEnabled(AddonId::BATTLEFIELD_PROMOTION)) - IncreaseRank(); + increaseRank(); // Ist evtl. unser Heimatgebäude zerstört? if(!homeBld) { // Ziel Bescheid sagen - InformTargetsAboutCancelling(); + informTargetsAboutCancelling(); // Rumirren state = SoldierState::FigureWork; - StartWandering(); - Wander(); + startWandering(); + wander(); return; } // Continue walking to our attacker - MissAggressiveDefendingContinueWalking(); + missAggressiveDefendingContinueWalking(); } -void nofAggressiveDefender::LostFighting() +void nofAggressiveDefender::lostFighting() { // Meinem zu Hause Bescheid sagen, dass ich nicht mehr lebe (damit neue Truppen reinkönnen), // falls es noch existiert - AbrogateWorkplace(); + abrogateWorkplace(); // Ziel Bescheid sagen, das ich verteidigt hatte - InformTargetsAboutCancelling(); + informTargetsAboutCancelling(); } -void nofAggressiveDefender::MissionAggressiveDefendingLookForNewAggressor() +void nofAggressiveDefender::missionAggressiveDefendingLookForNewAggressor() { RTTR_Assert(!attacker); // Wenns das Zielgebäude nich mehr gibt, gleich nach Hause gehen! if(!attacked_goal) { - ReturnHomeMissionAggressiveDefending(); + returnHomeMissionAggressiveDefending(); return; } @@ -147,19 +147,19 @@ void nofAggressiveDefender::MissionAggressiveDefendingLookForNewAggressor() state = SoldierState::AggressivedefendingWalkingToAggressor; // nach anderen suchen, die in meiner Nähe sind und mich evtl noch mit denen kloppen - attacker = attacked_goal->FindAggressor(*this); + attacker = attacked_goal->findAggressor(*this); if(attacker) { // zum Angreifer gehen und mit ihm kämpfen - MissAggressiveDefendingWalk(); + missAggressiveDefendingWalk(); } else { // keiner will mehr mit mir kämpfen, dann geh ich halt wieder nach Hause - ReturnHomeMissionAggressiveDefending(); + returnHomeMissionAggressiveDefending(); } } -void nofAggressiveDefender::AttackedGoalDestroyed() +void nofAggressiveDefender::attackedGoalDestroyed() { cancelAtAttacker(); attacked_goal = nullptr; @@ -169,35 +169,35 @@ void nofAggressiveDefender::AttackedGoalDestroyed() ReturnHome();*/ } -void nofAggressiveDefender::MissAggressiveDefendingContinueWalking() +void nofAggressiveDefender::missAggressiveDefendingContinueWalking() { state = SoldierState::AggressivedefendingWalkingToAggressor; - MissAggressiveDefendingWalk(); + missAggressiveDefendingWalk(); } -void nofAggressiveDefender::MissAggressiveDefendingWalk() +void nofAggressiveDefender::missAggressiveDefendingWalk() { if(!homeBld) { // Home destroyed so abort and wander around - InformTargetsAboutCancelling(); + informTargetsAboutCancelling(); state = SoldierState::FigureWork; - StartWandering(); - Wander(); + startWandering(); + wander(); return; } if(!attacked_goal) { // Similar when the defended building is gone - ReturnHomeMissionAggressiveDefending(); + returnHomeMissionAggressiveDefending(); return; } if(!attacker) { // Search for a new attacker if lost - MissionAggressiveDefendingLookForNewAggressor(); + missionAggressiveDefendingLookForNewAggressor(); return; } @@ -206,12 +206,12 @@ void nofAggressiveDefender::MissAggressiveDefendingWalk() { // Look for a new one cancelAtAttacker(); - MissionAggressiveDefendingLookForNewAggressor(); + missionAggressiveDefendingLookForNewAggressor(); return; } // Look for enemies - if(TryFightingNearbyEnemy()) + if(tryFightingNearbyEnemy()) { // Enemy found -> abort, because nofActiveSoldier handles all things now // Note it is ok, if the enemy is our attacker. @@ -223,37 +223,37 @@ void nofAggressiveDefender::MissAggressiveDefendingWalk() RTTR_Assert(pos != attacker->getPos()); // If so, why was it not found? // Calc next walking direction - const auto dir = world->FindHumanPath(pos, attacker->getPos(), 100, true); + const auto dir = world->findHumanPath(pos, attacker->getPos(), 100, true); if(dir) { // Continue walking towards him - StartWalking(*dir); + startWalking(*dir); } else { // No route found // Look for new attacker cancelAtAttacker(); - MissionAggressiveDefendingLookForNewAggressor(); + missionAggressiveDefendingLookForNewAggressor(); } } -void nofAggressiveDefender::ReturnHomeMissionAggressiveDefending() +void nofAggressiveDefender::returnHomeMissionAggressiveDefending() { - InformTargetsAboutCancelling(); - ReturnHome(); + informTargetsAboutCancelling(); + returnHome(); } -void nofAggressiveDefender::AttackerLost() +void nofAggressiveDefender::attackerLost() { RTTR_Assert(attacker); attacker = nullptr; // TODO(Replay) When still in leave queue abort to avoid going out and right back } -void nofAggressiveDefender::InformTargetsAboutCancelling() +void nofAggressiveDefender::informTargetsAboutCancelling() { - nofActiveSoldier::InformTargetsAboutCancelling(); + nofActiveSoldier::informTargetsAboutCancelling(); cancelAtAttacker(); cancelAtAttackedBld(); } @@ -263,12 +263,12 @@ void nofAggressiveDefender::cancelAtAttacker() if(attacker) { RTTR_Assert(attacker->getHuntingDefender() == this); - attacker->AggressiveDefenderLost(); + attacker->aggressiveDefenderLost(); attacker = nullptr; } } -nofActiveSoldier::SoldierState nofAggressiveDefender::FreeFightAborted() +nofActiveSoldier::SoldierState nofAggressiveDefender::freeFightAborted() { // Continue with normal walking towards our goal return SoldierState::AggressivedefendingWalkingToAggressor; diff --git a/libs/s25main/figures/nofAggressiveDefender.h b/libs/s25main/figures/nofAggressiveDefender.h index fd73a78a51..e50d5c8162 100644 --- a/libs/s25main/figures/nofAggressiveDefender.h +++ b/libs/s25main/figures/nofAggressiveDefender.h @@ -21,22 +21,22 @@ class nofAggressiveDefender : public nofActiveSoldier nobBaseMilitary* attacked_goal; /// wenn man gelaufen ist - void Walked() override; + void walked() override; /// Geht nach Haus für MAggressiveDefending-Mission - void ReturnHomeMissionAggressiveDefending(); + void returnHomeMissionAggressiveDefending(); /// Läuft wieter - void MissAggressiveDefendingWalk(); + void missAggressiveDefendingWalk(); /// Sucht sich für MissionAggressiveAttacking ein neues Ziel, wenns keins findet, gehts nach Hause - void MissionAggressiveDefendingLookForNewAggressor(); + void missionAggressiveDefendingLookForNewAggressor(); /// Sagt den verschiedenen Zielen Bescheid, dass wir doch nicht mehr kommen können - void InformTargetsAboutCancelling() override; + void informTargetsAboutCancelling() override; void cancelAtAttacker(); protected: - SoldierState FreeFightAborted() override; + SoldierState freeFightAborted() override; - [[noreturn]] void HandleDerivedEvent(unsigned) override { throw std::logic_error("No events expected"); } + [[noreturn]] void handleDerivedEvent(unsigned) override { throw std::logic_error("No events expected"); } public: nofAggressiveDefender(MapPoint pos, unsigned char player, nobBaseMilitary& home, unsigned char rank, @@ -46,30 +46,30 @@ class nofAggressiveDefender : public nofActiveSoldier ~nofAggressiveDefender() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofAggressivedefender; } /// Wenn ein Heimat-Militärgebäude bei Missionseinsätzen zerstört wurde - void HomeDestroyed() override; + void homeDestroyed() override; /// Wenn er noch in der Warteschleife vom Ausgangsgebäude hängt und dieses zerstört wurde - void HomeDestroyedAtBegin() override; + void homeDestroyedAtBegin() override; void cancelAtAttackedBld(); /// Wenn ein Kampf gewonnen wurde - void WonFighting() override; + void wonFighting() override; /// Wenn ein Kampf verloren wurde (Tod) - void LostFighting() override; + void lostFighting() override; /// Gebäude, das vom aggressiv-verteidigenden Soldaten verteidigt werden sollte, wurde zerstört - void AttackedGoalDestroyed(); + void attackedGoalDestroyed(); /// Soldat, der angehalten ist, um auf seinen Angreifer-Kollegen zu warten, soll jetzt weiterlaufen, da er um /// das Angriffsgebäude schon wartet - void MissAggressiveDefendingContinueWalking(); + void missAggressiveDefendingContinueWalking(); /// Wenn der jeweils andere Soldat, mit dem man kämpfen wollte, nicht mehr kommen kann - void AttackerLost(); + void attackerLost(); // Debugging const nofAttacker* getAttacker() const { return attacker; } diff --git a/libs/s25main/figures/nofArmorer.cpp b/libs/s25main/figures/nofArmorer.cpp index b34cd98216..303628ea9d 100644 --- a/libs/s25main/figures/nofArmorer.cpp +++ b/libs/s25main/figures/nofArmorer.cpp @@ -32,19 +32,19 @@ nofArmorer::nofArmorer(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id), sword_shield(sgd.PopBool()) {} -void nofArmorer::DrawWorking(DrawPoint drawPt) +void nofArmorer::drawWorking(DrawPoint drawPt) { constexpr helpers::EnumArray offsets = {{{-10, 15}, {-11, 9}, {-14, 16}, {-19, 1}, {-11, 9}}}; constexpr unsigned max_id = 280; - const unsigned now_id = GAMECLIENT.Interpolate(max_id, current_ev); + const unsigned now_id = GAMECLIENT.interpolate(max_id, current_ev); if(now_id < 200) { const Nation wpNation = workplace->getNation(); const unsigned plColor = world->getPlayer(player).color; LOADER.getPlayerImage("rom_bobs", 16 + (now_id % 8)) - ->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); + ->drawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); if((now_id % 8) == 5) { @@ -74,7 +74,7 @@ unsigned short nofArmorer::getCarryID() const } } -void nofArmorer::HandleDerivedEvent(const unsigned /*id*/) +void nofArmorer::handleDerivedEvent(const unsigned /*id*/) { switch(state) { @@ -83,11 +83,11 @@ void nofArmorer::HandleDerivedEvent(const unsigned /*id*/) if(!world->getGGS().isEnabled(AddonId::HALF_COST_MIL_EQUIP) || !sword_shield) { // LOG.write(("armorer handlewait1 - consume wares %i \n",player); - nofWorkman::HandleStateWaiting1(); + nofWorkman::handleStateWaiting1(); } else { // Nach 1. Warten wird gearbeitet - current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].work_length, 1); + current_ev = getEvMgr().addEvent(this, JOB_CONSTS[job_].work_length, 1); state = State::Work; workplace->is_working = true; // LOG.write(("armorer handlewait1 - no consume wares %i \n",player); @@ -96,24 +96,24 @@ void nofArmorer::HandleDerivedEvent(const unsigned /*id*/) break; case State::Work: { - HandleStateWork(); + handleStateWork(); } break; case State::Waiting2: { - HandleStateWaiting2(); + handleStateWaiting2(); } break; default: break; } } -bool nofArmorer::AreWaresAvailable() const +bool nofArmorer::areWaresAvailable() const { - return workplace->WaresAvailable() || (world->getGGS().isEnabled(AddonId::HALF_COST_MIL_EQUIP) && sword_shield); + return workplace->waresAvailable() || (world->getGGS().isEnabled(AddonId::HALF_COST_MIL_EQUIP) && sword_shield); } -helpers::OptionalEnum nofArmorer::ProduceWare() +helpers::OptionalEnum nofArmorer::produceWare() { sword_shield = !sword_shield; diff --git a/libs/s25main/figures/nofArmorer.h b/libs/s25main/figures/nofArmorer.h index 2342e10154..e79bd93236 100644 --- a/libs/s25main/figures/nofArmorer.h +++ b/libs/s25main/figures/nofArmorer.h @@ -17,14 +17,14 @@ class nofArmorer : public nofWorkman bool sword_shield; protected: - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override; /// Der Arbeiter erzeugt eine Ware - helpers::OptionalEnum ProduceWare() override; - void HandleDerivedEvent(unsigned id) override; + helpers::OptionalEnum produceWare() override; + void handleDerivedEvent(unsigned id) override; - bool AreWaresAvailable() const override; + bool areWaresAvailable() const override; public: nofArmorer(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofAttacker.cpp b/libs/s25main/figures/nofAttacker.cpp index 1c970aaec1..68f18cc471 100644 --- a/libs/s25main/figures/nofAttacker.cpp +++ b/libs/s25main/figures/nofAttacker.cpp @@ -31,20 +31,20 @@ nofAttacker::nofAttacker(const nofPassiveSoldier& other, nobBaseMilitary& attack : nofActiveSoldier(other, harbor ? SoldierState::SeaattackingGoToHarbor : SoldierState::AttackingWalkingToGoal), attacked_goal(&attacked_goal), mayBeHunted(true), canPlayerSendAggDefender(world->getNumPlayers(), SendDefender::Undecided), huntingDefender(nullptr), radius(0), - blocking_event(nullptr), harborPos(harbor ? harbor->getPos() : MapPoint::Invalid()), shipPos(MapPoint::Invalid()), + blocking_event(nullptr), harborPos(harbor ? harbor->getPos() : MapPoint::invalid()), shipPos(MapPoint::invalid()), ship_obj_id(0) { - attacked_goal.LinkAggressor(*this); + attacked_goal.linkAggressor(*this); } nofAttacker::~nofAttacker() = default; -void nofAttacker::Destroy() +void nofAttacker::destroy() { RTTR_Assert(!attacked_goal); RTTR_Assert(!ship_obj_id); RTTR_Assert(!huntingDefender); - nofActiveSoldier::Destroy(); + nofActiveSoldier::destroy(); /*unsigned char oplayer = (player == 0) ? 1 : 0; RTTR_Assert(!world->GetPlayer(oplayer).GetFirstWH()->Test(this));*/ @@ -56,14 +56,14 @@ void nofAttacker::Serialize(SerializedGameData& sgd) const if(state != SoldierState::WalkingHome && state != SoldierState::FigureWork) { - sgd.PushObject(attacked_goal); + sgd.pushObject(attacked_goal); sgd.PushBool(mayBeHunted); helpers::pushContainer(sgd, canPlayerSendAggDefender); - sgd.PushObject(huntingDefender, true); + sgd.pushObject(huntingDefender, true); sgd.PushUnsignedShort(radius); if(state == SoldierState::AttackingWaitingForDefender) - sgd.PushEvent(blocking_event); + sgd.pushEvent(blocking_event); helpers::pushPoint(sgd, harborPos); helpers::pushPoint(sgd, shipPos); @@ -80,21 +80,21 @@ nofAttacker::nofAttacker(SerializedGameData& sgd, const unsigned obj_id) : nofAc { if(state != SoldierState::WalkingHome && state != SoldierState::FigureWork) { - attacked_goal = sgd.PopObject(); + attacked_goal = sgd.popObject(); mayBeHunted = sgd.PopBool(); - sgd.PopContainer(canPlayerSendAggDefender); + sgd.popContainer(canPlayerSendAggDefender); RTTR_Assert(canPlayerSendAggDefender.size() == world->getNumPlayers()); - huntingDefender = sgd.PopObject(GO_Type::NofAggressivedefender); + huntingDefender = sgd.popObject(GO_Type::NofAggressivedefender); radius = sgd.PopUnsignedShort(); if(state == SoldierState::AttackingWaitingForDefender) - blocking_event = sgd.PopEvent(); + blocking_event = sgd.popEvent(); else blocking_event = nullptr; - harborPos = sgd.PopMapPoint(); - shipPos = sgd.PopMapPoint(); + harborPos = sgd.popMapPoint(); + shipPos = sgd.popMapPoint(); ship_obj_id = sgd.PopUnsignedInt(); } else { @@ -104,26 +104,26 @@ nofAttacker::nofAttacker(SerializedGameData& sgd, const unsigned obj_id) : nofAc huntingDefender = nullptr; radius = 0; blocking_event = nullptr; - harborPos = MapPoint::Invalid(); - shipPos = MapPoint::Invalid(); //-V656 + harborPos = MapPoint::invalid(); + shipPos = MapPoint::invalid(); //-V656 ship_obj_id = 0; } } -void nofAttacker::Walked() +void nofAttacker::walked() { - ExpelEnemies(); + expelEnemies(); switch(state) { - default: nofActiveSoldier::Walked(); break; - case SoldierState::AttackingWalkingToGoal: MissAttackingWalk(); break; + default: nofActiveSoldier::walked(); break; + case SoldierState::AttackingWalkingToGoal: missAttackingWalk(); break; case SoldierState::AttackingAttackingFlag: { // If target is destroyed go home if(!attacked_goal) { - ReturnHomeMissionAttacking(); + returnHomeMissionAttacking(); return; } @@ -151,28 +151,28 @@ void nofAttacker::Walked() if(defender) { // Start fight with the defender - world->AddFigure(pos, std::make_unique(*this, *defender)); + world->addFigure(pos, std::make_unique(*this, *defender)); state = SoldierState::AttackingFightingVsDefender; - defender->FightStarted(); + defender->fightStarted(); } else { // No defender at the flag? // -> Order new defenders or capture the building - ContinueAtFlag(); + continueAtFlag(); } } else { - const auto dir = world->FindHumanPath(pos, goalFlagPos, 5, true); + const auto dir = world->findHumanPath(pos, goalFlagPos, 5, true); if(dir) - StartWalking(*dir); + startWalking(*dir); else { // If there is no path anymore walk in the direction of the goal (or go back home) state = SoldierState::AttackingWalkingToGoal; - MissAttackingWalk(); + missAttackingWalk(); // Notify defender if any if(defender) - defender->AttackerArrested(); + defender->attackerArrested(); } } } @@ -182,19 +182,19 @@ void nofAttacker::Walked() if(!attacked_goal) { // Goal destroyed -> Go gome - ReturnHomeMissionAttacking(); + returnHomeMissionAttacking(); return; } // If there is a defender available then an enemy soldier went back in - if(attacked_goal->DefendersAvailable()) + if(attacked_goal->defendersAvailable()) { // Go back out if(attacked_goal->getGOT() == GO_Type::NobMilitary) - static_cast(attacked_goal)->StopCapturing(); + static_cast(attacked_goal)->stopCapturing(); state = SoldierState::AttackingWalkingToGoal; - StartWalking(Direction::SouthEast); + startWalking(Direction::SouthEast); } else { // Did we just conquer a "regular" military building? @@ -203,38 +203,38 @@ void nofAttacker::Walked() RTTR_Assert(dynamic_cast(attacked_goal)); // We will now have this building as the new home, so inform old home, hunting soldier and ship if(homeBld) - homeBld->SoldierLost(this); + homeBld->soldierLost(this); cancelAtHuntingDefender(); if(ship_obj_id) cancelAtShip(); // Store the goal in a temporary as attacked_goal will be reset auto* goal = static_cast(attacked_goal); - goal->Capture(player); + goal->capture(player); homeBld = attacked_goal; - attacked_goal->AddActiveSoldier(world->RemoveFigure(pos, *this)); - RemoveFromAttackedGoal(); + attacked_goal->addActiveSoldier(world->RemoveFigure(pos, *this)); + removeFromAttackedGoal(); // This might call other capturers - goal->CapturingSoldierArrived(); + goal->capturingSoldierArrived(); } else // Something like HQ or harbor { // Inform the owner of the building and destroy it const std::string msg = (attacked_goal->getGOT() == GO_Type::NobHq) ? _("Our headquarters was destroyed!") : _("This harbor building was destroyed"); - SendPostMessage(attacked_goal->getPlayer(), + sendPostMessage(attacked_goal->getPlayer(), std::make_unique(getEvMgr().getCurrentGF(), msg, PostCategory::Military, *attacked_goal)); nobBaseMilitary* tmp_goal = attacked_goal; // Store in a temporary in case it gets reset by Destroy - tmp_goal->Destroy(); + tmp_goal->destroy(); delete tmp_goal; attacked_goal = nullptr; - ReturnHomeMissionAttacking(); + returnHomeMissionAttacking(); } } } break; - case SoldierState::AttackingCapturingNext: CapturingWalking(); break; + case SoldierState::AttackingCapturingNext: capturingWalking(); break; case SoldierState::SeaattackingGoToHarbor: { @@ -245,28 +245,28 @@ void nofAttacker::Walked() if(!valid_harbor || !attacked_goal) { - ReturnHomeMissionAttacking(); + returnHomeMissionAttacking(); return; } if(pos == harborPos) // When we arrived add to harbor { state = SoldierState::SeaattackingWaitInHarbor; - world->getSpecObj(pos)->AddSeaAttacker(world->RemoveFigure(pos, *this)); + world->getSpecObj(pos)->addSeaAttacker(world->RemoveFigure(pos, *this)); } else // Go to flag then walk inside the building { const MapPoint harborFlagPos = world->getNeighbour(harborPos, Direction::SouthEast); if(pos == harborFlagPos) - StartWalking(Direction::NorthWest); + startWalking(Direction::NorthWest); else { const auto dir = - world->FindHumanPath(pos, harborFlagPos, MAX_ATTACKING_RUN_DISTANCE, false, nullptr); + world->findHumanPath(pos, harborFlagPos, MAX_ATTACKING_RUN_DISTANCE, false, nullptr); if(dir) - StartWalking(*dir); + startWalking(*dir); else - ReturnHomeMissionAttacking(); // No possible path -> Abort + returnHomeMissionAttacking(); // No possible path -> Abort } } } @@ -280,7 +280,7 @@ void nofAttacker::Walked() } } -void nofAttacker::HomeDestroyed() +void nofAttacker::homeDestroyed() { // If we are waiting, no events will trigger -> Start wandering right now, // else continue current event (e.g. movement) and handle at the end of that @@ -288,17 +288,17 @@ void nofAttacker::HomeDestroyed() { // We are lost now so no valid source or target of attacks nobBaseMilitary* curGoal = attacked_goal; // attacked_goal gets reset - InformTargetsAboutCancelling(); + informTargetsAboutCancelling(); if(ship_obj_id) cancelAtShip(); homeBld = nullptr; state = SoldierState::FigureWork; - StartWandering(); - Wander(); + startWandering(); + wander(); // Someone else might take this place - curGoal->SendSuccessor(pos, radius); + curGoal->sendSuccessor(pos, radius); } else { // If we were going back home, reset that goal @@ -308,44 +308,44 @@ void nofAttacker::HomeDestroyed() } } -void nofAttacker::HomeDestroyedAtBegin() +void nofAttacker::homeDestroyedAtBegin() { homeBld = nullptr; // We are lost now and hence not targetable - InformTargetsAboutCancelling(); + informTargetsAboutCancelling(); state = SoldierState::FigureWork; - StartWandering(); - StartWalking(RANDOM_ENUM(Direction)); + startWandering(); + startWalking(RANDOM_ENUM(Direction)); } -void nofAttacker::WonFighting() +void nofAttacker::wonFighting() { if(world->getGGS().isEnabled(AddonId::BATTLEFIELD_PROMOTION)) - IncreaseRank(); + increaseRank(); // If our home was destroyed then we are lost // unless we are currently fighting at the flag so that building can become our new home if(!homeBld && state != SoldierState::AttackingFightingVsDefender) { // Lost -> Tell all dependents - InformTargetsAboutCancelling(); + informTargetsAboutCancelling(); if(ship_obj_id) cancelAtShip(); state = SoldierState::FigureWork; - StartWandering(); - Wander(); + startWandering(); + wander(); } else if(!attacked_goal) { // Target is gone -> Go home - ReturnHomeMissionAttacking(); + returnHomeMissionAttacking(); } else - ContinueAtFlag(); + continueAtFlag(); } -void nofAttacker::ContinueAtFlag() +void nofAttacker::continueAtFlag() { RTTR_Assert(attacked_goal); // If we were fighting at the flag of the goal then call a new defender @@ -353,59 +353,59 @@ void nofAttacker::ContinueAtFlag() if(state == SoldierState::AttackingFightingVsDefender || (state == SoldierState::Fighting && attacked_goal->getFlagPos() == pos)) { - if(attacked_goal->CallDefender(*this)) //-V522 - SwitchStateAttackingWaitingForDefender(); - else if(!TryFightingNearbyEnemy(attacked_goal->getPlayer())) + if(attacked_goal->callDefender(*this)) //-V522 + switchStateAttackingWaitingForDefender(); + else if(!tryFightingNearbyEnemy(attacked_goal->getPlayer())) { // No defender or soldiers of other non-friendly non-owner players to fight // -> Enter building state = SoldierState::AttackingCapturingFirst; - StartWalking(Direction::NorthWest); + startWalking(Direction::NorthWest); // Regular military buildings will be captured if(attacked_goal->getGOT() == GO_Type::NobMilitary) - static_cast(attacked_goal)->PrepareCapturing(); + static_cast(attacked_goal)->prepareCapturing(); } } else { // Go (back) to goal state = SoldierState::AttackingWalkingToGoal; - MissAttackingWalk(); + missAttackingWalk(); } } -void nofAttacker::LostFighting() +void nofAttacker::lostFighting() { // Inform home building (so e.g. new troops can be ordered) and all dependents - AbrogateWorkplace(); - InformTargetsAboutCancelling(); + abrogateWorkplace(); + informTargetsAboutCancelling(); if(ship_obj_id) this->cancelAtShip(); } -void nofAttacker::ReturnHomeMissionAttacking() +void nofAttacker::returnHomeMissionAttacking() { - InformTargetsAboutCancelling(); // We don't attack anymore + informTargetsAboutCancelling(); // We don't attack anymore if(ship_obj_id) { state = SoldierState::SeaattackingReturnToShip; handleStateSeaAttackReturnToShip(); } else - ReturnHome(); + returnHome(); } -void nofAttacker::MissAttackingWalk() +void nofAttacker::missAttackingWalk() { // If our home is destroyed we are lost if(!homeBld) { - InformTargetsAboutCancelling(); + informTargetsAboutCancelling(); if(ship_obj_id) cancelAtShip(); state = SoldierState::FigureWork; - StartWandering(); - Wander(); + startWandering(); + wander(); return; } @@ -413,33 +413,33 @@ void nofAttacker::MissAttackingWalk() // When target is gone go home if(!attacked_goal) { - ReturnHomeMissionAttacking(); + returnHomeMissionAttacking(); return; } // Find a position next to the target - const MapPoint goal = attacked_goal->FindAnAttackerPlace(radius, *this); + const MapPoint goal = attacked_goal->findAnAttackerPlace(radius, *this); if(!goal.isValid()) // Go home if there is no free spot - ReturnHomeMissionAttacking(); + returnHomeMissionAttacking(); else if(pos == goal) - ReachedDestination(); - else if(!TryFightingNearbyEnemy()) + reachedDestination(); + else if(!tryFightingNearbyEnemy()) { // If no Enemy (attackers, aggressive defenders..) was found (would be handled by nofActiveSoldier) // check if some building might send a defender and walk to goal - TryToOrderAggressiveDefender(); + tryToOrderAggressiveDefender(); - const auto dir = world->FindHumanPath(pos, goal, MAX_ATTACKING_RUN_DISTANCE, true); + const auto dir = world->findHumanPath(pos, goal, MAX_ATTACKING_RUN_DISTANCE, true); if(dir) - StartWalking(*dir); + startWalking(*dir); else - ReturnHomeMissionAttacking(); + returnHomeMissionAttacking(); } } -void nofAttacker::ReachedDestination() +void nofAttacker::reachedDestination() { // Are we at the flag of the target? const MapPoint attFlagPos = attacked_goal->getFlagPos(); @@ -454,27 +454,27 @@ void nofAttacker::ReachedDestination() auto* goal = static_cast(attacked_goal); RTTR_Assert(goal->isFarAwayCapturer(*this)); // Start walking first so the flag is free - StartWalking(Direction::NorthWest); + startWalking(Direction::NorthWest); // Then tell the building - goal->FarAwayCapturerReachedGoal(*this, true); + goal->farAwayCapturerReachedGoal(*this, true); } else { // Notify player // TODO: Possibly improve that not every attacker does that - SendPostMessage(attacked_goal->getPlayer(), + sendPostMessage(attacked_goal->getPlayer(), std::make_unique(getEvMgr().getCurrentGF(), _("We are under attack!"), PostCategory::Military, *attacked_goal)); // Get a defender or walk into the building - if(attacked_goal->CallDefender(*this)) - SwitchStateAttackingWaitingForDefender(); + if(attacked_goal->callDefender(*this)) + switchStateAttackingWaitingForDefender(); else { state = SoldierState::AttackingCapturingFirst; - StartWalking(Direction::NorthWest); + startWalking(Direction::NorthWest); // Regular military buildings will be captured if(attacked_goal->getGOT() == GO_Type::NobMilitary) - static_cast(attacked_goal)->PrepareCapturing(); + static_cast(attacked_goal)->prepareCapturing(); } } } else @@ -503,7 +503,7 @@ void nofAttacker::ReachedDestination() dir = (pos.x < attFlagPos.x) ? Direction::SouthEast : Direction::SouthWest; else // pos.y > attFlagPos.y dir = (pos.x < attFlagPos.x) ? Direction::NorthEast : Direction::NorthWest; - FaceDir(dir); + faceDir(dir); if(attacked_goal->getPlayer() == player) { // Building already captured? -> Then we might be a far-away-capturer @@ -511,33 +511,33 @@ void nofAttacker::ReachedDestination() RTTR_Assert(dynamic_cast(attacked_goal)); auto* goal = static_cast(attacked_goal); if(goal->isFarAwayCapturer(*this)) - goal->FarAwayCapturerReachedGoal(*this, false); + goal->farAwayCapturerReachedGoal(*this, false); } } } -void nofAttacker::TryToOrderAggressiveDefender() +void nofAttacker::tryToOrderAggressiveDefender() { RTTR_Assert(state == SoldierState::AttackingWalkingToGoal); if(mayBeHunted) { // 20% chance to get one if(RANDOM_RAND(10) < 2) - OrderAggressiveDefender(); + orderAggressiveDefender(); } } -void nofAttacker::OrderAggressiveDefender() +void nofAttacker::orderAggressiveDefender() { // Any military building in at most this distance could send a defender constexpr auto maxDistance = 14; - sortedMilitaryBlds buildings = world->LookForMilitaryBuildings(pos, 2); + sortedMilitaryBlds buildings = world->lookForMilitaryBuildings(pos, 2); for(nobBaseMilitary* bld : buildings) { // Exclude HQs unless the one being attacked if(bld->getBuildingType() == BuildingType::Headquarters && bld != attacked_goal) continue; - if(world->CalcDistance(pos, bld->getPos()) > maxDistance) + if(world->calcDistance(pos, bld->getPos()) > maxDistance) continue; const unsigned bldOwnerId = bld->getPlayer(); if(canPlayerSendAggDefender[bldOwnerId] == SendDefender::No) @@ -553,7 +553,7 @@ void nofAttacker::OrderAggressiveDefender() // that the player changed the setting when the defender is asked for if(canPlayerSendAggDefender[bldOwnerId] == SendDefender::Undecided) { - if(bldOwner.ShouldSendDefender()) + if(bldOwner.shouldSendDefender()) canPlayerSendAggDefender[bldOwnerId] = SendDefender::Yes; else { @@ -561,7 +561,7 @@ void nofAttacker::OrderAggressiveDefender() continue; } } - huntingDefender = bld->SendAggressiveDefender(*this); + huntingDefender = bld->sendAggressiveDefender(*this); if(huntingDefender) { // Cannot be hunted again @@ -571,7 +571,7 @@ void nofAttacker::OrderAggressiveDefender() } } -void nofAttacker::AttackedGoalDestroyed() +void nofAttacker::attackedGoalDestroyed() { attacked_goal = nullptr; @@ -592,19 +592,19 @@ void nofAttacker::AttackedGoalDestroyed() // If waiting start moving if(state == SoldierState::AttackingWaitingForDefender || state == SoldierState::AttackingWaitingAroundBuilding || state == SoldierState::WaitingForFight) - ReturnHomeMissionAttacking(); + returnHomeMissionAttacking(); if(was_waiting_for_defender) { - getEvMgr().RemoveEvent(blocking_event); - world->RoadNodeAvailable(pos); + getEvMgr().removeEvent(blocking_event); + world->roadNodeAvailable(pos); } } } -bool nofAttacker::AttackDefenderAtFlag() +bool nofAttacker::attackDefenderAtFlag() { // Walk to flag if possible - const auto dir = world->FindHumanPath(pos, attacked_goal->getFlagPos(), 3, true); + const auto dir = world->findHumanPath(pos, attacked_goal->getFlagPos(), 3, true); if(dir) { const bool waiting_around_building = (state == SoldierState::AttackingWaitingAroundBuilding); @@ -612,36 +612,36 @@ bool nofAttacker::AttackDefenderAtFlag() if(waiting_around_building) { - StartWalking(*dir); - attacked_goal->SendSuccessor(pos, radius); + startWalking(*dir); + attacked_goal->sendSuccessor(pos, radius); } return true; } else { state = nofActiveSoldier::SoldierState::AttackingWalkingToGoal; - MissAttackingWalk(); + missAttackingWalk(); return false; } } -void nofAttacker::AttackFlag() +void nofAttacker::attackFlag() { state = SoldierState::AttackingWalkingToGoal; - MissAttackingWalk(); + missAttackingWalk(); } -void nofAttacker::CaptureBuilding() +void nofAttacker::captureBuilding() { state = SoldierState::AttackingCapturingNext; - CapturingWalking(); + capturingWalking(); } -void nofAttacker::CapturingWalking() +void nofAttacker::capturingWalking() { // If building is gone go home if(!attacked_goal) { - ReturnHomeMissionAttacking(); + returnHomeMissionAttacking(); return; } RTTR_Assert(dynamic_cast(attacked_goal)); @@ -656,12 +656,12 @@ void nofAttacker::CapturingWalking() { // We switch buildings if(homeBld) - homeBld->SoldierLost(this); + homeBld->soldierLost(this); cancelAtHuntingDefender(); if(ship_obj_id) cancelAtShip(); homeBld = attacked_goal; - attacked_goal->AddActiveSoldier(world->RemoveFigure(pos, *this)); + attacked_goal->addActiveSoldier(world->RemoveFigure(pos, *this)); // No longer attacking if(BuildingProperties::isMilitary(attacked_goal->getBuildingType())) @@ -673,20 +673,20 @@ void nofAttacker::CapturingWalking() if(goal->isFarAwayCapturer(*this)) { RTTR_Assert(goal->getPlayer() == player); - RemoveFromAttackedGoal(); + removeFromAttackedGoal(); } else { - RemoveFromAttackedGoal(); - goal->CapturingSoldierArrived(); + removeFromAttackedGoal(); + goal->capturingSoldierArrived(); } } else - RemoveFromAttackedGoal(); + removeFromAttackedGoal(); } else if(pos == attFlagPos) { // Go into the building and call next one for reinforcement - StartWalking(Direction::NorthWest); + startWalking(Direction::NorthWest); RTTR_Assert(attacked_goal->getPlayer() == player); // Assumed by the call below - static_cast(attacked_goal)->NeedOccupyingTroops(); + static_cast(attacked_goal)->needOccupyingTroops(); } else if(!homeBld) { // If our home is destroyed we are lost and don't walk to the target (our new home if we were at least at the @@ -694,35 +694,35 @@ void nofAttacker::CapturingWalking() if(attacked_goal) { auto* attackedBld = static_cast(attacked_goal); - RemoveFromAttackedGoal(); + removeFromAttackedGoal(); // Reinforce building (should be already ours) RTTR_Assert(attackedBld->getPlayer() == player); - attackedBld->NeedOccupyingTroops(); + attackedBld->needOccupyingTroops(); } if(ship_obj_id) cancelAtShip(); state = SoldierState::FigureWork; - StartWandering(); - Wander(); + startWandering(); + wander(); } else { // Our home still exists so walk to the flag of the building if possible - const auto dir = world->FindHumanPath(pos, attFlagPos, 10, true); + const auto dir = world->findHumanPath(pos, attFlagPos, 10, true); if(dir) - StartWalking(*dir); + startWalking(*dir); else { // Call other troops to occupy the building instead and go home RTTR_Assert(attacked_goal->getPlayer() == player); // Assumed by the call below - static_cast(attacked_goal)->NeedOccupyingTroops(); - ReturnHomeMissionAttacking(); + static_cast(attacked_goal)->needOccupyingTroops(); + returnHomeMissionAttacking(); } } } -void nofAttacker::CapturedBuildingFull() +void nofAttacker::capturedBuildingFull() { // Reset goal, no longer our business attacked_goal = nullptr; @@ -730,23 +730,23 @@ void nofAttacker::CapturedBuildingFull() // We only need to do something when we are currently waiting, // otherwise the next steps are handled when our current action (walk, fight) is finished if(state == SoldierState::AttackingWaitingAroundBuilding) - ReturnHomeMissionAttacking(); + returnHomeMissionAttacking(); } -void nofAttacker::StartSucceeding(const MapPoint /*pt*/, unsigned short /*new_radius*/) +void nofAttacker::startSucceeding(const MapPoint /*pt*/, unsigned short /*new_radius*/) { state = SoldierState::AttackingWalkingToGoal; const auto oldPos = pos; const auto oldRadius = radius; - MissAttackingWalk(); + missAttackingWalk(); if(isMoving()) - attacked_goal->SendSuccessor(oldPos, oldRadius); + attacked_goal->sendSuccessor(oldPos, oldRadius); } -void nofAttacker::LetsFight(nofAggressiveDefender& other) +void nofAttacker::letsFight(nofAggressiveDefender& other) { RTTR_Assert(!huntingDefender); // We only get hunted once @@ -754,26 +754,26 @@ void nofAttacker::LetsFight(nofAggressiveDefender& other) huntingDefender = &other; } -void nofAttacker::AggressiveDefenderLost() +void nofAttacker::aggressiveDefenderLost() { RTTR_Assert(huntingDefender); huntingDefender = nullptr; } -void nofAttacker::SwitchStateAttackingWaitingForDefender() +void nofAttacker::switchStateAttackingWaitingForDefender() { state = SoldierState::AttackingWaitingForDefender; - blocking_event = getEvMgr().AddEvent(this, BLOCK_OFFSET, 5); + blocking_event = getEvMgr().addEvent(this, BLOCK_OFFSET, 5); } -void nofAttacker::HandleDerivedEvent(const unsigned /*id*/) +void nofAttacker::handleDerivedEvent(const unsigned /*id*/) { RTTR_Assert(blocking_event); // If we are still waiting (we could be walking again if building was destroyed) // stop figures walking to this position if(state == SoldierState::AttackingWaitingForDefender) { - world->StopOnRoads(pos); + world->stopOnRoads(pos); blocking_event = nullptr; } } @@ -787,17 +787,17 @@ bool nofAttacker::isBlockingRoads() const return blocking_event == nullptr; } -void nofAttacker::InformTargetsAboutCancelling() +void nofAttacker::informTargetsAboutCancelling() { - nofActiveSoldier::InformTargetsAboutCancelling(); + nofActiveSoldier::informTargetsAboutCancelling(); cancelAtHuntingDefender(); if(attacked_goal) - RemoveFromAttackedGoal(); + removeFromAttackedGoal(); RTTR_Assert(attacked_goal == nullptr); } -void nofAttacker::RemoveFromAttackedGoal() +void nofAttacker::removeFromAttackedGoal() { // If state == AttackingFightingVsDefender then we probably just lost the fight against the defender, // otherwise there must either be no defender or he is not waiting for us @@ -807,42 +807,42 @@ void nofAttacker::RemoveFromAttackedGoal() // No defender should be chasing us at this point for(auto* it : attacked_goal->getAggresiveDefenders()) RTTR_Assert(it->getAttacker() != this); - attacked_goal->UnlinkAggressor(*this); + attacked_goal->unlinkAggressor(*this); attacked_goal = nullptr; } -void nofAttacker::StartAttackOnOtherIsland(const MapPoint shipPos, const unsigned ship_id) +void nofAttacker::startAttackOnOtherIsland(const MapPoint shipPos, const unsigned ship_id) { pos = this->shipPos = shipPos; this->ship_obj_id = ship_id; state = SoldierState::AttackingWalkingToGoal; on_ship = false; - MissAttackingWalk(); + missAttackingWalk(); } -void nofAttacker::SeaAttackFailedBeforeLaunch() +void nofAttacker::seaAttackFailedBeforeLaunch() { - InformTargetsAboutCancelling(); + informTargetsAboutCancelling(); RTTR_Assert(!huntingDefender); - AbrogateWorkplace(); + abrogateWorkplace(); goal_ = nullptr; state = SoldierState::FigureWork; } -void nofAttacker::StartReturnViaShip(noShip& ship) +void nofAttacker::startReturnViaShip(noShip& ship) { if(pos.isValid()) { - ship.AddReturnedAttacker(world->RemoveFigure(pos, *this)); - pos = MapPoint::Invalid(); // Similar to start ship journey + ship.addReturnedAttacker(world->RemoveFigure(pos, *this)); + pos = MapPoint::invalid(); // Similar to start ship journey } else { // If pos is not valid, then we are still on the ship! // This can happen, if the ship cannot reach its target RTTR_Assert(state == SoldierState::SeaattackingOnShip); RTTR_Assert(ship.isOnBoard(*this)); - InformTargetsAboutCancelling(); + informTargetsAboutCancelling(); } goal_ = homeBld; @@ -852,7 +852,7 @@ void nofAttacker::StartReturnViaShip(noShip& ship) ship_obj_id = 0; } -void nofAttacker::HomeHarborLost() +void nofAttacker::homeHarborLost() { // this in combination with telling the home building that the soldier is lost should work just fine goal_ = nullptr; @@ -864,7 +864,7 @@ void nofAttacker::cancelAtShip() { if(figure.getObjId() == ship_obj_id) { - static_cast(figure).SeaAttackerWishesNoReturn(); + static_cast(figure).seaAttackerWishesNoReturn(); break; } } @@ -876,7 +876,7 @@ void nofAttacker::cancelAtHuntingDefender() if(huntingDefender) { RTTR_Assert(huntingDefender->getAttacker() == this); - huntingDefender->AttackerLost(); + huntingDefender->attackerLost(); huntingDefender = nullptr; } } @@ -887,8 +887,8 @@ void nofAttacker::handleStateSeaAttackReturnToShip() { // Home destroyed -> start wandering state = SoldierState::FigureWork; - StartWandering(); - Wander(); + startWandering(); + wander(); cancelAtShip(); } else if(pos == shipPos) // Arrived at ship @@ -897,7 +897,7 @@ void nofAttacker::handleStateSeaAttackReturnToShip() { if(figure.getObjId() == ship_obj_id) { - StartReturnViaShip(static_cast(figure)); + startReturnViaShip(static_cast(figure)); return; } } @@ -905,23 +905,23 @@ void nofAttacker::handleStateSeaAttackReturnToShip() // Ship is gone, shouldn't happen! RTTR_Assert(false); ship_obj_id = 0; - StartWandering(); + startWandering(); state = SoldierState::FigureWork; - Wander(); + wander(); } else { - const auto dir = world->FindHumanPath(pos, shipPos, MAX_ATTACKING_RUN_DISTANCE); + const auto dir = world->findHumanPath(pos, shipPos, MAX_ATTACKING_RUN_DISTANCE); if(dir) - StartWalking(*dir); + startWalking(*dir); else { // No path -> wander around - StartWandering(); + startWandering(); state = SoldierState::FigureWork; - Wander(); + wander(); // Notify home and ship - homeBld->SoldierLost(this); + homeBld->soldierLost(this); cancelAtShip(); } } @@ -929,12 +929,12 @@ void nofAttacker::handleStateSeaAttackReturnToShip() void nofAttacker::cancelSeaAttack() { - InformTargetsAboutCancelling(); + informTargetsAboutCancelling(); RTTR_Assert(!huntingDefender); - Abrogate(); + abrogate(); } -nofActiveSoldier::SoldierState nofAttacker::FreeFightAborted() +nofActiveSoldier::SoldierState nofAttacker::freeFightAborted() { // Continue with normal walking towards our goal return SoldierState::AttackingWalkingToGoal; @@ -947,7 +947,7 @@ bool nofAttacker::canStartFarAwayCapturing(const nobMilitary& dest) const || state == SoldierState::WaitingForFight || state == SoldierState::Fighting) { // Not too far away? - if(world->CalcDistance(pos, dest.getPos()) < MAX_FAR_AWAY_CAPTURING_DISTANCE) + if(world->calcDistance(pos, dest.getPos()) < MAX_FAR_AWAY_CAPTURING_DISTANCE) return true; } diff --git a/libs/s25main/figures/nofAttacker.h b/libs/s25main/figures/nofAttacker.h index 98ea852284..670aae1575 100644 --- a/libs/s25main/figures/nofAttacker.h +++ b/libs/s25main/figures/nofAttacker.h @@ -49,25 +49,25 @@ class nofAttacker : public nofActiveSoldier MapPoint shipPos; unsigned ship_obj_id; - void Walked() override; + void walked() override; /// Go home from an attack - void ReturnHomeMissionAttacking(); + void returnHomeMissionAttacking(); /// Continue walking during an attack - void MissAttackingWalk(); + void missAttackingWalk(); /// Reached target military building - void ReachedDestination(); + void reachedDestination(); /// Handle next step of walking into an already captured building - void CapturingWalking(); + void capturingWalking(); /// Find a defender (coming out of a building, i.e. not the main defender at the flag) with a certain chance - void TryToOrderAggressiveDefender(); + void tryToOrderAggressiveDefender(); /// Actually do order an aggressive defender - void OrderAggressiveDefender(); + void orderAggressiveDefender(); /// Doesn't find a defender at the flag -> Send defenders or capture it - void ContinueAtFlag(); + void continueAtFlag(); /// Start waiting for a defender (at the flag) and register the block event - void SwitchStateAttackingWaitingForDefender(); + void switchStateAttackingWaitingForDefender(); /// Sea attackers: Notify ship that this soldier is not coming any more void cancelAtShip(); @@ -76,13 +76,13 @@ class nofAttacker : public nofActiveSoldier void handleStateSeaAttackReturnToShip(); protected: - SoldierState FreeFightAborted() override; + SoldierState freeFightAborted() override; public: /// Notify all targets (or those that target us) that we won't be coming anymore - void InformTargetsAboutCancelling() override; + void informTargetsAboutCancelling() override; - void RemoveFromAttackedGoal(); + void removeFromAttackedGoal(); /// Create an attacker from a passive soldier, if harbor is set, the soldier will first walk there for a sea attack nofAttacker(const nofPassiveSoldier& other, nobBaseMilitary& attacked_goal, @@ -90,47 +90,47 @@ class nofAttacker : public nofActiveSoldier nofAttacker(SerializedGameData& sgd, unsigned obj_id); ~nofAttacker() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofAttacker; } const nofAggressiveDefender* getHuntingDefender() const { return huntingDefender; } - void HandleDerivedEvent(unsigned id) override; + void handleDerivedEvent(unsigned id) override; /// Return whether the roads to the position of this soldier cannot be used bool isBlockingRoads() const; /// Notify the soldier about the destruction of the home building - void HomeDestroyed() override; + void homeDestroyed() override; /// Notify the soldier that the home building was destroyed while he was waiting to leave - void HomeDestroyedAtBegin() override; + void homeDestroyedAtBegin() override; /// Called when a fight was won - void WonFighting() override; + void wonFighting() override; /// Called when a fight was lost (i.e. the soldier will die) - void LostFighting() override; + void lostFighting() override; /// Notify that the target building gone - void AttackedGoalDestroyed(); + void attackedGoalDestroyed(); /// The aggressive defender won't chase this soldier anymore - void AggressiveDefenderLost(); + void aggressiveDefenderLost(); /// Go to the defender waiting at the flag - bool AttackDefenderAtFlag(); + bool attackDefenderAtFlag(); /// Go to the flag without an available defender (e.g. just freed after a fight) - void AttackFlag(); + void attackFlag(); /// Go into a building that was just captured. - void CaptureBuilding(); + void captureBuilding(); /// Notification that the captured building is full - void CapturedBuildingFull(); + void capturedBuildingFull(); /// Return the distance to the flag at which the soldier is waiting unsigned getRadius() const { return radius; } /// A waiting soldier should move closer to the flag to fill gaps - void StartSucceeding(MapPoint pt, unsigned short new_radius); + void startSucceeding(MapPoint pt, unsigned short new_radius); /// Return if this soldier is available to occupy the captured building bool canStartFarAwayCapturing(const nobMilitary& dest) const; /// The aggressive defender is going to fight with this soldier - void LetsFight(nofAggressiveDefender& other); + void letsFight(nofAggressiveDefender& other); /// Return if this attacker waits around the building for a fight bool isAttackerReady() const { return (state == SoldierState::AttackingWaitingAroundBuilding); } @@ -139,18 +139,18 @@ class nofAttacker : public nofActiveSoldier nobBaseMilitary* getAttackedGoal() const { return attacked_goal; } /// Start attack from anchor point of the ship - void StartAttackOnOtherIsland(MapPoint shipPos, unsigned ship_id); + void startAttackOnOtherIsland(MapPoint shipPos, unsigned ship_id); /// Call attacker back to the ship - void StartReturnViaShip(noShip& ship); + void startReturnViaShip(noShip& ship); /// Notification in a harbor before boarding a ship to the fight that e.g. the ship has no longer a valid route or /// target - void SeaAttackFailedBeforeLaunch(); + void seaAttackFailedBeforeLaunch(); /// Tell soldier the sea attack failed and they can't go home either void cancelSeaAttack(); /// notify sea attackers that they wont return home - void HomeHarborLost(); + void homeHarborLost(); /// Notification that the attacker is now on a ship - void SeaAttackStarted() { state = SoldierState::SeaattackingOnShip; } + void seaAttackStarted() { state = SoldierState::SeaattackingOnShip; } /// Return whether the soldier is on a ship waiting to attack, i.e. not already back from a fight bool isSeaAttackCompleted() const { return (state != SoldierState::SeaattackingOnShip); } }; diff --git a/libs/s25main/figures/nofBaker.cpp b/libs/s25main/figures/nofBaker.cpp index 3c28690136..84a7aa8a44 100644 --- a/libs/s25main/figures/nofBaker.cpp +++ b/libs/s25main/figures/nofBaker.cpp @@ -20,7 +20,7 @@ nofBaker::nofBaker(const MapPoint pos, const unsigned char player, nobUsual* wor nofBaker::nofBaker(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id) {} -void nofBaker::DrawWorking(DrawPoint drawPt) +void nofBaker::drawWorking(DrawPoint drawPt) { constexpr helpers::EnumArray workOffset = {{{40, -4}, {-16, 8}, {-5, 9}, {-8, 7}, {-16, 8}}}; constexpr helpers::EnumArray, Nation> walkOffsets = { @@ -42,7 +42,7 @@ void nofBaker::DrawWorking(DrawPoint drawPt) Direction::NorthWest}}}; unsigned max_id = 120; - unsigned now_id = GAMECLIENT.Interpolate(max_id, current_ev); + unsigned now_id = GAMECLIENT.interpolate(max_id, current_ev); const Nation wpNation = workplace->getNation(); unsigned plColor = world->getPlayer(player).color; @@ -53,13 +53,13 @@ void nofBaker::DrawWorking(DrawPoint drawPt) if(now_id < 2) // hinauslaufen teil 1 { - LOADER.building_cache[wpNation][BuildingType::Bakery].door.DrawFull(drawPt); + LOADER.building_cache[wpNation][BuildingType::Bakery].door.drawFull(drawPt); LOADER.getBobSprite(wpNation, Job::Baker, walkdirection[wpNation][0], now_id) .draw(walkOutPos, COLOR_WHITE, plColor); } if((now_id >= 2) && (now_id < 4)) // hinauslaufen teil 2 { - LOADER.building_cache[wpNation][BuildingType::Bakery].door.DrawFull(drawPt); + LOADER.building_cache[wpNation][BuildingType::Bakery].door.drawFull(drawPt); LOADER.getBobSprite(wpNation, Job::Baker, walkdirection[wpNation][1], now_id) .draw(walkOutPos, COLOR_WHITE, plColor); } @@ -71,7 +71,7 @@ void nofBaker::DrawWorking(DrawPoint drawPt) if((now_id >= 8) && (now_id < 16)) // brot in den ofen schieben { LOADER.getPlayerImage("rom_bobs", 182 + (now_id - 8)) - ->DrawFull(drawPt + workOffset[wpNation], COLOR_WHITE, plColor); + ->drawFull(drawPt + workOffset[wpNation], COLOR_WHITE, plColor); // "Brot-rein/raus"-Sound if((now_id % 8) == 4) @@ -82,12 +82,12 @@ void nofBaker::DrawWorking(DrawPoint drawPt) } if((now_id >= 16) && (now_id < max_id - 16)) // warten { - LOADER.getPlayerImage("rom_bobs", 189)->DrawFull(drawPt + workOffset[wpNation], COLOR_WHITE, plColor); + LOADER.getPlayerImage("rom_bobs", 189)->drawFull(drawPt + workOffset[wpNation], COLOR_WHITE, plColor); } if((now_id >= max_id - 16) && (now_id < max_id - 8)) // brot aus dem ofen holen { LOADER.getPlayerImage("rom_bobs", 182 + 7 - (now_id % 8)) - ->DrawFull(drawPt + workOffset[wpNation], COLOR_WHITE, plColor); + ->drawFull(drawPt + workOffset[wpNation], COLOR_WHITE, plColor); // "Brot-rein/raus"-Sound if((now_id % 8) == 4) @@ -103,19 +103,19 @@ void nofBaker::DrawWorking(DrawPoint drawPt) } if((now_id >= max_id - 4) && (now_id < max_id - 2)) // reingehn teil 1 { - LOADER.building_cache[wpNation][BuildingType::Bakery].door.DrawFull(drawPt); + LOADER.building_cache[wpNation][BuildingType::Bakery].door.drawFull(drawPt); LOADER.getBobSprite(wpNation, Job::Baker, walkdirection[wpNation][4], now_id % 8) .draw(walkInPos, COLOR_WHITE, plColor); } if((now_id >= max_id - 2) && (now_id < max_id)) // reingehn teil 2 { - LOADER.building_cache[wpNation][BuildingType::Bakery].door.DrawFull(drawPt); + LOADER.building_cache[wpNation][BuildingType::Bakery].door.drawFull(drawPt); LOADER.getBobSprite(wpNation, Job::Baker, walkdirection[wpNation][5], now_id % 8) .draw(walkInPos, COLOR_WHITE, plColor); } } -helpers::OptionalEnum nofBaker::ProduceWare() +helpers::OptionalEnum nofBaker::produceWare() { return GoodType::Bread; } diff --git a/libs/s25main/figures/nofBaker.h b/libs/s25main/figures/nofBaker.h index a71f896e94..0c6046868d 100644 --- a/libs/s25main/figures/nofBaker.h +++ b/libs/s25main/figures/nofBaker.h @@ -13,11 +13,11 @@ class nobUsual; class nofBaker : public nofWorkman { /// Zeichnet ihn beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override { return 76; } /// Der Arbeiter erzeugt eine Ware - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; public: nofBaker(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofBrewer.cpp b/libs/s25main/figures/nofBrewer.cpp index 64349dffc7..4499c1695d 100644 --- a/libs/s25main/figures/nofBrewer.cpp +++ b/libs/s25main/figures/nofBrewer.cpp @@ -17,16 +17,16 @@ nofBrewer::nofBrewer(const MapPoint pos, const unsigned char player, nobUsual* w nofBrewer::nofBrewer(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id) {} -void nofBrewer::DrawWorking(DrawPoint drawPt) +void nofBrewer::drawWorking(DrawPoint drawPt) { static constexpr helpers::EnumArray offsets = { {{10, 17}, {10, 17}, {10, 17}, {10, 17}, {10, 17}}}; - unsigned now_id = GAMECLIENT.Interpolate(128, current_ev); + unsigned now_id = GAMECLIENT.interpolate(128, current_ev); if(now_id < 16) LOADER.getPlayerImage("rom_bobs", now_id) - ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, + ->drawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); if(now_id == 5) @@ -37,7 +37,7 @@ void nofBrewer::DrawWorking(DrawPoint drawPt) last_id = now_id; } -helpers::OptionalEnum nofBrewer::ProduceWare() +helpers::OptionalEnum nofBrewer::produceWare() { return GoodType::Beer; } diff --git a/libs/s25main/figures/nofBrewer.h b/libs/s25main/figures/nofBrewer.h index 1996535347..2af4e19693 100644 --- a/libs/s25main/figures/nofBrewer.h +++ b/libs/s25main/figures/nofBrewer.h @@ -13,11 +13,11 @@ class nobUsual; class nofBrewer : public nofWorkman { /// Zeichnet ihn beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override { return 54; } /// Der Arbeiter erzeugt eine Ware - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; public: nofBrewer(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofBuilder.cpp b/libs/s25main/figures/nofBuilder.cpp index e31f6c02f2..113653e083 100644 --- a/libs/s25main/figures/nofBuilder.cpp +++ b/libs/s25main/figures/nofBuilder.cpp @@ -32,7 +32,7 @@ nofBuilder::nofBuilder(const MapPoint pos, const unsigned char player, noBuildin { // Dann gleich mit dem Bauprozess beginnen fs = FigureState::Job; - GoalReached(); + goalReached(); } } } @@ -41,21 +41,21 @@ void nofBuilder::Serialize(SerializedGameData& sgd) const { noFigure::Serialize(sgd); - sgd.PushEnum(state); - sgd.PushObject(building_site, true); + sgd.pushEnum(state); + sgd.pushObject(building_site, true); helpers::pushPoint(sgd, offsetSite); helpers::pushPoint(sgd, nextOffsetSite); sgd.PushUnsignedChar(building_steps_available); } nofBuilder::nofBuilder(SerializedGameData& sgd, const unsigned obj_id) - : noFigure(sgd, obj_id), state(sgd.Pop()), - building_site(sgd.PopObject(GO_Type::Buildingsite)), + : noFigure(sgd, obj_id), state(sgd.pop()), + building_site(sgd.popObject(GO_Type::Buildingsite)), offsetSite(helpers::popPoint>(sgd)), nextOffsetSite(helpers::popPoint>(sgd)), building_steps_available(sgd.PopUnsignedChar()) {} -void nofBuilder::GoalReached() +void nofBuilder::goalReached() { goal_ = nullptr; // an der Baustelle normal anfangen zu arbeiten @@ -65,39 +65,39 @@ void nofBuilder::GoalReached() offsetSite = Point(0, 0); // Anfangen um die Baustelle herumzulaufen - StartFreewalk(); + startFreewalk(); } -void nofBuilder::Walked() {} +void nofBuilder::walked() {} -void nofBuilder::AbrogateWorkplace() +void nofBuilder::abrogateWorkplace() { if(building_site) { state = BuilderState::FigureWork; - building_site->Abrogate(); + building_site->abrogate(); building_site = nullptr; } } -void nofBuilder::LostWork() +void nofBuilder::lostWork() { building_site = nullptr; if(state == BuilderState::FigureWork) - GoHome(); + goHome(); else { // Event abmelden - getEvMgr().RemoveEvent(current_ev); + getEvMgr().removeEvent(current_ev); - StartWandering(); - Wander(); + startWandering(); + wander(); state = BuilderState::FigureWork; } } -void nofBuilder::HandleDerivedEvent(const unsigned id) +void nofBuilder::handleDerivedEvent(const unsigned id) { RTTR_Assert(id == 1u && current_ev->id == id); switch(state) @@ -108,11 +108,11 @@ void nofBuilder::HandleDerivedEvent(const unsigned id) offsetSite = nextOffsetSite; // Ware aufnehmen, falls es eine gibt - if(ChooseWare()) + if(chooseWare()) state = BuilderState::BuildFreewalk; // Weiter drumrumlaufen - StartFreewalk(); + startFreewalk(); } break; case BuilderState::BuildFreewalk: @@ -124,7 +124,7 @@ void nofBuilder::HandleDerivedEvent(const unsigned id) if(building_steps_available) { // dann mal schön bauen - current_ev = getEvMgr().AddEvent(this, 40, 1); + current_ev = getEvMgr().addEvent(this, 40, 1); state = BuilderState::Build; } else if(building_site->isBuildingComplete()) { @@ -141,15 +141,15 @@ void nofBuilder::HandleDerivedEvent(const unsigned id) // Baustelle abmelden GamePlayer& owner = world->getPlayer(player); - owner.RemoveBuildingSite(building_site); + owner.removeBuildingSite(building_site); if(world->isHarborBuildingSiteFromSea(building_site)) - world->RemoveHarborBuildingSiteFromSea(building_site); + world->removeHarborBuildingSiteFromSea(building_site); // Remove buildingsite, but don't destroy! world->setNO(building_site->getPos(), nullptr); deletePtr(building_site); - noBuilding* bld = BuildingFactory::CreateBuilding(*world, building_type, pos, player, building_nation); + noBuilding* bld = BuildingFactory::createBuilding(*world, building_type, pos, player, building_nation); world->getNotifications().publish(BuildingNote(BuildingNote::Constructed, player, pos, building_type)); // Special handling for warehouses @@ -157,14 +157,14 @@ void nofBuilder::HandleDerivedEvent(const unsigned id) { auto* wh = static_cast(bld); // Mich dort gleich einquartieren und nicht erst zurücklaufen - wh->AddFigure(world->RemoveFigure(pos, *this)); + wh->addFigure(world->RemoveFigure(pos, *this)); // Evtl Träger aus dem HQ wieder verwenden - owner.FindCarrierForAllRoads(); - owner.FindWarehouseForAllJobs(Job::Helper); + owner.findCarrierForAllRoads(); + owner.findWarehouseForAllJobs(Job::Helper); // Evtl gabs verlorene Waren, die jetzt in das WH wieder reinkönnen - owner.FindClientForLostWares(); + owner.findClientForLostWares(); return; } @@ -173,18 +173,18 @@ void nofBuilder::HandleDerivedEvent(const unsigned id) rs_dir = true; cur_rs = world->getSpecObj(pos)->getRoute(Direction::SouthEast); - GoHome(); - StartWalking(Direction::SouthEast); + goHome(); + startWalking(Direction::SouthEast); } else { // Brauchen neues Material // Ware aufnehmen, falls es eine gibt - if(!ChooseWare()) + if(!chooseWare()) state = BuilderState::WaitingFreewalk; // Weiter drumrumlaufen - StartFreewalk(); + startFreewalk(); } } break; @@ -198,7 +198,7 @@ void nofBuilder::HandleDerivedEvent(const unsigned id) ++building_site->build_progress; // Fertig mit dem Bauschritt, dann an nächste Position gehen state = BuilderState::BuildFreewalk; - StartFreewalk(); + startFreewalk(); } break; default: break; @@ -209,7 +209,7 @@ void nofBuilder::HandleDerivedEvent(const unsigned id) const std::array FREEWALK_LENGTH = {22, 11}; // waagerecht const std::array FREEWALK_LENGTH_SLANTWISE = {14, 7}; // schräg -void nofBuilder::StartFreewalk() +void nofBuilder::startFreewalk() { std::vector possible_directions; @@ -242,10 +242,10 @@ void nofBuilder::StartFreewalk() RTTR_Assert(!possible_directions.empty()); // Zufällige Richtung von diesen auswählen - FaceDir(RANDOM_ELEMENT(possible_directions)); + faceDir(RANDOM_ELEMENT(possible_directions)); // Und dort auch hinlaufen - current_ev = getEvMgr().AddEvent(this, (state == BuilderState::WaitingFreewalk) ? 24 : 17, 1); + current_ev = getEvMgr().addEvent(this, (state == BuilderState::WaitingFreewalk) ? 24 : 17, 1); // Zukünftigen Platz berechnen nextOffsetSite = offsetSite; @@ -273,32 +273,32 @@ void nofBuilder::StartFreewalk() } } -void nofBuilder::Draw(DrawPoint drawPt) +void nofBuilder::draw(DrawPoint drawPt) { switch(state) { case BuilderState::FigureWork: { - DrawWalkingBobJobs(drawPt, Job::Builder); + drawWalkingBobJobs(drawPt, Job::Builder); } break; case BuilderState::BuildFreewalk: case BuilderState::WaitingFreewalk: { // Interpolieren und Door-Point von Baustelle draufaddieren - drawPt.x += GAMECLIENT.Interpolate(offsetSite.x, nextOffsetSite.x, current_ev); - drawPt.y += GAMECLIENT.Interpolate(offsetSite.y, nextOffsetSite.y, current_ev); + drawPt.x += GAMECLIENT.interpolate(offsetSite.x, nextOffsetSite.x, current_ev); + drawPt.y += GAMECLIENT.interpolate(offsetSite.y, nextOffsetSite.y, current_ev); drawPt += building_site->getDoorPoint(); LOADER .getBobSprite(building_site->getNation(), Job::Builder, getCurMoveDir(), - GAMECLIENT.Interpolate(12, current_ev) % 8u) + GAMECLIENT.interpolate(12, current_ev) % 8u) .draw(drawPt, COLOR_WHITE, world->getPlayer(player).color); } break; case BuilderState::Build: { - const unsigned index = GAMECLIENT.Interpolate(28, current_ev); + const unsigned index = GAMECLIENT.interpolate(28, current_ev); unsigned texture; unsigned soundId = 0; @@ -329,7 +329,7 @@ void nofBuilder::Draw(DrawPoint drawPt) } drawPt += building_site->getDoorPoint() + DrawPoint(offsetSite); LOADER.getPlayerImage("rom_bobs", texture) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(building_site->getPlayer()).color); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(building_site->getPlayer()).color); if(soundId && index % 4 == 2) world->getSoundMgr().playNOSound(soundId, *this, index, 160 - rand() % 60); } @@ -337,7 +337,7 @@ void nofBuilder::Draw(DrawPoint drawPt) } } -bool nofBuilder::ChooseWare() +bool nofBuilder::chooseWare() { // Brauch ich ein Brett(Rohbau und wenn kein Stein benötigt wird) oder Stein? const BuildingCost costs = BUILDING_COSTS[building_site->getBuildingType()]; diff --git a/libs/s25main/figures/nofBuilder.h b/libs/s25main/figures/nofBuilder.h index bd8322452d..7b204a1d11 100644 --- a/libs/s25main/figures/nofBuilder.h +++ b/libs/s25main/figures/nofBuilder.h @@ -39,34 +39,34 @@ class nofBuilder final : public noFigure /// Wie viele Bauschritte noch verfügbar sind, bis der nächste Rohstoff geholt werden muss unsigned char building_steps_available; - void GoalReached() override; - void Walked() override; - void AbrogateWorkplace() override; - void HandleDerivedEvent(unsigned id) override; + void goalReached() override; + void walked() override; + void abrogateWorkplace() override; + void handleDerivedEvent(unsigned id) override; /// In neue Richtung laufen (Freewalk) - void StartFreewalk(); + void startFreewalk(); /// "Frisst" eine passende Ware (falls vorhanden, gibt true in dem Fall zurück!) von der Baustelle, d.h nimmt sie in /// die Hand und erhöht die building_steps_avaible - bool ChooseWare(); + bool chooseWare(); public: nofBuilder(MapPoint pos, unsigned char player, noBuildingSite* building_site); nofBuilder(SerializedGameData& sgd, unsigned obj_id); nofBuilder(const nofBuilder&) = delete; - void Destroy() override + void destroy() override { RTTR_Assert(!building_site); - noFigure::Destroy(); + noFigure::destroy(); } void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofBuilder; } - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; // Wird von der Baustelle aus aufgerufen, um den Bauarbeiter zu sagen, dass er gehen kann - void LostWork(); + void lostWork(); }; diff --git a/libs/s25main/figures/nofBuildingWorker.cpp b/libs/s25main/figures/nofBuildingWorker.cpp index fde4d0fd31..17b7c6a96f 100644 --- a/libs/s25main/figures/nofBuildingWorker.cpp +++ b/libs/s25main/figures/nofBuildingWorker.cpp @@ -29,22 +29,22 @@ void nofBuildingWorker::Serialize(SerializedGameData& sgd) const { noFigure::Serialize(sgd); - sgd.PushEnum(state); + sgd.pushEnum(state); if(fs != FigureState::GoHome && fs != FigureState::Wander) { - sgd.PushObject(workplace); - sgd.PushOptionalEnum(ware); + sgd.pushObject(workplace); + sgd.pushOptionalEnum(ware); sgd.PushBool(was_sounding); } } nofBuildingWorker::nofBuildingWorker(SerializedGameData& sgd, const unsigned obj_id) - : noFigure(sgd, obj_id), state(sgd.Pop()) + : noFigure(sgd, obj_id), state(sgd.pop()) { if(fs != FigureState::GoHome && fs != FigureState::Wander) { - workplace = sgd.PopObject(); + workplace = sgd.popObject(); if(sgd.getGameDataVersion() < 5) { const auto iWare = sgd.PopUnsignedChar(); @@ -55,7 +55,7 @@ nofBuildingWorker::nofBuildingWorker(SerializedGameData& sgd, const unsigned obj else ware = GoodType(iWare); } else - ware = sgd.PopOptionalEnum(); + ware = sgd.popOptionalEnum(); was_sounding = sgd.PopBool(); } else { @@ -65,16 +65,16 @@ nofBuildingWorker::nofBuildingWorker(SerializedGameData& sgd, const unsigned obj } } -void nofBuildingWorker::AbrogateWorkplace() +void nofBuildingWorker::abrogateWorkplace() { if(workplace) { - workplace->WorkerLost(); + workplace->workerLost(); workplace = nullptr; } } -void nofBuildingWorker::Draw(DrawPoint drawPt) +void nofBuildingWorker::draw(DrawPoint drawPt) { switch(state) { @@ -82,27 +82,27 @@ void nofBuildingWorker::Draw(DrawPoint drawPt) case State::HunterChasing: case State::HunterWalkingToCadaver: case State::HunterFindingShootingpoint: - case State::SkinnerWalkingToCarcass: DrawWalking(drawPt); break; + case State::SkinnerWalkingToCarcass: drawWalking(drawPt); break; case State::Work: case State::HunterShooting: case State::HunterEviscerating: case State::HunterWaitingForAnimalReady: case State::SkinnerSkinningCarcass: case State::CatapultTargetBuilding: - case State::CatapultBackoff: DrawWorking(drawPt); break; - case State::CarryoutWare: DrawWalkingWithWare(drawPt); break; + case State::CatapultBackoff: drawWorking(drawPt); break; + case State::CarryoutWare: drawWalkingWithWare(drawPt); break; case State::WalkingHome: case State::EnterBuilding: if(ware) - DrawWalkingWithWare(drawPt); + drawWalkingWithWare(drawPt); else - DrawWalking(drawPt); + drawWalking(drawPt); break; - default: DrawOtherStates(drawPt); break; + default: drawOtherStates(drawPt); break; } } -void nofBuildingWorker::Walked() +void nofBuildingWorker::walked() { switch(state) { @@ -115,27 +115,27 @@ void nofBuildingWorker::Walked() // dann war draußen kein Platz --> ist jetzt evtl Platz? state = State::WaitForWareSpace; if(workplace->getFlag()->hasSpaceForWare()) - FreePlaceAtFlag(); + freePlaceAtFlag(); // Ab jetzt warten, d.h. nicht mehr arbeiten --> schlecht für die Produktivität - workplace->StartNotWorking(); + workplace->startNotWorking(); } else { // Anfangen zu Arbeiten - TryToWork(); + tryToWork(); } } break; case State::CarryoutWare: { // Alles weitere übernimmt nofBuildingWorker - WorkingReady(); + workingReady(); } break; - default: WalkedDerived(); + default: walkedDerived(); } } -void nofBuildingWorker::WorkingReady() +void nofBuildingWorker::workingReady() { // wir arbeiten nicht mehr workplace->is_working = false; @@ -149,84 +149,84 @@ void nofBuildingWorker::WorkingReady() { // Ware erzeugen auto real_ware = std::make_unique(*ware, nullptr, flag); - real_ware->WaitAtFlag(*flag); + real_ware->waitAtFlag(*flag); // Inventur entsprechend erhöhen, dabei Schilder unterscheiden! GoodType ware_type = ConvertShields(real_ware->type); - world->getPlayer(player).IncreaseInventoryWare(ware_type, 1); + world->getPlayer(player).increaseInventoryWare(ware_type, 1); // Abnehmer für Ware finden - real_ware->setGoal(world->getPlayer(player).FindClientForWare(*real_ware)); + real_ware->setGoal(world->getPlayer(player).findClientForWare(*real_ware)); // Ware soll ihren weiteren Weg berechnen - real_ware->RecalcRoute(); + real_ware->recalcRoute(); // Ware ablegen - flag->AddWare(std::move(real_ware)); + flag->addWare(std::move(real_ware)); // Warenstatistik erhöhen - world->getPlayer(this->player).IncreaseMerchandiseStatistic(ware_type); + world->getPlayer(this->player).increaseMerchandiseStatistic(ware_type); // Tragen nun keine Ware mehr ware = std::nullopt; } } // Wieder reingehen - StartWalking(Direction::NorthWest); + startWalking(Direction::NorthWest); state = State::EnterBuilding; } -void nofBuildingWorker::TryToWork() +void nofBuildingWorker::tryToWork() { - if(!workplace->isProductionDisabled() && AreWaresAvailable()) + if(!workplace->isProductionDisabled() && areWaresAvailable()) { state = State::Waiting1; - current_ev = getEvMgr().AddEvent( + current_ev = getEvMgr().addEvent( this, (getGOT() == GO_Type::NofCatapultman) ? CATAPULT_WAIT1_LENGTH : JOB_CONSTS[job_].wait1_length, 1); - workplace->StopNotWorking(); + workplace->stopNotWorking(); } else { state = State::WaitingForWaresOrProductionStopped; // Nun arbeite ich nich mehr - workplace->StartNotWorking(); + workplace->startNotWorking(); } } -bool nofBuildingWorker::AreWaresAvailable() const +bool nofBuildingWorker::areWaresAvailable() const { - return workplace->WaresAvailable(); + return workplace->waresAvailable(); } -void nofBuildingWorker::GotWareOrProductionAllowed() +void nofBuildingWorker::gotWareOrProductionAllowed() { // Falls man auf Waren wartet, kann man dann anfangen zu arbeiten if(state == State::WaitingForWaresOrProductionStopped) { // anfangen zu arbeiten - TryToWork(); + tryToWork(); } } -void nofBuildingWorker::GoalReached() +void nofBuildingWorker::goalReached() { // Tür zumachen (ist immer bis zu Erstbesetzung offen) - workplace->CloseDoor(); + workplace->closeDoor(); // Gebäude Bescheid sagen, dass ich da bin - workplace->WorkerArrived(); + workplace->workerArrived(); - WorkplaceReached(); + workplaceReached(); // ggf. anfangen zu arbeiten - TryToWork(); + tryToWork(); } -bool nofBuildingWorker::FreePlaceAtFlag() +bool nofBuildingWorker::freePlaceAtFlag() { // Hinaus gehen, um Ware abzulegen, falls wir auf einen freien Platz warten if(state == State::WaitForWareSpace) { - StartWalking(Direction::SouthEast); + startWalking(Direction::SouthEast); state = State::CarryoutWare; return true; } else return false; } -void nofBuildingWorker::LostWork() +void nofBuildingWorker::lostWork() { switch(state) { @@ -234,7 +234,7 @@ void nofBuildingWorker::LostWork() case State::FigureWork: { // Auf Wegen nach Hause gehen - GoHome(); + goHome(); } break; case State::Waiting1: @@ -250,14 +250,14 @@ void nofBuildingWorker::LostWork() case State::CatapultBackoff: { // Bisheriges Event abmelden, da die Arbeit unterbrochen wird - getEvMgr().RemoveEvent(current_ev); + getEvMgr().removeEvent(current_ev); // Bescheid sagen, dass Arbeit abgebrochen wurde - WorkAborted(); + workAborted(); // Rumirren - StartWandering(); - Wander(); + startWandering(); + wander(); // Evtl. Sounds löschen world->getSoundMgr().stopSounds(*this); @@ -275,12 +275,12 @@ void nofBuildingWorker::LostWork() case State::SkinnerWalkingToCarcass: { // Bescheid sagen, dass Arbeit abgebrochen wurde - WorkAborted(); + workAborted(); // Rumirren // Bei diesen States läuft man schon, darf also nicht noch zusätzlich Wander aufrufen, da man dann ja im // Laufen nochmal losläuft! - StartWandering(); + startWandering(); // Evtl. Sounds löschen world->getSoundMgr().stopSounds(*this); @@ -293,27 +293,27 @@ void nofBuildingWorker::LostWork() workplace = nullptr; } -void nofBuildingWorker::ProductionStopped() +void nofBuildingWorker::productionStopped() { // Wenn ich gerade warte und schon ein Arbeitsevent angemeldet habe, muss das wieder abgemeldet werden if(state == State::Waiting1) { - getEvMgr().RemoveEvent(current_ev); + getEvMgr().removeEvent(current_ev); current_ev = nullptr; state = State::WaitingForWaresOrProductionStopped; - workplace->StartNotWorking(); + workplace->startNotWorking(); } } -void nofBuildingWorker::WorkAborted() {} +void nofBuildingWorker::workAborted() {} -void nofBuildingWorker::WorkplaceReached() {} +void nofBuildingWorker::workplaceReached() {} /// Zeichnen der Figur in sonstigen Arbeitslagen -void nofBuildingWorker::DrawOtherStates(DrawPoint) {} +void nofBuildingWorker::drawOtherStates(DrawPoint) {} /// Zeichnet Figur beim Hereinlaufen/nach Hause laufen mit evtl. getragenen Waren -void nofBuildingWorker::DrawWalkingWithWare(DrawPoint drawPt) +void nofBuildingWorker::drawWalkingWithWare(DrawPoint drawPt) { unsigned short id = getCarryID(); // >=CARRY_ID_CARRIER_OFFSET -> carrier.bob else jobs.bob! @@ -321,7 +321,7 @@ void nofBuildingWorker::DrawWalkingWithWare(DrawPoint drawPt) { id -= CARRY_ID_CARRIER_OFFSET; RTTR_Assert(id <= helpers::MaxEnumValue_v); - DrawWalkingCarrier(drawPt, GoodType(id), JOB_SPRITE_CONSTS[job_].isFat()); + drawWalkingCarrier(drawPt, GoodType(id), JOB_SPRITE_CONSTS[job_].isFat()); } else - DrawWalking(drawPt, LOADER.getBob("jobs"), id, JOB_SPRITE_CONSTS[job_].isFat()); + drawWalking(drawPt, LOADER.getBob("jobs"), id, JOB_SPRITE_CONSTS[job_].isFat()); } diff --git a/libs/s25main/figures/nofBuildingWorker.h b/libs/s25main/figures/nofBuildingWorker.h index 5a8fee6028..f1c221b1d0 100644 --- a/libs/s25main/figures/nofBuildingWorker.h +++ b/libs/s25main/figures/nofBuildingWorker.h @@ -56,39 +56,39 @@ class nofBuildingWorker : public noFigure /// wird von abgeleiteten Klassen aufgerufen, wenn sie die Ware an der Fahne vorm Gebäude ablegen wollen (oder auch /// nicht) also fertig mit Arbeiten sind - void WorkingReady(); + void workingReady(); /// wenn man beim Arbeitsplatz "kündigen" soll, man das Laufen zum Ziel unterbrechen muss (warum auch immer) - void AbrogateWorkplace() override; + void abrogateWorkplace() override; /// Tries to start working. /// Checks preconditions (production enabled, wares available...) and starts the pre-Work-Waiting period if ok - virtual void TryToWork(); + virtual void tryToWork(); /// Returns true, when there are enough wares available for working. /// Note: On false, we will wait for the next ware or production change till checking again - virtual bool AreWaresAvailable() const; + virtual bool areWaresAvailable() const; private: /// von noFigure aufgerufen - void Walked() override; // wenn man gelaufen ist - void GoalReached() override; // wenn das Ziel erreicht wurde + void walked() override; // wenn man gelaufen ist + void goalReached() override; // wenn das Ziel erreicht wurde protected: /// Malt den Arbeiter beim Arbeiten - virtual void DrawWorking(DrawPoint drawPt) = 0; + virtual void drawWorking(DrawPoint drawPt) = 0; static constexpr unsigned short CARRY_ID_CARRIER_OFFSET = 100; /// Ask derived class for an ID into JOBS.BOB when the figure is carrying a ware /// Use GD_* + CARRY_ID_CARRIER_OFFSET for using carrier graphics virtual unsigned short getCarryID() const = 0; /// Laufen an abgeleitete Klassen weiterleiten - virtual void WalkedDerived() = 0; + virtual void walkedDerived() = 0; /// Arbeit musste wegen Arbeitsplatzverlust abgebrochen werden - virtual void WorkAborted(); + virtual void workAborted(); /// Arbeitsplatz wurde erreicht - virtual void WorkplaceReached(); + virtual void workplaceReached(); /// Draws the figure while returning home / entering the building (often carrying wares) - virtual void DrawWalkingWithWare(DrawPoint drawPt); + virtual void drawWalkingWithWare(DrawPoint drawPt); /// Zeichnen der Figur in sonstigen Arbeitslagen - virtual void DrawOtherStates(DrawPoint drawPt); + virtual void drawOtherStates(DrawPoint drawPt); public: State getState() const { return state; } @@ -97,21 +97,21 @@ class nofBuildingWorker : public noFigure nofBuildingWorker(SerializedGameData& sgd, unsigned obj_id); nofBuildingWorker(const nofBuildingWorker&) = delete; - void Destroy() override + void destroy() override { RTTR_Assert(!workplace); - noFigure::Destroy(); + noFigure::destroy(); } void Serialize(SerializedGameData& sgd) const override; - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; /// Wenn eine neue Ware kommt oder die Produktion wieder erlaubt wurde, wird das aufgerufen - void GotWareOrProductionAllowed(); + void gotWareOrProductionAllowed(); /// Wenn wieder Platz an der Flagge ist und eine Ware wieder rausgetragen werden kann - bool FreePlaceAtFlag(); + bool freePlaceAtFlag(); /// Wenn das Haus des Arbeiters abbrennt - void LostWork(); + void lostWork(); /// Wird aufgerufen, nachdem die Produktion in dem Gebäude, wo er arbeitet, verboten wurde - void ProductionStopped(); + void productionStopped(); }; diff --git a/libs/s25main/figures/nofButcher.cpp b/libs/s25main/figures/nofButcher.cpp index 47eb67e8fd..dab572ee1c 100644 --- a/libs/s25main/figures/nofButcher.cpp +++ b/libs/s25main/figures/nofButcher.cpp @@ -17,14 +17,14 @@ nofButcher::nofButcher(const MapPoint pos, const unsigned char player, nobUsual* nofButcher::nofButcher(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id) {} -void nofButcher::DrawWorking(DrawPoint drawPt) +void nofButcher::drawWorking(DrawPoint drawPt) { static constexpr helpers::EnumArray offsets = {{{38, 2}, {-3, 5}, {21, -1}, {26, -5}, {-7, 2}}}; unsigned now_id; - LOADER.getPlayerImage("rom_bobs", 160 + (now_id = GAMECLIENT.Interpolate(136, current_ev)) % 6) - ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); + LOADER.getPlayerImage("rom_bobs", 160 + (now_id = GAMECLIENT.interpolate(136, current_ev)) % 6) + ->drawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); if(now_id % 6 == 5) { @@ -35,7 +35,7 @@ void nofButcher::DrawWorking(DrawPoint drawPt) last_id = now_id; } -helpers::OptionalEnum nofButcher::ProduceWare() +helpers::OptionalEnum nofButcher::produceWare() { return GoodType::Meat; } diff --git a/libs/s25main/figures/nofButcher.h b/libs/s25main/figures/nofButcher.h index 15529c76b2..5f734138d4 100644 --- a/libs/s25main/figures/nofButcher.h +++ b/libs/s25main/figures/nofButcher.h @@ -13,11 +13,11 @@ class nobUsual; class nofButcher : public nofWorkman { /// Zeichnet ihn beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override { return 74; } /// Der Arbeiter erzeugt eine Ware - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; public: nofButcher(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofCarpenter.cpp b/libs/s25main/figures/nofCarpenter.cpp index 8c94a52443..58b6af0c98 100644 --- a/libs/s25main/figures/nofCarpenter.cpp +++ b/libs/s25main/figures/nofCarpenter.cpp @@ -17,14 +17,14 @@ nofCarpenter::nofCarpenter(const MapPoint pos, const unsigned char player, nobUs nofCarpenter::nofCarpenter(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id) {} -void nofCarpenter::DrawWorking(DrawPoint drawPt) +void nofCarpenter::drawWorking(DrawPoint drawPt) { static constexpr helpers::EnumArray offsets = {{{30, 3}, {38, 3}, {30, 8}, {17, -2}, {38, 3}}}; unsigned now_id; - LOADER.getPlayerImage("rom_bobs", 32 + ((now_id = GAMECLIENT.Interpolate(136, current_ev)) % 8)) - ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); + LOADER.getPlayerImage("rom_bobs", 32 + ((now_id = GAMECLIENT.interpolate(136, current_ev)) % 8)) + ->drawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); // Evtl Sound abspielen if(now_id % 8 == 3 || now_id % 8 == 7) @@ -36,7 +36,7 @@ void nofCarpenter::DrawWorking(DrawPoint drawPt) last_id = now_id; } -helpers::OptionalEnum nofCarpenter::ProduceWare() +helpers::OptionalEnum nofCarpenter::produceWare() { return GoodType::Boards; } diff --git a/libs/s25main/figures/nofCarpenter.h b/libs/s25main/figures/nofCarpenter.h index 170f0ff5f7..4559428e06 100644 --- a/libs/s25main/figures/nofCarpenter.h +++ b/libs/s25main/figures/nofCarpenter.h @@ -13,11 +13,11 @@ class nobUsual; class nofCarpenter : public nofWorkman { /// Zeichnet ihn beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override { return 62; } /// Der Arbeiter erzeugt eine Ware - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; public: nofCarpenter(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofCarrier.cpp b/libs/s25main/figures/nofCarrier.cpp index 4e67c098e3..1d7ad25ebe 100644 --- a/libs/s25main/figures/nofCarrier.cpp +++ b/libs/s25main/figures/nofCarrier.cpp @@ -80,9 +80,9 @@ nofCarrier::nofCarrier(const CarrierType ct, const MapPoint pos, unsigned char p {} nofCarrier::nofCarrier(SerializedGameData& sgd, unsigned obj_id) - : noFigure(sgd, obj_id), ct(sgd.Pop()), state(sgd.Pop()), fat(sgd.PopBool()), - workplace(sgd.PopObject(GO_Type::Roadsegment)), carried_ware(sgd.PopObject(GO_Type::Ware)), - productivity_ev(sgd.PopEvent()), productivity(sgd.PopUnsignedInt()), worked_gf(sgd.PopUnsignedInt()), + : noFigure(sgd, obj_id), ct(sgd.pop()), state(sgd.pop()), fat(sgd.PopBool()), + workplace(sgd.popObject(GO_Type::Roadsegment)), carried_ware(sgd.popObject(GO_Type::Ware)), + productivity_ev(sgd.popEvent()), productivity(sgd.PopUnsignedInt()), worked_gf(sgd.PopUnsignedInt()), since_working_gf(sgd.PopUnsignedInt()), next_animation(0) { if(state == CarrierState::BoatcarrierWanderOnWater) @@ -100,12 +100,12 @@ void nofCarrier::Serialize(SerializedGameData& sgd) const { noFigure::Serialize(sgd); - sgd.PushEnum(ct); - sgd.PushEnum(state); + sgd.pushEnum(ct); + sgd.pushEnum(state); sgd.PushBool(fat); - sgd.PushObject(workplace, true); - sgd.PushObject(carried_ware, true); - sgd.PushEvent(productivity_ev); + sgd.pushObject(workplace, true); + sgd.pushObject(carried_ware, true); + sgd.pushEvent(productivity_ev); sgd.PushUnsignedInt(productivity); sgd.PushUnsignedInt(worked_gf); sgd.PushUnsignedInt(since_working_gf); @@ -118,18 +118,18 @@ void nofCarrier::Serialize(SerializedGameData& sgd) const nofCarrier::~nofCarrier() = default; -void nofCarrier::Destroy() +void nofCarrier::destroy() { RTTR_Assert(!workplace); // Ware vernichten (abmelden) RTTR_Assert(!carried_ware); // TODO: Check if this is ok so keep the LooseWare call below - LooseWare(); - getEvMgr().RemoveEvent(productivity_ev); + looseWare(); + getEvMgr().removeEvent(productivity_ev); - noFigure::Destroy(); + noFigure::destroy(); } -void nofCarrier::Draw(DrawPoint drawPt) +void nofCarrier::draw(DrawPoint drawPt) { // Unterscheiden, um was für eine Art von Träger es sich handelt switch(ct) @@ -180,14 +180,14 @@ void nofCarrier::Draw(DrawPoint drawPt) .getPlayerImage( "rom_bobs", ANIMATIONS[fat ? 1 : 0][animation_id][(current_gf - next_animation) / FRAME_GF]) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } else // Silvesteregg { glArchivItem_Bitmap_Player* bmp = LOADER.getPlayerImage("firework", (current_gf - next_animation) / 3 + 1); if(bmp) - bmp->DrawFull(drawPt - DrawPoint(26, 104), COLOR_WHITE, world->getPlayer(player).color); + bmp->drawFull(drawPt - DrawPoint(26, 104), COLOR_WHITE, world->getPlayer(player).color); else { setNewAnimationMoment(); @@ -203,7 +203,7 @@ void nofCarrier::Draw(DrawPoint drawPt) .draw(drawPt, COLOR_WHITE, world->getPlayer(player).color); } else // Steht und wartet (ohne Ware) - DrawShadow(drawPt, 0, getCurMoveDir()); + drawShadow(drawPt, 0, getCurMoveDir()); } else if(state == CarrierState::WaitForWareSpace || (waiting_for_free_node && !isStoppedBetweenNodes() && carried_ware)) { @@ -214,9 +214,9 @@ void nofCarrier::Draw(DrawPoint drawPt) { // Läuft normal mit oder ohne Ware if(carried_ware) - DrawWalkingCarrier(drawPt, carried_ware->type, fat); + drawWalkingCarrier(drawPt, carried_ware->type, fat); else - DrawWalkingCarrier(drawPt, std::nullopt, fat); + drawWalkingCarrier(drawPt, std::nullopt, fat); } } break; @@ -238,12 +238,12 @@ void nofCarrier::Draw(DrawPoint drawPt) LOADER.getDonkeySprite(getCurMoveDir(), 0).draw(drawPt); // Ware im Korb zeichnen - LOADER.getWareDonkeyTex(carried_ware->type)->DrawFull(drawPt + WARE_POS_DONKEY[getCurMoveDir()][0]); + LOADER.getWareDonkeyTex(carried_ware->type)->drawFull(drawPt + WARE_POS_DONKEY[getCurMoveDir()][0]); } else { - const unsigned ani_step = CalcWalkAnimationFrame(); + const unsigned ani_step = calcWalkAnimationFrame(); - drawPt += CalcFigurRelative(); + drawPt += calcFigurRelative(); // Läuft normal mit oder ohne Ware @@ -254,7 +254,7 @@ void nofCarrier::Draw(DrawPoint drawPt) { // Ware im Korb zeichnen LOADER.getWareDonkeyTex(carried_ware->type) - ->DrawFull(drawPt + WARE_POS_DONKEY[getCurMoveDir()][ani_step]); + ->drawFull(drawPt + WARE_POS_DONKEY[getCurMoveDir()][ani_step]); } } } @@ -264,7 +264,7 @@ void nofCarrier::Draw(DrawPoint drawPt) if(state == CarrierState::FigureWork) { // Beim normalen Laufen Träger mit Boot über den Schultern zeichnen - DrawWalkingCarrier(drawPt, GoodType::Boat, fat); + drawWalkingCarrier(drawPt, GoodType::Boat, fat); } else if(state == CarrierState::WaitForWare || (waiting_for_free_node && !isStoppedBetweenNodes() && !carried_ware)) { @@ -277,12 +277,12 @@ void nofCarrier::Draw(DrawPoint drawPt) .draw(drawPt, 0xFFFFFFFF, world->getPlayer(player).color); // Ware im Boot zeichnen - LOADER.getWareDonkeyTex(carried_ware->type)->DrawFull(drawPt + WARE_POS_BOAT[getCurMoveDir()]); + LOADER.getWareDonkeyTex(carried_ware->type)->drawFull(drawPt + WARE_POS_BOAT[getCurMoveDir()]); } else { - const unsigned ani_step = CalcWalkAnimationFrame(); + const unsigned ani_step = calcWalkAnimationFrame(); - drawPt += CalcFigurRelative(); + drawPt += calcFigurRelative(); // ruderndes Boot zeichnen LOADER.getBoatCarrierSprite(getCurMoveDir(), ani_step) @@ -291,7 +291,7 @@ void nofCarrier::Draw(DrawPoint drawPt) // Läuft normal mit oder ohne Ware if(carried_ware) // Ware im Boot zeichnen - LOADER.getWareDonkeyTex(carried_ware->type)->DrawFull(drawPt + WARE_POS_BOAT[getCurMoveDir()]); + LOADER.getWareDonkeyTex(carried_ware->type)->drawFull(drawPt + WARE_POS_BOAT[getCurMoveDir()]); // Sound ggf. abspielen if(ani_step == 2) @@ -310,7 +310,7 @@ void nofCarrier::setNewAnimationMoment() next_animation = getEvMgr().getCurrentGF() + NEXT_ANIMATION + rand() % NEXT_ANIMATION_RANDOM; } -void nofCarrier::Walked() +void nofCarrier::walked() { // Bootssounds ggf. löschen if(ct == CarrierType::Boat && state != CarrierState::FigureWork) @@ -323,28 +323,28 @@ void nofCarrier::Walked() { // Gibts an der Flagge in der entgegengesetzten Richtung, in die ich laufe, evtl Waren zu tragen // (da wir darüber nicht unmittelbar informiert werden!) - if(workplace->AreWareJobs(rs_dir, ct, false)) + if(workplace->areWareJobs(rs_dir, ct, false)) { // Dann umdrehen und holen rs_dir = !rs_dir; rs_pos = workplace->GetLength() - rs_pos; state = CarrierState::FetchWare; - StartWalking(cur_rs->getDir(rs_dir, rs_pos)); + startWalking(cur_rs->getDir(rs_dir, rs_pos)); } else if(rs_pos == cur_rs->GetLength() / 2 || rs_pos == cur_rs->GetLength() / 2 + cur_rs->GetLength() % 2) { // Wir sind in der Mitte angekommen state = CarrierState::WaitForWare; if(getCurMoveDir() == Direction::West || getCurMoveDir() == Direction::NorthWest || getCurMoveDir() == Direction::SouthWest) - FaceDir(Direction::SouthWest); + faceDir(Direction::SouthWest); else - FaceDir(Direction::SouthEast); + faceDir(Direction::SouthEast); current_ev = nullptr; // Jetzt wird wieder nur rumgegammelt, dann kriegen wir aber evtl keinen schönen IH-AH! - StopWorking(); + stopWorking(); // Animation auf später verschieben, damit die nicht mittendrin startet setNewAnimationMoment(); @@ -357,7 +357,7 @@ void nofCarrier::Walked() rs_pos = cur_rs->GetLength() - rs_pos; } - StartWalking(cur_rs->getDir(rs_dir, rs_pos)); + startWalking(cur_rs->getDir(rs_dir, rs_pos)); } } break; @@ -368,9 +368,9 @@ void nofCarrier::Walked() // Sind wir schon da? if(rs_pos == cur_rs->GetLength()) // Dann Ware aufnehmnen - FetchWare(false); + fetchWare(false); else - StartWalking(cur_rs->getDir(rs_dir, rs_pos)); + startWalking(cur_rs->getDir(rs_dir, rs_pos)); } break; case CarrierState::CarryWare: @@ -384,14 +384,14 @@ void nofCarrier::Walked() bool calculated = false; // Check if the ware should go into the building connected to the flag - if(WantInBuilding(&calculated)) + if(wantInBuilding(&calculated)) { // Walk to building or building site state = CarrierState::CarryWareToBuilding; - StartWalking(Direction::NorthWest); + startWalking(Direction::NorthWest); cur_rs = this_flag.getRoute(Direction::NorthWest); // Set location to next road node, i.e. building - carried_ware->Carry( + carried_ware->carry( assertNonNull((cur_rs->getF1() == &this_flag) ? cur_rs->getF2() : cur_rs->getF1())); } else { @@ -399,37 +399,37 @@ void nofCarrier::Walked() // If not try swapping it with another ware at that flag if(this_flag.hasSpaceForWare()) { - carried_ware->WaitAtFlag(this_flag); + carried_ware->waitAtFlag(this_flag); // Calc next route if not done in the WantInBuilding call if(!calculated) - carried_ware->RecalcRoute(); + carried_ware->recalcRoute(); // Put down ware - this_flag.AddWare(std::move(carried_ware)); + this_flag.addWare(std::move(carried_ware)); RTTR_Assert(carried_ware == nullptr); // Check if we can pick up another ware at this flag, else go back to middle of road - LookForWares(); - } else if(workplace->AreWareJobs(!rs_dir, ct, true)) + lookForWares(); + } else if(workplace->areWareJobs(!rs_dir, ct, true)) { // We can swap the ware with another one at this flag // Temporary store carried ware, so we can fetch another one before putting down the old one // which triggers a search for an available carrier which must not be us auto tmp_ware = std::move(carried_ware); - FetchWare(true); + fetchWare(true); - tmp_ware->WaitAtFlag(this_flag); + tmp_ware->waitAtFlag(this_flag); if(!calculated) - tmp_ware->RecalcRoute(); - this_flag.AddWare(std::move(tmp_ware)); + tmp_ware->recalcRoute(); + this_flag.addWare(std::move(tmp_ware)); } else { // No space at flag, go back and try again later state = CarrierState::GoBackFromFlag; rs_dir = !rs_dir; rs_pos = cur_rs->GetLength() - rs_pos; - StartWalking(getCurMoveDir() + 3u); + startWalking(getCurMoveDir() + 3u); } } } else if(rs_pos == cur_rs->GetLength() - 1) @@ -438,37 +438,37 @@ void nofCarrier::Walked() auto* this_flag = static_cast(((rs_dir) ? workplace->getF1() : workplace->getF2())); // If there is space at the flag, or we can carry it directly to the building or swap it with another // ware continue to the flag - if(this_flag->hasSpaceForWare() || WantInBuilding(nullptr) || cur_rs->AreWareJobs(!rs_dir, ct, true)) + if(this_flag->hasSpaceForWare() || wantInBuilding(nullptr) || cur_rs->areWareJobs(!rs_dir, ct, true)) { - StartWalking(cur_rs->getDir(rs_dir, rs_pos)); + startWalking(cur_rs->getDir(rs_dir, rs_pos)); } else { // No space at flag, wait here state = CarrierState::WaitForWareSpace; - FaceDir(cur_rs->getDir(rs_dir, rs_pos)); + faceDir(cur_rs->getDir(rs_dir, rs_pos)); } } else { - StartWalking(cur_rs->getDir(rs_dir, rs_pos)); + startWalking(cur_rs->getDir(rs_dir, rs_pos)); } } break; case CarrierState::CarryWareToBuilding: { // Ware ablegen - world->getSpecObj(pos)->AddWare(std::move(carried_ware)); + world->getSpecObj(pos)->addWare(std::move(carried_ware)); RTTR_Assert(carried_ware == nullptr); // Wieder zurück zu meinem Weg laufen state = CarrierState::LeaveBuilding; - StartWalking(Direction::SouthEast); + startWalking(Direction::SouthEast); } break; case CarrierState::LeaveBuilding: { // So tun, als ob der Träger gerade vom anderen Ende des Weges kommt, damit alles korrekt funktioniert cur_rs = workplace; - FaceDir(workplace->getDir(rs_dir, workplace->GetLength() - 1)); - LookForWares(); + faceDir(workplace->getDir(rs_dir, workplace->GetLength() - 1)); + lookForWares(); } break; case CarrierState::GoBackFromFlag: @@ -477,47 +477,47 @@ void nofCarrier::Walked() rs_dir = !rs_dir; rs_pos = cur_rs->GetLength() - rs_pos; state = CarrierState::CarryWare; - Walked(); + walked(); } break; case CarrierState::BoatcarrierWanderOnWater: { - WanderOnWater(); + wanderOnWater(); } break; } } -void nofCarrier::LookForWares() +void nofCarrier::lookForWares() { // Gibts an dieser Flagge etwas, das ich tragen muss? - if(workplace->AreWareJobs(!rs_dir, ct, true)) + if(workplace->areWareJobs(!rs_dir, ct, true)) { // Dann soll das FetchWare übernehmen - FetchWare(false); - } else if(workplace->AreWareJobs(rs_dir, ct, false)) + fetchWare(false); + } else if(workplace->areWareJobs(rs_dir, ct, false)) { // Oder evtl auf der anderen Seite? state = CarrierState::FetchWare; rs_dir = !rs_dir; rs_pos = 0; - StartWalking(cur_rs->getDir(rs_dir, rs_pos)); + startWalking(cur_rs->getDir(rs_dir, rs_pos)); } else { // Wieder zurück in die Mitte gehen state = CarrierState::GotoMiddleOfRoad; rs_dir = !rs_dir; rs_pos = 0; - StartWalking(cur_rs->getDir(rs_dir, rs_pos)); + startWalking(cur_rs->getDir(rs_dir, rs_pos)); } } -void nofCarrier::GoalReached() +void nofCarrier::goalReached() { // Erstes Produktivitätsevent anmelden - productivity_ev = getEvMgr().AddEvent(this, PRODUCTIVITY_GF, 1); + productivity_ev = getEvMgr().addEvent(this, PRODUCTIVITY_GF, 1); // Wir arbeiten schonmal - StartWorking(); + startWorking(); auto* rn = world->getSpecObj(pos); for(const auto dir : helpers::EnumRange{}) @@ -526,7 +526,7 @@ void nofCarrier::GoalReached() if(rn->getRoute(dir) == workplace) { // Am neuen Arbeitsplatz angekommen - StartWalking(dir); + startWalking(dir); cur_rs = workplace; rs_pos = 0; rs_dir = rn != cur_rs->getF1(); @@ -534,19 +534,19 @@ void nofCarrier::GoalReached() state = CarrierState::GotoMiddleOfRoad; // Wenn hier schon Waren liegen, diese gleich transportieren - if(workplace->AreWareJobs(rs_dir, ct, true)) + if(workplace->areWareJobs(rs_dir, ct, true)) { // Ware aufnehmen - carried_ware = static_cast(rn)->SelectWare(getCurMoveDir(), false, this); + carried_ware = static_cast(rn)->selectWare(getCurMoveDir(), false, this); if(carried_ware) { - carried_ware->Carry(assertNonNull(rs_dir ? workplace->getF1() : workplace->getF2())); + carried_ware->carry(assertNonNull(rs_dir ? workplace->getF1() : workplace->getF2())); state = CarrierState::CarryWare; } } // wenn was an der gegenüberliegenden Flaggge liegt, ebenfalls holen - else if(workplace->AreWareJobs(!rs_dir, ct, false)) + else if(workplace->areWareJobs(!rs_dir, ct, false)) state = CarrierState::FetchWare; return; } @@ -555,11 +555,11 @@ void nofCarrier::GoalReached() LOG.write("nofCarrier::GoalReached: ERROR: Road of carrier (id: %u) not found!\n") % getObjId(); } -void nofCarrier::AbrogateWorkplace() +void nofCarrier::abrogateWorkplace() { if(workplace) { - getEvMgr().RemoveEvent(productivity_ev); + getEvMgr().removeEvent(productivity_ev); // anderen Träger herausfinden unsigned other = (ct == CarrierType::Donkey) ? 0 : 1; @@ -569,26 +569,26 @@ void nofCarrier::AbrogateWorkplace() if((state == CarrierState::LeaveBuilding || state == CarrierState::CarryWareToBuilding) && workplace->hasCarrier(other)) { - if(workplace->AreWareJobs(false, ct, true)) - workplace->getCarrier(other)->AddWareJob(workplace->getF1()); - else if(workplace->AreWareJobs(true, ct, true)) - workplace->getCarrier(other)->AddWareJob(workplace->getF2()); + if(workplace->areWareJobs(false, ct, true)) + workplace->getCarrier(other)->addWareJob(workplace->getF1()); + else if(workplace->areWareJobs(true, ct, true)) + workplace->getCarrier(other)->addWareJob(workplace->getF2()); } - workplace->CarrierAbrogated(this); + workplace->carrierAbrogated(this); workplace = nullptr; - LooseWare(); + looseWare(); state = CarrierState::FigureWork; } } -void nofCarrier::LooseWare() +void nofCarrier::looseWare() { // Wenn ich noch ne Ware in der Hand habe, muss die gelöscht werden if(carried_ware) { - carried_ware->WareLost(player); + carried_ware->wareLost(player); destroyAndDelete(carried_ware); } } @@ -606,17 +606,17 @@ struct IsCoastalAndForFigs }; } // namespace -void nofCarrier::LostWork() +void nofCarrier::lostWork() { workplace = nullptr; - getEvMgr().RemoveEvent(productivity_ev); + getEvMgr().removeEvent(productivity_ev); if(state == CarrierState::FigureWork) - GoHome(); + goHome(); else { // Wenn ich noch ne Ware in der Hand habe, muss die gelöscht werden - LooseWare(); + looseWare(); // Is this a boat carrier (i.e. he is on the water) if(ct == CarrierType::Boat) @@ -638,7 +638,7 @@ void nofCarrier::LostWork() { // 10x the node distance should be enough, otherwise it would be to far to paddle const unsigned maxDistance = maxNodeDistance * 10; - if(it == tmpPos || world->FindShipPath(tmpPos, it, maxDistance, &shore_path, nullptr)) + if(it == tmpPos || world->findShipPath(tmpPos, it, maxDistance, &shore_path, nullptr)) { // Ok let's paddle to the coast rs_pos = 0; @@ -646,20 +646,20 @@ void nofCarrier::LostWork() const auto oldState = state; state = CarrierState::BoatcarrierWanderOnWater; if(oldState == CarrierState::WaitForWare || oldState == CarrierState::WaitForWareSpace) - WanderOnWater(); + wanderOnWater(); return; } } } - StartWandering(); + startWandering(); if(state == CarrierState::WaitForWare || state == CarrierState::WaitForWareSpace) - Wander(); + wander(); } state = CarrierState::FigureWork; } -void nofCarrier::RoadSplitted(RoadSegment* rs1, RoadSegment* rs2) +void nofCarrier::roadSplitted(RoadSegment* rs1, RoadSegment* rs2) { // Bin ich schon auf meinem Arbeitsplatz (=Straße) oder bin ich erst noch auf dem Weg dorthin? if(state == CarrierState::FigureWork) @@ -691,13 +691,13 @@ void nofCarrier::RoadSplitted(RoadSegment* rs1, RoadSegment* rs2) { // Wenn wir stehen, müssen wir in die Mitte laufen state = CarrierState::GotoMiddleOfRoad; - Walked(); + walked(); } break; case CarrierState::FetchWare: { // Wenn wir zur 2. Flagge vom 1. Wegstück gelaufen sind, können wir das nun vergessen - if(!workplace->AreWareJobs(!rs_dir, ct, false)) + if(!workplace->areWareJobs(!rs_dir, ct, false)) state = CarrierState::GotoMiddleOfRoad; } break; @@ -718,12 +718,12 @@ void nofCarrier::RoadSplitted(RoadSegment* rs1, RoadSegment* rs2) RTTR_Assert(otherRoad->getCarrier(carrierNr) == nullptr); // No carrier expected if(ct == CarrierType::Normal) - world->getPlayer(player).FindCarrierForRoad(*otherRoad); + world->getPlayer(player).findCarrierForRoad(*otherRoad); else if(ct == CarrierType::Donkey) - otherRoad->setCarrier(1, world->getPlayer(player).OrderDonkey(*otherRoad)); + otherRoad->setCarrier(1, world->getPlayer(player).orderDonkey(*otherRoad)); } -void nofCarrier::HandleDerivedEvent(const unsigned id) +void nofCarrier::handleDerivedEvent(const unsigned id) { switch(id) { @@ -748,17 +748,17 @@ void nofCarrier::HandleDerivedEvent(const unsigned id) worked_gf = 0; // Nächstes Event anmelden - productivity_ev = getEvMgr().AddEvent(this, PRODUCTIVITY_GF, 1); + productivity_ev = getEvMgr().addEvent(this, PRODUCTIVITY_GF, 1); // Reif für einen Esel? if(productivity >= DONKEY_PRODUCTIVITY && ct == CarrierType::Normal) - workplace->UpgradeDonkeyRoad(); + workplace->upgradeDonkeyRoad(); } break; } } -bool nofCarrier::AddWareJob(const noRoadNode* rn) +bool nofCarrier::addWareJob(const noRoadNode* rn) { // Wenn wir rumstehen, sollten wir mal loslaufen! ^^und ggf umdrehen, genauso wie beim Laufen in die Mitte if(state == CarrierState::WaitForWare || state == CarrierState::GotoMiddleOfRoad) @@ -776,9 +776,9 @@ bool nofCarrier::AddWareJob(const noRoadNode* rn) // Und loslaufen, wenn wir stehen if(state == CarrierState::WaitForWare) { - StartWalking(cur_rs->getDir(rs_dir, rs_pos)); + startWalking(cur_rs->getDir(rs_dir, rs_pos)); // Endlich wird wieder ordentlich gearbeitet! - StartWorking(); + startWorking(); } state = CarrierState::FetchWare; @@ -788,7 +788,7 @@ bool nofCarrier::AddWareJob(const noRoadNode* rn) } else if(state == CarrierState::WaitForWareSpace && rs_dir == !workplace->getNodeID(*rn)) { // Wenn wir auf einen freien Platz warten, können wir nun losgehen, da wir ja die Waren dann "tauschen" können - StartWalking(cur_rs->getDir(rs_dir, rs_pos)); + startWalking(cur_rs->getDir(rs_dir, rs_pos)); state = CarrierState::CarryWare; // Wir übernehmen den Job @@ -799,14 +799,14 @@ bool nofCarrier::AddWareJob(const noRoadNode* rn) return false; } -void nofCarrier::RemoveWareJob() +void nofCarrier::removeWareJob() { if(state == CarrierState::FetchWare) { // ACHTUNG!!! // Muss das if dorthin oder nicht?! //// Ist gar keine Ware mehr an der Flagge, zu der ich gehe? - if(!workplace->AreWareJobs(!rs_dir, ct, false)) + if(!workplace->areWareJobs(!rs_dir, ct, false)) //{ //// Wenn es an der anderen Flagge noch einen gibt, dort hin gehen // if(workplace->AreWareJobs(rs_dir)) @@ -823,38 +823,38 @@ void nofCarrier::RemoveWareJob() } } -void nofCarrier::FetchWare(const bool swap_wares) +void nofCarrier::fetchWare(const bool swap_wares) { // Ware aufnehmnen - carried_ware = world->getSpecObj(pos)->SelectWare(getCurMoveDir() + 3u, swap_wares, this); + carried_ware = world->getSpecObj(pos)->selectWare(getCurMoveDir() + 3u, swap_wares, this); if(carried_ware) { - carried_ware->Carry(assertNonNull(rs_dir ? workplace->getF2() : workplace->getF1())); + carried_ware->carry(assertNonNull(rs_dir ? workplace->getF2() : workplace->getF1())); // Und zum anderen Ende laufen state = CarrierState::CarryWare; rs_dir = !rs_dir; rs_pos = 0; - StartWalking(cur_rs->getDir(rs_dir, rs_pos)); + startWalking(cur_rs->getDir(rs_dir, rs_pos)); } else // zurücklaufen lassen state = CarrierState::GotoMiddleOfRoad; } -bool nofCarrier::SpaceAtFlag(const bool flag) +bool nofCarrier::spaceAtFlag(const bool flag) { // Interessiert uns nur, wenn wir auf einen freien Platz warten if(state == CarrierState::WaitForWareSpace && rs_dir == !flag) { // In Richtung Flagge laufen, um Ware dort abzulegen - StartWalking(cur_rs->getDir(rs_dir, rs_pos)); + startWalking(cur_rs->getDir(rs_dir, rs_pos)); state = CarrierState::CarryWare; return true; } else return false; } -bool nofCarrier::WantInBuilding(bool* calculated) +bool nofCarrier::wantInBuilding(bool* calculated) { RoadSegment* rs = static_cast((rs_dir ? cur_rs->getF1() : cur_rs->getF2()))->getRoute(Direction::NorthWest); @@ -869,12 +869,12 @@ bool nofCarrier::WantInBuilding(bool* calculated) *calculated = true; } - carried_ware->RecalcRoute(); + carried_ware->recalcRoute(); return carried_ware->getNextDir() == RoadPathDirection::NorthWest; } /// Für Produktivitätsmessungen: fängt an zu arbeiten -void nofCarrier::StartWorking() +void nofCarrier::startWorking() { // Wenn noch kein Zeitpunkt festgesetzt wurde, jetzt merken if(since_working_gf == 0xFFFFFFFF) @@ -882,7 +882,7 @@ void nofCarrier::StartWorking() } /// Für Produktivitätsmessungen: hört auf zu arbeiten -void nofCarrier::StopWorking() +void nofCarrier::stopWorking() { // Falls wir vorher nicht gearbeitet haben, diese Zeit merken für die Produktivität if(since_working_gf != 0xFFFFFFFF) @@ -900,9 +900,9 @@ void nofCarrier::correctSplitDataDerived() { // Dann die Location von der Ware aktualisieren if(!rs_dir) - carried_ware->Carry(assertNonNull(cur_rs->getF2())); + carried_ware->carry(assertNonNull(cur_rs->getF2())); else - carried_ware->Carry(assertNonNull(cur_rs->getF1())); + carried_ware->carry(assertNonNull(cur_rs->getF1())); } } @@ -916,20 +916,20 @@ noRoadNode* nofCarrier::getSecondFlag() const } /// Boat carrier paddles to the coast after his road was destroyed -void nofCarrier::WanderOnWater() +void nofCarrier::wanderOnWater() { // Are we already there? if(rs_pos == shore_path.size()) { // Start normal wandering at the land state = CarrierState::FigureWork; - StartWandering(); - Wander(); + startWandering(); + wander(); shore_path.clear(); } else { // Continue paddling to the coast - StartWalking(shore_path[rs_pos]); + startWalking(shore_path[rs_pos]); ++rs_pos; } } diff --git a/libs/s25main/figures/nofCarrier.h b/libs/s25main/figures/nofCarrier.h index ebf643c169..690419c1ea 100644 --- a/libs/s25main/figures/nofCarrier.h +++ b/libs/s25main/figures/nofCarrier.h @@ -69,34 +69,34 @@ class nofCarrier : public noFigure /// For boat carriers: path to the shore std::vector shore_path; - void GoalReached() override; - void Walked() override; - void AbrogateWorkplace() override; + void goalReached() override; + void walked() override; + void abrogateWorkplace() override; /// Make the carrier loose/destroy the ware if he has any - void LooseWare(); + void looseWare(); - void HandleDerivedEvent(unsigned id) override; + void handleDerivedEvent(unsigned id) override; /// Nach dem Tragen der Ware, guckt der Träger an beiden Flagge, obs Waren gibt, holt/trägt diese ggf oder geht /// ansonsten wieder in die Mitte - void LookForWares(); + void lookForWares(); /// Nimmt eine Ware auf an der aktuellen Flagge und dreht sich um, um sie zu tragen (fetch_dir ist die Richtung der /// Waren, die der Träger aufnehmen will) - void FetchWare(bool swap_wares); + void fetchWare(bool swap_wares); /// Prüft, ob die getragene Ware dann von dem Weg zum Gebäude will - bool WantInBuilding(bool* calculated); + bool wantInBuilding(bool* calculated); /// Für Produktivitätsmessungen: fängt an zu arbeiten - void StartWorking(); + void startWorking(); /// Für Produktivitätsmessungen: hört auf zu arbeiten - void StopWorking(); + void stopWorking(); /// Bestimmt neuen Animationszeitpunkt void setNewAnimationMoment(); /// Boat carrier paddles to the coast after his road was destroyed - void WanderOnWater(); + void wanderOnWater(); public: nofCarrier(CarrierType ct, MapPoint pos, unsigned char player, RoadSegment* workplace, noRoadNode* goal); @@ -107,7 +107,7 @@ class nofCarrier : public noFigure void Serialize(SerializedGameData& sgd) const override; - void Destroy() override; + void destroy() override; GO_Type getGOT() const final { return GO_Type::NofCarrier; } @@ -118,25 +118,25 @@ class nofCarrier : public noFigure /// Gibt Träger-Produktivität in % zurück unsigned getProductivity() const { return productivity; } - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; /// Wird aufgerufen, wenn der Weg des Trägers abgerissen wurde - void LostWork(); + void lostWork(); /// Wird aufgerufen, wenn der Arbeitsplatz des Trägers durch eine Flagge geteilt wurde /// der Träger sucht sich damit einen der beiden als neuen Arbeitsplatz, geht zur Mitte und ruft einen neuen Träger /// für das 2. Wegstück - void RoadSplitted(RoadSegment* rs1, RoadSegment* rs2); + void roadSplitted(RoadSegment* rs1, RoadSegment* rs2); /// Sagt dem Träger Bescheid, dass es an einer Flagge noch eine Ware zu transportieren gibt - bool AddWareJob(const noRoadNode* rn); + bool addWareJob(const noRoadNode* rn); /// Das Gegnteil von AddWareJob: wenn eine Ware nicht mehr transportiert werden will, sagt sie dem Träger Bescheid, /// damit er nicht unnötig dort hinläuft zur Flagge - void RemoveWareJob(); + void removeWareJob(); /// Benachrichtigt den Träger, wenn an einer auf seinem Weg an einer Flagge wieder ein freier Platz ist /// gibt zurück, ob der Träger diesen freien Platz auch nutzen wird - bool SpaceAtFlag(bool flag); + bool spaceAtFlag(bool flag); /// Gibt erste Flagge des Arbeitsweges zurück, falls solch einer existiert noRoadNode* getFirstFlag() const; diff --git a/libs/s25main/figures/nofCatapultMan.cpp b/libs/s25main/figures/nofCatapultMan.cpp index 99a3028db7..ff6f73eec8 100644 --- a/libs/s25main/figures/nofCatapultMan.cpp +++ b/libs/s25main/figures/nofCatapultMan.cpp @@ -21,7 +21,7 @@ const std::array STONE_STARTS = {{{-4, -48}, {-3, -47}, {-13, -47}, {-11, -48}, {-13, -47}, {-2, -47}}}; nofCatapultMan::PossibleTarget::PossibleTarget(SerializedGameData& sgd) - : pos(sgd.PopMapPoint()), distance(sgd.PopUnsignedInt()) + : pos(sgd.popMapPoint()), distance(sgd.PopUnsignedInt()) {} void nofCatapultMan::PossibleTarget::Serialize(SerializedGameData& sgd) const @@ -46,9 +46,9 @@ void nofCatapultMan::Serialize(SerializedGameData& sgd) const target.PossibleTarget::Serialize(sgd); } -void nofCatapultMan::WalkedDerived() {} +void nofCatapultMan::walkedDerived() {} -void nofCatapultMan::DrawWorking(DrawPoint drawPt) +void nofCatapultMan::drawWorking(DrawPoint drawPt) { // Offset of the catapult drawPt -= DrawPoint(7, 19); @@ -57,7 +57,7 @@ void nofCatapultMan::DrawWorking(DrawPoint drawPt) default: return; case State::CatapultTargetBuilding: { - int step = GAMECLIENT.Interpolate(std::abs(wheel_steps) + 1, current_ev); + int step = GAMECLIENT.interpolate(std::abs(wheel_steps) + 1, current_ev); if(step <= std::abs(wheel_steps)) { @@ -65,7 +65,7 @@ void nofCatapultMan::DrawWorking(DrawPoint drawPt) step = -step; // Katapult auf dem Dach mit Stein drehend zeichnen - LOADER.getPlayerImage("rom_bobs", 1781 + (7 + step) % 6)->DrawFull(drawPt); + LOADER.getPlayerImage("rom_bobs", 1781 + (7 + step) % 6)->drawFull(drawPt); } // else // // Katapult schießend zeichnen @@ -74,11 +74,11 @@ void nofCatapultMan::DrawWorking(DrawPoint drawPt) break; case State::CatapultBackoff: { - int step = GAMECLIENT.Interpolate((std::abs(wheel_steps) + 3) * 2, current_ev); + int step = GAMECLIENT.interpolate((std::abs(wheel_steps) + 3) * 2, current_ev); if(step < 2 * 3) // Katapult nach Schießen zeichnen (hin und her wippen - LOADER.getPlayerImage("rom_bobs", 1787 + (step % 2) * 6 + (7 + wheel_steps) % 6)->DrawFull(drawPt); + LOADER.getPlayerImage("rom_bobs", 1787 + (step % 2) * 6 + (7 + wheel_steps) % 6)->drawFull(drawPt); else { step = (step - 6) / 2; @@ -87,14 +87,14 @@ void nofCatapultMan::DrawWorking(DrawPoint drawPt) step = -(step); // Katapult auf dem Dach mit Stein drehend zeichnen (zurück in Ausgangsposition: Richtung 4) - LOADER.getPlayerImage("rom_bobs", 1775 + (7 + wheel_steps - step) % 6)->DrawFull(drawPt); + LOADER.getPlayerImage("rom_bobs", 1775 + (7 + wheel_steps - step) % 6)->drawFull(drawPt); } } break; } } -void nofCatapultMan::HandleDerivedEvent(const unsigned /*id*/) +void nofCatapultMan::handleDerivedEvent(const unsigned /*id*/) { switch(state) { @@ -106,7 +106,7 @@ void nofCatapultMan::HandleDerivedEvent(const unsigned /*id*/) // Liste von potentiellen Zielen std::vector possibleTargets; - sortedMilitaryBlds buildings = world->LookForMilitaryBuildings(pos, 3); + sortedMilitaryBlds buildings = world->lookForMilitaryBuildings(pos, 3); for(auto* building : buildings) { // Auch ein richtiges Militärgebäude (kein HQ usw.), @@ -118,7 +118,7 @@ void nofCatapultMan::HandleDerivedEvent(const unsigned /*id*/) && !static_cast(building)->isNewBuilt()) { // Entfernung ausrechnen - unsigned distance = world->CalcDistance(pos, building->getPos()); + unsigned distance = world->calcDistance(pos, building->getPos()); // Entfernung nicht zu hoch? if(distance <= CATAPULT_MAX_TARGET_RANGE) @@ -134,13 +134,13 @@ void nofCatapultMan::HandleDerivedEvent(const unsigned /*id*/) if(possibleTargets.empty()) { // Weiter warten, vielleicht gibts ja später wieder mal was - current_ev = getEvMgr().AddEvent(this, CATAPULT_WAIT1_LENGTH, 1); - workplace->StartNotWorking(); + current_ev = getEvMgr().addEvent(this, CATAPULT_WAIT1_LENGTH, 1); + workplace->startNotWorking(); return; } // Waren verbrauchen - workplace->ConsumeWares(); + workplace->consumeWares(); // Eins zufällig auswählen target = RANDOM_ELEMENT(possibleTargets); @@ -203,7 +203,7 @@ void nofCatapultMan::HandleDerivedEvent(const unsigned /*id*/) if(wheel_steps < -3) wheel_steps = 6 + wheel_steps; - current_ev = getEvMgr().AddEvent(this, 15 * (std::abs(wheel_steps) + 1), 1); + current_ev = getEvMgr().addEvent(this, 15 * (std::abs(wheel_steps) + 1), 1); state = State::CatapultTargetBuilding; @@ -266,10 +266,10 @@ void nofCatapultMan::HandleDerivedEvent(const unsigned /*id*/) } // Stein erzeugen - world->AddCatapultStone(new CatapultStone(target.pos, destMap, start, dest, 80)); + world->addCatapultStone(new CatapultStone(target.pos, destMap, start, dest, 80)); // Katapult wieder in Ausgangslage zurückdrehen - current_ev = getEvMgr().AddEvent(this, 15 * (std::abs(wheel_steps) + 3), 1); + current_ev = getEvMgr().addEvent(this, 15 * (std::abs(wheel_steps) + 3), 1); state = State::CatapultBackoff; } @@ -280,10 +280,10 @@ void nofCatapultMan::HandleDerivedEvent(const unsigned /*id*/) // wir arbeiten nicht mehr workplace->is_working = false; // Wieder versuchen, zu arbeiten - TryToWork(); + tryToWork(); } break; } } -void nofCatapultMan::WorkAborted() {} +void nofCatapultMan::workAborted() {} diff --git a/libs/s25main/figures/nofCatapultMan.h b/libs/s25main/figures/nofCatapultMan.h index 2e54058f7f..6e2b070121 100644 --- a/libs/s25main/figures/nofCatapultMan.h +++ b/libs/s25main/figures/nofCatapultMan.h @@ -34,9 +34,9 @@ class nofCatapultMan : public nofBuildingWorker private: /// Funktionen, die nur von der Basisklasse (noFigure) aufgerufen werden, wenn man gelaufen ist - void WalkedDerived() override; + void walkedDerived() override; /// Malt den Arbeiter beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override { return 0; } @@ -48,8 +48,8 @@ class nofCatapultMan : public nofBuildingWorker GO_Type getGOT() const final { return GO_Type::NofCatapultman; } - void HandleDerivedEvent(unsigned id) override; + void handleDerivedEvent(unsigned id) override; /// wird aufgerufen, wenn die Arbeit abgebrochen wird (von nofBuildingWorker aufgerufen) - void WorkAborted() override; + void workAborted() override; }; diff --git a/libs/s25main/figures/nofCharburner.cpp b/libs/s25main/figures/nofCharburner.cpp index 93123ca9d8..f4f4f22003 100644 --- a/libs/s25main/figures/nofCharburner.cpp +++ b/libs/s25main/figures/nofCharburner.cpp @@ -21,7 +21,7 @@ nofCharburner::nofCharburner(const MapPoint pos, const unsigned char player, nob {} nofCharburner::nofCharburner(SerializedGameData& sgd, const unsigned obj_id) - : nofFarmhand(sgd, obj_id), harvest(sgd.PopBool()), wt(sgd.Pop()) + : nofFarmhand(sgd, obj_id), harvest(sgd.PopBool()), wt(sgd.pop()) {} void nofCharburner::Serialize(SerializedGameData& sgd) const @@ -29,15 +29,15 @@ void nofCharburner::Serialize(SerializedGameData& sgd) const nofFarmhand::Serialize(sgd); sgd.PushBool(harvest); - sgd.PushEnum(wt); + sgd.pushEnum(wt); } /// Malt den Arbeiter beim Arbeiten -void nofCharburner::DrawWorking(DrawPoint drawPt) +void nofCharburner::drawWorking(DrawPoint drawPt) { if(harvest) { - unsigned short now_id = GAMECLIENT.Interpolate(39, current_ev); + unsigned short now_id = GAMECLIENT.interpolate(39, current_ev); // Schaufel-Sound if(now_id == 6 || now_id == 18 || now_id == 30) @@ -53,10 +53,10 @@ void nofCharburner::DrawWorking(DrawPoint drawPt) draw_id = 9 + 12 + (now_id - 36); LOADER.getPlayerImage("charburner_bobs", draw_id) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } else - LOADER.getPlayerImage("charburner_bobs", 1 + GAMECLIENT.Interpolate(18, current_ev) % 6) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + LOADER.getPlayerImage("charburner_bobs", 1 + GAMECLIENT.interpolate(18, current_ev) % 6) + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } #ifdef _MSC_VER @@ -74,10 +74,10 @@ unsigned short nofCharburner::getCarryID() const #endif /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) -void nofCharburner::WorkStarted() {} +void nofCharburner::workStarted() {} /// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten -void nofCharburner::WorkFinished() +void nofCharburner::workFinished() { noBase* no = world->getNO(pos); @@ -89,7 +89,7 @@ void nofCharburner::WorkFinished() // Then let's bring a coal to our house ware = GoodType::Coal; // One step further - static_cast(no)->NextStep(); + static_cast(no)->nextStep(); return; } @@ -103,12 +103,12 @@ void nofCharburner::WorkFinished() if(noType == NodalObjectType::Environment || noType == NodalObjectType::Nothing) { - world->DestroyNO(pos, false); + world->destroyNO(pos, false); // Plant charburner pile world->setNO(pos, new noCharburnerPile(pos)); // BQ drumrum neu berechnen - world->RecalcBQAroundPointBig(pos); + world->recalcBQAroundPointBig(pos); } } } @@ -130,7 +130,7 @@ nofFarmhand::PointQuality nofCharburner::getPointQuality(const MapPoint pt, cons if(pileState == noCharburnerPile::State::Wood) { // Only check for resources before going out - if(isBeforeWork && !workplace->WaresAvailable()) + if(isBeforeWork && !workplace->waresAvailable()) return PointQuality::NotPossible; else // Only second class, harvest all piles first before continue @@ -144,7 +144,7 @@ nofFarmhand::PointQuality nofCharburner::getPointQuality(const MapPoint pt, cons // Try to "plant" a new pile // Enough wares when starting new work? - if(isBeforeWork && !workplace->WaresAvailable()) + if(isBeforeWork && !workplace->waresAvailable()) return PointQuality::NotPossible; // Der Platz muss frei sein @@ -180,7 +180,7 @@ nofFarmhand::PointQuality nofCharburner::getPointQuality(const MapPoint pt, cons } /// Inform derived class about the start of the whole working process (at the beginning when walking out of the house) -void nofCharburner::WalkingStarted() +void nofCharburner::walkingStarted() { noBase* nob = world->getNO(dest); if(nob->getGOT() == GO_Type::Charburnerpile) @@ -191,7 +191,7 @@ void nofCharburner::WalkingStarted() // Consume wares if we carry a ware if(!harvest) { - workplace->ConsumeWares(); + workplace->consumeWares(); // Dertermine ware which we should carry to the pile if(nob->getGOT() != GO_Type::Charburnerpile) wt = WareType::Wood; @@ -201,14 +201,14 @@ void nofCharburner::WalkingStarted() } /// Draws the figure while returning home / entering the building (often carrying wares) -void nofCharburner::DrawWalkingWithWare(DrawPoint drawPt) +void nofCharburner::drawWalkingWithWare(DrawPoint drawPt) { - DrawWalking(drawPt, "charburner_bobs", 200); + drawWalking(drawPt, "charburner_bobs", 200); } /// Draws the charburner while walking /// (overriding standard method of nofFarmhand) -void nofCharburner::DrawOtherStates(DrawPoint drawPt) +void nofCharburner::drawOtherStates(DrawPoint drawPt) { switch(state) { @@ -218,19 +218,19 @@ void nofCharburner::DrawOtherStates(DrawPoint drawPt) if(!harvest) { if(wt == WareType::Wood) - DrawWalking(drawPt, "charburner_bobs", 102); + drawWalking(drawPt, "charburner_bobs", 102); else - DrawWalking(drawPt, "charburner_bobs", 151); + drawWalking(drawPt, "charburner_bobs", 151); } else // Draw normal walking - DrawWalking(drawPt); + drawWalking(drawPt); } break; default: return; } } -bool nofCharburner::AreWaresAvailable() const +bool nofCharburner::areWaresAvailable() const { // Charburner doesn't need wares for harvesting! // -> Wares are considered when calling GetPointQuality! diff --git a/libs/s25main/figures/nofCharburner.h b/libs/s25main/figures/nofCharburner.h index 32915027c8..6deda72b27 100644 --- a/libs/s25main/figures/nofCharburner.h +++ b/libs/s25main/figures/nofCharburner.h @@ -23,12 +23,12 @@ class nofCharburner : public nofFarmhand friend constexpr auto maxEnumValue(WareType) { return WareType::Grain; } private: - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Has no ID in jobs.bob or carrier.bob [[noreturn]] unsigned short getCarryID() const override; - void WorkStarted() override; - void WorkFinished() override; + void workStarted() override; + void workFinished() override; /// Returns the quality of this working point or determines if the worker can work here at all PointQuality getPointQuality(MapPoint pt, bool isBeforeWork) const override; @@ -36,16 +36,16 @@ class nofCharburner : public nofFarmhand /// Inform derived class about the start of the whole working process (at the beginning when walking out of the /// house) - void WalkingStarted() override; + void walkingStarted() override; /// Draws the figure while returning home / entering the building (often carrying wares) - void DrawWalkingWithWare(DrawPoint drawPt) override; + void drawWalkingWithWare(DrawPoint drawPt) override; /// Draws the charburner while walking /// (overriding standard method of nofFarmhand) - void DrawOtherStates(DrawPoint drawPt) override; + void drawOtherStates(DrawPoint drawPt) override; protected: - bool AreWaresAvailable() const override; + bool areWaresAvailable() const override; public: nofCharburner(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofDefender.cpp b/libs/s25main/figures/nofDefender.cpp index b55e6a07d4..5579562ca8 100644 --- a/libs/s25main/figures/nofDefender.cpp +++ b/libs/s25main/figures/nofDefender.cpp @@ -29,26 +29,26 @@ void nofDefender::Serialize(SerializedGameData& sgd) const nofActiveSoldier::Serialize(sgd); if(state != SoldierState::FigureWork) - sgd.PushObject(attacker, true); + sgd.pushObject(attacker, true); } nofDefender::nofDefender(SerializedGameData& sgd, const unsigned obj_id) : nofActiveSoldier(sgd, obj_id) { if(state != SoldierState::FigureWork) - attacker = sgd.PopObject(GO_Type::NofAttacker); + attacker = sgd.popObject(GO_Type::NofAttacker); else attacker = nullptr; } -void nofDefender::Walked() +void nofDefender::walked() { switch(state) { case SoldierState::DefendingWalkingTo: // Start fight with attacker - world->AddFigure(pos, std::make_unique(*attacker, *this)); + world->addFigure(pos, std::make_unique(*attacker, *this)); state = SoldierState::Fighting; - attacker->FightVsDefenderStarted(); + attacker->fightVsDefenderStarted(); break; case SoldierState::DefendingWalkingFrom: if(!homeBld) @@ -56,8 +56,8 @@ void nofDefender::Walked() // Home destroyed -> Start wandering around attacker = nullptr; state = SoldierState::FigureWork; - StartWandering(); - Wander(); + startWandering(); + wander(); } else { // Arrived in building @@ -65,12 +65,12 @@ void nofDefender::Walked() { // An attacker arrived in the meantime so go back out state = SoldierState::DefendingWalkingTo; - StartWalking(Direction::SouthEast); + startWalking(Direction::SouthEast); } else { nobBaseMilitary* bld = homeBld; RTTR_Assert(bld->getDefender() == this); // I should be the defender - bld->AddActiveSoldier(world->RemoveFigure(pos, *this)); + bld->addActiveSoldier(world->RemoveFigure(pos, *this)); RTTR_Assert(!bld->getDefender()); // No defender anymore } } @@ -79,7 +79,7 @@ void nofDefender::Walked() } } -void nofDefender::HomeDestroyed() +void nofDefender::homeDestroyed() { homeBld = nullptr; @@ -89,13 +89,13 @@ void nofDefender::HomeDestroyed() // Handle now as we are not moving attacker = nullptr; state = SoldierState::FigureWork; - StartWandering(); - Wander(); + startWandering(); + wander(); break; case SoldierState::DefendingWalkingTo: case SoldierState::DefendingWalkingFrom: attacker = nullptr; - StartWandering(); + startWandering(); state = SoldierState::FigureWork; break; case SoldierState::Fighting: @@ -104,21 +104,21 @@ void nofDefender::HomeDestroyed() } } -void nofDefender::HomeDestroyedAtBegin() +void nofDefender::homeDestroyedAtBegin() { homeBld = nullptr; state = SoldierState::FigureWork; - StartWandering(); - StartWalking(RANDOM_ENUM(Direction)); + startWandering(); + startWalking(RANDOM_ENUM(Direction)); } -void nofDefender::WonFighting() +void nofDefender::wonFighting() { // addon BattlefieldPromotion active? -> increase rank! if(world->getGGS().isEnabled(AddonId::BATTLEFIELD_PROMOTION)) - IncreaseRank(); + increaseRank(); // Attacker is dead attacker = nullptr; @@ -126,13 +126,13 @@ void nofDefender::WonFighting() { // Home destroyed so abort and wander around state = SoldierState::FigureWork; - StartWandering(); - Wander(); + startWandering(); + wander(); return; } - attacker = homeBld->FindAttackerNearBuilding(); + attacker = homeBld->findAttackerNearBuilding(); if(attacker) { // New attacker found so wait for him @@ -141,36 +141,36 @@ void nofDefender::WonFighting() { // Otherwise go back into the building state = SoldierState::DefendingWalkingFrom; - StartWalking(Direction::NorthWest); + startWalking(Direction::NorthWest); } } -void nofDefender::LostFighting() +void nofDefender::lostFighting() { attacker = nullptr; // Notify building if it still exists if(homeBld) { - homeBld->ResetDefender(); + homeBld->resetDefender(); // A military building potentially needs to get new soldiers if this wasn't the last one if(BuildingProperties::isMilitary(homeBld->getBuildingType())) { RTTR_Assert(dynamic_cast(homeBld)); if(static_cast(homeBld)->getNumTroops()) - static_cast(homeBld)->RegulateTroops(); + static_cast(homeBld)->regulateTroops(); } homeBld = nullptr; } } -void nofDefender::AttackerArrested() +void nofDefender::attackerArrested() { - attacker = homeBld->FindAttackerNearBuilding(); + attacker = homeBld->findAttackerNearBuilding(); if(!attacker) { // Go back into the building state = SoldierState::DefendingWalkingFrom; - StartWalking(Direction::NorthWest); + startWalking(Direction::NorthWest); } } diff --git a/libs/s25main/figures/nofDefender.h b/libs/s25main/figures/nofDefender.h index cd55355997..6a7d1b8811 100644 --- a/libs/s25main/figures/nofDefender.h +++ b/libs/s25main/figures/nofDefender.h @@ -19,50 +19,50 @@ class nofDefender : public nofActiveSoldier nofAttacker* attacker; /// Walked to the next map point - void Walked() override; + void walked() override; /// Hand back control to derived class after a fight of nofActiveSoldier, not possible for defenders - [[noreturn]] SoldierState FreeFightAborted() override + [[noreturn]] SoldierState freeFightAborted() override { throw std::logic_error("Should not participate in free fights"); } protected: - void HandleDerivedEvent [[noreturn]] (unsigned) override { throw std::logic_error("No events expected"); } + void handleDerivedEvent [[noreturn]] (unsigned) override { throw std::logic_error("No events expected"); } public: nofDefender(MapPoint pos, unsigned char player, nobBaseMilitary& home, unsigned char rank, nofAttacker& attacker); nofDefender(const nofPassiveSoldier& other, nofAttacker& attacker); nofDefender(SerializedGameData& sgd, unsigned obj_id); - void Destroy() override + void destroy() override { RTTR_Assert(!attacker); - nofActiveSoldier::Destroy(); + nofActiveSoldier::destroy(); } void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofDefender; } /// Inform that a new attacker arrived at the flag while we are going in such that we can come right back - void NewAttacker(nofAttacker& attacker) { this->attacker = &attacker; } + void newAttacker(nofAttacker& attacker) { this->attacker = &attacker; } /// The attacker won't come to the flag anymore - void AttackerArrested(); + void attackerArrested(); /// Home military building destroyed during mission - void HomeDestroyed() override; + void homeDestroyed() override; /// Home military building destroyed while waiting to go out - void HomeDestroyedAtBegin() override; + void homeDestroyedAtBegin() override; /// Fight was won - void WonFighting() override; + void wonFighting() override; /// Fight was lost -> Die - void LostFighting() override; + void lostFighting() override; /// Is the defender waiting at the flag for an attacker? bool isWaitingAtFlag() const { return (state == SoldierState::DefendingWaiting); } bool isFightingAtFlag() const { return (state == SoldierState::Fighting); } /// Inform the defender that a fight between him and an attacker has started - void FightStarted() { state = SoldierState::Fighting; } + void fightStarted() { state = SoldierState::Fighting; } // For debugging const nofAttacker* getAttacker() const { return attacker; } diff --git a/libs/s25main/figures/nofDonkeybreeder.cpp b/libs/s25main/figures/nofDonkeybreeder.cpp index 7a5d49c080..93700732fc 100644 --- a/libs/s25main/figures/nofDonkeybreeder.cpp +++ b/libs/s25main/figures/nofDonkeybreeder.cpp @@ -23,19 +23,19 @@ nofDonkeybreeder::nofDonkeybreeder(SerializedGameData& sgd, unsigned obj_id) : n /** * Zeichnet ihn beim Arbeiten. */ -void nofDonkeybreeder::DrawWorking(DrawPoint drawPt) +void nofDonkeybreeder::drawWorking(DrawPoint drawPt) { const Nation nation = workplace->getNation(); constexpr helpers::EnumArray walk_start = {{{2, 2}, {-6, -6}, {-7, -7}, {-7, -7}, {-6, -6}}}; const helpers::EnumArray walk_length = {22, 19, 19, 23, 19}; const unsigned color = world->getPlayer(player).color; - unsigned now_id = GAMECLIENT.Interpolate(9600, current_ev); + unsigned now_id = GAMECLIENT.interpolate(9600, current_ev); DrawPoint walkBasePos = drawPt + walk_start[nation]; if(now_id < 400) { - LOADER.building_cache[nation][BuildingType::DonkeyBreeder].door.DrawFull(drawPt); + LOADER.building_cache[nation][BuildingType::DonkeyBreeder].door.drawFull(drawPt); LOADER.getBobSprite(nation, Job::DonkeyBreeder, Direction::SouthEast, (now_id / 70) % 8) .draw(walkBasePos + DrawPoint(now_id / 100, now_id / 100), COLOR_WHITE, color); } else if(now_id < 1200) @@ -43,13 +43,13 @@ void nofDonkeybreeder::DrawWorking(DrawPoint drawPt) .draw(walkBasePos + DrawPoint((now_id - 400) / 800, 4), COLOR_WHITE, color); else if(now_id < 2000) LOADER.getPlayerImage("rom_bobs", 291 + (now_id - 1200) / 100) - ->DrawFull(walkBasePos + DrawPoint(walk_length[nation] + 4, 4), COLOR_WHITE, color); + ->drawFull(walkBasePos + DrawPoint(walk_length[nation] + 4, 4), COLOR_WHITE, color); else if(now_id < 2800) LOADER.getBobSprite(nation, Job::DonkeyBreeder, Direction::West, ((now_id - 2000) / 70) % 8) .draw(walkBasePos + DrawPoint(4 + walk_length[nation] * (2800 - now_id) / 800, 4), COLOR_WHITE, color); else if(now_id < 3200) { - LOADER.building_cache[nation][BuildingType::DonkeyBreeder].door.DrawFull(drawPt); + LOADER.building_cache[nation][BuildingType::DonkeyBreeder].door.drawFull(drawPt); LOADER.getBobSprite(nation, Job::DonkeyBreeder, Direction::NorthWest, ((now_id - 2800) / 70) % 8) .draw(walkBasePos + DrawPoint((3200 - now_id) / 100, (3200 - now_id) / 100), COLOR_WHITE, color); } @@ -58,30 +58,30 @@ void nofDonkeybreeder::DrawWorking(DrawPoint drawPt) /** * Der Arbeiter erzeugt eine Ware. */ -helpers::OptionalEnum nofDonkeybreeder::ProduceWare() +helpers::OptionalEnum nofDonkeybreeder::produceWare() { /// @todo Wie kann ich hier eine Person erzeugen? return std::nullopt; } -void nofDonkeybreeder::WorkFinished() +void nofDonkeybreeder::workFinished() { // Straße und Zielflagge für Esel suchen noRoadNode* flag_goal; - RoadSegment* road = world->getPlayer(player).FindRoadForDonkey(*workplace, &flag_goal); + RoadSegment* road = world->getPlayer(player).findRoadForDonkey(*workplace, &flag_goal); // Esel erzeugen und zum Ziel beordern auto donkey = std::make_unique(CarrierType::Donkey, pos, player, road, flag_goal); - world->getPlayer(player).IncreaseInventoryJob(Job::PackDonkey, 1); - donkey->InitializeRoadWalking(world->getSpecObj(pos)->getRoute(Direction::SouthEast), 0, true); + world->getPlayer(player).increaseInventoryJob(Job::PackDonkey, 1); + donkey->initializeRoadWalking(world->getSpecObj(pos)->getRoute(Direction::SouthEast), 0, true); // Wenn keine Straße gefunden wurde, muss er nach Hause gehen if(!road) - donkey->GoHome(); + donkey->goHome(); else // ansonsten Arbeitsplatz Bescheid sagen - road->GotDonkey(donkey.get()); + road->gotDonkey(donkey.get()); // Esel absetzen - world->AddFigure(pos, std::move(donkey)).ActAtFirst(); + world->addFigure(pos, std::move(donkey)).actAtFirst(); } diff --git a/libs/s25main/figures/nofDonkeybreeder.h b/libs/s25main/figures/nofDonkeybreeder.h index 3a0fe95ccf..342794949e 100644 --- a/libs/s25main/figures/nofDonkeybreeder.h +++ b/libs/s25main/figures/nofDonkeybreeder.h @@ -20,11 +20,11 @@ class nofDonkeybreeder : public nofWorkman private: /// Zeichnet ihn beim Arbeiten. - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Der Arbeiter erzeugt eine Ware. - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; /// Wird aufgerufen, wenn er fertig mit arbeiten ist - void WorkFinished() override; + void workFinished() override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override { return 0; } diff --git a/libs/s25main/figures/nofFarmer.cpp b/libs/s25main/figures/nofFarmer.cpp index b0e4f63c8f..3fc9cc8357 100644 --- a/libs/s25main/figures/nofFarmer.cpp +++ b/libs/s25main/figures/nofFarmer.cpp @@ -29,14 +29,14 @@ nofFarmer::nofFarmer(SerializedGameData& sgd, const unsigned obj_id) : nofFarmha {} /// Malt den Arbeiter beim Arbeiten -void nofFarmer::DrawWorking(DrawPoint drawPt) +void nofFarmer::drawWorking(DrawPoint drawPt) { unsigned now_id; if(harvest) { - LOADER.getPlayerImage("rom_bobs", 140 + (now_id = GAMECLIENT.Interpolate(88, current_ev)) % 8) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 140 + (now_id = GAMECLIENT.interpolate(88, current_ev)) % 8) + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); // Evtl Sound abspielen if(now_id % 8 == 3) @@ -47,8 +47,8 @@ void nofFarmer::DrawWorking(DrawPoint drawPt) } else { - LOADER.getPlayerImage("rom_bobs", 132 + GAMECLIENT.Interpolate(88, current_ev) % 8) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 132 + GAMECLIENT.interpolate(88, current_ev) % 8) + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } } @@ -88,18 +88,18 @@ nofFarmhand::PointQuality nofFarmer::getNewFieldPointQuality(const GameWorld& wo } /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) -void nofFarmer::WorkStarted() +void nofFarmer::workStarted() { // Wenn ich zu einem Getreidefeld gehe, ernte ich es ab, ansonsten sähe ich harvest = (world->getNO(pos)->getType() == NodalObjectType::Grainfield); // Getreidefeld Bescheid sagen, damits nicht plötzlich verschwindet, während wir arbeiten if(harvest) - world->getSpecObj(pos)->BeginHarvesting(); + world->getSpecObj(pos)->beginHarvesting(); } /// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten -void nofFarmer::WorkFinished() +void nofFarmer::workFinished() { if(harvest) { @@ -110,7 +110,7 @@ void nofFarmer::WorkFinished() if(nob->getGOT() != GO_Type::Grainfield) return; unsigned mapLstId = static_cast(nob)->getHarvestMapLstID(); - world->DestroyNO(pos); + world->destroyNO(pos); world->setNO(pos, new noEnvObject(pos, mapLstId)); // Getreide, was wir geerntet haben, in die Hand nehmen @@ -127,7 +127,7 @@ void nofFarmer::WorkFinished() // Nur Zierobjekte und Schilder dürfen weggerissen werden if(noType == NodalObjectType::Environment || noType == NodalObjectType::Nothing) { - world->DestroyNO(pos, false); + world->destroyNO(pos, false); // neues Getreidefeld setzen world->setNO(pos, new noGrainfield(pos)); } @@ -137,7 +137,7 @@ void nofFarmer::WorkFinished() } // BQ drumrum neu berechnen - world->RecalcBQAroundPoint(pos); + world->recalcBQAroundPoint(pos); } /// Returns the quality of this working point or determines if the worker can work here at all @@ -156,10 +156,10 @@ nofFarmhand::PointQuality nofFarmer::getPointQuality(const MapPoint pt, bool /* return getNewFieldPointQuality(*world, pt); } -void nofFarmer::WorkAborted() +void nofFarmer::workAborted() { - nofFarmhand::WorkAborted(); + nofFarmhand::workAborted(); // dem Getreidefeld Bescheid sagen, damit es wieder verdorren kann, wenn wir abernten if(harvest && state == State::Work) - world->getSpecObj(pos)->EndHarvesting(); + world->getSpecObj(pos)->endHarvesting(); } diff --git a/libs/s25main/figures/nofFarmer.h b/libs/s25main/figures/nofFarmer.h index ecc88e3b1d..5c743bf468 100644 --- a/libs/s25main/figures/nofFarmer.h +++ b/libs/s25main/figures/nofFarmer.h @@ -16,16 +16,16 @@ class nofFarmer : public nofFarmhand bool harvest; /// Malt den Arbeiter beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override; /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) - void WorkStarted() override; + void workStarted() override; /// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten - void WorkFinished() override; + void workFinished() override; /// Abgeleitete Klasse informieren, wenn Arbeiten abgebrochen werden müssen - void WorkAborted() override; + void workAborted() override; /// Returns the quality of this working point or determines if the worker can work here at all PointQuality getPointQuality(MapPoint pt, bool isBeforeWork) const override; diff --git a/libs/s25main/figures/nofFarmhand.cpp b/libs/s25main/figures/nofFarmhand.cpp index 91878b710e..4629bb1a46 100644 --- a/libs/s25main/figures/nofFarmhand.cpp +++ b/libs/s25main/figures/nofFarmhand.cpp @@ -29,7 +29,7 @@ void nofFarmhand::Serialize(SerializedGameData& sgd) const } nofFarmhand::nofFarmhand(SerializedGameData& sgd, const unsigned obj_id) - : nofBuildingWorker(sgd, obj_id), dest(sgd.PopMapPoint()) + : nofBuildingWorker(sgd, obj_id), dest(sgd.popMapPoint()) {} unsigned nofFarmhand::getWorkRadius(const Job job) @@ -64,26 +64,26 @@ unsigned nofFarmhand::getWorkRadius(const GlobalGameSettings& ggs, const Job job } } -void nofFarmhand::WalkedDerived() +void nofFarmhand::walkedDerived() { switch(state) { - case State::WalkToWorkpoint: WalkToWorkpoint(); break; - case State::WalkingHome: WalkHome(); break; + case State::WalkToWorkpoint: walkToWorkpoint(); break; + case State::WalkingHome: walkHome(); break; default: break; } } -void nofFarmhand::HandleDerivedEvent(const unsigned /*id*/) +void nofFarmhand::handleDerivedEvent(const unsigned /*id*/) { switch(state) { case State::Work: { // Done working -> Handle results of the work (step) - WorkFinished(); + workFinished(); world->setReserved(pos, false); - StartWalkingHome(); + startWalkingHome(); if(was_sounding) { @@ -132,7 +132,7 @@ void nofFarmhand::HandleDerivedEvent(const unsigned /*id*/) for(MapCoord r2 = 0; r2 < r; pt = world->getNeighbour(pt, dir), ++r2) { const auto quality = getPointQuality(pt, true); - if(quality != PointQuality::NotPossible && world->FindHumanPath(this->pos, pt, 20)) + if(quality != PointQuality::NotPossible && world->findHumanPath(this->pos, pt, 20)) { if(!world->getNode(pt).reserved) { @@ -166,15 +166,15 @@ void nofFarmhand::HandleDerivedEvent(const unsigned /*id*/) // Start working workplace->is_working = true; - workplace->StopNotWorking(); + workplace->stopNotWorking(); // Avoid others taking this point too world->setReserved(dest, true); // Walk out of the building first state = State::WalkToWorkpoint; - StartWalking(Direction::SouthEast); - WalkingStarted(); + startWalking(Direction::SouthEast); + walkingStarted(); } else { if(!wait) @@ -182,7 +182,7 @@ void nofFarmhand::HandleDerivedEvent(const unsigned /*id*/) switch(job_) { case Job::Stonemason: - case Job::Fisher: workplace->OnOutOfResources(); break; + case Job::Fisher: workplace->onOutOfResources(); break; case Job::Woodcutter: world->getNotifications().publish(BuildingNote( BuildingNote::NoRessources, player, workplace->getPos(), workplace->getBuildingType())); @@ -192,8 +192,8 @@ void nofFarmhand::HandleDerivedEvent(const unsigned /*id*/) } // Try to find something later - current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); - workplace->StartNotWorking(); + current_ev = getEvMgr().addEvent(this, JOB_CONSTS[job_].wait1_length, 1); + workplace->startNotWorking(); } } break; @@ -201,70 +201,70 @@ void nofFarmhand::HandleDerivedEvent(const unsigned /*id*/) } } -void nofFarmhand::WalkToWorkpoint() +void nofFarmhand::walkToWorkpoint() { if(getPointQuality(dest) == PointQuality::NotPossible) { // Point became invalid -> Abort and go home - WorkAborted(); - StartWalkingHome(); + workAborted(); + startWalkingHome(); } else if(pos == dest) { // Arrived at target -> Start working state = State::Work; - current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].work_length, 1); - WorkStarted(); + current_ev = getEvMgr().addEvent(this, JOB_CONSTS[job_].work_length, 1); + workStarted(); } else { // Keep on walking if possible - const auto dir = world->FindHumanPath(pos, dest, 20); + const auto dir = world->findHumanPath(pos, dest, 20); if(dir) - StartWalking(*dir); + startWalking(*dir); else { // Point now unreachable -> abort and go gome - WorkAborted(); - StartWalkingHome(); + workAborted(); + startWalkingHome(); } } } -void nofFarmhand::StartWalkingHome() +void nofFarmhand::startWalkingHome() { state = State::WalkingHome; // Fahne vor dem Gebäude anpeilen dest = world->getNeighbour(workplace->getPos(), Direction::SouthEast); // Zu Laufen anfangen - WalkHome(); + walkHome(); } -void nofFarmhand::WalkHome() +void nofFarmhand::walkHome() { // Sind wir zu Hause angekommen? (genauer an der Flagge !!) if(pos == dest) { // Weiteres übernimmt nofBuildingWorker - WorkingReady(); + workingReady(); return; } - const auto dir = world->FindHumanPath(pos, dest, 40); + const auto dir = world->findHumanPath(pos, dest, 40); // Weg suchen und ob wir überhaupt noch nach Hause kommen if(!dir) { // Kein Weg führt mehr nach Hause--> Rumirren - AbrogateWorkplace(); - StartWandering(); - Wander(); + abrogateWorkplace(); + startWandering(); + wander(); } else { // All good, let's start walking there - StartWalking(*dir); + startWalking(*dir); } } -void nofFarmhand::WorkAborted() +void nofFarmhand::workAborted() { // Platz freigeben, falls man gerade arbeitet if(state == State::Work || state == State::WalkToWorkpoint) @@ -272,14 +272,14 @@ void nofFarmhand::WorkAborted() } /// Zeichnen der Figur in sonstigen Arbeitslagen -void nofFarmhand::DrawOtherStates(DrawPoint drawPt) +void nofFarmhand::drawOtherStates(DrawPoint drawPt) { switch(state) { case State::WalkToWorkpoint: { // Normales Laufen zeichnen - DrawWalking(drawPt); + drawWalking(drawPt); } break; default: return; @@ -287,4 +287,4 @@ void nofFarmhand::DrawOtherStates(DrawPoint drawPt) } /// Inform derived class about the start of the whole working process (at the beginning when walking out of the house) -void nofFarmhand::WalkingStarted() {} +void nofFarmhand::walkingStarted() {} diff --git a/libs/s25main/figures/nofFarmhand.h b/libs/s25main/figures/nofFarmhand.h index 6031aae46f..b7d9e830a4 100644 --- a/libs/s25main/figures/nofFarmhand.h +++ b/libs/s25main/figures/nofFarmhand.h @@ -28,28 +28,28 @@ class nofFarmhand : public nofBuildingWorker friend constexpr auto maxEnumValue(PointQuality) { return PointQuality::Class3; } /// Called by base class (noFigure) after having walked to new point - void WalkedDerived() override; + void walkedDerived() override; /// Stop work as workplace becomes unavailable - void WorkAborted() override; + void workAborted() override; /// Start walking to work point - void WalkToWorkpoint(); + void walkToWorkpoint(); /// Get ready to work back to workplace - void StartWalkingHome(); + void startWalkingHome(); /// Do next step for walking home - void WalkHome(); + void walkHome(); /// Inform derived class about the start of the whole working process /// (at the beginning when walking out of the house) - virtual void WalkingStarted(); + virtual void walkingStarted(); /// Inform derived class when starting work at the work point - virtual void WorkStarted() = 0; + virtual void workStarted() = 0; /// Inform derived class when work at work point is done - virtual void WorkFinished() = 0; + virtual void workFinished() = 0; /// Draw in other work-related states - void DrawOtherStates(DrawPoint drawPt) override; + void drawOtherStates(DrawPoint drawPt) override; public: nofFarmhand(Job job, MapPoint pos, unsigned char player, nobUsual* workplace); @@ -60,7 +60,7 @@ class nofFarmhand : public nofBuildingWorker void Serialize(SerializedGameData& sgd) const override; - void HandleDerivedEvent(unsigned id) override; + void handleDerivedEvent(unsigned id) override; /// Return the quality of this working point (including if the worker can work here at all) /// isBeforeWork determines whether the evaluation happens before leaving for work or afterwards virtual PointQuality getPointQuality(MapPoint pt, bool isBeforeWork) const = 0; diff --git a/libs/s25main/figures/nofFisher.cpp b/libs/s25main/figures/nofFisher.cpp index d6e6f25aae..b5f89b8de5 100644 --- a/libs/s25main/figures/nofFisher.cpp +++ b/libs/s25main/figures/nofFisher.cpp @@ -25,18 +25,18 @@ void nofFisher::Serialize(SerializedGameData& sgd) const { nofFarmhand::Serialize(sgd); - sgd.PushEnum(fishing_dir); + sgd.pushEnum(fishing_dir); sgd.PushBool(successful); } nofFisher::nofFisher(SerializedGameData& sgd, const unsigned obj_id) - : nofFarmhand(sgd, obj_id), fishing_dir(sgd.Pop()), successful(sgd.PopBool()) + : nofFarmhand(sgd, obj_id), fishing_dir(sgd.pop()), successful(sgd.PopBool()) {} /// Malt den Arbeiter beim Arbeiten -void nofFisher::DrawWorking(DrawPoint drawPt) +void nofFisher::drawWorking(DrawPoint drawPt) { - unsigned short id = GAMECLIENT.Interpolate(232, current_ev); + unsigned short id = GAMECLIENT.interpolate(232, current_ev); unsigned short draw_id; if(id < 16) @@ -80,8 +80,8 @@ void nofFisher::DrawWorking(DrawPoint drawPt) } } - LOADER.getPlayerImage("rom_bobs", draw_id)->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); - DrawShadow(drawPt, 0, Direction(fishing_dir)); + LOADER.getPlayerImage("rom_bobs", draw_id)->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + drawShadow(drawPt, 0, Direction(fishing_dir)); } unsigned short nofFisher::getCarryID() const @@ -89,7 +89,7 @@ unsigned short nofFisher::getCarryID() const return 70; } -void nofFisher::WorkStarted() +void nofFisher::workStarted() { // Find a random neighbour point with fish unsigned fishAmount = 0; @@ -109,10 +109,10 @@ void nofFisher::WorkStarted() successful = RANDOM_RAND(100) < probability; // On success remove the fish now to make it unavailable to others if(successful && !world->getGGS().isEnabled(AddonId::INEXHAUSTIBLE_FISH)) - world->ReduceResource(world->getNeighbour(pos, fishing_dir)); + world->reduceResource(world->getNeighbour(pos, fishing_dir)); } -void nofFisher::WorkFinished() +void nofFisher::workFinished() { if(successful) ware = GoodType::Fish; diff --git a/libs/s25main/figures/nofFisher.h b/libs/s25main/figures/nofFisher.h index be4a9fbe7b..0f3b8dabae 100644 --- a/libs/s25main/figures/nofFisher.h +++ b/libs/s25main/figures/nofFisher.h @@ -17,14 +17,14 @@ class nofFisher : public nofFarmhand private: /// Malt den Arbeiter beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override; /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) - void WorkStarted() override; + void workStarted() override; /// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten - void WorkFinished() override; + void workFinished() override; public: nofFisher(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofFlagWorker.cpp b/libs/s25main/figures/nofFlagWorker.cpp index d7a3f49706..2111c01a69 100644 --- a/libs/s25main/figures/nofFlagWorker.cpp +++ b/libs/s25main/figures/nofFlagWorker.cpp @@ -20,7 +20,7 @@ nofFlagWorker::nofFlagWorker(const Job job, const MapPoint pos, const unsigned c if(goal->getGOT() == GO_Type::Flag) { this->flag = static_cast(goal); - world->getPlayer(player).RegisterFlagWorker(this); + world->getPlayer(player).registerFlagWorker(this); } else this->flag = nullptr; } else @@ -28,37 +28,37 @@ nofFlagWorker::nofFlagWorker(const Job job, const MapPoint pos, const unsigned c } nofFlagWorker::nofFlagWorker(SerializedGameData& sgd, const unsigned obj_id) - : noFigure(sgd, obj_id), flag(sgd.PopObject(GO_Type::Flag)), state(sgd.Pop()) + : noFigure(sgd, obj_id), flag(sgd.popObject(GO_Type::Flag)), state(sgd.pop()) {} void nofFlagWorker::Serialize(SerializedGameData& sgd) const { noFigure::Serialize(sgd); - sgd.PushObject(flag, true); - sgd.PushEnum(state); + sgd.pushObject(flag, true); + sgd.pushEnum(state); } -void nofFlagWorker::Destroy() +void nofFlagWorker::destroy() { RTTR_Assert(!flag); RTTR_Assert(!world->getPlayer(player).isFlagWorker(this)); - noFigure::Destroy(); + noFigure::destroy(); } -void nofFlagWorker::AbrogateWorkplace() +void nofFlagWorker::abrogateWorkplace() { if(flag) { /// uns entfernen, da wir wieder umdrehen müssen - world->getPlayer(player).RemoveFlagWorker(this); + world->getPlayer(player).removeFlagWorker(this); flag = nullptr; } else RTTR_Assert(!world->getPlayer(player).isFlagWorker(this)); } /// Geht wieder zurück zur Flagge und dann nach Hause -void nofFlagWorker::GoToFlag() +void nofFlagWorker::goToFlag() { // Zur Flagge zurücklaufen @@ -66,40 +66,40 @@ void nofFlagWorker::GoToFlag() if(pos == flag->getPos()) { // nach Hause gehen - nobBaseWarehouse* wh = world->getPlayer(player).FindWarehouse(*flag, FW::AcceptsFigure(job_), true, false); + nobBaseWarehouse* wh = world->getPlayer(player).findWarehouse(*flag, FW::AcceptsFigure(job_), true, false); if(wh) { - GoHome(wh); + goHome(wh); // Vorgaukeln, dass wir ein Stück Straße bereits geschafft haben // damit wir mit WalkToGoal weiter bis zum Ziel laufen können cur_rs = &emulated_wanderroad; rs_pos = 0; - WalkToGoal(); + walkToGoal(); } else { // Weg führt nicht mehr zum Lagerhaus, dann rumirren - StartWandering(); - Wander(); + startWandering(); + wander(); } // Da wir quasi "freiwillig" nach Hause gegangen sind ohne das Abreißen der Flagge, auch manuell wieder // "abmelden" - world->getPlayer(player).RemoveFlagWorker(this); + world->getPlayer(player).removeFlagWorker(this); state = State::FigureWork; flag = nullptr; } else { // Weg suchen - const auto dir = world->FindHumanPath(pos, flag->getPos(), 40); + const auto dir = world->findHumanPath(pos, flag->getPos(), 40); // Wenns keinen gibt, rumirren, ansonsten hinlaufen if(dir) - StartWalking(*dir); + startWalking(*dir); else { - Abrogate(); - StartWandering(); - Wander(); + abrogate(); + startWandering(); + wander(); state = State::FigureWork; flag = nullptr; diff --git a/libs/s25main/figures/nofFlagWorker.h b/libs/s25main/figures/nofFlagWorker.h index 2acd824dbc..ee71ac0989 100644 --- a/libs/s25main/figures/nofFlagWorker.h +++ b/libs/s25main/figures/nofFlagWorker.h @@ -31,20 +31,20 @@ class nofFlagWorker : public noFigure friend constexpr auto maxEnumValue(State) { return State::ScoutScouting; } /// Kündigt bei der Flagge - void AbrogateWorkplace() override; + void abrogateWorkplace() override; /// Geht wieder zurück zur Flagge und dann nach Hause - void GoToFlag(); + void goToFlag(); public: nofFlagWorker(Job job, MapPoint pos, unsigned char player, noRoadNode* goal); nofFlagWorker(SerializedGameData& sgd, unsigned obj_id); nofFlagWorker(const nofFlagWorker&) = delete; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; /// Wird aufgerufen, wenn die Flagge abgerissen wurde - virtual void LostWork() = 0; + virtual void lostWork() = 0; /// Gibt Flagge zurück noFlag* getFlag() const { return flag; } diff --git a/libs/s25main/figures/nofForester.cpp b/libs/s25main/figures/nofForester.cpp index a58b696924..98fe3999ee 100644 --- a/libs/s25main/figures/nofForester.cpp +++ b/libs/s25main/figures/nofForester.cpp @@ -25,7 +25,7 @@ bool IsPotentialNewFieldForOwnFarm(GameWorld& world, const MapPoint pt, const un if(nofFarmer::getNewFieldPointQuality(world, pt) == nofFarmhand::PointQuality::NotPossible) return false; - return world.CheckPointsInRadius( + return world.checkPointsInRadius( pt, nofFarmhand::getWorkRadius(world.getGGS(), Job::Farmer), [&world, player](const MapPoint farmPt, unsigned) { if(world.getNO(farmPt)->getType() != NodalObjectType::Building) @@ -45,11 +45,11 @@ nofForester::nofForester(const MapPoint pos, const unsigned char player, nobUsua nofForester::nofForester(SerializedGameData& sgd, const unsigned obj_id) : nofFarmhand(sgd, obj_id) {} /// Malt den Arbeiter beim Arbeiten -void nofForester::DrawWorking(DrawPoint drawPt) +void nofForester::drawWorking(DrawPoint drawPt) { - unsigned short now_id = GAMECLIENT.Interpolate(36, current_ev); + unsigned short now_id = GAMECLIENT.interpolate(36, current_ev); // Baum pflanzen - LOADER.getPlayerImage("rom_bobs", 48 + now_id)->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 48 + now_id)->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); // Schaufel-Sound if(now_id == 7 || now_id == 18) @@ -71,10 +71,10 @@ unsigned short nofForester::getCarryID() const } /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) -void nofForester::WorkStarted() {} +void nofForester::workStarted() {} /// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten -void nofForester::WorkFinished() +void nofForester::workFinished() { // Wenn irgendwo ne Straße schon ist, NICHT einsetzen! for(const auto dir : helpers::EnumRange{}) @@ -87,7 +87,7 @@ void nofForester::WorkFinished() // Wenn Objekt ein Zierobjekt ist, dann löschen, ansonsten den Baum NICHT einsetzen! if(noType == NodalObjectType::Environment || noType == NodalObjectType::Nothing) { - world->DestroyNO(pos, false); + world->destroyNO(pos, false); // Je nach Landschaft andere Bäume pflanzbar! const std::array, 3> AVAILABLE_TREES = { @@ -98,7 +98,7 @@ void nofForester::WorkFinished() world->setNO(pos, new noTree(pos, RANDOM_ELEMENT(AVAILABLE_TREES[landscapeType]), 0)); // BQ drumherum neu berechnen - world->RecalcBQAroundPoint(pos); + world->recalcBQAroundPoint(pos); // Minimap Bescheid geben (neuer Baum) if(world->getGameInterface()) diff --git a/libs/s25main/figures/nofForester.h b/libs/s25main/figures/nofForester.h index ddfea34801..60a7681290 100644 --- a/libs/s25main/figures/nofForester.h +++ b/libs/s25main/figures/nofForester.h @@ -12,14 +12,14 @@ class nofForester : public nofFarmhand { private: /// Malt den Arbeiter beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override; /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) - void WorkStarted() override; + void workStarted() override; /// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten - void WorkFinished() override; + void workFinished() override; /// Returns the quality of this working point or determines if the worker can work here at all PointQuality getPointQuality(MapPoint pt, bool isBeforeWork) const override; diff --git a/libs/s25main/figures/nofGeologist.cpp b/libs/s25main/figures/nofGeologist.cpp index 9a5e55754b..d1e2314a75 100644 --- a/libs/s25main/figures/nofGeologist.cpp +++ b/libs/s25main/figures/nofGeologist.cpp @@ -51,11 +51,11 @@ nofGeologist::nofGeologist(SerializedGameData& sgd, const unsigned obj_id) unsigned available_nodes_count = sgd.PopUnsignedInt(); for(unsigned i = 0; i < available_nodes_count; ++i) { - MapPoint p = sgd.PopMapPoint(); + MapPoint p = sgd.popMapPoint(); available_nodes.push_back(p); } - node_goal = sgd.PopMapPoint(); + node_goal = sgd.popMapPoint(); if(sgd.getGameDataVersion() < 6) { @@ -68,7 +68,7 @@ nofGeologist::nofGeologist(SerializedGameData& sgd, const unsigned obj_id) helpers::popContainer(sgd, resAlreadyFound); } -void nofGeologist::Draw(DrawPoint drawPt) +void nofGeologist::draw(DrawPoint drawPt) { switch(state) { @@ -78,19 +78,19 @@ void nofGeologist::Draw(DrawPoint drawPt) case State::GoToFlag: { // normales Laufen zeichnen - DrawWalkingBobJobs(drawPt, Job::Geologist); + drawWalkingBobJobs(drawPt, Job::Geologist); } break; case State::GeologistDig: { // 1x grab, 1x "spring-grab", 2x grab, 1x "spring-grab", 2x grab, 1x "spring-grab", 4x grab - unsigned short i = GAMECLIENT.Interpolate(84, current_ev); + unsigned short i = GAMECLIENT.interpolate(84, current_ev); unsigned sound = 0, sound_id; if(i < 6) { LOADER.getPlayerImage("rom_bobs", 324 + i) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(i == 4) { sound = 1; @@ -99,7 +99,7 @@ void nofGeologist::Draw(DrawPoint drawPt) } else if(i < 16) { LOADER.getPlayerImage("rom_bobs", 314 + i - 6) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(i == 14) { sound = 2; @@ -108,7 +108,7 @@ void nofGeologist::Draw(DrawPoint drawPt) } else if(i < 28) { LOADER.getPlayerImage("rom_bobs", 324 + (i - 16) % 6) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(i == 20) { sound = 1; @@ -121,7 +121,7 @@ void nofGeologist::Draw(DrawPoint drawPt) } else if(i < 38) { LOADER.getPlayerImage("rom_bobs", 314 + i - 28) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(i == 36) { sound = 2; @@ -130,7 +130,7 @@ void nofGeologist::Draw(DrawPoint drawPt) } else if(i < 50) { LOADER.getPlayerImage("rom_bobs", 324 + (i - 38) % 6) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(i == 42) { sound = 1; @@ -143,7 +143,7 @@ void nofGeologist::Draw(DrawPoint drawPt) } else if(i < 60) { LOADER.getPlayerImage("rom_bobs", 314 + i - 50) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(i == 58) { sound = 2; @@ -152,7 +152,7 @@ void nofGeologist::Draw(DrawPoint drawPt) } else { LOADER.getPlayerImage("rom_bobs", 324 + (i - 60) % 6) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(i == 64) { sound = 1; @@ -178,17 +178,17 @@ void nofGeologist::Draw(DrawPoint drawPt) break; case State::GeologistCheer: { - unsigned short i = GAMECLIENT.Interpolate(16, current_ev); + unsigned short i = GAMECLIENT.interpolate(16, current_ev); if(i < 7) { LOADER.getPlayerImage("rom_bobs", 357 + i) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } else { std::array ids = {1, 0, 1, 2, 1, 0, 1, 2, 1}; LOADER.getPlayerImage("rom_bobs", 361 + ids[i - 7]) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } if(i == 4) @@ -198,7 +198,7 @@ void nofGeologist::Draw(DrawPoint drawPt) } } -void nofGeologist::GoalReached() +void nofGeologist::goalReached() { // An der Flagge angekommen @@ -210,13 +210,13 @@ void nofGeologist::GoalReached() std::fill(resAlreadyFound.begin(), resAlreadyFound.end(), false); // Umgebung absuchen - LookForNewNodes(); + lookForNewNodes(); // ersten Punkt suchen - GoToNextNode(); + goToNextNode(); } -void nofGeologist::Walked() +void nofGeologist::walked() { if(state == State::GeologistGotoNextNode) { @@ -227,7 +227,7 @@ void nofGeologist::Walked() // alten Punkt wieder freigeben world->setReserved(node_goal, false); // wenn nicht, dann zu einem neuen Punkt gehen - GoToNextNode(); + goToNextNode(); return; } @@ -235,26 +235,26 @@ void nofGeologist::Walked() if(pos == node_goal) { // anfangen zu graben - current_ev = getEvMgr().AddEvent(this, 100, 1); + current_ev = getEvMgr().addEvent(this, 100, 1); state = State::GeologistDig; } else { // Weg zum nächsten Punkt suchen - const auto dir = world->FindHumanPath(pos, node_goal, 20); + const auto dir = world->findHumanPath(pos, node_goal, 20); // Wenns keinen gibt if(!dir) - GoToNextNode(); + goToNextNode(); else - StartWalking(*dir); + startWalking(*dir); } } else if(state == State::GoToFlag) { - GoToFlag(); + goToFlag(); } } -void nofGeologist::HandleDerivedEvent(const unsigned /*id*/) +void nofGeologist::handleDerivedEvent(const unsigned /*id*/) { switch(state) { @@ -271,14 +271,14 @@ void nofGeologist::HandleDerivedEvent(const unsigned /*id*/) { // Es wurde was gefunden, erstmal Jubeln state = State::GeologistCheer; - current_ev = getEvMgr().AddEvent(this, 15, 1); + current_ev = getEvMgr().addEvent(this, 15, 1); } else { // leeres Schild hinstecken und ohne Jubel weiterziehen setSign(foundRes); /// Punkt wieder freigeben world->setReserved(pos, false); - GoToNextNode(); + goToNextNode(); } } break; @@ -291,7 +291,7 @@ void nofGeologist::HandleDerivedEvent(const unsigned /*id*/) /// Sounds evtl löschen world->getSoundMgr().stopSounds(*this); // Und weiterlaufen - GoToNextNode(); + goToNextNode(); } break; } @@ -305,7 +305,7 @@ bool nofGeologist::isNodeGood(const MapPoint pt) const && obj.getType() != NodalObjectType::Flag && obj.getType() != NodalObjectType::Tree; } -void nofGeologist::LookForNewNodes() +void nofGeologist::lookForNewNodes() { const auto pts = world->getPointsInRadius(flag->getPos(), 15, ReturnMapPointWithRadius{}); unsigned curMaxRadius = 15; @@ -329,7 +329,7 @@ void nofGeologist::LookForNewNodes() bool nofGeologist::isValidTargetNode(const MapPoint pt) const { - return (isNodeGood(pt) && !world->getNode(pt).reserved && (pos == pt || world->FindHumanPath(pos, pt, 20))); + return (isNodeGood(pt) && !world->getNode(pt).reserved && (pos == pt || world->findHumanPath(pos, pt, 20))); } helpers::OptionalEnum nofGeologist::getNextNode() @@ -337,7 +337,7 @@ helpers::OptionalEnum nofGeologist::getNextNode() // Überhaupt noch Schilder zum Aufstellen if(!signs) { - node_goal = MapPoint::Invalid(); + node_goal = MapPoint::invalid(); return std::nullopt; } @@ -358,7 +358,7 @@ helpers::OptionalEnum nofGeologist::getNextNode() helpers::OptionalEnum ret_dir; if(pos != node_goal) { - ret_dir = world->FindHumanPath(pos, node_goal, 20); + ret_dir = world->findHumanPath(pos, node_goal, 20); if(!ret_dir) continue; } @@ -368,20 +368,20 @@ helpers::OptionalEnum nofGeologist::getNextNode() } // Nach neuen Punkten sucehn - LookForNewNodes(); + lookForNewNodes(); } while(!available_nodes.empty()); - node_goal = MapPoint::Invalid(); + node_goal = MapPoint::invalid(); return std::nullopt; } -void nofGeologist::GoToNextNode() +void nofGeologist::goToNextNode() { // Wenn es keine Flagge mehr gibt, dann gleich rumirren if(!flag) { - StartWandering(); - Wander(); + startWandering(); + wander(); state = State::FigureWork; return; } @@ -393,19 +393,19 @@ void nofGeologist::GoToNextNode() { // Wenn es einen Punkt gibt, dann hingehen state = State::GeologistGotoNextNode; - StartWalking(*dir); + startWalking(*dir); --signs; } else if(node_goal == pos) { // Already there state = State::GeologistGotoNextNode; --signs; - Walked(); + walked(); } else { // ansonsten zur Flagge zurückgehen state = State::GoToFlag; - Walked(); + walked(); } } @@ -417,7 +417,7 @@ void nofGeologist::setSign(Resource resources) NodalObjectType noType = world->getNO(pos)->getType(); if(noType != NodalObjectType::Nothing && noType != NodalObjectType::Environment) return; - world->DestroyNO(pos, false); + world->destroyNO(pos, false); // Schild setzen world->setNO(pos, new noSign(pos, resources)); @@ -441,18 +441,18 @@ void nofGeologist::setSign(Resource resources) if(resources.getType() != ResourceType::Water || world->getGGS().getSelection(AddonId::EXHAUSTIBLE_WATER) != 1) { - SendPostMessage(player, + sendPostMessage(player, std::make_unique(getEvMgr().getCurrentGF(), msg, PostCategory::Geologist, pos)); } world->getNotifications().publish(ResourceNote(player, pos, resources)); if(world->hasLua()) - world->getLua().EventResourceFound(this->player, pos, resources.getType(), resources.getAmount()); + world->getLua().eventResourceFound(this->player, pos, resources.getType(), resources.getAmount()); } resAlreadyFound[resources.getType()] = true; } -void nofGeologist::LostWork() +void nofGeologist::lostWork() { flag = nullptr; @@ -460,10 +460,10 @@ void nofGeologist::LostWork() { default: break; // Wenn wir noch hingehen, dann zurückgehen - case State::FigureWork: GoHome(); break; + case State::FigureWork: goHome(); break; case State::GoToFlag: // dann sofort rumirren, wenn wir zur Flagge gehen - StartWandering(); + startWandering(); state = State::FigureWork; break; } @@ -485,5 +485,5 @@ struct IsSignOfType bool nofGeologist::isSignInArea(ResourceType type) const { - return world->CheckPointsInRadius(pos, 7, IsSignOfType(type, *world), false); + return world->checkPointsInRadius(pos, 7, IsSignOfType(type, *world), false); } diff --git a/libs/s25main/figures/nofGeologist.h b/libs/s25main/figures/nofGeologist.h index 9e0170f9ca..8785e30d56 100644 --- a/libs/s25main/figures/nofGeologist.h +++ b/libs/s25main/figures/nofGeologist.h @@ -29,14 +29,14 @@ class nofGeologist : public nofFlagWorker helpers::EnumArray resAlreadyFound; - void GoalReached() override; - void Walked() override; - void HandleDerivedEvent(unsigned id) override; + void goalReached() override; + void walked() override; + void handleDerivedEvent(unsigned id) override; /// Kann man an diesem Punkt ein Schild aufstellen? bool isNodeGood(MapPoint pt) const; /// Sucht im Umkreis von der Flagge neue Punkte wo man graben könnte - void LookForNewNodes(); + void lookForNewNodes(); /// Checks if the node is valid as a new target inline bool isValidTargetNode(MapPoint pt) const; /// Searches for a new point to go to. Returns the direction to walk in if any point was found, else sets node_goal @@ -44,7 +44,7 @@ class nofGeologist : public nofFlagWorker helpers::OptionalEnum getNextNode(); /// Sucht sich einen neuen Punkt und geht dorthin oder geht wieder nach Hause wenn alle Schilder aufgestellt wurden /// oder es keinen Punkt mehr gibt - void GoToNextNode(); + void goToNextNode(); /// Setzt das Schild, wenn noch was frei ist void setSign(Resource resources); @@ -58,8 +58,8 @@ class nofGeologist : public nofFlagWorker GO_Type getGOT() const final { return GO_Type::NofGeologist; } - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; /// Wird aufgerufen, wenn die Flagge abgerissen wurde - void LostWork() override; + void lostWork() override; }; diff --git a/libs/s25main/figures/nofHunter.cpp b/libs/s25main/figures/nofHunter.cpp index 73b3656970..79aa53f170 100644 --- a/libs/s25main/figures/nofHunter.cpp +++ b/libs/s25main/figures/nofHunter.cpp @@ -26,7 +26,7 @@ const MapCoord MAX_HUNTING_DISTANCE = 50; nofHunter::nofHunter(const MapPoint pos, const unsigned char player, nobUsual* workplace) - : nofBuildingWorker(Job::Hunter, pos, player, workplace), animal(nullptr), shootingPos(MapPoint::Invalid()), + : nofBuildingWorker(Job::Hunter, pos, player, workplace), animal(nullptr), shootingPos(MapPoint::invalid()), shooting_dir(Direction::West) {} @@ -36,9 +36,9 @@ void nofHunter::Serialize(SerializedGameData& sgd) const if(state != State::FigureWork && state != State::Waiting1) { - sgd.PushObject(animal, true); + sgd.pushObject(animal, true); helpers::pushPoint(sgd, shootingPos); - sgd.PushEnum(shooting_dir); + sgd.pushEnum(shooting_dir); } } @@ -46,21 +46,21 @@ nofHunter::nofHunter(SerializedGameData& sgd, const unsigned obj_id) : nofBuildi { if(state != State::FigureWork && state != State::Waiting1) { - animal = sgd.PopObject(GO_Type::Animal); - shootingPos = sgd.PopMapPoint(); - shooting_dir = sgd.Pop(); + animal = sgd.popObject(GO_Type::Animal); + shootingPos = sgd.popMapPoint(); + shooting_dir = sgd.pop(); // https://github.com/Return-To-The-Roots/s25client/issues/1126 if(sgd.getGameDataVersion() < 4 && state == State::HunterFindingShootingpoint && pos == shootingPos) state = State::HunterWaitingForAnimalReady; } else { animal = nullptr; - shootingPos = MapPoint::Invalid(); + shootingPos = MapPoint::invalid(); shooting_dir = Direction::West; } } -void nofHunter::DrawWorking(DrawPoint drawPt) +void nofHunter::drawWorking(DrawPoint drawPt) { const GamePlayer& owner = world->getPlayer(player); switch(state) @@ -74,7 +74,7 @@ void nofHunter::DrawWorking(DrawPoint drawPt) if(shooting_dir == Direction::East) { // die Animation in dieser Richtung ist etwas anders als die in den restlichen - unsigned short id = GAMECLIENT.Interpolate(13, current_ev); + unsigned short id = GAMECLIENT.interpolate(13, current_ev); LOADER.getPlayerImage("rom_bobs", 219 + id)->drawForPlayer(drawPt, owner.color); if(id == 12) @@ -84,7 +84,7 @@ void nofHunter::DrawWorking(DrawPoint drawPt) } } else { - unsigned short id = GAMECLIENT.Interpolate(8, current_ev); + unsigned short id = GAMECLIENT.interpolate(8, current_ev); LOADER.getPlayerImage("rom_bobs", 1686 + rttr::enum_cast(shooting_dir + 2u) * 8 + id) ->drawForPlayer(drawPt, owner.color); @@ -95,12 +95,12 @@ void nofHunter::DrawWorking(DrawPoint drawPt) } } - DrawShadow(drawPt, 0, shooting_dir); + drawShadow(drawPt, 0, shooting_dir); } break; case State::HunterEviscerating: { - unsigned short id = GAMECLIENT.Interpolate(45, current_ev); + unsigned short id = GAMECLIENT.interpolate(45, current_ev); unsigned short draw_id; if(id < 4) @@ -116,15 +116,15 @@ void nofHunter::DrawWorking(DrawPoint drawPt) } } -void nofHunter::HandleDerivedEvent(unsigned /*id*/) +void nofHunter::handleDerivedEvent(unsigned /*id*/) { switch(state) { default: RTTR_Assert(false); break; - case State::Waiting1: TryStartHunting(); break; - case State::HunterWaitingForAnimalReady: HandleStateWaitingForAnimalReady(); break; - case State::HunterShooting: HandleStateShooting(); break; - case State::HunterEviscerating: HandleStateEviscerating(); break; + case State::Waiting1: tryStartHunting(); break; + case State::HunterWaitingForAnimalReady: handleStateWaitingForAnimalReady(); break; + case State::HunterShooting: handleStateShooting(); break; + case State::HunterEviscerating: handleStateEviscerating(); break; } } @@ -142,7 +142,7 @@ std::vector nofHunter::getAnimalsInRange(const GameWorldBase& world, const auto canAnimalBeUsed = [pos, maxDistance, &world, isValidAnimal](const noAnimal* const animal) { return animal && isValidAnimal(animal) - && (pos == animal->getPos() || world.FindHumanPath(pos, animal->getPos(), maxDistance)); + && (pos == animal->getPos() || world.findHumanPath(pos, animal->getPos(), maxDistance)); }; return world.getPointsInRadius(pos, radius, pointToAnimal, canAnimalBeUsed, true); @@ -154,7 +154,7 @@ std::vector nofHunter::getHuntableAnimalsInRange(const GameWorldBase& [](const noAnimal* a) { return a->canHunted(); }); } -void nofHunter::TryStartHunting() +void nofHunter::tryStartHunting() { std::vector available_animals; @@ -169,7 +169,7 @@ void nofHunter::TryStartHunting() { for(curPos.x = pos.x - SQUARE_SIZE; curPos.x <= pos.x + SQUARE_SIZE; ++curPos.x) { - MapPoint curMapPos = world->MakeMapPoint(curPos); + MapPoint curMapPos = world->makeMapPoint(curPos); for(auto& figure : world->getFigures(curMapPos)) { if(figure.getType() != NodalObjectType::Animal) @@ -177,7 +177,7 @@ void nofHunter::TryStartHunting() auto& animal = static_cast(figure); if(!animal.canHunted()) continue; - if(pos == animal.getPos() || world->FindHumanPath(pos, animal.getPos(), MAX_HUNTING_DISTANCE)) + if(pos == animal.getPos() || world->findHumanPath(pos, animal.getPos(), MAX_HUNTING_DISTANCE)) { available_animals.push_back(&animal); } @@ -199,53 +199,53 @@ void nofHunter::TryStartHunting() workplace->is_working = true; // Tier Bescheid sagen - animal->BeginHunting(this); + animal->beginHunting(this); // Anfangen zu laufen (erstmal aus dem Haus raus!) - StartWalking(Direction::SouthEast); + startWalking(Direction::SouthEast); - workplace->StopNotWorking(); + workplace->stopNotWorking(); } else { // Weiter warten, vielleicht gibts ja später wieder mal was - current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); + current_ev = getEvMgr().addEvent(this, JOB_CONSTS[job_].wait1_length, 1); world->getNotifications().publish( BuildingNote(BuildingNote::NoRessources, player, workplace->getPos(), workplace->getBuildingType())); - workplace->StartNotWorking(); + workplace->startNotWorking(); } was_sounding = false; } -void nofHunter::WalkedDerived() +void nofHunter::walkedDerived() { switch(state) { default: break; - case State::HunterChasing: HandleStateChasing(); break; - case State::HunterFindingShootingpoint: HandleStateFindingShootingPoint(); break; - case State::HunterWalkingToCadaver: HandleStateWalkingToCadaver(); break; - case State::WalkingHome: HandleStateWalkingHome(); break; + case State::HunterChasing: handleStateChasing(); break; + case State::HunterFindingShootingpoint: handleStateFindingShootingPoint(); break; + case State::HunterWalkingToCadaver: handleStateWalkingToCadaver(); break; + case State::WalkingHome: handleStateWalkingHome(); break; } } bool nofHunter::isShootingPointGood(const MapPoint pt) { // Punkt muss betretbar sein und man muss ihn erreichen können - return PathConditionHuman(*world).isNodeOk(pt) && world->FindHumanPath(this->pos, pt, 6).has_value(); + return PathConditionHuman(*world).isNodeOk(pt) && world->findHumanPath(this->pos, pt, 6).has_value(); } -void nofHunter::HandleStateChasing() +void nofHunter::handleStateChasing() { // Sind wir in der Nähe des Tieres? - if(world->CalcDistance(pos, animal->getPos()) < 7) + if(world->calcDistance(pos, animal->getPos()) < 7) { // Dann bitten wir es mal, schonmal anzuhalten und bekommen seine Koordinaten, wo es dann steht - Position animalPos(animal->HunterIsNear()); + Position animalPos(animal->hunterIsNear()); // Nun müssen wir drumherum einen Punkt suchen, von dem wir schießen, der natürlich direkt dem Standort // des Tieres gegenüberliegen muss (mit zufälliger Richtung beginnen) - shootingPos = MapPoint::Invalid(); + shootingPos = MapPoint::invalid(); for(const Direction d : helpers::enumRange(RANDOM_ENUM(Direction))) { Position delta; @@ -278,8 +278,8 @@ void nofHunter::HandleStateChasing() default: throw std::logic_error("Wrong value?"); } - MapPoint curShootingPos = world->MakeMapPoint(animalPos + delta); - if(curShootingPos == pos || world->FindHumanPath(pos, curShootingPos, 6)) + MapPoint curShootingPos = world->makeMapPoint(animalPos + delta); + if(curShootingPos == pos || world->findHumanPath(pos, curShootingPos, 6)) { shootingPos = curShootingPos; // Richtung, in die geschossen wird, bestimmen (natürlich die entgegengesetzte nehmen) @@ -293,103 +293,103 @@ void nofHunter::HandleStateChasing() { // dorthingehen state = State::HunterFindingShootingpoint; - HandleStateFindingShootingPoint(); + handleStateFindingShootingPoint(); } else { // kein Punkt gefunden --> nach Hause gehen - StartWalkingHome(); + startWalkingHome(); } } else { // Weg dorthin suchen - const auto dir = world->FindHumanPath(pos, animal->getPos(), MAX_HUNTING_DISTANCE); + const auto dir = world->findHumanPath(pos, animal->getPos(), MAX_HUNTING_DISTANCE); if(dir) { // Weg gefunden, dann hinlaufen - StartWalking(*dir); + startWalking(*dir); } else { // kein Weg gefunden --> nach Hause laufen - StartWalkingHome(); + startWalkingHome(); } } } -void nofHunter::HandleStateFindingShootingPoint() +void nofHunter::handleStateFindingShootingPoint() { // Are we there yet? if(shootingPos == pos) { state = State::HunterWaitingForAnimalReady; - HandleStateWaitingForAnimalReady(); + handleStateWaitingForAnimalReady(); } else { // Weg dorthin suchen - const auto dir = world->FindHumanPath(pos, shootingPos, 6); + const auto dir = world->findHumanPath(pos, shootingPos, 6); if(dir) { // Weg gefunden, dann hinlaufen - StartWalking(*dir); + startWalking(*dir); } else { // kein Weg gefunden --> nach Hause laufen - StartWalkingHome(); + startWalkingHome(); } } } -void nofHunter::HandleStateWaitingForAnimalReady() +void nofHunter::handleStateWaitingForAnimalReady() { // Is the animal ready? if(animal->isReadyForShooting()) { // fire! state = State::HunterShooting; - current_ev = getEvMgr().AddEvent(this, 16, 1); + current_ev = getEvMgr().addEvent(this, 16, 1); } else if(animal->isGettingReadyForShooting()) - current_ev = getEvMgr().AddEvent(this, 15, 2); // Give the animal some time for getting ready + current_ev = getEvMgr().addEvent(this, 15, 2); // Give the animal some time for getting ready else { // Something went wrong, animal is doing something else? - StartWalkingHome(); + startWalkingHome(); } } -void nofHunter::HandleStateShooting() +void nofHunter::handleStateShooting() { // Tier muss sterben - animal->Die(); + animal->die(); // zum Kadaver laufen, um ihn auszunehmen state = State::HunterWalkingToCadaver; - HandleStateWalkingToCadaver(); + handleStateWalkingToCadaver(); } -void nofHunter::HandleStateWalkingToCadaver() +void nofHunter::handleStateWalkingToCadaver() { // Sind wir schon da? if(animal->getPos() == pos) { // dann ausnehmen state = State::HunterEviscerating; - current_ev = getEvMgr().AddEvent(this, 80, 1); + current_ev = getEvMgr().addEvent(this, 80, 1); } else { // Weg dorthin suchen - const auto dir = world->FindHumanPath(pos, animal->getPos(), 6); + const auto dir = world->findHumanPath(pos, animal->getPos(), 6); if(dir) { // Weg gefunden, dann hinlaufen - StartWalking(*dir); + startWalking(*dir); } else { // kein Weg gefunden --> nach Hause laufen - StartWalkingHome(); + startWalkingHome(); } } } -void nofHunter::HandleStateEviscerating() +void nofHunter::handleStateEviscerating() { // Evtl. Sounds löschen if(was_sounding) @@ -399,59 +399,59 @@ void nofHunter::HandleStateEviscerating() } // see comment at noAnimal::HandleEvent for explanation of ownership of animal - animal->Eviscerated(); + animal->eviscerated(); if(!animal->isGettingSkinned()) { // Tier verschwinden lassen auto ownedAnimal = world->RemoveFigure(pos, *animal); // Tier vernichten - ownedAnimal->Destroy(); + ownedAnimal->destroy(); } animal = nullptr; // Fleisch in die Hand nehmen ware = GoodType::Meat; // und zurück zur Hütte - StartWalkingHome(); + startWalkingHome(); } -void nofHunter::StartWalkingHome() +void nofHunter::startWalkingHome() { - WorkAborted(); + workAborted(); state = State::WalkingHome; // We may be still walking in which case we delay finding a path home until we reached the next node if(!isMoving()) - HandleStateWalkingHome(); + handleStateWalkingHome(); } -void nofHunter::HandleStateWalkingHome() +void nofHunter::handleStateWalkingHome() { // Sind wir zu Hause angekommen? (genauer an der Flagge !!) MapPoint homeFlagPos = world->getNeighbour(workplace->getPos(), Direction::SouthEast); if(pos == homeFlagPos) { // Weiteres übernimmt nofBuildingWorker - WorkingReady(); + workingReady(); return; } // Weg suchen und ob wir überhaupt noch nach Hause kommen (Toleranz bei dem Weg mit einberechnen, // damit er nicht einfach rumirrt und wegstirbt, wenn er einmal ein paar Felder zu weit gelaufen ist) - const auto dir = world->FindHumanPath(pos, homeFlagPos, MAX_HUNTING_DISTANCE + MAX_HUNTING_DISTANCE / 4); + const auto dir = world->findHumanPath(pos, homeFlagPos, MAX_HUNTING_DISTANCE + MAX_HUNTING_DISTANCE / 4); if(dir) { // All good, let's start walking there - StartWalking(*dir); + startWalking(*dir); } else { // Kein Weg führt mehr nach Hause--> Rumirren - AbrogateWorkplace(); - StartWandering(); - Wander(); + abrogateWorkplace(); + startWandering(); + wander(); } } -void nofHunter::AnimalLost() +void nofHunter::animalLost() { animal = nullptr; @@ -460,24 +460,24 @@ void nofHunter::AnimalLost() default: return; case State::HunterChasing: case State::HunterFindingShootingpoint: - case State::HunterWalkingToCadaver: StartWalkingHome(); break; + case State::HunterWalkingToCadaver: startWalkingHome(); break; case State::HunterShooting: case State::HunterEviscerating: case State::HunterWaitingForAnimalReady: // Arbeits-Event abmelden - getEvMgr().RemoveEvent(current_ev); + getEvMgr().removeEvent(current_ev); // Nach Hause laufen - StartWalkingHome(); + startWalkingHome(); break; } } -void nofHunter::WorkAborted() +void nofHunter::workAborted() { // Tier Bescheid sagen if(animal) { - animal->StopHunting(); + animal->stopHunting(); animal = nullptr; } } diff --git a/libs/s25main/figures/nofHunter.h b/libs/s25main/figures/nofHunter.h index 1354e9d9cf..e0b47083f7 100644 --- a/libs/s25main/figures/nofHunter.h +++ b/libs/s25main/figures/nofHunter.h @@ -25,46 +25,46 @@ class nofHunter : public nofBuildingWorker Direction shooting_dir; /// Funktionen, die nur von der Basisklasse (noFigure) aufgerufen werden, wenn man gelaufen ist - void WalkedDerived() override; + void walkedDerived() override; /// Malt den Arbeiter beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override { return 89; } /// Trifft Vorbereitungen fürs nach Hause - Laufen - void StartWalkingHome(); + void startWalkingHome(); /// Läuft wieder zu seiner Hütte zurück - void HandleStateWalkingHome(); + void handleStateWalkingHome(); /// Prüft, ob der Schießpunkt geeignet ist bool isShootingPointGood(MapPoint pt); /// Wenn jeweils gelaufen wurde oder ein Event abgelaufen ist, je nach aktuellem Status folgende Funktionen /// ausführen - void HandleStateChasing(); - void HandleStateFindingShootingPoint(); - void HandleStateWaitingForAnimalReady(); - void HandleStateShooting(); - void HandleStateWalkingToCadaver(); - void HandleStateEviscerating(); + void handleStateChasing(); + void handleStateFindingShootingPoint(); + void handleStateWaitingForAnimalReady(); + void handleStateShooting(); + void handleStateWalkingToCadaver(); + void handleStateEviscerating(); public: nofHunter(MapPoint pos, unsigned char player, nobUsual* workplace); nofHunter(SerializedGameData& sgd, unsigned obj_id); - void Destroy() override + void destroy() override { RTTR_Assert(!animal); - nofBuildingWorker::Destroy(); + nofBuildingWorker::destroy(); } void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofHunter; } - void HandleDerivedEvent(unsigned id) override; + void handleDerivedEvent(unsigned id) override; - void TryStartHunting(); + void tryStartHunting(); /// Find animals in a radius around a position that satisfy a predicate and are reachable static std::vector getAnimalsInRange(const GameWorldBase& world, MapPoint pos, unsigned radius, @@ -72,7 +72,7 @@ class nofHunter : public nofBuildingWorker static std::vector getHuntableAnimalsInRange(const GameWorldBase& world, MapPoint pos); /// das Tier ist nicht mehr verfügbar (von selbst gestorben o.Ä.) - void AnimalLost(); + void animalLost(); /// wird aufgerufen, wenn die Arbeit abgebrochen wird (von nofBuildingWorker aufgerufen) - void WorkAborted() override; + void workAborted() override; }; diff --git a/libs/s25main/figures/nofIronfounder.cpp b/libs/s25main/figures/nofIronfounder.cpp index 8023b052b6..e0a9d1d5fd 100644 --- a/libs/s25main/figures/nofIronfounder.cpp +++ b/libs/s25main/figures/nofIronfounder.cpp @@ -18,16 +18,16 @@ nofIronfounder::nofIronfounder(const MapPoint pos, const unsigned char player, n nofIronfounder::nofIronfounder(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id) {} -void nofIronfounder::DrawWorking(DrawPoint drawPt) +void nofIronfounder::drawWorking(DrawPoint drawPt) { const helpers::EnumArray offsets = {{{-22, 12}, {-23, 3}, {-19, 8}, {-18, 4}, {-33, 7}}}; - unsigned now_id = GAMECLIENT.Interpolate(272, current_ev); + unsigned now_id = GAMECLIENT.interpolate(272, current_ev); if(now_id < 182) { LOADER.getPlayerImage("rom_bobs", 100 + (now_id % 8)) - ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, + ->drawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); // Evtl Sound abspielen @@ -39,7 +39,7 @@ void nofIronfounder::DrawWorking(DrawPoint drawPt) } } -helpers::OptionalEnum nofIronfounder::ProduceWare() +helpers::OptionalEnum nofIronfounder::produceWare() { return GoodType::Iron; } diff --git a/libs/s25main/figures/nofIronfounder.h b/libs/s25main/figures/nofIronfounder.h index 7555812cd9..0c58bd5867 100644 --- a/libs/s25main/figures/nofIronfounder.h +++ b/libs/s25main/figures/nofIronfounder.h @@ -13,11 +13,11 @@ class nobUsual; class nofIronfounder : public nofWorkman { /// Zeichnet ihn beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override { return 69; } /// Der Arbeiter erzeugt eine Ware - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; public: nofIronfounder(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofLeatherWorker.cpp b/libs/s25main/figures/nofLeatherWorker.cpp index bc7bb9bf1e..980141e871 100644 --- a/libs/s25main/figures/nofLeatherWorker.cpp +++ b/libs/s25main/figures/nofLeatherWorker.cpp @@ -20,14 +20,14 @@ nofLeatherWorker::nofLeatherWorker(const MapPoint pos, const unsigned char playe nofLeatherWorker::nofLeatherWorker(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id) {} -void nofLeatherWorker::DrawWorking(DrawPoint drawPt) +void nofLeatherWorker::drawWorking(DrawPoint drawPt) { constexpr helpers::EnumArray offsets = {{{11, -41}, {21, -20}, {21, -17}, {24, -13}, {22, -14}}}; - const unsigned now_id = GAMECLIENT.Interpolate(230, current_ev); + const unsigned now_id = GAMECLIENT.interpolate(230, current_ev); LOADER.getPlayerImage("leather_bobs", bobIndex[BobType::LeatherworksWorkWindowAnimation] + (now_id % 23)) - ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); + ->drawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); // hammer sound if(now_id % 23 == 3 || now_id % 23 == 7) @@ -61,12 +61,12 @@ unsigned short nofLeatherWorker::getCarryID() const # pragma warning(pop) #endif -void nofLeatherWorker::DrawWalkingWithWare(DrawPoint drawPt) +void nofLeatherWorker::drawWalkingWithWare(DrawPoint drawPt) { - DrawWalking(drawPt, "leather_bobs", bobIndex[BobType::LeatherworkerCarryingArmorInOut]); + drawWalking(drawPt, "leather_bobs", bobIndex[BobType::LeatherworkerCarryingArmorInOut]); } -helpers::OptionalEnum nofLeatherWorker::ProduceWare() +helpers::OptionalEnum nofLeatherWorker::produceWare() { return GoodType::Armor; } diff --git a/libs/s25main/figures/nofLeatherWorker.h b/libs/s25main/figures/nofLeatherWorker.h index a0be3d528c..aa7766d786 100644 --- a/libs/s25main/figures/nofLeatherWorker.h +++ b/libs/s25main/figures/nofLeatherWorker.h @@ -12,13 +12,13 @@ class nobUsual; class nofLeatherWorker : public nofWorkman { /// Draw worker at work - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware [[noreturn]] unsigned short getCarryID() const override; - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; /// Draws the figure while returning home / entering the building (often carrying wares) - void DrawWalkingWithWare(DrawPoint drawPt) override; + void drawWalkingWithWare(DrawPoint drawPt) override; public: nofLeatherWorker(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofMetalworker.cpp b/libs/s25main/figures/nofMetalworker.cpp index 6413071353..f583759bb4 100644 --- a/libs/s25main/figures/nofMetalworker.cpp +++ b/libs/s25main/figures/nofMetalworker.cpp @@ -28,7 +28,7 @@ nofMetalworker::nofMetalworker(const MapPoint pos, const unsigned char player, n toolOrderSub = world->getNotifications().subscribe([this](const ToolNote& note) { if((note.type == ToolNote::OrderPlaced || note.type == ToolNote::SettingsChanged) && note.player == this->player) - CheckForOrders(); + checkForOrders(); }); } @@ -44,7 +44,7 @@ nofMetalworker::nofMetalworker(SerializedGameData& sgd, const unsigned obj_id) : else nextProducedTool = GoodType(iWare); } else - nextProducedTool = sgd.PopOptionalEnum(); + nextProducedTool = sgd.popOptionalEnum(); if(state == State::EnterBuilding && current_ev == nullptr && !ware && !nextProducedTool) { LOG.write("Found invalid metalworker. Assuming corrupted savegame -> Trying to fix this. If you encounter this " @@ -52,29 +52,29 @@ nofMetalworker::nofMetalworker(SerializedGameData& sgd, const unsigned obj_id) : "report this!"); RTTR_Assert(false); state = State::WaitingForWaresOrProductionStopped; - current_ev = getEvMgr().AddEvent(this, 1000, 2); + current_ev = getEvMgr().addEvent(this, 1000, 2); } toolOrderSub = world->getNotifications().subscribe([this](const ToolNote& note) { if((note.type == ToolNote::OrderPlaced || note.type == ToolNote::SettingsChanged) && note.player == this->player) - CheckForOrders(); + checkForOrders(); }); } void nofMetalworker::Serialize(SerializedGameData& sgd) const { nofWorkman::Serialize(sgd); - sgd.PushOptionalEnum(nextProducedTool); + sgd.pushOptionalEnum(nextProducedTool); } -void nofMetalworker::DrawWorking(DrawPoint drawPt) +void nofMetalworker::drawWorking(DrawPoint drawPt) { constexpr helpers::EnumArray offsets = {{{-11, -13}, {31, 5}, {32, 6}, {30, 10}, {28, 5}}}; - const unsigned now_id = GAMECLIENT.Interpolate(230, current_ev); + const unsigned now_id = GAMECLIENT.interpolate(230, current_ev); LOADER.getPlayerImage("rom_bobs", 190 + (now_id % 23)) - ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); + ->drawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); // Hämmer-Sound if(now_id % 23 == 3 || now_id % 23 == 7) @@ -116,9 +116,9 @@ bool nofMetalworker::hasToolOrder() const return false; } -bool nofMetalworker::AreWaresAvailable() const +bool nofMetalworker::areWaresAvailable() const { - if(!nofWorkman::AreWaresAvailable()) + if(!nofWorkman::areWaresAvailable()) return false; // If produce nothing on zero is disabled we will always produce something ->OK if(world->getGGS().getSelection(AddonId::METALWORKSBEHAVIORONZERO) == 0) @@ -136,20 +136,20 @@ bool nofMetalworker::AreWaresAvailable() const return false; } -bool nofMetalworker::StartWorking() +bool nofMetalworker::startWorking() { nextProducedTool = getOrderedTool(); if(!nextProducedTool) nextProducedTool = getRandomTool(); - return nextProducedTool && nofWorkman::StartWorking(); + return nextProducedTool && nofWorkman::startWorking(); } -void nofMetalworker::CheckForOrders() +void nofMetalworker::checkForOrders() { // If we are waiting and an order or setting was changed -> See if we can work if(state == State::WaitingForWaresOrProductionStopped) - TryToWork(); + tryToWork(); } helpers::OptionalEnum nofMetalworker::getOrderedTool() @@ -168,11 +168,11 @@ helpers::OptionalEnum nofMetalworker::getOrderedTool() const Tool tool = RANDOM_ELEMENT(random_array); - owner.ToolOrderProcessed(tool); + owner.toolOrderProcessed(tool); if(!hasToolOrder()) { - SendPostMessage(player, + sendPostMessage(player, std::make_unique(getEvMgr().getCurrentGF(), _("Completed the ordered amount of tools."), PostCategory::Economy)); } @@ -206,7 +206,7 @@ helpers::OptionalEnum nofMetalworker::getRandomTool() return TOOL_TO_GOOD[RANDOM_ELEMENT(random_array)]; } -helpers::OptionalEnum nofMetalworker::ProduceWare() +helpers::OptionalEnum nofMetalworker::produceWare() { return nextProducedTool; } diff --git a/libs/s25main/figures/nofMetalworker.h b/libs/s25main/figures/nofMetalworker.h index de974b533b..b9c36f4134 100644 --- a/libs/s25main/figures/nofMetalworker.h +++ b/libs/s25main/figures/nofMetalworker.h @@ -18,11 +18,11 @@ class nofMetalworker : public nofWorkman protected: /// Zeichnet ihn beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override; /// Der Arbeiter erzeugt eine Ware - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; /// Returns the next tool to be produced according to the orders helpers::OptionalEnum getOrderedTool(); /// Returns a random tool according to the priorities @@ -30,9 +30,9 @@ class nofMetalworker : public nofWorkman bool hasToolOrder() const; - bool AreWaresAvailable() const override; - bool StartWorking() override; - void CheckForOrders(); + bool areWaresAvailable() const override; + bool startWorking() override; + void checkForOrders(); public: nofMetalworker(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofMiller.cpp b/libs/s25main/figures/nofMiller.cpp index 5691fcd265..04913deac0 100644 --- a/libs/s25main/figures/nofMiller.cpp +++ b/libs/s25main/figures/nofMiller.cpp @@ -22,7 +22,7 @@ nofMiller::nofMiller(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id), last_sound(0), next_interval(0) {} -void nofMiller::DrawWorking(DrawPoint drawPt) +void nofMiller::drawWorking(DrawPoint drawPt) { constexpr helpers::EnumArray offsets = {{{20, 8}, {20, 8}, {20, 8}, {20, 8}, {20, 8}}}; constexpr helpers::EnumArray offsets_sitdown = {{{23, 8}, {23, 8}, {23, 8}, {23, 8}, {23, 8}}}; @@ -30,13 +30,13 @@ void nofMiller::DrawWorking(DrawPoint drawPt) {{8, 8}, {10, 9}, {12, 10}, {14, 11}, {16, 10}, {18, 9}, {20, 8}, {22, 8}}}; unsigned max_id = 120; - unsigned now_id = GAMECLIENT.Interpolate(max_id, current_ev); + unsigned now_id = GAMECLIENT.interpolate(max_id, current_ev); bool rotate_sails = true; const Nation nation = workplace->getNation(); if(now_id < 4) // hinauslaufen teil 1 { - LOADER.building_cache[nation][BuildingType::Mill].door.DrawFull(drawPt); + LOADER.building_cache[nation][BuildingType::Mill].door.drawFull(drawPt); LOADER.getBobSprite(nation, Job::Miller, Direction::SouthEast, now_id % 8) .draw(drawPt + walkoffsets[now_id], COLOR_WHITE, world->getPlayer(player).color); rotate_sails = false; @@ -49,17 +49,17 @@ void nofMiller::DrawWorking(DrawPoint drawPt) if((now_id >= 8) && (now_id < 16)) // hinsetzen { LOADER.getPlayerImage("rom_bobs", 166 + (now_id % 8)) - ->DrawFull(drawPt + offsets_sitdown[nation], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); + ->drawFull(drawPt + offsets_sitdown[nation], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); } if((now_id >= 16) && (now_id < max_id - 16)) // schlafen { LOADER.getPlayerImage("rom_bobs", 174 + (now_id % 8)) - ->DrawFull(drawPt + offsets[nation], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); + ->drawFull(drawPt + offsets[nation], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); } if((now_id >= max_id - 16) && (now_id < max_id - 8)) // aufstehn { LOADER.getPlayerImage("rom_bobs", 166 + 7 - (now_id % 8)) - ->DrawFull(drawPt + offsets_sitdown[nation], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); + ->drawFull(drawPt + offsets_sitdown[nation], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); } if((now_id >= max_id - 8) && (now_id < max_id - 4)) // zurücklaufen teil 1 { @@ -68,7 +68,7 @@ void nofMiller::DrawWorking(DrawPoint drawPt) } if((now_id >= max_id - 4) && (now_id < max_id)) // zurücklaufen teil 2 { - LOADER.building_cache[nation][BuildingType::Mill].door.DrawFull(drawPt); + LOADER.building_cache[nation][BuildingType::Mill].door.drawFull(drawPt); LOADER.getBobSprite(nation, Job::Miller, Direction::NorthWest, now_id % 8) .draw(drawPt + walkoffsets[7 - (now_id % 8)], COLOR_WHITE, world->getPlayer(player).color); rotate_sails = false; @@ -77,9 +77,9 @@ void nofMiller::DrawWorking(DrawPoint drawPt) if(rotate_sails) { // Flügel der Mühle - LOADER.getNationImage(nation, 250 + 5 * (42 + ((now_id + 4) % 8)))->DrawFull(drawPt); + LOADER.getNationImage(nation, 250 + 5 * (42 + ((now_id + 4) % 8)))->drawFull(drawPt); // Schatten der Flügel - LOADER.getNationImage(nation, 250 + (5 * (42 + ((now_id + 4) % 8))) + 1)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getNationImage(nation, 250 + (5 * (42 + ((now_id + 4) % 8))) + 1)->drawFull(drawPt, COLOR_SHADOW); // Mühlensound abspielen in zufälligen Intervallen if(VIDEODRIVER.getTickCount() - last_sound > next_interval) @@ -93,13 +93,13 @@ void nofMiller::DrawWorking(DrawPoint drawPt) } else { // Flügel der Mühle - LOADER.getNationImage(nation, 250 + 5 * 49)->DrawFull(drawPt); + LOADER.getNationImage(nation, 250 + 5 * 49)->drawFull(drawPt); // Schatten der Flügel - LOADER.getNationImage(nation, 250 + 5 * 49 + 1)->DrawFull(drawPt, COLOR_SHADOW); + LOADER.getNationImage(nation, 250 + 5 * 49 + 1)->drawFull(drawPt, COLOR_SHADOW); } } -helpers::OptionalEnum nofMiller::ProduceWare() +helpers::OptionalEnum nofMiller::produceWare() { return GoodType::Flour; } diff --git a/libs/s25main/figures/nofMiller.h b/libs/s25main/figures/nofMiller.h index b9cc303498..3aaf6e5983 100644 --- a/libs/s25main/figures/nofMiller.h +++ b/libs/s25main/figures/nofMiller.h @@ -19,11 +19,11 @@ class nofMiller : public nofWorkman private: /// Zeichnet ihn beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override { return 75; } /// Der Arbeiter erzeugt eine Ware - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; public: nofMiller(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofMiner.cpp b/libs/s25main/figures/nofMiner.cpp index d2f8a360b4..5a7c96fb2d 100644 --- a/libs/s25main/figures/nofMiner.cpp +++ b/libs/s25main/figures/nofMiner.cpp @@ -63,7 +63,7 @@ helpers::OptionalEnum GetNoOutputFallbackGood(const GlobalGameSettings if(graniteFallbackChance > 0) { if(graniteFallbackChance == MAX_PRODUCTION_PERCENT - || static_cast(RANDOM.Rand(RANDOM_CONTEXT2(objId), MAX_PRODUCTION_PERCENT)) + || static_cast(RANDOM.rand(RANDOM_CONTEXT2(objId), MAX_PRODUCTION_PERCENT)) < graniteFallbackChance) return GoodType::Stones; @@ -88,7 +88,7 @@ void ReduceS4LikeResource(GameWorld& world, const std::vector& resourc { if(world.getNode(pt).resources.getAmount() > S4LIKE_MIN_RESOURCE_AMOUNT) { - world.ReduceResource(pt); + world.reduceResource(pt); return; } } @@ -101,7 +101,7 @@ nofMiner::nofMiner(const MapPoint pos, const unsigned char player, nobUsual* wor nofMiner::nofMiner(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id) {} -void nofMiner::DrawWorking(DrawPoint drawPt) +void nofMiner::drawWorking(DrawPoint drawPt) { constexpr helpers::EnumArray, Nation> offsets = // work animation offset per nation and (granite, coal, iron, gold) @@ -115,13 +115,13 @@ void nofMiner::DrawWorking(DrawPoint drawPt) const unsigned mineIdx = rttr::enum_cast(workplace->getBuildingType()) - rttr::enum_cast(BuildingType::GraniteMine); RTTR_Assert(mineIdx < offsets.size()); - unsigned now_id = GAMECLIENT.Interpolate(160, current_ev); + unsigned now_id = GAMECLIENT.interpolate(160, current_ev); unsigned texture; if(workplace->getNation() == Nation::Romans) texture = 92 + now_id % 8; else texture = 1799 + now_id % 4; - LOADER.getPlayerImage("rom_bobs", texture)->DrawFull(drawPt + offsets[workplace->getNation()][mineIdx]); + LOADER.getPlayerImage("rom_bobs", texture)->drawFull(drawPt + offsets[workplace->getNation()][mineIdx]); if(now_id % 8 == 3) { @@ -141,7 +141,7 @@ unsigned short nofMiner::getCarryID() const } } -helpers::OptionalEnum nofMiner::ProduceWare() +helpers::OptionalEnum nofMiner::produceWare() { const GlobalGameSettings& settings = world->getGGS(); const MineResourceBehavior behavior = getMineResourceBehavior(settings, workplace->getBuildingType()); @@ -163,40 +163,40 @@ helpers::OptionalEnum nofMiner::ProduceWare() return getMineOutput(workplace->getBuildingType()); } -bool nofMiner::AreWaresAvailable() const +bool nofMiner::areWaresAvailable() const { - if(!nofWorkman::AreWaresAvailable()) + if(!nofWorkman::areWaresAvailable()) return false; const MineResourceBehavior behavior = getMineResourceBehavior(world->getGGS(), workplace->getBuildingType()); if(behavior == MineResourceBehavior::WorkEverywhere) return true; - const bool hasResources = FindPointWithResource(getRequiredResType()).isValid(); + const bool hasResources = findPointWithResource(getRequiredResType()).isValid(); if(!hasResources) - workplace->OnOutOfResources(); + workplace->onOutOfResources(); return hasResources; } -bool nofMiner::StartWorking() +bool nofMiner::startWorking() { const GlobalGameSettings& settings = world->getGGS(); const MineResourceBehavior behavior = getMineResourceBehavior(settings, workplace->getBuildingType()); if(behavior == MineResourceBehavior::WorkEverywhere) - return nofWorkman::StartWorking(); + return nofWorkman::startWorking(); - const MapPoint resPt = FindPointWithResource(getRequiredResType()); + const MapPoint resPt = findPointWithResource(getRequiredResType()); if(!resPt.isValid()) { - workplace->OnOutOfResources(); + workplace->onOutOfResources(); return false; } if(behavior != MineResourceBehavior::S4LikeExhaustion && isMineResourceDepletable(settings, workplace->getBuildingType())) - world->ReduceResource(resPt); + world->reduceResource(resPt); - return nofWorkman::StartWorking(); + return nofWorkman::startWorking(); } ResourceType nofMiner::getRequiredResType() const diff --git a/libs/s25main/figures/nofMiner.h b/libs/s25main/figures/nofMiner.h index 37af2b6af8..a55e1f9cdc 100644 --- a/libs/s25main/figures/nofMiner.h +++ b/libs/s25main/figures/nofMiner.h @@ -14,14 +14,14 @@ class nofMiner : public nofWorkman { protected: /// Zeichnet ihn beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override; /// Der Arbeiter erzeugt eine Ware - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; - bool AreWaresAvailable() const override; - bool StartWorking() override; + bool areWaresAvailable() const override; + bool startWorking() override; ResourceType getRequiredResType() const; public: diff --git a/libs/s25main/figures/nofMinter.cpp b/libs/s25main/figures/nofMinter.cpp index 8e1670f344..4e3a37db22 100644 --- a/libs/s25main/figures/nofMinter.cpp +++ b/libs/s25main/figures/nofMinter.cpp @@ -17,16 +17,16 @@ nofMinter::nofMinter(const MapPoint pos, const unsigned char player, nobUsual* w nofMinter::nofMinter(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id) {} -void nofMinter::DrawWorking(DrawPoint drawPt) +void nofMinter::drawWorking(DrawPoint drawPt) { constexpr helpers::EnumArray offsets = {{{19, -20}, {19, -11}, {22, -12}, {28, 1}, {16, -12}}}; - unsigned now_id = GAMECLIENT.Interpolate(136, current_ev); + unsigned now_id = GAMECLIENT.interpolate(136, current_ev); if(now_id < 91) { LOADER.getPlayerImage("rom_bobs", 84 + (now_id) % 8) - ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, + ->drawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); // Evtl Sound abspielen @@ -40,8 +40,8 @@ void nofMinter::DrawWorking(DrawPoint drawPt) last_id = now_id; } -helpers::OptionalEnum nofMinter::ProduceWare() +helpers::OptionalEnum nofMinter::produceWare() { - world->getPlayer(player).ChangeStatisticValue(StatisticType::Gold, 1); + world->getPlayer(player).changeStatisticValue(StatisticType::Gold, 1); return GoodType::Coins; } diff --git a/libs/s25main/figures/nofMinter.h b/libs/s25main/figures/nofMinter.h index e3712bdf01..9ba18a5de0 100644 --- a/libs/s25main/figures/nofMinter.h +++ b/libs/s25main/figures/nofMinter.h @@ -12,11 +12,11 @@ class nobUsual; class nofMinter : public nofWorkman { /// Zeichnet ihn beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override { return 64; } /// Der Arbeiter erzeugt eine Ware - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; public: nofMinter(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofPassiveSoldier.cpp b/libs/s25main/figures/nofPassiveSoldier.cpp index 86fae1a852..fd24f8b6d0 100644 --- a/libs/s25main/figures/nofPassiveSoldier.cpp +++ b/libs/s25main/figures/nofPassiveSoldier.cpp @@ -16,7 +16,7 @@ nofPassiveSoldier::nofPassiveSoldier(const nofSoldier& soldier) : nofSoldier(soldier), healing_event(nullptr) { // Soldat von einer Mission nach Hause gekommen --> ggf heilen! - Heal(); + heal(); // Laufevent nullen, laufen ja nicht mehr current_ev = nullptr; } @@ -28,30 +28,30 @@ nofPassiveSoldier::nofPassiveSoldier(const MapPoint pos, const unsigned char pla nofPassiveSoldier::~nofPassiveSoldier() = default; -void nofPassiveSoldier::Destroy() +void nofPassiveSoldier::destroy() { - getEvMgr().RemoveEvent(healing_event); - nofSoldier::Destroy(); + getEvMgr().removeEvent(healing_event); + nofSoldier::destroy(); } void nofPassiveSoldier::Serialize(SerializedGameData& sgd) const { nofSoldier::Serialize(sgd); - sgd.PushEvent(healing_event); + sgd.pushEvent(healing_event); } nofPassiveSoldier::nofPassiveSoldier(SerializedGameData& sgd, const unsigned obj_id) - : nofSoldier(sgd, obj_id), healing_event(sgd.PopEvent()) + : nofSoldier(sgd, obj_id), healing_event(sgd.popEvent()) {} -void nofPassiveSoldier::Draw(DrawPoint drawPt) +void nofPassiveSoldier::draw(DrawPoint drawPt) { // Soldat normal laufend zeichnen - DrawWalkingBobJobs(drawPt, job_); + drawWalkingBobJobs(drawPt, job_); } -void nofPassiveSoldier::HandleDerivedEvent(const unsigned id) +void nofPassiveSoldier::handleDerivedEvent(const unsigned id) { switch(id) { @@ -71,7 +71,7 @@ void nofPassiveSoldier::HandleDerivedEvent(const unsigned id) // Sind wir immer noch nicht gesund? Dann neues Event anmelden! if(hitpoints < HITPOINTS[getRank()]) healing_event = - getEvMgr().AddEvent(this, CONVALESCE_TIME + RANDOM_RAND(CONVALESCE_TIME_RANDOM), 1); + getEvMgr().addEvent(this, CONVALESCE_TIME + RANDOM_RAND(CONVALESCE_TIME_RANDOM), 1); } } } @@ -79,39 +79,39 @@ void nofPassiveSoldier::HandleDerivedEvent(const unsigned id) } } -void nofPassiveSoldier::Heal() +void nofPassiveSoldier::heal() { // Schon ein Event angemeldet? // Dann muss dieses entfernt werden, wahrscheinlich war er zuvor draußen gewesen if(healing_event) { - getEvMgr().RemoveEvent(healing_event); + getEvMgr().removeEvent(healing_event); healing_event = nullptr; } // Ist er verletzt? // Dann muss er geheilt werden if(hitpoints < HITPOINTS[getRank()]) - healing_event = getEvMgr().AddEvent(this, CONVALESCE_TIME + RANDOM_RAND(CONVALESCE_TIME_RANDOM), 1); + healing_event = getEvMgr().addEvent(this, CONVALESCE_TIME + RANDOM_RAND(CONVALESCE_TIME_RANDOM), 1); } -void nofPassiveSoldier::GoalReached() +void nofPassiveSoldier::goalReached() { - static_cast(homeBld)->AddPassiveSoldier(world->RemoveFigure(pos, *this)); + static_cast(homeBld)->addPassiveSoldier(world->RemoveFigure(pos, *this)); } -void nofPassiveSoldier::LeaveBuilding() +void nofPassiveSoldier::leaveBuilding() { // Nach Hause in ein Lagerhaus gehen rs_dir = true; rs_pos = 1; cur_rs = homeBld->getRoute(Direction::SouthEast); - GoHome(); + goHome(); homeBld = nullptr; } -void nofPassiveSoldier::Upgrade() +void nofPassiveSoldier::upgrade() { // We must not be in the buildings list while upgrading. This would destroy the ordered list RTTR_Assert(!homeBld || !static_cast(homeBld)->isInTroops(*this)); @@ -123,24 +123,24 @@ void nofPassiveSoldier::Upgrade() hitpoints = HITPOINTS[getRank()]; // Inventur entsprechend erhöhen und verringern - owner.IncreaseInventoryJob(job_, 1); - owner.DecreaseInventoryJob(Job(unsigned(job_) - 1), 1); + owner.increaseInventoryJob(job_, 1); + owner.decreaseInventoryJob(Job(unsigned(job_) - 1), 1); if(hasArmor_) { - owner.IncreaseInventoryJob(jobEnumToAmoredSoldierEnum(job_), 1); - owner.DecreaseInventoryJob(jobEnumToAmoredSoldierEnum(Job(unsigned(job_) - 1)), 1); + owner.increaseInventoryJob(jobEnumToAmoredSoldierEnum(job_), 1); + owner.decreaseInventoryJob(jobEnumToAmoredSoldierEnum(Job(unsigned(job_) - 1)), 1); } } -void nofPassiveSoldier::Walked() +void nofPassiveSoldier::walked() { throw std::logic_error("Passive soldiers shall not walk"); } -void nofPassiveSoldier::NotNeeded() +void nofPassiveSoldier::notNeeded() { homeBld = nullptr; - GoHome(); + goHome(); } nobMilitary* nofPassiveSoldier::getHome() const diff --git a/libs/s25main/figures/nofPassiveSoldier.h b/libs/s25main/figures/nofPassiveSoldier.h index 9dcdf35339..1d09cf79f3 100644 --- a/libs/s25main/figures/nofPassiveSoldier.h +++ b/libs/s25main/figures/nofPassiveSoldier.h @@ -19,15 +19,15 @@ class nofPassiveSoldier : public nofSoldier const GameEvent* healing_event; /// Eventhandling - void HandleDerivedEvent(unsigned id) override; + void handleDerivedEvent(unsigned id) override; // informieren, wenn ... - void GoalReached() override; // das Ziel erreicht wurde + void goalReached() override; // das Ziel erreicht wurde /// wenn man gelaufen ist - [[noreturn]] void Walked() override; + [[noreturn]] void walked() override; /// Prüft die Gesundheit des Soldaten und meldet, falls erforderlich, ein Heilungs-Event an - void Heal(); + void heal(); public: nofPassiveSoldier(MapPoint pos, unsigned char player, nobBaseMilitary* goal, nobMilitary* home, unsigned char rank); @@ -36,23 +36,23 @@ class nofPassiveSoldier : public nofSoldier ~nofPassiveSoldier() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofPassivesoldier; } // Zeichnet den Soldaten - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; /// Sagt einem in einem Militärgebäude sitzenden Soldaten, dass er raus nach Hause gehen soll - void LeaveBuilding(); + void leaveBuilding(); /// Befördert einen Soldaten - void Upgrade(); + void upgrade(); /// Soldat befindet sich auf dem Hinweg zum Militärgebäude und wird nich länger gebraucht - void NotNeeded(); + void notNeeded(); /// Tells the soldier it is not in its home building anymore (e.g. died, or converted to attacker) - void LeftBuilding() { homeBld = nullptr; } + void leftBuilding() { homeBld = nullptr; } nobMilitary* getHome() const; }; diff --git a/libs/s25main/figures/nofPassiveWorker.cpp b/libs/s25main/figures/nofPassiveWorker.cpp index 0a17b5f47d..32b82bb76f 100644 --- a/libs/s25main/figures/nofPassiveWorker.cpp +++ b/libs/s25main/figures/nofPassiveWorker.cpp @@ -16,24 +16,24 @@ nofPassiveWorker::nofPassiveWorker(SerializedGameData& sgd, const unsigned obj_i /// von noFigure aufgerufen // wenn man gelaufen ist -void nofPassiveWorker::Walked() {} +void nofPassiveWorker::walked() {} // wenn das Ziel erreicht wurde -void nofPassiveWorker::GoalReached() +void nofPassiveWorker::goalReached() { // Mich hier einquartieren auto* wh = world->getSpecObj(pos); RTTR_Assert(wh); - wh->AddFigure(world->RemoveFigure(pos, *this)); + wh->addFigure(world->RemoveFigure(pos, *this)); } -void nofPassiveWorker::AbrogateWorkplace() {} +void nofPassiveWorker::abrogateWorkplace() {} /// Zeichnen -void nofPassiveWorker::Draw(DrawPoint drawPt) +void nofPassiveWorker::draw(DrawPoint drawPt) { - DrawWalking(drawPt); + drawWalking(drawPt); } /// Für alle restlichen Events, die nicht von noFigure behandelt werden -void nofPassiveWorker::HandleDerivedEvent(const unsigned /*id*/) {} +void nofPassiveWorker::handleDerivedEvent(const unsigned /*id*/) {} diff --git a/libs/s25main/figures/nofPassiveWorker.h b/libs/s25main/figures/nofPassiveWorker.h index 05f02f88fc..489b97aa91 100644 --- a/libs/s25main/figures/nofPassiveWorker.h +++ b/libs/s25main/figures/nofPassiveWorker.h @@ -15,11 +15,11 @@ class nofPassiveWorker : public noFigure { private: /// von noFigure aufgerufen - void Walked() override; // wenn man gelaufen ist - void GoalReached() override; // wenn das Ziel erreicht wurde - void AbrogateWorkplace() override; + void walked() override; // wenn man gelaufen ist + void goalReached() override; // wenn das Ziel erreicht wurde + void abrogateWorkplace() override; void - HandleDerivedEvent(unsigned id) override; /// Für alle restlichen Events, die nicht von noFigure behandelt werden + handleDerivedEvent(unsigned id) override; /// Für alle restlichen Events, die nicht von noFigure behandelt werden public: nofPassiveWorker(Job job, MapPoint pos, unsigned char player, noRoadNode* goal); @@ -27,7 +27,7 @@ class nofPassiveWorker : public noFigure nofPassiveWorker(const nofPassiveWorker&) = delete; /// Zeichnen - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; GO_Type getGOT() const final { return GO_Type::NofPassiveworker; } }; diff --git a/libs/s25main/figures/nofPigbreeder.cpp b/libs/s25main/figures/nofPigbreeder.cpp index f316b919d1..890a7746c5 100644 --- a/libs/s25main/figures/nofPigbreeder.cpp +++ b/libs/s25main/figures/nofPigbreeder.cpp @@ -20,13 +20,13 @@ nofPigbreeder::nofPigbreeder(const MapPoint pos, const unsigned char player, nob nofPigbreeder::nofPigbreeder(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id) {} -void nofPigbreeder::DrawWorking(DrawPoint drawPt) +void nofPigbreeder::drawWorking(DrawPoint drawPt) { constexpr helpers::EnumArray offsets = {{{10, 2}, {10, 2}, {10, 2}, {10, 2}, {10, 2}}}; constexpr helpers::EnumArray walkstart = {{{-6, -6}, {-6, -6}, {-6, -6}, {-6, -6}, {-6, -6}}}; unsigned max_id = 240; - int now_id = GAMECLIENT.Interpolate(max_id, current_ev); + int now_id = GAMECLIENT.interpolate(max_id, current_ev); const Nation wpNation = workplace->getNation(); unsigned plColor = world->getPlayer(player).color; int walksteps = 16; @@ -34,7 +34,7 @@ void nofPigbreeder::DrawWorking(DrawPoint drawPt) if(now_id < 16) { if(now_id < 8) - LOADER.building_cache[wpNation][BuildingType::PigFarm].door.DrawFull(drawPt); + LOADER.building_cache[wpNation][BuildingType::PigFarm].door.drawFull(drawPt); // TODO: Use GlobalAnimation? DrawPoint walkPos = drawPt + walkstart[wpNation] + (offsets[wpNation] - walkstart[wpNation]) * now_id / walksteps; @@ -44,7 +44,7 @@ void nofPigbreeder::DrawWorking(DrawPoint drawPt) } else if(now_id < 40) { LOADER.getPlayerImage("rom_bobs", 148 + (now_id - 16) / 2) - ->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); + ->drawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); // Evtl Sound abspielen if((now_id - 16) == 10) @@ -55,7 +55,7 @@ void nofPigbreeder::DrawWorking(DrawPoint drawPt) } else if(now_id < 56) { if(now_id > 46) - LOADER.building_cache[wpNation][BuildingType::PigFarm].door.DrawFull(drawPt); + LOADER.building_cache[wpNation][BuildingType::PigFarm].door.drawFull(drawPt); // TODO: Use GlobalAnimation? DrawPoint walkPos = drawPt + walkstart[wpNation] + (walkstart[wpNation] - offsets[wpNation]) * (now_id - 40) / walksteps; @@ -64,12 +64,12 @@ void nofPigbreeder::DrawWorking(DrawPoint drawPt) } } -helpers::OptionalEnum nofPigbreeder::ProduceWare() +helpers::OptionalEnum nofPigbreeder::produceWare() { return GoodType::Ham; } -void nofPigbreeder::MakePigSounds() +void nofPigbreeder::makePigSounds() { /// Ist es wieder Zeit für einen Schweine-Sound? unsigned timeDiffSound = 600 + unsigned(rand() % 200) - workplace->getProductivity() * 5u; diff --git a/libs/s25main/figures/nofPigbreeder.h b/libs/s25main/figures/nofPigbreeder.h index 31447d8758..17d6c9ad0d 100644 --- a/libs/s25main/figures/nofPigbreeder.h +++ b/libs/s25main/figures/nofPigbreeder.h @@ -13,11 +13,11 @@ class nobUsual; class nofPigbreeder : public nofWorkman { /// Zeichnet ihn beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override { return 73; } /// Der Arbeiter erzeugt eine Ware - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; public: nofPigbreeder(MapPoint pos, unsigned char player, nobUsual* workplace); @@ -26,5 +26,5 @@ class nofPigbreeder : public nofWorkman GO_Type getGOT() const final { return GO_Type::NofPigbreeder; } /// Ggf. Schweinesounds abspielen - void MakePigSounds(); + void makePigSounds(); }; diff --git a/libs/s25main/figures/nofPlaner.cpp b/libs/s25main/figures/nofPlaner.cpp index 49bf1cfb74..1c9b6d7985 100644 --- a/libs/s25main/figures/nofPlaner.cpp +++ b/libs/s25main/figures/nofPlaner.cpp @@ -24,19 +24,19 @@ void nofPlaner::Serialize(SerializedGameData& sgd) const { noFigure::Serialize(sgd); - sgd.PushEnum(state); - sgd.PushObject(building_site, true); - sgd.PushEnum(pd); + sgd.pushEnum(state); + sgd.pushObject(building_site, true); + sgd.pushEnum(pd); } nofPlaner::nofPlaner(SerializedGameData& sgd, const unsigned obj_id) : noFigure(sgd, obj_id) { - state = sgd.Pop(); - building_site = sgd.PopObject(GO_Type::Buildingsite); - pd = sgd.Pop(); + state = sgd.pop(); + building_site = sgd.popObject(GO_Type::Buildingsite); + pd = sgd.pop(); } -void nofPlaner::GoalReached() +void nofPlaner::goalReached() { state = PlanerState::Walking; @@ -44,16 +44,16 @@ void nofPlaner::GoalReached() pd = (RANDOM_RAND(2) == 0) ? (PlaningDir::Clockwise) : (PlaningDir::Counterclockwise); // Je nachdem erst nach rechts oder links gehen - StartWalking((pd == PlaningDir::Clockwise) ? Direction::SouthWest : Direction::East); + startWalking((pd == PlaningDir::Clockwise) ? Direction::SouthWest : Direction::East); } -void nofPlaner::Walked() +void nofPlaner::walked() { /// Zur Baustelle zurückgelaufen? (=fertig) if(pos == building_site->getPos()) { // Baustelle Bescheid sagen - building_site->PlaningFinished(); + building_site->planingFinished(); state = PlanerState::FigureWork; @@ -63,59 +63,59 @@ void nofPlaner::Walked() cur_rs = world->getSpecObj(pos)->getRoute(Direction::SouthEast); building_site = nullptr; - GoHome(); - StartWalking(Direction::SouthEast); + goHome(); + startWalking(Direction::SouthEast); } else { /// Anfangen zu arbeiten - current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[Job::Planer].work_length, 1); + current_ev = getEvMgr().addEvent(this, JOB_CONSTS[Job::Planer].work_length, 1); state = PlanerState::Planing; } } -void nofPlaner::AbrogateWorkplace() +void nofPlaner::abrogateWorkplace() { if(building_site) { state = PlanerState::FigureWork; - building_site->Abrogate(); + building_site->abrogate(); building_site = nullptr; } } -void nofPlaner::LostWork() +void nofPlaner::lostWork() { building_site = nullptr; if(state == PlanerState::FigureWork) - GoHome(); + goHome(); else { // Event ggf. abmelden if(state == PlanerState::Planing) { - getEvMgr().RemoveEvent(current_ev); + getEvMgr().removeEvent(current_ev); /// Sounds abmelden world->getSoundMgr().stopSounds(*this); } - StartWandering(); + startWandering(); // wenn wir schon laufen, nicht nochmal laufen! if(state != PlanerState::Walking) - Wander(); + wander(); state = PlanerState::FigureWork; } } -void nofPlaner::Draw(DrawPoint drawPt) +void nofPlaner::draw(DrawPoint drawPt) { switch(state) { case PlanerState::FigureWork: case PlanerState::Walking: { - DrawWalkingBobJobs(drawPt, Job::Planer); + drawWalkingBobJobs(drawPt, Job::Planer); } break; case PlanerState::Planing: @@ -123,7 +123,7 @@ void nofPlaner::Draw(DrawPoint drawPt) // 41 /// Animation des Planierers - unsigned now_id = GAMECLIENT.Interpolate(69, current_ev); + unsigned now_id = GAMECLIENT.interpolate(69, current_ev); // spezielle Animation am Ende const std::array ANIMATION = {273, 273, 273, 273, 273, 274, 274, 275, 276, 276, 276, @@ -139,7 +139,7 @@ void nofPlaner::Draw(DrawPoint drawPt) else bobId = 253 + now_id - 55; LOADER.getPlayerImage("rom_bobs", bobId) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(building_site->getPlayer()).color); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(building_site->getPlayer()).color); // Schaufel-Sound if(now_id == 5 || now_id == 46 || now_id == 60) @@ -152,13 +152,13 @@ void nofPlaner::Draw(DrawPoint drawPt) } } -void nofPlaner::HandleDerivedEvent(const unsigned id) +void nofPlaner::handleDerivedEvent(const unsigned id) { if(id == 1) { // Planieren (falls Baustelle noch existiert) if(building_site) - world->ChangeAltitude(pos, world->getNode(building_site->getPos()).altitude); + world->changeAltitude(pos, world->getNode(building_site->getPos()).altitude); /// Sounds abmelden world->getSoundMgr().stopSounds(*this); @@ -170,17 +170,17 @@ void nofPlaner::HandleDerivedEvent(const unsigned id) // Das erste Mal gelaufen? if((pd == PlaningDir::Clockwise && curDir == Direction::SouthWest) || (pd == PlaningDir::Counterclockwise && curDir == Direction::East)) - StartWalking(Direction::NorthWest); + startWalking(Direction::NorthWest); // Fertig -> zur Baustelle zurücklaufen else if(pd == PlaningDir::Clockwise && curDir == Direction::SouthEast) - StartWalking(Direction::West); + startWalking(Direction::West); else if(pd == PlaningDir::Counterclockwise && curDir == Direction::SouthEast) - StartWalking(Direction::NorthEast); + startWalking(Direction::NorthEast); // In nächste Richtung gehen else if(pd == PlaningDir::Clockwise) - StartWalking(curDir + 1u); + startWalking(curDir + 1u); else - StartWalking(curDir - 1u); + startWalking(curDir - 1u); } } diff --git a/libs/s25main/figures/nofPlaner.h b/libs/s25main/figures/nofPlaner.h index b5b04718d4..8e2eda75dc 100644 --- a/libs/s25main/figures/nofPlaner.h +++ b/libs/s25main/figures/nofPlaner.h @@ -34,10 +34,10 @@ class nofPlaner : public noFigure friend constexpr auto maxEnumValue(PlaningDir) { return PlaningDir::Counterclockwise; } private: - void GoalReached() override; - void Walked() override; - void AbrogateWorkplace() override; - void HandleDerivedEvent(unsigned id) override; + void goalReached() override; + void walked() override; + void abrogateWorkplace() override; + void handleDerivedEvent(unsigned id) override; public: nofPlaner(MapPoint pos, unsigned char player, noBuildingSite* building_site); @@ -48,8 +48,8 @@ class nofPlaner : public noFigure GO_Type getGOT() const final { return GO_Type::NofPlaner; } - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; /// Wird von der Baustelle aus aufgerufen, um den Bauarbeiter zu sagen, dass er gehen kann - void LostWork(); + void lostWork(); }; diff --git a/libs/s25main/figures/nofScout_Free.cpp b/libs/s25main/figures/nofScout_Free.cpp index 46521e492f..8f28a34a95 100644 --- a/libs/s25main/figures/nofScout_Free.cpp +++ b/libs/s25main/figures/nofScout_Free.cpp @@ -25,16 +25,16 @@ void nofScout_Free::Serialize(SerializedGameData& sgd) const } nofScout_Free::nofScout_Free(SerializedGameData& sgd, const unsigned obj_id) - : nofFlagWorker(sgd, obj_id), nextPos(sgd.PopMapPoint()), rest_way(sgd.PopUnsignedInt()) + : nofFlagWorker(sgd, obj_id), nextPos(sgd.popMapPoint()), rest_way(sgd.PopUnsignedInt()) {} -void nofScout_Free::Draw(DrawPoint drawPt) +void nofScout_Free::draw(DrawPoint drawPt) { // normales Laufen zeichnen - DrawWalking(drawPt); + drawWalking(drawPt); } -void nofScout_Free::GoalReached() +void nofScout_Free::goalReached() { /// Bestimmte Anzahl an Punkten abklappern, leicht variieren rest_way = 80 + RANDOM_RAND(20); @@ -42,22 +42,22 @@ void nofScout_Free::GoalReached() state = State::ScoutScouting; // Loslegen - GoToNewNode(); + goToNewNode(); } -void nofScout_Free::Walked() +void nofScout_Free::walked() { switch(state) { default: break; - case State::GoToFlag: GoToFlag(); break; - case State::ScoutScouting: Scout(); break; + case State::GoToFlag: goToFlag(); break; + case State::ScoutScouting: scout(); break; } } -void nofScout_Free::HandleDerivedEvent(const unsigned /*id*/) {} +void nofScout_Free::handleDerivedEvent(const unsigned /*id*/) {} -void nofScout_Free::LostWork() +void nofScout_Free::lostWork() { flag = nullptr; @@ -67,14 +67,14 @@ void nofScout_Free::LostWork() // Wenn wir noch hingehen, dann zurückgehen case State::FigureWork: { - GoHome(); + goHome(); } break; case State::GoToFlag: case State::ScoutScouting: { // dann sofort rumirren, wenn wir zur Flagge gehen - StartWandering(); + startWandering(); state = State::FigureWork; } break; @@ -82,14 +82,14 @@ void nofScout_Free::LostWork() } /// Erkundet (quasi ein Umherirren) -void nofScout_Free::Scout() +void nofScout_Free::scout() { // Erkundet er noch, ist aber schon seine maximale Wegstrecke abgelaufen? if(--rest_way == 0) { // Wieder zur Flagge zurückgehen state = State::GoToFlag; - GoToFlag(); + goToFlag(); return; } @@ -97,19 +97,19 @@ void nofScout_Free::Scout() if(pos == nextPos) { // Nächsten Punkt suchen - GoToNewNode(); + goToNewNode(); } else { // Weg suchen - const auto dir = world->FindHumanPath(pos, nextPos, 30); + const auto dir = world->findHumanPath(pos, nextPos, 30); // Wenns keinen gibt, neuen suchen, ansonsten hinlaufen if(dir) - StartWalking(*dir); + startWalking(*dir); else { // Neuen Punkt suchen - GoToNewNode(); + goToNewNode(); } } } @@ -126,13 +126,13 @@ struct IsScoutable bool operator()(const MapPoint& pt) const { // Liegt Punkt im Nebel und für Figuren begehbar? - return world.CalcVisiblityWithAllies(pt, player) != Visibility::Visible + return world.calcVisiblityWithAllies(pt, player) != Visibility::Visible && PathConditionHuman(world).isNodeOk(pt); } }; } // namespace -void nofScout_Free::GoToNewNode() +void nofScout_Free::goToNewNode() { std::vector available_points = world->GetMatchingPointsInRadius<-1>(flag->getPos(), SCOUT_RANGE, IsScoutable(player, *world)); @@ -141,19 +141,19 @@ void nofScout_Free::GoToNewNode() { // Is there a path to this point and is the point also not to far away from the flag? // (Second check avoids running around mountains with a very far way back) - if(world->FindHumanPath(pos, pt, SCOUT_RANGE * 2) - && world->FindHumanPath(flag->getPos(), pt, SCOUT_RANGE + SCOUT_RANGE / 4)) + if(world->findHumanPath(pos, pt, SCOUT_RANGE * 2) + && world->findHumanPath(flag->getPos(), pt, SCOUT_RANGE + SCOUT_RANGE / 4)) { // Take it nextPos = pt; - Scout(); + scout(); return; } } // Nothing found -> Go back state = State::GoToFlag; - GoToFlag(); + goToFlag(); } /// Gibt den Sichtradius dieser Figur zurück (0, falls nicht-spähend) diff --git a/libs/s25main/figures/nofScout_Free.h b/libs/s25main/figures/nofScout_Free.h index 0d549700b7..684ef6716a 100644 --- a/libs/s25main/figures/nofScout_Free.h +++ b/libs/s25main/figures/nofScout_Free.h @@ -18,15 +18,15 @@ class nofScout_Free : public nofFlagWorker unsigned rest_way; private: - void GoalReached() override; - void Walked() override; - void HandleDerivedEvent(unsigned id) override; + void goalReached() override; + void walked() override; + void handleDerivedEvent(unsigned id) override; /// Erkundet (quasi ein Umherirren) - void Scout(); + void scout(); /// Sucht einen neuen Zielpunkt und geht zu diesen - void GoToNewNode(); + void goToNewNode(); /// Gibt den Sichtradius dieser Figur zurück (0, falls nicht-spähend) unsigned getVisualRange() const override; @@ -39,10 +39,10 @@ class nofScout_Free : public nofFlagWorker GO_Type getGOT() const final { return GO_Type::NofScoutFree; } - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; /// Wird aufgerufen, wenn die Flagge abgerissen wurde - void LostWork() override; + void lostWork() override; ///// Ist der Erkunder am erkunden (Sichtbereich um ihn herum)? // bool IsScouting() const { return (state == ScoutScouting || state == GoToFlag); } diff --git a/libs/s25main/figures/nofScout_LookoutTower.cpp b/libs/s25main/figures/nofScout_LookoutTower.cpp index 0705db6930..4f5452d8c3 100644 --- a/libs/s25main/figures/nofScout_LookoutTower.cpp +++ b/libs/s25main/figures/nofScout_LookoutTower.cpp @@ -19,30 +19,30 @@ nofScout_LookoutTower::nofScout_LookoutTower(SerializedGameData& sgd, const unsi : nofBuildingWorker(sgd, obj_id) {} -void nofScout_LookoutTower::WalkedDerived() {} +void nofScout_LookoutTower::walkedDerived() {} -void nofScout_LookoutTower::DrawWorking(DrawPoint /*drawPt*/) {} +void nofScout_LookoutTower::drawWorking(DrawPoint /*drawPt*/) {} -void nofScout_LookoutTower::HandleDerivedEvent(const unsigned /*id*/) {} +void nofScout_LookoutTower::handleDerivedEvent(const unsigned /*id*/) {} -void nofScout_LookoutTower::WorkAborted() +void nofScout_LookoutTower::workAborted() { // Im enstprechenden Radius alles neu berechnen - world->RecalcVisibilitiesAroundPoint(pos, VISUALRANGE_LOOKOUTTOWER, player, workplace); + world->recalcVisibilitiesAroundPoint(pos, VISUALRANGE_LOOKOUTTOWER, player, workplace); } -void nofScout_LookoutTower::WorkplaceReached() +void nofScout_LookoutTower::workplaceReached() { // Im enstprechenden Radius alles sichtbar machen - world->MakeVisibleAroundPoint(pos, VISUALRANGE_LOOKOUTTOWER, player); + world->makeVisibleAroundPoint(pos, VISUALRANGE_LOOKOUTTOWER, player); // Und Post versenden - SendPostMessage(player, + sendPostMessage(player, std::make_unique(getEvMgr().getCurrentGF(), _("Lookout-tower occupied"), PostCategory::Military, *workplace)); } -bool nofScout_LookoutTower::AreWaresAvailable() const +bool nofScout_LookoutTower::areWaresAvailable() const { // We never work! return false; diff --git a/libs/s25main/figures/nofScout_LookoutTower.h b/libs/s25main/figures/nofScout_LookoutTower.h index 9287d8f50a..7f3f6483c8 100644 --- a/libs/s25main/figures/nofScout_LookoutTower.h +++ b/libs/s25main/figures/nofScout_LookoutTower.h @@ -14,17 +14,17 @@ class nofScout_LookoutTower : public nofBuildingWorker { protected: /// Funktionen, die nur von der Basisklasse (noFigure) aufgerufen werden, wenn man gelaufen ist - void WalkedDerived() override; + void walkedDerived() override; /// Malt den Arbeiter beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override { return 0; } /// Arbeit musste wegen Arbeitsplatzverlust abgebrochen werden - void WorkAborted() override; + void workAborted() override; /// Arbeitsplatz wurde erreicht - void WorkplaceReached() override; + void workplaceReached() override; - bool AreWaresAvailable() const override; + bool areWaresAvailable() const override; public: nofScout_LookoutTower(MapPoint pos, unsigned char player, nobUsual* workplace); @@ -32,5 +32,5 @@ class nofScout_LookoutTower : public nofBuildingWorker GO_Type getGOT() const final { return GO_Type::NofScoutLookouttower; } - void HandleDerivedEvent(unsigned id) override; + void handleDerivedEvent(unsigned id) override; }; diff --git a/libs/s25main/figures/nofShipWright.cpp b/libs/s25main/figures/nofShipWright.cpp index ec1c6da7e5..15b210b9ef 100644 --- a/libs/s25main/figures/nofShipWright.cpp +++ b/libs/s25main/figures/nofShipWright.cpp @@ -19,7 +19,7 @@ #include "s25util/colors.h" nofShipWright::nofShipWright(const MapPoint pos, const unsigned char player, nobUsual* workplace) - : nofWorkman(Job::Shipwright, pos, player, workplace), curShipBuildPos(MapPoint::Invalid()) + : nofWorkman(Job::Shipwright, pos, player, workplace), curShipBuildPos(MapPoint::invalid()) { RTTR_Assert(!workplace || dynamic_cast(workplace)); } @@ -39,7 +39,7 @@ struct IsNotReserved }; } // namespace -void nofShipWright::HandleDerivedEvent(const unsigned /*id*/) +void nofShipWright::handleDerivedEvent(const unsigned /*id*/) { switch(state) { @@ -48,7 +48,7 @@ void nofShipWright::HandleDerivedEvent(const unsigned /*id*/) // Herausfinden, was der Schiffsbauer als nächstes bauen soll if(static_cast(workplace)->getMode() == nobShipYard::Mode::Boats) // in Handwerksmanier Boote herstellen - nofWorkman::HandleStateWaiting1(); + nofWorkman::handleStateWaiting1(); else { // Wege müssen immer von der Flagge aus berechnet werden @@ -71,7 +71,7 @@ void nofShipWright::HandleDerivedEvent(const unsigned /*id*/) if(obj->getGOT() == GO_Type::Shipbuildingsite && static_cast(obj)->getPlayer() == player) { - if(world->FindHumanPath(flagPos, pt, SHIPWRIGHT_WALKING_DISTANCE)) + if(world->findHumanPath(flagPos, pt, SHIPWRIGHT_WALKING_DISTANCE)) available_points.push_back(pt); } } @@ -82,7 +82,7 @@ void nofShipWright::HandleDerivedEvent(const unsigned /*id*/) for(const auto& pt : possiblePts) { // Dieser Punkt geeignet? - if(isPointGood(pt) && world->FindHumanPath(flagPos, pt, SHIPWRIGHT_WALKING_DISTANCE)) + if(isPointGood(pt) && world->findHumanPath(flagPos, pt, SHIPWRIGHT_WALKING_DISTANCE)) available_points.push_back(pt); } } @@ -92,13 +92,13 @@ void nofShipWright::HandleDerivedEvent(const unsigned /*id*/) { // Einen Punkt zufällig auswählen und dorthin laufen curShipBuildPos = RANDOM_ELEMENT(available_points); - StartWalkingToShip(); + startWalkingToShip(); } else { // Nichts zu arbeiten gefunden - workplace->StartNotWorking(); + workplace->startNotWorking(); // Weiter warten, vielleicht gibts ja später wieder mal was - current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); + current_ev = getEvMgr().addEvent(this, JOB_CONSTS[job_].wait1_length, 1); } } } @@ -109,15 +109,15 @@ void nofShipWright::HandleDerivedEvent(const unsigned /*id*/) // ansonsten sind wir an unserem Schiff und bauen große Schiffe if(workplace->getPos() == pos) // Boote bauen - nofWorkman::HandleStateWork(); + nofWorkman::handleStateWork(); else { // fertig mit Arbeiten --> dann müssen die "Folgen des Arbeitens" ausgeführt werden - WorkFinished(); + workFinished(); // Objekt wieder freigeben world->setReserved(pos, false); // Wieder nach Hause gehen - StartWalkingHome(); + startWalkingHome(); // Evtl. Sounds löschen if(was_sounding) @@ -131,7 +131,7 @@ void nofShipWright::HandleDerivedEvent(const unsigned /*id*/) case State::Waiting2: { // Hier ist die Sache klar, dieser State kann nur bei Handwerkern vorkommen - nofWorkman::HandleStateWaiting2(); + nofWorkman::handleStateWaiting2(); } break; default: break; @@ -139,7 +139,7 @@ void nofShipWright::HandleDerivedEvent(const unsigned /*id*/) } nofShipWright::nofShipWright(SerializedGameData& sgd, const unsigned obj_id) - : nofWorkman(sgd, obj_id), curShipBuildPos(sgd.PopMapPoint()) + : nofWorkman(sgd, obj_id), curShipBuildPos(sgd.popMapPoint()) {} void nofShipWright::Serialize(SerializedGameData& sgd) const @@ -150,19 +150,19 @@ void nofShipWright::Serialize(SerializedGameData& sgd) const } /// Startet das Laufen zu der Arbeitsstelle, dem Schiff -void nofShipWright::StartWalkingToShip() +void nofShipWright::startWalkingToShip() { state = State::WalkToWorkpoint; // Wir arbeiten jetzt workplace->is_working = true; // Waren verbrauchen - workplace->ConsumeWares(); + workplace->consumeWares(); // Punkt für uns reservieren world->setReserved(curShipBuildPos, true); // Anfangen zu laufen (erstmal aus dem Haus raus!) - StartWalking(Direction::SouthEast); + startWalking(Direction::SouthEast); - workplace->StopNotWorking(); + workplace->stopNotWorking(); } /// Ist ein bestimmter Punkt auf der Karte für den Schiffsbau geeignet @@ -182,66 +182,66 @@ bool nofShipWright::isPointGood(const MapPoint pt) const || world->getNO(pt)->getType() == NodalObjectType::Nothing)); } -void nofShipWright::WalkToWorkpoint() +void nofShipWright::walkToWorkpoint() { // Sind wir am Ziel angekommen? if(pos == curShipBuildPos) { // Anfangen zu arbeiten state = State::Work; - current_ev = getEvMgr().AddEvent(this, WORKING_TIME_SHIPS, 1); + current_ev = getEvMgr().addEvent(this, WORKING_TIME_SHIPS, 1); return; } - const auto dir = world->FindHumanPath(pos, curShipBuildPos, 20); + const auto dir = world->findHumanPath(pos, curShipBuildPos, 20); // Weg suchen und gucken ob der Punkt noch in Ordnung ist if(!dir || (!isPointGood(curShipBuildPos) && world->getGOT(curShipBuildPos) != GO_Type::Shipbuildingsite)) { // Punkt freigeben world->setReserved(curShipBuildPos, false); // Kein Weg führt mehr zum Ziel oder Punkt ist nich mehr in Ordnung --> wieder nach Hause gehen - StartWalkingHome(); + startWalkingHome(); } else { // All good, let's start walking there - StartWalking(*dir); + startWalking(*dir); } } -void nofShipWright::StartWalkingHome() +void nofShipWright::startWalkingHome() { state = State::WalkingHome; // Fahne vor dem Gebäude anpeilen curShipBuildPos = world->getNeighbour(workplace->getPos(), Direction::SouthEast); // Zu Laufen anfangen - WalkHome(); + walkHome(); } -void nofShipWright::WalkHome() +void nofShipWright::walkHome() { // Sind wir zu Hause angekommen? (genauer an der Flagge !!) if(pos == curShipBuildPos) { // Weiteres übernimmt nofBuildingWorker - WorkingReady(); + workingReady(); return; } - const auto dir = world->FindHumanPath(pos, curShipBuildPos, SHIPWRIGHT_WALKING_DISTANCE); + const auto dir = world->findHumanPath(pos, curShipBuildPos, SHIPWRIGHT_WALKING_DISTANCE); // Weg suchen und ob wir überhaupt noch nach Hause kommen if(dir) { // All good, let's start walking there - StartWalking(*dir); + startWalking(*dir); } else { // Kein Weg führt mehr nach Hause--> Rumirren - AbrogateWorkplace(); - StartWandering(); - Wander(); + abrogateWorkplace(); + startWandering(); + wander(); } } -void nofShipWright::WorkAborted() +void nofShipWright::workAborted() { // Platz freigeben, falls man gerade arbeitet if((state == State::Work && workplace->getPos() != pos) @@ -250,7 +250,7 @@ void nofShipWright::WorkAborted() } /// Der Schiffsbauer hat einen Bauschritt bewältigt und geht wieder zurück zum Haus -void nofShipWright::WorkFinished() +void nofShipWright::workFinished() { // Befindet sich an dieser Stelle schon ein Schiff oder müssen wir es erst noch hinsetzen? if(world->getGOT(pos) != GO_Type::Shipbuildingsite) @@ -263,25 +263,25 @@ void nofShipWright::WorkFinished() // Mittlerweile wurde anderes Objekt hierhin gesetzt --> können kein Schiff mehr bauen return; - world->DestroyNO(pos); + world->destroyNO(pos); } // Baustelle setzen world->setNO(pos, new noShipBuildingSite(pos, player)); // Bauplätze drumrum neu berechnen - world->RecalcBQAroundPointBig(pos); + world->recalcBQAroundPointBig(pos); } // Schiff weiterbauen - world->getSpecObj(pos)->MakeBuildStep(); + world->getSpecObj(pos)->makeBuildStep(); } -void nofShipWright::WalkedDerived() +void nofShipWright::walkedDerived() { switch(state) { - case State::WalkToWorkpoint: WalkToWorkpoint(); break; - case State::WalkingHome: WalkHome(); break; + case State::WalkToWorkpoint: walkToWorkpoint(); break; + case State::WalkingHome: walkHome(); break; default: break; } } @@ -290,7 +290,7 @@ const std::array ANIMATION = {299, 300, 301, 302, 299, 300, 301, 3 304, 304, 305, 305, 306, 306, 307, 307, 299, 300, 301, 302, 299, 300, 301, 302, 308, 309, 310, 311, 312, 313, 308, 309, 310, 311, 312, 313}; -void nofShipWright::DrawWorking(DrawPoint drawPt) +void nofShipWright::drawWorking(DrawPoint drawPt) { // Nicht mich zeichnen wenn ich im Haus arbeite if(this->pos == workplace->getPos()) @@ -301,10 +301,10 @@ void nofShipWright::DrawWorking(DrawPoint drawPt) default: break; case State::Work: { - unsigned id = GAMECLIENT.Interpolate(42, current_ev); + unsigned id = GAMECLIENT.interpolate(42, current_ev); unsigned graphics_id = ANIMATION[id]; LOADER.getPlayerImage("rom_bobs", graphics_id) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); // Steh-Hammer-Sound if(graphics_id == 300) @@ -322,14 +322,14 @@ void nofShipWright::DrawWorking(DrawPoint drawPt) } /// Zeichnen der Figur in sonstigen Arbeitslagen -void nofShipWright::DrawOtherStates(DrawPoint drawPt) +void nofShipWright::drawOtherStates(DrawPoint drawPt) { switch(state) { case State::WalkToWorkpoint: { // Schiffsbauer mit Brett zeichnen - DrawWalking(drawPt, LOADER.getBob("jobs"), 92, false); + drawWalking(drawPt, LOADER.getBob("jobs"), 92, false); } break; default: return; diff --git a/libs/s25main/figures/nofShipWright.h b/libs/s25main/figures/nofShipWright.h index 9dcf06f2a0..5b68482b49 100644 --- a/libs/s25main/figures/nofShipWright.h +++ b/libs/s25main/figures/nofShipWright.h @@ -16,34 +16,34 @@ class nofShipWright : public nofWorkman private: /// Zeichnet ihn beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override { return 90; } /// Der Arbeiter erzeugt eine Ware - helpers::OptionalEnum ProduceWare() override { return GoodType::Boat; } + helpers::OptionalEnum produceWare() override { return GoodType::Boat; } /// Startet das Laufen zu der Arbeitsstelle, dem Schiff - void StartWalkingToShip(); + void startWalkingToShip(); /// Ist ein bestimmter Punkt auf der Karte für den Schiffsbau geeignet bool isPointGood(MapPoint pt) const; /// Der Schiffsbauer hat einen Bauschritt bewältigt und geht wieder zurück zum Haus - void WorkFinished() override; + void workFinished() override; - void WalkToWorkpoint(); - void StartWalkingHome(); - void WalkHome(); - void WorkAborted() override; - void WalkedDerived() override; + void walkToWorkpoint(); + void startWalkingHome(); + void walkHome(); + void workAborted() override; + void walkedDerived() override; /// Zeichnen der Figur in sonstigen Arbeitslagen - void DrawOtherStates(DrawPoint drawPt) override; + void drawOtherStates(DrawPoint drawPt) override; public: nofShipWright(MapPoint pos, unsigned char player, nobUsual* workplace); nofShipWright(SerializedGameData& sgd, unsigned obj_id); GO_Type getGOT() const final { return GO_Type::NofShipwright; } - void HandleDerivedEvent(unsigned id) override; + void handleDerivedEvent(unsigned id) override; void Serialize(SerializedGameData& sgd) const override; }; diff --git a/libs/s25main/figures/nofSkinner.cpp b/libs/s25main/figures/nofSkinner.cpp index 56e5248f31..569ed30e1e 100644 --- a/libs/s25main/figures/nofSkinner.cpp +++ b/libs/s25main/figures/nofSkinner.cpp @@ -31,7 +31,7 @@ nofSkinner::nofSkinner(const MapPoint pos, const unsigned char player, nobUsual* nofSkinner::nofSkinner(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id) { if(state != State::FigureWork && state != State::Waiting1) - animal = sgd.PopObject(GO_Type::Animal); + animal = sgd.popObject(GO_Type::Animal); else animal = nullptr; } @@ -41,30 +41,30 @@ void nofSkinner::Serialize(SerializedGameData& sgd) const nofBuildingWorker::Serialize(sgd); if(state != State::FigureWork && state != State::Waiting1) - sgd.PushObject(animal, true); + sgd.pushObject(animal, true); } -void nofSkinner::WorkAborted() +void nofSkinner::workAborted() { if(animal) { - animal->StopSkinning(); + animal->stopSkinning(); animal = nullptr; } } -void nofSkinner::AnimalLost() +void nofSkinner::animalLost() { animal = nullptr; switch(state) { default: return; - case State::SkinnerWalkingToCarcass: StartWalkingHome(); break; + case State::SkinnerWalkingToCarcass: startWalkingHome(); break; case State::SkinnerSkinningCarcass: // Remove Working-Event - getEvMgr().RemoveEvent(current_ev); - StartWalkingHome(); + getEvMgr().removeEvent(current_ev); + startWalkingHome(); break; } } @@ -83,24 +83,24 @@ unsigned short nofSkinner::getCarryID() const # pragma warning(pop) #endif -void nofSkinner::DrawWalkingWithWare(DrawPoint drawPt) +void nofSkinner::drawWalkingWithWare(DrawPoint drawPt) { - DrawWalking(drawPt, "leather_bobs", bobIndex[BobType::SkinnerCarryingSkins]); + drawWalking(drawPt, "leather_bobs", bobIndex[BobType::SkinnerCarryingSkins]); } -void nofSkinner::HandleDerivedEvent(unsigned) +void nofSkinner::handleDerivedEvent(unsigned) { switch(state) { - case State::Waiting1: TryStartSkinning(); break; - case State::Work: HandleStateWork(); break; - case State::Waiting2: HandleStateWaiting2(); break; - case State::SkinnerSkinningCarcass: HandleStateSkinningCarcass(); break; + case State::Waiting1: tryStartSkinning(); break; + case State::Work: handleStateWork(); break; + case State::Waiting2: handleStateWaiting2(); break; + case State::SkinnerSkinningCarcass: handleStateSkinningCarcass(); break; default: break; } } -void nofSkinner::DrawWorking(DrawPoint drawPt) +void nofSkinner::drawWorking(DrawPoint drawPt) { const GamePlayer& owner = world->getPlayer(player); switch(state) @@ -108,7 +108,7 @@ void nofSkinner::DrawWorking(DrawPoint drawPt) default: break; case State::SkinnerSkinningCarcass: { - unsigned short id = GAMECLIENT.Interpolate(45, current_ev); + unsigned short id = GAMECLIENT.interpolate(45, current_ev); unsigned short draw_id = leatheraddon::bobIndex[leatheraddon::BobType::SkinnerSkinningAnimalCarcassAnimation]; @@ -125,68 +125,68 @@ void nofSkinner::DrawWorking(DrawPoint drawPt) } } -void nofSkinner::HandleStateSkinningCarcass() +void nofSkinner::handleStateSkinningCarcass() { // see comment at noAnimal::HandleEvent for explanation of ownership of animal - animal->Skinned(); + animal->skinned(); if(!animal->isHunted()) { // Tier verschwinden lassen auto ownedAnimal = world->RemoveFigure(pos, *animal); // Tier vernichten - ownedAnimal->Destroy(); + ownedAnimal->destroy(); } animal = nullptr; - ware = ProduceWare(); - StartWalkingHome(); + ware = produceWare(); + startWalkingHome(); } -void nofSkinner::StartWalkingHome() +void nofSkinner::startWalkingHome() { - WorkAborted(); + workAborted(); state = State::WalkingHome; // We may be still walking in which case we delay finding a path home until we reached the next node if(!isMoving()) - HandleStateWalkingHome(); + handleStateWalkingHome(); } -void nofSkinner::HandleStateWalkingHome() +void nofSkinner::handleStateWalkingHome() { // We reached our home? (exactly at the flag !!) MapPoint homeFlagPos = world->getNeighbour(workplace->getPos(), Direction::SouthEast); if(pos == homeFlagPos) { // Redirect to nofBuildingWorker - WorkingReady(); + workingReady(); return; } // Search for way if we can go home (add tolerance to avoid dying, if he walked some fields to far away) - const auto dir = world->FindHumanPath(pos, homeFlagPos, MAX_SKINNING_DISTANCE + MAX_SKINNING_DISTANCE / 4); + const auto dir = world->findHumanPath(pos, homeFlagPos, MAX_SKINNING_DISTANCE + MAX_SKINNING_DISTANCE / 4); if(dir) - StartWalking(*dir); + startWalking(*dir); else { // no way to home - AbrogateWorkplace(); - StartWandering(); - Wander(); + abrogateWorkplace(); + startWandering(); + wander(); } } -void nofSkinner::TryStartSkinning() +void nofSkinner::tryStartSkinning() { if(workplace->isProductionDisabled()) { - current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); - workplace->StartNotWorking(); + current_ev = getEvMgr().addEvent(this, JOB_CONSTS[job_].wait1_length, 1); + workplace->startNotWorking(); return; } // pigs have higher priority then going skinning dead animals - if(AreWaresAvailable()) - HandleStateWaiting1(); + if(areWaresAvailable()) + handleStateWaiting1(); else { const auto available_animals = nofHunter::getAnimalsInRange( @@ -197,30 +197,30 @@ void nofSkinner::TryStartSkinning() animal = RANDOM_ELEMENT(available_animals); state = State::SkinnerWalkingToCarcass; workplace->is_working = true; - animal->BeginSkinning(this); - StartWalking(Direction::SouthEast); - workplace->StopNotWorking(); + animal->beginSkinning(this); + startWalking(Direction::SouthEast); + workplace->stopNotWorking(); } else { - current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); - workplace->StartNotWorking(); + current_ev = getEvMgr().addEvent(this, JOB_CONSTS[job_].wait1_length, 1); + workplace->startNotWorking(); } } } -void nofSkinner::TryToWork() +void nofSkinner::tryToWork() { - if(AreWaresAvailable()) - nofBuildingWorker::TryToWork(); + if(areWaresAvailable()) + nofBuildingWorker::tryToWork(); else { state = State::Waiting1; - current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].wait1_length, 1); - workplace->StartNotWorking(); + current_ev = getEvMgr().addEvent(this, JOB_CONSTS[job_].wait1_length, 1); + workplace->startNotWorking(); } } -void nofSkinner::WalkedDerived() +void nofSkinner::walkedDerived() { switch(state) { @@ -230,25 +230,25 @@ void nofSkinner::WalkedDerived() if(pos == animal->getPos()) { state = State::SkinnerSkinningCarcass; - current_ev = getEvMgr().AddEvent(this, 80, 1); + current_ev = getEvMgr().addEvent(this, 80, 1); } else { - const auto dir = world->FindHumanPath(pos, animal->getPos(), MAX_SKINNING_DISTANCE); + const auto dir = world->findHumanPath(pos, animal->getPos(), MAX_SKINNING_DISTANCE); if(dir) - StartWalking(*dir); + startWalking(*dir); else { // no way --> go home - StartWalkingHome(); + startWalkingHome(); } } break; } - case State::WalkingHome: HandleStateWalkingHome(); break; + case State::WalkingHome: handleStateWalkingHome(); break; } } -helpers::OptionalEnum nofSkinner::ProduceWare() +helpers::OptionalEnum nofSkinner::produceWare() { return GoodType::Skins; } diff --git a/libs/s25main/figures/nofSkinner.h b/libs/s25main/figures/nofSkinner.h index 8478c0c603..fdefdc80cc 100644 --- a/libs/s25main/figures/nofSkinner.h +++ b/libs/s25main/figures/nofSkinner.h @@ -16,22 +16,22 @@ class nofSkinner : public nofWorkman noAnimal* animal = nullptr; /// Draw worker at work - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware [[noreturn]] unsigned short getCarryID() const override; - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; /// Draws the figure while returning home / entering the building (often carrying wares) - void DrawWalkingWithWare(DrawPoint drawPt) override; + void drawWalkingWithWare(DrawPoint drawPt) override; - void HandleDerivedEvent(unsigned id) override; - void TryToWork() override; - void WalkedDerived() override; + void handleDerivedEvent(unsigned id) override; + void tryToWork() override; + void walkedDerived() override; - void TryStartSkinning(); - void HandleStateSkinningCarcass(); - void StartWalkingHome(); - void HandleStateWalkingHome(); + void tryStartSkinning(); + void handleStateSkinningCarcass(); + void startWalkingHome(); + void handleStateWalkingHome(); public: nofSkinner(MapPoint pos, unsigned char player, nobUsual* workplace); @@ -41,6 +41,6 @@ class nofSkinner : public nofWorkman GO_Type getGOT() const final { return GO_Type::NofSkinner; } - void WorkAborted() override; - void AnimalLost(); + void workAborted() override; + void animalLost(); }; diff --git a/libs/s25main/figures/nofSoldier.cpp b/libs/s25main/figures/nofSoldier.cpp index 30d2b3f43f..789c2d419a 100644 --- a/libs/s25main/figures/nofSoldier.cpp +++ b/libs/s25main/figures/nofSoldier.cpp @@ -31,7 +31,7 @@ void nofSoldier::Serialize(SerializedGameData& sgd) const noFigure::Serialize(sgd); if(fs != FigureState::Wander && fs != FigureState::GoHome) - sgd.PushObject(homeBld); + sgd.pushObject(homeBld); sgd.PushUnsignedChar(hitpoints); } @@ -41,26 +41,26 @@ nofSoldier::nofSoldier(SerializedGameData& sgd, const unsigned obj_id) : noFigur RTTR_Assert(IsSoldier()); if(fs != FigureState::Wander && fs != FigureState::GoHome) - homeBld = sgd.PopObject(); + homeBld = sgd.popObject(); else homeBld = nullptr; hitpoints = sgd.PopUnsignedChar(); } -void nofSoldier::DrawSoldierWaiting(DrawPoint drawPt) +void nofSoldier::drawSoldierWaiting(DrawPoint drawPt) { const GamePlayer& owner = world->getPlayer(player); LOADER.getBobSprite(owner.nation, job_, getCurMoveDir(), 2).drawForPlayer(drawPt, owner.color); if(hasArmor_) - this->DrawArmor(drawPt); + this->drawArmor(drawPt); } -void nofSoldier::AbrogateWorkplace() +void nofSoldier::abrogateWorkplace() { if(homeBld) { - homeBld->SoldierLost(this); + homeBld->soldierLost(this); homeBld = nullptr; } } diff --git a/libs/s25main/figures/nofSoldier.h b/libs/s25main/figures/nofSoldier.h index 7289b0256e..7ae9503125 100644 --- a/libs/s25main/figures/nofSoldier.h +++ b/libs/s25main/figures/nofSoldier.h @@ -18,10 +18,10 @@ class nofSoldier : public noFigure uint8_t hitpoints; /// Draw during regular walking - void DrawSoldierWaiting(DrawPoint drawPt); + void drawSoldierWaiting(DrawPoint drawPt); /// Tell workplace (i.e. home bld) that we are not coming back - void AbrogateWorkplace() override; + void abrogateWorkplace() override; explicit nofSoldier(const nofSoldier&) = default; @@ -31,10 +31,10 @@ class nofSoldier : public noFigure nofSoldier(MapPoint pos, unsigned char player, nobBaseMilitary& home, unsigned char rank, bool armor = false); nofSoldier(SerializedGameData& sgd, unsigned obj_id); - void Destroy() override + void destroy() override { RTTR_Assert(!getHomeBld()); - noFigure::Destroy(); + noFigure::destroy(); } void Serialize(SerializedGameData& sgd) const override; diff --git a/libs/s25main/figures/nofStonemason.cpp b/libs/s25main/figures/nofStonemason.cpp index 82d11db13f..f0e3a38176 100644 --- a/libs/s25main/figures/nofStonemason.cpp +++ b/libs/s25main/figures/nofStonemason.cpp @@ -20,13 +20,13 @@ nofStonemason::nofStonemason(const MapPoint pos, const unsigned char player, nob nofStonemason::nofStonemason(SerializedGameData& sgd, const unsigned obj_id) : nofFarmhand(sgd, obj_id) {} /// Malt den Arbeiter beim Arbeiten -void nofStonemason::DrawWorking(DrawPoint drawPt) +void nofStonemason::drawWorking(DrawPoint drawPt) { unsigned now_id; // Stein hauen - LOADER.getPlayerImage("rom_bobs", 40 + (now_id = GAMECLIENT.Interpolate(64, current_ev)) % 8) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + LOADER.getPlayerImage("rom_bobs", 40 + (now_id = GAMECLIENT.interpolate(64, current_ev)) % 8) + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); if(now_id % 8 == 5) { @@ -41,26 +41,26 @@ unsigned short nofStonemason::getCarryID() const } /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) -void nofStonemason::WorkStarted() {} +void nofStonemason::workStarted() {} /// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten -void nofStonemason::WorkFinished() +void nofStonemason::workFinished() { // Stein abhauen (wenn er nur noch ganz klein ist, dann wird er von der Landkarte getilgt) if(world->getSpecObj(pos)->isSmall()) { // Granitklötzchen löschen - world->DestroyNO(pos); + world->destroyNO(pos); // Minimap Bescheid geben (Granitglötzchen muss weg) if(world->getGameInterface()) world->getGameInterface()->GI_UpdateMinimap(pos); // Drumherum BQ neu berechnen, da diese sich ja jetzt hätten ändern können - world->RecalcBQAroundPoint(pos); + world->recalcBQAroundPoint(pos); } else // ansonsten wird er um 1 kleiner - world->getSpecObj(pos)->Hew(); + world->getSpecObj(pos)->hew(); // Stein in die Hand nehmen ware = GoodType::Stones; diff --git a/libs/s25main/figures/nofStonemason.h b/libs/s25main/figures/nofStonemason.h index 359f8be7c2..5554aef3d8 100644 --- a/libs/s25main/figures/nofStonemason.h +++ b/libs/s25main/figures/nofStonemason.h @@ -12,14 +12,14 @@ class nofStonemason : public nofFarmhand { private: /// Malt den Arbeiter beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override; /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) - void WorkStarted() override; + void workStarted() override; /// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten - void WorkFinished() override; + void workFinished() override; /// Returns the quality of this working point or determines if the worker can work here at all PointQuality getPointQuality(MapPoint pt, bool isBeforeWork) const override; diff --git a/libs/s25main/figures/nofTanner.cpp b/libs/s25main/figures/nofTanner.cpp index f6aa4ecbd8..f5074096c7 100644 --- a/libs/s25main/figures/nofTanner.cpp +++ b/libs/s25main/figures/nofTanner.cpp @@ -18,16 +18,16 @@ nofTanner::nofTanner(const MapPoint pos, const unsigned char player, nobUsual* w nofTanner::nofTanner(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id) {} -void nofTanner::DrawWorking(DrawPoint drawPt) +void nofTanner::drawWorking(DrawPoint drawPt) { constexpr helpers::EnumArray offsets = {{{28, -14}, {28, -8}, {-14, -22}, {-5, -25}, {17, -35}}}; - const unsigned now_id = GAMECLIENT.Interpolate(136, current_ev); + const unsigned now_id = GAMECLIENT.interpolate(136, current_ev); LOADER .getPlayerImage("leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::TanneryWorkWindowAnimation] + (now_id) % 8) - ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); + ->drawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); last_id = now_id; } @@ -46,12 +46,12 @@ unsigned short nofTanner::getCarryID() const # pragma warning(pop) #endif -void nofTanner::DrawWalkingWithWare(DrawPoint drawPt) +void nofTanner::drawWalkingWithWare(DrawPoint drawPt) { - DrawWalking(drawPt, "leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::TannerCarryingLeatherInOut]); + drawWalking(drawPt, "leather_bobs", leatheraddon::bobIndex[leatheraddon::BobType::TannerCarryingLeatherInOut]); } -helpers::OptionalEnum nofTanner::ProduceWare() +helpers::OptionalEnum nofTanner::produceWare() { return GoodType::Leather; } diff --git a/libs/s25main/figures/nofTanner.h b/libs/s25main/figures/nofTanner.h index 065492b903..115de092f7 100644 --- a/libs/s25main/figures/nofTanner.h +++ b/libs/s25main/figures/nofTanner.h @@ -12,14 +12,14 @@ class nobUsual; class nofTanner : public nofWorkman { /// Draw worker at work - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware [[noreturn]] unsigned short getCarryID() const override; /// Der Arbeiter erzeugt eine Ware - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; /// Draws the figure while returning home / entering the building (often carrying wares) - void DrawWalkingWithWare(DrawPoint drawPt) override; + void drawWalkingWithWare(DrawPoint drawPt) override; public: nofTanner(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofTempleServant.cpp b/libs/s25main/figures/nofTempleServant.cpp index 87a434a90a..4c96da00d4 100644 --- a/libs/s25main/figures/nofTempleServant.cpp +++ b/libs/s25main/figures/nofTempleServant.cpp @@ -22,30 +22,30 @@ nofTempleServant::nofTempleServant(const MapPoint pos, const unsigned char playe {} nofTempleServant::nofTempleServant(SerializedGameData& sgd, const unsigned obj_id) - : nofWorkman(sgd, obj_id), currentProduction(sgd.Pop()) + : nofWorkman(sgd, obj_id), currentProduction(sgd.pop()) {} void nofTempleServant::Serialize(SerializedGameData& sgd) const { nofWorkman::Serialize(sgd); - sgd.PushEnum(currentProduction); + sgd.pushEnum(currentProduction); } -void nofTempleServant::DrawWorking(DrawPoint drawPt) +void nofTempleServant::drawWorking(DrawPoint drawPt) { constexpr helpers::EnumArray offsets = {{{26, -23}, {17, -40}, {4, 0}, {22, -25}, {20, -45}}}; - const unsigned now_id = GAMECLIENT.Interpolate(82, current_ev); + const unsigned now_id = GAMECLIENT.interpolate(82, current_ev); if(now_id < 11) // servant pours wine into crucible(play once at start) { LOADER.getPlayerImage("wine_bobs", bobIndex[BobTypes::TEMPLE_WORK_WINDOW_START_ANIMATION] + now_id) - ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, + ->drawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); } else if(now_id < 77) // wine and food is burned (loop for duration) { LOADER.getPlayerImage("wine_bobs", bobIndex[BobTypes::TEMPLE_WORK_WINDOW_MAIN_ANIMATION] + (now_id + 1) % 6) - ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, + ->drawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); // Play sound burning @@ -57,7 +57,7 @@ void nofTempleServant::DrawWorking(DrawPoint drawPt) } else // last loop of animation (play once at end) { LOADER.getPlayerImage("wine_bobs", bobIndex[BobTypes::TEMPLE_WORK_WINDOW_END_ANIMATION] + now_id - 77) - ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, + ->drawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); } @@ -78,17 +78,17 @@ unsigned short nofTempleServant::getCarryID() const # pragma warning(pop) #endif -void nofTempleServant::DrawWalkingWithWare(DrawPoint drawPt) +void nofTempleServant::drawWalkingWithWare(DrawPoint drawPt) { std::map goodTypeToTexture{{GoodType::Gold, BobTypes::TEMPLESERVANT_CARRYING_GOLD_IN_OUT}, {GoodType::IronOre, BobTypes::TEMPLESERVANT_CARRYING_IRON_IN_OUT}, {GoodType::Coal, BobTypes::TEMPLESERVANT_CARRYING_COAL_IN_OUT}, {GoodType::Stones, BobTypes::TEMPLESERVANT_CARRYING_STONE_IN_OUT}}; - DrawWalking(drawPt, "wine_bobs", bobIndex[goodTypeToTexture[currentProduction]]); + drawWalking(drawPt, "wine_bobs", bobIndex[goodTypeToTexture[currentProduction]]); } -helpers::OptionalEnum nofTempleServant::ProduceWare() +helpers::OptionalEnum nofTempleServant::produceWare() { const auto productionMode = static_cast(workplace)->getProductionMode(); switch(productionMode) diff --git a/libs/s25main/figures/nofTempleServant.h b/libs/s25main/figures/nofTempleServant.h index 04f8e19260..7c39054a63 100644 --- a/libs/s25main/figures/nofTempleServant.h +++ b/libs/s25main/figures/nofTempleServant.h @@ -12,14 +12,14 @@ class nobUsual; class nofTempleServant : public nofWorkman { /// Draw worker at work - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware [[noreturn]] unsigned short getCarryID() const override; /// The worker produces a ware - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; /// Draws the figure while returning home / entering the building (often carrying wares) - void DrawWalkingWithWare(DrawPoint drawPt) override; + void drawWalkingWithWare(DrawPoint drawPt) override; GoodType currentProduction; diff --git a/libs/s25main/figures/nofTradeDonkey.cpp b/libs/s25main/figures/nofTradeDonkey.cpp index 7e75109194..1b9c8e836e 100644 --- a/libs/s25main/figures/nofTradeDonkey.cpp +++ b/libs/s25main/figures/nofTradeDonkey.cpp @@ -22,13 +22,13 @@ nofTradeDonkey::nofTradeDonkey(const MapPoint pos, const unsigned char player, } nofTradeDonkey::nofTradeDonkey(SerializedGameData& sgd, const unsigned obj_id) - : noFigure(sgd, obj_id), successor(sgd.PopObject(GO_Type::NofTradedonkey)), - gt(sgd.PopOptionalEnum()) + : noFigure(sgd, obj_id), successor(sgd.popObject(GO_Type::NofTradedonkey)), + gt(sgd.popOptionalEnum()) { if(sgd.getGameDataVersion() < 6) { std::vector next_dirs_raw; - sgd.PopContainer(next_dirs_raw); + sgd.popContainer(next_dirs_raw); for(const auto dir : next_dirs_raw) next_dirs.push_back(dir == 0xDD ? TradeDirection::ReachedGoal : TradeDirection(dir)); } else @@ -39,12 +39,12 @@ void nofTradeDonkey::Serialize(SerializedGameData& sgd) const { noFigure::Serialize(sgd); - sgd.PushObject(successor, true); - sgd.PushOptionalEnum(gt); + sgd.pushObject(successor, true); + sgd.pushOptionalEnum(gt); helpers::pushContainer(sgd, next_dirs); } -void nofTradeDonkey::GoalReached() +void nofTradeDonkey::goalReached() { RTTR_Assert(dynamic_cast(world->getNO(pos))); successor = nullptr; @@ -52,26 +52,26 @@ void nofTradeDonkey::GoalReached() GamePlayer& whOwner = world->getPlayer(wh->getPlayer()); if(gt) - wh->AddToInventory(GoodCounts::make(*gt, 1), true); + wh->addToInventory(GoodCounts::make(*gt, 1), true); - whOwner.IncreaseInventoryJob(this->getJobType(), 1); + whOwner.increaseInventoryJob(this->getJobType(), 1); if(hasArmor_) - whOwner.IncreaseInventoryJob(jobEnumToAmoredSoldierEnum(this->getJobType()), 1); - wh->AddFigure(world->RemoveFigure(pos, *this)); + whOwner.increaseInventoryJob(jobEnumToAmoredSoldierEnum(this->getJobType()), 1); + wh->addFigure(world->RemoveFigure(pos, *this)); } -void nofTradeDonkey::Walked() +void nofTradeDonkey::walked() { if(next_dirs.empty()) { cancelTradeCaravane(); - WanderFailedTrade(); + wanderFailedTrade(); return; } TradeDirection nextDir = getNextDir(); if(successor) - successor->AddNextDir(nextDir); + successor->addNextDir(nextDir); // Are we now at the goal? if(nextDir == TradeDirection::ReachedGoal) { @@ -79,26 +79,26 @@ void nofTradeDonkey::Walked() noBase* nob = world->getNO(pos); if(nob->getType() == NodalObjectType::Building && BuildingProperties::isWareHouse(static_cast(nob)->getBuildingType())) - GoalReached(); + goalReached(); else { cancelTradeCaravane(); - WanderFailedTrade(); + wanderFailedTrade(); } } else - StartWalking(toDirection(nextDir)); + startWalking(toDirection(nextDir)); } -void nofTradeDonkey::HandleDerivedEvent(const unsigned /*id*/) {} -void nofTradeDonkey::AbrogateWorkplace() {} +void nofTradeDonkey::handleDerivedEvent(const unsigned /*id*/) {} +void nofTradeDonkey::abrogateWorkplace() {} -void nofTradeDonkey::Draw(DrawPoint drawPt) +void nofTradeDonkey::draw(DrawPoint drawPt) { if(job_ == Job::PackDonkey) { - const unsigned ani_step = CalcWalkAnimationFrame(); + const unsigned ani_step = calcWalkAnimationFrame(); - drawPt += CalcFigurRelative(); + drawPt += calcFigurRelative(); // Läuft normal mit oder ohne Ware @@ -108,13 +108,13 @@ void nofTradeDonkey::Draw(DrawPoint drawPt) if(gt) { // Ware im Korb zeichnen - LOADER.getWareDonkeyTex(*gt)->DrawFull(drawPt + WARE_POS_DONKEY[getCurMoveDir()][ani_step]); + LOADER.getWareDonkeyTex(*gt)->drawFull(drawPt + WARE_POS_DONKEY[getCurMoveDir()][ani_step]); } } else - DrawWalking(drawPt); + drawWalking(drawPt); } -void nofTradeDonkey::LostWork() {} +void nofTradeDonkey::lostWork() {} void nofTradeDonkey::cancelTradeCaravane() { diff --git a/libs/s25main/figures/nofTradeDonkey.h b/libs/s25main/figures/nofTradeDonkey.h index 91fb95321b..e18ca31e4e 100644 --- a/libs/s25main/figures/nofTradeDonkey.h +++ b/libs/s25main/figures/nofTradeDonkey.h @@ -24,10 +24,10 @@ class nofTradeDonkey : public noFigure std::deque next_dirs; private: - void GoalReached() override; - void Walked() override; - void HandleDerivedEvent(unsigned id) override; - void AbrogateWorkplace() override; + void goalReached() override; + void walked() override; + void handleDerivedEvent(unsigned id) override; + void abrogateWorkplace() override; /// Returns next direction TradeDirection getNextDir() @@ -41,23 +41,23 @@ class nofTradeDonkey : public noFigure nofTradeDonkey(MapPoint pos, unsigned char player, const boost_variant2& what); nofTradeDonkey(SerializedGameData& sgd, unsigned obj_id); - void Destroy() override + void destroy() override { RTTR_Assert(!successor); - noFigure::Destroy(); + noFigure::destroy(); } void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofTradedonkey; } - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; /// Wird aufgerufen, wenn die Flagge abgerissen wurde - void LostWork(); + void lostWork(); /// Adds the next direction, this is usually done by the predecessor - void AddNextDir(TradeDirection dir) { next_dirs.push_back(dir); } + void addNextDir(TradeDirection dir) { next_dirs.push_back(dir); } /// Gets the type of ware this donkey is carrying const auto& getCarriedWare() const { return gt; } diff --git a/libs/s25main/figures/nofTradeLeader.cpp b/libs/s25main/figures/nofTradeLeader.cpp index 41ca34b112..204a8ad521 100644 --- a/libs/s25main/figures/nofTradeLeader.cpp +++ b/libs/s25main/figures/nofTradeLeader.cpp @@ -26,8 +26,8 @@ nofTradeLeader::nofTradeLeader(const MapPoint pos, const unsigned char player, T {} nofTradeLeader::nofTradeLeader(SerializedGameData& sgd, const unsigned obj_id) - : noFigure(sgd, obj_id), tr(sgd, *world, player), successor(sgd.PopObject(GO_Type::NofTradedonkey)), - homePos(sgd.PopMapPoint()), goalPos(sgd.PopMapPoint()) + : noFigure(sgd, obj_id), tr(sgd, *world, player), successor(sgd.popObject(GO_Type::NofTradedonkey)), + homePos(sgd.popMapPoint()), goalPos(sgd.popMapPoint()) {} void nofTradeLeader::Serialize(SerializedGameData& sgd) const @@ -36,12 +36,12 @@ void nofTradeLeader::Serialize(SerializedGameData& sgd) const tr.Serialize(sgd); - sgd.PushObject(successor, true); + sgd.pushObject(successor, true); helpers::pushPoint(sgd, homePos); helpers::pushPoint(sgd, goalPos); } -void nofTradeLeader::GoalReached() +void nofTradeLeader::goalReached() { noBase* nob = world->getNO(goalPos); auto* targetWarehouse = checkedCast(nob); @@ -60,18 +60,18 @@ void nofTradeLeader::GoalReached() std::string waresName = _(!goodType ? JOB_NAMES[jobType] : WARE_NAMES[*goodType]); std::string text = str(boost::format(_("Trade caravan with %s %s arrives from player '%s'.")) % amountWares % waresName % owner.name); - SendPostMessage(targetWarehouse->getPlayer(), + sendPostMessage(targetWarehouse->getPlayer(), std::make_unique(getEvMgr().getCurrentGF(), text, PostCategory::Economy, *targetWarehouse)); - successor->AddNextDir(TradeDirection::ReachedGoal); + successor->addNextDir(TradeDirection::ReachedGoal); successor = nullptr; } - world->getPlayer(targetWarehouse->getPlayer()).IncreaseInventoryJob(this->getJobType(), 1); - targetWarehouse->AddFigure(world->RemoveFigure(pos, *this)); + world->getPlayer(targetWarehouse->getPlayer()).increaseInventoryJob(this->getJobType(), 1); + targetWarehouse->addFigure(world->RemoveFigure(pos, *this)); } -void nofTradeLeader::Walked() +void nofTradeLeader::walked() { noBase* nob = world->getNO(goalPos); @@ -79,51 +79,51 @@ void nofTradeLeader::Walked() if(nob->getType() != NodalObjectType::Building || !BuildingProperties::isWareHouse(static_cast(nob)->getBuildingType())) { - if(TryToGoHome()) - Walked(); + if(tryToGoHome()) + walked(); else { cancelTradeCaravane(); - WanderFailedTrade(); + wanderFailedTrade(); } } else if(pos == goalPos) - GoalReached(); + goalReached(); else { RTTR_Assert(pos == tr.getCurPos()); auto next_dir = tr.getNextDir(); if(!next_dir) { - if(TryToGoHome()) - Walked(); + if(tryToGoHome()) + walked(); else { cancelTradeCaravane(); - WanderFailedTrade(); + wanderFailedTrade(); } } else { if(*next_dir == TradeDirection::ReachedGoal) next_dir = TradeDirection(Direction::NorthWest); // Walk into building - StartWalking(toDirection(*next_dir)); + startWalking(toDirection(*next_dir)); if(successor) - successor->AddNextDir(*next_dir); + successor->addNextDir(*next_dir); } } } -void nofTradeLeader::HandleDerivedEvent(const unsigned /*id*/) {} -void nofTradeLeader::AbrogateWorkplace() {} +void nofTradeLeader::handleDerivedEvent(const unsigned /*id*/) {} +void nofTradeLeader::abrogateWorkplace() {} -void nofTradeLeader::Draw(DrawPoint drawPt) +void nofTradeLeader::draw(DrawPoint drawPt) { - DrawWalkingBobJobs(drawPt, Job::Scout); + drawWalkingBobJobs(drawPt, Job::Scout); } -void nofTradeLeader::LostWork() {} +void nofTradeLeader::lostWork() {} /// Tries to go to the home ware house, otherwise start wandering -bool nofTradeLeader::TryToGoHome() +bool nofTradeLeader::tryToGoHome() { if(goalPos == homePos) return false; // Already going home @@ -138,7 +138,7 @@ bool nofTradeLeader::TryToGoHome() // Find a way back home MapPoint homeFlagPos = world->getNeighbour(homePos, Direction::SouthEast); - tr.AssignNewGoal(this->getPos(), homeFlagPos); + tr.assignNewGoal(this->getPos(), homeFlagPos); return tr.isValid(); } diff --git a/libs/s25main/figures/nofTradeLeader.h b/libs/s25main/figures/nofTradeLeader.h index 5f952541fc..102725bb4a 100644 --- a/libs/s25main/figures/nofTradeLeader.h +++ b/libs/s25main/figures/nofTradeLeader.h @@ -21,13 +21,13 @@ class nofTradeLeader : public noFigure MapPoint homePos, goalPos; private: - void GoalReached() override; - void Walked() override; - void HandleDerivedEvent(unsigned id) override; - void AbrogateWorkplace() override; + void goalReached() override; + void walked() override; + void handleDerivedEvent(unsigned id) override; + void abrogateWorkplace() override; /// Tries to go to the home ware house and returns whether this is possible - bool TryToGoHome(); + bool tryToGoHome(); /// Inform successor that the caravane is canceled void cancelTradeCaravane(); @@ -36,20 +36,20 @@ class nofTradeLeader : public noFigure nofTradeLeader(SerializedGameData& sgd, unsigned obj_id); nofTradeLeader(const nofTradeLeader&) = delete; - void Destroy() override + void destroy() override { RTTR_Assert(!successor); - noFigure::Destroy(); + noFigure::destroy(); } void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofTradeleader; } - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; /// Wird aufgerufen, wenn die Flagge abgerissen wurde - void LostWork(); + void lostWork(); /// Sets the sucessor in the caravane void setSuccessor(nofTradeDonkey* const successor) { this->successor = successor; } diff --git a/libs/s25main/figures/nofVintner.cpp b/libs/s25main/figures/nofVintner.cpp index e4b11f5238..ac31d63d3c 100644 --- a/libs/s25main/figures/nofVintner.cpp +++ b/libs/s25main/figures/nofVintner.cpp @@ -20,16 +20,16 @@ nofVintner::nofVintner(const MapPoint pos, const unsigned char player, nobUsual* nofVintner::nofVintner(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id) {} -void nofVintner::DrawWorking(DrawPoint drawPt) +void nofVintner::drawWorking(DrawPoint drawPt) { constexpr helpers::EnumArray offsets = {{{13, -22}, {19, 6}, {-14, 16}, {4, -20}, {-19, 12}}}; - unsigned now_id = GAMECLIENT.Interpolate(136, current_ev); + unsigned now_id = GAMECLIENT.interpolate(136, current_ev); if(now_id < 91) { LOADER.getPlayerImage("wine_bobs", bobIndex[BobTypes::VINTNER_WORK_WINDOW] + (now_id) % 8) - ->DrawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, + ->drawFull(drawPt + offsets[workplace->getNation()], COLOR_WHITE, world->getPlayer(workplace->getPlayer()).color); // Play rowing boat sound @@ -57,12 +57,12 @@ unsigned short nofVintner::getCarryID() const # pragma warning(pop) #endif -void nofVintner::DrawWalkingWithWare(DrawPoint drawPt) +void nofVintner::drawWalkingWithWare(DrawPoint drawPt) { - DrawWalking(drawPt, "wine_bobs", bobIndex[BobTypes::VINTNER_CARRYING_WINE_IN_OUT]); + drawWalking(drawPt, "wine_bobs", bobIndex[BobTypes::VINTNER_CARRYING_WINE_IN_OUT]); } -helpers::OptionalEnum nofVintner::ProduceWare() +helpers::OptionalEnum nofVintner::produceWare() { return GoodType::Wine; } diff --git a/libs/s25main/figures/nofVintner.h b/libs/s25main/figures/nofVintner.h index 6836b1f30c..c89edbbd81 100644 --- a/libs/s25main/figures/nofVintner.h +++ b/libs/s25main/figures/nofVintner.h @@ -12,14 +12,14 @@ class nobUsual; class nofVintner : public nofWorkman { /// Draw worker at work - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware [[noreturn]] unsigned short getCarryID() const override; /// Der Arbeiter erzeugt eine Ware - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; /// Draws the figure while returning home / entering the building (often carrying wares) - void DrawWalkingWithWare(DrawPoint drawPt) override; + void drawWalkingWithWare(DrawPoint drawPt) override; public: nofVintner(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofWarehouseWorker.cpp b/libs/s25main/figures/nofWarehouseWorker.cpp index 4a36b1747e..e8e16fb5b5 100644 --- a/libs/s25main/figures/nofWarehouseWorker.cpp +++ b/libs/s25main/figures/nofWarehouseWorker.cpp @@ -19,7 +19,7 @@ nofWarehouseWorker::nofWarehouseWorker(const MapPoint pos, const unsigned char p carried_ware(std::move(ware)), shouldBringWareIn(task), fat((RANDOM_RAND(2)) != 0) { // New figure - world->getPlayer(player).IncreaseInventoryJob(Job::Helper, 1); + world->getPlayer(player).increaseInventoryJob(Job::Helper, 1); /// Set the road to building flag (1-piece) cur_rs = static_cast(getGoal())->getRoute(Direction::NorthWest); @@ -29,35 +29,35 @@ nofWarehouseWorker::nofWarehouseWorker(const MapPoint pos, const unsigned char p nofWarehouseWorker::~nofWarehouseWorker() = default; -void nofWarehouseWorker::Destroy() +void nofWarehouseWorker::destroy() { RTTR_Assert(!carried_ware); // TODO Check if this holds true and remove the LooseWare below - LooseWare(); + looseWare(); } void nofWarehouseWorker::Serialize(SerializedGameData& sgd) const { noFigure::Serialize(sgd); - sgd.PushObject(carried_ware, true); + sgd.pushObject(carried_ware, true); sgd.PushBool(shouldBringWareIn); sgd.PushBool(fat); } nofWarehouseWorker::nofWarehouseWorker(SerializedGameData& sgd, const unsigned obj_id) - : noFigure(sgd, obj_id), carried_ware(sgd.PopObject(GO_Type::Ware)), shouldBringWareIn(sgd.PopBool()), + : noFigure(sgd, obj_id), carried_ware(sgd.popObject(GO_Type::Ware)), shouldBringWareIn(sgd.PopBool()), fat(sgd.PopBool()) {} -void nofWarehouseWorker::Draw(DrawPoint drawPt) +void nofWarehouseWorker::draw(DrawPoint drawPt) { if(carried_ware) - DrawWalkingCarrier(drawPt, carried_ware->type, fat); + drawWalkingCarrier(drawPt, carried_ware->type, fat); else - DrawWalkingCarrier(drawPt, std::nullopt, fat); + drawWalkingCarrier(drawPt, std::nullopt, fat); } -void nofWarehouseWorker::GoalReached() +void nofWarehouseWorker::goalReached() { // When worker is still working, the warehouse (and its flag) exists auto& wh = assertNonNull(world->getSpecObj(world->getNeighbour(pos, Direction::NorthWest))); @@ -71,28 +71,28 @@ void nofWarehouseWorker::GoalReached() // TODO: Remove assert. Was added to verify prior condition RTTR_Assert(carried_ware->getGoal() != carried_ware->getLocation()); - carried_ware->WaitAtFlag(flag); - carried_ware->RecalcRoute(); - flag.AddWare(std::move(carried_ware)); + carried_ware->waitAtFlag(flag); + carried_ware->recalcRoute(); + flag.addWare(std::move(carried_ware)); } else { // Bring back in - carried_ware->Carry(wh); + carried_ware->carry(wh); } } else { // Take ware if any - carried_ware = flag.SelectWare(Direction::NorthWest, false, this); + carried_ware = flag.selectWare(Direction::NorthWest, false, this); if(carried_ware) - carried_ware->Carry(wh); + carried_ware->carry(wh); } // Start walking back - StartWalking(Direction::NorthWest); - InitializeRoadWalking(wh.getRoute(Direction::SouthEast), 0, false); + startWalking(Direction::NorthWest); + initializeRoadWalking(wh.getRoute(Direction::SouthEast), 0, false); } -void nofWarehouseWorker::Walked() +void nofWarehouseWorker::walked() { // Arrived back. Check if we were supposed to bring a ware or carry on out if(!shouldBringWareIn) @@ -111,11 +111,11 @@ void nofWarehouseWorker::Walked() { // TODO: Remove assert. Was added to verify prior condition RTTR_Assert(!carried_ware->getGoal() || carried_ware->getGoal() == carried_ware->getLocation()); - wh->AddWare(std::move(carried_ware)); + wh->addWare(std::move(carried_ware)); } else - wh->AddWaitingWare(std::move(carried_ware)); + wh->addWaitingWare(std::move(carried_ware)); } else - LooseWare(); // Warehouse is missing --> destroy ware + looseWare(); // Warehouse is missing --> destroy ware RTTR_Assert(carried_ware == nullptr); } } else @@ -124,35 +124,35 @@ void nofWarehouseWorker::Walked() { // Add ware to warehouse if it still exists if(world->getNO(pos)->getType() == NodalObjectType::Building) - world->getSpecObj(pos)->AddWare(std::move(carried_ware)); + world->getSpecObj(pos)->addWare(std::move(carried_ware)); else - LooseWare(); // Warehouse is missing --> destroy ware + looseWare(); // Warehouse is missing --> destroy ware RTTR_Assert(carried_ware == nullptr); } } // Remove myself - getEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); - world->getPlayer(player).DecreaseInventoryJob(Job::Helper, 1); + getEvMgr().addToKillList(world->RemoveFigure(pos, *this)); + world->getPlayer(player).decreaseInventoryJob(Job::Helper, 1); } -void nofWarehouseWorker::AbrogateWorkplace() +void nofWarehouseWorker::abrogateWorkplace() { - LooseWare(); - StartWandering(); + looseWare(); + startWandering(); } -void nofWarehouseWorker::LooseWare() +void nofWarehouseWorker::looseWare() { // Destroy carried ware if any if(carried_ware) { - carried_ware->WareLost(player); - carried_ware->Destroy(); + carried_ware->wareLost(player); + carried_ware->destroy(); carried_ware.reset(); } } -void nofWarehouseWorker::HandleDerivedEvent(const unsigned /*id*/) {} +void nofWarehouseWorker::handleDerivedEvent(const unsigned /*id*/) {} -void nofWarehouseWorker::CarryWare(Ware* /*ware*/) {} +void nofWarehouseWorker::carryWare(Ware* /*ware*/) {} diff --git a/libs/s25main/figures/nofWarehouseWorker.h b/libs/s25main/figures/nofWarehouseWorker.h index 2286a57e4b..e762594b92 100644 --- a/libs/s25main/figures/nofWarehouseWorker.h +++ b/libs/s25main/figures/nofWarehouseWorker.h @@ -26,14 +26,14 @@ class nofWarehouseWorker : public noFigure // Bin ich fett? (werde immer mal dünn oder fett, damits nicht immer gleich aussieht, wenn jemand rauskommt) bool fat; - void GoalReached() override; - void Walked() override; + void goalReached() override; + void walked() override; /// wenn man beim Arbeitsplatz "kündigen" soll, man das Laufen zum Ziel unterbrechen muss (warum auch immer) - void AbrogateWorkplace() override; + void abrogateWorkplace() override; - void LooseWare(); + void looseWare(); - void HandleDerivedEvent(unsigned id) override; + void handleDerivedEvent(unsigned id) override; public: nofWarehouseWorker(MapPoint pos, unsigned char player, std::unique_ptr ware, bool task); @@ -42,16 +42,16 @@ class nofWarehouseWorker : public noFigure ~nofWarehouseWorker() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofWarehouseworker; } - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; // Ware nach draußen bringen (von Lagerhaus aus aufgerufen) - void CarryWare(Ware* ware); + void carryWare(Ware* ware); /// Mitglied von nem Lagerhaus(Lagerhausarbeiter, die die Träger-Bestände nicht beeinflussen?) - bool MemberOfWarehouse() const override { return true; } + bool memberOfWarehouse() const override { return true; } }; diff --git a/libs/s25main/figures/nofWellguy.cpp b/libs/s25main/figures/nofWellguy.cpp index 0e0d386bdf..3594c646ee 100644 --- a/libs/s25main/figures/nofWellguy.cpp +++ b/libs/s25main/figures/nofWellguy.cpp @@ -21,7 +21,7 @@ nofWellguy::nofWellguy(const MapPoint pos, const unsigned char player, nobUsual* nofWellguy::nofWellguy(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id) {} -void nofWellguy::DrawWorking(DrawPoint drawPt) +void nofWellguy::drawWorking(DrawPoint drawPt) { constexpr helpers::EnumArray offsets = {{{-20, 17}, {-18, 17}, {-20, 13}, {-20, 15}, {-18, 17}}}; @@ -45,7 +45,7 @@ void nofWellguy::DrawWorking(DrawPoint drawPt) }}; unsigned max_id = 112; - unsigned now_id = GAMECLIENT.Interpolate(max_id, current_ev); + unsigned now_id = GAMECLIENT.interpolate(max_id, current_ev); const Nation wpNation = workplace->getNation(); unsigned plColor = world->getPlayer(player).color; @@ -57,13 +57,13 @@ void nofWellguy::DrawWorking(DrawPoint drawPt) if(now_id < 2) // laufen 1 { if(wpNation == Nation::Romans) - LOADER.building_cache[wpNation][BuildingType::Well].door.DrawFull(drawPt); + LOADER.building_cache[wpNation][BuildingType::Well].door.drawFull(drawPt); LOADER.getCarrierSprite(GoodType::WaterEmpty, false, walkdirection[wpNation][0], now_id % 8) .draw(walkOutPos, COLOR_WHITE, plColor); } else if(now_id < 4) // laufen 2 { if(wpNation == Nation::Romans) - LOADER.building_cache[wpNation][BuildingType::Well].door.DrawFull(drawPt); + LOADER.building_cache[wpNation][BuildingType::Well].door.drawFull(drawPt); LOADER.getCarrierSprite(GoodType::WaterEmpty, false, walkdirection[wpNation][1], now_id % 8) .draw(walkOutPos, COLOR_WHITE, plColor); } else if(now_id < 8) // laufen 3 @@ -73,18 +73,18 @@ void nofWellguy::DrawWorking(DrawPoint drawPt) } else if(now_id < 16) // eimer runter lassen { if(now_id == 8) - LOADER.getPlayerImage("rom_bobs", 346)->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); + LOADER.getPlayerImage("rom_bobs", 346)->drawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); else LOADER.getPlayerImage("rom_bobs", 346 + (now_id % 8) - 1) - ->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); + ->drawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); } else if(now_id < max_id - 16) // kurbeln { LOADER.getPlayerImage("rom_bobs", 330 + (now_id % 8)) - ->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); + ->drawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); } else if(now_id < max_id - 8) // eimer rauf kurbeln { LOADER.getPlayerImage("rom_bobs", 338 + (now_id % 8)) - ->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); + ->drawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor); } else if(now_id < max_id - 4) // laufen 3 { LOADER.getCarrierSprite(GoodType::Water, false, walkdirection[wpNation][3], now_id % 8) @@ -92,13 +92,13 @@ void nofWellguy::DrawWorking(DrawPoint drawPt) } else if(now_id < max_id - 2) // laufen 2 { if(wpNation == Nation::Romans) - LOADER.building_cache[wpNation][BuildingType::Well].door.DrawFull(drawPt); + LOADER.building_cache[wpNation][BuildingType::Well].door.drawFull(drawPt); LOADER.getCarrierSprite(GoodType::Water, false, walkdirection[wpNation][4], now_id % 8) .draw(walkInPos, COLOR_WHITE, plColor); } else // laufen 1 { if(wpNation == Nation::Romans) - LOADER.building_cache[wpNation][BuildingType::Well].door.DrawFull(drawPt); + LOADER.building_cache[wpNation][BuildingType::Well].door.drawFull(drawPt); LOADER.getCarrierSprite(GoodType::Water, false, walkdirection[wpNation][5], now_id % 8) .draw(walkInPos, COLOR_WHITE, plColor); } @@ -110,29 +110,29 @@ void nofWellguy::DrawWorking(DrawPoint drawPt) } } -helpers::OptionalEnum nofWellguy::ProduceWare() +helpers::OptionalEnum nofWellguy::produceWare() { return GoodType::Water; } -bool nofWellguy::AreWaresAvailable() const +bool nofWellguy::areWaresAvailable() const { // Check for water - const bool hasWater = FindPointWithResource(ResourceType::Water).isValid(); + const bool hasWater = findPointWithResource(ResourceType::Water).isValid(); if(!hasWater) - workplace->OnOutOfResources(); + workplace->onOutOfResources(); return hasWater; } -bool nofWellguy::StartWorking() +bool nofWellguy::startWorking() { - MapPoint resPt = FindPointWithResource(ResourceType::Water); + MapPoint resPt = findPointWithResource(ResourceType::Water); if(!resPt.isValid()) { - workplace->OnOutOfResources(); + workplace->onOutOfResources(); return false; } if(world->getGGS().getSelection(AddonId::EXHAUSTIBLE_WATER) == 2) - world->ReduceResource(resPt); - return nofWorkman::StartWorking(); + world->reduceResource(resPt); + return nofWorkman::startWorking(); } diff --git a/libs/s25main/figures/nofWellguy.h b/libs/s25main/figures/nofWellguy.h index 8a48bd92fa..84c6dadbd0 100644 --- a/libs/s25main/figures/nofWellguy.h +++ b/libs/s25main/figures/nofWellguy.h @@ -16,14 +16,14 @@ class nofWellguy : public nofWorkman { protected: /// Zeichnet ihn beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override { return CARRY_ID_CARRIER_OFFSET + rttr::enum_cast(GoodType::Water); } /// Der Arbeiter erzeugt eine Ware - helpers::OptionalEnum ProduceWare() override; + helpers::OptionalEnum produceWare() override; - bool AreWaresAvailable() const override; - bool StartWorking() override; + bool areWaresAvailable() const override; + bool startWorking() override; public: nofWellguy(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofWinegrower.cpp b/libs/s25main/figures/nofWinegrower.cpp index bfe32818f5..da48c46dd1 100644 --- a/libs/s25main/figures/nofWinegrower.cpp +++ b/libs/s25main/figures/nofWinegrower.cpp @@ -33,16 +33,16 @@ void nofWinegrower::Serialize(SerializedGameData& sgd) const sgd.PushBool(harvest); } -void nofWinegrower::DrawWorking(DrawPoint drawPt) +void nofWinegrower::drawWorking(DrawPoint drawPt) { if(harvest) { - const unsigned now_id = GAMECLIENT.Interpolate(44, current_ev); + const unsigned now_id = GAMECLIENT.interpolate(44, current_ev); LOADER.getPlayerImage("wine_bobs", bobIndex[BobTypes::WINEGROWER_PICKING_GRAPES_ANIMATION] + now_id % 4) - ->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + ->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } else { - const unsigned now_id = GAMECLIENT.Interpolate(3 * 16 + 8 * 4, current_ev); + const unsigned now_id = GAMECLIENT.interpolate(3 * 16 + 8 * 4, current_ev); unsigned draw_id; if(now_id < 48) { @@ -57,7 +57,7 @@ void nofWinegrower::DrawWorking(DrawPoint drawPt) } else draw_id = bobIndex[BobTypes::WINEGROWER_PLANTING_ANIMATION] + now_id % 4; - LOADER.getPlayerImage("wine_bobs", draw_id)->DrawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); + LOADER.getPlayerImage("wine_bobs", draw_id)->drawFull(drawPt, COLOR_WHITE, world->getPlayer(player).color); } } @@ -75,14 +75,14 @@ unsigned short nofWinegrower::getCarryID() const # pragma warning(pop) #endif -void nofWinegrower::WorkStarted() +void nofWinegrower::workStarted() { // Inform grapefield to not disappear during harvesting if(harvest) - world->getSpecObj(pos)->BeginHarvesting(); + world->getSpecObj(pos)->beginHarvesting(); } -void nofWinegrower::WorkFinished() +void nofWinegrower::workFinished() { if(harvest) { @@ -93,7 +93,7 @@ void nofWinegrower::WorkFinished() if(nob->getGOT() != GO_Type::Grapefield) return; const unsigned wine_bobs = static_cast(nob)->getHarvestID(); - world->DestroyNO(pos); + world->destroyNO(pos); world->setNO(pos, new noEnvObject(pos, wine_bobs, 7)); // Take harvested grapes into hands @@ -110,7 +110,7 @@ void nofWinegrower::WorkFinished() // Only demolish ornamental objects and signs if(noType == NodalObjectType::Environment || noType == NodalObjectType::Nothing) { - world->DestroyNO(pos, false); + world->destroyNO(pos, false); // place new grapefield world->setNO(pos, new noGrapefield(pos)); } @@ -120,7 +120,7 @@ void nofWinegrower::WorkFinished() } // recompute BQ around - world->RecalcBQAroundPoint(pos); + world->recalcBQAroundPoint(pos); } nofFarmhand::PointQuality nofWinegrower::getPointQuality(const MapPoint pt, const bool isBeforeWork) const @@ -136,7 +136,7 @@ nofFarmhand::PointQuality nofWinegrower::getPointQuality(const MapPoint pt, cons { // Try to "plant" a new grapefield // Still enough wares when starting new work - if(isBeforeWork && !workplace->WaresAvailable()) + if(isBeforeWork && !workplace->waresAvailable()) return PointQuality::NotPossible; // Do not build on road @@ -168,40 +168,40 @@ nofFarmhand::PointQuality nofWinegrower::getPointQuality(const MapPoint pt, cons } } -void nofWinegrower::WorkAborted() +void nofWinegrower::workAborted() { - nofFarmhand::WorkAborted(); + nofFarmhand::workAborted(); // inform the grapefield, so it can wither, when we harvest it if(harvest && state == State::Work) - world->getSpecObj(pos)->AbortHarvesting(); + world->getSpecObj(pos)->abortHarvesting(); } -void nofWinegrower::WalkingStarted() +void nofWinegrower::walkingStarted() { // When walking to a grapefield, harvest it or plant a new one harvest = (world->getNO(dest)->getType() == NodalObjectType::Grapefield); if(!harvest) - workplace->ConsumeWares(); + workplace->consumeWares(); } -void nofWinegrower::DrawWalkingWithWare(DrawPoint drawPt) +void nofWinegrower::drawWalkingWithWare(DrawPoint drawPt) { - DrawWalking(drawPt, "wine_bobs", bobIndex[BobTypes::WINEGROWER_WALKING_WITH_FULL_BASKET]); + drawWalking(drawPt, "wine_bobs", bobIndex[BobTypes::WINEGROWER_WALKING_WITH_FULL_BASKET]); } -void nofWinegrower::DrawOtherStates(DrawPoint drawPt) +void nofWinegrower::drawOtherStates(DrawPoint drawPt) { if(state == State::WalkToWorkpoint) { if(harvest) // Go to harvest grapes - DrawWalking(drawPt, "wine_bobs", bobIndex[BobTypes::WINEGROWER_WALKING_WITH_EMPTY_BASKET]); + drawWalking(drawPt, "wine_bobs", bobIndex[BobTypes::WINEGROWER_WALKING_WITH_EMPTY_BASKET]); else // Draw normal walking - DrawWalking(drawPt); + drawWalking(drawPt); } } -bool nofWinegrower::AreWaresAvailable() const +bool nofWinegrower::areWaresAvailable() const { // wine grower doesn't need wares for harvesting! // -> Wares are considered when calling GetPointQuality! diff --git a/libs/s25main/figures/nofWinegrower.h b/libs/s25main/figures/nofWinegrower.h index 6ad95ed7cf..fef3e8752e 100644 --- a/libs/s25main/figures/nofWinegrower.h +++ b/libs/s25main/figures/nofWinegrower.h @@ -16,16 +16,16 @@ class nofWinegrower : public nofFarmhand private: /// Draw worker at work - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware [[noreturn]] unsigned short getCarryID() const override; /// Inform derived class, when working starts (preparing) - void WorkStarted() override; + void workStarted() override; /// Inform derived class, when work is finished - void WorkFinished() override; + void workFinished() override; /// Inform derived class, when work was aborted - void WorkAborted() override; + void workAborted() override; /// Returns the quality of this working point or determines if the worker can work here at all PointQuality getPointQuality(MapPoint pt, bool isBeforeWork) const override; @@ -33,14 +33,14 @@ class nofWinegrower : public nofFarmhand /// Inform derived class about the start of the whole working process (at the beginning when walking out of the /// house) - void WalkingStarted() override; + void walkingStarted() override; /// Draws the figure while returning home / entering the building (often carrying wares) - void DrawWalkingWithWare(DrawPoint drawPt) override; + void drawWalkingWithWare(DrawPoint drawPt) override; /// Draws the vintner while walking - void DrawOtherStates(DrawPoint drawPt) override; + void drawOtherStates(DrawPoint drawPt) override; - bool AreWaresAvailable() const override; + bool areWaresAvailable() const override; public: nofWinegrower(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofWoodcutter.cpp b/libs/s25main/figures/nofWoodcutter.cpp index 540ec5e1f3..8c518675f3 100644 --- a/libs/s25main/figures/nofWoodcutter.cpp +++ b/libs/s25main/figures/nofWoodcutter.cpp @@ -20,9 +20,9 @@ nofWoodcutter::nofWoodcutter(const MapPoint pos, const unsigned char player, nob nofWoodcutter::nofWoodcutter(SerializedGameData& sgd, const unsigned obj_id) : nofFarmhand(sgd, obj_id) {} /// Malt den Arbeiter beim Arbeiten -void nofWoodcutter::DrawWorking(DrawPoint drawPt) +void nofWoodcutter::drawWorking(DrawPoint drawPt) { - unsigned short nowId = GAMECLIENT.Interpolate(118, current_ev); + unsigned short nowId = GAMECLIENT.interpolate(118, current_ev); if(nowId < 10) { @@ -33,7 +33,7 @@ void nofWoodcutter::DrawWorking(DrawPoint drawPt) { // 2. Hacken LOADER.getPlayerImage("rom_bobs", 24 + (nowId - 10) % 8) - ->DrawFull(drawPt - DrawPoint(9, 0), COLOR_WHITE, world->getPlayer(player).color); + ->drawFull(drawPt - DrawPoint(9, 0), COLOR_WHITE, world->getPlayer(player).color); if((nowId - 10) % 8 == 3) { @@ -45,7 +45,7 @@ void nofWoodcutter::DrawWorking(DrawPoint drawPt) { // 3. Warten bis Baum umfällt LOADER.getPlayerImage("rom_bobs", 24) - ->DrawFull(drawPt - DrawPoint(9, 0), COLOR_WHITE, world->getPlayer(player).color); + ->drawFull(drawPt - DrawPoint(9, 0), COLOR_WHITE, world->getPlayer(player).color); if(nowId == 90) { @@ -71,15 +71,15 @@ unsigned short nofWoodcutter::getCarryID() const } /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) -void nofWoodcutter::WorkStarted() +void nofWoodcutter::workStarted() { RTTR_Assert(world->getSpecObj(dest)->getType() == NodalObjectType::Tree); - world->getSpecObj(dest)->FallSoon(); + world->getSpecObj(dest)->fallSoon(); } /// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten -void nofWoodcutter::WorkFinished() +void nofWoodcutter::workFinished() { // Holz in die Hand nehmen ware = GoodType::Wood; @@ -93,17 +93,17 @@ nofFarmhand::PointQuality nofWoodcutter::getPointQuality(const MapPoint pt, bool const noBase* no = world->getNO(pt); if(no->getType() == NodalObjectType::Tree) { - if(static_cast(no)->isFullyGrown() && static_cast(no)->ProducesWood()) + if(static_cast(no)->isFullyGrown() && static_cast(no)->producesWood()) return PointQuality::Class1; } return PointQuality::NotPossible; } -void nofWoodcutter::WorkAborted() +void nofWoodcutter::workAborted() { - nofFarmhand::WorkAborted(); + nofFarmhand::workAborted(); // Dem Baum Bescheid sagen if(state == State::Work) - world->getSpecObj(pos)->DontFall(); + world->getSpecObj(pos)->dontFall(); } diff --git a/libs/s25main/figures/nofWoodcutter.h b/libs/s25main/figures/nofWoodcutter.h index 1e9ef08e56..f574afd65f 100644 --- a/libs/s25main/figures/nofWoodcutter.h +++ b/libs/s25main/figures/nofWoodcutter.h @@ -12,20 +12,20 @@ class nofWoodcutter : public nofFarmhand { private: /// Malt den Arbeiter beim Arbeiten - void DrawWorking(DrawPoint drawPt) override; + void drawWorking(DrawPoint drawPt) override; /// Id in jobs.bob or carrier.bob when carrying a ware unsigned short getCarryID() const override; /// Abgeleitete Klasse informieren, wenn sie anfängt zu arbeiten (Vorbereitungen) - void WorkStarted() override; + void workStarted() override; /// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten - void WorkFinished() override; + void workFinished() override; /// Returns the quality of this working point or determines if the worker can work here at all PointQuality getPointQuality(MapPoint pt, bool isBeforeWork) const override; /// wird aufgerufen, wenn die Arbeit abgebrochen wird (von nofBuildingWorker aufgerufen) - void WorkAborted() override; + void workAborted() override; public: nofWoodcutter(MapPoint pos, unsigned char player, nobUsual* workplace); diff --git a/libs/s25main/figures/nofWorkman.cpp b/libs/s25main/figures/nofWorkman.cpp index 9e0370a781..1663916cf2 100644 --- a/libs/s25main/figures/nofWorkman.cpp +++ b/libs/s25main/figures/nofWorkman.cpp @@ -15,61 +15,61 @@ nofWorkman::nofWorkman(const Job job, const MapPoint pos, const unsigned char pl nofWorkman::nofWorkman(SerializedGameData& sgd, const unsigned obj_id) : nofBuildingWorker(sgd, obj_id) {} -void nofWorkman::HandleDerivedEvent(const unsigned /*id*/) +void nofWorkman::handleDerivedEvent(const unsigned /*id*/) { switch(state) { - case State::Waiting1: HandleStateWaiting1(); break; - case State::Work: HandleStateWork(); break; - case State::Waiting2: HandleStateWaiting2(); break; + case State::Waiting1: handleStateWaiting1(); break; + case State::Work: handleStateWork(); break; + case State::Waiting2: handleStateWaiting2(); break; default: break; } } -bool nofWorkman::StartWorking() +bool nofWorkman::startWorking() { - current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].work_length, 1); + current_ev = getEvMgr().addEvent(this, JOB_CONSTS[job_].work_length, 1); state = State::Work; workplace->is_working = true; // Waren verbrauchen - workplace->ConsumeWares(); + workplace->consumeWares(); return true; } -void nofWorkman::HandleStateWaiting1() +void nofWorkman::handleStateWaiting1() { current_ev = nullptr; - if(!StartWorking()) + if(!startWorking()) { state = State::WaitingForWaresOrProductionStopped; - workplace->StartNotWorking(); + workplace->startNotWorking(); } } -void nofWorkman::HandleStateWaiting2() +void nofWorkman::handleStateWaiting2() { current_ev = nullptr; // Ware erzeugen... (noch nicht "richtig"!, sondern nur viruell erstmal) - if(!(ware = ProduceWare()).has_value()) + if(!(ware = produceWare()).has_value()) { // Soll keine erzeugt werden --> wieder anfangen zu arbeiten - TryToWork(); + tryToWork(); } else { // und diese raustragen - StartWalking(Direction::SouthEast); + startWalking(Direction::SouthEast); state = State::CarryoutWare; } // abgeleiteten Klassen Bescheid sagen - WorkFinished(); + workFinished(); } -void nofWorkman::HandleStateWork() +void nofWorkman::handleStateWork() { // Nach Arbeiten wird noch ein bisschen gewartet, bevor das Produkt herausgetragen wird // Bei 0 mind. 1 GF - current_ev = getEvMgr().AddEvent(this, JOB_CONSTS[job_].wait2_length ? JOB_CONSTS[job_].wait2_length : 1, 1); + current_ev = getEvMgr().addEvent(this, JOB_CONSTS[job_].wait2_length ? JOB_CONSTS[job_].wait2_length : 1, 1); state = State::Waiting2; // wir arbeiten nicht mehr workplace->is_working = false; @@ -93,7 +93,7 @@ struct NodeHasResource }; } // namespace -MapPoint nofWorkman::FindPointWithResource(ResourceType type) const +MapPoint nofWorkman::findPointWithResource(ResourceType type) const { // Alle Punkte durchgehen, bis man einen findet, wo man graben kann const std::vector pts = @@ -101,5 +101,5 @@ MapPoint nofWorkman::FindPointWithResource(ResourceType type) const if(!pts.empty()) return pts.front(); - return MapPoint::Invalid(); + return MapPoint::invalid(); } diff --git a/libs/s25main/figures/nofWorkman.h b/libs/s25main/figures/nofWorkman.h index 850b7a3808..6269298785 100644 --- a/libs/s25main/figures/nofWorkman.h +++ b/libs/s25main/figures/nofWorkman.h @@ -19,29 +19,29 @@ class nofWorkman : public nofBuildingWorker { private: // Funktionen, die nur von der Basisklasse aufgerufen werden, wenn... - void WalkedDerived() override {} // man gelaufen ist + void walkedDerived() override {} // man gelaufen ist /// Gibt den Warentyp zurück, welche der Arbeiter erzeugen will - virtual helpers::OptionalEnum ProduceWare() = 0; + virtual helpers::OptionalEnum produceWare() = 0; /// Abgeleitete Klasse informieren, wenn man fertig ist mit Arbeiten - virtual void WorkFinished() {} + virtual void workFinished() {} protected: /// Entsprechende Methoden für die Abwicklung der einzelnen Zustände /// Nach erstem Warten, sprich der Arbeiter muss versuchen, neu anfangen zu arbeiten - void HandleStateWaiting1(); - void HandleStateWaiting2(); - void HandleStateWork(); + void handleStateWaiting1(); + void handleStateWaiting2(); + void handleStateWork(); /// Called when the work actually starts. The base implementation changes the state and reduces ware count. /// Subclasses can return false, if work has to be aborted for any reason in which case we enter the wait-for-wares /// state - virtual bool StartWorking(); + virtual bool startWorking(); /// Looks for a point with a given resource on the node - MapPoint FindPointWithResource(ResourceType type) const; + MapPoint findPointWithResource(ResourceType type) const; public: nofWorkman(Job job, MapPoint pos, unsigned char player, nobUsual* workplace); nofWorkman(SerializedGameData& sgd, unsigned obj_id); - void HandleDerivedEvent(unsigned id) override; + void handleDerivedEvent(unsigned id) override; }; diff --git a/libs/s25main/gameData/ApplicationLoader.cpp b/libs/s25main/gameData/ApplicationLoader.cpp index aafce220f8..948a21bc6b 100644 --- a/libs/s25main/gameData/ApplicationLoader.cpp +++ b/libs/s25main/gameData/ApplicationLoader.cpp @@ -17,7 +17,7 @@ ApplicationLoader::~ApplicationLoader() = default; bool ApplicationLoader::load() { loader_.initResourceFolders(); - if(!loader_.LoadFilesAtStart()) + if(!loader_.loadFilesAtStart()) return false; if(!playlistPath_.empty()) { diff --git a/libs/s25main/gameData/GameLoader.cpp b/libs/s25main/gameData/GameLoader.cpp index f79cd1d075..9e13eef2b7 100644 --- a/libs/s25main/gameData/GameLoader.cpp +++ b/libs/s25main/gameData/GameLoader.cpp @@ -76,7 +76,7 @@ bool GameLoader::loadTextures() } const LandscapeDesc& lt = game->world_.getDescription().get(game->world_.GetLandscapeType()); - if(!loader.LoadFilesAtGame(lt.mapGfxPath, lt.isWinter, usedNations, enabledAddons) || !loader.LoadFiles(textures)) + if(!loader.loadFilesAtGame(lt.mapGfxPath, lt.isWinter, usedNations, enabledAddons) || !loader.loadFiles(textures)) return false; loader.fillCaches(); diff --git a/libs/s25main/gameTypes/CompressedData.cpp b/libs/s25main/gameTypes/CompressedData.cpp index 2e43f18e8f..a4b7860430 100644 --- a/libs/s25main/gameTypes/CompressedData.cpp +++ b/libs/s25main/gameTypes/CompressedData.cpp @@ -11,7 +11,7 @@ #include #include -bool CompressedData::DecompressToFile(const boost::filesystem::path& filePath, unsigned* checksum) const +bool CompressedData::decompressToFile(const boost::filesystem::path& filePath, unsigned* checksum) const { boost::nowide::ofstream file(filePath, std::ios::binary); @@ -32,7 +32,7 @@ bool CompressedData::DecompressToFile(const boost::filesystem::path& filePath, u } if(checksum) - *checksum = CalcChecksumOfBuffer(uncompressedData); + *checksum = calcChecksumOfBuffer(uncompressedData); } catch(const std::runtime_error& err) { LOG.write("FATAL ERROR: %1%\n") % err.what(); @@ -42,7 +42,7 @@ bool CompressedData::DecompressToFile(const boost::filesystem::path& filePath, u return true; } -bool CompressedData::CompressFromFile(const boost::filesystem::path& filePath, unsigned* checksum /* = nullptr */) +bool CompressedData::compressFromFile(const boost::filesystem::path& filePath, unsigned* checksum /* = nullptr */) { boost::nowide::ifstream file(filePath, std::ios::binary | std::ios::ate); uncompressedLength = static_cast(file.tellg()); @@ -65,7 +65,7 @@ bool CompressedData::CompressFromFile(const boost::filesystem::path& filePath, u } if(checksum) - *checksum = CalcChecksumOfBuffer(uncompressedData); + *checksum = calcChecksumOfBuffer(uncompressedData); return true; } diff --git a/libs/s25main/gameTypes/CompressedData.h b/libs/s25main/gameTypes/CompressedData.h index 3f2f155629..a8ac43732e 100644 --- a/libs/s25main/gameTypes/CompressedData.h +++ b/libs/s25main/gameTypes/CompressedData.h @@ -12,13 +12,13 @@ struct CompressedData { CompressedData(const unsigned uncompressedLength = 0) : uncompressedLength(uncompressedLength) {} - void Clear() + void clear() { uncompressedLength = 0; data.clear(); } - bool DecompressToFile(const boost::filesystem::path& filePath, unsigned* checksum = nullptr) const; - bool CompressFromFile(const boost::filesystem::path& filePath, unsigned* checksum = nullptr); + bool decompressToFile(const boost::filesystem::path& filePath, unsigned* checksum = nullptr) const; + bool compressFromFile(const boost::filesystem::path& filePath, unsigned* checksum = nullptr); /// Uncompressed length unsigned uncompressedLength; diff --git a/libs/s25main/gameTypes/FoWNode.cpp b/libs/s25main/gameTypes/FoWNode.cpp index 3fbd2bc767..6be2280b8b 100644 --- a/libs/s25main/gameTypes/FoWNode.cpp +++ b/libs/s25main/gameTypes/FoWNode.cpp @@ -15,12 +15,12 @@ FoWNode::FoWNode() : last_update_time(0), visibility(Visibility::Invisible), own void FoWNode::Serialize(SerializedGameData& sgd) const { - sgd.PushEnum(visibility); + sgd.pushEnum(visibility); // Only in FoW can be FoW objects if(visibility == Visibility::FogOfWar) { sgd.PushUnsignedInt(last_update_time); - sgd.PushFOWObject(object.get()); + sgd.pushFOWObject(object.get()); helpers::pushContainer(sgd, roads); sgd.PushUnsignedChar(owner); helpers::pushContainer(sgd, boundary_stones); @@ -29,12 +29,12 @@ void FoWNode::Serialize(SerializedGameData& sgd) const void FoWNode::Deserialize(SerializedGameData& sgd) { - visibility = sgd.Pop(); + visibility = sgd.pop(); // Only in FoW can be FoW objects if(visibility == Visibility::FogOfWar) { last_update_time = sgd.PopUnsignedInt(); - object = sgd.PopFOWObject(); + object = sgd.popFOWObject(); helpers::popContainer(sgd, roads); owner = sgd.PopUnsignedChar(); helpers::popContainer(sgd, boundary_stones); diff --git a/libs/s25main/gameTypes/Inventory.h b/libs/s25main/gameTypes/Inventory.h index 7575fdbac7..12660ec197 100644 --- a/libs/s25main/gameTypes/Inventory.h +++ b/libs/s25main/gameTypes/Inventory.h @@ -27,24 +27,24 @@ struct Inventory : private GoodsAndPeopleCounts /// Sets everything to 0 void clear(); - void Add(const GoodType good, unsigned amount = 1) { goods[good] += amount; } - void Add(const Job job, unsigned amount = 1) { people[job] += amount; } - void Add(const ArmoredSoldier soldier, unsigned amount = 1) + void add(const GoodType good, unsigned amount = 1) { goods[good] += amount; } + void add(const Job job, unsigned amount = 1) { people[job] += amount; } + void add(const ArmoredSoldier soldier, unsigned amount = 1) { armoredSoldiers[soldier] += amount; RTTR_Assert(armoredSoldiers[soldier] <= people[amoredEnumToSoldierEnum(soldier)]); } - void Remove(const GoodType good, unsigned amount = 1) + void remove(const GoodType good, unsigned amount = 1) { RTTR_Assert(goods[good] >= amount); goods[good] -= amount; } - void Remove(const Job job, unsigned amount = 1) + void remove(const Job job, unsigned amount = 1) { RTTR_Assert(people[job] >= amount); people[job] -= amount; } - void Remove(const ArmoredSoldier soldier, unsigned amount = 1) + void remove(const ArmoredSoldier soldier, unsigned amount = 1) { RTTR_Assert(armoredSoldiers[soldier] >= amount); armoredSoldiers[soldier] -= amount; diff --git a/libs/s25main/gameTypes/InventorySetting.h b/libs/s25main/gameTypes/InventorySetting.h index 69a07c0bff..304b2891c9 100644 --- a/libs/s25main/gameTypes/InventorySetting.h +++ b/libs/s25main/gameTypes/InventorySetting.h @@ -17,16 +17,16 @@ enum class EInventorySetting : unsigned struct InventorySetting { constexpr InventorySetting() noexcept = default; - constexpr InventorySetting(const EInventorySetting setting) noexcept : state(MakeBitField(setting)) {} - constexpr explicit InventorySetting(uint8_t state) noexcept : state(state) { MakeValid(); } + constexpr InventorySetting(const EInventorySetting setting) noexcept : state(makeBitField(setting)) {} + constexpr explicit InventorySetting(uint8_t state) noexcept : state(state) { makeValid(); } constexpr bool isSet(EInventorySetting setting) const noexcept; - constexpr InventorySetting Toggle(EInventorySetting setting) noexcept; - constexpr void MakeValid() noexcept; + constexpr InventorySetting toggle(EInventorySetting setting) noexcept; + constexpr void makeValid() noexcept; constexpr explicit operator uint8_t() const noexcept { return state; } friend constexpr bool operator==(const InventorySetting& lhs, const InventorySetting& rhs) noexcept; private: - static constexpr uint8_t MakeBitField(EInventorySetting setting) noexcept; + static constexpr uint8_t makeBitField(EInventorySetting setting) noexcept; // Current state as a bitfield! uint8_t state = 0; }; @@ -37,34 +37,34 @@ struct InventorySetting constexpr bool InventorySetting::isSet(const EInventorySetting setting) const noexcept { - return (state & MakeBitField(setting)) != 0; + return (state & makeBitField(setting)) != 0; } -constexpr InventorySetting InventorySetting::Toggle(const EInventorySetting setting) noexcept +constexpr InventorySetting InventorySetting::toggle(const EInventorySetting setting) noexcept { - state ^= MakeBitField(setting); + state ^= makeBitField(setting); // If we changed collect, then allow only collect to be set // Else clear collect (Collect with anything else makes no sense) if(setting == EInventorySetting::Collect) - state &= MakeBitField(EInventorySetting::Collect); + state &= makeBitField(EInventorySetting::Collect); else - state &= ~MakeBitField(EInventorySetting::Collect); + state &= ~makeBitField(EInventorySetting::Collect); return *this; } -constexpr uint8_t InventorySetting::MakeBitField(const EInventorySetting setting) noexcept +constexpr uint8_t InventorySetting::makeBitField(const EInventorySetting setting) noexcept { return static_cast(1 << static_cast(setting)); } -constexpr void InventorySetting::MakeValid() noexcept +constexpr void InventorySetting::makeValid() noexcept { switch(state) { - case MakeBitField(EInventorySetting::Stop): - case MakeBitField(EInventorySetting::Send): - case MakeBitField(EInventorySetting::Collect): - case static_cast(MakeBitField(EInventorySetting::Stop) | MakeBitField(EInventorySetting::Send)): break; + case makeBitField(EInventorySetting::Stop): + case makeBitField(EInventorySetting::Send): + case makeBitField(EInventorySetting::Collect): + case static_cast(makeBitField(EInventorySetting::Stop) | makeBitField(EInventorySetting::Send)): break; default: state = 0; break; } } diff --git a/libs/s25main/gameTypes/MapInfo.cpp b/libs/s25main/gameTypes/MapInfo.cpp index 6ff70be8a8..107b14da64 100644 --- a/libs/s25main/gameTypes/MapInfo.cpp +++ b/libs/s25main/gameTypes/MapInfo.cpp @@ -13,19 +13,19 @@ static_assert(MAX_FILE_SIZE <= std::numeric_limits::max() / 4u, "Max s MapInfo::MapInfo() { - Clear(); + clear(); } MapInfo::~MapInfo() = default; -void MapInfo::Clear() +void MapInfo::clear() { type = MapType::OldMap; title.clear(); filepath.clear(); luaFilepath.clear(); - mapData.Clear(); - luaData.Clear(); + mapData.clear(); + luaData.clear(); mapChecksum = 0; luaChecksum = 0; savegame.reset(); diff --git a/libs/s25main/gameTypes/MapInfo.h b/libs/s25main/gameTypes/MapInfo.h index 159acaa98e..cd1caddf0f 100644 --- a/libs/s25main/gameTypes/MapInfo.h +++ b/libs/s25main/gameTypes/MapInfo.h @@ -17,7 +17,7 @@ class MapInfo public: MapInfo(); ~MapInfo(); - void Clear(); + void clear(); /// Return true if the currently present data sizes (compressed and uncompressed) are valid (especially fit into /// uint32) diff --git a/libs/s25main/gameTypes/MapNode.cpp b/libs/s25main/gameTypes/MapNode.cpp index 178eb5df19..e0b1ee7b4e 100644 --- a/libs/s25main/gameTypes/MapNode.cpp +++ b/libs/s25main/gameTypes/MapNode.cpp @@ -31,8 +31,8 @@ void MapNode::Serialize(SerializedGameData& sgd, const unsigned numPlayers, cons RTTR_Assert(numPlayers <= fow.size()); for(unsigned z = 0; z < numPlayers; ++z) fow[z].Serialize(sgd); - sgd.PushObject(obj); - sgd.PushObjectContainer(figures); + sgd.pushObject(obj); + sgd.pushObjectContainer(figures); sgd.PushUnsignedShort(seaId.value()); sgd.PushUnsignedInt(harborId.value()); } @@ -66,12 +66,12 @@ void MapNode::Deserialize(SerializedGameData& sgd, const unsigned numPlayers, co owner = sgd.PopUnsignedChar(); helpers::popContainer(sgd, boundary_stones); if(sgd.getGameDataVersion() < 9) - bq = sgd.Pop(); + bq = sgd.pop(); RTTR_Assert(numPlayers <= fow.size()); for(unsigned z = 0; z < numPlayers; ++z) fow[z].Deserialize(sgd); - obj = sgd.PopObject(); - sgd.PopObjectContainer(figures); + obj = sgd.popObject(); + sgd.popObjectContainer(figures); seaId = SeaId(sgd.PopUnsignedShort()); harborId = HarborId(sgd.PopUnsignedInt()); } diff --git a/libs/s25main/gameTypes/VirtualInventory.h b/libs/s25main/gameTypes/VirtualInventory.h index 93fa51268b..6fbd3e4fc7 100644 --- a/libs/s25main/gameTypes/VirtualInventory.h +++ b/libs/s25main/gameTypes/VirtualInventory.h @@ -21,41 +21,41 @@ struct VirtualInventory real.clear(); } /// Adds goods to both inventories - void Add(const GoodType good, unsigned amount = 1) + void add(const GoodType good, unsigned amount = 1) { - visual.Add(good, amount); - real.Add(good, amount); + visual.add(good, amount); + real.add(good, amount); } /// Adds figures to both inventories - void Add(const Job job, unsigned amount = 1) + void add(const Job job, unsigned amount = 1) { - visual.Add(job, amount); - real.Add(job, amount); + visual.add(job, amount); + real.add(job, amount); } /// Adds armored figures to both inventories - void Add(const ArmoredSoldier soldier, unsigned amount = 1) + void add(const ArmoredSoldier soldier, unsigned amount = 1) { - visual.Add(soldier, amount); - real.Add(soldier, amount); + visual.add(soldier, amount); + real.add(soldier, amount); } /// Removes goods from both inventories - void Remove(const GoodType good, unsigned amount = 1) + void remove(const GoodType good, unsigned amount = 1) { - visual.Remove(good, amount); - real.Remove(good, amount); + visual.remove(good, amount); + real.remove(good, amount); } /// Removes jobs from both inventories - void Remove(const Job job, unsigned amount = 1) + void remove(const Job job, unsigned amount = 1) { - visual.Remove(job, amount); - real.Remove(job, amount); + visual.remove(job, amount); + real.remove(job, amount); } /// Removes armored figures from both inventories - void Remove(const ArmoredSoldier soldier, unsigned amount = 1) + void remove(const ArmoredSoldier soldier, unsigned amount = 1) { - visual.Remove(soldier, amount); - real.Remove(soldier, amount); + visual.remove(soldier, amount); + real.remove(soldier, amount); } /// Returns the real number of people of the given type diff --git a/libs/s25main/ingameWindows/IngameWindow.cpp b/libs/s25main/ingameWindows/IngameWindow.cpp index 312c20349f..3ee1c03e58 100644 --- a/libs/s25main/ingameWindows/IngameWindow.cpp +++ b/libs/s25main/ingameWindows/IngameWindow.cpp @@ -50,11 +50,11 @@ IngameWindow::IngameWindow(unsigned id, const DrawPoint& pos, const Extent& size // For compatibility we treat the given height as the window height, not the content height // First we have to make sure the size is not to small - Window::Resize(elMax(contentOffset + contentOffsetEnd, getSize())); + Window::resize(elMax(contentOffset + contentOffsetEnd, getSize())); iwHeight = getSize().y - contentOffset.y - contentOffsetEnd.y; // Save to settings that window is open - SaveOpenStatus(true); + saveOpenStatus(true); if(windowSettings_) { @@ -63,7 +63,7 @@ IngameWindow::IngameWindow(unsigned id, const DrawPoint& pos, const Extent& size { isMinimized_ = true; Extent minimizedSize(getSize().x, contentOffset.y + contentOffsetEnd.y); - Window::Resize(minimizedSize); + Window::resize(minimizedSize); } isPinned_ = windowSettings_->isPinned; // Restore pinned state restorePos_ = windowSettings_->restorePos; // Load restorePos @@ -75,16 +75,16 @@ IngameWindow::IngameWindow(unsigned id, const DrawPoint& pos, const Extent& size if(windowSettings_ && windowSettings_->lastPos.isValid()) setPos(windowSettings_->lastPos, !restorePos_.isValid()); else - MoveToCenter(); + moveToCenter(); } else if(pos == posCenter) - MoveToCenter(); + moveToCenter(); else if(pos == posAtMouse) - MoveNextToMouse(); + moveNextToMouse(); else setPos(pos); // always call SetPos() to update restorePos } -void IngameWindow::Resize(const Extent& newSize) +void IngameWindow::resize(const Extent& newSize) { DrawPoint iSize(newSize); iSize = elMax(DrawPoint(0, 0), iSize - DrawPoint(contentOffset + contentOffsetEnd)); @@ -101,7 +101,7 @@ void IngameWindow::setIwSize(const Extent& newSize) if(isMinimized_) wndSize.y = 0; wndSize += contentOffset + contentOffsetEnd; - Window::Resize(wndSize); + Window::resize(wndSize); // Adjust restorePos if the window was connecting with the bottom screen edge before being minimized const auto pos = (atBottom && isMinimized_) ? DrawPoint(restorePos_.x, DrawPoint::MaxElementValue) : restorePos_; @@ -163,9 +163,9 @@ void IngameWindow::setPos(DrawPoint newPos, bool saveRestorePos) Window::setPos(newPos); } -void IngameWindow::Close() +void IngameWindow::close() { - SaveOpenStatus(false); + saveOpenStatus(false); closeme = true; } @@ -175,7 +175,7 @@ void IngameWindow::setMinimized(bool minimized) if(isMinimized_) fullSize.y = iwHeight + contentOffset.y + contentOffsetEnd.y; this->isMinimized_ = minimized; - Resize(fullSize); + resize(fullSize); // if possible save the minimized state to settings if(windowSettings_) @@ -200,7 +200,7 @@ bool IngameWindow::msgLeftDown(const MouseCoords& mc) buttonStates_[btn] = ButtonState::Pressed; if(btn == IwButton::Title) { - StartDragging(mc.pos); + startDragging(mc.pos); return true; } } @@ -211,7 +211,7 @@ bool IngameWindow::msgLeftDown(const MouseCoords& mc) bool IngameWindow::msgLeftUp(const MouseCoords& mc) { // If we handled the msg event. Don't return yet in case touch dblclick triggered dragging - const bool handled = StopDragging(); + const bool handled = stopDragging(); for(const auto btn : helpers::enumRange()) { @@ -229,12 +229,12 @@ bool IngameWindow::msgLeftUp(const MouseCoords& mc) { switch(btn) { - case IwButton::Close: Close(); return true; + case IwButton::Close: close(); return true; case IwButton::Title: if(SETTINGS.interface.enableWindowPinning && mc.dbl_click) { setMinimized(!isMinimized()); - LOADER.getSoundN("sound", 113)->Play(255, false); + LOADER.getSoundN("sound", 113)->play(255, false); return true; } break; @@ -242,11 +242,11 @@ bool IngameWindow::msgLeftUp(const MouseCoords& mc) if(SETTINGS.interface.enableWindowPinning) { setPinned(!isPinned()); - LOADER.getSoundN("sound", 111)->Play(255, false); + LOADER.getSoundN("sound", 111)->play(255, false); } else { setMinimized(!isMinimized()); - LOADER.getSoundN("sound", 113)->Play(255, false); + LOADER.getSoundN("sound", 113)->play(255, false); } return true; } @@ -256,7 +256,7 @@ bool IngameWindow::msgLeftUp(const MouseCoords& mc) // On touch devices dblclick closes window if(VIDEODRIVER.isTouch() && mc.dbl_click && closeBehavior_ != CloseBehavior::Custom) { - Close(); + close(); return true; } return handled; @@ -264,13 +264,13 @@ bool IngameWindow::msgLeftUp(const MouseCoords& mc) bool IngameWindow::msgMiddleDown(const MouseCoords& mc) { - StartDragging(mc.pos); + startDragging(mc.pos); return true; } bool IngameWindow::msgMiddleUp(const MouseCoords&) { - return StopDragging(); + return stopDragging(); } bool IngameWindow::msgMouseMove(const MouseCoords& mc) @@ -317,12 +317,12 @@ bool IngameWindow::msgMouseMove(const MouseCoords& mc) } } -void IngameWindow::Draw_() +void IngameWindow::drawImpl() { if(isModal_ && !IsActive()) setActive(true); if(!isMinimized_) - DrawBackground(); + drawBackground(); // Black border // TODO: It would be better if this was included in the windows size. But the controls are added with absolute // positions so adding the border to the size would move the border imgs inward into the content. @@ -336,21 +336,21 @@ void IngameWindow::Draw_() const Rect drawRect = getDrawRect(); const Rect fullWndRect(drawRect.getOrigin() - borderSize, drawRect.getSize() + borderSize * 2u); // Top - DrawRectangle(Rect(fullWndRect.getOrigin(), fullWndRect.getSize().x, borderSize.y), COLOR_BLACK); + drawRectangle(Rect(fullWndRect.getOrigin(), fullWndRect.getSize().x, borderSize.y), COLOR_BLACK); // Left - DrawRectangle(Rect(fullWndRect.getOrigin(), borderSize.x, fullWndRect.getSize().y), COLOR_BLACK); + drawRectangle(Rect(fullWndRect.getOrigin(), borderSize.x, fullWndRect.getSize().y), COLOR_BLACK); // Right - DrawRectangle(Rect(fullWndRect.right - borderSize.x, fullWndRect.top, borderSize.x, fullWndRect.getSize().y), + drawRectangle(Rect(fullWndRect.right - borderSize.x, fullWndRect.top, borderSize.x, fullWndRect.getSize().y), COLOR_BLACK); // Bottom - DrawRectangle(Rect(fullWndRect.left, fullWndRect.bottom - borderSize.y, fullWndRect.getSize().x, borderSize.y), + drawRectangle(Rect(fullWndRect.left, fullWndRect.bottom - borderSize.y, fullWndRect.getSize().x, borderSize.y), COLOR_BLACK); // Upper parts glArchivItem_Bitmap* leftUpperImg = LOADER.getImageN("resource", 36); - leftUpperImg->DrawFull(getPos()); + leftUpperImg->drawFull(getPos()); glArchivItem_Bitmap* rightUpperImg = LOADER.getImageN("resource", 37); - rightUpperImg->DrawFull(getPos() + DrawPoint(getSize().x - rightUpperImg->getWidth(), 0)); + rightUpperImg->drawFull(getPos() + DrawPoint(getSize().x - rightUpperImg->getWidth(), 0)); // The buttons using ButtonStateResIds = helpers::EnumArray; @@ -361,20 +361,20 @@ void IngameWindow::Draw_() constexpr ButtonStateResIds unpinOverlayResIds = {18, 19, 20}; if(closeBehavior_ != CloseBehavior::Custom) LOADER.getImageN("resource", closeResIds[buttonStates_[IwButton::Close]]) - ->DrawFull(getButtonBounds(IwButton::Close)); + ->drawFull(getButtonBounds(IwButton::Close)); if(!isModal()) { const auto buttonState = buttonStates_[IwButton::PinOrMinimize]; const auto bounds = getButtonBounds(IwButton::PinOrMinimize); if(SETTINGS.interface.enableWindowPinning) { - LOADER.getImageN("resource", pinBaseResIds[buttonState])->DrawFull(bounds); + LOADER.getImageN("resource", pinBaseResIds[buttonState])->drawFull(bounds); if(isPinned_) - LOADER.getImageN("io_new", unpinOverlayResIds[buttonState])->DrawFull(bounds); + LOADER.getImageN("io_new", unpinOverlayResIds[buttonState])->drawFull(bounds); else - LOADER.getImageN("io_new", pinOverlayResIds[buttonState])->DrawFull(bounds); + LOADER.getImageN("io_new", pinOverlayResIds[buttonState])->drawFull(bounds); } else - LOADER.getImageN("resource", minimizeResIds[buttonState])->DrawFull(bounds); + LOADER.getImageN("resource", minimizeResIds[buttonState])->drawFull(bounds); } // The title bar @@ -391,17 +391,17 @@ void IngameWindow::Draw_() unsigned tileCount = titleWidth / titleImg.getWidth(); for(unsigned i = 0; i < tileCount; ++i) { - titleImg.DrawFull(titleImgPos); + titleImg.drawFull(titleImgPos); titleImgPos.x += titleImg.getWidth(); } // The remaining part (if any) unsigned remainingTileSize = titleWidth % titleImg.getWidth(); if(remainingTileSize) - titleImg.DrawPart(Rect(titleImgPos, remainingTileSize, titleImg.getHeight())); + titleImg.drawPart(Rect(titleImgPos, remainingTileSize, titleImg.getHeight())); // Text on the title bar - NormalFont->Draw(getPos() + DrawPoint(getSize().x, titleImg.getHeight()) / 2, title_, + NormalFont->draw(getPos() + DrawPoint(getSize().x, titleImg.getHeight()) / 2, title_, FontStyle::CENTER | FontStyle::VCENTER, COLOR_YELLOW); glArchivItem_Bitmap* bottomBorderSideImg = LOADER.getImageN("resource", 45); @@ -419,8 +419,8 @@ void IngameWindow::Draw_() DrawPoint rightImgPos = leftImgPos + DrawPoint(getSize().x - leftSideImg->getWidth(), 0); for(unsigned i = 0; i < tileCount; ++i) { - leftSideImg->DrawFull(leftImgPos); - rightSideImg->DrawFull(rightImgPos); + leftSideImg->drawFull(leftImgPos); + rightSideImg->drawFull(rightImgPos); rightImgPos.y = leftImgPos.y += leftSideImg->getHeight(); } @@ -428,8 +428,8 @@ void IngameWindow::Draw_() remainingTileSize = sideHeight % leftSideImg->getHeight(); if(remainingTileSize) { - leftSideImg->DrawPart(Rect(leftImgPos, leftSideImg->getWidth(), remainingTileSize)); - rightSideImg->DrawPart(Rect(rightImgPos, rightSideImg->getWidth(), remainingTileSize)); + leftSideImg->drawPart(Rect(leftImgPos, leftSideImg->getWidth(), remainingTileSize)); + rightSideImg->drawPart(Rect(rightImgPos, rightSideImg->getWidth(), remainingTileSize)); } } @@ -439,38 +439,38 @@ void IngameWindow::Draw_() DrawPoint bottomImgPos = getPos() + DrawPoint(bottomBorderSideImg->getWidth(), getRightBottomBoundary().y); for(unsigned i = 0; i < tileCount; ++i) { - bottomBarImg->DrawFull(bottomImgPos); + bottomBarImg->drawFull(bottomImgPos); bottomImgPos.x += bottomBarImg->getWidth(); } remainingTileSize = bottomBarWidth % bottomBarImg->getWidth(); if(remainingTileSize) - bottomBarImg->DrawPart(Rect(bottomImgPos, remainingTileSize, bottomBarImg->getHeight())); + bottomBarImg->drawPart(Rect(bottomImgPos, remainingTileSize, bottomBarImg->getHeight())); // Client area if(!isMinimized_) { - Window::Draw_(); - DrawContent(); + Window::drawImpl(); + drawContent(); } // The 2 rects on the bottom left and right - bottomBorderSideImg->DrawFull(getPos() + DrawPoint(0, getSize().y - bottomBorderSideImg->getHeight())); - bottomBorderSideImg->DrawFull(getPos() + getSize() - bottomBorderSideImg->getSize()); + bottomBorderSideImg->drawFull(getPos() + DrawPoint(0, getSize().y - bottomBorderSideImg->getHeight())); + bottomBorderSideImg->drawFull(getPos() + getSize() - bottomBorderSideImg->getSize()); } -void IngameWindow::DrawBackground() +void IngameWindow::drawBackground() { if(background) - background->DrawPart(Rect(getPos() + DrawPoint(contentOffset), getIwSize())); + background->drawPart(Rect(getPos() + DrawPoint(contentOffset), getIwSize())); } -void IngameWindow::MoveToCenter() +void IngameWindow::moveToCenter() { setPos(DrawPoint(VIDEODRIVER.getRenderSize() - getSize()) / 2); } -void IngameWindow::MoveNextToMouse() +void IngameWindow::moveNextToMouse() { // Center vertically and move slightly right DrawPoint newPos = VIDEODRIVER.getMousePos() - DrawPoint(-20, getSize().y / 2); @@ -482,7 +482,7 @@ bool IngameWindow::isMessageRelayAllowed() const return !isMinimized_ && !isMoving; } -void IngameWindow::SaveOpenStatus(bool isOpen) const +void IngameWindow::saveOpenStatus(bool isOpen) const { if(windowSettings_) windowSettings_->isOpen = isOpen; @@ -504,14 +504,14 @@ Rect IngameWindow::getButtonBounds(IwButton btn) const return Rect(pos, size); } -void IngameWindow::StartDragging(const Position& pos) +void IngameWindow::startDragging(const Position& pos) { isMoving = true; snapOffset_ = SnapOffset::all(0); lastMousePos = pos; } -bool IngameWindow::StopDragging() +bool IngameWindow::stopDragging() { if(isMoving) { diff --git a/libs/s25main/ingameWindows/IngameWindow.h b/libs/s25main/ingameWindows/IngameWindow.h index d498fa49e7..b254b91ffb 100644 --- a/libs/s25main/ingameWindows/IngameWindow.h +++ b/libs/s25main/ingameWindows/IngameWindow.h @@ -66,7 +66,7 @@ class IngameWindow : public Window /// Get window title const std::string& getTitle() const { return title_; } - void Resize(const Extent& newSize) override; + void resize(const Extent& newSize) override; /// Set the size of the (expanded) content area void setIwSize(const Extent& newSize); /// Get the size of the (expanded) content area @@ -80,9 +80,9 @@ class IngameWindow : public Window void setPos(DrawPoint newPos, bool saveRestorePos = true); /// Queue the window for closing, will be done in next draw cycle - virtual void Close(); + virtual void close(); /// Return if the window will be closes - bool ShouldBeClosed() const { return closeme; } + bool shouldBeClosed() const { return closeme; } /// Minimize window (only title bar and bottom border remains) void setMinimized(bool minimized = true); @@ -106,26 +106,26 @@ class IngameWindow : public Window bool msgMouseMove(const MouseCoords&) override; protected: - void Draw_() final; + void drawImpl() final; /// Called when not minimized before drawing the frame - virtual void DrawBackground(); + virtual void drawBackground(); /// Called when not minimized after the frame and background have been drawn - virtual void DrawContent() {} + virtual void drawContent() {} /// Move window to center of screen - void MoveToCenter(); + void moveToCenter(); /// Move window next to current cursor position - void MoveNextToMouse(); + void moveNextToMouse(); /// Return if events (mouse move...) should be passed to controls of the window bool isMessageRelayAllowed() const override; - void SaveOpenStatus(bool isOpen) const; + void saveOpenStatus(bool isOpen) const; - void StartDragging(const Position& pos); + void startDragging(const Position& pos); // Return true if dragging stopped - bool StopDragging(); + bool stopDragging(); unsigned short iwHeight; std::string title_; diff --git a/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.cpp b/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.cpp index 521ab5d4ef..909af7971f 100644 --- a/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.cpp +++ b/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.cpp @@ -16,18 +16,18 @@ TransmitSettingsIgwAdapter::TransmitSettingsIgwAdapter(unsigned id, const DrawPo { // Timer for transmitting changes every 2 seconds using namespace std::chrono_literals; - AddTimer(firstCtrlID + 1u, 2s); + addTimer(firstCtrlID + 1u, 2s); } -void TransmitSettingsIgwAdapter::Close() +void TransmitSettingsIgwAdapter::close() { - TransmitSettings(); + transmitSettings(); if(!settings_changed) { - IngameWindow::Close(); + IngameWindow::close(); } else { - WINDOWMANAGER.Show(std::make_unique(getTitle(), + WINDOWMANAGER.show(std::make_unique(getTitle(), _("The changes could not be applied and will be discarded. A " "potential reason for this is that the game is paused."), this, MsgboxButton::OkCancel, MsgboxIcon::ExclamationRed, @@ -38,13 +38,13 @@ void TransmitSettingsIgwAdapter::Close() void TransmitSettingsIgwAdapter::msgMsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) { if(msgbox_id == firstCtrlID && mbr == MsgboxResult::Ok) - IngameWindow::Close(); + IngameWindow::close(); } void TransmitSettingsIgwAdapter::msgTimer(const unsigned /*ctrl_id*/) { if(GAMECLIENT.isReplayModeOn()) - UpdateSettings(); + updateSettings(); else - TransmitSettings(); + transmitSettings(); } diff --git a/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.h b/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.h index 2e3d5203e6..c6b02dbbe3 100644 --- a/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.h +++ b/libs/s25main/ingameWindows/TransmitSettingsIgwAdapter.h @@ -19,11 +19,11 @@ class TransmitSettingsIgwAdapter : public IngameWindow glArchivItem_Bitmap* background, bool modal = false); /// Updates the control elements with values from visual settings - virtual void UpdateSettings() = 0; + virtual void updateSettings() = 0; /// sends potential changes to the client - virtual void TransmitSettings() = 0; + virtual void transmitSettings() = 0; - void Close() override; + void close() override; void msgTimer(unsigned ctrl_id) override; void msgMsgBoxResult(unsigned msgbox_id, MsgboxResult mbr) override; diff --git a/libs/s25main/ingameWindows/iwAIDebug.cpp b/libs/s25main/ingameWindows/iwAIDebug.cpp index 34caa6ae82..dc74af9758 100644 --- a/libs/s25main/ingameWindows/iwAIDebug.cpp +++ b/libs/s25main/ingameWindows/iwAIDebug.cpp @@ -60,13 +60,13 @@ class iwAIDebug::DebugPrinter : public IDrawNodeCallback { auto* img = bqImgs[ai->getAINode(pt).bq]; if(img) - img->DrawFull(curPos); + img->drawFull(curPos); } else if(overlay == 2) - ticks[ai->getAINode(pt).reachable]->DrawFull(curPos); + ticks[ai->getAINode(pt).reachable]->drawFull(curPos); else if(overlay == 3) - ticks[ai->getAINode(pt).farmed]->DrawFull(curPos); + ticks[ai->getAINode(pt).farmed]->drawFull(curPos); else if(overlay < 13) - font.Draw(curPos, helpers::toString(ai->getResMapValue(pt, AIResource(overlay - 4))), FontStyle{}, + font.draw(curPos, helpers::toString(ai->getResMapValue(pt, AIResource(overlay - 4))), FontStyle{}, COLOR_YELLOW); } }; @@ -85,35 +85,35 @@ iwAIDebug::iwAIDebug(GameWorldView& gwv, const std::vector& ais // Wenn keine KI-Spieler, schließen if(ais_.empty()) { - Close(); + close(); return; } ctrlComboBox* players = - AddComboBox(ID_CbPlayer, DrawPoint(15, 30), Extent(250, 20), TextureColor::Grey, NormalFont, 100); + addComboBox(ID_CbPlayer, DrawPoint(15, 30), Extent(250, 20), TextureColor::Grey, NormalFont, 100); for(const AIJH::AIPlayerJH* ai : ais_) { - players->AddItem(ai->getPlayerName()); + players->addItem(ai->getPlayerName()); } ctrlComboBox* overlays = - AddComboBox(ID_CbOverlay, DrawPoint(15, 60), Extent(250, 20), TextureColor::Grey, NormalFont, 100); - overlays->AddItem("None"); - overlays->AddItem("BuildingQuality"); - overlays->AddItem("Reachability"); - overlays->AddItem("Farmed"); - overlays->AddItem("Gold"); - overlays->AddItem("Ironore"); - overlays->AddItem("Coal"); - overlays->AddItem("Granite"); - overlays->AddItem("Fish"); - overlays->AddItem("Wood"); - overlays->AddItem("Stones"); - overlays->AddItem("Plantspace"); - overlays->AddItem("Borderland"); + addComboBox(ID_CbOverlay, DrawPoint(15, 60), Extent(250, 20), TextureColor::Grey, NormalFont, 100); + overlays->addItem("None"); + overlays->addItem("BuildingQuality"); + overlays->addItem("Reachability"); + overlays->addItem("Farmed"); + overlays->addItem("Gold"); + overlays->addItem("Ironore"); + overlays->addItem("Coal"); + overlays->addItem("Granite"); + overlays->addItem("Fish"); + overlays->addItem("Wood"); + overlays->addItem("Stones"); + overlays->addItem("Plantspace"); + overlays->addItem("Borderland"); // Show 7 lines of text and 1 empty line - text = AddMultiline(ID_Text, DrawPoint(15, 120), Extent(250, 8 * NormalFont->getHeight()), TextureColor::Grey, + text = addMultiline(ID_Text, DrawPoint(15, 120), Extent(250, 8 * NormalFont->getHeight()), TextureColor::Grey, NormalFont, FontStyle::NO_OUTLINE); setIwSize(Extent(getIwSize().x, text->getPos().y + text->getSize().y)); @@ -121,14 +121,14 @@ iwAIDebug::iwAIDebug(GameWorldView& gwv, const std::vector& ais players->setSelection(0); overlays->setSelection(0); printer = new DebugPrinter(ais_[0], 0); - gwv.AddDrawNodeCallback(printer); + gwv.addDrawNodeCallback(printer); } iwAIDebug::~iwAIDebug() { if(printer) { - gwv.RemoveDrawNodeCallback(printer); + gwv.removeDrawNodeCallback(printer); delete printer; } } @@ -150,8 +150,8 @@ void iwAIDebug::msgPaintBefore() const AIJH::AIJob* currentJob = printer->ai->getCurrentJob(); if(!currentJob) { - text->Clear(); - text->AddString(_("No current job"), COLOR_YELLOW); + text->clear(); + text->addString(_("No current job"), COLOR_YELLOW); return; } @@ -213,6 +213,6 @@ void iwAIDebug::msgPaintBefore() default: ss << "Unknown status"; break; } - text->Clear(); - text->AddString(ss.str(), COLOR_YELLOW); + text->clear(); + text->addString(ss.str(), COLOR_YELLOW); } diff --git a/libs/s25main/ingameWindows/iwAction.cpp b/libs/s25main/ingameWindows/iwAction.cpp index a987c0417c..55978b2e82 100644 --- a/libs/s25main/ingameWindows/iwAction.cpp +++ b/libs/s25main/ingameWindows/iwAction.cpp @@ -79,25 +79,25 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP const GamePlayer& player = gwv.getViewer().getPlayer(); /// Haupttab - ctrlTab* main_tab = AddTabCtrl(0, DrawPoint(10, 20), 180); + ctrlTab* main_tab = addTabCtrl(0, DrawPoint(10, 20), 180); // Bau-main_tab if(tabs.build) { - ctrlGroup* group = main_tab->AddTab(LOADER.getImageN("io", 18), _("-> Build house"), TAB_BUILD); + ctrlGroup* group = main_tab->addTab(LOADER.getImageN("io", 18), _("-> Build house"), TAB_BUILD); - ctrlTab* build_tab = group->AddTabCtrl(1, DrawPoint(0, 45), 180); + ctrlTab* build_tab = group->addTabCtrl(1, DrawPoint(0, 45), 180); // Building tabs if(tabs.build_tabs == BuildTab::Mine) // mines - build_tab->AddTab(LOADER.getImageN("io", 76), _("-> Dig mines"), int(BuildTab::Mine)); + build_tab->addTab(LOADER.getImageN("io", 76), _("-> Dig mines"), int(BuildTab::Mine)); else { - build_tab->AddTab(LOADER.getImageN("io", 67), _("-> Build hut"), int(BuildTab::Hut)); + build_tab->addTab(LOADER.getImageN("io", 67), _("-> Build hut"), int(BuildTab::Hut)); if(tabs.build_tabs >= BuildTab::House) - build_tab->AddTab(LOADER.getImageN("io", 68), _("-> Build house"), int(BuildTab::House)); + build_tab->addTab(LOADER.getImageN("io", 68), _("-> Build house"), int(BuildTab::House)); if(tabs.build_tabs >= BuildTab::Castle) // castle & harbor - build_tab->AddTab(LOADER.getImageN("io", 69), _("-> Build castle"), int(BuildTab::Castle)); + build_tab->addTab(LOADER.getImageN("io", 69), _("-> Build castle"), int(BuildTab::Castle)); } // add building icons to TabCtrl. Note: None for BuildTab::Harbor (last) @@ -194,19 +194,19 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP DrawPoint iconPos((k % 5) * 36, (k / 5) * 36 + 45); ctrlBuildingIcon* icon = build_tab->getGroup(static_cast(bt)) - ->AddBuildingIcon(k, iconPos, bld, player.nation, 36, tooltip.str()); + ->addBuildingIcon(k, iconPos, bld, player.nation, 36, tooltip.str()); if(radius > 0) { icon->setOnHoverChanged([this, icon, radius](bool hovered) noexcept { - if(hovered && !ShouldBeClosed()) + if(hovered && !shouldBeClosed()) { this->activeHoveredIcon_ = icon; - this->gwv.ShowRadiusPreview(this->selectedPt, radius); + this->gwv.showRadiusPreview(this->selectedPt, radius); } else if(this->activeHoveredIcon_ == icon) { this->activeHoveredIcon_ = nullptr; - this->gwv.HideRadiusPreview(); + this->gwv.hideRadiusPreview(); } // else: stale leave from a previously-hovered icon, ignore }); @@ -224,47 +224,47 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP // Wenn es einen Flaggen-main_tab gibt, dann entsprechend die Buttons anordnen, wie sie gebraucht werden if(tabs.flag) { - ctrlGroup* group = main_tab->AddTab(LOADER.getImageN("io", 70), _("Erect flag"), TAB_FLAG); + ctrlGroup* group = main_tab->addTab(LOADER.getImageN("io", 70), _("Erect flag"), TAB_FLAG); switch(get(params)) { case FlagType::Normal: { - group->AddImageButton(1, DrawPoint(0, 45), Extent(45, 36), TextureColor::Grey, + group->addImageButton(1, DrawPoint(0, 45), Extent(45, 36), TextureColor::Grey, LOADER.getImageN("io", 65), _("Build road")); - group->AddImageButton(3, DrawPoint(45, 45), Extent(45, 36), TextureColor::Grey, + group->addImageButton(3, DrawPoint(45, 45), Extent(45, 36), TextureColor::Grey, LOADER.getImageN("io", 118), _("Pull down flag")); - group->AddImageButton(4, DrawPoint(90, 45), Extent(45, 36), TextureColor::Grey, + group->addImageButton(4, DrawPoint(90, 45), Extent(45, 36), TextureColor::Grey, LOADER.getImageN("io", 20), _("Call in geologist")); - group->AddImageButton(5, DrawPoint(135, 45), Extent(45, 36), TextureColor::Grey, + group->addImageButton(5, DrawPoint(135, 45), Extent(45, 36), TextureColor::Grey, LOADER.getImageN("io", 96), _("Send out scout")); } break; case FlagType::WaterFlag: { - group->AddImageButton(1, DrawPoint(0, 45), Extent(36, 36), TextureColor::Grey, + group->addImageButton(1, DrawPoint(0, 45), Extent(36, 36), TextureColor::Grey, LOADER.getImageN("io", 65), _("Build road")); - group->AddImageButton(2, DrawPoint(36, 45), Extent(36, 36), TextureColor::Grey, + group->addImageButton(2, DrawPoint(36, 45), Extent(36, 36), TextureColor::Grey, LOADER.getImageN("io", 95), _("Build waterway")); - group->AddImageButton(3, DrawPoint(72, 45), Extent(36, 36), TextureColor::Grey, + group->addImageButton(3, DrawPoint(72, 45), Extent(36, 36), TextureColor::Grey, LOADER.getImageN("io", 118), _("Pull down flag")); - group->AddImageButton(4, DrawPoint(108, 45), Extent(36, 36), TextureColor::Grey, + group->addImageButton(4, DrawPoint(108, 45), Extent(36, 36), TextureColor::Grey, LOADER.getImageN("io", 20), _("Call in geologist")); - group->AddImageButton(5, DrawPoint(144, 45), Extent(36, 36), TextureColor::Grey, + group->addImageButton(5, DrawPoint(144, 45), Extent(36, 36), TextureColor::Grey, LOADER.getImageN("io", 96), _("Send out scout")); } break; case FlagType::HQ: { - group->AddImageButton(1, DrawPoint(0, 45), Extent(180, 36), TextureColor::Grey, + group->addImageButton(1, DrawPoint(0, 45), Extent(180, 36), TextureColor::Grey, LOADER.getImageN("io", 65), _("Build road")); } break; case FlagType::Storehouse: { - group->AddImageButton(1, DrawPoint(0, 45), Extent(90, 36), TextureColor::Grey, + group->addImageButton(1, DrawPoint(0, 45), Extent(90, 36), TextureColor::Grey, LOADER.getImageN("io", 65), _("Build road")); - group->AddImageButton(3, DrawPoint(90, 45), Extent(90, 36), TextureColor::Grey, + group->addImageButton(3, DrawPoint(90, 45), Extent(90, 36), TextureColor::Grey, LOADER.getImageN("io", 118), _("Demolish house")); } break; @@ -274,7 +274,7 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP // Flagge Setzen-main_tab if(tabs.setflag) { - ctrlGroup* group = main_tab->AddTab(LOADER.getImageN("io", 45), _("Erect flag"), TAB_SETFLAG); + ctrlGroup* group = main_tab->addTab(LOADER.getImageN("io", 45), _("Erect flag"), TAB_SETFLAG); unsigned nr = 70; if(get(params) == FlagType::WaterFlag) @@ -283,43 +283,43 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP // Straße aufwerten ggf anzeigen Extent btSize(180, 36); unsigned btPosX = 90; - AddUpgradeRoad(group, btPosX, btSize.x); + addUpgradeRoad(group, btPosX, btSize.x); - group->AddImageButton(1, DrawPoint(0, 45), btSize, TextureColor::Grey, LOADER.getImageN("io", nr), + group->addImageButton(1, DrawPoint(0, 45), btSize, TextureColor::Grey, LOADER.getImageN("io", nr), _("Erect flag")); } // Cut-main_tab if(tabs.cutroad) { - ctrlGroup* group = main_tab->AddTab(LOADER.getImageN("io", 19), _("Dig up road"), TAB_CUTROAD); + ctrlGroup* group = main_tab->addTab(LOADER.getImageN("io", 19), _("Dig up road"), TAB_CUTROAD); // Straße aufwerten ggf anzeigen Extent btSize(180, 36); unsigned btPosX = 0; if(tabs.upgradeRoad) - AddUpgradeRoad(group, btPosX, btSize.x); + addUpgradeRoad(group, btPosX, btSize.x); - group->AddImageButton(1, DrawPoint(btPosX, 45), btSize, TextureColor::Grey, LOADER.getImageN("io", 32), + group->addImageButton(1, DrawPoint(btPosX, 45), btSize, TextureColor::Grey, LOADER.getImageN("io", 32), _("Dig up road")); } if(tabs.attack) { - ctrlGroup* group = main_tab->AddTab(LOADER.getImageN("io", 98), _("Attack options"), TAB_ATTACK); + ctrlGroup* group = main_tab->addTab(LOADER.getImageN("io", 98), _("Attack options"), TAB_ATTACK); available_soldiers_count = get(params); - AddAttackControls(group, available_soldiers_count); + addAttackControls(group, available_soldiers_count); selected_soldiers_count = 1; } if(tabs.sea_attack) { - ctrlGroup* group = main_tab->AddTab(LOADER.getImageN("io", 177), _("Attack options"), TAB_SEAATTACK); + ctrlGroup* group = main_tab->addTab(LOADER.getImageN("io", 177), _("Attack options"), TAB_SEAATTACK); selected_soldiers_count_sea = 1; available_soldiers_count_sea = gwv.getViewer().getNumSoldiersForSeaAttack(selectedPt); - AddAttackControls(group, available_soldiers_count_sea); + addAttackControls(group, available_soldiers_count_sea); } // Beobachten-main_tab @@ -329,23 +329,23 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP { constexpr auto buildImgId = 18; auto* buildImg = LOADER.getImageN("io", buildImgId); - ctrlGroup* group = main_tab->AddTab(buildImg, _("Build headquarters"), TAB_CHEAT); - group->AddImageButton(1, DrawPoint{0, 45}, Extent{180, 36}, TextureColor::Grey, buildImg, + ctrlGroup* group = main_tab->addTab(buildImg, _("Build headquarters"), TAB_CHEAT); + group->addImageButton(1, DrawPoint{0, 45}, Extent{180, 36}, TextureColor::Grey, buildImg, _("Build headquarters")); } - ctrlGroup* group = main_tab->AddTab(LOADER.getImageN("io", 36), _("Display options"), TAB_WATCH); + ctrlGroup* group = main_tab->addTab(LOADER.getImageN("io", 36), _("Display options"), TAB_WATCH); const Extent btSize(45, 36); DrawPoint curPos(0, 45); - group->AddImageButton(1, curPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 108), + group->addImageButton(1, curPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 108), _("Observation window")); curPos.x += btSize.x; - group->AddImageButton(2, curPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 179), _("House names")); + group->addImageButton(2, curPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 179), _("House names")); curPos.x += btSize.x; - group->AddImageButton(3, curPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 180), + group->addImageButton(3, curPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 180), _("Go to headquarters")); curPos.x += btSize.x; - group->AddImageButton(4, curPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 107), + group->addImageButton(4, curPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 107), _("Notify allies of this location")); } @@ -363,19 +363,19 @@ iwAction::iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapP VIDEODRIVER.setMousePos(getDrawPos() + DrawPoint(20, 75)); } -void iwAction::AddUpgradeRoad(ctrlGroup* group, unsigned& /*x*/, unsigned& width) +void iwAction::addUpgradeRoad(ctrlGroup* group, unsigned& /*x*/, unsigned& width) { RTTR_Assert(group); if(gwv.getWorld().getGGS().isEnabled(AddonId::MANUAL_ROAD_ENLARGEMENT)) { width = 90; - group->AddImageButton(2, DrawPoint(90, 45), Extent(width, 36), TextureColor::Grey, LOADER.getImageN("io", 44), + group->addImageButton(2, DrawPoint(90, 45), Extent(width, 36), TextureColor::Grey, LOADER.getImageN("io", 44), _("Upgrade to donkey road")); } } -bool iwAction::DoUpgradeRoad() +bool iwAction::doUpgradeRoad() { Direction flag_dir; const noFlag* flag = gwv.getWorld().getRoadFlag(selectedPt, flag_dir); @@ -386,28 +386,28 @@ bool iwAction::DoUpgradeRoad() } /// Fügt Angriffs-Steuerelemente für bestimmte Gruppe hinzu -void iwAction::AddAttackControls(ctrlGroup* group, const unsigned attackers_count) +void iwAction::addAttackControls(ctrlGroup* group, const unsigned attackers_count) { // Verfügbare Soldatenzahl steht in params, wenns keine gibt, einfach Meldung anzeigen: "Angriff nicht möglich!" if(attackers_count == 0) { // Angriff nicht möglich! - group->AddText(1, DrawPoint(90, 56), _("Attack not possible."), COLOR_YELLOW, FontStyle::CENTER, NormalFont); + group->addText(1, DrawPoint(90, 56), _("Attack not possible."), COLOR_YELLOW, FontStyle::CENTER, NormalFont); } else { selected_soldiers_count = 1; // Minus und Plus - Button - group->AddImageButton(1, DrawPoint(3, 49), Extent(26, 32), TextureColor::Grey, LOADER.getImageN("io", 139), + group->addImageButton(1, DrawPoint(3, 49), Extent(26, 32), TextureColor::Grey, LOADER.getImageN("io", 139), _("Less attackers")); - group->AddImageButton(2, DrawPoint(89, 49), Extent(26, 32), TextureColor::Grey, LOADER.getImageN("io", 138), + group->addImageButton(2, DrawPoint(89, 49), Extent(26, 32), TextureColor::Grey, LOADER.getImageN("io", 138), _("More attackers")); // Starke/Schwache Soldaten - ctrlOptionGroup* ogroup = group->AddOptionGroup(3, GroupSelectType::Illuminate); - ogroup->AddImageButton(0, DrawPoint(146, 49), Extent(30, 33), TextureColor::Grey, LOADER.getImageN("io", 31), + ctrlOptionGroup* ogroup = group->addOptionGroup(3, GroupSelectType::Illuminate); + ogroup->addImageButton(0, DrawPoint(146, 49), Extent(30, 33), TextureColor::Grey, LOADER.getImageN("io", 31), _("Weak attackers")); - ogroup->AddImageButton(1, DrawPoint(117, 49), Extent(30, 33), TextureColor::Grey, LOADER.getImageN("io", 30), + ogroup->addImageButton(1, DrawPoint(117, 49), Extent(30, 33), TextureColor::Grey, LOADER.getImageN("io", 30), _("Strong attackers")); // standardmäßig starke Soldaten ogroup->setSelection(1); @@ -417,22 +417,22 @@ void iwAction::AddAttackControls(ctrlGroup* group, const unsigned attackers_coun unsigned short button_width = 112 / buttons_count; for(unsigned i = 0; i < buttons_count; ++i) - group->AddImageButton(10 + i, DrawPoint(3 + i * button_width, 83), Extent(button_width, 32), + group->addImageButton(10 + i, DrawPoint(3 + i * button_width, 83), Extent(button_width, 32), TextureColor::Grey, LOADER.getImageN("io", 204 + i), _("Number of attackers")); // Angriffsbutton - group->AddImageButton(4, DrawPoint(117, 83), Extent(59, 32), TextureColor::Red1, LOADER.getImageN("io", 25), + group->addImageButton(4, DrawPoint(117, 83), Extent(59, 32), TextureColor::Red1, LOADER.getImageN("io", 25), _("Attack!")); } } -void iwAction::Close() +void iwAction::close() { - if(ShouldBeClosed()) + if(shouldBeClosed()) return; activeHoveredIcon_ = nullptr; - gwv.HideRadiusPreview(); - IngameWindow::Close(); + gwv.hideRadiusPreview(); + IngameWindow::close(); if(mousePosAtOpen_.isValid()) VIDEODRIVER.setMousePos(mousePosAtOpen_); } @@ -560,11 +560,11 @@ void iwAction::msgPaintAfter() if(tab->getCurrentTab() == TAB_ATTACK && available_soldiers_count > 0) { fmt % selected_soldiers_count % available_soldiers_count; - LargeFont->Draw(getDrawPos() + DrawPoint(67, 79), fmt.str(), FontStyle::CENTER, COLOR_YELLOW); + LargeFont->draw(getDrawPos() + DrawPoint(67, 79), fmt.str(), FontStyle::CENTER, COLOR_YELLOW); } else if(tab->getCurrentTab() == TAB_SEAATTACK && available_soldiers_count_sea > 0) { fmt % selected_soldiers_count_sea % available_soldiers_count_sea; - LargeFont->Draw(getDrawPos() + DrawPoint(67, 79), fmt.str(), FontStyle::CENTER, COLOR_YELLOW); + LargeFont->draw(getDrawPos() + DrawPoint(67, 79), fmt.str(), FontStyle::CENTER, COLOR_YELLOW); } } } @@ -600,7 +600,7 @@ void iwAction::msgButtonClickTabAttack(const unsigned ctrl_id) { auto* ogroup = getCtrl(0)->getGroup(TAB_ATTACK)->getCtrl(3); if(GAMECLIENT.Attack(selectedPt, selected_soldiers_count, (ogroup->getSelection() == 1))) - Close(); + close(); } break; } @@ -637,7 +637,7 @@ void iwAction::msgButtonClickTabSeaAttack(const unsigned ctrl_id) { auto* ogroup = getCtrl(0)->getGroup(TAB_SEAATTACK)->getCtrl(3); if(GAMECLIENT.SeaAttack(selectedPt, selected_soldiers_count_sea, (ogroup->getSelection() == 1))) - Close(); + close(); } break; } @@ -650,13 +650,13 @@ void iwAction::msgButtonClickTabFlag(const unsigned ctrl_id) case 1: // Straße bauen { gi.GI_StartRoadBuilding(selectedPt, false); - Close(); + close(); } break; case 2: // Wasserstraße bauen { gi.GI_StartRoadBuilding(selectedPt, true); - Close(); + close(); } break; case 3: // Flagge abreißen @@ -677,31 +677,31 @@ void iwAction::msgButtonClickTabFlag(const unsigned ctrl_id) if(!static_cast(building)->isDemolitionAllowed()) { // Nein, dann Messagebox anzeigen - iwMilitaryBuilding::DemolitionNotAllowed(world.getGGS()); + iwMilitaryBuilding::demolitionNotAllowed(world.getGGS()); break; } } - WINDOWMANAGER.Show(std::make_unique(gwv, building, true)); - DisableMousePosResetOnClose(); - Close(); + WINDOWMANAGER.show(std::make_unique(gwv, building, true)); + disableMousePosResetOnClose(); + close(); } else { if(GAMECLIENT.DestroyFlag(selectedPt)) - Close(); + close(); } } break; case 4: // Geologen rufen { if(GAMECLIENT.CallSpecialist(selectedPt, Job::Geologist)) - Close(); + close(); } break; case 5: // Späher rufen { if(GAMECLIENT.CallSpecialist(selectedPt, Job::Scout)) - Close(); + close(); } break; } @@ -718,7 +718,7 @@ void iwAction::msgButtonClickTabBuild(const unsigned ctrl_id) ->getType())) { // Fenster schließen - Close(); + close(); } } @@ -731,12 +731,12 @@ void iwAction::msgButtonClickTabSetFlag(const unsigned ctrl_id) success = GAMECLIENT.SetFlag(selectedPt); break; case 2: // Weg aufwerten - success = DoUpgradeRoad(); + success = doUpgradeRoad(); break; } if(success) - Close(); + close(); } void iwAction::msgButtonClickTabCutRoad(const unsigned ctrl_id) @@ -753,12 +753,12 @@ void iwAction::msgButtonClickTabCutRoad(const unsigned ctrl_id) } break; case 2: // Straße aufwerten - success = DoUpgradeRoad(); + success = doUpgradeRoad(); break; } if(success) - Close(); + close(); } void iwAction::msgButtonClickTabWatch(const unsigned ctrl_id) @@ -767,22 +767,22 @@ void iwAction::msgButtonClickTabWatch(const unsigned ctrl_id) { case 1: // TODO: bestimen, was an der position selected ist - WINDOWMANAGER.Show(std::make_unique(gwv, selectedPt)); - DisableMousePosResetOnClose(); - Close(); + WINDOWMANAGER.show(std::make_unique(gwv, selectedPt)); + disableMousePosResetOnClose(); + close(); break; case 2: // Häusernamen/Prozent anmachen - gwv.ToggleShowNamesAndProductivity(); - Close(); + gwv.toggleShowNamesAndProductivity(); + close(); break; case 3: // zum HQ - gwv.MoveToMapPt(gwv.getViewer().getPlayer().getHQPos()); - DisableMousePosResetOnClose(); - Close(); + gwv.moveToMapPt(gwv.getViewer().getPlayer().getHQPos()); + disableMousePosResetOnClose(); + close(); break; case 4: if(GAMECLIENT.NotifyAlliesOfLocation(selectedPt)) - Close(); + close(); break; } } @@ -793,12 +793,12 @@ void iwAction::msgButtonClickTabCheat(const unsigned ctrl_id) { case 1: gi.GI_GetCheats().placeCheatBuilding(selectedPt, gwv.getViewer().getPlayer()); - Close(); + close(); break; } } -void iwAction::DisableMousePosResetOnClose() +void iwAction::disableMousePosResetOnClose() { - mousePosAtOpen_ = DrawPoint::Invalid(); + mousePosAtOpen_ = DrawPoint::invalid(); } diff --git a/libs/s25main/ingameWindows/iwAction.h b/libs/s25main/ingameWindows/iwAction.h index 947a3d10c6..3eaf216dff 100644 --- a/libs/s25main/ingameWindows/iwAction.h +++ b/libs/s25main/ingameWindows/iwAction.h @@ -77,7 +77,7 @@ class iwAction : public IngameWindow iwAction(GameInterface& gi, GameWorldView& gwv, const Tabs& tabs, MapPoint selectedPt, const DrawPoint& mousePos, Params params, bool military_buildings); - void Close() override; + void close() override; /// Gibt zurück, auf welchen Punkt es sich bezieht const MapPoint& getSelectedPt() const { return selectedPt; } @@ -97,10 +97,10 @@ class iwAction : public IngameWindow inline void msgButtonClickTabWatch(unsigned ctrl_id); inline void msgButtonClickTabCheat(unsigned ctrl_id); - void DisableMousePosResetOnClose(); + void disableMousePosResetOnClose(); /// Fügt Angriffs-Steuerelemente für bestimmte Gruppe hinzu - void AddAttackControls(ctrlGroup* group, unsigned attackers_count); - void AddUpgradeRoad(ctrlGroup* group, unsigned& x, unsigned& width); - bool DoUpgradeRoad(); + void addAttackControls(ctrlGroup* group, unsigned attackers_count); + void addUpgradeRoad(ctrlGroup* group, unsigned& x, unsigned& width); + bool doUpgradeRoad(); }; diff --git a/libs/s25main/ingameWindows/iwAddonPresets.cpp b/libs/s25main/ingameWindows/iwAddonPresets.cpp index e7be3af0c8..9f481c5418 100644 --- a/libs/s25main/ingameWindows/iwAddonPresets.cpp +++ b/libs/s25main/ingameWindows/iwAddonPresets.cpp @@ -91,33 +91,33 @@ iwAddonPresetsBase::iwAddonPresetsBase(const std::string& title, const std::stri LOADER.getImageN("resource", 41), true) { using SRT = ctrlTable::SortType; - AddTable(ID_tblPresets, DrawPoint(contentX, tableY), Extent(contentWidth, tableHeight), TextureColor::Green2, + addTable(ID_tblPresets, DrawPoint(contentX, tableY), Extent(contentWidth, tableHeight), TextureColor::Green2, NormalFont, ctrlTable::Columns{{_("Preset Name"), contentWidth, SRT::String}, {}}); - AddText(ID_txtFolder, DrawPoint(contentX, tableY + tableHeight + ctrlSpacingY), GetPresetsDir().string(), + addText(ID_txtFolder, DrawPoint(contentX, tableY + tableHeight + ctrlSpacingY), GetPresetsDir().string(), COLOR_YELLOW, FontStyle::TOP, SmallFont) ->setMaxWidth(contentWidth); const unsigned buttonY = contentStartY + additionalHeight; - AddTextButton(ID_btAction, DrawPoint(rightColumnX, buttonY), Extent(halfWidth, ctrlHeight), TextureColor::Green2, + addTextButton(ID_btAction, DrawPoint(rightColumnX, buttonY), Extent(halfWidth, ctrlHeight), TextureColor::Green2, actionLabel, NormalFont) ->setEnabled(false); - AddTextButton(ID_btDelete, DrawPoint(contentX, buttonY), Extent(halfWidth, ctrlHeight), TextureColor::Red1, + addTextButton(ID_btDelete, DrawPoint(contentX, buttonY), Extent(halfWidth, ctrlHeight), TextureColor::Red1, _("Delete"), NormalFont) ->setEnabled(false); - RefreshTable(); + refreshTable(); } -void iwAddonPresetsBase::RefreshTable() +void iwAddonPresetsBase::refreshTable() { auto& table = assertNonNull(getCtrl(ID_tblPresets)); - table.DeleteAllItems(); + table.deleteAllItems(); for(const auto& file : ListDir(GetPresetsDir(), "ini")) - table.AddRow({file.stem().string(), file.string()}); + table.addRow({file.stem().string(), file.string()}); - table.SortRows(0, TableSortDir::Ascending); + table.sortRows(0, TableSortDir::Ascending); } bfs::path iwAddonPresetsBase::getSelectedFilePath() const @@ -134,7 +134,7 @@ bool iwAddonPresetsBase::isPresetSelected() const return assertNonNull(getCtrl(ID_tblPresets)).getSelection().has_value(); } -void iwAddonPresetsBase::UpdateButtons() +void iwAddonPresetsBase::updateButtons() { getCtrl(ID_btDelete)->setEnabled(isPresetSelected()); getCtrl(ID_btAction)->setEnabled(canDoAction()); @@ -148,30 +148,30 @@ bool iwAddonPresetsBase::canDoAction() const void iwAddonPresetsBase::msgButtonClick(const unsigned ctrl_id) { if(ctrl_id == ID_btDelete) - ConfirmDelete(); + confirmDelete(); else { RTTR_Assert(ctrl_id == ID_btAction); - DoAction(); + doAction(); } } void iwAddonPresetsBase::msgTableSelectItem(const unsigned /*ctrl_id*/, const std::optional& /*selection*/) { - UpdateButtons(); + updateButtons(); } void iwAddonPresetsBase::msgTableChooseItem(const unsigned /*ctrl_id*/, const unsigned /*selection*/) { - DoAction(); + doAction(); } -void iwAddonPresetsBase::ConfirmDelete() +void iwAddonPresetsBase::confirmDelete() { const bfs::path filePath = getSelectedFilePath(); if(filePath.empty()) return; - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Delete Preset"), helpers::format(_("Are you sure you want to delete preset '%1%'?"), filePath.stem().string()), this, MsgboxButton::YesNo, MsgboxIcon::QuestionRed, ID_mbDelete)); } @@ -190,12 +190,12 @@ void iwAddonPresetsBase::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxR if(ec) { LOG.write("Failed to delete addon preset %1%: %2%\n") % filePath % ec.message(); - WINDOWMANAGER.Show(std::make_unique(_("Delete Failed"), _("Failed to delete the selected preset."), + WINDOWMANAGER.show(std::make_unique(_("Delete Failed"), _("Failed to delete the selected preset."), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); } // Refresh in both cases so the list reflects the actual filesystem state // (e.g. the file became a directory or was removed out from under us). - RefreshTable(); + refreshTable(); } iwSaveAddonPreset::iwSaveAddonPreset(std::map states) @@ -203,14 +203,14 @@ iwSaveAddonPreset::iwSaveAddonPreset(std::map states) { // maxLength 251 = 255 filename limit - 4 chars for ".ini"; just discourages absurdly long // input, isValidFileName() may still reject it since it counts bytes, not codepoints. - AddEdit(ID_edtName, DrawPoint(contentX, contentStartY), Extent(contentWidth, ctrlHeight), TextureColor::Green2, + addEdit(ID_edtName, DrawPoint(contentX, contentStartY), Extent(contentWidth, ctrlHeight), TextureColor::Green2, NormalFont, 251, false, false, true) ->setType(EditType::Filename); } void iwSaveAddonPreset::msgEditEnter(const unsigned /*ctrl_id*/) { - DoAction(); + doAction(); } void iwSaveAddonPreset::msgEditChange(const unsigned /*ctrl_id*/) @@ -240,17 +240,17 @@ bool iwSaveAddonPreset::canDoAction() const return getCtrl(ID_edtName)->getFileName(".ini").status != FileNameStatus::Empty; } -void iwSaveAddonPreset::DoAction() +void iwSaveAddonPreset::doAction() { const auto fileNameResult = getCtrl(ID_edtName)->getFileName(".ini"); switch(fileNameResult.status) { case FileNameStatus::Empty: - WINDOWMANAGER.Show(std::make_unique(_("Invalid Name"), _("Please enter a preset name."), this, + WINDOWMANAGER.show(std::make_unique(_("Invalid Name"), _("Please enter a preset name."), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); return; case FileNameStatus::Invalid: - WINDOWMANAGER.Show(std::make_unique(_("Invalid Name"), _("Please enter a valid preset name."), + WINDOWMANAGER.show(std::make_unique(_("Invalid Name"), _("Please enter a valid preset name."), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); return; case FileNameStatus::Valid: break; @@ -259,7 +259,7 @@ void iwSaveAddonPreset::DoAction() if(bfs::exists(filePath)) { - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Overwrite Preset"), helpers::format(_("A preset named '%1%' already exists. Do you want to overwrite it?"), filePath.stem().string()), @@ -267,10 +267,10 @@ void iwSaveAddonPreset::DoAction() return; } - SaveToPath(filePath); + saveToPath(filePath); } -void iwSaveAddonPreset::SaveToPath(const bfs::path& filePath) +void iwSaveAddonPreset::saveToPath(const bfs::path& filePath) { auto iniItem = std::make_unique("addons"); for(const auto& [id, status] : states_) @@ -282,15 +282,15 @@ void iwSaveAddonPreset::SaveToPath(const bfs::path& filePath) const int ec = libsiedler2::Write(filePath, archive); if(ec == libsiedler2::ErrorCode::NONE) { - Close(); + close(); return; } LOG.write("Failed to save addon preset to %1%: %2%\n") % filePath % libsiedler2::getErrorString(ec); - WINDOWMANAGER.Show(std::make_unique(_("Save Failed"), + WINDOWMANAGER.show(std::make_unique(_("Save Failed"), _("Failed to save the preset. Check application logs for details."), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); - RefreshTable(); + refreshTable(); } void iwSaveAddonPreset::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult mbr) @@ -305,14 +305,14 @@ void iwSaveAddonPreset::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxRe const auto fileNameResult = getCtrl(ID_edtName)->getFileName(".ini"); if(fileNameResult.status == FileNameStatus::Valid) - SaveToPath(GetPresetsDir() / fileNameResult.name); + saveToPath(GetPresetsDir() / fileNameResult.name); } iwLoadAddonPreset::iwLoadAddonPreset(std::function&)> onLoad) : iwAddonPresetsBase(_("Load Addon Preset"), _("Load"), 0), onLoad_(std::move(onLoad)) {} -void iwLoadAddonPreset::DoAction() +void iwLoadAddonPreset::doAction() { const bfs::path filePath = getSelectedFilePath(); if(filePath.empty()) @@ -321,7 +321,7 @@ void iwLoadAddonPreset::DoAction() const auto states = LoadPresetsFromFile(filePath); if(!states) { - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Load Failed"), _("The selected preset could not be loaded. The file may be corrupted or have an invalid format."), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); @@ -329,5 +329,5 @@ void iwLoadAddonPreset::DoAction() } onLoad_(*states); - Close(); + close(); } diff --git a/libs/s25main/ingameWindows/iwAddonPresets.h b/libs/s25main/ingameWindows/iwAddonPresets.h index 9755d810aa..3fef81573d 100644 --- a/libs/s25main/ingameWindows/iwAddonPresets.h +++ b/libs/s25main/ingameWindows/iwAddonPresets.h @@ -30,7 +30,7 @@ class iwAddonPresetsBase : public IngameWindow /// additionalHeight is the room the subclass needs for its own controls above the buttons iwAddonPresetsBase(const std::string& title, const std::string& actionLabel, unsigned additionalHeight); - void RefreshTable(); + void refreshTable(); /// Empty if no preset is selected boost::filesystem::path getSelectedFilePath() const; @@ -41,10 +41,10 @@ class iwAddonPresetsBase : public IngameWindow private: bool isPresetSelected() const; - void UpdateButtons(); + void updateButtons(); virtual bool canDoAction() const; - virtual void DoAction() = 0; - void ConfirmDelete(); + virtual void doAction() = 0; + void confirmDelete(); }; class iwSaveAddonPreset : public iwAddonPresetsBase @@ -54,9 +54,9 @@ class iwSaveAddonPreset : public iwAddonPresetsBase private: const std::map states_; - void SaveToPath(const boost::filesystem::path& filePath); + void saveToPath(const boost::filesystem::path& filePath); bool canDoAction() const override; - void DoAction() override; + void doAction() override; void msgEditEnter(unsigned ctrl_id) override; void msgEditChange(unsigned ctrl_id) override; void msgTableSelectItem(unsigned ctrl_id, const std::optional& selection) override; @@ -70,5 +70,5 @@ class iwLoadAddonPreset : public iwAddonPresetsBase private: std::function&)> onLoad_; - void DoAction() override; + void doAction() override; }; diff --git a/libs/s25main/ingameWindows/iwAddons.cpp b/libs/s25main/ingameWindows/iwAddons.cpp index 6307b5a110..1bf97be566 100644 --- a/libs/s25main/ingameWindows/iwAddons.cpp +++ b/libs/s25main/ingameWindows/iwAddons.cpp @@ -41,45 +41,45 @@ iwAddons::iwAddons(GlobalGameSettings& ggs, Window* parent, AddonChangeAllowed p LOADER.getImageN("resource", 41), true, CloseBehavior::Custom, parent), ggs(ggs), policy_(policy), whitelistedAddons_(std::move(whitelistedAddons)) { - AddText(ID_txtAddFeatures, DrawPoint(20, 30), _("Additional features:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addText(ID_txtAddFeatures, DrawPoint(20, 30), _("Additional features:"), COLOR_YELLOW, FontStyle{}, NormalFont); Extent btSize(200, 22); if(policy != AddonChangeAllowed::None) { - AddTextButton(ID_btSavePreset, DrawPoint(20, getSize().y - 70), btSize, TextureColor::Green2, _("Save"), + addTextButton(ID_btSavePreset, DrawPoint(20, getSize().y - 70), btSize, TextureColor::Green2, _("Save"), NormalFont, _("Save Addon Preset")); - AddTextButton(ID_btLoadPreset, DrawPoint(250, getSize().y - 70), btSize, TextureColor::Green2, _("Load"), + addTextButton(ID_btLoadPreset, DrawPoint(250, getSize().y - 70), btSize, TextureColor::Green2, _("Load"), NormalFont, _("Load Addon Preset")); - AddTextButton(ID_btS2Defaults, DrawPoint(480, getSize().y - 70), btSize, TextureColor::Grey, _("Default"), + addTextButton(ID_btS2Defaults, DrawPoint(480, getSize().y - 70), btSize, TextureColor::Grey, _("Default"), NormalFont, _("Use S2 Defaults")); - AddTextButton(ID_btApply, DrawPoint(20, getSize().y - 40), btSize, TextureColor::Green2, _("Apply"), NormalFont, + addTextButton(ID_btApply, DrawPoint(20, getSize().y - 40), btSize, TextureColor::Green2, _("Apply"), NormalFont, _("Apply Changes")); } - AddTextButton(ID_btAbort, DrawPoint(250, getSize().y - 40), btSize, TextureColor::Red1, _("Abort"), NormalFont, + addTextButton(ID_btAbort, DrawPoint(250, getSize().y - 40), btSize, TextureColor::Red1, _("Abort"), NormalFont, _("Close Without Saving")); // Kategorien - ctrlOptionGroup* optiongroup = AddOptionGroup(ID_grpAddonGroup, GroupSelectType::Check); + ctrlOptionGroup* optiongroup = addOptionGroup(ID_grpAddonGroup, GroupSelectType::Check); btSize = Extent(120, 22); // "Alle" - optiongroup->AddTextButton(static_cast(AddonGroup::All), DrawPoint(20, 50), btSize, TextureColor::Green2, + optiongroup->addTextButton(static_cast(AddonGroup::All), DrawPoint(20, 50), btSize, TextureColor::Green2, _("All"), NormalFont); // "Militär" - optiongroup->AddTextButton(static_cast(AddonGroup::Military), DrawPoint(150, 50), btSize, + optiongroup->addTextButton(static_cast(AddonGroup::Military), DrawPoint(150, 50), btSize, TextureColor::Green2, _("Military"), NormalFont); // "Wirtschaft" - optiongroup->AddTextButton(static_cast(AddonGroup::Economy), DrawPoint(290, 50), btSize, + optiongroup->addTextButton(static_cast(AddonGroup::Economy), DrawPoint(290, 50), btSize, TextureColor::Green2, _("Economy"), NormalFont); // "Spielverhalten" - optiongroup->AddTextButton(static_cast(AddonGroup::GamePlay), DrawPoint(430, 50), btSize, + optiongroup->addTextButton(static_cast(AddonGroup::GamePlay), DrawPoint(430, 50), btSize, TextureColor::Green2, _("Gameplay"), NormalFont); // "Sonstiges" - optiongroup->AddTextButton(static_cast(AddonGroup::Other), DrawPoint(560, 50), btSize, + optiongroup->addTextButton(static_cast(AddonGroup::Other), DrawPoint(560, 50), btSize, TextureColor::Green2, _("Other"), NormalFont); ctrlScrollBar* scrollbar = - AddScrollBar(ID_scroll, DrawPoint(getSize().x - SCROLLBAR_WIDTH - 20, 90), + addScrollBar(ID_scroll, DrawPoint(getSize().x - SCROLLBAR_WIDTH - 20, 90), Extent(SCROLLBAR_WIDTH, getSize().y - 170), SCROLLBAR_WIDTH, TextureColor::Green2, 1); scrollbar->setPageSize(scrollbar->getSize().y / AddonGuiLineHeight); @@ -87,7 +87,7 @@ iwAddons::iwAddons(GlobalGameSettings& ggs, Window* parent, AddonChangeAllowed p { const unsigned id = ID_grpAddonsStart + i; const Addon& addon = assertNonNull(ggs.getAddon(i)); - addonGuis_.emplace_back(addon.createGui(*AddGroup(id), isReadOnly(addon.getId()))); + addonGuis_.emplace_back(addon.createGui(*addGroup(id), isReadOnly(addon.getId()))); addonGuis_.back()->setStatus(ggs.getSelection(addon.getId())); } @@ -96,12 +96,12 @@ iwAddons::iwAddons(GlobalGameSettings& ggs, Window* parent, AddonChangeAllowed p iwAddons::~iwAddons() = default; -void iwAddons::Close() +void iwAddons::close() { // Close an open save/load preset window: the load window holds a callback into this window, // so it must not outlive it - WINDOWMANAGER.Close(CGI_ADDON_PRESETS); - IngameWindow::Close(); + WINDOWMANAGER.close(CGI_ADDON_PRESETS); + IngameWindow::close(); } void iwAddons::msgButtonClick(const unsigned ctrl_id) @@ -120,7 +120,7 @@ void iwAddons::msgButtonClick(const unsigned ctrl_id) switch(policy_) { default: break; - case AddonChangeAllowed::AllAndSaveToConfig: ggs.SaveSettings(); break; + case AddonChangeAllowed::AllAndSaveToConfig: ggs.saveSettings(); break; case AddonChangeAllowed::All: case AddonChangeAllowed::WhitelistOnly: // send message via msgboxresult @@ -128,12 +128,12 @@ void iwAddons::msgButtonClick(const unsigned ctrl_id) break; } } - Close(); + close(); } break; case ID_btAbort: // Discard changes - Close(); + close(); break; case ID_btSavePreset: @@ -141,12 +141,12 @@ void iwAddons::msgButtonClick(const unsigned ctrl_id) std::map states; for(const auto& gui : addonGuis_) states[static_cast(gui->getAddon().getId())] = gui->getStatus(); - WINDOWMANAGER.Show(std::make_unique(std::move(states))); + WINDOWMANAGER.show(std::make_unique(std::move(states))); } break; case ID_btLoadPreset: - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( [this](const std::map& states) { applyAddonStates(states); })); break; @@ -161,7 +161,7 @@ void iwAddons::msgButtonClick(const unsigned ctrl_id) } } -void iwAddons::UpdateView(const AddonGroup selection) +void iwAddons::updateView(const AddonGroup selection) { auto* scrollbar = getCtrl(ID_scroll); const unsigned scrollPos = scrollbar->getScrollPos(); @@ -215,7 +215,7 @@ void iwAddons::msgOptionGroupChange(const unsigned ctrl_id, const unsigned selec case ID_grpAddonGroup: // richtige Kategorie anzeigen { getCtrl(ID_scroll)->setScrollPos(0); - UpdateView(static_cast(selection)); + updateView(static_cast(selection)); } break; } @@ -227,17 +227,17 @@ void iwAddons::msgOptionGroupChange(const unsigned ctrl_id, const unsigned selec void iwAddons::msgScrollChange(const unsigned /*ctrl_id*/, const unsigned short /*position*/) { auto* optiongroup = getCtrl(ID_grpAddonGroup); - UpdateView(static_cast(optiongroup->getSelection())); + updateView(static_cast(optiongroup->getSelection())); } bool iwAddons::msgWheelUp(const MouseCoords& /*mc*/) { - getCtrl(ID_scroll)->Scroll(-2); + getCtrl(ID_scroll)->scroll(-2); return true; } bool iwAddons::msgWheelDown(const MouseCoords& /*mc*/) { - getCtrl(ID_scroll)->Scroll(+2); + getCtrl(ID_scroll)->scroll(+2); return true; } diff --git a/libs/s25main/ingameWindows/iwAddons.h b/libs/s25main/ingameWindows/iwAddons.h index 22b83fa780..aad0439553 100644 --- a/libs/s25main/ingameWindows/iwAddons.h +++ b/libs/s25main/ingameWindows/iwAddons.h @@ -30,7 +30,7 @@ class iwAddons : public IngameWindow std::vector whitelistedAddons = {}); ~iwAddons() override; - void Close() override; + void close() override; protected: void msgButtonClick(unsigned ctrl_id) override; @@ -47,7 +47,7 @@ class iwAddons : public IngameWindow std::vector> addonGuis_; /// Aktualisiert die Addons, die angezeigt werden sollen - void UpdateView(AddonGroup selection); + void updateView(AddonGroup selection); bool isReadOnly(AddonId) const; void applyAddonStates(const std::map& states); }; diff --git a/libs/s25main/ingameWindows/iwBaseWarehouse.cpp b/libs/s25main/ingameWindows/iwBaseWarehouse.cpp index a7afd5d03b..af2c3b6c97 100644 --- a/libs/s25main/ingameWindows/iwBaseWarehouse.cpp +++ b/libs/s25main/ingameWindows/iwBaseWarehouse.cpp @@ -44,41 +44,41 @@ enum } iwBaseWarehouse::iwBaseWarehouse(GameWorldView& gwv, GameCommandFactory& gcFactory, nobBaseWarehouse* wh) - : iwWares(CGI_BUILDING + MapBase::CreateGUIID(wh->getPos()), IngameWindow::posAtMouse, 40, + : iwWares(CGI_BUILDING + MapBase::createGUIID(wh->getPos()), IngameWindow::posAtMouse, 40, _(BUILDING_NAMES[wh->getBuildingType()]), true, NormalFont, wh->getInventory(), gwv.getWorld().getPlayer(wh->getPlayer())), gwv(gwv), gcFactory(gcFactory), wh(wh) { - wh->AddListener(this); + wh->addListener(this); // Basisinitialisierungsänderungen background = LOADER.getImageN("resource", 41); // Auswahl für Auslagern/Einlagern Verbieten-Knöpfe - ctrlOptionGroup* group = AddOptionGroup(ID_STORE_SETTINGS_GROUP, GroupSelectType::Check); + ctrlOptionGroup* group = addOptionGroup(ID_STORE_SETTINGS_GROUP, GroupSelectType::Check); // Einlagern - group->AddImageButton(ID_COLLECT, DrawPoint(16, getFullSize().y - 81), Extent(32, 32), TextureColor::Grey, + group->addImageButton(ID_COLLECT, DrawPoint(16, getFullSize().y - 81), Extent(32, 32), TextureColor::Grey, LOADER.getImageN("io_new", 4), _("Collect")); // Auslagern - group->AddImageButton(ID_TAKEOUT, DrawPoint(52, getFullSize().y - 81), Extent(32, 32), TextureColor::Grey, + group->addImageButton(ID_TAKEOUT, DrawPoint(52, getFullSize().y - 81), Extent(32, 32), TextureColor::Grey, LOADER.getImageN("io", 211), _("Take out of store")); // Einlagern verbieten - group->AddImageButton(ID_STOP, DrawPoint(86, getFullSize().y - 81), Extent(32, 32), TextureColor::Grey, + group->addImageButton(ID_STOP, DrawPoint(86, getFullSize().y - 81), Extent(32, 32), TextureColor::Grey, LOADER.getImageN("io", 212), _("Stop storage")); // nix tun auswählen group->setSelection(ID_COLLECT); // Alle auswählen bzw setzen! - AddImageButton(ID_SELECT_ALL, DrawPoint(122, getFullSize().y - 81), Extent(32, 32), TextureColor::Grey, + addImageButton(ID_SELECT_ALL, DrawPoint(122, getFullSize().y - 81), Extent(32, 32), TextureColor::Grey, LOADER.getImageN("io", 223), _("Select all")); // "Gehe Zu Ort" - AddImageButton(ID_GOTO, DrawPoint(122, getFullSize().y - 47), Extent(15, 32), TextureColor::Grey, + addImageButton(ID_GOTO, DrawPoint(122, getFullSize().y - 47), Extent(15, 32), TextureColor::Grey, LOADER.getImageN("io_new", 10), _("Go to place")); // Go to next warehouse - AddImageButton(ID_GOTO_NEXT, DrawPoint(139, getFullSize().y - 47), Extent(15, 32), TextureColor::Grey, + addImageButton(ID_GOTO_NEXT, DrawPoint(139, getFullSize().y - 47), Extent(15, 32), TextureColor::Grey, LOADER.getImageN("io_new", 13), _("Go to next warehouse")); - UpdateOverlays(); + updateOverlays(); // Add demolish button if not HQ if(wh->getGOT() != GO_Type::NobHq) @@ -87,7 +87,7 @@ iwBaseWarehouse::iwBaseWarehouse(GameWorldView& gwv, GameCommandFactory& gcFacto getCtrl(ID_PAGINATE)->setWidth(32); getCtrl(ID_PAGINATE)->setPos(DrawPoint(86, getFullSize().y - 47)); - AddImageButton(ID_DEMOLISH, DrawPoint(52, getFullSize().y - 47), Extent(32, 32), TextureColor::Grey, + addImageButton(ID_DEMOLISH, DrawPoint(52, getFullSize().y - 47), Extent(32, 32), TextureColor::Grey, LOADER.getImageN("io", 23), _("Demolish house")); } } @@ -95,7 +95,7 @@ iwBaseWarehouse::iwBaseWarehouse(GameWorldView& gwv, GameCommandFactory& gcFacto iwBaseWarehouse::~iwBaseWarehouse() { if(wh) - wh->RemoveListener(this); + wh->removeListener(this); } void iwBaseWarehouse::msgGroupButtonClick(const unsigned group_id, const unsigned ctrl_id) @@ -119,12 +119,12 @@ void iwBaseWarehouse::msgGroupButtonClick(const unsigned group_id, const unsigne } auto setSetting = [this](auto what, EInventorySetting setting) { InventorySetting state = wh->getInventorySettingVisual(what); - state.Toggle(setting); + state.toggle(setting); if(gcFactory.SetInventorySetting(wh->getPos(), what, state)) { // optisch schonmal setzen wh->setInventorySettingVisual(what, state); - UpdateOverlay(rttr::enum_cast(what)); + updateOverlay(rttr::enum_cast(what)); } }; if(getCurPage() == warePageID) @@ -141,8 +141,8 @@ void iwBaseWarehouse::msgButtonClick(const unsigned ctrl_id) case ID_DEMOLISH: // Gebäude abreißen { // Abreißen? - Close(); - WINDOWMANAGER.Show(std::make_unique(gwv, wh)); + close(); + WINDOWMANAGER.show(std::make_unique(gwv, wh)); } break; case ID_SELECT_ALL: // "Alle auswählen" @@ -187,7 +187,7 @@ void iwBaseWarehouse::msgButtonClick(const unsigned ctrl_id) for(unsigned i = 0; i < count; i++) { if(states[i].isSet(data) != enable) - states[i].Toggle(data); + states[i].toggle(data); } if(gcFactory.SetAllInventorySettings(wh->getPos(), getCurPage() == peoplePageID, states)) @@ -202,18 +202,18 @@ void iwBaseWarehouse::msgButtonClick(const unsigned ctrl_id) for(const auto i : helpers::enumRange()) wh->setInventorySettingVisual(i, states[rttr::enum_cast(i)]); } - UpdateOverlays(); + updateOverlays(); } } break; case ID_HELP: // "Hilfe" { - WINDOWMANAGER.ReplaceWindow(std::make_unique(_(BUILDING_HELP_STRINGS[wh->getBuildingType()]))); + WINDOWMANAGER.replaceWindow(std::make_unique(_(BUILDING_HELP_STRINGS[wh->getBuildingType()]))); } break; case ID_GOTO: // "Gehe Zu Ort" { - gwv.MoveToMapPt(wh->getPos()); + gwv.moveToMapPt(wh->getPos()); } break; case ID_GOTO_NEXT: // go to next of same type @@ -228,24 +228,24 @@ void iwBaseWarehouse::msgButtonClick(const unsigned ctrl_id) { // close old window, open new window (todo: only open if it isnt already open), move to location of next // building - Close(); + close(); ++it; if(it == storehouses.end()) // was last entry in list -> goto first it = storehouses.begin(); - gwv.MoveToMapPt((*it)->getPos()); + gwv.moveToMapPt((*it)->getPos()); if((*it)->getBuildingType() == BuildingType::Headquarters) { - WINDOWMANAGER.ReplaceWindow(std::make_unique(gwv, gcFactory, *it)).setPos(getPos()); + WINDOWMANAGER.replaceWindow(std::make_unique(gwv, gcFactory, *it)).setPos(getPos()); } else if((*it)->getBuildingType() == BuildingType::HarborBuilding) { WINDOWMANAGER - .ReplaceWindow( + .replaceWindow( std::make_unique(gwv, gcFactory, dynamic_cast(*it))) .setPos(getPos()); } else if((*it)->getBuildingType() == BuildingType::Storehouse) { WINDOWMANAGER - .ReplaceWindow( + .replaceWindow( std::make_unique(gwv, gcFactory, dynamic_cast(*it))) .setPos(getPos()); } @@ -271,12 +271,12 @@ void iwBaseWarehouse::setPage(unsigned page) getCtrl(ID_SELECT_ALL)->setEnabled(showStorageSettings); } -void iwBaseWarehouse::UpdateOverlay(unsigned i) +void iwBaseWarehouse::updateOverlay(unsigned i) { - UpdateOverlay(i, getCurPage() == warePageID); + updateOverlay(i, getCurPage() == warePageID); } -void iwBaseWarehouse::UpdateOverlay(unsigned i, bool isWare) +void iwBaseWarehouse::updateOverlay(unsigned i, bool isWare) { auto* group = getCtrl(isWare ? warePageID : peoplePageID); // Einlagern verbieten-Bild (de)aktivieren @@ -298,7 +298,7 @@ void iwBaseWarehouse::UpdateOverlay(unsigned i, bool isWare) wh->isInventorySettingVisual(Job(i), EInventorySetting::Collect)); } -void iwBaseWarehouse::UpdateOverlays() +void iwBaseWarehouse::updateOverlays() { // Ein/Auslager Overlays entsprechend setzen for(unsigned char category = 0; category < 2; ++category) @@ -306,17 +306,17 @@ void iwBaseWarehouse::UpdateOverlays() unsigned count = (category == 0) ? helpers::NumEnumValues_v : helpers::NumEnumValues_v; for(unsigned i = 0; i < count; ++i) { - UpdateOverlay(i, category == 0); + updateOverlay(i, category == 0); } } } -void iwBaseWarehouse::OnChange(unsigned changeId) +void iwBaseWarehouse::onChange(unsigned changeId) { if(changeId == 0) { wh = nullptr; - Close(); + close(); } else if(changeId == 1) - UpdateOverlays(); + updateOverlays(); } diff --git a/libs/s25main/ingameWindows/iwBaseWarehouse.h b/libs/s25main/ingameWindows/iwBaseWarehouse.h index e7d780c2ba..2e68fb22c1 100644 --- a/libs/s25main/ingameWindows/iwBaseWarehouse.h +++ b/libs/s25main/ingameWindows/iwBaseWarehouse.h @@ -24,14 +24,14 @@ class iwBaseWarehouse : public iwWares, public IDataChangedListener iwBaseWarehouse(GameWorldView& gwv, GameCommandFactory& gcFactory, nobBaseWarehouse* wh); ~iwBaseWarehouse() override; - void OnChange(unsigned changeId) override; + void onChange(unsigned changeId) override; protected: /// Update displayed overlay (e.g. stop symbol) for the item at the current page - void UpdateOverlay(unsigned i); + void updateOverlay(unsigned i); /// Update displayed overlay (e.g. stop symbol) for the item of the given type - void UpdateOverlay(unsigned i, bool isWare); - void UpdateOverlays(); + void updateOverlay(unsigned i, bool isWare); + void updateOverlays(); void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; void msgButtonClick(unsigned ctrl_id) override; diff --git a/libs/s25main/ingameWindows/iwBuildOrder.cpp b/libs/s25main/ingameWindows/iwBuildOrder.cpp index d32bb0bc2d..d553b70d11 100644 --- a/libs/s25main/ingameWindows/iwBuildOrder.cpp +++ b/libs/s25main/ingameWindows/iwBuildOrder.cpp @@ -31,42 +31,42 @@ iwBuildOrder::iwBuildOrder(const GameWorldViewer& gwv) _("Building sequence"), LOADER.getImageN("io", 5)), gwv(gwv) { - ctrlList* list = AddList(0, DrawPoint(15, 60), Extent(150, 220), TextureColor::Grey, NormalFont); + ctrlList* list = addList(0, DrawPoint(15, 60), Extent(150, 220), TextureColor::Grey, NormalFont); fillBuildOrder(GAMECLIENT.visual_settings.build_order); for(const auto buildOrder : pendingBuildOrder) - list->AddItem(_(BUILDING_NAMES[buildOrder])); //-V807 + list->addItem(_(BUILDING_NAMES[buildOrder])); //-V807 // Nach ganz oben - AddImageButton(1, DrawPoint(250, 194), Extent(48, 20), TextureColor::Grey, LOADER.getImageN("io", 215), _("Top")); + addImageButton(1, DrawPoint(250, 194), Extent(48, 20), TextureColor::Grey, LOADER.getImageN("io", 215), _("Top")); // Hoch - AddImageButton(2, DrawPoint(250, 216), Extent(48, 20), TextureColor::Grey, LOADER.getImageN("io", 33), _("Up")); + addImageButton(2, DrawPoint(250, 216), Extent(48, 20), TextureColor::Grey, LOADER.getImageN("io", 33), _("Up")); // Runter - AddImageButton(3, DrawPoint(250, 238), Extent(48, 20), TextureColor::Grey, LOADER.getImageN("io", 34), _("Down")); + addImageButton(3, DrawPoint(250, 238), Extent(48, 20), TextureColor::Grey, LOADER.getImageN("io", 34), _("Down")); // Nach ganz unten - AddImageButton(4, DrawPoint(250, 260), Extent(48, 20), TextureColor::Grey, LOADER.getImageN("io", 216), + addImageButton(4, DrawPoint(250, 260), Extent(48, 20), TextureColor::Grey, LOADER.getImageN("io", 216), _("Bottom")); // Bild der Auswahl - AddImage(5, DrawPoint(240, 150), LOADER.getBuildingTex(gwv.getPlayer().nation, pendingBuildOrder[0])); + addImage(5, DrawPoint(240, 150), LOADER.getBuildingTex(gwv.getPlayer().nation, pendingBuildOrder[0])); - ctrlComboBox* combo = AddComboBox(6, DrawPoint(15, 30), Extent(290, 20), TextureColor::Grey, NormalFont, 100); - combo->AddItem(_("Sequence of given order")); // "Reihenfolge der Auftraggebung" - combo->AddItem(_("After the following order")); // "Nach folgender Reihenfolge" + ctrlComboBox* combo = addComboBox(6, DrawPoint(15, 30), Extent(290, 20), TextureColor::Grey, NormalFont, 100); + combo->addItem(_("Sequence of given order")); // "Reihenfolge der Auftraggebung" + combo->addItem(_("After the following order")); // "Nach folgender Reihenfolge" // Eintrag in Combobox auswählen useCustomBuildOrder = GAMECLIENT.visual_settings.useCustomBuildOrder; combo->setSelection(useCustomBuildOrder ? 1 : 0); // Standard - AddImageButton(10, DrawPoint(200, 250), Extent(48, 30), TextureColor::Grey, LOADER.getImageN("io", 191), + addImageButton(10, DrawPoint(200, 250), Extent(48, 30), TextureColor::Grey, LOADER.getImageN("io", 191), _("Default")); list->setSelection(0); } -void iwBuildOrder::TransmitSettings() +void iwBuildOrder::transmitSettings() { if(GAMECLIENT.isReplayModeOn()) return; @@ -201,11 +201,11 @@ void iwBuildOrder::msgButtonClick(const unsigned ctrl_id) fillBuildOrder(GAMECLIENT.default_settings.build_order); auto* list = getCtrl(0); - list->DeleteAllItems(); + list->deleteAllItems(); // Liste füllen for(unsigned char i = 0; i < 31; ++i) - list->AddItem(_(BUILDING_NAMES[pendingBuildOrder[i]])); + list->addItem(_(BUILDING_NAMES[pendingBuildOrder[i]])); list->setSelection(0); getCtrl(5)->setImage(LOADER.getBuildingTex(gwv.getPlayer().nation, pendingBuildOrder[0])); @@ -216,11 +216,11 @@ void iwBuildOrder::msgButtonClick(const unsigned ctrl_id) } } -void iwBuildOrder::UpdateSettings() +void iwBuildOrder::updateSettings() { if(GAMECLIENT.isReplayModeOn()) { - gwv.getPlayer().FillVisualSettings(GAMECLIENT.visual_settings); + gwv.getPlayer().fillVisualSettings(GAMECLIENT.visual_settings); fillBuildOrder(GAMECLIENT.visual_settings.build_order); useCustomBuildOrder = GAMECLIENT.visual_settings.useCustomBuildOrder; } diff --git a/libs/s25main/ingameWindows/iwBuildOrder.h b/libs/s25main/ingameWindows/iwBuildOrder.h index eb13d125ad..2d837e03d0 100644 --- a/libs/s25main/ingameWindows/iwBuildOrder.h +++ b/libs/s25main/ingameWindows/iwBuildOrder.h @@ -22,9 +22,9 @@ class iwBuildOrder final : public TransmitSettingsIgwAdapter private: /// Updates the control elements with the pending build order - void UpdateSettings() override; + void updateSettings() override; /// Sendet veränderte Einstellungen (an den Client), falls sie verändert wurden - void TransmitSettings() override; + void transmitSettings() override; void msgListSelectItem(unsigned ctrl_id, int selection) override; void msgButtonClick(unsigned ctrl_id) override; diff --git a/libs/s25main/ingameWindows/iwBuilding.cpp b/libs/s25main/ingameWindows/iwBuilding.cpp index b7c777b0e8..bfb4e03c35 100644 --- a/libs/s25main/ingameWindows/iwBuilding.cpp +++ b/libs/s25main/ingameWindows/iwBuilding.cpp @@ -30,18 +30,18 @@ const unsigned IODAT_BOAT_ID = 219; const unsigned IODAT_SHIP_ID = 218; iwBuilding::iwBuilding(GameWorldView& gwv, GameCommandFactory& gcFactory, nobUsual* const building, Extent extent) - : IngameWindow(CGI_BUILDING + MapBase::CreateGUIID(building->getPos()), IngameWindow::posAtMouse, extent, + : IngameWindow(CGI_BUILDING + MapBase::createGUIID(building->getPos()), IngameWindow::posAtMouse, extent, _(BUILDING_NAMES[building->getBuildingType()]), LOADER.getImageN("resource", 41)), gwv(gwv), gcFactory(gcFactory), building(building), productivity(building->getProductivity()) { // Arbeitersymbol - AddImage(0, DrawPoint(28, 39), LOADER.getMapTexture(2298)); + addImage(0, DrawPoint(28, 39), LOADER.getMapTexture(2298)); if(const auto job = BLD_WORK_DESC[building->getBuildingType()].job) - AddImage(13, DrawPoint(28, 39), LOADER.getJobTex(*job)); + addImage(13, DrawPoint(28, 39), LOADER.getJobTex(*job)); // Gebäudesymbol - AddImage(1, DrawPoint(117, 114), &building->getBuildingImage()); + addImage(1, DrawPoint(117, 114), &building->getBuildingImage()); // Symbol der produzierten Ware (falls hier was produziert wird) const auto& producedWare = BLD_WORK_DESC[building->getBuildingType()].producedWare; @@ -52,18 +52,18 @@ iwBuilding::iwBuilding(GameWorldView& gwv, GameCommandFactory& gcFactory, nobUsu producedWare); if(tex) { - AddImage(2, DrawPoint(196, 39), LOADER.getMapTexture(2298)); - AddImage(3, DrawPoint(196, 39), tex); + addImage(2, DrawPoint(196, 39), LOADER.getMapTexture(2298)); + addImage(3, DrawPoint(196, 39), tex); } // Info - AddImageButton(4, DrawPoint(16, extent.y - 47), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), + addImageButton(4, DrawPoint(16, extent.y - 47), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); // Abreißen - AddImageButton(5, DrawPoint(50, extent.y - 47), Extent(34, 32), TextureColor::Grey, LOADER.getImageN("io", 23), + addImageButton(5, DrawPoint(50, extent.y - 47), Extent(34, 32), TextureColor::Grey, LOADER.getImageN("io", 23), _("Demolish house")); // Produktivität einstellen (196,197) (bei Spähturm ausblenden) - Window* enable_productivity = AddImageButton( + Window* enable_productivity = addImageButton( 6, DrawPoint(90, extent.y - 47), Extent(34, 32), TextureColor::Grey, LOADER.getImageN("io", ((building->isProductionDisabledVirtual()) ? 197 : 196)), _("Production on/off")); if(building->getBuildingType() == BuildingType::LookoutTower) @@ -74,25 +74,25 @@ iwBuilding::iwBuilding(GameWorldView& gwv, GameCommandFactory& gcFactory, nobUsu // Jenachdem Boot oder Schiff anzeigen unsigned io_dat_id = (static_cast(building)->getMode() == nobShipYard::Mode::Boats) ? IODAT_BOAT_ID : IODAT_SHIP_ID; - AddImageButton(11, DrawPoint(130, extent.y - 47), Extent(43, 32), TextureColor::Grey, + addImageButton(11, DrawPoint(130, extent.y - 47), Extent(43, 32), TextureColor::Grey, LOADER.getImageN("io", io_dat_id), _("Ships/Boats")); } // "Gehe Zum Ort" - AddImageButton(7, DrawPoint(179, extent.y - 47), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 107), + addImageButton(7, DrawPoint(179, extent.y - 47), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 107), _("Go to place")); // Produktivitätsanzeige (bei Katapulten und Spähtürmen ausblenden) Window* productivity = - AddPercent(9, DrawPoint(59, 31), Extent(106, 16), TextureColor::Grey, 0xFFFFFF00, SmallFont, &this->productivity); + addPercent(9, DrawPoint(59, 31), Extent(106, 16), TextureColor::Grey, 0xFFFFFF00, SmallFont, &this->productivity); if(building->getBuildingType() == BuildingType::Catapult || building->getBuildingType() == BuildingType::LookoutTower) productivity->setVisible(false); - AddText(10, DrawPoint(113, 50), _("(House unoccupied)"), COLOR_RED, FontStyle::CENTER, NormalFont); + addText(10, DrawPoint(113, 50), _("(House unoccupied)"), COLOR_RED, FontStyle::CENTER, NormalFont); // "Go to next" (building of same type) - AddImageButton(12, DrawPoint(179, extent.y - 79), Extent(30, 32), TextureColor::Grey, + addImageButton(12, DrawPoint(179, extent.y - 79), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io_new", 11), _("Go to next building of same type")); } @@ -114,14 +114,14 @@ void iwBuilding::msgPaintAfter() // Bei Bergwerken sieht die Nahrungsanzeige ein wenig anders aus (3x 2) // "Schwarzer Rahmen" - DrawRectangle(Rect(getDrawPos() + DrawPoint(40, 60), Extent(144, 24)), 0x80000000); + drawRectangle(Rect(getDrawPos() + DrawPoint(40, 60), Extent(144, 24)), 0x80000000); DrawPoint curPos = getDrawPos() + DrawPoint(52, 72); for(unsigned char i = 0; i < bldWorkDesk.waresNeeded.size(); ++i) { for(unsigned char z = 0; z < bldWorkDesk.numSpacesPerWare; ++z) { LOADER.getWareTex(bldWorkDesk.waresNeeded[i]) - ->DrawFull(curPos, (z < building->getNumWares(i) ? 0xFFFFFFFF : 0xFF404040)); + ->drawFull(curPos, (z < building->getNumWares(i) ? 0xFFFFFFFF : 0xFF404040)); curPos.x += 24; } } @@ -134,19 +134,19 @@ void iwBuilding::msgPaintAfter() // "Schwarzer Rahmen" DrawPoint waresPos = curPos - DrawPoint(24 * wares_count / 2, 0); - DrawRectangle(Rect(waresPos, Extent(24 * wares_count, 24)), 0x80000000); + drawRectangle(Rect(waresPos, Extent(24 * wares_count, 24)), 0x80000000); waresPos += DrawPoint(12, 12); for(unsigned char z = 0; z < wares_count; ++z) { LOADER.getWareTex(bldWorkDesk.waresNeeded[i]) - ->DrawFull(waresPos, (z < building->getNumWares(i) ? COLOR_WHITE : 0xFF404040)); + ->drawFull(waresPos, (z < building->getNumWares(i) ? COLOR_WHITE : 0xFF404040)); waresPos.x += 24; } std::stringstream text; text << (unsigned)building->getNumWares(i) << "/" << wares_count; - NormalFont->Draw(curPos + DrawPoint(0, 12), text.str(), FontStyle::CENTER | FontStyle::VCENTER); + NormalFont->draw(curPos + DrawPoint(0, 12), text.str(), FontStyle::CENTER | FontStyle::VCENTER); curPos.y += 29; } } @@ -158,15 +158,15 @@ void iwBuilding::msgButtonClick(const unsigned ctrl_id) { case 4: // Hilfe { - WINDOWMANAGER.ReplaceWindow( + WINDOWMANAGER.replaceWindow( std::make_unique(_(BUILDING_HELP_STRINGS[building->getBuildingType()]))); } break; case 5: // Gebäude abbrennen { // Abreißen? - Close(); - WINDOWMANAGER.Show(std::make_unique(gwv, building)); + close(); + WINDOWMANAGER.show(std::make_unique(gwv, building)); } break; case 6: @@ -176,7 +176,7 @@ void iwBuilding::msgButtonClick(const unsigned ctrl_id) if(gcFactory.SetProductionEnabled(building->getPos(), building->isProductionDisabledVirtual())) { // visuell anzeigen, falls erfolgreich - building->ToggleProductionVirtual(); + building->toggleProductionVirtual(); // anderes Bild auf dem Button if(building->isProductionDisabledVirtual()) @@ -194,7 +194,7 @@ void iwBuilding::msgButtonClick(const unsigned ctrl_id) break; case 7: // "Gehe Zum Ort" { - gwv.MoveToMapPt(building->getPos()); + gwv.moveToMapPt(building->getPos()); } break; case 11: // Schiff/Boot umstellen bei Schiffsbauer @@ -224,16 +224,16 @@ void iwBuilding::msgButtonClick(const unsigned ctrl_id) { // close old window, open new window (todo: only open if it isnt already open), move to location of next // building - Close(); + close(); ++it; if(it == buildings.end()) // was last entry in list -> goto first it = buildings.begin(); - gwv.MoveToMapPt((*it)->getPos()); + gwv.moveToMapPt((*it)->getPos()); if(building->getBuildingType() == BuildingType::Temple) - WINDOWMANAGER.ReplaceWindow(std::make_unique(gwv, gcFactory, *it)) + WINDOWMANAGER.replaceWindow(std::make_unique(gwv, gcFactory, *it)) .setPos(getPos()); else - WINDOWMANAGER.ReplaceWindow(std::make_unique(gwv, gcFactory, *it)).setPos(getPos()); + WINDOWMANAGER.replaceWindow(std::make_unique(gwv, gcFactory, *it)).setPos(getPos()); break; } } diff --git a/libs/s25main/ingameWindows/iwBuildingProductivities.cpp b/libs/s25main/ingameWindows/iwBuildingProductivities.cpp index 4b79057d11..51a24fb7f9 100644 --- a/libs/s25main/ingameWindows/iwBuildingProductivities.cpp +++ b/libs/s25main/ingameWindows/iwBuildingProductivities.cpp @@ -64,7 +64,7 @@ iwBuildingProductivities::iwBuildingProductivities(const GamePlayer& player) { setBuildingOrder(); const unsigned numRows = helpers::divCeil(usedIcons.size(), 2); - Resize(cellSize * Extent(2, numRows + 1) + bldProdContentOffset); + resize(cellSize * Extent(2, numRows + 1) + bldProdContentOffset); const Nation playerNation = player.nation; unsigned curIdx = 0; @@ -79,17 +79,17 @@ iwBuildingProductivities::iwBuildingProductivities(const GamePlayer& player) const unsigned imgId = curIdx * 2; if(player.isBuildingEnabled(usedIcons[curIdx])) { - AddImage(imgId, imgPos, LOADER.getNationIcon(playerNation, usedIcons[curIdx]), + addImage(imgId, imgPos, LOADER.getNationIcon(playerNation, usedIcons[curIdx]), _(BUILDING_NAMES[usedIcons[curIdx]])); DrawPoint percentPos = curPos + DrawPoint(image_percent_x, 0); - AddPercent(imgId + 1, percentPos, percentSize, TextureColor::Grey, COLOR_YELLOW, SmallFont, + addPercent(imgId + 1, percentPos, percentSize, TextureColor::Grey, COLOR_YELLOW, SmallFont, &percents[usedIcons[curIdx]]); } else - AddImage(imgId, imgPos, LOADER.getImageN("io", 188)); + addImage(imgId, imgPos, LOADER.getImageN("io", 188)); } } - UpdatePercents(); + updatePercents(); // Hilfe-Button // Original S2 does not have a Help button in this window. Add it if you have something to say. @@ -98,13 +98,13 @@ iwBuildingProductivities::iwBuildingProductivities(const GamePlayer& player) // _("Help")); } -void iwBuildingProductivities::UpdatePercents() +void iwBuildingProductivities::updatePercents() { - percents = player.getBuildingRegister().CalcProductivities(); + percents = player.getBuildingRegister().calcProductivities(); } void iwBuildingProductivities::msgPaintAfter() { IngameWindow::msgPaintAfter(); - UpdatePercents(); + updatePercents(); } diff --git a/libs/s25main/ingameWindows/iwBuildingProductivities.h b/libs/s25main/ingameWindows/iwBuildingProductivities.h index dfaf7b72bc..7bea05ecd3 100644 --- a/libs/s25main/ingameWindows/iwBuildingProductivities.h +++ b/libs/s25main/ingameWindows/iwBuildingProductivities.h @@ -23,7 +23,7 @@ class iwBuildingProductivities : public IngameWindow static const std::array allIcons; private: - void UpdatePercents(); + void updatePercents(); void msgPaintAfter() override; void setBuildingOrder(); diff --git a/libs/s25main/ingameWindows/iwBuildingSite.cpp b/libs/s25main/ingameWindows/iwBuildingSite.cpp index d0336275ff..9b9bb5bbe0 100644 --- a/libs/s25main/ingameWindows/iwBuildingSite.cpp +++ b/libs/s25main/ingameWindows/iwBuildingSite.cpp @@ -16,24 +16,24 @@ #include "gameData/const_gui_ids.h" iwBuildingSite::iwBuildingSite(GameWorldView& gwv, const noBuildingSite* const buildingsite) - : IngameWindow(CGI_BUILDING + MapBase::CreateGUIID(buildingsite->getPos()), IngameWindow::posAtMouse, + : IngameWindow(CGI_BUILDING + MapBase::createGUIID(buildingsite->getPos()), IngameWindow::posAtMouse, Extent(226, 194), _(BUILDING_NAMES[buildingsite->getBuildingType()]), LOADER.getImageN("resource", 41)), gwv(gwv), buildingsite(buildingsite) { // Bild des Gebäudes - AddImage(0, DrawPoint(113, 130), &buildingsite->getBuildingImage()); + addImage(0, DrawPoint(113, 130), &buildingsite->getBuildingImage()); // Gebäudename - AddText(1, DrawPoint(113, 44), _("Order of building site"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); + addText(1, DrawPoint(113, 44), _("Order of building site"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); // Hilfe - AddImageButton(2, DrawPoint(16, 147), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); + addImageButton(2, DrawPoint(16, 147), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); // Gebäude abbrennen - AddImageButton(3, DrawPoint(50, 147), Extent(34, 32), TextureColor::Grey, LOADER.getImageN("io", 23), + addImageButton(3, DrawPoint(50, 147), Extent(34, 32), TextureColor::Grey, LOADER.getImageN("io", 23), _("Demolish house")); // "Gehe Zu Ort" - AddImageButton(4, DrawPoint(179, 147), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 107), + addImageButton(4, DrawPoint(179, 147), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 107), _("Go to place")); } @@ -43,20 +43,20 @@ void iwBuildingSite::msgButtonClick(const unsigned ctrl_id) { case 2: // Hilfe { - WINDOWMANAGER.ReplaceWindow( + WINDOWMANAGER.replaceWindow( std::make_unique(_(BUILDING_HELP_STRINGS[buildingsite->getBuildingType()]))); } break; case 3: // Gebäude abbrennen { // Abreißen? - Close(); - WINDOWMANAGER.Show(std::make_unique(gwv, buildingsite)); + close(); + WINDOWMANAGER.show(std::make_unique(gwv, buildingsite)); } break; case 4: // "Gehe Zu Ort" { - gwv.MoveToMapPt(buildingsite->getPos()); + gwv.moveToMapPt(buildingsite->getPos()); } break; } @@ -90,18 +90,18 @@ void iwBuildingSite::msgPaintAfter() // "Schwarzer Rahmen" DrawPoint waresPos = curPos - DrawPoint(24 * wares_count / 2, 0); - DrawRectangle(Rect(waresPos, Extent(24 * wares_count, 24)), 0x80000000); + drawRectangle(Rect(waresPos, Extent(24 * wares_count, 24)), 0x80000000); waresPos += DrawPoint(12, 12); // Die Waren for(unsigned char z = 0; z < wares_count; ++z) { LOADER.getWareTex(i == 0 ? GoodType::Boards : GoodType::Stones) - ->DrawFull(waresPos, (z < wares_delivered ? 0xFFFFFFFF : 0xFF404040)); + ->drawFull(waresPos, (z < wares_delivered ? 0xFFFFFFFF : 0xFF404040)); // Hammer wenn Ware verbaut if(z < wares_used) - LOADER.getWareTex(GoodType::Hammer)->DrawFull(waresPos); + LOADER.getWareTex(GoodType::Hammer)->drawFull(waresPos); waresPos.x += 24; } curPos.y += 29; diff --git a/libs/s25main/ingameWindows/iwBuildings.cpp b/libs/s25main/ingameWindows/iwBuildings.cpp index 1314638fa5..84e7db3997 100644 --- a/libs/s25main/ingameWindows/iwBuildings.cpp +++ b/libs/s25main/ingameWindows/iwBuildings.cpp @@ -75,7 +75,7 @@ iwBuildings::iwBuildings(GameWorldView& gwv, GameCommandFactory& gcFactory) gwv(gwv), gcFactory(gcFactory) { setBuildingOrder(); - Resize(iconSpacing * Extent(4, helpers::divCeil(bts.size(), 4) + 1) + bldContentOffset); + resize(iconSpacing * Extent(4, helpers::divCeil(bts.size(), 4) + 1) + bldContentOffset); const Nation playerNation = gwv.getViewer().getPlayer().nation; // Symbole für die einzelnen Gebäude erstellen @@ -88,14 +88,14 @@ iwBuildings::iwBuildings(GameWorldView& gwv, GameCommandFactory& gcFactory) Extent btSize = Extent(32, 32); DrawPoint btPos = bldContentOffset - btSize / 2 + iconSpacing * DrawPoint(x, y); - AddImageButton(ID_BuildingsStart + y * 4 + x, btPos, btSize, TextureColor::Grey, + addImageButton(ID_BuildingsStart + y * 4 + x, btPos, btSize, TextureColor::Grey, LOADER.getNationIcon(playerNation, bts[y * 4 + x]), _(BUILDING_NAMES[bts[y * 4 + x]])); } } // "Help" button Extent btSize = Extent(30, 32); - AddImageButton(ID_Help, getFullSize() - DrawPoint(14, 20) - btSize, btSize, TextureColor::Grey, + addImageButton(ID_Help, getFullSize() - DrawPoint(14, 20) - btSize, btSize, TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); } @@ -118,7 +118,7 @@ void iwBuildings::msgPaintAfter() break; fmt % bc.buildings[bts[y * 4 + x]] % bc.buildingSites[bts[y * 4 + x]]; - NormalFont->Draw(curPos, fmt.str(), FontStyle::CENTER, COLOR_YELLOW); + NormalFont->draw(curPos, fmt.str(), FontStyle::CENTER, COLOR_YELLOW); curPos.x += iconSpacing.x; } rowPos.y += iconSpacing.y; @@ -129,7 +129,7 @@ void iwBuildings::msgButtonClick(const unsigned ctrl_id) { if(ctrl_id == ID_Help) // Help button { - WINDOWMANAGER.ReplaceWindow( + WINDOWMANAGER.replaceWindow( std::make_unique(_("The building statistics window gives you an insight into " "the number of buildings you have, by type. The number on " "the left is the total number of this type of building " @@ -144,28 +144,28 @@ void iwBuildings::msgButtonClick(const unsigned ctrl_id) BuildingType bldType = bts[ctrl_id - ID_BuildingsStart]; if(BuildingProperties::isMilitary(bldType)) - GoToFirstMatching(bldType, buildingRegister.getMilitaryBuildings()); + goToFirstMatching(bldType, buildingRegister.getMilitaryBuildings()); else if(bldType == BuildingType::HarborBuilding) - GoToFirstMatching(bldType, buildingRegister.getHarbors()); + goToFirstMatching(bldType, buildingRegister.getHarbors()); else if(BuildingProperties::isWareHouse(bldType)) - GoToFirstMatching(bldType, buildingRegister.getStorehouses()); + goToFirstMatching(bldType, buildingRegister.getStorehouses()); else if(bldType == BuildingType::Temple) - GoToFirstMatching(bldType, buildingRegister.getBuildings(bldType)); + goToFirstMatching(bldType, buildingRegister.getBuildings(bldType)); else - GoToFirstMatching(bldType, buildingRegister.getBuildings(bldType)); + goToFirstMatching(bldType, buildingRegister.getBuildings(bldType)); } template -void iwBuildings::GoToFirstMatching(BuildingType bldType, const std::list& blds) +void iwBuildings::goToFirstMatching(BuildingType bldType, const std::list& blds) { for(T_Building* bld : blds) { if(bld->getBuildingType() == bldType) { - gwv.MoveToMapPt(bld->getPos()); + gwv.moveToMapPt(bld->getPos()); auto nextscrn = std::make_unique(gwv, gcFactory, static_cast(bld)); nextscrn->setPos(getPos()); - WINDOWMANAGER.ReplaceWindow(std::move(nextscrn)); + WINDOWMANAGER.replaceWindow(std::move(nextscrn)); return; } } diff --git a/libs/s25main/ingameWindows/iwBuildings.h b/libs/s25main/ingameWindows/iwBuildings.h index ddd6716766..cc37c355dc 100644 --- a/libs/s25main/ingameWindows/iwBuildings.h +++ b/libs/s25main/ingameWindows/iwBuildings.h @@ -27,7 +27,7 @@ class iwBuildings : public IngameWindow void msgButtonClick(unsigned ctrl_id) override; template - void GoToFirstMatching(BuildingType bldType, const std::list& blds); + void goToFirstMatching(BuildingType bldType, const std::list& blds); void setBuildingOrder(); std::vector bts; diff --git a/libs/s25main/ingameWindows/iwChat.cpp b/libs/s25main/ingameWindows/iwChat.cpp index 1c98ce07ce..5be7b9c981 100644 --- a/libs/s25main/ingameWindows/iwChat.cpp +++ b/libs/s25main/ingameWindows/iwChat.cpp @@ -19,17 +19,17 @@ iwChat::iwChat(Window* parent) LOADER.getImageN("resource", 41), false, CloseBehavior::Regular, parent) { // Eingabefeld für Chattext - AddEdit(0, DrawPoint(20, 30), Extent(260, 22), TextureColor::Grey, NormalFont); + addEdit(0, DrawPoint(20, 30), Extent(260, 22), TextureColor::Grey, NormalFont); - ctrlOptionGroup* group = AddOptionGroup(1, GroupSelectType::Check); + ctrlOptionGroup* group = addOptionGroup(1, GroupSelectType::Check); // "Alle" - group->AddTextButton(rttr::enum_cast(ChatDestination::All), DrawPoint(20, 80), Extent(260, 22), TextureColor::Grey, + group->addTextButton(rttr::enum_cast(ChatDestination::All), DrawPoint(20, 80), Extent(260, 22), TextureColor::Grey, _("All"), NormalFont); // "Verbündete" - group->AddTextButton(rttr::enum_cast(ChatDestination::Allies), DrawPoint(20, 112), Extent(125, 22), + group->addTextButton(rttr::enum_cast(ChatDestination::Allies), DrawPoint(20, 112), Extent(125, 22), TextureColor::Green2, _("Allies"), NormalFont); // "Feinde" - group->AddTextButton(rttr::enum_cast(ChatDestination::Enemies), DrawPoint(155, 112), Extent(125, 22), + group->addTextButton(rttr::enum_cast(ChatDestination::Enemies), DrawPoint(155, 112), Extent(125, 22), TextureColor::Red1, _("Enemies"), NormalFont); // Entspr. vom letzten Mal auswählen auswählen @@ -51,7 +51,7 @@ void iwChat::msgOptionGroupChange(const unsigned /*ctrl_id*/, unsigned selection void iwChat::msgEditEnter(const unsigned /*ctrl_id*/) { - Close(); + close(); auto* edit = getCtrl(0); std::string text = edit->getText(); @@ -61,7 +61,7 @@ void iwChat::msgEditEnter(const unsigned /*ctrl_id*/) { auto* listener = dynamic_cast(getParent()); if(listener) - listener->OnChatCommand(text.substr(1)); + listener->onChatCommand(text.substr(1)); } else GAMECLIENT.commandChat(text, ChatDestination(lastChatDestination)); } diff --git a/libs/s25main/ingameWindows/iwChat.h b/libs/s25main/ingameWindows/iwChat.h index cf4d51e70d..7684cef3ac 100644 --- a/libs/s25main/ingameWindows/iwChat.h +++ b/libs/s25main/ingameWindows/iwChat.h @@ -9,7 +9,7 @@ class IChatCmdListener { public: - virtual void OnChatCommand(const std::string& cmd) = 0; + virtual void onChatCommand(const std::string& cmd) = 0; }; class iwChat : public IngameWindow diff --git a/libs/s25main/ingameWindows/iwConnecting.cpp b/libs/s25main/ingameWindows/iwConnecting.cpp index 4836d3e005..c9ac4a94f8 100644 --- a/libs/s25main/ingameWindows/iwConnecting.cpp +++ b/libs/s25main/ingameWindows/iwConnecting.cpp @@ -30,26 +30,26 @@ iwConnecting::iwConnecting(ServerType serverType, std::unique_ptr { WINDOWMANAGER.setCursor(Cursor::Moon); - AddText(ID_txtStatus, DrawPoint(150, 30), _("Please wait..."), COLOR_YELLOW, FontStyle::CENTER, NormalFont); - AddPercent(ID_prgLoad, DrawPoint(20, 50), Extent(260, 26), TextureColor::Grey, COLOR_YELLOW, SmallFont, + addText(ID_txtStatus, DrawPoint(150, 30), _("Please wait..."), COLOR_YELLOW, FontStyle::CENTER, NormalFont); + addPercent(ID_prgLoad, DrawPoint(20, 50), Extent(260, 26), TextureColor::Grey, COLOR_YELLOW, SmallFont, &downloadProgress_) ->setVisible(false); - AddTextButton(ID_btAbort, DrawPoint(87, 80), Extent(125, 22), TextureColor::Red1, _("Abort"), NormalFont); + addTextButton(ID_btAbort, DrawPoint(87, 80), Extent(125, 22), TextureColor::Red1, _("Abort"), NormalFont); GAMECLIENT.setInterface(this); } -void iwConnecting::Close() +void iwConnecting::close() { - IngameWindow::Close(); + IngameWindow::close(); WINDOWMANAGER.setCursor(); - GAMECLIENT.RemoveInterface(this); + GAMECLIENT.removeInterface(this); } void iwConnecting::msgButtonClick(unsigned ctrlId) { RTTR_Assert(ctrlId == ID_btAbort); - GAMECLIENT.Stop(); + GAMECLIENT.stop(); CI_Error(ClientError::ConnectionLost); } @@ -57,11 +57,11 @@ void iwConnecting::CI_Error(const ClientError ce) { if(onError.empty()) { - WINDOWMANAGER.Show(std::make_unique(_("Error"), ClientErrorToStr(ce), nullptr, MsgboxButton::Ok, + WINDOWMANAGER.show(std::make_unique(_("Error"), clientErrorToStr(ce), nullptr, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, 0)); } else onError(ce); - Close(); + close(); } void iwConnecting::CI_NextConnectState(const ConnectState cs) @@ -85,7 +85,7 @@ void iwConnecting::CI_NextConnectState(const ConnectState cs) case ConnectState::Finished: WINDOWMANAGER.Switch(std::make_unique(serverType_, GAMECLIENT.getGameLobby(), GAMECLIENT.getPlayerId(), std::move(lobbyClient_))); - Close(); + close(); break; } } diff --git a/libs/s25main/ingameWindows/iwConnecting.h b/libs/s25main/ingameWindows/iwConnecting.h index 36bc3fed74..8c3f7edd93 100644 --- a/libs/s25main/ingameWindows/iwConnecting.h +++ b/libs/s25main/ingameWindows/iwConnecting.h @@ -22,7 +22,7 @@ class iwConnecting : public IngameWindow, public ClientInterface /// If unset an error message box is shown boost::signals2::signal onError; - void Close() override; + void close() override; void msgButtonClick(unsigned ctrlId) override; private: diff --git a/libs/s25main/ingameWindows/iwDemolishBuilding.cpp b/libs/s25main/ingameWindows/iwDemolishBuilding.cpp index 857f0296bf..7316eb70dc 100644 --- a/libs/s25main/ingameWindows/iwDemolishBuilding.cpp +++ b/libs/s25main/ingameWindows/iwDemolishBuilding.cpp @@ -14,22 +14,22 @@ #include "gameData/const_gui_ids.h" iwDemolishBuilding::iwDemolishBuilding(GameWorldView& gwv, const noBaseBuilding* building, const bool flag) - : IngameWindow(CGI_BUILDING + MapBase::CreateGUIID(building->getPos()), IngameWindow::posAtMouse, Extent(200, 200), + : IngameWindow(CGI_BUILDING + MapBase::createGUIID(building->getPos()), IngameWindow::posAtMouse, Extent(200, 200), _("Demolish?"), LOADER.getImageN("resource", 41)), gwv(gwv), building(building), flag(flag) { // Ja - AddImageButton(0, DrawPoint(14, 140), Extent(66, 40), TextureColor::Red1, LOADER.getImageN("io", 32), + addImageButton(0, DrawPoint(14, 140), Extent(66, 40), TextureColor::Red1, LOADER.getImageN("io", 32), _("Yes")); //-V525 // Nein - AddImageButton(1, DrawPoint(82, 140), Extent(66, 40), TextureColor::Grey, LOADER.getImageN("io", 40), _("No")); + addImageButton(1, DrawPoint(82, 140), Extent(66, 40), TextureColor::Grey, LOADER.getImageN("io", 40), _("No")); // Gehe zum Standort - AddImageButton(2, DrawPoint(150, 140), Extent(36, 40), TextureColor::Grey, LOADER.getImageN("io", 107), + addImageButton(2, DrawPoint(150, 140), Extent(36, 40), TextureColor::Grey, LOADER.getImageN("io", 107), _("Go to place")); // Gebäudebild - AddImage(3, DrawPoint(104, 109), &building->getBuildingImage()); + addImage(3, DrawPoint(104, 109), &building->getBuildingImage()); // Gebäudename - AddText(4, DrawPoint(100, 125), _(BUILDING_NAMES[building->getBuildingType()]), 0xFFFFFF00, FontStyle::CENTER, + addText(4, DrawPoint(100, 125), _(BUILDING_NAMES[building->getBuildingType()]), 0xFFFFFF00, FontStyle::CENTER, NormalFont); } @@ -51,19 +51,19 @@ void iwDemolishBuilding::msgButtonClick(const unsigned ctrl_id) } if(success) - Close(); + close(); } break; case 1: { // Einfach schließen - Close(); + close(); } break; case 2: { // Zum Ort gehen - gwv.MoveToMapPt(building->getPos()); + gwv.moveToMapPt(building->getPos()); } break; } diff --git a/libs/s25main/ingameWindows/iwDiplomacy.cpp b/libs/s25main/ingameWindows/iwDiplomacy.cpp index 3bbecd0f9d..a5c7569a5f 100644 --- a/libs/s25main/ingameWindows/iwDiplomacy.cpp +++ b/libs/s25main/ingameWindows/iwDiplomacy.cpp @@ -47,9 +47,9 @@ iwDiplomacy::iwDiplomacy(const GameWorldViewer& gwv, GameCommandFactory& gcFacto gwv(gwv), gcFactory(gcFactory) { // "Header" der Tabelle - AddText(0, DrawPoint(LINE_DISTANCE_TO_MARGINS + PING_FIELD_POS, HEADER_Y), _("Ping"), COLOR_YELLOW, + addText(0, DrawPoint(LINE_DISTANCE_TO_MARGINS + PING_FIELD_POS, HEADER_Y), _("Ping"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); - AddText(1, DrawPoint(LINE_DISTANCE_TO_MARGINS + TREATIES_POS, HEADER_Y), _("Treaties"), COLOR_YELLOW, + addText(1, DrawPoint(LINE_DISTANCE_TO_MARGINS + TREATIES_POS, HEADER_Y), _("Treaties"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); DrawPoint curTxtPos(LINE_DISTANCE_TO_MARGINS + 10, FIRST_LINE_Y + CELL_HEIGHT / 2 - CELL_HEIGHT - SPACE_HEIGHT); @@ -60,13 +60,13 @@ iwDiplomacy::iwDiplomacy(const GameWorldViewer& gwv, GameCommandFactory& gcFacto if(!player.isUsed()) continue; // Einzelne Spielernamen - AddText(100 + i, curTxtPos, player.name, player.color, FontStyle::VCENTER, NormalFont); + addText(100 + i, curTxtPos, player.name, player.color, FontStyle::VCENTER, NormalFont); if(player.ps == PlayerState::Occupied) { // Ping DrawPoint pingPos(LINE_DISTANCE_TO_MARGINS + PING_FIELD_POS - PING_FIELD_SIZE.x / 2, curTxtPos.y); - AddTextDeepening(200 + i, pingPos, PING_FIELD_SIZE, TextureColor::Grey, "0", NormalFont, COLOR_YELLOW); + addTextDeepening(200 + i, pingPos, PING_FIELD_SIZE, TextureColor::Grey, "0", NormalFont, COLOR_YELLOW); } // An sich selber braucht man keine Bündnisse zu schließen @@ -77,20 +77,20 @@ iwDiplomacy::iwDiplomacy(const GameWorldViewer& gwv, GameCommandFactory& gcFacto Extent btSize(40, 40); DrawPoint btPos(LINE_DISTANCE_TO_MARGINS + TREATIES_POS - TREATIE_BUTTON_SPACE / 2 - (image->getWidth() + 8), curTxtPos.y - btSize.y / 2); - ctrlButton* button = AddImageButton(300 + i, btPos, btSize, TextureColor::Grey, image, _("Treaty of alliance")); + ctrlButton* button = addImageButton(300 + i, btPos, btSize, TextureColor::Grey, image, _("Treaty of alliance")); // Verbleibende Zeit unter dem Button DrawPoint remainingTimePos = button->getPos() + DrawPoint(btSize.x / 2, btSize.y + 4); - AddText(500 + i, remainingTimePos, "", COLOR_YELLOW, FontStyle::CENTER, SmallFont); + addText(500 + i, remainingTimePos, "", COLOR_YELLOW, FontStyle::CENTER, SmallFont); // Nichtangriffspakt image = LOADER.getImageN("io", 100); btPos.x = LINE_DISTANCE_TO_MARGINS + TREATIES_POS + TREATIE_BUTTON_SPACE / 2; - button = AddImageButton(400 + i, btPos, btSize, TextureColor::Grey, image, _("Non-aggression pact")); + button = addImageButton(400 + i, btPos, btSize, TextureColor::Grey, image, _("Non-aggression pact")); // Verbleibende Zeit unter dem Button remainingTimePos = button->getPos() + DrawPoint(btSize.x / 2, btSize.y + 4); - AddText(600 + i, remainingTimePos, "", COLOR_YELLOW, FontStyle::CENTER, SmallFont); + addText(600 + i, remainingTimePos, "", COLOR_YELLOW, FontStyle::CENTER, SmallFont); } // Farben festlegen msgPaintAfter(); @@ -108,7 +108,7 @@ void iwDiplomacy::msgPaintBefore() for(unsigned i = 0; i < gwv.getWorld().getNumPlayers(); ++i) { // Rechtecke in Spielerfarbe malen mit entsprechender Transparenz - DrawRectangle(curRect, SetAlpha(gwv.getWorld().getPlayer(i).color, 0x40)); + drawRectangle(curRect, SetAlpha(gwv.getWorld().getPlayer(i).color, 0x40)); curRect.move(DrawPoint(0, CELL_HEIGHT + SPACE_HEIGHT)); // Farben der Bündnis-Buttons setzen, je nachdem wie der Status ist @@ -138,7 +138,7 @@ void iwDiplomacy::msgPaintBefore() // Überhaupt ein Bündnis abgeschlossen und Bündnis nicht für die Ewigkeit? if(duration > 0 && duration != DURATION_INFINITE) // Dann entsprechende Zeit setzen - getCtrl(500 + z * 100 + i)->setText(GAMECLIENT.FormatGFTime(duration)); + getCtrl(500 + z * 100 + i)->setText(GAMECLIENT.formatGFTime(duration)); else // Ansonsten leer getCtrl(500 + z * 100 + i)->setText(""); @@ -151,7 +151,7 @@ void iwDiplomacy::msgButtonClick(const unsigned ctrl_id) { if(gwv.getWorld().getGGS().lockedTeams) { - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Teams locked"), _("As the teams are locked, you cannot make treaties of any kind."), nullptr, MsgboxButton::Ok, MsgboxIcon::ExclamationGreen, 1)); return; @@ -164,7 +164,7 @@ void iwDiplomacy::msgButtonClick(const unsigned ctrl_id) // Noch kein Bündnis abgeschlossen? if(gwv.getPlayer().getPactState(PactType::TreatyOfAlliance, playerId) == PactState::None) // Dann neues Bündnis vorschlagen - WINDOWMANAGER.ReplaceWindow(std::make_unique(PactType::TreatyOfAlliance, + WINDOWMANAGER.replaceWindow(std::make_unique(PactType::TreatyOfAlliance, gwv.getWorld().getPlayer(playerId), gcFactory)); else // ansonsten Vertrag versuchen abzubrechen @@ -177,7 +177,7 @@ void iwDiplomacy::msgButtonClick(const unsigned ctrl_id) // Noch kein Bündnis abgeschlossen? if(gwv.getPlayer().getPactState(PactType::NonAgressionPact, playerId) == PactState::None) // Dann neues Bündnis vorschlagen - WINDOWMANAGER.ReplaceWindow(std::make_unique(PactType::NonAgressionPact, + WINDOWMANAGER.replaceWindow(std::make_unique(PactType::NonAgressionPact, gwv.getWorld().getPlayer(playerId), gcFactory)); else // ansonsten Vertrag versuchen abzubrechen @@ -217,27 +217,27 @@ iwSuggestPact::iwSuggestPact(const PactType pt, const GamePlayer& player, GameCo // Bild als Orientierung, welchen Vertrag wir gerade bearbeiten if(image) - this->AddImage(0, DrawPoint(55, 100), image); + this->addImage(0, DrawPoint(55, 100), image); - AddText(1, DrawPoint(100, 30), _("Contract type:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddText(2, DrawPoint(100, 45), _(PACT_NAMES[pt]), COLOR_GREEN, FontStyle{}, NormalFont); - AddText(3, DrawPoint(100, 70), _("To player:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddText(4, DrawPoint(100, 85), player.name, player.color, FontStyle{}, NormalFont); - AddText(5, DrawPoint(100, 110), _("Duration:"), COLOR_YELLOW, FontStyle{}, NormalFont); - ctrlComboBox* combo = AddComboBox(6, DrawPoint(100, 125), Extent(190, 22), TextureColor::Green2, NormalFont, 100); + addText(1, DrawPoint(100, 30), _("Contract type:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addText(2, DrawPoint(100, 45), _(PACT_NAMES[pt]), COLOR_GREEN, FontStyle{}, NormalFont); + addText(3, DrawPoint(100, 70), _("To player:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addText(4, DrawPoint(100, 85), player.name, player.color, FontStyle{}, NormalFont); + addText(5, DrawPoint(100, 110), _("Duration:"), COLOR_YELLOW, FontStyle{}, NormalFont); + ctrlComboBox* combo = addComboBox(6, DrawPoint(100, 125), Extent(190, 22), TextureColor::Green2, NormalFont, 100); // Zeiten zur Combobox hinzufügen for(unsigned i = 0; i < NUM_DURATIONS; ++i) { - combo->AddItem(helpers::format("%s (%s)", DURATION_NAMES[i], GAMECLIENT.FormatGFTime(DURATIONS[i]))); + combo->addItem(helpers::format("%s (%s)", DURATION_NAMES[i], GAMECLIENT.formatGFTime(DURATIONS[i]))); } // Erstes Item in der Combobox vorerst auswählen combo->setSelection(0); // Option "ewig" noch hinzufügen - combo->AddItem(_("Eternal")); + combo->addItem(_("Eternal")); - AddTextButton(7, DrawPoint(110, 170), Extent(100, 22), TextureColor::Green2, _("Confirm"), NormalFont); + addTextButton(7, DrawPoint(110, 170), Extent(100, 22), TextureColor::Green2, _("Confirm"), NormalFont); } void iwSuggestPact::msgButtonClick(const unsigned /*ctrl_id*/) @@ -246,5 +246,5 @@ void iwSuggestPact::msgButtonClick(const unsigned /*ctrl_id*/) const unsigned selected_id = getCtrl(6)->getSelection().value(); const unsigned duration = (selected_id == NUM_DURATIONS) ? DURATION_INFINITE : DURATIONS[selected_id]; if(gcFactory.SuggestPact(player.getPlayerId(), this->pt, duration)) - Close(); + close(); } diff --git a/libs/s25main/ingameWindows/iwDirectIPConnect.cpp b/libs/s25main/ingameWindows/iwDirectIPConnect.cpp index bb362c2d33..73eae6b03c 100644 --- a/libs/s25main/ingameWindows/iwDirectIPConnect.cpp +++ b/libs/s25main/ingameWindows/iwDirectIPConnect.cpp @@ -42,27 +42,27 @@ iwDirectIPConnect::iwDirectIPConnect(ServerType serverType) LOADER.getImageN("resource", 41), true), serverType_(serverType) { - AddText(ID_txtIp, DrawPoint(20, 30), _("IP Address of Host:"), COLOR_YELLOW, FontStyle{}, NormalFont); - ctrlEdit* host = AddEdit(ID_edtIp, DrawPoint(20, 45), Extent(260, 22), TextureColor::Green2, NormalFont, 0, false, + addText(ID_txtIp, DrawPoint(20, 30), _("IP Address of Host:"), COLOR_YELLOW, FontStyle{}, NormalFont); + ctrlEdit* host = addEdit(ID_edtIp, DrawPoint(20, 45), Extent(260, 22), TextureColor::Green2, NormalFont, 0, false, (serverType != ServerType::Direct), true); - AddText(ID_txtPort, DrawPoint(20, 80), _("Server-Port:"), COLOR_YELLOW, FontStyle{}, NormalFont); - ctrlEdit* port = AddEdit(ID_edtPort, DrawPoint(20, 95), Extent(260, 22), TextureColor::Green2, NormalFont, 0, false, + addText(ID_txtPort, DrawPoint(20, 80), _("Server-Port:"), COLOR_YELLOW, FontStyle{}, NormalFont); + ctrlEdit* port = addEdit(ID_edtPort, DrawPoint(20, 95), Extent(260, 22), TextureColor::Green2, NormalFont, 0, false, (serverType != ServerType::Direct), true); - AddText(ID_txtPw, DrawPoint(20, 130), _("Password (if needed):"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddEdit(ID_edtPw, DrawPoint(20, 145), Extent(260, 22), TextureColor::Green2, NormalFont, 0, false, false, true); + addText(ID_txtPw, DrawPoint(20, 130), _("Password (if needed):"), COLOR_YELLOW, FontStyle{}, NormalFont); + addEdit(ID_edtPw, DrawPoint(20, 145), Extent(260, 22), TextureColor::Green2, NormalFont, 0, false, false, true); - AddText(ID_txtIpv6, DrawPoint(20, 185), _("Use IPv6:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addText(ID_txtIpv6, DrawPoint(20, 185), _("Use IPv6:"), COLOR_YELLOW, FontStyle{}, NormalFont); - ctrlOptionGroup* ipv6 = AddOptionGroup(ID_grpIpv6, GroupSelectType::Check); - ipv6->AddTextButton(0, DrawPoint(120, 180), Extent(75, 22), TextureColor::Green2, _("IPv4"), NormalFont); - ipv6->AddTextButton(1, DrawPoint(205, 180), Extent(75, 22), TextureColor::Green2, _("IPv6"), NormalFont); + ctrlOptionGroup* ipv6 = addOptionGroup(ID_grpIpv6, GroupSelectType::Check); + ipv6->addTextButton(0, DrawPoint(120, 180), Extent(75, 22), TextureColor::Green2, _("IPv4"), NormalFont); + ipv6->addTextButton(1, DrawPoint(205, 180), Extent(75, 22), TextureColor::Green2, _("IPv6"), NormalFont); ipv6->setSelection((SETTINGS.server.ipv6 ? 1 : 0)); - AddText(ID_txtStatus, DrawPoint(150, 215), "", COLOR_RED, FontStyle::CENTER, NormalFont); - AddTextButton(ID_btConnect, DrawPoint(20, 240), Extent(125, 22), TextureColor::Green2, _("Connect"), NormalFont); - AddTextButton(ID_btBack, DrawPoint(155, 240), Extent(125, 22), TextureColor::Red1, _("Back"), NormalFont); + addText(ID_txtStatus, DrawPoint(150, 215), "", COLOR_RED, FontStyle::CENTER, NormalFont); + addTextButton(ID_btConnect, DrawPoint(20, 240), Extent(125, 22), TextureColor::Green2, _("Connect"), NormalFont); + addTextButton(ID_btBack, DrawPoint(155, 240), Extent(125, 22), TextureColor::Red1, _("Back"), NormalFont); host->setFocus(); host->setText(SETTINGS.server.lastIP); @@ -107,7 +107,7 @@ void iwDirectIPConnect::msgButtonClick(const unsigned ctrl_id) // save settings SETTINGS.server.lastIP = edtHost->getText(); - if(!GAMECLIENT.Connect(edtHost->getText(), edtPw->getText(), serverType_, *port, false, + if(!GAMECLIENT.connect(edtHost->getText(), edtPw->getText(), serverType_, *port, false, SETTINGS.server.ipv6)) { setStatus(_("Connection failed!"), COLOR_RED); @@ -119,15 +119,15 @@ void iwDirectIPConnect::msgButtonClick(const unsigned ctrl_id) if(serverType_ == ServerType::Lobby) lobbyClient = std::make_unique(LOBBYCLIENT); iwConnecting& wnd = - WINDOWMANAGER.Show(std::make_unique(serverType_, std::move(lobbyClient))); + WINDOWMANAGER.show(std::make_unique(serverType_, std::move(lobbyClient))); onErrorConnection_ = wnd.onError.connect([this](ClientError error) { - setStatus(ClientErrorToStr(error), COLOR_RED); + setStatus(clientErrorToStr(error), COLOR_RED); this->getCtrl(ID_btConnect)->setEnabled(); }); } } break; - case ID_btBack: Close(); break; + case ID_btBack: close(); break; } } @@ -144,7 +144,7 @@ void iwDirectIPConnect::setStatus(const std::string& text, unsigned color) txtStatus->setText(text); } -void iwDirectIPConnect::Connect(const std::string& hostOrIp, const unsigned short port, const bool isIPv6, +void iwDirectIPConnect::connect(const std::string& hostOrIp, const unsigned short port, const bool isIPv6, const bool hasPwd) { getCtrl(ID_edtIp)->setText(hostOrIp); diff --git a/libs/s25main/ingameWindows/iwDirectIPConnect.h b/libs/s25main/ingameWindows/iwDirectIPConnect.h index 5ac483fa6c..30170c8b72 100644 --- a/libs/s25main/ingameWindows/iwDirectIPConnect.h +++ b/libs/s25main/ingameWindows/iwDirectIPConnect.h @@ -17,7 +17,7 @@ class iwDirectIPConnect : public IngameWindow public: iwDirectIPConnect(ServerType serverType); /// Connects to the given server or fills in the info if it has a password - void Connect(const std::string& hostOrIp, unsigned short port, bool isIPv6, bool hasPwd); + void connect(const std::string& hostOrIp, unsigned short port, bool isIPv6, bool hasPwd); private: void setStatus(const std::string& text, unsigned color); diff --git a/libs/s25main/ingameWindows/iwDirectIPCreate.cpp b/libs/s25main/ingameWindows/iwDirectIPCreate.cpp index 41923858e4..c69140774d 100644 --- a/libs/s25main/ingameWindows/iwDirectIPCreate.cpp +++ b/libs/s25main/ingameWindows/iwDirectIPCreate.cpp @@ -23,33 +23,33 @@ iwDirectIPCreate::iwDirectIPCreate(ServerType server_type) ctrlEdit *name, *port; // "Name des Spiels" - AddText(0, DrawPoint(20, 30), _("Game's Name:"), COLOR_YELLOW, FontStyle{}, NormalFont); - name = AddEdit(1, DrawPoint(20, 45), Extent(260, 22), TextureColor::Green2, NormalFont, 0, false, false, true); + addText(0, DrawPoint(20, 30), _("Game's Name:"), COLOR_YELLOW, FontStyle{}, NormalFont); + name = addEdit(1, DrawPoint(20, 45), Extent(260, 22), TextureColor::Green2, NormalFont, 0, false, false, true); // "Server-Port" - AddText(2, DrawPoint(20, 80), _("Server-Port:"), COLOR_YELLOW, FontStyle{}, NormalFont); - port = AddEdit(3, DrawPoint(20, 95), Extent(260, 22), TextureColor::Green2, NormalFont, 0, false, false, true); + addText(2, DrawPoint(20, 80), _("Server-Port:"), COLOR_YELLOW, FontStyle{}, NormalFont); + port = addEdit(3, DrawPoint(20, 95), Extent(260, 22), TextureColor::Green2, NormalFont, 0, false, false, true); // "Passwort" - AddText(4, DrawPoint(20, 130), _("Password:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddEdit(5, DrawPoint(20, 145), Extent(260, 22), TextureColor::Green2, NormalFont, 0, false, false, true); + addText(4, DrawPoint(20, 130), _("Password:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addEdit(5, DrawPoint(20, 145), Extent(260, 22), TextureColor::Green2, NormalFont, 0, false, false, true); // ipv6 oder ipv4 benutzen - AddText(11, DrawPoint(20, 185), _("Use IPv6:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addText(11, DrawPoint(20, 185), _("Use IPv6:"), COLOR_YELLOW, FontStyle{}, NormalFont); - ctrlOptionGroup* ipv6 = AddOptionGroup(12, GroupSelectType::Check); - ipv6->AddTextButton(0, DrawPoint(120, 180), Extent(75, 22), TextureColor::Green2, _("IPv4"), NormalFont); - ipv6->AddTextButton(1, DrawPoint(205, 180), Extent(75, 22), TextureColor::Green2, _("IPv6"), NormalFont); + ctrlOptionGroup* ipv6 = addOptionGroup(12, GroupSelectType::Check); + ipv6->addTextButton(0, DrawPoint(120, 180), Extent(75, 22), TextureColor::Green2, _("IPv4"), NormalFont); + ipv6->addTextButton(1, DrawPoint(205, 180), Extent(75, 22), TextureColor::Green2, _("IPv6"), NormalFont); ipv6->setSelection((SETTINGS.server.ipv6 ? 1 : 0)); // Status - AddText(6, DrawPoint(150, 215), "", COLOR_RED, FontStyle::CENTER, NormalFont); + addText(6, DrawPoint(150, 215), "", COLOR_RED, FontStyle::CENTER, NormalFont); // "Starten" - AddTextButton(7, DrawPoint(20, 240), Extent(125, 22), TextureColor::Green2, _("Start"), NormalFont); + addTextButton(7, DrawPoint(20, 240), Extent(125, 22), TextureColor::Green2, _("Start"), NormalFont); // "Zurück" - AddTextButton(8, DrawPoint(155, 240), Extent(125, 22), TextureColor::Red1, _("Back"), NormalFont); + addTextButton(8, DrawPoint(155, 240), Extent(125, 22), TextureColor::Red1, _("Back"), NormalFont); name->setText(SETTINGS.lobby.name + _("'s Game")); name->setFocus(); @@ -151,7 +151,7 @@ void iwDirectIPCreate::msgButtonClick(const unsigned ctrl_id) break; case 8: { - Close(); + close(); } break; } diff --git a/libs/s25main/ingameWindows/iwDistribution.cpp b/libs/s25main/ingameWindows/iwDistribution.cpp index 5217cdfee5..2485d00288 100644 --- a/libs/s25main/ingameWindows/iwDistribution.cpp +++ b/libs/s25main/ingameWindows/iwDistribution.cpp @@ -33,12 +33,12 @@ iwDistribution::iwDistribution(const GameWorldViewer& gwv, GameCommandFactory& g _("Distribution of goods"), LOADER.getImageN("resource", 41)), gwv(gwv), gcFactory(gcFactory) { - CreateGroups(); + createGroups(); - Resize(Extent(groups.size() * TAB_ICON_SIZE + TAB_ICON_SIZE / 2 + 20, 312)); + resize(Extent(groups.size() * TAB_ICON_SIZE + TAB_ICON_SIZE / 2 + 20, 312)); // Tab Control - ctrlTab* tab = AddTabCtrl(0, DrawPoint(10, 20), groups.size() * TAB_ICON_SIZE + TAB_ICON_SIZE / 2); + ctrlTab* tab = addTabCtrl(0, DrawPoint(10, 20), groups.size() * TAB_ICON_SIZE + TAB_ICON_SIZE / 2); DrawPoint txtPos(getSize().x / 2, 60); DrawPoint progPos(PROGRESS_BORDER_DISTANCE - tab->getPos().x, txtPos.y); const Extent progSize(getSize().x - 2 * PROGRESS_BORDER_DISTANCE, 20); @@ -46,15 +46,15 @@ iwDistribution::iwDistribution(const GameWorldViewer& gwv, GameCommandFactory& g for(unsigned groupId = 0; groupId < groups.size(); groupId++) { const DistributionGroup& group = groups[groupId]; - ctrlGroup* tabGrp = tab->AddTab(group.img, group.name, groupId); + ctrlGroup* tabGrp = tab->addTab(group.img, group.name, groupId); txtPos.y = progPos.y = 60; unsigned curId = 0; for(const auto& entry : group.entries) { unsigned txtId = group.entries.size() + curId; - tabGrp->AddText(txtId, txtPos, std::get<0>(entry), COLOR_YELLOW, FontStyle::CENTER | FontStyle::BOTTOM, + tabGrp->addText(txtId, txtPos, std::get<0>(entry), COLOR_YELLOW, FontStyle::CENTER | FontStyle::BOTTOM, SmallFont); - tabGrp->AddProgress(curId++, progPos, progSize, TextureColor::Grey, 139, 138, 10); + tabGrp->addProgress(curId++, progPos, progSize, TextureColor::Grey, 139, 138, 10); txtPos.y = progPos.y += progSize.y * 2; } } @@ -64,16 +64,16 @@ iwDistribution::iwDistribution(const GameWorldViewer& gwv, GameCommandFactory& g const Extent btSize(32, 32); // "Help" button - AddImageButton(2, DrawPoint(15, getFullSize().y - 15 - btSize.y), btSize, TextureColor::Grey, + addImageButton(2, DrawPoint(15, getFullSize().y - 15 - btSize.y), btSize, TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); // "Default" button - AddImageButton(10, getFullSize() - DrawPoint::all(15) - btSize, btSize, TextureColor::Grey, + addImageButton(10, getFullSize() - DrawPoint::all(15) - btSize, btSize, TextureColor::Grey, LOADER.getImageN("io", 191), _("Default")); - iwDistribution::UpdateSettings(); + iwDistribution::updateSettings(); } -void iwDistribution::TransmitSettings() +void iwDistribution::transmitSettings() { if(GAMECLIENT.isReplayModeOn()) return; @@ -112,10 +112,10 @@ void iwDistribution::msgGroupProgressChange(const unsigned /*group_id*/, const u settings_changed = true; } -void iwDistribution::UpdateSettings(const Distributions& distribution) +void iwDistribution::updateSettings(const Distributions& distribution) { if(GAMECLIENT.isReplayModeOn()) - gwv.getPlayer().FillVisualSettings(GAMECLIENT.visual_settings); + gwv.getPlayer().fillVisualSettings(GAMECLIENT.visual_settings); for(unsigned g = 0; g < groups.size(); ++g) { @@ -128,9 +128,9 @@ void iwDistribution::UpdateSettings(const Distributions& distribution) } } -void iwDistribution::UpdateSettings() +void iwDistribution::updateSettings() { - UpdateSettings(GAMECLIENT.visual_settings.distribution); + updateSettings(GAMECLIENT.visual_settings.distribution); } void iwDistribution::msgButtonClick(const unsigned ctrl_id) @@ -143,7 +143,7 @@ void iwDistribution::msgButtonClick(const unsigned ctrl_id) case 2: { - WINDOWMANAGER.ReplaceWindow( + WINDOWMANAGER.replaceWindow( std::make_unique(_("The priority of goods for the individual buildings can be set here. " "The higher the value, the quicker the required goods are delivered " "to the building concerned."))); @@ -152,14 +152,14 @@ void iwDistribution::msgButtonClick(const unsigned ctrl_id) // Default button case 10: { - UpdateSettings(GAMECLIENT.default_settings.distribution); + updateSettings(GAMECLIENT.default_settings.distribution); settings_changed = true; } break; } } -void iwDistribution::CreateGroups() +void iwDistribution::createGroups() { if(!groups.empty()) return; diff --git a/libs/s25main/ingameWindows/iwDistribution.h b/libs/s25main/ingameWindows/iwDistribution.h index d2a416ef61..3ac614211f 100644 --- a/libs/s25main/ingameWindows/iwDistribution.h +++ b/libs/s25main/ingameWindows/iwDistribution.h @@ -29,10 +29,10 @@ class iwDistribution final : public TransmitSettingsIgwAdapter GameCommandFactory& gcFactory; /// Updatet die Steuerelemente mit den übergebenen Einstellungen - void UpdateSettings(const Distributions& distribution); - void UpdateSettings() override; + void updateSettings(const Distributions& distribution); + void updateSettings() override; /// Sendet veränderte Einstellungen (an den Client), falls sie verändert wurden - void TransmitSettings() override; + void transmitSettings() override; void msgGroupProgressChange(unsigned group_id, unsigned ctrl_id, unsigned short position) override; void msgButtonClick(unsigned ctrl_id) override; @@ -40,5 +40,5 @@ class iwDistribution final : public TransmitSettingsIgwAdapter /// Groups for the settings std::vector groups; /// Initialize the groups structure - void CreateGroups(); + void createGroups(); }; diff --git a/libs/s25main/ingameWindows/iwEconomicProgress.cpp b/libs/s25main/ingameWindows/iwEconomicProgress.cpp index 60df51b911..05ba62d9be 100644 --- a/libs/s25main/ingameWindows/iwEconomicProgress.cpp +++ b/libs/s25main/ingameWindows/iwEconomicProgress.cpp @@ -43,9 +43,9 @@ iwEconomicProgress::iwEconomicProgress(const GameWorldViewer& gwv) Extent size(padding1.x + wareIconSize.x + (std::max((int)eH->getTeams().size(), 2) + 1) * txtBoxWidth + padding2.x, padding1.y + teamRectHeight + ((int)eH->getGoodTypesToCollect().size() + 1) * wareIconSize.y + extraSpacing * 2 + padding2.y); - this->Resize(size); + this->resize(size); - AddText(1, DrawPoint(padding1.x + wareIconSize.x, padding1.y + teamRectHeight), _("Player"), COLOR_GREEN, + addText(1, DrawPoint(padding1.x + wareIconSize.x, padding1.y + teamRectHeight), _("Player"), COLOR_GREEN, FontStyle::LEFT | FontStyle::BOTTOM, NormalFont); // determine team display order (main player team first) @@ -72,14 +72,14 @@ iwEconomicProgress::iwEconomicProgress(const GameWorldViewer& gwv) { GoodType good = goodsToCollect[i]; - AddImage(100 + i, curBoxPos + wareIconSize / 2, LOADER.getMapTexture(2298), _(WARE_NAMES[good])); + addImage(100 + i, curBoxPos + wareIconSize / 2, LOADER.getMapTexture(2298), _(WARE_NAMES[good])); const DrawPoint warePos = curBoxPos + wareIconSize / 2; - AddImage(200 + i, warePos, LOADER.getWareTex(good)); + addImage(200 + i, warePos, LOADER.getWareTex(good)); DrawPoint curTxtPos = curBoxPos + DrawPoint(wareIconSize.x, 0); for(unsigned j = 0; j < 1 + eH->getTeams().size(); j++) { - AddTextDeepening(300 + (MAX_PLAYERS + 2) * j + i, curTxtPos, Extent(txtBoxWidth, wareIconSize.y), + addTextDeepening(300 + (MAX_PLAYERS + 2) * j + i, curTxtPos, Extent(txtBoxWidth, wareIconSize.y), TextureColor::Grey, "?", NormalFont, textcolor[j < 2 ? j : 2]); curTxtPos.x += txtBoxWidth; } @@ -89,21 +89,21 @@ iwEconomicProgress::iwEconomicProgress(const GameWorldViewer& gwv) if(!eH->isInfinite()) { // game progress display - AddText(2, DrawPoint(wareIconSize.x + extraSpacing + padding1.x, this->getSize().y - padding2.y), + addText(2, DrawPoint(wareIconSize.x + extraSpacing + padding1.x, this->getSize().y - padding2.y), _("Time remaining:"), COLOR_ORANGE, FontStyle::LEFT | FontStyle::BOTTOM, NormalFont); txtRemainingTime = - AddText(3, DrawPoint(wareIconSize.x + extraSpacing + txtBoxWidth * 3, this->getSize().y - padding2.y), "%", + addText(3, DrawPoint(wareIconSize.x + extraSpacing + txtBoxWidth * 3, this->getSize().y - padding2.y), "%", COLOR_ORANGE, FontStyle::RIGHT | FontStyle::BOTTOM, NormalFont); } // help button - AddImageButton(25, DrawPoint(padding1.x, this->getSize().y - wareIconSize.y - padding2.y), wareIconSize, + addImageButton(25, DrawPoint(padding1.x, this->getSize().y - wareIconSize.y - padding2.y), wareIconSize, TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); } iwEconomicProgress::~iwEconomicProgress() = default; -void iwEconomicProgress::DrawContent() +void iwEconomicProgress::drawContent() { // draw team colors DrawPoint curTeamRectPos = getDrawPos() + DrawPoint(padding1.x + wareIconSize.x + txtBoxWidth, padding1.y); @@ -117,7 +117,7 @@ void iwEconomicProgress::DrawContent() { if(teamRectHeight - ypos < 2 * ystep) ystep = teamRectHeight - ypos; - DrawRectangle(Rect(curTeamRectPos + DrawPoint(0, ypos), Extent(txtBoxWidth - 1, ystep)), + drawRectangle(Rect(curTeamRectPos + DrawPoint(0, ypos), Extent(txtBoxWidth - 1, ystep)), gwv.getWorld().getPlayer(i).color); ypos += ystep; } @@ -133,7 +133,7 @@ void iwEconomicProgress::msgButtonClick(const unsigned ctrl_id) break; case 25: // help { - WINDOWMANAGER.ReplaceWindow( + WINDOWMANAGER.replaceWindow( std::make_unique(_("This window shows the wares that should be collected for " "the economy mode. Displayed is the current inventory of " "the player, his team and after game end of the opponent " @@ -155,7 +155,7 @@ void iwEconomicProgress::msgPaintBefore() RTTR_Assert(economyModeTeams.size() == teamOrder.size()); // make sure the amounts are current - eH->UpdateAmounts(); + eH->updateAmounts(); // update table elements for(unsigned i = 0; i < eH->getGoodTypesToCollect().size(); i++) @@ -193,10 +193,10 @@ void iwEconomicProgress::msgPaintBefore() // Refresh game progress tracker if(!eH->isOver()) { - txtRemainingTime->setText(GAMECLIENT.FormatGFTime(eH->getEndFrame() - world.getEvMgr().getCurrentGF())); + txtRemainingTime->setText(GAMECLIENT.formatGFTime(eH->getEndFrame() - world.getEvMgr().getCurrentGF())); } else { - txtRemainingTime->setText(GAMECLIENT.FormatGFTime(0)); + txtRemainingTime->setText(GAMECLIENT.formatGFTime(0)); } } } diff --git a/libs/s25main/ingameWindows/iwEconomicProgress.h b/libs/s25main/ingameWindows/iwEconomicProgress.h index 03dfb38634..1e224c0086 100644 --- a/libs/s25main/ingameWindows/iwEconomicProgress.h +++ b/libs/s25main/ingameWindows/iwEconomicProgress.h @@ -24,7 +24,7 @@ class iwEconomicProgress : public IngameWindow /// Order in which the teams are displayed std::vector teamOrder; - void DrawContent() override; + void drawContent() override; void msgButtonClick(unsigned ctrl_id) override; void msgPaintBefore() override; diff --git a/libs/s25main/ingameWindows/iwEndgame.cpp b/libs/s25main/ingameWindows/iwEndgame.cpp index 0792c7f79b..e64b8ff59e 100644 --- a/libs/s25main/ingameWindows/iwEndgame.cpp +++ b/libs/s25main/ingameWindows/iwEndgame.cpp @@ -14,11 +14,11 @@ iwEndgame::iwEndgame() LOADER.getImageN("resource", 41)) { // Ok - AddImageButton(0, DrawPoint(16, 24), Extent(71, 57), TextureColor::Green2, LOADER.getImageN("io", 32)); //-V525 + addImageButton(0, DrawPoint(16, 24), Extent(71, 57), TextureColor::Green2, LOADER.getImageN("io", 32)); //-V525 // Abbrechen - AddImageButton(1, DrawPoint(88, 24), Extent(71, 57), TextureColor::Red1, LOADER.getImageN("io", 40)); + addImageButton(1, DrawPoint(88, 24), Extent(71, 57), TextureColor::Red1, LOADER.getImageN("io", 40)); // Ok + Speichern - AddImageButton(2, DrawPoint(160, 24), Extent(65, 57), TextureColor::Grey, LOADER.getImageN("io", 47)); + addImageButton(2, DrawPoint(160, 24), Extent(65, 57), TextureColor::Grey, LOADER.getImageN("io", 47)); } void iwEndgame::msgButtonClick(const unsigned ctrl_id) @@ -27,17 +27,17 @@ void iwEndgame::msgButtonClick(const unsigned ctrl_id) { case 0: // OK { - GAMEMANAGER.ShowMenu(); + GAMEMANAGER.showMenu(); } break; case 1: // Abbrechen { - Close(); + close(); } break; case 2: // OK + Speichern { - WINDOWMANAGER.ToggleWindow(std::make_unique()); + WINDOWMANAGER.toggleWindow(std::make_unique()); } break; } diff --git a/libs/s25main/ingameWindows/iwHQ.cpp b/libs/s25main/ingameWindows/iwHQ.cpp index 4e07b61880..8563b132aa 100644 --- a/libs/s25main/ingameWindows/iwHQ.cpp +++ b/libs/s25main/ingameWindows/iwHQ.cpp @@ -15,11 +15,11 @@ iwHQ::iwHQ(GameWorldView& gwv, GameCommandFactory& gcFactory, nobBaseWarehouse* setTitle(_("Headquarters")); // Soldaten Reservierungsseite - ctrlGroup& reserve = AddPage(); + ctrlGroup& reserve = addPage(); grpIdReserve = reserve.getID(); // "Reserve"-Überschrift - reserve.AddText(0, DrawPoint(83, 87), _("Reserve"), 0xFFFFFF00, FontStyle::CENTER, NormalFont); + reserve.addText(0, DrawPoint(83, 87), _("Reserve"), 0xFFFFFF00, FontStyle::CENTER, NormalFont); // Y-Abstand zwischen den Zeilen const unsigned Y_DISTANCE = 30; @@ -27,17 +27,17 @@ iwHQ::iwHQ(GameWorldView& gwv, GameCommandFactory& gcFactory, nobBaseWarehouse* for(unsigned i = 0; i < 5; ++i) { // Bildhintergrund - reserve.AddImage(1 + i, DrawPoint(34, 124 + Y_DISTANCE * i), LOADER.getMapTexture(2298)); + reserve.addImage(1 + i, DrawPoint(34, 124 + Y_DISTANCE * i), LOADER.getMapTexture(2298)); // Rang-Bild - reserve.AddImage(6 + i, DrawPoint(34, 124 + Y_DISTANCE * i), LOADER.getMapTexture(2321 + i)); + reserve.addImage(6 + i, DrawPoint(34, 124 + Y_DISTANCE * i), LOADER.getMapTexture(2321 + i)); // Minus-Button - reserve.AddImageButton(11 + i, DrawPoint(54, 112 + Y_DISTANCE * i), Extent(24, 24), TextureColor::Red1, + reserve.addImageButton(11 + i, DrawPoint(54, 112 + Y_DISTANCE * i), Extent(24, 24), TextureColor::Red1, LOADER.getImageN("io", 139), _("Less")); // Plus-Button - reserve.AddImageButton(16 + i, DrawPoint(118, 112 + Y_DISTANCE * i), Extent(24, 24), TextureColor::Green2, + reserve.addImageButton(16 + i, DrawPoint(118, 112 + Y_DISTANCE * i), Extent(24, 24), TextureColor::Green2, LOADER.getImageN("io", 138), _("More")); // Anzahl-Text - reserve.AddVarText(21 + i, DrawPoint(100, 117 + Y_DISTANCE * i), _("%u/%u"), 0xFFFFFF00, FontStyle::CENTER, + reserve.addVarText(21 + i, DrawPoint(100, 117 + Y_DISTANCE * i), _("%u/%u"), 0xFFFFFF00, FontStyle::CENTER, NormalFont, 2, wh->getReserveAvailablePointer(i), wh->getReserveClaimedVisualPointer(i)); } } diff --git a/libs/s25main/ingameWindows/iwHarborBuilding.cpp b/libs/s25main/ingameWindows/iwHarborBuilding.cpp index 243cbd913a..d4c6751e96 100644 --- a/libs/s25main/ingameWindows/iwHarborBuilding.cpp +++ b/libs/s25main/ingameWindows/iwHarborBuilding.cpp @@ -16,24 +16,24 @@ iwHarborBuilding::iwHarborBuilding(GameWorldView& gwv, GameCommandFactory& gcFac setTitle(_("Harbor building")); // Zusätzliche Hafenseite - ctrlGroup& harbor_page = AddPage(); + ctrlGroup& harbor_page = addPage(); grpIdExpedition = harbor_page.getID(); // "Expedition"-Überschrift - harbor_page.AddText(0, DrawPoint(83, 70), _("Expedition"), 0xFFFFFF00, FontStyle::CENTER, NormalFont); + harbor_page.addText(0, DrawPoint(83, 70), _("Expedition"), 0xFFFFFF00, FontStyle::CENTER, NormalFont); // Button zum Expedition starten - harbor_page.AddImageButton(1, DrawPoint(65, 100), Extent(30, 30), TextureColor::Grey, LOADER.getImageN("io", 176), + harbor_page.addImageButton(1, DrawPoint(65, 100), Extent(30, 30), TextureColor::Grey, LOADER.getImageN("io", 176), _("Start expedition")); - AdjustExpeditionButton(false); + adjustExpeditionButton(false); // "Expedition"-Überschrift - harbor_page.AddText(2, DrawPoint(83, 140), _("Exploration expedition"), 0xFFFFFF00, FontStyle::CENTER, NormalFont); + harbor_page.addText(2, DrawPoint(83, 140), _("Exploration expedition"), 0xFFFFFF00, FontStyle::CENTER, NormalFont); // Button zum Expedition starten - harbor_page.AddImageButton(3, DrawPoint(65, 170), Extent(30, 30), TextureColor::Grey, LOADER.getImageN("io", 176), + harbor_page.addImageButton(3, DrawPoint(65, 170), Extent(30, 30), TextureColor::Grey, LOADER.getImageN("io", 176), _("Start exporation expedition")); - AdjustExplorationExpeditionButton(false); + adjustExplorationExpeditionButton(false); } /** @@ -41,7 +41,7 @@ iwHarborBuilding::iwHarborBuilding(GameWorldView& gwv, GameCommandFactory& gcFac * * falls @p flip gesetzt, dann umgekehrt einfärben */ -void iwHarborBuilding::AdjustExpeditionButton(bool flip) +void iwHarborBuilding::adjustExpeditionButton(bool flip) { auto* button = getCtrl(grpIdExpedition)->getCtrl(1); @@ -68,7 +68,7 @@ void iwHarborBuilding::AdjustExpeditionButton(bool flip) * * falls @p flip gesetzt, dann umgekehrt einfärben */ -void iwHarborBuilding::AdjustExplorationExpeditionButton(bool flip) +void iwHarborBuilding::adjustExplorationExpeditionButton(bool flip) { auto* button = getCtrl(grpIdExpedition)->getCtrl(3); @@ -100,13 +100,13 @@ void iwHarborBuilding::msgGroupButtonClick(const unsigned group_id, const unsign // Entsprechenden GC senden if(GAMECLIENT.StartStopExpedition(wh->getPos(), !static_cast(wh)->isExpeditionActive())) - AdjustExpeditionButton(true); + adjustExpeditionButton(true); break; case 3: // Expedition starten // Entsprechenden GC senden if(GAMECLIENT.StartStopExplorationExpedition( wh->getPos(), !static_cast(wh)->isExplorationExpeditionActive())) - AdjustExplorationExpeditionButton(true); + adjustExplorationExpeditionButton(true); break; } } diff --git a/libs/s25main/ingameWindows/iwHarborBuilding.h b/libs/s25main/ingameWindows/iwHarborBuilding.h index 80d9247cff..fc7e779a79 100644 --- a/libs/s25main/ingameWindows/iwHarborBuilding.h +++ b/libs/s25main/ingameWindows/iwHarborBuilding.h @@ -18,8 +18,8 @@ class iwHarborBuilding : public iwHQ void msgGroupButtonClick(unsigned group_id, unsigned ctrl_id) override; private: - void AdjustExpeditionButton(bool flip); - void AdjustExplorationExpeditionButton(bool flip); + void adjustExpeditionButton(bool flip); + void adjustExplorationExpeditionButton(bool flip); unsigned grpIdExpedition; }; diff --git a/libs/s25main/ingameWindows/iwHelp.cpp b/libs/s25main/ingameWindows/iwHelp.cpp index 7b99feb701..01602c575d 100644 --- a/libs/s25main/ingameWindows/iwHelp.cpp +++ b/libs/s25main/ingameWindows/iwHelp.cpp @@ -18,12 +18,12 @@ iwHelp::iwHelp(const std::string& content) LOADER.getImageN("io", 1)) { // Größe des Fensters und des Controls nach der Anzahl der Zeilen - ctrlMultiline* text = AddMultiline(2, DrawPoint(contentOffset), getIwSize(), TextureColor::Green1, NormalFont); + ctrlMultiline* text = addMultiline(2, DrawPoint(contentOffset), getIwSize(), TextureColor::Green1, NormalFont); text->setNumVisibleLines(MAX_LINES); - text->ShowBackground(false); - text->AddString(content, COLOR_YELLOW, false); + text->showBackground(false); + text->addString(content, COLOR_YELLOW, false); // Shrink to content - text->Resize(text->getContentSize()); + text->resize(text->getContentSize()); setIwSize(text->getSize()); - MoveNextToMouse(); + moveNextToMouse(); } diff --git a/libs/s25main/ingameWindows/iwLobbyConnect.cpp b/libs/s25main/ingameWindows/iwLobbyConnect.cpp index 5b0bf70631..9b827c8578 100644 --- a/libs/s25main/ingameWindows/iwLobbyConnect.cpp +++ b/libs/s25main/ingameWindows/iwLobbyConnect.cpp @@ -55,42 +55,42 @@ iwLobbyConnect::iwLobbyConnect() constexpr Extent btSize(edtSize.x / 2 - 5, edtSize.y); constexpr auto secCtrlStartPos = ctrlStartPos + btSize.x + 10; - AddText(ID_txtUser, curLblPos, _("Username:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addText(ID_txtUser, curLblPos, _("Username:"), COLOR_YELLOW, FontStyle{}, NormalFont); ctrlEdit* user = - AddEdit(ID_edtUser, DrawPoint(ctrlStartPos, curLblPos.y), edtSize, TextureColor::Green2, NormalFont, 30); + addEdit(ID_edtUser, DrawPoint(ctrlStartPos, curLblPos.y), edtSize, TextureColor::Green2, NormalFont, 30); user->setFocus(); user->setText(SETTINGS.lobby.name); //-V807 curLblPos.y += 30; - AddText(ID_txtPw, curLblPos, _("Password:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addText(ID_txtPw, curLblPos, _("Password:"), COLOR_YELLOW, FontStyle{}, NormalFont); ctrlEdit* pass = - AddEdit(ID_edtPw, DrawPoint(ctrlStartPos, curLblPos.y), edtSize, TextureColor::Green2, NormalFont, 0, true); + addEdit(ID_edtPw, DrawPoint(ctrlStartPos, curLblPos.y), edtSize, TextureColor::Green2, NormalFont, 0, true); pass->setText(isStoredPasswordHash(SETTINGS.lobby.password) ? SETTINGS.lobby.password.substr(4) : SETTINGS.lobby.password); curLblPos.y += 30; - AddText(ID_txtSavePw, curLblPos, _("Save Password?"), COLOR_YELLOW, FontStyle{}, NormalFont); - ctrlOptionGroup* savepassword = AddOptionGroup(ID_optSavePw, GroupSelectType::Check); - savepassword->AddTextButton(0, DrawPoint(ctrlStartPos, curLblPos.y), btSize, TextureColor::Green2, _("No"), + addText(ID_txtSavePw, curLblPos, _("Save Password?"), COLOR_YELLOW, FontStyle{}, NormalFont); + ctrlOptionGroup* savepassword = addOptionGroup(ID_optSavePw, GroupSelectType::Check); + savepassword->addTextButton(0, DrawPoint(ctrlStartPos, curLblPos.y), btSize, TextureColor::Green2, _("No"), NormalFont); - savepassword->AddTextButton(1, DrawPoint(secCtrlStartPos, curLblPos.y), btSize, TextureColor::Green2, _("Yes"), + savepassword->addTextButton(1, DrawPoint(secCtrlStartPos, curLblPos.y), btSize, TextureColor::Green2, _("Yes"), NormalFont); savepassword->setSelection((SETTINGS.lobby.savePassword ? 1 : 0)); curLblPos.y += 30; - AddText(ID_txtProtocol, curLblPos, _("Use IPv6:"), COLOR_YELLOW, FontStyle{}, NormalFont); - ctrlOptionGroup* ipv6 = AddOptionGroup(ID_optProtocol, GroupSelectType::Check); - ipv6->AddTextButton(0, DrawPoint(ctrlStartPos, curLblPos.y), btSize, TextureColor::Green2, _("IPv4"), NormalFont); - ipv6->AddTextButton(1, DrawPoint(secCtrlStartPos, curLblPos.y), btSize, TextureColor::Green2, _("IPv6"), + addText(ID_txtProtocol, curLblPos, _("Use IPv6:"), COLOR_YELLOW, FontStyle{}, NormalFont); + ctrlOptionGroup* ipv6 = addOptionGroup(ID_optProtocol, GroupSelectType::Check); + ipv6->addTextButton(0, DrawPoint(ctrlStartPos, curLblPos.y), btSize, TextureColor::Green2, _("IPv4"), NormalFont); + ipv6->addTextButton(1, DrawPoint(secCtrlStartPos, curLblPos.y), btSize, TextureColor::Green2, _("IPv6"), NormalFont); ipv6->setSelection((SETTINGS.server.ipv6 ? 1 : 0)); auto curYPos = curLblPos.y + 35; - AddText(ID_txtStatus, DrawPoint(getSize().x / 2, curYPos), "", COLOR_RED, FontStyle::CENTER, NormalFont); + addText(ID_txtStatus, DrawPoint(getSize().x / 2, curYPos), "", COLOR_RED, FontStyle::CENTER, NormalFont); curYPos += 25; - AddTextButton(ID_btConnect, DrawPoint(curLblPos.x, curYPos), edtSize, TextureColor::Red1, _("Connect"), NormalFont); - AddTextButton(ID_btRegister, DrawPoint(ctrlStartPos, curYPos), edtSize, TextureColor::Green2, _("Register"), + addTextButton(ID_btConnect, DrawPoint(curLblPos.x, curYPos), edtSize, TextureColor::Red1, _("Connect"), NormalFont); + addTextButton(ID_btRegister, DrawPoint(ctrlStartPos, curYPos), edtSize, TextureColor::Green2, _("Register"), NormalFont); LOBBYCLIENT.SetProgramVersion(rttr::version::getReadableVersion()); @@ -111,7 +111,7 @@ iwLobbyConnect::~iwLobbyConnect() } /// Get entered data and save to settings -void iwLobbyConnect::ReadFromEditAndSaveLobbyData(std::string& user, std::string& pass) +void iwLobbyConnect::readFromEditAndSaveLobbyData(std::string& user, std::string& pass) { user = getCtrl(ID_edtUser)->getText(); pass = getCtrl(ID_edtPw)->getText(); @@ -159,7 +159,7 @@ void iwLobbyConnect::msgButtonClick(const unsigned ctrl_id) setText(_("Connecting with Host..."), COLOR_RED, false); std::string user, pass; - ReadFromEditAndSaveLobbyData(user, pass); + readFromEditAndSaveLobbyData(user, pass); if(!LOBBYCLIENT.Login(LOADER.getTextN("client", 0), s25util::fromStringClassic(LOADER.getTextN("client", 1)), user, pass, @@ -171,7 +171,7 @@ void iwLobbyConnect::msgButtonClick(const unsigned ctrl_id) } break; case ID_btRegister: - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Error"), _("To register, you have to create a valid board account at http://forum.siedler25.org at the moment.\n"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed, 0)); diff --git a/libs/s25main/ingameWindows/iwLobbyConnect.h b/libs/s25main/ingameWindows/iwLobbyConnect.h index caae18079b..37d6d25417 100644 --- a/libs/s25main/ingameWindows/iwLobbyConnect.h +++ b/libs/s25main/ingameWindows/iwLobbyConnect.h @@ -27,5 +27,5 @@ class iwLobbyConnect : public IngameWindow, public LobbyInterface private: void setText(const std::string& text, unsigned color, bool button); - void ReadFromEditAndSaveLobbyData(std::string& user, std::string& pass); + void readFromEditAndSaveLobbyData(std::string& user, std::string& pass); }; diff --git a/libs/s25main/ingameWindows/iwLobbyServerInfo.cpp b/libs/s25main/ingameWindows/iwLobbyServerInfo.cpp index ce3adfbea6..e047b2d963 100644 --- a/libs/s25main/ingameWindows/iwLobbyServerInfo.cpp +++ b/libs/s25main/ingameWindows/iwLobbyServerInfo.cpp @@ -13,7 +13,7 @@ /** * aktualisiert das Serverinfo. */ -void iwLobbyServerInfo::UpdateServerInfo() +void iwLobbyServerInfo::updateServerInfo() { const LobbyServerInfo& serverinfo = LOBBYCLIENT.GetServerInfo(); @@ -30,18 +30,18 @@ iwLobbyServerInfo::iwLobbyServerInfo(unsigned serverId) LOADER.getImageN("resource", 41)), serverId_(serverId) { - AddText(0, DrawPoint(30, 40), _("Map Name:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddEdit(1, DrawPoint(30, 60), Extent(200, 22), TextureColor::Green2, NormalFont, 0, false, true); - AddText(3, DrawPoint(30, 90), _("Server Name:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddEdit(4, DrawPoint(30, 110), Extent(200, 22), TextureColor::Green2, NormalFont, 0, false, true); - AddText(5, DrawPoint(30, 140), _("Host:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddEdit(6, DrawPoint(30, 160), Extent(200, 22), TextureColor::Green2, NormalFont, 0, false, true); - AddText(7, DrawPoint(30, 190), _("Version:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddEdit(8, DrawPoint(30, 210), Extent(200, 22), TextureColor::Green2, NormalFont, 0, false, true); + addText(0, DrawPoint(30, 40), _("Map Name:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addEdit(1, DrawPoint(30, 60), Extent(200, 22), TextureColor::Green2, NormalFont, 0, false, true); + addText(3, DrawPoint(30, 90), _("Server Name:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addEdit(4, DrawPoint(30, 110), Extent(200, 22), TextureColor::Green2, NormalFont, 0, false, true); + addText(5, DrawPoint(30, 140), _("Host:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addEdit(6, DrawPoint(30, 160), Extent(200, 22), TextureColor::Green2, NormalFont, 0, false, true); + addText(7, DrawPoint(30, 190), _("Version:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addEdit(8, DrawPoint(30, 210), Extent(200, 22), TextureColor::Green2, NormalFont, 0, false, true); LOBBYCLIENT.SendServerInfoRequest(serverId_); using namespace std::chrono_literals; - AddTimer(9, 5s); + addTimer(9, 5s); } void iwLobbyServerInfo::msgTimer(const unsigned ctrl_id) diff --git a/libs/s25main/ingameWindows/iwLobbyServerInfo.h b/libs/s25main/ingameWindows/iwLobbyServerInfo.h index c0c75e0454..39c0d556b3 100644 --- a/libs/s25main/ingameWindows/iwLobbyServerInfo.h +++ b/libs/s25main/ingameWindows/iwLobbyServerInfo.h @@ -16,7 +16,7 @@ class iwLobbyServerInfo : public IngameWindow void setServerId(unsigned serverId); unsigned getServerId() const { return serverId_; } - void UpdateServerInfo(); + void updateServerInfo(); protected: void msgTimer(unsigned ctrl_id) override; diff --git a/libs/s25main/ingameWindows/iwMainMenu.cpp b/libs/s25main/ingameWindows/iwMainMenu.cpp index 341e24ecf7..fdd50d9a22 100644 --- a/libs/s25main/ingameWindows/iwMainMenu.cpp +++ b/libs/s25main/ingameWindows/iwMainMenu.cpp @@ -36,48 +36,48 @@ iwMainMenu::iwMainMenu(GameWorldView& gwv, GameCommandFactory& gcFactory) gwv(gwv), gcFactory(gcFactory) { // Verteilung - AddImageButton(0, DrawPoint(12, 22), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 134), + addImageButton(0, DrawPoint(12, 22), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 134), _("Distribution of goods")); // Transport - AddImageButton(1, DrawPoint(68, 22), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 198), + addImageButton(1, DrawPoint(68, 22), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 198), _("Transport")); // Werkzeugproduktion - AddImageButton(2, DrawPoint(124, 22), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 137), _("Tools")); + addImageButton(2, DrawPoint(124, 22), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 137), _("Tools")); // Statistiken - AddImageButton(3, DrawPoint(12, 70), Extent(39, 44), TextureColor::Grey, LOADER.getImageN("io", 166), + addImageButton(3, DrawPoint(12, 70), Extent(39, 44), TextureColor::Grey, LOADER.getImageN("io", 166), _("General statistics")); - AddImageButton(4, DrawPoint(54, 70), Extent(39, 44), TextureColor::Grey, LOADER.getImageN("io", 135), + addImageButton(4, DrawPoint(54, 70), Extent(39, 44), TextureColor::Grey, LOADER.getImageN("io", 135), _("Merchandise statistics")); - AddImageButton(5, DrawPoint(96, 70), Extent(39, 44), TextureColor::Grey, LOADER.getImageN("io", 132), + addImageButton(5, DrawPoint(96, 70), Extent(39, 44), TextureColor::Grey, LOADER.getImageN("io", 132), _("Buildings")); // Inventur - AddImageButton(6, DrawPoint(138, 70), Extent(39, 44), TextureColor::Grey, LOADER.getImageN("io", 214), _("Stock")); + addImageButton(6, DrawPoint(138, 70), Extent(39, 44), TextureColor::Grey, LOADER.getImageN("io", 214), _("Stock")); // Gebäude - AddImageButton(7, DrawPoint(12, 118), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 136), + addImageButton(7, DrawPoint(12, 118), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 136), _("Productivity")); // Militär - AddImageButton(8, DrawPoint(68, 118), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 133), + addImageButton(8, DrawPoint(68, 118), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 133), _("Military")); // Schiffe - AddImageButton(9, DrawPoint(124, 118), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 175), + addImageButton(9, DrawPoint(124, 118), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 175), _("Ship register")); // Baureihenfolge if(gwv.getWorld().getGGS().isEnabled(AddonId::CUSTOM_BUILD_SEQUENCE)) - AddImageButton(10, DrawPoint(12, 166), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 24), + addImageButton(10, DrawPoint(12, 166), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 24), _("Building sequence")); // Diplomatie (todo: besseres Bild suchen) - AddImageButton(11, DrawPoint(68, 166), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 190), + addImageButton(11, DrawPoint(68, 166), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 190), _("Diplomacy")); if(gwv.getWorld().getEconHandler()) { // Economy Mode - AddImageButton(12, DrawPoint(124, 166), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 196), + addImageButton(12, DrawPoint(124, 166), Extent(53, 44), TextureColor::Grey, LOADER.getImageN("io", 196), _("Economic Progress")); } @@ -89,13 +89,13 @@ iwMainMenu::iwMainMenu(GameWorldView& gwv, GameCommandFactory& gcFactory) #endif if(gwv.getViewer().getPlayer().isHost && enableAIDebug) { - auto* bt = static_cast(AddTextButton(13, DrawPoint(80, 210), Extent(0, 22), TextureColor::Grey, + auto* bt = static_cast(addTextButton(13, DrawPoint(80, 210), Extent(0, 22), TextureColor::Grey, _("AI"), NormalFont, _("AI Debug Window"))); - bt->ResizeForMaxChars(bt->getText().size()); + bt->resizeForMaxChars(bt->getText().size()); } // Optionen - AddImageButton(30, DrawPoint(12, 231), Extent(165, 32), TextureColor::Grey, LOADER.getImageN("io", 37), + addImageButton(30, DrawPoint(12, 231), Extent(165, 32), TextureColor::Grey, LOADER.getImageN("io", 37), _("Options")); } @@ -108,74 +108,74 @@ void iwMainMenu::msgButtonClick(const unsigned ctrl_id) { case 0: // Verteilung { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer(), gcFactory)); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv.getViewer(), gcFactory)); } break; case 1: // Transport { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer(), gcFactory)); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv.getViewer(), gcFactory)); } break; case 2: // Werkzeugproduktion { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer(), gcFactory)); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv.getViewer(), gcFactory)); } break; case 3: // Statistik { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer())); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv.getViewer())); } break; case 4: // Warenstatistik { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer().getPlayer())); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv.getViewer().getPlayer())); } break; case 5: // Gebäudestatistik { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv, gcFactory)); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv, gcFactory)); } break; case 6: // Inventur { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer().getPlayer())); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv.getViewer().getPlayer())); } break; case 7: // Produktivitäten { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer().getPlayer())); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv.getViewer().getPlayer())); } break; case 8: // Militär { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer(), gcFactory)); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv.getViewer(), gcFactory)); } break; case 9: // Schiffe { - WINDOWMANAGER.ToggleWindow(std::make_unique( + WINDOWMANAGER.toggleWindow(std::make_unique( gwv, gcFactory, gwv.getViewer().getPlayer().getShipByID(0), IngameWindow::posCenter)); } break; case 10: // Baureihenfolge { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer())); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv.getViewer())); } break; case 11: // Diplomatie { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer(), gcFactory)); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv.getViewer(), gcFactory)); } break; case 12: // Wirtschaftsmodusfortschritt { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getViewer())); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv.getViewer())); } break; case 13: // AI Debug { - if(auto* wnd = WINDOWMANAGER.FindNonModalWindow(CGI_AI_DEBUG)) - wnd->Close(); + if(auto* wnd = WINDOWMANAGER.findNonModalWindow(CGI_AI_DEBUG)) + wnd->close(); else if(gwv.getViewer().getPlayer().isHost) { std::vector ais; @@ -185,13 +185,13 @@ void iwMainMenu::msgButtonClick(const unsigned ctrl_id) if(ai) ais.push_back(ai); } - WINDOWMANAGER.Show(std::make_unique(gwv, ais)); + WINDOWMANAGER.show(std::make_unique(gwv, ais)); } } break; case 30: // Optionen { - WINDOWMANAGER.ToggleWindow(std::make_unique(gwv.getSoundMgr())); + WINDOWMANAGER.toggleWindow(std::make_unique(gwv.getSoundMgr())); } break; } diff --git a/libs/s25main/ingameWindows/iwMapDebug.cpp b/libs/s25main/ingameWindows/iwMapDebug.cpp index f1c0980036..ace2bda1fd 100644 --- a/libs/s25main/ingameWindows/iwMapDebug.cpp +++ b/libs/s25main/ingameWindows/iwMapDebug.cpp @@ -82,10 +82,10 @@ class iwMapDebug::DebugPrinter : public IDrawNodeCallback if(showCoords) { std::string coord = helpers::toString(pt.x) + ":" + helpers::toString(pt.y); - font->Draw(displayPt, coord, FontStyle{}, coordsColor); + font->draw(displayPt, coord, FontStyle{}, coordsColor); } if(!data.empty()) - font->Draw(displayPt, data, FontStyle{}, dataColor); + font->draw(displayPt, data, FontStyle{}, dataColor); } bool showCoords; @@ -100,7 +100,7 @@ class iwMapDebug::EventChecker public: EventChecker(const GameWorldBase& gw) : gw(gw) { - bqMap.Resize(gw.getSize()); + bqMap.resize(gw.getSize()); for(unsigned i = 0; i < gw.getNumPlayers(); i++) { if(gw.getPlayer(i).isUsed()) @@ -153,57 +153,57 @@ iwMapDebug::iwMapDebug(GameWorldView& gwv, bool allowCheating) LOADER.getImageN("resource", 41)), gwv(gwv), printer(std::make_unique(gwv.getWorld())) { - gwv.AddDrawNodeCallback(printer.get()); + gwv.addDrawNodeCallback(printer.get()); DrawPoint curPos(15, 25); constexpr Extent ctrlSize(200, 20); constexpr auto spaceY = ctrlSize.y + 5; ctrlCheck* cbShowCoords = - AddCheckBox(ID_cbShowCoordinates, curPos, ctrlSize, TextureColor::Grey, _("Show coordinates"), NormalFont); + addCheckBox(ID_cbShowCoordinates, curPos, ctrlSize, TextureColor::Grey, _("Show coordinates"), NormalFont); curPos.y += spaceY; cbShowCoords->setChecked(true); constexpr Extent editSize(40, ctrlSize.y); - AddText(ID_lblJump, curPos + DrawPoint(0, 2), _("Jump to X:Y"), COLOR_YELLOW, FontStyle{}, NormalFont); + addText(ID_lblJump, curPos + DrawPoint(0, 2), _("Jump to X:Y"), COLOR_YELLOW, FontStyle{}, NormalFont); const DrawPoint edtPos = curPos + DrawPoint(ctrlSize.x - 2 * editSize.x - 2, 0); - AddEdit(ID_edtJumpX, edtPos, editSize, TextureColor::Grey, NormalFont, 4); - AddEdit(ID_edtJumpY, edtPos + DrawPoint(editSize.x + 2, 0), editSize, TextureColor::Grey, NormalFont, 4); + addEdit(ID_edtJumpX, edtPos, editSize, TextureColor::Grey, NormalFont, 4); + addEdit(ID_edtJumpY, edtPos + DrawPoint(editSize.x + 2, 0), editSize, TextureColor::Grey, NormalFont, 4); curPos.y += spaceY; ctrlComboBox* cbCheckEvents = - AddComboBox(ID_cbCheckEventForPlayer, curPos, ctrlSize, TextureColor::Grey, NormalFont, 100); + addComboBox(ID_cbCheckEventForPlayer, curPos, ctrlSize, TextureColor::Grey, NormalFont, 100); curPos.y += spaceY; - cbCheckEvents->AddItem(_("BQ check disabled")); + cbCheckEvents->addItem(_("BQ check disabled")); for(const std::chrono::milliseconds ms : BQ_CHECK_INTERVALS) { - cbCheckEvents->AddItem((boost::format(_("BQ check every %1%ms")) % ms.count()).str()); + cbCheckEvents->addItem((boost::format(_("BQ check every %1%ms")) % ms.count()).str()); } cbCheckEvents->setSelection(0); using namespace std::chrono_literals; - AddTimer(ID_tmrCheckEvents, 500ms)->Stop(); + addTimer(ID_tmrCheckEvents, 500ms)->stop(); if(allowCheating) { - ctrlComboBox* data = AddComboBox(ID_cbShowWhat, curPos, ctrlSize, TextureColor::Grey, NormalFont, 100); + ctrlComboBox* data = addComboBox(ID_cbShowWhat, curPos, ctrlSize, TextureColor::Grey, NormalFont, 100); curPos.y += spaceY; - data->AddItem(_("Nothing")); - data->AddItem(_("Reserved")); - data->AddItem(_("Altitude")); - data->AddItem(_("Resources")); - data->AddItem(_("Sea Id")); - data->AddItem(_("Owner")); - data->AddItem(_("Restricted area")); + data->addItem(_("Nothing")); + data->addItem(_("Reserved")); + data->addItem(_("Altitude")); + data->addItem(_("Resources")); + data->addItem(_("Sea Id")); + data->addItem(_("Owner")); + data->addItem(_("Restricted area")); data->setSelection(1); - ctrlComboBox* players = AddComboBox(ID_cbShowForPlayer, curPos, ctrlSize, TextureColor::Grey, NormalFont, 100); + ctrlComboBox* players = addComboBox(ID_cbShowForPlayer, curPos, ctrlSize, TextureColor::Grey, NormalFont, 100); curPos.y += spaceY; for(unsigned pIdx = 0; pIdx < gwv.getWorld().getNumPlayers(); pIdx++) { const GamePlayer& p = gwv.getWorld().getPlayer(pIdx); if(!p.isUsed()) - players->AddItem((boost::format(_("Player %1%")) % pIdx).str()); + players->addItem((boost::format(_("Player %1%")) % pIdx).str()); else - players->AddItem(p.name); + players->addItem(p.name); } players->setSelection(0); printer->showDataIdx = *data->getSelection(); @@ -222,7 +222,7 @@ iwMapDebug::iwMapDebug(GameWorldView& gwv, bool allowCheating) iwMapDebug::~iwMapDebug() { - gwv.RemoveDrawNodeCallback(printer.get()); + gwv.removeDrawNodeCallback(printer.get()); } void iwMapDebug::msgComboSelectItem(const unsigned ctrl_id, const unsigned select) @@ -236,11 +236,11 @@ void iwMapDebug::msgComboSelectItem(const unsigned ctrl_id, const unsigned selec if(select == 0) { eventChecker.reset(); - getCtrl(ID_tmrCheckEvents)->Stop(); + getCtrl(ID_tmrCheckEvents)->stop(); } else { eventChecker = std::make_unique(gwv.getWorld()); - getCtrl(ID_tmrCheckEvents)->Start(BQ_CHECK_INTERVALS[select - 1]); + getCtrl(ID_tmrCheckEvents)->start(BQ_CHECK_INTERVALS[select - 1]); } } } @@ -264,7 +264,7 @@ void iwMapDebug::msgEditEnter(unsigned ctrl_id) if(s25util::tryFromStringClassic(getCtrl(ID_edtJumpX)->getText(), pos.x) && s25util::tryFromStringClassic(getCtrl(ID_edtJumpY)->getText(), pos.y)) { - gwv.MoveToMapPt(gwv.getWorld().MakeMapPoint(pos)); + gwv.moveToMapPt(gwv.getWorld().makeMapPoint(pos)); } } diff --git a/libs/s25main/ingameWindows/iwMapGenerator.cpp b/libs/s25main/ingameWindows/iwMapGenerator.cpp index a0173750bb..054e042350 100644 --- a/libs/s25main/ingameWindows/iwMapGenerator.cpp +++ b/libs/s25main/ingameWindows/iwMapGenerator.cpp @@ -27,7 +27,7 @@ iwMapGenerator::iwMapGenerator(MapSettings& settings) GameDataLoader gdLoader(desc); if(!gdLoader.Load()) { - Close(); + close(); return; } @@ -39,99 +39,99 @@ iwMapGenerator::iwMapGenerator(MapSettings& settings) constexpr Extent buttonSize(100, 20); curPos.y += 30; - ctrlComboBox* combo = AddComboBox(ID_cbNumPlayers, curPos, comboSize, TextureColor::Grey, NormalFont, 100); + ctrlComboBox* combo = addComboBox(ID_cbNumPlayers, curPos, comboSize, TextureColor::Grey, NormalFont, 100); for(unsigned n = 2; n <= MAX_PLAYERS; n++) - combo->AddItem(helpers::format(_("%1% players"), n)); + combo->addItem(helpers::format(_("%1% players"), n)); curPos.y += 30; - AddText(ID_txtMapStyle, curPos, _("Style"), COLOR_YELLOW, FontStyle{}, NormalFont); + addText(ID_txtMapStyle, curPos, _("Style"), COLOR_YELLOW, FontStyle{}, NormalFont); combo = - AddComboBox(ID_cbMapStyle, curPos + DrawPoint(100, -5), comboSizeSmall, TextureColor::Grey, NormalFont, 100); - combo->AddItem(_("Water")); - combo->AddItem(_("Land")); - combo->AddItem(_("Mixed")); + addComboBox(ID_cbMapStyle, curPos + DrawPoint(100, -5), comboSizeSmall, TextureColor::Grey, NormalFont, 100); + combo->addItem(_("Water")); + combo->addItem(_("Land")); + combo->addItem(_("Mixed")); curPos.y += 30; - AddText(ID_txtMapSize, curPos, _("Size"), COLOR_YELLOW, FontStyle{}, NormalFont); + addText(ID_txtMapSize, curPos, _("Size"), COLOR_YELLOW, FontStyle{}, NormalFont); auto* cbSizeX = - AddComboBox(ID_cbMapSizeX, curPos + DrawPoint(100, -5), Extent(50, 20), TextureColor::Grey, NormalFont, 200); - AddText(ID_txtMapSizeX, curPos + DrawPoint(160, 5), "x", COLOR_YELLOW, FontStyle::VCENTER, NormalFont); + addComboBox(ID_cbMapSizeX, curPos + DrawPoint(100, -5), Extent(50, 20), TextureColor::Grey, NormalFont, 200); + addText(ID_txtMapSizeX, curPos + DrawPoint(160, 5), "x", COLOR_YELLOW, FontStyle::VCENTER, NormalFont); auto* cbSizeY = - AddComboBox(ID_cbMapSizeY, curPos + DrawPoint(180, -5), Extent(50, 20), TextureColor::Grey, NormalFont, 200); + addComboBox(ID_cbMapSizeY, curPos + DrawPoint(180, -5), Extent(50, 20), TextureColor::Grey, NormalFont, 200); for(unsigned size = 32; size <= 320; size += 32) { const auto strSize = s25util::toStringClassic(size); - cbSizeX->AddItem(strSize); - cbSizeY->AddItem(strSize); + cbSizeX->addItem(strSize); + cbSizeY->addItem(strSize); } curPos.y += 30; - AddText(ID_txtLandscape, curPos, _("Landscape"), COLOR_YELLOW, FontStyle{}, NormalFont); + addText(ID_txtLandscape, curPos, _("Landscape"), COLOR_YELLOW, FontStyle{}, NormalFont); curPos.y += 20; - combo = AddComboBox(ID_cbMapType, curPos, comboSize, TextureColor::Grey, NormalFont, 100); + combo = addComboBox(ID_cbMapType, curPos, comboSize, TextureColor::Grey, NormalFont, 100); for(unsigned i = 0; i < desc.landscapes.size(); i++) - combo->AddItem(_(desc.get(DescIdx(i)).name)); + combo->addItem(_(desc.get(DescIdx(i)).name)); curPos.y += 30; - AddText(ID_txtMountainDist, curPos, _("HQ distance to mountain"), COLOR_YELLOW, FontStyle{}, NormalFont); + addText(ID_txtMountainDist, curPos, _("HQ distance to mountain"), COLOR_YELLOW, FontStyle{}, NormalFont); curPos.y += 20; - combo = AddComboBox(ID_cbMountainDist, curPos, comboSize, TextureColor::Grey, NormalFont, 100); - combo->AddItem(_("Close")); - combo->AddItem(_("Normal")); - combo->AddItem(_("Far")); - combo->AddItem(_("Very far")); + combo = addComboBox(ID_cbMountainDist, curPos, comboSize, TextureColor::Grey, NormalFont, 100); + combo->addItem(_("Close")); + combo->addItem(_("Normal")); + combo->addItem(_("Far")); + combo->addItem(_("Very far")); curPos.y += 30; - AddText(ID_txtIslands, curPos, _("Islands"), COLOR_YELLOW, FontStyle{}, NormalFont); + addText(ID_txtIslands, curPos, _("Islands"), COLOR_YELLOW, FontStyle{}, NormalFont); curPos.y += 20; - combo = AddComboBox(ID_cbIslands, curPos, comboSize, TextureColor::Grey, NormalFont, 100); - combo->AddItem(_("Few")); - combo->AddItem(_("Medium")); - combo->AddItem(_("Many")); + combo = addComboBox(ID_cbIslands, curPos, comboSize, TextureColor::Grey, NormalFont, 100); + combo->addItem(_("Few")); + combo->addItem(_("Medium")); + combo->addItem(_("Many")); constexpr int pgrOffset = 120; curPos.y += 35; - AddText(ID_txtGold, curPos, _("Gold:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddProgress(ID_pgGoldRatio, DrawPoint(pgrOffset, curPos.y - 5), progressSize, TextureColor::Grey, 139, 138, 100); + addText(ID_txtGold, curPos, _("Gold:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addProgress(ID_pgGoldRatio, DrawPoint(pgrOffset, curPos.y - 5), progressSize, TextureColor::Grey, 139, 138, 100); curPos.y += 30; - AddText(ID_txtIron, curPos, _("Iron:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddProgress(ID_pgIronRatio, DrawPoint(pgrOffset, curPos.y - 5), progressSize, TextureColor::Grey, 139, 138, 100); + addText(ID_txtIron, curPos, _("Iron:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addProgress(ID_pgIronRatio, DrawPoint(pgrOffset, curPos.y - 5), progressSize, TextureColor::Grey, 139, 138, 100); curPos.y += 30; - AddText(ID_txtCoal, curPos, _("Coal:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddProgress(ID_pgCoalRatio, DrawPoint(pgrOffset, curPos.y - 5), progressSize, TextureColor::Grey, 139, 138, 100); + addText(ID_txtCoal, curPos, _("Coal:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addProgress(ID_pgCoalRatio, DrawPoint(pgrOffset, curPos.y - 5), progressSize, TextureColor::Grey, 139, 138, 100); curPos.y += 30; - AddText(ID_txtGranite, curPos, _("Granite:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddProgress(ID_pgGraniteRatio, DrawPoint(pgrOffset, curPos.y - 5), progressSize, TextureColor::Grey, 139, 138, 100); + addText(ID_txtGranite, curPos, _("Granite:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addProgress(ID_pgGraniteRatio, DrawPoint(pgrOffset, curPos.y - 5), progressSize, TextureColor::Grey, 139, 138, 100); curPos.y += 30; - AddText(ID_txtRivers, curPos, _("Rivers:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddProgress(ID_pgRivers, DrawPoint(pgrOffset, curPos.y - 5), progressSize, TextureColor::Grey, 139, 138, 100); + addText(ID_txtRivers, curPos, _("Rivers:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addProgress(ID_pgRivers, DrawPoint(pgrOffset, curPos.y - 5), progressSize, TextureColor::Grey, 139, 138, 100); curPos.y += 30; - AddText(ID_txtTrees, curPos, _("Trees:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddProgress(ID_pgTrees, DrawPoint(pgrOffset, curPos.y - 5), progressSize, TextureColor::Grey, 139, 138, 100); + addText(ID_txtTrees, curPos, _("Trees:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addProgress(ID_pgTrees, DrawPoint(pgrOffset, curPos.y - 5), progressSize, TextureColor::Grey, 139, 138, 100); curPos.y += 30; - AddText(ID_txtStonePiles, curPos, _("Stone piles:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddProgress(ID_pgStonePiles, DrawPoint(pgrOffset, curPos.y - 5), progressSize, TextureColor::Grey, 139, 138, 100); + addText(ID_txtStonePiles, curPos, _("Stone piles:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addProgress(ID_pgStonePiles, DrawPoint(pgrOffset, curPos.y - 5), progressSize, TextureColor::Grey, 139, 138, 100); curPos.y += 25; - AddTextButton(ID_btBack, curPos, buttonSize, TextureColor::Red1, _("Back"), NormalFont); - AddTextButton(ID_btApply, DrawPoint(130, curPos.y), buttonSize, TextureColor::Green2, _("Apply"), NormalFont); + addTextButton(ID_btBack, curPos, buttonSize, TextureColor::Red1, _("Back"), NormalFont); + addTextButton(ID_btApply, DrawPoint(130, curPos.y), buttonSize, TextureColor::Green2, _("Apply"), NormalFont); - Reset(); + reset(); } void iwMapGenerator::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { - case ID_btBack: Close(); break; + case ID_btBack: close(); break; case ID_btApply: - Apply(); - Close(); + apply(); + close(); break; } } -void iwMapGenerator::Apply() +void iwMapGenerator::apply() { mapSettings.numPlayers = getCtrl(ID_cbNumPlayers)->getSelection().value() + 2; mapSettings.ratioGold = getCtrl(ID_pgGoldRatio)->getPosition(); @@ -170,7 +170,7 @@ void iwMapGenerator::Apply() mapSettings.type = DescIdx(*mapType); } -void iwMapGenerator::Reset() +void iwMapGenerator::reset() { getCtrl(ID_cbNumPlayers) ->setSelection(std::min(mapSettings.numPlayers, MAX_PLAYERS) - 2); // List starts at 2 players diff --git a/libs/s25main/ingameWindows/iwMapGenerator.h b/libs/s25main/ingameWindows/iwMapGenerator.h index a1b29c3bae..7298b389be 100644 --- a/libs/s25main/ingameWindows/iwMapGenerator.h +++ b/libs/s25main/ingameWindows/iwMapGenerator.h @@ -56,7 +56,7 @@ class iwMapGenerator : public IngameWindow rttr::mapGenerator::MapSettings& mapSettings; /// Reset the UI to the values of @ref mapSettings - void Reset(); + void reset(); /// Updates @ref mapSettings with the values currently configured in the UI. - void Apply(); + void apply(); }; diff --git a/libs/s25main/ingameWindows/iwMerchandiseStatistics.cpp b/libs/s25main/ingameWindows/iwMerchandiseStatistics.cpp index bd729918ae..a402561a85 100644 --- a/libs/s25main/ingameWindows/iwMerchandiseStatistics.cpp +++ b/libs/s25main/ingameWindows/iwMerchandiseStatistics.cpp @@ -37,67 +37,67 @@ iwMerchandiseStatistics::iwMerchandiseStatistics(const GamePlayer& player) player(player), currentTime(StatisticTime::T1Hour) { // Statistikfeld - AddImage(0, DrawPoint(10 + 115, 23 + 81), LOADER.getImageN("io", 228)); + addImage(0, DrawPoint(10 + 115, 23 + 81), LOADER.getImageN("io", 228)); // Waren-Buttons // obere Reihe - ctrlMultiSelectGroup* types = AddMultiSelectGroup(22, GroupSelectType::Illuminate); - types->AddImageButton(1, DrawPoint(17, 192), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Wood), + ctrlMultiSelectGroup* types = addMultiSelectGroup(22, GroupSelectType::Illuminate); + types->addImageButton(1, DrawPoint(17, 192), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Wood), _("Wood")); - types->AddImageButton(2, DrawPoint(48, 192), Extent(30, 30), TextureColor::Grey, + types->addImageButton(2, DrawPoint(48, 192), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Boards), _("Boards")); - types->AddImageButton(3, DrawPoint(79, 192), Extent(30, 30), TextureColor::Grey, + types->addImageButton(3, DrawPoint(79, 192), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Stones), _("Stones")); - types->AddImageButton(4, DrawPoint(110, 192), Extent(30, 30), TextureColor::Grey, LOADER.getImageN("io", 80), + types->addImageButton(4, DrawPoint(110, 192), Extent(30, 30), TextureColor::Grey, LOADER.getImageN("io", 80), _("Food")); - types->AddImageButton(5, DrawPoint(141, 192), Extent(30, 30), TextureColor::Grey, + types->addImageButton(5, DrawPoint(141, 192), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Water), _("Water")); - types->AddImageButton(6, DrawPoint(172, 192), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Beer), + types->addImageButton(6, DrawPoint(172, 192), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Beer), _("Beer")); - types->AddImageButton(7, DrawPoint(203, 192), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Coal), + types->addImageButton(7, DrawPoint(203, 192), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Coal), _("Coal")); // untere Reihe - types->AddImageButton(8, DrawPoint(17, 227), Extent(30, 30), TextureColor::Grey, + types->addImageButton(8, DrawPoint(17, 227), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::IronOre), _("Ironore")); - types->AddImageButton(9, DrawPoint(48, 227), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Gold), + types->addImageButton(9, DrawPoint(48, 227), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Gold), _("Gold")); - types->AddImageButton(10, DrawPoint(79, 227), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Iron), + types->addImageButton(10, DrawPoint(79, 227), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Iron), _("Iron")); - types->AddImageButton(11, DrawPoint(110, 227), Extent(30, 30), TextureColor::Grey, + types->addImageButton(11, DrawPoint(110, 227), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Coins), _("Coins")); - types->AddImageButton(12, DrawPoint(141, 227), Extent(30, 30), TextureColor::Grey, + types->addImageButton(12, DrawPoint(141, 227), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Hammer), _("Tools")); - types->AddImageButton(13, DrawPoint(172, 227), Extent(30, 30), TextureColor::Grey, LOADER.getImageN("io", 111), + types->addImageButton(13, DrawPoint(172, 227), Extent(30, 30), TextureColor::Grey, LOADER.getImageN("io", 111), _("Weapons")); - types->AddImageButton(14, DrawPoint(203, 227), Extent(30, 30), TextureColor::Grey, + types->addImageButton(14, DrawPoint(203, 227), Extent(30, 30), TextureColor::Grey, LOADER.getWareTex(GoodType::Boat), _("Boats")); // Hilfe - AddImageButton(16, DrawPoint(17, 261), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); + addImageButton(16, DrawPoint(17, 261), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); // Mülleimer - AddImageButton(17, DrawPoint(49, 263), Extent(30, 28), TextureColor::Grey, LOADER.getImageN("io", 106), + addImageButton(17, DrawPoint(49, 263), Extent(30, 28), TextureColor::Grey, LOADER.getImageN("io", 106), _("Delete all")); // Zeiten - ctrlOptionGroup* times = AddOptionGroup(23, GroupSelectType::Illuminate); - times->AddTextButton(18, DrawPoint(81, 263), Extent(36, 28), TextureColor::Grey, _("15 m"), NormalFont); - times->AddTextButton(19, DrawPoint(119, 263), Extent(36, 28), TextureColor::Grey, _("1 h"), NormalFont); - times->AddTextButton(20, DrawPoint(155, 263), Extent(36, 28), TextureColor::Grey, _("4 h"), NormalFont); - times->AddTextButton(21, DrawPoint(191, 263), Extent(36, 28), TextureColor::Grey, _("16 h"), NormalFont); + ctrlOptionGroup* times = addOptionGroup(23, GroupSelectType::Illuminate); + times->addTextButton(18, DrawPoint(81, 263), Extent(36, 28), TextureColor::Grey, _("15 m"), NormalFont); + times->addTextButton(19, DrawPoint(119, 263), Extent(36, 28), TextureColor::Grey, _("1 h"), NormalFont); + times->addTextButton(20, DrawPoint(155, 263), Extent(36, 28), TextureColor::Grey, _("4 h"), NormalFont); + times->addTextButton(21, DrawPoint(191, 263), Extent(36, 28), TextureColor::Grey, _("16 h"), NormalFont); times->setSelection(19); // Zeit-Werte an der x-Achse timeAnnotations = std::vector(7); for(unsigned i = 0; i < 7; ++i) { - timeAnnotations[i] = AddText(32 + i, DrawPoint(211 + i, 125 + i), "", MakeColor(255, 136, 96, 52), + timeAnnotations[i] = addText(32 + i, DrawPoint(211 + i, 125 + i), "", MakeColor(255, 136, 96, 52), FontStyle::CENTER | FontStyle::TOP | FontStyle::NO_OUTLINE, NormalFont); } // Aktueller Maximalwert an der y-Achse - maxValue = AddText(31, DrawPoint(211, 55), "1", MakeColor(255, 136, 96, 52), + maxValue = addText(31, DrawPoint(211, 55), "1", MakeColor(255, 136, 96, 52), FontStyle::RIGHT | FontStyle::VCENTER | FontStyle::NO_OUTLINE, NormalFont); } @@ -109,7 +109,7 @@ void iwMerchandiseStatistics::msgButtonClick(const unsigned ctrl_id) { case 16: // Hilfe { - WINDOWMANAGER.ReplaceWindow(std::make_unique( + WINDOWMANAGER.replaceWindow(std::make_unique( _("The merchandise statistics window allows you to check the quantities " "of your merchandise. By clicking the left mouse button you can switch " "the display of individual goods on and off. These can displayed over " @@ -120,7 +120,7 @@ void iwMerchandiseStatistics::msgButtonClick(const unsigned ctrl_id) { const std::set active = getCtrl(22)->getSelection(); for(unsigned sel : active) - getCtrl(22)->RemoveSelection(sel); + getCtrl(22)->removeSelection(sel); } break; } @@ -142,15 +142,15 @@ void iwMerchandiseStatistics::msgOptionGroupChange(const unsigned ctrl_id, const } } -void iwMerchandiseStatistics::DrawContent() +void iwMerchandiseStatistics::drawContent() { - DrawRectangles(); - DrawAxis(); - DrawStatistic(); + drawRectangles(); + drawAxis(); + drawStatistic(); } // TODO -void iwMerchandiseStatistics::DrawStatistic() +void iwMerchandiseStatistics::drawStatistic() { // Ein paar benötigte Werte... const int sizeX = 180; @@ -199,7 +199,7 @@ void iwMerchandiseStatistics::DrawStatistic() / max; if(i != 0) { - DrawLine(drawPos, previous, 2, BarColors[it - 1]); + drawLine(drawPos, previous, 2, BarColors[it - 1]); } previous = drawPos; } @@ -207,7 +207,7 @@ void iwMerchandiseStatistics::DrawStatistic() } // Lustige bunte Kästchen über den Buttons malen -void iwMerchandiseStatistics::DrawRectangles() +void iwMerchandiseStatistics::drawRectangles() { const Extent size(30, 4); const DrawPoint step(31, 35); @@ -217,7 +217,7 @@ void iwMerchandiseStatistics::DrawRectangles() for(unsigned i = 0; i < 14; ++i) { - DrawRectangle(Rect(pos + curOffset, size), BarColors[i]); + drawRectangle(Rect(pos + curOffset, size), BarColors[i]); if(i == 6) { curOffset.x = 17; @@ -227,7 +227,7 @@ void iwMerchandiseStatistics::DrawRectangles() } } -void iwMerchandiseStatistics::DrawAxis() +void iwMerchandiseStatistics::drawAxis() { // Ein paar benötigte Werte... const int sizeX = 180; @@ -236,15 +236,15 @@ void iwMerchandiseStatistics::DrawAxis() const DrawPoint topLeftRel(37, 64); // X-Achse, horizontal, war irgendwie zu lang links :S - DrawLine(topLeft + DrawPoint(6, sizeY + 2), // bisschen tiefer, damit man nulllinien noch sieht + drawLine(topLeft + DrawPoint(6, sizeY + 2), // bisschen tiefer, damit man nulllinien noch sieht topLeft + DrawPoint(sizeX, sizeY + 1), 1, MakeColor(255, 88, 44, 16)); // Y-Achse, vertikal - DrawLine(topLeft + DrawPoint(sizeX, 0), topLeft + DrawPoint(sizeX, sizeY + 5), 1, MakeColor(255, 88, 44, 16)); + drawLine(topLeft + DrawPoint(sizeX, 0), topLeft + DrawPoint(sizeX, sizeY + 5), 1, MakeColor(255, 88, 44, 16)); // Striche an der Y-Achse - DrawLine(topLeft + DrawPoint(sizeX - 3, 0), topLeft + DrawPoint(sizeX + 4, 0), 1, MakeColor(255, 88, 44, 16)); - DrawLine(topLeft + DrawPoint(sizeX - 3, sizeY / 2), topLeft + DrawPoint(sizeX + 4, sizeY / 2), 1, + drawLine(topLeft + DrawPoint(sizeX - 3, 0), topLeft + DrawPoint(sizeX + 4, 0), 1, MakeColor(255, 88, 44, 16)); + drawLine(topLeft + DrawPoint(sizeX - 3, sizeY / 2), topLeft + DrawPoint(sizeX + 4, sizeY / 2), 1, MakeColor(255, 88, 44, 16)); // Striche an der X-Achse + Beschriftung @@ -257,35 +257,35 @@ void iwMerchandiseStatistics::DrawAxis() { case StatisticTime::T15Minutes: // -15 - DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[0]->setPos(topLeftRel + DrawPoint(6, sizeY + 6)); timeAnnotations[0]->setText("-15"); timeAnnotations[0]->setVisible(true); // -12 - DrawLine(topLeft + DrawPoint(40, sizeY + 2), topLeft + DrawPoint(40, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(40, sizeY + 2), topLeft + DrawPoint(40, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[1]->setPos(topLeftRel + DrawPoint(40, sizeY + 6)); timeAnnotations[1]->setText("-12"); timeAnnotations[1]->setVisible(true); // -9 - DrawLine(topLeft + DrawPoint(75, sizeY + 2), topLeft + DrawPoint(75, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(75, sizeY + 2), topLeft + DrawPoint(75, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[2]->setPos(topLeftRel + DrawPoint(75, sizeY + 6)); timeAnnotations[2]->setText("-9"); timeAnnotations[2]->setVisible(true); // -6 - DrawLine(topLeft + DrawPoint(110, sizeY + 2), topLeft + DrawPoint(110, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(110, sizeY + 2), topLeft + DrawPoint(110, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[3]->setPos(topLeftRel + DrawPoint(110, sizeY + 6)); timeAnnotations[3]->setText("-6"); timeAnnotations[3]->setVisible(true); // -3 - DrawLine(topLeft + DrawPoint(145, sizeY + 2), topLeft + DrawPoint(145, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(145, sizeY + 2), topLeft + DrawPoint(145, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[4]->setPos(topLeftRel + DrawPoint(145, sizeY + 6)); timeAnnotations[4]->setText("-3"); @@ -295,42 +295,42 @@ void iwMerchandiseStatistics::DrawAxis() break; case StatisticTime::T1Hour: // -60 - DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[0]->setPos(topLeftRel + DrawPoint(6, sizeY + 6)); timeAnnotations[0]->setText("-60"); timeAnnotations[0]->setVisible(true); // -50 - DrawLine(topLeft + DrawPoint(35, sizeY + 2), topLeft + DrawPoint(35, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(35, sizeY + 2), topLeft + DrawPoint(35, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[1]->setPos(topLeftRel + DrawPoint(35, sizeY + 6)); timeAnnotations[1]->setText("-50"); timeAnnotations[1]->setVisible(true); // -40 - DrawLine(topLeft + DrawPoint(64, sizeY + 2), topLeft + DrawPoint(64, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(64, sizeY + 2), topLeft + DrawPoint(64, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[2]->setPos(topLeftRel + DrawPoint(64, sizeY + 6)); timeAnnotations[2]->setText("-40"); timeAnnotations[2]->setVisible(true); // -30 - DrawLine(topLeft + DrawPoint(93, sizeY + 2), topLeft + DrawPoint(93, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(93, sizeY + 2), topLeft + DrawPoint(93, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[3]->setPos(topLeftRel + DrawPoint(93, sizeY + 6)); timeAnnotations[3]->setText("-30"); timeAnnotations[3]->setVisible(true); // -20 - DrawLine(topLeft + DrawPoint(122, sizeY + 2), topLeft + DrawPoint(122, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(122, sizeY + 2), topLeft + DrawPoint(122, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[4]->setPos(topLeftRel + DrawPoint(122, sizeY + 6)); timeAnnotations[4]->setText("-20"); timeAnnotations[4]->setVisible(true); // -10 - DrawLine(topLeft + DrawPoint(151, sizeY + 2), topLeft + DrawPoint(151, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(151, sizeY + 2), topLeft + DrawPoint(151, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[5]->setPos(topLeftRel + DrawPoint(151, sizeY + 6)); timeAnnotations[5]->setText("-10"); @@ -338,28 +338,28 @@ void iwMerchandiseStatistics::DrawAxis() break; case StatisticTime::T4Hours: // -240 - DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[0]->setPos(topLeftRel + DrawPoint(6, sizeY + 6)); timeAnnotations[0]->setText("-240"); timeAnnotations[0]->setVisible(true); // -180 - DrawLine(topLeft + DrawPoint(49, sizeY + 2), topLeft + DrawPoint(49, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(49, sizeY + 2), topLeft + DrawPoint(49, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[1]->setPos(topLeftRel + DrawPoint(49, sizeY + 6)); timeAnnotations[1]->setText("-180"); timeAnnotations[1]->setVisible(true); // -120 - DrawLine(topLeft + DrawPoint(93, sizeY + 2), topLeft + DrawPoint(93, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(93, sizeY + 2), topLeft + DrawPoint(93, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[2]->setPos(topLeftRel + DrawPoint(93, sizeY + 6)); timeAnnotations[2]->setText("-120"); timeAnnotations[2]->setVisible(true); // -60 - DrawLine(topLeft + DrawPoint(136, sizeY + 2), topLeft + DrawPoint(136, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(136, sizeY + 2), topLeft + DrawPoint(136, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[3]->setPos(topLeftRel + DrawPoint(136, sizeY + 6)); timeAnnotations[3]->setText("-60"); @@ -370,28 +370,28 @@ void iwMerchandiseStatistics::DrawAxis() break; case StatisticTime::T16Hours: // -960 - DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[0]->setPos(topLeftRel + DrawPoint(6, sizeY + 6)); timeAnnotations[0]->setText("-960"); timeAnnotations[0]->setVisible(true); // -720 - DrawLine(topLeft + DrawPoint(49, sizeY + 2), topLeft + DrawPoint(49, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(49, sizeY + 2), topLeft + DrawPoint(49, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[1]->setPos(topLeftRel + DrawPoint(49, sizeY + 6)); timeAnnotations[1]->setText("-720"); timeAnnotations[1]->setVisible(true); // -480 - DrawLine(topLeft + DrawPoint(93, sizeY + 2), topLeft + DrawPoint(93, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(93, sizeY + 2), topLeft + DrawPoint(93, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[2]->setPos(topLeftRel + DrawPoint(93, sizeY + 6)); timeAnnotations[2]->setText("-480"); timeAnnotations[2]->setVisible(true); // -240 - DrawLine(topLeft + DrawPoint(136, sizeY + 2), topLeft + DrawPoint(136, sizeY + 4), 1, + drawLine(topLeft + DrawPoint(136, sizeY + 2), topLeft + DrawPoint(136, sizeY + 4), 1, MakeColor(255, 88, 44, 16)); timeAnnotations[3]->setPos(topLeftRel + DrawPoint(136, sizeY + 6)); timeAnnotations[3]->setText("-240"); diff --git a/libs/s25main/ingameWindows/iwMerchandiseStatistics.h b/libs/s25main/ingameWindows/iwMerchandiseStatistics.h index fe7403e0eb..8fe610b4ca 100644 --- a/libs/s25main/ingameWindows/iwMerchandiseStatistics.h +++ b/libs/s25main/ingameWindows/iwMerchandiseStatistics.h @@ -19,11 +19,11 @@ class iwMerchandiseStatistics : public IngameWindow private: /// Malt die bunten Kästchen über den Buttons - void DrawRectangles(); + void drawRectangles(); /// Zeichnet das Achsensystem - void DrawAxis(); + void drawAxis(); /// Zeichnet die Statistikdaten (TODO) - void DrawStatistic(); + void drawStatistic(); // Die Farben für die einzelnen Warenlinien static const std::array BarColors; @@ -38,7 +38,7 @@ class iwMerchandiseStatistics : public IngameWindow // Maximalwert der y-Achse ctrlText* maxValue; - void DrawContent() override; + void drawContent() override; // Durchgereichte Methoden vom Window void msgOptionGroupChange(unsigned ctrl_id, unsigned selection) override; void msgButtonClick(unsigned ctrl_id) override; diff --git a/libs/s25main/ingameWindows/iwMilitary.cpp b/libs/s25main/ingameWindows/iwMilitary.cpp index 12fe869222..ecf4c51e8a 100644 --- a/libs/s25main/ingameWindows/iwMilitary.cpp +++ b/libs/s25main/ingameWindows/iwMilitary.cpp @@ -35,49 +35,49 @@ iwMilitary::iwMilitary(const GameWorldViewer& gwv, GameCommandFactory& gcFactory constexpr Extent progPadding(4, 4); constexpr unsigned progSpacing = 6; DrawPoint curPos((getSize().x - progSize.x) / 2, 25); // Same space left and right - AddProgress(ID_Offset, curPos, progSize, TextureColor::Grey, 119, 120, MILITARY_SETTINGS_SCALE[0], "", progPadding, + addProgress(ID_Offset, curPos, progSize, TextureColor::Grey, 119, 120, MILITARY_SETTINGS_SCALE[0], "", progPadding, 0, _("Fewer recruits"), _("More recruits")); /* pitch: progPadding */ curPos.y += progSize.y + progSpacing; - AddProgress(ID_Offset + 1, curPos, progSize, TextureColor::Grey, 121, 122, MILITARY_SETTINGS_SCALE[1], "", + addProgress(ID_Offset + 1, curPos, progSize, TextureColor::Grey, 121, 122, MILITARY_SETTINGS_SCALE[1], "", progPadding, 0, _("Weak defense"), _("Strong defense")); curPos.y += progSize.y + progSpacing; - auto* ctrl = AddProgress(ID_Offset + 2, curPos, progSize, TextureColor::Grey, 123, 124, MILITARY_SETTINGS_SCALE[2], + auto* ctrl = addProgress(ID_Offset + 2, curPos, progSize, TextureColor::Grey, 123, 124, MILITARY_SETTINGS_SCALE[2], "", progPadding, 0, _("Fewer defenders"), _("More defenders")); // Hide defender setting if changing defender behavior is disabled if(gwv.getWorld().getGGS().getSelection(AddonId::DEFENDER_BEHAVIOR) == 1) ctrl->setVisible(false); else curPos.y += progSize.y + progSpacing; - AddProgress(ID_Offset + 3, curPos, progSize, TextureColor::Grey, 209, 210, MILITARY_SETTINGS_SCALE[3], "", + addProgress(ID_Offset + 3, curPos, progSize, TextureColor::Grey, 209, 210, MILITARY_SETTINGS_SCALE[3], "", progPadding, 0, _("Less attackers"), _("More attackers")); curPos.y += progSize.y + progSpacing; - AddProgress(ID_Offset + 4, curPos, progSize, TextureColor::Grey, 129, 130, MILITARY_SETTINGS_SCALE[4], "", + addProgress(ID_Offset + 4, curPos, progSize, TextureColor::Grey, 129, 130, MILITARY_SETTINGS_SCALE[4], "", progPadding, 0, _("Interior"), _("Interior")); curPos.y += progSize.y + progSpacing; - AddProgress(ID_Offset + 5, curPos, progSize, TextureColor::Grey, 127, 128, MILITARY_SETTINGS_SCALE[5], "", + addProgress(ID_Offset + 5, curPos, progSize, TextureColor::Grey, 127, 128, MILITARY_SETTINGS_SCALE[5], "", progPadding, 0, _("Center of country"), _("Center of country")); curPos.y += progSize.y + progSpacing; - ctrl = AddProgress(ID_Offset + 6, curPos, progSize, TextureColor::Grey, 1000, 1001, MILITARY_SETTINGS_SCALE[6], "", + ctrl = addProgress(ID_Offset + 6, curPos, progSize, TextureColor::Grey, 1000, 1001, MILITARY_SETTINGS_SCALE[6], "", progPadding, 0, _("Near harbor points"), _("Near harbor points")); // Hide changing harbor area if sea attacks are disabled if(!gwv.getWorld().getGGS().isEnabled(AddonId::SEA_ATTACK)) ctrl->setVisible(false); else curPos.y += progSize.y + progSpacing; - AddProgress(ID_Offset + 7, curPos, progSize, TextureColor::Grey, 125, 126, MILITARY_SETTINGS_SCALE[7], "", + addProgress(ID_Offset + 7, curPos, progSize, TextureColor::Grey, 125, 126, MILITARY_SETTINGS_SCALE[7], "", progPadding, 0, _("Border areas"), _("Border areas")); // Buttons at bottom constexpr Extent buttonSize(30, 32); curPos.y = getRightBottomBoundary().y - buttonSize.y - 5; - AddImageButton(ID_btHelp, curPos, buttonSize, TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); + addImageButton(ID_btHelp, curPos, buttonSize, TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); curPos.x += progSize.x - buttonSize.x; - AddImageButton(ID_btDefault, curPos, buttonSize, TextureColor::Grey, LOADER.getImageN("io", 191), _("Default")); + addImageButton(ID_btDefault, curPos, buttonSize, TextureColor::Grey, LOADER.getImageN("io", 191), _("Default")); - iwMilitary::UpdateSettings(); + iwMilitary::updateSettings(); } -void iwMilitary::TransmitSettings() +void iwMilitary::transmitSettings() { if(GAMECLIENT.isReplayModeOn()) return; @@ -102,17 +102,17 @@ void iwMilitary::msgProgressChange(const unsigned /*ctrl_id*/, const unsigned sh settings_changed = true; } -void iwMilitary::UpdateSettings(const MilitarySettings& military_settings) +void iwMilitary::updateSettings(const MilitarySettings& military_settings) { if(GAMECLIENT.isReplayModeOn()) - GAMECLIENT.ResetVisualSettings(); + GAMECLIENT.resetVisualSettings(); for(unsigned i = 0; i < military_settings.size(); ++i) getCtrl(ID_Offset + i)->setPosition(military_settings[i]); } -void iwMilitary::UpdateSettings() +void iwMilitary::updateSettings() { - UpdateSettings(GAMECLIENT.visual_settings.military_settings); + updateSettings(GAMECLIENT.visual_settings.military_settings); } void iwMilitary::msgButtonClick(const unsigned ctrl_id) @@ -122,7 +122,7 @@ void iwMilitary::msgButtonClick(const unsigned ctrl_id) default: return; case ID_btHelp: { - WINDOWMANAGER.ReplaceWindow( + WINDOWMANAGER.replaceWindow( std::make_unique(_("This is where you can make adjustments to all military matters. " "The upper value corresponds to the recruiting rate of your army. " "The higher it is, the more inhabitants are recruited as soldiers. " @@ -137,7 +137,7 @@ void iwMilitary::msgButtonClick(const unsigned ctrl_id) break; case ID_btDefault: { - UpdateSettings(GAMECLIENT.default_settings.military_settings); + updateSettings(GAMECLIENT.default_settings.military_settings); settings_changed = true; } break; diff --git a/libs/s25main/ingameWindows/iwMilitary.h b/libs/s25main/ingameWindows/iwMilitary.h index af171785fa..025efccb27 100644 --- a/libs/s25main/ingameWindows/iwMilitary.h +++ b/libs/s25main/ingameWindows/iwMilitary.h @@ -20,10 +20,10 @@ class iwMilitary final : public TransmitSettingsIgwAdapter private: /// Update controls with given military settings - void UpdateSettings(const MilitarySettings& military_settings); - void UpdateSettings() override; + void updateSettings(const MilitarySettings& military_settings); + void updateSettings() override; /// Send changed values to client, if any have changed - void TransmitSettings() override; + void transmitSettings() override; void msgProgressChange(unsigned ctrl_id, unsigned short position) override; void msgButtonClick(unsigned ctrl_id) override; diff --git a/libs/s25main/ingameWindows/iwMilitaryBuilding.cpp b/libs/s25main/ingameWindows/iwMilitaryBuilding.cpp index 8bd2bab51d..4b25415f09 100644 --- a/libs/s25main/ingameWindows/iwMilitaryBuilding.cpp +++ b/libs/s25main/ingameWindows/iwMilitaryBuilding.cpp @@ -31,7 +31,7 @@ constexpr unsigned ARMOR_ENABLE_BUTTON_ID = 10 + NUM_SOLDIER_RANKS * 4 + 1; constexpr unsigned HEIGHT_OF_ROW = 38; iwMilitaryBuilding::iwMilitaryBuilding(GameWorldView& gwv, GameCommandFactory& gcFactory, nobMilitary* const building) - : IngameWindow(CGI_BUILDING + MapBase::CreateGUIID(building->getPos()), IngameWindow::posAtMouse, Extent(226, 194), + : IngameWindow(CGI_BUILDING + MapBase::createGUIID(building->getPos()), IngameWindow::posAtMouse, Extent(226, 194), _(BUILDING_NAMES[building->getBuildingType()]), LOADER.getImageN("resource", 41)), gwv(gwv), gcFactory(gcFactory), building(building) { @@ -48,38 +48,38 @@ iwMilitaryBuilding::iwMilitaryBuilding(GameWorldView& gwv, GameCommandFactory& g btOffset += btOffsetLeatherAddon; } - Resize(Extent(226 + btOffset.x, 194 + btOffset.y)); + resize(Extent(226 + btOffset.x, 194 + btOffset.y)); // Schwert - AddImage(0, DrawPoint(28, 39), LOADER.getMapTexture(2298)); - AddImage(1, DrawPoint(28, 39), LOADER.getWareTex(GoodType::Sword)); + addImage(0, DrawPoint(28, 39), LOADER.getMapTexture(2298)); + addImage(1, DrawPoint(28, 39), LOADER.getWareTex(GoodType::Sword)); // Schild - AddImage(2, DrawPoint(196 + btOffset.x, 39), LOADER.getMapTexture(2298)); - AddImage(3, DrawPoint(196 + btOffset.x, 39), LOADER.getWareTex(GoodType::ShieldRomans)); + addImage(2, DrawPoint(196 + btOffset.x, 39), LOADER.getMapTexture(2298)); + addImage(3, DrawPoint(196 + btOffset.x, 39), LOADER.getWareTex(GoodType::ShieldRomans)); // Hilfe - AddImageButton(4, DrawPoint(16, btOffset.y + 147), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), + addImageButton(4, DrawPoint(16, btOffset.y + 147), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); // Abreißen - AddImageButton(5, DrawPoint(50, btOffset.y + 147), Extent(34, 32), TextureColor::Grey, LOADER.getImageN("io", 23), + addImageButton(5, DrawPoint(50, btOffset.y + 147), Extent(34, 32), TextureColor::Grey, LOADER.getImageN("io", 23), _("Demolish house")); // Gold an/aus (227,226) - AddImageButton(6, DrawPoint(90, btOffset.y + 147), Extent(32, 32), TextureColor::Grey, + addImageButton(6, DrawPoint(90, btOffset.y + 147), Extent(32, 32), TextureColor::Grey, LOADER.getImageN("io", ((building->isGoldDisabledVirtual()) ? 226 : 227)), _("Gold delivery")); // "Gehe Zu Ort" - AddImageButton(7, DrawPoint(179 + btOffset.x, btOffset.y + 147), Extent(30, 32), TextureColor::Grey, + addImageButton(7, DrawPoint(179 + btOffset.x, btOffset.y + 147), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 107), _("Go to place")); // Gebäudebild - AddImage(8, DrawPoint(117 + btOffset.x / 2, 114), &building->getBuildingImage()); + addImage(8, DrawPoint(117 + btOffset.x / 2, 114), &building->getBuildingImage()); // "Go to next" (building of same type) - AddImageButton(9, DrawPoint(179 + btOffset.x, btOffset.y + 115), Extent(30, 32), TextureColor::Grey, + addImageButton(9, DrawPoint(179 + btOffset.x, btOffset.y + 115), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io_new", 11), _("Go to next military building")); if(leatheraddon::isAddonActive(gwv.getWorld())) { - AddImageButton( + addImageButton( ARMOR_ENABLE_BUTTON_ID, DrawPoint(126 + btOffsetLeatherAddon.x, btOffset.y + 147), Extent(32, 32), TextureColor::Grey, LOADER.getImageN("leather_bobs", leatheraddon::bobIndex[building->isArmorAllowedVirtual() ? @@ -91,46 +91,46 @@ iwMilitaryBuilding::iwMilitaryBuilding(GameWorldView& gwv, GameCommandFactory& g if(addonStatusMilitaryControl == 1) { // Minimal troop controls - AddImageButton(10, DrawPoint(126, btOffset.y + 147), Extent(32, 32), TextureColor::Grey, + addImageButton(10, DrawPoint(126, btOffset.y + 147), Extent(32, 32), TextureColor::Grey, LOADER.getImageN("io_new", 12), _("Send max rank soldiers to a warehouse")); } else if(addonStatusMilitaryControl == 2) { // Full troop controls - AddImageButton(10, DrawPoint(126, btOffset.y + 147), Extent(32, 32), TextureColor::Grey, + addImageButton(10, DrawPoint(126, btOffset.y + 147), Extent(32, 32), TextureColor::Grey, LOADER.getImageN("io_new", 12), _("Send soldiers home")); const unsigned Y_SPACING = 30; for(unsigned i = 0; i < NUM_SOLDIER_RANKS; ++i) { // Minus - AddImageButton(11 + (4 * i), DrawPoint(69 + btOffset.x / 2, 136 + btOffsetLeatherAddon.y + Y_SPACING * i), + addImageButton(11 + (4 * i), DrawPoint(69 + btOffset.x / 2, 136 + btOffsetLeatherAddon.y + Y_SPACING * i), Extent(24, 24), TextureColor::Red1, LOADER.getImageN("io", 139), _("Fewer")); // Background - AddImage(12 + (4 * i), DrawPoint(113 + btOffset.x / 2, 148 + btOffsetLeatherAddon.y + Y_SPACING * i), + addImage(12 + (4 * i), DrawPoint(113 + btOffset.x / 2, 148 + btOffsetLeatherAddon.y + Y_SPACING * i), LOADER.getMapTexture(2298)); // Rank image - AddImage(13 + (4 * i), DrawPoint(113 + btOffset.x / 2, 148 + btOffsetLeatherAddon.y + Y_SPACING * i), + addImage(13 + (4 * i), DrawPoint(113 + btOffset.x / 2, 148 + btOffsetLeatherAddon.y + Y_SPACING * i), LOADER.getMapTexture(2321 + i)); // Plus - AddImageButton(14 + (4 * i), DrawPoint(133 + btOffset.x / 2, 136 + btOffsetLeatherAddon.y + Y_SPACING * i), + addImageButton(14 + (4 * i), DrawPoint(133 + btOffset.x / 2, 136 + btOffsetLeatherAddon.y + Y_SPACING * i), Extent(24, 24), TextureColor::Green2, LOADER.getImageN("io", 138), _("More")); } } } -void iwMilitaryBuilding::DrawContent() +void iwMilitaryBuilding::drawContent() { unsigned btOffsetY = 60; // Schwarzer Untergrund für Goldanzeige const unsigned maxCoinCt = building->getMaxCoinCt(); DrawPoint goldPos = getDrawPos() + DrawPoint((getSize().x - 22 * maxCoinCt) / 2, btOffsetY); - DrawRectangle(Rect(goldPos, Extent(22 * maxCoinCt, 24)), 0x96000000); + drawRectangle(Rect(goldPos, Extent(22 * maxCoinCt, 24)), 0x96000000); // Gold goldPos += DrawPoint(12, 12); for(unsigned short i = 0; i < maxCoinCt; ++i) { - LOADER.getMapTexture(2278)->DrawFull(goldPos, (i >= building->getNumCoins() ? 0xFFA0A0A0 : 0xFFFFFFFF)); + LOADER.getMapTexture(2278)->drawFull(goldPos, (i >= building->getNumCoins() ? 0xFFA0A0A0 : 0xFFFFFFFF)); goldPos.x += 22; } btOffsetY += HEIGHT_OF_ROW; @@ -143,12 +143,12 @@ void iwMilitaryBuilding::DrawContent() // Black background for armor display const unsigned maxArmorCt = building->getMaxArmorCt(); DrawPoint armorPos = getDrawPos() + DrawPoint((getSize().x - 22 * maxArmorCt) / 2, btOffsetY); - DrawRectangle(Rect(armorPos, Extent(22 * maxArmorCt, 24)), 0x96000000); + drawRectangle(Rect(armorPos, Extent(22 * maxArmorCt, 24)), 0x96000000); // Armor armorPos += DrawPoint(12, 12); for(unsigned short i = 0; i < maxArmorCt; ++i) { - armorWareIcon->DrawFull(armorPos, (i >= building->getNumArmor() ? 0xFFA0A0A0 : 0xFFFFFFFF)); + armorWareIcon->drawFull(armorPos, (i >= building->getNumArmor() ? 0xFFA0A0A0 : 0xFFFFFFFF)); armorPos.x += 22; } btOffsetY += HEIGHT_OF_ROW; @@ -171,15 +171,15 @@ void iwMilitaryBuilding::DrawContent() const unsigned maxSoldierCt = building->getMaxTroopsCt(); DrawPoint troopsPos = getDrawPos() + DrawPoint((getSize().x - 22 * maxSoldierCt) / 2, btOffsetY); // Schwarzer Untergrund für Soldatenanzeige - DrawRectangle(Rect(troopsPos, Extent(22 * maxSoldierCt, 24)), 0x96000000); + drawRectangle(Rect(troopsPos, Extent(22 * maxSoldierCt, 24)), 0x96000000); // Soldaten zeichnen DrawPoint curTroopsPos = troopsPos + DrawPoint(12, 12); for(const auto* soldier : soldiers) { if(leatheraddon::isAddonActive(gwv.getWorld()) && soldier->hasArmor()) - armorWareIcon->DrawFull(curTroopsPos, 0xFFA0A0A0); - LOADER.getMapTexture(2321 + soldier->getRank())->DrawFull(curTroopsPos); + armorWareIcon->drawFull(curTroopsPos, 0xFFA0A0A0); + LOADER.getMapTexture(2321 + soldier->getRank())->drawFull(curTroopsPos); curTroopsPos.x += 22; } @@ -189,7 +189,7 @@ void iwMilitaryBuilding::DrawContent() DrawPoint healthPos = troopsPos - DrawPoint(0, 14); // black background for hitpoints - DrawRectangle(Rect(healthPos, Extent(22 * maxSoldierCt, 14)), 0x96000000); + drawRectangle(Rect(healthPos, Extent(22 * maxSoldierCt, 14)), 0x96000000); healthPos += DrawPoint(12, 2); for(const auto* soldier : soldiers) @@ -206,11 +206,11 @@ void iwMilitaryBuilding::DrawContent() else hitpointsColour = COLOR_ORANGE; } - NormalFont->Draw(healthPos, std::to_string(hitpoints), FontStyle::CENTER, hitpointsColour); + NormalFont->draw(healthPos, std::to_string(hitpoints), FontStyle::CENTER, hitpointsColour); if(leatheraddon::isAddonActive(gwv.getWorld()) && soldier->hasArmor()) { - SmallFont->Draw(healthPos + DrawPoint(7, 0), "+", FontStyle::CENTER, hitpointsColour); - SmallFont->Draw(healthPos + DrawPoint(10, 0), "1", FontStyle::CENTER, hitpointsColour); + SmallFont->draw(healthPos + DrawPoint(7, 0), "+", FontStyle::CENTER, hitpointsColour); + SmallFont->draw(healthPos + DrawPoint(10, 0), "1", FontStyle::CENTER, hitpointsColour); } healthPos.x += 22; } @@ -221,7 +221,7 @@ void iwMilitaryBuilding::DrawContent() { const unsigned Y_SPACING = 30; for(unsigned i = 0; i < NUM_SOLDIER_RANKS; ++i) - NormalFont->Draw(getDrawPos() + DrawPoint(getSize().x / 2 - 12, btOffsetY + Y_SPACING * i), + NormalFont->draw(getDrawPos() + DrawPoint(getSize().x / 2 - 12, btOffsetY + Y_SPACING * i), std::to_string(building->getTroopLimit(i)), FontStyle::LEFT, COLOR_YELLOW); } } @@ -232,7 +232,7 @@ void iwMilitaryBuilding::msgButtonClick(const unsigned ctrl_id) { case 4: // Hilfe { - WINDOWMANAGER.ReplaceWindow( + WINDOWMANAGER.replaceWindow( std::make_unique(_(BUILDING_HELP_STRINGS[building->getBuildingType()]))); } break; @@ -242,12 +242,12 @@ void iwMilitaryBuilding::msgButtonClick(const unsigned ctrl_id) if(!building->isDemolitionAllowed()) { // Messagebox anzeigen - DemolitionNotAllowed(gwv.getWorld().getGGS()); + demolitionNotAllowed(gwv.getWorld().getGGS()); } else { // Abreißen? - Close(); - WINDOWMANAGER.Show(std::make_unique(gwv, building)); + close(); + WINDOWMANAGER.show(std::make_unique(gwv, building)); } } break; @@ -259,7 +259,7 @@ void iwMilitaryBuilding::msgButtonClick(const unsigned ctrl_id) if(gcFactory.SetCoinsAllowed(building->getPos(), building->isGoldDisabledVirtual())) { // visuell anzeigen - building->ToggleCoinsVirtual(); + building->toggleCoinsVirtual(); // anderes Bild auf dem Button if(building->isGoldDisabledVirtual()) getCtrl(6)->setImage(LOADER.getImageN("io", 226)); @@ -271,7 +271,7 @@ void iwMilitaryBuilding::msgButtonClick(const unsigned ctrl_id) break; case 7: // "Gehe Zu Ort" { - gwv.MoveToMapPt(building->getPos()); + gwv.moveToMapPt(building->getPos()); } break; case 9: // go to next of same type @@ -285,12 +285,12 @@ void iwMilitaryBuilding::msgButtonClick(const unsigned ctrl_id) { // close old window, open new window (todo: only open if it isnt already open), move to location of next // building - Close(); + close(); ++it; if(it == militaryBuildings.end()) // was last entry in list -> goto first it = militaryBuildings.begin(); - gwv.MoveToMapPt((*it)->getPos()); - WINDOWMANAGER.ReplaceWindow(std::make_unique(gwv, gcFactory, *it)).setPos(getPos()); + gwv.moveToMapPt((*it)->getPos()); + WINDOWMANAGER.replaceWindow(std::make_unique(gwv, gcFactory, *it)).setPos(getPos()); break; } } @@ -321,7 +321,7 @@ void iwMilitaryBuilding::msgButtonClick(const unsigned ctrl_id) { if(gcFactory.SetArmorAllowed(building->getPos(), !building->isArmorAllowedVirtual())) { - building->ToggleArmorVirtual(); + building->toggleArmorVirtual(); getCtrl(ctrl_id)->setImage(LOADER.getImageN( "leather_bobs", leatheraddon::bobIndex[building->isArmorAllowedVirtual() ? leatheraddon::BobType::ArmorDeliverIcon : @@ -354,7 +354,7 @@ void iwMilitaryBuilding::msgButtonClick(const unsigned ctrl_id) } } -void iwMilitaryBuilding::DemolitionNotAllowed(const GlobalGameSettings& ggs) +void iwMilitaryBuilding::demolitionNotAllowed(const GlobalGameSettings& ggs) { // Meldung auswählen, je nach Einstellung std::string msg; @@ -365,6 +365,6 @@ void iwMilitaryBuilding::DemolitionNotAllowed(const GlobalGameSettings& ggs) case 2: msg = _("Demolition ist not allowed because the building is located in border area!"); break; } - WINDOWMANAGER.Show(std::make_unique(_("Demolition not possible"), msg, nullptr, MsgboxButton::Ok, + WINDOWMANAGER.show(std::make_unique(_("Demolition not possible"), msg, nullptr, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); } diff --git a/libs/s25main/ingameWindows/iwMilitaryBuilding.h b/libs/s25main/ingameWindows/iwMilitaryBuilding.h index c770321464..010e86554f 100644 --- a/libs/s25main/ingameWindows/iwMilitaryBuilding.h +++ b/libs/s25main/ingameWindows/iwMilitaryBuilding.h @@ -22,9 +22,9 @@ class iwMilitaryBuilding : public IngameWindow iwMilitaryBuilding(GameWorldView& gwv, GameCommandFactory& gcFactory, nobMilitary* building); /// Zeigt Messagebox an, dass das Militärgebäude nicht abgerissen werden kann (Abriss-Verbot) - static void DemolitionNotAllowed(const GlobalGameSettings& ggs); + static void demolitionNotAllowed(const GlobalGameSettings& ggs); private: - void DrawContent() override; + void drawContent() override; void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwMinimap.cpp b/libs/s25main/ingameWindows/iwMinimap.cpp index cb92bb474d..a289b07938 100644 --- a/libs/s25main/ingameWindows/iwMinimap.cpp +++ b/libs/s25main/ingameWindows/iwMinimap.cpp @@ -30,33 +30,33 @@ iwMinimap::iwMinimap(IngameMinimap& minimap, GameWorldView& gwv) LOADER.getImageN("resource", 41)), extended(SETTINGS.ingame.minimapExtended) { - AddCtrl(std::make_unique(this, 0, DrawPoint(contentOffset), Extent::all(WINDOW_MAP_SPACE), + addCtrl(std::make_unique(this, 0, DrawPoint(contentOffset), Extent::all(WINDOW_MAP_SPACE), Extent::all(WINDOW_MAP_SPACE), minimap, gwv)); // Land, Häuser, Straßen an/aus DrawPoint curPos(contentOffset.x + WINDOW_MAP_SPACE, 0); for(unsigned i = 0; i < 3; ++i) { - AddImageButton(i + 1, curPos, BUTTON_SIZE, TextureColor::Grey, LOADER.getImageN("io", 85 + i)); + addImageButton(i + 1, curPos, BUTTON_SIZE, TextureColor::Grey, LOADER.getImageN("io", 85 + i)); curPos.x += BUTTON_SIZE.x; } // Fenster vergrößern/verkleinern - AddImageButton(4, DrawPoint(0, 0), BUTTON_SIZE, TextureColor::Grey, LOADER.getImageN("io", 109)); + addImageButton(4, DrawPoint(0, 0), BUTTON_SIZE, TextureColor::Grey, LOADER.getImageN("io", 109)); - Resize(extended ? MINIMAP_SIZE_BIG : MINIMAP_SIZE); + resize(extended ? MINIMAP_SIZE_BIG : MINIMAP_SIZE); } /// Verändert die Größe des Fensters und positioniert alle Controls etc. neu -void iwMinimap::Resize(const Extent& newSize) +void iwMinimap::resize(const Extent& newSize) { - IngameWindow::Resize(newSize); + IngameWindow::resize(newSize); auto* im = getCtrl(0); - im->Resize(newSize - contentOffset - contentOffsetEnd); + im->resize(newSize - contentOffset - contentOffsetEnd); // Control kürzen in der Höhe - im->RemoveBoundingBox(Extent(BUTTON_SIZE.x * 4 + WINDOW_MAP_SPACE * 2, 0)); + im->removeBoundingBox(Extent(BUTTON_SIZE.x * 4 + WINDOW_MAP_SPACE * 2, 0)); // Fensterbreite anpassen setIwSize(im->getSize() + Extent(0, WINDOW_MAP_SPACE + BUTTON_MAP_SPACE + BUTTON_SIZE.y + BUTTON_WINDOW_SPACE)); @@ -82,16 +82,16 @@ void iwMinimap::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { - case 1: getCtrl(0)->ToggleTerritory(); break; - case 2: getCtrl(0)->ToggleHouses(); break; - case 3: getCtrl(0)->ToggleRoads(); break; + case 1: getCtrl(0)->toggleTerritory(); break; + case 2: getCtrl(0)->toggleHouses(); break; + case 3: getCtrl(0)->toggleRoads(); break; case 4: { // Fenster vergrößern/verkleinern this->extended = !extended; SETTINGS.ingame.minimapExtended = extended; - Resize(extended ? MINIMAP_SIZE_BIG : MINIMAP_SIZE); + resize(extended ? MINIMAP_SIZE_BIG : MINIMAP_SIZE); } break; } diff --git a/libs/s25main/ingameWindows/iwMinimap.h b/libs/s25main/ingameWindows/iwMinimap.h index d46af3a468..a9692a0941 100644 --- a/libs/s25main/ingameWindows/iwMinimap.h +++ b/libs/s25main/ingameWindows/iwMinimap.h @@ -20,5 +20,5 @@ class iwMinimap final : public IngameWindow public: iwMinimap(IngameMinimap& minimap, GameWorldView& gwv); - void Resize(const Extent& newSize) override; + void resize(const Extent& newSize) override; }; diff --git a/libs/s25main/ingameWindows/iwMissionStatement.cpp b/libs/s25main/ingameWindows/iwMissionStatement.cpp index 1992d7c4f9..24ece0142f 100644 --- a/libs/s25main/ingameWindows/iwMissionStatement.cpp +++ b/libs/s25main/ingameWindows/iwMissionStatement.cpp @@ -26,11 +26,11 @@ iwMissionStatement::iwMissionStatement(const std::string& title, const std::stri const Extent buttonSize(100, 22); const unsigned short maxTextWidth = getIwSize().x - imgSize.x - textSpace - imgSpace; - ctrlMultiline* text = AddMultiline(0, contentOffset + DrawPoint::all(textSpace), + ctrlMultiline* text = addMultiline(0, contentOffset + DrawPoint::all(textSpace), Extent(maxTextWidth, getIwSize().y), TextureColor::Green2, NormalFont); - text->ShowBackground(false); - text->AddString(content, COLOR_YELLOW, false); - text->Resize(text->getContentSize()); + text->showBackground(false); + text->addString(content, COLOR_YELLOW, false); + text->resize(text->getContentSize()); // set window width to our determined max width Extent newIwSize = text->getSize() + Extent::all(textSpace) + Extent(imgSize.x + imgSpace, buttonSize.y + 2); @@ -38,14 +38,14 @@ iwMissionStatement::iwMissionStatement(const std::string& title, const std::stri newIwSize.y = std::max(newIwSize.y, imgSize.y + minImgSpaceTop) + buttonSpace; setIwSize(newIwSize); - AddTextButton(1, + addTextButton(1, DrawPoint((getSize().x - buttonSize.x) / 2, getRightBottomBoundary().y - buttonSpace - buttonSize.y), buttonSize, TextureColor::Grey, _("Continue"), NormalFont); if(img) { DrawPoint imgPos = getRightBottomBoundary() + img->getOrigin() - DrawPoint(imgSize) - DrawPoint(imgSpaceRight, buttonSpace); - AddImage(2, imgPos, img); + addImage(2, imgPos, img); } } @@ -53,7 +53,7 @@ void iwMissionStatement::msgButtonClick(const unsigned /*ctrl_id*/) { if(pauseGame_ && GAMECLIENT.getState() != ClientState::Stopped) GAMECLIENT.setPause(false); - Close(); + close(); } void iwMissionStatement::setActive(bool activate) diff --git a/libs/s25main/ingameWindows/iwMsgbox.cpp b/libs/s25main/ingameWindows/iwMsgbox.cpp index 95a472b016..e453c3ef7c 100644 --- a/libs/s25main/ingameWindows/iwMsgbox.cpp +++ b/libs/s25main/ingameWindows/iwMsgbox.cpp @@ -44,15 +44,15 @@ void iwMsgbox::Init(const std::string& text, const ResourceId& iconFile, unsigne { glArchivItem_Bitmap* icon = LOADER.getImageN(iconFile, iconIdx); if(icon) - AddImage(ID_ICON, contentOffset + DrawPoint(30, 20), icon); + addImage(ID_ICON, contentOffset + DrawPoint(30, 20), icon); int textX = icon ? icon->getWidth() - icon->getNx() + getCtrl(ID_ICON)->getPos().x : contentOffset.x; textX += paddingX; Extent txtSize = Extent(std::max(minTextWidth, getRightBottomBoundary().x - textX - paddingX), maxTextHeight); ctrlMultiline* multiline = - AddMultiline(ID_TEXT, DrawPoint(textX, contentOffset.y + 5), txtSize, TextureColor::Green2, NormalFont); - multiline->ShowBackground(false); - multiline->AddString(text, COLOR_YELLOW); - multiline->Resize(multiline->getContentSize()); + addMultiline(ID_TEXT, DrawPoint(textX, contentOffset.y + 5), txtSize, TextureColor::Green2, NormalFont); + multiline->showBackground(false); + multiline->addString(text, COLOR_YELLOW); + multiline->resize(multiline->getContentSize()); // 10 padding, button/button padding Extent newIwSize(multiline->getPos() + multiline->getSize() + Extent(paddingX, 10 + btSize.y * 2)); // Increase window size if required @@ -63,26 +63,26 @@ void iwMsgbox::Init(const std::string& text, const ResourceId& iconFile, unsigne switch(button) { case MsgboxButton::Ok: - AddButton(ID_BT_0, getSize().x / 2 - 45, _("OK"), TextureColor::Green2); + addButton(ID_BT_0, getSize().x / 2 - 45, _("OK"), TextureColor::Green2); defaultBt = 0; break; case MsgboxButton::OkCancel: - AddButton(ID_BT_0, getSize().x / 2 - 3 - 90, _("OK"), TextureColor::Green2); - AddButton(ID_BT_0 + 1, getSize().x / 2 + 3, _("Cancel"), TextureColor::Red1); + addButton(ID_BT_0, getSize().x / 2 - 3 - 90, _("OK"), TextureColor::Green2); + addButton(ID_BT_0 + 1, getSize().x / 2 + 3, _("Cancel"), TextureColor::Red1); defaultBt = 1; break; case MsgboxButton::YesNo: - AddButton(ID_BT_0, getSize().x / 2 - 3 - 90, _("Yes"), TextureColor::Green2); - AddButton(ID_BT_0 + 1, getSize().x / 2 + 3, _("No"), TextureColor::Red1); + addButton(ID_BT_0, getSize().x / 2 - 3 - 90, _("Yes"), TextureColor::Green2); + addButton(ID_BT_0 + 1, getSize().x / 2 + 3, _("No"), TextureColor::Red1); defaultBt = 1; break; case MsgboxButton::YesNoCancel: - AddButton(ID_BT_0, getSize().x / 2 - 45 - 6 - 90, _("Yes"), TextureColor::Green2); - AddButton(ID_BT_0 + 1, getSize().x / 2 - 45, _("No"), TextureColor::Red1); - AddButton(ID_BT_0 + 2, getSize().x / 2 + 45 + 6, _("Cancel"), TextureColor::Grey); + addButton(ID_BT_0, getSize().x / 2 - 45 - 6 - 90, _("Yes"), TextureColor::Green2); + addButton(ID_BT_0 + 1, getSize().x / 2 - 45, _("No"), TextureColor::Red1); + addButton(ID_BT_0 + 2, getSize().x / 2 + 45 + 6, _("Cancel"), TextureColor::Grey); defaultBt = 2; break; } @@ -94,7 +94,7 @@ void iwMsgbox::Init(const std::string& text, const ResourceId& iconFile, unsigne iwMsgbox::~iwMsgbox() = default; -void iwMsgbox::MoveIcon(const DrawPoint& pos) +void iwMsgbox::moveIcon(const DrawPoint& pos) { auto* icon = getCtrl(ID_ICON); if(icon) @@ -134,8 +134,8 @@ void iwMsgbox::MoveIcon(const DrawPoint& pos) } auto* multiline = getCtrl(ID_TEXT); multiline->setPos(textPos); - multiline->Resize(textMaxSize); - multiline->Resize(multiline->getContentSize()); + multiline->resize(textMaxSize); + multiline->resize(multiline->getContentSize()); DrawPoint newSize = iconPos + DrawPoint(iconImg->getSize()); newSize = elMax(newSize, multiline->getPos() + DrawPoint(multiline->getSize()) + DrawPoint::all(paddingX)); @@ -148,7 +148,7 @@ void iwMsgbox::MoveIcon(const DrawPoint& pos) if(bt) bt->setPos(bt->getPos() + btMoveDelta); } - Resize(Extent(newSize)); + resize(Extent(newSize)); } } @@ -162,10 +162,10 @@ void iwMsgbox::msgButtonClick(const unsigned ctrl_id) { if(msgHandler_) msgHandler_->msgMsgBoxResult(msgboxid, RET_IDS[button][ctrl_id - ID_BT_0]); - Close(); + close(); } -void iwMsgbox::AddButton(unsigned short id, int x, const std::string& text, const TextureColor tc) +void iwMsgbox::addButton(unsigned short id, int x, const std::string& text, const TextureColor tc) { - AddTextButton(id, DrawPoint(x, getRightBottomBoundary().y - btSize.y * 2), btSize, tc, text, NormalFont); + addTextButton(id, DrawPoint(x, getRightBottomBoundary().y - btSize.y * 2), btSize, tc, text, NormalFont); } diff --git a/libs/s25main/ingameWindows/iwMsgbox.h b/libs/s25main/ingameWindows/iwMsgbox.h index 4ea37e115e..133eb11e24 100644 --- a/libs/s25main/ingameWindows/iwMsgbox.h +++ b/libs/s25main/ingameWindows/iwMsgbox.h @@ -29,12 +29,12 @@ class iwMsgbox : public IngameWindow ~iwMsgbox() override; /// Moves the icon to given position - void MoveIcon(const DrawPoint& pos); + void moveIcon(const DrawPoint& pos); private: void Init(const std::string& text, const ResourceId& iconFile, unsigned iconIdx); - void AddButton(unsigned short id, int x, const std::string& text, TextureColor tc); + void addButton(unsigned short id, int x, const std::string& text, TextureColor tc); void msgButtonClick(unsigned ctrl_id) override; }; diff --git a/libs/s25main/ingameWindows/iwMusicPlayer.cpp b/libs/s25main/ingameWindows/iwMusicPlayer.cpp index 87ee821b13..248429b75e 100644 --- a/libs/s25main/ingameWindows/iwMusicPlayer.cpp +++ b/libs/s25main/ingameWindows/iwMusicPlayer.cpp @@ -60,9 +60,9 @@ iwMusicPlayer::InputWindow::InputWindow(iwMusicPlayer& playerWnd, const unsigned true), win_id(win_id), playerWnd_(playerWnd) { - AddEdit(ID_edtName, DrawPoint(20, 30), Extent(getSize().x - 40, 22), TextureColor::Green2, NormalFont)->setFocus(); - AddTextButton(ID_btOk, DrawPoint(20, 60), Extent(100, 22), TextureColor::Green1, _("OK"), NormalFont); - AddTextButton(ID_btAbort, DrawPoint(130, 60), Extent(100, 22), TextureColor::Red1, _("Abort"), NormalFont); + addEdit(ID_edtName, DrawPoint(20, 30), Extent(getSize().x - 40, 22), TextureColor::Green2, NormalFont)->setFocus(); + addTextButton(ID_btOk, DrawPoint(20, 60), Extent(100, 22), TextureColor::Green1, _("OK"), NormalFont); + addTextButton(ID_btAbort, DrawPoint(130, 60), Extent(100, 22), TextureColor::Red1, _("Abort"), NormalFont); } void iwMusicPlayer::InputWindow::msgButtonClick(const unsigned ctrl_id) @@ -70,7 +70,7 @@ void iwMusicPlayer::InputWindow::msgButtonClick(const unsigned ctrl_id) if(ctrl_id == ID_btOk) playerWnd_.msgInput(win_id, getCtrl(ID_edtName)->getText()); - Close(); + close(); } void iwMusicPlayer::InputWindow::msgEditEnter(const unsigned /*ctrl_id*/) @@ -83,43 +83,43 @@ iwMusicPlayer::iwMusicPlayer() LOADER.getImageN("resource", 41)), changed(false) { - AddList(ID_lstSongs, DrawPoint(20, 30), Extent(330, 200), TextureColor::Green1, NormalFont); - AddText(ID_txtPlaylist, DrawPoint(20, 240), _("Playlist:"), COLOR_YELLOW, FontStyle{}, NormalFont); - AddComboBox(ID_cbPlaylist, DrawPoint(20, 260), Extent(330, 22), TextureColor::Green1, NormalFont, 200); + addList(ID_lstSongs, DrawPoint(20, 30), Extent(330, 200), TextureColor::Green1, NormalFont); + addText(ID_txtPlaylist, DrawPoint(20, 240), _("Playlist:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addComboBox(ID_cbPlaylist, DrawPoint(20, 260), Extent(330, 22), TextureColor::Green1, NormalFont, 200); // Playlist buttons const unsigned short button_distance = 10; const Extent buttonSize((330 - button_distance) / 2, 22); ctrlButton* b1 = - AddTextButton(ID_btAddPlaylist, DrawPoint(20, 288), buttonSize, TextureColor::Green2, _("Add"), NormalFont); - AddTextButton(ID_btRemovePlaylist, b1->getPos() + DrawPoint(buttonSize.x + button_distance, 0), buttonSize, + addTextButton(ID_btAddPlaylist, DrawPoint(20, 288), buttonSize, TextureColor::Green2, _("Add"), NormalFont); + addTextButton(ID_btRemovePlaylist, b1->getPos() + DrawPoint(buttonSize.x + button_distance, 0), buttonSize, TextureColor::Green2, _("Remove"), NormalFont); // Track buttons - AddImageButton(ID_btAddTrack, DrawPoint(360, 30), Extent(30, 40), TextureColor::Grey, LOADER.getImageN("io", 138), + addImageButton(ID_btAddTrack, DrawPoint(360, 30), Extent(30, 40), TextureColor::Grey, LOADER.getImageN("io", 138), _("Add track")); - AddImageButton(ID_btAddTrackDir, DrawPoint(390, 30), Extent(30, 40), TextureColor::Grey, + addImageButton(ID_btAddTrackDir, DrawPoint(390, 30), Extent(30, 40), TextureColor::Grey, LOADER.getImageN("io_new", 2), _("Add directory of tracks")); - AddImageButton(ID_btRemoveTrack, DrawPoint(370, 80), Extent(40, 40), TextureColor::Red1, + addImageButton(ID_btRemoveTrack, DrawPoint(370, 80), Extent(40, 40), TextureColor::Red1, LOADER.getImageN("io", 220), _("Remove track")); - AddImageButton(ID_btUp, DrawPoint(370, 130), Extent(40, 15), TextureColor::Grey, LOADER.getImageN("io", 33), + addImageButton(ID_btUp, DrawPoint(370, 130), Extent(40, 15), TextureColor::Grey, LOADER.getImageN("io", 33), _("Upwards")); - AddImageButton(ID_btDown, DrawPoint(370, 145), Extent(40, 15), TextureColor::Grey, LOADER.getImageN("io", 34), + addImageButton(ID_btDown, DrawPoint(370, 145), Extent(40, 15), TextureColor::Grey, LOADER.getImageN("io", 34), _("Downwards")); - AddTextDeepening(ID_txtRepeat, DrawPoint(370, 170), Extent(40, 20), TextureColor::Grey, "1", NormalFont, + addTextDeepening(ID_txtRepeat, DrawPoint(370, 170), Extent(40, 20), TextureColor::Grey, "1", NormalFont, COLOR_YELLOW); - AddImageButton(ID_btDecRepeat, DrawPoint(370, 190), Extent(20, 20), TextureColor::Red1, LOADER.getImageN("io", 139), + addImageButton(ID_btDecRepeat, DrawPoint(370, 190), Extent(20, 20), TextureColor::Red1, LOADER.getImageN("io", 139), _("Less repeats")); - AddImageButton(ID_btIncRepeat, DrawPoint(390, 190), Extent(20, 20), TextureColor::Grey, LOADER.getImageN("io", 138), + addImageButton(ID_btIncRepeat, DrawPoint(390, 190), Extent(20, 20), TextureColor::Grey, LOADER.getImageN("io", 138), _("More repeats")); - AddImageButton(ID_btRandom, DrawPoint(370, 220), Extent(40, 40), TextureColor::Grey, LOADER.getImageN("io", 107), + addImageButton(ID_btRandom, DrawPoint(370, 220), Extent(40, 40), TextureColor::Grey, LOADER.getImageN("io", 107), _("Playback in this order")); - AddImageButton(ID_btSave, DrawPoint(370, 270), Extent(40, 40), TextureColor::Grey, LOADER.getImageN("io", 37), + addImageButton(ID_btSave, DrawPoint(370, 270), Extent(40, 40), TextureColor::Grey, LOADER.getImageN("io", 37), _("Save playlist")); // Fill values for current playlist - UpdateFromPlaylist(MUSICPLAYER.getPlaylist()); - UpdatePlaylistCombo(SETTINGS.sound.playlist); + updateFromPlaylist(MUSICPLAYER.getPlaylist()); + updatePlaylistCombo(SETTINGS.sound.playlist); auto* cbPlayList = getCtrl(ID_cbPlaylist); if(!cbPlayList->getSelection() && cbPlayList->getNumItems() > 0u) { @@ -134,11 +134,11 @@ static bool isReadonlyPlaylist(const std::string& name) return name == boost::filesystem::path(s25::files::defaultPlaylist).stem(); } -void iwMusicPlayer::Close() +void iwMusicPlayer::close() { - IngameWindow::Close(); + IngameWindow::close(); - if(SaveCurrentPlaylist()) + if(saveCurrentPlaylist()) { const auto& selection = getCtrl(ID_cbPlaylist)->getSelection(); if(selection) @@ -151,8 +151,8 @@ void iwMusicPlayer::Close() // Update the player if anything has changed if(changed) { - MUSICPLAYER.setPlaylist(MakePlaylist()); - MUSICPLAYER.Play(); + MUSICPLAYER.setPlaylist(makePlaylist()); + MUSICPLAYER.play(); changed = false; } } @@ -164,23 +164,23 @@ void iwMusicPlayer::msgComboSelectItem(const unsigned ctrl_id, const unsigned se const std::string playlistName = getCtrl(ID_cbPlaylist)->getText(selection); if(pl.Load(LOG, getFullPlaylistPath(playlistName))) { - UpdateFromPlaylist(pl); + updateFromPlaylist(pl); changed = true; } else { - WINDOWMANAGER.Show(std::make_unique(_("Error"), _("The specified file couldn't be loaded!"), this, + WINDOWMANAGER.show(std::make_unique(_("Error"), _("The specified file couldn't be loaded!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); } - UpdateSaveChangeButtonsState(); + updateSaveChangeButtonsState(); } void iwMusicPlayer::msgListChooseItem(const unsigned /*ctrl_id*/, const unsigned selection) { // (Re)create playlist with selected song as start song set in musicplayer - Playlist pl = MakePlaylist(); + Playlist pl = makePlaylist(); pl.setStartSong(selection); MUSICPLAYER.setPlaylist(std::move(pl)); - MUSICPLAYER.Play(); + MUSICPLAYER.play(); // No changes anymore changed = false; @@ -193,29 +193,29 @@ boost::filesystem::path iwMusicPlayer::getFullPlaylistPath(const std::string& na return folder / (name + ".pll"); } -bool iwMusicPlayer::SaveCurrentPlaylist() +bool iwMusicPlayer::saveCurrentPlaylist() { const auto playlistName = getCtrl(ID_cbPlaylist)->getSelectedText(); if(!playlistName) return false; - const Playlist pl = MakePlaylist(); + const Playlist pl = makePlaylist(); const auto fullPlaylistPath = getFullPlaylistPath(*playlistName); if(isReadonlyPlaylist(*playlistName)) return false; - return pl.SaveAs(fullPlaylistPath); + return pl.saveAs(fullPlaylistPath); } -void iwMusicPlayer::UpdateFromPlaylist(const Playlist& playlist) +void iwMusicPlayer::updateFromPlaylist(const Playlist& playlist) { auto* lstSongs = getCtrl(ID_lstSongs); - lstSongs->DeleteAllItems(); + lstSongs->deleteAllItems(); for(const auto& song : playlist.getSongs()) - lstSongs->AddItem(song); + lstSongs->addItem(song); const auto& currentSong = playlist.getCurrentSong(); if(!currentSong.empty()) @@ -234,7 +234,7 @@ void iwMusicPlayer::UpdateFromPlaylist(const Playlist& playlist) setRandomPlayback(playlist.isRandomized()); } -void iwMusicPlayer::UpdateSaveChangeButtonsState() +void iwMusicPlayer::updateSaveChangeButtonsState() { const auto playlistName = getCtrl(ID_cbPlaylist)->getSelectedText(); const bool isReadOnly = !playlistName || isReadonlyPlaylist(*playlistName); @@ -242,7 +242,7 @@ void iwMusicPlayer::UpdateSaveChangeButtonsState() getCtrl(id)->setEnabled(!isReadOnly); } -Playlist iwMusicPlayer::MakePlaylist() +Playlist iwMusicPlayer::makePlaylist() { const auto* lstSongs = getCtrl(ID_lstSongs); std::vector songs; @@ -257,7 +257,7 @@ void iwMusicPlayer::msgButtonClick(const unsigned ctrl_id) switch(ctrl_id) { case ID_btAddPlaylist: - WINDOWMANAGER.Show(std::make_unique(*this, ID_wndAddPlaylist, _("Specify the playlist name"))); + WINDOWMANAGER.show(std::make_unique(*this, ID_wndAddPlaylist, _("Specify the playlist name"))); break; case ID_btRemovePlaylist: { @@ -267,7 +267,7 @@ void iwMusicPlayer::msgButtonClick(const unsigned ctrl_id) // RTTR-playlists must not be deleted if(isReadonlyPlaylist(*playlistName)) { - WINDOWMANAGER.Show( + WINDOWMANAGER.show( std::make_unique(_("Error"), _("You are not allowed to delete the standard playlist!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); return; @@ -276,16 +276,16 @@ void iwMusicPlayer::msgButtonClick(const unsigned ctrl_id) boost::system::error_code ec; boost::filesystem::remove(getFullPlaylistPath(*playlistName), ec); SETTINGS.sound.playlist = RTTRCONFIG.ExpandPath(s25::files::defaultPlaylist).string(); - UpdatePlaylistCombo(SETTINGS.sound.playlist); + updatePlaylistCombo(SETTINGS.sound.playlist); } } break; case ID_btAddTrack: - WINDOWMANAGER.ToggleWindow(std::make_unique(*this, ID_wndAddTrack, _("Add track"))); + WINDOWMANAGER.toggleWindow(std::make_unique(*this, ID_wndAddTrack, _("Add track"))); changed = true; break; case ID_btAddTrackDir: - WINDOWMANAGER.ToggleWindow( + WINDOWMANAGER.toggleWindow( std::make_unique(*this, ID_wndAddTrackDir, _("Add directory of tracks"))); changed = true; break; @@ -295,7 +295,7 @@ void iwMusicPlayer::msgButtonClick(const unsigned ctrl_id) if(selection) { - getCtrl(ID_lstSongs)->Remove(*selection); + getCtrl(ID_lstSongs)->remove(*selection); changed = true; } } @@ -336,13 +336,13 @@ void iwMusicPlayer::msgButtonClick(const unsigned ctrl_id) changed = true; break; case ID_btSave: - if(SaveCurrentPlaylist()) + if(saveCurrentPlaylist()) { - WINDOWMANAGER.Show(std::make_unique(_("Ok"), _("The playlist was saved!"), nullptr, + WINDOWMANAGER.show(std::make_unique(_("Ok"), _("The playlist was saved!"), nullptr, MsgboxButton::Ok, MsgboxIcon::ExclamationGreen)); } else { - WINDOWMANAGER.Show(std::make_unique(_("Error"), _("The specified file couldn't be saved!"), + WINDOWMANAGER.show(std::make_unique(_("Error"), _("The specified file couldn't be saved!"), nullptr, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); } break; @@ -370,10 +370,10 @@ void iwMusicPlayer::msgInput(const unsigned win_id, const std::string& msg) if(valid) { - getCtrl(ID_lstSongs)->AddItem(msg); + getCtrl(ID_lstSongs)->addItem(msg); changed = true; } else - WINDOWMANAGER.Show(std::make_unique(_("Error"), _("The specified file couldn't be opened!"), + WINDOWMANAGER.show(std::make_unique(_("Error"), _("The specified file couldn't be opened!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); } break; @@ -382,13 +382,13 @@ void iwMusicPlayer::msgInput(const unsigned win_id, const std::string& msg) // Playlist name must start with a letter const auto isLetter = [](const char c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); }; const boost::filesystem::path fullPlaylistPath = getFullPlaylistPath(msg); - if(!msg.empty() && isLetter(msg.front()) && Playlist().SaveAs(fullPlaylistPath)) + if(!msg.empty() && isLetter(msg.front()) && Playlist().saveAs(fullPlaylistPath)) { - UpdatePlaylistCombo(fullPlaylistPath.string()); + updatePlaylistCombo(fullPlaylistPath.string()); changed = true; } else { - WINDOWMANAGER.Show(std::make_unique(_("Error"), _("The specified file couldn't be saved!"), + WINDOWMANAGER.show(std::make_unique(_("Error"), _("The specified file couldn't be saved!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); } } @@ -398,7 +398,7 @@ void iwMusicPlayer::msgInput(const unsigned win_id, const std::string& msg) std::vector oggFiles = ListDir(msg, "ogg"); for(const auto& oggFile : oggFiles) - getCtrl(ID_lstSongs)->AddItem(oggFile.string()); + getCtrl(ID_lstSongs)->addItem(oggFile.string()); changed = true; } @@ -429,10 +429,10 @@ void iwMusicPlayer::setRandomPlayback(const bool random_playback) ->setTooltip(random_playback ? _("Playback in this order") : _("Random playback")); } -void iwMusicPlayer::UpdatePlaylistCombo(const std::string& highlight_entry) +void iwMusicPlayer::updatePlaylistCombo(const std::string& highlight_entry) { auto* cbPlaylist = getCtrl(ID_cbPlaylist); - cbPlaylist->DeleteAllItems(); + cbPlaylist->deleteAllItems(); std::vector playlists = ListDir(RTTRCONFIG.ExpandPath(s25::folders::playlists), "pll"); playlists.insert(playlists.begin(), RTTRCONFIG.ExpandPath(s25::files::defaultPlaylist)); @@ -442,10 +442,10 @@ void iwMusicPlayer::UpdatePlaylistCombo(const std::string& highlight_entry) for(const auto& playlistPath : playlists) { // Reduce to pure filename - cbPlaylist->AddItem(playlistPath.stem().string()); + cbPlaylist->addItem(playlistPath.stem().string()); if(playlistPath == currentPath) cbPlaylist->setSelection(i); ++i; } - UpdateSaveChangeButtonsState(); + updateSaveChangeButtonsState(); } diff --git a/libs/s25main/ingameWindows/iwMusicPlayer.h b/libs/s25main/ingameWindows/iwMusicPlayer.h index e7a81f4cf4..892aa02343 100644 --- a/libs/s25main/ingameWindows/iwMusicPlayer.h +++ b/libs/s25main/ingameWindows/iwMusicPlayer.h @@ -30,7 +30,7 @@ class iwMusicPlayer final : public IngameWindow public: iwMusicPlayer(); - void Close() override; + void close() override; private: /// Get the full path to a playlist by its name @@ -42,13 +42,13 @@ class iwMusicPlayer final : public IngameWindow void setRandomPlayback(bool random_playback); /// Fill combobox with all playlists and selects given entry if present - void UpdatePlaylistCombo(const std::string& highlight_entry); + void updatePlaylistCombo(const std::string& highlight_entry); - bool SaveCurrentPlaylist(); - void UpdateFromPlaylist(const Playlist&); + bool saveCurrentPlaylist(); + void updateFromPlaylist(const Playlist&); // Enable/Disable buttons for changing playlist contents - void UpdateSaveChangeButtonsState(); - Playlist MakePlaylist(); + void updateSaveChangeButtonsState(); + Playlist makePlaylist(); void msgListChooseItem(unsigned ctrl_id, unsigned selection) override; void msgComboSelectItem(unsigned ctrl_id, unsigned selection) override; diff --git a/libs/s25main/ingameWindows/iwObservate.cpp b/libs/s25main/ingameWindows/iwObservate.cpp index fac3396a38..d8fedda9d8 100644 --- a/libs/s25main/ingameWindows/iwObservate.cpp +++ b/libs/s25main/ingameWindows/iwObservate.cpp @@ -20,9 +20,9 @@ #include "gameData/const_gui_ids.h" #include -const Extent SmallWndSize(260, 190); -const Extent MediumWndSize(300, 250); -const Extent BigWndSize(340, 310); +const Extent smallWndSize(260, 190); +const Extent mediumWndSize(300, 250); +const Extent bigWndSize(340, 310); enum { @@ -30,39 +30,39 @@ enum }; iwObservate::iwObservate(GameWorldView& gwv, const MapPoint selectedPt) - : IngameWindow(CGI_OBSERVATION, IngameWindow::posAtMouse, SmallWndSize, _("Observation window"), nullptr, false, + : IngameWindow(CGI_OBSERVATION, IngameWindow::posAtMouse, smallWndSize, _("Observation window"), nullptr, false, CloseBehavior::NoRightClick), parentView(gwv), view(new GameWorldView(gwv.getViewer(), Position(getDrawPos() * DrawPoint(10, 15)), getSize() - Extent::all(20))), - selectedPt(selectedPt), lastWindowPos(Point::Invalid()), isScrolling(false), zoomLvl(0), + selectedPt(selectedPt), lastWindowPos(Point::invalid()), isScrolling(false), zoomLvl(0), followMovableId(0) { - view->MoveToMapPt(selectedPt); + view->moveToMapPt(selectedPt); view->setZoomFactor(1.9f, false); const Extent btSize(36, 36); DrawPoint btPos(getSize().x / 2, getSize().y); btPos -= DrawPoint(btSize.x * 2, 50); // Lupe: 36 - AddImageButton(1, btPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 36), _("Zoom")); + addImageButton(1, btPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 36), _("Zoom")); // Kamera (Folgen): 43 btPos.x += btSize.x; - AddImageButton(2, btPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 43), _("Follow object")); + addImageButton(2, btPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 43), _("Follow object")); // Zum Ort btPos.x += btSize.x; - AddImageButton(3, btPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 107), _("Go to place")); + addImageButton(3, btPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 107), _("Go to place")); // Fenster vergroessern/verkleinern btPos.x += btSize.x; - AddImageButton(4, btPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 109), _("Resize window")); + addImageButton(4, btPos, btSize, TextureColor::Grey, LOADER.getImageN("io", 109), _("Resize window")); // Synchronize visibility of HUD elements with parentView - parentView.CopyHudSettingsTo(*view, false); + parentView.copyHudSettingsTo(*view, false); gwvSettingsConnection = - parentView.onHudSettingsChanged.connect([this]() { parentView.CopyHudSettingsTo(*view, false); }); + parentView.onHudSettingsChanged.connect([this]() { parentView.copyHudSettingsTo(*view, false); }); // Check the followed object periodically using namespace std::chrono_literals; - AddTimer(ID_tmrUpdateFollow, 1s)->Stop(); + addTimer(ID_tmrUpdateFollow, 1s)->stop(); } void iwObservate::msgButtonClick(const unsigned ctrl_id) @@ -88,7 +88,7 @@ void iwObservate::msgButtonClick(const unsigned ctrl_id) if(followMovableId) { followMovableId = 0; - getCtrl(ID_tmrUpdateFollow)->Stop(); + getCtrl(ID_tmrUpdateFollow)->stop(); } else { const DrawPoint centerDrawPt = DrawPoint(view->getSize() / 2u); @@ -101,7 +101,7 @@ void iwObservate::msgButtonClick(const unsigned ctrl_id) { Position curOffset; const MapPoint curPt = - view->getViewer().getTerrainRenderer().ConvertCoords(Position(x, y), &curOffset); + view->getViewer().getTerrainRenderer().convertCoords(Position(x, y), &curOffset); DrawPoint curDrawPt = view->getWorld().getNodePos(curPt) - view->getOffset() + curOffset; if(view->getViewer().getVisibility(curPt) != Visibility::Visible) @@ -116,7 +116,7 @@ void iwObservate::msgButtonClick(const unsigned ctrl_id) DrawPoint objDrawPt = curDrawPt; if(movable->isMoving()) - objDrawPt += movable->CalcWalkingRelative(); + objDrawPt += movable->calcWalkingRelative(); DrawPoint diffToCenter = objDrawPt - centerDrawPt; double distance = sqrt(pow(diffToCenter.x, 2) + pow(diffToCenter.y, 2)); @@ -130,34 +130,34 @@ void iwObservate::msgButtonClick(const unsigned ctrl_id) } } if(followMovableId) - getCtrl(ID_tmrUpdateFollow)->Start(); + getCtrl(ID_tmrUpdateFollow)->start(); } break; } case 3: - parentView.MoveToMapPt(MapPoint(view->getLastPt() - (view->getLastPt() - view->getFirstPt()) / 2)); + parentView.moveToMapPt(MapPoint(view->getLastPt() - (view->getLastPt() - view->getFirstPt()) / 2)); break; case 4: int diff = getSize().x; - if(getSize() == SmallWndSize) + if(getSize() == smallWndSize) { - Resize(MediumWndSize); - } else if(getSize() == MediumWndSize) + resize(mediumWndSize); + } else if(getSize() == mediumWndSize) { - Resize(BigWndSize); + resize(bigWndSize); getCtrl(4)->setImage(LOADER.getImageN("io", 108)); } else { - Resize(SmallWndSize); + resize(smallWndSize); getCtrl(4)->setImage(LOADER.getImageN("io", 109)); } diff -= getSize().x; diff /= 2; - view->Resize(getSize() - Extent::all(20)); + view->resize(getSize() - Extent::all(20)); for(unsigned i = 1; i <= 4; ++i) getCtrl(i)->setPos( @@ -170,16 +170,16 @@ void iwObservate::msgTimer(const unsigned ctrl_id) switch(ctrl_id) { case ID_tmrUpdateFollow: - if(followMovableId && !MoveToFollowedObj()) + if(followMovableId && !moveToFollowedObj()) { followMovableId = 0; - getCtrl(ID_tmrUpdateFollow)->Stop(); + getCtrl(ID_tmrUpdateFollow)->stop(); } break; } } -void iwObservate::DrawBackground() +void iwObservate::drawBackground() { if(getPos() != lastWindowPos) { @@ -190,21 +190,21 @@ void iwObservate::DrawBackground() RoadBuildState road; road.mode = RoadBuildMode::Disabled; - view->Draw(road, parentView.getSelectedPt(), false); + view->draw(road, parentView.getSelectedPt(), false); // Draw indicator for center point if(!followMovableId) - LOADER.getMapTexture(23)->DrawFull(view->getPos() + view->getSize() / 2u); + LOADER.getMapTexture(23)->drawFull(view->getPos() + view->getSize() / 2u); } -bool iwObservate::MoveToFollowedObj() +bool iwObservate::moveToFollowedObj() { // First look around the center (figure is normally still there) const GameWorldBase& world = view->getWorld(); - const MapPoint centerPt = world.MakeMapPoint((view->getFirstPt() + view->getLastPt()) / 2); + const MapPoint centerPt = world.makeMapPoint((view->getFirstPt() + view->getLastPt()) / 2); const std::vector centerPts = world.GetPointsInRadiusWithCenter(centerPt, 2); for(const MapPoint& curPt : centerPts) { - if(MoveToFollowedObj(curPt)) + if(moveToFollowedObj(curPt)) return true; } @@ -213,15 +213,15 @@ bool iwObservate::MoveToFollowedObj() { for(int x = view->getFirstPt().x; x <= view->getLastPt().x; ++x) { - const MapPoint curPt = world.MakeMapPoint(Position(x, y)); - if(MoveToFollowedObj(curPt)) + const MapPoint curPt = world.makeMapPoint(Position(x, y)); + if(moveToFollowedObj(curPt)) return true; } } return false; } -bool iwObservate::MoveToFollowedObj(const MapPoint ptToCheck) +bool iwObservate::moveToFollowedObj(const MapPoint ptToCheck) { if(view->getViewer().getVisibility(ptToCheck) != Visibility::Visible) return false; @@ -233,9 +233,9 @@ bool iwObservate::MoveToFollowedObj(const MapPoint ptToCheck) DrawPoint drawPt = view->getWorld().getNodePos(ptToCheck); if(followMovable.isMoving()) - drawPt += followMovable.CalcWalkingRelative(); + drawPt += followMovable.calcWalkingRelative(); - view->MoveTo(drawPt - view->getSize() / 2u); + view->moveTo(drawPt - view->getSize() / 2u); return true; } } @@ -251,7 +251,7 @@ bool iwObservate::msgMouseMove(const MouseCoords& mc) if(SETTINGS.interface.mapScrollMode == MapScrollMode::ScrollSame) acceleration = -acceleration; - view->MoveBy((mc.pos - scrollOrigin) * acceleration); + view->moveBy((mc.pos - scrollOrigin) * acceleration); VIDEODRIVER.setMousePos(scrollOrigin); return true; } else @@ -273,7 +273,7 @@ bool iwObservate::msgRightDown(const MouseCoords& mc) WINDOWMANAGER.setCursor(Cursor::Scroll); } else { - Close(); + close(); } return true; diff --git a/libs/s25main/ingameWindows/iwObservate.h b/libs/s25main/ingameWindows/iwObservate.h index c5dd0bb56c..2129d5c0b9 100644 --- a/libs/s25main/ingameWindows/iwObservate.h +++ b/libs/s25main/ingameWindows/iwObservate.h @@ -37,13 +37,13 @@ class iwObservate : public IngameWindow iwObservate(GameWorldView& gwv, MapPoint selectedPt); private: - void DrawBackground() override; + void drawBackground() override; void msgButtonClick(unsigned ctrl_id) override; bool msgMouseMove(const MouseCoords& mc) override; bool msgRightDown(const MouseCoords& mc) override; bool msgRightUp(const MouseCoords& mc) override; void msgTimer(unsigned ctrl_id) override; /// Move view to the object we currently follow, return true if it can still be found - bool MoveToFollowedObj(); - bool MoveToFollowedObj(MapPoint ptToCheck); + bool moveToFollowedObj(); + bool moveToFollowedObj(MapPoint ptToCheck); }; diff --git a/libs/s25main/ingameWindows/iwOptionsWindow.cpp b/libs/s25main/ingameWindows/iwOptionsWindow.cpp index cb4bd1e20c..53a1c1c343 100644 --- a/libs/s25main/ingameWindows/iwOptionsWindow.cpp +++ b/libs/s25main/ingameWindows/iwOptionsWindow.cpp @@ -70,16 +70,16 @@ iwOptionsWindow::iwOptionsWindow(SoundManager& soundManager) // The soldier on top constexpr Offset soldierOffset(0, 26); - AddImage(ID_imgSoldier, curPos + soldierOffset, LOADER.getImageN("io", 30)); + addImage(ID_imgSoldier, curPos + soldierOffset, LOADER.getImageN("io", 30)); curPos.y += textSpacing + soldierOffset.y; - AddText(ID_txtRttr, curPos, "Return To The Roots", COLOR_YELLOW, FontStyle::CENTER, NormalFont); + addText(ID_txtRttr, curPos, "Return To The Roots", COLOR_YELLOW, FontStyle::CENTER, NormalFont); curPos.y += textSpacing; - AddText(ID_txtVersion, curPos, rttr::version::getReadableVersion(), COLOR_YELLOW, FontStyle::CENTER, NormalFont); + addText(ID_txtVersion, curPos, rttr::version::getReadableVersion(), COLOR_YELLOW, FontStyle::CENTER, NormalFont); curPos.y += textSpacing; - AddFormattedText(ID_txtCopyright, curPos, + addFormattedText(ID_txtCopyright, curPos, "\xC2\xA9" "2005 - %s Settlers Freaks", COLOR_YELLOW, FontStyle::CENTER, NormalFont) @@ -87,13 +87,13 @@ iwOptionsWindow::iwOptionsWindow(SoundManager& soundManager) curPos.y += textSpacing * 2; curPos.x = leftMargin; - AddImageButton(ID_btKeyboardLayout, curPos, imageButtonSize, TextureColor::Green2, LOADER.getImageN("io", 79)); - AddText(ID_txtKeyboardLayout, curPos + textOffset, _("Keyboard layout"), COLOR_YELLOW, FontStyle::BOTTOM, + addImageButton(ID_btKeyboardLayout, curPos, imageButtonSize, TextureColor::Green2, LOADER.getImageN("io", 79)); + addText(ID_txtKeyboardLayout, curPos + textOffset, _("Keyboard layout"), COLOR_YELLOW, FontStyle::BOTTOM, NormalFont); curPos.y += imageButtonSize.y + generalSpacing; - AddImageButton(ID_btReadme, curPos, imageButtonSize, TextureColor::Green2, LOADER.getImageN("io", 79)); - AddText(ID_txtReadme, curPos + textOffset, _("Load 'ReadMe' file"), COLOR_YELLOW, FontStyle::BOTTOM, NormalFont); + addImageButton(ID_btReadme, curPos, imageButtonSize, TextureColor::Green2, LOADER.getImageN("io", 79)); + addText(ID_txtReadme, curPos + textOffset, _("Load 'ReadMe' file"), COLOR_YELLOW, FontStyle::BOTTOM, NormalFont); curPos.y += imageButtonSize.y + generalSpacing; // TODO: Implement @@ -102,43 +102,43 @@ iwOptionsWindow::iwOptionsWindow(SoundManager& soundManager) // curPos.y += imageButtonSize.y + generalSpacing; curPos.y += 3 + imageButtonSize.y / 2; // TODO: Delete this row, if the Load button is implemented - AddImageButton(ID_btSave, curPos, imageButtonSize, TextureColor::Green2, LOADER.getImageN("io", 47)); - AddText(ID_txtSave, curPos + textOffset, _("Save game!"), COLOR_YELLOW, FontStyle::BOTTOM, NormalFont); + addImageButton(ID_btSave, curPos, imageButtonSize, TextureColor::Green2, LOADER.getImageN("io", 47)); + addText(ID_txtSave, curPos + textOffset, _("Save game!"), COLOR_YELLOW, FontStyle::BOTTOM, NormalFont); curPos.y += 3 + imageButtonSize.y / 2; // TODO: Delete this row, if the Load button is implemented curPos.y += imageButtonSize.y + generalSpacing; // Sound on/off + volume - AddImageButton(ID_btSoundEffects, curPos, imageButtonSize, TextureColor::Green2, + addImageButton(ID_btSoundEffects, curPos, imageButtonSize, TextureColor::Green2, LOADER.getImageN("io", 114 + !SETTINGS.sound.effectsEnabled)); //-V807 - AddProgress(ID_pgEffectVol, curPos + optionOffset, optionSizeSmall, TextureColor::Green2, 139, 138, 100) + addProgress(ID_pgEffectVol, curPos + optionOffset, optionSizeSmall, TextureColor::Green2, 139, 138, 100) ->setPosition((SETTINGS.sound.effectsVolume * 100) / 255); curPos.y += imageButtonSize.y; curPos.x += optionOffset.x; - AddCheckBox(ID_cpBirdSounds, curPos, optionSizeSmall, TextureColor::Green2, _("Bird sounds"), NormalFont, false) + addCheckBox(ID_cpBirdSounds, curPos, optionSizeSmall, TextureColor::Green2, _("Bird sounds"), NormalFont, false) ->setChecked(SETTINGS.sound.birdsEnabled); curPos.y += optionSizeSmall.y + generalSpacing * 3; curPos.x = leftMargin; // Music on/off + volume - AddImageButton(ID_btMusic, curPos, imageButtonSize, TextureColor::Green2, + addImageButton(ID_btMusic, curPos, imageButtonSize, TextureColor::Green2, LOADER.getImageN("io", 116 + !SETTINGS.sound.musicEnabled)); - AddProgress(ID_pgMusicVol, curPos + optionOffset, optionSizeSmall, TextureColor::Green2, 139, 138, 100) + addProgress(ID_pgMusicVol, curPos + optionOffset, optionSizeSmall, TextureColor::Green2, 139, 138, 100) ->setPosition((SETTINGS.sound.musicVolume * 100) / 255); curPos.y += imageButtonSize.y; curPos.x += optionOffset.x; - AddTextButton(ID_btMusicPlayer, curPos, optionSizeSmall, TextureColor::Green2, _("Music player"), NormalFont); + addTextButton(ID_btMusicPlayer, curPos, optionSizeSmall, TextureColor::Green2, _("Music player"), NormalFont); curPos.y += optionSizeSmall.y + generalSpacing * 3; curPos.x = leftMargin; // Buttons at the bottom curPos.x = centerPosition - optionSizeBig.x / 2; - AddTextButton(ID_btAdvanced, curPos, optionSizeBig, TextureColor::Green2, _("Advanced"), NormalFont); + addTextButton(ID_btAdvanced, curPos, optionSizeBig, TextureColor::Green2, _("Advanced"), NormalFont); curPos.y += optionSizeBig.y + generalSpacing; - AddTextButton(ID_btSurrender, curPos, optionSizeBig, TextureColor::Red1, _("Surrender"), NormalFont); + addTextButton(ID_btSurrender, curPos, optionSizeBig, TextureColor::Red1, _("Surrender"), NormalFont); curPos.y += optionSizeBig.y + generalSpacing; - AddTextButton(ID_btEndGame, curPos, optionSizeBig, TextureColor::Red1, _("End game"), NormalFont); + addTextButton(ID_btEndGame, curPos, optionSizeBig, TextureColor::Red1, _("End game"), NormalFont); } void iwOptionsWindow::msgButtonClick(const unsigned ctrl_id) @@ -146,14 +146,14 @@ void iwOptionsWindow::msgButtonClick(const unsigned ctrl_id) switch(ctrl_id) { case ID_btEndGame: - WINDOWMANAGER.ToggleWindow(std::make_unique()); - Close(); + WINDOWMANAGER.toggleWindow(std::make_unique()); + close(); break; case ID_btKeyboardLayout: - WINDOWMANAGER.ToggleWindow(std::make_unique("keyboardlayout.txt", _("Keyboard layout"))); + WINDOWMANAGER.toggleWindow(std::make_unique("keyboardlayout.txt", _("Keyboard layout"))); break; - case ID_btReadme: WINDOWMANAGER.ToggleWindow(std::make_unique("readme.txt", _("Readme!"))); break; - case ID_btSave: WINDOWMANAGER.ToggleWindow(std::make_unique()); break; + case ID_btReadme: WINDOWMANAGER.toggleWindow(std::make_unique("readme.txt", _("Readme!"))); break; + case ID_btSave: WINDOWMANAGER.toggleWindow(std::make_unique()); break; case ID_btSoundEffects: SETTINGS.sound.effectsEnabled = !SETTINGS.sound.effectsEnabled; //-V807 @@ -169,18 +169,18 @@ void iwOptionsWindow::msgButtonClick(const unsigned ctrl_id) getCtrl(ID_btMusic) ->setImage(LOADER.getTextureN("io", 116 + !SETTINGS.sound.musicEnabled)); if(SETTINGS.sound.musicEnabled) - MUSICPLAYER.Play(); + MUSICPLAYER.play(); else - MUSICPLAYER.Stop(); + MUSICPLAYER.stop(); break; - case ID_btMusicPlayer: WINDOWMANAGER.ToggleWindow(std::make_unique()); break; + case ID_btMusicPlayer: WINDOWMANAGER.toggleWindow(std::make_unique()); break; case ID_btSurrender: - WINDOWMANAGER.ReplaceWindow(std::make_unique()); - Close(); + WINDOWMANAGER.replaceWindow(std::make_unique()); + close(); break; case ID_btAdvanced: - WINDOWMANAGER.ReplaceWindow(std::make_unique()); - Close(); + WINDOWMANAGER.replaceWindow(std::make_unique()); + close(); break; } } diff --git a/libs/s25main/ingameWindows/iwPlayReplay.cpp b/libs/s25main/ingameWindows/iwPlayReplay.cpp index 4fe3bcb906..dba09a7977 100644 --- a/libs/s25main/ingameWindows/iwPlayReplay.cpp +++ b/libs/s25main/ingameWindows/iwPlayReplay.cpp @@ -28,7 +28,7 @@ class SwitchOnStart : public ClientInterface { public: SwitchOnStart() { GAMECLIENT.setInterface(this); } - ~SwitchOnStart() override { GAMECLIENT.RemoveInterface(this); } + ~SwitchOnStart() override { GAMECLIENT.removeInterface(this); } void CI_GameLoading(std::shared_ptr game) override { @@ -47,27 +47,27 @@ iwPlayReplay::iwPlayReplay() LOADER.getImageN("resource", 41)) { using SRT = ctrlTable::SortType; - AddTable(0, DrawPoint(20, 30), Extent(560, 220), TextureColor::Green2, NormalFont, + addTable(0, DrawPoint(20, 30), Extent(560, 220), TextureColor::Green2, NormalFont, ctrlTable::Columns{{("Filename"), 300, SRT::String}, {_("Stocktaking date"), 220, SRT::Date}, {_("Player"), 360, SRT::String}, {_("Length"), 120, SRT::Time}, {}}); - AddTextButton(2, DrawPoint(20, 260), Extent(100, 22), TextureColor::Red1, _("Clear"), NormalFont); - AddTextButton(5, DrawPoint(130, 260), Extent(160, 22), TextureColor::Red1, "Delete Invalid", NormalFont, + addTextButton(2, DrawPoint(20, 260), Extent(100, 22), TextureColor::Red1, _("Clear"), NormalFont); + addTextButton(5, DrawPoint(130, 260), Extent(160, 22), TextureColor::Red1, "Delete Invalid", NormalFont, _("Removes all replays that cannot be loaded with the current game version")); - AddTextButton(3, DrawPoint(20, 290), Extent(160, 22), TextureColor::Red1, _("Delete selected"), NormalFont); - AddTextButton(4, DrawPoint(190, 290), Extent(190, 22), TextureColor::Red1, _("Back"), NormalFont); - AddTextButton(1, DrawPoint(390, 290), Extent(190, 22), TextureColor::Green2, _("Start"), NormalFont); + addTextButton(3, DrawPoint(20, 290), Extent(160, 22), TextureColor::Red1, _("Delete selected"), NormalFont); + addTextButton(4, DrawPoint(190, 290), Extent(190, 22), TextureColor::Red1, _("Back"), NormalFont); + addTextButton(1, DrawPoint(390, 290), Extent(190, 22), TextureColor::Green2, _("Start"), NormalFont); - PopulateTable(); + populateTable(); // Nach Zeit Sortieren - getCtrl(0)->SortRows(1, TableSortDir::Descending); + getCtrl(0)->sortRows(1, TableSortDir::Descending); } -void iwPlayReplay::PopulateTable() +void iwPlayReplay::populateTable() { static bool loadedOnce = false; @@ -76,7 +76,7 @@ void iwPlayReplay::PopulateTable() if(sortCol == -1) sortCol = 0; const auto sortDir = table->getSortDirection(); - table->DeleteAllItems(); + table->deleteAllItems(); unsigned numInvalid = 0; @@ -86,7 +86,7 @@ void iwPlayReplay::PopulateTable() Replay replay; // Datei laden - if(!replay.LoadHeader(path)) + if(!replay.loadHeader(path)) { // Show errors only first time this is loaded if(!loadedOnce) @@ -115,14 +115,14 @@ void iwPlayReplay::PopulateTable() if(!path.has_filename()) continue; std::string fileName = path.filename().string(); - std::string length = GAMECLIENT.FormatGFTime(replay.getLastGF()); + std::string length = GAMECLIENT.formatGFTime(replay.getLastGF()); // Und das Zeug zur Tabelle hinzufügen - table->AddRow({fileName, dateStr, tmp_players, length, path.string()}); + table->addRow({fileName, dateStr, tmp_players, length, path.string()}); } // Erst einmal nach Dateiname sortieren - table->SortRows(sortCol, sortDir); + table->sortRows(sortCol, sortDir); auto* btDelInvalid = getCtrl(5); if(numInvalid == 0) @@ -140,23 +140,23 @@ void iwPlayReplay::msgButtonClick(const unsigned ctrl_id) switch(ctrl_id) { default: break; - case 1: StartReplay(); break; + case 1: startReplay(); break; case 2: - WINDOWMANAGER.Show(std::make_unique(_("Clear"), _("Are you sure to remove all replays?"), this, + WINDOWMANAGER.show(std::make_unique(_("Clear"), _("Are you sure to remove all replays?"), this, MsgboxButton::YesNo, MsgboxIcon::QuestionRed, 1)); break; case 3: { auto* table = getCtrl(0); if(table->getSelection()) - WINDOWMANAGER.Show(std::make_unique(_("Delete selected"), + WINDOWMANAGER.show(std::make_unique(_("Delete selected"), _("Are you sure you want to remove the selected replay?"), this, MsgboxButton::YesNo, MsgboxIcon::QuestionRed, 2)); break; } - case 4: Close(); break; + case 4: close(); break; case 5: - WINDOWMANAGER.Show(std::make_unique(_("Clear"), _("Are you sure to remove all invalid replays?"), + WINDOWMANAGER.show(std::make_unique(_("Clear"), _("Are you sure to remove all invalid replays?"), this, MsgboxButton::YesNo, MsgboxIcon::QuestionRed, 3)); break; } @@ -164,22 +164,22 @@ void iwPlayReplay::msgButtonClick(const unsigned ctrl_id) void iwPlayReplay::msgTableChooseItem(const unsigned /*ctrl_id*/, const unsigned /*selection*/) { - StartReplay(); + startReplay(); } /// Startet das Replay (aktuell ausgewählter Eintrag) -void iwPlayReplay::StartReplay() +void iwPlayReplay::startReplay() { // Mond malen - LOADER.getImageN("resource", 33)->DrawFull(VIDEODRIVER.getMousePos() - DrawPoint(0, 40)); - VIDEODRIVER.SwapBuffers(); + LOADER.getImageN("resource", 33)->drawFull(VIDEODRIVER.getMousePos() - DrawPoint(0, 40)); + VIDEODRIVER.swapBuffers(); auto* table = getCtrl(0); if(table->getSelection()) { SwitchOnStart switchOnStart; - if(!GAMECLIENT.StartReplay(table->getItemText(*table->getSelection(), 4))) - WINDOWMANAGER.Show(std::make_unique(_("Error while playing replay!"), _("Invalid Replay!"), this, + if(!GAMECLIENT.startReplay(table->getItemText(*table->getSelection(), 4))) + WINDOWMANAGER.show(std::make_unique(_("Error while playing replay!"), _("Invalid Replay!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); } } @@ -197,22 +197,22 @@ void iwPlayReplay::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult } // Tabelle leeren - getCtrl(0)->DeleteAllItems(); + getCtrl(0)->deleteAllItems(); } else if(msgbox_id == 3 && mbr == MsgboxResult::Yes) { const std::vector replays = GetReplays(); for(const auto& it : replays) { Replay replay; - if(!replay.LoadHeader(it)) + if(!replay.loadHeader(it)) { - replay.Close(); + replay.close(); boost::system::error_code ec; bfs::remove(it, ec); } } - PopulateTable(); + populateTable(); } else if(msgbox_id == 2 && mbr == MsgboxResult::Yes) { auto* table = getCtrl(0); @@ -220,7 +220,7 @@ void iwPlayReplay::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult { boost::system::error_code ec; bfs::remove(table->getItemText(*table->getSelection(), 4), ec); - PopulateTable(); + populateTable(); } } } diff --git a/libs/s25main/ingameWindows/iwPlayReplay.h b/libs/s25main/ingameWindows/iwPlayReplay.h index 2e56d53a06..92c5dfd817 100644 --- a/libs/s25main/ingameWindows/iwPlayReplay.h +++ b/libs/s25main/ingameWindows/iwPlayReplay.h @@ -17,8 +17,8 @@ class iwPlayReplay : public IngameWindow void msgTableChooseItem(unsigned ctrl_id, unsigned selection) override; private: - void PopulateTable(); + void populateTable(); /// Startet das Replay (aktuell ausgewählter Eintrag) - void StartReplay(); + void startReplay(); }; diff --git a/libs/s25main/ingameWindows/iwPleaseWait.cpp b/libs/s25main/ingameWindows/iwPleaseWait.cpp index 863e66271e..4f83e56299 100644 --- a/libs/s25main/ingameWindows/iwPleaseWait.cpp +++ b/libs/s25main/ingameWindows/iwPleaseWait.cpp @@ -19,7 +19,7 @@ iwPleaseWait::iwPleaseWait() LOADER.getImageN("resource", 41), true, CloseBehavior::Custom) { WINDOWMANAGER.setCursor(Cursor::Moon); - AddText(0, getSize() / 2, _("Please wait..."), COLOR_YELLOW, FontStyle::CENTER | FontStyle::VCENTER, NormalFont); + addText(0, getSize() / 2, _("Please wait..."), COLOR_YELLOW, FontStyle::CENTER | FontStyle::VCENTER, NormalFont); } iwPleaseWait::~iwPleaseWait() diff --git a/libs/s25main/ingameWindows/iwPostWindow.cpp b/libs/s25main/ingameWindows/iwPostWindow.cpp index f020643326..f221573367 100644 --- a/libs/s25main/ingameWindows/iwPostWindow.cpp +++ b/libs/s25main/ingameWindows/iwPostWindow.cpp @@ -55,58 +55,58 @@ iwPostWindow::iwPostWindow(GameWorldView& gwv, PostBox& postBox) gwv(gwv), postBox(postBox), showAll(true), curCategory(PostCategory::General), curMsg(nullptr), lastHasMissionGoal(true) { - AddImageButton(ID_SHOW_ALL, DrawPoint(18, 25), Extent(35, 35), TextureColor::Grey, + addImageButton(ID_SHOW_ALL, DrawPoint(18, 25), Extent(35, 35), TextureColor::Grey, LOADER.getImageN("io", 190)); // Viewer: 191 - Papier - AddImageButton(ID_SHOW_MIL, DrawPoint(56, 25), Extent(35, 35), TextureColor::Grey, + addImageButton(ID_SHOW_MIL, DrawPoint(56, 25), Extent(35, 35), TextureColor::Grey, LOADER.getImageN("io", 30)); // Viewer: 31 - Soldat - AddImageButton(ID_SHOW_GEO, DrawPoint(91, 25), Extent(35, 35), TextureColor::Grey, + addImageButton(ID_SHOW_GEO, DrawPoint(91, 25), Extent(35, 35), TextureColor::Grey, LOADER.getImageN("io", 20)); // Viewer: 21 - Geologe - AddImageButton(ID_SHOW_ECO, DrawPoint(126, 25), Extent(35, 35), TextureColor::Grey, + addImageButton(ID_SHOW_ECO, DrawPoint(126, 25), Extent(35, 35), TextureColor::Grey, LOADER.getImageN("io", 28)); // Viewer: 29 - Wage - AddImageButton(ID_SHOW_GEN, DrawPoint(161, 25), Extent(35, 35), TextureColor::Grey, + addImageButton(ID_SHOW_GEN, DrawPoint(161, 25), Extent(35, 35), TextureColor::Grey, LOADER.getImageN("io", 189)); // Viewer: 190 - Neue Nachricht - AddImageButton(ID_SHOW_GOAL, DrawPoint(199, 25), Extent(35, 35), TextureColor::Grey, + addImageButton(ID_SHOW_GOAL, DrawPoint(199, 25), Extent(35, 35), TextureColor::Grey, LOADER.getImageN("io", 79)); // Viewer: 80 - Notiz - AddImage(0, DrawPoint(126, 151), LOADER.getImageN("io", 228)); - AddImageButton(ID_HELP, DrawPoint(18, 242), Extent(30, 35), TextureColor::Grey, + addImage(0, DrawPoint(126, 151), LOADER.getImageN("io", 228)); + addImageButton(ID_HELP, DrawPoint(18, 242), Extent(30, 35), TextureColor::Grey, LOADER.getImageN("io", 225)); // Viewer: 226 - Hilfe - AddImageButton(ID_GO_START, DrawPoint(51, 246), Extent(30, 26), TextureColor::Grey, + addImageButton(ID_GO_START, DrawPoint(51, 246), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 102)); // Viewer: 103 - Schnell zurück - AddImageButton(ID_GO_BACK, DrawPoint(81, 246), Extent(30, 26), TextureColor::Grey, + addImageButton(ID_GO_BACK, DrawPoint(81, 246), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 103)); // Viewer: 104 - Zurück - AddImageButton(ID_GO_FWD, DrawPoint(111, 246), Extent(30, 26), TextureColor::Grey, + addImageButton(ID_GO_FWD, DrawPoint(111, 246), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 104)); // Viewer: 105 - Vor - AddImageButton(ID_GO_END, DrawPoint(141, 246), Extent(30, 26), TextureColor::Grey, + addImageButton(ID_GO_END, DrawPoint(141, 246), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 105)); // Viewer: 106 - Schnell vor // Goto, nur sichtbar wenn Nachricht mit Koordinaten da - AddImageButton(ID_GOTO, DrawPoint(181, 246), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 107)) + addImageButton(ID_GOTO, DrawPoint(181, 246), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 107)) ->setVisible(false); // Mülleimer, nur sichtbar, wenn Nachricht da - AddImageButton(ID_DELETE, DrawPoint(211, 246), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 106)) + addImageButton(ID_DELETE, DrawPoint(211, 246), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 106)) ->setVisible(false); - AddText(ID_INFO, DrawPoint(127, 228), "", MakeColor(255, 188, 100, 88), FontStyle::CENTER | FontStyle::BOTTOM, + addText(ID_INFO, DrawPoint(127, 228), "", MakeColor(255, 188, 100, 88), FontStyle::CENTER | FontStyle::BOTTOM, SmallFont) ->setVisible(false); - AddImage(ID_IMG, DrawPoint(127, 155), LOADER.getImageN("io", 225)); + addImage(ID_IMG, DrawPoint(127, 155), LOADER.getImageN("io", 225)); // Multiline-Teil mit drei leeren Zeilen erzeugen - ctrlMultiline* text = AddMultiline(ID_TEXT, DrawPoint(126, 141), Extent(200, 0), TextureColor::Invisible, + ctrlMultiline* text = addMultiline(ID_TEXT, DrawPoint(126, 141), Extent(200, 0), TextureColor::Invisible, NormalFont, FontStyle::CENTER | FontStyle::BOTTOM | FontStyle::NO_OUTLINE); text->setNumVisibleLines(4); - text->ShowBackground(false); + text->showBackground(false); // Button with OK and deny sign (tick and cross) for contracts - AddImageButton(ID_ACCEPT, DrawPoint(87, 185), Extent(30, 26), TextureColor::Green1, LOADER.getImageN("io", 32)) + addImageButton(ID_ACCEPT, DrawPoint(87, 185), Extent(30, 26), TextureColor::Green1, LOADER.getImageN("io", 32)) ->setVisible(false); - AddImageButton(ID_DENY, DrawPoint(137, 185), Extent(30, 26), TextureColor::Red1, LOADER.getImageN("io", 40)) + addImageButton(ID_DENY, DrawPoint(137, 185), Extent(30, 26), TextureColor::Red1, LOADER.getImageN("io", 40)) ->setVisible(false); - FilterMessages(); + filterMessages(); curMsgId = curMsgIdxs.size(); - DisplayPostMessage(); + displayPostMessage(); } void iwPostWindow::msgButtonClick(const unsigned ctrl_id) @@ -114,66 +114,66 @@ void iwPostWindow::msgButtonClick(const unsigned ctrl_id) switch(ctrl_id) { case ID_HELP: - WINDOWMANAGER.ReplaceWindow(std::make_unique( + WINDOWMANAGER.replaceWindow(std::make_unique( _("All important messages are collected in this window and " "sorted into groups. If this window is not open, the dove " "symbol at the bottom of the screen indicates the arrival of a new message."))); break; case ID_SHOW_ALL: showAll = true; - FilterMessages(); + filterMessages(); curMsgId = curMsgIdxs.size(); - DisplayPostMessage(); + displayPostMessage(); break; case ID_SHOW_GOAL: if(!postBox.getCurrentMissionGoal().empty()) - WINDOWMANAGER.Show(std::make_unique(_("Diary"), postBox.getCurrentMissionGoal(), + WINDOWMANAGER.show(std::make_unique(_("Diary"), postBox.getCurrentMissionGoal(), false, iwMissionStatement::IM_AVATAR9)); break; - case ID_SHOW_MIL: SwitchCategory(PostCategory::Military); break; - case ID_SHOW_GEO: SwitchCategory(PostCategory::Geologist); break; - case ID_SHOW_ECO: SwitchCategory(PostCategory::Economy); break; - case ID_SHOW_GEN: SwitchCategory(PostCategory::General); break; + case ID_SHOW_MIL: switchCategory(PostCategory::Military); break; + case ID_SHOW_GEO: switchCategory(PostCategory::Geologist); break; + case ID_SHOW_ECO: switchCategory(PostCategory::Economy); break; + case ID_SHOW_GEN: switchCategory(PostCategory::General); break; case ID_GO_START: // To oldest curMsgId = 0; - DisplayPostMessage(); + displayPostMessage(); break; case ID_GO_BACK: // Back curMsgId = (curMsgId > 0) ? curMsgId - 1 : 0; - DisplayPostMessage(); + displayPostMessage(); break; case ID_GO_FWD: // Forward ++curMsgId; - DisplayPostMessage(); + displayPostMessage(); break; case ID_GO_END: // To newest curMsgId = postBox.getNumMsgs(); - DisplayPostMessage(); + displayPostMessage(); break; case ID_GOTO: { // Goto - if(!ValidateMessages()) + if(!validateMessages()) return; if(curMsg && curMsg->getPos().isValid()) - gwv.MoveToMapPt(curMsg->getPos()); + gwv.moveToMapPt(curMsg->getPos()); } break; case ID_DELETE: // Delete { - if(!ValidateMessages() || !curMsg) + if(!validateMessages() || !curMsg) return; - postBox.DeleteMsg(curMsg); + postBox.deleteMsg(curMsg); break; } case ID_DENY: // Cross (Deny) { - if(!ValidateMessages() || !curMsg) + if(!validateMessages() || !curMsg) return; const auto* dcurMsg = dynamic_cast(curMsg); if(dcurMsg) @@ -181,7 +181,7 @@ void iwPostWindow::msgButtonClick(const unsigned ctrl_id) // If it is a question about a new contract, tell the other player we denied it if(dcurMsg->isAccept()) if(GAMECLIENT.CancelPact(dcurMsg->getPactType(), dcurMsg->getPlayerId())) - postBox.DeleteMsg(curMsg); + postBox.deleteMsg(curMsg); } } break; @@ -189,7 +189,7 @@ void iwPostWindow::msgButtonClick(const unsigned ctrl_id) // Haken-Button ("Ja") case ID_ACCEPT: { - if(!ValidateMessages()) + if(!validateMessages()) return; const auto* dcurMsg = dynamic_cast(getMsg(curMsgId)); if(dcurMsg) @@ -202,7 +202,7 @@ void iwPostWindow::msgButtonClick(const unsigned ctrl_id) else success = GAMECLIENT.CancelPact(dcurMsg->getPactType(), dcurMsg->getPlayerId()); if(success) - postBox.DeleteMsg(dcurMsg); + postBox.deleteMsg(dcurMsg); } } break; @@ -212,7 +212,7 @@ void iwPostWindow::msgButtonClick(const unsigned ctrl_id) void iwPostWindow::msgPaintBefore() { IngameWindow::msgPaintBefore(); - ValidateMessages(); + validateMessages(); if(lastHasMissionGoal != !postBox.getCurrentMissionGoal().empty()) { lastHasMissionGoal = !postBox.getCurrentMissionGoal().empty(); @@ -253,7 +253,7 @@ bool iwPostWindow::msgKeyDown(const KeyEvent& ke) } // Zeigt Nachricht an, passt Steuerelemente an -void iwPostWindow::DisplayPostMessage() +void iwPostWindow::displayPostMessage() { const DrawPoint imgBottomCenter(127, 210); //-V821 // todo: koordinaten abschmecken @@ -288,7 +288,7 @@ void iwPostWindow::DisplayPostMessage() // We have a message, display its status... std::stringstream ss; ss << _("Message") << " " << curMsgId + 1 << "/" << size << " - " << _("Time") << ": " - << GAMECLIENT.FormatGFTime(curMsg->getSendFrame()); + << GAMECLIENT.formatGFTime(curMsg->getSendFrame()); getCtrl(ID_INFO)->setText(ss.str()); getCtrl(ID_INFO)->setVisible(true); // ...and delete button @@ -323,11 +323,11 @@ void iwPostWindow::DisplayPostMessage() void iwPostWindow::setMessageText(const std::string& message) { auto* text = getCtrl(ID_TEXT); - text->Clear(); - text->AddString(message, COLOR_WINDOWBROWN); + text->clear(); + text->addString(message, COLOR_WINDOWBROWN); } -void iwPostWindow::FilterMessages() +void iwPostWindow::filterMessages() { curMsgIdxs.clear(); lastMsgCt = postBox.getNumMsgs(); @@ -345,17 +345,17 @@ void iwPostWindow::FilterMessages() } } -bool iwPostWindow::ValidateMessages() +bool iwPostWindow::validateMessages() { if(lastMsgCt == postBox.getNumMsgs() && getMsg(curMsgId) == curMsg) return true; // Messages have changed -> Update filter - FilterMessages(); + filterMessages(); if(!curMsg) { // No last message? Display oldest curMsgId = 0; - DisplayPostMessage(); + displayPostMessage(); return false; } else { @@ -366,12 +366,12 @@ bool iwPostWindow::ValidateMessages() if(postBox.getMsg(i - 1) == curMsg) { curMsgId = i - 1; - DisplayPostMessage(); + displayPostMessage(); return true; } } // Display next valid one - DisplayPostMessage(); + displayPostMessage(); return false; } } @@ -384,11 +384,11 @@ const PostMsg* iwPostWindow::getMsg(unsigned id) const return nullptr; } -void iwPostWindow::SwitchCategory(PostCategory cat) +void iwPostWindow::switchCategory(PostCategory cat) { showAll = false; curCategory = cat; - FilterMessages(); + filterMessages(); curMsgId = curMsgIdxs.size(); - DisplayPostMessage(); + displayPostMessage(); } diff --git a/libs/s25main/ingameWindows/iwPostWindow.h b/libs/s25main/ingameWindows/iwPostWindow.h index 09353cdd89..395ff3bad5 100644 --- a/libs/s25main/ingameWindows/iwPostWindow.h +++ b/libs/s25main/ingameWindows/iwPostWindow.h @@ -33,11 +33,11 @@ class iwPostWindow : public IngameWindow bool lastHasMissionGoal; /// Passt Steuerelemente an, setzt Einstellung für diverse Controls passend für die aktuelle PostMessage - void DisplayPostMessage(); + void displayPostMessage(); /// Setzt den Text mehrzeilig in das Postfenster void setMessageText(const std::string& message); - void FilterMessages(); - bool ValidateMessages(); + void filterMessages(); + bool validateMessages(); const PostMsg* getMsg(unsigned id) const; - void SwitchCategory(PostCategory cat); + void switchCategory(PostCategory cat); }; diff --git a/libs/s25main/ingameWindows/iwRoadWindow.cpp b/libs/s25main/ingameWindows/iwRoadWindow.cpp index 3dc1945015..269113b207 100644 --- a/libs/s25main/ingameWindows/iwRoadWindow.cpp +++ b/libs/s25main/ingameWindows/iwRoadWindow.cpp @@ -16,14 +16,14 @@ iwRoadWindow::iwRoadWindow(GameInterface& gi, bool flagpossible, const Position& gi(gi), mousePosAtOpen_(mousePos) { // Bau abbrechen - ctrlButton* cancel = AddImageButton(1, DrawPoint(10, 20), Extent(36, 36), TextureColor::Grey, + ctrlButton* cancel = addImageButton(1, DrawPoint(10, 20), Extent(36, 36), TextureColor::Grey, LOADER.getImageN("io", 110), _("Interrupt road building")); ctrlButton* defaultBt = cancel; if(flagpossible) { // Flagge platzieren - defaultBt = AddImageButton(0, DrawPoint(10, 20), Extent(36, 36), TextureColor::Grey, LOADER.getImageN("io", 70), + defaultBt = addImageButton(0, DrawPoint(10, 20), Extent(36, 36), TextureColor::Grey, LOADER.getImageN("io", 70), _("Erect flag")); // Abbrechen button daneben schieben cancel->setPos(DrawPoint(46, 20)); @@ -52,5 +52,5 @@ void iwRoadWindow::msgButtonClick(const unsigned ctrl_id) VIDEODRIVER.setMousePos(mousePosAtOpen_); // und fenster schließen - Close(); + close(); } diff --git a/libs/s25main/ingameWindows/iwSave.cpp b/libs/s25main/ingameWindows/iwSave.cpp index c47643efeb..8906879c61 100644 --- a/libs/s25main/ingameWindows/iwSave.cpp +++ b/libs/s25main/ingameWindows/iwSave.cpp @@ -48,33 +48,33 @@ iwSaveLoad::iwSaveLoad(const std::string& window_title, ITexture* btImg, const u LOADER.getImageN("resource", 41)) { using SRT = ctrlTable::SortType; - AddTable(ID_tblSaveGames, DrawPoint(20, 30), Extent(660, 300), TextureColor::Green2, NormalFont, + addTable(ID_tblSaveGames, DrawPoint(20, 30), Extent(660, 300), TextureColor::Green2, NormalFont, ctrlTable::Columns{{_("Filename"), 320, SRT::String}, {_("Map"), 250, SRT::String}, {_("Time"), 160, SRT::Date}, {_("Game Time"), 115, SRT::Time}, {}}); - AddText(ID_txtSaveFolder, DrawPoint(20, 333), RTTRCONFIG.ExpandPath(s25::folders::save).string(), COLOR_YELLOW, + addText(ID_txtSaveFolder, DrawPoint(20, 333), RTTRCONFIG.ExpandPath(s25::folders::save).string(), COLOR_YELLOW, FontStyle::TOP, SmallFont) ->setMaxWidth(510); // maxLength 251 = 255 filename limit - 4 chars for ".sav"; just discourages absurdly long // input, isValidFileName() may still reject it since it counts bytes, not codepoints. - AddEdit(ID_edtFilename, DrawPoint(20, 350), Extent(510, 22), TextureColor::Green2, NormalFont, 251); - AddImageButton(ID_btSaveOrLoad, DrawPoint(540, 341), Extent(40, 40), TextureColor::Green2, btImg); + addEdit(ID_edtFilename, DrawPoint(20, 350), Extent(510, 22), TextureColor::Green2, NormalFont, 251); + addImageButton(ID_btSaveOrLoad, DrawPoint(540, 341), Extent(40, 40), TextureColor::Green2, btImg); // Initially fill the table - RefreshTable(); + refreshTable(); } void iwSaveLoad::msgEditEnter(const unsigned /*ctrl_id*/) { - SaveLoad(); + saveLoad(); } void iwSaveLoad::msgButtonClick(const unsigned ctrl_id) { RTTR_Assert(ctrl_id == ID_btSaveOrLoad); - SaveLoad(); + saveLoad(); } void iwSaveLoad::msgTableSelectItem(const unsigned /*ctrl_id*/, const std::optional& selection) @@ -84,13 +84,13 @@ void iwSaveLoad::msgTableSelectItem(const unsigned /*ctrl_id*/, const std::optio ->setText(selection ? getCtrl(ID_tblSaveGames)->getItemText(*selection, 0) : ""); } -void iwSaveLoad::RefreshTable() +void iwSaveLoad::refreshTable() { static bool loadedOnce = false; auto* table = getCtrl(ID_tblSaveGames); - table->DeleteAllItems(); + table->deleteAllItems(); std::vector saveFiles = ListDir(RTTRCONFIG.ExpandPath(s25::folders::save), "sav"); for(const auto& saveFile : saveFiles) @@ -109,34 +109,34 @@ void iwSaveLoad::RefreshTable() const auto fileName = saveFile.stem().string(); const std::string dateStr = s25util::Time::FormatTime("%d.%m.%Y - %H:%i", save.getSaveTime()); - const std::string gameTime = GAMECLIENT.FormatGFTime(save.start_gf); + const std::string gameTime = GAMECLIENT.formatGFTime(save.start_gf); - table->AddRow({fileName, save.getMapName(), dateStr, gameTime, saveFile.string()}); + table->addRow({fileName, save.getMapName(), dateStr, gameTime, saveFile.string()}); } // Sort by time - table->SortRows(2, TableSortDir::Descending); + table->sortRows(2, TableSortDir::Descending); loadedOnce = true; } -void iwSave::SaveLoad() +void iwSave::saveLoad() { const auto fileNameResult = getCtrl(ID_edtFilename)->getFileName(".sav"); switch(fileNameResult.status) { case FileNameStatus::Empty: - WINDOWMANAGER.Show(std::make_unique(_("Invalid Filename"), _("Please enter a filename."), this, + WINDOWMANAGER.show(std::make_unique(_("Invalid Filename"), _("Please enter a filename."), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); return; case FileNameStatus::Invalid: - WINDOWMANAGER.Show(std::make_unique(_("Invalid Filename"), _("Please enter a valid filename."), + WINDOWMANAGER.show(std::make_unique(_("Invalid Filename"), _("Please enter a valid filename."), this, MsgboxButton::Ok, MsgboxIcon::ExclamationRed)); return; case FileNameStatus::Valid: break; } - GAMECLIENT.SaveToFile(RTTRCONFIG.ExpandPath(s25::folders::save) / fileNameResult.name); + GAMECLIENT.saveToFile(RTTRCONFIG.ExpandPath(s25::folders::save) / fileNameResult.name); - RefreshTable(); + refreshTable(); getCtrl(ID_edtFilename)->setText(""); } @@ -147,17 +147,17 @@ iwSave::iwSave() : iwSaveLoad(_("Save game!"), LOADER.getTextureN("io", 47), 30) DrawPoint pos(getSize().x / 2, fileNameEdit->getPos().y + fileNameEdit->getSize().y + 10); ctrlComboBox* combo = - AddComboBox(ID_cbAutoSaveInterval, pos, Extent(130, 22), TextureColor::Green2, NormalFont, 100); + addComboBox(ID_cbAutoSaveInterval, pos, Extent(130, 22), TextureColor::Green2, NormalFont, 100); pos += DrawPoint(-5, 11); - AddText(ID_txtAutoSave, pos, _("Auto-Save every:"), 0xFFFFFF00, FontStyle::RIGHT | FontStyle::VCENTER, NormalFont); + addText(ID_txtAutoSave, pos, _("Auto-Save every:"), 0xFFFFFF00, FontStyle::RIGHT | FontStyle::VCENTER, NormalFont); // Add intervals - combo->AddItem(_("Disabled")); + combo->addItem(_("Disabled")); for(const std::chrono::minutes interval : AUTO_SAVE_INTERVALS) - combo->AddItem((boost::format(_("%1% min")) % interval.count()).str()); + combo->addItem((boost::format(_("%1% min")) % interval.count()).str()); // Last entry is only for debugging if(SETTINGS.global.debugMode) - combo->AddItem(_("Every GF")); + combo->addItem(_("Every GF")); // Select interval combo->setSelection(0); // Use disabled by default and change if possible @@ -193,29 +193,29 @@ void iwSave::msgComboSelectItem(const unsigned /*ctrl_id*/, const unsigned selec iwLoad::iwLoad(CreateServerInfo csi) : iwSaveLoad(_("Load game!"), LOADER.getTextureN("io", 48)), csi(std::move(csi)) {} -void iwLoad::SaveLoad() +void iwLoad::saveLoad() { const auto* table = getCtrl(ID_tblSaveGames); if(!table->getSelection()) return; - if(GAMECLIENT.HostGame(csi, {table->getItemText(*table->getSelection(), 4), MapType::Savegame})) + if(GAMECLIENT.hostGame(csi, {table->getItemText(*table->getSelection(), 4), MapType::Savegame})) { std::unique_ptr lobbyClient; if(csi.type == ServerType::Lobby) lobbyClient = std::make_unique(LOBBYCLIENT); - WINDOWMANAGER.Show(std::make_unique(csi.type, std::move(lobbyClient))); + WINDOWMANAGER.show(std::make_unique(csi.type, std::move(lobbyClient))); } else { if(LOBBYCLIENT.IsLoggedIn()) WINDOWMANAGER.Switch(std::make_unique()); else - Close(); + close(); } } /// Handle double click on the table void iwLoad::msgTableChooseItem(const unsigned /*ctrl_id*/, const unsigned /*selection*/) { - SaveLoad(); + saveLoad(); } diff --git a/libs/s25main/ingameWindows/iwSave.h b/libs/s25main/ingameWindows/iwSave.h index 10f56e542d..0c9e180e3c 100644 --- a/libs/s25main/ingameWindows/iwSave.h +++ b/libs/s25main/ingameWindows/iwSave.h @@ -16,11 +16,11 @@ class iwSaveLoad : public IngameWindow protected: /// Re-fill the table with existing files - void RefreshTable(); + void refreshTable(); private: /// Save or load the currently selected file - virtual void SaveLoad() = 0; + virtual void saveLoad() = 0; void msgEditEnter(unsigned ctrl_id) override; void msgButtonClick(unsigned ctrl_id) override; @@ -34,7 +34,7 @@ class iwSave : public iwSaveLoad private: // Save game - void SaveLoad() override; + void saveLoad() override; void msgComboSelectItem(unsigned ctrl_id, unsigned selection) override; }; @@ -51,5 +51,5 @@ class iwLoad : public iwSaveLoad void msgTableChooseItem(unsigned ctrl_id, unsigned selection) override; // Load game - void SaveLoad() override; + void saveLoad() override; }; diff --git a/libs/s25main/ingameWindows/iwSettings.cpp b/libs/s25main/ingameWindows/iwSettings.cpp index d1f42b2c1f..14b4f87979 100644 --- a/libs/s25main/ingameWindows/iwSettings.cpp +++ b/libs/s25main/ingameWindows/iwSettings.cpp @@ -54,67 +54,67 @@ iwSettings::iwSettings() constexpr auto btSpacing = btSize.x / 3; DrawPoint curPos(leftColOffset, 30); - AddText(ID_txtDisplayMode, curPos, _("Mode:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addText(ID_txtDisplayMode, curPos, _("Mode:"), COLOR_YELLOW, FontStyle{}, NormalFont); ctrlComboBox* cbDisplayMode = - AddComboBox(ID_cbDisplayMode, curPos + rightColOffset, ctrlSize, TextureColor::Grey, NormalFont, 100); - cbDisplayMode->AddItem(_("Windowed")); - cbDisplayMode->AddItem(_("Fullscreen")); - cbDisplayMode->AddItem(_("Borderless window")); + addComboBox(ID_cbDisplayMode, curPos + rightColOffset, ctrlSize, TextureColor::Grey, NormalFont, 100); + cbDisplayMode->addItem(_("Windowed")); + cbDisplayMode->addItem(_("Fullscreen")); + cbDisplayMode->addItem(_("Borderless window")); cbDisplayMode->setSelection(rttr::enum_cast(SETTINGS.video.displayMode.type)); curPos.y += ctrlSize.y + 5; - auto* grpResolution = AddGroup(ID_grpResolution); - grpResolution->AddText(ID_txtResolution, curPos, _("Fullscreen resolution:"), COLOR_YELLOW, FontStyle{}, + auto* grpResolution = addGroup(ID_grpResolution); + grpResolution->addText(ID_txtResolution, curPos, _("Fullscreen resolution:"), COLOR_YELLOW, FontStyle{}, NormalFont); - auto* cbResolution = grpResolution->AddComboBox(ID_cbResolution, curPos + rightColOffset, ctrlSize, + auto* cbResolution = grpResolution->addComboBox(ID_cbResolution, curPos + rightColOffset, ctrlSize, TextureColor::Grey, NormalFont, 110); - auto* grpWindowSize = AddGroup(ID_grpWindowSize); - grpWindowSize->AddText(ID_txtWindowSize, curPos, _("Window size:"), COLOR_YELLOW, FontStyle{}, NormalFont); - auto& cbWindowSize = *grpWindowSize->AddComboBox(ID_cbWindowSize, curPos + rightColOffset, ctrlSize, + auto* grpWindowSize = addGroup(ID_grpWindowSize); + grpWindowSize->addText(ID_txtWindowSize, curPos, _("Window size:"), COLOR_YELLOW, FontStyle{}, NormalFont); + auto& cbWindowSize = *grpWindowSize->addComboBox(ID_cbWindowSize, curPos + rightColOffset, ctrlSize, TextureColor::Grey, NormalFont, 150); curPos.y += ctrlSize.y + 1; grpWindowSize - ->AddCheckBox(ID_cbLockWindowSize, curPos, cbSize, TextureColor::Grey, _("Lock window size:"), NormalFont, false) + ->addCheckBox(ID_cbLockWindowSize, curPos, cbSize, TextureColor::Grey, _("Lock window size:"), NormalFont, false) ->setChecked(!SETTINGS.video.displayMode.resizeable); - const auto supportedResolutions = VIDEODRIVER.ListVideoModes(); + const auto supportedResolutions = VIDEODRIVER.listVideoModes(); supportedResolutions_.assign(supportedResolutions.begin(), supportedResolutions.end()); for(const auto& videoMode : supportedResolutions_) { - cbResolution->AddItem(helpers::format("%ux%u", videoMode.width, videoMode.height)); + cbResolution->addItem(helpers::format("%ux%u", videoMode.width, videoMode.height)); if(videoMode == SETTINGS.video.fullscreenSize) cbResolution->setSelection(cbResolution->getNumItems() - 1); } const auto windowSizes = VIDEODRIVER.getDefaultWindowSizes(); windowSizes_.assign(windowSizes.begin(), windowSizes.end()); - cbWindowSize.AddItem(""); // Placeholder for current window size + cbWindowSize.addItem(""); // Placeholder for current window size for(const auto& size : windowSizes_) - cbWindowSize.AddItem(helpers::format("%ux%u", size.width, size.height)); + cbWindowSize.addItem(helpers::format("%ux%u", size.width, size.height)); curPos.y += cbSize.y + 15; - AddText(ID_txtMapScrollMode, curPos, _("Map scroll mode:"), COLOR_YELLOW, FontStyle{}, NormalFont); + addText(ID_txtMapScrollMode, curPos, _("Map scroll mode:"), COLOR_YELLOW, FontStyle{}, NormalFont); ctrlComboBox* cbMapScrollMode = - AddComboBox(ID_cbMapScrollMode, curPos + rightColOffset, ctrlSize, TextureColor::Grey, NormalFont, 100); - cbMapScrollMode->AddItem( + addComboBox(ID_cbMapScrollMode, curPos + rightColOffset, ctrlSize, TextureColor::Grey, NormalFont, 100); + cbMapScrollMode->addItem( _("Scroll same (Map moves in the same direction the mouse is moved when scrolling/panning.)")); - cbMapScrollMode->AddItem( + cbMapScrollMode->addItem( _("Scroll opposite (Map moves in the opposite direction the mouse is moved when scrolling/panning.)")); - cbMapScrollMode->AddItem(_("Grab and drag (Map moves with your cursor when scrolling/panning.)")); + cbMapScrollMode->addItem(_("Grab and drag (Map moves with your cursor when scrolling/panning.)")); cbMapScrollMode->setSelection(static_cast(SETTINGS.interface.mapScrollMode)); curPos.y += ctrlSize.y + 10; - AddCheckBox(ID_cbSmartCursor, curPos, cbSize, TextureColor::Grey, _("Smart Cursor"), NormalFont, false) + addCheckBox(ID_cbSmartCursor, curPos, cbSize, TextureColor::Grey, _("Smart Cursor"), NormalFont, false) ->setChecked(SETTINGS.global.smartCursor) ->setTooltip(_("Place cursor on default button for new dialogs / action windows (default)")); curPos.y += cbSize.y + 3; - AddCheckBox(ID_cbStatisticScale, curPos, cbSize, TextureColor::Grey, _("Statistics Scale"), NormalFont, false) + addCheckBox(ID_cbStatisticScale, curPos, cbSize, TextureColor::Grey, _("Statistics Scale"), NormalFont, false) ->setChecked(SETTINGS.ingame.scaleStatistics); curPos = DrawPoint(leftColOffset + btSpacing, getSize().y - 40); - AddTextButton(ID_btApply, curPos, btSize, TextureColor::Green2, _("Apply"), NormalFont, _("Apply Changes")); + addTextButton(ID_btApply, curPos, btSize, TextureColor::Green2, _("Apply"), NormalFont, _("Apply Changes")); curPos.x += btSize.x + btSpacing; - AddTextButton(ID_btAbort, curPos, btSize, TextureColor::Red1, _("Abort"), NormalFont, _("Close Without Saving")); + addTextButton(ID_btAbort, curPos, btSize, TextureColor::Red1, _("Abort"), NormalFont, _("Close Without Saving")); updateWindowSizeComboBox(); updateResolutionGroups(); @@ -151,17 +151,17 @@ void iwSettings::msgButtonClick(unsigned ctrl_id) && VIDEODRIVER.getWindowSize() != screenSize) || SETTINGS.video.displayMode != VIDEODRIVER.getDisplayMode()) { - if(!VIDEODRIVER.ResizeScreen(screenSize, SETTINGS.video.displayMode)) + if(!VIDEODRIVER.resizeScreen(screenSize, SETTINGS.video.displayMode)) { - WINDOWMANAGER.Show(std::make_unique( + WINDOWMANAGER.show(std::make_unique( _("Sorry!"), _("You need to restart your game to change the screen resolution!"), this, MsgboxButton::Ok, MsgboxIcon::ExclamationGreen, 1)); } } - SETTINGS.Save(); + SETTINGS.save(); } break; - case ID_btAbort: Close(); break; + case ID_btAbort: close(); break; default: RTTR_Assert(false); } } @@ -188,7 +188,7 @@ void iwSettings::msgGroupComboSelectItem(unsigned /*group_id*/, unsigned ctrl_id // Directly apply new window size if(currentDisplayMode == DisplayMode::Windowed && VIDEODRIVER.getDisplayMode() == DisplayMode::Windowed) { - VIDEODRIVER.ResizeScreen(windowSizes_[selection - 1], DisplayMode::Windowed); + VIDEODRIVER.resizeScreen(windowSizes_[selection - 1], DisplayMode::Windowed); } else closeBehavior_ = CloseBehavior::Custom; } else diff --git a/libs/s25main/ingameWindows/iwShip.cpp b/libs/s25main/ingameWindows/iwShip.cpp index b5d9535c69..2df3fc4809 100644 --- a/libs/s25main/ingameWindows/iwShip.cpp +++ b/libs/s25main/ingameWindows/iwShip.cpp @@ -37,22 +37,22 @@ iwShip::iwShip(GameWorldView& gwv, GameCommandFactory& gcFactory, const noShip* gcFactory(gcFactory), player(ship ? ship->getPlayerId() : gwv.getViewer().getPlayerId()), ship_id(ship ? gwv.getWorld().getPlayer(player).getShipID(*ship) : 0) { - AddImage(0, DrawPoint(126, 101), LOADER.getImageN("io", 228)); - AddImageButton(2, DrawPoint(18, 192), Extent(30, 35), TextureColor::Grey, + addImage(0, DrawPoint(126, 101), LOADER.getImageN("io", 228)); + addImageButton(2, DrawPoint(18, 192), Extent(30, 35), TextureColor::Grey, LOADER.getImageN("io", 225)); // Viewer: 226 - Hilfe - AddImageButton(3, DrawPoint(51, 196), Extent(30, 26), TextureColor::Grey, + addImageButton(3, DrawPoint(51, 196), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 102)); // Viewer: 103 - Schnell zurück - AddImageButton(4, DrawPoint(81, 196), Extent(30, 26), TextureColor::Grey, + addImageButton(4, DrawPoint(81, 196), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 103)); // Viewer: 104 - Zurück - AddImageButton(5, DrawPoint(111, 196), Extent(30, 26), TextureColor::Grey, + addImageButton(5, DrawPoint(111, 196), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 104)); // Viewer: 105 - Vor - AddImageButton(6, DrawPoint(141, 196), Extent(30, 26), TextureColor::Grey, + addImageButton(6, DrawPoint(141, 196), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 105)); // Viewer: 106 - Schnell vor - AddImageButton(7, DrawPoint(181, 196), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 107), + addImageButton(7, DrawPoint(181, 196), Extent(30, 26), TextureColor::Grey, LOADER.getImageN("io", 107), _("Go to place")); // "Gehe Zu Ort" // Die Expeditionsweiterfahrbuttons - AddImageButton(10, DrawPoint(60, 81), Extent(18, 18), TextureColor::Grey, LOADER.getImageN("io", 187), + addImageButton(10, DrawPoint(60, 81), Extent(18, 18), TextureColor::Grey, LOADER.getImageN("io", 187), _("Found colony")) ->setVisible(false); @@ -61,18 +61,18 @@ iwShip::iwShip(GameWorldView& gwv, GameCommandFactory& gcFactory, const noShip* constexpr helpers::EnumArray BUTTON_IDs = {{185, 186, 181, 182, 183, 184}}; // Expedition abbrechen - AddImageButton(11, DrawPoint(200, 143), Extent(18, 18), TextureColor::Red1, LOADER.getImageN("io", 40), + addImageButton(11, DrawPoint(200, 143), Extent(18, 18), TextureColor::Red1, LOADER.getImageN("io", 40), _("Return to harbor")) ->setVisible(false); // Die 6 Richtungen for(const auto dir : helpers::EnumRange{}) - AddImageButton(12 + rttr::enum_cast(dir), BUTTON_POS[dir], Extent(18, 18), TextureColor::Grey, + addImageButton(12 + rttr::enum_cast(dir), BUTTON_POS[dir], Extent(18, 18), TextureColor::Grey, LOADER.getImageN("io", BUTTON_IDs[dir])) ->setVisible(false); } -void iwShip::DrawContent() +void iwShip::drawContent() { static boost::format valByValFmt{"%1%/%2%"}; @@ -90,20 +90,20 @@ void iwShip::DrawContent() // Immer noch nicht? Dann gibt es keine Schiffe mehr und wir zeigen eine entsprechende Meldung an if(!ship) { - NormalFont->Draw(getDrawPos() + DrawPoint(getSize().x / 2, 60), _("No ships available"), + NormalFont->draw(getDrawPos() + DrawPoint(getSize().x / 2, 60), _("No ships available"), FontStyle::CENTER | FontStyle::NO_OUTLINE, COLOR_WINDOWBROWN); return; } } // Schiffsname - NormalFont->Draw(getDrawPos() + DrawPoint(42, 42), ship->getName(), FontStyle::NO_OUTLINE, COLOR_WINDOWBROWN); + NormalFont->draw(getDrawPos() + DrawPoint(42, 42), ship->getName(), FontStyle::NO_OUTLINE, COLOR_WINDOWBROWN); // Schiffs-Nr. valByValFmt % (ship_id + 1) % owner.getNumShips(); - NormalFont->Draw(getDrawPos() + DrawPoint(208, 42), valByValFmt.str(), FontStyle::RIGHT | FontStyle::NO_OUTLINE, + NormalFont->draw(getDrawPos() + DrawPoint(208, 42), valByValFmt.str(), FontStyle::RIGHT | FontStyle::NO_OUTLINE, COLOR_WINDOWBROWN); // Das Schiffs-Bild - LOADER.getImageN("boot_z", 12)->DrawFull(getDrawPos() + DrawPoint(138, 117)); + LOADER.getImageN("boot_z", 12)->drawFull(getDrawPos() + DrawPoint(138, 117)); // Expeditions-Buttons malen? if(ship->isWaitingForExpeditionInstructions()) @@ -125,14 +125,14 @@ void iwShip::DrawContent() getCtrl(10 + i)->setVisible(false); } - DrawCargo(); + drawCargo(); } void iwShip::msgButtonClick(const unsigned ctrl_id) { if(ctrl_id == 2) // Hilfe { - WINDOWMANAGER.ReplaceWindow( + WINDOWMANAGER.replaceWindow( std::make_unique(_("The ship register contains all the ships in your fleet. Here you can monitor " "the loading and destinations of individual ships. Ships on an expedition are " "controlled from here as well."))); @@ -149,14 +149,14 @@ void iwShip::msgButtonClick(const unsigned ctrl_id) { bool success = false; if(ctrl_id == 10) - success = gcFactory.FoundColony(ship_id); + success = gcFactory.foundColony(ship_id); else if(ctrl_id == 11) success = gcFactory.CancelExpedition(ship_id); else - success = gcFactory.TravelToNextSpot(ShipDirection(ctrl_id - 12), ship_id); + success = gcFactory.travelToNextSpot(ShipDirection(ctrl_id - 12), ship_id); if(success) - Close(); + close(); } switch(ctrl_id) @@ -193,13 +193,13 @@ void iwShip::msgButtonClick(const unsigned ctrl_id) break; case 7: // "Gehe Zu Ort" { - gwv.MoveToMapPt(ship->getPos()); + gwv.moveToMapPt(ship->getPos()); } break; } } -void iwShip::DrawCargo() +void iwShip::drawCargo() { const GamePlayer& owner = gwv.getWorld().getPlayer(player); const noShip* ship = owner.getShipByID(ship_id); @@ -260,9 +260,9 @@ void iwShip::DrawCargo() orderedFigures[job]--; if(job == Job::PackDonkey) - LOADER.getMapTexture(2016)->DrawFull(drawPt); + LOADER.getMapTexture(2016)->drawFull(drawPt); else if(job == Job::BoatCarrier) - LOADER.getBob("carrier")->Draw(rttr::enum_cast(GoodType::Boat), libsiedler2::ImgDir::SW, false, 0, + LOADER.getBob("carrier")->draw(rttr::enum_cast(GoodType::Boat), libsiedler2::ImgDir::SW, false, 0, drawPt, owner.color); else if(wineaddon::isWineAddonJobType(job)) { @@ -275,7 +275,7 @@ void iwShip::DrawCargo() LOADER .getPlayerImage("wine_bobs", wineaddon::bobIndex[type] + static_cast(libsiedler2::ImgDir::SW) * 8) - ->DrawFull(drawPt, COLOR_WHITE, owner.color); + ->drawFull(drawPt, COLOR_WHITE, owner.color); } else if(leatheraddon::isLeatherAddonJobType(job)) { leatheraddon::BobType type = leatheraddon::BobType::SkinnerWalking; @@ -287,11 +287,11 @@ void iwShip::DrawCargo() LOADER .getPlayerImage("leather_bobs", leatheraddon::bobIndex[type] + static_cast(libsiedler2::ImgDir::SW) * 8) - ->DrawFull(drawPt, COLOR_WHITE, owner.color); + ->drawFull(drawPt, COLOR_WHITE, owner.color); } else { const auto& spriteData = JOB_SPRITE_CONSTS[job]; - LOADER.getBob("jobs")->Draw(spriteData.getBobId(owner.nation), libsiedler2::ImgDir::SW, + LOADER.getBob("jobs")->draw(spriteData.getBobId(owner.nation), libsiedler2::ImgDir::SW, spriteData.isFat(), 0, drawPt, owner.color); } @@ -300,8 +300,8 @@ void iwShip::DrawCargo() armoredFigures[jobEnumToAmoredSoldierEnum(job)]--; if(gwv.getWorld().getGGS().isEnabled(AddonId::MILITARY_HITPOINTS)) { - SmallFont->Draw(drawPt + DrawPoint(-2, -25), "+", FontStyle::CENTER, COLOR_RED); - SmallFont->Draw(drawPt + DrawPoint(1, -25), "1", FontStyle::CENTER, COLOR_RED); + SmallFont->draw(drawPt + DrawPoint(-2, -25), "+", FontStyle::CENTER, COLOR_RED); + SmallFont->draw(drawPt + DrawPoint(1, -25), "1", FontStyle::CENTER, COLOR_RED); } } @@ -325,7 +325,7 @@ void iwShip::DrawCargo() const auto draw_id = convertShieldToNation(ware, owner.nation); - LOADER.getWareStackTex(draw_id)->DrawFull(drawPt); + LOADER.getWareStackTex(draw_id)->drawFull(drawPt); drawPt.x += xStep; lineCounter++; } diff --git a/libs/s25main/ingameWindows/iwShip.h b/libs/s25main/ingameWindows/iwShip.h index 40fef23d2f..91b395628c 100644 --- a/libs/s25main/ingameWindows/iwShip.h +++ b/libs/s25main/ingameWindows/iwShip.h @@ -22,8 +22,8 @@ class iwShip : public IngameWindow const DrawPoint& pos = IngameWindow::posAtMouse); private: - void DrawContent() override; + void drawContent() override; void msgButtonClick(unsigned ctrl_id) override; - void DrawCargo(); + void drawCargo(); }; diff --git a/libs/s25main/ingameWindows/iwSkipGFs.cpp b/libs/s25main/ingameWindows/iwSkipGFs.cpp index 98e16f524d..5ac38369a5 100644 --- a/libs/s25main/ingameWindows/iwSkipGFs.cpp +++ b/libs/s25main/ingameWindows/iwSkipGFs.cpp @@ -42,21 +42,21 @@ iwSkipGFs::iwSkipGFs(GameWorldView& gwv) Extent btSize(getIwSize().x - edtOffset - edtSize.x - spacing, edtSize.y); DrawPoint curPos(edtOffset, 28); - ctrlEdit* edit = AddEdit(ID_edtToGf, curPos, edtSize, TextureColor::Grey, NormalFont); + ctrlEdit* edit = addEdit(ID_edtToGf, curPos, edtSize, TextureColor::Grey, NormalFont); edit->setFocus(); curPos.x -= spacing; - AddText(ID_lblToGf, curPos + DrawPoint(0, 4), _("to GameFrame:"), COLOR_YELLOW, FontStyle::RIGHT, NormalFont); + addText(ID_lblToGf, curPos + DrawPoint(0, 4), _("to GameFrame:"), COLOR_YELLOW, FontStyle::RIGHT, NormalFont); curPos.x += edtSize.x + spacing * 2; - AddTextButton(ID_btToGf, curPos, btSize, TextureColor::Green2, "->|", NormalFont); + addTextButton(ID_btToGf, curPos, btSize, TextureColor::Green2, "->|", NormalFont); curPos.x = edtOffset; curPos.y += edtSize.y + 5; - AddEdit(ID_edtByGf, curPos, edtSize, TextureColor::Grey, NormalFont); + addEdit(ID_edtByGf, curPos, edtSize, TextureColor::Grey, NormalFont); curPos.x -= spacing; - AddText(ID_lblByGf, curPos + DrawPoint(0, 4), _("by GameFrames:"), COLOR_YELLOW, FontStyle::RIGHT, NormalFont); + addText(ID_lblByGf, curPos + DrawPoint(0, 4), _("by GameFrames:"), COLOR_YELLOW, FontStyle::RIGHT, NormalFont); curPos.x += edtSize.x + spacing * 2; - AddTextButton(ID_btByGf, curPos, btSize, TextureColor::Green2, "-->", NormalFont); + addTextButton(ID_btByGf, curPos, btSize, TextureColor::Green2, "-->", NormalFont); curPos.x = contentOffset.x + spacing; curPos.y += edtSize.y + 5; @@ -64,32 +64,32 @@ iwSkipGFs::iwSkipGFs(GameWorldView& gwv) btSize.x = (availWidth - spacing * (jumpPresets.size() - 1)) / jumpPresets.size(); for(auto i : jumpPresets) { - AddTextButton(ID_btJumpPresetStart + i, curPos, btSize, TextureColor::Green2, "+" + std::to_string(i), + addTextButton(ID_btJumpPresetStart + i, curPos, btSize, TextureColor::Green2, "+" + std::to_string(i), NormalFont); curPos.x += btSize.x + spacing; } } -void iwSkipGFs::SkipGFs(const unsigned edtCtrlId) +void iwSkipGFs::skipGFs(const unsigned edtCtrlId) { int targetGF = s25util::fromStringClassicDef(getCtrl(edtCtrlId)->getText(), 0); if(edtCtrlId == ID_edtByGf) targetGF += GAMECLIENT.getGFNumber(); - GAMECLIENT.SkipGF(targetGF, gwv); + GAMECLIENT.skipGF(targetGF, gwv); } void iwSkipGFs::msgButtonClick(const unsigned ctrlId) { if(ctrlId < ID_btJumpPresetStart) - SkipGFs((ctrlId == ID_btByGf) ? ID_edtByGf : ID_edtToGf); + skipGFs((ctrlId == ID_btByGf) ? ID_edtByGf : ID_edtToGf); else { const unsigned targetGF = GAMECLIENT.getGFNumber() + ctrlId - ID_btJumpPresetStart; - GAMECLIENT.SkipGF(targetGF, gwv); + GAMECLIENT.skipGF(targetGF, gwv); } } void iwSkipGFs::msgEditEnter(const unsigned ctrlId) { - SkipGFs(ctrlId); + skipGFs(ctrlId); } diff --git a/libs/s25main/ingameWindows/iwSkipGFs.h b/libs/s25main/ingameWindows/iwSkipGFs.h index f5346ea0b2..745a5b6231 100644 --- a/libs/s25main/ingameWindows/iwSkipGFs.h +++ b/libs/s25main/ingameWindows/iwSkipGFs.h @@ -16,7 +16,7 @@ class iwSkipGFs : public IngameWindow private: GameWorldView& gwv; - void SkipGFs(unsigned edtCtrlId); + void skipGFs(unsigned edtCtrlId); void msgButtonClick(unsigned ctrlId) override; void msgEditEnter(unsigned ctrlId) override; diff --git a/libs/s25main/ingameWindows/iwStatistics.cpp b/libs/s25main/ingameWindows/iwStatistics.cpp index d8aaff7f66..85d2753815 100644 --- a/libs/s25main/ingameWindows/iwStatistics.cpp +++ b/libs/s25main/ingameWindows/iwStatistics.cpp @@ -118,62 +118,62 @@ iwStatistics::iwStatistics(const GameWorldViewer& gwv) RTTR_Assert(curPlayer.portraitIndex < Portraits.size()); const auto& portrait = Portraits[curPlayer.portraitIndex]; auto* btPortrait = - AddImageButton(ID_btPlayer_Start + i, curBtPos, playerBtSize, TextureColor::Green1, + addImageButton(ID_btPlayer_Start + i, curBtPos, playerBtSize, TextureColor::Green1, LOADER.getImageN(portrait.resourceId, portrait.resourceIndex), curPlayer.name); curBtPos.x += playerBtSize.x; btPortrait->setBorder(false); btPortrait->setEnabled(showStatistic[i]); } - AddImage(ID_imgStatistic, DrawPoint(126, 165), LOADER.getImageN("io", 228)); + addImage(ID_imgStatistic, DrawPoint(126, 165), LOADER.getImageN("io", 228)); // Buttons for changing the statistic type shown - ctrlOptionGroup* statChanger = AddOptionGroup(ID_grpStatType, GroupSelectType::Illuminate); - statChanger->AddImageButton(ID_btTypeSize, DrawPoint(18, 250), Extent(26, 30), TextureColor::Grey, + ctrlOptionGroup* statChanger = addOptionGroup(ID_grpStatType, GroupSelectType::Illuminate); + statChanger->addImageButton(ID_btTypeSize, DrawPoint(18, 250), Extent(26, 30), TextureColor::Grey, LOADER.getImageN("io", 167), _("Size of country")); - statChanger->AddImageButton(ID_btTypeBuildings, DrawPoint(45, 250), Extent(26, 30), TextureColor::Grey, + statChanger->addImageButton(ID_btTypeBuildings, DrawPoint(45, 250), Extent(26, 30), TextureColor::Grey, LOADER.getImageN("io", 168), _("Buildings")); - statChanger->AddImageButton(ID_btTypeInhabitants, DrawPoint(72, 250), Extent(26, 30), TextureColor::Grey, + statChanger->addImageButton(ID_btTypeInhabitants, DrawPoint(72, 250), Extent(26, 30), TextureColor::Grey, LOADER.getImageN("io", 169), _("Inhabitants")); - statChanger->AddImageButton(ID_btTypeMerchandise, DrawPoint(99, 250), Extent(26, 30), TextureColor::Grey, + statChanger->addImageButton(ID_btTypeMerchandise, DrawPoint(99, 250), Extent(26, 30), TextureColor::Grey, LOADER.getImageN("io", 170), _("Merchandise")); - statChanger->AddImageButton(ID_btTypeMilitary, DrawPoint(126, 250), Extent(26, 30), TextureColor::Grey, + statChanger->addImageButton(ID_btTypeMilitary, DrawPoint(126, 250), Extent(26, 30), TextureColor::Grey, LOADER.getImageN("io", 171), _("Military strength")); - statChanger->AddImageButton(ID_btTypeGold, DrawPoint(153, 250), Extent(26, 30), TextureColor::Grey, + statChanger->addImageButton(ID_btTypeGold, DrawPoint(153, 250), Extent(26, 30), TextureColor::Grey, LOADER.getImageN("io", 172), _("Gold")); - statChanger->AddImageButton(ID_btTypeProductivity, DrawPoint(180, 250), Extent(26, 30), TextureColor::Grey, + statChanger->addImageButton(ID_btTypeProductivity, DrawPoint(180, 250), Extent(26, 30), TextureColor::Grey, LOADER.getImageN("io", 173), _("Productivity")); - statChanger->AddImageButton(ID_btTypeVanquishedEnemies, DrawPoint(207, 250), Extent(26, 30), TextureColor::Grey, + statChanger->addImageButton(ID_btTypeVanquishedEnemies, DrawPoint(207, 250), Extent(26, 30), TextureColor::Grey, LOADER.getImageN("io", 217), _("Vanquished enemies")); // Buttons for duration constexpr Extent timeBtSize(43, 28); - ctrlOptionGroup* timeChanger = AddOptionGroup(ID_grpTime, GroupSelectType::Illuminate); - timeChanger->AddTextButton(ID_time15m, DrawPoint(51, 288), timeBtSize, TextureColor::Grey, _("15 m"), NormalFont); - timeChanger->AddTextButton(ID_time1h, DrawPoint(96, 288), timeBtSize, TextureColor::Grey, _("1 h"), NormalFont); - timeChanger->AddTextButton(ID_time4h, DrawPoint(141, 288), timeBtSize, TextureColor::Grey, _("4 h"), NormalFont); - timeChanger->AddTextButton(ID_time16h, DrawPoint(186, 288), timeBtSize, TextureColor::Grey, _("16 h"), NormalFont); + ctrlOptionGroup* timeChanger = addOptionGroup(ID_grpTime, GroupSelectType::Illuminate); + timeChanger->addTextButton(ID_time15m, DrawPoint(51, 288), timeBtSize, TextureColor::Grey, _("15 m"), NormalFont); + timeChanger->addTextButton(ID_time1h, DrawPoint(96, 288), timeBtSize, TextureColor::Grey, _("1 h"), NormalFont); + timeChanger->addTextButton(ID_time4h, DrawPoint(141, 288), timeBtSize, TextureColor::Grey, _("4 h"), NormalFont); + timeChanger->addTextButton(ID_time16h, DrawPoint(186, 288), timeBtSize, TextureColor::Grey, _("16 h"), NormalFont); - AddImageButton(ID_btHelp, DrawPoint(18, 288), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), + addImageButton(ID_btHelp, DrawPoint(18, 288), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); const auto labelColor = MakeColor(255, 136, 96, 52); // Current header - headline = AddText(ID_txtHeader, DrawPoint(130, 120), _("Size of country"), labelColor, + headline = addText(ID_txtHeader, DrawPoint(130, 120), _("Size of country"), labelColor, FontStyle::CENTER | FontStyle::BOTTOM | FontStyle::NO_OUTLINE, NormalFont); // Current maximum of y-axis - txtMaxValueY = AddText(ID_txtMaxY, DrawPoint(211, 125), "1", labelColor, + txtMaxValueY = addText(ID_txtMaxY, DrawPoint(211, 125), "1", labelColor, FontStyle::RIGHT | FontStyle::VCENTER | FontStyle::NO_OUTLINE, NormalFont); // Current minimum of y-axis - txtMinValueY = AddText(ID_txtMinY, DrawPoint(211, 200), "0", labelColor, + txtMinValueY = addText(ID_txtMinY, DrawPoint(211, 200), "0", labelColor, FontStyle::RIGHT | FontStyle::VCENTER | FontStyle::NO_OUTLINE, NormalFont); // Time values on the x-axis for(const auto i : helpers::range(timeAnnotations.size())) { - timeAnnotations[i] = AddText(ID_txtXAxisValuesStart + i, DrawPoint(0, 0), "", labelColor, + timeAnnotations[i] = addText(ID_txtXAxisValuesStart + i, DrawPoint(0, 0), "", labelColor, FontStyle::CENTER | FontStyle::TOP | FontStyle::NO_OUTLINE, NormalFont); } @@ -196,7 +196,7 @@ void iwStatistics::msgButtonClick(const unsigned ctrl_id) showStatistic[playerIndex] = !showStatistic[playerIndex]; else if(ctrl_id == ID_btHelp) { - WINDOWMANAGER.ReplaceWindow( + WINDOWMANAGER.replaceWindow( std::make_unique(_("This window allows a direct comparison with the enemies. " "Factors such as the wealth, territorial area, inhabitants, " "etc. of all parties can be compared. This data can be shown " @@ -258,18 +258,18 @@ void iwStatistics::msgOptionGroupChange(const unsigned ctrl_id, const unsigned s } } -void iwStatistics::DrawContent() +void iwStatistics::drawContent() { // Draw the alliances and the colored boxes under the portraits - DrawPlayerOverlays(); + drawPlayerOverlays(); - DrawAxis(); + drawAxis(); // Draw lines making up the statistic - DrawStatistic(currentView); + drawStatistic(currentView); } -void iwStatistics::DrawPlayerOverlays() +void iwStatistics::drawPlayerOverlays() { DrawPoint drawPt = getDrawPos() + playerButtonsCenterPos - DrawPoint(numPlayingPlayers * playerBtSize.x / 2, 0); @@ -282,25 +282,25 @@ void iwStatistics::DrawPlayerOverlays() if(showStatistic[i]) { // Draw the alliances at top of the player image - DrawPlayerAlliances(drawPt, player); + drawPlayerAlliances(drawPt, player); // Draw player boxes and player status at bottom - DrawPlayerBox(drawPt, player); + drawPlayerBox(drawPt, player); } drawPt.x += playerBtSize.x; } } -void iwStatistics::DrawPlayerBox(DrawPoint const& drawPt, const GamePlayer& player) +void iwStatistics::drawPlayerBox(DrawPoint const& drawPt, const GamePlayer& player) { auto const playerBoxRect = Rect(DrawPoint(drawPt.x, drawPt.y + 47), Extent(34, 12)); auto const playerStatusPosition = DrawPoint(playerBoxRect.getOrigin() + playerBoxRect.getSize() / 2 + DrawPoint(0, 1)); - DrawRectangle(playerBoxRect, player.color); - SmallFont->Draw(playerStatusPosition, getPlayerStatus(player), FontStyle::CENTER | FontStyle::VCENTER, + drawRectangle(playerBoxRect, player.color); + SmallFont->draw(playerStatusPosition, getPlayerStatus(player), FontStyle::CENTER | FontStyle::VCENTER, COLOR_YELLOW); } -void iwStatistics::DrawPlayerAlliances(DrawPoint const& drawPt, const GamePlayer& player) +void iwStatistics::drawPlayerAlliances(DrawPoint const& drawPt, const GamePlayer& player) { constexpr unsigned spacingAllianceRects = 1; constexpr Extent allianceRectExtent(4, 6); @@ -311,13 +311,13 @@ void iwStatistics::DrawPlayerAlliances(DrawPoint const& drawPt, const GamePlayer { if(idxOther != player.getPlayerId() && player.isAlly(idxOther)) { - DrawRectangle(Rect(pactPos, allianceRectExtent), gwv.getWorld().getPlayer(idxOther).color); + drawRectangle(Rect(pactPos, allianceRectExtent), gwv.getWorld().getPlayer(idxOther).color); pactPos.x += allianceRectOffset; } } } -void iwStatistics::DrawStatistic(StatisticType type) +void iwStatistics::drawStatistic(StatisticType type) { // Find min and max value unsigned max = 1; @@ -371,13 +371,13 @@ void iwStatistics::DrawStatistic(StatisticType type) else curPos.y -= (curStatVal * diagramSize.y) / max; if(i != 0) - DrawLine(curPos, previousPos, 2, playerColor); + drawLine(curPos, previousPos, 2, playerColor); previousPos = curPos; } } } -void iwStatistics::DrawAxis() +void iwStatistics::drawAxis() { const DrawPoint topLeft = getPos() + topLeftRel; const auto axisColor = MakeColor(255, 88, 44, 16); @@ -385,14 +385,14 @@ void iwStatistics::DrawAxis() // X-axis, horizontal // slightly lower to see zero line, offset so it starts with last (leftmost) value of right-aligned graph const auto startPoint = topLeft + DrawPoint(stepX, diagramSize.y + 2); - DrawLine(startPoint, topLeft + diagramSize + DrawPoint(0, 2), 1, axisColor); + drawLine(startPoint, topLeft + diagramSize + DrawPoint(0, 2), 1, axisColor); // Y-axis, vertical - DrawLine(topLeft + DrawPoint(diagramSize.x, 0), topLeft + diagramSize + DrawPoint(0, 5), 1, axisColor); + drawLine(topLeft + DrawPoint(diagramSize.x, 0), topLeft + diagramSize + DrawPoint(0, 5), 1, axisColor); // Marks on y-axis - DrawLine(topLeft + DrawPoint(diagramSize.x - 3, 0), topLeft + DrawPoint(diagramSize.x + 4, 0), 1, axisColor); - DrawLine(topLeft + DrawPoint(diagramSize.x - 3, diagramSize.y / 2), + drawLine(topLeft + DrawPoint(diagramSize.x - 3, 0), topLeft + DrawPoint(diagramSize.x + 4, 0), 1, axisColor); + drawLine(topLeft + DrawPoint(diagramSize.x - 3, diagramSize.y / 2), topLeft + DrawPoint(diagramSize.x + 4, diagramSize.y / 2), 1, axisColor); // Marks on x-axis @@ -401,7 +401,7 @@ void iwStatistics::DrawAxis() if(lbl->isVisible()) { const auto lblPos = lbl->getDrawPos(); - DrawLine(lblPos - DrawPoint(0, 4), lblPos - DrawPoint(0, 2), 1, axisColor); + drawLine(lblPos - DrawPoint(0, 4), lblPos - DrawPoint(0, 2), 1, axisColor); } } } diff --git a/libs/s25main/ingameWindows/iwStatistics.h b/libs/s25main/ingameWindows/iwStatistics.h index c9204c6b1a..880ebbf9a0 100644 --- a/libs/s25main/ingameWindows/iwStatistics.h +++ b/libs/s25main/ingameWindows/iwStatistics.h @@ -33,13 +33,13 @@ class iwStatistics : public IngameWindow unsigned numPlayingPlayers; void msgButtonClick(unsigned ctrl_id) override; - void DrawContent() override; + void drawContent() override; void msgOptionGroupChange(unsigned ctrl_id, unsigned selection) override; - void DrawPlayerBox(DrawPoint const& drawPt, const GamePlayer& player); - void DrawPlayerAlliances(DrawPoint const& drawPt, const GamePlayer& player); - void DrawPlayerOverlays(); - void DrawStatistic(StatisticType type); - void DrawAxis(); + void drawPlayerBox(DrawPoint const& drawPt, const GamePlayer& player); + void drawPlayerAlliances(DrawPoint const& drawPt, const GamePlayer& player); + void drawPlayerOverlays(); + void drawStatistic(StatisticType type); + void drawAxis(); void updateTimeAxisLabels(); }; diff --git a/libs/s25main/ingameWindows/iwSurrender.cpp b/libs/s25main/ingameWindows/iwSurrender.cpp index 92abda3ce8..b65298e1fa 100644 --- a/libs/s25main/ingameWindows/iwSurrender.cpp +++ b/libs/s25main/ingameWindows/iwSurrender.cpp @@ -12,13 +12,13 @@ iwSurrender::iwSurrender() LOADER.getImageN("resource", 41)) { // Ok - AddImageButton(0, DrawPoint(85, 24), Extent(68, 57), TextureColor::Green2, LOADER.getImageN("io", 32), + addImageButton(0, DrawPoint(85, 24), Extent(68, 57), TextureColor::Green2, LOADER.getImageN("io", 32), _("Surrender")); // Ok + Abbrennen - AddImageButton(2, DrawPoint(16, 24), Extent(68, 57), TextureColor::Green2, LOADER.getImageN("io", 23), + addImageButton(2, DrawPoint(16, 24), Extent(68, 57), TextureColor::Green2, LOADER.getImageN("io", 23), _("Destroy all buildings and surrender")); // Abbrechen - AddImageButton(1, DrawPoint(158, 24), Extent(68, 57), TextureColor::Red1, LOADER.getImageN("io", 40), + addImageButton(1, DrawPoint(158, 24), Extent(68, 57), TextureColor::Red1, LOADER.getImageN("io", 40), _("Don't surrender")); } @@ -29,18 +29,18 @@ void iwSurrender::msgButtonClick(const unsigned ctrl_id) case 0: // OK { if(GAMECLIENT.Surrender()) - Close(); + close(); } break; case 1: // Abbrechen { - Close(); + close(); } break; case 2: // OK + Alles abbrennen { if(GAMECLIENT.DestroyAll()) - Close(); + close(); } break; } diff --git a/libs/s25main/ingameWindows/iwTempleBuilding.cpp b/libs/s25main/ingameWindows/iwTempleBuilding.cpp index f656717848..d84c7a07a5 100644 --- a/libs/s25main/ingameWindows/iwTempleBuilding.cpp +++ b/libs/s25main/ingameWindows/iwTempleBuilding.cpp @@ -15,7 +15,7 @@ iwTempleBuilding::iwTempleBuilding(GameWorldView& gwv, GameCommandFactory& gcFac { getCtrl(1)->setPos(DrawPoint(117, 160)); getCtrl(3)->setImage(wineaddon::getTempleProductionModeTex(ProductionMode::Default)); - AddImageButton(8, DrawPoint(130, 176), Extent(34, 32), TextureColor::Grey, + addImageButton(8, DrawPoint(130, 176), Extent(34, 32), TextureColor::Grey, wineaddon::getTempleProductionModeTex(static_cast(building)->getProductionMode()), _("Output mineral")); } diff --git a/libs/s25main/ingameWindows/iwTextfile.cpp b/libs/s25main/ingameWindows/iwTextfile.cpp index a4778f5f58..8c71ac0cc1 100644 --- a/libs/s25main/ingameWindows/iwTextfile.cpp +++ b/libs/s25main/ingameWindows/iwTextfile.cpp @@ -29,7 +29,7 @@ iwTextfile::iwTextfile(const std::string& filename, const std::string& title) : IngameWindow(CGI_README, IngameWindow::posLastOrCenter, Extent(640, 480), title, LOADER.getImageN("resource", 41)) { ctrlMultiline* text = - AddMultiline(2, DrawPoint(10, 20), Extent(getSize().x - 20, 450), TextureColor::Green1, NormalFont); + addMultiline(2, DrawPoint(10, 20), Extent(getSize().x - 20, 450), TextureColor::Green1, NormalFont); // Pfad mit gewählter Sprache auswählen std::vector paths; @@ -44,12 +44,12 @@ iwTextfile::iwTextfile(const std::string& filename, const std::string& title) file.open(*existingFilePath); if(!file) { - text->AddString((boost::format(_("The file was not found!")) % filename).str(), COLOR_RED, false); + text->addString((boost::format(_("The file was not found!")) % filename).str(), COLOR_RED, false); } else { std::stringstream stream; stream << file.rdbuf(); - text->AddString(stream.str(), COLOR_YELLOW, false); + text->addString(stream.str(), COLOR_YELLOW, false); } text->setWidth(text->getContentSize().x); diff --git a/libs/s25main/ingameWindows/iwTools.cpp b/libs/s25main/ingameWindows/iwTools.cpp index acecd533a5..0a4d1e0c24 100644 --- a/libs/s25main/ingameWindows/iwTools.cpp +++ b/libs/s25main/ingameWindows/iwTools.cpp @@ -35,7 +35,7 @@ iwTools::iwTools(const GameWorldViewer& gwv, GameCommandFactory& gcFactory) { // Einzelne Balken for(const auto tool : helpers::enumRange()) - AddToolSettingSlider(rttr::enum_cast(tool), TOOL_TO_GOOD[tool]); + addToolSettingSlider(rttr::enum_cast(tool), TOOL_TO_GOOD[tool]); const GlobalGameSettings& settings = gwv.getWorld().getGGS(); if(settings.isEnabled(AddonId::TOOL_ORDERING)) @@ -46,45 +46,45 @@ iwTools::iwTools(const GameWorldViewer& gwv, GameCommandFactory& gcFactory) const auto toolIdx = rttr::enum_cast(tool); constexpr Extent btSize(20, 13); auto* txt = static_cast( - AddTextDeepening(200 + toolIdx, DrawPoint(151, 31 + toolIdx * 28), Extent(22, 18), TextureColor::Grey, "", + addTextDeepening(200 + toolIdx, DrawPoint(151, 31 + toolIdx * 28), Extent(22, 18), TextureColor::Grey, "", NormalFont, COLOR_YELLOW)); - txt->ResizeForMaxChars(2); + txt->resizeForMaxChars(2); const auto txtSize = txt->getSize(); - ctrlButton* bt = AddImageButton(100 + toolIdx * 2, txt->getPos() + DrawPoint(txtSize.x + 1, -4), btSize, + ctrlButton* bt = addImageButton(100 + toolIdx * 2, txt->getPos() + DrawPoint(txtSize.x + 1, -4), btSize, TextureColor::Grey, LOADER.getImageN("io", 33), "+1"); - AddImageButton(101 + toolIdx * 2, bt->getPos() + DrawPoint(0, btSize.y), btSize, TextureColor::Grey, + addImageButton(101 + toolIdx * 2, bt->getPos() + DrawPoint(0, btSize.y), btSize, TextureColor::Grey, LOADER.getImageN("io", 34), "-1"); } std::fill(pendingOrderChanges.begin(), pendingOrderChanges.end(), 0); - UpdateTexts(); + updateTexts(); } // Info - AddImageButton(12, DrawPoint(18, 384), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); + addImageButton(12, DrawPoint(18, 384), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); if(settings.isEnabled(AddonId::TOOL_ORDERING)) - AddImageButton(15, DrawPoint(130, 384), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 216), + addImageButton(15, DrawPoint(130, 384), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 216), _("Zero all production")); // Standard - AddImageButton(13, DrawPoint(118 + (settings.isEnabled(AddonId::TOOL_ORDERING) ? 46 : 0), 384), Extent(30, 32), + addImageButton(13, DrawPoint(118 + (settings.isEnabled(AddonId::TOOL_ORDERING) ? 46 : 0), 384), Extent(30, 32), TextureColor::Grey, LOADER.getImageN("io", 191), _("Default")); // Einstellungen festlegen - UpdateSettings(); + updateSettings(); toolSubscription = gwv.getWorld().getNotifications().subscribe([this](auto) noexcept { this->shouldUpdateTexts = true; }); } -void iwTools::AddToolSettingSlider(unsigned id, GoodType ware) +void iwTools::addToolSettingSlider(unsigned id, GoodType ware) { ctrlProgress* el = - AddProgress(id, DrawPoint(17, 25 + id * 28), Extent(132, 26), TextureColor::Grey, 140 + id * 2 + 1, 140 + id * 2, + addProgress(id, DrawPoint(17, 25 + id * 28), Extent(132, 26), TextureColor::Grey, 140 + id * 2 + 1, 140 + id * 2, 10, _(WARE_NAMES[ware]), Extent(4, 4), 0, _("Less often"), _("More often")); if(isReplay) - el->ActivateControls(false); + el->activateControls(false); } -void iwTools::TransmitSettings() +void iwTools::transmitSettings() { if(isReplay) return; @@ -116,7 +116,7 @@ void iwTools::TransmitSettings() { const GamePlayer& localPlayer = gwv.getPlayer(); for(const auto tool : helpers::enumRange()) - localPlayer.ChangeToolOrderVisual(tool, pendingOrderChanges[tool]); + localPlayer.changeToolOrderVisual(tool, pendingOrderChanges[tool]); std::fill(pendingOrderChanges.begin(), pendingOrderChanges.end(), 0); } settings_changed = false; @@ -125,7 +125,7 @@ void iwTools::TransmitSettings() } } -void iwTools::UpdateTexts() +void iwTools::updateTexts() { if(gwv.getWorld().getGGS().isEnabled(AddonId::TOOL_ORDERING)) { @@ -146,7 +146,7 @@ void iwTools::msgPaintBefore() if(shouldUpdateTexts) { - UpdateTexts(); + updateTexts(); shouldUpdateTexts = false; } } @@ -181,17 +181,17 @@ void iwTools::msgButtonClick(const unsigned ctrl_id) { default: return; case 12: - WINDOWMANAGER.ReplaceWindow( + WINDOWMANAGER.replaceWindow( std::make_unique(_("These settings control the tool production of your metalworks. " "The higher the value, the more likely this tool is to be produced."))); break; case 13: // Standard - UpdateSettings(GAMECLIENT.default_settings.tools_settings); + updateSettings(GAMECLIENT.default_settings.tools_settings); settings_changed = true; break; case 15: // Zero all ToolSettings zero{}; - UpdateSettings(zero); + updateSettings(zero); settings_changed = true; break; } @@ -203,15 +203,15 @@ void iwTools::msgProgressChange(const unsigned /*ctrl_id*/, const unsigned short settings_changed = true; } -void iwTools::UpdateSettings(const ToolSettings& tool_settings) +void iwTools::updateSettings(const ToolSettings& tool_settings) { if(isReplay) - GAMECLIENT.ResetVisualSettings(); + GAMECLIENT.resetVisualSettings(); for(const auto tool : helpers::enumRange()) getCtrl(rttr::enum_cast(tool))->setPosition(tool_settings[tool]); } -void iwTools::UpdateSettings() +void iwTools::updateSettings() { - UpdateSettings(GAMECLIENT.visual_settings.tools_settings); + updateSettings(GAMECLIENT.visual_settings.tools_settings); } diff --git a/libs/s25main/ingameWindows/iwTools.h b/libs/s25main/ingameWindows/iwTools.h index d32c08b65a..56fbdb690e 100644 --- a/libs/s25main/ingameWindows/iwTools.h +++ b/libs/s25main/ingameWindows/iwTools.h @@ -30,16 +30,16 @@ class iwTools final : public TransmitSettingsIgwAdapter bool isReplay; Subscription toolSubscription; - void AddToolSettingSlider(unsigned id, GoodType ware); + void addToolSettingSlider(unsigned id, GoodType ware); /// Updatet die Steuerelemente mit den übergebenen Einstellungen - void UpdateSettings(const ToolSettings& tool_settings); - void UpdateSettings() override; + void updateSettings(const ToolSettings& tool_settings); + void updateSettings() override; /// Sendet veränderte Einstellungen (an den Client), falls sie verändert wurden - void TransmitSettings() override; + void transmitSettings() override; void msgButtonClick(unsigned ctrl_id) override; void msgProgressChange(unsigned ctrl_id, unsigned short position) override; - void UpdateTexts(); + void updateTexts(); void msgPaintBefore() override; }; diff --git a/libs/s25main/ingameWindows/iwTrade.cpp b/libs/s25main/ingameWindows/iwTrade.cpp index 6836f2b30f..89bac1b00a 100644 --- a/libs/s25main/ingameWindows/iwTrade.cpp +++ b/libs/s25main/ingameWindows/iwTrade.cpp @@ -24,25 +24,25 @@ #include "gameData/const_gui_ids.h" iwTrade::iwTrade(const nobBaseWarehouse& wh, const GameWorldViewer& gwv, GameCommandFactory& gcFactory) - : IngameWindow(CGI_BUILDING + MapBase::CreateGUIID(wh.getPos()), IngameWindow::posAtMouse, Extent(400, 194), + : IngameWindow(CGI_BUILDING + MapBase::createGUIID(wh.getPos()), IngameWindow::posAtMouse, Extent(400, 194), _("Trade"), LOADER.getImageN("resource", 41)), wh(wh), gwv(gwv), gcFactory(gcFactory), possibleSrcWarehouses(gwv.getPlayer().getWarehousesForTrading(wh)) { // Get title of the player setTitle((boost::format(_("Trade with %s")) % gwv.getWorld().getPlayer(wh.getPlayer()).name).str()); // Gebäudebild und dessen Schatten - AddImage(0, DrawPoint(100, 144), &wh.getBuildingImage()); + addImage(0, DrawPoint(100, 144), &wh.getBuildingImage()); const unsigned left_column = 200; - AddComboBox(4, DrawPoint(left_column, 84), Extent(160, 18), TextureColor::Grey, NormalFont, + addComboBox(4, DrawPoint(left_column, 84), Extent(160, 18), TextureColor::Grey, NormalFont, 90); // Ware/Figure names - AddText(1, DrawPoint(left_column, 30), "Deal in:", COLOR_YELLOW, FontStyle::LEFT, NormalFont); - ctrlComboBox* box = this->AddComboBox(2, DrawPoint(left_column, 44), Extent(160, 18), TextureColor::Grey, + addText(1, DrawPoint(left_column, 30), "Deal in:", COLOR_YELLOW, FontStyle::LEFT, NormalFont); + ctrlComboBox* box = this->addComboBox(2, DrawPoint(left_column, 44), Extent(160, 18), TextureColor::Grey, NormalFont, 200); // Ware or figure? - box->AddItem(_("Wares")); - box->AddItem(_("Settlers")); - AddText(3, DrawPoint(left_column, 70), "Type:", COLOR_YELLOW, FontStyle::LEFT, NormalFont); + box->addItem(_("Wares")); + box->addItem(_("Settlers")); + addText(3, DrawPoint(left_column, 70), "Type:", COLOR_YELLOW, FontStyle::LEFT, NormalFont); // Create possible wares, figures for(const auto i : helpers::enumRange()) @@ -63,12 +63,12 @@ iwTrade::iwTrade(const nobBaseWarehouse& wh, const GameWorldViewer& gwv, GameCom jobs.push_back(i); } - AddImage(5, DrawPoint(left_column + 20, 130), static_cast(nullptr), _("Ware you like to trade")); - AddEdit(6, DrawPoint(left_column + 34, 120), Extent(39, 20), TextureColor::Grey, NormalFont) + addImage(5, DrawPoint(left_column + 20, 130), static_cast(nullptr), _("Ware you like to trade")); + addEdit(6, DrawPoint(left_column + 34, 120), Extent(39, 20), TextureColor::Grey, NormalFont) ->setType(EditType::Number); - AddText(7, DrawPoint(left_column + 75, 125), "/ 20", COLOR_YELLOW, FontStyle::LEFT, NormalFont); + addText(7, DrawPoint(left_column + 75, 125), "/ 20", COLOR_YELLOW, FontStyle::LEFT, NormalFont); - AddTextButton(8, DrawPoint(left_column, 150), Extent(150, 22), TextureColor::Green2, _("Send"), NormalFont); + addTextButton(8, DrawPoint(left_column, 150), Extent(150, 22), TextureColor::Green2, _("Send"), NormalFont); // Choose wares at first box->setSelection(0); @@ -92,7 +92,7 @@ void iwTrade::msgButtonClick(const unsigned /*ctrl_id*/) if(!getCtrl(4)->getCtrl(0)->isVisible() && helpers::fromString(number_str, 0) > 0) { if(gcFactory.TradeOverLand(wh.getPos(), what, helpers::fromString(number_str, 0))) - this->Close(); + this->close(); } } @@ -104,18 +104,18 @@ void iwTrade::msgComboSelectItem(const unsigned ctrl_id, const unsigned selectio case 2: { auto* names = this->getCtrl(4); - names->DeleteAllItems(); + names->deleteAllItems(); if(selection == 0) { // Add ware names for(GoodType ware : wares) - names->AddItem(_(WARE_NAMES[ware])); + names->addItem(_(WARE_NAMES[ware])); } else { // Add job names for(Job job : jobs) - names->AddItem(_(JOB_NAMES[job])); + names->addItem(_(JOB_NAMES[job])); } names->setSelection(0); msgComboSelectItem(4, 0); diff --git a/libs/s25main/ingameWindows/iwTransport.cpp b/libs/s25main/ingameWindows/iwTransport.cpp index a5dd9ff7c4..762f0bcbf1 100644 --- a/libs/s25main/ingameWindows/iwTransport.cpp +++ b/libs/s25main/ingameWindows/iwTransport.cpp @@ -35,30 +35,30 @@ iwTransport::iwTransport(const GameWorldViewer& gwv, GameCommandFactory& gcFacto if(leatheraddon::isAddonActive(gwv.getWorld())) { btOffsetY = 17; - Resize(Extent(166, 333 + btOffsetY)); + resize(Extent(166, 333 + btOffsetY)); } - AddImageButton(0, DrawPoint(18, 285 + btOffsetY), Extent(30, 30), TextureColor::Grey, LOADER.getImageN("io", 225), + addImageButton(0, DrawPoint(18, 285 + btOffsetY), Extent(30, 30), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); // Standard - AddImageButton(1, DrawPoint(60, 285 + btOffsetY), Extent(48, 30), TextureColor::Grey, LOADER.getImageN("io", 191), + addImageButton(1, DrawPoint(60, 285 + btOffsetY), Extent(48, 30), TextureColor::Grey, LOADER.getImageN("io", 191), _("Default")); // ganz hoch - AddImageButton(2, DrawPoint(118, 235 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.getImageN("io", 215), + addImageButton(2, DrawPoint(118, 235 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.getImageN("io", 215), _("Top")); // hoch - AddImageButton(3, DrawPoint(118, 255 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.getImageN("io", 33), + addImageButton(3, DrawPoint(118, 255 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.getImageN("io", 33), _("Up")); // runter - AddImageButton(4, DrawPoint(118, 275 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.getImageN("io", 34), + addImageButton(4, DrawPoint(118, 275 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.getImageN("io", 34), _("Down")); // ganz runter - AddImageButton(5, DrawPoint(118, 295 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.getImageN("io", 216), + addImageButton(5, DrawPoint(118, 295 + btOffsetY), Extent(30, 20), TextureColor::Grey, LOADER.getImageN("io", 216), _("Bottom")); // Buttons der einzelnen Waren anlegen - ctrlOptionGroup* group = AddOptionGroup(6, GroupSelectType::Illuminate); + ctrlOptionGroup* group = addOptionGroup(6, GroupSelectType::Illuminate); auto getGoodTex = [](GoodType good) { return LOADER.getWareTex(good); }; buttonData = {{{getGoodTex(GoodType::Coins), WARE_NAMES[GoodType::Coins]}, @@ -100,13 +100,13 @@ iwTransport::iwTransport(const GameWorldViewer& gwv, GameCommandFactory& gcFacto // Einstellungen festlegen for(unsigned char i = 0; i < pendingOrder.size(); ++i) { - group->AddImageButton(i, BUTTON_POS[i], Extent(30, 30), TextureColor::Grey, buttonData[pendingOrder[i]].sprite, + group->addImageButton(i, BUTTON_POS[i], Extent(30, 30), TextureColor::Grey, buttonData[pendingOrder[i]].sprite, _(buttonData[pendingOrder[i]].tooltip)); } group->setSelection(0); } -void iwTransport::TransmitSettings() +void iwTransport::transmitSettings() { if(GAMECLIENT.isReplayModeOn()) return; @@ -142,7 +142,7 @@ void iwTransport::msgButtonClick(const unsigned ctrl_id) { case 0: { - WINDOWMANAGER.ReplaceWindow( + WINDOWMANAGER.replaceWindow( std::make_unique(_("The transport priority of a type of merchandise can " "be determined here.The higher the priority of an item " "in the list, the quicker it is transported by helpers."))); @@ -173,8 +173,8 @@ void iwTransport::msgButtonClick(const unsigned ctrl_id) std::swap(pendingOrder[group->getSelection()], pendingOrder[group->getSelection() - 1]); ctrlImageButton& btPrev = *group->getCtrl(group->getSelection() - 1); ctrlImageButton& btNext = *group->getCtrl(group->getSelection()); - btPrev.SwapImage(btNext); - btPrev.SwapTooltip(btNext); + btPrev.swapImage(btNext); + btPrev.swapTooltip(btNext); group->setSelection(group->getSelection() - 1); } @@ -191,8 +191,8 @@ void iwTransport::msgButtonClick(const unsigned ctrl_id) std::swap(pendingOrder[group->getSelection()], pendingOrder[group->getSelection() - 1]); ctrlImageButton& btPrev = *group->getCtrl(group->getSelection() - 1); ctrlImageButton& btNext = *group->getCtrl(group->getSelection()); - btPrev.SwapImage(btNext); - btPrev.SwapTooltip(btNext); + btPrev.swapImage(btNext); + btPrev.swapTooltip(btNext); group->setSelection(group->getSelection() - 1); } @@ -209,8 +209,8 @@ void iwTransport::msgButtonClick(const unsigned ctrl_id) std::swap(pendingOrder[group->getSelection()], pendingOrder[group->getSelection() + 1]); ctrlImageButton& btPrev = *group->getCtrl(group->getSelection()); ctrlImageButton& btNext = *group->getCtrl(group->getSelection() + 1); - btPrev.SwapImage(btNext); - btPrev.SwapTooltip(btNext); + btPrev.swapImage(btNext); + btPrev.swapTooltip(btNext); group->setSelection(group->getSelection() + 1); } @@ -227,8 +227,8 @@ void iwTransport::msgButtonClick(const unsigned ctrl_id) std::swap(pendingOrder[group->getSelection()], pendingOrder[group->getSelection() + 1]); ctrlImageButton& btPrev = *group->getCtrl(group->getSelection()); ctrlImageButton& btNext = *group->getCtrl(group->getSelection() + 1); - btPrev.SwapImage(btNext); - btPrev.SwapTooltip(btNext); + btPrev.swapImage(btNext); + btPrev.swapTooltip(btNext); group->setSelection(group->getSelection() + 1); } @@ -238,11 +238,11 @@ void iwTransport::msgButtonClick(const unsigned ctrl_id) } } -void iwTransport::UpdateSettings() +void iwTransport::updateSettings() { if(GAMECLIENT.isReplayModeOn()) { - gwv.getPlayer().FillVisualSettings(GAMECLIENT.visual_settings); + gwv.getPlayer().fillVisualSettings(GAMECLIENT.visual_settings); fillTransportOrder(GAMECLIENT.visual_settings.transport_order); } auto* group = getCtrl(6); diff --git a/libs/s25main/ingameWindows/iwTransport.h b/libs/s25main/ingameWindows/iwTransport.h index b0436ba7c3..66a752d836 100644 --- a/libs/s25main/ingameWindows/iwTransport.h +++ b/libs/s25main/ingameWindows/iwTransport.h @@ -33,9 +33,9 @@ class iwTransport final : public TransmitSettingsIgwAdapter private: /// Updatet die Steuerelemente mit den übergebenen Einstellungen - void UpdateSettings() override; + void updateSettings() override; /// Sendet veränderte Einstellungen (an den Client), falls sie verändert wurden - void TransmitSettings() override; + void transmitSettings() override; void msgButtonClick(unsigned ctrl_id) override; diff --git a/libs/s25main/ingameWindows/iwVictory.cpp b/libs/s25main/ingameWindows/iwVictory.cpp index 4142313ac5..688a30fb2a 100644 --- a/libs/s25main/ingameWindows/iwVictory.cpp +++ b/libs/s25main/ingameWindows/iwVictory.cpp @@ -24,14 +24,14 @@ iwVictory::iwVictory(const std::vector& winnerNames) : IngameWindow(CGI_VICTORY, IngameWindow::posLastOrCenter, Extent(240, 240), _("End of game"), LOADER.getImageN("io", 5)) { - AddText(ID_TITLE, DrawPoint(120, 40), winnerNames.size() > 1u ? _("The winners:") : _("The winner:"), COLOR_YELLOW, + addText(ID_TITLE, DrawPoint(120, 40), winnerNames.size() > 1u ? _("The winners:") : _("The winner:"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); - auto* names = AddMultiline(ID_NAMES, DrawPoint(0, 70), Extent(800, 600), TextureColor::Invisible, NormalFont); + auto* names = addMultiline(ID_NAMES, DrawPoint(0, 70), Extent(800, 600), TextureColor::Invisible, NormalFont); names->setNumVisibleLines(winnerNames.size()); - names->ShowBackground(false); + names->showBackground(false); names->setScrollBarAllowed(false); for(const auto& name : winnerNames) - names->AddString(name, COLOR_YELLOW); + names->addString(name, COLOR_YELLOW); const auto txtBounds = Rect(names->getPos(), names->getContentSize()); Extent iwSize = getIwSize(); if(iwSize.x + 20u < txtBounds.getSize().x) @@ -42,9 +42,9 @@ iwVictory::iwVictory(const std::vector& winnerNames) setIwSize(iwSize); names->setPos(DrawPoint((getSize().x - txtBounds.getSize().x) / 2, names->getPos().y)); int btPosY = std::max(170, txtBounds.bottom + 20); - AddTextButton(ID_CONTINUE, DrawPoint(50, btPosY), Extent(140, 20), TextureColor::Grey, _("Continue game"), + addTextButton(ID_CONTINUE, DrawPoint(50, btPosY), Extent(140, 20), TextureColor::Grey, _("Continue game"), NormalFont); - AddTextButton(ID_END_GAME, DrawPoint(50, btPosY + 25), Extent(140, 20), TextureColor::Red1, _("End game"), + addTextButton(ID_END_GAME, DrawPoint(50, btPosY + 25), Extent(140, 20), TextureColor::Red1, _("End game"), NormalFont); } @@ -52,10 +52,10 @@ void iwVictory::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { - case ID_CONTINUE: Close(); break; + case ID_CONTINUE: close(); break; case ID_END_GAME: - WINDOWMANAGER.ReplaceWindow(std::make_unique()); - Close(); + WINDOWMANAGER.replaceWindow(std::make_unique()); + close(); break; } } diff --git a/libs/s25main/ingameWindows/iwWares.cpp b/libs/s25main/ingameWindows/iwWares.cpp index a00bec30f0..42b2d66dca 100644 --- a/libs/s25main/ingameWindows/iwWares.cpp +++ b/libs/s25main/ingameWindows/iwWares.cpp @@ -38,36 +38,36 @@ static void addElement(ctrlGroup& page, const glFont* font, const DrawPoint btPo if(allow_outhousing) { ctrlButton* b = - page.AddImageButton(100 + idOffset, btPos, btSize, TextureColor::Grey, LOADER.getMapTexture(2298), name); + page.addImageButton(100 + idOffset, btPos, btSize, TextureColor::Grey, LOADER.getMapTexture(2298), name); b->setBorder(false); } else - page.AddImage(100 + idOffset, btPos + btSize / 2, LOADER.getMapTexture(2298), name); + page.addImage(100 + idOffset, btPos + btSize / 2, LOADER.getMapTexture(2298), name); // Background image for the amount const DrawPoint bgCtPos = btPos + DrawPoint(btSize.x / 2, 32); - page.AddImage(200 + idOffset, bgCtPos, LOADER.getMapTexture(2299)); + page.addImage(200 + idOffset, bgCtPos, LOADER.getMapTexture(2299)); // The actual image for the element const DrawPoint warePos = btPos + btSize / 2; - page.AddImage(300 + idOffset, warePos, img); + page.addImage(300 + idOffset, warePos, img); // Overlay for "don't collect" DrawPoint overlayPos = warePos - DrawPoint(0, 4); - ctrlImage* image = page.AddImage(400 + idOffset, overlayPos, LOADER.getImageN("io", 222)); + ctrlImage* image = page.addImage(400 + idOffset, overlayPos, LOADER.getImageN("io", 222)); image->setVisible(false); // Overlay for "send out" overlayPos = warePos + DrawPoint(0, 10); - image = page.AddImage(500 + idOffset, overlayPos, LOADER.getImageN("io", 221)); + image = page.addImage(500 + idOffset, overlayPos, LOADER.getImageN("io", 221)); image->setVisible(false); // Overlay for "collect" - image = page.AddImage(700 + idOffset, overlayPos, LOADER.getImageN("io_new", 3)); + image = page.addImage(700 + idOffset, overlayPos, LOADER.getImageN("io_new", 3)); image->setVisible(false); // Amount of the element const DrawPoint txtPos = btPos + DrawPoint(btSize.x, 40); - page.AddText(600 + idOffset, txtPos, "", COLOR_YELLOW, FontStyle::RIGHT | FontStyle::BOTTOM, font); + page.addText(600 + idOffset, txtPos, "", COLOR_YELLOW, FontStyle::RIGHT | FontStyle::BOTTOM, font); } iwWares::iwWares(unsigned id, const DrawPoint& pos, unsigned additionalYSpace, const std::string& title, @@ -118,10 +118,10 @@ iwWares::iwWares(unsigned id, const DrawPoint& pos, unsigned additionalYSpace, c helpers::erase_if(JOB_DISPLAY_ORDER, makeIsUnusedJob(player.getGameWorld().getGGS())); // Warenseite hinzufügen - ctrlGroup& waresPage = AddPage(); + ctrlGroup& waresPage = addPage(); warePageID = waresPage.getID(); // Figurenseite hinzufügen - ctrlGroup& figuresPage = AddPage(); + ctrlGroup& figuresPage = addPage(); peoplePageID = figuresPage.getID(); bool isRowWithFourElemens = true; @@ -158,14 +158,14 @@ iwWares::iwWares(unsigned id, const DrawPoint& pos, unsigned additionalYSpace, c } // compute the final window size - Resize(Extent(getSize().x, topMargin + (y + 1) * rowHeight + spacingBetweenLastRowAndButtonRow + additionalYSpace + resize(Extent(getSize().x, topMargin + (y + 1) * rowHeight + spacingBetweenLastRowAndButtonRow + additionalYSpace + buttonRowHeight + bottomMargin)); // "Next page" button - AddImageButton(0, DrawPoint(52, getFullSize().y - 47), Extent(66, 32), TextureColor::Grey, + addImageButton(0, DrawPoint(52, getFullSize().y - 47), Extent(66, 32), TextureColor::Grey, LOADER.getImageN("io", 84), _("Next page")); // "Help" button - AddImageButton(12, DrawPoint(16, getFullSize().y - 47), Extent(32, 32), TextureColor::Grey, + addImageButton(12, DrawPoint(16, getFullSize().y - 47), Extent(32, 32), TextureColor::Grey, LOADER.getImageN("io", 225), _("Help")); waresPage.setVisible(true); @@ -180,7 +180,7 @@ void iwWares::msgButtonClick(const unsigned ctrl_id) setPage(curPage_ + 1); break; case 12: // Hilfe - WINDOWMANAGER.ReplaceWindow( + WINDOWMANAGER.replaceWindow( std::make_unique(_("Here you will find a list of your entire stores of " "merchandise and all the inhabitants of your realm."))); break; @@ -253,9 +253,9 @@ void iwWares::setPage(unsigned page) group->setVisible(true); } -ctrlGroup& iwWares::AddPage() +ctrlGroup& iwWares::addPage() { - ctrlGroup& grp = *AddGroup(ID_pageOffset + numPages); + ctrlGroup& grp = *addGroup(ID_pageOffset + numPages); numPages++; grp.setVisible(false); return grp; diff --git a/libs/s25main/ingameWindows/iwWares.h b/libs/s25main/ingameWindows/iwWares.h index 9776d5a9a9..45824dd963 100644 --- a/libs/s25main/ingameWindows/iwWares.h +++ b/libs/s25main/ingameWindows/iwWares.h @@ -25,7 +25,7 @@ class iwWares : public IngameWindow /// bestimmte Inventurseite zeigen. virtual void setPage(unsigned page); /// Add a new page and return it. ID will be in range 100+ - ctrlGroup& AddPage(); + ctrlGroup& addPage(); void msgButtonClick(unsigned ctrl_id) override; void msgPaintBefore() override; diff --git a/libs/s25main/lua/LuaInterfaceGame.cpp b/libs/s25main/lua/LuaInterfaceGame.cpp index c0999c1464..8bf99c3570 100644 --- a/libs/s25main/lua/LuaInterfaceGame.cpp +++ b/libs/s25main/lua/LuaInterfaceGame.cpp @@ -206,18 +206,18 @@ KAGUYA_MEMBER_FUNCTION_OVERLOADS(SetMissionGoalWrapper, LuaInterfaceGame, setMis void LuaInterfaceGame::Register(kaguya::State& state) { state["RTTRGame"].setClass(kaguya::UserdataMetatable() - .addFunction("ClearResources", &LuaInterfaceGame::ClearResources) + .addFunction("ClearResources", &LuaInterfaceGame::clearResources) .addFunction("GetGF", &LuaInterfaceGame::getGF) - .addFunction("FormatNumGFs", &LuaInterfaceGame::FormatNumGFs) + .addFunction("FormatNumGFs", &LuaInterfaceGame::formatNumGFs) .addFunction("GetGameFrame", &LuaInterfaceGame::getGF) .addFunction("GetNumPlayers", &LuaInterfaceGame::getNumPlayers) - .addFunction("Chat", &LuaInterfaceGame::Chat) - .addOverloadedFunctions("MissionStatement", &LuaInterfaceGame::MissionStatement, - &LuaInterfaceGame::MissionStatement2, - &LuaInterfaceGame::MissionStatement3) + .addFunction("Chat", &LuaInterfaceGame::chat) + .addOverloadedFunctions("MissionStatement", &LuaInterfaceGame::missionStatement, + &LuaInterfaceGame::missionStatement2, + &LuaInterfaceGame::missionStatement3) .addFunction("SetMissionGoal", SetMissionGoalWrapper()) - .addFunction("PostMessage", &LuaInterfaceGame::PostMessageLua) - .addFunction("PostMessageWithLocation", &LuaInterfaceGame::PostMessageWithLocation) + .addFunction("PostMessage", &LuaInterfaceGame::postMessageLua) + .addFunction("PostMessageWithLocation", &LuaInterfaceGame::postMessageWithLocation) .addFunction("GetPlayer", &LuaInterfaceGame::getPlayer) .addFunction("GetWorld", &LuaInterfaceGame::getWorld) // Old name @@ -259,10 +259,10 @@ bool LuaInterfaceGame::Deserialize(Serializer& luaSaveState) return true; } -void LuaInterfaceGame::ClearResources() +void LuaInterfaceGame::clearResources() { for(unsigned p = 0; p < gw.getNumPlayers(); p++) - getPlayer(p).ClearResources(); + getPlayer(p).clearResources(); } unsigned LuaInterfaceGame::getGF() const @@ -270,9 +270,9 @@ unsigned LuaInterfaceGame::getGF() const return gw.getEvMgr().getCurrentGF(); } -std::string LuaInterfaceGame::FormatNumGFs(unsigned numGFs) const +std::string LuaInterfaceGame::formatNumGFs(unsigned numGFs) const { - return localGameState.FormatGFTime(numGFs); + return localGameState.formatGFTime(numGFs); } unsigned LuaInterfaceGame::getNumPlayers() const @@ -280,32 +280,32 @@ unsigned LuaInterfaceGame::getNumPlayers() const return gw.getNumPlayers(); } -void LuaInterfaceGame::Chat(int playerIdx, const std::string& msg) +void LuaInterfaceGame::chat(int playerIdx, const std::string& msg) { if(playerIdx >= 0 && localGameState.getPlayerId() != unsigned(playerIdx)) return; - localGameState.SystemChat(msg); + localGameState.systemChat(msg); } -void LuaInterfaceGame::MissionStatement(int playerIdx, const std::string& title, const std::string& msg) +void LuaInterfaceGame::missionStatement(int playerIdx, const std::string& title, const std::string& msg) { - MissionStatement2(playerIdx, title, msg, iwMissionStatement::IM_SWORDSMAN); + missionStatement2(playerIdx, title, msg, iwMissionStatement::IM_SWORDSMAN); } -void LuaInterfaceGame::MissionStatement2(int playerIdx, const std::string& title, const std::string& msg, +void LuaInterfaceGame::missionStatement2(int playerIdx, const std::string& title, const std::string& msg, unsigned imgIdx) { - MissionStatement3(playerIdx, title, msg, imgIdx, true); + missionStatement3(playerIdx, title, msg, imgIdx, true); } -void LuaInterfaceGame::MissionStatement3(int playerIdx, const std::string& title, const std::string& msg, +void LuaInterfaceGame::missionStatement3(int playerIdx, const std::string& title, const std::string& msg, unsigned imgIdx, bool pause) { if(playerIdx >= 0 && localGameState.getPlayerId() != unsigned(playerIdx)) return; - WINDOWMANAGER.Show(std::make_unique(_(title), msg, gw.isSinglePlayer() && pause, + WINDOWMANAGER.show(std::make_unique(_(title), msg, gw.isSinglePlayer() && pause, iwMissionStatement::HelpImage(imgIdx))); } @@ -315,19 +315,19 @@ void LuaInterfaceGame::setMissionGoal(int playerIdx, const std::string& newGoal) } // Must not be PostMessage as this is a windows define :( -void LuaInterfaceGame::PostMessageLua(int playerIdx, const std::string& msg) +void LuaInterfaceGame::postMessageLua(int playerIdx, const std::string& msg) { lua::assertTrue(playerIdx >= 0, "Invalid player idx"); - gw.getPostMgr().SendMsg(static_cast(playerIdx), + gw.getPostMgr().sendMsg(static_cast(playerIdx), std::make_unique(gw.getEvMgr().getCurrentGF(), msg, PostCategory::General)); } -void LuaInterfaceGame::PostMessageWithLocation(int playerIdx, const std::string& msg, int x, int y) +void LuaInterfaceGame::postMessageWithLocation(int playerIdx, const std::string& msg, int x, int y) { lua::assertTrue(playerIdx >= 0, "Invalid player idx"); - gw.getPostMgr().SendMsg(static_cast(playerIdx), + gw.getPostMgr().sendMsg(static_cast(playerIdx), std::make_unique(gw.getEvMgr().getCurrentGF(), msg, PostCategory::General, - gw.MakeMapPoint(Position(x, y)))); + gw.makeMapPoint(Position(x, y)))); } LuaPlayer LuaInterfaceGame::getPlayer(int playerIdx) @@ -341,7 +341,7 @@ LuaWorld LuaInterfaceGame::getWorld() return LuaWorld(gw); } -void LuaInterfaceGame::EventExplored(unsigned player, const MapPoint pt, unsigned char owner) +void LuaInterfaceGame::eventExplored(unsigned player, const MapPoint pt, unsigned char owner) { kaguya::LuaRef onExplored = lua["onExplored"]; if(onExplored.type() == LUA_TFUNCTION) @@ -358,14 +358,14 @@ void LuaInterfaceGame::EventExplored(unsigned player, const MapPoint pt, unsigne } } -void LuaInterfaceGame::EventOccupied(unsigned player, const MapPoint pt) +void LuaInterfaceGame::eventOccupied(unsigned player, const MapPoint pt) { kaguya::LuaRef onOccupied = lua["onOccupied"]; if(onOccupied.type() == LUA_TFUNCTION) onOccupied.call(player, pt.x, pt.y); } -void LuaInterfaceGame::EventAttack(unsigned char attackerPlayerId, unsigned char defenderPlayerId, +void LuaInterfaceGame::eventAttack(unsigned char attackerPlayerId, unsigned char defenderPlayerId, unsigned attackerCount) { kaguya::LuaRef onAttack = lua["onAttack"]; @@ -373,21 +373,21 @@ void LuaInterfaceGame::EventAttack(unsigned char attackerPlayerId, unsigned char onAttack.call(attackerPlayerId, defenderPlayerId, attackerCount); } -void LuaInterfaceGame::EventStart(bool isFirstStart) +void LuaInterfaceGame::eventStart(bool isFirstStart) { kaguya::LuaRef onStart = lua["onStart"]; if(onStart.type() == LUA_TFUNCTION) onStart.call(isFirstStart); } -void LuaInterfaceGame::EventGameFrame(unsigned nr) +void LuaInterfaceGame::eventGameFrame(unsigned nr) { kaguya::LuaRef onGameFrame = lua["onGameFrame"]; if(onGameFrame.type() == LUA_TFUNCTION) onGameFrame.call(nr); } -void LuaInterfaceGame::EventResourceFound(unsigned char player, const MapPoint pt, ResourceType type, +void LuaInterfaceGame::eventResourceFound(unsigned char player, const MapPoint pt, ResourceType type, unsigned char quantity) { kaguya::LuaRef onResourceFound = lua["onResourceFound"]; @@ -395,7 +395,7 @@ void LuaInterfaceGame::EventResourceFound(unsigned char player, const MapPoint p onResourceFound.call(player, pt.x, pt.y, type, quantity); } -bool LuaInterfaceGame::EventCancelPactRequest(PactType pt, unsigned char canceledByPlayerId, +bool LuaInterfaceGame::eventCancelPactRequest(PactType pt, unsigned char canceledByPlayerId, unsigned char targetPlayerId) { kaguya::LuaRef onPactCancel = lua["onCancelPactRequest"]; @@ -404,7 +404,7 @@ bool LuaInterfaceGame::EventCancelPactRequest(PactType pt, unsigned char cancele return true; // always accept pact cancel if there is no handler } -void LuaInterfaceGame::EventSuggestPact(const PactType pt, unsigned char suggestedByPlayerId, +void LuaInterfaceGame::eventSuggestPact(const PactType pt, unsigned char suggestedByPlayerId, unsigned char targetPlayerId, const unsigned duration) { AIPlayer* ai = game.getAIPlayer(targetPlayerId); @@ -423,7 +423,7 @@ void LuaInterfaceGame::EventSuggestPact(const PactType pt, unsigned char suggest } } -void LuaInterfaceGame::EventPactCanceled(const PactType pt, unsigned char canceledByPlayerId, +void LuaInterfaceGame::eventPactCanceled(const PactType pt, unsigned char canceledByPlayerId, unsigned char targetPlayerId) { kaguya::LuaRef onPactCanceled = lua["onPactCanceled"]; @@ -433,7 +433,7 @@ void LuaInterfaceGame::EventPactCanceled(const PactType pt, unsigned char cancel } } -void LuaInterfaceGame::EventPactCreated(const PactType pt, unsigned char suggestedByPlayerId, +void LuaInterfaceGame::eventPactCreated(const PactType pt, unsigned char suggestedByPlayerId, unsigned char targetPlayerId, const unsigned duration) { kaguya::LuaRef onPactCreated = lua["onPactCreated"]; diff --git a/libs/s25main/lua/LuaInterfaceGame.h b/libs/s25main/lua/LuaInterfaceGame.h index f8a33c9ed6..c197febc19 100644 --- a/libs/s25main/lua/LuaInterfaceGame.h +++ b/libs/s25main/lua/LuaInterfaceGame.h @@ -29,35 +29,35 @@ class LuaInterfaceGame : public LuaInterfaceGameBase bool Serialize(Serializer& luaSaveState); bool Deserialize(Serializer& luaSaveState); - void EventExplored(unsigned player, MapPoint pt, unsigned char owner); - void EventOccupied(unsigned player, MapPoint pt); - void EventAttack(unsigned char attackerPlayerId, unsigned char defenderPlayerId, unsigned attackerCount); - void EventStart(bool isFirstStart); - void EventGameFrame(unsigned nr); - void EventResourceFound(unsigned char player, MapPoint pt, ResourceType type, unsigned char quantity); + void eventExplored(unsigned player, MapPoint pt, unsigned char owner); + void eventOccupied(unsigned player, MapPoint pt); + void eventAttack(unsigned char attackerPlayerId, unsigned char defenderPlayerId, unsigned attackerCount); + void eventStart(bool isFirstStart); + void eventGameFrame(unsigned nr); + void eventResourceFound(unsigned char player, MapPoint pt, ResourceType type, unsigned char quantity); // Called if player wants to cancel a pact - bool EventCancelPactRequest(PactType pt, unsigned char canceledByPlayerId, unsigned char targetPlayerId); + bool eventCancelPactRequest(PactType pt, unsigned char canceledByPlayerId, unsigned char targetPlayerId); // Called if player suggests a pact - void EventSuggestPact(PactType pt, unsigned char suggestedByPlayerId, unsigned char targetPlayerId, + void eventSuggestPact(PactType pt, unsigned char suggestedByPlayerId, unsigned char targetPlayerId, unsigned duration); // called if pact was canceled - void EventPactCanceled(PactType pt, unsigned char canceledByPlayerId, unsigned char targetPlayerId); + void eventPactCanceled(PactType pt, unsigned char canceledByPlayerId, unsigned char targetPlayerId); // called if pact was created - void EventPactCreated(PactType pt, unsigned char suggestedByPlayerId, unsigned char targetPlayerId, + void eventPactCreated(PactType pt, unsigned char suggestedByPlayerId, unsigned char targetPlayerId, unsigned duration); // Callable from Lua - void ClearResources(); + void clearResources(); unsigned getGF() const; - std::string FormatNumGFs(unsigned numGFs) const; + std::string formatNumGFs(unsigned numGFs) const; unsigned getNumPlayers() const; - void Chat(int playerIdx, const std::string& msg); - void MissionStatement(int playerIdx, const std::string& title, const std::string& msg); - void MissionStatement2(int playerIdx, const std::string& title, const std::string& msg, unsigned imgIdx); - void MissionStatement3(int playerIdx, const std::string& title, const std::string& msg, unsigned imgIdx, + void chat(int playerIdx, const std::string& msg); + void missionStatement(int playerIdx, const std::string& title, const std::string& msg); + void missionStatement2(int playerIdx, const std::string& title, const std::string& msg, unsigned imgIdx); + void missionStatement3(int playerIdx, const std::string& title, const std::string& msg, unsigned imgIdx, bool pause); void setMissionGoal(int playerIdx, const std::string& newGoal = ""); - void PostMessageLua(int playerIdx, const std::string& msg); - void PostMessageWithLocation(int playerIdx, const std::string& msg, int x, int y); + void postMessageLua(int playerIdx, const std::string& msg); + void postMessageWithLocation(int playerIdx, const std::string& msg, int x, int y); private: ILocalGameState& localGameState; diff --git a/libs/s25main/lua/LuaInterfaceGameBase.cpp b/libs/s25main/lua/LuaInterfaceGameBase.cpp index afcf8614e6..371798d895 100644 --- a/libs/s25main/lua/LuaInterfaceGameBase.cpp +++ b/libs/s25main/lua/LuaInterfaceGameBase.cpp @@ -31,11 +31,11 @@ void LuaInterfaceGameBase::Register(kaguya::State& state) .addStaticFunction("GetFeatureLevel", &LuaInterfaceGameBase::getFeatureLevel) .addFunction("IsHost", &LuaInterfaceGameBase::isHost) .addFunction("GetLocalPlayerIdx", &LuaInterfaceGameBase::getLocalPlayerIdx) - .addOverloadedFunctions("MsgBox", &LuaInterfaceGameBase::MsgBox, &LuaInterfaceGameBase::MsgBox2) - .addOverloadedFunctions("MsgBoxEx", &LuaInterfaceGameBase::MsgBoxEx, &LuaInterfaceGameBase::MsgBoxEx2)); + .addOverloadedFunctions("MsgBox", &LuaInterfaceGameBase::msgBox, &LuaInterfaceGameBase::msgBox2) + .addOverloadedFunctions("MsgBoxEx", &LuaInterfaceGameBase::msgBoxEx, &LuaInterfaceGameBase::msgBoxEx2)); } -bool LuaInterfaceGameBase::CheckScriptVersion() +bool LuaInterfaceGameBase::checkScriptVersion() { kaguya::LuaRef func = lua["getRequiredLuaVersion"]; if(func.type() == LUA_TFUNCTION) @@ -66,24 +66,24 @@ unsigned LuaInterfaceGameBase::getLocalPlayerIdx() const return localGameState.getPlayerId(); } -void LuaInterfaceGameBase::MsgBox(const std::string& title, const std::string& msg, bool isError) +void LuaInterfaceGameBase::msgBox(const std::string& title, const std::string& msg, bool isError) { - WINDOWMANAGER.Show(std::make_unique(_(title), _(msg), nullptr, MsgboxButton::Ok, + WINDOWMANAGER.show(std::make_unique(_(title), _(msg), nullptr, MsgboxButton::Ok, isError ? MsgboxIcon::ExclamationRed : MsgboxIcon::ExclamationGreen)); } -void LuaInterfaceGameBase::MsgBoxEx(const std::string& title, const std::string& msg, const std::string& iconFile, +void LuaInterfaceGameBase::msgBoxEx(const std::string& title, const std::string& msg, const std::string& iconFile, unsigned iconIdx) { - WINDOWMANAGER.Show( + WINDOWMANAGER.show( std::make_unique(_(title), _(msg), nullptr, MsgboxButton::Ok, ResourceId::make(iconFile), iconIdx)); } -void LuaInterfaceGameBase::MsgBoxEx2(const std::string& title, const std::string& msg, const std::string& iconFile, +void LuaInterfaceGameBase::msgBoxEx2(const std::string& title, const std::string& msg, const std::string& iconFile, unsigned iconIdx, int iconX, int iconY) { auto msgBox = std::make_unique(_(title), _(msg), nullptr, MsgboxButton::Ok, ResourceId::make(iconFile), iconIdx); - msgBox->MoveIcon(DrawPoint(iconX, iconY)); - WINDOWMANAGER.Show(std::move(msgBox)); + msgBox->moveIcon(DrawPoint(iconX, iconY)); + WINDOWMANAGER.show(std::move(msgBox)); } diff --git a/libs/s25main/lua/LuaInterfaceGameBase.h b/libs/s25main/lua/LuaInterfaceGameBase.h index 4f04e546c9..38f0b0267f 100644 --- a/libs/s25main/lua/LuaInterfaceGameBase.h +++ b/libs/s25main/lua/LuaInterfaceGameBase.h @@ -12,7 +12,7 @@ class LuaInterfaceGameBase : public LuaInterfaceBase public: static void Register(kaguya::State& state); - bool CheckScriptVersion(); + bool checkScriptVersion(); /// Return version of the interface. Changes here reflect breaking changes static unsigned getVersion(); @@ -28,11 +28,11 @@ class LuaInterfaceGameBase : public LuaInterfaceBase unsigned getLocalPlayerIdx() const; /// Show a message box with given title and text. /// If isError is true, a red exclamation mark is shown, otherwise a green one is shown - void MsgBox(const std::string& title, const std::string& msg, bool isError); - void MsgBox2(const std::string& title, const std::string& msg) { MsgBox(title, msg, false); } + void msgBox(const std::string& title, const std::string& msg, bool isError); + void msgBox2(const std::string& title, const std::string& msg) { msgBox(title, msg, false); } /// Shows a message with a custom icon. Image with iconIdx must exist in iconFile and iconFile must be loaded! - void MsgBoxEx(const std::string& title, const std::string& msg, const std::string& iconFile, unsigned iconIdx); - void MsgBoxEx2(const std::string& title, const std::string& msg, const std::string& iconFile, unsigned iconIdx, + void msgBoxEx(const std::string& title, const std::string& msg, const std::string& iconFile, unsigned iconIdx); + void msgBoxEx2(const std::string& title, const std::string& msg, const std::string& iconFile, unsigned iconIdx, int iconX, int iconY); private: diff --git a/libs/s25main/lua/LuaInterfaceSettings.cpp b/libs/s25main/lua/LuaInterfaceSettings.cpp index de07ea02b1..87b1230e43 100644 --- a/libs/s25main/lua/LuaInterfaceSettings.cpp +++ b/libs/s25main/lua/LuaInterfaceSettings.cpp @@ -39,8 +39,8 @@ void LuaInterfaceSettings::Register(kaguya::State& state) .addFunction("GetNumPlayers", &LuaInterfaceSettings::getNumPlayers) .addFunction("GetPlayer", &LuaInterfaceSettings::getPlayer) .addOverloadedFunctions("SetAddon", &LuaInterfaceSettings::setAddon, &LuaInterfaceSettings::setBoolAddon) - .addFunction("ResetAddons", &LuaInterfaceSettings::ResetAddons) - .addFunction("ResetGameSettings", &LuaInterfaceSettings::ResetGameSettings) + .addFunction("ResetAddons", &LuaInterfaceSettings::resetAddons) + .addFunction("ResetGameSettings", &LuaInterfaceSettings::resetGameSettings) .addFunction("SetGameSettings", &LuaInterfaceSettings::setGameSettings) // Old name .addFunction("GetPlayerCount", &LuaInterfaceSettings::getNumPlayers)); @@ -109,7 +109,7 @@ void LuaInterfaceSettings::setAddon(AddonIdWrapper id, unsigned value) ggs.applyLegacyInexhaustibleMines(); } else ggs.setSelection(id, value); - lobbyServerController_.ChangeGlobalGameSettings(ggs); + lobbyServerController_.changeGlobalGameSettings(ggs); } void LuaInterfaceSettings::setBoolAddon(AddonIdWrapper id, bool value) @@ -117,17 +117,17 @@ void LuaInterfaceSettings::setBoolAddon(AddonIdWrapper id, bool value) setAddon(id, value ? 1 : 0); } -void LuaInterfaceSettings::ResetAddons() +void LuaInterfaceSettings::resetAddons() { GlobalGameSettings ggs = lobbyServerController_.getGGS(); ggs.resetAddons(); - lobbyServerController_.ChangeGlobalGameSettings(ggs); + lobbyServerController_.changeGlobalGameSettings(ggs); } -void LuaInterfaceSettings::ResetGameSettings() +void LuaInterfaceSettings::resetGameSettings() { // Simply create a new instance - lobbyServerController_.ChangeGlobalGameSettings(GlobalGameSettings()); + lobbyServerController_.changeGlobalGameSettings(GlobalGameSettings()); } void LuaInterfaceSettings::setGameSettings(const kaguya::LuaTable& settings) @@ -168,7 +168,7 @@ void LuaInterfaceSettings::setGameSettings(const kaguya::LuaTable& settings) if(helpers::contains(keys, "randomStartPosition")) ggs.randomStartPosition = settings.getField("randomStartPosition"); - lobbyServerController_.ChangeGlobalGameSettings(ggs); + lobbyServerController_.changeGlobalGameSettings(ggs); } kaguya::LuaRef LuaInterfaceSettings::getAllowedChanges() @@ -183,7 +183,7 @@ kaguya::LuaRef LuaInterfaceSettings::getAllowedChanges() return kaguya::LuaRef(); } -bool LuaInterfaceSettings::EventSettingsInit(bool isSinglePlayer, bool isSavegame) +bool LuaInterfaceSettings::eventSettingsInit(bool isSinglePlayer, bool isSavegame) { kaguya::LuaRef func = lua["onSettingsInit"]; if(func.type() == LUA_TFUNCTION) @@ -192,28 +192,28 @@ bool LuaInterfaceSettings::EventSettingsInit(bool isSinglePlayer, bool isSavegam return true; } -void LuaInterfaceSettings::EventSettingsReady() +void LuaInterfaceSettings::eventSettingsReady() { kaguya::LuaRef func = lua["onSettingsReady"]; if(func.type() == LUA_TFUNCTION) func.call(); } -void LuaInterfaceSettings::EventPlayerJoined(unsigned playerIdx) +void LuaInterfaceSettings::eventPlayerJoined(unsigned playerIdx) { kaguya::LuaRef func = lua["onPlayerJoined"]; if(func.type() == LUA_TFUNCTION) func.call(playerIdx); } -void LuaInterfaceSettings::EventPlayerLeft(unsigned playerIdx) +void LuaInterfaceSettings::eventPlayerLeft(unsigned playerIdx) { kaguya::LuaRef func = lua["onPlayerLeft"]; if(func.type() == LUA_TFUNCTION) func.call(playerIdx); } -void LuaInterfaceSettings::EventPlayerReady(unsigned playerIdx) +void LuaInterfaceSettings::eventPlayerReady(unsigned playerIdx) { kaguya::LuaRef func = lua["onPlayerReady"]; if(func.type() == LUA_TFUNCTION) diff --git a/libs/s25main/lua/LuaInterfaceSettings.h b/libs/s25main/lua/LuaInterfaceSettings.h index 2e6bb6383c..851293edb6 100644 --- a/libs/s25main/lua/LuaInterfaceSettings.h +++ b/libs/s25main/lua/LuaInterfaceSettings.h @@ -24,13 +24,13 @@ class LuaInterfaceSettings : public LuaInterfaceGameBase // Interface for C++ /// Called when settings are entered. Returns whether script should be executed - bool EventSettingsInit(bool isSinglePlayer, bool isSavegame); + bool eventSettingsInit(bool isSinglePlayer, bool isSavegame); // Other events are only called for the host /// Called when the settings screen is ready - void EventSettingsReady(); - void EventPlayerJoined(unsigned playerIdx); - void EventPlayerLeft(unsigned playerIdx); - void EventPlayerReady(unsigned playerIdx); + void eventSettingsReady(); + void eventPlayerJoined(unsigned playerIdx); + void eventPlayerLeft(unsigned playerIdx); + void eventPlayerReady(unsigned playerIdx); /// Return whether the named change is allowed bool isChangeAllowed(const std::string& name, bool defaultVal = false); /// Get addons that are allowed to be changed @@ -46,7 +46,7 @@ class LuaInterfaceSettings : public LuaInterfaceGameBase LuaServerPlayer getPlayer(int idx); void setAddon(AddonIdWrapper id, unsigned value); void setBoolAddon(AddonIdWrapper id, bool value); // Alias - void ResetAddons(); - void ResetGameSettings(); + void resetAddons(); + void resetGameSettings(); void setGameSettings(const kaguya::LuaTable& settings); }; diff --git a/libs/s25main/lua/LuaPlayer.cpp b/libs/s25main/lua/LuaPlayer.cpp index 12fcd58f66..56e6d6c058 100644 --- a/libs/s25main/lua/LuaPlayer.cpp +++ b/libs/s25main/lua/LuaPlayer.cpp @@ -31,22 +31,22 @@ void LuaPlayer::Register(kaguya::State& state) { LuaPlayerBase::Register(state); state["Player"].setClass(kaguya::UserdataMetatable() - .addFunction("EnableBuilding", &LuaPlayer::EnableBuilding) - .addFunction("DisableBuilding", &LuaPlayer::DisableBuilding) - .addFunction("EnableAllBuildings", &LuaPlayer::EnableAllBuildings) - .addFunction("DisableAllBuildings", &LuaPlayer::DisableAllBuildings) + .addFunction("EnableBuilding", &LuaPlayer::enableBuilding) + .addFunction("DisableBuilding", &LuaPlayer::disableBuilding) + .addFunction("EnableAllBuildings", &LuaPlayer::enableAllBuildings) + .addFunction("DisableAllBuildings", &LuaPlayer::disableAllBuildings) .addFunction("SetRestrictedArea", &LuaPlayer::setRestrictedArea) .addFunction("IsInRestrictedArea", &LuaPlayer::isInRestrictedArea) - .addFunction("ClearResources", &LuaPlayer::ClearResources) - .addFunction("AddWares", &LuaPlayer::AddWares) - .addFunction("AddPeople", &LuaPlayer::AddPeople) + .addFunction("ClearResources", &LuaPlayer::clearResources) + .addFunction("AddWares", &LuaPlayer::addWares) + .addFunction("AddPeople", &LuaPlayer::addPeople) .addFunction("GetNumBuildings", &LuaPlayer::getNumBuildings) .addFunction("GetNumBuildingSites", &LuaPlayer::getNumBuildingSites) .addFunction("GetNumWares", &LuaPlayer::getNumWares) .addFunction("GetNumPeople", &LuaPlayer::getNumPeople) .addFunction("GetStatisticsValue", &LuaPlayer::getStatisticsValue) - .addFunction("AIConstructionOrder", &LuaPlayer::AIConstructionOrder) - .addFunction("ModifyHQ", &LuaPlayer::ModifyHQ) + .addFunction("AIConstructionOrder", &LuaPlayer::aIConstructionOrder) + .addFunction("ModifyHQ", &LuaPlayer::modifyHQ) .addFunction("GetHQPos", &LuaPlayer::getHQPos) .addFunction("IsDefeated", &LuaPlayer::IsDefeated) .addFunction("Surrender", &LuaPlayer::Surrender) @@ -61,33 +61,33 @@ void LuaPlayer::Register(kaguya::State& state) .addFunction("GetPeopleCount", &LuaPlayer::getNumPeople)); } -void LuaPlayer::EnableBuilding(lua::SafeEnum bld, bool notify) +void LuaPlayer::enableBuilding(lua::SafeEnum bld, bool notify) { - player.EnableBuilding(bld); + player.enableBuilding(bld); if(notify) { - player.SendPostMessage( + player.sendPostMessage( std::make_unique(player.getGameWorld().getEvMgr().getCurrentGF(), std::string(_("New building type:")) + "\n" + _(BUILDING_NAMES[bld]), PostCategory::General, bld, player.nation)); } } -void LuaPlayer::DisableBuilding(lua::SafeEnum bld) +void LuaPlayer::disableBuilding(lua::SafeEnum bld) { - player.DisableBuilding(bld); + player.disableBuilding(bld); } -void LuaPlayer::EnableAllBuildings() +void LuaPlayer::enableAllBuildings() { for(const auto bld : helpers::enumRange()) - player.EnableBuilding(bld); + player.enableBuilding(bld); } -void LuaPlayer::DisableAllBuildings() +void LuaPlayer::disableAllBuildings() { for(const auto bld : helpers::enumRange()) - player.DisableBuilding(bld); + player.disableBuilding(bld); } void LuaPlayer::setRestrictedArea(kaguya::VariadicArgType inPoints) @@ -173,14 +173,14 @@ bool LuaPlayer::isInRestrictedArea(unsigned x, unsigned y) const return TerritoryRegion::isPointValid(world.getSize(), player.getRestrictedArea(), MapPoint(x, y)); } -void LuaPlayer::ClearResources() +void LuaPlayer::clearResources() { const std::list warehouses = player.getBuildingRegister().getStorehouses(); for(auto* warehouse : warehouses) - warehouse->Clear(); + warehouse->clear(); } -bool LuaPlayer::AddWares(const std::map, unsigned>& wares) +bool LuaPlayer::addWares(const std::map, unsigned>& wares) { nobBaseWarehouse* warehouse = player.getFirstWH(); @@ -191,11 +191,11 @@ bool LuaPlayer::AddWares(const std::map, unsigned>& ware for(const auto& ware : wares) counts[ware.first] += ware.second; - warehouse->AddToInventory(counts, true); + warehouse->addToInventory(counts, true); return true; } -bool LuaPlayer::AddPeople(const std::map, unsigned>& people) +bool LuaPlayer::addPeople(const std::map, unsigned>& people) { nobBaseWarehouse* warehouse = player.getFirstWH(); @@ -215,7 +215,7 @@ bool LuaPlayer::AddPeople(const std::map, unsigned>& people) counts[it.first] += it.second; } - warehouse->AddToInventory(counts, true); + warehouse->addToInventory(counts, true); return true; } @@ -244,7 +244,7 @@ unsigned LuaPlayer::getStatisticsValue(lua::SafeEnum stat) const return player.getStatisticCurrentValue(stat); } -bool LuaPlayer::AIConstructionOrder(unsigned x, unsigned y, lua::SafeEnum bld) +bool LuaPlayer::aIConstructionOrder(unsigned x, unsigned y, lua::SafeEnum bld) { // Only for actual AIs if(!player.isUsed() || player.isHuman()) @@ -256,7 +256,7 @@ bool LuaPlayer::AIConstructionOrder(unsigned x, unsigned y, lua::SafeEnum LuaPlayer::getHQPos() const diff --git a/libs/s25main/lua/LuaPlayer.h b/libs/s25main/lua/LuaPlayer.h index fc51763521..4b52f55091 100644 --- a/libs/s25main/lua/LuaPlayer.h +++ b/libs/s25main/lua/LuaPlayer.h @@ -35,22 +35,22 @@ class LuaPlayer : public LuaPlayerBase LuaPlayer(Game& game, GamePlayer& player) : game(game), player(player) {} static void Register(kaguya::State& state); - void EnableBuilding(lua::SafeEnum bld, bool notify); - void DisableBuilding(lua::SafeEnum bld); - void EnableAllBuildings(); - void DisableAllBuildings(); + void enableBuilding(lua::SafeEnum bld, bool notify); + void disableBuilding(lua::SafeEnum bld); + void enableAllBuildings(); + void disableAllBuildings(); void setRestrictedArea(kaguya::VariadicArgType inPoints); bool isInRestrictedArea(unsigned x, unsigned y) const; - void ClearResources(); - bool AddWares(const std::map, unsigned>& wares); - bool AddPeople(const std::map, unsigned>& people); + void clearResources(); + bool addWares(const std::map, unsigned>& wares); + bool addPeople(const std::map, unsigned>& people); unsigned getNumBuildings(lua::SafeEnum bld) const; unsigned getNumBuildingSites(lua::SafeEnum bld) const; unsigned getNumWares(lua::SafeEnum ware) const; unsigned getNumPeople(lua::SafeEnum job) const; unsigned getStatisticsValue(lua::SafeEnum stat) const; - bool AIConstructionOrder(unsigned x, unsigned y, lua::SafeEnum bld); - void ModifyHQ(bool isTent); + bool aIConstructionOrder(unsigned x, unsigned y, lua::SafeEnum bld); + void modifyHQ(bool isTent); bool IsDefeated() const; void Surrender(bool destroyBlds); std::pair getHQPos() const; diff --git a/libs/s25main/lua/LuaServerPlayer.cpp b/libs/s25main/lua/LuaServerPlayer.cpp index 342ff164a2..0cab30d16c 100644 --- a/libs/s25main/lua/LuaServerPlayer.cpp +++ b/libs/s25main/lua/LuaServerPlayer.cpp @@ -26,7 +26,7 @@ void LuaServerPlayer::Register(kaguya::State& state) .addFunction("SetNation", &LuaServerPlayer::setNation) .addFunction("SetTeam", &LuaServerPlayer::setTeam) .addFunction("SetColor", &LuaServerPlayer::setColor) - .addFunction("Close", &LuaServerPlayer::Close) + .addFunction("Close", &LuaServerPlayer::close) .addFunction("SetAI", &LuaServerPlayer::setAI) .addFunction("SetName", &LuaServerPlayer::setName) .addFunction("SetPortrait", &LuaServerPlayer::setPortrait)); @@ -55,11 +55,11 @@ void LuaServerPlayer::setColor(unsigned colorOrIdx) lobbyServerController_.setColor(playerId, player.color); } -void LuaServerPlayer::Close() +void LuaServerPlayer::close() { if(player.ps == PlayerState::Locked) return; - lobbyServerController_.CloseSlot(playerId); + lobbyServerController_.closeSlot(playerId); } void LuaServerPlayer::setAI(unsigned level) diff --git a/libs/s25main/lua/LuaServerPlayer.h b/libs/s25main/lua/LuaServerPlayer.h index b879791520..2bfa1f2abb 100644 --- a/libs/s25main/lua/LuaServerPlayer.h +++ b/libs/s25main/lua/LuaServerPlayer.h @@ -27,7 +27,7 @@ class LuaServerPlayer : public LuaPlayerBase void setNation(lua::SafeEnum nat); void setTeam(lua::SafeEnum team); void setColor(unsigned colorOrIdx); - void Close(); + void close(); void setAI(unsigned level); void setName(const std::string& name); void setPortrait(unsigned int portraitIndex); diff --git a/libs/s25main/lua/LuaWorld.cpp b/libs/s25main/lua/LuaWorld.cpp index 349376fbd0..ed0c2cd7db 100644 --- a/libs/s25main/lua/LuaWorld.cpp +++ b/libs/s25main/lua/LuaWorld.cpp @@ -12,8 +12,8 @@ #include "s25util/strAlgos.h" #include -KAGUYA_MEMBER_FUNCTION_OVERLOADS(AddEnvObjectWrapper, LuaWorld, AddEnvObject, 3, 4) -KAGUYA_MEMBER_FUNCTION_OVERLOADS(AddStaticObjectWrapper, LuaWorld, AddStaticObject, 3, 5) +KAGUYA_MEMBER_FUNCTION_OVERLOADS(AddEnvObjectWrapper, LuaWorld, addEnvObject, 3, 4) +KAGUYA_MEMBER_FUNCTION_OVERLOADS(AddStaticObjectWrapper, LuaWorld, addStaticObject, 3, 5) void LuaWorld::Register(kaguya::State& state) { @@ -33,7 +33,7 @@ void LuaWorld::Register(kaguya::State& state) state["World"].setClass(kaguya::UserdataMetatable() .addFunction("AddEnvObject", AddEnvObjectWrapper()) .addFunction("AddStaticObject", AddStaticObjectWrapper()) - .addFunction("AddAnimal", &LuaWorld::AddAnimal) + .addFunction("AddAnimal", &LuaWorld::addAnimal) .addFunction("SetComputerBarrier", &LuaWorld::setComputerBarrier)); } @@ -48,11 +48,11 @@ static bool isValidObject(unsigned file, unsigned id) } } -bool LuaWorld::AddEnvObject(int x, int y, unsigned id, unsigned file /* = 0xFFFF */) +bool LuaWorld::addEnvObject(int x, int y, unsigned id, unsigned file /* = 0xFFFF */) { lua::assertTrue(isValidObject(file, id), "Invalid object (file/id)"); - MapPoint pt = gw.MakeMapPoint(Position(x, y)); + MapPoint pt = gw.makeMapPoint(Position(x, y)); noBase* obj = gw.getNode(pt).obj; if(obj) { @@ -62,18 +62,18 @@ bool LuaWorld::AddEnvObject(int x, int y, unsigned id, unsigned file /* = 0xFFFF return false; } - gw.DestroyNO(pt, false); + gw.destroyNO(pt, false); gw.setNO(pt, new noEnvObject(pt, id, file)); - gw.RecalcBQAroundPoint(pt); + gw.recalcBQAroundPoint(pt); return true; } -bool LuaWorld::AddStaticObject(int x, int y, unsigned id, unsigned file /* = 0xFFFF */, unsigned size /* = 1 */) +bool LuaWorld::addStaticObject(int x, int y, unsigned id, unsigned file /* = 0xFFFF */, unsigned size /* = 1 */) { lua::assertTrue(size <= 2, "Invalid size"); lua::assertTrue(isValidObject(file, id), "Invalid object (file/id)"); - MapPoint pt = gw.MakeMapPoint(Position(x, y)); + MapPoint pt = gw.makeMapPoint(Position(x, y)); noBase* obj = gw.getNode(pt).obj; if(obj) { @@ -83,19 +83,19 @@ bool LuaWorld::AddStaticObject(int x, int y, unsigned id, unsigned file /* = 0xF return false; } - gw.DestroyNO(pt, false); + gw.destroyNO(pt, false); gw.setNO(pt, new noStaticObject(pt, id, file, size)); if(size > 1) - gw.RecalcBQAroundPointBig(pt); + gw.recalcBQAroundPointBig(pt); else if(size == 1) - gw.RecalcBQAroundPoint(pt); + gw.recalcBQAroundPoint(pt); return true; } -void LuaWorld::AddAnimal(int x, int y, lua::SafeEnum species) +void LuaWorld::addAnimal(int x, int y, lua::SafeEnum species) { - MapPoint pos = gw.MakeMapPoint(Position(x, y)); - gw.AddFigure(pos, std::make_unique(species, pos)).StartLiving(); + MapPoint pos = gw.makeMapPoint(Position(x, y)); + gw.addFigure(pos, std::make_unique(species, pos)).startLiving(); } void LuaWorld::setComputerBarrier(unsigned radius, unsigned short x, unsigned short y) diff --git a/libs/s25main/lua/LuaWorld.h b/libs/s25main/lua/LuaWorld.h index 59b600d600..7288aeb61d 100644 --- a/libs/s25main/lua/LuaWorld.h +++ b/libs/s25main/lua/LuaWorld.h @@ -20,8 +20,8 @@ class LuaWorld public: LuaWorld(GameWorld& gw) : gw(gw) {} static void Register(kaguya::State& state); - bool AddEnvObject(int x, int y, unsigned id, unsigned file = 0xFFFF); - bool AddStaticObject(int x, int y, unsigned id, unsigned file = 0xFFFF, unsigned size = 1); - void AddAnimal(int x, int y, lua::SafeEnum species); + bool addEnvObject(int x, int y, unsigned id, unsigned file = 0xFFFF); + bool addStaticObject(int x, int y, unsigned id, unsigned file = 0xFFFF, unsigned size = 1); + void addAnimal(int x, int y, lua::SafeEnum species); void setComputerBarrier(unsigned radius, unsigned short x, unsigned short y); }; diff --git a/libs/s25main/mapGenerator/Algorithms.cpp b/libs/s25main/mapGenerator/Algorithms.cpp index 5d9d34f5c4..4bcb33c3f1 100644 --- a/libs/s25main/mapGenerator/Algorithms.cpp +++ b/libs/s25main/mapGenerator/Algorithms.cpp @@ -7,7 +7,7 @@ namespace rttr::mapGenerator { -void UpdateDistances(NodeMapBase& distances, std::queue& queue) +void updateDistances(NodeMapBase& distances, std::queue& queue) { while(!queue.empty()) { @@ -33,7 +33,7 @@ void UpdateDistances(NodeMapBase& distances, std::queue& que } } -void FlattenForCastleBuilding(NodeMapBase& heightMap, MapPoint pos) +void flattenForCastleBuilding(NodeMapBase& heightMap, MapPoint pos) { const auto& neighbors = heightMap.getNeighbours(pos); const auto& farNeighbors = heightMap.getPointsInRadius(pos, 2); diff --git a/libs/s25main/mapGenerator/Algorithms.h b/libs/s25main/mapGenerator/Algorithms.h index 41576e1647..f8615a8d5e 100644 --- a/libs/s25main/mapGenerator/Algorithms.h +++ b/libs/s25main/mapGenerator/Algorithms.h @@ -63,7 +63,7 @@ void Smooth(unsigned iterations, unsigned radius, NodeMapBase& nodes) } /// Flatten the height map so a castle sized building can be placed at pos -void FlattenForCastleBuilding(NodeMapBase& heightMap, MapPoint pos); +void flattenForCastleBuilding(NodeMapBase& heightMap, MapPoint pos); /** * Maps the values to the specified range [minimum, maximum]. @@ -73,7 +73,7 @@ void FlattenForCastleBuilding(NodeMapBase& heightMap, MapPoint pos); * @param maximum maximum value to map any values to */ template -void Scale(NodeMapBase& values, T minimum, T maximum) +void scale(NodeMapBase& values, T minimum, T maximum) { auto range = GetRange(values); auto actualRange = range.getDifference(); @@ -147,7 +147,7 @@ std::vector Collect(const MapBase& map, const MapPoint& pt, T&& evalua * @param distances distance map which is being updated * @param queue queue with initial elements to used for distance computation */ -void UpdateDistances(NodeMapBase& distances, std::queue& queue); +void updateDistances(NodeMapBase& distances, std::queue& queue); /** * Computes a map of distance values describing the distance of each grid position to the closest flagged point. @@ -162,7 +162,7 @@ NodeMapBase DistancesTo(const T_Container& flaggedPoints, const MapExt { std::queue queue; NodeMapBase distances; - distances.Resize(size, unsigned(-1)); + distances.resize(size, unsigned(-1)); for(const MapPoint& pt : flaggedPoints) { @@ -170,7 +170,7 @@ NodeMapBase DistancesTo(const T_Container& flaggedPoints, const MapExt queue.push(pt); } - UpdateDistances(distances, queue); + updateDistances(distances, queue); return distances; } @@ -199,7 +199,7 @@ NodeMapBase Distances(const MapExtent& size, const T_Container& area, { std::queue queue; NodeMapBase distances; - distances.Resize(size, defaultValue); + distances.resize(size, defaultValue); for(const MapPoint& pt : area) { @@ -213,7 +213,7 @@ NodeMapBase Distances(const MapExtent& size, const T_Container& area, } } - UpdateDistances(distances, queue); + updateDistances(distances, queue); return distances; } diff --git a/libs/s25main/mapGenerator/Harbors.cpp b/libs/s25main/mapGenerator/Harbors.cpp index 546306c667..11fcf81ee0 100644 --- a/libs/s25main/mapGenerator/Harbors.cpp +++ b/libs/s25main/mapGenerator/Harbors.cpp @@ -10,16 +10,16 @@ namespace rttr::mapGenerator { -void PlaceHarborPosition(Map& map, const MapPoint& position) +void placeHarborPosition(Map& map, const MapPoint& position) { - FlattenForCastleBuilding(map.z, position); + flattenForCastleBuilding(map.z, position); auto& textures = map.textureMap; auto harborTexture = textures.Find(isBuildableCoast); auto triangles = GetTriangles(position, map.size); - auto isWater = [&textures](const MapPoint& pt) { return textures.Any(pt, IsWater); }; + auto isWater = [&textures](const MapPoint& pt) { return textures.any(pt, IsWater); }; for(const Triangle& triangle : triangles) { @@ -41,8 +41,8 @@ std::vector> FindCoastlines(const Map& map, const std::vec std::set visited; const auto isCoast = [&map](const MapPoint& pt) { - const auto allWater = [&map](const MapPoint& p) { return map.textureMap.All(p, IsWater); }; - return map.textureMap.Any(pt, isLand) && map.textureMap.Any(pt, IsWater) + const auto allWater = [&map](const MapPoint& p) { return map.textureMap.all(p, IsWater); }; + return map.textureMap.any(pt, isLand) && map.textureMap.any(pt, IsWater) && helpers::contains_if(map.getTextures().getNeighbours(pt), allWater); }; @@ -70,7 +70,7 @@ std::vector> FindCoastlines(const Map& map, const std::vec return coasts; } -void PlaceHarbors(Map& map, const std::vector& rivers, int coastSize, int nodesPerHarbor) +void placeHarbors(Map& map, const std::vector& rivers, int coastSize, int nodesPerHarbor) { const auto coasts = FindCoastlines(map, rivers); std::vector harbors; @@ -86,10 +86,10 @@ void PlaceHarbors(Map& map, const std::vector& rivers, int coastSize, int const auto distanceToHarbors = [&map, &harbors, maxDistance](const MapPoint& pt) { const auto calcDistance = [pt, &map](const MapPoint& hp1, const MapPoint& hp2) { - return map.getTextures().CalcDistance(hp1, pt) < map.getTextures().CalcDistance(hp2, pt); + return map.getTextures().calcDistance(hp1, pt) < map.getTextures().calcDistance(hp2, pt); }; const auto closestHarbor = std::min_element(harbors.begin(), harbors.end(), calcDistance); - return closestHarbor == harbors.end() ? maxDistance : map.getTextures().CalcDistance(pt, *closestHarbor); + return closestHarbor == harbors.end() ? maxDistance : map.getTextures().calcDistance(pt, *closestHarbor); }; const auto compareHarbors = [&distanceToHarbors](const MapPoint& p1, const MapPoint& p2) { return distanceToHarbors(p1) < distanceToHarbors(p2); @@ -101,7 +101,7 @@ void PlaceHarbors(Map& map, const std::vector& rivers, int coastSize, int if(harbor != coast.end()) { harbors.push_back(*harbor); - PlaceHarborPosition(map, *harbor); + placeHarborPosition(map, *harbor); } } } diff --git a/libs/s25main/mapGenerator/Harbors.h b/libs/s25main/mapGenerator/Harbors.h index 9afe167002..1012d56a60 100644 --- a/libs/s25main/mapGenerator/Harbors.h +++ b/libs/s25main/mapGenerator/Harbors.h @@ -14,7 +14,7 @@ namespace rttr::mapGenerator { * @param map reference to the map to place the harbor position on * @param position position for the harbor */ -void PlaceHarborPosition(Map& map, const MapPoint& position); +void placeHarborPosition(Map& map, const MapPoint& position); /** * Finds all connected nodes which are part of a coastline. A coast node must fulfill following three criteria: @@ -35,6 +35,6 @@ std::vector> FindCoastlines(const Map& map, const std::vec * @param coastSize minimum number of nodes a coastline requires to be considered for harbor positions * @param nodesPerHarbor number of coast nodes required per harbor position */ -void PlaceHarbors(Map& map, const std::vector& rivers, int coastSize = 32, int nodesPerHarbor = 64); +void placeHarbors(Map& map, const std::vector& rivers, int coastSize = 32, int nodesPerHarbor = 64); } // namespace rttr::mapGenerator diff --git a/libs/s25main/mapGenerator/HeadQuarters.cpp b/libs/s25main/mapGenerator/HeadQuarters.cpp index f51ea2ce48..96c1d1fcae 100644 --- a/libs/s25main/mapGenerator/HeadQuarters.cpp +++ b/libs/s25main/mapGenerator/HeadQuarters.cpp @@ -14,7 +14,7 @@ std::vector FindLargestConnectedArea(const Map& map) std::set visited; std::vector connectedArea; - auto partiallyBuildable = [&map](const MapPoint& pt) { return map.textureMap.Any(pt, isBuildableLand); }; + auto partiallyBuildable = [&map](const MapPoint& pt) { return map.textureMap.any(pt, isBuildableLand); }; auto partiallyConnected = [&map, &partiallyBuildable](const MapPoint& pt) { return helpers::contains_if(map.getTextures().getNeighbours(pt), partiallyBuildable); @@ -37,12 +37,12 @@ std::vector FindLargestConnectedArea(const Map& map) // added before due to allowing tiny rivers to be part of // connected areas - helpers::erase_if(connectedArea, [&map](const MapPoint& pt) { return map.textureMap.Any(pt, IsWater); }); + helpers::erase_if(connectedArea, [&map](const MapPoint& pt) { return map.textureMap.any(pt, IsWater); }); return connectedArea; } -void PlaceHeadquarters(Map& map, RandomUtility& rnd, int number, MountainDistance distance, int retries) +void placeHeadquarters(Map& map, RandomUtility& rnd, int number, MountainDistance distance, int retries) { auto maxRetries = retries; auto success = false; @@ -64,7 +64,7 @@ void PlaceHeadquarters(Map& map, RandomUtility& rnd, int number, MountainDistanc break; } - auto hq = retries == maxRetries ? possiblePositions.front() : rnd.RandomItem(possiblePositions); + auto hq = retries == maxRetries ? possiblePositions.front() : rnd.randomItem(possiblePositions); map.hqPositions.push_back(hq); } @@ -75,7 +75,7 @@ void PlaceHeadquarters(Map& map, RandomUtility& rnd, int number, MountainDistanc if(!success) throw std::runtime_error("Could not find any valid HQ position!"); for(const MapPoint hqPos : map.hqPositions) - FlattenForCastleBuilding(map.z, hqPos); + flattenForCastleBuilding(map.z, hqPos); } } // namespace rttr::mapGenerator diff --git a/libs/s25main/mapGenerator/HeadQuarters.h b/libs/s25main/mapGenerator/HeadQuarters.h index bd310e3073..5047e71ead 100644 --- a/libs/s25main/mapGenerator/HeadQuarters.h +++ b/libs/s25main/mapGenerator/HeadQuarters.h @@ -50,7 +50,7 @@ std::vector FindHqPositions(const Map& map, const T_Container& area, M // 1. look for points within a buildable area of radius 2 (min. req. of HQ) const auto obstacleDistance = DistancesTo(map.size, [&map](const MapPoint& pt) { - return map.textureMap.Any(pt, [](auto t) { return !t.Is(ETerrain::Buildable); }); + return map.textureMap.any(pt, [](auto t) { return !t.Is(ETerrain::Buildable); }); }); const auto hasEnoughSpace = [&obstacleDistance](const MapPoint& pt) { return obstacleDistance[pt] >= 2; }; std::vector possiblePositions; @@ -83,7 +83,7 @@ std::vector FindHqPositions(const Map& map, const T_Container& area, M } // 5. sort remaining points by how close they're to desired mountain distance - const auto mountain = [&map](const MapPoint& pt) { return map.textureMap.Any(pt, isMinableMountain); }; + const auto mountain = [&map](const MapPoint& pt) { return map.textureMap.any(pt, isMinableMountain); }; const auto mountainDistances = DistancesTo(map.size, mountain); const auto desiredDistance = static_cast(distance); const auto desiredDistanceOffset = [&mountainDistances, desiredDistance](const MapPoint& pt) { @@ -113,7 +113,7 @@ void PlaceHeadquarter(Map& map, const T_Container& area, MountainDistance distan const auto positions = FindHqPositions(map, area, distance); if(positions.empty()) throw std::runtime_error("Could not find any valid HQ position!"); - FlattenForCastleBuilding(map.z, positions.front()); + flattenForCastleBuilding(map.z, positions.front()); map.hqPositions.push_back(positions.front()); } @@ -128,6 +128,6 @@ void PlaceHeadquarter(Map& map, const T_Container& area, MountainDistance distan * * @throw runtime_error */ -void PlaceHeadquarters(Map& map, RandomUtility& rnd, int number, MountainDistance distance, int retries = 10); +void placeHeadquarters(Map& map, RandomUtility& rnd, int number, MountainDistance distance, int retries = 10); } // namespace rttr::mapGenerator diff --git a/libs/s25main/mapGenerator/Islands.cpp b/libs/s25main/mapGenerator/Islands.cpp index 4ad749b4fa..54b4cfaa22 100644 --- a/libs/s25main/mapGenerator/Islands.cpp +++ b/libs/s25main/mapGenerator/Islands.cpp @@ -8,7 +8,7 @@ namespace rttr::mapGenerator { -Island CreateIsland(Map& map, RandomUtility& rnd, unsigned size, unsigned minLandDist, double mountainCoverage) +Island createIsland(Map& map, RandomUtility& rnd, unsigned size, unsigned minLandDist, double mountainCoverage) { Island island; @@ -18,14 +18,14 @@ Island CreateIsland(Map& map, RandomUtility& rnd, unsigned size, unsigned minLan const unsigned minDistance = std::min(maxDistance, minLandDist * 10); const auto possibleCenters = SelectPoints( [&distances, minDistance](const MapPoint& pt) { return distances[pt] >= minDistance; }, distances.getSize()); - const MapPoint center = rnd.RandomItem(possibleCenters); + const MapPoint center = rnd.randomItem(possibleCenters); const auto compare = [&distances, ¢er](const MapPoint& rhs, const MapPoint& lhs) { // computes prefered extension points for the island by considering distance to // center of the island and maximizing distance to other land - const auto ratioRhs = distances[rhs] - distances.CalcDistance(center, rhs); - const auto ratioLhs = distances[lhs] - distances.CalcDistance(center, lhs); + const auto ratioRhs = distances[rhs] - distances.calcDistance(center, rhs); + const auto ratioLhs = distances[lhs] - distances.calcDistance(center, lhs); return ratioRhs < ratioLhs; }; @@ -65,7 +65,7 @@ Island CreateIsland(Map& map, RandomUtility& rnd, unsigned size, unsigned minLan for(const MapPoint& pt : island) { const auto base = map.height.minimum + coastDistance[pt]; - const auto minimum = rnd.RandomValue(base, base + 1u); + const auto minimum = rnd.randomValue(base, base + 1u); map.z[pt] = std::min(static_cast(minimum), map.height.maximum); } @@ -76,7 +76,7 @@ Island CreateIsland(Map& map, RandomUtility& rnd, unsigned size, unsigned minLan auto textures = map.textureMap.FindAll(isBuildableLand); auto textureRange = ValueRange(0u, mountainLevel); - map.textureMap.Sort(textures, ByHumidity); + map.textureMap.sort(textures, byHumidity); for(const MapPoint& pt : island) { diff --git a/libs/s25main/mapGenerator/Islands.h b/libs/s25main/mapGenerator/Islands.h index b77f41049b..d024071b7c 100644 --- a/libs/s25main/mapGenerator/Islands.h +++ b/libs/s25main/mapGenerator/Islands.h @@ -23,6 +23,6 @@ using Island = std::set; * * @returns a vector of nodes the new island covers. */ -Island CreateIsland(Map& map, RandomUtility& rnd, unsigned size, unsigned minLandDist, double mountainCoverage); +Island createIsland(Map& map, RandomUtility& rnd, unsigned size, unsigned minLandDist, double mountainCoverage); } // namespace rttr::mapGenerator diff --git a/libs/s25main/mapGenerator/Map.cpp b/libs/s25main/mapGenerator/Map.cpp index de9238ebb5..6952f9a96a 100644 --- a/libs/s25main/mapGenerator/Map.cpp +++ b/libs/s25main/mapGenerator/Map.cpp @@ -16,14 +16,14 @@ Map::Map(const MapExtent& size, uint8_t players, const WorldDescription& worldDe : textureMap(TextureMap(worldDesc, landscape, size)), name("Random"), author("Auto"), height(0, maxHeight), players(players), size(size) { - z.Resize(size); - objectTypes.Resize(size, libsiedler2::OT_Empty); - objectInfos.Resize(size, libsiedler2::OI_Empty); - resources.Resize(size, libsiedler2::R_None); - animals.Resize(size, libsiedler2::Animal::None); + z.resize(size); + objectTypes.resize(size, libsiedler2::OT_Empty); + objectInfos.resize(size, libsiedler2::OI_Empty); + resources.resize(size, libsiedler2::R_None); + animals.resize(size, libsiedler2::Animal::None); } -libsiedler2::Archiv Map::CreateArchiv() const +libsiedler2::Archiv Map::createArchiv() const { // create header information for the archiv auto header = std::make_unique(); @@ -36,7 +36,7 @@ libsiedler2::Archiv Map::CreateArchiv() const if(players != hqPositions.size()) throw std::logic_error("Not all players have an HQ set"); - RTTR_Assert(!helpers::contains(hqPositions, MapPoint::Invalid())); + RTTR_Assert(!helpers::contains(hqPositions, MapPoint::invalid())); // First players go into the header const unsigned numPlayersInHeader = std::min(static_cast(header->maxPlayers), static_cast(hqPositions.size())); diff --git a/libs/s25main/mapGenerator/Map.h b/libs/s25main/mapGenerator/Map.h index 5ad3da5c54..bfe24a1c4f 100644 --- a/libs/s25main/mapGenerator/Map.h +++ b/libs/s25main/mapGenerator/Map.h @@ -45,7 +45,7 @@ class Map * * @return a new archiv containing the information of this map */ - libsiedler2::Archiv CreateArchiv() const; + libsiedler2::Archiv createArchiv() const; NodeMapBase& getTextures() { return textureMap.textures_; } const NodeMapBase& getTextures() const { return textureMap.textures_; } diff --git a/libs/s25main/mapGenerator/MapSettings.cpp b/libs/s25main/mapGenerator/MapSettings.cpp index a7fc1700a0..237ec5d14f 100644 --- a/libs/s25main/mapGenerator/MapSettings.cpp +++ b/libs/s25main/mapGenerator/MapSettings.cpp @@ -8,7 +8,7 @@ namespace rttr::mapGenerator { -void MapSettings::MakeValid() +void MapSettings::makeValid() { if(name.empty()) name = "Random"; diff --git a/libs/s25main/mapGenerator/MapSettings.h b/libs/s25main/mapGenerator/MapSettings.h index 4558255f60..1a5d6413e7 100644 --- a/libs/s25main/mapGenerator/MapSettings.h +++ b/libs/s25main/mapGenerator/MapSettings.h @@ -39,7 +39,7 @@ enum class IslandAmount : uint8_t struct MapSettings { - void MakeValid(); + void makeValid(); std::string name, author; unsigned numPlayers = 2; diff --git a/libs/s25main/mapGenerator/RandomMap.cpp b/libs/s25main/mapGenerator/RandomMap.cpp index b302748e78..efe617ac53 100644 --- a/libs/s25main/mapGenerator/RandomMap.cpp +++ b/libs/s25main/mapGenerator/RandomMap.cpp @@ -110,41 +110,41 @@ unsigned getSmoothIterations(const MapExtent& size) return 13; } -void SmoothHeightMap(NodeMapBase& z, const ValueRange& range) +void smoothHeightMap(NodeMapBase& z, const ValueRange& range) { int radius = getSmoothRadius(z.getSize()); int iterations = getSmoothIterations(z.getSize()); Smooth(iterations, radius, z); - Scale(z, range.minimum, range.maximum); + scale(z, range.minimum, range.maximum); } RandomMap::RandomMap(RandomUtility& rnd, Map& map) : rnd_(rnd), map_(map), texturizer_(map.z, map.getTextures(), map.textureMap) {} -void RandomMap::Create(const MapSettings& settings) +void RandomMap::create(const MapSettings& settings) { auto defaultHeight = map_.height.minimum + map_.height.getDifference() / 2; settings_ = settings; - map_.z.Resize(settings.size, defaultHeight); + map_.z.resize(settings.size, defaultHeight); switch(settings.style) { - case MapStyle::Water: CreateWaterMap(); break; + case MapStyle::Water: createWaterMap(); break; - case MapStyle::Mixed: CreateMixedMap(); break; + case MapStyle::Mixed: createMixedMap(); break; - case MapStyle::Land: CreateLandMap(); break; + case MapStyle::Land: createLandMap(); break; } - AddObjects(map_, rnd_, settings_); - AddResources(map_, rnd_, settings_); - AddAnimals(map_, rnd_); + addObjects(map_, rnd_, settings_); + addResources(map_, rnd_, settings_); + addAnimals(map_, rnd_); } -std::vector RandomMap::CreateRivers(const MapPoint source) +std::vector RandomMap::createRivers(const MapPoint source) { std::vector rivers; @@ -153,79 +153,79 @@ std::vector RandomMap::CreateRivers(const MapPoint source) for(const auto dir : helpers::EnumRange()) { - if(rnd_.ByChance(settings_.rivers)) + if(rnd_.byChance(settings_.rivers)) { - const unsigned splitRate = rnd_.RandomValue(0u, 2u); + const unsigned splitRate = rnd_.randomValue(0u, 2u); rivers.push_back( - CreateStream(rnd_, map_, source.isValid() ? source : rnd_.Point(map_.size), dir, length, splitRate)); + createStream(rnd_, map_, source.isValid() ? source : rnd_.Point(map_.size), dir, length, splitRate)); } } return rivers; } -void RandomMap::CreateFreeIslands(unsigned waterNodes) +void RandomMap::createFreeIslands(unsigned waterNodes) { const auto islandRadius = getIslandRadius(map_.size); const auto islandAmount = static_cast(settings_.islands) / 100; const auto maxIslandSize = getIslandSize(map_.size); const auto minIslandSize = std::min(200u, maxIslandSize); auto islandNodes = static_cast(islandAmount * waterNodes); - auto islandSize = rnd_.RandomValue(minIslandSize, maxIslandSize); + auto islandSize = rnd_.randomValue(minIslandSize, maxIslandSize); while(islandNodes >= islandSize) { islandNodes -= islandSize; - CreateIsland(map_, rnd_, islandSize, islandRadius, .2); - islandSize = rnd_.RandomValue(minIslandSize, maxIslandSize); + createIsland(map_, rnd_, islandSize, islandRadius, .2); + islandSize = rnd_.randomValue(minIslandSize, maxIslandSize); } } -void RandomMap::CreateMixedMap() +void RandomMap::createMixedMap() { const auto center = rnd_.Point(map_.size); - const unsigned maxDistance = map_.z.CalcMaxDistance(); + const unsigned maxDistance = map_.z.calcMaxDistance(); - Restructure(map_, [this, ¢er, maxDistance](const MapPoint& pt) { - auto weight = 1. - static_cast(map_.z.CalcDistance(pt, center)) / maxDistance; + restructure(map_, [this, ¢er, maxDistance](const MapPoint& pt) { + auto weight = 1. - static_cast(map_.z.calcDistance(pt, center)) / maxDistance; auto percentage = static_cast(12 * weight); - return rnd_.ByChance(percentage); + return rnd_.byChance(percentage); }); - SmoothHeightMap(map_.z, map_.height); + smoothHeightMap(map_.z, map_.height); const double sea = 0.5; const double mountain = 0.1; const double land = 1. - sea - mountain; - ResetSeaLevel(map_, rnd_, LimitFor(map_.z, sea, map_.height.minimum)); + resetSeaLevel(map_, rnd_, LimitFor(map_.z, sea, map_.height.minimum)); const auto mountainLevel = LimitFor(map_.z, land, static_cast(map_.height.minimum + 1)) + 1; - const auto rivers = CreateRivers(center); + const auto rivers = createRivers(center); const unsigned waterNodes = helpers::count(map_.z, map_.height.minimum); - CreateFreeIslands(waterNodes); + createFreeIslands(waterNodes); - texturizer_.AddTextures(mountainLevel, getCoastline(map_.size)); + texturizer_.addTextures(mountainLevel, getCoastline(map_.size)); - PlaceHarbors(map_, rivers); - PlaceHeadquarters(map_, rnd_, map_.players, settings_.mountainDistance); + placeHarbors(map_, rivers); + placeHeadquarters(map_, rnd_, map_.players, settings_.mountainDistance); } -void RandomMap::CreateWaterMap() +void RandomMap::createWaterMap() { const auto center = rnd_.Point(map_.size); - const unsigned maxDistance = map_.z.CalcMaxDistance(); + const unsigned maxDistance = map_.z.calcMaxDistance(); - Restructure(map_, [this, ¢er, maxDistance](const MapPoint& pt) { - const auto weight = 1. - static_cast(map_.z.CalcDistance(pt, center)) / maxDistance; + restructure(map_, [this, ¢er, maxDistance](const MapPoint& pt) { + const auto weight = 1. - static_cast(map_.z.calcDistance(pt, center)) / maxDistance; const auto percentage = static_cast(15 * weight * weight); - return rnd_.ByChance(percentage); + return rnd_.byChance(percentage); }); - SmoothHeightMap(map_.z, map_.height); + smoothHeightMap(map_.z, map_.height); const double sea = 0.80; // 20% of map is center island (100% - 80% water) const double mountain = 0.05; // 20% of center island is mountain (5% of 20% land) const auto seaLevel = LimitFor(map_.z, sea, map_.height.minimum); - ResetSeaLevel(map_, rnd_, seaLevel); + resetSeaLevel(map_, rnd_, seaLevel); const unsigned waterNodes = helpers::count(map_.z, map_.height.minimum); const auto land = 1. - static_cast(waterNodes) / (map_.size.x * map_.size.y) - mountain; @@ -237,19 +237,19 @@ void RandomMap::CreateWaterMap() for(unsigned i = 0; i < map_.players; i++) { - islands[i] = CreateIsland(map_, rnd_, islandSize, islandRadius, .2); + islands[i] = createIsland(map_, rnd_, islandSize, islandRadius, .2); } if(waterNodes > map_.players * islandSize) { - CreateFreeIslands(waterNodes - map_.players * islandSize); + createFreeIslands(waterNodes - map_.players * islandSize); } - const auto rivers = CreateRivers(center); + const auto rivers = createRivers(center); - texturizer_.AddTextures(mountainLevel, getCoastline(map_.size)); + texturizer_.addTextures(mountainLevel, getCoastline(map_.size)); - PlaceHarbors(map_, rivers); + placeHarbors(map_, rivers); for(unsigned i = 0; i < map_.players; i++) { @@ -257,42 +257,42 @@ void RandomMap::CreateWaterMap() } } -void RandomMap::CreateLandMap() +void RandomMap::createLandMap() { - Restructure(map_, [this](auto&&) { return rnd_.ByChance(5); }); - SmoothHeightMap(map_.z, map_.height); + restructure(map_, [this](auto&&) { return rnd_.byChance(5); }); + smoothHeightMap(map_.z, map_.height); - const double sea = rnd_.RandomDouble(0.1, 0.2); - const double mountain = rnd_.RandomDouble(0.15, 0.4 - sea); + const double sea = rnd_.randomDouble(0.1, 0.2); + const double mountain = rnd_.randomDouble(0.15, 0.4 - sea); const double land = 1. - sea - mountain; - ResetSeaLevel(map_, rnd_, LimitFor(map_.z, sea, map_.height.minimum)); + resetSeaLevel(map_, rnd_, LimitFor(map_.z, sea, map_.height.minimum)); const auto mountainLevel = LimitFor(map_.z, land, static_cast(1)) + 1; - CreateRivers(); + createRivers(); - texturizer_.AddTextures(mountainLevel, getCoastline(map_.size)); + texturizer_.addTextures(mountainLevel, getCoastline(map_.size)); - PlaceHeadquarters(map_, rnd_, map_.players, settings_.mountainDistance); + placeHeadquarters(map_, rnd_, map_.players, settings_.mountainDistance); } -Map GenerateRandomMap(RandomUtility& rnd, const WorldDescription& worldDesc, const MapSettings& settings) +Map generateRandomMap(RandomUtility& rnd, const WorldDescription& worldDesc, const MapSettings& settings) { auto height = getMaximumHeight(settings.size); Map map(settings.size, settings.numPlayers, worldDesc, settings.type, height); RandomMap randomMap(rnd, map); - randomMap.Create(settings); + randomMap.create(settings); return map; } -void CreateRandomMap(const boost::filesystem::path& filePath, const MapSettings& settings) +void createRandomMap(const boost::filesystem::path& filePath, const MapSettings& settings) { RandomUtility rnd; WorldDescription worldDesc; loadGameData(worldDesc); - Map map = GenerateRandomMap(rnd, worldDesc, settings); - libsiedler2::Write(filePath, map.CreateArchiv()); + Map map = generateRandomMap(rnd, worldDesc, settings); + libsiedler2::Write(filePath, map.createArchiv()); } } // namespace rttr::mapGenerator diff --git a/libs/s25main/mapGenerator/RandomMap.h b/libs/s25main/mapGenerator/RandomMap.h index b59f9ca320..c5b6e50625 100644 --- a/libs/s25main/mapGenerator/RandomMap.h +++ b/libs/s25main/mapGenerator/RandomMap.h @@ -20,7 +20,7 @@ unsigned getIslandSize(const MapExtent& size); unsigned getSmoothRadius(const MapExtent& size); unsigned getSmoothIterations(const MapExtent& size); -void SmoothHeightMap(NodeMapBase& z, const ValueRange& range); +void smoothHeightMap(NodeMapBase& z, const ValueRange& range); class RandomMap { @@ -30,18 +30,18 @@ class RandomMap Texturizer texturizer_; MapSettings settings_; - std::vector CreateRivers(MapPoint source = MapPoint::Invalid()); - void CreateFreeIslands(unsigned waterNodes); - void CreateMixedMap(); - void CreateLandMap(); - void CreateWaterMap(); + std::vector createRivers(MapPoint source = MapPoint::invalid()); + void createFreeIslands(unsigned waterNodes); + void createMixedMap(); + void createLandMap(); + void createWaterMap(); public: RandomMap(RandomUtility& rnd, Map& map); - void Create(const MapSettings& settings); + void create(const MapSettings& settings); }; -Map GenerateRandomMap(RandomUtility& rnd, const WorldDescription& worldDesc, const MapSettings& settings); -void CreateRandomMap(const boost::filesystem::path& filePath, const MapSettings& settings); +Map generateRandomMap(RandomUtility& rnd, const WorldDescription& worldDesc, const MapSettings& settings); +void createRandomMap(const boost::filesystem::path& filePath, const MapSettings& settings); } // namespace rttr::mapGenerator diff --git a/libs/s25main/mapGenerator/RandomUtility.cpp b/libs/s25main/mapGenerator/RandomUtility.cpp index 5ce6401290..78273a351b 100644 --- a/libs/s25main/mapGenerator/RandomUtility.cpp +++ b/libs/s25main/mapGenerator/RandomUtility.cpp @@ -20,22 +20,22 @@ RandomUtility::RandomUtility(uint64_t seed) rng_.seed(static_cast(seed)); } -bool RandomUtility::ByChance(unsigned percentage) +bool RandomUtility::byChance(unsigned percentage) { - return static_cast(RandomValue(1, 100)) <= percentage; + return static_cast(randomValue(1, 100)) <= percentage; } -unsigned RandomUtility::Index(const size_t& size) +unsigned RandomUtility::index(const size_t& size) { - return RandomValue(0u, static_cast(size - 1)); + return randomValue(0u, static_cast(size - 1)); } MapPoint RandomUtility::Point(const MapExtent& size) { - return MapPoint(Index(size.x), Index(size.y)); + return MapPoint(index(size.x), index(size.y)); } -double RandomUtility::RandomDouble(double min, double max) +double RandomUtility::randomDouble(double min, double max) { std::uniform_real_distribution distr(min, max); return distr(rng_); diff --git a/libs/s25main/mapGenerator/RandomUtility.h b/libs/s25main/mapGenerator/RandomUtility.h index fc50f85676..7785ae1a0c 100644 --- a/libs/s25main/mapGenerator/RandomUtility.h +++ b/libs/s25main/mapGenerator/RandomUtility.h @@ -27,7 +27,7 @@ class RandomUtility * * @param percentage likelihood to return true */ - bool ByChance(unsigned percentage); + bool byChance(unsigned percentage); /** * Generates a random index based on the specified size. @@ -36,7 +36,7 @@ class RandomUtility * * @return a random index based on the specified size. */ - unsigned Index(const size_t& size); + unsigned index(const size_t& size); /** * Creates a random point within the specified size. @@ -55,9 +55,9 @@ class RandomUtility * @returns a random item out of the specified collection of items. */ template - T RandomItem(const std::vector& items) + T randomItem(const std::vector& items) { - return items[Index(items.size())]; + return items[index(items.size())]; } /** @@ -69,7 +69,7 @@ class RandomUtility * @return a random number between min and max (inclusive). */ template - T RandomValue(T min, T max) + T randomValue(T min, T max) { static_assert(std::is_integral_v, "T must be an integral type."); std::uniform_int_distribution distr(min, max); @@ -84,7 +84,7 @@ class RandomUtility * * @return a random float value between min and max (inclusive). */ - double RandomDouble(double min, double max); + double randomDouble(double min, double max); }; } // namespace rttr::mapGenerator diff --git a/libs/s25main/mapGenerator/Resources.cpp b/libs/s25main/mapGenerator/Resources.cpp index 19c798814b..073cc7eaf1 100644 --- a/libs/s25main/mapGenerator/Resources.cpp +++ b/libs/s25main/mapGenerator/Resources.cpp @@ -46,11 +46,11 @@ std::vector CreateTrees(const TextureMap& textures) throw std::invalid_argument("invalid landscape type"); } -void AddObjects(Map& map, RandomUtility& rnd, const MapSettings& settings) +void addObjects(Map& map, RandomUtility& rnd, const MapSettings& settings) { std::set excludedArea; NodeMapBase probabilities; - probabilities.Resize(map.size, 0u); + probabilities.resize(map.size, 0u); // Do not allow to place trees/stone piles nearby head quarters or // harbor positions to avoid inaccessible harbors or invalid player positions. @@ -66,7 +66,7 @@ void AddObjects(Map& map, RandomUtility& rnd, const MapSettings& settings) { auto suroundingArea = map.getTextures().GetPointsInRadiusWithCenter(pt, 5); excludedArea.insert(suroundingArea.begin(), suroundingArea.end()); - } else if(map.textureMap.Any(pt, isSnowOrLava)) + } else if(map.textureMap.any(pt, isSnowOrLava)) { excludedArea.insert(pt); } @@ -84,10 +84,10 @@ void AddObjects(Map& map, RandomUtility& rnd, const MapSettings& settings) // 3b) mountains: last element of trees auto& textureMap = map.textureMap; - const auto mountain = [&textureMap](const MapPoint& pt) { return textureMap.Any(pt, isMountainOrSnowOrLava); }; + const auto mountain = [&textureMap](const MapPoint& pt) { return textureMap.any(pt, isMountainOrSnowOrLava); }; const auto mountainDistance = DistancesTo(map.size, mountain); - const auto water = [&textureMap](const MapPoint& pt) { return textureMap.Any(pt, IsWater); }; + const auto water = [&textureMap](const MapPoint& pt) { return textureMap.any(pt, IsWater); }; auto waterDistance = DistancesTo(map.size, water); RTTR_FOREACH_PT(MapPoint, map.size) @@ -104,7 +104,7 @@ void AddObjects(Map& map, RandomUtility& rnd, const MapSettings& settings) const auto probRange = ValueRange(settings.trees / 2, settings.trees); const unsigned probDiff = probRange.getDifference(); - const auto mountainFoot = [&map](const MapPoint& pt) { return !map.textureMap.All(pt, isMountainOrSnowOrLava); }; + const auto mountainFoot = [&map](const MapPoint& pt) { return !map.textureMap.all(pt, isMountainOrSnowOrLava); }; const auto mountainDepth = DistancesTo(map.size, mountainFoot); const auto mountainRange = GetRange(mountainDepth); @@ -141,25 +141,25 @@ void AddObjects(Map& map, RandomUtility& rnd, const MapSettings& settings) RTTR_FOREACH_PT(MapPoint, map.size) { const bool canPlaceStonePile = waterDistance[pt] > 0 && distanceToExcludedArea[pt] > 0; - if(canPlaceStonePile && rnd.ByChance(settings.stonePiles)) + if(canPlaceStonePile && rnd.byChance(settings.stonePiles)) { - map.objectTypes[pt] = rnd.ByChance(50) ? 0xCC : 0xCD; - map.objectInfos[pt] = rnd.RandomValue(1, 6); + map.objectTypes[pt] = rnd.byChance(50) ? 0xCC : 0xCD; + map.objectInfos[pt] = rnd.randomValue(1, 6); continue; } const auto treeProb = probabilities[pt]; - if(treeProb > 0 && rnd.ByChance(treeProb)) + if(treeProb > 0 && rnd.byChance(treeProb)) { auto tree = treeForPoint(pt); map.objectTypes[pt] = tree.type; - map.objectInfos[pt] = tree.index + rnd.RandomValue(0, 7); + map.objectInfos[pt] = tree.index + rnd.randomValue(0, 7); } } } -void AddResources(Map& map, RandomUtility& rnd, const MapSettings& settings) +void addResources(Map& map, RandomUtility& rnd, const MapSettings& settings) { const auto& textures = map.textureMap; auto& resources = map.resources; @@ -183,7 +183,7 @@ void AddResources(Map& map, RandomUtility& rnd, const MapSettings& settings) // place. Note that we do not perform budget adjustments and checks here. auto resourcePicker = [&]() { int ratio = 0; - int randomNumber = rnd.RandomValue(1, std::max(1, total)); + int randomNumber = rnd.randomValue(1, std::max(1, total)); for(unsigned i = 0; i < mRIs.size(); ++i) { ratio += mRIs[i].ratio; @@ -196,7 +196,7 @@ void AddResources(Map& map, RandomUtility& rnd, const MapSettings& settings) RTTR_FOREACH_PT(MapPoint, map.size) { - if(textures.All(pt, isMinableMountain)) + if(textures.all(pt, isMinableMountain)) { // No mineable resources wanted. if(total == 0) @@ -223,17 +223,17 @@ void AddResources(Map& map, RandomUtility& rnd, const MapSettings& settings) { for(int yd = -4; yd <= 4; ++yd) { - const MapPoint pt_d = resources.MakeMapPoint(pt + Position(xd, yd)); + const MapPoint pt_d = resources.makeMapPoint(pt + Position(xd, yd)); // Only place it on mines that have no resource yet, adjust the budget for each placed // resource. - if(!resources[pt_d] && textures.All(pt_d, isMinableMountain)) + if(!resources[pt_d] && textures.all(pt_d, isMinableMountain)) { --mRI.budget; - resources[pt_d] = mRI.resource + rnd.RandomValue(1, 8); + resources[pt_d] = mRI.resource + rnd.randomValue(1, 8); } } } - } else if(textures.All(pt, IsWater)) + } else if(textures.all(pt, IsWater)) { resources[pt] = libsiedler2::R_Fish; } else @@ -243,7 +243,7 @@ void AddResources(Map& map, RandomUtility& rnd, const MapSettings& settings) } } -void AddAnimals(Map& map, RandomUtility& rnd) +void addAnimals(Map& map, RandomUtility& rnd) { std::vector landAnimals{libsiedler2::Animal::Rabbit, libsiedler2::Animal::Fox, libsiedler2::Animal::Stag, libsiedler2::Animal::Deer, @@ -251,14 +251,14 @@ void AddAnimals(Map& map, RandomUtility& rnd) const auto& textures = map.textureMap; RTTR_FOREACH_PT(MapPoint, map.size) { - if(rnd.ByChance(3)) + if(rnd.byChance(3)) { - if(textures.All(pt, IsWater)) + if(textures.all(pt, IsWater)) { map.animals[pt] = libsiedler2::Animal::Duck; - } else if(textures.All(pt, isLand)) + } else if(textures.all(pt, isLand)) { - map.animals[pt] = rnd.RandomItem(landAnimals); + map.animals[pt] = rnd.randomItem(landAnimals); } } } diff --git a/libs/s25main/mapGenerator/Resources.h b/libs/s25main/mapGenerator/Resources.h index 61af72fa96..bb6770b053 100644 --- a/libs/s25main/mapGenerator/Resources.h +++ b/libs/s25main/mapGenerator/Resources.h @@ -25,10 +25,10 @@ class Tree std::vector CreateTrees(const TextureMap& textures); -void AddObjects(Map& map, RandomUtility& rnd, const MapSettings& settings); +void addObjects(Map& map, RandomUtility& rnd, const MapSettings& settings); -void AddResources(Map& map, RandomUtility& rnd, const MapSettings& settings); +void addResources(Map& map, RandomUtility& rnd, const MapSettings& settings); -void AddAnimals(Map& map, RandomUtility& rnd); +void addAnimals(Map& map, RandomUtility& rnd); } // namespace rttr::mapGenerator diff --git a/libs/s25main/mapGenerator/Rivers.cpp b/libs/s25main/mapGenerator/Rivers.cpp index b2a5126070..7718226979 100644 --- a/libs/s25main/mapGenerator/Rivers.cpp +++ b/libs/s25main/mapGenerator/Rivers.cpp @@ -8,7 +8,7 @@ namespace rttr::mapGenerator { -River CreateStream(RandomUtility& rnd, Map& map, const MapPoint& source, Direction direction, unsigned length, +River createStream(RandomUtility& rnd, Map& map, const MapPoint& source, Direction direction, unsigned length, unsigned splitRate) { const MapExtent& size = map.size; @@ -46,15 +46,15 @@ River CreateStream(RandomUtility& rnd, Map& map, const MapPoint& source, Directi while(currentDir == lastDir || helpers::contains(exlcuded, currentDir)) { - currentDir = lastDir + (rnd.ByChance(50) ? 5 : 1); + currentDir = lastDir + (rnd.byChance(50) ? 5 : 1); } currentNode = map.getTextures().getNeighbour(currentNode, lastDir); - if(rnd.ByChance(splitRate)) + if(rnd.byChance(splitRate)) { - auto splitDirection = direction + (rnd.ByChance(50) ? 5 : 1); - auto anotherRivers = CreateStream(rnd, map, currentNode, splitDirection, length / 2, splitRate / 2); + auto splitDirection = direction + (rnd.byChance(50) ? 5 : 1); + auto anotherRivers = createStream(rnd, map, currentNode, splitDirection, length / 2, splitRate / 2); for(const MapPoint& node : anotherRivers) { diff --git a/libs/s25main/mapGenerator/Rivers.h b/libs/s25main/mapGenerator/Rivers.h index 9571047ce2..d4da3f6599 100644 --- a/libs/s25main/mapGenerator/Rivers.h +++ b/libs/s25main/mapGenerator/Rivers.h @@ -24,7 +24,7 @@ using River = std::set; * * @returns all nodes the stream (incl. split up streams) is covering. */ -River CreateStream(RandomUtility& rnd, Map& map, const MapPoint& source, Direction direction, unsigned length, +River createStream(RandomUtility& rnd, Map& map, const MapPoint& source, Direction direction, unsigned length, unsigned splitRate = 0); } // namespace rttr::mapGenerator diff --git a/libs/s25main/mapGenerator/Terrain.cpp b/libs/s25main/mapGenerator/Terrain.cpp index d48e0f8f9f..12cdeb95af 100644 --- a/libs/s25main/mapGenerator/Terrain.cpp +++ b/libs/s25main/mapGenerator/Terrain.cpp @@ -11,7 +11,7 @@ namespace rttr::mapGenerator { -void Restructure(Map& map, const std::function& predicate, double weight) +void restructure(Map& map, const std::function& predicate, double weight) { auto& z = map.z; const MapExtent& size = map.size; @@ -27,10 +27,10 @@ void Restructure(Map& map, const std::function& predicate z[pt] = static_cast(round(std::pow(value, weight) * z[pt])); } - Scale(z, map.height.minimum, map.height.maximum); + scale(z, map.height.minimum, map.height.maximum); } -void ResetSeaLevel(Map& map, RandomUtility& rnd, unsigned seaLevel) +void resetSeaLevel(Map& map, RandomUtility& rnd, unsigned seaLevel) { auto& z = map.z; @@ -53,7 +53,7 @@ void ResetSeaLevel(Map& map, RandomUtility& rnd, unsigned seaLevel) if(maximum > map.height.maximum) { maximum = map.height.maximum; - Scale(coastDistance, minimum, maximum); + scale(coastDistance, minimum, maximum); } RTTR_FOREACH_PT(MapPoint, map.size) @@ -62,7 +62,7 @@ void ResetSeaLevel(Map& map, RandomUtility& rnd, unsigned seaLevel) { const unsigned base = coastDistance[pt]; - z[pt] = rnd.RandomValue(std::max(minimum + 1, base), std::min(maximum, base + 1)); + z[pt] = rnd.randomValue(std::max(minimum + 1, base), std::min(maximum, base + 1)); } } } diff --git a/libs/s25main/mapGenerator/Terrain.h b/libs/s25main/mapGenerator/Terrain.h index ebcb9e82be..54bd73c622 100644 --- a/libs/s25main/mapGenerator/Terrain.h +++ b/libs/s25main/mapGenerator/Terrain.h @@ -20,7 +20,7 @@ namespace rttr::mapGenerator { * @param weight factor influencing the strength of elevation towards the focused area (default: 2 - quadratic drop * with distance) */ -void Restructure(Map& map, const std::function& predicate, double weight = 2.); +void restructure(Map& map, const std::function& predicate, double weight = 2.); /** * Resets the sea level to "0" by setting all sea nodes to "0" height and scaling the remaining nodes to a range @@ -29,6 +29,6 @@ void Restructure(Map& map, const std::function& predicate * @param map reference to the map * @param seaLevel maximum height sea can reach */ -void ResetSeaLevel(Map& map, RandomUtility& rnd, unsigned seaLevel); +void resetSeaLevel(Map& map, RandomUtility& rnd, unsigned seaLevel); } // namespace rttr::mapGenerator diff --git a/libs/s25main/mapGenerator/TextureHelper.cpp b/libs/s25main/mapGenerator/TextureHelper.cpp index 76e87e31f5..e5431f0ae3 100644 --- a/libs/s25main/mapGenerator/TextureHelper.cpp +++ b/libs/s25main/mapGenerator/TextureHelper.cpp @@ -6,7 +6,7 @@ namespace rttr::mapGenerator { -uint8_t ByHumidity(const TerrainDesc& terrain) +uint8_t byHumidity(const TerrainDesc& terrain) { return terrain.humidity; } diff --git a/libs/s25main/mapGenerator/TextureHelper.h b/libs/s25main/mapGenerator/TextureHelper.h index 9ff03c51ed..c17c82774c 100644 --- a/libs/s25main/mapGenerator/TextureHelper.h +++ b/libs/s25main/mapGenerator/TextureHelper.h @@ -8,7 +8,7 @@ namespace rttr::mapGenerator { -uint8_t ByHumidity(const TerrainDesc& terrain); +uint8_t byHumidity(const TerrainDesc& terrain); bool IsWater(const TerrainDesc& terrain); diff --git a/libs/s25main/mapGenerator/Textures.cpp b/libs/s25main/mapGenerator/Textures.cpp index fcdfb36652..65d52a9946 100644 --- a/libs/s25main/mapGenerator/Textures.cpp +++ b/libs/s25main/mapGenerator/Textures.cpp @@ -44,7 +44,7 @@ DescIdx TextureMap::get(const Triangle& triangle) const } } -std::vector> Texturizer::CreateTextureMapping(unsigned mountainLevel) +std::vector> Texturizer::createTextureMapping(unsigned mountainLevel) { if(seaLevel_ + 2 > mountainLevel) { @@ -55,7 +55,7 @@ std::vector> Texturizer::CreateTextureMapping(unsigned moun std::vector> mapping(maximum + 1); const auto waterTexture = textureMap_.Find(isShipableWater); auto landTextures = textureMap_.FindAll(isBuildableLand); - textureMap_.Sort(landTextures, ByHumidity); + textureMap_.sort(landTextures, byHumidity); auto mountainTextures = textureMap_.FindAll(isMinableMountain); mountainTextures.push_back(textureMap_.Find(isSnowOrLava)); @@ -78,9 +78,9 @@ std::vector> Texturizer::CreateTextureMapping(unsigned moun return mapping; } -void Texturizer::ApplyTexturingByHeightMap(unsigned mountainLevel) +void Texturizer::applyTexturingByHeightMap(unsigned mountainLevel) { - const auto& mapping = CreateTextureMapping(mountainLevel); + const auto& mapping = createTextureMapping(mountainLevel); const MapExtent size = z_.getSize(); const auto& z = z_; @@ -102,7 +102,7 @@ void Texturizer::ApplyTexturingByHeightMap(unsigned mountainLevel) } } -void Texturizer::ApplyCoastTexturing(const std::vector& coast, unsigned width) +void Texturizer::applyCoastTexturing(const std::vector& coast, unsigned width) { std::set visited; std::copy(coast.begin(), coast.end(), std::inserter(visited, visited.begin())); @@ -110,7 +110,7 @@ void Texturizer::ApplyCoastTexturing(const std::vector& coast, unsigne // setup transition textures from water to land auto sand = textureMap_.Find(isCoastTerrain); auto sandGrass = textureMap_.FindAll(isBuildableCoast); - textureMap_.Sort(sandGrass, ByHumidity); + textureMap_.sort(sandGrass, byHumidity); std::array, 3> transitionTextures{sand, sandGrass[0], sandGrass[1]}; // exclude mountain & water textures from being replaced by water-land transition @@ -124,14 +124,14 @@ void Texturizer::ApplyCoastTexturing(const std::vector& coast, unsigne { // for nodes covered by water & coast, replace only neighboring coast textures unsigned appliedWidth = width - (i == 0 ? 1 : 0); - ReplaceTextures(textures_, appliedWidth, visited, transitionTextures[i], excludedTextures); + replaceTextures(textures_, appliedWidth, visited, transitionTextures[i], excludedTextures); // don't replace already applied transition textures excludedTextures.insert(transitionTextures[i]); } } -void Texturizer::ApplyMountainTransitions(const std::vector& mountainFoot) +void Texturizer::applyMountainTransitions(const std::vector& mountainFoot) { std::set> excludedTextures{textureMap_.Find(isShipableWater)}; @@ -146,57 +146,57 @@ void Texturizer::ApplyMountainTransitions(const std::vector& mountainF for(const MapPoint& point : mountainFoot) { - ReplaceTextureForPoint(textures_, point, mountainTransition, excludedTextures); + replaceTextureForPoint(textures_, point, mountainTransition, excludedTextures); } } -void Texturizer::ApplyMountainWaterTransitions(const std::vector& transitions) +void Texturizer::applyMountainWaterTransitions(const std::vector& transitions) { std::set nodes; nodes.insert(transitions.begin(), transitions.end()); const auto water = textureMap_.Find(IsWater); const auto boulder = textureMap_.Find(isBuildableMountain); const auto swamp = textureMap_.Find(isSwamp); - ReplaceTextures(textures_, 0, nodes, swamp, {water}); - ReplaceTextures(textures_, 1, nodes, boulder, {swamp, water}); + replaceTextures(textures_, 0, nodes, swamp, {water}); + replaceTextures(textures_, 1, nodes, boulder, {swamp, water}); } -void Texturizer::AddTextures(unsigned mountainLevel, unsigned coastline) +void Texturizer::addTextures(unsigned mountainLevel, unsigned coastline) { - ApplyTexturingByHeightMap(mountainLevel); + applyTexturingByHeightMap(mountainLevel); auto coast = SelectPoints( - [this](const MapPoint& pt) { return this->textureMap_.Any(pt, isLand) && this->textureMap_.Any(pt, IsWater); }, + [this](const MapPoint& pt) { return this->textureMap_.any(pt, isLand) && this->textureMap_.any(pt, IsWater); }, this->textures_.getSize()); - ApplyCoastTexturing(coast, 1); // small for tiny rivers + applyCoastTexturing(coast, 1); // small for tiny rivers auto isRiver = [this](const MapPoint& pt) { - auto suroundedByWater = [this](const MapPoint& pt) { return this->textureMap_.All(pt, IsWater); }; + auto suroundedByWater = [this](const MapPoint& pt) { return this->textureMap_.all(pt, IsWater); }; return !helpers::contains_if(this->textures_.getNeighbours(pt), suroundedByWater); }; helpers::erase_if(coast, isRiver); - ApplyCoastTexturing(coast, coastline); + applyCoastTexturing(coast, coastline); const auto mountainFoot = SelectPoints( [this](const MapPoint& pt) { - return this->textureMap_.Any(pt, isMinableMountain) && !this->textureMap_.All(pt, isMountainOrSnowOrLava); + return this->textureMap_.any(pt, isMinableMountain) && !this->textureMap_.all(pt, isMountainOrSnowOrLava); }, this->textures_.getSize()); - ApplyMountainTransitions(mountainFoot); + applyMountainTransitions(mountainFoot); const auto moutainWaterTransition = SelectPoints( [this](const MapPoint& pt) { - return this->textureMap_.Any(pt, isMinableMountain) && this->textureMap_.Any(pt, IsWater); + return this->textureMap_.any(pt, isMinableMountain) && this->textureMap_.any(pt, IsWater); }, this->textures_.getSize()); - ApplyMountainWaterTransitions(moutainWaterTransition); + applyMountainWaterTransitions(moutainWaterTransition); } -void ReplaceTextureForPoint(NodeMapBase& textures, const MapPoint& point, DescIdx texture, +void replaceTextureForPoint(NodeMapBase& textures, const MapPoint& point, DescIdx texture, const std::set>& excluded) { auto triangles = GetTriangles(point, textures.getSize()); @@ -213,14 +213,14 @@ void ReplaceTextureForPoint(NodeMapBase& textures, const MapPoint& } } -void ReplaceTextures(NodeMapBase& textures, unsigned radius, std::set& nodes, +void replaceTextures(NodeMapBase& textures, unsigned radius, std::set& nodes, DescIdx texture, const std::set>& excluded) { if(radius == 0) { for(const MapPoint& pt : nodes) { - ReplaceTextureForPoint(textures, pt, texture, excluded); + replaceTextureForPoint(textures, pt, texture, excluded); } return; @@ -234,7 +234,7 @@ void ReplaceTextures(NodeMapBase& textures, unsigned radius, std::s for(const MapPoint& p : points) { - ReplaceTextureForPoint(textures, p, texture, excluded); + replaceTextureForPoint(textures, p, texture, excluded); nodes.insert(p); } } diff --git a/libs/s25main/mapGenerator/Textures.h b/libs/s25main/mapGenerator/Textures.h index ebc6e6bf86..42b92a2d32 100644 --- a/libs/s25main/mapGenerator/Textures.h +++ b/libs/s25main/mapGenerator/Textures.h @@ -65,7 +65,7 @@ class TextureOperator } template - void Sort(std::vector>& textures, T_SortBy sortBy) const + void sort(std::vector>& textures, T_SortBy sortBy) const { auto lessThan = [this, &sortBy](const auto& t1, const auto& t2) { return sortBy(worldDesc_.get(t1)) < sortBy(worldDesc_.get(t2)); @@ -75,7 +75,7 @@ class TextureOperator } template - bool Check(DescIdx texture, T_Predicate predicate) const + bool check(DescIdx texture, T_Predicate predicate) const { return predicate(worldDesc_.get(texture)); } @@ -89,32 +89,32 @@ class TextureMap : public TextureOperator TextureMap(const WorldDescription& worldDesc, DescIdx landscape, const MapExtent& size) : TextureOperator(worldDesc, landscape) { - textures_.Resize(size); + textures_.resize(size); } template - bool Check(const Triangle& triangle, T_Predicate predicate) const + bool check(const Triangle& triangle, T_Predicate predicate) const { if(triangle.rsu) { - return TextureOperator::Check(textures_[triangle.position].rsu, predicate); + return TextureOperator::check(textures_[triangle.position].rsu, predicate); } else { - return TextureOperator::Check(textures_[triangle.position].lsd, predicate); + return TextureOperator::check(textures_[triangle.position].lsd, predicate); } } template - bool Any(const MapPoint& point, T_Predicate predicate) const + bool any(const MapPoint& point, T_Predicate predicate) const { - auto condition = [this, &predicate](auto triangle) { return this->Check(triangle, predicate); }; + auto condition = [this, &predicate](auto triangle) { return this->check(triangle, predicate); }; return helpers::contains_if(GetTriangles(point, textures_.getSize()), condition); } template - bool All(const MapPoint& point, T_Predicate predicate) const + bool all(const MapPoint& point, T_Predicate predicate) const { - auto condition = [this, &predicate](auto triangle) { return !this->Check(triangle, predicate); }; + auto condition = [this, &predicate](auto triangle) { return !this->check(triangle, predicate); }; return !helpers::contains_if(GetTriangles(point, textures_.getSize()), condition); } @@ -159,14 +159,14 @@ class Texturizer * * @returns a vector of textures with each index representing a z-value. */ - std::vector> CreateTextureMapping(unsigned mountainLevel); + std::vector> createTextureMapping(unsigned mountainLevel); /** * Adds textures based on z-values, sea- and mountain levels. * * @param mountainLevel minimum height mountains start from */ - void ApplyTexturingByHeightMap(unsigned mountainLevel); + void applyTexturingByHeightMap(unsigned mountainLevel); /** * Sets textures near the specified coast to ensure a smooth looking transition from water to buildable land. @@ -174,21 +174,21 @@ class Texturizer * @param coast nodes to consider for re-texturing * @param width width (in node edges) for each coast transition texture */ - void ApplyCoastTexturing(const std::vector& coast, unsigned width); + void applyCoastTexturing(const std::vector& coast, unsigned width); /** * Creates smooth transitions between grass and mountain textures. * * @param mountainFoot all points on the map which are surounded by mountain and grass */ - void ApplyMountainTransitions(const std::vector& mountainFoot); + void applyMountainTransitions(const std::vector& mountainFoot); /** * Creates swamp transitions between water and mountain textures. * * @param transitions all points surounded by mountain and water textures */ - void ApplyMountainWaterTransitions(const std::vector& transitions); + void applyMountainWaterTransitions(const std::vector& transitions); public: Texturizer(NodeMapBase& z, NodeMapBase& textures, TextureMap& textureMap) @@ -203,7 +203,7 @@ class Texturizer * @param mountainLevel minimum z-value defining the starting height for mountains * @param coastline size of the coastline */ - void AddTextures(unsigned mountainLevel, unsigned coastline); + void addTextures(unsigned mountainLevel, unsigned coastline); }; /** @@ -215,7 +215,7 @@ class Texturizer * @param texture new texture to replace current textures with * @param excluded textures which are excluded from replacement */ -void ReplaceTextureForPoint(NodeMapBase& textures, const MapPoint& point, DescIdx texture, +void replaceTextureForPoint(NodeMapBase& textures, const MapPoint& point, DescIdx texture, const std::set>& excluded); /** @@ -230,7 +230,7 @@ void ReplaceTextureForPoint(NodeMapBase& textures, const MapPoint& * @param texture texture to apply to nodes' triangles * @param excluded set of texture which shouldn't get replaced */ -void ReplaceTextures(NodeMapBase& textures, unsigned radius, std::set& nodes, +void replaceTextures(NodeMapBase& textures, unsigned radius, std::set& nodes, DescIdx texture, const std::set>& excluded); } // namespace rttr::mapGenerator diff --git a/libs/s25main/mapGenerator/Triangles.cpp b/libs/s25main/mapGenerator/Triangles.cpp index e40ba39f8d..2c678ec755 100644 --- a/libs/s25main/mapGenerator/Triangles.cpp +++ b/libs/s25main/mapGenerator/Triangles.cpp @@ -166,7 +166,7 @@ std::array GetTriangleEdges(const Triangle& t, const MapExtent& siz int x2 = p.x + (!rsu && odd ? 1 : 0); int y2 = p.y + 1; - return {p, MakeMapPoint(Position(x1, y1), size), MakeMapPoint(Position(x2, y2), size)}; + return {p, makeMapPoint(Position(x1, y1), size), makeMapPoint(Position(x2, y2), size)}; } } // namespace rttr::mapGenerator diff --git a/libs/s25main/mapGenerator/Triangles.h b/libs/s25main/mapGenerator/Triangles.h index 65c7d11d46..3854304d16 100644 --- a/libs/s25main/mapGenerator/Triangles.h +++ b/libs/s25main/mapGenerator/Triangles.h @@ -20,7 +20,7 @@ struct Triangle Triangle(bool rsu, const MapPoint& position) : rsu(rsu), position(position) {} Triangle(bool rsu, const Position& position, const MapExtent& size) - : rsu(rsu), position(MakeMapPoint(position, size)) + : rsu(rsu), position(makeMapPoint(position, size)) {} }; diff --git a/libs/s25main/network/ClientError.cpp b/libs/s25main/network/ClientError.cpp index b946e7f766..babe7793ef 100644 --- a/libs/s25main/network/ClientError.cpp +++ b/libs/s25main/network/ClientError.cpp @@ -5,7 +5,7 @@ #include "ClientError.h" #include "mygettext/mygettext.h" -const char* ClientErrorToStr(ClientError error) +const char* clientErrorToStr(ClientError error) { switch(error) { diff --git a/libs/s25main/network/ClientError.h b/libs/s25main/network/ClientError.h index 0bbfaa4bc2..74a25106b9 100644 --- a/libs/s25main/network/ClientError.h +++ b/libs/s25main/network/ClientError.h @@ -18,4 +18,4 @@ enum class ClientError InvalidMap }; -const char* ClientErrorToStr(ClientError error); +const char* clientErrorToStr(ClientError error); diff --git a/libs/s25main/network/GameClient.cpp b/libs/s25main/network/GameClient.cpp index 8fbc294b5c..02747b9927 100644 --- a/libs/s25main/network/GameClient.cpp +++ b/libs/s25main/network/GameClient.cpp @@ -79,7 +79,7 @@ void copyFileIfPathDifferent(const boost::filesystem::path& src_path, const boos } } // namespace -void GameClient::ClientConfig::Clear() +void GameClient::ClientConfig::clear() { server.clear(); gameName.clear(); @@ -92,7 +92,7 @@ GameClient::GameClient() : skiptogf(0), mainPlayer(0), state(ClientState::Stoppe GameClient::~GameClient() { - Stop(); + stop(); } /** @@ -105,10 +105,10 @@ GameClient::~GameClient() * * @return true, wenn Client erfolgreich verbunden und gestartet */ -bool GameClient::Connect(const std::string& server, const std::string& password, ServerType servertyp, +bool GameClient::connect(const std::string& server, const std::string& password, ServerType servertyp, unsigned short port, bool host, bool use_ipv6) { - Stop(); + stop(); RTTR_Assert(aiBattlePlayers_.empty()); @@ -125,12 +125,12 @@ bool GameClient::Connect(const std::string& server, const std::string& password, { LOG.write("GameClient::Connect: ERROR: Connect failed!\n"); if(host) - GAMESERVER.Stop(); + GAMESERVER.stop(); return false; } state = ClientState::Connect; - AdvanceState(ConnectState::Initiated); + advanceState(ConnectState::Initiated); // Es wird kein Replay abgespielt, sondern dies ist ein richtiges Spiel replayMode = false; @@ -138,7 +138,7 @@ bool GameClient::Connect(const std::string& server, const std::string& password, return true; } -bool GameClient::HostGame(const CreateServerInfo& csi, const MapDescription& map) +bool GameClient::hostGame(const CreateServerInfo& csi, const MapDescription& map) { std::string hostPw = createRandString(20); // Copy the map and lua to the played map folders to avoid having to transmit it from the (local) server @@ -149,13 +149,13 @@ bool GameClient::HostGame(const CreateServerInfo& csi, const MapDescription& map const auto playedMapLuaPath = RTTRCONFIG.ExpandPath(s25::folders::mapsPlayed) / map.lua_path->filename(); copyFileIfPathDifferent(*map.lua_path, playedMapLuaPath); } - return GAMESERVER.Start(csi, map, hostPw) && Connect("localhost", hostPw, csi.type, csi.port, true, csi.ipv6); + return GAMESERVER.start(csi, map, hostPw) && connect("localhost", hostPw, csi.type, csi.port, true, csi.ipv6); } /** * Hauptschleife des Clients */ -void GameClient::Run() +void GameClient::run() { if(state == ClientState::Stopped) return; @@ -173,7 +173,7 @@ void GameClient::Run() if(!mainPlayer.receiveMsgs()) { LOG.write("Receiving Message from server failed\n"); - ServerLost(); + serverLost(); } } @@ -190,7 +190,7 @@ void GameClient::Run() { // Server ist weg LOG.write("Error on socket to server\n"); - ServerLost(); + serverLost(); } } @@ -198,9 +198,9 @@ void GameClient::Run() { // All players ready? if(nwfInfo->isReady()) - OnGameStart(); + onGameStart(); } else if(state == ClientState::Game) - ExecuteGameFrame(); + executeGameFrame(); // maximal 10 Pakete verschicken mainPlayer.sendMsgs(10); @@ -211,28 +211,28 @@ void GameClient::Run() /** * Stoppt das Spiel */ -void GameClient::Stop() +void GameClient::stop() { if(state == ClientState::Stopped) return; if(game) - ExitGame(); + exitGame(); else if(state == ClientState::Connect || state == ClientState::Config) gameLobby.reset(); if(isHost()) - GAMESERVER.Stop(); + GAMESERVER.stop(); - framesinfo.Clear(); - clientconfig.Clear(); - mapinfo.Clear(); + framesinfo.clear(); + clientconfig.clear(); + mapinfo.clear(); if(replayinfo) { if(replayinfo->replay.isRecording()) - replayinfo->replay.StopRecording(); - replayinfo->replay.Close(); + replayinfo->replay.stopRecording(); + replayinfo->replay.close(); replayinfo.reset(); } @@ -269,15 +269,15 @@ const AIPlayer* GameClient::getAIPlayer(unsigned id) const * * @param[in] random_init Initialwert des Zufallsgenerators. */ -void GameClient::StartGame(const unsigned random_init) +void GameClient::startGame(const unsigned random_init) { RTTR_Assert(state == ClientState::Config || (state == ClientState::Stopped && replayMode)); // Mond malen Position moonPos = VIDEODRIVER.getMousePos(); moonPos.y -= 40; - LOADER.getImageN("resource", 33)->DrawFull(moonPos); - VIDEODRIVER.SwapBuffers(); + LOADER.getImageN("resource", 33)->drawFull(moonPos); + VIDEODRIVER.swapBuffers(); // Start in pause mode framesinfo.isPaused = true; @@ -292,7 +292,7 @@ void GameClient::StartGame(const unsigned random_init) if(!isReplayModeOn() && mapinfo.savegame && !mapinfo.savegame->Load(mapinfo.filepath, SaveGameDataToLoad::All)) { - OnError(ClientError::InvalidMap); + onError(ClientError::InvalidMap); return; } @@ -319,7 +319,7 @@ void GameClient::StartGame(const unsigned random_init) ci->CI_GameLoading(game); // Get standard settings before they get overwritten - getPlayer(getPlayerId()).FillVisualSettings(default_settings); + getPlayer(getPlayerId()).fillVisualSettings(default_settings); try { @@ -327,31 +327,31 @@ void GameClient::StartGame(const unsigned random_init) } catch(const GameSetupError& error) { LOG.write("%1%\n") % error.what(); - OnError(ClientError::InvalidMap); + onError(ClientError::InvalidMap); return; } // Update visual settings - ResetVisualSettings(); + resetVisualSettings(); if(!replayMode) { RTTR_Assert(!replayinfo); - StartReplayRecording(random_init); + startReplayRecording(random_init); } // Daten nach dem Schreiben des Replays ggf wieder löschen - mapinfo.mapData.Clear(); + mapinfo.mapData.clear(); } -void GameClient::GameLoaded() +void GameClient::gameLoaded() { RTTR_Assert(state == ClientState::Loading); state = ClientState::Loaded; if(replayMode) - OnGameStart(); + onGameStart(); else { // Notify server that we are ready @@ -361,18 +361,18 @@ void GameClient::GameLoaded() { if(getPlayer(id).ps == PlayerState::AI) { - game->AddAIPlayer(CreateAIPlayer(id, getPlayer(id).aiInfo)); - SendNothingNC(id); + game->addAIPlayer(createAIPlayer(id, getPlayer(id).aiInfo)); + sendNothingNC(id); } } if(isAIBattleModeOn()) - ToggleHumanAIPlayer(aiBattlePlayers_[getPlayerId()]); + toggleHumanAIPlayer(aiBattlePlayers_[getPlayerId()]); } - SendNothingNC(); + sendNothingNC(); } } -void GameClient::ExitGame() +void GameClient::exitGame() { RTTR_Assert(state == ClientState::Game || state == ClientState::Loaded || state == ClientState::Loading); game.reset(); @@ -389,7 +389,7 @@ unsigned GameClient::getGFNumber() const /** * Ping-Nachricht. */ -bool GameClient::OnGameMessage(const GameMessage_Ping& /*msg*/) +bool GameClient::onGameMessage(const GameMessage_Ping& /*msg*/) { mainPlayer.sendMsgAsync(new GameMessage_Pong()); return true; @@ -398,14 +398,14 @@ bool GameClient::OnGameMessage(const GameMessage_Ping& /*msg*/) /** * Player-ID-Nachricht. */ -bool GameClient::OnGameMessage(const GameMessage_Player_Id& msg) +bool GameClient::onGameMessage(const GameMessage_Player_Id& msg) { - if(!VerifyState(ConnectState::Initiated)) + if(!verifyState(ConnectState::Initiated)) return true; // haben wir eine ungültige ID erhalten? (aka Server-Voll) if(msg.player == GameMessageWithPlayer::NO_PLAYER_ID) { - OnError(ClientError::ServerFull); + onError(ClientError::ServerFull); return true; } @@ -413,22 +413,22 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Id& msg) // Server-Typ senden mainPlayer.sendMsgAsync(new GameMessage_Server_Type(clientconfig.servertyp, rttr::version::getRevision())); - AdvanceState(ConnectState::VerifyServer); + advanceState(ConnectState::VerifyServer); return true; } /** * Player-List-Nachricht. */ -bool GameClient::OnGameMessage(const GameMessage_Player_List& msg) +bool GameClient::onGameMessage(const GameMessage_Player_List& msg) { - if(state != ClientState::Config && !VerifyState(ConnectState::QueryPlayerList)) + if(state != ClientState::Config && !verifyState(ConnectState::QueryPlayerList)) return true; RTTR_Assert(gameLobby); RTTR_Assert(gameLobby->getNumPlayers() == msg.playerInfos.size()); if(gameLobby->getNumPlayers() != msg.playerInfos.size()) { - OnError(ClientError::InvalidMessage); + onError(ClientError::InvalidMessage); return true; } @@ -436,11 +436,11 @@ bool GameClient::OnGameMessage(const GameMessage_Player_List& msg) gameLobby->getPlayer(i) = msg.playerInfos[i]; if(state == ClientState::Connect) - AdvanceState(ConnectState::QuerySettings); + advanceState(ConnectState::QuerySettings); return true; } -bool GameClient::OnGameMessage(const GameMessage_Player_Name& msg) +bool GameClient::onGameMessage(const GameMessage_Player_Name& msg) { if(state != ClientState::Config) return true; @@ -452,7 +452,7 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Name& msg) return true; } -bool GameClient::OnGameMessage(const GameMessage_Player_Portrait& msg) +bool GameClient::onGameMessage(const GameMessage_Player_Portrait& msg) { if(state != ClientState::Config) return true; @@ -469,7 +469,7 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Portrait& msg) /////////////////////////////////////////////////////////////////////////////// /// player joined /// @param message Nachricht, welche ausgeführt wird -bool GameClient::OnGameMessage(const GameMessage_Player_New& msg) +bool GameClient::onGameMessage(const GameMessage_Player_New& msg) { if(state != ClientState::Config) return true; @@ -488,7 +488,7 @@ bool GameClient::OnGameMessage(const GameMessage_Player_New& msg) return true; } -bool GameClient::OnGameMessage(const GameMessage_Player_Ping& msg) +bool GameClient::onGameMessage(const GameMessage_Player_Ping& msg) { if(state == ClientState::Config) { @@ -514,7 +514,7 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Ping& msg) /** * Player-Toggle-State-Nachricht. */ -bool GameClient::OnGameMessage(const GameMessage_Player_State& msg) +bool GameClient::onGameMessage(const GameMessage_Player_State& msg) { if(state != ClientState::Config) return true; @@ -542,7 +542,7 @@ bool GameClient::OnGameMessage(const GameMessage_Player_State& msg) /////////////////////////////////////////////////////////////////////////////// /// nation button gedrückt /// @param message Nachricht, welche ausgeführt wird -bool GameClient::OnGameMessage(const GameMessage_Player_Nation& msg) +bool GameClient::onGameMessage(const GameMessage_Player_Nation& msg) { if(state != ClientState::Config) return true; @@ -560,7 +560,7 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Nation& msg) /////////////////////////////////////////////////////////////////////////////// /// team button gedrückt /// @param message Nachricht, welche ausgeführt wird -bool GameClient::OnGameMessage(const GameMessage_Player_Team& msg) +bool GameClient::onGameMessage(const GameMessage_Player_Team& msg) { if(state != ClientState::Config) return true; @@ -578,7 +578,7 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Team& msg) /////////////////////////////////////////////////////////////////////////////// /// color button gedrückt /// @param message Nachricht, welche ausgeführt wird -bool GameClient::OnGameMessage(const GameMessage_Player_Color& msg) +bool GameClient::onGameMessage(const GameMessage_Player_Color& msg) { if(state != ClientState::Config) return true; @@ -598,7 +598,7 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Color& msg) * * @param[in] message Nachricht, welche ausgeführt wird */ -bool GameClient::OnGameMessage(const GameMessage_Player_Ready& msg) +bool GameClient::onGameMessage(const GameMessage_Player_Ready& msg) { if(state != ClientState::Config) return true; @@ -616,7 +616,7 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Ready& msg) /////////////////////////////////////////////////////////////////////////////// /// player gekickt /// @param message Nachricht, welche ausgeführt wird -bool GameClient::OnGameMessage(const GameMessage_Player_Kicked& msg) +bool GameClient::onGameMessage(const GameMessage_Player_Kicked& msg) { if(state == ClientState::Config) { @@ -634,8 +634,8 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Kicked& msg) // Host has to handle it if(isHost()) { - game->AddAIPlayer(CreateAIPlayer(msg.player, player.aiInfo)); - SendNothingNC(msg.player); + game->addAIPlayer(createAIPlayer(msg.player, player.aiInfo)); + sendNothingNC(msg.player); } } } else @@ -646,7 +646,7 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Kicked& msg) return true; } -bool GameClient::OnGameMessage(const GameMessage_Player_Swap& msg) +bool GameClient::onGameMessage(const GameMessage_Player_Swap& msg) { LOG.writeToFile("<<< NMS_PLAYER_SWAP(%u, %u)\n") % unsigned(msg.player) % unsigned(msg.player2); @@ -660,7 +660,7 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Swap& msg) swap(gameLobby->getPlayer(msg.player), gameLobby->getPlayer(msg.player2)); // Some things cannot be changed in savegames if(mapinfo.type == MapType::Savegame) - gameLobby->getPlayer(msg.player).FixSwappedSaveSlot(gameLobby->getPlayer(msg.player2)); + gameLobby->getPlayer(msg.player).fixSwappedSaveSlot(gameLobby->getPlayer(msg.player2)); // Evtl. sind wir betroffen? if(mainPlayer.playerId == msg.player) @@ -671,7 +671,7 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Swap& msg) if(ci) ci->CI_PlayersSwapped(msg.player, msg.player2); } else if(state == ClientState::Loading || state == ClientState::Loaded || state == ClientState::Game) - ChangePlayerIngame(msg.player, msg.player2); + changePlayerIngame(msg.player, msg.player2); else return true; mainPlayer.sendMsgAsync(new GameMessage_Player_SwapConfirm(msg.player, msg.player2)); @@ -681,9 +681,9 @@ bool GameClient::OnGameMessage(const GameMessage_Player_Swap& msg) /** * Server-Typ-Nachricht. */ -bool GameClient::OnGameMessage(const GameMessage_Server_TypeOK& msg) +bool GameClient::onGameMessage(const GameMessage_Server_TypeOK& msg) { - if(!VerifyState(ConnectState::VerifyServer)) + if(!verifyState(ConnectState::VerifyServer)) return true; using StatusCode = GameMessage_Server_TypeOK::StatusCode; @@ -694,7 +694,7 @@ bool GameClient::OnGameMessage(const GameMessage_Server_TypeOK& msg) default: case StatusCode::InvalidServerType: { - OnError(ClientError::InvalidServerType); + onError(ClientError::InvalidServerType); return true; } break; @@ -703,7 +703,7 @@ bool GameClient::OnGameMessage(const GameMessage_Server_TypeOK& msg) { LOG.write(_("Version mismatch. Server version: %1%, your version %2%")) % msg.version % rttr::version::getRevision(); - OnError(ClientError::WrongVersion); + onError(ClientError::WrongVersion); return true; } break; @@ -711,21 +711,21 @@ bool GameClient::OnGameMessage(const GameMessage_Server_TypeOK& msg) mainPlayer.sendMsgAsync(new GameMessage_Server_Password(clientconfig.password)); - AdvanceState(ConnectState::QueryPw); + advanceState(ConnectState::QueryPw); return true; } /** * Server-Passwort-Nachricht. */ -bool GameClient::OnGameMessage(const GameMessage_Server_Password& msg) +bool GameClient::onGameMessage(const GameMessage_Server_Password& msg) { - if(!VerifyState(ConnectState::QueryPw)) + if(!verifyState(ConnectState::QueryPw)) return true; if(msg.password != "true") { - OnError(ClientError::WrongPassword); + onError(ClientError::WrongPassword); return true; } @@ -733,27 +733,27 @@ bool GameClient::OnGameMessage(const GameMessage_Server_Password& msg) mainPlayer.sendMsgAsync(new GameMessage_Player_Portrait(0xFF, SETTINGS.lobby.portraitIndex)); mainPlayer.sendMsgAsync(new GameMessage_MapRequest(true)); - AdvanceState(ConnectState::QueryMapInfo); + advanceState(ConnectState::QueryMapInfo); return true; } /** * Server-Name-Nachricht. */ -bool GameClient::OnGameMessage(const GameMessage_Server_Name& msg) +bool GameClient::onGameMessage(const GameMessage_Server_Name& msg) { - if(!VerifyState(ConnectState::QueryServerName)) + if(!verifyState(ConnectState::QueryServerName)) return true; clientconfig.gameName = msg.name; - AdvanceState(ConnectState::QueryPlayerList); + advanceState(ConnectState::QueryPlayerList); return true; } /** * Server-Start-Nachricht */ -bool GameClient::OnGameMessage(const GameMessage_Server_Start& msg) +bool GameClient::onGameMessage(const GameMessage_Server_Start& msg) { if(state != ClientState::Config) return true; @@ -762,12 +762,12 @@ bool GameClient::OnGameMessage(const GameMessage_Server_Start& msg) nwfInfo->init(msg.firstNwf, msg.cmdDelay); try { - StartGame(msg.random_init); + startGame(msg.random_init); } catch(const SerializedGameData::Error& error) { LOG.write("Error when loading game: %s\n") % error.what(); - Stop(); - GAMEMANAGER.ShowMenu(); + stop(); + GAMEMANAGER.showMenu(); } return true; } @@ -775,11 +775,11 @@ bool GameClient::OnGameMessage(const GameMessage_Server_Start& msg) /** * Server-Chat-Nachricht. */ -bool GameClient::OnGameMessage(const GameMessage_Chat& msg) +bool GameClient::onGameMessage(const GameMessage_Chat& msg) { if(msg.destination == ChatDestination::System) { - SystemChat(msg.text, (msg.player < game->world_.getNumPlayers()) ? msg.player : getPlayerId()); + systemChat(msg.text, (msg.player < game->world_.getNumPlayers()) ? msg.player : getPlayerId()); return true; } if(state == ClientState::Game) @@ -790,7 +790,7 @@ bool GameClient::OnGameMessage(const GameMessage_Chat& msg) /// Mit im Replay aufzeichnen if(replayinfo && replayinfo->replay.isRecording()) - replayinfo->replay.AddChatCommand(getGFNumber(), msg.player, msg.destination, msg.text); + replayinfo->replay.addChatCommand(getGFNumber(), msg.player, msg.destination, msg.text); const GamePlayer& player = game->world_.getPlayer(msg.player); @@ -814,7 +814,7 @@ bool GameClient::OnGameMessage(const GameMessage_Chat& msg) for(AIPlayer& ai : game->aiPlayers_) { if(isValidRecipient(ai.getPlayerId())) - ai.OnChatMessage(msg.player, msg.destination, msg.text); + ai.onChatMessage(msg.player, msg.destination, msg.text); } if(!isValidRecipient(getPlayerId())) @@ -835,7 +835,7 @@ bool GameClient::OnGameMessage(const GameMessage_Chat& msg) /** * Server-Async-Nachricht. */ -bool GameClient::OnGameMessage(const GameMessage_Server_Async& msg) +bool GameClient::onGameMessage(const GameMessage_Server_Async& msg) { if(state != ClientState::Game) return true; @@ -865,7 +865,7 @@ bool GameClient::OnGameMessage(const GameMessage_Server_Async& msg) const bfs::path filePathLog = RTTRCONFIG.ExpandPath(s25::folders::logs) / makePortableFileName(fileName + "Player.log"); saveRandomLog(filePathLog, RANDOM.GetAsyncLog()); - SaveToFile(filePathSave); + saveToFile(filePathSave); LOG.write(_("Async log saved at %1%,\ngame saved at %2%\n")) % filePathLog % filePathSave; return true; } @@ -873,7 +873,7 @@ bool GameClient::OnGameMessage(const GameMessage_Server_Async& msg) /** * Server-Countdown-Nachricht. */ -bool GameClient::OnGameMessage(const GameMessage_Countdown& msg) +bool GameClient::onGameMessage(const GameMessage_Countdown& msg) { if(state != ClientState::Config) return true; @@ -885,7 +885,7 @@ bool GameClient::OnGameMessage(const GameMessage_Countdown& msg) /** * Server-Cancel-Countdown-Nachricht. */ -bool GameClient::OnGameMessage(const GameMessage_CancelCountdown& msg) +bool GameClient::onGameMessage(const GameMessage_CancelCountdown& msg) { if(state != ClientState::Config) return true; @@ -900,9 +900,9 @@ bool GameClient::OnGameMessage(const GameMessage_CancelCountdown& msg) * * @param message Nachricht, welche ausgeführt wird */ -bool GameClient::OnGameMessage(const GameMessage_Map_Info& msg) +bool GameClient::onGameMessage(const GameMessage_Map_Info& msg) { - if(!VerifyState(ConnectState::QueryMapInfo)) + if(!verifyState(ConnectState::QueryMapInfo)) return true; // For local savegame loads the filename comes from our own server and is already a valid @@ -914,12 +914,12 @@ bool GameClient::OnGameMessage(const GameMessage_Map_Info& msg) if(portFilename.empty()) { LOG.write("Invalid filename received!\n"); - OnError(ClientError::InvalidMap); + onError(ClientError::InvalidMap); return true; } if(!MapInfo::verifySize(msg.mapLen, msg.luaLen, msg.mapCompressedLen, msg.luaCompressedLen)) { - OnError(ClientError::InvalidMap); + onError(ClientError::InvalidMap); return true; } const auto targetPath = @@ -936,15 +936,15 @@ bool GameClient::OnGameMessage(const GameMessage_Map_Info& msg) // We have the map locally already, so prepare and ask if this is the same as the one on the server if(bfs::exists(mapinfo.filepath) && (mapinfo.luaFilepath.empty() || bfs::exists(mapinfo.luaFilepath)) - && CreateLobby()) + && createLobby()) { - mapinfo.mapData.CompressFromFile(mapinfo.filepath, &mapinfo.mapChecksum); + mapinfo.mapData.compressFromFile(mapinfo.filepath, &mapinfo.mapChecksum); if(mapinfo.mapData.data.size() == msg.mapCompressedLen && mapinfo.mapData.uncompressedLength == msg.mapLen) { bool ok = true; if(!mapinfo.luaFilepath.empty()) { - mapinfo.luaData.CompressFromFile(mapinfo.luaFilepath, &mapinfo.luaChecksum); + mapinfo.luaData.compressFromFile(mapinfo.luaFilepath, &mapinfo.luaChecksum); ok = (mapinfo.luaData.data.size() == msg.luaCompressedLen && mapinfo.luaData.uncompressedLength == msg.luaLen); } @@ -952,7 +952,7 @@ bool GameClient::OnGameMessage(const GameMessage_Map_Info& msg) if(ok) { mainPlayer.sendMsgAsync(new GameMessage_Map_Checksum(mapinfo.mapChecksum, mapinfo.luaChecksum)); - AdvanceState(ConnectState::VerifyMap); + advanceState(ConnectState::VerifyMap); return true; } } @@ -963,23 +963,23 @@ bool GameClient::OnGameMessage(const GameMessage_Map_Info& msg) mapinfo.mapData.data.resize(msg.mapCompressedLen); mapinfo.luaData.data.resize(msg.luaCompressedLen); mainPlayer.sendMsgAsync(new GameMessage_MapRequest(false)); - AdvanceState(ConnectState::ReceiveMap); + advanceState(ConnectState::ReceiveMap); return true; } /////////////////////////////////////////////////////////////////////////////// /// Kartendaten /// @param message Nachricht, welche ausgeführt wird -bool GameClient::OnGameMessage(const GameMessage_Map_Data& msg) +bool GameClient::onGameMessage(const GameMessage_Map_Data& msg) { - if(!VerifyState(ConnectState::ReceiveMap)) + if(!verifyState(ConnectState::ReceiveMap)) return true; LOG.writeToFile("<<< NMS_MAP_DATA(%u)\n") % msg.data.size(); std::vector& targetData = (msg.isMapData) ? mapinfo.mapData.data : mapinfo.luaData.data; if(msg.data.size() > targetData.size() || msg.offset > targetData.size() - msg.data.size()) { - OnError(ClientError::MapTransmission); + onError(ClientError::MapTransmission); return true; } std::copy(msg.data.begin(), msg.data.end(), targetData.begin() + msg.offset); @@ -998,62 +998,62 @@ bool GameClient::OnGameMessage(const GameMessage_Map_Data& msg) if(receivedSize == totalSize) { - if(!mapinfo.mapData.DecompressToFile(mapinfo.filepath, &mapinfo.mapChecksum)) + if(!mapinfo.mapData.decompressToFile(mapinfo.filepath, &mapinfo.mapChecksum)) { - OnError(ClientError::MapTransmission); + onError(ClientError::MapTransmission); return true; } - if(!mapinfo.luaFilepath.empty() && !mapinfo.luaData.DecompressToFile(mapinfo.luaFilepath, &mapinfo.luaChecksum)) + if(!mapinfo.luaFilepath.empty() && !mapinfo.luaData.decompressToFile(mapinfo.luaFilepath, &mapinfo.luaChecksum)) { - OnError(ClientError::MapTransmission); + onError(ClientError::MapTransmission); return true; } RTTR_Assert(!mapinfo.luaFilepath.empty() || mapinfo.luaChecksum == 0); - if(!CreateLobby()) + if(!createLobby()) { - OnError(ClientError::MapTransmission); + onError(ClientError::MapTransmission); return true; } mainPlayer.sendMsgAsync(new GameMessage_Map_Checksum(mapinfo.mapChecksum, mapinfo.luaChecksum)); - AdvanceState(ConnectState::VerifyMap); + advanceState(ConnectState::VerifyMap); } return true; } -bool GameClient::OnGameMessage(const GameMessage_SkipToGF& msg) +bool GameClient::onGameMessage(const GameMessage_SkipToGF& msg) { skiptogf = msg.targetGF; LOG.write("Jumping from GF %1% to GF %2%\n") % getGFNumber() % skiptogf; return true; } -void GameClient::OnError(ClientError error) +void GameClient::onError(ClientError error) { if(ci) ci->CI_Error(error); - Stop(); + stop(); } -void GameClient::AdvanceState(ConnectState newState) +void GameClient::advanceState(ConnectState newState) { connectState = newState; if(ci) ci->CI_NextConnectState(connectState); } -bool GameClient::VerifyState(ConnectState expectedState) +bool GameClient::verifyState(ConnectState expectedState) { if(state != ClientState::Connect || connectState != expectedState) { - OnError(ClientError::InvalidMessage); + onError(ClientError::InvalidMessage); return false; } return true; } -bool GameClient::CreateLobby() +bool GameClient::createLobby() { RTTR_Assert(!gameLobby); @@ -1099,23 +1099,23 @@ bool GameClient::CreateLobby() /////////////////////////////////////////////////////////////////////////////// /// map-checksum /// @param message Nachricht, welche ausgeführt wird -bool GameClient::OnGameMessage(const GameMessage_Map_ChecksumOK& msg) +bool GameClient::onGameMessage(const GameMessage_Map_ChecksumOK& msg) { - if(!VerifyState(ConnectState::VerifyMap)) + if(!verifyState(ConnectState::VerifyMap)) return true; LOG.writeToFile("<<< NMS_MAP_CHECKSUM(%d)\n") % (msg.correct ? 1 : 0); if(msg.correct) - AdvanceState(ConnectState::QueryServerName); + advanceState(ConnectState::QueryServerName); else { gameLobby.reset(); if(msg.retryAllowed) { mainPlayer.sendMsgAsync(new GameMessage_MapRequest(false)); - AdvanceState(ConnectState::ReceiveMap); + advanceState(ConnectState::ReceiveMap); } else - OnError(ClientError::MapTransmission); + onError(ClientError::MapTransmission); } return true; } @@ -1123,9 +1123,9 @@ bool GameClient::OnGameMessage(const GameMessage_Map_ChecksumOK& msg) /////////////////////////////////////////////////////////////////////////////// /// server typ /// @param message Nachricht, welche ausgeführt wird -bool GameClient::OnGameMessage(const GameMessage_GGSChange& msg) +bool GameClient::onGameMessage(const GameMessage_GGSChange& msg) { - if(state != ClientState::Config && !VerifyState(ConnectState::QuerySettings)) + if(state != ClientState::Config && !verifyState(ConnectState::QuerySettings)) return true; LOG.writeToFile("<<< NMS_GGS_CHANGE\n"); @@ -1134,18 +1134,18 @@ bool GameClient::OnGameMessage(const GameMessage_GGSChange& msg) if(state == ClientState::Connect) { state = ClientState::Config; - AdvanceState(ConnectState::Finished); + advanceState(ConnectState::Finished); } else if(ci) ci->CI_GGSChanged(msg.ggs); return true; } -bool GameClient::OnGameMessage(const GameMessage_RemoveLua&) +bool GameClient::onGameMessage(const GameMessage_RemoveLua&) { if(state != ClientState::Connect && state != ClientState::Config) return true; mapinfo.luaFilepath.clear(); - mapinfo.luaData.Clear(); + mapinfo.luaData.clear(); mapinfo.luaChecksum = 0; return true; } @@ -1153,7 +1153,7 @@ bool GameClient::OnGameMessage(const GameMessage_RemoveLua&) /////////////////////////////////////////////////////////////////////////////// /// NFC Antwort vom Server /// @param message Nachricht, welche ausgeführt wird -bool GameClient::OnGameMessage(const GameMessage_GameCommand& msg) +bool GameClient::onGameMessage(const GameMessage_GameCommand& msg) { if(nwfInfo) { @@ -1166,7 +1166,7 @@ bool GameClient::OnGameMessage(const GameMessage_GameCommand& msg) return true; } -void GameClient::IncreaseSpeed(const bool wraparound) +void GameClient::increaseSpeed(const bool wraparound) { const auto curSpeed = framesinfo.gfLengthReq; // Note: Higher speed = lower gf_length value @@ -1181,7 +1181,7 @@ void GameClient::IncreaseSpeed(const bool wraparound) setNewSpeed(MIN_SPEED); } -void GameClient::DecreaseSpeed() +void GameClient::decreaseSpeed() { if((DEBUG_MODE || replayMode) && framesinfo.gfLengthReq >= MIN_SPEED) setNewSpeed(MIN_SPEED_DEBUG); @@ -1206,7 +1206,7 @@ void GameClient::setNewSpeed(std::chrono::milliseconds gfLength) /////////////////////////////////////////////////////////////////////////////// /// NFC Done vom Server /// @param message Nachricht, welche ausgeführt wird -bool GameClient::OnGameMessage(const GameMessage_Server_NWFDone& msg) +bool GameClient::onGameMessage(const GameMessage_Server_NWFDone& msg) { if(!nwfInfo) return true; @@ -1220,7 +1220,7 @@ bool GameClient::OnGameMessage(const GameMessage_Server_NWFDone& msg) return true; } -bool GameClient::OnGameMessage(const GameMessage_Pause& msg) +bool GameClient::onGameMessage(const GameMessage_Pause& msg) { // Ignore recorded pause messages in replay mode if(state != ClientState::Game || replayMode) @@ -1243,7 +1243,7 @@ bool GameClient::OnGameMessage(const GameMessage_Pause& msg) * * @param[in] message Nachricht, welche ausgeführt wird */ -bool GameClient::OnGameMessage(const GameMessage_GetAsyncLog& /*msg*/) +bool GameClient::onGameMessage(const GameMessage_GetAsyncLog& /*msg*/) { if(state != ClientState::Game) return true; @@ -1273,7 +1273,7 @@ bool GameClient::OnGameMessage(const GameMessage_GetAsyncLog& /*msg*/) /////////////////////////////////////////////////////////////////////////////// /// testet ob ein Netwerkframe abgelaufen ist und führt dann ggf die Befehle aus -void GameClient::ExecuteGameFrame() +void GameClient::executeGameFrame() { if(framesinfo.isPaused) return; // Pause @@ -1330,7 +1330,7 @@ void GameClient::ExecuteGameFrame() RTTR_Assert(nwfInfo->getServerInfo().gf == curGF); - ExecuteNWF(); + executeNWF(); const auto oldGFLen = framesinfo.gf_length; nwfInfo->execute(framesinfo); @@ -1342,19 +1342,19 @@ void GameClient::ExecuteGameFrame() } } - NextGF(isNWF); + nextGF(isNWF); RTTR_Assert(curGF <= nwfInfo->getNextNWF()); - HandleAutosave(); + handleAutosave(); // GF-Ende im Replay aktualisieren if(replayinfo && replayinfo->replay.isRecording()) - replayinfo->replay.UpdateLastGF(curGF); + replayinfo->replay.updateLastGF(curGF); } } catch(const LuaExecutionError& e) { - SystemChat((boost::format(_("Error during execution of lua script: %1%\nGame stopped!")) % e.what()).str()); - OnError(ClientError::InvalidMap); + systemChat((boost::format(_("Error during execution of lua script: %1%\nGame stopped!")) % e.what()).str()); + onError(ClientError::InvalidMap); } if(skiptogf == getGFNumber()) skiptogf = 0; @@ -1384,7 +1384,7 @@ void GameClient::ExecuteGameFrame() RTTR_Assert(framesinfo.frameTime < framesinfo.gf_length); } -void GameClient::HandleAutosave() +void GameClient::handleAutosave() { // If inactive or during replay -> no autosave if(!SETTINGS.interface.autosaveInterval || replayMode) @@ -1399,43 +1399,43 @@ void GameClient::HandleAutosave() else filename = mapinfo.title + " (" + _("Auto-Save") + ").sav"; - SaveToFile(RTTRCONFIG.ExpandPath(s25::folders::save) / filename); + saveToFile(RTTRCONFIG.ExpandPath(s25::folders::save) / filename); } } /// Führt notwendige Dinge für nächsten GF aus -void GameClient::NextGF(bool wasNWF) +void GameClient::nextGF(bool wasNWF) { for(AIPlayer& ai : game->aiPlayers_) - ai.RunGF(getGFNumber(), wasNWF); - game->RunGF(); + ai.runGF(getGFNumber(), wasNWF); + game->runGF(); } -void GameClient::ExecuteAllGCs(uint8_t playerId, const PlayerGameCommands& gcs) +void GameClient::executeAllGCs(uint8_t playerId, const PlayerGameCommands& gcs) { for(const gc::GameCommandPtr& gc : gcs.gcs) - gc->Execute(game->world_, playerId); + gc->execute(game->world_, playerId); } -void GameClient::SendNothingNC(uint8_t player) +void GameClient::sendNothingNC(uint8_t player) { mainPlayer.sendMsgAsync( new GameMessage_GameCommand(player, AsyncChecksum::create(*game), std::vector())); } -void GameClient::WritePlayerInfo(SavedFile& file) +void GameClient::writePlayerInfo(SavedFile& file) { RTTR_Assert(state == ClientState::Loading || state == ClientState::Loaded || state == ClientState::Game); // Spielerdaten for(unsigned i = 0; i < getNumPlayers(); ++i) - file.AddPlayer(getPlayer(i)); + file.addPlayer(getPlayer(i)); } -void GameClient::OnGameStart() +void GameClient::onGameStart() { if(state == ClientState::Loaded) { - GAMEMANAGER.ResetAverageGFPS(); + GAMEMANAGER.resetAverageGFPS(); framesinfo.lastTime = FramesInfo::UsedClock::now(); state = ClientState::Game; if(ci) @@ -1443,19 +1443,19 @@ void GameClient::OnGameStart() } else if(state == ClientState::Game && !game->isStarted()) { framesinfo.isPaused = replayMode; - game->Start(!!mapinfo.savegame); + game->start(!!mapinfo.savegame); } } -void GameClient::StartReplayRecording(const unsigned random_init) +void GameClient::startReplayRecording(const unsigned random_init) { replayinfo = std::make_unique(); replayinfo->filename = s25util::Time::FormatTime("%Y-%m-%d_%H-%i-%s") + ".rpl"; - WritePlayerInfo(replayinfo->replay); + writePlayerInfo(replayinfo->replay); replayinfo->replay.ggs = game->ggs_; - if(!replayinfo->replay.StartRecording(RTTRCONFIG.ExpandPath(s25::folders::replays) / replayinfo->filename, mapinfo, + if(!replayinfo->replay.startRecording(RTTRCONFIG.ExpandPath(s25::folders::replays) / replayinfo->filename, mapinfo, random_init)) { LOG.write(_("Replayfile couldn't be opened. No replay will be recorded\n")); @@ -1463,17 +1463,17 @@ void GameClient::StartReplayRecording(const unsigned random_init) } } -bool GameClient::StartReplay(const boost::filesystem::path& path) +bool GameClient::startReplay(const boost::filesystem::path& path) { RTTR_Assert(state == ClientState::Stopped); - mapinfo.Clear(); + mapinfo.clear(); replayinfo = std::make_unique(); - if(!replayinfo->replay.LoadHeader(path) || !replayinfo->replay.LoadGameData(mapinfo)) //-V807 + if(!replayinfo->replay.loadHeader(path) || !replayinfo->replay.LoadGameData(mapinfo)) //-V807 { LOG.write(_("Invalid Replay %1%! Reason: %2%\n")) % path % (replayinfo->replay.getLastErrorMsg().empty() ? _("Unknown") : replayinfo->replay.getLastErrorMsg()); - OnError(ClientError::InvalidMap); + onError(ClientError::InvalidMap); replayinfo.reset(); return false; } @@ -1520,19 +1520,19 @@ bool GameClient::StartReplay(const boost::filesystem::path& path) // Richtigen Pfad zur Map erstellen bfs::path mapFilePath = RTTRCONFIG.ExpandPath(s25::folders::mapsPlayed) / mapinfo.filepath.filename(); mapinfo.filepath = mapFilePath; - if(!mapinfo.mapData.DecompressToFile(mapinfo.filepath)) + if(!mapinfo.mapData.decompressToFile(mapinfo.filepath)) { LOG.write(_("Error decompressing map file")); - OnError(ClientError::MapTransmission); + onError(ClientError::MapTransmission); return false; } if(mapinfo.luaData.uncompressedLength) { mapinfo.luaFilepath = mapFilePath.replace_extension("lua"); - if(!mapinfo.luaData.DecompressToFile(mapinfo.luaFilepath)) + if(!mapinfo.luaData.decompressToFile(mapinfo.luaFilepath)) { LOG.write(_("Error decompressing lua file")); - OnError(ClientError::MapTransmission); + onError(ClientError::MapTransmission); return false; } } @@ -1545,15 +1545,15 @@ bool GameClient::StartReplay(const boost::filesystem::path& path) try { - StartGame(replayinfo->replay.getSeed()); + startGame(replayinfo->replay.getSeed()); } catch(const SerializedGameData::Error& error) { LOG.write(_("Error when loading game from replay: %s\n")) % error.what(); - OnError(ClientError::InvalidMap); + onError(ClientError::InvalidMap); return false; } - replayinfo->nextGF = replayinfo->replay.ReadGF(); + replayinfo->nextGF = replayinfo->replay.readGF(); return true; } @@ -1587,19 +1587,19 @@ T GameClient::doInterpolate(const T x1, const T x2, const GameEvent& ev) const return helpers::interpolate(x1, x2, elapsedTime, duration); } -unsigned GameClient::Interpolate(const unsigned maxVal, const GameEvent* ev) const +unsigned GameClient::interpolate(const unsigned maxVal, const GameEvent* ev) const { return doInterpolate(0u, maxVal, assertNonNull(ev)); } -int GameClient::Interpolate(const int x1, const int x2, const GameEvent* ev) const +int GameClient::interpolate(const int x1, const int x2, const GameEvent* ev) const { return doInterpolate(x1, x2, assertNonNull(ev)); } -void GameClient::ServerLost() +void GameClient::serverLost() { - OnError(ClientError::ConnectionLost); + onError(ClientError::ConnectionLost); // Stop game framesinfo.isPaused = true; } @@ -1609,7 +1609,7 @@ void GameClient::ServerLost() * * @param[in] dest_gf Zielgameframe */ -void GameClient::SkipGF(unsigned gf, GameWorldView& gwv) +void GameClient::skipGF(unsigned gf, GameWorldView& gwv) { if(gf <= getGFNumber()) return; @@ -1638,17 +1638,17 @@ void GameClient::SkipGF(unsigned gf, GameWorldView& gwv) road.mode = RoadBuildMode::Disabled; // spiel aktualisieren - gwv.Draw(road, MapPoint::Invalid(), false); + gwv.draw(road, MapPoint::invalid(), false); // text oben noch hinschreiben boost::format nwfString(_("current GF: %u - still fast forwarding: %d GFs left (%d %%)")); nwfString % getGFNumber() % (gf - i) % (i * 100 / gf); - LargeFont->Draw(DrawPoint(VIDEODRIVER.getRenderSize() / 2u), nwfString.str(), FontStyle::CENTER, + LargeFont->draw(DrawPoint(VIDEODRIVER.getRenderSize() / 2u), nwfString.str(), FontStyle::CENTER, COLOR_YELLOW); - VIDEODRIVER.SwapBuffers(); + VIDEODRIVER.swapBuffers(); } - ExecuteGameFrame(); + executeGameFrame(); } // Either we force-stopped skipping (skiptogf set to 0) or we reached the target gf RTTR_Assert(skiptogf == 0u || getGFNumber() == gf); @@ -1657,34 +1657,34 @@ void GameClient::SkipGF(unsigned gf, GameWorldView& gwv) unsigned ticks = VIDEODRIVER.getTickCount() - start_ticks; boost::format text(_("Jump finished (%1$.3g seconds).")); text % (ticks / 1000.0); - SystemChat(text.str()); + systemChat(text.str()); setPause(true); } -void GameClient::SystemChat(const std::string& text) +void GameClient::systemChat(const std::string& text) { - SystemChat(text, getPlayerId()); + systemChat(text, getPlayerId()); } -void GameClient::SystemChat(const std::string& text, unsigned char fromPlayerIdx) +void GameClient::systemChat(const std::string& text, unsigned char fromPlayerIdx) { if(ci) ci->CI_Chat(fromPlayerIdx, ChatDestination::System, text); } -bool GameClient::SaveToFile(const boost::filesystem::path& filepath) +bool GameClient::saveToFile(const boost::filesystem::path& filepath) { mainPlayer.sendMsg(GameMessage_Chat(getPlayerId(), ChatDestination::System, _("Saving game..."))); // Mond malen Position moonPos = VIDEODRIVER.getMousePos(); moonPos.y -= 40; - LOADER.getImageN("resource", 33)->DrawFull(moonPos); - VIDEODRIVER.SwapBuffers(); + LOADER.getImageN("resource", 33)->drawFull(moonPos); + VIDEODRIVER.swapBuffers(); Savegame save; - WritePlayerInfo(save); + writePlayerInfo(save); // GGS-Daten save.ggs = game->ggs_; @@ -1697,19 +1697,19 @@ bool GameClient::SaveToFile(const boost::filesystem::path& filepath) try { // Spiel serialisieren - save.sgd.MakeSnapshot(*game); + save.sgd.makeSnapshot(*game); // Und alles speichern - return save.Save(filepath, mapinfo.title); + return save.save(filepath, mapinfo.title); } catch(const std::exception& e) { - SystemChat(std::string(_("Error during saving: ")) + e.what()); + systemChat(std::string(_("Error during saving: ")) + e.what()); return false; } } -void GameClient::ResetVisualSettings() +void GameClient::resetVisualSettings() { - getPlayer(getPlayerId()).FillVisualSettings(visual_settings); + getPlayer(getPlayerId()).fillVisualSettings(visual_settings); } void GameClient::setPause(bool pause) @@ -1731,7 +1731,7 @@ void GameClient::setPause(bool pause) { auto* msg = new GameMessage_Pause(pause); if(pause) - OnGameMessage(*msg); + onGameMessage(*msg); mainPlayer.sendMsgAsync(msg); } } @@ -1752,7 +1752,7 @@ unsigned GameClient::getLastReplayGF() const return replayinfo ? replayinfo->replay.getLastGF() : 0u; } -bool GameClient::AddGC(gc::GameCommandPtr gc) +bool GameClient::addGC(gc::GameCommandPtr gc) { // Nicht in der Pause oder wenn er besiegt wurde if(framesinfo.isPaused || getPlayer(getPlayerId()).IsDefeated() || isReplayModeOn()) @@ -1775,13 +1775,13 @@ GamePlayer& GameClient::getPlayer(const unsigned id) return game->world_.getPlayer(id); } -std::unique_ptr GameClient::CreateAIPlayer(unsigned playerId, const AI::Info& aiInfo) +std::unique_ptr GameClient::createAIPlayer(unsigned playerId, const AI::Info& aiInfo) { - return AIFactory::Create(aiInfo, playerId, game->world_); + return AIFactory::create(aiInfo, playerId, game->world_); } /// Wandelt eine GF-Angabe in eine Zeitangabe um (HH:MM:SS oder MM:SS wenn Stunden = 0) -std::string GameClient::FormatGFTime(const unsigned gf) const +std::string GameClient::formatGFTime(const unsigned gf) const { using seconds = std::chrono::duration; using hours = std::chrono::duration; @@ -1832,7 +1832,7 @@ unsigned GameClient::getTournamentModeDuration() const return 0; } -void GameClient::ToggleHumanAIPlayer(const AI::Info& aiInfo) +void GameClient::toggleHumanAIPlayer(const AI::Info& aiInfo) { RTTR_Assert(!isReplayModeOn()); auto it = helpers::find_if(game->aiPlayers_, @@ -1840,15 +1840,15 @@ void GameClient::ToggleHumanAIPlayer(const AI::Info& aiInfo) if(it != game->aiPlayers_.end()) { game->aiPlayers_.erase(it); - SystemChat(_("Disabled AI for current player")); + systemChat(_("Disabled AI for current player")); } else { - game->AddAIPlayer(CreateAIPlayer(getPlayerId(), aiInfo)); - SystemChat(_("Enabled AI for current player")); + game->addAIPlayer(createAIPlayer(getPlayerId(), aiInfo)); + systemChat(_("Enabled AI for current player")); } } -void GameClient::RequestSwapToPlayer(const unsigned char newId) +void GameClient::requestSwapToPlayer(const unsigned char newId) { if(state != ClientState::Game) return; diff --git a/libs/s25main/network/GameClient.h b/libs/s25main/network/GameClient.h index 50a6d87624..ee290d2b0d 100644 --- a/libs/s25main/network/GameClient.h +++ b/libs/s25main/network/GameClient.h @@ -66,7 +66,7 @@ class GameClient final : void setInterface(ClientInterface* ci) { this->ci = ci; } /// Removes the given interface (if it is not yet overwritten by another one) - void RemoveInterface(ClientInterface* ci) + void removeInterface(ClientInterface* ci) { if(this->ci == ci) this->ci = nullptr; @@ -78,13 +78,13 @@ class GameClient final : unsigned getPlayerId() const override { return mainPlayer.playerId; } - bool Connect(const std::string& server, const std::string& password, ServerType servertyp, unsigned short port, + bool connect(const std::string& server, const std::string& password, ServerType servertyp, unsigned short port, bool host, bool use_ipv6); /// Start the server and connect to it - bool HostGame(const CreateServerInfo& csi, const MapDescription& map); - void Run(); - void Stop(); + bool hostGame(const CreateServerInfo& csi, const MapDescription& map); + void run(); + void stop(); /// Gibt Map-Titel zurück const std::string& getMapTitle() const { return mapinfo.title; } @@ -95,12 +95,12 @@ class GameClient final : const boost::filesystem::path& getLuaFilePath() const { return mapinfo.luaFilepath; } // Initialisiert und startet das Spiel - void StartGame(unsigned random_init); + void startGame(unsigned random_init); /// Called when the game is loaded - void GameLoaded(); + void gameLoaded(); /// Beendet das Spiel, zerstört die Spielstrukturen - void ExitGame(); + void exitGame(); ClientState getState() const { return state; } Replay* getReplay(); @@ -114,8 +114,8 @@ class GameClient final : std::chrono::milliseconds getFrameTime() const { return framesinfo.frameTime; } unsigned getGlobalAnimation(unsigned short max, unsigned char factor_numerator, unsigned char factor_denumerator, unsigned offset); - unsigned Interpolate(unsigned maxVal, const GameEvent* ev) const; - int Interpolate(int x1, int x2, const GameEvent* ev) const; + unsigned interpolate(unsigned maxVal, const GameEvent* ev) const; + int interpolate(int x1, int x2, const GameEvent* ev) const; void commandChat(const std::string& text, ChatDestination cd); void commandSetNation(Nation newNation); @@ -126,16 +126,16 @@ class GameClient final : /// Called internally when the game is ready to start (loaded and all players ready) /// And a 2nd time when the GUI is ready which actually starty the game - void OnGameStart(); + void onGameStart(); - void IncreaseSpeed(bool wraparound = false); - void DecreaseSpeed(); + void increaseSpeed(bool wraparound = false); + void decreaseSpeed(); void setNewSpeed(std::chrono::milliseconds gfLength); // Used by tests (stinks, but what to do?) std::chrono::milliseconds getGFLengthReq() { return framesinfo.gfLengthReq; } /// Lädt ein Replay und startet dementsprechend das Spiel - bool StartReplay(const boost::filesystem::path& path); + bool startReplay(const boost::filesystem::path& path); /// When a non-empty vector is given then an AI battle with the given AIs is started void setAIBattlePlayers(std::vector aiInfos); @@ -143,7 +143,7 @@ class GameClient final : bool isAIBattleModeOn() const { return !aiBattlePlayers_.empty(); } void setPause(bool pause); - void TogglePause() { setPause(!framesinfo.isPaused); } + void togglePause() { setPause(!framesinfo.isPaused); } /// Hide or show the fog-of-war. Only in replay mode void setReplayFOW(bool hideFOW); /// Return whether we are in replay mode and fog-of-war is disabled @@ -151,7 +151,7 @@ class GameClient final : /// Gibt Replay-Ende (GF) zurück unsigned getLastReplayGF() const; /// Wandelt eine GF-Angabe in eine Zeitangabe um (HH:MM:SS oder MM:SS wenn Stunden = 0) - std::string FormatGFTime(unsigned gf) const override; + std::string formatGFTime(unsigned gf) const override; /// Gibt Replay-Dateiname zurück const boost::filesystem::path& getReplayFilename() const; @@ -161,52 +161,52 @@ class GameClient final : /// Is tournament mode activated (0 if not)? Returns the durations of the tournament mode in gf otherwise unsigned getTournamentModeDuration() const; - void SkipGF(unsigned gf, GameWorldView& gwv); + void skipGF(unsigned gf, GameWorldView& gwv); /// Changes the player ingame (for replay or debugging) - void ChangePlayerIngame(unsigned char playerId1, unsigned char playerId2); + void changePlayerIngame(unsigned char playerId1, unsigned char playerId2); /// Sends a request to swap places with the requested player. Only for debugging! - void RequestSwapToPlayer(unsigned char newId); + void requestSwapToPlayer(unsigned char newId); /// Spiel pausiert? bool isPaused() const { return framesinfo.isPaused; } /// Schreibt Header der Save-Datei - bool SaveToFile(const boost::filesystem::path& filepath); + bool saveToFile(const boost::filesystem::path& filepath); /// Visuelle Einstellungen aus den richtigen ableiten - void ResetVisualSettings(); - void SystemChat(const std::string& text) override; - void SystemChat(const std::string& text, unsigned char fromPlayerIdx); + void resetVisualSettings(); + void systemChat(const std::string& text) override; + void systemChat(const std::string& text, unsigned char fromPlayerIdx); /// Toggle current player to be an AI player of the given type - void ToggleHumanAIPlayer(const AI::Info& aiInfo); + void toggleHumanAIPlayer(const AI::Info& aiInfo); NetworkPlayer& getMainPlayer() { return mainPlayer; } private: /// Create an AI player for the current world - std::unique_ptr CreateAIPlayer(unsigned playerId, const AI::Info& aiInfo); + std::unique_ptr createAIPlayer(unsigned playerId, const AI::Info& aiInfo); /// Add the gamecommand. Return true in success, false otherwise (paused, or defeated) - bool AddGC(gc::GameCommandPtr gc) override; + bool addGC(gc::GameCommandPtr gc) override; unsigned getNumPlayers() const; /// Liefert einen Player zurück GamePlayer& getPlayer(unsigned id); /// Versucht einen neuen GameFrame auszuführen, falls die Zeit dafür gekommen ist - void ExecuteGameFrame(); + void executeGameFrame(); void executeGameFrameReplay(); - void ExecuteNWF(); + void executeNWF(); /// Filtert aus einem Network-Command-Paket alle Commands aus und führt sie aus, falls ein Spielerwechsel-Command /// dabei ist, füllt er die übergebenen IDs entsprechend aus - void ExecuteAllGCs(uint8_t playerId, const PlayerGameCommands& gcs); + void executeAllGCs(uint8_t playerId, const PlayerGameCommands& gcs); /// Sendet ein NC-Paket ohne Befehle - void SendNothingNC(uint8_t player = 0xFF); + void sendNothingNC(uint8_t player = 0xFF); /// Führt notwendige Dinge für nächsten GF aus - void NextGF(bool wasNWF); + void nextGF(bool wasNWF); /// Checks if its time for autosaving (if enabled) and does it - void HandleAutosave(); + void handleAutosave(); /// Interpolate implementation for generic types /// Returns x in [x1, x2] according to the current time in the range of the events duration. @@ -215,64 +215,64 @@ class GameClient final : // Netzwerknachrichten RTTR_IGNORE_OVERLOADED_VIRTUAL - bool OnGameMessage(const GameMessage_Ping& msg) override; - - bool OnGameMessage(const GameMessage_Server_TypeOK& msg) override; - bool OnGameMessage(const GameMessage_Server_Password& msg) override; - bool OnGameMessage(const GameMessage_Server_Name& msg) override; - bool OnGameMessage(const GameMessage_Server_Start& msg) override; - bool OnGameMessage(const GameMessage_Chat& msg) override; - bool OnGameMessage(const GameMessage_Server_Async& msg) override; - bool OnGameMessage(const GameMessage_Countdown& msg) override; - bool OnGameMessage(const GameMessage_CancelCountdown& msg) override; - - bool OnGameMessage(const GameMessage_Player_Id& msg) override; - bool OnGameMessage(const GameMessage_Player_List& msg) override; - bool OnGameMessage(const GameMessage_Player_Name& msg) override; - bool OnGameMessage(const GameMessage_Player_Portrait& msg) override; - bool OnGameMessage(const GameMessage_Player_State& msg) override; - bool OnGameMessage(const GameMessage_Player_Nation& msg) override; - bool OnGameMessage(const GameMessage_Player_Team& msg) override; - bool OnGameMessage(const GameMessage_Player_Color& msg) override; - bool OnGameMessage(const GameMessage_Player_Kicked& msg) override; - bool OnGameMessage(const GameMessage_Player_Ping& msg) override; - bool OnGameMessage(const GameMessage_Player_New& msg) override; - bool OnGameMessage(const GameMessage_Player_Ready& msg) override; - bool OnGameMessage(const GameMessage_Player_Swap& msg) override; - - bool OnGameMessage(const GameMessage_Map_Info& msg) override; - bool OnGameMessage(const GameMessage_Map_Data& msg) override; - bool OnGameMessage(const GameMessage_Map_ChecksumOK& msg) override; - - bool OnGameMessage(const GameMessage_Pause& msg) override; - bool OnGameMessage(const GameMessage_SkipToGF& msg) override; - bool OnGameMessage(const GameMessage_Server_NWFDone& msg) override; - bool OnGameMessage(const GameMessage_GameCommand& msg) override; - - bool OnGameMessage(const GameMessage_GGSChange& msg) override; - bool OnGameMessage(const GameMessage_RemoveLua& msg) override; - - bool OnGameMessage(const GameMessage_GetAsyncLog& msg) override; + bool onGameMessage(const GameMessage_Ping& msg) override; + + bool onGameMessage(const GameMessage_Server_TypeOK& msg) override; + bool onGameMessage(const GameMessage_Server_Password& msg) override; + bool onGameMessage(const GameMessage_Server_Name& msg) override; + bool onGameMessage(const GameMessage_Server_Start& msg) override; + bool onGameMessage(const GameMessage_Chat& msg) override; + bool onGameMessage(const GameMessage_Server_Async& msg) override; + bool onGameMessage(const GameMessage_Countdown& msg) override; + bool onGameMessage(const GameMessage_CancelCountdown& msg) override; + + bool onGameMessage(const GameMessage_Player_Id& msg) override; + bool onGameMessage(const GameMessage_Player_List& msg) override; + bool onGameMessage(const GameMessage_Player_Name& msg) override; + bool onGameMessage(const GameMessage_Player_Portrait& msg) override; + bool onGameMessage(const GameMessage_Player_State& msg) override; + bool onGameMessage(const GameMessage_Player_Nation& msg) override; + bool onGameMessage(const GameMessage_Player_Team& msg) override; + bool onGameMessage(const GameMessage_Player_Color& msg) override; + bool onGameMessage(const GameMessage_Player_Kicked& msg) override; + bool onGameMessage(const GameMessage_Player_Ping& msg) override; + bool onGameMessage(const GameMessage_Player_New& msg) override; + bool onGameMessage(const GameMessage_Player_Ready& msg) override; + bool onGameMessage(const GameMessage_Player_Swap& msg) override; + + bool onGameMessage(const GameMessage_Map_Info& msg) override; + bool onGameMessage(const GameMessage_Map_Data& msg) override; + bool onGameMessage(const GameMessage_Map_ChecksumOK& msg) override; + + bool onGameMessage(const GameMessage_Pause& msg) override; + bool onGameMessage(const GameMessage_SkipToGF& msg) override; + bool onGameMessage(const GameMessage_Server_NWFDone& msg) override; + bool onGameMessage(const GameMessage_GameCommand& msg) override; + + bool onGameMessage(const GameMessage_GGSChange& msg) override; + bool onGameMessage(const GameMessage_RemoveLua& msg) override; + + bool onGameMessage(const GameMessage_GetAsyncLog& msg) override; RTTR_POP_DIAGNOSTIC /// Report the error and stop - void OnError(ClientError error); + void onError(ClientError error); /// Advance to new connect state - void AdvanceState(ConnectState newState); + void advanceState(ConnectState newState); /// Verifies that the current connect state matches the expected one /// On error the error is reported and the connection terminated as likely the server is faulty - bool VerifyState(ConnectState expectedState); + bool verifyState(ConnectState expectedState); - bool CreateLobby(); + bool createLobby(); /// Wird aufgerufen, wenn der Server gegangen ist (Verbindung verloren, ungültige Nachricht etc.) - void ServerLost(); + void serverLost(); // Replaymethoden /// Schreibt den Header der Replaydatei - void StartReplayRecording(unsigned random_init); - void WritePlayerInfo(SavedFile& file); + void startReplayRecording(unsigned random_init); + void writePlayerInfo(SavedFile& file); public: /// Virtuelle Werte der Einstellungsfenster, die aber noch nicht wirksam sind, nur um die Verzögerungen zu @@ -298,8 +298,8 @@ class GameClient final : class ClientConfig { public: - ClientConfig() { Clear(); } - void Clear(); + ClientConfig() { clear(); } + void clear(); std::string server; std::string gameName; diff --git a/libs/s25main/network/GameClientCommands.cpp b/libs/s25main/network/GameClientCommands.cpp index c367cef6a4..e7106db2ed 100644 --- a/libs/s25main/network/GameClientCommands.cpp +++ b/libs/s25main/network/GameClientCommands.cpp @@ -58,7 +58,7 @@ void GameClient::commandSetColor(unsigned newColor) * @param[in] old_id Alte Spieler-ID * @param[in] new_id Neue Spieler-ID */ -void GameClient::ChangePlayerIngame(const unsigned char playerId1, const unsigned char playerId2) +void GameClient::changePlayerIngame(const unsigned char playerId1, const unsigned char playerId2) { RTTR_Assert(state == ClientState::Game); // Must be ingame @@ -97,7 +97,7 @@ void GameClient::ChangePlayerIngame(const unsigned char playerId1, const unsigne { // Switch AIs game->aiPlayers_.erase_if([playerId2](const auto& player) { return player.getPlayerId() == playerId2; }); - game->AddAIPlayer(CreateAIPlayer(playerId1, AI::Info(AI::Type::Dummy))); + game->addAIPlayer(createAIPlayer(playerId1, AI::Info(AI::Type::Dummy))); } getPlayer(playerId1).ps = PlayerState::AI; getPlayer(playerId2).ps = PlayerState::Occupied; diff --git a/libs/s25main/network/GameClientGF_Game.cpp b/libs/s25main/network/GameClientGF_Game.cpp index abc8246321..8db4d296be 100644 --- a/libs/s25main/network/GameClientGF_Game.cpp +++ b/libs/s25main/network/GameClientGF_Game.cpp @@ -10,7 +10,7 @@ #include "ai/AIPlayer.h" #include "network/GameClient.h" -void GameClient::ExecuteNWF() +void GameClient::executeNWF() { // Geschickte Network Commands der Spieler ausführen und ggf. im Replay aufzeichnen @@ -27,11 +27,11 @@ void GameClient::ExecuteNWF() { // Set the current checksum as the GF checksum. The checksum from the command is from the last NWF! PlayerGameCommands replayCmds(checksum, currentGCs.gcs); - replayinfo->replay.AddGameCommand(curGF, player.id, replayCmds); + replayinfo->replay.addGameCommand(curGF, player.id, replayCmds); } // Das ganze Zeug soll die andere Funktion ausführen - ExecuteAllGCs(player.id, currentGCs); + executeAllGCs(player.id, currentGCs); } // Send GC message for this NWF @@ -44,7 +44,7 @@ void GameClient::ExecuteNWF() gameCommands_.insert(gameCommands_.end(), aiGCs.begin(), aiGCs.end()); else mainPlayer.sendMsgAsync(new GameMessage_GameCommand(ai.getPlayerId(), checksum, aiGCs)); - for(auto& msg : ai.getAIInterface().FetchChatMessages()) + for(auto& msg : ai.getAIInterface().fetchChatMessages()) mainPlayer.sendMsgAsync(msg.release()); } mainPlayer.sendMsgAsync(new GameMessage_GameCommand(0xFF, checksum, gameCommands_)); diff --git a/libs/s25main/network/GameClientGF_Replay.cpp b/libs/s25main/network/GameClientGF_Replay.cpp index 01d92e55d9..f6e217ca18 100644 --- a/libs/s25main/network/GameClientGF_Replay.cpp +++ b/libs/s25main/network/GameClientGF_Replay.cpp @@ -44,7 +44,7 @@ void GameClient::executeGameFrameReplay() } // Run game simulation - NextGF(result.executedGameCommands); + nextGF(result.executedGameCommands); // Check for game end if(curGF == replayinfo->replay.getLastGF()) diff --git a/libs/s25main/network/GameMessage.cpp b/libs/s25main/network/GameMessage.cpp index 79c60f79f2..65b99c4d14 100644 --- a/libs/s25main/network/GameMessage.cpp +++ b/libs/s25main/network/GameMessage.cpp @@ -10,7 +10,7 @@ bool GameMessage::run(MessageInterface* callback, unsigned senderPlayerID) { this->senderPlayerID = senderPlayerID; - return Run(checkedCast(callback)); + return runGame(checkedCast(callback)); } Message* GameMessage::createGame(unsigned short id) diff --git a/libs/s25main/network/GameMessage.h b/libs/s25main/network/GameMessage.h index df77f9646e..49b5267d14 100644 --- a/libs/s25main/network/GameMessage.h +++ b/libs/s25main/network/GameMessage.h @@ -19,7 +19,7 @@ class GameMessage : public Message GameMessage(uint16_t id) : Message(id) {} /// Run Methode für GameMessages, wobei PlayerId ggf. schon in der Message festgemacht wurde - virtual bool Run(GameMessageInterface* callback) const = 0; + virtual bool runGame(GameMessageInterface* callback) const = 0; bool run(MessageInterface* callback, unsigned senderPlayerID) override; diff --git a/libs/s25main/network/GameMessageInterface.h b/libs/s25main/network/GameMessageInterface.h index 997f28fd0e..a5e4b269d2 100644 --- a/libs/s25main/network/GameMessageInterface.h +++ b/libs/s25main/network/GameMessageInterface.h @@ -14,7 +14,7 @@ BOOST_PP_SEQ_FOR_EACH(__GENERATE_FWD_DECL_SINGLE, 0, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)) #define __GENERATE_CALLBACK_SINGLE(s, data, expression) \ - virtual bool OnGameMessage(const expression& /*msg*/) { return false; } + virtual bool onGameMessage(const expression& /*msg*/) { return false; } #define __GENERATE_CALLBACKS(...) \ BOOST_PP_SEQ_FOR_EACH(__GENERATE_CALLBACK_SINGLE, 0, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)) diff --git a/libs/s25main/network/GameMessage_Chat.cpp b/libs/s25main/network/GameMessage_Chat.cpp index 4449bf39c6..385a85246c 100644 --- a/libs/s25main/network/GameMessage_Chat.cpp +++ b/libs/s25main/network/GameMessage_Chat.cpp @@ -21,7 +21,7 @@ void GameMessage_Chat::Deserialize(Serializer& ser) text = ser.PopString(); } -bool GameMessage_Chat::Run(GameMessageInterface* callback) const +bool GameMessage_Chat::runGame(GameMessageInterface* callback) const { - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } diff --git a/libs/s25main/network/GameMessage_Chat.h b/libs/s25main/network/GameMessage_Chat.h index 524143f54d..41eec0ef12 100644 --- a/libs/s25main/network/GameMessage_Chat.h +++ b/libs/s25main/network/GameMessage_Chat.h @@ -22,5 +22,5 @@ class GameMessage_Chat : public GameMessageWithPlayer void Serialize(Serializer& ser) const override; void Deserialize(Serializer& ser) override; - bool Run(GameMessageInterface* callback) const override; + bool runGame(GameMessageInterface* callback) const override; }; diff --git a/libs/s25main/network/GameMessage_GameCommand.cpp b/libs/s25main/network/GameMessage_GameCommand.cpp index 391fe9f31b..3e09a8f89d 100644 --- a/libs/s25main/network/GameMessage_GameCommand.cpp +++ b/libs/s25main/network/GameMessage_GameCommand.cpp @@ -28,7 +28,7 @@ void GameMessage_GameCommand::Deserialize(Serializer& ser) cmds.Deserialize(deser); } -bool GameMessage_GameCommand::Run(GameMessageInterface* callback) const +bool GameMessage_GameCommand::runGame(GameMessageInterface* callback) const { - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } diff --git a/libs/s25main/network/GameMessage_GameCommand.h b/libs/s25main/network/GameMessage_GameCommand.h index 7c4369c7ac..b2590ea4e3 100644 --- a/libs/s25main/network/GameMessage_GameCommand.h +++ b/libs/s25main/network/GameMessage_GameCommand.h @@ -21,5 +21,5 @@ class GameMessage_GameCommand : public GameMessageWithPlayer void Serialize(Serializer& ser) const override; void Deserialize(Serializer& ser) override; - bool Run(GameMessageInterface* callback) const override; + bool runGame(GameMessageInterface* callback) const override; }; diff --git a/libs/s25main/network/GameMessages.cpp b/libs/s25main/network/GameMessages.cpp index b8ef2164d2..5aaebcf402 100644 --- a/libs/s25main/network/GameMessages.cpp +++ b/libs/s25main/network/GameMessages.cpp @@ -36,7 +36,7 @@ void GameMessage_Player_List::Deserialize(Serializer& ser) playerInfos.push_back(JoinPlayerInfo(ser)); } -bool GameMessage_Player_List::Run(GameMessageInterface* callback) const +bool GameMessage_Player_List::runGame(GameMessageInterface* callback) const { LOG.writeToFile("<<< NMS_PLAYER_LIST(%d)\n") % playerInfos.size(); for(unsigned i = 0; i < playerInfos.size(); ++i) @@ -46,7 +46,7 @@ bool GameMessage_Player_List::Run(GameMessageInterface* callback) const % playerInfo.ping % rttr::enum_cast(playerInfo.nation) % playerInfo.color % rttr::enum_cast(playerInfo.team) % (playerInfo.isReady ? "true" : "false"); } - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } void GameMessage_Server_Async::Serialize(Serializer& ser) const diff --git a/libs/s25main/network/GameMessages.h b/libs/s25main/network/GameMessages.h index 776d0d0e26..1f8f554f1e 100644 --- a/libs/s25main/network/GameMessages.h +++ b/libs/s25main/network/GameMessages.h @@ -39,10 +39,10 @@ class GameMessage_Ping : public GameMessageWithPlayer GameMessage_Ping() : GameMessageWithPlayer(NMS_PING) {} GameMessage_Ping(uint8_t player) : GameMessageWithPlayer(NMS_PING, player) {} - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { // LOG.writeToFile("<<< NMS_PING\n"); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -51,10 +51,10 @@ class GameMessage_Pong : public GameMessage { public: GameMessage_Pong() : GameMessage(NMS_PONG) {} - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { // LOG.writeToFile("<<< NMS_PONG\n"); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -86,10 +86,10 @@ class GameMessage_Server_Type : public GameMessage revision = ser.PopLongString(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_SERVER_Type(%d, %s)\n") % static_cast(type) % revision; - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -116,7 +116,7 @@ class GameMessage_Server_TypeOK : public GameMessage void Serialize(Serializer& ser) const override; void Deserialize(Serializer& ser) override; - bool Run(GameMessageInterface* callback) const override { return callback->OnGameMessage(*this); } + bool runGame(GameMessageInterface* callback) const override { return callback->onGameMessage(*this); } }; /// ein/ausgehende Server-Password-Nachricht @@ -141,10 +141,10 @@ class GameMessage_Server_Password : public GameMessage password = ser.PopString(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_SERVER_PASSWORD(%s)\n") % "********"; - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -170,10 +170,10 @@ class GameMessage_Server_Name : public GameMessage name = ser.PopString(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_SERVER_NAME(%s)\n") % name; - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -205,10 +205,10 @@ class GameMessage_Server_Start : public GameMessage cmdDelay = ser.PopUnsignedInt(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_SERVER_START(%d, %d, %d)\n") % random_init % firstNwf % cmdDelay; - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -235,10 +235,10 @@ class GameMessage_Countdown : public GameMessage countdown = ser.PopUnsignedInt(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_SERVERCOUNTDOWN(%d)\n") % countdown; - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -260,7 +260,7 @@ class GameMessage_CancelCountdown : public GameMessage GameMessage::Deserialize(ser); error = ser.PopBool(); } - bool Run(GameMessageInterface* callback) const override { return callback->OnGameMessage(*this); } + bool runGame(GameMessageInterface* callback) const override { return callback->onGameMessage(*this); } }; /// eingehende Server-Async-Nachricht @@ -280,10 +280,10 @@ class GameMessage_Server_Async : public GameMessage void Deserialize(Serializer& ser) override; - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_SERVER_ASYNC(%d)\n") % checksums.size(); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -297,10 +297,10 @@ class GameMessage_Player_Id : public GameMessageWithPlayer LOG.writeToFile(">>> NMS_PLAYER_ID(%d)\n") % unsigned(playerId); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_PLAYER_ID(%d)\n") % unsigned(player); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -330,10 +330,10 @@ class GameMessage_Player_Name : public GameMessageWithPlayer playername = ser.PopString(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_PLAYER_NAME(%s)\n") % playername; - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -359,10 +359,10 @@ class GameMessage_Player_Portrait : public GameMessageWithPlayer playerPortraitIndex = ser.PopUnsignedInt(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_PLAYER_PORTRAIT(%u)\n") % playerPortraitIndex; - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -378,7 +378,7 @@ class GameMessage_Player_List : public GameMessage void Serialize(Serializer& ser) const override; void Deserialize(Serializer& ser) override; - bool Run(GameMessageInterface* callback) const override; + bool runGame(GameMessageInterface* callback) const override; }; /// gehende -Nachricht @@ -411,10 +411,10 @@ class GameMessage_Player_State : public GameMessageWithPlayer aiInfo.type = helpers::popEnum(ser); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_PLAYER_SETSTATE(%d)\n") % unsigned(player); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -444,10 +444,10 @@ class GameMessage_Player_Nation : public GameMessageWithPlayer nation = helpers::popEnum(ser); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_PLAYER_SET_NATION\n"); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -476,10 +476,10 @@ class GameMessage_Player_Team : public GameMessageWithPlayer team = helpers::popEnum(ser); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_PLAYER_SET_TEAM\n"); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -507,10 +507,10 @@ class GameMessage_Player_Color : public GameMessageWithPlayer color = ser.PopUnsignedInt(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_PLAYER_SET_COLOR\n"); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -540,7 +540,7 @@ class GameMessage_Player_Kicked : public GameMessageWithPlayer param = ser.PopUnsignedInt(); } - bool Run(GameMessageInterface* callback) const override { return callback->OnGameMessage(*this); } + bool runGame(GameMessageInterface* callback) const override { return callback->onGameMessage(*this); } }; /// gehende Player-Ping-Nachricht @@ -565,10 +565,10 @@ class GameMessage_Player_Ping : public GameMessageWithPlayer ping = ser.PopUnsignedShort(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { // LOG.writeToFile("<<< NMS_PLAYER_PING\n"); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -598,10 +598,10 @@ class GameMessage_Player_New : public GameMessageWithPlayer name = ser.PopString(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_PLAYER_NEW\n"); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -630,10 +630,10 @@ class GameMessage_Player_Ready : public GameMessageWithPlayer ready = ser.PopBool(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_PLAYER_READY\n"); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -662,10 +662,10 @@ class GameMessage_Player_Swap : public GameMessageWithPlayer player2 = ser.PopUnsignedChar(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_PLAYER_SWAP\n"); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -692,7 +692,7 @@ class GameMessage_Player_SwapConfirm : public GameMessageWithPlayer player2 = ser.PopUnsignedChar(); } - bool Run(GameMessageInterface* callback) const override { return callback->OnGameMessage(*this); } + bool runGame(GameMessageInterface* callback) const override { return callback->onGameMessage(*this); } }; class GameMessage_Map_Info : public GameMessage @@ -736,10 +736,10 @@ class GameMessage_Map_Info : public GameMessage luaCompressedLen = ser.PopUnsignedInt(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_MAP_INFO\n"); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -763,7 +763,7 @@ class GameMessage_MapRequest : public GameMessage requestInfo = ser.PopBool(); } - bool Run(GameMessageInterface* callback) const override { return callback->OnGameMessage(*this); } + bool runGame(GameMessageInterface* callback) const override { return callback->onGameMessage(*this); } }; class GameMessage_Map_Data : public GameMessage @@ -801,10 +801,10 @@ class GameMessage_Map_Data : public GameMessage ser.PopRawData(&data.front(), data.size()); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_MAP_DATA\n"); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -835,10 +835,10 @@ class GameMessage_Map_Checksum : public GameMessage luaChecksum = ser.PopUnsignedInt(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_MAP_CHECKSUM\n"); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -868,7 +868,7 @@ class GameMessage_Map_ChecksumOK : public GameMessage retryAllowed = ser.PopBool(); } - bool Run(GameMessageInterface* callback) const override { return callback->OnGameMessage(*this); } + bool runGame(GameMessageInterface* callback) const override { return callback->onGameMessage(*this); } }; class GameMessage_GGSChange : public GameMessage @@ -895,10 +895,10 @@ class GameMessage_GGSChange : public GameMessage ggs.Deserialize(ser); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_GGS_CHANGE\n"); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -907,7 +907,7 @@ class GameMessage_RemoveLua : public GameMessage public: GameMessage_RemoveLua() : GameMessage(NMS_REMOVE_LUA) {} - bool Run(GameMessageInterface* callback) const override { return callback->OnGameMessage(*this); } + bool runGame(GameMessageInterface* callback) const override { return callback->onGameMessage(*this); } }; class GameMessage_Speed : public GameMessage @@ -933,10 +933,10 @@ class GameMessage_Speed : public GameMessage gf_length = decltype(gf_length)(ser.PopUnsignedInt()); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_SERVER_SPEED(%d)\n") % gf_length.count(); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -968,10 +968,10 @@ class GameMessage_Server_NWFDone : public GameMessage nextNWF = ser.PopUnsignedInt(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_NWF_DONE(%d, %d, %d)\n") % gf % gf_length % nextNWF; - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -999,10 +999,10 @@ class GameMessage_Pause : public GameMessage paused = ser.PopBool(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_PAUSE(%d)\n") % (paused ? 1 : 0); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; @@ -1026,7 +1026,7 @@ class GameMessage_SkipToGF : public GameMessage targetGF = ser.PopUnsignedInt(); } - bool Run(GameMessageInterface* callback) const override { return callback->OnGameMessage(*this); } + bool runGame(GameMessageInterface* callback) const override { return callback->onGameMessage(*this); } }; /// ausgehende GetAsyncLog-Nachricht @@ -1034,7 +1034,7 @@ class GameMessage_GetAsyncLog : public GameMessage { public: GameMessage_GetAsyncLog() : GameMessage(NMS_GET_ASYNC_LOG) {} - bool Run(GameMessageInterface* callback) const override { return callback->OnGameMessage(*this); } + bool runGame(GameMessageInterface* callback) const override { return callback->onGameMessage(*this); } }; /// eingehende SendAsyncLog-Nachricht @@ -1084,9 +1084,9 @@ class GameMessage_AsyncLog : public GameMessage last = ser.PopBool(); } - bool Run(GameMessageInterface* callback) const override + bool runGame(GameMessageInterface* callback) const override { LOG.writeToFile("<<< NMS_SEND_ASYNC_LOG: %u [%s]\n") % entries.size() % (last ? "last" : "non-last"); - return callback->OnGameMessage(*this); + return callback->onGameMessage(*this); } }; diff --git a/libs/s25main/network/GameServer.cpp b/libs/s25main/network/GameServer.cpp index 3317cdd73f..92d16f9732 100644 --- a/libs/s25main/network/GameServer.cpp +++ b/libs/s25main/network/GameServer.cpp @@ -55,10 +55,10 @@ struct GameServer::AsyncLog GameServer::ServerConfig::ServerConfig() { - Clear(); + clear(); } -void GameServer::ServerConfig::Clear() +void GameServer::ServerConfig::clear() { servertype = ServerType::Local; gamename.clear(); @@ -69,19 +69,19 @@ void GameServer::ServerConfig::Clear() GameServer::CountDown::CountDown() : isActive(false), remainingSecs(0) {} -void GameServer::CountDown::Start(unsigned timeInSec) +void GameServer::CountDown::start(unsigned timeInSec) { isActive = true; remainingSecs = timeInSec; lasttime = SteadyClock::now(); } -void GameServer::CountDown::Stop() +void GameServer::CountDown::stop() { isActive = false; } -bool GameServer::CountDown::Update() +bool GameServer::CountDown::update() { RTTR_Assert(isActive); SteadyClock::time_point curTime = SteadyClock::now(); @@ -91,7 +91,7 @@ bool GameServer::CountDown::Update() return false; if(remainingSecs == 0) { - Stop(); + stop(); return true; } // 1s has passed -> Reduce remaining time @@ -104,14 +104,14 @@ GameServer::GameServer() : skiptogf(0), state(ServerState::Stopped), currentGF(0 GameServer::~GameServer() { - Stop(); + stop(); } /////////////////////////////////////////////////////////////////////////////// // Spiel hosten -bool GameServer::Start(const CreateServerInfo& csi, const MapDescription& map, const std::string& hostPw) +bool GameServer::start(const CreateServerInfo& csi, const MapDescription& map, const std::string& hostPw) { - Stop(); + stop(); // Name, Password und Kartenname kopieren config.gamename = csi.gameName; @@ -142,7 +142,7 @@ bool GameServer::Start(const CreateServerInfo& csi, const MapDescription& map, c playerInfos.resize(header.getNumPlayers()); mapinfo.title = s25util::ansiToUTF8(header.getName()); - ggs_.LoadSettings(); + ggs_.loadSettings(); currentGF = 0; } break; @@ -182,7 +182,7 @@ bool GameServer::Start(const CreateServerInfo& csi, const MapDescription& map, c LOG.write("Map %1% has too many players! (%1% > %2%)\n") % mapinfo.filepath % playerInfos.size() % MAX_PLAYERS; return false; } - if(!mapinfo.mapData.CompressFromFile(mapinfo.filepath, &mapinfo.mapChecksum)) + if(!mapinfo.mapData.compressFromFile(mapinfo.filepath, &mapinfo.mapChecksum)) return false; if(map.lua_path.has_value() && !bfs::is_regular_file(*map.lua_path)) @@ -191,7 +191,7 @@ bool GameServer::Start(const CreateServerInfo& csi, const MapDescription& map, c bfs::path luaFilePath = map.lua_path.value_or(bfs::path(mapinfo.filepath).replace_extension("lua")); if(bfs::is_regular_file(luaFilePath)) { - if(!mapinfo.luaData.CompressFromFile(luaFilePath, &mapinfo.luaChecksum)) + if(!mapinfo.luaData.compressFromFile(luaFilePath, &mapinfo.luaChecksum)) return false; mapinfo.luaFilepath = luaFilePath; } else @@ -221,7 +221,7 @@ bool GameServer::Start(const CreateServerInfo& csi, const MapDescription& map, c LOBBYCLIENT.AddServer(config.gamename, mapinfo.title, (!config.password.empty()), config.port); LOBBYCLIENT.AddListener(this); } - AnnounceStatusChange(); + announceStatusChange(); return true; } @@ -237,7 +237,7 @@ unsigned GameServer::getNumFilledSlots() const return numFilled; } -void GameServer::AnnounceStatusChange() +void GameServer::announceStatusChange() { if(config.servertype == ServerType::LAN) { @@ -264,34 +264,34 @@ void GameServer::AnnounceStatusChange() void GameServer::LC_Status_Error(const std::string& /*error*/) { // Error during adding of server to lobby -> Stop - Stop(); + stop(); } void GameServer::LC_Created() { // All good -> Don't listen anymore LOBBYCLIENT.RemoveListener(this); - AnnounceStatusChange(); + announceStatusChange(); } -void GameServer::Run() +void GameServer::run() { if(state == ServerState::Stopped) return; // auf tote Clients prüfen - ClientWatchDog(); + clientWatchDog(); // auf neue Clients warten if(state == ServerState::Config) - RunStateConfig(); + runStateConfig(); else if(state == ServerState::Loading) - RunStateLoading(); + runStateLoading(); else if(state == ServerState::Game) - RunStateGame(); + runStateGame(); // post zustellen - FillPlayerQueues(); + fillPlayerQueues(); // Execute messages for(GameServerPlayer& player : networkPlayers) @@ -314,25 +314,25 @@ void GameServer::Run() lanAnnouncer.Run(); } -void GameServer::RunStateConfig() +void GameServer::runStateConfig() { - WaitForClients(); - if(countdown.IsActive() && countdown.Update()) + waitForClients(); + if(countdown.IsActive() && countdown.update()) { // nun echt starten if(!countdown.IsActive()) { - if(!StartGame()) + if(!startGame()) { - Stop(); + stop(); return; } } else - SendToAll(GameMessage_Countdown(countdown.getRemainingSecs())); + sendToAll(GameMessage_Countdown(countdown.getRemainingSecs())); } } -void GameServer::RunStateLoading() +void GameServer::runStateLoading() { if(!nwfInfo.isReady()) { @@ -341,7 +341,7 @@ void GameServer::RunStateLoading() for(const NWFPlayerInfo& player : nwfInfo.getPlayerInfos()) { if(player.isLagging) - KickPlayer(player.id, KickReason::PingTimeout, __LINE__); + kickPlayer(player.id, KickReason::PingTimeout, __LINE__); } } return; @@ -358,7 +358,7 @@ void GameServer::RunStateLoading() { GameMessage_GameCommand msg(player.id, nwfInfo.getPlayerCmds(player.id).checksum, std::vector()); - SendToAll(msg); + sendToAll(msg); nwfInfo.addPlayerCmds(player.id, msg.cmds); } } @@ -367,7 +367,7 @@ void GameServer::RunStateLoading() // Send cmdDelay NWFDone messages // First send the OK for NWF 0 which is also the game ready command // Note: Do not store. It already is in NWFInfo - SendToAll( + sendToAll( GameMessage_Server_NWFDone(serverInfo.gf, static_cast(serverInfo.newGFLen / 1ms), serverInfo.nextNWF)); RTTR_Assert(framesinfo.nwf_length > 0); // Then the remaining OKs for the commands sent above @@ -375,7 +375,7 @@ void GameServer::RunStateLoading() { serverInfo.gf = serverInfo.nextNWF; serverInfo.nextNWF += framesinfo.nwf_length; - SendNWFDone(serverInfo); + sendNWFDone(serverInfo); } // And go! @@ -383,13 +383,13 @@ void GameServer::RunStateLoading() state = ServerState::Game; } -void GameServer::RunStateGame() +void GameServer::runStateGame() { if(!framesinfo.isPaused) - ExecuteGameFrame(); + executeGameFrame(); } -void GameServer::Stop() +void GameServer::stop() { if(state == ServerState::Stopped) return; @@ -399,10 +399,10 @@ void GameServer::Stop() networkPlayers.clear(); // aufräumen - framesinfo.Clear(); - config.Clear(); - mapinfo.Clear(); - countdown.Stop(); + framesinfo.clear(); + config.clear(); + mapinfo.clear(); + countdown.stop(); // laden dicht machen serversocket.Close(); @@ -524,13 +524,13 @@ bool GameServer::assignPlayersOfRandomTeams(std::vector& playerI return playerWasAssigned; } -bool GameServer::StartGame() +bool GameServer::startGame() { lanAnnouncer.Stop(); // Finalize the team selection for unassigned players. if(assignPlayersOfRandomTeams(playerInfos)) - SendToAll(GameMessage_Player_List(playerInfos)); + sendToAll(GameMessage_Player_List(playerInfos)); // Bei Savegames wird der Startwert von den Clients aus der Datei gelesen! unsigned random_init; @@ -542,7 +542,7 @@ bool GameServer::StartGame() nwfInfo.init(currentGF, 3); // Send start first, then load the rest - SendToAll(GameMessage_Server_Start(random_init, nwfInfo.getNextNWF(), nwfInfo.getCmdDelay())); + sendToAll(GameMessage_Server_Start(random_init, nwfInfo.getNextNWF(), nwfInfo.getCmdDelay())); LOG.writeToFile("SERVER >>> BROADCAST: NMS_SERVER_START(%d)\n") % random_init; // Höchsten Ping ermitteln @@ -559,7 +559,7 @@ bool GameServer::StartGame() framesinfo.gfLengthReq = framesinfo.gf_length = SPEED_GF_LENGTHS[ggs_.speed]; // NetworkFrame-Länge bestimmen, je schlechter (also höher) die Pings, desto länger auch die Framelänge - framesinfo.nwf_length = CalcNWFLength(std::chrono::milliseconds(highest_ping)); + framesinfo.nwf_length = calcNWFLength(std::chrono::milliseconds(highest_ping)); LOG.write("SERVER: Using gameframe length of %1%\n") % helpers::withUnit(framesinfo.gf_length); LOG.write("SERVER: Using networkframe length of %1% GFs (%2%)\n") % framesinfo.nwf_length @@ -581,7 +581,7 @@ bool GameServer::StartGame() return true; } -unsigned GameServer::CalcNWFLength(std::chrono::milliseconds minDuration) const +unsigned GameServer::calcNWFLength(std::chrono::milliseconds minDuration) const { constexpr unsigned maxNumGF = 20; for(unsigned i = 1; i < maxNumGF; ++i) @@ -592,13 +592,13 @@ unsigned GameServer::CalcNWFLength(std::chrono::milliseconds minDuration) const return maxNumGF; } -void GameServer::SendNWFDone(const NWFServerInfo& info) +void GameServer::sendNWFDone(const NWFServerInfo& info) { nwfInfo.addServerInfo(info); - SendToAll(GameMessage_Server_NWFDone(info.gf, static_cast(info.newGFLen / 1ms), info.nextNWF)); + sendToAll(GameMessage_Server_NWFDone(info.gf, static_cast(info.newGFLen / 1ms), info.nextNWF)); } -void GameServer::SendToAll(const GameMessage& msg) +void GameServer::sendToAll(const GameMessage& msg) { for(GameServerPlayer& player : networkPlayers) { @@ -608,7 +608,7 @@ void GameServer::SendToAll(const GameMessage& msg) } } -void GameServer::KickPlayer(uint8_t playerId, KickReason cause, uint32_t param) +void GameServer::kickPlayer(uint8_t playerId, KickReason cause, uint32_t param) { if(playerId >= playerInfos.size()) return; @@ -621,7 +621,7 @@ void GameServer::KickPlayer(uint8_t playerId, KickReason cause, uint32_t param) return; playerInfo.ps = PlayerState::Free; - SendToAll(GameMessage_Player_Kicked(playerId, cause, param)); + sendToAll(GameMessage_Player_Kicked(playerId, cause, param)); // If we are ingame, replace by KI if(state == ServerState::Game || state == ServerState::Loading) @@ -631,13 +631,13 @@ void GameServer::KickPlayer(uint8_t playerId, KickReason cause, uint32_t param) } else cancelCountdown(); - AnnounceStatusChange(); + announceStatusChange(); LOG.writeToFile("SERVER >>> BROADCAST: NMS_PLAYERKICKED(%d,%d,%d)\n") % unsigned(playerId) % unsigned(cause) % unsigned(param); } // testet, ob in der Verbindungswarteschlange Clients auf Verbindung warten -void GameServer::ClientWatchDog() +void GameServer::clientWatchDog() { SocketSet set; set.Clear(); @@ -654,7 +654,7 @@ void GameServer::ClientWatchDog() if(set.InSet(player.socket)) { LOG.write(_("SERVER: Error on socket of player %1%, bye bye!\n")) % player.playerId; - KickPlayer(player.playerId, KickReason::ConnectionLost, __LINE__); + kickPlayer(player.playerId, KickReason::ConnectionLost, __LINE__); } } } @@ -664,13 +664,13 @@ void GameServer::ClientWatchDog() if(player.hasTimedOut()) { LOG.write(_("SERVER: Reserved slot %1% freed due to timeout\n")) % player.playerId; - KickPlayer(player.playerId, KickReason::PingTimeout, __LINE__); + kickPlayer(player.playerId, KickReason::PingTimeout, __LINE__); } else player.doPing(); } } -void GameServer::ExecuteGameFrame() +void GameServer::executeGameFrame() { RTTR_Assert(state == ServerState::Game); @@ -683,19 +683,19 @@ void GameServer::ExecuteGameFrame() { if(currentGF == nwfInfo.getNextNWF()) // NWF passed? { - if(CheckForLaggingPlayers()) + if(checkForLaggingPlayers()) { // Check for kicking every second static std::remove_const_t lastLagKickTime; if(currentTime - lastLagKickTime >= 1s) { lastLagKickTime = currentTime; - CheckAndKickLaggingPlayers(); + checkAndKickLaggingPlayers(); } // Skip the rest return; } else - ExecuteNWF(); + executeNWF(); } // Advance GF ++currentGF; @@ -722,10 +722,10 @@ void GameServer::ExecuteGameFrame() } } -void GameServer::ExecuteNWF() +void GameServer::executeNWF() { // Check for asyncs - if(CheckForAsync()) + if(checkForAsync()) { // Pause game RTTR_Assert(!framesinfo.isPaused); @@ -736,7 +736,7 @@ void GameServer::ExecuteNWF() checksumHashes.reserve(networkPlayers.size()); for(const GameServerPlayer& player : networkPlayers) checksumHashes.push_back(nwfInfo.getPlayerCmds(player.playerId).checksum.getHash()); - SendToAll(GameMessage_Server_Async(checksumHashes)); + sendToAll(GameMessage_Server_Async(checksumHashes)); // Request async logs for(GameServerPlayer& player : networkPlayers) @@ -767,10 +767,10 @@ void GameServer::ExecuteNWF() framesinfo.nwf_length * framesinfo.gf_length / duration_cast(framesinfo.gfLengthReq); newInfo.nextNWF = lastNWF + std::max(1u, helpers::iround(newNWFLen)); } - SendNWFDone(newInfo); + sendNWFDone(newInfo); } -bool GameServer::CheckForAsync() +bool GameServer::checkForAsync() { if(networkPlayers.empty()) return false; @@ -791,13 +791,13 @@ bool GameServer::CheckForAsync() return isAsync; } -void GameServer::CheckAndKickLaggingPlayers() +void GameServer::checkAndKickLaggingPlayers() { for(const GameServerPlayer& player : networkPlayers) { const unsigned timeOut = player.getLagTimeOut(); if(timeOut == 0) - KickPlayer(player.playerId, KickReason::PingTimeout, __LINE__); + kickPlayer(player.playerId, KickReason::PingTimeout, __LINE__); else if(timeOut <= 30 && (timeOut % 5 == 0 || timeOut < 5)) // Notify every 5s if max 30s are remaining, if less than 5s notify every second @@ -805,7 +805,7 @@ void GameServer::CheckAndKickLaggingPlayers() } } -bool GameServer::CheckForLaggingPlayers() +bool GameServer::checkForLaggingPlayers() { if(nwfInfo.isReady()) return false; @@ -818,7 +818,7 @@ bool GameServer::CheckForLaggingPlayers() } // testet, ob in der Verbindungswarteschlange Clients auf Verbindung warten -void GameServer::WaitForClients() +void GameServer::waitForClients() { SocketSet set; @@ -854,7 +854,7 @@ void GameServer::WaitForClients() } // füllt die warteschlangen mit "paketen" -void GameServer::FillPlayerQueues() +void GameServer::fillPlayerQueues() { SocketSet set; bool msgReceived = false; @@ -879,7 +879,7 @@ void GameServer::FillPlayerQueues() if(!player.receiveMsgs()) { LOG.write(_("SERVER: Receiving Message for player %1% failed, kicking...\n")) % player.playerId; - KickPlayer(player.playerId, KickReason::ConnectionLost, __LINE__); + kickPlayer(player.playerId, KickReason::ConnectionLost, __LINE__); } else msgReceived = true; } @@ -888,7 +888,7 @@ void GameServer::FillPlayerQueues() } while(msgReceived); } -bool GameServer::OnGameMessage(const GameMessage_Pong& msg) +bool GameServer::onGameMessage(const GameMessage_Pong& msg) { GameServerPlayer* player = getNetworkPlayer(msg.senderPlayerID); if(player) @@ -897,16 +897,16 @@ bool GameServer::OnGameMessage(const GameMessage_Pong& msg) if(ping == 0u) return true; playerInfos[msg.senderPlayerID].ping = ping; - SendToAll(GameMessage_Player_Ping(msg.senderPlayerID, ping)); + sendToAll(GameMessage_Player_Ping(msg.senderPlayerID, ping)); } return true; } -bool GameServer::OnGameMessage(const GameMessage_Server_Type& msg) +bool GameServer::onGameMessage(const GameMessage_Server_Type& msg) { if(state != ServerState::Config) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } @@ -923,15 +923,15 @@ bool GameServer::OnGameMessage(const GameMessage_Server_Type& msg) player->sendMsg(GameMessage_Server_TypeOK(typeok, rttr::version::getRevision())); if(typeok != GameMessage_Server_TypeOK::StatusCode::Ok) - KickPlayer(msg.senderPlayerID, KickReason::ConnectionLost, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::ConnectionLost, __LINE__); return true; } -bool GameServer::OnGameMessage(const GameMessage_Server_Password& msg) +bool GameServer::onGameMessage(const GameMessage_Server_Password& msg) { if(state != ServerState::Config) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } @@ -950,27 +950,27 @@ bool GameServer::OnGameMessage(const GameMessage_Server_Password& msg) if(passwordok == "false") { player->sendMsg(GameMessage_Server_Password(passwordok)); - KickPlayer(msg.senderPlayerID, KickReason::WrongPassword, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::WrongPassword, __LINE__); } else player->sendMsgAsync(new GameMessage_Server_Password(passwordok)); return true; } -bool GameServer::OnGameMessage(const GameMessage_Chat& msg) +bool GameServer::onGameMessage(const GameMessage_Chat& msg) { int playerID = getTargetPlayer(msg); if(playerID >= 0) - SendToAll(GameMessage_Chat(playerID, msg.destination, msg.text)); + sendToAll(GameMessage_Chat(playerID, msg.destination, msg.text)); return true; } -bool GameServer::OnGameMessage(const GameMessage_Player_State& msg) +bool GameServer::onGameMessage(const GameMessage_Player_State& msg) { // `Occupied` is set only when a real player went through the join protocol // See `GameMessage_Map_Checksum` handling if(state != ServerState::Config || msg.ps == PlayerState::Occupied) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } @@ -983,7 +983,7 @@ bool GameServer::OnGameMessage(const GameMessage_Player_State& msg) { // Remove the player currently occupying the target slot, if any if(getNetworkPlayer(playerID)) - KickPlayer(playerID, KickReason::NoCause, __LINE__); + kickPlayer(playerID, KickReason::NoCause, __LINE__); if(mapinfo.type == MapType::Savegame) { @@ -1011,29 +1011,29 @@ bool GameServer::OnGameMessage(const GameMessage_Player_State& msg) if(player.ps == PlayerState::AI) { player.setAIName(playerID); - SendToAll(GameMessage_Player_Name(playerID, player.name)); + sendToAll(GameMessage_Player_Name(playerID, player.name)); } // If slot is filled, check current color if(player.isUsed()) { // Ensure a unique color only when initially filling the slot - CheckAndSetColor(playerID, player.color, oldPs == PlayerState::Free || oldPs == PlayerState::Locked); + checkAndSetColor(playerID, player.color, oldPs == PlayerState::Free || oldPs == PlayerState::Locked); } - SendToAll(GameMessage_Player_State(playerID, player.ps, player.aiInfo)); + sendToAll(GameMessage_Player_State(playerID, player.ps, player.aiInfo)); if(oldPs != player.ps) player.isReady = (player.ps == PlayerState::AI); - SendToAll(GameMessage_Player_Ready(playerID, player.isReady)); - PlayerDataChanged(playerID); - AnnounceStatusChange(); + sendToAll(GameMessage_Player_Ready(playerID, player.isReady)); + playerDataChanged(playerID); + announceStatusChange(); return true; } -bool GameServer::OnGameMessage(const GameMessage_Player_Name& msg) +bool GameServer::onGameMessage(const GameMessage_Player_Name& msg) { if(state != ServerState::Config) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } int playerID = getTargetPlayer(msg); @@ -1043,17 +1043,17 @@ bool GameServer::OnGameMessage(const GameMessage_Player_Name& msg) LOG.writeToFile("CLIENT%d >>> SERVER: NMS_PLAYER_NAME(%s)\n") % playerID % msg.playername; playerInfos[playerID].name = msg.playername; - SendToAll(GameMessage_Player_Name(playerID, msg.playername)); - PlayerDataChanged(playerID); + sendToAll(GameMessage_Player_Name(playerID, msg.playername)); + playerDataChanged(playerID); return true; } -bool GameServer::OnGameMessage(const GameMessage_Player_Portrait& msg) +bool GameServer::onGameMessage(const GameMessage_Player_Portrait& msg) { if(state != ServerState::Config) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } int playerID = getTargetPlayer(msg); @@ -1064,17 +1064,17 @@ bool GameServer::OnGameMessage(const GameMessage_Player_Portrait& msg) LOG.writeToFile("CLIENT%d >>> SERVER: NMS_PLAYER_PORTRAIT(%u)\n") % playerID % msg.playerPortraitIndex; playerInfos[playerID].portraitIndex = msg.playerPortraitIndex; - SendToAll(GameMessage_Player_Portrait(playerID, msg.playerPortraitIndex)); - PlayerDataChanged(playerID); + sendToAll(GameMessage_Player_Portrait(playerID, msg.playerPortraitIndex)); + playerDataChanged(playerID); return true; } -bool GameServer::OnGameMessage(const GameMessage_Player_Nation& msg) +bool GameServer::onGameMessage(const GameMessage_Player_Nation& msg) { if(state != ServerState::Config) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } int playerID = getTargetPlayer(msg); @@ -1083,16 +1083,16 @@ bool GameServer::OnGameMessage(const GameMessage_Player_Nation& msg) playerInfos[playerID].nation = msg.nation; - SendToAll(GameMessage_Player_Nation(playerID, msg.nation)); - PlayerDataChanged(playerID); + sendToAll(GameMessage_Player_Nation(playerID, msg.nation)); + playerDataChanged(playerID); return true; } -bool GameServer::OnGameMessage(const GameMessage_Player_Team& msg) +bool GameServer::onGameMessage(const GameMessage_Player_Team& msg) { if(state != ServerState::Config) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } int playerID = getTargetPlayer(msg); @@ -1101,32 +1101,32 @@ bool GameServer::OnGameMessage(const GameMessage_Player_Team& msg) playerInfos[playerID].team = msg.team; - SendToAll(GameMessage_Player_Team(playerID, msg.team)); - PlayerDataChanged(playerID); + sendToAll(GameMessage_Player_Team(playerID, msg.team)); + playerDataChanged(playerID); return true; } -bool GameServer::OnGameMessage(const GameMessage_Player_Color& msg) +bool GameServer::onGameMessage(const GameMessage_Player_Color& msg) { if(state != ServerState::Config) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } int playerID = getTargetPlayer(msg); if(playerID < 0) return true; - CheckAndSetColor(playerID, msg.color, false); - PlayerDataChanged(playerID); + checkAndSetColor(playerID, msg.color, false); + playerDataChanged(playerID); return true; } -bool GameServer::OnGameMessage(const GameMessage_Player_Ready& msg) +bool GameServer::onGameMessage(const GameMessage_Player_Ready& msg) { if(state != ServerState::Config) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } int playerID = getTargetPlayer(msg); @@ -1141,15 +1141,15 @@ bool GameServer::OnGameMessage(const GameMessage_Player_Ready& msg) if(!player.isReady && countdown.IsActive()) cancelCountdown(); - SendToAll(GameMessage_Player_Ready(playerID, msg.ready)); + sendToAll(GameMessage_Player_Ready(playerID, msg.ready)); return true; } -bool GameServer::OnGameMessage(const GameMessage_MapRequest& msg) +bool GameServer::onGameMessage(const GameMessage_MapRequest& msg) { if(state != ServerState::Config) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } GameServerPlayer* player = getNetworkPlayer(msg.senderPlayerID); @@ -1164,7 +1164,7 @@ bool GameServer::OnGameMessage(const GameMessage_MapRequest& msg) } else if(player->isMapSending()) { // Don't send again - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); } else { // Send map data @@ -1199,11 +1199,11 @@ bool GameServer::OnGameMessage(const GameMessage_MapRequest& msg) return true; } -bool GameServer::OnGameMessage(const GameMessage_Map_Checksum& msg) +bool GameServer::onGameMessage(const GameMessage_Map_Checksum& msg) { if(state != ServerState::Config) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } GameServerPlayer* player = getNetworkPlayer(msg.senderPlayerID); @@ -1223,17 +1223,17 @@ bool GameServer::OnGameMessage(const GameMessage_Map_Checksum& msg) if(!checksumok) { if(player->isMapSending()) - KickPlayer(msg.senderPlayerID, KickReason::WrongChecksum, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::WrongChecksum, __LINE__); } else { JoinPlayerInfo& playerInfo = playerInfos[msg.senderPlayerID]; // Used? Then we got this twice or some error happened. Remove him if(playerInfo.isUsed()) - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); else { // Inform others about a new player - SendToAll(GameMessage_Player_New(msg.senderPlayerID, playerInfo.name)); + sendToAll(GameMessage_Player_New(msg.senderPlayerID, playerInfo.name)); LOG.writeToFile("SERVER >>> BROADCAST: NMS_PLAYER_NEW(%d, %s)\n") % unsigned(msg.senderPlayerID) % playerInfo.name; @@ -1241,7 +1241,7 @@ bool GameServer::OnGameMessage(const GameMessage_Map_Checksum& msg) // Mark as used and assign a unique color // Do this before sending the player list to avoid sending useless updates playerInfo.ps = PlayerState::Occupied; - CheckAndSetColor(msg.senderPlayerID, playerInfo.color, true); + checkAndSetColor(msg.senderPlayerID, playerInfo.color, true); // Send remaining data and mark as active player->sendMsgAsync(new GameMessage_Server_Name(config.gamename)); @@ -1249,30 +1249,30 @@ bool GameServer::OnGameMessage(const GameMessage_Map_Checksum& msg) player->sendMsgAsync(new GameMessage_GGSChange(ggs_)); player->setActive(); } - AnnounceStatusChange(); + announceStatusChange(); } return true; } // speed change message -bool GameServer::OnGameMessage(const GameMessage_Speed& msg) +bool GameServer::onGameMessage(const GameMessage_Speed& msg) { if(state != ServerState::Game) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } framesinfo.gfLengthReq = msg.gf_length; return true; } -bool GameServer::OnGameMessage(const GameMessage_GameCommand& msg) +bool GameServer::onGameMessage(const GameMessage_GameCommand& msg) { int targetPlayerId = getTargetPlayer(msg); if((state != ServerState::Game && state != ServerState::Loading) || targetPlayerId < 0 || (state == ServerState::Loading && !msg.cmds.gcs.empty())) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } @@ -1281,16 +1281,16 @@ bool GameServer::OnGameMessage(const GameMessage_GameCommand& msg) GameServerPlayer* player = getNetworkPlayer(targetPlayerId); if(player) player->setNotLagging(); - SendToAll(GameMessage_GameCommand(targetPlayerId, msg.cmds.checksum, msg.cmds.gcs)); + sendToAll(GameMessage_GameCommand(targetPlayerId, msg.cmds.checksum, msg.cmds.gcs)); return true; } -bool GameServer::OnGameMessage(const GameMessage_AsyncLog& msg) +bool GameServer::onGameMessage(const GameMessage_AsyncLog& msg) { if(state != ServerState::Game) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } bool foundPlayer = false; @@ -1326,9 +1326,9 @@ bool GameServer::OnGameMessage(const GameMessage_AsyncLog& msg) LOG.write(_("Async logs received completely.\n")); - const bfs::path asyncFilePath = SaveAsyncLog(); + const bfs::path asyncFilePath = saveAsyncLog(); if(!asyncFilePath.empty()) - SendAsyncLog(asyncFilePath); + sendAsyncLog(asyncFilePath); // Kick all players that have a different checksum from the host AsyncChecksum hostChecksum; @@ -1343,31 +1343,31 @@ bool GameServer::OnGameMessage(const GameMessage_AsyncLog& msg) for(const AsyncLog& log : asyncLogs) { if(log.checksum != hostChecksum) - KickPlayer(log.playerId, KickReason::Async, __LINE__); + kickPlayer(log.playerId, KickReason::Async, __LINE__); } return true; } -bool GameServer::OnGameMessage(const GameMessage_RemoveLua& msg) +bool GameServer::onGameMessage(const GameMessage_RemoveLua& msg) { if(state != ServerState::Config || !isHost(msg.senderPlayerID)) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } mapinfo.luaFilepath.clear(); - mapinfo.luaData.Clear(); + mapinfo.luaData.clear(); mapinfo.luaChecksum = 0; - SendToAll(msg); + sendToAll(msg); cancelCountdown(); return true; } -bool GameServer::OnGameMessage(const GameMessage_Countdown& msg) +bool GameServer::onGameMessage(const GameMessage_Countdown& msg) { if(state != ServerState::Config || !isHost(msg.senderPlayerID)) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } @@ -1375,30 +1375,30 @@ bool GameServer::OnGameMessage(const GameMessage_Countdown& msg) if(!nwPlayer || countdown.IsActive()) return true; - if(!ArePlayersReady()) + if(!arePlayersReady()) nwPlayer->sendMsgAsync(new GameMessage_CancelCountdown(true)); else { // Just to make sure update all player infos - SendToAll(GameMessage_Player_List(playerInfos)); + sendToAll(GameMessage_Player_List(playerInfos)); // Start countdown (except its single player) if(networkPlayers.size() > 1) { - countdown.Start(msg.countdown); - SendToAll(GameMessage_Countdown(countdown.getRemainingSecs())); + countdown.start(msg.countdown); + sendToAll(GameMessage_Countdown(countdown.getRemainingSecs())); LOG.writeToFile("SERVER >>> Countdown started(%d)\n") % countdown.getRemainingSecs(); - } else if(!StartGame()) - Stop(); + } else if(!startGame()) + stop(); } return true; } -bool GameServer::OnGameMessage(const GameMessage_CancelCountdown& msg) +bool GameServer::onGameMessage(const GameMessage_CancelCountdown& msg) { if(state != ServerState::Config || !isHost(msg.senderPlayerID)) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } @@ -1406,32 +1406,32 @@ bool GameServer::OnGameMessage(const GameMessage_CancelCountdown& msg) return true; } -bool GameServer::OnGameMessage(const GameMessage_Pause& msg) +bool GameServer::onGameMessage(const GameMessage_Pause& msg) { if(isHost(msg.senderPlayerID)) setPaused(msg.paused); return true; } -bool GameServer::OnGameMessage(const GameMessage_SkipToGF& msg) +bool GameServer::onGameMessage(const GameMessage_SkipToGF& msg) { if(isHost(msg.senderPlayerID)) { skiptogf = msg.targetGF; - SendToAll(msg); + sendToAll(msg); } return true; } -bool GameServer::OnGameMessage(const GameMessage_GGSChange& msg) +bool GameServer::onGameMessage(const GameMessage_GGSChange& msg) { if(state != ServerState::Config || !isHost(msg.senderPlayerID)) { - KickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); + kickPlayer(msg.senderPlayerID, KickReason::InvalidMsg, __LINE__); return true; } ggs_ = msg.ggs; - SendToAll(msg); + sendToAll(msg); cancelCountdown(); return true; } @@ -1441,12 +1441,12 @@ void GameServer::cancelCountdown() if(!countdown.IsActive()) return; // Countdown-Stop allen mitteilen - countdown.Stop(); - SendToAll(GameMessage_CancelCountdown()); + countdown.stop(); + sendToAll(GameMessage_CancelCountdown()); LOG.writeToFile("SERVER >>> BROADCAST: NMS_CANCELCOUNTDOWN\n"); } -bool GameServer::ArePlayersReady() const +bool GameServer::arePlayersReady() const { // All slots filled and human players are ready for(const JoinPlayerInfo& player : playerInfos) @@ -1472,18 +1472,18 @@ bool GameServer::ArePlayersReady() const return true; } -void GameServer::PlayerDataChanged(unsigned playerIdx) +void GameServer::playerDataChanged(unsigned playerIdx) { cancelCountdown(); JoinPlayerInfo& player = getJoinPlayer(playerIdx); if(player.ps != PlayerState::AI && player.isReady) { player.isReady = false; - SendToAll(GameMessage_Player_Ready(playerIdx, false)); + sendToAll(GameMessage_Player_Ready(playerIdx, false)); } } -bfs::path GameServer::SaveAsyncLog() +bfs::path GameServer::saveAsyncLog() { // Get the highest common counter number and start from there (remove all others) unsigned maxCtr = 0; @@ -1580,7 +1580,7 @@ bfs::path GameServer::SaveAsyncLog() } } -void GameServer::SendAsyncLog(const bfs::path& asyncLogFilePath) +void GameServer::sendAsyncLog(const bfs::path& asyncLogFilePath) { if(SETTINGS.global.submitDebugData == SubmitDebugData::Yes #ifdef _WIN32 @@ -1596,13 +1596,13 @@ void GameServer::SendAsyncLog(const bfs::path& asyncLogFilePath) ) { DebugInfo di; - LOG.write(_("Sending async logs %1%.\n")) % (di.SendAsyncLog(asyncLogFilePath) ? "succeeded" : "failed"); + LOG.write(_("Sending async logs %1%.\n")) % (di.sendAsyncLog(asyncLogFilePath) ? "succeeded" : "failed"); - di.SendReplay(); + di.sendReplay(); } } -void GameServer::CheckAndSetColor(unsigned playerIdx, unsigned newColor, bool ensureUnique) +void GameServer::checkAndSetColor(unsigned playerIdx, unsigned newColor, bool ensureUnique) { RTTR_Assert(playerIdx < playerInfos.size()); // If either of those fails we may not find a valid color! @@ -1637,11 +1637,11 @@ void GameServer::CheckAndSetColor(unsigned playerIdx, unsigned newColor, bool en player.color = newColor; - SendToAll(GameMessage_Player_Color(playerIdx, player.color)); + sendToAll(GameMessage_Player_Color(playerIdx, player.color)); LOG.writeToFile("SERVER >>> BROADCAST: NMS_PLAYER_TOGGLECOLOR(%d, %d)\n") % playerIdx % player.color; } -bool GameServer::OnGameMessage(const GameMessage_Player_Swap& msg) +bool GameServer::onGameMessage(const GameMessage_Player_Swap& msg) { if(state != ServerState::Game && state != ServerState::Config) return true; @@ -1652,11 +1652,11 @@ bool GameServer::OnGameMessage(const GameMessage_Player_Swap& msg) if(player1 == msg.player2 || msg.player2 >= playerInfos.size()) return true; - SwapPlayer(player1, msg.player2); + swapPlayer(player1, msg.player2); return true; } -bool GameServer::OnGameMessage(const GameMessage_Player_SwapConfirm& msg) +bool GameServer::onGameMessage(const GameMessage_Player_SwapConfirm& msg) { GameServerPlayer* player = getNetworkPlayer(msg.senderPlayerID); if(!player) @@ -1672,7 +1672,7 @@ bool GameServer::OnGameMessage(const GameMessage_Player_SwapConfirm& msg) return true; } -void GameServer::SwapPlayer(const uint8_t player1, const uint8_t player2) +void GameServer::swapPlayer(const uint8_t player1, const uint8_t player2) { // TODO: Swapping the player messes up the ids because our IDs are indizes. Usually this works because we use the // sender player ID for messages received by the server and set the right ID for messages sent by the server. @@ -1687,7 +1687,7 @@ void GameServer::SwapPlayer(const uint8_t player1, const uint8_t player2) swap(playerInfos[player1], playerInfos[player2]); // In savegames some things cannot be changed if(mapinfo.type == MapType::Savegame) - playerInfos[player1].FixSwappedSaveSlot(playerInfos[player2]); + playerInfos[player1].fixSwappedSaveSlot(playerInfos[player2]); } else if(state == ServerState::Game) { // Ingame we can only switch to a KI @@ -1707,7 +1707,7 @@ void GameServer::SwapPlayer(const uint8_t player1, const uint8_t player2) newPlayer->playerId = player1; if(oldPlayer) oldPlayer->playerId = player2; - SendToAll(GameMessage_Player_Swap(player1, player2)); + sendToAll(GameMessage_Player_Swap(player1, player2)); const auto pSwap = std::make_pair(player1, player2); for(GameServerPlayer& player : networkPlayers) { @@ -1732,7 +1732,7 @@ void GameServer::setPaused(bool paused) if(framesinfo.isPaused == paused) return; framesinfo.isPaused = paused; - SendToAll(GameMessage_Pause(framesinfo.isPaused)); + sendToAll(GameMessage_Pause(framesinfo.isPaused)); for(GameServerPlayer& player : networkPlayers) player.setNotLagging(); } diff --git a/libs/s25main/network/GameServer.h b/libs/s25main/network/GameServer.h index bfecdb787e..fe09dfb475 100644 --- a/libs/s25main/network/GameServer.h +++ b/libs/s25main/network/GameServer.h @@ -39,94 +39,94 @@ class GameServer : ~GameServer(); /// Starts the server - bool Start(const CreateServerInfo& csi, const MapDescription& map, const std::string& hostPw); + bool start(const CreateServerInfo& csi, const MapDescription& map, const std::string& hostPw); - void Run(); + void run(); - void RunStateGame(); + void runStateGame(); - void RunStateConfig(); + void runStateConfig(); - void Stop(); + void stop(); /// Assign players that do not have a fixed team, return true if any player was assigned. static bool assignPlayersOfRandomTeams(std::vector& playerInfos); private: - bool StartGame(); + bool startGame(); - unsigned CalcNWFLength(std::chrono::milliseconds minDuration) const; + unsigned calcNWFLength(std::chrono::milliseconds minDuration) const; GameServerPlayer* getNetworkPlayer(unsigned playerId); /// Swap players ingame or during config - void SwapPlayer(uint8_t player1, uint8_t player2); + void swapPlayer(uint8_t player1, uint8_t player2); - void SendToAll(const GameMessage& msg); - void SendNWFDone(const NWFServerInfo& info); + void sendToAll(const GameMessage& msg); + void sendNWFDone(const NWFServerInfo& info); /// Kick a player (free slot and set socket to invalid. Does NOT remove it from NetworkPlayers) - void KickPlayer(uint8_t playerId, KickReason cause, uint32_t param); + void kickPlayer(uint8_t playerId, KickReason cause, uint32_t param); - void ClientWatchDog(); + void clientWatchDog(); - void WaitForClients(); - void FillPlayerQueues(); + void waitForClients(); + void fillPlayerQueues(); unsigned getNumFilledSlots() const; /// Notifies listeners (e.g. Lobby) that the game status has changed (e.g player count) - void AnnounceStatusChange(); + void announceStatusChange(); void setPaused(bool paused); void LC_Status_Error(const std::string& error) override; void LC_Created() override; RTTR_IGNORE_OVERLOADED_VIRTUAL - bool OnGameMessage(const GameMessage_Pong& msg) override; - bool OnGameMessage(const GameMessage_Server_Type& msg) override; - bool OnGameMessage(const GameMessage_Server_Password& msg) override; - bool OnGameMessage(const GameMessage_Chat& msg) override; - bool OnGameMessage(const GameMessage_GGSChange& msg) override; - bool OnGameMessage(const GameMessage_Player_State& msg) override; - bool OnGameMessage(const GameMessage_Player_Name& msg) override; - bool OnGameMessage(const GameMessage_Player_Portrait& msg) override; - bool OnGameMessage(const GameMessage_Player_Nation& msg) override; - bool OnGameMessage(const GameMessage_Player_Team& msg) override; - bool OnGameMessage(const GameMessage_Player_Color& msg) override; - bool OnGameMessage(const GameMessage_Player_Ready& msg) override; - bool OnGameMessage(const GameMessage_Player_Swap& msg) override; - bool OnGameMessage(const GameMessage_Player_SwapConfirm& msg) override; - bool OnGameMessage(const GameMessage_MapRequest& msg) override; - bool OnGameMessage(const GameMessage_Map_Checksum& msg) override; - bool OnGameMessage(const GameMessage_GameCommand& msg) override; - bool OnGameMessage(const GameMessage_Speed& msg) override; - bool OnGameMessage(const GameMessage_AsyncLog& msg) override; - bool OnGameMessage(const GameMessage_RemoveLua& msg) override; - bool OnGameMessage(const GameMessage_Countdown& msg) override; - bool OnGameMessage(const GameMessage_CancelCountdown& msg) override; - bool OnGameMessage(const GameMessage_Pause& msg) override; - bool OnGameMessage(const GameMessage_SkipToGF& msg) override; + bool onGameMessage(const GameMessage_Pong& msg) override; + bool onGameMessage(const GameMessage_Server_Type& msg) override; + bool onGameMessage(const GameMessage_Server_Password& msg) override; + bool onGameMessage(const GameMessage_Chat& msg) override; + bool onGameMessage(const GameMessage_GGSChange& msg) override; + bool onGameMessage(const GameMessage_Player_State& msg) override; + bool onGameMessage(const GameMessage_Player_Name& msg) override; + bool onGameMessage(const GameMessage_Player_Portrait& msg) override; + bool onGameMessage(const GameMessage_Player_Nation& msg) override; + bool onGameMessage(const GameMessage_Player_Team& msg) override; + bool onGameMessage(const GameMessage_Player_Color& msg) override; + bool onGameMessage(const GameMessage_Player_Ready& msg) override; + bool onGameMessage(const GameMessage_Player_Swap& msg) override; + bool onGameMessage(const GameMessage_Player_SwapConfirm& msg) override; + bool onGameMessage(const GameMessage_MapRequest& msg) override; + bool onGameMessage(const GameMessage_Map_Checksum& msg) override; + bool onGameMessage(const GameMessage_GameCommand& msg) override; + bool onGameMessage(const GameMessage_Speed& msg) override; + bool onGameMessage(const GameMessage_AsyncLog& msg) override; + bool onGameMessage(const GameMessage_RemoveLua& msg) override; + bool onGameMessage(const GameMessage_Countdown& msg) override; + bool onGameMessage(const GameMessage_CancelCountdown& msg) override; + bool onGameMessage(const GameMessage_Pause& msg) override; + bool onGameMessage(const GameMessage_SkipToGF& msg) override; RTTR_POP_DIAGNOSTIC void cancelCountdown(); - bool ArePlayersReady() const; + bool arePlayersReady() const; /// Some player data has changed. Set non-ready and cancel countdown - void PlayerDataChanged(unsigned playerIdx); + void playerDataChanged(unsigned playerIdx); /// Sets the color of this player to the given color. /// If ensureUnique is true and the color is already used it will be set to the next free one /// Sends a notification to all players if the color was changed - void CheckAndSetColor(unsigned playerIdx, unsigned newColor, bool ensureUnique); + void checkAndSetColor(unsigned playerIdx, unsigned newColor, bool ensureUnique); /// Handles advancing of GFs, actions of AI and potentially the NWF - void ExecuteGameFrame(); - void ExecuteNWF(); + void executeGameFrame(); + void executeNWF(); - bool CheckForAsync(); - boost::filesystem::path SaveAsyncLog(); - void SendAsyncLog(const boost::filesystem::path& asyncLogFilePath); + bool checkForAsync(); + boost::filesystem::path saveAsyncLog(); + void sendAsyncLog(const boost::filesystem::path& asyncLogFilePath); - void CheckAndKickLaggingPlayers(); - bool CheckForLaggingPlayers(); + void checkAndKickLaggingPlayers(); + bool checkForLaggingPlayers(); JoinPlayerInfo& getJoinPlayer(unsigned playerIdx); /// Is the player with the given idx the host? @@ -150,7 +150,7 @@ class GameServer : struct ServerConfig { ServerConfig(); - void Clear(); + void clear(); ServerType servertype; std::string gamename; @@ -177,10 +177,10 @@ class GameServer : public: CountDown(); /// Starts a countdown at curTime of timeInSec seconds - void Start(unsigned timeInSec); - void Stop(); + void start(unsigned timeInSec); + void stop(); /// Updates the state and returns true on change. Stops 1s after remainingSecs reached zero - bool Update(); + bool update(); bool IsActive() const { return isActive; } unsigned getRemainingSecs() const { return remainingSecs; } } countdown; @@ -192,7 +192,7 @@ class GameServer : std::chrono::steady_clock::time_point loadStartTime; LANDiscoveryService lanAnnouncer; - void RunStateLoading(); + void runStateLoading(); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/libs/s25main/network/IGameLobbyController.h b/libs/s25main/network/IGameLobbyController.h index f410c66781..fe77ea99df 100644 --- a/libs/s25main/network/IGameLobbyController.h +++ b/libs/s25main/network/IGameLobbyController.h @@ -21,7 +21,7 @@ class IGameLobbyController virtual ~IGameLobbyController() = default; virtual unsigned getMaxNumPlayers() const = 0; virtual JoinPlayerInfo& getJoinPlayer(unsigned playerIdx) = 0; - virtual void CloseSlot(unsigned playerIdx) = 0; + virtual void closeSlot(unsigned playerIdx) = 0; virtual void setPlayerState(unsigned playerIdx, PlayerState state, const AI::Info& aiInfo) = 0; virtual void setName(unsigned playerIdx, const std::string& name) = 0; virtual void setPortrait(unsigned playerIdx, unsigned portraitIndex) = 0; @@ -29,5 +29,5 @@ class IGameLobbyController virtual void setTeam(unsigned playerIdx, Team newTeam) = 0; virtual void setNation(unsigned playerIdx, Nation newNation) = 0; virtual const GlobalGameSettings& getGGS() const = 0; - virtual void ChangeGlobalGameSettings(const GlobalGameSettings& ggs) = 0; + virtual void changeGlobalGameSettings(const GlobalGameSettings& ggs) = 0; }; diff --git a/libs/s25main/nodeObjs/noAnimal.cpp b/libs/s25main/nodeObjs/noAnimal.cpp index 5909a413f2..cecf1c0e49 100644 --- a/libs/s25main/nodeObjs/noAnimal.cpp +++ b/libs/s25main/nodeObjs/noAnimal.cpp @@ -37,28 +37,28 @@ void noAnimal::Serialize(SerializedGameData& sgd) const { noMovable::Serialize(sgd); - sgd.PushEnum(species); - sgd.PushEnum(state); + sgd.pushEnum(species); + sgd.pushEnum(state); sgd.PushUnsignedShort(pause_way); - sgd.PushObject(hunter, true); - sgd.PushObject(skinner, true); + sgd.pushObject(hunter, true); + sgd.pushObject(skinner, true); } noAnimal::noAnimal(SerializedGameData& sgd, const unsigned obj_id) - : noMovable(sgd, obj_id), species(sgd.Pop()), state(sgd.Pop()), pause_way(sgd.PopUnsignedShort()), - hunter(sgd.PopObject(GO_Type::NofHunter)), skinner(nullptr), sound_moment(0) + : noMovable(sgd, obj_id), species(sgd.pop()), state(sgd.pop()), pause_way(sgd.PopUnsignedShort()), + hunter(sgd.popObject(GO_Type::NofHunter)), skinner(nullptr), sound_moment(0) { if(sgd.getGameDataVersion() >= 12) - skinner = sgd.PopObject(GO_Type::NofSkinner); + skinner = sgd.popObject(GO_Type::NofSkinner); } -void noAnimal::StartLiving() +void noAnimal::startLiving() { // anfangen zu laufen - StandardWalking(); + standardWalking(); } -void noAnimal::Draw(DrawPoint drawPt) +void noAnimal::draw(DrawPoint drawPt) { // Tier zeichnen @@ -71,9 +71,9 @@ void noAnimal::Draw(DrawPoint drawPt) // Laufend (bzw. Ente schwimmend zeichnen) // Interpolieren zwischen beiden Knotenpunkten - drawPt += CalcWalkingRelative(); + drawPt += calcWalkingRelative(); - unsigned ani_step = GAMECLIENT.Interpolate(ASCENT_ANIMATION_STEPS[getAscent()], current_ev) + unsigned ani_step = GAMECLIENT.interpolate(ASCENT_ANIMATION_STEPS[getAscent()], current_ev) % ANIMALCONSTS[species].animation_steps; // Zeichnen @@ -114,7 +114,7 @@ void noAnimal::Draw(DrawPoint drawPt) case State::Disappearing: { // Alpha-Wert ausrechnen - unsigned char alpha = 0xFF - GAMECLIENT.Interpolate(0xFF, current_ev); + unsigned char alpha = 0xFF - GAMECLIENT.interpolate(0xFF, current_ev); // Gibts ein Leichenbild? if(!LOADER.getDeadAnimalSprite(species).empty()) @@ -142,7 +142,7 @@ void noAnimal::Draw(DrawPoint drawPt) and if the skinner was first the meat remains there. The animal disappears and the noAnimal class is responsible for removing and deleting itself afterwards. */ -void noAnimal::HandleEvent(const unsigned id) +void noAnimal::handleEvent(const unsigned id) { current_ev = nullptr; @@ -152,17 +152,17 @@ void noAnimal::HandleEvent(const unsigned id) case 0: { // neue Position einnehmen - Walk(); + walk(); // entscheiden, was als nächstes zu tun ist - Walked(); + walked(); } break; // Warte-Event case 1: { // wieder weiterlaufen - StandardWalking(); + standardWalking(); // state entsprechen setzen, wenn es nich gestorben ist if(state != State::Dead) state = State::Walking; @@ -172,18 +172,18 @@ void noAnimal::HandleEvent(const unsigned id) case 2: { // nun verschwinden - current_ev = getEvMgr().AddEvent(this, 30, 3); + current_ev = getEvMgr().addEvent(this, 30, 3); state = State::Disappearing; // Jäger ggf. Bescheid sagen (falls der es nicht mehr rechtzeitig schafft, bis ich verwest bin) if(hunter) { - hunter->AnimalLost(); + hunter->animalLost(); hunter = nullptr; } if(skinner) { - skinner->AnimalLost(); + skinner->animalLost(); skinner = nullptr; } } @@ -192,39 +192,39 @@ void noAnimal::HandleEvent(const unsigned id) case 3: { // von der Karte tilgen - getEvMgr().AddToKillList(world->RemoveFigure(pos, *this)); + getEvMgr().addToKillList(world->RemoveFigure(pos, *this)); } break; } } -void noAnimal::StartWalking(const Direction dir) +void noAnimal::startWalking(const Direction dir) { - StartMoving(dir, ANIMALCONSTS[species].speed); + startMoving(dir, ANIMALCONSTS[species].speed); } -void noAnimal::StandardWalking() +void noAnimal::standardWalking() { // neuen Weg suchen - const helpers::OptionalEnum dir = FindDir(); + const helpers::OptionalEnum dir = findDir(); if(!dir) { // Sterben, weil kein Weg mehr gefunden wurde - Die(); + die(); // Jäger ggf. Bescheid sagen (falls der es nicht mehr rechtzeitig schafft, bis ich verwest bin) if(hunter) //-V779 { - hunter->AnimalLost(); + hunter->animalLost(); hunter = nullptr; } } else { // weiterlaufen - StartWalking(*dir); + startWalking(*dir); } } -void noAnimal::Walked() +void noAnimal::walked() { switch(state) { @@ -246,10 +246,10 @@ void noAnimal::Walked() // dann stellt es sich hier hin und wartet erstmal eine Weile state = State::Paused; pause_way = 5 + RANDOM_RAND(15); - current_ev = getEvMgr().AddEvent(this, 50 + RANDOM_RAND(50), 1); + current_ev = getEvMgr().addEvent(this, 50 + RANDOM_RAND(50), 1); } else { - StandardWalking(); + standardWalking(); } // Bei Enten und Schafen: Soundzeitpunkt ggf. setzen @@ -265,7 +265,7 @@ void noAnimal::Walked() } } -helpers::OptionalEnum noAnimal::FindDir() +helpers::OptionalEnum noAnimal::findDir() { // mit zufälliger Richtung anfangen const Direction doffset = RANDOM_ENUM(Direction); @@ -329,23 +329,23 @@ bool noAnimal::isGettingSkinned() const return skinner != nullptr; } -void noAnimal::Skinned() +void noAnimal::skinned() { if(!hunter) { // Remove decay event for animal because skinner has taken it - getEvMgr().RemoveEvent(current_ev); + getEvMgr().removeEvent(current_ev); } // Reset skinner skinner = nullptr; } -void noAnimal::BeginSkinning(nofSkinner* skinner) +void noAnimal::beginSkinning(nofSkinner* skinner) { this->skinner = skinner; } -void noAnimal::StopSkinning() +void noAnimal::stopSkinning() { skinner = nullptr; } @@ -361,12 +361,12 @@ bool noAnimal::isHunted() const return hunter != nullptr; } -void noAnimal::BeginHunting(nofHunter* hunter) +void noAnimal::beginHunting(nofHunter* hunter) { this->hunter = hunter; } -MapPoint noAnimal::HunterIsNear() +MapPoint noAnimal::hunterIsNear() { // Steht es gerade? if(state == State::Paused) @@ -374,7 +374,7 @@ MapPoint noAnimal::HunterIsNear() // dann bleibt es einfach stehen und gibt seine jetzigen Koordinaten zurück state = State::WaitingForHunter; // Warteevent abmelden - getEvMgr().RemoveEvent(current_ev); + getEvMgr().removeEvent(current_ev); return pos; } else { @@ -384,7 +384,7 @@ MapPoint noAnimal::HunterIsNear() } } -void noAnimal::StopHunting() +void noAnimal::stopHunting() { // keiner jagt uns mehr hunter = nullptr; @@ -397,7 +397,7 @@ void noAnimal::StopHunting() { // wenn wir stehen, zusätzlich loslaufen state = State::Walking; - StandardWalking(); + standardWalking(); } break; case State::WalkingUntilWaitingForHunter: @@ -409,28 +409,28 @@ void noAnimal::StopHunting() } } -void noAnimal::Die() +void noAnimal::die() { // nun bin ich tot if(ANIMALCONSTS[species].dead_id) { // Verwesungsevent unsigned gf_length = leatheraddon::isAddonActive(*world) ? 600 : 300; - current_ev = getEvMgr().AddEvent(this, gf_length, 2); + current_ev = getEvMgr().addEvent(this, gf_length, 2); state = State::Dead; } else { // Falls keine Verwesungsgrafik --> sofort verschwinden - current_ev = getEvMgr().AddEvent(this, 30, 3); + current_ev = getEvMgr().addEvent(this, 30, 3); state = State::Disappearing; } } -void noAnimal::Eviscerated() +void noAnimal::eviscerated() { // Event abmelden if(!isGettingSkinned()) - getEvMgr().RemoveEvent(current_ev); + getEvMgr().removeEvent(current_ev); // Reset hunter hunter = nullptr; } diff --git a/libs/s25main/nodeObjs/noAnimal.h b/libs/s25main/nodeObjs/noAnimal.h index 68c410afaa..0899eada36 100644 --- a/libs/s25main/nodeObjs/noAnimal.h +++ b/libs/s25main/nodeObjs/noAnimal.h @@ -41,13 +41,13 @@ class noAnimal : public noMovable private: /// entscheidet, was nach einem gelaufenen Abschnitt weiter zu tun ist - void Walked(); + void walked(); /// Sucht eine Richtung, in die das Tier gehen kann - helpers::OptionalEnum FindDir(); + helpers::OptionalEnum findDir(); /// Fängt an zu laufen - void StartWalking(Direction dir); + void startWalking(Direction dir); /// Sucht eine neue Richtung und läuft in diese, ansonsten stirbt es - void StandardWalking(); + void standardWalking(); public: noAnimal(Species species, MapPoint pos); @@ -56,47 +56,47 @@ class noAnimal : public noMovable ~noAnimal() override = default; void Serialize(SerializedGameData& sgd) const override; - void Destroy() override + void destroy() override { RTTR_Assert(!hunter); RTTR_Assert(!skinner); - noMovable::Destroy(); + noMovable::destroy(); } GO_Type getGOT() const final { return GO_Type::Animal; } Species getSpecies() const { return species; } // An x,y zeichnen - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; // Benachrichtigen, wenn neuer gf erreicht wurde - void HandleEvent(unsigned id) override; + void handleEvent(unsigned id) override; /// Wird aufgerufen, nachdem das Tier erzeugt wurde und zur Figurenliste hinzugefügt wurde - void StartLiving(); + void startLiving(); bool canBeSkinned() const; bool isGettingSkinned() const; - void BeginSkinning(nofSkinner* skinner); - void StopSkinning(); - void Skinned(); + void beginSkinning(nofSkinner* skinner); + void stopSkinning(); + void skinned(); /// Kann das Tier noch vom Jäger gejagt werden? bool canHunted() const; bool isHunted() const; /// Ein Jäger geht das Tier jagen - void BeginHunting(nofHunter* hunter); + void beginHunting(nofHunter* hunter); /// Ein Jäger ist in der Nähe vom Tier und will es abschießen --> Tier muss stillhalten /// gibt die Koordinaten seines (späteren) Standorts zurück - MapPoint HunterIsNear(); + MapPoint hunterIsNear(); /// Ein Jäger kann doch nicht mehr zum Tier kommen --> kann wieder normal weiterlaufen - void StopHunting(); + void stopHunting(); /// Steht das Tier schon schön ruhig, damit der Jäger es erschießen kann? bool isReadyForShooting() const { return (state == State::WaitingForHunter); } bool isGettingReadyForShooting() const { return (state == State::WalkingUntilWaitingForHunter); } /// Tier soll sterben - erstmal nur Leiche liegen lassen - void Die(); + void die(); /// Tier wurde vom Jäger ausgenommen und muss sofort verschwinden - void Eviscerated(); + void eviscerated(); }; diff --git a/libs/s25main/nodeObjs/noBase.cpp b/libs/s25main/nodeObjs/noBase.cpp index 128b81a590..07704e8a05 100644 --- a/libs/s25main/nodeObjs/noBase.cpp +++ b/libs/s25main/nodeObjs/noBase.cpp @@ -7,15 +7,15 @@ noBase::noBase(SerializedGameData& sgd, const unsigned obj_id) : GameObject(sgd, obj_id) { - nop = sgd.Pop(); + nop = sgd.pop(); } void noBase::Serialize(SerializedGameData& sgd) const { - sgd.PushEnum(nop); + sgd.pushEnum(nop); } -std::unique_ptr noBase::CreateFOWObject() const +std::unique_ptr noBase::createFOWObject() const { return nullptr; } diff --git a/libs/s25main/nodeObjs/noBase.h b/libs/s25main/nodeObjs/noBase.h index 01c3effcce..02cc39de33 100644 --- a/libs/s25main/nodeObjs/noBase.h +++ b/libs/s25main/nodeObjs/noBase.h @@ -31,7 +31,7 @@ class noBase : public GameObject noBase(SerializedGameData& sgd, unsigned obj_id); /// An x,y zeichnen. - virtual void Draw(DrawPoint drawPt) = 0; + virtual void draw(DrawPoint drawPt) = 0; /// Type zurückgeben. NodalObjectType getType() const { return nop; } @@ -39,7 +39,7 @@ class noBase : public GameObject void Serialize(SerializedGameData& sgd) const override; /// Erzeugt von ihnen selbst ein FOW Objekt als visuelle "Erinnerung" für den Fog of War - virtual std::unique_ptr CreateFOWObject() const; + virtual std::unique_ptr createFOWObject() const; virtual BlockingManner getBM() const; /// Gibt zurück, ob sich das angegebene Objekt zwischen zwei Punkten bewegt diff --git a/libs/s25main/nodeObjs/noCharburnerPile.cpp b/libs/s25main/nodeObjs/noCharburnerPile.cpp index f3b5f730d7..71eab7f873 100644 --- a/libs/s25main/nodeObjs/noCharburnerPile.cpp +++ b/libs/s25main/nodeObjs/noCharburnerPile.cpp @@ -35,39 +35,39 @@ noCharburnerPile::noCharburnerPile(const MapPoint pos) noCharburnerPile::~noCharburnerPile() = default; -void noCharburnerPile::Destroy() +void noCharburnerPile::destroy() { - getEvMgr().RemoveEvent(event); + getEvMgr().removeEvent(event); // Bauplätze drumrum neu berechnen - world->RecalcBQAroundPointBig(pos); + world->recalcBQAroundPointBig(pos); - noCoordBase::Destroy(); + noCoordBase::destroy(); } void noCharburnerPile::Serialize(SerializedGameData& sgd) const { noCoordBase::Serialize(sgd); - sgd.PushEnum(state); + sgd.pushEnum(state); sgd.PushUnsignedShort(step); sgd.PushUnsignedShort(sub_step); - sgd.PushEvent(event); + sgd.pushEvent(event); } noCharburnerPile::noCharburnerPile(SerializedGameData& sgd, const unsigned obj_id) - : noCoordBase(sgd, obj_id), state(sgd.Pop()), step(sgd.PopUnsignedShort()), sub_step(sgd.PopUnsignedShort()), - event(sgd.PopEvent()) + : noCoordBase(sgd, obj_id), state(sgd.pop()), step(sgd.PopUnsignedShort()), sub_step(sgd.PopUnsignedShort()), + event(sgd.popEvent()) {} -void noCharburnerPile::Draw(DrawPoint drawPt) +void noCharburnerPile::draw(DrawPoint drawPt) { switch(state) { case State::Wood: { // Draw sand on which the wood stack is constructed - LOADER.getImageN("charburner_bobs", 25)->DrawFull(drawPt); + LOADER.getImageN("charburner_bobs", 25)->drawFull(drawPt); glArchivItem_Bitmap* image; if(step == 0) @@ -77,12 +77,12 @@ void noCharburnerPile::Draw(DrawPoint drawPt) image = LOADER.getImageN("charburner_bobs", 28); // Draw wood pile beneath the cover - LOADER.getImageN("charburner_bobs", 26)->DrawFull(drawPt); + LOADER.getImageN("charburner_bobs", 26)->drawFull(drawPt); } unsigned short progress = sub_step * 100 / CONSTRUCTION_WORKING_STEPS[step]; if(progress != 0) - image->DrawPercent(drawPt, progress); + image->drawPercent(drawPt, progress); } return; case State::Smoldering: @@ -90,32 +90,32 @@ void noCharburnerPile::Draw(DrawPoint drawPt) LOADER .getImageN("charburner_bobs", 27 + GAMECLIENT.getGlobalAnimation(2, 10, 1, getObjId() + this->pos.x * 10 + this->pos.y * 10)) - ->DrawFull(drawPt); + ->drawFull(drawPt); // Dann Qualm zeichnen unsigned globalAnimation = GAMECLIENT.getGlobalAnimation(8, 5, 2, (this->pos.x + this->pos.y) * 100); LOADER.getMapTexture(692 + 1 * 8 + globalAnimation) - ->DrawFull(drawPt + DrawPoint(21, -11), 0x99EEEEEE); //-V525 - LOADER.getMapTexture(692 + 2 * 8 + globalAnimation)->DrawFull(drawPt - DrawPoint(2, 06), 0x99EEEEEE); - LOADER.getMapTexture(692 + 1 * 8 + globalAnimation)->DrawFull(drawPt - DrawPoint(25, 11), 0x99EEEEEE); - LOADER.getMapTexture(692 + 3 * 8 + globalAnimation)->DrawFull(drawPt - DrawPoint(2, 35), 0x99EEEEEE); + ->drawFull(drawPt + DrawPoint(21, -11), 0x99EEEEEE); //-V525 + LOADER.getMapTexture(692 + 2 * 8 + globalAnimation)->drawFull(drawPt - DrawPoint(2, 06), 0x99EEEEEE); + LOADER.getMapTexture(692 + 1 * 8 + globalAnimation)->drawFull(drawPt - DrawPoint(25, 11), 0x99EEEEEE); + LOADER.getMapTexture(692 + 3 * 8 + globalAnimation)->drawFull(drawPt - DrawPoint(2, 35), 0x99EEEEEE); } return; case State::RemoveCover: { - LOADER.getImageN("charburner_bobs", 28 + step)->DrawFull(drawPt); + LOADER.getImageN("charburner_bobs", 28 + step)->drawFull(drawPt); } return; case State::Harvest: { - LOADER.getImageN("charburner_bobs", 34 + step)->DrawFull(drawPt); + LOADER.getImageN("charburner_bobs", 34 + step)->drawFull(drawPt); } return; default: return; } } -void noCharburnerPile::HandleEvent(const unsigned /*id*/) +void noCharburnerPile::handleEvent(const unsigned /*id*/) { // Smoldering is over // Pile is ready for the remove of the cover @@ -123,24 +123,24 @@ void noCharburnerPile::HandleEvent(const unsigned /*id*/) { state = State::RemoveCover; // start a selfdestruct timer - event = getEvMgr().AddEvent(this, SELFDESTRUCT_DELAY, 0); + event = getEvMgr().addEvent(this, SELFDESTRUCT_DELAY, 0); } else { // selfdestruct! event = nullptr; world->setNO(pos, new noFire(pos, false), true); - world->RecalcBQAroundPoint(pos); - getEvMgr().AddToKillList(this); + world->recalcBQAroundPoint(pos); + getEvMgr().addToKillList(this); } } /// Charburner has worked on it --> Goto next step -void noCharburnerPile::NextStep() +void noCharburnerPile::nextStep() { // reset selfdestruct timer if(event) - getEvMgr().RemoveEvent(event); - event = getEvMgr().AddEvent(this, SELFDESTRUCT_DELAY, 0); + getEvMgr().removeEvent(event); + event = getEvMgr().addEvent(this, SELFDESTRUCT_DELAY, 0); // execute step switch(state) @@ -159,8 +159,8 @@ void noCharburnerPile::NextStep() { step = 0; state = State::Smoldering; - getEvMgr().RemoveEvent(event); - event = getEvMgr().AddEvent(this, SMOLDERING_LENGTH, 0); + getEvMgr().removeEvent(event); + event = getEvMgr().addEvent(this, SMOLDERING_LENGTH, 0); } } } @@ -195,10 +195,10 @@ void noCharburnerPile::NextStep() { // Add an empty pile as environmental object world->setNO(pos, new noEnvObject(pos, 40, 6), true); - getEvMgr().AddToKillList(this); + getEvMgr().addToKillList(this); // BQ drumrum neu berechnen - world->RecalcBQAroundPoint(pos); + world->recalcBQAroundPoint(pos); } } } diff --git a/libs/s25main/nodeObjs/noCharburnerPile.h b/libs/s25main/nodeObjs/noCharburnerPile.h index 541bb5dae3..33a8dfb159 100644 --- a/libs/s25main/nodeObjs/noCharburnerPile.h +++ b/libs/s25main/nodeObjs/noCharburnerPile.h @@ -41,13 +41,13 @@ class noCharburnerPile : public noCoordBase ~noCharburnerPile() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Charburnerpile; } - void Draw(DrawPoint drawPt) override; - void HandleEvent(unsigned id) override; + void draw(DrawPoint drawPt) override; + void handleEvent(unsigned id) override; BlockingManner getBM() const override { return BlockingManner::NothingAround; } @@ -55,7 +55,7 @@ class noCharburnerPile : public noCoordBase State getState() const { return state; } /// Charburner has worked on it --> Goto next step - void NextStep(); + void nextStep(); /// Dertermines if the charburner pile needs wood or grain /// Only graphical "effect", dertermines which ware the charburner will be carrying diff --git a/libs/s25main/nodeObjs/noCoordBase.cpp b/libs/s25main/nodeObjs/noCoordBase.cpp index 994fc43787..6d8d09ca7d 100644 --- a/libs/s25main/nodeObjs/noCoordBase.cpp +++ b/libs/s25main/nodeObjs/noCoordBase.cpp @@ -14,5 +14,5 @@ void noCoordBase::Serialize(SerializedGameData& sgd) const helpers::pushPoint(sgd, pos); } -noCoordBase::noCoordBase(SerializedGameData& sgd, const unsigned obj_id) : noBase(sgd, obj_id), pos(sgd.PopMapPoint()) +noCoordBase::noCoordBase(SerializedGameData& sgd, const unsigned obj_id) : noBase(sgd, obj_id), pos(sgd.popMapPoint()) {} diff --git a/libs/s25main/nodeObjs/noDisappearingEnvObject.cpp b/libs/s25main/nodeObjs/noDisappearingEnvObject.cpp index a3f205aa29..f2a9d83175 100644 --- a/libs/s25main/nodeObjs/noDisappearingEnvObject.cpp +++ b/libs/s25main/nodeObjs/noDisappearingEnvObject.cpp @@ -15,7 +15,7 @@ noDisappearingEnvObject::noDisappearingEnvObject(const MapPoint pos, const unsig const unsigned add_var_living_time) : noCoordBase(NodalObjectType::Environment, pos), disappearing(false) { - dead_event = getEvMgr().AddEvent(this, living_time + RANDOM_RAND(add_var_living_time)); + dead_event = getEvMgr().addEvent(this, living_time + RANDOM_RAND(add_var_living_time)); } void noDisappearingEnvObject::Serialize(SerializedGameData& sgd) const @@ -23,18 +23,18 @@ void noDisappearingEnvObject::Serialize(SerializedGameData& sgd) const noCoordBase::Serialize(sgd); sgd.PushBool(disappearing); - sgd.PushEvent(dead_event); + sgd.pushEvent(dead_event); } noDisappearingEnvObject::noDisappearingEnvObject(SerializedGameData& sgd, const unsigned obj_id) - : noCoordBase(sgd, obj_id), disappearing(sgd.PopBool()), dead_event(sgd.PopEvent()) + : noCoordBase(sgd, obj_id), disappearing(sgd.PopBool()), dead_event(sgd.popEvent()) {} unsigned noDisappearingEnvObject::getDrawColor() const { if(disappearing) { - const unsigned opacity = GAMECLIENT.Interpolate(0xFF, 0, dead_event); + const unsigned opacity = GAMECLIENT.interpolate(0xFF, 0, dead_event); return opacity | (opacity << 8) | (opacity << 16) | (opacity << 24); } else return 0xFFFFFFFF; @@ -44,35 +44,35 @@ unsigned noDisappearingEnvObject::getDrawShadowColor() const { if(disappearing) { - const unsigned opacity = GAMECLIENT.Interpolate(0x40, 0, dead_event); + const unsigned opacity = GAMECLIENT.interpolate(0x40, 0, dead_event); return (opacity << 24); } else return COLOR_SHADOW; } -void noDisappearingEnvObject::HandleEvent(const unsigned /*id*/) +void noDisappearingEnvObject::handleEvent(const unsigned /*id*/) { if(disappearing) { RTTR_Assert(world->getNode(pos).obj == this); world->setNO(pos, nullptr); - getEvMgr().AddToKillList(this); + getEvMgr().addToKillList(this); dead_event = nullptr; } else { disappearing = true; // Remove after some time fading out - dead_event = getEvMgr().AddEvent(this, 30, 1); + dead_event = getEvMgr().addEvent(this, 30, 1); } } -void noDisappearingEnvObject::Destroy() +void noDisappearingEnvObject::destroy() { // Remove from map if still present if(world->getNode(pos).obj == this) world->setNO(pos, nullptr); - getEvMgr().RemoveEvent(dead_event); + getEvMgr().removeEvent(dead_event); - noCoordBase::Destroy(); + noCoordBase::destroy(); } diff --git a/libs/s25main/nodeObjs/noDisappearingEnvObject.h b/libs/s25main/nodeObjs/noDisappearingEnvObject.h index baa5909362..aa5881275f 100644 --- a/libs/s25main/nodeObjs/noDisappearingEnvObject.h +++ b/libs/s25main/nodeObjs/noDisappearingEnvObject.h @@ -15,10 +15,10 @@ class noDisappearingEnvObject : public noCoordBase noDisappearingEnvObject(MapPoint pos, unsigned living_time, unsigned add_var_living_time); noDisappearingEnvObject(SerializedGameData& sgd, unsigned obj_id); - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; - void HandleEvent(unsigned id) override; + void handleEvent(unsigned id) override; protected: /// Gibt Farbe zurück, mit der das Objekt gezeichnet werden soll diff --git a/libs/s25main/nodeObjs/noDisappearingMapEnvObject.cpp b/libs/s25main/nodeObjs/noDisappearingMapEnvObject.cpp index b6a2ed93e8..d59294eeec 100644 --- a/libs/s25main/nodeObjs/noDisappearingMapEnvObject.cpp +++ b/libs/s25main/nodeObjs/noDisappearingMapEnvObject.cpp @@ -33,10 +33,10 @@ noDisappearingMapEnvObject::noDisappearingMapEnvObject(SerializedGameData& sgd, /** * An x,y zeichnen. */ -void noDisappearingMapEnvObject::Draw(DrawPoint drawPt) +void noDisappearingMapEnvObject::draw(DrawPoint drawPt) { // Bild - LOADER.getMapTexture(map_id)->DrawFull(drawPt, getDrawColor()); + LOADER.getMapTexture(map_id)->drawFull(drawPt, getDrawColor()); // Schatten - LOADER.getMapTexture(map_id + 100)->DrawFull(drawPt, getDrawShadowColor()); + LOADER.getMapTexture(map_id + 100)->drawFull(drawPt, getDrawShadowColor()); } diff --git a/libs/s25main/nodeObjs/noDisappearingMapEnvObject.h b/libs/s25main/nodeObjs/noDisappearingMapEnvObject.h index 3ae6267f27..59c95ed0d8 100644 --- a/libs/s25main/nodeObjs/noDisappearingMapEnvObject.h +++ b/libs/s25main/nodeObjs/noDisappearingMapEnvObject.h @@ -19,7 +19,7 @@ class noDisappearingMapEnvObject : public noDisappearingEnvObject GO_Type getGOT() const final { return GO_Type::Disappearingmapenvobject; } /// An x,y zeichnen. - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; private: /// ID in der mapsx.lst diff --git a/libs/s25main/nodeObjs/noExtension.cpp b/libs/s25main/nodeObjs/noExtension.cpp index 8bc443d12d..9cbbde10a0 100644 --- a/libs/s25main/nodeObjs/noExtension.cpp +++ b/libs/s25main/nodeObjs/noExtension.cpp @@ -9,11 +9,11 @@ void noExtension::Serialize(SerializedGameData& sgd) const { noBase::Serialize(sgd); - sgd.PushObject(base); + sgd.pushObject(base); } noExtension::noExtension(SerializedGameData& sgd, const unsigned obj_id) - : noBase(sgd, obj_id), base(sgd.PopObject()) + : noBase(sgd, obj_id), base(sgd.popObject()) {} noExtension::~noExtension() = default; diff --git a/libs/s25main/nodeObjs/noExtension.h b/libs/s25main/nodeObjs/noExtension.h index 4b5aeaa552..7a5db23f91 100644 --- a/libs/s25main/nodeObjs/noExtension.h +++ b/libs/s25main/nodeObjs/noExtension.h @@ -16,9 +16,9 @@ class noExtension final : public noBase ~noExtension() override; noBase* getBaseObject() const { return base; } - void Draw(DrawPoint /*drawPt*/) override {} + void draw(DrawPoint /*drawPt*/) override {} - void Destroy() override {} + void destroy() override {} void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Extension; } diff --git a/libs/s25main/nodeObjs/noFighting.cpp b/libs/s25main/nodeObjs/noFighting.cpp index 84dd70066f..728fd9eedd 100644 --- a/libs/s25main/nodeObjs/noFighting.cpp +++ b/libs/s25main/nodeObjs/noFighting.cpp @@ -31,14 +31,14 @@ noFighting::noFighting(nofActiveSoldier& soldier1, nofActiveSoldier& soldier2) : player_won = 0xFF; // Beginn-Event Anmelden (Soldaten gehen auf ihre Seiten) - current_ev = getEvMgr().AddEvent(this, 15); + current_ev = getEvMgr().addEvent(this, 15); // anderen Leute, die auf diesem Punkt zulaufen, stoppen - world->StopOnRoads(pos); + world->stopOnRoads(pos); // Sichtradius behalten - world->MakeVisibleAroundPoint(pos, VISUALRANGE_SOLDIER, soldier1.getPlayer()); - world->MakeVisibleAroundPoint(pos, VISUALRANGE_SOLDIER, soldier2.getPlayer()); + world->makeVisibleAroundPoint(pos, VISUALRANGE_SOLDIER, soldier1.getPlayer()); + world->makeVisibleAroundPoint(pos, VISUALRANGE_SOLDIER, soldier2.getPlayer()); } noFighting::~noFighting() = default; @@ -49,37 +49,37 @@ void noFighting::Serialize(SerializedGameData& sgd) const sgd.PushUnsignedChar(turn); sgd.PushUnsignedChar(defending_animation); - sgd.PushEvent(current_ev); + sgd.pushEvent(current_ev); sgd.PushUnsignedChar(player_won); for(const auto& soldier : soldiers) - sgd.PushObject(soldier); + sgd.pushObject(soldier); } noFighting::noFighting(SerializedGameData& sgd, const unsigned obj_id) : noBase(sgd, obj_id), turn(sgd.PopUnsignedChar()), defending_animation(sgd.PopUnsignedChar()), - current_ev(sgd.PopEvent()), player_won(sgd.PopUnsignedChar()) + current_ev(sgd.popEvent()), player_won(sgd.PopUnsignedChar()) { for(auto& soldier : soldiers) - soldier.reset(sgd.PopObject()); + soldier.reset(sgd.popObject()); } -void noFighting::Destroy() +void noFighting::destroy() { RTTR_Assert(!soldiers[0]); RTTR_Assert(!soldiers[1]); - noBase::Destroy(); + noBase::destroy(); } -void noFighting::Draw(DrawPoint drawPt) +void noFighting::draw(DrawPoint drawPt) { switch(turn) { case 3: case 4: { - const unsigned curAnimFrame = GAMECLIENT.Interpolate(16, current_ev); + const unsigned curAnimFrame = GAMECLIENT.interpolate(16, current_ev); const auto& soldier = *soldiers[turn - 3]; const GamePlayer& owner = world->getPlayer(soldier.getPlayer()); @@ -97,10 +97,10 @@ void noFighting::Draw(DrawPoint drawPt) drawPt.x -= 12; else drawPt.x += 12; - LOADER.getPlayerImage("rom_bobs", 903 + curAnimFrame - 4)->DrawFull(drawPt, COLOR_WHITE, owner.color); + LOADER.getPlayerImage("rom_bobs", 903 + curAnimFrame - 4)->drawFull(drawPt, COLOR_WHITE, owner.color); } if(soldiers[turn - 3]->hasArmor()) - soldiers[turn - 3]->DrawArmor(drawPt); + soldiers[turn - 3]->drawArmor(drawPt); // Sterbesound abspielen if(curAnimFrame == 6) @@ -110,17 +110,17 @@ void noFighting::Draw(DrawPoint drawPt) case 2: { // Erste Phase des Kampfes, die Soldaten gehen jeweils nach links bzw. rechts - auto x_diff = int(GAMECLIENT.Interpolate(12, current_ev)); + auto x_diff = int(GAMECLIENT.interpolate(12, current_ev)); drawPt.x -= x_diff; for(unsigned i : {0, 1}) { const GamePlayer& owner = world->getPlayer(soldiers[i]->getPlayer()); glSmartBitmap& bmp = LOADER.getBobSprite(owner.nation, soldiers[i]->getJobType(), (i == 0) ? Direction::West : Direction::East, - GAMECLIENT.Interpolate(8, current_ev)); + GAMECLIENT.interpolate(8, current_ev)); bmp.draw(drawPt, COLOR_WHITE, owner.color); if(soldiers[i]->hasArmor()) - soldiers[i]->DrawArmor(drawPt); + soldiers[i]->drawArmor(drawPt); drawPt.x += 2 * x_diff; } } @@ -129,7 +129,7 @@ void noFighting::Draw(DrawPoint drawPt) { // Kampf // Aktueller Animationsframe - const unsigned curAnimFrame = GAMECLIENT.Interpolate(8, current_ev); + const unsigned curAnimFrame = GAMECLIENT.interpolate(8, current_ev); for(unsigned i : {0, 1}) { @@ -173,7 +173,7 @@ void noFighting::Draw(DrawPoint drawPt) } } if(soldiers[i]->hasArmor()) - soldiers[i]->DrawArmor(drawPt + DrawPoint(i == 0 ? -12 : 12, 0)); + soldiers[i]->drawArmor(drawPt + DrawPoint(i == 0 ? -12 : 12, 0)); } // Angriffssound @@ -184,7 +184,7 @@ void noFighting::Draw(DrawPoint drawPt) } } -void noFighting::HandleEvent(const unsigned id) +void noFighting::handleEvent(const unsigned id) { // Normales Ablaufevent? if(id == 0) @@ -198,7 +198,7 @@ void noFighting::HandleEvent(const unsigned id) // "Auslosen", wer als erstes dran ist mit Angreifen turn = static_cast(RANDOM_RAND(2)); // anfangen anzugreifen - StartAttack(); + startAttack(); } return; case 0: @@ -210,34 +210,34 @@ void noFighting::HandleEvent(const unsigned id) // Wurde der eine getroffen? if(defending_animation == 3) { - soldiers[1 - turn]->TakeHit(); + soldiers[1 - turn]->takeHit(); if(soldiers[1 - turn]->getHitpoints() == 0) { // Besitzer merken für die Sichtbarkeiten am Ende dann player_won = soldiers[turn]->getPlayer(); // Soldat Bescheid sagen, dass er stirbt - soldiers[1 - turn]->LostFighting(); + soldiers[1 - turn]->lostFighting(); // Anderen Soldaten auf die Karte wieder setzen, Bescheid sagen, er kann wieder loslaufen const MapPoint pos = soldiers[turn]->getPos(); - auto& winningSoldier = world->AddFigure(pos, std::move(soldiers[turn])); + auto& winningSoldier = world->addFigure(pos, std::move(soldiers[turn])); // Hitpoints sind 0 --> Soldat ist tot, Kampf beendet, turn = 3+welche Soldat stirbt // Do this before calling WonFighting so this fight doesn't block the soldier looking for a new // fight spot turn = 3 + (1 - turn); - winningSoldier.WonFighting(); + winningSoldier.wonFighting(); // Event zum Sterben des einen Soldaten anmelden - current_ev = getEvMgr().AddEvent(this, 30); + current_ev = getEvMgr().addEvent(this, 30); // Umstehenden Figuren Bescheid Bescheid sagen - world->RoadNodeAvailable(pos); + world->roadNodeAvailable(pos); // In die Statistik eintragen - world->getPlayer(player_won).ChangeStatisticValue(StatisticType::Vanquished, 1); + world->getPlayer(player_won).changeStatisticValue(StatisticType::Vanquished, 1); return; } } turn = 1 - turn; - StartAttack(); + startAttack(); } return; case 3: @@ -250,26 +250,26 @@ void noFighting::HandleEvent(const unsigned id) world->getSoundMgr().stopSounds(*this); // Kampf ist endgültig beendet - getEvMgr().AddToKillList(world->RemoveFigure(pt, *this)); + getEvMgr().addToKillList(world->RemoveFigure(pt, *this)); // Wenn da nix war bzw. nur ein Verzierungsobjekt, kommt nun ein Skelett hin NodalObjectType noType = world->getNO(pt)->getType(); if(noType == NodalObjectType::Nothing || noType == NodalObjectType::Environment) { - world->DestroyNO(pt, false); + world->destroyNO(pt, false); world->setNO(pt, new noSkeleton(pt)); } // Sichtradius ausblenden am Ende des Kampfes, an jeweiligen Soldaten dann übergeben, welcher überlebt // hat - world->RecalcVisibilitiesAroundPoint(pt, VISUALRANGE_SOLDIER, soldiers[player_lost]->getPlayer(), + world->recalcVisibilitiesAroundPoint(pt, VISUALRANGE_SOLDIER, soldiers[player_lost]->getPlayer(), nullptr); - world->RecalcVisibilitiesAroundPoint(pt, VISUALRANGE_SOLDIER, player_won, nullptr); + world->recalcVisibilitiesAroundPoint(pt, VISUALRANGE_SOLDIER, player_won, nullptr); // Soldaten endgültig umbringen world->getPlayer(soldiers[player_lost]->getPlayer()) - .DecreaseInventoryJob(soldiers[player_lost]->getJobType(), 1); - soldiers[player_lost]->Destroy(); + .decreaseInventoryJob(soldiers[player_lost]->getJobType(), 1); + soldiers[player_lost]->destroy(); soldiers[player_lost].reset(); } break; @@ -278,7 +278,7 @@ void noFighting::HandleEvent(const unsigned id) RTTR_Assert(false); } -void noFighting::StartAttack() +void noFighting::startAttack() { // "Auswürfeln", ob der Angreifer (also der, der gerade den Angriff vollzieht) trifft oder ob sich der andere // erfolgreich verteidigt @@ -307,7 +307,7 @@ void noFighting::StartAttack() defending_animation = static_cast(RANDOM_RAND(3)); // Entsprechendes Event anmelden - current_ev = getEvMgr().AddEvent(this, 15); + current_ev = getEvMgr().addEvent(this, 15); } bool noFighting::IsActive() const diff --git a/libs/s25main/nodeObjs/noFighting.h b/libs/s25main/nodeObjs/noFighting.h index a8c10be977..b4e8b2967f 100644 --- a/libs/s25main/nodeObjs/noFighting.h +++ b/libs/s25main/nodeObjs/noFighting.h @@ -29,20 +29,20 @@ class noFighting : public noBase private: /// Bestimmt, ob der Angreifer erfolgreich angreift oder ob der Verteidiger sich verteidigt usw /// bereitet also alles für eine solche Angrifsseinheit vor - void StartAttack(); + void startAttack(); public: noFighting(nofActiveSoldier& soldier1, nofActiveSoldier& soldier2); noFighting(SerializedGameData& sgd, unsigned obj_id); ~noFighting() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Fighting; } - void Draw(DrawPoint drawPt) override; - void HandleEvent(unsigned id) override; + void draw(DrawPoint drawPt) override; + void handleEvent(unsigned id) override; /// Dürfen andern Figuren diesen Kampf schon durchqueren? bool IsActive() const; diff --git a/libs/s25main/nodeObjs/noFire.cpp b/libs/s25main/nodeObjs/noFire.cpp index 723e4c5bf2..429acf9926 100644 --- a/libs/s25main/nodeObjs/noFire.cpp +++ b/libs/s25main/nodeObjs/noFire.cpp @@ -22,21 +22,21 @@ noFire::noFire(const MapPoint pos, bool isBig) : noCoordBase(NodalObjectType::Fire, pos), isBig(isBig), was_sounding(false), last_sound(0), next_interval(0) { // Burn for some time - dead_event = getEvMgr().AddEvent(this, FIREDURATION[world->getGGS().getSelection(AddonId::BURN_DURATION)]); + dead_event = getEvMgr().addEvent(this, FIREDURATION[world->getGGS().getSelection(AddonId::BURN_DURATION)]); } noFire::~noFire() = default; -void noFire::Destroy() +void noFire::destroy() { // Remove from map if still present if(world->getNode(pos).obj == this) world->setNO(pos, nullptr); - world->RecalcBQAroundPoint(pos); + world->recalcBQAroundPoint(pos); world->getSoundMgr().stopSounds(*this); - getEvMgr().RemoveEvent(dead_event); - noCoordBase::Destroy(); + getEvMgr().removeEvent(dead_event); + noCoordBase::destroy(); } void noFire::Serialize(SerializedGameData& sgd) const @@ -44,25 +44,25 @@ void noFire::Serialize(SerializedGameData& sgd) const noCoordBase::Serialize(sgd); sgd.PushBool(isBig); - sgd.PushEvent(dead_event); + sgd.pushEvent(dead_event); } noFire::noFire(SerializedGameData& sgd, const unsigned obj_id) - : noCoordBase(sgd, obj_id), isBig(sgd.PopBool()), dead_event(sgd.PopEvent()), was_sounding(false), last_sound(0), + : noCoordBase(sgd, obj_id), isBig(sgd.PopBool()), dead_event(sgd.popEvent()), was_sounding(false), last_sound(0), next_interval(0) {} -void noFire::Draw(DrawPoint drawPt) +void noFire::draw(DrawPoint drawPt) { unsigned id = - GAMECLIENT.Interpolate(FIREANIMATIONDURATION[world->getGGS().getSelection(AddonId::BURN_DURATION)], dead_event); + GAMECLIENT.interpolate(FIREANIMATIONDURATION[world->getGGS().getSelection(AddonId::BURN_DURATION)], dead_event); // Burn for the first 2/3 of the time, leave debris for the last 1/3 if(id < FIREANIMATIONDURATION[world->getGGS().getSelection(AddonId::BURN_DURATION)] * 2 / 3) { // Fire animation - LOADER.getMapTexture(2500 + (isBig ? 8 : 0) + id % 8)->DrawFull(drawPt); - LOADER.getMapTexture(2530 + (isBig ? 8 : 0) + id % 8)->DrawFull(drawPt, 0xC0101010); + LOADER.getMapTexture(2500 + (isBig ? 8 : 0) + id % 8)->drawFull(drawPt); + LOADER.getMapTexture(2530 + (isBig ? 8 : 0) + id % 8)->drawFull(drawPt, 0xC0101010); // Fire sound play in random intervals if(VIDEODRIVER.getTickCount() - last_sound > next_interval) @@ -76,15 +76,15 @@ void noFire::Draw(DrawPoint drawPt) } else { // Debris - LOADER.getMapTexture(2524 + (isBig ? 1 : 0))->DrawFull(drawPt); + LOADER.getMapTexture(2524 + (isBig ? 1 : 0))->drawFull(drawPt); } } -void noFire::HandleEvent(const unsigned /*id*/) +void noFire::handleEvent(const unsigned /*id*/) { // End event: Remove from map and destroy RTTR_Assert(world->getNode(pos).obj == this); world->setNO(pos, nullptr); dead_event = nullptr; - getEvMgr().AddToKillList(this); + getEvMgr().addToKillList(this); } diff --git a/libs/s25main/nodeObjs/noFire.h b/libs/s25main/nodeObjs/noFire.h index f45d7d3bc4..2ad7d64d67 100644 --- a/libs/s25main/nodeObjs/noFire.h +++ b/libs/s25main/nodeObjs/noFire.h @@ -28,7 +28,7 @@ class noFire : public noCoordBase noFire(SerializedGameData& sgd, unsigned obj_id); ~noFire() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Fire; } @@ -36,7 +36,7 @@ class noFire : public noCoordBase BlockingManner getBM() const override { return BlockingManner::FlagsAround; } /// Zeichnen - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; /// Benachrichtigen, wenn neuer gf erreicht wurde - void HandleEvent(unsigned id) override; + void handleEvent(unsigned id) override; }; diff --git a/libs/s25main/nodeObjs/noFlag.cpp b/libs/s25main/nodeObjs/noFlag.cpp index c81dacb1a2..7c3631bc1c 100644 --- a/libs/s25main/nodeObjs/noFlag.cpp +++ b/libs/s25main/nodeObjs/noFlag.cpp @@ -35,7 +35,7 @@ noFlag::noFlag(const MapPoint pos, const unsigned char player) noFlag* flag = world->getRoadFlag(pos, dir); if(flag && flag->getRoute(dir)) - flag->getRoute(dir)->SplitRoad(this); + flag->getRoute(dir)->splitRoad(this); // auf Wasseranteile prüfen if(world->hasTerrain(pos, [](const auto& desc) { return desc.kind == TerrainKind::Water; })) @@ -45,18 +45,18 @@ noFlag::noFlag(const MapPoint pos, const unsigned char player) } noFlag::noFlag(SerializedGameData& sgd, const unsigned obj_id) - : noRoadNode(sgd, obj_id), ani_offset(rand() % 20000), flagtype(sgd.Pop()) + : noRoadNode(sgd, obj_id), ani_offset(rand() % 20000), flagtype(sgd.pop()) { if(sgd.getGameDataVersion() < 8) { for(unsigned i = 0; i < wares.max_size(); i++) { - auto* ware = sgd.PopObject(GO_Type::Ware); + auto* ware = sgd.popObject(GO_Type::Ware); if(ware) wares.emplace_back(ware); } } else - sgd.PopObjectContainer(wares, GO_Type::Ware); + sgd.popObjectContainer(wares, GO_Type::Ware); // BWUs laden for(auto& bwu : bwus) @@ -68,7 +68,7 @@ noFlag::noFlag(SerializedGameData& sgd, const unsigned obj_id) noFlag::~noFlag() = default; -void noFlag::Destroy() +void noFlag::destroy() { /// Da ist dann nichts world->setNO(pos, nullptr); @@ -77,23 +77,23 @@ void noFlag::Destroy() for(auto& ware : wares) { // Inventur entsprechend verringern - ware->WareLost(player); - ware->Destroy(); + ware->wareLost(player); + ware->destroy(); } wares.clear(); // Den Flag-Workern Bescheid sagen, die hier ggf. arbeiten - world->getPlayer(player).FlagDestroyed(this); + world->getPlayer(player).flagDestroyed(this); - noRoadNode::Destroy(); + noRoadNode::destroy(); } void noFlag::Serialize(SerializedGameData& sgd) const { noRoadNode::Serialize(sgd); - sgd.PushEnum(flagtype); - sgd.PushObjectContainer(wares, true); + sgd.pushEnum(flagtype); + sgd.pushObjectContainer(wares, true); // BWUs speichern for(const auto& bwu : bwus) @@ -103,7 +103,7 @@ void noFlag::Serialize(SerializedGameData& sgd) const } } -void noFlag::Draw(DrawPoint drawPt) +void noFlag::draw(DrawPoint drawPt) { // Positionen der Waren an der Flagge relativ zur Flagge static constexpr std::array WARES_POS = { @@ -117,7 +117,7 @@ void noFlag::Draw(DrawPoint drawPt) // Waren (von hinten anfangen zu zeichnen) for(unsigned i = wares.size(); i > 0; --i) { - LOADER.getWareStackTex(wares[i - 1]->type)->DrawFull(drawPt + WARES_POS[i - 1]); + LOADER.getWareStackTex(wares[i - 1]->type)->drawFull(drawPt + WARES_POS[i - 1]); } } @@ -125,7 +125,7 @@ void noFlag::Draw(DrawPoint drawPt) * Erzeugt von ihnen selbst ein FOW Objekt als visuelle "Erinnerung" * für den Fog of War. */ -std::unique_ptr noFlag::CreateFOWObject() const +std::unique_ptr noFlag::createFOWObject() const { const GamePlayer& owner = world->getPlayer(player); return std::make_unique(owner.color, owner.nation, flagtype); @@ -134,14 +134,14 @@ std::unique_ptr noFlag::CreateFOWObject() const /** * Legt eine Ware an der Flagge ab. */ -void noFlag::AddWare(std::unique_ptr ware) +void noFlag::addWare(std::unique_ptr ware) { // First add ware, then tell carrier. So get the info from the ware first const RoadPathDirection nextDir = ware->getNextDir(); wares.push_back(std::move(ware)); if(nextDir != RoadPathDirection::None) - getRoute(toDirection(nextDir))->AddWareJob(this); + getRoute(toDirection(nextDir))->addWareJob(this); } /** @@ -151,7 +151,7 @@ void noFlag::AddWare(std::unique_ptr ware) * wenn swap_wares true ist, bedeutet dies, dass Waren nur ausgetauscht werden * und somit nicht die Träger benachrichtigt werden müssen. */ -std::unique_ptr noFlag::SelectWare(const Direction roadDir, const bool swap_wares, const noFigure* const carrier) +std::unique_ptr noFlag::selectWare(const Direction roadDir, const bool swap_wares, const noFigure* const carrier) { // Index merken, damit wir die enstprechende Ware dann entfernen können int best_ware_index = -1; @@ -182,7 +182,7 @@ std::unique_ptr noFlag::SelectWare(const Direction roadDir, const bool swa } // ggf. anderen Trägern Bescheid sagen, aber nicht dem, der die Ware aufgehoben hat! - getRoute(roadDir)->WareJobRemoved(carrier); + getRoute(roadDir)->wareJobRemoved(carrier); if(!swap_wares && bestWare) { @@ -201,7 +201,7 @@ std::unique_ptr noFlag::SelectWare(const Direction roadDir, const bool swa if(world->getSpecObj(world->getNeighbour(pos, Direction::NorthWest))->getType() == NodalObjectType::Building) { - if(world->getSpecObj(world->getNeighbour(pos, Direction::NorthWest))->FreePlaceAtFlag()) + if(world->getSpecObj(world->getNeighbour(pos, Direction::NorthWest))->freePlaceAtFlag()) break; } } else @@ -211,7 +211,7 @@ std::unique_ptr noFlag::SelectWare(const Direction roadDir, const bool swa { if(route->hasCarrier(c)) { - if(route->getCarrier(c)->SpaceAtFlag(this == route->getF2())) + if(route->getCarrier(c)->spaceAtFlag(this == route->getF2())) break; } } @@ -265,13 +265,13 @@ unsigned noFlag::getPunishmentPoints(const Direction dir) const /** * Zerstört evtl. vorhandenes Gebäude bzw. Baustelle vor der Flagge. */ -void noFlag::DestroyAttachedBuilding() +void noFlag::destroyAttachedBuilding() { // Achtung es wird ein Feuer durch Destroy gesetzt, daher Objekt merken! noBase* no = world->getNO(world->getNeighbour(pos, Direction::NorthWest)); if(no->getType() == NodalObjectType::Buildingsite || no->getType() == NodalObjectType::Building) { - no->Destroy(); + no->destroy(); delete no; } } @@ -279,7 +279,7 @@ void noFlag::DestroyAttachedBuilding() /** * Baut normale Flaggen zu "gloriösen" aus bei Eselstraßen. */ -void noFlag::Upgrade() +void noFlag::upgrade() { if(flagtype == FlagType::Normal) flagtype = FlagType::Large; @@ -288,7 +288,7 @@ void noFlag::Upgrade() /** * Feind übernimmt die Flagge. */ -void noFlag::Capture(const unsigned char new_owner) +void noFlag::capture(const unsigned char new_owner) { // Alle Straßen um mich herum zerstören bis auf die zum Gebäude for(const auto dir : helpers::EnumRange{}) @@ -300,13 +300,13 @@ void noFlag::Capture(const unsigned char new_owner) // Waren vernichten for(auto& ware : wares) { - ware->WareLost(player); - ware->Destroy(); + ware->wareLost(player); + ware->destroy(); } wares.clear(); // Unregister this flag in the players flags - world->getPlayer(player).FlagDestroyed(this); + world->getPlayer(player).flagDestroyed(this); this->player = new_owner; } @@ -334,7 +334,7 @@ bool noFlag::isImpossibleForBWU(const unsigned bwu_id) const /** * Hinzufügen, dass diese Flagge für eine bestimmte Lagerhausgruppe nicht zugänglich ist. */ -void noFlag::ImpossibleForBWU(const unsigned bwu_id) +void noFlag::impossibleForBWU(const unsigned bwu_id) { // Evtl gibts BWU schon --> Dann einfach GF-Zahl aktualisieren for(auto& bwu : bwus) diff --git a/libs/s25main/nodeObjs/noFlag.h b/libs/s25main/nodeObjs/noFlag.h index 9eff5b5b1f..fad386988d 100644 --- a/libs/s25main/nodeObjs/noFlag.h +++ b/libs/s25main/nodeObjs/noFlag.h @@ -23,7 +23,7 @@ class noFlag : public noRoadNode noFlag(SerializedGameData& sgd, unsigned obj_id); ~noFlag() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Flag; } @@ -31,33 +31,33 @@ class noFlag : public noRoadNode /// Gibt Auskunft darüber, ob noch Platz für eine Ware an der Flagge ist. bool hasSpaceForWare() const { return wares.size() < wares.max_size(); } - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; BlockingManner getBM() const override { return BlockingManner::Flag; } /// Erzeugt von ihnen selbst ein FOW Objekt als visuelle "Erinnerung" für den Fog of War. - std::unique_ptr CreateFOWObject() const override; + std::unique_ptr createFOWObject() const override; /// Legt eine Ware an der Flagge ab. - void AddWare(std::unique_ptr ware) override; + void addWare(std::unique_ptr ware) override; /// Gibt die Anzahl der Waren zurück, die an der Flagge liegen. unsigned getNumWares() const { return wares.size(); } /// Wählt eine Ware von einer Flagge aus (anhand der Transportreihenfolge), entfernt sie von der Flagge und gibt sie /// zurück. - std::unique_ptr SelectWare(Direction roadDir, bool swap_wares, const noFigure* carrier); + std::unique_ptr selectWare(Direction roadDir, bool swap_wares, const noFigure* carrier); /// Prüft, ob es Waren gibt, die auf den Weg in Richtung dir getragen werden müssen. unsigned getNumWaresForRoad(Direction dir) const; /// Penalty for transporting a ware in a specific direction unsigned getPunishmentPoints(Direction dir) const override; /// Zerstört evtl. vorhandenes Gebäude bzw. Baustelle vor der Flagge. - void DestroyAttachedBuilding(); + void destroyAttachedBuilding(); /// Baut normale Flaggen zu "gloriösen" aus bei Eselstraßen. - void Upgrade(); + void upgrade(); /// Feind übernimmt die Flagge. - void Capture(unsigned char new_owner); + void capture(unsigned char new_owner); /// Ist diese Flagge für eine bestimmte Lagerhausflüchtlingsgruppe (BWU) nicht zugänglich? bool isImpossibleForBWU(unsigned bwu_id) const; /// Hinzufügen, dass diese Flagge für eine bestimmte Lagerhausgruppe nicht zugänglich ist. - void ImpossibleForBWU(unsigned bwu_id); + void impossibleForBWU(unsigned bwu_id); private: unsigned short ani_offset; diff --git a/libs/s25main/nodeObjs/noGrainfield.cpp b/libs/s25main/nodeObjs/noGrainfield.cpp index 16f96af18a..990f4691a1 100644 --- a/libs/s25main/nodeObjs/noGrainfield.cpp +++ b/libs/s25main/nodeObjs/noGrainfield.cpp @@ -21,19 +21,19 @@ const unsigned GROWING_LENGTH = 16; noGrainfield::noGrainfield(const MapPoint pos) : noCoordBase(NodalObjectType::Grainfield, pos), type(RANDOM_RAND(2)), state(State::GrowingWaiting), size(0) { - event = getEvMgr().AddEvent(this, GROWING_WAITING_LENGTH); + event = getEvMgr().addEvent(this, GROWING_WAITING_LENGTH); } noGrainfield::~noGrainfield() = default; -void noGrainfield::Destroy() +void noGrainfield::destroy() { - getEvMgr().RemoveEvent(event); + getEvMgr().removeEvent(event); // Bauplätze drumrum neu berechnen - world->RecalcBQAroundPoint(pos); + world->recalcBQAroundPoint(pos); - noCoordBase::Destroy(); + noCoordBase::destroy(); } void noGrainfield::Serialize(SerializedGameData& sgd) const @@ -41,17 +41,17 @@ void noGrainfield::Serialize(SerializedGameData& sgd) const noCoordBase::Serialize(sgd); sgd.PushUnsignedChar(type); - sgd.PushEnum(state); + sgd.pushEnum(state); sgd.PushUnsignedChar(size); - sgd.PushEvent(event); + sgd.pushEvent(event); } noGrainfield::noGrainfield(SerializedGameData& sgd, const unsigned obj_id) - : noCoordBase(sgd, obj_id), type(sgd.PopUnsignedChar()), state(sgd.Pop()), size(sgd.PopUnsignedChar()), - event(sgd.PopEvent()) + : noCoordBase(sgd, obj_id), type(sgd.PopUnsignedChar()), state(sgd.pop()), size(sgd.PopUnsignedChar()), + event(sgd.popEvent()) {} -void noGrainfield::Draw(DrawPoint drawPt) +void noGrainfield::draw(DrawPoint drawPt) { switch(state) { @@ -63,7 +63,7 @@ void noGrainfield::Draw(DrawPoint drawPt) break; case State::Growing: { - unsigned alpha = GAMECLIENT.Interpolate(0xFF, event); + unsigned alpha = GAMECLIENT.interpolate(0xFF, event); // altes Feld ausblenden LOADER.grainfield_cache[type][size].draw(drawPt, SetAlpha(COLOR_WHITE, 0xFF - alpha)); @@ -74,7 +74,7 @@ void noGrainfield::Draw(DrawPoint drawPt) break; case State::Withering: { - unsigned alpha = GAMECLIENT.Interpolate(0xFF, event); + unsigned alpha = GAMECLIENT.interpolate(0xFF, event); // Feld ausblenden LOADER.grainfield_cache[type][size].draw(drawPt, SetAlpha(COLOR_WHITE, 0xFF - alpha)); @@ -83,14 +83,14 @@ void noGrainfield::Draw(DrawPoint drawPt) } } -void noGrainfield::HandleEvent(const unsigned /*id*/) +void noGrainfield::handleEvent(const unsigned /*id*/) { switch(state) { case State::GrowingWaiting: { // Feld hat gewartet, also wächst es jetzt - event = getEvMgr().AddEvent(this, GROWING_LENGTH); + event = getEvMgr().addEvent(this, GROWING_LENGTH); state = State::Growing; } break; @@ -100,7 +100,7 @@ void noGrainfield::HandleEvent(const unsigned /*id*/) // wächst if(++size != 3) { - event = getEvMgr().AddEvent(this, GROWING_WAITING_LENGTH); + event = getEvMgr().addEvent(this, GROWING_WAITING_LENGTH); // Erstmal wieder bis zum nächsten Wachsstumsschub warten state = State::GrowingWaiting; } else @@ -108,7 +108,7 @@ void noGrainfield::HandleEvent(const unsigned /*id*/) // bin nun ausgewachsen state = State::Normal; // nach langer Zeit verdorren - event = getEvMgr().AddEvent(this, 3000 + RANDOM_RAND(1000)); + event = getEvMgr().addEvent(this, 3000 + RANDOM_RAND(1000)); } } break; @@ -116,7 +116,7 @@ void noGrainfield::HandleEvent(const unsigned /*id*/) { // Jetzt lebt es schon zu lange --> hokus pokus verschwindibus! state = State::Withering; - event = getEvMgr().AddEvent(this, 20); + event = getEvMgr().addEvent(this, 20); } break; case State::Withering: @@ -124,22 +124,22 @@ void noGrainfield::HandleEvent(const unsigned /*id*/) // Selbst zerstören event = nullptr; world->setNO(pos, nullptr); - getEvMgr().AddToKillList(this); + getEvMgr().addToKillList(this); } break; } } -void noGrainfield::BeginHarvesting() +void noGrainfield::beginHarvesting() { // Event killen, damit wir nicht plötzlich verschwinden, wenn er uns aberntet - getEvMgr().RemoveEvent(event); + getEvMgr().removeEvent(event); event = nullptr; state = State::Normal; } -void noGrainfield::EndHarvesting() +void noGrainfield::endHarvesting() { // nach langer Zeit verdorren (von neuem) - event = getEvMgr().AddEvent(this, 3000 + RANDOM_RAND(1000)); + event = getEvMgr().addEvent(this, 3000 + RANDOM_RAND(1000)); } diff --git a/libs/s25main/nodeObjs/noGrainfield.h b/libs/s25main/nodeObjs/noGrainfield.h index a0b17462f6..9046400684 100644 --- a/libs/s25main/nodeObjs/noGrainfield.h +++ b/libs/s25main/nodeObjs/noGrainfield.h @@ -37,13 +37,13 @@ class noGrainfield : public noCoordBase ~noGrainfield() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Grainfield; } - void Draw(DrawPoint drawPt) override; - void HandleEvent(unsigned id) override; + void draw(DrawPoint drawPt) override; + void handleEvent(unsigned id) override; BlockingManner getBM() const override { return BlockingManner::FlagsAround; } @@ -54,7 +54,7 @@ class noGrainfield : public noCoordBase unsigned getHarvestMapLstID() const { return 532 + type * 5 + 4; } /// Bauer beginnt dieses Feld abzuernten - void BeginHarvesting(); + void beginHarvesting(); /// Bauer wird beim Abernten unterbrochen - void EndHarvesting(); + void endHarvesting(); }; diff --git a/libs/s25main/nodeObjs/noGranite.cpp b/libs/s25main/nodeObjs/noGranite.cpp index 787b75f70f..680fc8ec5e 100644 --- a/libs/s25main/nodeObjs/noGranite.cpp +++ b/libs/s25main/nodeObjs/noGranite.cpp @@ -18,25 +18,25 @@ void noGranite::Serialize(SerializedGameData& sgd) const { noBase::Serialize(sgd); - sgd.PushEnum(type); + sgd.pushEnum(type); sgd.PushUnsignedChar(state); } noGranite::noGranite(SerializedGameData& sgd, const unsigned obj_id) - : noBase(sgd, obj_id), type(sgd.Pop()), state(sgd.PopUnsignedChar()) + : noBase(sgd, obj_id), type(sgd.pop()), state(sgd.PopUnsignedChar()) {} -void noGranite::Draw(DrawPoint drawPt) +void noGranite::draw(DrawPoint drawPt) { LOADER.granite_cache[type][state].draw(drawPt); } -std::unique_ptr noGranite::CreateFOWObject() const +std::unique_ptr noGranite::createFOWObject() const { return std::make_unique(type, state); } -void noGranite::Hew() +void noGranite::hew() { if(state) --state; diff --git a/libs/s25main/nodeObjs/noGranite.h b/libs/s25main/nodeObjs/noGranite.h index fe8c26fa9b..bbc7891495 100644 --- a/libs/s25main/nodeObjs/noGranite.h +++ b/libs/s25main/nodeObjs/noGranite.h @@ -18,20 +18,20 @@ class noGranite final : public noBase noGranite(GraniteType type, unsigned char state); noGranite(SerializedGameData& sgd, unsigned obj_id); - void Destroy() override {} + void destroy() override {} void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Granite; } - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; BlockingManner getBM() const override { return BlockingManner::FlagsAround; } /// Erzeugt von ihnen selbst ein FOW Objekt als visuelle "Erinnerung" für den Fog of War - std::unique_ptr CreateFOWObject() const override; + std::unique_ptr createFOWObject() const override; /// "Bearbeitet" den Granitglotz --> haut ein Stein ab - void Hew(); + void hew(); /// Gibt true zurück, falls der Granitblock nur noch 1 Stein groß ist und damit dann vernichtet werden kann bool isSmall() const { return (state == 0); } diff --git a/libs/s25main/nodeObjs/noGrapefield.cpp b/libs/s25main/nodeObjs/noGrapefield.cpp index e4ce87b727..ccf8e60351 100644 --- a/libs/s25main/nodeObjs/noGrapefield.cpp +++ b/libs/s25main/nodeObjs/noGrapefield.cpp @@ -25,19 +25,19 @@ using namespace wineaddon; noGrapefield::noGrapefield(const MapPoint pos) : noCoordBase(NodalObjectType::Grapefield, pos), type(RANDOM_RAND(2)), state(State::GrowingWaiting), size(0) { - event = getEvMgr().AddEvent(this, GROWING_WAITING_LENGTH); + event = getEvMgr().addEvent(this, GROWING_WAITING_LENGTH); } noGrapefield::~noGrapefield() = default; -void noGrapefield::Destroy() +void noGrapefield::destroy() { - getEvMgr().RemoveEvent(event); + getEvMgr().removeEvent(event); // recompute BQ around - world->RecalcBQAroundPoint(pos); + world->recalcBQAroundPoint(pos); - noCoordBase::Destroy(); + noCoordBase::destroy(); } void noGrapefield::Serialize(SerializedGameData& sgd) const @@ -45,17 +45,17 @@ void noGrapefield::Serialize(SerializedGameData& sgd) const noCoordBase::Serialize(sgd); sgd.PushUnsignedChar(type); - sgd.PushEnum(state); + sgd.pushEnum(state); sgd.PushUnsignedChar(size); - sgd.PushEvent(event); + sgd.pushEvent(event); } noGrapefield::noGrapefield(SerializedGameData& sgd, const unsigned obj_id) - : noCoordBase(sgd, obj_id), type(sgd.PopUnsignedChar()), state(sgd.Pop()), size(sgd.PopUnsignedChar()), - event(sgd.PopEvent()) + : noCoordBase(sgd, obj_id), type(sgd.PopUnsignedChar()), state(sgd.pop()), size(sgd.PopUnsignedChar()), + event(sgd.popEvent()) {} -void noGrapefield::Draw(DrawPoint drawPt) +void noGrapefield::draw(DrawPoint drawPt) { switch(state) { @@ -67,7 +67,7 @@ void noGrapefield::Draw(DrawPoint drawPt) break; case State::Growing: { - unsigned alpha = GAMECLIENT.Interpolate(0xFF, event); + unsigned alpha = GAMECLIENT.interpolate(0xFF, event); // hiding old field grapefield_cache[type][size].draw(drawPt, SetAlpha(COLOR_WHITE, 0xFF - alpha)); @@ -78,7 +78,7 @@ void noGrapefield::Draw(DrawPoint drawPt) break; case State::Withering: { - unsigned alpha = GAMECLIENT.Interpolate(0xFF, event); + unsigned alpha = GAMECLIENT.interpolate(0xFF, event); // hiding old field grapefield_cache[type][size].draw(drawPt, SetAlpha(COLOR_WHITE, 0xFF - alpha)); @@ -87,14 +87,14 @@ void noGrapefield::Draw(DrawPoint drawPt) } } -void noGrapefield::HandleEvent(const unsigned /*id*/) +void noGrapefield::handleEvent(const unsigned /*id*/) { switch(state) { case State::GrowingWaiting: { // Field was waiting, so it is growing now - event = getEvMgr().AddEvent(this, GROWING_LENGTH); + event = getEvMgr().addEvent(this, GROWING_LENGTH); state = State::Growing; } break; @@ -103,7 +103,7 @@ void noGrapefield::HandleEvent(const unsigned /*id*/) // When not fully grown, add an additional wait event, so the field can grow further if(++size != 3) { - event = getEvMgr().AddEvent(this, GROWING_WAITING_LENGTH); + event = getEvMgr().addEvent(this, GROWING_WAITING_LENGTH); // Wait until the next growing phase state = State::GrowingWaiting; } else @@ -111,7 +111,7 @@ void noGrapefield::HandleEvent(const unsigned /*id*/) // Fully grown state = State::Normal; // wither after large time - event = getEvMgr().AddEvent(this, 3000 + RANDOM_RAND(1000)); + event = getEvMgr().addEvent(this, 3000 + RANDOM_RAND(1000)); } } break; @@ -119,7 +119,7 @@ void noGrapefield::HandleEvent(const unsigned /*id*/) { // Living to long --> start vanishing state = State::Withering; - event = getEvMgr().AddEvent(this, 20); + event = getEvMgr().addEvent(this, 20); } break; case State::Withering: @@ -127,7 +127,7 @@ void noGrapefield::HandleEvent(const unsigned /*id*/) // Self destruction event = nullptr; world->setNO(pos, nullptr); - getEvMgr().AddToKillList(this); + getEvMgr().addToKillList(this); } break; } @@ -138,16 +138,16 @@ unsigned noGrapefield::getHarvestID() const return bobIndex[BobTypes(rttr::enum_cast(BobTypes::WINEGROWER_GRAPEFIELDS_ONE) + type)] + 4; } -void noGrapefield::BeginHarvesting() +void noGrapefield::beginHarvesting() { // Kill event, so we do not disappear when we are harvested - getEvMgr().RemoveEvent(event); + getEvMgr().removeEvent(event); event = nullptr; state = State::Normal; } -void noGrapefield::AbortHarvesting() +void noGrapefield::abortHarvesting() { // Wither after long time - event = getEvMgr().AddEvent(this, 3000 + RANDOM_RAND(1000)); + event = getEvMgr().addEvent(this, 3000 + RANDOM_RAND(1000)); } diff --git a/libs/s25main/nodeObjs/noGrapefield.h b/libs/s25main/nodeObjs/noGrapefield.h index ba48b065c8..96e2ce08ae 100644 --- a/libs/s25main/nodeObjs/noGrapefield.h +++ b/libs/s25main/nodeObjs/noGrapefield.h @@ -37,13 +37,13 @@ class noGrapefield : public noCoordBase ~noGrapefield() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Grapefield; } - void Draw(DrawPoint drawPt) override; - void HandleEvent(unsigned id) override; + void draw(DrawPoint drawPt) override; + void handleEvent(unsigned id) override; BlockingManner getBM() const override { return BlockingManner::FlagsAround; } @@ -54,7 +54,7 @@ class noGrapefield : public noCoordBase unsigned getHarvestID() const; /// Winegrower starts harvesting the field - void BeginHarvesting(); + void beginHarvesting(); /// Winegrower is interrupted during harvesting - void AbortHarvesting(); + void abortHarvesting(); }; diff --git a/libs/s25main/nodeObjs/noMovable.cpp b/libs/s25main/nodeObjs/noMovable.cpp index 17e176cdb6..674186fe46 100644 --- a/libs/s25main/nodeObjs/noMovable.cpp +++ b/libs/s25main/nodeObjs/noMovable.cpp @@ -23,36 +23,36 @@ void noMovable::Serialize(SerializedGameData& sgd) const { noCoordBase::Serialize(sgd); - sgd.PushEnum(curMoveDir); + sgd.pushEnum(curMoveDir); sgd.PushUnsignedChar(ascent); - sgd.PushEvent(current_ev); + sgd.pushEvent(current_ev); sgd.PushUnsignedInt(pauseEv.elapsed); sgd.PushUnsignedInt(pauseEv.length); sgd.PushBool(moving); } noMovable::noMovable(SerializedGameData& sgd, const unsigned obj_id) - : noCoordBase(sgd, obj_id), curMoveDir(sgd.Pop()), ascent(sgd.PopUnsignedChar()) + : noCoordBase(sgd, obj_id), curMoveDir(sgd.pop()), ascent(sgd.PopUnsignedChar()) { - current_ev = sgd.PopEvent(); + current_ev = sgd.popEvent(); pauseEv = EventState(sgd); moving = sgd.PopBool(); } -void noMovable::Walk() +void noMovable::walk() { moving = false; const MapPoint oldPos = pos; pos = world->getNeighbour(pos, curMoveDir); - world->AddFigure(pos, world->RemoveFigure(oldPos, *this)); + world->addFigure(pos, world->RemoveFigure(oldPos, *this)); } -void noMovable::FaceDir(Direction newDir) +void noMovable::faceDir(Direction newDir) { curMoveDir = newDir; } -void noMovable::StartMoving(const Direction dir, unsigned gf_length) +void noMovable::startMoving(const Direction dir, unsigned gf_length) { RTTR_Assert(!moving); @@ -64,7 +64,7 @@ void noMovable::StartMoving(const Direction dir, unsigned gf_length) // Avoid setting an event for current gf by increasing the length if(pauseEv.length == pauseEv.elapsed) pauseEv.length++; - current_ev = getEvMgr().AddEvent(this, pauseEv.length, 0, pauseEv.elapsed); + current_ev = getEvMgr().addEvent(this, pauseEv.length, 0, pauseEv.elapsed); pauseEv = EventState(); moving = true; return; @@ -96,12 +96,12 @@ void noMovable::StartMoving(const Direction dir, unsigned gf_length) case -5: ascent = 0; break; // steil runter } - current_ev = getEvMgr().AddEvent(this, gf_length); + current_ev = getEvMgr().addEvent(this, gf_length); this->curMoveDir = dir; moving = true; } -DrawPoint noMovable::CalcRelative(DrawPoint curPt, DrawPoint nextPt) const +DrawPoint noMovable::calcRelative(DrawPoint curPt, DrawPoint nextPt) const { if(current_ev) { @@ -166,21 +166,21 @@ DrawPoint noMovable::CalcRelative(DrawPoint curPt, DrawPoint nextPt) const } /// Interpoliert fürs Laufen zwischen zwei Kartenpunkten -DrawPoint noMovable::CalcWalkingRelative() const +DrawPoint noMovable::calcWalkingRelative() const { Position curPt = world->getNodePos(pos); Position nextPt = world->getNodePos(world->getNeighbour(pos, curMoveDir)); - return CalcRelative(curPt, nextPt); + return calcRelative(curPt, nextPt); } -void noMovable::PauseWalking() +void noMovable::pauseWalking() { RTTR_Assert(isMoving()); // Frames festhalten, bis zu denen wir gekommen sind pauseEv = EventState(getEvMgr().getCurrentGF() - current_ev->startGF, current_ev->length); // Event abmelden - getEvMgr().RemoveEvent(current_ev); + getEvMgr().removeEvent(current_ev); moving = false; } diff --git a/libs/s25main/nodeObjs/noMovable.h b/libs/s25main/nodeObjs/noMovable.h index c5ceefb99b..b3bd2e1043 100644 --- a/libs/s25main/nodeObjs/noMovable.h +++ b/libs/s25main/nodeObjs/noMovable.h @@ -36,7 +36,7 @@ class noMovable : public noCoordBase protected: const GameEvent* current_ev; /// Pausiert ein gerade laufendes Wesen - void PauseWalking(); + void pauseWalking(); public: noMovable(NodalObjectType nop, MapPoint pos); @@ -52,15 +52,15 @@ class noMovable : public noCoordBase uint8_t getAscent() const { return ascent; } const EventState& getPausedEvent() { return pauseEv; } /// "Turns" the object in that direction without starting to walk - void FaceDir(Direction newDir); + void faceDir(Direction newDir); /// In aktueller Richtung ein Stück zurücklegen - void Walk(); + void walk(); // Starten zu Laufen, Event anmelden - void StartMoving(Direction dir, unsigned gf_length); + void startMoving(Direction dir, unsigned gf_length); // Interpoliert die Position zwischen zwei Knoten punkten - DrawPoint CalcRelative(DrawPoint curPt, DrawPoint nextPt) const; + DrawPoint calcRelative(DrawPoint curPt, DrawPoint nextPt) const; /// Interpoliert fürs Laufen zwischen zwei Kartenpunkten - DrawPoint CalcWalkingRelative() const; + DrawPoint calcWalkingRelative() const; // Steht er in der zwischen 2 Wegpunkten? bool isStoppedBetweenNodes() const { return pauseEv.elapsed > 0; } /// Gibt die Position zurück, wo wir uns hinbewegen (selbe Position, wenn Schiff steht) diff --git a/libs/s25main/nodeObjs/noNothing.h b/libs/s25main/nodeObjs/noNothing.h index dfc3188799..6c5497469c 100644 --- a/libs/s25main/nodeObjs/noNothing.h +++ b/libs/s25main/nodeObjs/noNothing.h @@ -11,7 +11,7 @@ class noNothing final : public noBase public: noNothing() : noBase(NodalObjectType::Nothing) {} - void Destroy() override {} + void destroy() override {} GO_Type getGOT() const final { return GO_Type::Nothing; } - void Draw(DrawPoint) override {} + void draw(DrawPoint) override {} }; diff --git a/libs/s25main/nodeObjs/noRoadNode.cpp b/libs/s25main/nodeObjs/noRoadNode.cpp index 88eb423b50..c52c0187a5 100644 --- a/libs/s25main/nodeObjs/noRoadNode.cpp +++ b/libs/s25main/nodeObjs/noRoadNode.cpp @@ -18,10 +18,10 @@ noRoadNode::noRoadNode(const NodalObjectType nop, const MapPoint pos, const unsi noRoadNode::~noRoadNode() = default; -void noRoadNode::Destroy() +void noRoadNode::destroy() { - DestroyAllRoads(); - noCoordBase::Destroy(); + destroyAllRoads(); + noCoordBase::destroy(); } void noRoadNode::Serialize(SerializedGameData& sgd) const @@ -37,11 +37,11 @@ void noRoadNode::Serialize(SerializedGameData& sgd) const // -> initialize routes for flag with nullptr // -> RoadSegment will set these later for([[maybe_unused]] const auto i : helpers::EnumRange{}) - sgd.PushObject(static_cast(nullptr), true); + sgd.pushObject(static_cast(nullptr), true); } else { for(const auto dir : helpers::EnumRange{}) - sgd.PushObject(routes[dir], true); + sgd.pushObject(routes[dir], true); } } @@ -50,7 +50,7 @@ noRoadNode::noRoadNode(SerializedGameData& sgd, const unsigned obj_id) { for(const auto dir : helpers::EnumRange{}) { - routes[dir] = sgd.PopObject(GO_Type::Roadsegment); + routes[dir] = sgd.popObject(GO_Type::Roadsegment); } last_visit = 0; @@ -59,7 +59,7 @@ noRoadNode::noRoadNode(SerializedGameData& sgd, const unsigned obj_id) void noRoadNode::UpgradeRoad(const Direction dir) const { if(getRoute(dir)) - getRoute(dir)->UpgradeDonkeyRoad(); + getRoute(dir)->upgradeDonkeyRoad(); } void noRoadNode::DestroyRoad(const Direction dir) @@ -71,7 +71,7 @@ void noRoadNode::DestroyRoad(const Direction dir) for(unsigned z = 0; z < route->GetLength(); ++z) { world->setPointRoad(t, route->getRoute(z), PointRoad::None); - world->RecalcBQForRoad(t); + world->recalcBQForRoad(t); t = world->getNeighbour(t, route->getRoute(z)); } @@ -93,15 +93,15 @@ void noRoadNode::DestroyRoad(const Direction dir) setRoute(dir, nullptr); - route->Destroy(); + route->destroy(); delete route; // Spieler Bescheid sagen - world->getPlayer(player).RoadDestroyed(); + world->getPlayer(player).roadDestroyed(); } /// Vernichtet Alle Straße um diesen Knoten -void noRoadNode::DestroyAllRoads() +void noRoadNode::destroyAllRoads() { // Alle Straßen um mich herum zerstören for(const auto dir : helpers::EnumRange{}) diff --git a/libs/s25main/nodeObjs/noRoadNode.h b/libs/s25main/nodeObjs/noRoadNode.h index 3308d6e6e0..5cc3988d95 100644 --- a/libs/s25main/nodeObjs/noRoadNode.h +++ b/libs/s25main/nodeObjs/noRoadNode.h @@ -40,7 +40,7 @@ class noRoadNode : public noCoordBase noRoadNode(const noRoadNode&) = delete; ~noRoadNode() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; RoadSegment* getRoute(const Direction dir) const { return routes[dir]; } @@ -51,12 +51,12 @@ class noRoadNode : public noCoordBase void DestroyRoad(Direction dir); void UpgradeRoad(Direction dir) const; /// Vernichtet Alle Straße um diesen Knoten - void DestroyAllRoads(); + void destroyAllRoads(); unsigned char getPlayer() const { return player; } /// Legt eine Ware am Objekt ab (an allen Straßenknoten (Gebäude, Baustellen und Flaggen) kann man Waren ablegen - virtual void AddWare(std::unique_ptr ware) = 0; + virtual void addWare(std::unique_ptr ware) = 0; /// Nur für Flagge, Gebäude können 0 zurückgeben, gibt Wegstrafpunkte für das Pathfinden für Waren, die in eine /// bestimmte Richtung noch transportiert werden müssen diff --git a/libs/s25main/nodeObjs/noShip.cpp b/libs/s25main/nodeObjs/noShip.cpp index 5f6b4d2761..02c96f482d 100644 --- a/libs/s25main/nodeObjs/noShip.cpp +++ b/libs/s25main/nodeObjs/noShip.cpp @@ -71,7 +71,7 @@ void noShip::Serialize(SerializedGameData& sgd) const noMovable::Serialize(sgd); sgd.PushUnsignedChar(ownerId_); - sgd.PushEnum(state); + sgd.pushEnum(state); sgd.PushUnsignedShort(seaId_.value()); sgd.PushUnsignedInt(goalHarbor.value()); sgd.PushUnsignedChar(goal_dir); @@ -82,12 +82,12 @@ void noShip::Serialize(SerializedGameData& sgd) const sgd.PushUnsignedInt(homeHarbor.value()); sgd.PushUnsignedInt(covered_distance); helpers::pushContainer(sgd, route_); - sgd.PushObjectContainer(figures); - sgd.PushObjectContainer(wares, true); + sgd.pushObjectContainer(figures); + sgd.pushObjectContainer(wares, true); } noShip::noShip(SerializedGameData& sgd, const unsigned obj_id) - : noMovable(sgd, obj_id), ownerId_(sgd.PopUnsignedChar()), state(sgd.Pop()), seaId_(sgd.PopUnsignedShort()), + : noMovable(sgd, obj_id), ownerId_(sgd.PopUnsignedChar()), state(sgd.pop()), seaId_(sgd.PopUnsignedShort()), goalHarbor(sgd.PopUnsignedInt()), goal_dir(sgd.PopUnsignedChar()), name(sgd.getGameDataVersion() < 2 ? sgd.PopLongString() : sgd.PopString()), curRouteIdx(sgd.PopUnsignedInt()), route_(sgd.getGameDataVersion() < 7 ? sgd.PopUnsignedInt() : 0), lost(sgd.PopBool()), @@ -95,27 +95,27 @@ noShip::noShip(SerializedGameData& sgd, const unsigned obj_id) covered_distance(sgd.PopUnsignedInt()) { helpers::popContainer(sgd, route_, sgd.getGameDataVersion() < 7); - sgd.PopObjectContainer(figures); - sgd.PopObjectContainer(wares, GO_Type::Ware); + sgd.popObjectContainer(figures); + sgd.popObjectContainer(wares, GO_Type::Ware); } -void noShip::Destroy() +void noShip::destroy() { RTTR_Assert(figures.empty()); RTTR_Assert(wares.empty()); world->getNotifications().publish(ShipNote(ShipNote::Destroyed, ownerId_, pos)); // Schiff wieder abmelden - world->getPlayer(ownerId_).RemoveShip(this); + world->getPlayer(ownerId_).removeShip(this); } -void noShip::Draw(DrawPoint drawPt) +void noShip::draw(DrawPoint drawPt) { unsigned flag_drawing_type = 1; // Sind wir verloren? Dann immer stehend zeichnen if(lost) { - DrawFixed(drawPt, true); + drawFixed(drawPt, true); return; } @@ -125,14 +125,14 @@ void noShip::Draw(DrawPoint drawPt) case State::Idle: case State::SeaattackWaiting: { - DrawFixed(drawPt, false); + drawFixed(drawPt, false); flag_drawing_type = 0; } break; case State::Gotoharbor: { - DrawDriving(drawPt); + drawDriving(drawPt); } break; case State::ExpeditionLoading: @@ -144,13 +144,13 @@ void noShip::Draw(DrawPoint drawPt) case State::ExplorationexpeditionLoading: case State::ExplorationexpeditionUnloading: { - DrawFixed(drawPt, false); + drawFixed(drawPt, false); } break; case State::ExplorationexpeditionWaiting: case State::ExpeditionWaiting: { - DrawFixed(drawPt, true); + drawFixed(drawPt, true); } break; case State::ExpeditionDriving: @@ -158,58 +158,58 @@ void noShip::Draw(DrawPoint drawPt) case State::SeaattackDrivingToDestination: case State::ExplorationexpeditionDriving: { - DrawDrivingWithWares(drawPt); + drawDrivingWithWares(drawPt); } break; case State::SeaattackReturnDriving: { if(!figures.empty() || !wares.empty()) - DrawDrivingWithWares(drawPt); + drawDrivingWithWares(drawPt); else - DrawDriving(drawPt); + drawDriving(drawPt); } break; } LOADER.getPlayerImage("boot_z", 40 + GAMECLIENT.getGlobalAnimation(6, 1, 1, getObjId())) - ->DrawFull(drawPt + SHIPS_FLAG_POS[flag_drawing_type][getCurMoveDir()], COLOR_WHITE, + ->drawFull(drawPt + SHIPS_FLAG_POS[flag_drawing_type][getCurMoveDir()], COLOR_WHITE, world->getPlayer(ownerId_).color); // Second, white flag, only when on expedition, always swinging in the opposite direction if(state >= State::ExpeditionLoading && state <= State::ExpeditionDriving) LOADER.getPlayerImage("boot_z", 40 + GAMECLIENT.getGlobalAnimation(6, 1, 1, getObjId() + 4)) - ->DrawFull(drawPt + SHIPS_FLAG_POS[flag_drawing_type][getCurMoveDir()]); + ->drawFull(drawPt + SHIPS_FLAG_POS[flag_drawing_type][getCurMoveDir()]); } /// Zeichnet das Schiff stehend mit oder ohne Waren -void noShip::DrawFixed(DrawPoint drawPt, const bool draw_wares) +void noShip::drawFixed(DrawPoint drawPt, const bool draw_wares) { - LOADER.getImageN("boot_z", rttr::enum_cast(getCurMoveDir() + 3u) * 2 + 1)->DrawFull(drawPt, COLOR_SHADOW); - LOADER.getImageN("boot_z", rttr::enum_cast(getCurMoveDir() + 3u) * 2)->DrawFull(drawPt); + LOADER.getImageN("boot_z", rttr::enum_cast(getCurMoveDir() + 3u) * 2 + 1)->drawFull(drawPt, COLOR_SHADOW); + LOADER.getImageN("boot_z", rttr::enum_cast(getCurMoveDir() + 3u) * 2)->drawFull(drawPt); if(draw_wares) /// Waren zeichnen - LOADER.getImageN("boot_z", 30 + rttr::enum_cast(getCurMoveDir() + 3u))->DrawFull(drawPt); + LOADER.getImageN("boot_z", 30 + rttr::enum_cast(getCurMoveDir() + 3u))->drawFull(drawPt); } /// Zeichnet normales Fahren auf dem Meer ohne irgendwelche Güter -void noShip::DrawDriving(DrawPoint& drawPt) +void noShip::drawDriving(DrawPoint& drawPt) { // Interpolieren zwischen beiden Knotenpunkten - drawPt += CalcWalkingRelative(); + drawPt += calcWalkingRelative(); - LOADER.getImageN("boot_z", 13 + rttr::enum_cast(getCurMoveDir() + 3u) * 2)->DrawFull(drawPt, COLOR_SHADOW); - LOADER.getImageN("boot_z", 12 + rttr::enum_cast(getCurMoveDir() + 3u) * 2)->DrawFull(drawPt); + LOADER.getImageN("boot_z", 13 + rttr::enum_cast(getCurMoveDir() + 3u) * 2)->drawFull(drawPt, COLOR_SHADOW); + LOADER.getImageN("boot_z", 12 + rttr::enum_cast(getCurMoveDir() + 3u) * 2)->drawFull(drawPt); } /// Zeichnet normales Fahren auf dem Meer mit Gütern -void noShip::DrawDrivingWithWares(DrawPoint& drawPt) +void noShip::drawDrivingWithWares(DrawPoint& drawPt) { - DrawDriving(drawPt); + drawDriving(drawPt); /// Waren zeichnen - LOADER.getImageN("boot_z", 30 + rttr::enum_cast(getCurMoveDir() + 3u))->DrawFull(drawPt); + LOADER.getImageN("boot_z", 30 + rttr::enum_cast(getCurMoveDir() + 3u))->drawFull(drawPt); } -void noShip::HandleEvent(const unsigned id) +void noShip::handleEvent(const unsigned id) { RTTR_Assert(current_ev); RTTR_Assert(current_ev->id == id); @@ -219,9 +219,9 @@ void noShip::HandleEvent(const unsigned id) { // Move event // neue Position einnehmen - Walk(); + walk(); // entscheiden, was als nächstes zu tun ist - Driven(); + driven(); } else { switch(state) @@ -235,7 +235,7 @@ void noShip::HandleEvent(const unsigned id) state = State::ExpeditionWaiting; // Spieler benachrichtigen - SendPostMessage(ownerId_, std::make_unique(getEvMgr().getCurrentGF(), + sendPostMessage(ownerId_, std::make_unique(getEvMgr().getCurrentGF(), _("A ship is ready for an expedition."), PostCategory::Economy, *this)); world->getNotifications().publish(ExpeditionNote(ExpeditionNote::Waiting, ownerId_, pos)); @@ -243,7 +243,7 @@ void noShip::HandleEvent(const unsigned id) case State::ExplorationexpeditionLoading: case State::ExplorationexpeditionWaiting: // Schiff ist nun bereit und Expedition kann beginnen - ContinueExplorationExpedition(); + continueExplorationExpedition(); break; case State::ExpeditionUnloading: { @@ -256,9 +256,9 @@ void noShip::HandleEvent(const unsigned id) goods.goods[GoodType::Boards] = BUILDING_COSTS[BuildingType::HarborBuilding].boards; goods.goods[GoodType::Stones] = BUILDING_COSTS[BuildingType::HarborBuilding].stones; goods.people[Job::Builder] = 1; - static_cast(hb)->AddToInventory(goods, false); + static_cast(hb)->addToInventory(goods, false); // Wieder idlen und ggf. neuen Job suchen - StartIdling(); + startIdling(); world->getPlayer(ownerId_).getJobForShip(*this); } else { @@ -279,9 +279,9 @@ void noShip::HandleEvent(const unsigned id) { // Späher wieder entladen const auto people = PeopleCounts::make(Job::Scout, world->getGGS().getNumScoutsExpedition()); - static_cast(hb)->AddToInventory(people, false); + static_cast(hb)->addToInventory(people, false); // Wieder idlen und ggf. neuen Job suchen - StartIdling(); + startIdling(); world->getPlayer(ownerId_).getJobForShip(*this); } else { @@ -291,11 +291,11 @@ void noShip::HandleEvent(const unsigned id) } // Sichtbarkeiten neu berechnen - world->RecalcVisibilitiesAroundPoint(pos, old_visual_range, ownerId_, nullptr); + world->recalcVisibilitiesAroundPoint(pos, old_visual_range, ownerId_, nullptr); break; } - case State::TransportLoading: StartTransport(); break; + case State::TransportLoading: startTransport(); break; case State::TransportUnloading: case State::SeaattackUnloading: { @@ -304,32 +304,32 @@ void noShip::HandleEvent(const unsigned id) noBase* hb = goalHarbor ? world->getNO(world->getHarborPoint(goalHarbor)) : nullptr; if(hb && hb->getGOT() == GO_Type::NobHarborbuilding) { - static_cast(hb)->ReceiveGoodsFromShip(figures, wares); + static_cast(hb)->receiveGoodsFromShip(figures, wares); figures.clear(); wares.clear(); state = State::TransportUnloading; // Hafen bescheid sagen, dass er das Schiff nun nutzen kann - static_cast(hb)->ShipArrived(*this); + static_cast(hb)->shipArrived(*this); // Hafen hat keinen Job für uns? if(state == State::TransportUnloading) { // Wieder idlen und ggf. neuen Job suchen - StartIdling(); + startIdling(); world->getPlayer(ownerId_).getJobForShip(*this); } } else { // target harbor for unloading doesnt exist anymore -> set state to driving and handle the new state if(state == State::TransportUnloading) - FindUnloadGoal(State::TransportDriving); + findUnloadGoal(State::TransportDriving); else - FindUnloadGoal(State::SeaattackReturnDriving); + findUnloadGoal(State::SeaattackReturnDriving); } break; } - case State::SeaattackLoading: StartSeaAttack(); break; + case State::SeaattackLoading: startSeaAttack(); break; case State::SeaattackWaiting: { // Nächsten Soldaten nach draußen beordern @@ -342,35 +342,35 @@ void noShip::HandleEvent(const unsigned id) if(static_cast(*figures.front()).isSeaAttackCompleted()) break; - auto& attacker = world->AddFigure(pos, std::move(figures.front())); + auto& attacker = world->addFigure(pos, std::move(figures.front())); figures.pop_front(); - current_ev = getEvMgr().AddEvent(this, 30, 1); - static_cast(attacker).StartAttackOnOtherIsland(pos, getObjId()); + current_ev = getEvMgr().addEvent(this, 30, 1); + static_cast(attacker).startAttackOnOtherIsland(pos, getObjId()); break; } } } } -void noShip::StartDriving(const Direction dir) +void noShip::startDriving(const Direction dir) { const std::array SHIP_SPEEDS = {35, 25, 20, 10, 5}; - StartMoving(dir, SHIP_SPEEDS[world->getGGS().getSelection(AddonId::SHIP_SPEED)]); + startMoving(dir, SHIP_SPEEDS[world->getGGS().getSelection(AddonId::SHIP_SPEED)]); } -void noShip::Driven() +void noShip::driven() { - MapPoint enemy_territory_discovered(MapPoint::Invalid()); - world->RecalcMovingVisibilities(pos, ownerId_, getVisualRange(), getCurMoveDir(), &enemy_territory_discovered); + MapPoint enemy_territory_discovered(MapPoint::invalid()); + world->recalcMovingVisibilities(pos, ownerId_, getVisualRange(), getCurMoveDir(), &enemy_territory_discovered); // Feindliches Territorium entdeckt? if(enemy_territory_discovered.isValid()) { // Send message if necessary - if(world->getPlayer(ownerId_).ShipDiscoveredHostileTerritory(enemy_territory_discovered)) - SendPostMessage(ownerId_, std::make_unique(getEvMgr().getCurrentGF(), + if(world->getPlayer(ownerId_).shipDiscoveredHostileTerritory(enemy_territory_discovered)) + sendPostMessage(ownerId_, std::make_unique(getEvMgr().getCurrentGF(), _("A ship disovered an enemy territory"), PostCategory::Military, enemy_territory_discovered)); } @@ -415,7 +415,7 @@ unsigned noShip::getVisualRange() const } /// Fährt zum Hafen, um dort eine Mission (Expedition) zu erledigen -void noShip::GoToHarbor(const nobHarborBuilding& hb, const std::vector& route) +void noShip::goToHarbor(const nobHarborBuilding& hb, const std::vector& route) { RTTR_Assert(state == State::Idle); // otherwise we might carry wares etc RTTR_Assert(figures.empty()); @@ -432,15 +432,15 @@ void noShip::GoToHarbor(const nobHarborBuilding& hb, const std::vectorgetCoastalPoint(homeHarborId, seaId_)); homeHarbor = homeHarborId; @@ -448,22 +448,22 @@ void noShip::StartExpedition(HarborId homeHarborId) } /// Startet eine Erkundungs-Expedition -void noShip::StartExplorationExpedition(HarborId homeHarborId) +void noShip::startExplorationExpedition(HarborId homeHarborId) { /// Schiff wird "beladen", also kurze Zeit am Hafen stehen, bevor wir bereit sind state = State::ExplorationexpeditionLoading; - current_ev = getEvMgr().AddEvent(this, LOADING_TIME, 1); + current_ev = getEvMgr().addEvent(this, LOADING_TIME, 1); covered_distance = 0; RTTR_Assert(homeHarborId); RTTR_Assert(pos == world->getCoastalPoint(homeHarborId, seaId_)); homeHarbor = homeHarborId; goalHarbor = homeHarborId; // This is current goal (commands are relative to current goal) // Sichtbarkeiten neu berechnen - world->MakeVisibleAroundPoint(pos, getVisualRange(), ownerId_); + world->makeVisibleAroundPoint(pos, getVisualRange(), ownerId_); } /// Fährt weiter zu einem Hafen -noShip::Result noShip::DriveToHarbour() +noShip::Result noShip::driveToHarbour() { if(!goalHarbor) return Result::HarborDoesntExist; @@ -473,11 +473,11 @@ noShip::Result noShip::DriveToHarbour() if(world->getGOT(goal) != GO_Type::NobHarborbuilding) return Result::HarborDoesntExist; - return DriveToHarbourPlace(); + return driveToHarbourPlace(); } /// Fährt weiter zu Hafenbauplatz -noShip::Result noShip::DriveToHarbourPlace() +noShip::Result noShip::driveToHarbourPlace() { if(!goalHarbor) return Result::HarborDoesntExist; @@ -489,10 +489,10 @@ noShip::Result noShip::DriveToHarbourPlace() MapPoint goalRoutePos; // Route überprüfen - if(!world->CheckShipRoute(pos, route_, curRouteIdx, &goalRoutePos)) + if(!world->checkShipRoute(pos, route_, curRouteIdx, &goalRoutePos)) { // Route kann nicht mehr passiert werden --> neue Route suchen - if(!world->FindShipPathToHarbor(pos, goalHarbor, seaId_, &route_, nullptr)) + if(!world->findShipPathToHarbor(pos, goalHarbor, seaId_, &route_, nullptr)) { // Wieder keine gefunden -> raus return Result::NoRouteFound; @@ -507,7 +507,7 @@ noShip::Result noShip::DriveToHarbourPlace() RTTR_Assert(route_.size() >= curRouteIdx); if(route_.size() - curRouteIdx < 10) { - if(!world->FindShipPathToHarbor(pos, goalHarbor, seaId_, &route_, nullptr)) + if(!world->findShipPathToHarbor(pos, goalHarbor, seaId_, &route_, nullptr)) // Keiner gefunden -> raus return Result::NoRouteFound; @@ -516,7 +516,7 @@ noShip::Result noShip::DriveToHarbourPlace() } RTTR_Assert(curRouteIdx < route_.size()); - StartDriving(route_[curRouteIdx++]); + startDriving(route_[curRouteIdx++]); return Result::Driving; } @@ -537,7 +537,7 @@ HarborId noShip::getHomeHarbor() const } /// Weist das Schiff an, in einer bestimmten Richtung die Expedition fortzusetzen -void noShip::ContinueExpedition(const ShipDirection dir) +void noShip::continueExpedition(const ShipDirection dir) { if(state != State::ExpeditionWaiting) return; @@ -550,7 +550,7 @@ void noShip::ContinueExpedition(const ShipDirection dir) return; // Versuchen, Weg zu finden - if(!world->FindShipPathToHarbor(pos, new_goal, seaId_, &route_, nullptr)) + if(!world->findShipPathToHarbor(pos, new_goal, seaId_, &route_, nullptr)) return; // Dann fahren wir da mal hin @@ -584,24 +584,24 @@ void noShip::CancelExpedition() { state = State::ExpeditionDriving; goalHarbor = homeHarbor; - StartDrivingToHarborPlace(); + startDrivingToHarborPlace(); handleStateExpeditionDriving(); } } /// Weist das Schiff an, an der aktuellen Position einen Hafen zu gründen -void noShip::FoundColony() +void noShip::foundColony() { if(state != State::ExpeditionWaiting) return; // Kolonie gründen - if(world->FoundColony(goalHarbor, ownerId_, seaId_)) + if(world->foundColony(goalHarbor, ownerId_, seaId_)) { // For checks state = State::ExpeditionUnloading; // Dann idlen wir wieder - StartIdling(); + startIdling(); // Neue Arbeit suchen world->getPlayer(ownerId_).getJobForShip(*this); } else // colony founding FAILED @@ -613,11 +613,11 @@ void noShip::handleStateGoToHarbor() // Hafen schon zerstört? if(!goalHarbor) { - StartIdling(); + startIdling(); return; } - Result res = DriveToHarbour(); + Result res = driveToHarbour(); switch(res) { case Result::Driving: return; // Continue @@ -625,11 +625,11 @@ void noShip::handleStateGoToHarbor() { const MapPoint goal = world->getHarborPoint(goalHarbor); // Go idle here (if harbor does not need it) - StartIdling(); + startIdling(); // Hafen Bescheid sagen, dass wir da sind (falls er überhaupt noch existiert) noBase* hb = goal.isValid() ? world->getNO(goal) : nullptr; if(hb && hb->getGOT() == GO_Type::NobHarborbuilding) - static_cast(hb)->ShipArrived(*this); + static_cast(hb)->shipArrived(*this); } break; case Result::NoRouteFound: @@ -637,11 +637,11 @@ void noShip::handleStateGoToHarbor() MapPoint goal(world->getHarborPoint(goalHarbor)); RTTR_Assert(goal.isValid()); // Dem Hafen Bescheid sagen - world->getSpecObj(goal)->ShipLost(this); - StartIdling(); + world->getSpecObj(goal)->shipLost(this); + startIdling(); } break; - case Result::HarborDoesntExist: StartIdling(); break; + case Result::HarborDoesntExist: startIdling(); break; } } @@ -650,9 +650,9 @@ void noShip::handleStateExpeditionDriving() Result res; // Zum Heimathafen fahren? if(homeHarbor == goalHarbor) - res = DriveToHarbour(); + res = driveToHarbour(); else - res = DriveToHarbourPlace(); + res = driveToHarbourPlace(); switch(res) { @@ -664,14 +664,14 @@ void noShip::handleStateExpeditionDriving() { // Sachen wieder in den Hafen verladen state = State::ExpeditionUnloading; - current_ev = getEvMgr().AddEvent(this, UNLOADING_TIME, 1); + current_ev = getEvMgr().addEvent(this, UNLOADING_TIME, 1); } else { // Warten auf weitere Anweisungen state = State::ExpeditionWaiting; // Spieler benachrichtigen - SendPostMessage( + sendPostMessage( ownerId_, std::make_unique(getEvMgr().getCurrentGF(), _("A ship has reached the destination of its expedition."), PostCategory::Economy, *this)); @@ -689,7 +689,7 @@ void noShip::handleStateExpeditionDriving() goalHarbor = homeHarbor; handleStateExpeditionDriving(); } else - FindUnloadGoal(State::ExpeditionDriving); // Unload anywhere! + findUnloadGoal(State::ExpeditionDriving); // Unload anywhere! } break; } @@ -700,9 +700,9 @@ void noShip::handleStateExplorationExpeditionDriving() Result res; // Zum Heimathafen fahren? if(homeHarbor == goalHarbor) - res = DriveToHarbour(); + res = driveToHarbour(); else - res = DriveToHarbourPlace(); + res = driveToHarbourPlace(); switch(res) { @@ -714,7 +714,7 @@ void noShip::handleStateExplorationExpeditionDriving() { // Dann sind wir fertig -> wieder entladen state = State::ExplorationexpeditionUnloading; - current_ev = getEvMgr().AddEvent(this, UNLOADING_TIME, 1); + current_ev = getEvMgr().addEvent(this, UNLOADING_TIME, 1); } else { // Strecke, die wir gefahren sind, draufaddieren @@ -722,7 +722,7 @@ void noShip::handleStateExplorationExpeditionDriving() // Erstmal kurz ausruhen an diesem Punkt und das Rohr ausfahren, um ein bisschen // auf der Insel zu gucken state = State::ExplorationexpeditionWaiting; - current_ev = getEvMgr().AddEvent(this, EXPLORATION_EXPEDITION_WAITING_TIME, 1); + current_ev = getEvMgr().addEvent(this, EXPLORATION_EXPEDITION_WAITING_TIME, 1); } } break; @@ -734,14 +734,14 @@ void noShip::handleStateExplorationExpeditionDriving() goalHarbor = homeHarbor; handleStateExplorationExpeditionDriving(); } else - FindUnloadGoal(State::ExplorationexpeditionDriving); // Unload anywhere! + findUnloadGoal(State::ExplorationexpeditionDriving); // Unload anywhere! break; } } void noShip::handleStateTransportDriving() { - Result res = DriveToHarbour(); + Result res = driveToHarbour(); switch(res) { case Result::Driving: return; @@ -749,7 +749,7 @@ void noShip::handleStateTransportDriving() { // Waren abladen, dafür wieder kurze Zeit hier ankern state = State::TransportUnloading; - current_ev = getEvMgr().AddEvent(this, UNLOADING_TIME, 1); + current_ev = getEvMgr().addEvent(this, UNLOADING_TIME, 1); } break; case Result::NoRouteFound: @@ -763,16 +763,16 @@ void noShip::handleStateTransportDriving() // LOG.write(("transport goal harbor doesnt exist player %i state %i pos %u,%u \n",player,state,x,y); for(auto& figure : figures) { - figure->Abrogate(); + figure->abrogate(); figure->setGoalTonullptr(); } for(auto& ware : wares) { - ware->NotifyGoalAboutLostWare(); + ware->notifyGoalAboutLostWare(); } - FindUnloadGoal(State::TransportDriving); + findUnloadGoal(State::TransportDriving); } break; } @@ -780,37 +780,37 @@ void noShip::handleStateTransportDriving() void noShip::handleStateSeaAttackDriving() { - Result res = DriveToHarbourPlace(); + Result res = driveToHarbourPlace(); switch(res) { case Result::Driving: return; // OK case Result::GoalReached: // Ziel erreicht, dann stellen wir das Schiff hier hin und die Soldaten laufen nacheinander raus zum Ziel state = State::SeaattackWaiting; - current_ev = getEvMgr().AddEvent(this, 15, 1); + current_ev = getEvMgr().addEvent(this, 15, 1); remaining_sea_attackers = figures.size(); break; case Result::NoRouteFound: case Result::HarborDoesntExist: RTTR_Assert(goalHarbor != homeHarbor || !homeHarbor); - AbortSeaAttack(); + abortSeaAttack(); break; } } void noShip::handleStateSeaAttackReturn() { - Result res = DriveToHarbour(); + Result res = driveToHarbour(); switch(res) { case Result::Driving: return; case Result::GoalReached: // Entladen state = State::SeaattackUnloading; - this->current_ev = getEvMgr().AddEvent(this, UNLOADING_TIME, 1); + this->current_ev = getEvMgr().addEvent(this, UNLOADING_TIME, 1); break; case Result::HarborDoesntExist: - case Result::NoRouteFound: AbortSeaAttack(); break; + case Result::NoRouteFound: abortSeaAttack(); break; } } @@ -863,7 +863,7 @@ bool noShip::isGoingToHarbor(const nobHarborBuilding& hb) const } /// Belädt das Schiff mit Waren und Figuren, um eine Transportfahrt zu starten -void noShip::PrepareTransport(HarborId homeHarborId, MapPoint goal, std::list> figures, +void noShip::prepareTransport(HarborId homeHarborId, MapPoint goal, std::list> figures, std::list> wares) { RTTR_Assert(homeHarborId); @@ -878,11 +878,11 @@ void noShip::PrepareTransport(HarborId homeHarborId, MapPoint goal, std::listwares = std::move(wares); state = State::TransportLoading; - current_ev = getEvMgr().AddEvent(this, LOADING_TIME, 1); + current_ev = getEvMgr().addEvent(this, LOADING_TIME, 1); } /// Belädt das Schiff mit Schiffs-Angreifern -void noShip::PrepareSeaAttack(HarborId homeHarborId, MapPoint goal, std::vector> attackers) +void noShip::prepareSeaAttack(HarborId homeHarborId, MapPoint goal, std::vector> attackers) { // Heimathafen merken RTTR_Assert(homeHarborId); @@ -893,23 +893,23 @@ void noShip::PrepareSeaAttack(HarborId homeHarborId, MapPoint goal, std::vector< figures.clear(); for(auto& attacker : attackers) { - attacker->StartShipJourney(); - attacker->SeaAttackStarted(); + attacker->startShipJourney(); + attacker->seaAttackStarted(); figures.push_back(std::move(attacker)); } state = State::SeaattackLoading; - current_ev = getEvMgr().AddEvent(this, LOADING_TIME, 1); + current_ev = getEvMgr().addEvent(this, LOADING_TIME, 1); } /// Startet Schiffs-Angreiff -void noShip::StartSeaAttack() +void noShip::startSeaAttack() { state = State::SeaattackDrivingToDestination; - StartDrivingToHarborPlace(); + startDrivingToHarborPlace(); handleStateSeaAttackDriving(); } -void noShip::AbortSeaAttack() +void noShip::abortSeaAttack() { RTTR_Assert(state != State::SeaattackWaiting); // figures are not aboard if this fails! RTTR_Assert(remaining_sea_attackers == 0); // Some soldiers are still not aboard @@ -921,7 +921,7 @@ void noShip::AbortSeaAttack() // -> tell the soldiers we go back (like after an attack) goalHarbor = homeHarbor; for(auto& figure : figures) - checkedCast(figure.get())->StartReturnViaShip(*this); + checkedCast(figure.get())->startReturnViaShip(*this); if(state == State::SeaattackLoading) { // We are still loading (loading event must be active) @@ -945,15 +945,15 @@ void noShip::AbortSeaAttack() { // Abort loading RTTR_Assert(current_ev); - getEvMgr().RemoveEvent(current_ev); + getEvMgr().removeEvent(current_ev); } // Das Schiff muss einen Notlandeplatz ansteuern - FindUnloadGoal(State::SeaattackReturnDriving); + findUnloadGoal(State::SeaattackReturnDriving); } } -void noShip::StartDrivingToHarborPlace() +void noShip::startDrivingToHarborPlace() { if(!goalHarbor) { @@ -974,7 +974,7 @@ void noShip::StartDrivingToHarborPlace() RTTR_Assert(!route_.empty()); } else { - if(!world->FindShipPathToHarbor(pos, goalHarbor, seaId_, &route_, nullptr)) + if(!world->findShipPathToHarbor(pos, goalHarbor, seaId_, &route_, nullptr)) { // todo RTTR_Assert(false); @@ -995,21 +995,21 @@ void noShip::StartDrivingToHarborPlace() } /// Startet die eigentliche Transportaktion, nachdem das Schiff beladen wurde -void noShip::StartTransport() +void noShip::startTransport() { state = State::TransportDriving; - StartDrivingToHarborPlace(); + startDrivingToHarborPlace(); // Einfach weiterfahren handleStateTransportDriving(); } -void noShip::FindUnloadGoal(State newState) +void noShip::findUnloadGoal(State newState) { state = newState; // Das Schiff muss einen Notlandeplatz ansteuern // Neuen Hafen suchen - if(world->getPlayer(ownerId_).FindHarborForUnloading(this, pos, &goalHarbor, &route_, nullptr)) + if(world->getPlayer(ownerId_).findHarborForUnloading(this, pos, &goalHarbor, &route_, nullptr)) { curRouteIdx = 0; homeHarbor = goalHarbor; // To allow unloading here @@ -1025,7 +1025,7 @@ void noShip::FindUnloadGoal(State newState) { RTTR_Assert(false); LOG.write("Bug detected: Invalid state for FindUnloadGoal"); - FindUnloadGoal(State::TransportDriving); + findUnloadGoal(State::TransportDriving); } } else { @@ -1038,7 +1038,7 @@ void noShip::FindUnloadGoal(State newState) } /// Sagt dem Schiff, das ein bestimmter Hafen zerstört wurde -void noShip::HarborDestroyed(nobHarborBuilding* hb) +void noShip::harborDestroyed(nobHarborBuilding* hb) { const HarborId destroyedHarborId = hb->getHarborPosID(); // Almost every case of a destroyed harbor is handled when the ships event fires (the handler detects the destroyed @@ -1065,21 +1065,21 @@ void noShip::HarborDestroyed(nobHarborBuilding* hb) // Tell wares and figures that they won't reach their goal for(auto& figure : figures) { - figure->Abrogate(); + figure->abrogate(); figure->setGoalTonullptr(); } for(auto& ware : wares) { // Notify goal only, if it is not the destroyed harbor. It already knows about that ;) if(ware->getGoal() != hb) - ware->NotifyGoalAboutLostWare(); + ware->notifyGoalAboutLostWare(); else ware->setGoal(nullptr); } break; case State::SeaattackLoading: // We could also just set the goal harbor id to 0 but this can reuse the event - AbortSeaAttack(); + abortSeaAttack(); break; case State::SeaattackUnloading: break; } @@ -1096,23 +1096,23 @@ void noShip::HarborDestroyed(nobHarborBuilding* hb) state = State::TransportUnloading; } else { - getEvMgr().RemoveEvent(current_ev); - FindUnloadGoal(State::TransportDriving); + getEvMgr().removeEvent(current_ev); + findUnloadGoal(State::TransportDriving); } } else if(oldState == State::TransportUnloading || oldState == State::SeaattackUnloading) { // Remove current unload event - getEvMgr().RemoveEvent(current_ev); + getEvMgr().removeEvent(current_ev); if(oldState == State::SeaattackUnloading) - AbortSeaAttack(); + abortSeaAttack(); else - FindUnloadGoal(State::TransportDriving); + findUnloadGoal(State::TransportDriving); } } /// Fängt an mit idlen und setzt nötigen Sachen auf nullptr -void noShip::StartIdling() +void noShip::startIdling() { // If those are not empty, then we are lost, not idling! RTTR_Assert(figures.empty()); @@ -1128,7 +1128,7 @@ void noShip::StartIdling() } /// Sagt Bescheid, dass ein Schiffsangreifer nicht mehr mit nach Hause fahren will -void noShip::SeaAttackerWishesNoReturn() +void noShip::seaAttackerWishesNoReturn() { RTTR_Assert(remaining_sea_attackers); RTTR_Assert(state == State::SeaattackWaiting); @@ -1138,36 +1138,36 @@ void noShip::SeaAttackerWishesNoReturn() if(remaining_sea_attackers == 0) { // Andere Events ggf. erstmal abmelden - getEvMgr().RemoveEvent(current_ev); + getEvMgr().removeEvent(current_ev); if(!figures.empty()) { // Go back home. Note: home_harbor can be 0 if it was destroyed, allow this and let the state handlers // handle that case later goalHarbor = homeHarbor; state = State::SeaattackReturnDriving; - StartDrivingToHarborPlace(); + startDrivingToHarborPlace(); handleStateSeaAttackReturn(); } else { // Wenn keine Soldaten mehr da sind können wir auch erstmal idlen - StartIdling(); + startIdling(); world->getPlayer(ownerId_).getJobForShip(*this); } } } /// Schiffs-Angreifer sind nach dem Angriff wieder zurückgekehrt -void noShip::AddReturnedAttacker(std::unique_ptr attacker) +void noShip::addReturnedAttacker(std::unique_ptr attacker) { RTTR_Assert(!helpers::containsPtr(figures, attacker.get())); figures.push_back(std::move(attacker)); // Nun brauchen wir quasi einen Angreifer weniger - SeaAttackerWishesNoReturn(); + seaAttackerWishesNoReturn(); } /// Weist das Schiff an, seine Erkundungs-Expedition fortzusetzen -void noShip::ContinueExplorationExpedition() +void noShip::continueExplorationExpedition() { // Sind wir schon über unserem Limit, also zu weit gefahren if(covered_distance >= MAX_EXPLORATION_EXPEDITION_DISTANCE) @@ -1191,13 +1191,13 @@ void noShip::ContinueExplorationExpedition() } } - StartDrivingToHarborPlace(); + startDrivingToHarborPlace(); state = State::ExplorationexpeditionDriving; handleStateExplorationExpeditionDriving(); } /// Sagt dem Schiff, dass ein neuer Hafen erbaut wurde -void noShip::NewHarborBuilt(nobHarborBuilding* hb) +void noShip::newHarborBuilt(nobHarborBuilding* hb) { if(!lost) return; @@ -1209,14 +1209,14 @@ void noShip::NewHarborBuilt(nobHarborBuilding* hb) homeHarbor = goalHarbor = hb->getHarborPosID(); lost = false; - StartDrivingToHarborPlace(); + startDrivingToHarborPlace(); switch(state) { case State::ExplorationexpeditionDriving: case State::ExpeditionDriving: case State::TransportDriving: - case State::SeaattackReturnDriving: Driven(); break; + case State::SeaattackReturnDriving: driven(); break; default: RTTR_Assert(false); // Das darf eigentlich nicht passieren LOG.write("Bug detected: Invalid state in NewHarborBuilt"); diff --git a/libs/s25main/nodeObjs/noShip.h b/libs/s25main/nodeObjs/noShip.h index 14e0e84a81..7660abd42f 100644 --- a/libs/s25main/nodeObjs/noShip.h +++ b/libs/s25main/nodeObjs/noShip.h @@ -79,9 +79,9 @@ class noShip : public noMovable private: /// entscheidet, was nach einem gefahrenen Abschnitt weiter zu tun ist - void Driven(); + void driven(); /// Fängt an zu fahren - void StartDriving(Direction dir); + void startDriving(Direction dir); void handleStateGoToHarbor(); void handleStateExpeditionDriving(); @@ -99,33 +99,33 @@ class noShip : public noMovable }; /// Fährt weiter zu einem Hafen - Result DriveToHarbour(); + Result driveToHarbour(); /// Fährt weiter zu Hafenbauplatz - Result DriveToHarbourPlace(); + Result driveToHarbourPlace(); /// Zeichnet das Schiff stehend mit oder ohne Waren - void DrawFixed(DrawPoint drawPt, bool draw_wares); + void drawFixed(DrawPoint drawPt, bool draw_wares); /// Zeichnet normales Fahren auf dem Meer ohne irgendwelche Güter - void DrawDriving(DrawPoint& drawPt); + void drawDriving(DrawPoint& drawPt); /// Zeichnet normales Fahren auf dem Meer mit Gütern - void DrawDrivingWithWares(DrawPoint& drawPt); + void drawDrivingWithWares(DrawPoint& drawPt); /// Startet die eigentliche Transportaktion, nachdem das Schiff beladen wurde - void StartTransport(); + void startTransport(); /// Startet Schiffs-Angreiff - void StartSeaAttack(); + void startSeaAttack(); /// Fängt an mit idlen und setzt nötigen Sachen auf nullptr - void StartIdling(); + void startIdling(); /// Fängt an zu einem Hafen zu fahren (berechnet Route usw.) - void StartDrivingToHarborPlace(); + void startDrivingToHarborPlace(); /// Looks for a harbour to unload the goods (e.g if old one was destroyed) - void FindUnloadGoal(State newState); + void findUnloadGoal(State newState); /// Aborts a sea attack (in case harbor was not found anymore) - void AbortSeaAttack(); + void abortSeaAttack(); public: noShip(MapPoint pos, unsigned char player); @@ -134,14 +134,14 @@ class noShip : public noMovable ~noShip() override; void Serialize(SerializedGameData& sgd) const override; - void Destroy() override; + void destroy() override; GO_Type getGOT() const final { return GO_Type::Ship; } // An x,y zeichnen - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; // Benachrichtigen, wenn neuer gf erreicht wurde - void HandleEvent(unsigned id) override; + void handleEvent(unsigned id) override; /// Gibt den Besitzer zurück unsigned char getPlayerId() const { return ownerId_; } @@ -190,38 +190,38 @@ class noShip : public noMovable HarborId getHomeHarbor() const; /// Fährt zum Hafen, um dort eine Mission (Expedition) zu erledigen - void GoToHarbor(const nobHarborBuilding& hb, const std::vector& route); + void goToHarbor(const nobHarborBuilding& hb, const std::vector& route); /// Startet eine Expedition - void StartExpedition(HarborId homeHarborId); + void startExpedition(HarborId homeHarborId); /// Startet eine Erkundungs-Expedition - void StartExplorationExpedition(HarborId homeHarborId); + void startExplorationExpedition(HarborId homeHarborId); /// Weist das Schiff an, in einer bestimmten Richtung die Expedition fortzusetzen - void ContinueExpedition(ShipDirection dir); + void continueExpedition(ShipDirection dir); /// Weist das Schiff an, eine Expedition abzubrechen (nur wenn es steht) und zum /// Hafen zurückzukehren void CancelExpedition(); /// Weist das Schiff an, seine Erkundungs-Expedition fortzusetzen - void ContinueExplorationExpedition(); + void continueExplorationExpedition(); /// Gibt zurück, ob das Schiff jetzt in der Lage wäre, eine Kolonie zu gründen bool isAbleToFoundColony() const; /// Weist das Schiff an, an der aktuellen Position einen Hafen zu gründen - void FoundColony(); + void foundColony(); /// Return true, if the ship is driving to this harbor as its final destination (free for new orders) bool isGoingToHarbor(const nobHarborBuilding& hb) const; /// Belädt das Schiff mit Waren und Figuren, um eine Transportfahrt zu starten - void PrepareTransport(HarborId homeHarborId, MapPoint goal, std::list> figures, + void prepareTransport(HarborId homeHarborId, MapPoint goal, std::list> figures, std::list> wares); /// Belädt das Schiff mit Schiffs-Angreifern - void PrepareSeaAttack(HarborId homeHarborId, MapPoint goal, std::vector> attackers); + void prepareSeaAttack(HarborId homeHarborId, MapPoint goal, std::vector> attackers); /// Sagt Bescheid, dass ein Schiffsangreifer nicht mehr mit nach Hause fahren will - void SeaAttackerWishesNoReturn(); + void seaAttackerWishesNoReturn(); /// Schiffs-Angreifer sind nach dem Angriff wieder zurückgekehrt - void AddReturnedAttacker(std::unique_ptr attacker); + void addReturnedAttacker(std::unique_ptr attacker); /// Sagt dem Schiff, das ein bestimmter Hafen zerstört wurde - void HarborDestroyed(nobHarborBuilding* hb); + void harborDestroyed(nobHarborBuilding* hb); /// Sagt dem Schiff, dass ein neuer Hafen erbaut wurde - void NewHarborBuilt(nobHarborBuilding* hb); + void newHarborBuilt(nobHarborBuilding* hb); }; diff --git a/libs/s25main/nodeObjs/noShipBuildingSite.cpp b/libs/s25main/nodeObjs/noShipBuildingSite.cpp index 53cbba98e1..f05f5339a8 100644 --- a/libs/s25main/nodeObjs/noShipBuildingSite.cpp +++ b/libs/s25main/nodeObjs/noShipBuildingSite.cpp @@ -20,12 +20,12 @@ noShipBuildingSite::noShipBuildingSite(const MapPoint pos, const unsigned char p noShipBuildingSite::~noShipBuildingSite() = default; -void noShipBuildingSite::Destroy() +void noShipBuildingSite::destroy() { if(world->getNode(pos).obj == this) world->setNO(pos, nullptr); - noCoordBase::Destroy(); + noCoordBase::destroy(); } void noShipBuildingSite::Serialize(SerializedGameData& sgd) const @@ -43,37 +43,37 @@ noShipBuildingSite::noShipBuildingSite(SerializedGameData& sgd, const unsigned o /// Progress-Anteile für die 3 Baustufen constexpr std::array PROGRESS_PARTS = {4, 2, 3}; -void noShipBuildingSite::Draw(DrawPoint drawPt) +void noShipBuildingSite::draw(DrawPoint drawPt) { if(progress < PROGRESS_PARTS[0] + PROGRESS_PARTS[1]) { glArchivItem_Bitmap* image = LOADER.getImageN("boot_z", 24); unsigned percentDone = (progress > PROGRESS_PARTS[0]) ? 100u : progress * 100 / PROGRESS_PARTS[0]; - image->DrawPercent(drawPt, percentDone); + image->drawPercent(drawPt, percentDone); image = LOADER.getImageN("boot_z", 25); - image->DrawPercent(drawPt, percentDone, COLOR_SHADOW); + image->drawPercent(drawPt, percentDone, COLOR_SHADOW); } if(progress > PROGRESS_PARTS[0]) { unsigned curProg = progress - PROGRESS_PARTS[0]; unsigned percentDone = (curProg > PROGRESS_PARTS[1]) ? 100u : curProg * 100 / PROGRESS_PARTS[1]; glArchivItem_Bitmap* image = LOADER.getImageN("boot_z", 26); - image->DrawPercent(drawPt, percentDone); + image->drawPercent(drawPt, percentDone); image = LOADER.getImageN("boot_z", 27); - image->DrawPercent(drawPt, percentDone, COLOR_SHADOW); + image->drawPercent(drawPt, percentDone, COLOR_SHADOW); } if(progress > PROGRESS_PARTS[0] + PROGRESS_PARTS[1]) { unsigned percentDone = (progress - PROGRESS_PARTS[0] - PROGRESS_PARTS[1]) * 100 / PROGRESS_PARTS[2]; glArchivItem_Bitmap* image = LOADER.getImageN("boot_z", 28); - image->DrawPercent(drawPt, percentDone); + image->drawPercent(drawPt, percentDone); image = LOADER.getImageN("boot_z", 29); - image->DrawPercent(drawPt, percentDone, COLOR_SHADOW); + image->drawPercent(drawPt, percentDone, COLOR_SHADOW); } } /// Das Schiff wird um eine Stufe weitergebaut -void noShipBuildingSite::MakeBuildStep() +void noShipBuildingSite::makeBuildStep() { ++progress; @@ -82,17 +82,17 @@ void noShipBuildingSite::MakeBuildStep() { // Replace me by ship world->setNO(pos, nullptr); - getEvMgr().AddToKillList(this); - auto& ship = world->AddFigure(pos, std::make_unique(pos, player)); + getEvMgr().addToKillList(this); + auto& ship = world->addFigure(pos, std::make_unique(pos, player)); // Schiff registrieren lassen - world->getPlayer(player).RegisterShip(ship); + world->getPlayer(player).registerShip(ship); // BQ neu berechnen, da Schiff nicht mehr blockiert - world->RecalcBQAroundPointBig(pos); + world->recalcBQAroundPointBig(pos); // Spieler über Fertigstellung benachrichtigen - SendPostMessage(player, std::make_unique(getEvMgr().getCurrentGF(), _("A new ship is ready"), + sendPostMessage(player, std::make_unique(getEvMgr().getCurrentGF(), _("A new ship is ready"), PostCategory::Economy, ship)); world->getNotifications().publish(ShipNote(ShipNote::Constructed, player, pos)); } diff --git a/libs/s25main/nodeObjs/noShipBuildingSite.h b/libs/s25main/nodeObjs/noShipBuildingSite.h index 58f0e07e97..9aeaecdaf0 100644 --- a/libs/s25main/nodeObjs/noShipBuildingSite.h +++ b/libs/s25main/nodeObjs/noShipBuildingSite.h @@ -14,7 +14,7 @@ class noShipBuildingSite : public noCoordBase noShipBuildingSite(MapPoint pos, unsigned char player); noShipBuildingSite(SerializedGameData& sgd, unsigned obj_id); ~noShipBuildingSite() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Shipbuildingsite; } @@ -22,12 +22,12 @@ class noShipBuildingSite : public noCoordBase unsigned char getPlayer() const { return player; } /// Das Schiff wird um eine Stufe weitergebaut - void MakeBuildStep(); + void makeBuildStep(); BlockingManner getBM() const override { return BlockingManner::Building; } protected: - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; private: /// Spieler, dem dieses Schiff gehört diff --git a/libs/s25main/nodeObjs/noSign.cpp b/libs/s25main/nodeObjs/noSign.cpp index b2555b29d6..b17d9629c2 100644 --- a/libs/s25main/nodeObjs/noSign.cpp +++ b/libs/s25main/nodeObjs/noSign.cpp @@ -34,7 +34,7 @@ noSign::noSign(SerializedGameData& sgd, const unsigned obj_id) : noDisappearingEnvObject(sgd, obj_id), resource(sgd.PopUnsignedChar()) {} -void noSign::Draw(DrawPoint drawPt) +void noSign::draw(DrawPoint drawPt) { // Schild selbst unsigned imgId; @@ -49,8 +49,8 @@ void noSign::Draw(DrawPoint drawPt) default: return; } imgId += std::min(resource.getAmount() / 3u, 2u); - LOADER.getMapTexture(imgId)->DrawFull(drawPt, getDrawColor()); + LOADER.getMapTexture(imgId)->drawFull(drawPt, getDrawColor()); // Schatten des Schildes - LOADER.getMapTexture(700)->DrawFull(drawPt, getDrawShadowColor()); + LOADER.getMapTexture(700)->drawFull(drawPt, getDrawShadowColor()); } diff --git a/libs/s25main/nodeObjs/noSign.h b/libs/s25main/nodeObjs/noSign.h index ac93a1bfdd..c182dc36ae 100644 --- a/libs/s25main/nodeObjs/noSign.h +++ b/libs/s25main/nodeObjs/noSign.h @@ -20,7 +20,7 @@ class noSign : public noDisappearingEnvObject GO_Type getGOT() const final { return GO_Type::Sign; } /// An x,y zeichnen. - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; /// Return the resources found, as drawn on the sign. Resource getResource() const { return resource; } diff --git a/libs/s25main/nodeObjs/noSkeleton.cpp b/libs/s25main/nodeObjs/noSkeleton.cpp index dac0a3b6d9..95fe870dcd 100644 --- a/libs/s25main/nodeObjs/noSkeleton.cpp +++ b/libs/s25main/nodeObjs/noSkeleton.cpp @@ -12,20 +12,20 @@ noSkeleton::noSkeleton(const MapPoint pos) : noCoordBase(NodalObjectType::Environment, pos), type(0) { - current_event = getEvMgr().AddEvent(this, 15000 + RANDOM_RAND(10000)); + current_event = getEvMgr().addEvent(this, 15000 + RANDOM_RAND(10000)); } noSkeleton::~noSkeleton() = default; -void noSkeleton::Destroy() +void noSkeleton::destroy() { // Remove from map if still present if(world->getNode(pos).obj == this) world->setNO(pos, nullptr); - getEvMgr().RemoveEvent(current_event); + getEvMgr().removeEvent(current_event); - noCoordBase::Destroy(); + noCoordBase::destroy(); } void noSkeleton::Serialize(SerializedGameData& sgd) const @@ -33,31 +33,31 @@ void noSkeleton::Serialize(SerializedGameData& sgd) const noCoordBase::Serialize(sgd); sgd.PushUnsignedChar(type); - sgd.PushEvent(current_event); + sgd.pushEvent(current_event); } noSkeleton::noSkeleton(SerializedGameData& sgd, const unsigned obj_id) - : noCoordBase(sgd, obj_id), type(sgd.PopUnsignedChar()), current_event(sgd.PopEvent()) + : noCoordBase(sgd, obj_id), type(sgd.PopUnsignedChar()), current_event(sgd.popEvent()) {} -void noSkeleton::Draw(DrawPoint drawPt) +void noSkeleton::draw(DrawPoint drawPt) { - LOADER.getMapTexture(547 + type)->DrawFull(drawPt); + LOADER.getMapTexture(547 + type)->drawFull(drawPt); } -void noSkeleton::HandleEvent(const unsigned /*id*/) +void noSkeleton::handleEvent(const unsigned /*id*/) { if(!type) { // weiter verwesen, dann später sterben nach ner zufälligen Zeit type = 1; - current_event = getEvMgr().AddEvent(this, 10000 + RANDOM_RAND(10000)); + current_event = getEvMgr().addEvent(this, 10000 + RANDOM_RAND(10000)); } else { // Remove from map and destroy RTTR_Assert(world->getNode(pos).obj == this); world->setNO(pos, nullptr); - getEvMgr().AddToKillList(this); + getEvMgr().addToKillList(this); current_event = nullptr; } } diff --git a/libs/s25main/nodeObjs/noSkeleton.h b/libs/s25main/nodeObjs/noSkeleton.h index ab2adf90a4..35c63d8af5 100644 --- a/libs/s25main/nodeObjs/noSkeleton.h +++ b/libs/s25main/nodeObjs/noSkeleton.h @@ -17,14 +17,14 @@ class noSkeleton : public noCoordBase noSkeleton(SerializedGameData& sgd, unsigned obj_id); ~noSkeleton() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Skeleton; } protected: - void Draw(DrawPoint drawPt) override; - void HandleEvent(unsigned id) override; + void draw(DrawPoint drawPt) override; + void handleEvent(unsigned id) override; private: /// Type des Skeletts (0 = ganz "frisch", 1 - schon etwas verdorrt) diff --git a/libs/s25main/nodeObjs/noStaticObject.cpp b/libs/s25main/nodeObjs/noStaticObject.cpp index 93ac23915f..ff46697433 100644 --- a/libs/s25main/nodeObjs/noStaticObject.cpp +++ b/libs/s25main/nodeObjs/noStaticObject.cpp @@ -31,7 +31,7 @@ noStaticObject::noStaticObject(const MapPoint pos, unsigned short id, unsigned s for(const Direction dir : {Direction::West, Direction::NorthWest, Direction::NorthEast}) { MapPoint nb = world->getNeighbour(pos, dir); - world->DestroyNO(nb, false); + world->destroyNO(nb, false); world->setNO(nb, new noExtension(this)); } } @@ -50,16 +50,16 @@ void noStaticObject::Serialize(SerializedGameData& sgd) const sgd.PushUnsignedChar(size); } -void noStaticObject::Destroy() +void noStaticObject::destroy() { // waren wir ein "Schloss" Objekt? if(getSize() == 2) { for(const Direction i : {Direction::West, Direction::NorthWest, Direction::NorthEast}) - world->DestroyNO(world->getNeighbour(pos, i)); + world->destroyNO(world->getNeighbour(pos, i)); } - noCoordBase::Destroy(); + noCoordBase::destroy(); } BlockingManner noStaticObject::getBM() const @@ -73,7 +73,7 @@ BlockingManner noStaticObject::getBM() const * @param[in] id Nr der Grafik * @param[in] file Nr der Datei (0xFFFF map_?_z.lst, 0-5 mis?bobs.lst) */ -void noStaticObject::Draw(DrawPoint drawPt) +void noStaticObject::draw(DrawPoint drawPt) { if(isAnimated() || !textures.bmp) { @@ -82,11 +82,11 @@ void noStaticObject::Draw(DrawPoint drawPt) } // Bild zeichnen - textures.bmp->DrawFull(drawPt); + textures.bmp->drawFull(drawPt); // Schatten zeichnen if(textures.shadow) - textures.shadow->DrawFull(drawPt, COLOR_SHADOW); + textures.shadow->drawFull(drawPt, COLOR_SHADOW); } noStaticObject::Textures noStaticObject::getTextures(unsigned short file, unsigned short id) diff --git a/libs/s25main/nodeObjs/noStaticObject.h b/libs/s25main/nodeObjs/noStaticObject.h index 848c74f290..fc1b2ef54a 100644 --- a/libs/s25main/nodeObjs/noStaticObject.h +++ b/libs/s25main/nodeObjs/noStaticObject.h @@ -20,7 +20,7 @@ class noStaticObject : public noCoordBase NodalObjectType type = NodalObjectType::Object); noStaticObject(SerializedGameData& sgd, unsigned obj_id); - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const override { return GO_Type::Staticobject; } @@ -34,7 +34,7 @@ class noStaticObject : public noCoordBase BlockingManner getBM() const override; /// zeichnet das Objekt. - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; static Textures getTextures(unsigned short file, unsigned short id); bool isAnimated() const; diff --git a/libs/s25main/nodeObjs/noTree.cpp b/libs/s25main/nodeObjs/noTree.cpp index 4d11763b68..16ed5fe720 100644 --- a/libs/s25main/nodeObjs/noTree.cpp +++ b/libs/s25main/nodeObjs/noTree.cpp @@ -28,7 +28,7 @@ noTree::noTree(const MapPoint pos, const unsigned char type, const unsigned char // Wenn der Baum klein ist, muss später mal wachsen if(!size) { - event = getEvMgr().AddEvent(this, WAIT_LENGTH); + event = getEvMgr().addEvent(this, WAIT_LENGTH); state = State::GrowingWait; } else state = State::Nothing; @@ -40,15 +40,15 @@ noTree::noTree(const MapPoint pos, const unsigned char type, const unsigned char // Falls das der Fall ist, dann wollen wir doch gleich mal eins produzieren if(produce_animals) - produce_animal_event = getEvMgr().AddEvent(this, 6000 + RANDOM_RAND(2000), 3); + produce_animal_event = getEvMgr().addEvent(this, 6000 + RANDOM_RAND(2000), 3); } noTree::~noTree() = default; -void noTree::Destroy() +void noTree::destroy() { - getEvMgr().RemoveEvent(produce_animal_event); - noCoordBase::Destroy(); + getEvMgr().removeEvent(produce_animal_event); + noCoordBase::destroy(); } void noTree::Serialize(SerializedGameData& sgd) const @@ -57,18 +57,18 @@ void noTree::Serialize(SerializedGameData& sgd) const sgd.PushUnsignedChar(type); sgd.PushUnsignedChar(size); - sgd.PushEnum(state); - sgd.PushEvent(event); - sgd.PushEvent(produce_animal_event); + sgd.pushEnum(state); + sgd.pushEvent(event); + sgd.pushEvent(produce_animal_event); sgd.PushBool(produce_animals); } noTree::noTree(SerializedGameData& sgd, const unsigned obj_id) - : noCoordBase(sgd, obj_id), type(sgd.PopUnsignedChar()), size(sgd.PopUnsignedChar()), state(sgd.Pop()), - event(sgd.PopEvent()), produce_animal_event(sgd.PopEvent()), produce_animals(sgd.PopBool()) + : noCoordBase(sgd, obj_id), type(sgd.PopUnsignedChar()), size(sgd.PopUnsignedChar()), state(sgd.pop()), + event(sgd.popEvent()), produce_animal_event(sgd.popEvent()), produce_animals(sgd.PopBool()) {} -void noTree::Draw(DrawPoint drawPt) +void noTree::draw(DrawPoint drawPt) { switch(state) { @@ -94,7 +94,7 @@ void noTree::Draw(DrawPoint drawPt) case State::GrowingGrow: { // alten Baum ausblenden - unsigned transparency = (GAMECLIENT.Interpolate(0xFF, event)) << 24; + unsigned transparency = (GAMECLIENT.interpolate(0xFF, event)) << 24; LOADER.tree_cache[type][8 + size].draw(drawPt, 0xFFFFFFFF - transparency); @@ -110,7 +110,7 @@ void noTree::Draw(DrawPoint drawPt) case State::FallingFall: { // Umfallen beschleunigen --> für erste Frames mehr Zeit - unsigned short i = GAMECLIENT.Interpolate(9, event); + unsigned short i = GAMECLIENT.interpolate(9, event); if(i < 4) i = 0; @@ -130,15 +130,15 @@ void noTree::Draw(DrawPoint drawPt) } } -void noTree::HandleEvent(const unsigned id) +void noTree::handleEvent(const unsigned id) { // Ein Tier-Produzier-Event? if(id == 3) { // Neues Tier erzeugen - ProduceAnimal(); + produceAnimal(); // nächstes Event anmelden - produce_animal_event = getEvMgr().AddEvent(this, 6000 + RANDOM_RAND(2000), 3); + produce_animal_event = getEvMgr().addEvent(this, 6000 + RANDOM_RAND(2000), 3); return; } @@ -148,7 +148,7 @@ void noTree::HandleEvent(const unsigned id) case State::GrowingWait: { // Der Baum hat gewartet, also wächst er jetzt - event = getEvMgr().AddEvent(this, GROWING_LENGTH); + event = getEvMgr().addEvent(this, GROWING_LENGTH); state = State::GrowingGrow; } break; @@ -158,7 +158,7 @@ void noTree::HandleEvent(const unsigned id) // wächst if(++size != 3) { - event = getEvMgr().AddEvent(this, WAIT_LENGTH); + event = getEvMgr().addEvent(this, WAIT_LENGTH); // Erstmal wieder bis zum nächsten Wachsstumsschub warten state = State::GrowingWait; } else @@ -174,21 +174,21 @@ void noTree::HandleEvent(const unsigned id) // Jetzt umfallen state = State::FallingFall; - event = getEvMgr().AddEvent(this, 15); + event = getEvMgr().addEvent(this, 15); } break; case State::FallingFall: { // Baum ist gefallen, nach bestimmer Zeit verschwinden state = State::FallingFallen; - event = getEvMgr().AddEvent(this, 28); + event = getEvMgr().addEvent(this, 28); } break; case State::FallingFallen: { // Baum verschwindet nun und es bleibt ein Baumstumpf zurück event = nullptr; - getEvMgr().AddToKillList(this); + getEvMgr().addToKillList(this); // Due to the "build headquarters" cheat, there could be an HQ in these directions. Replace stump with // extension which would have otherwise been placed in noBaseBuilding ctor. @@ -209,7 +209,7 @@ void noTree::HandleEvent(const unsigned id) if(shouldPlaceStump) { world->setNO(pos, new noDisappearingMapEnvObject(pos, 531), true); - world->RecalcBQAroundPoint(pos); + world->recalcBQAroundPoint(pos); } // Minimap Bescheid geben (Baum gefallen) @@ -221,28 +221,28 @@ void noTree::HandleEvent(const unsigned id) } } -std::unique_ptr noTree::CreateFOWObject() const +std::unique_ptr noTree::createFOWObject() const { return std::make_unique(type, size); } -void noTree::FallSoon() +void noTree::fallSoon() { // Warten bis der Holzfäller fertig ist und der Baum dann umfällt - event = getEvMgr().AddEvent(this, 105); + event = getEvMgr().addEvent(this, 105); state = State::FallingWait; } -void noTree::DontFall() +void noTree::dontFall() { if(state == State::FallingWait) - getEvMgr().RemoveEvent(event); + getEvMgr().removeEvent(event); } -void noTree::ProduceAnimal() +void noTree::produceAnimal() { // neues Tier erzeugen, zufälliger Typ constexpr std::array possibleSpecies = { {Species::RabbitWhite, Species::RabbitGrey, Species::Fox, Species::Stag, Species::Deer, Species::Sheep}}; - world->AddFigure(pos, std::make_unique(RANDOM_ELEMENT(possibleSpecies), pos)).StartLiving(); + world->addFigure(pos, std::make_unique(RANDOM_ELEMENT(possibleSpecies), pos)).startLiving(); } diff --git a/libs/s25main/nodeObjs/noTree.h b/libs/s25main/nodeObjs/noTree.h index 66711fa902..b331026483 100644 --- a/libs/s25main/nodeObjs/noTree.h +++ b/libs/s25main/nodeObjs/noTree.h @@ -62,7 +62,7 @@ class noTree : public noCoordBase private: /// "Produziert" ein Tier - void ProduceAnimal(); + void produceAnimal(); public: noTree(MapPoint pos, unsigned char type, unsigned char size); @@ -70,31 +70,31 @@ class noTree : public noCoordBase ~noTree() override; - void Destroy() override; + void destroy() override; void Serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Tree; } - void Draw(DrawPoint drawPt) override; + void draw(DrawPoint drawPt) override; - void HandleEvent(unsigned id) override; + void handleEvent(unsigned id) override; BlockingManner getBM() const override { return BlockingManner::Tree; } /// Erzeugt von ihnen selbst ein FOW Objekt als visuelle "Erinnerung" für den Fog of War - std::unique_ptr CreateFOWObject() const override; + std::unique_ptr createFOWObject() const override; /// Can this tree(type) produce wood? - bool ProducesWood() const { return type != 5; } + bool producesWood() const { return type != 5; } /// Return if this tree is fully grown bool isFullyGrown() const { return size == 3; } /// Vom Holzfäller aufgerufen: Wenn der Holzfäller anfängt und der Baum dann in einer bestimmten Zeit umfallen soll - void FallSoon(); + void fallSoon(); /// Vom Holzfäller aufgerufen: Der Holzfäller hat seine Arbeit unterbrochen und der Baum soll doch nicht umfallen - void DontFall(); + void dontFall(); /// Setzt Draw-Counter auf 0 - static void ResetDrawCounter() { DRAW_COUNTER = 0; } + static void resetDrawCounter() { DRAW_COUNTER = 0; } /// Liest Draw-Counter aus - static unsigned short QueryDrawCounter() { return DRAW_COUNTER; } + static unsigned short queryDrawCounter() { return DRAW_COUNTER; } }; diff --git a/libs/s25main/ogl/DummyRenderer.h b/libs/s25main/ogl/DummyRenderer.h index 91c3a31e69..fea59281bf 100644 --- a/libs/s25main/ogl/DummyRenderer.h +++ b/libs/s25main/ogl/DummyRenderer.h @@ -12,10 +12,10 @@ class DummyRenderer : public IRenderer { public: bool initOpenGL(OpenGL_Loader_Proc) override; - void Draw3DBorder(const Rect&, bool /*elevated*/, glArchivItem_Bitmap& /*texture*/) override {} - void Draw3DContent(const Rect&, bool /*elevated*/, glArchivItem_Bitmap& /*texture*/, bool /*illuminated*/, + void draw3DBorder(const Rect&, bool /*elevated*/, glArchivItem_Bitmap& /*texture*/) override {} + void draw3DContent(const Rect&, bool /*elevated*/, glArchivItem_Bitmap& /*texture*/, bool /*illuminated*/, unsigned /*color*/) override {} - void DrawRect(const Rect&, unsigned) override {} - void DrawLine(DrawPoint, DrawPoint, unsigned, unsigned) override {} + void drawRect(const Rect&, unsigned) override {} + void drawLine(DrawPoint, DrawPoint, unsigned, unsigned) override {} }; diff --git a/libs/s25main/ogl/IRenderer.h b/libs/s25main/ogl/IRenderer.h index 78a3106d71..e24d654559 100644 --- a/libs/s25main/ogl/IRenderer.h +++ b/libs/s25main/ogl/IRenderer.h @@ -24,14 +24,14 @@ class IRenderer /// Draw a border around rect with 3D effect /// @param elevated true for elevated, false for deepened effect /// @param texture Texture to use - virtual void Draw3DBorder(const Rect& rect, bool elevated, glArchivItem_Bitmap& texture) = 0; + virtual void draw3DBorder(const Rect& rect, bool elevated, glArchivItem_Bitmap& texture) = 0; /// Draw the content with 3D effect /// @param elevated true for elevated, false for deepened effect /// @param texture Texture to use /// @param illuminated Draw illuminated /// @param color Color for the content - virtual void Draw3DContent(const Rect& rect, bool elevated, glArchivItem_Bitmap& texture, bool illuminated, + virtual void draw3DContent(const Rect& rect, bool elevated, glArchivItem_Bitmap& texture, bool illuminated, unsigned color) = 0; - virtual void DrawRect(const Rect& rect, unsigned color) = 0; - virtual void DrawLine(DrawPoint pt1, DrawPoint pt2, unsigned width, unsigned color) = 0; + virtual void drawRect(const Rect& rect, unsigned color) = 0; + virtual void drawLine(DrawPoint pt1, DrawPoint pt2, unsigned width, unsigned color) = 0; }; diff --git a/libs/s25main/ogl/ITexture.h b/libs/s25main/ogl/ITexture.h index 392316acb1..26025157a8 100644 --- a/libs/s25main/ogl/ITexture.h +++ b/libs/s25main/ogl/ITexture.h @@ -15,9 +15,9 @@ class ITexture public: virtual Position getOrigin() const = 0; virtual Extent getSize() const = 0; - virtual void DrawFull(const Position& dstPos, unsigned color = 0xFFFFFFFFu) = 0; + virtual void drawFull(const Position& dstPos, unsigned color = 0xFFFFFFFFu) = 0; /// Draws portion of image specified by srcArea on area defined by dstArea. /// In case of srcArea and dstArea size mismatch, scaling will occur. - virtual void Draw(Rect dstArea, Rect srcArea, unsigned color = 0xFFFFFFFFu) = 0; + virtual void draw(Rect dstArea, Rect srcArea, unsigned color = 0xFFFFFFFFu) = 0; }; diff --git a/libs/s25main/ogl/MusicItem.cpp b/libs/s25main/ogl/MusicItem.cpp index 392f742377..a8eabc306c 100644 --- a/libs/s25main/ogl/MusicItem.cpp +++ b/libs/s25main/ogl/MusicItem.cpp @@ -6,9 +6,9 @@ #include "Settings.h" #include "drivers/AudioDriverWrapper.h" -void MusicItem::Play(int repeats) +void MusicItem::play(int repeats) { if(!SETTINGS.sound.musicEnabled) return; - AUDIODRIVER.PlayMusic(getSoundHandle(), repeats); + AUDIODRIVER.playMusic(getSoundHandle(), repeats); } diff --git a/libs/s25main/ogl/MusicItem.h b/libs/s25main/ogl/MusicItem.h index d1009f3124..030845cae2 100644 --- a/libs/s25main/ogl/MusicItem.h +++ b/libs/s25main/ogl/MusicItem.h @@ -10,5 +10,5 @@ class MusicItem : public SoundItem { public: /// Plays the music repeating it if repeats is greater than zero or indefinitely when repeats is less than zero - void Play(int repeats = 0); + void play(int repeats = 0); }; diff --git a/libs/s25main/ogl/OpenGLRenderer.cpp b/libs/s25main/ogl/OpenGLRenderer.cpp index f02fba2b76..2e8fa3ba19 100644 --- a/libs/s25main/ogl/OpenGLRenderer.cpp +++ b/libs/s25main/ogl/OpenGLRenderer.cpp @@ -14,7 +14,7 @@ void OpenGLRenderer::synchronize() glFinish(); } -void OpenGLRenderer::Draw3DBorder(const Rect& rect, bool elevated, glArchivItem_Bitmap& texture) +void OpenGLRenderer::draw3DBorder(const Rect& rect, bool elevated, glArchivItem_Bitmap& texture) { const Extent rectSize = rect.getSize(); if(rectSize.x < 4 || rectSize.y < 4) @@ -34,8 +34,8 @@ void OpenGLRenderer::Draw3DBorder(const Rect& rect, bool elevated, glArchivItem_ vertImgBorderPos += DrawPoint(rectSize.x - 2, 0); } // Draw img borders - texture.DrawPart(Rect(horImgBorderPos, Extent(rectSize.x, 2))); - texture.DrawPart(Rect(vertImgBorderPos, Extent(2, rectSize.y))); + texture.drawPart(Rect(horImgBorderPos, Extent(rectSize.x, 2))); + texture.drawPart(Rect(vertImgBorderPos, Extent(2, rectSize.y))); // Draw black borders over the img borders glDisable(GL_TEXTURE_2D); @@ -66,7 +66,7 @@ void OpenGLRenderer::Draw3DBorder(const Rect& rect, bool elevated, glArchivItem_ glEnable(GL_TEXTURE_2D); } -void OpenGLRenderer::Draw3DContent(const Rect& rect, bool elevated, glArchivItem_Bitmap& texture, bool illuminated, +void OpenGLRenderer::draw3DContent(const Rect& rect, bool elevated, glArchivItem_Bitmap& texture, bool illuminated, unsigned color) { if(illuminated) @@ -82,7 +82,7 @@ void OpenGLRenderer::Draw3DContent(const Rect& rect, bool elevated, glArchivItem // Move a bit to left upper for elevated version contentOffset = DrawPoint(2, 2); } - texture.DrawPart(rect, contentOffset, color); + texture.drawPart(rect, contentOffset, color); if(illuminated) { @@ -91,7 +91,7 @@ void OpenGLRenderer::Draw3DContent(const Rect& rect, bool elevated, glArchivItem } } -void OpenGLRenderer::DrawRect(const Rect& rect, unsigned color) +void OpenGLRenderer::drawRect(const Rect& rect, unsigned color) { glDisable(GL_TEXTURE_2D); @@ -107,7 +107,7 @@ void OpenGLRenderer::DrawRect(const Rect& rect, unsigned color) glEnable(GL_TEXTURE_2D); } -void OpenGLRenderer::DrawLine(DrawPoint pt1, DrawPoint pt2, unsigned width, unsigned color) +void OpenGLRenderer::drawLine(DrawPoint pt1, DrawPoint pt2, unsigned width, unsigned color) { glDisable(GL_TEXTURE_2D); glColor4ub(GetRed(color), GetGreen(color), GetBlue(color), GetAlpha(color)); diff --git a/libs/s25main/ogl/OpenGLRenderer.h b/libs/s25main/ogl/OpenGLRenderer.h index 6cfba22e54..4c1704c7aa 100644 --- a/libs/s25main/ogl/OpenGLRenderer.h +++ b/libs/s25main/ogl/OpenGLRenderer.h @@ -13,9 +13,9 @@ class OpenGLRenderer : public IRenderer public: bool initOpenGL(OpenGL_Loader_Proc) override; void synchronize() override; - void Draw3DBorder(const Rect& rect, bool elevated, glArchivItem_Bitmap& texture) override; - void Draw3DContent(const Rect& rect, bool elevated, glArchivItem_Bitmap& texture, bool illuminated, + void draw3DBorder(const Rect& rect, bool elevated, glArchivItem_Bitmap& texture) override; + void draw3DContent(const Rect& rect, bool elevated, glArchivItem_Bitmap& texture, bool illuminated, unsigned color) override; - void DrawRect(const Rect& rect, unsigned color) override; - void DrawLine(DrawPoint pt1, DrawPoint pt2, unsigned width, unsigned color) override; + void drawRect(const Rect& rect, unsigned color) override; + void drawLine(DrawPoint pt1, DrawPoint pt2, unsigned width, unsigned color) override; }; diff --git a/libs/s25main/ogl/SoundEffectItem.cpp b/libs/s25main/ogl/SoundEffectItem.cpp index a74478396e..b23dd9087a 100644 --- a/libs/s25main/ogl/SoundEffectItem.cpp +++ b/libs/s25main/ogl/SoundEffectItem.cpp @@ -6,9 +6,9 @@ #include "Settings.h" #include "drivers/AudioDriverWrapper.h" -EffectPlayId SoundEffectItem::Play(uint8_t volume, bool loop) +EffectPlayId SoundEffectItem::play(uint8_t volume, bool loop) { if(!SETTINGS.sound.effectsEnabled) return EffectPlayId::Invalid; - return AUDIODRIVER.PlayEffect(getSoundHandle(), volume, loop); + return AUDIODRIVER.playEffect(getSoundHandle(), volume, loop); } diff --git a/libs/s25main/ogl/SoundEffectItem.h b/libs/s25main/ogl/SoundEffectItem.h index 8023ec6d3a..4fe5c115ba 100644 --- a/libs/s25main/ogl/SoundEffectItem.h +++ b/libs/s25main/ogl/SoundEffectItem.h @@ -12,5 +12,5 @@ class SoundEffectItem : public SoundItem { public: /// Play the sound effect - EffectPlayId Play(uint8_t volume, bool loop); + EffectPlayId play(uint8_t volume, bool loop); }; diff --git a/libs/s25main/ogl/constants.h b/libs/s25main/ogl/constants.h index 0b12d9d2c0..0498c3d6ac 100644 --- a/libs/s25main/ogl/constants.h +++ b/libs/s25main/ogl/constants.h @@ -10,7 +10,7 @@ namespace ogl { enum class Target : GLenum { Array = GL_ARRAY_BUFFER, - Index = GL_ELEMENT_ARRAY_BUFFER + index = GL_ELEMENT_ARRAY_BUFFER }; enum class Usage : GLenum diff --git a/libs/s25main/ogl/glArchivItem_Bitmap.cpp b/libs/s25main/ogl/glArchivItem_Bitmap.cpp index 36b82b838a..3ab21911b5 100644 --- a/libs/s25main/ogl/glArchivItem_Bitmap.cpp +++ b/libs/s25main/ogl/glArchivItem_Bitmap.cpp @@ -17,7 +17,7 @@ glArchivItem_Bitmap::glArchivItem_Bitmap(const glArchivItem_Bitmap& item) /** * Zeichnet die Textur. */ -void glArchivItem_Bitmap::Draw(Rect dstArea, Rect srcArea, unsigned color /*= COLOR_WHITE*/) +void glArchivItem_Bitmap::draw(Rect dstArea, Rect srcArea, unsigned color /*= COLOR_WHITE*/) { if(getTexture() == 0) return; @@ -58,42 +58,42 @@ void glArchivItem_Bitmap::Draw(Rect dstArea, Rect srcArea, unsigned color /*= CO glVertexPointer(2, GL_FLOAT, 0, vertices.data()); glTexCoordPointer(2, GL_FLOAT, 0, texCoords.data()); - VIDEODRIVER.BindTexture(getTexture()); + VIDEODRIVER.bindTexture(getTexture()); glColor4ub(GetRed(color), GetGreen(color), GetBlue(color), GetAlpha(color)); glDrawArrays(GL_QUADS, 0, 4); } -void glArchivItem_Bitmap::DrawFull(const Rect& destArea, unsigned color) +void glArchivItem_Bitmap::drawFull(const Rect& destArea, unsigned color) { - Draw(destArea, Rect(Position(0, 0), getSize()), color); + draw(destArea, Rect(Position(0, 0), getSize()), color); } -void glArchivItem_Bitmap::DrawFull(const DrawPoint& dstPos, unsigned color) +void glArchivItem_Bitmap::drawFull(const DrawPoint& dstPos, unsigned color) { - DrawFull(Rect(dstPos, getSize()), color); + drawFull(Rect(dstPos, getSize()), color); } -void glArchivItem_Bitmap::DrawPart(const Rect& destArea, const DrawPoint& offset, unsigned color) +void glArchivItem_Bitmap::drawPart(const Rect& destArea, const DrawPoint& offset, unsigned color) { - Draw(destArea, Rect(offset, destArea.getSize()), color); + draw(destArea, Rect(offset, destArea.getSize()), color); } -void glArchivItem_Bitmap::DrawPart(const Rect& destArea, unsigned color /*= COLOR_WHITE*/) +void glArchivItem_Bitmap::drawPart(const Rect& destArea, unsigned color /*= COLOR_WHITE*/) { - DrawPart(destArea, DrawPoint::all(0), color); + drawPart(destArea, DrawPoint::all(0), color); } -void glArchivItem_Bitmap::DrawPercent(const DrawPoint& dstPos, unsigned percent, unsigned color /*= COLOR_WHITE*/) +void glArchivItem_Bitmap::drawPercent(const DrawPoint& dstPos, unsigned percent, unsigned color /*= COLOR_WHITE*/) { RTTR_Assert(percent <= 100); if(percent == 0u) return; unsigned drawnHeight = getHeight() * std::min(100u, percent) / 100; DrawPoint offset(0, getHeight() - drawnHeight); - DrawPart(Rect(dstPos + offset, getWidth(), drawnHeight), offset, color); + drawPart(Rect(dstPos + offset, getWidth(), drawnHeight), offset, color); } -void glArchivItem_Bitmap::FillTexture() +void glArchivItem_Bitmap::fillTexture() { int iformat = getInternalFormat(), dformat = GL_BGRA; @@ -103,7 +103,7 @@ void glArchivItem_Bitmap::FillTexture() glTexImage2D(GL_TEXTURE_2D, 0, iformat, texSize.x, texSize.y, 0, dformat, GL_UNSIGNED_BYTE, buffer.getPixelPtr()); } -Extent glArchivItem_Bitmap::CalcTextureSize() const +Extent glArchivItem_Bitmap::calcTextureSize() const { return VIDEODRIVER.calcPreferredTextureSize(getSize()); } diff --git a/libs/s25main/ogl/glArchivItem_Bitmap.h b/libs/s25main/ogl/glArchivItem_Bitmap.h index 21d95b29a9..ed9412cbc2 100644 --- a/libs/s25main/ogl/glArchivItem_Bitmap.h +++ b/libs/s25main/ogl/glArchivItem_Bitmap.h @@ -19,21 +19,21 @@ class glArchivItem_Bitmap : public virtual libsiedler2::baseArchivItem_Bitmap, p glArchivItem_Bitmap(const glArchivItem_Bitmap& item); /// Draw the texture in the given rect, stretching if required - void DrawFull(const Rect& destArea, unsigned color = COLOR_WHITE); + void drawFull(const Rect& destArea, unsigned color = COLOR_WHITE); /// Draw the texture to the given position with full size - void DrawFull(const DrawPoint& dstPos, unsigned color = COLOR_WHITE) override; + void drawFull(const DrawPoint& dstPos, unsigned color = COLOR_WHITE) override; /// Draw a rectangular part of the texture. offset specifies the offset from the origin of the texture - void DrawPart(const Rect& destArea, const DrawPoint& offset, unsigned color = COLOR_WHITE); + void drawPart(const Rect& destArea, const DrawPoint& offset, unsigned color = COLOR_WHITE); /// Draw a rectangular part of the texture from the origin of it - void DrawPart(const Rect& destArea, unsigned color = COLOR_WHITE); + void drawPart(const Rect& destArea, unsigned color = COLOR_WHITE); /// Draw only percent% of the height of the image, counting from the bottom of the image - void DrawPercent(const DrawPoint& dstPos, unsigned percent, unsigned color = COLOR_WHITE); + void drawPercent(const DrawPoint& dstPos, unsigned percent, unsigned color = COLOR_WHITE); /// Draw the texture. /// src_w/h default to the full bitmap size /// dst_w/h default the src_w/h - void Draw(Rect dstArea, Rect srcArea, unsigned color = COLOR_WHITE) override; + void draw(Rect dstArea, Rect srcArea, unsigned color = COLOR_WHITE) override; protected: - void FillTexture() override; - Extent CalcTextureSize() const override; + void fillTexture() override; + Extent calcTextureSize() const override; }; diff --git a/libs/s25main/ogl/glArchivItem_BitmapBase.cpp b/libs/s25main/ogl/glArchivItem_BitmapBase.cpp index de805c4493..97388c8b1c 100644 --- a/libs/s25main/ogl/glArchivItem_BitmapBase.cpp +++ b/libs/s25main/ogl/glArchivItem_BitmapBase.cpp @@ -26,7 +26,7 @@ glArchivItem_BitmapBase::glArchivItem_BitmapBase(const glArchivItem_BitmapBase& glArchivItem_BitmapBase::~glArchivItem_BitmapBase() { - DeleteTexture(); + deleteTexture(); } /** @@ -35,16 +35,16 @@ glArchivItem_BitmapBase::~glArchivItem_BitmapBase() unsigned glArchivItem_BitmapBase::getTexture() { if(texture == 0) - GenerateTexture(); + generateTexture(); return texture; } /** * Löscht die GL-Textur (z.B fürs Neuerstellen) */ -void glArchivItem_BitmapBase::DeleteTexture() +void glArchivItem_BitmapBase::deleteTexture() { - VIDEODRIVER.DeleteTexture(texture); + VIDEODRIVER.deleteTexture(texture); texture = 0; } @@ -57,7 +57,7 @@ void glArchivItem_BitmapBase::setInterpolateTexture(bool interpolate) // neugenerierung der Textur anstoßen if(texture != 0) - DeleteTexture(); + deleteTexture(); } Extent glArchivItem_BitmapBase::getTexSize() const @@ -69,26 +69,26 @@ Extent glArchivItem_BitmapBase::getTexSize() const /** * Erzeugt die Textur. */ -void glArchivItem_BitmapBase::GenerateTexture() +void glArchivItem_BitmapBase::generateTexture() { - textureSize_ = CalcTextureSize(); + textureSize_ = calcTextureSize(); if(textureSize_.x == 0 || textureSize_.y == 0) return; - texture = VIDEODRIVER.GenerateTexture(); + texture = VIDEODRIVER.generateTexture(); if(!texture) return; if(!getPalette() && getFormat() == libsiedler2::TextureFormat::Paletted) setPaletteCopy(*LOADER.getPaletteN("pal5")); - VIDEODRIVER.BindTexture(texture); + VIDEODRIVER.bindTexture(texture); GLint filter = interpolateTexture_ ? GL_NEAREST : GL_LINEAR; glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); - FillTexture(); + fillTexture(); } int glArchivItem_BitmapBase::getInternalFormat() const diff --git a/libs/s25main/ogl/glArchivItem_BitmapBase.h b/libs/s25main/ogl/glArchivItem_BitmapBase.h index 4fc4e093ee..789ed667ea 100644 --- a/libs/s25main/ogl/glArchivItem_BitmapBase.h +++ b/libs/s25main/ogl/glArchivItem_BitmapBase.h @@ -19,7 +19,7 @@ class glArchivItem_BitmapBase : public virtual libsiedler2::ArchivItem_BitmapBas unsigned getTexture(); unsigned getTextureNoCreate() const { return texture; } /// Löscht die GL-Textur (z.B fürs Neuerstellen) - void DeleteTexture(); + void deleteTexture(); /// Setzt den Texturfilter auf einen bestimmten Wert. virtual void setInterpolateTexture(bool interpolate); @@ -30,7 +30,7 @@ class glArchivItem_BitmapBase : public virtual libsiedler2::ArchivItem_BitmapBas private: /// Erzeugt die Textur. - void GenerateTexture(); + void generateTexture(); unsigned texture; /// Das GL-Textur-Handle Extent textureSize_; /// The size of the texture. Only valid when texture exists @@ -40,9 +40,9 @@ class glArchivItem_BitmapBase : public virtual libsiedler2::ArchivItem_BitmapBas /// Returns the internal texure format int getInternalFormat() const; /// Fill a just generated texture (glTexImage2D calls) - virtual void FillTexture() = 0; + virtual void fillTexture() = 0; /// Calculate the actual texture size - virtual Extent CalcTextureSize() const = 0; + virtual Extent calcTextureSize() const = 0; /// Returns the currently set texture or 0 if none created unsigned getTexNoCreate() const { return texture; } }; diff --git a/libs/s25main/ogl/glArchivItem_Bitmap_Direct.cpp b/libs/s25main/ogl/glArchivItem_Bitmap_Direct.cpp index 394588d5ec..6de49e436b 100644 --- a/libs/s25main/ogl/glArchivItem_Bitmap_Direct.cpp +++ b/libs/s25main/ogl/glArchivItem_Bitmap_Direct.cpp @@ -35,7 +35,7 @@ void glArchivItem_Bitmap_Direct::endUpdate() Position origin = areaToUpdate_.getOrigin(); int ec = print(buffer, nullptr, 0, 0, origin.x, origin.y); RTTR_Assert(ec == 0); - VIDEODRIVER.BindTexture(getTexNoCreate()); + VIDEODRIVER.bindTexture(getTexNoCreate()); glTexSubImage2D(GL_TEXTURE_2D, 0, origin.x, origin.y, buffer.getWidth(), buffer.getHeight(), GL_BGRA, GL_UNSIGNED_BYTE, buffer.getPixelPtr()); } diff --git a/libs/s25main/ogl/glArchivItem_Bitmap_Player.cpp b/libs/s25main/ogl/glArchivItem_Bitmap_Player.cpp index c617e666eb..d6fb606027 100644 --- a/libs/s25main/ogl/glArchivItem_Bitmap_Player.cpp +++ b/libs/s25main/ogl/glArchivItem_Bitmap_Player.cpp @@ -16,38 +16,38 @@ struct GL_RGBAColor }; } // namespace -Extent glArchivItem_Bitmap_Player::CalcTextureSize() const +Extent glArchivItem_Bitmap_Player::calcTextureSize() const { // We have the texture 2 times: one with non-player colors and one with them return VIDEODRIVER.calcPreferredTextureSize(Extent(getSize().x * 2, getSize().y)); } -void glArchivItem_Bitmap_Player::DrawFull(const Rect& destArea, unsigned color, unsigned player_color) +void glArchivItem_Bitmap_Player::drawFull(const Rect& destArea, unsigned color, unsigned player_color) { - Draw(destArea, Rect(Position::all(0), getSize()), color, player_color); + draw(destArea, Rect(Position::all(0), getSize()), color, player_color); } -void glArchivItem_Bitmap_Player::DrawFull(const DrawPoint& dst, unsigned color, unsigned player_color) +void glArchivItem_Bitmap_Player::drawFull(const DrawPoint& dst, unsigned color, unsigned player_color) { - DrawFull(Rect(dst, getSize()), color, player_color); + drawFull(Rect(dst, getSize()), color, player_color); } -void glArchivItem_Bitmap_Player::DrawFull(const Position& dstPos, unsigned color) +void glArchivItem_Bitmap_Player::drawFull(const Position& dstPos, unsigned color) { - DrawFull(dstPos, color, COLOR_WHITE); + drawFull(dstPos, color, COLOR_WHITE); } void glArchivItem_Bitmap_Player::drawForPlayer(const DrawPoint& dst, unsigned playerColor) { - DrawFull(dst, COLOR_WHITE, playerColor); + drawFull(dst, COLOR_WHITE, playerColor); } -void glArchivItem_Bitmap_Player::Draw(Rect dstArea, Rect srcArea, unsigned color /*= COLOR_WHITE*/) +void glArchivItem_Bitmap_Player::draw(Rect dstArea, Rect srcArea, unsigned color /*= COLOR_WHITE*/) { - Draw(dstArea, srcArea, color, COLOR_WHITE); + draw(dstArea, srcArea, color, COLOR_WHITE); } -void glArchivItem_Bitmap_Player::Draw(Rect dstArea, Rect srcArea, unsigned color /*= COLOR_WHITE*/, +void glArchivItem_Bitmap_Player::draw(Rect dstArea, Rect srcArea, unsigned color /*= COLOR_WHITE*/, unsigned player_color /*= COLOR_WHITE*/) { if(getTexture() == 0) @@ -110,12 +110,12 @@ void glArchivItem_Bitmap_Player::Draw(Rect dstArea, Rect srcArea, unsigned color glVertexPointer(2, GL_FLOAT, 0, vertices.data()); glTexCoordPointer(2, GL_FLOAT, 0, texCoords.data()); glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors.data()); - VIDEODRIVER.BindTexture(getTexture()); + VIDEODRIVER.bindTexture(getTexture()); glDrawArrays(GL_QUADS, 0, 8); glDisableClientState(GL_COLOR_ARRAY); } -void glArchivItem_Bitmap_Player::FillTexture() +void glArchivItem_Bitmap_Player::fillTexture() { // Spezialpalette (blaue Spielerfarben sind Grau) verwenden, // damit man per OpenGL einfärben kann! diff --git a/libs/s25main/ogl/glArchivItem_Bitmap_Player.h b/libs/s25main/ogl/glArchivItem_Bitmap_Player.h index 2ab87505ba..943e94e4b4 100644 --- a/libs/s25main/ogl/glArchivItem_Bitmap_Player.h +++ b/libs/s25main/ogl/glArchivItem_Bitmap_Player.h @@ -22,17 +22,17 @@ class glArchivItem_Bitmap_Player : public libsiedler2::ArchivItem_Bitmap_Player, /// Draw the texture in the given rect, stretching if required /// equivalent to Draw(destArea, {0, 0, 0, 0}, color) - void DrawFull(const Rect& destArea, unsigned color, unsigned player_color = COLOR_WHITE); + void drawFull(const Rect& destArea, unsigned color, unsigned player_color = COLOR_WHITE); /// Draw the texture to the given position with full size /// equivalent to Draw({dst, 0, 0}, {0, 0, 0, 0}, color, player_color) - void DrawFull(const DrawPoint& dst, unsigned color, unsigned player_color); - virtual void DrawFull(const Position& dstPos, unsigned color = COLOR_WHITE) override; + void drawFull(const DrawPoint& dst, unsigned color, unsigned player_color); + virtual void drawFull(const Position& dstPos, unsigned color = COLOR_WHITE) override; /// Draw in player colors void drawForPlayer(const DrawPoint& dst, unsigned playerColor); - void Draw(Rect dstArea, Rect srcArea, unsigned color = COLOR_WHITE) override; + void draw(Rect dstArea, Rect srcArea, unsigned color = COLOR_WHITE) override; protected: - void Draw(Rect dstArea, Rect srcArea, unsigned color = COLOR_WHITE, unsigned player_color = COLOR_WHITE); - void FillTexture() override; - Extent CalcTextureSize() const override; + void draw(Rect dstArea, Rect srcArea, unsigned color = COLOR_WHITE, unsigned player_color = COLOR_WHITE); + void fillTexture() override; + Extent calcTextureSize() const override; }; diff --git a/libs/s25main/ogl/glArchivItem_Bob.cpp b/libs/s25main/ogl/glArchivItem_Bob.cpp index 04691887f0..c36c521c39 100644 --- a/libs/s25main/ogl/glArchivItem_Bob.cpp +++ b/libs/s25main/ogl/glArchivItem_Bob.cpp @@ -10,18 +10,18 @@ /** * Zeichnet einen Animationsstep. */ -void glArchivItem_Bob::Draw(unsigned item, libsiedler2::ImgDir direction, bool fat, unsigned animationstep, +void glArchivItem_Bob::draw(unsigned item, libsiedler2::ImgDir direction, bool fat, unsigned animationstep, DrawPoint drawPt, unsigned color) { auto* body = dynamic_cast(getBody(fat, direction, animationstep)); if(body) - body->DrawFull(drawPt, COLOR_WHITE, color); + body->drawFull(drawPt, COLOR_WHITE, color); auto overlay = getOverlay(item, fat, direction, animationstep); auto* glOverlay = dynamic_cast(overlay.first); if(glOverlay) { drawPt.y -= overlay.second; - glOverlay->DrawFull(drawPt, COLOR_WHITE, color); + glOverlay->drawFull(drawPt, COLOR_WHITE, color); } } diff --git a/libs/s25main/ogl/glArchivItem_Bob.h b/libs/s25main/ogl/glArchivItem_Bob.h index 35b7c195ef..9519a6f088 100644 --- a/libs/s25main/ogl/glArchivItem_Bob.h +++ b/libs/s25main/ogl/glArchivItem_Bob.h @@ -12,7 +12,7 @@ class glArchivItem_Bob : public libsiedler2::ArchivItem_Bob { public: /// Zeichnet einen Animationsstep. - void Draw(unsigned item, libsiedler2::ImgDir direction, bool fat, unsigned animationstep, DrawPoint drawPt, + void draw(unsigned item, libsiedler2::ImgDir direction, bool fat, unsigned animationstep, DrawPoint drawPt, unsigned color); RTTR_CLONEABLE(glArchivItem_Bob) diff --git a/libs/s25main/ogl/glArchivItem_Sound_Midi.cpp b/libs/s25main/ogl/glArchivItem_Sound_Midi.cpp index e5353de036..4e0ec63f99 100644 --- a/libs/s25main/ogl/glArchivItem_Sound_Midi.cpp +++ b/libs/s25main/ogl/glArchivItem_Sound_Midi.cpp @@ -7,5 +7,5 @@ SoundHandle glArchivItem_Sound_Midi::Load() { - return AUDIODRIVER.LoadMusic(*this, ".midi"); + return AUDIODRIVER.loadMusic(*this, ".midi"); } diff --git a/libs/s25main/ogl/glArchivItem_Sound_Other.cpp b/libs/s25main/ogl/glArchivItem_Sound_Other.cpp index e37f234cbd..9174fc9dce 100644 --- a/libs/s25main/ogl/glArchivItem_Sound_Other.cpp +++ b/libs/s25main/ogl/glArchivItem_Sound_Other.cpp @@ -13,5 +13,5 @@ SoundHandle glArchivItem_Sound_Other::Load() else if(getType() == libsiedler2::SoundType::MP3) extension = ".mp3"; - return AUDIODRIVER.LoadMusic(*this, extension); + return AUDIODRIVER.loadMusic(*this, extension); } diff --git a/libs/s25main/ogl/glArchivItem_Sound_Wave.cpp b/libs/s25main/ogl/glArchivItem_Sound_Wave.cpp index 66001cea8e..e8830f64b5 100644 --- a/libs/s25main/ogl/glArchivItem_Sound_Wave.cpp +++ b/libs/s25main/ogl/glArchivItem_Sound_Wave.cpp @@ -7,5 +7,5 @@ SoundHandle glArchivItem_Sound_Wave::Load() { - return AUDIODRIVER.LoadEffect(*this, ".wav"); + return AUDIODRIVER.loadEffect(*this, ".wav"); } diff --git a/libs/s25main/ogl/glArchivItem_Sound_XMidi.cpp b/libs/s25main/ogl/glArchivItem_Sound_XMidi.cpp index 7066bd759b..317ca1237c 100644 --- a/libs/s25main/ogl/glArchivItem_Sound_XMidi.cpp +++ b/libs/s25main/ogl/glArchivItem_Sound_XMidi.cpp @@ -11,5 +11,5 @@ SoundHandle glArchivItem_Sound_XMidi::Load() const libsiedler2::MIDI_Track& midiTrack = getMidiTrack(0); libsiedler2::ArchivItem_Sound_Midi soundArchiv; soundArchiv.addTrack(midiTrack); - return AUDIODRIVER.LoadMusic(soundArchiv, ".midi"); + return AUDIODRIVER.loadMusic(soundArchiv, ".midi"); } diff --git a/libs/s25main/ogl/glFont.cpp b/libs/s25main/ogl/glFont.cpp index f4721eed61..00c4ca409f 100644 --- a/libs/s25main/ogl/glFont.cpp +++ b/libs/s25main/ogl/glFont.cpp @@ -70,7 +70,7 @@ glFont::glFont(const libsiedler2::ArchivItem_Font& font) : maxCharSize(font.getD CharInfo ci(curPos, std::min(maxCharSize.x + 2, c->getWidth())); - AddCharInfo(i, ci); + addCharInfo(i, ci); curPos.x += maxCharSize.x + spacing.x * 2; ++numChars; } @@ -79,9 +79,9 @@ glFont::glFont(const libsiedler2::ArchivItem_Font& font) : maxCharSize(font.getD fontWithOutline->create(bufferWithOutline); // Set the placeholder for non-existent glyphs. Use '?' (should always be possible) - if(CharExist(0xFFFD)) + if(charExist(0xFFFD)) placeHolder = getCharInfo(0xFFFD); - else if(CharExist('?')) + else if(charExist('?')) placeHolder = getCharInfo('?'); else throw std::runtime_error("Cannot find '?' glyph in font. What shall I use as fallback?"); @@ -96,7 +96,7 @@ glFont::glFont(const libsiedler2::ArchivItem_Font& font) : maxCharSize(font.getD } } -bool glFont::CharExist(char32_t c) const +bool glFont::charExist(char32_t c) const { if(c < asciiMapping.size()) return asciiMapping[c].first; @@ -118,7 +118,7 @@ const glFont::CharInfo& glFont::getCharInfo(char32_t c) const return placeHolder; } -void glFont::AddCharInfo(char32_t c, const CharInfo& info) +void glFont::addCharInfo(char32_t c, const CharInfo& info) { if(c < asciiMapping.size()) asciiMapping[c] = std::make_pair(true, info); @@ -129,7 +129,7 @@ void glFont::AddCharInfo(char32_t c, const CharInfo& info) /** * @brief fügt ein einzelnes Zeichen zur Zeichenliste hinzu */ -inline void glFont::DrawChar(char32_t curChar, VertexArrays& vertices, DrawPoint& curPos) const +inline void glFont::drawChar(char32_t curChar, VertexArrays& vertices, DrawPoint& curPos) const { CharInfo ci = getCharInfo(curChar); @@ -169,7 +169,7 @@ inline void glFont::DrawChar(char32_t curChar, VertexArrays& vertices, DrawPoint * @param[in] maxWidth maximale Länge * @param end Suffix for displaying a truncation of the text (...) */ -void glFont::Draw(DrawPoint pos, const std::string& text, FontStyle format, unsigned color, unsigned short maxWidth, +void glFont::draw(DrawPoint pos, const std::string& text, FontStyle format, unsigned color, unsigned short maxWidth, const std::string& end) const { RTTR_Assert(s25util::isValidUTF8(text)); @@ -222,7 +222,7 @@ void glFont::Draw(DrawPoint pos, const std::string& text, FontStyle format, unsi for(auto it = text.begin(); it != itEnd;) { const utf::code_point curChar = utf8::decode(it, itEnd); - DrawChar(curChar, texList, pos); + drawChar(curChar, texList, pos); } if(drawEnd) @@ -230,7 +230,7 @@ void glFont::Draw(DrawPoint pos, const std::string& text, FontStyle format, unsi for(auto it = end.begin(); it != end.end();) { const utf::code_point curChar = utf8::decode(it, end.end()); - DrawChar(curChar, texList, pos); + drawChar(curChar, texList, pos); } } @@ -250,7 +250,7 @@ void glFont::Draw(DrawPoint pos, const std::string& text, FontStyle format, unsi glVertexPointer(2, GL_FLOAT, 0, texList.vertices.data()); glTexCoordPointer(2, GL_FLOAT, 0, texList.texCoords.data()); - VIDEODRIVER.BindTexture(texture); + VIDEODRIVER.bindTexture(texture); glColor4ub(GetRed(color), GetGreen(color), GetBlue(color), GetAlpha(color)); glDrawArrays(GL_QUADS, 0, texList.vertices.size()); } @@ -264,7 +264,7 @@ unsigned glFont::getWidthInternal(const std::string::const_iterator& begin, cons { const auto itCurChar = it; const utf::code_point curChar = utf8::decode(it, end); - const unsigned cw = CharWidth(curChar); + const unsigned cw = charWidth(curChar); // If we limit the width and the text will be longer, stop before it // Do not stop if this is the first char if(T_limitWidth && curLen != 0 && curLen + cw > maxWidth) @@ -310,7 +310,7 @@ Rect glFont::getBounds(DrawPoint pos, const std::string& text, FontStyle format) return result; } -std::vector glFont::WrapInfo::CreateSingleStrings(const std::string& text) const +std::vector glFont::WrapInfo::createSingleStrings(const std::string& text) const { std::vector destStrings; destStrings.reserve(lines.size()); @@ -344,7 +344,7 @@ glFont::WrapInfo glFont::getWrapInfo(const std::string& text, const unsigned sho auto itWordStart = it; auto itLineStart = it; - const unsigned spaceWidth = CharWidth(' '); + const unsigned spaceWidth = charWidth(' '); const auto makeLineRange = [&text, &itLineStart](const auto& itLineEnd) { return WrapInfo::LineRange{static_cast(itLineStart - text.begin()), @@ -378,7 +378,7 @@ glFont::WrapInfo glFont::getWrapInfo(const std::string& text, const unsigned sho for(auto itWord = itWordStart; itWord != itCurChar;) { const auto itPotentialBreak = itWord; - const utf::code_point letter_width = CharWidth(utf8::decode(itWord, itEnd)); + const utf::code_point letter_width = charWidth(utf8::decode(itWord, itEnd)); // Can we fit the letter onto current line? if(line_width + letter_width <= curMaxLineWidth) @@ -419,7 +419,7 @@ glFont::WrapInfo glFont::getWrapInfo(const std::string& text, const unsigned sho } else { // Some char -> Add its width - word_width += CharWidth(curChar); + word_width += charWidth(curChar); } } for(auto& line : wi.lines) diff --git a/libs/s25main/ogl/glFont.h b/libs/s25main/ogl/glFont.h index 3ac5efc952..f81cf9f709 100644 --- a/libs/s25main/ogl/glFont.h +++ b/libs/s25main/ogl/glFont.h @@ -28,7 +28,7 @@ class glFont /// Draw the the text at the given position with format (alignment) and color. /// If maxWidth is given then the text length will be at most maxWidth. If the text is shortened then end is /// appended (included in maxWidth) - void Draw(DrawPoint pos, const std::string& text, FontStyle format, unsigned color = COLOR_WHITE, + void draw(DrawPoint pos, const std::string& text, FontStyle format, unsigned color = COLOR_WHITE, unsigned short maxWidth = 0xFFFF, const std::string& end = "...") const; /// Return the width of the drawn text. If maxWidth is given then the width will be <= maxWidth and maxNumChars will @@ -52,7 +52,7 @@ class glFont }; /// Create an array of strings by breaking the given string at the contained line range information - std::vector CreateSingleStrings(const std::string& text) const; + std::vector createSingleStrings(const std::string& text) const; /// Information on each line detected std::vector lines; @@ -63,9 +63,9 @@ class glFont WrapInfo getWrapInfo(const std::string& text, unsigned short primary_width, unsigned short secondary_width) const; /// prüft ob ein Buchstabe existiert. - bool CharExist(char32_t c) const; + bool charExist(char32_t c) const; /// liefert die Breite eines Zeichens - unsigned CharWidth(char32_t c) const { return getCharInfo(c).width; } + unsigned charWidth(char32_t c) const { return getCharInfo(c).width; } private: struct CharInfo @@ -82,10 +82,10 @@ class glFont std::vector vertices; }; - void AddCharInfo(char32_t c, const CharInfo& info); + void addCharInfo(char32_t c, const CharInfo& info); /// liefert das Char-Info eines Zeichens const CharInfo& getCharInfo(char32_t c) const; - void DrawChar(char32_t curChar, VertexArrays& vertices, DrawPoint& curPos) const; + void drawChar(char32_t curChar, VertexArrays& vertices, DrawPoint& curPos) const; Extent maxCharSize; // How big each char is at most (aka dx,dy) std::unique_ptr fontNoOutline; diff --git a/libs/s25main/ogl/glSmartBitmap.cpp b/libs/s25main/ogl/glSmartBitmap.cpp index ff73b7a058..b94ff5f567 100644 --- a/libs/s25main/ogl/glSmartBitmap.cpp +++ b/libs/s25main/ogl/glSmartBitmap.cpp @@ -32,7 +32,7 @@ glSmartBitmap::~glSmartBitmap() void glSmartBitmap::reset() { if(texture && !sharedTexture) - VIDEODRIVER.DeleteTexture(texture); + VIDEODRIVER.deleteTexture(texture); texture = 0; for(glBitmapItem& bmpItem : items) @@ -201,7 +201,7 @@ void glSmartBitmap::generateTexture() if(!texture) { - texture = VIDEODRIVER.GenerateTexture(); + texture = VIDEODRIVER.generateTexture(); if(!texture) return; @@ -212,7 +212,7 @@ void glSmartBitmap::generateTexture() libsiedler2::PixelBufferBGRA buffer(bufSize.x, bufSize.y); drawTo(buffer); - VIDEODRIVER.BindTexture(texture); + VIDEODRIVER.bindTexture(texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); @@ -240,7 +240,7 @@ void glSmartBitmap::generateTexture() } } -void glSmartBitmap::Draw(Rect dstArea, Rect srcArea, unsigned color /*= 0xFFFFFFFF*/) +void glSmartBitmap::draw(Rect dstArea, Rect srcArea, unsigned color /*= 0xFFFFFFFF*/) { drawRect(dstArea, srcArea, color); } @@ -331,7 +331,7 @@ void glSmartBitmap::drawRect(Rect dstArea, Rect srcArea, unsigned color /*= 0xFF glVertexPointer(2, GL_FLOAT, 0, vertices.data()); glTexCoordPointer(2, GL_FLOAT, 0, curTexCoords.data()); glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors.data()); - VIDEODRIVER.BindTexture(texture); + VIDEODRIVER.bindTexture(texture); glDrawArrays(GL_QUADS, 0, numQuads); glDisableClientState(GL_COLOR_ARRAY); } diff --git a/libs/s25main/ogl/glSmartBitmap.h b/libs/s25main/ogl/glSmartBitmap.h index e978609307..cc2878d341 100644 --- a/libs/s25main/ogl/glSmartBitmap.h +++ b/libs/s25main/ogl/glSmartBitmap.h @@ -58,8 +58,8 @@ class glSmartBitmap : public ITexture unsigned getTexture() const { return texture; } void generateTexture(); - void DrawFull(const Position& dstPos, unsigned color = 0xFFFFFFFF) override { draw(dstPos, color); } - void Draw(Rect dstArea, Rect srcArea, unsigned color = 0xFFFFFFFF) override; + void drawFull(const Position& dstPos, unsigned color = 0xFFFFFFFF) override { draw(dstPos, color); } + void draw(Rect dstArea, Rect srcArea, unsigned color = 0xFFFFFFFF) override; void drawRect(Rect dstArea, Rect srcArea, unsigned color = 0xFFFFFFFF, unsigned player_color = 0); void draw(DrawPoint drawPt, unsigned color = 0xFFFFFFFF, unsigned player_color = 0); void drawForPlayer(DrawPoint drawPt, unsigned player_color) { draw(drawPt, 0xFFFFFFFF, player_color); } diff --git a/libs/s25main/ogl/glTexturePacker.cpp b/libs/s25main/ogl/glTexturePacker.cpp index 978d6a4043..c91b2f5db3 100644 --- a/libs/s25main/ogl/glTexturePacker.cpp +++ b/libs/s25main/ogl/glTexturePacker.cpp @@ -132,7 +132,7 @@ bool glTexturePacker::pack() return false; } -glTexture::glTexture() : handle(VIDEODRIVER.GenerateTexture()), size(0, 0) +glTexture::glTexture() : handle(VIDEODRIVER.generateTexture()), size(0, 0) { if(!handle) return; @@ -154,20 +154,20 @@ glTexture& glTexture::operator=(glTexture&& rhs) noexcept void glTexture::bind() const { - VIDEODRIVER.BindTexture(handle); + VIDEODRIVER.bindTexture(handle); } glTexture::~glTexture() { if(handle) - VIDEODRIVER.DeleteTexture(handle); + VIDEODRIVER.deleteTexture(handle); } bool glTexture::checkSize(const Extent& size) const { if(!handle) return false; - VIDEODRIVER.BindTexture(handle); + VIDEODRIVER.bindTexture(handle); glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, size.x, size.y, 0, GL_BGRA, GL_UNSIGNED_BYTE, nullptr); int resultWidth; glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &resultWidth); @@ -179,7 +179,7 @@ bool glTexture::uploadData(const libsiedler2::PixelBufferBGRA& buffer) { if(!handle) return false; - VIDEODRIVER.BindTexture(handle); + VIDEODRIVER.bindTexture(handle); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, buffer.getWidth(), buffer.getHeight(), 0, GL_BGRA, GL_UNSIGNED_BYTE, buffer.getPixelPtr()); size = Extent(buffer.getWidth(), buffer.getHeight()); diff --git a/libs/s25main/pathfinding/FindPathForRoad.cpp b/libs/s25main/pathfinding/FindPathForRoad.cpp index 6f5ceb207a..6e9ebf3053 100644 --- a/libs/s25main/pathfinding/FindPathForRoad.cpp +++ b/libs/s25main/pathfinding/FindPathForRoad.cpp @@ -35,7 +35,7 @@ std::vector FindPathForRoad(const T_WorldOrViewer& world, const MapPo { RTTR_Assert(startPt != endPt); std::vector road; - getWorld(world).getFreePathFinder().FindPath(startPt, endPt, false, maxLen, &road, nullptr, nullptr, + getWorld(world).getFreePathFinder().findPath(startPt, endPt, false, maxLen, &road, nullptr, nullptr, makePathConditionRoad(world, isBoatRoad)); return road; } diff --git a/libs/s25main/pathfinding/FindPathReachable.cpp b/libs/s25main/pathfinding/FindPathReachable.cpp index 7358a82b47..5c64ca5db8 100644 --- a/libs/s25main/pathfinding/FindPathReachable.cpp +++ b/libs/s25main/pathfinding/FindPathReachable.cpp @@ -28,9 +28,9 @@ struct PathConditionReachableWithStaticBlockers : PathConditionReachable } // namespace -bool DoesReachablePathExist(const GameWorldBase& world, const MapPoint startPt, const MapPoint endPt, unsigned maxLen) +bool doesReachablePathExist(const GameWorldBase& world, const MapPoint startPt, const MapPoint endPt, unsigned maxLen) { RTTR_Assert(startPt != endPt); - return world.getFreePathFinder().FindPath(startPt, endPt, false, maxLen, nullptr, nullptr, nullptr, + return world.getFreePathFinder().findPath(startPt, endPt, false, maxLen, nullptr, nullptr, nullptr, PathConditionReachableWithStaticBlockers(world)); } diff --git a/libs/s25main/pathfinding/FindPathReachable.h b/libs/s25main/pathfinding/FindPathReachable.h index 5bdfaad278..1018ff5780 100644 --- a/libs/s25main/pathfinding/FindPathReachable.h +++ b/libs/s25main/pathfinding/FindPathReachable.h @@ -7,4 +7,4 @@ #include "gameTypes/MapCoordinates.h" class GameWorldBase; -bool DoesReachablePathExist(const GameWorldBase& world, MapPoint startPt, MapPoint endPt, unsigned maxLen); +bool doesReachablePathExist(const GameWorldBase& world, MapPoint startPt, MapPoint endPt, unsigned maxLen); diff --git a/libs/s25main/pathfinding/FreePathFinder.cpp b/libs/s25main/pathfinding/FreePathFinder.cpp index 789e9cf9f7..b6fc5b148c 100644 --- a/libs/s25main/pathfinding/FreePathFinder.cpp +++ b/libs/s25main/pathfinding/FreePathFinder.cpp @@ -39,7 +39,7 @@ void FreePathFinder::Init(const MapExtent& mapSize) } } -void FreePathFinder::IncreaseCurrentVisit() +void FreePathFinder::increaseCurrentVisit() { // if the counter reaches its maxium, tidy up if(currentVisit == std::numeric_limits::max()) @@ -59,7 +59,7 @@ void FreePathFinder::IncreaseCurrentVisit() } /// Pathfinder ( A* ), O(v lg v) --> Normal terrain (ignoring roads) for road building and free walking jobs -bool FreePathFinder::FindPathAlternatingConditions(const MapPoint start, const MapPoint dest, const bool randomRoute, +bool FreePathFinder::findPathAlternatingConditions(const MapPoint start, const MapPoint dest, const bool randomRoute, const unsigned maxLength, std::vector* route, unsigned* length, Direction* firstDir, FP_Node_OK_Callback IsNodeOK, FP_Node_OK_Callback IsNodeOKAlternate, @@ -83,7 +83,7 @@ bool FreePathFinder::FindPathAlternatingConditions(const MapPoint start, const M } // increase currentVisit, so we don't have to clear the visited-states at every run - IncreaseCurrentVisit(); + increaseCurrentVisit(); std::list todo; const unsigned destId = gwb_.getIdx(dest); @@ -93,7 +93,7 @@ bool FreePathFinder::FindPathAlternatingConditions(const MapPoint start, const M // Add start node unsigned startId = gwb_.getIdx(start); - todo.push_back(PathfindingPoint(startId, gwb_.CalcDistance(start, dest), 0)); + todo.push_back(PathfindingPoint(startId, gwb_.calcDistance(start, dest), 0)); // And init it nodes[startId].prevEven = INVALID_PREV; nodes[startId].lastVisitedEven = currentVisit; @@ -212,13 +212,13 @@ bool FreePathFinder::FindPathAlternatingConditions(const MapPoint start, const M } bool tooClose = helpers::contains_if(evenLocationsOnRoute, [this, neighbourPos](const MapPoint& it) { - return gwb_.CalcDistance(neighbourPos, it) < 2; + return gwb_.calcDistance(neighbourPos, it) < 2; }); if(tooClose) continue; - if(gwb_.CalcDistance(neighbourPos, start) < 2) + if(gwb_.calcDistance(neighbourPos, start) < 2) continue; - if(gwb_.CalcDistance(neighbourPos, dest) < 2) + if(gwb_.calcDistance(neighbourPos, dest) < 2) continue; } } @@ -246,7 +246,7 @@ bool FreePathFinder::FindPathAlternatingConditions(const MapPoint start, const M nodes[nbId].prevEven = bestId; } - todo.push_back(PathfindingPoint(nbId, gwb_.CalcDistance(neighbourPos, dest), way)); + todo.push_back(PathfindingPoint(nbId, gwb_.calcDistance(neighbourPos, dest), way)); // pf_nodes[xaid].it_p = ret.first; } } diff --git a/libs/s25main/pathfinding/FreePathFinder.h b/libs/s25main/pathfinding/FreePathFinder.h index e50d58c2da..6a7d15e12f 100644 --- a/libs/s25main/pathfinding/FreePathFinder.h +++ b/libs/s25main/pathfinding/FreePathFinder.h @@ -30,19 +30,19 @@ class FreePathFinder /// TNodeChecker must implement: bool IsNodeOk(MapPoint pt, unsigned char dirFromPrevPt) and bool /// IsNodeToDestOk(MapPoint pt, unsigned char dirFromPrevPt) template - bool FindPath(MapPoint start, MapPoint dest, bool randomRoute, unsigned maxLength, std::vector* route, + bool findPath(MapPoint start, MapPoint dest, bool randomRoute, unsigned maxLength, std::vector* route, unsigned* length, Direction* firstDir, const TNodeChecker& nodeChecker); - bool FindPathAlternatingConditions(MapPoint start, MapPoint dest, bool randomRoute, unsigned maxLength, + bool findPathAlternatingConditions(MapPoint start, MapPoint dest, bool randomRoute, unsigned maxLength, std::vector* route, unsigned* length, Direction* firstDir, FP_Node_OK_Callback IsNodeOK, FP_Node_OK_Callback IsNodeOKAlternate, FP_Node_OK_Callback IsNodeToDestOk, const void* param); /// Ermittelt, ob eine freie Route noch passierbar ist und gibt den Endpunkt der Route zurück template - bool CheckRoute(MapPoint start, const std::vector& route, unsigned pos, const TNodeChecker& nodeChecker, + bool checkRoute(MapPoint start, const std::vector& route, unsigned pos, const TNodeChecker& nodeChecker, MapPoint* dest) const; private: - void IncreaseCurrentVisit(); + void increaseCurrentVisit(); }; diff --git a/libs/s25main/pathfinding/FreePathFinderImpl.h b/libs/s25main/pathfinding/FreePathFinderImpl.h index eab268f079..0fd4e58730 100644 --- a/libs/s25main/pathfinding/FreePathFinderImpl.h +++ b/libs/s25main/pathfinding/FreePathFinderImpl.h @@ -38,14 +38,14 @@ struct GetEstimatedDistance using QueueImpl = OpenListBinaryHeap; template -bool FreePathFinder::FindPath(const MapPoint start, const MapPoint dest, bool randomRoute, unsigned maxLength, +bool FreePathFinder::findPath(const MapPoint start, const MapPoint dest, bool randomRoute, unsigned maxLength, std::vector* route, unsigned* length, Direction* firstDir, const TNodeChecker& nodeChecker) { RTTR_Assert(start != dest); // increase currentVisit, so we don't have to clear the visited-states at every run - IncreaseCurrentVisit(); + increaseCurrentVisit(); QueueImpl todo; const unsigned startId = gwb_.getIdx(start); @@ -54,7 +54,7 @@ bool FreePathFinder::FindPath(const MapPoint start, const MapPoint dest, bool ra FreePathNode& destNode = fpNodes[destId]; // Anfangsknoten einfügen Und mit entsprechenden Werten füllen - startNode.targetDistance = gwb_.CalcDistance(start, dest); + startNode.targetDistance = gwb_.calcDistance(start, dest); startNode.estimatedDistance = startNode.targetDistance; startNode.lastVisited = currentVisit; startNode.prev = nullptr; @@ -150,7 +150,7 @@ bool FreePathFinder::FindPath(const MapPoint start, const MapPoint dest, bool ra // Alles in Ordnung, Knoten kann gebildet werden neighbour.lastVisited = currentVisit; neighbour.curDistance = best.curDistance + 1; - neighbour.targetDistance = gwb_.CalcDistance(neighbourPos, dest); + neighbour.targetDistance = gwb_.calcDistance(neighbourPos, dest); neighbour.estimatedDistance = neighbour.curDistance + neighbour.targetDistance; neighbour.dir = dir; neighbour.prev = &best; @@ -166,7 +166,7 @@ bool FreePathFinder::FindPath(const MapPoint start, const MapPoint dest, bool ra /// Ermittelt, ob eine freie Route noch passierbar ist und gibt den Endpunkt der Route zurück template -bool FreePathFinder::CheckRoute(const MapPoint start, const std::vector& route, unsigned pos, +bool FreePathFinder::checkRoute(const MapPoint start, const std::vector& route, unsigned pos, const TNodeChecker& nodeChecker, MapPoint* dest) const { RTTR_Assert(pos < route.size()); diff --git a/libs/s25main/pathfinding/OpenListBinaryHeap.h b/libs/s25main/pathfinding/OpenListBinaryHeap.h index b0b819dd6d..ca1846a96a 100644 --- a/libs/s25main/pathfinding/OpenListBinaryHeap.h +++ b/libs/s25main/pathfinding/OpenListBinaryHeap.h @@ -53,10 +53,10 @@ class OpenListBinaryHeap : T_GetKey void rearrange(T* el) { decreasedKey(el); } protected: - static size_type NoPos() { return std::numeric_limits::max(); } - static size_type ParentPos(size_type pos) { return (pos - 1) / 2; } - static size_type LeftChildPos(size_type pos) { return (2 * pos) + 1; } - static size_type RightChildPos(size_type pos) { return (2 * pos) + 2; } + static size_type noPos() { return std::numeric_limits::max(); } + static size_type parentPos(size_type pos) { return (pos - 1) / 2; } + static size_type leftChildPos(size_type pos) { return (2 * pos) + 1; } + static size_type rightChildPos(size_type pos) { return (2 * pos) + 2; } bool isHeap() const; bool arePositionsValid() const; @@ -85,8 +85,8 @@ bool OpenListBinaryHeap::isHeap() const size_type size = this->size(); for(size_type i = 0; i < size; i++) { - const size_type left = LeftChildPos(i); - const size_type right = RightChildPos(i); + const size_type left = leftChildPos(i); + const size_type right = rightChildPos(i); // If child exist, parent must be "less" than child if(left < size && getKey(left) < getKey(i)) return false; @@ -131,13 +131,13 @@ inline void OpenListBinaryHeap::decreasedKey(T* el) RTTR_Assert(i < this->size()); while(i > 0) { - const unsigned parentPos = ParentPos(i); - if(elVal >= this->elements[parentPos].key) + const unsigned parent = parentPos(i); + if(elVal >= this->elements[parent].key) break; using std::swap; - getPos(this->elements[parentPos].el) = i; - swap(this->elements[parentPos], this->elements[i]); - i = parentPos; + getPos(this->elements[parent].el) = i; + swap(this->elements[parent], this->elements[i]); + i = parent; } getPos(el) = i; RTTR_VALIDATE_HEAP(); @@ -170,10 +170,10 @@ inline T* OpenListBinaryHeap::pop() do { // Now check if the heap condition is violated for the current position - const size_type left = LeftChildPos(i); + const size_type left = leftChildPos(i); if(left >= size) break; // No child? -> All ok - const size_type right = RightChildPos(i); + const size_type right = rightChildPos(i); const unsigned leftVal = this->elements[left].key; if(leftVal < el.key) // left < i { diff --git a/libs/s25main/pathfinding/RoadPathFinder.cpp b/libs/s25main/pathfinding/RoadPathFinder.cpp index 70b75a3215..eb87c91dd7 100644 --- a/libs/s25main/pathfinding/RoadPathFinder.cpp +++ b/libs/s25main/pathfinding/RoadPathFinder.cpp @@ -104,7 +104,7 @@ struct And : private T_Func1, private T_Func2 /// \tparam T_AdditionalCosts Cost for each road segment but the one to the goal building /// \tparam T_SegmentConstraints Predicate whether a road is allowed template -bool RoadPathFinder::FindPathImpl(const noRoadNode& start, const noRoadNode& goal, const unsigned max, +bool RoadPathFinder::findPathImpl(const noRoadNode& start, const noRoadNode& goal, const unsigned max, const T_AdditionalCosts addCosts, const T_SegmentConstraints isSegmentAllowed, unsigned* const length, RoadPathDirection* const firstDir, MapPoint* const firstNodePos) @@ -148,7 +148,7 @@ bool RoadPathFinder::FindPathImpl(const noRoadNode& start, const noRoadNode& goa todo.clear(); const MapPoint goalPos = goal.getPos(); - start.targetDistance = gwb_.CalcDistance(start.getPos(), goalPos); + start.targetDistance = gwb_.calcDistance(start.getPos(), goalPos); start.estimate = start.targetDistance; start.last_visit = currentVisit; start.prev = nullptr; @@ -240,7 +240,7 @@ bool RoadPathFinder::FindPathImpl(const noRoadNode& start, const noRoadNode& goa { // Not visited yet -> Add to list neighbour->cost = cost; - neighbour->targetDistance = gwb_.CalcDistance(neighbour->getPos(), goalPos); + neighbour->targetDistance = gwb_.calcDistance(neighbour->getPos(), goalPos); neighbour->estimate = neighbour->targetDistance + cost; neighbour->last_visit = currentVisit; neighbour->prev = &best; @@ -277,7 +277,7 @@ bool RoadPathFinder::FindPathImpl(const noRoadNode& start, const noRoadNode& goa { // Not visited yet -> Add to list dest.cost = cost; - dest.targetDistance = gwb_.CalcDistance(dest.getPos(), goalPos); + dest.targetDistance = gwb_.calcDistance(dest.getPos(), goalPos); dest.estimate = dest.targetDistance + cost; dest.last_visit = currentVisit; dest.prev = &best; @@ -292,7 +292,7 @@ bool RoadPathFinder::FindPathImpl(const noRoadNode& start, const noRoadNode& goa return false; } -bool RoadPathFinder::FindPath(const noRoadNode& start, const noRoadNode& goal, const bool wareMode, const unsigned max, +bool RoadPathFinder::findPath(const noRoadNode& start, const noRoadNode& goal, const bool wareMode, const unsigned max, const RoadSegment* const forbidden, unsigned* const length, RoadPathDirection* const firstDir, MapPoint* const firstNodePos) { @@ -302,25 +302,25 @@ bool RoadPathFinder::FindPath(const noRoadNode& start, const noRoadNode& goal, c { // TODO(Replay): Change to target flag instead of its attached building if(forbidden) - return FindPathImpl(start, goal, max, AdditonalCosts::Carrier(), + return findPathImpl(start, goal, max, AdditonalCosts::Carrier(), SegmentConstraints::AvoidSegment(forbidden), length, firstDir, firstNodePos); else - return FindPathImpl(start, goal, max, AdditonalCosts::Carrier(), SegmentConstraints::None(), length, + return findPathImpl(start, goal, max, AdditonalCosts::Carrier(), SegmentConstraints::None(), length, firstDir, firstNodePos); } else { if(forbidden) - return FindPathImpl(start, goal, max, AdditonalCosts::None(), + return findPathImpl(start, goal, max, AdditonalCosts::None(), SegmentConstraints::And>(forbidden), length, firstDir, firstNodePos); else - return FindPathImpl(start, goal, max, AdditonalCosts::None(), + return findPathImpl(start, goal, max, AdditonalCosts::None(), SegmentConstraints::AvoidRoadType(), length, firstDir, firstNodePos); } } -bool RoadPathFinder::PathExists(const noRoadNode& start, const noRoadNode& goal, const bool allowWaterRoads, +bool RoadPathFinder::pathExists(const noRoadNode& start, const noRoadNode& goal, const bool allowWaterRoads, const unsigned max, const RoadSegment* const forbidden) { if(allowWaterRoads) @@ -328,17 +328,17 @@ bool RoadPathFinder::PathExists(const noRoadNode& start, const noRoadNode& goal, // TODO(Replay): Change to target flag instead of its attached building. // Likely combine with RoadPathFinder::FindPath if(forbidden) - return FindPathImpl(start, goal, max, AdditonalCosts::None(), SegmentConstraints::AvoidSegment(forbidden)); + return findPathImpl(start, goal, max, AdditonalCosts::None(), SegmentConstraints::AvoidSegment(forbidden)); else - return FindPathImpl(start, goal, max, AdditonalCosts::None(), SegmentConstraints::None()); + return findPathImpl(start, goal, max, AdditonalCosts::None(), SegmentConstraints::None()); } else { if(forbidden) - return FindPathImpl(start, goal, max, AdditonalCosts::None(), + return findPathImpl(start, goal, max, AdditonalCosts::None(), SegmentConstraints::And>(forbidden)); else - return FindPathImpl(start, goal, max, AdditonalCosts::None(), + return findPathImpl(start, goal, max, AdditonalCosts::None(), SegmentConstraints::AvoidRoadType()); } } diff --git a/libs/s25main/pathfinding/RoadPathFinder.h b/libs/s25main/pathfinding/RoadPathFinder.h index ccebdf87de..22d7cda3ba 100644 --- a/libs/s25main/pathfinding/RoadPathFinder.h +++ b/libs/s25main/pathfinding/RoadPathFinder.h @@ -31,7 +31,7 @@ class RoadPathFinder /// @param length If != nullptr will receive the final costs /// @param firstDir If != nullptr will receive the first direction to travel /// @param firstNodePos If != nullptr will receive the position of the first node - bool FindPath(const noRoadNode& start, const noRoadNode& goal, bool wareMode, + bool findPath(const noRoadNode& start, const noRoadNode& goal, bool wareMode, unsigned max = std::numeric_limits::max(), const RoadSegment* forbidden = nullptr, unsigned* length = nullptr, RoadPathDirection* firstDir = nullptr, MapPoint* firstNodePos = nullptr); @@ -40,12 +40,12 @@ class RoadPathFinder /// @param allowWaterRoads True to allow boat roads (mostly: Ware=true, Person=false) /// @param max Maximum costs allowed (Usually makes pathfinding faster) /// @param forbidden RoadSegment that will be ignored - bool PathExists(const noRoadNode& start, const noRoadNode& goal, bool allowWaterRoads, + bool pathExists(const noRoadNode& start, const noRoadNode& goal, bool allowWaterRoads, unsigned max = std::numeric_limits::max(), const RoadSegment* forbidden = nullptr); private: template - bool FindPathImpl(const noRoadNode& start, const noRoadNode& goal, unsigned max, T_AdditionalCosts addCosts, + bool findPathImpl(const noRoadNode& start, const noRoadNode& goal, unsigned max, T_AdditionalCosts addCosts, T_SegmentConstraints isSegmentAllowed, unsigned* length = nullptr, RoadPathDirection* firstDir = nullptr, MapPoint* firstNodePos = nullptr); }; diff --git a/libs/s25main/pathfinding/ShipPathData.cpp b/libs/s25main/pathfinding/ShipPathData.cpp index a19fe72e8e..d62617623d 100644 --- a/libs/s25main/pathfinding/ShipPathData.cpp +++ b/libs/s25main/pathfinding/ShipPathData.cpp @@ -89,7 +89,7 @@ void ShipPathData::initHarborConnections() const auto nbPoint = world_.getCoastalPoint(nb.id, nb.sea); const bool found = (startPoint == nbPoint) - || world_.FindShipPath(startPoint, nbPoint, nb.distance, &curConnections.back().route, &len); + || world_.findShipPath(startPoint, nbPoint, nb.distance, &curConnections.back().route, &len); RTTR_Assert(found); RTTR_Assert(len == nb.distance); } diff --git a/libs/s25main/postSystem/DiplomacyPostQuestion.cpp b/libs/s25main/postSystem/DiplomacyPostQuestion.cpp index 3477bdcaa7..fdd1bf6af9 100644 --- a/libs/s25main/postSystem/DiplomacyPostQuestion.cpp +++ b/libs/s25main/postSystem/DiplomacyPostQuestion.cpp @@ -19,7 +19,7 @@ DiplomacyPostQuestion::DiplomacyPostQuestion(unsigned sendFrame, PactType pact, text += _("Duration: Forever"); else text += boost::str(boost::format(_("Duration: %d GF (%s)")) % duration - % GAMECLIENT.FormatGFTime(static_cast(duration))); + % GAMECLIENT.formatGFTime(static_cast(duration))); setText(text); } diff --git a/libs/s25main/postSystem/PostBox.cpp b/libs/s25main/postSystem/PostBox.cpp index a6dfc8501f..7cd8b6009d 100644 --- a/libs/s25main/postSystem/PostBox.cpp +++ b/libs/s25main/postSystem/PostBox.cpp @@ -10,34 +10,34 @@ PostBox::PostBox() = default; PostBox::~PostBox() = default; -void PostBox::AddMsg(std::unique_ptr msg) +void PostBox::addMsg(std::unique_ptr msg) { if(numMessages == MAX_MESSAGES) - DeleteMsg(0, false); + deleteMsg(0, false); messages[numMessages] = std::move(msg); numMessages++; if(evNewMsg) evNewMsg(*messages[numMessages - 1u], numMessages); } -bool PostBox::DeleteMsg(const PostMsg* msg) +bool PostBox::deleteMsg(const PostMsg* msg) { if(!msg) return false; for(unsigned i = 0; i < numMessages; ++i) { if(messages[i].get() == msg) - return DeleteMsg(i); + return deleteMsg(i); } return false; } -bool PostBox::DeleteMsg(unsigned idx) +bool PostBox::deleteMsg(unsigned idx) { - return DeleteMsg(idx, true); + return deleteMsg(idx, true); } -bool PostBox::DeleteMsg(unsigned idx, bool notify) +bool PostBox::deleteMsg(unsigned idx, bool notify) { if(idx >= numMessages) return false; @@ -50,10 +50,10 @@ bool PostBox::DeleteMsg(unsigned idx, bool notify) return true; } -void PostBox::Clear() +void PostBox::clear() { for(unsigned i = numMessages; i > 0; --i) - DeleteMsg(i - 1); + deleteMsg(i - 1); } const PostMsg* PostBox::getMsg(unsigned idx) const diff --git a/libs/s25main/postSystem/PostBox.h b/libs/s25main/postSystem/PostBox.h index 40f74e0ed8..f6e0c1e691 100644 --- a/libs/s25main/postSystem/PostBox.h +++ b/libs/s25main/postSystem/PostBox.h @@ -21,22 +21,22 @@ class PostBox ~PostBox(); /// Add the message, possibly deleting the oldest message - void AddMsg(std::unique_ptr msg); + void addMsg(std::unique_ptr msg); /// Delete the message. Return true, when it existed - bool DeleteMsg(const PostMsg* msg); + bool deleteMsg(const PostMsg* msg); /// Delete the message by its index. Return true, if it was valid /// Oldest message is at index 0 - bool DeleteMsg(unsigned idx); - void Clear(); + bool deleteMsg(unsigned idx); + void clear(); unsigned getNumMsgs() const { return numMessages; } static constexpr unsigned getMaxMsgs() { return MAX_MESSAGES; } /// Get message by index or nullptr if invalid index /// Oldest message is at index 0 const PostMsg* getMsg(unsigned idx) const; /// Set callback that receives new message and message count everytime a message is added - void ObserveNewMsg(const NewMsgCallback& callback) { evNewMsg = callback; } + void observeNewMsg(const NewMsgCallback& callback) { evNewMsg = callback; } /// Set callback that receives new message count everytime a message is deleted - void ObserveDeletedMsg(const MsgDeletedCallback& callback) { evDelMsg = callback; } + void observeDeletedMsg(const MsgDeletedCallback& callback) { evDelMsg = callback; } /// Sets the current goal as shown in the post window void setCurrentMissionGoal(const std::string& goal); @@ -44,7 +44,7 @@ class PostBox private: static constexpr unsigned MAX_MESSAGES = 20; - bool DeleteMsg(unsigned idx, bool notify); + bool deleteMsg(unsigned idx, bool notify); std::array, MAX_MESSAGES> messages; unsigned numMessages = 0; /// Current mission goal. Shown as a special message diff --git a/libs/s25main/postSystem/PostManager.cpp b/libs/s25main/postSystem/PostManager.cpp index efdaab5390..39b84b8739 100644 --- a/libs/s25main/postSystem/PostManager.cpp +++ b/libs/s25main/postSystem/PostManager.cpp @@ -11,7 +11,7 @@ PostManager::PostManager() = default; PostManager::~PostManager() = default; -PostBox& PostManager::AddPostBox(unsigned player) +PostBox& PostManager::addPostBox(unsigned player) { if(player >= postBoxes.size()) throw std::out_of_range("Invalid player for new postbox"); @@ -26,16 +26,16 @@ PostBox* PostManager::getPostBox(unsigned player) const return (player < postBoxes.size()) ? postBoxes[player].get() : nullptr; } -void PostManager::RemovePostBox(unsigned player) +void PostManager::removePostBox(unsigned player) { postBoxes[player].reset(); } -void PostManager::SendMsg(unsigned player, std::unique_ptr msg) const +void PostManager::sendMsg(unsigned player, std::unique_ptr msg) const { PostBox* box = getPostBox(player); if(box) - box->AddMsg(std::move(msg)); + box->addMsg(std::move(msg)); } void PostManager::setMissionGoal(unsigned player, const std::string& newGoal) const diff --git a/libs/s25main/postSystem/PostManager.h b/libs/s25main/postSystem/PostManager.h index 39627d172b..405b965839 100644 --- a/libs/s25main/postSystem/PostManager.h +++ b/libs/s25main/postSystem/PostManager.h @@ -17,10 +17,10 @@ class PostManager public: PostManager(); ~PostManager(); - PostBox& AddPostBox(unsigned player); + PostBox& addPostBox(unsigned player); PostBox* getPostBox(unsigned player) const; - void RemovePostBox(unsigned player); - void SendMsg(unsigned player, std::unique_ptr msg) const; + void removePostBox(unsigned player); + void sendMsg(unsigned player, std::unique_ptr msg) const; void setMissionGoal(unsigned player, const std::string& newGoal) const; private: diff --git a/libs/s25main/postSystem/PostMsg.cpp b/libs/s25main/postSystem/PostMsg.cpp index 6fb173276a..ac11028a51 100644 --- a/libs/s25main/postSystem/PostMsg.cpp +++ b/libs/s25main/postSystem/PostMsg.cpp @@ -13,12 +13,12 @@ PostMsg::PostMsg(unsigned sendFrame, std::string text, PostCategory cat, const M {} PostMsg::PostMsg(unsigned sendFrame, std::string text, PostCategory cat, SoundEffect soundEffect) - : sendFrame_(sendFrame), text_(std::move(text)), cat_(cat), pt_(MapPoint::Invalid()), soundEffect_(soundEffect) + : sendFrame_(sendFrame), text_(std::move(text)), cat_(cat), pt_(MapPoint::invalid()), soundEffect_(soundEffect) {} PostMsg::PostMsg(unsigned sendFrame, PactType pt, const BasePlayerInfo& otherPlayer, bool acceptedOrCanceled, SoundEffect soundEffect) - : sendFrame_(sendFrame), cat_(PostCategory::Diplomacy), pt_(MapPoint::Invalid()), soundEffect_(soundEffect) + : sendFrame_(sendFrame), cat_(PostCategory::Diplomacy), pt_(MapPoint::invalid()), soundEffect_(soundEffect) { if(acceptedOrCanceled) { diff --git a/libs/s25main/postSystem/PostMsgWithBuilding.h b/libs/s25main/postSystem/PostMsgWithBuilding.h index dd5ff585e8..87e2e7c7aa 100644 --- a/libs/s25main/postSystem/PostMsgWithBuilding.h +++ b/libs/s25main/postSystem/PostMsgWithBuilding.h @@ -20,7 +20,7 @@ class PostMsgWithBuilding : public PostMsg PostMsgWithBuilding(unsigned sendFrame, const std::string& text, PostCategory cat, const noBaseBuilding& bld, SoundEffect soundEffect = SoundEffect::Pidgeon); PostMsgWithBuilding(unsigned sendFrame, const std::string& text, PostCategory cat, BuildingType bld, Nation nation, - const MapPoint& pos = MapPoint::Invalid()); + const MapPoint& pos = MapPoint::invalid()); ITexture* getImage() const override; diff --git a/libs/s25main/random/Random.cpp b/libs/s25main/random/Random.cpp index 1821638c46..a20cb9ce98 100644 --- a/libs/s25main/random/Random.cpp +++ b/libs/s25main/random/Random.cpp @@ -24,18 +24,18 @@ Random::Random() template void Random::Init(const uint64_t& seed) { - ResetState(PRNG(static_cast(seed))); + resetState(PRNG(static_cast(seed))); } template -void Random::ResetState(const PRNG& newState) +void Random::resetState(const PRNG& newState) { rng_ = newState; numInvocations_ = 0; } template -int Random::Rand(const RandomContext& context, const int maxExcl) +int Random::rand(const RandomContext& context, const int maxExcl) { history_[numInvocations_ % history_.size()] = RandomEntry(numInvocations_, maxExcl, rng_, context); ++numInvocations_; @@ -46,11 +46,11 @@ int Random::Rand(const RandomContext& context, const int maxExcl) template unsigned Random::getChecksum() const { - return CalcChecksum(rng_); + return calcChecksum(rng_); } template -unsigned Random::CalcChecksum(const PRNG& rng) +unsigned Random::calcChecksum(const PRNG& rng) { // This is designed in a way that makes the checksum be equivalent // to the state of the OldLCG for compatibility with old versions diff --git a/libs/s25main/random/Random.h b/libs/s25main/random/Random.h index 38e5e977ec..c0d1201f38 100644 --- a/libs/s25main/random/Random.h +++ b/libs/s25main/random/Random.h @@ -61,13 +61,13 @@ class Random : public Singleton> /// Initialize the rng with a given seed void Init(const uint64_t& seed); /// Reset the Random class to start from a given state - void ResetState(const PRNG& newState); + void resetState(const PRNG& newState); /// Return a random number in the range [0, maxExcl) - int Rand(const RandomContext& context, int maxExcl); + int rand(const RandomContext& context, int maxExcl); /// Get a checksum of the RNG unsigned getChecksum() const; - static unsigned CalcChecksum(const PRNG& rng); + static unsigned calcChecksum(const PRNG& rng); /// Get current rng state const PRNG& getCurrentState() const; @@ -96,7 +96,7 @@ using RandomEntry = UsedRandom::RandomEntry; RandomContext { __FILE__, __LINE__, objId } /// Shortcut to get a new random value in range [0, maxVal) for a given object id /// Note: maxVal has to be small (at least <= 32768) -#define RANDOM_RAND(maxValExcl) RANDOM.Rand(RANDOM_CONTEXT(), maxValExcl) +#define RANDOM_RAND(maxValExcl) RANDOM.rand(RANDOM_CONTEXT(), maxValExcl) /// Return a random element from the container. Must not be empty #define RANDOM_ELEMENT(container) detail::randomElement(container, RANDOM_CONTEXT()) /// Return a random enumerator of the given type. Requires the include @@ -110,7 +110,7 @@ template auto randomElement(const T& container, const RandomContext& ctx) { RTTR_Assert(!container.empty()); - return *(container.begin() + RANDOM.Rand(ctx, container.size())); + return *(container.begin() + RANDOM.rand(ctx, container.size())); } template static void shuffleContainer(T& container, const RandomContext& ctx) @@ -120,7 +120,7 @@ static void shuffleContainer(T& container, const RandomContext& ctx) for(int i = container.size() - 1; i > 0; --i) { using std::swap; - swap(container[i], container[RANDOM.Rand(ctx, i + 1)]); + swap(container[i], container[RANDOM.rand(ctx, i + 1)]); } } } // namespace detail diff --git a/libs/s25main/world/GameWorld.cpp b/libs/s25main/world/GameWorld.cpp index c44015a676..d45947fb99 100644 --- a/libs/s25main/world/GameWorld.cpp +++ b/libs/s25main/world/GameWorld.cpp @@ -56,12 +56,12 @@ inline std::vector CreatePlayers(const std::vector& play GameWorld::GameWorld(const std::vector& players, const GlobalGameSettings& gameSettings, EventManager& em) : GameWorldBase(CreatePlayers(players, *this), gameSettings, em) { - GameObject::AttachWorld(this); + GameObject::attachWorld(this); } GameWorld::~GameWorld() { - GameObject::DetachWorld(this); + GameObject::detachWorld(this); } MilitarySquares& GameWorld::getMilitarySquares() @@ -80,10 +80,10 @@ bool GameWorld::SetFlag(const MapPoint pt, const unsigned char player) // Gucken, nicht, dass schon eine Flagge dasteht if(getNO(pt)->getType() != NodalObjectType::Flag) { - DestroyNO(pt, false); + destroyNO(pt, false); setNO(pt, new noFlag(pt, player)); - RecalcBQAroundPointBig(pt); + recalcBQAroundPointBig(pt); } return true; } @@ -109,10 +109,10 @@ void GameWorld::DestroyFlag(const MapPoint pt, unsigned char playerId) } // Demolish, also the building - flag->DestroyAttachedBuilding(); + flag->destroyAttachedBuilding(); - DestroyNO(pt, false); - RecalcBQAroundPointBig(pt); + destroyNO(pt, false); + recalcBQAroundPointBig(pt); } if(gi) @@ -149,7 +149,7 @@ void GameWorld::SetBuildingSite(const BuildingType type, const MapPoint pt, cons if(type == BuildingType::Catapult && !getPlayer(player).canBuildCatapult()) return; - DestroyNO(pt, false); + destroyNO(pt, false); // Baustelle setzen setNO(pt, new noBuildingSite(type, pt, player)); @@ -157,7 +157,7 @@ void GameWorld::SetBuildingSite(const BuildingType type, const MapPoint pt, cons gi->GI_UpdateMinimap(pt); // Bauplätze drumrum neu berechnen - RecalcBQAroundPointBig(pt); + recalcBQAroundPointBig(pt); } void GameWorld::DestroyBuilding(const MapPoint pt, const unsigned char player) @@ -180,9 +180,9 @@ void GameWorld::DestroyBuilding(const MapPoint pt, const unsigned char player) return; } - DestroyNO(pt); + destroyNO(pt); // Bauplätze drumrum neu berechnen - RecalcBQAroundPointBig(pt); + recalcBQAroundPointBig(pt); } } @@ -213,7 +213,7 @@ MapPoint GameWorld::BuildRoad(const unsigned char playerId, const bool boat_road if(!roadOk) { // No? Then check whether the desired road is already there - if(!RoadAlreadyBuilt(boat_road, start, route)) + if(!roadAlreadyBuilt(boat_road, start, route)) getNotifications().publish(RoadNote(RoadNote::ConstructionFailed, playerId, start, route)); return {}; } @@ -238,18 +238,18 @@ MapPoint GameWorld::BuildRoad(const unsigned char playerId, const bool boat_road // Destroy possible decorative objects at start if(hasRemovableObjForRoad(start)) - DestroyNO(start); + destroyNO(start); curPt = start; for(auto i : route) { setPointRoad(curPt, i, boat_road ? PointRoad::Boat : PointRoad::Normal); - RecalcBQForRoad(curPt); + recalcBQForRoad(curPt); curPt = getNeighbour(curPt, i); // Destroy possible decorative objects at end if(hasRemovableObjForRoad(curPt)) - DestroyNO(curPt); + destroyNO(curPt); } auto* rs = new RoadSegment(boat_road ? RoadType::Water : RoadType::Normal, getSpecObj(start), @@ -259,7 +259,7 @@ MapPoint GameWorld::BuildRoad(const unsigned char playerId, const bool boat_road getSpecObj(endPt)->setRoute(route.back() + 3u, rs); // Tell the economy that a new road has been built - getPlayer(playerId).NewRoadConnection(rs); + getPlayer(playerId).newRoadConnection(rs); getNotifications().publish(RoadNote(RoadNote::Constructed, playerId, start, route)); // Add flags on land roads for human players if addon is enabled @@ -287,7 +287,7 @@ bool GameWorld::hasRemovableObjForRoad(const MapPoint pt) const // tries to fix // #define PREVENT_BORDER_STONE_BLOCKING -void GameWorld::RecalcBorderStones(Position startPt, Extent areaSize) +void GameWorld::recalcBorderStones(Position startPt, Extent areaSize) { // Add a bit extra space as this influences also border stones around the region // But not so much we wrap completely around the map (+1 to round up, /2 to have extra space centered) @@ -305,7 +305,7 @@ void GameWorld::RecalcBorderStones(Position startPt, Extent areaSize) RTTR_FOREACH_PT(Position, areaSize) { // Make map point - const MapPoint curMapPt = MakeMapPoint(pt + startPt); + const MapPoint curMapPt = makeMapPoint(pt + startPt); const unsigned char owner = getNode(curMapPt).owner; BoundaryStones& boundaryStones = getBoundaryStones(curMapPt); @@ -341,7 +341,7 @@ void GameWorld::RecalcBorderStones(Position startPt, Extent areaSize) // Do a second pass and delete some stones with 3 or more neighbors to avoid blocks of stones RTTR_FOREACH_PT(Position, areaSize) { - const MapPoint curMapPt = MakeMapPoint(pt + startPt); + const MapPoint curMapPt = makeMapPoint(pt + startPt); // Do we have a stone here? const unsigned char owner = getNode(curMapPt).boundary_stones[BorderStonePos::OnPoint]; @@ -376,7 +376,7 @@ void GameWorld::RecalcBorderStones(Position startPt, Extent areaSize) #endif } -void GameWorld::RecalcTerritory(const noBaseBuilding& building, TerritoryChangeReason reason) +void GameWorld::recalcTerritory(const noBaseBuilding& building, TerritoryChangeReason reason) { // Additional radius to eliminate border stones or odd remaining territory parts static const int ADD_RADIUS = 2; @@ -387,7 +387,7 @@ void GameWorld::RecalcTerritory(const noBaseBuilding& building, TerritoryChangeR const unsigned militaryRadius = building.getMilitaryRadius(); RTTR_Assert(militaryRadius > 0u); - const TerritoryRegion region = CreateTerritoryRegion(building, militaryRadius + ADD_RADIUS, reason); + const TerritoryRegion region = createTerritoryRegion(building, militaryRadius + ADD_RADIUS, reason); std::vector ptsWithChangedOwners; std::vector sizeChanges(getNumPlayers()); @@ -395,7 +395,7 @@ void GameWorld::RecalcTerritory(const noBaseBuilding& building, TerritoryChangeR // Copy owners from territory region to map and do the bookkeeping RTTR_FOREACH_PT(Position, region.size) { - const MapPoint curMapPt = MakeMapPoint(pt + region.startPt); + const MapPoint curMapPt = makeMapPoint(pt + region.startPt); const uint8_t oldOwner = getNode(curMapPt).owner; const uint8_t newOwner = region.getOwner(pt); @@ -417,7 +417,7 @@ void GameWorld::RecalcTerritory(const noBaseBuilding& building, TerritoryChangeR for(const MapPoint& curMapPt : ptsToHandle) { // Do not destroy the triggering building or its flag - DestroyPlayerRests(curMapPt, getNode(curMapPt).owner, &building); + destroyPlayerRests(curMapPt, getNode(curMapPt).owner, &building); if(gi) gi->GI_UpdateMinimap(curMapPt); @@ -450,32 +450,32 @@ void GameWorld::RecalcTerritory(const noBaseBuilding& building, TerritoryChangeR for(const MapPoint& pt : ptsToHandle) { // BQ neu berechnen - RecalcBQ(pt); + recalcBQ(pt); // ggf den noch darüber, falls es eine Flagge war (kann ja ein Gebäude entstehen) const MapPoint neighbourPt = getNeighbour(pt, Direction::NorthWest); if(getNode(neighbourPt).bq != BuildingQuality::Nothing) - RecalcBQ(neighbourPt); + recalcBQ(neighbourPt); } - RecalcBorderStones(region.startPt, region.size); + recalcBorderStones(region.startPt, region.size); // Recalc visibilities if building was destroyed // Otherwise just set everything to visible const unsigned visualRadius = militaryRadius + VISUALRANGE_MILITARY; if(reason == TerritoryChangeReason::Destroyed) - RecalcVisibilitiesAroundPoint(building.getPos(), visualRadius, building.getPlayer(), &building); + recalcVisibilitiesAroundPoint(building.getPos(), visualRadius, building.getPlayer(), &building); else - MakeVisibleAroundPoint(building.getPos(), visualRadius, building.getPlayer()); + makeVisibleAroundPoint(building.getPos(), visualRadius, building.getPlayer()); // Notify players for(unsigned i = 0; i < getNumPlayers(); ++i) { - getPlayer(i).ChangeStatisticValue(StatisticType::Country, sizeChanges[i]); + getPlayer(i).changeStatisticValue(StatisticType::Country, sizeChanges[i]); // Negatives Wachstum per Post dem/der jeweiligen Landesherren/dame melden, nur bei neugebauten Gebäuden if(reason == TerritoryChangeReason::Build && sizeChanges[i] < 0) { - getPostMgr().SendMsg(i, std::make_unique(getEvMgr().getCurrentGF(), + getPostMgr().sendMsg(i, std::make_unique(getEvMgr().getCurrentGF(), _("Lost land by this building"), PostCategory::Military, building)); getNotifications().publish( @@ -491,12 +491,12 @@ void GameWorld::RecalcTerritory(const noBaseBuilding& building, TerritoryChangeR const uint8_t newOwner = getNode(pt).owner; // Event for map scripting if(newOwner != 0) - getLua().EventOccupied(newOwner - 1, pt); + getLua().eventOccupied(newOwner - 1, pt); } } } -bool GameWorld::DoesDestructionChangeTerritory(const noBaseBuilding& building) const +bool GameWorld::doesDestructionChangeTerritory(const noBaseBuilding& building) const { // Get the military radius this building affects. Bld is either a military building or a harbor building site RTTR_Assert( @@ -505,12 +505,12 @@ bool GameWorld::DoesDestructionChangeTerritory(const noBaseBuilding& building) c const unsigned militaryRadius = building.getMilitaryRadius(); RTTR_Assert(militaryRadius > 0u); - const TerritoryRegion region = CreateTerritoryRegion(building, militaryRadius, TerritoryChangeReason::Destroyed); + const TerritoryRegion region = createTerritoryRegion(building, militaryRadius, TerritoryChangeReason::Destroyed); // Look for a node that changed its owner and is important. If any -> return true RTTR_FOREACH_PT(Position, region.size) { - MapPoint curMapPt = MakeMapPoint(pt + region.startPt); + MapPoint curMapPt = makeMapPoint(pt + region.startPt); const MapNode& node = getNode(curMapPt); if(node.owner == region.getOwner(pt)) continue; @@ -530,7 +530,7 @@ bool GameWorld::DoesDestructionChangeTerritory(const noBaseBuilding& building) c return false; } -TerritoryRegion GameWorld::CreateTerritoryRegion(const noBaseBuilding& building, unsigned radius, +TerritoryRegion GameWorld::createTerritoryRegion(const noBaseBuilding& building, unsigned radius, TerritoryChangeReason reason) const { const MapPoint bldPos = building.getPos(); @@ -549,25 +549,25 @@ TerritoryRegion GameWorld::CreateTerritoryRegion(const noBaseBuilding& building, TerritoryRegion region(startPt, size, *this); // Alle Gebäude ihr Terrain in der Nähe neu berechnen - sortedMilitaryBlds buildings = LookForMilitaryBuildings(bldPos, 3); + sortedMilitaryBlds buildings = lookForMilitaryBuildings(bldPos, 3); for(const nobBaseMilitary* milBld : buildings) { if(reason != TerritoryChangeReason::Destroyed || milBld != &building) - region.CalcTerritoryOfBuilding(*milBld); + region.calcTerritoryOfBuilding(*milBld); } // Baustellen von Häfen mit einschließen for(const noBuildingSite* bldSite : harbor_building_sites_from_sea) { if(reason != TerritoryChangeReason::Destroyed || bldSite != &building) - region.CalcTerritoryOfBuilding(*bldSite); + region.calcTerritoryOfBuilding(*bldSite); } - CleanTerritoryRegion(region, reason, building); + cleanTerritoryRegion(region, reason, building); return region; } -void GameWorld::CleanTerritoryRegion(TerritoryRegion& region, TerritoryChangeReason reason, +void GameWorld::cleanTerritoryRegion(TerritoryRegion& region, TerritoryChangeReason reason, const noBaseBuilding& triggerBld) const { if(getGGS().isEnabled(AddonId::NO_ALLIED_PUSH)) @@ -582,7 +582,7 @@ void GameWorld::CleanTerritoryRegion(TerritoryRegion& region, TerritoryChangeRea RTTR_FOREACH_PT(Position, region.size) { - const MapPoint curMapPt = MakeMapPoint(pt + region.startPt); + const MapPoint curMapPt = makeMapPoint(pt + region.startPt); const auto oldOwner = getNode(curMapPt).owner; const auto newOwner = region.getOwner(pt); @@ -617,11 +617,11 @@ void GameWorld::CleanTerritoryRegion(TerritoryRegion& region, TerritoryChangeRea for(const auto d : helpers::EnumRange{}) { Position neighbour = ::getNeighbour(pt + region.startPt, d); - if(region.SafeGetOwner(neighbour - region.startPt) != owner) + if(region.safeGetOwner(neighbour - region.startPt) != owner) continue; // Don't check this point as it is always true const Direction exceptDir = d + 3u; - if(region.WillBePlayerTerritory(neighbour, owner, exceptDir)) + if(region.willBePlayerTerritory(neighbour, owner, exceptDir)) { isPlayerTerritoryNear = true; break; @@ -636,14 +636,14 @@ void GameWorld::CleanTerritoryRegion(TerritoryRegion& region, TerritoryChangeRea for(const auto d : helpers::EnumRange{}) { Position neighbour = ::getNeighbour(pt + region.startPt, d); - uint8_t nbOwner = region.SafeGetOwner(neighbour - region.startPt); + uint8_t nbOwner = region.safeGetOwner(neighbour - region.startPt); // No or same player? if(!nbOwner || nbOwner == owner) continue; // Don't check this point as it would always fail const Direction exceptDir = d + 3u; // First one found gets it - if(region.WillBePlayerTerritory(neighbour, nbOwner, exceptDir)) + if(region.willBePlayerTerritory(neighbour, nbOwner, exceptDir)) { newOwner = nbOwner; break; @@ -653,7 +653,7 @@ void GameWorld::CleanTerritoryRegion(TerritoryRegion& region, TerritoryChangeRea } } -void GameWorld::DestroyPlayerRests(const MapPoint pt, unsigned char newOwner, const noBaseBuilding* exception) +void GameWorld::destroyPlayerRests(const MapPoint pt, unsigned char newOwner, const noBaseBuilding* exception) { noBase* no = getNode(pt).obj; if(!no || no == exception) @@ -686,12 +686,12 @@ void GameWorld::DestroyPlayerRests(const MapPoint pt, unsigned char newOwner, co // If it is a flag, destroy the building if(noType == NodalObjectType::Flag && (!exception || no != exception->getFlag())) - static_cast(no)->DestroyAttachedBuilding(); + static_cast(no)->destroyAttachedBuilding(); - DestroyNO(pt, false); + destroyNO(pt, false); } -void GameWorld::RoadNodeAvailable(const MapPoint pt) +void GameWorld::roadNodeAvailable(const MapPoint pt) { // Figuren direkt daneben for(const MapPoint nb : getNeighbours(pt)) @@ -704,7 +704,7 @@ void GameWorld::RoadNodeAvailable(const MapPoint pt) for(noBase& object : getFigures(nb)) { if(object.getType() == NodalObjectType::Figure) - static_cast(object).NodeFreed(pt); + static_cast(object).nodeFreed(pt); } } } @@ -725,7 +725,7 @@ void GameWorld::Attack(const unsigned char player_attacker, const MapPoint pt, c return; // Militärgebäude in der Nähe finden - sortedMilitaryBlds buildings = LookForMilitaryBuildings(pt, 3); + sortedMilitaryBlds buildings = lookForMilitaryBuildings(pt, 3); // Liste von verfügbaren Soldaten, geordnet einfügen, damit man dann starke oder schwache Soldaten nehmen kann std::list potentialAttackers; @@ -743,7 +743,7 @@ void GameWorld::Attack(const unsigned char player_attacker, const MapPoint pt, c // Take soldier(s) unsigned curNumSoldiers = 0; - const unsigned distance = CalcDistance(building->getPos(), pt); + const unsigned distance = calcDistance(building->getPos(), pt); if(strong_soldiers) { // Strong soldiers first @@ -790,13 +790,13 @@ void GameWorld::Attack(const unsigned char player_attacker, const MapPoint pt, c { if(curNumSoldiers >= soldiers_count) break; - pa.soldier->getHome()->SendAttacker(pa.soldier, *attacked_building); + pa.soldier->getHome()->sendAttacker(pa.soldier, *attacked_building); curNumSoldiers++; } if(curNumSoldiers > 0 && hasLua()) { - getLua().EventAttack(player_attacker, attacked_building->getPlayer(), curNumSoldiers); + getLua().eventAttack(player_attacker, attacked_building->getPlayer(), curNumSoldiers); } } @@ -822,7 +822,7 @@ struct CmpSeaAttacker : private T_RankCmp } }; -void GameWorld::AttackViaSea(const unsigned char player_attacker, const MapPoint pt, +void GameWorld::attackViaSea(const unsigned char player_attacker, const MapPoint pt, const unsigned short soldiers_count, const bool strong_soldiers) { // Verfügbare Soldaten herausfinden @@ -842,13 +842,13 @@ void GameWorld::AttackViaSea(const unsigned char player_attacker, const MapPoint { if(counter >= soldiers_count) break; - pa.soldier->getHome()->SendAttacker(pa.soldier, attacked_building, pa.harbor); + pa.soldier->getHome()->sendAttacker(pa.soldier, attacked_building, pa.harbor); counter++; } if(counter > 0 && hasLua()) { - getLua().EventAttack(player_attacker, attacked_building.getPlayer(), counter); + getLua().eventAttack(player_attacker, attacked_building.getPlayer(), counter); } } @@ -900,7 +900,7 @@ bool GameWorld::isRoadNodeForFigures(const MapPoint pt) } /// Lässt alle Figuren, die auf diesen Punkt auf Wegen zulaufen, anhalten auf dem Weg (wegen einem Kampf) -void GameWorld::StopOnRoads(const MapPoint pt, const helpers::OptionalEnum dir) +void GameWorld::stopOnRoads(const MapPoint pt, const helpers::OptionalEnum dir) { // Figuren drumherum sammeln (auch von dem Punkt hier aus) std::vector figures; @@ -931,37 +931,37 @@ void GameWorld::StopOnRoads(const MapPoint pt, const helpers::OptionalEnum(figure)->StopIfNecessary(pt); + static_cast(figure)->stopIfNecessary(pt); } } -void GameWorld::Armageddon() +void GameWorld::armageddon() { RTTR_FOREACH_PT(MapPoint, getSize()) { auto* flag = getSpecObj(pt); if(flag) { - flag->DestroyAttachedBuilding(); - DestroyNO(pt, false); + flag->destroyAttachedBuilding(); + destroyNO(pt, false); } } } -void GameWorld::Armageddon(const unsigned char player) +void GameWorld::armageddon(const unsigned char player) { RTTR_FOREACH_PT(MapPoint, getSize()) { auto* flag = getSpecObj(pt); if(flag && flag->getPlayer() == player) { - flag->DestroyAttachedBuilding(); - DestroyNO(pt, false); + flag->destroyAttachedBuilding(); + destroyNO(pt, false); } } } -bool GameWorld::ValidWaitingAroundBuildingPoint(const MapPoint pt, const MapPoint center) +bool GameWorld::validWaitingAroundBuildingPoint(const MapPoint pt, const MapPoint center) { // Gültiger Punkt für Figuren? if(!PathConditionHuman(*this).isNodeOk(pt)) @@ -985,7 +985,7 @@ bool GameWorld::ValidWaitingAroundBuildingPoint(const MapPoint pt, const MapPoin return false; } // object wall or impassable terrain increasing my path to target length to a higher value than the direct distance? - return FindHumanPath(pt, center, CalcDistance(pt, center)).has_value(); + return findHumanPath(pt, center, calcDistance(pt, center)).has_value(); } bool GameWorld::isValidPointForFighting(MapPoint pt, const nofActiveSoldier& soldier, @@ -1033,7 +1033,7 @@ bool GameWorld::isValidPointForFighting(MapPoint pt, const nofActiveSoldier& sol bool GameWorld::isPointCompletelyVisible(const MapPoint& pt, unsigned char player, const noBaseBuilding* exception) const { - sortedMilitaryBlds buildings = LookForMilitaryBuildings(pt, 3); + sortedMilitaryBlds buildings = lookForMilitaryBuildings(pt, 3); // Sichtbereich von Militärgebäuden for(const nobBaseMilitary* milBld : buildings) @@ -1047,7 +1047,7 @@ bool GameWorld::isPointCompletelyVisible(const MapPoint& pt, unsigned char playe continue; } - if(CalcDistance(pt, milBld->getPos()) <= unsigned(milBld->getMilitaryRadius() + VISUALRANGE_MILITARY)) + if(calcDistance(pt, milBld->getPos()) <= unsigned(milBld->getMilitaryRadius() + VISUALRANGE_MILITARY)) return true; } } @@ -1057,7 +1057,7 @@ bool GameWorld::isPointCompletelyVisible(const MapPoint& pt, unsigned char playe { if(bldSite->getPlayer() == player && bldSite != exception) { - if(CalcDistance(pt, bldSite->getPos()) <= unsigned(HARBOR_RADIUS + VISUALRANGE_MILITARY)) + if(calcDistance(pt, bldSite->getPos()) <= unsigned(HARBOR_RADIUS + VISUALRANGE_MILITARY)) return true; } } @@ -1074,13 +1074,13 @@ bool GameWorld::isPointCompletelyVisible(const MapPoint& pt, unsigned char playe continue; // Liegt Spähturm innerhalb des Sichtradius? - if(CalcDistance(pt, bld->getPos()) <= VISUALRANGE_LOOKOUTTOWER) + if(calcDistance(pt, bld->getPos()) <= VISUALRANGE_LOOKOUTTOWER) return true; } // Check scouts and soldiers const unsigned range = std::max(VISUALRANGE_SCOUT, VISUALRANGE_SOLDIER); - if(CheckPointsInRadius( + if(checkPointsInRadius( pt, range, [this, player](auto pt, auto distance) { return this->isScoutingFigureOnNode(pt, player, distance); }, true)) { @@ -1131,14 +1131,14 @@ bool GameWorld::isPointScoutedByShip(const MapPoint& pt, unsigned player) const const std::vector& ships = getPlayer(player).getShips(); for(const noShip* ship : ships) { - unsigned shipDistance = CalcDistance(pt, ship->getPos()); + unsigned shipDistance = calcDistance(pt, ship->getPos()); if(shipDistance <= ship->getVisualRange()) return true; } return false; } -void GameWorld::RecalcVisibility(const MapPoint pt, const unsigned char player, const noBaseBuilding* const exception) +void GameWorld::recalcVisibility(const MapPoint pt, const unsigned char player, const noBaseBuilding* const exception) { /// Zustand davor merken Visibility visibility_before = getNode(pt).fow[player].visibility; @@ -1148,7 +1148,7 @@ void GameWorld::RecalcVisibility(const MapPoint pt, const unsigned char player, // Vollständig sichtbar --> vollständig sichtbar logischerweise if(visible) - MakeVisible(pt, player); + makeVisible(pt, player); else { // nicht mehr sichtbar @@ -1173,30 +1173,30 @@ void GameWorld::RecalcVisibility(const MapPoint pt, const unsigned char player, } } -void GameWorld::MakeVisible(const MapPoint pt, const unsigned char player) +void GameWorld::makeVisible(const MapPoint pt, const unsigned char player) { setVisibility(pt, player, Visibility::Visible); } -void GameWorld::RecalcVisibilitiesAroundPoint(const MapPoint pt, const MapCoord radius, const unsigned char player, +void GameWorld::recalcVisibilitiesAroundPoint(const MapPoint pt, const MapCoord radius, const unsigned char player, const noBaseBuilding* const exception) { std::vector pts = GetPointsInRadiusWithCenter(pt, radius); for(const MapPoint& pt : pts) - RecalcVisibility(pt, player, exception); + recalcVisibility(pt, player, exception); } /// Setzt die Sichtbarkeiten um einen Punkt auf sichtbar (aus Performancegründen Alternative zu oberem) -void GameWorld::MakeVisibleAroundPoint(const MapPoint pt, const MapCoord radius, const unsigned char player) +void GameWorld::makeVisibleAroundPoint(const MapPoint pt, const MapCoord radius, const unsigned char player) { std::vector pts = GetPointsInRadiusWithCenter(pt, radius); for(const MapPoint& curPt : pts) - MakeVisible(curPt, player); + makeVisible(curPt, player); } /// Bestimmt bei der Bewegung eines spähenden Objekts die Sichtbarkeiten an /// den Rändern neu -void GameWorld::RecalcMovingVisibilities(const MapPoint pt, const unsigned char player, const MapCoord radius, +void GameWorld::recalcMovingVisibilities(const MapPoint pt, const unsigned char player, const MapCoord radius, const Direction moving_dir, MapPoint* enemy_territory) { // Neue Sichtbarkeiten zuerst setzen @@ -1206,7 +1206,7 @@ void GameWorld::RecalcMovingVisibilities(const MapPoint pt, const unsigned char t = getNeighbour(t, moving_dir); // Und zu beiden Abzweigungen weiter gehen und Punkte auf visible setzen - MakeVisible(t, player); + makeVisible(t, player); MapPoint tt(t); Direction dir = moving_dir + 2u; for(MapCoord i = 0; i < radius; ++i) @@ -1214,9 +1214,9 @@ void GameWorld::RecalcMovingVisibilities(const MapPoint pt, const unsigned char tt = getNeighbour(tt, dir); // Sichtbarkeit und für FOW-Gebiet vorherigen Besitzer merken // (d.h. der dort zuletzt war, als es für Spieler player sichtbar war) - Visibility old_vis = CalcVisiblityWithAllies(tt, player); + Visibility old_vis = calcVisiblityWithAllies(tt, player); unsigned char old_owner = getNode(tt).fow[player].owner; - MakeVisible(tt, player); + makeVisible(tt, player); // Neues feindliches Gebiet entdeckt? // Muss vorher undaufgedeckt oder FOW gewesen sein, aber in dem Fall darf dort vorher noch kein // Territorium entdeckt worden sein @@ -1238,9 +1238,9 @@ void GameWorld::RecalcMovingVisibilities(const MapPoint pt, const unsigned char tt = getNeighbour(tt, dir); // Sichtbarkeit und für FOW-Gebiet vorherigen Besitzer merken // (d.h. der dort zuletzt war, als es für Spieler player sichtbar war) - Visibility old_vis = CalcVisiblityWithAllies(tt, player); + Visibility old_vis = calcVisiblityWithAllies(tt, player); unsigned char old_owner = getNode(tt).fow[player].owner; - MakeVisible(tt, player); + makeVisible(tt, player); // Neues feindliches Gebiet entdeckt? // Muss vorher undaufgedeckt oder FOW gewesen sein, aber in dem Fall darf dort vorher noch kein // Territorium entdeckt worden sein @@ -1262,13 +1262,13 @@ void GameWorld::RecalcMovingVisibilities(const MapPoint pt, const unsigned char for(MapCoord i = 0; i < radius + 1; ++i) t = getNeighbour(t, anti_moving_dir); - RecalcVisibility(t, player, nullptr); + recalcVisibility(t, player, nullptr); tt = t; dir = anti_moving_dir + 2u; for(MapCoord i = 0; i < radius; ++i) { tt = getNeighbour(tt, dir); - RecalcVisibility(tt, player, nullptr); + recalcVisibility(tt, player, nullptr); } tt = t; @@ -1276,7 +1276,7 @@ void GameWorld::RecalcMovingVisibilities(const MapPoint pt, const unsigned char for(unsigned i = 0; i < radius; ++i) { tt = getNeighbour(tt, dir); - RecalcVisibility(tt, player, nullptr); + recalcVisibility(tt, player, nullptr); } } @@ -1286,33 +1286,33 @@ bool GameWorld::isBorderNode(const MapPoint pt, const unsigned char owner) const } /// Gründet vom Schiff aus eine neue Kolonie -bool GameWorld::FoundColony(const HarborId harbor, const unsigned char player, const SeaId seaId) +bool GameWorld::foundColony(const HarborId harbor, const unsigned char player, const SeaId seaId) { // Ist es hier überhaupt noch möglich, eine Kolonie zu gründen? if(!isHarborAtSea(harbor, seaId) || !isHarborPointFree(harbor, player)) return false; MapPoint pos(getHarborPoint(harbor)); - DestroyNO(pos, false); + destroyNO(pos, false); // Hafenbaustelle errichten auto* bs = new noBuildingSite(pos, player); setNO(pos, bs); - AddHarborBuildingSiteFromSea(bs); + addHarborBuildingSiteFromSea(bs); if(gi) gi->GI_UpdateMinimap(pos); - RecalcTerritory(*bs, TerritoryChangeReason::Build); + recalcTerritory(*bs, TerritoryChangeReason::Build); // BQ neu berechnen (evtl durch RecalcTerritory noch nicht geschehen) - RecalcBQAroundPointBig(pos); + recalcBQAroundPointBig(pos); getNotifications().publish(ExpeditionNote(ExpeditionNote::ColonyFounded, player, pos)); return true; } -void GameWorld::RemoveHarborBuildingSiteFromSea(noBuildingSite* building_site) +void GameWorld::removeHarborBuildingSiteFromSea(noBuildingSite* building_site) { RTTR_Assert(building_site->getBuildingType() == BuildingType::HarborBuilding); harbor_building_sites_from_sea.remove(building_site); @@ -1331,7 +1331,7 @@ std::vector GameWorld::getUnexploredHarborPoints(const HarborId hbIdTo { if(i == hbIdToSkip || !isHarborAtSea(i, seaId)) continue; - if(CalcVisiblityWithAllies(getHarborPoint(i), playerId) != Visibility::Visible) + if(calcVisiblityWithAllies(getHarborPoint(i), playerId) != Visibility::Visible) hps.push_back(i); } return hps; @@ -1342,11 +1342,11 @@ MapNode& GameWorld::getNodeWriteable(const MapPoint pt) return getNodeInt(pt); } -void GameWorld::VisibilityChanged(const MapPoint pt, unsigned player, Visibility oldVis, Visibility newVis) +void GameWorld::visibilityChanged(const MapPoint pt, unsigned player, Visibility oldVis, Visibility newVis) { - GameWorldBase::VisibilityChanged(pt, player, oldVis, newVis); + GameWorldBase::visibilityChanged(pt, player, oldVis, newVis); if(oldVis == Visibility::Invisible && newVis == Visibility::Visible && hasLua()) - getLua().EventExplored(player, pt, getNode(pt).owner); + getLua().eventExplored(player, pt, getNode(pt).owner); // Minimap Bescheid sagen if(gi) gi->GI_UpdateMinimap(pt); diff --git a/libs/s25main/world/GameWorld.h b/libs/s25main/world/GameWorld.h index 2f204a9b23..e0290d8e85 100644 --- a/libs/s25main/world/GameWorld.h +++ b/libs/s25main/world/GameWorld.h @@ -35,7 +35,7 @@ class GameWorld : public GameWorldBase std::unique_ptr tradePathCache; /// Destroys player belongings if that pint does not belong to the player anymore - void DestroyPlayerRests(MapPoint pt, unsigned char newOwner, const noBaseBuilding* exception); + void destroyPlayerRests(MapPoint pt, unsigned char newOwner, const noBaseBuilding* exception); /// Return if there are deco-objects that can be removed when building roads bool hasRemovableObjForRoad(MapPoint pt) const; @@ -49,15 +49,15 @@ class GameWorld : public GameWorldBase /// Berechnet die Sichtbarkeit eines Punktes neu für den angegebenen Spieler /// exception ist ein Gebäude (Spähturm, Militärgebäude), was nicht mit in die Berechnung einbezogen /// werden soll, z.b. weil es abgerissen wird - void RecalcVisibility(MapPoint pt, unsigned char player, const noBaseBuilding* exception); + void recalcVisibility(MapPoint pt, unsigned char player, const noBaseBuilding* exception); /// Setzt Punkt auf jeden Fall auf sichtbar - void MakeVisible(MapPoint pt, unsigned char player); + void makeVisible(MapPoint pt, unsigned char player); /// Creates a region with territories marked around a building with the given radius - TerritoryRegion CreateTerritoryRegion(const noBaseBuilding& building, unsigned radius, + TerritoryRegion createTerritoryRegion(const noBaseBuilding& building, unsigned radius, TerritoryChangeReason reason) const; /// Cleans the region (removes edges of terrain and applies the allied border push addon - void CleanTerritoryRegion(TerritoryRegion& region, TerritoryChangeReason reason, + void cleanTerritoryRegion(TerritoryRegion& region, TerritoryChangeReason reason, const noBaseBuilding& triggerBld) const; public: @@ -72,10 +72,10 @@ class GameWorld : public GameWorldBase /// Kann dieser Punkt von auf Straßen laufenden Menschen betreten werden? (Kämpfe!) bool isRoadNodeForFigures(MapPoint pt); /// Lässt alle Figuren, die auf diesen Punkt auf Wegen zulaufen, anhalten auf dem Weg (wegen einem Kampf) - void StopOnRoads(MapPoint pt, helpers::OptionalEnum dir = std::nullopt); + void stopOnRoads(MapPoint pt, helpers::OptionalEnum dir = std::nullopt); /// Sagt Bescheid, dass der Punkt wieder freigeworden ist und lässt ggf. Figuren drumherum wieder weiterlaufen - void RoadNodeAvailable(MapPoint pt); + void roadNodeAvailable(MapPoint pt); /// Place a flag for the player bool SetFlag(MapPoint pt, unsigned char player); @@ -87,22 +87,22 @@ class GameWorld : public GameWorldBase void DestroyBuilding(MapPoint pt, unsigned char player); /// Find a path for people using roads. - RoadPathDirection FindHumanPathOnRoads(const noRoadNode& start, const noRoadNode& goal, unsigned* length = nullptr, + RoadPathDirection findHumanPathOnRoads(const noRoadNode& start, const noRoadNode& goal, unsigned* length = nullptr, MapPoint* firstPt = nullptr, const RoadSegment* forbidden = nullptr); /// Find a path for wares using roads. - RoadPathDirection FindPathForWareOnRoads(const noRoadNode& start, const noRoadNode& goal, + RoadPathDirection findPathForWareOnRoads(const noRoadNode& start, const noRoadNode& goal, unsigned* length = nullptr, MapPoint* firstPt = nullptr, unsigned max = std::numeric_limits::max()); /// Prüft, ob eine Schiffsroute noch Gültigkeit hat - bool CheckShipRoute(MapPoint start, const std::vector& route, unsigned pos, MapPoint* dest) const; + bool checkShipRoute(MapPoint start, const std::vector& route, unsigned pos, MapPoint* dest) const; /// Find a route for trade caravanes - helpers::OptionalEnum FindTradePath(MapPoint start, MapPoint dest, unsigned char player, + helpers::OptionalEnum findTradePath(MapPoint start, MapPoint dest, unsigned char player, unsigned max_route = 0xffffffff, bool random_route = false, std::vector* route = nullptr, unsigned* length = nullptr) const; /// Check whether trade path (starting from point @param start and at index @param startRouteIdx) is still valid. /// Optionally returns destination pt - bool CheckTradeRoute(MapPoint start, const std::vector& route, unsigned pos, unsigned char player, + bool checkTradeRoute(MapPoint start, const std::vector& route, unsigned pos, unsigned char player, MapPoint* dest = nullptr) const; /// setzt den Straßen-Wert um den Punkt X,Y. @@ -112,51 +112,51 @@ class GameWorld : public GameWorldBase MapPoint BuildRoad(unsigned char playerId, bool boat_road, MapPoint start, const std::vector& route); /// Recalculates the ownership around a military building - void RecalcTerritory(const noBaseBuilding& building, TerritoryChangeReason reason); + void recalcTerritory(const noBaseBuilding& building, TerritoryChangeReason reason); /// Berechnet das Land in einem bestimmten Bereich um ein aktuelles Militärgebäude rum neu und gibt zurück ob sich /// etwas verändern würde (auf für ki wichtigem untergrund) wenn das Gebäude zerstört werden würde - bool DoesDestructionChangeTerritory(const noBaseBuilding& building) const; + bool doesDestructionChangeTerritory(const noBaseBuilding& building) const; /// Greift ein Militärgebäude auf x,y an (entsendet dafür die Soldaten etc.) void Attack(unsigned char player_attacker, MapPoint pt, unsigned short soldiers_count, bool strong_soldiers); /// Greift ein Militäregebäude mit Schiffen an - void AttackViaSea(unsigned char player_attacker, MapPoint pt, unsigned short soldiers_count, bool strong_soldiers); + void attackViaSea(unsigned char player_attacker, MapPoint pt, unsigned short soldiers_count, bool strong_soldiers); MilitarySquares& getMilitarySquares(); /// Lässt alles spielerische abbrennen, indem es alle Flaggen der Spieler zerstört - void Armageddon(); + void armageddon(); /// Lässt alles spielerische eines Spielers abbrennen, indem es alle Flaggen eines Spieler zerstört - void Armageddon(unsigned char player); + void armageddon(unsigned char player); /// Ist der Punkt ein geeigneter Platz zum Warten vor dem Militärgebäude - bool ValidWaitingAroundBuildingPoint(MapPoint pt, MapPoint center); + bool validWaitingAroundBuildingPoint(MapPoint pt, MapPoint center); /// Is this point a valid point for the given soldier to fight? bool isValidPointForFighting(MapPoint pt, const nofActiveSoldier& soldier, bool avoid_military_building_flags); /// Berechnet die Sichtbarkeiten neu um einen Punkt mit radius - void RecalcVisibilitiesAroundPoint(MapPoint pt, MapCoord radius, unsigned char player, + void recalcVisibilitiesAroundPoint(MapPoint pt, MapCoord radius, unsigned char player, const noBaseBuilding* exception); /// Setzt die Sichtbarkeiten um einen Punkt auf sichtbar (aus Performancegründen Alternative zu oberem) - void MakeVisibleAroundPoint(MapPoint pt, MapCoord radius, unsigned char player); + void makeVisibleAroundPoint(MapPoint pt, MapCoord radius, unsigned char player); /// Bestimmt bei der Bewegung eines spähenden Objekts die Sichtbarkeiten an den Rändern neu - void RecalcMovingVisibilities(MapPoint pt, unsigned char player, MapCoord radius, Direction moving_dir, + void recalcMovingVisibilities(MapPoint pt, unsigned char player, MapCoord radius, Direction moving_dir, MapPoint* enemy_territory); /// Return whether this is a border node (node belongs to player, but not all others around) bool isBorderNode(MapPoint pt, unsigned char owner) const; /// Gründet vom Schiff aus eine neue Kolonie, gibt true zurück bei Erfolg - bool FoundColony(HarborId harbor, unsigned char player, SeaId seaId); + bool foundColony(HarborId harbor, unsigned char player, SeaId seaId); /// Registriert eine Baustelle eines Hafens, die vom Schiff aus gesetzt worden ist - void AddHarborBuildingSiteFromSea(noBuildingSite* building_site) + void addHarborBuildingSiteFromSea(noBuildingSite* building_site) { harbor_building_sites_from_sea.push_back(building_site); } /// Removes it. It is allowed to be called with a regular harbor building site (no-op in that case) - void RemoveHarborBuildingSiteFromSea(noBuildingSite* building_site); + void removeHarborBuildingSiteFromSea(noBuildingSite* building_site); /// Gibt zurück, ob eine bestimmte Baustellen eine Baustelle ist, die vom Schiff aus errichtet wurde bool isHarborBuildingSiteFromSea(const noBuildingSite* building_site) const; /// Liefert eine Liste der Hafenpunkte, die von einem bestimmten Hafenpunkt erreichbar sind @@ -165,8 +165,8 @@ class GameWorld : public GameWorldBase /// Writeable access to node. Use only for initial map setup! MapNode& getNodeWriteable(MapPoint pt); /// Recalculates where border stones should be done after a change in the given region - void RecalcBorderStones(Position startPt, Extent areaSize); + void recalcBorderStones(Position startPt, Extent areaSize); protected: - void VisibilityChanged(MapPoint pt, unsigned player, Visibility oldVis, Visibility newVis) override; + void visibilityChanged(MapPoint pt, unsigned player, Visibility oldVis, Visibility newVis) override; }; diff --git a/libs/s25main/world/GameWorldBase.cpp b/libs/s25main/world/GameWorldBase.cpp index 14c186b68f..8ee2f3aceb 100644 --- a/libs/s25main/world/GameWorldBase.cpp +++ b/libs/s25main/world/GameWorldBase.cpp @@ -43,10 +43,10 @@ void GameWorldBase::Init(const MapExtent& mapSize, DescIdx lt) freePathFinder->Init(mapSize); } -void GameWorldBase::InitAfterLoad() +void GameWorldBase::initAfterLoad() { RTTR_FOREACH_PT(MapPoint, getSize()) - RecalcBQ(pt); + recalcBQ(pt); } GamePlayer& GameWorldBase::getPlayer(const unsigned id) @@ -149,7 +149,7 @@ bool GameWorldBase::isRoadAvailable(const bool boat_road, const MapPoint pt) con return true; } -bool GameWorldBase::RoadAlreadyBuilt(const bool /*boat_road*/, const MapPoint start, +bool GameWorldBase::roadAlreadyBuilt(const bool /*boat_road*/, const MapPoint start, const std::vector& route) { MapPoint tmp(start); @@ -197,12 +197,12 @@ bool GameWorldBase::isAnyNeighborOwned(const MapPoint& pt) const return false; } -void GameWorldBase::RecalcBQForRoad(const MapPoint pt) +void GameWorldBase::recalcBQForRoad(const MapPoint pt) { - RecalcBQ(pt); + recalcBQ(pt); for(const Direction dir : {Direction::East, Direction::SouthEast, Direction::SouthWest}) - RecalcBQ(getNeighbour(pt, dir)); + recalcBQ(getNeighbour(pt, dir)); } namespace { @@ -215,7 +215,7 @@ bool IsMilBldOfOwner(const GameWorldBase& gwb, MapPoint pt, unsigned char owner) bool GameWorldBase::isMilitaryBuildingNearNode(const MapPoint nPt, const unsigned char player) const { // Im Umkreis von 4 Punkten ein Militärgebäude suchen - return CheckPointsInRadius( + return checkPointsInRadius( nPt, 4, [this, player](auto pt, auto) { return IsMilBldOfOwner(*this, pt, player + 1); }, false); } @@ -235,7 +235,7 @@ bool GameWorldBase::isMilitaryBuildingOnNode(const MapPoint pt, bool attackBldsO return false; } -sortedMilitaryBlds GameWorldBase::LookForMilitaryBuildings(const MapPoint pt, unsigned short radius) const +sortedMilitaryBlds GameWorldBase::lookForMilitaryBuildings(const MapPoint pt, unsigned short radius) const { return militarySquares.getBuildingsInRange(pt, radius); } @@ -283,35 +283,35 @@ Position GameWorldBase::getNodePos(const MapPoint pt) const return ::getNodePos(pt, getNode(pt).altitude); } -void GameWorldBase::VisibilityChanged(const MapPoint pt, unsigned player, Visibility /*oldVis*/, Visibility /*newVis*/) +void GameWorldBase::visibilityChanged(const MapPoint pt, unsigned player, Visibility /*oldVis*/, Visibility /*newVis*/) { getNotifications().publish(PlayerNodeNote(PlayerNodeNote::Visibility, pt, player)); } /// Verändert die Höhe eines Punktes und die damit verbundenen Schatten -void GameWorldBase::AltitudeChanged(const MapPoint pt) +void GameWorldBase::altitudeChanged(const MapPoint pt) { - RecalcBQAroundPointBig(pt); + recalcBQAroundPointBig(pt); getNotifications().publish(NodeNote(NodeNote::Altitude, pt)); } -void GameWorldBase::RecalcBQAroundPoint(const MapPoint pt) +void GameWorldBase::recalcBQAroundPoint(const MapPoint pt) { - RecalcBQ(pt); + recalcBQ(pt); for(const MapPoint nb : getNeighbours(pt)) - RecalcBQ(nb); + recalcBQ(nb); } -void GameWorldBase::RecalcBQAroundPointBig(const MapPoint pt) +void GameWorldBase::recalcBQAroundPointBig(const MapPoint pt) { // Point and radius 1 - RecalcBQAroundPoint(pt); + recalcBQAroundPoint(pt); // And radius 2 for(unsigned i = 0; i < 12; ++i) - RecalcBQ(getNeighbour2(pt, i)); + recalcBQ(getNeighbour2(pt, i)); } -Visibility GameWorldBase::CalcVisiblityWithAllies(const MapPoint pt, const unsigned char player) const +Visibility GameWorldBase::calcVisiblityWithAllies(const MapPoint pt, const unsigned char player) const { const MapNode& node = getNode(pt); Visibility best_visibility = node.fow[player].visibility; @@ -409,7 +409,7 @@ bool GameWorldBase::isHarborPointFree(const HarborId harborId, const unsigned ch MapPoint flagPos = getNeighbour(hbPos, Direction::SouthEast); if(getNode(hbPos).owner != player + 1 || getNode(flagPos).owner != player + 1) { - if(CheckPointsInRadius(hbPos, 4, IsPointOwnerDifferent(*this, player), false)) + if(checkPointsInRadius(hbPos, 4, IsPointOwnerDifferent(*this, player), false)) return false; } @@ -425,11 +425,11 @@ HarborId GameWorldBase::getNextFreeHarborPoint(const MapPoint pt, const HarborId } /// Bestimmt für einen beliebigen Punkt auf der Karte die Entfernung zum nächsten Hafenpunkt -unsigned GameWorldBase::CalcDistanceToNearestHarbor(const MapPoint pos) const +unsigned GameWorldBase::calcDistanceToNearestHarbor(const MapPoint pos) const { unsigned min_distance = std::numeric_limits::max(); for(const auto i : helpers::idRange(getNumHarborPoints())) - min_distance = std::min(min_distance, this->CalcDistance(pos, getHarborPoint(i))); + min_distance = std::min(min_distance, this->calcDistance(pos, getHarborPoint(i))); return min_distance; } @@ -439,9 +439,9 @@ bool GameWorldBase::isAHarborInSeaAttackDistance(const MapPoint pos) const { for(const auto i : helpers::idRange(getNumHarborPoints())) { - if(CalcDistance(pos, getHarborPoint(i)) < SEAATTACK_DISTANCE) + if(calcDistance(pos, getHarborPoint(i)) < SEAATTACK_DISTANCE) { - if(FindHumanPath(pos, getHarborPoint(i), SEAATTACK_DISTANCE)) + if(findHumanPath(pos, getHarborPoint(i), SEAATTACK_DISTANCE)) return true; } } @@ -461,7 +461,7 @@ std::vector GameWorldBase::getUsableTargetHarborsForAttack(const MapPo { const MapPoint harborPt = getHarborPoint(curHbId); - if(CalcDistance(harborPt, targetPt) > SEAATTACK_DISTANCE) + if(calcDistance(harborPt, targetPt) > SEAATTACK_DISTANCE) continue; // Not attacking this harbor and harbors block? @@ -495,7 +495,7 @@ std::vector GameWorldBase::getUsableTargetHarborsForAttack(const MapPo // Can figures reach flag from coast const MapPoint coastalPt = getCoastalPoint(curHbId, seaId); - if((flagPt == coastalPt) || FindHumanPath(flagPt, coastalPt, SEAATTACK_DISTANCE)) + if((flagPt == coastalPt) || findHumanPath(flagPt, coastalPt, SEAATTACK_DISTANCE)) { use_seas.at(seaId.value() - 1) = true; if(!harborinlist) @@ -522,7 +522,7 @@ std::vector GameWorldBase::getFilteredSeaIDsForAttack(const MapPoint targ { const MapPoint harborPt = getHarborPoint(curHbId); - if(CalcDistance(harborPt, targetPt) > SEAATTACK_DISTANCE) + if(calcDistance(harborPt, targetPt) > SEAATTACK_DISTANCE) continue; // Not attacking this harbor and harbors block? @@ -558,7 +558,7 @@ std::vector GameWorldBase::getFilteredSeaIDsForAttack(const MapPoint targ // Can figures reach flag from coast MapPoint coastalPt = getCoastalPoint(curHbId, seaId); - if((flagPt == coastalPt) || FindHumanPath(flagPt, coastalPt, SEAATTACK_DISTANCE)) + if((flagPt == coastalPt) || findHumanPath(flagPt, coastalPt, SEAATTACK_DISTANCE)) { confirmedSeaIds.push_back(seaId); // all sea ids confirmed? return without changes @@ -580,10 +580,10 @@ std::vector GameWorldBase::getHarborPointsAroundMilitaryBuilding(const { const MapPoint harborPt = getHarborPoint(i); - if(CalcDistance(harborPt, pt) <= SEAATTACK_DISTANCE) + if(calcDistance(harborPt, pt) <= SEAATTACK_DISTANCE) { // Wird ein Weg vom Militärgebäude zum Hafen gefunden bzw. Ziel = Hafen? - if(pt == harborPt || FindHumanPath(pt, harborPt, SEAATTACK_DISTANCE)) + if(pt == harborPt || findHumanPath(pt, harborPt, SEAATTACK_DISTANCE)) harbor_points.push_back(i); } } @@ -712,7 +712,7 @@ GameWorldBase::getSoldiersForSeaAttack(const unsigned char player_attacker, cons return attackers; } -void GameWorldBase::RecalcBQ(const MapPoint pt) +void GameWorldBase::recalcBQ(const MapPoint pt) { BQCalculator calcBQ(*this); if(setBQ(pt, calcBQ(pt, [this](auto pt) { return this->isOnRoad(pt); }))) diff --git a/libs/s25main/world/GameWorldBase.h b/libs/s25main/world/GameWorldBase.h index d1397e9b74..aaf6e7713e 100644 --- a/libs/s25main/world/GameWorldBase.h +++ b/libs/s25main/world/GameWorldBase.h @@ -79,7 +79,7 @@ class GameWorldBase : public World // Grundlegende Initialisierungen void Init(const MapExtent& mapSize, DescIdx lt = DescIdx(0)) override; // Remaining initialization after loading (BQ...) - void InitAfterLoad(); + void initAfterLoad(); GameInterface* getGameInterface() { return gi; } const GameInterface* getGameInterface() const { return gi; } @@ -93,7 +93,7 @@ class GameWorldBase : public World /// Should only be used for the points between the 2 flags of a road bool isRoadAvailable(bool boat_road, MapPoint pt) const; /// Check if this road already exists completely - bool RoadAlreadyBuilt(bool boat_road, MapPoint start, const std::vector& route); + bool roadAlreadyBuilt(bool boat_road, MapPoint start, const std::vector& route); bool isOnRoad(const MapPoint& pt) const; /// Check if a flag is at a neighbour node bool isFlagAround(const MapPoint& pt) const; @@ -102,7 +102,7 @@ class GameWorldBase : public World bool isAnyNeighborOwned(const MapPoint& pt) const; /// Berechnet BQ bei einer gebauten Stra�e - void RecalcBQForRoad(MapPoint pt); + void recalcBQForRoad(MapPoint pt); /// Pr�ft, ob sich in unmittelbarer N�he (im Radius von 4) Milit�rgeb�ude befinden bool isMilitaryBuildingNearNode(MapPoint nPt, unsigned char player) const; /// Return true if there is a military building or building site on the node @@ -111,18 +111,18 @@ class GameWorldBase : public World bool isMilitaryBuildingOnNode(MapPoint pt, bool attackBldsOnly) const; /// Erstellt eine Liste mit allen Milit�rgeb�uden in der Umgebung, radius bestimmt wie viele K�stchen nach einer /// Richtung im Umkreis - sortedMilitaryBlds LookForMilitaryBuildings(MapPoint pt, unsigned short radius) const; + sortedMilitaryBlds lookForMilitaryBuildings(MapPoint pt, unsigned short radius) const; /// Finds a path for figures. Returns first direction to walk in if found - helpers::OptionalEnum FindHumanPath(MapPoint start, MapPoint dest, unsigned max_route = 0xFFFFFFFF, + helpers::OptionalEnum findHumanPath(MapPoint start, MapPoint dest, unsigned max_route = 0xFFFFFFFF, bool random_route = false, unsigned* length = nullptr, std::vector* route = nullptr) const; /// Find path for ships to a specific harbor and see. Return true on success /// If starting point equals the coastal point of target harbor, set length 0, clear route and return true. - bool FindShipPathToHarbor(MapPoint start, HarborId harborId, SeaId seaId, std::vector* route, + bool findShipPathToHarbor(MapPoint start, HarborId harborId, SeaId seaId, std::vector* route, unsigned* length) const; /// Find path for ships with a limited distance. Return true on success - bool FindShipPath(MapPoint start, MapPoint dest, unsigned maxDistance, std::vector* route, + bool findShipPath(MapPoint start, MapPoint dest, unsigned maxDistance, std::vector* route, unsigned* length) const; RoadPathFinder& getRoadPathFinder() const { return *roadPathFinder; } FreePathFinder& getFreePathFinder() const { return *freePathFinder; } @@ -138,12 +138,12 @@ class GameWorldBase : public World Position getNodePos(MapPoint pt) const; /// Berechnet Bauqualitäten an Punkt x;y und den ersten Kreis darum neu - void RecalcBQAroundPoint(MapPoint pt); + void recalcBQAroundPoint(MapPoint pt); /// Berechnet Bauqualitäten wie bei letzterer Funktion, bloß noch den 2. Kreis um x;y herum - void RecalcBQAroundPointBig(MapPoint pt); + void recalcBQAroundPointBig(MapPoint pt); /// Ermittelt Sichtbarkeit eines Punktes auch unter Einbeziehung der Verbündeten des jeweiligen Spielers - Visibility CalcVisiblityWithAllies(MapPoint pt, unsigned char player) const; + Visibility calcVisiblityWithAllies(MapPoint pt, unsigned char player) const; /// Ist es an dieser Stelle für einen Spieler möglich einen Hafen zu bauen bool isHarborPointFree(HarborId harborId, unsigned char player) const; @@ -154,7 +154,7 @@ class GameWorldBase : public World HarborId getNextFreeHarborPoint(MapPoint pt, HarborId originHarborId, const ShipDirection& dir, unsigned char player) const; /// Bestimmt für einen beliebigen Punkt auf der Karte die Entfernung zum nächsten Hafenpunkt - unsigned CalcDistanceToNearestHarbor(MapPoint pos) const; + unsigned calcDistanceToNearestHarbor(MapPoint pos) const; /// returns true when a harborpoint is in SEAATTACK_DISTANCE for figures! bool isAHarborInSeaAttackDistance(MapPoint pos) const; @@ -222,7 +222,7 @@ class GameWorldBase : public World unsigned getNumSoldiersForSeaAttackAtSea(unsigned char player_attacker, SeaId sea, bool returnCount = true) const; /// Recalculates the BQ for the given point - void RecalcBQ(MapPoint pt); + void recalcBQ(MapPoint pt); void setComputerBarrier(const MapPoint& pt, unsigned radius); bool isInsideComputerBarrier(const MapPoint& pt) const; @@ -233,9 +233,9 @@ class GameWorldBase : public World protected: /// Called when the visibility of point changed for a player - void VisibilityChanged(MapPoint pt, unsigned player, Visibility oldVis, Visibility newVis) override; + void visibilityChanged(MapPoint pt, unsigned player, Visibility oldVis, Visibility newVis) override; /// Called, when the altitude of a point was changed - void AltitudeChanged(MapPoint pt) override; + void altitudeChanged(MapPoint pt) override; private: /// Returns the harbor ID of the next matching harbor in the given direction (0 = None) diff --git a/libs/s25main/world/GameWorldView.cpp b/libs/s25main/world/GameWorldView.cpp index 377bf2aecc..68aaf364c5 100644 --- a/libs/s25main/world/GameWorldView.cpp +++ b/libs/s25main/world/GameWorldView.cpp @@ -50,7 +50,7 @@ GameWorldView::GameWorldView(const GameWorldViewer& gwv, const Position& pos, co zoomFactor_(1.f), targetZoomFactor_(1.f), zoomSpeed_(0.f) { updateEffectiveZoomFactor(); - MoveBy({0, 0}); + moveBy({0, 0}); } const GameWorldBase& GameWorldView::getWorld() const @@ -95,7 +95,7 @@ void GameWorldView::setNextZoomFactor() zoomFactor_ = zoomFactor_ + zoomSpeed_; updateEffectiveZoomFactor(); - CalcFxLx(); + calcFxLx(); } float GameWorldView::setZoomFactor(float zoomFactor, bool smoothTransition /* = true*/) @@ -105,7 +105,7 @@ float GameWorldView::setZoomFactor(float zoomFactor, bool smoothTransition /* = { zoomFactor_ = targetZoomFactor_; updateEffectiveZoomFactor(); - CalcFxLx(); + calcFxLx(); } return targetZoomFactor_; } @@ -115,7 +115,7 @@ float GameWorldView::getCurrentTargetZoomFactor() const return targetZoomFactor_; } -Position GameWorldView::ViewPosToMap(Position pos) const +Position GameWorldView::viewPosToMap(Position pos) const { pos -= origin_; if(effectiveZoomFactor_ != 1.f) @@ -135,7 +135,7 @@ struct ObjectBetweenLines ObjectBetweenLines(noBase& obj, const DrawPoint& pos) : obj(obj), pos(pos) {} }; -void GameWorldView::Draw(const RoadBuildState& rb, const MapPoint selected, bool drawMouse, unsigned* water) +void GameWorldView::draw(const RoadBuildState& rb, const MapPoint selected, bool drawMouse, unsigned* water) { setNextZoomFactor(); @@ -168,7 +168,7 @@ void GameWorldView::Draw(const RoadBuildState& rb, const MapPoint selected, bool glTranslatef(static_cast(-offset.x), static_cast(-offset.y), 0.0f); const TerrainRenderer& terrainRenderer = gwv.getTerrainRenderer(); - terrainRenderer.Draw(getFirstPt(), getLastPt(), gwv, water); + terrainRenderer.draw(getFirstPt(), getLastPt(), gwv, water); glTranslatef(static_cast(offset.x), static_cast(offset.y), 0.0f); const auto& world = getWorld(); @@ -182,7 +182,7 @@ void GameWorldView::Draw(const RoadBuildState& rb, const MapPoint selected, bool for(const int x : helpers::range(firstPt.x, lastPt.x + 1)) { Position curOffset; - const MapPoint curPt = terrainRenderer.ConvertCoords(Position(x, y), &curOffset); + const MapPoint curPt = terrainRenderer.convertCoords(Position(x, y), &curOffset); const DrawPoint curPos = world.getNodePos(curPt) - offset + curOffset; Position mouseDist = mousePos - curPos; @@ -196,23 +196,23 @@ void GameWorldView::Draw(const RoadBuildState& rb, const MapPoint selected, bool const Visibility visibility = gwv.getVisibility(curPt); - DrawBoundaryStone(curPt, curPos, visibility); + drawBoundaryStone(curPt, curPos, visibility); if(visibility == Visibility::Visible) { - DrawObject(curPt, curPos); - DrawMovingFiguresFromBelow(terrainRenderer, Position(x, y), objsBetweenRows); - DrawFigures(curPt, curPos, objsBetweenRows); + drawObject(curPt, curPos); + drawMovingFiguresFromBelow(terrainRenderer, Position(x, y), objsBetweenRows); + drawFigures(curPt, curPos, objsBetweenRows); if(show_bq) - DrawConstructionAid(curPt, curPos); + drawConstructionAid(curPt, curPos); if(resourceRevealMode != Cheats::ResourceRevealMode::Nothing) - DrawResource(curPt, curPos, resourceRevealMode); + drawResource(curPt, curPos, resourceRevealMode); } else if(visibility == Visibility::FogOfWar) { const FOWObject* fowobj = gwv.getYoungestFOWObject(MapPoint(curPt)); if(fowobj) - fowobj->Draw(curPos); + fowobj->draw(curPos); } for(IDrawNodeCallback* callback : drawNodeCallbacks) @@ -221,27 +221,27 @@ void GameWorldView::Draw(const RoadBuildState& rb, const MapPoint selected, bool // Draw objects that are between rows now for(auto& between_line : objsBetweenRows) - between_line.obj.Draw(between_line.pos); + between_line.obj.draw(between_line.pos); } if(show_names || show_productivity) - DrawNameProductivityOverlay(terrainRenderer); + drawNameProductivityOverlay(terrainRenderer); if(isBuildingRadiusEnabled_) { if(drawMouse) - UpdateRadiusPreviewForMousePos(); - DrawRadiusOutline(); + updateRadiusPreviewForMousePos(); + drawRadiusOutline(); } - DrawGUI(rb, terrainRenderer, selected, drawMouse); + drawGUI(rb, terrainRenderer, selected, drawMouse); // Draw catapult stones for(auto* catapult_stone : world.catapult_stones) { if(gwv.getVisibility(catapult_stone->dest_building) == Visibility::Visible || gwv.getVisibility(catapult_stone->dest_map) == Visibility::Visible) - catapult_stone->Draw(offset); + catapult_stone->draw(offset); } if(effectiveZoomFactor_ != 1.f) //-V550 @@ -255,7 +255,7 @@ void GameWorldView::Draw(const RoadBuildState& rb, const MapPoint selected, bool glScissor(0, 0, windowSize.width, windowSize.height); } -void GameWorldView::DrawGUI(const RoadBuildState& rb, const TerrainRenderer& terrainRenderer, +void GameWorldView::drawGUI(const RoadBuildState& rb, const TerrainRenderer& terrainRenderer, const MapPoint& selectedPt, bool drawMouse) { // Falls im Straßenbaumodus: Punkte um den aktuellen Straßenbaupunkt herum ermitteln @@ -278,7 +278,7 @@ void GameWorldView::DrawGUI(const RoadBuildState& rb, const TerrainRenderer& ter { // Coordinates transform Position curOffset; - MapPoint curPt = terrainRenderer.ConvertCoords(Position(x, y), &curOffset); + MapPoint curPt = terrainRenderer.convertCoords(Position(x, y), &curOffset); Position curPos = getWorld().getNodePos(curPt) - offset + curOffset; /// Current point indicated by Mouse @@ -299,12 +299,12 @@ void GameWorldView::DrawGUI(const RoadBuildState& rb, const TerrainRenderer& ter default: break; } } - LOADER.getMapTexture(mid)->DrawFull(curPos); + LOADER.getMapTexture(mid)->drawFull(curPos); } // Currently selected point if(selectedPt == curPt) - LOADER.getMapTexture(20)->DrawFull(curPos); + LOADER.getMapTexture(20)->drawFull(curPos); // not building roads, no further action needed if(rb.mode == RoadBuildMode::Disabled) @@ -318,7 +318,7 @@ void GameWorldView::DrawGUI(const RoadBuildState& rb, const TerrainRenderer& ter // highlight current route pt if(rb.point == curPt) { - LOADER.getMapTexture(21)->DrawFull(curPos); + LOADER.getMapTexture(21)->drawFull(curPos); continue; } @@ -335,7 +335,7 @@ void GameWorldView::DrawGUI(const RoadBuildState& rb, const TerrainRenderer& ter // render special icon for route revert if(!rb.route.empty() && road_points[rb.route.back() + 3u] == curPt) { - LOADER.getMapTexture(67)->DrawFull(curPos); + LOADER.getMapTexture(67)->drawFull(curPos); continue; } @@ -360,20 +360,20 @@ void GameWorldView::DrawGUI(const RoadBuildState& rb, const TerrainRenderer& ter default: id = 60; break; } if(!targetFlag) - LOADER.getMapTexture(id)->DrawFull(curPos); + LOADER.getMapTexture(id)->drawFull(curPos); else { DrawPoint lastPos = getWorld().getNodePos(rb.point) - offset + curOffset; DrawPoint halfWayPos = (curPos + lastPos) / 2; - LOADER.getMapTexture(id)->DrawFull(halfWayPos); - LOADER.getMapTexture(20)->DrawFull(curPos); + LOADER.getMapTexture(id)->drawFull(halfWayPos); + LOADER.getMapTexture(20)->drawFull(curPos); } } } } } -void GameWorldView::DrawNameProductivityOverlay(const TerrainRenderer& terrainRenderer) +void GameWorldView::drawNameProductivityOverlay(const TerrainRenderer& terrainRenderer) { const bool showEnemyProductivity = getWorld().getGameInterface()->GI_GetCheats().shouldShowEnemyProductivityOverlay(); @@ -386,7 +386,7 @@ void GameWorldView::DrawNameProductivityOverlay(const TerrainRenderer& terrainRe { // Coordinate transform Position curOffset; - MapPoint pt = terrainRenderer.ConvertCoords(Position(x, y), &curOffset); + MapPoint pt = terrainRenderer.convertCoords(Position(x, y), &curOffset); const auto* no = getWorld().getSpecObj(pt); if(!no) @@ -401,7 +401,7 @@ void GameWorldView::DrawNameProductivityOverlay(const TerrainRenderer& terrainRe if(!isAllVisible && gwv.getVisibility(pt, false) != Visibility::Visible) continue; if(attackAidImage && gwv.getNumSoldiersForAttack(pt) > 0) - attackAidImage->DrawFull(curPos - DrawPoint(0, attackAidImage->getHeight())); + attackAidImage->drawFull(curPos - DrawPoint(0, attackAidImage->getHeight())); // Do not draw enemy productivity overlay unless the related cheat is on if(!showEnemyProductivity) continue; @@ -411,19 +411,19 @@ void GameWorldView::DrawNameProductivityOverlay(const TerrainRenderer& terrainRe if(show_names) { unsigned color = (no->getGOT() == GO_Type::Buildingsite) ? COLOR_GREY : COLOR_YELLOW; - SmallFont->Draw(curPos, _(BUILDING_NAMES[no->getBuildingType()]), + SmallFont->draw(curPos, _(BUILDING_NAMES[no->getBuildingType()]), FontStyle::CENTER | FontStyle::VCENTER, color); curPos.y += SmallFont->getHeight(); } // Draw productivity/soldiers if(show_productivity) - DrawProductivity(*no, curPos); + drawProductivity(*no, curPos); } } } -void GameWorldView::DrawProductivity(const noBaseBuilding& no, const DrawPoint& curPos) +void GameWorldView::drawProductivity(const noBaseBuilding& no, const DrawPoint& curPos) { const GO_Type got = no.getGOT(); if(got == GO_Type::Buildingsite) @@ -431,7 +431,7 @@ void GameWorldView::DrawProductivity(const noBaseBuilding& no, const DrawPoint& unsigned color = COLOR_GREY; unsigned short p = static_cast(no).getBuildProgress(); - SmallFont->Draw(curPos, (boost::format("(%1% %%)") % p).str(), FontStyle::CENTER | FontStyle::VCENTER, color); + SmallFont->draw(curPos, (boost::format("(%1% %%)") % p).str(), FontStyle::CENTER | FontStyle::VCENTER, color); } else if(got == GO_Type::NobUsual || got == GO_Type::NobShipyard || got == GO_Type::NobTemple) { const auto& n = static_cast(no); @@ -457,7 +457,7 @@ void GameWorldView::DrawProductivity(const noBaseBuilding& no, const DrawPoint& else if(p >= 20) color = COLOR_20_PERCENT; } - SmallFont->Draw(curPos, text, FontStyle::CENTER | FontStyle::VCENTER, color); + SmallFont->draw(curPos, text, FontStyle::CENTER | FontStyle::VCENTER, color); } else if(got == GO_Type::NobMilitary) { // Display amount of soldiers @@ -468,12 +468,12 @@ void GameWorldView::DrawProductivity(const noBaseBuilding& no, const DrawPoint& else sSoldiers = boost::str(boost::format(_("(%d soldiers)")) % soldiers_count); - SmallFont->Draw(curPos, sSoldiers, FontStyle::CENTER | FontStyle::VCENTER, + SmallFont->draw(curPos, sSoldiers, FontStyle::CENTER | FontStyle::VCENTER, (soldiers_count > 0) ? COLOR_YELLOW : COLOR_RED); } } -void GameWorldView::DrawFigures(const MapPoint& pt, const DrawPoint& curPos, +void GameWorldView::drawFigures(const MapPoint& pt, const DrawPoint& curPos, std::vector& objsBetweenRows) const { for(noBase& figure : getWorld().getFigures(pt)) @@ -489,11 +489,11 @@ void GameWorldView::DrawFigures(const MapPoint& pt, const DrawPoint& curPos, } else if(figure.getGOT() == GO_Type::Ship) objsBetweenRows.push_back(ObjectBetweenLines(figure, curPos)); // TODO: Why special handling for ships? else - figure.Draw(curPos); // Draw normally + figure.draw(curPos); // Draw normally } } -void GameWorldView::DrawMovingFiguresFromBelow(const TerrainRenderer& terrainRenderer, const DrawPoint& curPos, +void GameWorldView::drawMovingFiguresFromBelow(const TerrainRenderer& terrainRenderer, const DrawPoint& curPos, std::vector& objsBetweenRows) { // First draw figures moving towards this point from below @@ -502,7 +502,7 @@ void GameWorldView::DrawMovingFiguresFromBelow(const TerrainRenderer& terrainRen // Get figures opposite the current dir and check if they are moving in this dir // Coordinates transform Position curOffset; - MapPoint curPt = terrainRenderer.ConvertCoords(getNeighbour(curPos, dir + 3u), &curOffset); + MapPoint curPt = terrainRenderer.convertCoords(getNeighbour(curPos, dir + 3u), &curOffset); Position figPos = getWorld().getNodePos(curPt) - offset + curOffset; for(noBase& figure : getWorld().getFigures(curPt)) @@ -525,7 +525,7 @@ constexpr auto getBqImgs() return imgs; } -void GameWorldView::DrawConstructionAid(const MapPoint& pt, const DrawPoint& curPos) +void GameWorldView::drawConstructionAid(const MapPoint& pt, const DrawPoint& curPos) { BuildingQuality bq = gwv.GetBQ(pt); if(bq != BuildingQuality::Nothing) @@ -533,28 +533,28 @@ void GameWorldView::DrawConstructionAid(const MapPoint& pt, const DrawPoint& cur constexpr auto bqImgs = getBqImgs(); auto* bm = LOADER.getMapTexture(bqImgs[bq]); // Draw building quality icon - bm->DrawFull(curPos); + bm->drawFull(curPos); // Show ability to construct military buildings if(getWorld().getGGS().isEnabled(AddonId::MILITARY_AID)) { if(!getWorld().isMilitaryBuildingNearNode(pt, gwv.getPlayerId()) && (bq == BuildingQuality::Hut || bq == BuildingQuality::House || bq == BuildingQuality::Castle || bq == BuildingQuality::Harbor)) - LOADER.getImageN("map_new", 20000)->DrawFull(curPos - DrawPoint(-1, bm->getSize().y + 5)); + LOADER.getImageN("map_new", 20000)->drawFull(curPos - DrawPoint(-1, bm->getSize().y + 5)); } } } -void GameWorldView::DrawObject(const MapPoint& pt, const DrawPoint& curPos) const +void GameWorldView::drawObject(const MapPoint& pt, const DrawPoint& curPos) const { noBase* obj = getWorld().getNode(pt).obj; if(!obj) return; - obj->Draw(curPos); + obj->draw(curPos); } -void GameWorldView::DrawBoundaryStone(const MapPoint& pt, const DrawPoint pos, Visibility vis) +void GameWorldView::drawBoundaryStone(const MapPoint& pt, const DrawPoint pos, Visibility vis) { if(vis == Visibility::Invisible) return; @@ -571,7 +571,7 @@ void GameWorldView::DrawBoundaryStone(const MapPoint& pt, const DrawPoint pos, V const Nation nation = getWorld().getPlayer(owner - 1).nation; unsigned player_color = getWorld().getPlayer(owner - 1).color; if(isFoW) - player_color = CalcPlayerFOWDrawColor(player_color); + player_color = calcPlayerFOWDrawColor(player_color); const auto curVertexPos = gwv.getTerrainRenderer().getVertexPos(pt); for(const auto bPos : helpers::EnumRange{}) @@ -589,7 +589,7 @@ void GameWorldView::DrawBoundaryStone(const MapPoint& pt, const DrawPoint pos, V } } -void GameWorldView::DrawResource(const MapPoint& pt, DrawPoint curPos, const Cheats::ResourceRevealMode resRevealMode) +void GameWorldView::drawResource(const MapPoint& pt, DrawPoint curPos, const Cheats::ResourceRevealMode resRevealMode) { using RRM = Cheats::ResourceRevealMode; @@ -627,56 +627,56 @@ void GameWorldView::DrawResource(const MapPoint& pt, DrawPoint curPos, const Che { for([[maybe_unused]] const auto i : helpers::range(amount)) { - bm->DrawFull(curPos); + bm->drawFull(curPos); curPos.y -= 4; } } } -void GameWorldView::ToggleShowBQ() +void GameWorldView::toggleShowBQ() { show_bq = !show_bq; - SaveIngameSettingsValues(); + saveIngameSettingsValues(); onHudSettingsChanged(); } -void GameWorldView::ToggleShowNames() +void GameWorldView::toggleShowNames() { show_names = !show_names; - SaveIngameSettingsValues(); + saveIngameSettingsValues(); onHudSettingsChanged(); } -void GameWorldView::ToggleShowProductivity() +void GameWorldView::toggleShowProductivity() { show_productivity = !show_productivity; - SaveIngameSettingsValues(); + saveIngameSettingsValues(); onHudSettingsChanged(); } -void GameWorldView::ToggleShowNamesAndProductivity() +void GameWorldView::toggleShowNamesAndProductivity() { if(show_productivity && show_names) show_productivity = show_names = false; else show_productivity = show_names = true; - SaveIngameSettingsValues(); + saveIngameSettingsValues(); onHudSettingsChanged(); } -void GameWorldView::CopyHudSettingsTo(GameWorldView& other, bool copyBQ) const +void GameWorldView::copyHudSettingsTo(GameWorldView& other, bool copyBQ) const { other.show_bq = (copyBQ ? show_bq : false); other.show_names = show_names; other.show_productivity = show_productivity; } -void GameWorldView::MoveBy(const DrawPoint& numPixels) +void GameWorldView::moveBy(const DrawPoint& numPixels) { - MoveTo(offset + numPixels); + moveTo(offset + numPixels); } -void GameWorldView::MoveTo(const DrawPoint& newPos) +void GameWorldView::moveTo(const DrawPoint& newPos) { offset = newPos; DrawPoint size(getWorld().getWidth() * TR_W, getWorld().getHeight() * TR_H); @@ -691,10 +691,10 @@ void GameWorldView::MoveTo(const DrawPoint& newPos) offset.y += size.y; } - CalcFxLx(); + calcFxLx(); } -void GameWorldView::MoveToMapPt(const MapPoint pt) +void GameWorldView::moveToMapPt(const MapPoint pt) { if(!pt.isValid()) return; @@ -702,14 +702,14 @@ void GameWorldView::MoveToMapPt(const MapPoint pt) lastOffset = offset; Position nodePos = getWorld().getNodePos(pt); - MoveTo(nodePos - getSize() / 2u); + moveTo(nodePos - getSize() / 2u); } -void GameWorldView::MoveToLastPosition() +void GameWorldView::moveToLastPosition() { Position newLastOffset = offset; - MoveTo(lastOffset); + moveTo(lastOffset); lastOffset = newLastOffset; } @@ -773,20 +773,20 @@ unsigned GameWorldView::getBuildingRadius(BuildingType bld) const BOOST_UNREACHABLE_RETURN(0); // LCOV_EXCL_LINE } -void GameWorldView::AddDrawNodeCallback(IDrawNodeCallback* newCallback) +void GameWorldView::addDrawNodeCallback(IDrawNodeCallback* newCallback) { RTTR_Assert(newCallback); drawNodeCallbacks.push_back(newCallback); } -void GameWorldView::RemoveDrawNodeCallback(IDrawNodeCallback* callbackToRemove) +void GameWorldView::removeDrawNodeCallback(IDrawNodeCallback* callbackToRemove) { auto itPos = helpers::find(drawNodeCallbacks, callbackToRemove); RTTR_Assert(itPos != drawNodeCallbacks.end()); drawNodeCallbacks.erase(itPos); } -void GameWorldView::ShowRadiusPreview(MapPoint center, unsigned radius) +void GameWorldView::showRadiusPreview(MapPoint center, unsigned radius) { if(radiusPreview_ && radiusPreview_->center == center && radiusPreview_->radius == radius) return; @@ -799,7 +799,7 @@ void GameWorldView::ShowRadiusPreview(MapPoint center, unsigned radius) radiusPreview_ = RadiusPreview{center, radius, std::move(pts)}; } -DrawPoint GameWorldView::SnapToNearestCopy(const DrawPoint pt, const DrawPoint ref, const Extent mapSize) +DrawPoint GameWorldView::snapToNearestCopy(const DrawPoint pt, const DrawPoint ref, const Extent mapSize) { // Find how many map sizes separate `pt` from `ref`, round to the nearest integer number of wraps. const auto k = PointF(ref - pt) / mapSize; @@ -808,7 +808,7 @@ DrawPoint GameWorldView::SnapToNearestCopy(const DrawPoint pt, const DrawPoint r return pt + DrawPoint(kRounded) * mapSize; } -void GameWorldView::DrawRadiusOutline() +void GameWorldView::drawRadiusOutline() { if(!radiusPreview_) return; @@ -826,12 +826,12 @@ void GameWorldView::DrawRadiusOutline() for(auto screenPt : radiusPreview_->outline) { - screenPt = SnapToNearestCopy(screenPt, centerScr, mapPxSize) - offset; - Window::DrawRectangle(Rect(screenPt - BORDER_SIZE / 2, BORDER_SIZE), BORDER_COLOR); + screenPt = snapToNearestCopy(screenPt, centerScr, mapPxSize) - offset; + Window::drawRectangle(Rect(screenPt - BORDER_SIZE / 2, BORDER_SIZE), BORDER_COLOR); } } -void GameWorldView::UpdateRadiusPreviewForMousePos() +void GameWorldView::updateRadiusPreviewForMousePos() { const auto& world = getWorld(); std::optional bldType; @@ -858,14 +858,14 @@ void GameWorldView::UpdateRadiusPreviewForMousePos() { const unsigned bldRadius = getBuildingRadius(*bldType); if(bldRadius > 0) - ShowRadiusPreview(selPt, bldRadius); + showRadiusPreview(selPt, bldRadius); else - HideRadiusPreview(); + hideRadiusPreview(); } else - HideRadiusPreview(); + hideRadiusPreview(); } -void GameWorldView::CalcFxLx() +void GameWorldView::calcFxLx() { // Calc first and last point in map units (with 1 extra for incomplete triangles) firstPt.x = offset.x / TR_W - 1; @@ -891,13 +891,13 @@ void GameWorldView::CalcFxLx() } } -void GameWorldView::Resize(const Extent& newSize) +void GameWorldView::resize(const Extent& newSize) { size_ = newSize; - CalcFxLx(); + calcFxLx(); } -void GameWorldView::SaveIngameSettingsValues() const +void GameWorldView::saveIngameSettingsValues() const { auto& ingameSettings = SETTINGS.ingame; ingameSettings.showBQ = show_bq; diff --git a/libs/s25main/world/GameWorldView.h b/libs/s25main/world/GameWorldView.h index f63be08eca..1839efc8de 100644 --- a/libs/s25main/world/GameWorldView.h +++ b/libs/s25main/world/GameWorldView.h @@ -100,30 +100,30 @@ class GameWorldView void setNextZoomFactor(); // Converts a view coordinate to map position - Position ViewPosToMap(Position pos) const; + Position viewPosToMap(Position pos) const; /// Show or hide construction aid - void ToggleShowBQ(); + void toggleShowBQ(); /// Show or hide building names - void ToggleShowNames(); + void toggleShowNames(); /// Show or hide productivity - void ToggleShowProductivity(); + void toggleShowProductivity(); /// Toggle names and productivity completely on or off - void ToggleShowNamesAndProductivity(); + void toggleShowNamesAndProductivity(); /// Copy visibility of HUD elements from this view to another - void CopyHudSettingsTo(GameWorldView& other, bool copyBQ) const; + void copyHudSettingsTo(GameWorldView& other, bool copyBQ) const; - void Draw(const RoadBuildState& rb, MapPoint selected, bool drawMouse, unsigned* water = nullptr); + void draw(const RoadBuildState& rb, MapPoint selected, bool drawMouse, unsigned* water = nullptr); /// Moves the map view by the given offset in pixels - void MoveBy(const DrawPoint& numPixels); + void moveBy(const DrawPoint& numPixels); /// Moves a position on the map in pixels - void MoveTo(const DrawPoint& newPos); + void moveTo(const DrawPoint& newPos); /// Zentriert den Bildschirm auf ein bestimmtes Map-Object - void MoveToMapPt(MapPoint pt); + void moveToMapPt(MapPoint pt); /// Springt zur letzten Position, bevor man "weggesprungen" ist - void MoveToLastPosition(); + void moveToLastPosition(); DrawPoint getOffset() const { return offset; } @@ -131,21 +131,21 @@ class GameWorldView unsigned getBuildingRadius(BuildingType bld) const; /// Add a debug node printer - void AddDrawNodeCallback(IDrawNodeCallback* newCallback); - void RemoveDrawNodeCallback(IDrawNodeCallback* callbackToRemove); + void addDrawNodeCallback(IDrawNodeCallback* newCallback); + void removeDrawNodeCallback(IDrawNodeCallback* callbackToRemove); /// Show a radius preview outline on the map - void ShowRadiusPreview(MapPoint center, unsigned radius); - void HideRadiusPreview() { radiusPreview_ = std::nullopt; } + void showRadiusPreview(MapPoint center, unsigned radius); + void hideRadiusPreview() { radiusPreview_ = std::nullopt; } /// Update radius preview based on which map node is selected - void UpdateRadiusPreviewForMousePos(); + void updateRadiusPreviewForMousePos(); /// Get radius preview currently shown [[nodiscard]] const std::optional& getRadiusPreview() const noexcept { return radiusPreview_; } /// Snap a point to the nearest toroidal copy relative to a reference position, given the map size in pixels - static DrawPoint SnapToNearestCopy(DrawPoint pt, DrawPoint ref, Extent mapSize); + static DrawPoint snapToNearestCopy(DrawPoint pt, DrawPoint ref, Extent mapSize); /// Gibt selektierten Punkt zurück MapPoint getSelectedPt() const { return selPt; } @@ -155,30 +155,30 @@ class GameWorldView /// Gibt letzten Punkt an, der beim Zeichnen angezeigt wird Position getLastPt() const { return lastPt; } - void Resize(const Extent& newSize); + void resize(const Extent& newSize); /// Triggered when visibility of HUD elements changes boost::signals2::signal onHudSettingsChanged; private: - void CalcFxLx(); - void DrawBoundaryStone(const MapPoint& pt, DrawPoint pos, Visibility vis); - void DrawResource(const MapPoint& pt, DrawPoint curPos, Cheats::ResourceRevealMode resRevealMode); - void DrawObject(const MapPoint& pt, const DrawPoint& curPos) const; - void DrawConstructionAid(const MapPoint& pt, const DrawPoint& curPos); - void DrawFigures(const MapPoint& pt, const DrawPoint& curPos, + void calcFxLx(); + void drawBoundaryStone(const MapPoint& pt, DrawPoint pos, Visibility vis); + void drawResource(const MapPoint& pt, DrawPoint curPos, Cheats::ResourceRevealMode resRevealMode); + void drawObject(const MapPoint& pt, const DrawPoint& curPos) const; + void drawConstructionAid(const MapPoint& pt, const DrawPoint& curPos); + void drawFigures(const MapPoint& pt, const DrawPoint& curPos, std::vector& objsBetweenRows) const; - void DrawMovingFiguresFromBelow(const TerrainRenderer& terrainRenderer, const DrawPoint& curPos, + void drawMovingFiguresFromBelow(const TerrainRenderer& terrainRenderer, const DrawPoint& curPos, std::vector& objsBetweenRows); - void DrawNameProductivityOverlay(const TerrainRenderer& terrainRenderer); - void DrawProductivity(const noBaseBuilding& no, const DrawPoint& curPos); - void DrawGUI(const RoadBuildState& rb, const TerrainRenderer& terrainRenderer, const MapPoint& selectedPt, + void drawNameProductivityOverlay(const TerrainRenderer& terrainRenderer); + void drawProductivity(const noBaseBuilding& no, const DrawPoint& curPos); + void drawGUI(const RoadBuildState& rb, const TerrainRenderer& terrainRenderer, const MapPoint& selectedPt, bool drawMouse); /// Draw a radius outline ring - void DrawRadiusOutline(); + void drawRadiusOutline(); - void SaveIngameSettingsValues() const; + void saveIngameSettingsValues() const; void updateEffectiveZoomFactor(); }; diff --git a/libs/s25main/world/GameWorldViewer.cpp b/libs/s25main/world/GameWorldViewer.cpp index c5e59c9a7e..8f60f1507e 100644 --- a/libs/s25main/world/GameWorldViewer.cpp +++ b/libs/s25main/world/GameWorldViewer.cpp @@ -21,7 +21,7 @@ GameWorldViewer::GameWorldViewer(unsigned playerId, GameWorldBase& gwb) : playerId_(playerId), gwb(gwb) { - InitVisualData(); + initVisualData(); maxNodeAltitude_ = 0; RTTR_FOREACH_PT(MapPoint, gwb.getSize()) { @@ -35,9 +35,9 @@ GameWorldViewer::GameWorldViewer(unsigned playerId, GameWorldBase& gwb) : player }); } -void GameWorldViewer::InitVisualData() +void GameWorldViewer::initVisualData() { - visualNodes.Resize(gwb.getSize()); + visualNodes.resize(gwb.getSize()); RTTR_FOREACH_PT(MapPoint, gwb.getSize()) { VisualMapNode& vNode = visualNodes[pt]; @@ -47,28 +47,28 @@ void GameWorldViewer::InitVisualData() std::fill(vNode.roads.begin(), vNode.roads.end(), PointRoad::None); } evRoadConstruction = - gwb.getNotifications().subscribe([this](const RoadNote& note) { RoadConstructionEnded(note); }); + gwb.getNotifications().subscribe([this](const RoadNote& note) { roadConstructionEnded(note); }); evBQChanged = gwb.getNotifications().subscribe([this](const NodeNote& note) { if(note.type == NodeNote::BQ) - RecalcBQ(note.pos); + recalcBQ(note.pos); }); } -void GameWorldViewer::InitTerrainRenderer() +void GameWorldViewer::initTerrainRenderer() { - tr.GenerateOpenGL(*this); + tr.generateOpenGL(*this); // Notify renderer about altitude changes evAltitudeChanged = gwb.getNotifications().subscribe([this](const NodeNote& note) { if(note.type == NodeNote::Altitude) { maxNodeAltitude_ = std::max(maxNodeAltitude_, gwb.getNode(note.pos).altitude); - tr.AltitudeChanged(note.pos, *this); + tr.altitudeChanged(note.pos, *this); } }); // And visibility changes evVisibilityChanged = gwb.getNotifications().subscribe([this](const PlayerNodeNote& note) { if(note.type == PlayerNodeNote::Visibility) - VisibilityChanged(note.pt, note.player); + visibilityChanged(note.pt, note.player); }); } @@ -97,7 +97,7 @@ unsigned GameWorldViewer::getNumSoldiersForAttack(const MapPoint pt) const // Militärgebäude in der Nähe finden unsigned total_count = 0; - sortedMilitaryBlds buildings = getWorld().LookForMilitaryBuildings(pt, 3); + sortedMilitaryBlds buildings = getWorld().lookForMilitaryBuildings(pt, 3); for(auto& building : buildings) { // Muss ein Gebäude von uns sein und darf nur ein "normales Militärgebäude" sein (kein HQ etc.) @@ -110,14 +110,14 @@ unsigned GameWorldViewer::getNumSoldiersForAttack(const MapPoint pt) const BuildingQuality GameWorldViewer::GetBQ(const MapPoint& pt) const { - return getWorld().AdjustBQ(pt, playerId_, visualNodes[pt].bq); + return getWorld().adjustBQ(pt, playerId_, visualNodes[pt].bq); } Visibility GameWorldViewer::getVisibility(const MapPoint pt, const bool checkAllVisible) const { if(checkAllVisible && isAllVisible()) return Visibility::Visible; - return getWorld().CalcVisiblityWithAllies(pt, playerId_); + return getWorld().calcVisiblityWithAllies(pt, playerId_); } bool GameWorldViewer::isAllVisible() const @@ -156,9 +156,9 @@ MapPoint GameWorldViewer::getNeighbour(const MapPoint pt, const Direction dir) c return getWorld().getNeighbour(pt, dir); } -void GameWorldViewer::RecalcAllColors() +void GameWorldViewer::recalcAllColors() { - tr.UpdateAllColors(*this); + tr.updateAllColors(*this); } /// liefert sichtbare Straße, im FoW entsprechend die FoW-Straße @@ -232,7 +232,7 @@ const noShip* GameWorldViewer::getShip(const MapPoint pt) const } return false; }; - world.CheckPointsInRadius(pt, 1u, checkPointForShips, true); + world.checkPointsInRadius(pt, 1u, checkPointForShips, true); return resultShip; } @@ -243,15 +243,15 @@ unsigned GameWorldViewer::getNumSoldiersForSeaAttack(const MapPoint pt) const return unsigned(getWorld().getSoldiersForSeaAttack(playerId_, pt).size()); } -void GameWorldViewer::ChangePlayer(unsigned player, bool updateVisualData /* = true*/) +void GameWorldViewer::changePlayer(unsigned player, bool updateVisualData /* = true*/) { if(player == playerId_) return; playerId_ = player; if(updateVisualData) { - RecalcAllColors(); - InitVisualData(); + recalcAllColors(); + initVisualData(); } } @@ -260,46 +260,46 @@ helpers::EnumArray GameWorldViewer::getNeighbours(const Map return getWorld().getNeighbours(pt); } -void GameWorldViewer::VisibilityChanged(const MapPoint& pt, unsigned player) +void GameWorldViewer::visibilityChanged(const MapPoint& pt, unsigned player) { // If visibility changed for us, or our team mate if shared view is on -> Update renderer if(player == playerId_ || (getWorld().getGGS().teamView && getWorld().getPlayer(playerId_).isAlly(player))) - tr.VisibilityChanged(pt, *this); + tr.visibilityChanged(pt, *this); } -void GameWorldViewer::RoadConstructionEnded(const RoadNote& note) +void GameWorldViewer::roadConstructionEnded(const RoadNote& note) { if(note.player != playerId_ || (note.type != RoadNote::Constructed && note.type != RoadNote::ConstructionFailed)) //-V560 return; // Road construction command ended -> Remove visual overlay - RemoveVisualRoad(note.pos, note.route); + removeVisualRoad(note.pos, note.route); } -void GameWorldViewer::RecalcBQ(const MapPoint& pt) +void GameWorldViewer::recalcBQ(const MapPoint& pt) { BQCalculator calcBQ(getWorld()); visualNodes[pt].bq = calcBQ(pt, [this](const MapPoint& pos) { return isOnRoad(pos); }); } -void GameWorldViewer::RecalcBQForRoad(const MapPoint& pt) +void GameWorldViewer::recalcBQForRoad(const MapPoint& pt) { - RecalcBQ(pt); + recalcBQ(pt); for(const Direction dir : {Direction::East, Direction::SouthEast, Direction::SouthWest}) - RecalcBQ(getNeighbour(pt, dir)); + recalcBQ(getNeighbour(pt, dir)); } -void GameWorldViewer::RemoveVisualRoad(const MapPoint& start, const std::vector& route) +void GameWorldViewer::removeVisualRoad(const MapPoint& start, const std::vector& route) { MapPoint curPt = start; for(auto i : route) { setVisiblePointRoad(curPt, i, PointRoad::None); - RecalcBQForRoad(curPt); + recalcBQForRoad(curPt); curPt = getWorld().getNeighbour(curPt, i); } - RecalcBQForRoad(curPt); + recalcBQForRoad(curPt); } bool GameWorldViewer::isRoadAvailable(bool isWaterRoad, const MapPoint& pt) const diff --git a/libs/s25main/world/GameWorldViewer.h b/libs/s25main/world/GameWorldViewer.h index 94911a402a..8bbf2017fb 100644 --- a/libs/s25main/world/GameWorldViewer.h +++ b/libs/s25main/world/GameWorldViewer.h @@ -29,7 +29,7 @@ class GameWorldViewer GameWorldViewer(unsigned playerId, GameWorldBase& gwb); /// Init the terrain renderer. Must be done before first call to GetTerrainRenderer! - void InitTerrainRenderer(); + void initTerrainRenderer(); /// Return the world itself const GameWorldBase& getWorld() const { return gwb; } @@ -52,7 +52,7 @@ class GameWorldViewer /// Get BQ for this player BuildingQuality GetBQ(const MapPoint& pt) const; /// Recalculates the visual BQ when a road part is build at that point - void RecalcBQForRoad(const MapPoint& pt); + void recalcBQForRoad(const MapPoint& pt); /// Ermittelt Sichtbarkeit eines Punktes für den lokalen Spieler, berücksichtigt ggf. Teamkameraden /// If checkAllVisible is false then `IsAllVisible` is assumed to return false, else it is called to check Visibility getVisibility(MapPoint pt, bool checkAllVisible = true) const; @@ -73,7 +73,7 @@ class GameWorldViewer void setVisiblePointRoad(MapPoint pt, Direction dir, PointRoad type); bool isOnRoad(const MapPoint& pt) const; /// Remove a visual (not yet built) road - void RemoveVisualRoad(const MapPoint& start, const std::vector& route); + void removeVisualRoad(const MapPoint& start, const std::vector& route); /// Checks if the road can be build in the world and additonally if there is no virtual road at that point bool isRoadAvailable(bool isWaterRoad, const MapPoint& pt) const; @@ -88,10 +88,10 @@ class GameWorldViewer const noShip* getShip(MapPoint pt) const; /// Schattierungen (vor allem FoW) neu berechnen - void RecalcAllColors(); + void recalcAllColors(); /// Makes this a viewer for another player - void ChangePlayer(unsigned player, bool updateVisualData = true); + void changePlayer(unsigned player, bool updateVisualData = true); helpers::EnumArray getNeighbours(MapPoint pt) const; @@ -111,8 +111,8 @@ class GameWorldViewer /// Max height of any node uint8_t maxNodeAltitude_ = 0; - void InitVisualData(); - inline void VisibilityChanged(const MapPoint& pt, unsigned player); - inline void RoadConstructionEnded(const RoadNote& note); - void RecalcBQ(const MapPoint& pt); + void initVisualData(); + inline void visibilityChanged(const MapPoint& pt, unsigned player); + inline void roadConstructionEnded(const RoadNote& note); + void recalcBQ(const MapPoint& pt); }; diff --git a/libs/s25main/world/MapBase.cpp b/libs/s25main/world/MapBase.cpp index b9e0a0048e..5b899f2276 100644 --- a/libs/s25main/world/MapBase.cpp +++ b/libs/s25main/world/MapBase.cpp @@ -10,14 +10,14 @@ #include #include -unsigned MapBase::CreateGUIID(MapPoint pt) +unsigned MapBase::createGUIID(MapPoint pt) { return pt.y * MAX_MAP_SIZE + pt.x; } MapBase::MapBase() : size_(MapExtent::all(0)) {} -void MapBase::Resize(const MapExtent& newSize) +void MapBase::resize(const MapExtent& newSize) { // Odd heights make the map impossible (map wraps around so start and end must match) // For width it is technically possible to have odd sizes so we don't check this @@ -85,7 +85,7 @@ MapPoint MapBase::getNeighbour(const MapPoint pt, const Direction dir) const MapPoint MapBase::getNeighbour2(const MapPoint pt, unsigned dir) const { - return MakeMapPoint(::getNeighbour2(Position(pt), dir)); + return makeMapPoint(::getNeighbour2(Position(pt), dir)); } std::vector MapBase::getAllNeighboursUnion(const std::vector& points) const @@ -118,7 +118,7 @@ helpers::EnumArray MapBase::getNeighbours(const MapPoint pt MapPoint(!isEvenRow ? pt.x : xminus1, yplus1)}; } -unsigned MapBase::CalcDistance(const Position& p1, const Position& p2) const +unsigned MapBase::calcDistance(const Position& p1, const Position& p2) const { int dx = ((p1.x - p2.x) * 2) + (p1.y & 1) - (p2.y & 1); int dy = std::abs(p1.y - p2.y) * 2; @@ -137,9 +137,9 @@ unsigned MapBase::CalcDistance(const Position& p1, const Position& p2) const return ((dy + (dx > 0 ? dx : 0)) / 2); } -unsigned MapBase::CalcMaxDistance() const +unsigned MapBase::calcMaxDistance() const { - return CalcDistance(MapPoint::all(0), MapPoint(size_.x / 2, size_.y / 2)); + return calcDistance(MapPoint::all(0), MapPoint(size_.x / 2, size_.y / 2)); } ShipDirection MapBase::GetShipDir(MapPoint fromPt, MapPoint toPt) const @@ -189,7 +189,7 @@ ShipDirection MapBase::GetShipDir(MapPoint fromPt, MapPoint toPt) const } } -MapPoint MapBase::MakeMapPoint(Position pt) const +MapPoint MapBase::makeMapPoint(Position pt) const { - return ::MakeMapPoint(pt, size_); + return ::makeMapPoint(pt, size_); } diff --git a/libs/s25main/world/MapBase.h b/libs/s25main/world/MapBase.h index 8143862b4a..16ba02bb86 100644 --- a/libs/s25main/world/MapBase.h +++ b/libs/s25main/world/MapBase.h @@ -37,18 +37,18 @@ class MapBase MapExtent size_; public: - static unsigned CreateGUIID(MapPoint pt); + static unsigned createGUIID(MapPoint pt); MapBase(); - virtual void Resize(const MapExtent& newSize); + virtual void resize(const MapExtent& newSize); /// Return the size of the world unsigned short getWidth() const { return getSize().x; } unsigned short getHeight() const { return getSize().y; } MapExtent getSize() const { return size_; } /// Returns a MapPoint from a point. This ensures, the coords are actually in the map [0, mapSize) - MapPoint MakeMapPoint(Position pt) const; + MapPoint makeMapPoint(Position pt) const; /// Returns the linear index for a map point unsigned getIdx(MapPoint pt) const; @@ -87,15 +87,15 @@ class MapBase /// Returns true, if the IsValid functor returns true for any point in the given radius /// If includePt is true, then the point itself is also checked template - bool CheckPointsInRadius(MapPoint pt, unsigned radius, T_IsValidPt&& isValid, bool includePt) const; + bool checkPointsInRadius(MapPoint pt, unsigned radius, T_IsValidPt&& isValid, bool includePt) const; /// Return the distance between 2 points on the map (includes wrapping around map borders) - unsigned CalcDistance(const Position& p1, const Position& p2) const; - unsigned CalcDistance(const MapPoint p1, const MapPoint p2) const + unsigned calcDistance(const Position& p1, const Position& p2) const; + unsigned calcDistance(const MapPoint p1, const MapPoint p2) const { - return CalcDistance(Position(p1), Position(p2)); + return calcDistance(Position(p1), Position(p2)); } - unsigned CalcMaxDistance() const; + unsigned calcMaxDistance() const; /// Return the direction for ships for going from one point to another ShipDirection GetShipDir(MapPoint fromPt, MapPoint toPt) const; }; @@ -165,7 +165,7 @@ detail::GetPointsResult_t MapBase::getPointsInRadius(const MapPoi } template -inline bool MapBase::CheckPointsInRadius(const MapPoint pt, unsigned radius, T_IsValidPt&& isValid, +inline bool MapBase::checkPointsInRadius(const MapPoint pt, unsigned radius, T_IsValidPt&& isValid, bool includePt) const { if(includePt && isValid(pt, 0)) diff --git a/libs/s25main/world/MapGeometry.cpp b/libs/s25main/world/MapGeometry.cpp index 5fce5361f3..ac83ed561a 100644 --- a/libs/s25main/world/MapGeometry.cpp +++ b/libs/s25main/world/MapGeometry.cpp @@ -60,7 +60,7 @@ Position getNeighbour2(Position pt, unsigned dir) return pt; } -MapPoint MakeMapPoint(Position pt, const MapExtent& size) +MapPoint makeMapPoint(Position pt, const MapExtent& size) { // Shift into range pt.x %= size.x; diff --git a/libs/s25main/world/MapGeometry.h b/libs/s25main/world/MapGeometry.h index e3ffad1149..c5a9a42944 100644 --- a/libs/s25main/world/MapGeometry.h +++ b/libs/s25main/world/MapGeometry.h @@ -10,7 +10,7 @@ Position getNeighbour(const Position& p, Direction dir); Position getNeighbour2(Position pt, unsigned dir); -MapPoint MakeMapPoint(Position pt, const MapExtent& size); +MapPoint makeMapPoint(Position pt, const MapExtent& size); /// Return the position of the node on a flat map Position getNodePos(MapPoint pt); Position getNodePos(Position pt); diff --git a/libs/s25main/world/MapLoader.cpp b/libs/s25main/world/MapLoader.cpp index fd2eb3241d..3712453967 100644 --- a/libs/s25main/world/MapLoader.cpp +++ b/libs/s25main/world/MapLoader.cpp @@ -53,15 +53,15 @@ bool MapLoader::Load(const libsiedler2::ArchivItem_Map& map, Exploration explora world_.getDescription().landscapes.find([gfxSet](const LandscapeDesc& l) { return l.s2Id == gfxSet; }); world_.Init(MapExtent(map.getHeader().getWidth(), map.getHeader().getHeight()), lt); //-V807 - if(!InitNodes(map, exploration)) + if(!initNodes(map, exploration)) return false; - PlaceObjects(map); - PlaceAnimals(map); - if(!InitSeasAndHarbors(world_)) + placeObjects(map); + placeAnimals(map); + if(!initSeasAndHarbors(world_)) return false; /// Schatten - InitShadows(world_); + initShadows(world_); // If we have explored FoW, create the FoW objects if(exploration == Exploration::FogOfWarExplored) @@ -83,29 +83,29 @@ bool MapLoader::Load(const boost::filesystem::path& mapFilePath) if(!Load(map, world_.getGGS().exploration)) return false; - if(!PlaceHQs()) + if(!placeHQs()) return false; return true; } -bool MapLoader::LoadLuaScript(Game& game, ILocalGameState& localgameState, const boost::filesystem::path& luaFilePath) +bool MapLoader::loadLuaScript(Game& game, ILocalGameState& localgameState, const boost::filesystem::path& luaFilePath) { if(!bfs::exists(luaFilePath)) return false; auto lua = std::make_unique(game, localgameState); - if(!lua->loadScript(luaFilePath) || !lua->CheckScriptVersion()) + if(!lua->loadScript(luaFilePath) || !lua->checkScriptVersion()) return false; game.setLua(std::move(lua)); return true; } -bool MapLoader::PlaceHQs(bool addStartWares) +bool MapLoader::placeHQs(bool addStartWares) { std::vector hqPositions = hqPositions_; if(world_.getGGS().randomStartPosition) RANDOM_SHUFFLE2(hqPositions, 0); - return PlaceHQs(world_, hqPositions, addStartWares); + return placeHQs(world_, hqPositions, addStartWares); } void MapLoader::setupResources(GameWorldBase& world, const bool fixFish) @@ -120,13 +120,13 @@ void MapLoader::setupResources(GameWorldBase& world, const bool fixFish) case 3: target = ResourceType::Coal; break; case 4: target = ResourceType::Granite; break; } - ConvertMineResourceTypes(world, ResourceType::Gold, target); - PlaceAndFixWater(world); + convertMineResourceTypes(world, ResourceType::Gold, target); + placeAndFixWater(world); if(fixFish) - RemoveUnusableFishResources(world); + removeUnusableFishResources(world); } -void MapLoader::ConvertMineResourceTypes(GameWorldBase& world, ResourceType from, ResourceType to) +void MapLoader::convertMineResourceTypes(GameWorldBase& world, ResourceType from, ResourceType to) { // LOG.write(("Convert map resources from %i to %i\n", from, to); if(from == to) @@ -145,7 +145,7 @@ void MapLoader::ConvertMineResourceTypes(GameWorldBase& world, ResourceType from } } -void MapLoader::PlaceAndFixWater(GameWorldBase& world) +void MapLoader::placeAndFixWater(GameWorldBase& world) { const bool waterEverywhere = world.getGGS().getSelection(AddonId::EXHAUSTIBLE_WATER) == 1; @@ -182,7 +182,7 @@ void MapLoader::PlaceAndFixWater(GameWorldBase& world) } } -void MapLoader::RemoveUnusableFishResources(GameWorldBase& world) +void MapLoader::removeUnusableFishResources(GameWorldBase& world) { const auto isWaterPoint = [&world](const MapPoint nb) { return world.isWaterPoint(nb); }; for(const MapCoord y : helpers::range(world.getHeight())) @@ -207,10 +207,10 @@ void MapLoader::RemoveUnusableFishResources(GameWorldBase& world) } } -void MapLoader::InitShadows(World& world) +void MapLoader::initShadows(World& world) { RTTR_FOREACH_PT(MapPoint, world.getSize()) - world.RecalcShadow(pt); + world.recalcShadow(pt); } void MapLoader::setMapExplored(World& world) @@ -222,7 +222,7 @@ void MapLoader::setMapExplored(World& world) { // If we have FoW here, save it if(world.getNode(pt).fow[i].visibility == Visibility::FogOfWar) - world.SaveFOWNode(pt, i, 0); + world.saveFOWNode(pt, i, 0); } } } @@ -234,7 +234,7 @@ DescIdx MapLoader::getTerrainFromS2(uint8_t s2Id) const }); } -bool MapLoader::InitNodes(const libsiedler2::ArchivItem_Map& map, Exploration exploration) +bool MapLoader::initNodes(const libsiedler2::ArchivItem_Map& map, Exploration exploration) { using libsiedler2::MapLayer; // Init node data (everything except the objects, figures and BQ) @@ -303,7 +303,7 @@ bool MapLoader::InitNodes(const libsiedler2::ArchivItem_Map& map, Exploration ex return true; } -void MapLoader::PlaceObjects(const libsiedler2::ArchivItem_Map& map) +void MapLoader::placeObjects(const libsiedler2::ArchivItem_Map& map) { hqPositions_.clear(); @@ -321,7 +321,7 @@ void MapLoader::PlaceObjects(const libsiedler2::ArchivItem_Map& map) if(lc < MAX_PLAYERS) { while(hqPositions_.size() <= lc) - hqPositions_.push_back(MapPoint::Invalid()); + hqPositions_.push_back(MapPoint::invalid()); hqPositions_[lc] = pt; } } @@ -465,7 +465,7 @@ void MapLoader::PlaceObjects(const libsiedler2::ArchivItem_Map& map) } } -void MapLoader::PlaceAnimals(const libsiedler2::ArchivItem_Map& map) +void MapLoader::placeAnimals(const libsiedler2::ArchivItem_Map& map) { // Tiere auslesen RTTR_FOREACH_PT(MapPoint, world_.getSize()) @@ -476,7 +476,7 @@ void MapLoader::PlaceAnimals(const libsiedler2::ArchivItem_Map& map) { // TODO: Which id is the polar bear? case 1: - species = (RANDOM.Rand(RANDOM_CONTEXT2(0), 2) == 0) ? Species::RabbitWhite : Species::RabbitGrey; + species = (RANDOM.rand(RANDOM_CONTEXT2(0), 2) == 0) ? Species::RabbitWhite : Species::RabbitGrey; break; // Random rabbit case 2: species = Species::Fox; break; case 3: species = Species::Stag; break; @@ -494,11 +494,11 @@ void MapLoader::PlaceAnimals(const libsiedler2::ArchivItem_Map& map) continue; } - world_.AddFigure(pt, std::make_unique(species, pt)).StartLiving(); + world_.addFigure(pt, std::make_unique(species, pt)).startLiving(); } } -bool MapLoader::PlaceHQs(GameWorldBase& world, const std::vector& hqPositions, const bool addStartWares) +bool MapLoader::placeHQs(GameWorldBase& world, const std::vector& hqPositions, const bool addStartWares) { for(unsigned i = 0; i < world.getNumPlayers(); ++i) { @@ -513,7 +513,7 @@ bool MapLoader::PlaceHQs(GameWorldBase& world, const std::vector& hqPo return false; } - auto* hq = checkedCast(BuildingFactory::CreateBuilding(world, BuildingType::Headquarters, + auto* hq = checkedCast(BuildingFactory::createBuilding(world, BuildingType::Headquarters, hqPositions[i], i, world.getPlayer(i).nation)); if(addStartWares) hq->addStartWares(); @@ -521,7 +521,7 @@ bool MapLoader::PlaceHQs(GameWorldBase& world, const std::vector& hqPo return true; } -bool MapLoader::InitSeasAndHarbors(World& world, const std::vector& additionalHarbors) +bool MapLoader::initSeasAndHarbors(World& world, const std::vector& additionalHarbors) { for(MapPoint pt : additionalHarbors) world.harborData.push_back(HarborPos(pt)); @@ -541,7 +541,7 @@ bool MapLoader::InitSeasAndHarbors(World& world, const std::vector& ad // Point is not yet assigned a sea but should be if(!world.getNode(pt).seaId && world.isSeaPoint(pt)) { - const auto seaSize = MeasureSea(world, pt, curSeaId); + const auto seaSize = measureSea(world, pt, curSeaId); world.seas.push_back(World::Sea(seaSize)); curSeaId = curSeaId.next(); } @@ -585,7 +585,7 @@ bool MapLoader::InitSeasAndHarbors(World& world, const std::vector& ad } // Calculate the neighbors and distances - CalcHarborPosNeighbors(world); + calcHarborPosNeighbors(world); return true; } @@ -600,7 +600,7 @@ struct CalcHarborPosNeighborsNode }; /// Calculate the distance from each harbor to the others -void MapLoader::CalcHarborPosNeighbors(World& world) +void MapLoader::calcHarborPosNeighbors(World& world) { for(HarborPos& harbor : world.harborData) { @@ -727,7 +727,7 @@ void MapLoader::CalcHarborPosNeighbors(World& world) /// Vermisst ein neues Weltmeer von einem Punkt aus, indem es alle mit diesem Punkt verbundenen /// Wasserpunkte mit der gleichen ID belegt und die Anzahl zur�ckgibt -unsigned MapLoader::MeasureSea(World& world, const MapPoint start, SeaId seaId) +unsigned MapLoader::measureSea(World& world, const MapPoint start, SeaId seaId) { // Breitensuche von diesem Punkt aus durchf�hren std::vector visited(world.getWidth() * world.getHeight(), false); diff --git a/libs/s25main/world/MapLoader.h b/libs/s25main/world/MapLoader.h index 22c499c61f..ff6444ff14 100644 --- a/libs/s25main/world/MapLoader.h +++ b/libs/s25main/world/MapLoader.h @@ -29,15 +29,15 @@ class MapLoader DescIdx getTerrainFromS2(uint8_t s2Id) const; /// Initialize the nodes according to the map data - bool InitNodes(const libsiedler2::ArchivItem_Map& map, Exploration exploration); + bool initNodes(const libsiedler2::ArchivItem_Map& map, Exploration exploration); /// Place all objects on the nodes according to the map data. - void PlaceObjects(const libsiedler2::ArchivItem_Map& map); - void PlaceAnimals(const libsiedler2::ArchivItem_Map& map); + void placeObjects(const libsiedler2::ArchivItem_Map& map); + void placeAnimals(const libsiedler2::ArchivItem_Map& map); /// Vermisst ein neues Weltmeer von einem Punkt aus, indem es alle mit diesem Punkt verbundenen /// Wasserpunkte mit der gleichen seaId belegt und die Anzahl zurückgibt - static unsigned MeasureSea(World& world, MapPoint start, SeaId seaId); - static void CalcHarborPosNeighbors(World& world); + static unsigned measureSea(World& world, MapPoint start, SeaId seaId); + static void calcHarborPosNeighbors(World& world); public: /// Construct a loader for the given world. @@ -46,11 +46,11 @@ class MapLoader bool Load(const libsiedler2::ArchivItem_Map& map, Exploration exploration); /// Load the map from the given filepath bool Load(const boost::filesystem::path& mapFilePath); - bool LoadLuaScript(Game& game, ILocalGameState& localgameState, const boost::filesystem::path& luaFilePath); + bool loadLuaScript(Game& game, ILocalGameState& localgameState, const boost::filesystem::path& luaFilePath); /// Place the HQs on a loaded map (must be loaded first as hqPositions etc. are used) /// Optionally add the starting wares to the HQs. /// Return false if there was an error (e.g. invalid start position) - bool PlaceHQs(bool addStartWares = true); + bool placeHQs(bool addStartWares = true); /// Setup resources like gold and water after loading a new map. /// TODO(Replay): Remove fixFish (always set to true) static void setupResources(GameWorldBase& world, bool fixFish = true); @@ -58,19 +58,19 @@ class MapLoader /// Return the (original/unshuffled) position of the players HQ (only valid after successful load) MapPoint getOriginalHQPos(unsigned player) const { return hqPositions_[player]; } - static void InitShadows(World& world); + static void initShadows(World& world); static void setMapExplored(World& world); - static bool InitSeasAndHarbors(World& world, + static bool initSeasAndHarbors(World& world, const std::vector& additionalHarbors = std::vector()); /// Place the HQs on a loaded map and add starting wares if desired. /// Return false if there was an error. - static bool PlaceHQs(GameWorldBase& world, const std::vector& hqPositions, bool addStartWares = true); + static bool placeHQs(GameWorldBase& world, const std::vector& hqPositions, bool addStartWares = true); private: /// Converts map resources between types or deletes them. Used for games without gold. - static void ConvertMineResourceTypes(GameWorldBase& world, ResourceType from, ResourceType to); + static void convertMineResourceTypes(GameWorldBase& world, ResourceType from, ResourceType to); /// Fills water depending on terrain and Addon setting. - static void PlaceAndFixWater(GameWorldBase& world); + static void placeAndFixWater(GameWorldBase& world); /// Removes fish resources that cannot be reached by fisheries. - static void RemoveUnusableFishResources(GameWorldBase& world); + static void removeUnusableFishResources(GameWorldBase& world); }; diff --git a/libs/s25main/world/MapSerializer.cpp b/libs/s25main/world/MapSerializer.cpp index 39bbbf7d42..8ca2f2803f 100644 --- a/libs/s25main/world/MapSerializer.cpp +++ b/libs/s25main/world/MapSerializer.cpp @@ -30,7 +30,7 @@ void MapSerializer::Serialize(const GameWorldBase& world, SerializedGameData& sg } // Katapultsteine serialisieren - sgd.PushObjectContainer(world.catapult_stones, true); + sgd.pushObjectContainer(world.catapult_stones, true); // Meeresinformationen serialisieren sgd.PushUnsignedInt(world.seas.size()); for(const auto& sea : world.seas) @@ -56,7 +56,7 @@ void MapSerializer::Serialize(const GameWorldBase& world, SerializedGameData& sg } } - sgd.PushObjectContainer(world.harbor_building_sites_from_sea, true); + sgd.pushObjectContainer(world.harbor_building_sites_from_sea, true); if(!world.hasLua()) sgd.PushLongString(""); @@ -102,7 +102,7 @@ void MapSerializer::Deserialize(GameWorldBase& world, SerializedGameData& sgd, G throw SerializedGameData::Error(std::string("Invalid landscape: ") + sLandscape); } world.Init(size, lt); - GameObject::ResetCounters(sgd.PopUnsignedInt()); + GameObject::resetCounters(sgd.PopUnsignedInt()); std::vector> landscapeTerrains; if(sgd.getGameDataVersion() < 3) @@ -125,7 +125,7 @@ void MapSerializer::Deserialize(GameWorldBase& world, SerializedGameData& sgd, G } } - sgd.PopObjectContainer(world.catapult_stones, GO_Type::Catapultstone); + sgd.popObjectContainer(world.catapult_stones, GO_Type::Catapultstone); world.seas.resize(sgd.PopUnsignedInt()); for(auto& sea : world.seas) @@ -137,7 +137,7 @@ void MapSerializer::Deserialize(GameWorldBase& world, SerializedGameData& sgd, G world.harborData.reserve(numHarborPositions); for([[maybe_unused]] const auto i : helpers::range(numHarborPositions)) { - world.harborData.emplace_back(sgd.PopMapPoint()); + world.harborData.emplace_back(sgd.popMapPoint()); auto& curHarborPos = world.harborData.back(); helpers::popContainer(sgd, curHarborPos.seaIds); for(auto& neighbor : curHarborPos.neighbors) @@ -205,7 +205,7 @@ void MapSerializer::Deserialize(GameWorldBase& world, SerializedGameData& sgd, G neighbor.sea = sea; break; } - if(world.FindShipPath(world.getCoastalPoint(startHbId, sea), + if(world.findShipPath(world.getCoastalPoint(startHbId, sea), world.getCoastalPoint(neighbor.id, sea), neighbor.distance, nullptr, &len) && len == neighbor.distance) { @@ -219,7 +219,7 @@ void MapSerializer::Deserialize(GameWorldBase& world, SerializedGameData& sgd, G } } - sgd.PopObjectContainer(world.harbor_building_sites_from_sea, GO_Type::Buildingsite); + sgd.popObjectContainer(world.harbor_building_sites_from_sea, GO_Type::Buildingsite); const std::string luaScript = sgd.PopLongString(); if(!luaScript.empty()) @@ -236,7 +236,7 @@ void MapSerializer::Deserialize(GameWorldBase& world, SerializedGameData& sgd, G auto lua = std::make_unique(game, localgameState); if(!lua->loadScriptString(luaScript)) throw SerializedGameData::Error(_("Lua script failed to load.")); - if(!lua->CheckScriptVersion()) + if(!lua->checkScriptVersion()) throw SerializedGameData::Error(_("Wrong version for lua script.")); try { diff --git a/libs/s25main/world/MilitarySquares.cpp b/libs/s25main/world/MilitarySquares.cpp index c32df55cb4..a2c3a1580b 100644 --- a/libs/s25main/world/MilitarySquares.cpp +++ b/libs/s25main/world/MilitarySquares.cpp @@ -18,7 +18,7 @@ void MilitarySquares::Init(const MapExtent& mapSize) squares.resize(size_.x * size_.y); } -void MilitarySquares::Clear() +void MilitarySquares::clear() { squares.clear(); size_ = MapExtent::all(0); @@ -30,12 +30,12 @@ std::list& MilitarySquares::getSquare(const MapPoint pt) return squares[milPt.y * size_.x + milPt.x]; } -void MilitarySquares::Add(nobBaseMilitary* const bld) +void MilitarySquares::add(nobBaseMilitary* const bld) { getSquare(bld->getPos()).push_back(bld); } -void MilitarySquares::Remove(nobBaseMilitary* const bld) +void MilitarySquares::remove(nobBaseMilitary* const bld) { RTTR_Assert(helpers::contains(getSquare(bld->getPos()), bld)); getSquare(bld->getPos()).remove(bld); diff --git a/libs/s25main/world/MilitarySquares.h b/libs/s25main/world/MilitarySquares.h index 0a4666e52f..f1c3f7af14 100644 --- a/libs/s25main/world/MilitarySquares.h +++ b/libs/s25main/world/MilitarySquares.h @@ -22,8 +22,8 @@ class MilitarySquares public: MilitarySquares(); void Init(const MapExtent& mapSize); - void Clear(); - void Add(nobBaseMilitary* bld); - void Remove(nobBaseMilitary* bld); + void clear(); + void add(nobBaseMilitary* bld); + void remove(nobBaseMilitary* bld); sortedMilitaryBlds getBuildingsInRange(MapPoint pt, unsigned short radius) const; }; diff --git a/libs/s25main/world/NodeMapBase.h b/libs/s25main/world/NodeMapBase.h index 3e07ffaf85..fe2a4a5f75 100644 --- a/libs/s25main/world/NodeMapBase.h +++ b/libs/s25main/world/NodeMapBase.h @@ -20,8 +20,8 @@ class NodeMapBase final : public MapBase using Node = T_Node; using const_iterator = typename std::vector::const_iterator; - void Resize(const MapExtent& newSize) override; - void Resize(const MapExtent& newSize, const Node& defaultValue); + void resize(const MapExtent& newSize) override; + void resize(const MapExtent& newSize, const Node& defaultValue); /// Access given node Node& operator[](unsigned idx) { return nodes[idx]; } @@ -49,17 +49,17 @@ inline T_Node& NodeMapBase::operator[](const MapPoint& pt) } template -void NodeMapBase::Resize(const MapExtent& newSize) +void NodeMapBase::resize(const MapExtent& newSize) { - MapBase::Resize(newSize); + MapBase::resize(newSize); nodes.clear(); nodes.resize(prodOfComponents(newSize)); } template -void NodeMapBase::Resize(const MapExtent& newSize, const T_Node& defaultValue) +void NodeMapBase::resize(const MapExtent& newSize, const T_Node& defaultValue) { - MapBase::Resize(newSize); + MapBase::resize(newSize); nodes.clear(); nodes.resize(prodOfComponents(newSize), defaultValue); } diff --git a/libs/s25main/world/TerritoryRegion.cpp b/libs/s25main/world/TerritoryRegion.cpp index 89d7dd7e93..20a24021b8 100644 --- a/libs/s25main/world/TerritoryRegion.cpp +++ b/libs/s25main/world/TerritoryRegion.cpp @@ -64,9 +64,9 @@ bool TerritoryRegion::isPointValid(const MapExtent& mapSize, const std::vector* allowedArea) +void TerritoryRegion::adjustNode(MapPoint pt, uint8_t player, uint16_t radius, const std::vector* allowedArea) { - TRNode* node = TryGetNode(pt); + TRNode* node = tryGetNode(pt); // Not in our region -> Out if(!node) return; @@ -84,28 +84,28 @@ void TerritoryRegion::AdjustNode(MapPoint pt, uint8_t player, uint16_t radius, c } } -TerritoryRegion::TRNode* TerritoryRegion::TryGetNode(const MapPoint& pt) +TerritoryRegion::TRNode* TerritoryRegion::tryGetNode(const MapPoint& pt) { - return TryGetNode(getPosFromMapPos(pt)); + return tryGetNode(getPosFromMapPos(pt)); } -TerritoryRegion::TRNode* TerritoryRegion::TryGetNode(Position realPt) +TerritoryRegion::TRNode* TerritoryRegion::tryGetNode(Position realPt) { - if(!AdjustCoords(realPt)) + if(!adjustCoords(realPt)) return nullptr; return &getNode(realPt); } -const TerritoryRegion::TRNode* TerritoryRegion::TryGetNode(Position realPt) const +const TerritoryRegion::TRNode* TerritoryRegion::tryGetNode(Position realPt) const { - if(!AdjustCoords(realPt)) + if(!adjustCoords(realPt)) return nullptr; return &getNode(realPt); } -bool TerritoryRegion::AdjustCoords(Position& pt) const +bool TerritoryRegion::adjustCoords(Position& pt) const { // The region might wrap around world boundaries. So we have to adjust the point so it will still be inside this // region even if it is on "the other side" of the world wrap Note: Only 1 time wrapping around is allowed which is @@ -132,7 +132,7 @@ bool TerritoryRegion::AdjustCoords(Position& pt) const return true; } -void TerritoryRegion::CalcTerritoryOfBuilding(const noBaseBuilding& building) +void TerritoryRegion::calcTerritoryOfBuilding(const noBaseBuilding& building) { unsigned radius = building.getMilitaryRadius(); // Does not hold territory? -> Out @@ -148,29 +148,29 @@ void TerritoryRegion::CalcTerritoryOfBuilding(const noBaseBuilding& building) // Punkt, auf dem das Militärgebäude steht MapPoint bldPos = building.getPos(); - AdjustNode(bldPos, building.getPlayer(), 0, + adjustNode(bldPos, building.getPlayer(), 0, nullptr); // no need to check barriers here. this point is on our territory. const auto pts = world.getPointsInRadius(bldPos, radius, ReturnMapPointWithRadius{}); for(const auto& ptWithRadius : pts) - AdjustNode(ptWithRadius.first, building.getPlayer(), ptWithRadius.second, allowedArea); + adjustNode(ptWithRadius.first, building.getPlayer(), ptWithRadius.second, allowedArea); } -uint8_t TerritoryRegion::SafeGetOwner(const Position& pt) const +uint8_t TerritoryRegion::safeGetOwner(const Position& pt) const { - const TRNode* node = TryGetNode(pt); + const TRNode* node = tryGetNode(pt); if(!node) - return world.getNode(world.MakeMapPoint(pt + startPt)).owner; + return world.getNode(world.makeMapPoint(pt + startPt)).owner; return node->owner; } -bool TerritoryRegion::WillBePlayerTerritory(const Position& mapPos, uint8_t owner, Direction exceptDir) +bool TerritoryRegion::willBePlayerTerritory(const Position& mapPos, uint8_t owner, Direction exceptDir) { for(const auto d : helpers::EnumRange{}) { if(d == exceptDir) continue; - if(SafeGetOwner(::getNeighbour(mapPos, d) - startPt) != owner) + if(safeGetOwner(::getNeighbour(mapPos, d) - startPt) != owner) return false; } return true; diff --git a/libs/s25main/world/TerritoryRegion.h b/libs/s25main/world/TerritoryRegion.h index 93cdc61c0c..d1db2ecfb7 100644 --- a/libs/s25main/world/TerritoryRegion.h +++ b/libs/s25main/world/TerritoryRegion.h @@ -27,18 +27,18 @@ class TerritoryRegion static bool isPointValid(const MapExtent& mapSize, const std::vector& polygon, MapPoint pt); /// Adds the territory of the building - void CalcTerritoryOfBuilding(const noBaseBuilding& building); + void calcTerritoryOfBuilding(const noBaseBuilding& building); unsigned getIdx(const Position& pt) const; Position getPosFromMapPos(const MapPoint& pt) const; /// Return the owner of the point from this region (pt is relative to startPt) uint8_t getOwner(const Position& pt) const { return getNode(pt).owner; } /// Return the owner. If the point is outside the region return owner from map - uint8_t SafeGetOwner(const Position& pt) const; + uint8_t safeGetOwner(const Position& pt) const; void setOwner(const Position& pt, uint8_t owner) { getNode(pt).owner = owner; } /// Return true, if all points surrounding the given point (relative to map origin!!!) have the same owner /// Direction exceptDir will not be checked - bool WillBePlayerTerritory(const Position& mapPos, uint8_t owner, Direction exceptDir); + bool willBePlayerTerritory(const Position& mapPos, uint8_t owner, Direction exceptDir); /// Start position (inclusive) const Position startPt; @@ -60,14 +60,14 @@ class TerritoryRegion /// Check whether the point is part of the polygon static bool isPointInPolygon(const std::vector& polygon, const Position& pt); /// Check and set if a point belongs to the player, when a military bld in the given radius is added - void AdjustNode(MapPoint pt, uint8_t player, uint16_t radius, const std::vector* allowedArea); + void adjustNode(MapPoint pt, uint8_t player, uint16_t radius, const std::vector* allowedArea); TRNode& getNode(const Position& pt) { return nodes[getIdx(pt)]; } const TRNode& getNode(const Position& pt) const { return nodes[getIdx(pt)]; } /// Return a pointer to the node, if it is inside this region - TRNode* TryGetNode(const MapPoint& pt); - TRNode* TryGetNode(Position realPt); - const TRNode* TryGetNode(Position realPt) const; - bool AdjustCoords(Position& pt) const; + TRNode* tryGetNode(const MapPoint& pt); + TRNode* tryGetNode(Position realPt); + const TRNode* tryGetNode(Position realPt) const; + bool adjustCoords(Position& pt) const; const GameWorldBase& world; std::vector nodes; diff --git a/libs/s25main/world/TradePath.cpp b/libs/s25main/world/TradePath.cpp index cb994bf689..7679d504a7 100644 --- a/libs/s25main/world/TradePath.cpp +++ b/libs/s25main/world/TradePath.cpp @@ -5,12 +5,12 @@ #include "world/TradePath.h" #include "SerializedGameData.h" -TradePath::TradePath(SerializedGameData& sgd) : start(sgd.PopMapPoint()), goal(sgd.PopMapPoint()) +TradePath::TradePath(SerializedGameData& sgd) : start(sgd.popMapPoint()), goal(sgd.popMapPoint()) { route.resize(sgd.PopUnsignedInt()); for(Direction& dir : route) { - dir = sgd.Pop(); + dir = sgd.pop(); } } @@ -21,6 +21,6 @@ void TradePath::Serialize(SerializedGameData& sgd) const sgd.PushUnsignedInt(route.size()); for(const Direction& dir : route) { - sgd.PushEnum(dir); + sgd.pushEnum(dir); } } diff --git a/libs/s25main/world/TradeRoute.cpp b/libs/s25main/world/TradeRoute.cpp index d55601432d..8a6ab6319b 100644 --- a/libs/s25main/world/TradeRoute.cpp +++ b/libs/s25main/world/TradeRoute.cpp @@ -10,11 +10,11 @@ TradeRoute::TradeRoute(const GameWorld& world, unsigned char player, const MapPoint& start, const MapPoint& goal) : world(world), player(player) { - AssignNewGoal(start, goal); + assignNewGoal(start, goal); } TradeRoute::TradeRoute(SerializedGameData& sgd, const GameWorld& world, const unsigned char player) - : world(world), player(player), path(sgd), curPos(sgd.PopMapPoint()), curRouteIdx(sgd.PopUnsignedInt()) + : world(world), player(player), path(sgd), curPos(sgd.popMapPoint()), curRouteIdx(sgd.PopUnsignedInt()) {} void TradeRoute::Serialize(SerializedGameData& sgd) const @@ -35,12 +35,12 @@ helpers::OptionalEnum TradeRoute::getNextDir() Direction nextDir; // Check if the route is still valid - if(world.CheckTradeRoute(curPos, path.route, curRouteIdx, player)) + if(world.checkTradeRoute(curPos, path.route, curRouteIdx, player)) nextDir = path.route[curRouteIdx]; else { // If not, recalc it - const auto calculatedNextDir = RecalcRoute(); + const auto calculatedNextDir = recalcRoute(); // Check if we found a valid direction if(!calculatedNextDir) return calculatedNextDir; // If not, bail out @@ -54,7 +54,7 @@ helpers::OptionalEnum TradeRoute::getNextDir() } /// Recalc local route and returns next direction -helpers::OptionalEnum TradeRoute::RecalcRoute() +helpers::OptionalEnum TradeRoute::recalcRoute() { /// Are we at the goal? if(curPos == path.goal) @@ -63,7 +63,7 @@ helpers::OptionalEnum TradeRoute::RecalcRoute() path.start = curPos; path.route.clear(); const auto nextDir = - world.FindTradePath(path.start, path.goal, player, std::numeric_limits::max(), false, &path.route); + world.findTradePath(path.start, path.goal, player, std::numeric_limits::max(), false, &path.route); curRouteIdx = 0; if(nextDir) return TradeDirection(rttr::enum_cast(*nextDir)); @@ -72,10 +72,10 @@ helpers::OptionalEnum TradeRoute::RecalcRoute() } /// Assigns new start and goal positions and hence, a new route -void TradeRoute::AssignNewGoal(const MapPoint& start, const MapPoint& newGoal) +void TradeRoute::assignNewGoal(const MapPoint& start, const MapPoint& newGoal) { curPos = start; path.goal = newGoal; path.route.clear(); - RecalcRoute(); + recalcRoute(); } diff --git a/libs/s25main/world/TradeRoute.h b/libs/s25main/world/TradeRoute.h index 36580f8936..fd41c6613a 100644 --- a/libs/s25main/world/TradeRoute.h +++ b/libs/s25main/world/TradeRoute.h @@ -21,7 +21,7 @@ class TradeRoute MapPoint curPos; unsigned curRouteIdx; - helpers::OptionalEnum RecalcRoute(); + helpers::OptionalEnum recalcRoute(); public: TradeRoute(const GameWorld& world, unsigned char player, const MapPoint& start, const MapPoint& goal); @@ -39,7 +39,7 @@ class TradeRoute bool isValid() const { return !path.route.empty() || path.start == path.goal; } /// Assigns new start and goal positions and hence, a new route - void AssignNewGoal(const MapPoint& start, const MapPoint& newGoal); + void assignNewGoal(const MapPoint& start, const MapPoint& newGoal); const TradePath& getTradePath() const { return path; } }; diff --git a/libs/s25main/world/World.cpp b/libs/s25main/world/World.cpp index 4be5834128..fc9c5a78a9 100644 --- a/libs/s25main/world/World.cpp +++ b/libs/s25main/world/World.cpp @@ -23,23 +23,23 @@ World::World() : noNodeObj(nullptr) {} World::~World() { - Unload(); + unload(); } void World::Init(const MapExtent& mapSize, DescIdx lt) { RTTR_Assert(getSize() == MapExtent::all(0)); // Already init RTTR_Assert(mapSize.x > 0 && mapSize.y > 0); // No empty map - Resize(mapSize); + resize(mapSize); if(!lt) throw std::runtime_error("Invalid landscape"); this->lt = lt; - GameObject::ResetCounters(); + GameObject::resetCounters(); noNodeObj = std::make_unique(); } -void World::Unload() +void World::unload() { // Collect and destroy roads std::set roadsegments; @@ -71,14 +71,14 @@ void World::Unload() harborData.clear(); description_ = WorldDescription(); noNodeObj.reset(); - Resize(MapExtent::all(0)); + resize(MapExtent::all(0)); } -void World::Resize(const MapExtent& newSize) +void World::resize(const MapExtent& newSize) { - MapBase::Resize(newSize); + MapBase::resize(newSize); nodes.clear(); - militarySquares.Clear(); + militarySquares.clear(); if(getSize().x > 0) { nodes.resize(prodOfComponents(getSize())); @@ -86,7 +86,7 @@ void World::Resize(const MapExtent& newSize) } } -noBase& World::AddFigureImpl(const MapPoint pt, std::unique_ptr fig) +noBase& World::addFigureImpl(const MapPoint pt, std::unique_ptr fig) { RTTR_Assert(fig); @@ -102,7 +102,7 @@ noBase& World::AddFigureImpl(const MapPoint pt, std::unique_ptr fig) return result; } -noBase* World::RemoveFigureImpl(const MapPoint pt, noBase& fig) +noBase* World::removeFigureImpl(const MapPoint pt, noBase& fig) { return helpers::extractPtr(getNodeInt(pt).figures, &fig).release(); } @@ -132,7 +132,7 @@ void World::setNO(const MapPoint pt, noBase* obj, const bool replace /* = false* getNodeInt(pt).obj = obj; } -void World::DestroyNO(const MapPoint pt, const bool checkExists /* = true*/) +void World::destroyNO(const MapPoint pt, const bool checkExists /* = true*/) { noBase* obj = getNodeInt(pt).obj; if(obj) @@ -140,7 +140,7 @@ void World::DestroyNO(const MapPoint pt, const bool checkExists /* = true*/) // Destroy may remove the NO already from the map or replace it (e.g. building -> fire) // So remove from map, then destroy and free getNodeInt(pt).obj = nullptr; - obj->Destroy(); + obj->destroy(); deletePtr(obj); } else RTTR_Assert(!checkExists); @@ -156,7 +156,7 @@ GO_Type World::getGOT(const MapPoint pt) const return GO_Type::Nothing; } -void World::ReduceResource(const MapPoint pt) +void World::reduceResource(const MapPoint pt) { const uint8_t curAmount = getNodeInt(pt).resources.getAmount(); RTTR_Assert(curAmount > 0); @@ -180,21 +180,21 @@ void World::setVisibility(const MapPoint pt, unsigned char player, Visibility vi if(vis == Visibility::Visible) node.object.reset(); else if(vis == Visibility::FogOfWar) - SaveFOWNode(pt, player, fowTime); - VisibilityChanged(pt, player, oldVis, vis); + saveFOWNode(pt, player, fowTime); + visibilityChanged(pt, player, oldVis, vis); } -void World::ChangeAltitude(const MapPoint pt, const unsigned char altitude) +void World::changeAltitude(const MapPoint pt, const unsigned char altitude) { getNodeInt(pt).altitude = altitude; // Schattierung neu berechnen von diesem Punkt und den Punkten drumherum - RecalcShadow(pt); + recalcShadow(pt); for(const MapPoint nb : getNeighbours(pt)) - RecalcShadow(nb); + recalcShadow(nb); // Abgeleiteter Klasse Bescheid sagen - AltitudeChanged(pt); + altitudeChanged(pt); } bool World::isPlayerTerritory(const MapPoint pt, const unsigned char owner) const @@ -216,10 +216,10 @@ bool World::isPlayerTerritory(const MapPoint pt, const unsigned char owner) cons BuildingQuality World::GetBQ(const MapPoint pt, const unsigned char player) const { - return AdjustBQ(pt, player, getNode(pt).bq); + return adjustBQ(pt, player, getNode(pt).bq); } -BuildingQuality World::AdjustBQ(const MapPoint pt, unsigned char player, BuildingQuality nodeBQ) const +BuildingQuality World::adjustBQ(const MapPoint pt, unsigned char player, BuildingQuality nodeBQ) const { if(nodeBQ == BuildingQuality::Nothing || !isPlayerTerritory(pt, player + 1)) return BuildingQuality::Nothing; @@ -308,13 +308,13 @@ helpers::EnumArray, Direction> World::getTerrainsAround(Map return result; } -void World::SaveFOWNode(const MapPoint pt, const unsigned player, unsigned curTime) +void World::saveFOWNode(const MapPoint pt, const unsigned player, unsigned curTime) { FoWNode& fow = getNodeInt(pt).fow[player]; fow.last_update_time = curTime; // FOW-Objekt erzeugen - fow.object = getNO(pt)->CreateFOWObject(); + fow.object = getNO(pt)->createFOWObject(); // Wege speichern, aber nur richtige, keine, die gerade gebaut werden for(const auto dir : helpers::EnumRange{}) @@ -366,7 +366,7 @@ MapPoint World::getCoastalPoint(const HarborId harborId, const SeaId seaId) cons } // Keinen Punkt gefunden - return MapPoint::Invalid(); + return MapPoint::invalid(); } PointRoad World::getRoad(const MapPoint pt, RoadDir dir) const @@ -386,13 +386,13 @@ PointRoad World::getPointFOWRoad(MapPoint pt, Direction dir, const unsigned char return getNode(pt).fow[viewing_player].roads[rDir]; } -void World::AddCatapultStone(CatapultStone* cs) +void World::addCatapultStone(CatapultStone* cs) { RTTR_Assert(!helpers::contains(catapult_stones, cs)); catapult_stones.push_back(cs); } -void World::RemoveCatapultStone(CatapultStone* cs) +void World::removeCatapultStone(CatapultStone* cs) { RTTR_Assert(helpers::contains(catapult_stones, cs)); catapult_stones.remove(cs); @@ -481,7 +481,7 @@ bool World::setBQ(const MapPoint pt, BuildingQuality bq) return oldBQ != bq; } -void World::RecalcShadow(const MapPoint pt) +void World::recalcShadow(const MapPoint pt) { int altitude = getNode(pt).altitude; int A = getNeighbourNode(pt, Direction::NorthEast).altitude - altitude; @@ -497,7 +497,7 @@ void World::RecalcShadow(const MapPoint pt) getNodeInt(pt).shadow = shadingS2; } -void World::MakeWholeMapVisibleForAllPlayers() +void World::makeWholeMapVisibleForAllPlayers() { for(auto& mapNode : nodes) { diff --git a/libs/s25main/world/World.h b/libs/s25main/world/World.h index df7faa30e1..f835ab503d 100644 --- a/libs/s25main/world/World.h +++ b/libs/s25main/world/World.h @@ -62,10 +62,10 @@ class World : public MapBase WorldDescription description_; std::unique_ptr noNodeObj; - void Resize(const MapExtent& newSize) override final; - noBase& AddFigureImpl(MapPoint pt, std::unique_ptr fig); + void resize(const MapExtent& newSize) override final; + noBase& addFigureImpl(MapPoint pt, std::unique_ptr fig); /// Implementation of RemoveFigure. Returned pointer must be wrapped in an owning pointer - noBase* RemoveFigureImpl(MapPoint pt, noBase& fig); + noBase* removeFigureImpl(MapPoint pt, noBase& fig); protected: /// harbor building sites created by ships @@ -82,7 +82,7 @@ class World : public MapBase /// Initialize the world virtual void Init(const MapExtent& mapSize, DescIdx lt); /// Clean up (free objects and reset world to uninitialized state) - void Unload(); + void unload(); /// Return the type of the landscape DescIdx GetLandscapeType() const { return lt; } @@ -97,14 +97,14 @@ class World : public MapBase // Add a figure to a node (taking ownership) and returns a reference to it template - T& AddFigure(MapPoint pt, std::unique_ptr fig) + T& addFigure(MapPoint pt, std::unique_ptr fig) { - return static_cast(AddFigureImpl(pt, std::move(fig))); + return static_cast(addFigureImpl(pt, std::move(fig))); } template std::unique_ptr RemoveFigure(MapPoint pt, T& fig) { - return std::unique_ptr(static_cast(RemoveFigureImpl(pt, fig))); + return std::unique_ptr(static_cast(removeFigureImpl(pt, fig))); } template std::unique_ptr RemoveFigure(MapPoint pt, T*& fig) = delete; @@ -117,10 +117,10 @@ class World : public MapBase void setNO(MapPoint pt, noBase* obj, bool replace = false); /// Destroys the object at the given node and removes it from the map. If checkExists is false than it is ok, if /// there is no obj - void DestroyNO(MapPoint pt, bool checkExists = true); + void destroyNO(MapPoint pt, bool checkExists = true); /// Return the game object type of the object at that point or GOT_NONE of there is none GO_Type getGOT(MapPoint pt) const; - void ReduceResource(MapPoint pt); + void reduceResource(MapPoint pt); void setResource(const MapPoint pt, Resource newResource) { getNodeInt(pt).resources = newResource; } void setOwner(const MapPoint pt, unsigned char newOwner) { getNodeInt(pt).owner = newOwner; } void setReserved(MapPoint pt, bool reserved); @@ -128,10 +128,10 @@ class World : public MapBase /// fowTime is only used if visibility gets changed to FoW void setVisibility(MapPoint pt, unsigned char player, Visibility vis, unsigned fowTime = 0); - void ChangeAltitude(MapPoint pt, unsigned char altitude); + void changeAltitude(MapPoint pt, unsigned char altitude); // Make whole map visible with no additional checks or notices - void MakeWholeMapVisibleForAllPlayers(); + void makeWholeMapVisibleForAllPlayers(); /// Checks if the point completely belongs to a player (if false but point itself belongs to player then it is a /// border) if owner is != 0 it checks if the points specific ownership @@ -140,7 +140,7 @@ class World : public MapBase /// Return the BQ for the given player at the point (including ownership constraints) BuildingQuality GetBQ(MapPoint pt, unsigned char player) const; /// Incorporates node ownership into the given BQ - BuildingQuality AdjustBQ(MapPoint pt, unsigned char player, BuildingQuality nodeBQ) const; + BuildingQuality adjustBQ(MapPoint pt, unsigned char player, BuildingQuality nodeBQ) const; /// Return the figures currently on the node auto getFigures(const MapPoint pt) const { return helpers::nonNullPtrSpan(getNode(pt).figures); } @@ -165,7 +165,7 @@ class World : public MapBase helpers::EnumArray, Direction> getTerrainsAround(MapPoint pt) const; /// Create the FOW-objects, -streets, etc for a point and player - void SaveFOWNode(MapPoint pt, unsigned player, unsigned curTime); + void saveFOWNode(MapPoint pt, unsigned player, unsigned curTime); unsigned getNumSeas() const { return seas.size(); } /// Return whether a node is inside a (shippable) sea (surrounded by shippable water) bool isSeaPoint(MapPoint pt) const; @@ -232,8 +232,8 @@ class World : public MapBase PointRoad getPointFOWRoad(MapPoint pt, Direction dir, unsigned char viewing_player) const; /// Adds a catapult stone currently flying - void AddCatapultStone(CatapultStone* cs); - void RemoveCatapultStone(CatapultStone* cs); + void addCatapultStone(CatapultStone* cs); + void removeCatapultStone(CatapultStone* cs); protected: /// Internal method for access to nodes with write access @@ -241,9 +241,9 @@ class World : public MapBase MapNode& getNeighbourNodeInt(MapPoint pt, Direction dir); /// Notify derived classes of changed altitude - virtual void AltitudeChanged(MapPoint pt) = 0; + virtual void altitudeChanged(MapPoint pt) = 0; /// Notify derived classes of changed visibility - virtual void VisibilityChanged(MapPoint pt, unsigned player, Visibility oldVis, Visibility newVis) = 0; + virtual void visibilityChanged(MapPoint pt, unsigned player, Visibility oldVis, Visibility newVis) = 0; /// Sets the road for the given (road) direction void setRoad(MapPoint pt, RoadDir roadDir, PointRoad type); BoundaryStones& getBoundaryStones(const MapPoint pt) { return getNodeInt(pt).boundary_stones; } @@ -251,7 +251,7 @@ class World : public MapBase bool setBQ(MapPoint pt, BuildingQuality bq); /// Recalculates the shade of a point - void RecalcShadow(MapPoint pt); + void recalcShadow(MapPoint pt); }; ////////////////////////////////////////////////////////////////////////// diff --git a/tests/common/testCollisionDetection.cpp b/tests/common/testCollisionDetection.cpp index 1b20ef615f..d2d21ed54d 100644 --- a/tests/common/testCollisionDetection.cpp +++ b/tests/common/testCollisionDetection.cpp @@ -46,45 +46,45 @@ BOOST_AUTO_TEST_CASE(RectIntersect) Rect rect1(Position(10, 20), Extent(5, 15)); Rect rect2(rect1); // Identity - BOOST_TEST(DoRectsIntersect(rect1, rect2)); - BOOST_TEST(DoRectsIntersect(rect2, rect1)); + BOOST_TEST(doRectsIntersect(rect1, rect2)); + BOOST_TEST(doRectsIntersect(rect2, rect1)); // Just in and out on each line // Right rect2.move(Position(rect1.getSize().x, 0)); //-V807 - BOOST_TEST(!DoRectsIntersect(rect1, rect2)); - BOOST_TEST(!DoRectsIntersect(rect2, rect1)); + BOOST_TEST(!doRectsIntersect(rect1, rect2)); + BOOST_TEST(!doRectsIntersect(rect2, rect1)); rect2.move(-Position(1, 0)); - BOOST_TEST(DoRectsIntersect(rect1, rect2)); - BOOST_TEST(DoRectsIntersect(rect2, rect1)); + BOOST_TEST(doRectsIntersect(rect1, rect2)); + BOOST_TEST(doRectsIntersect(rect2, rect1)); // Left rect2 = rect1; rect2.move(-Position(rect1.getSize().x, 0)); - BOOST_TEST(!DoRectsIntersect(rect1, rect2)); - BOOST_TEST(!DoRectsIntersect(rect2, rect1)); + BOOST_TEST(!doRectsIntersect(rect1, rect2)); + BOOST_TEST(!doRectsIntersect(rect2, rect1)); rect2.move(Position(1, 0)); - BOOST_TEST(DoRectsIntersect(rect1, rect2)); - BOOST_TEST(DoRectsIntersect(rect2, rect1)); + BOOST_TEST(doRectsIntersect(rect1, rect2)); + BOOST_TEST(doRectsIntersect(rect2, rect1)); // Bottom rect2 = rect1; rect2.move(Position(0, rect1.getSize().y)); - BOOST_TEST(!DoRectsIntersect(rect1, rect2)); - BOOST_TEST(!DoRectsIntersect(rect2, rect1)); + BOOST_TEST(!doRectsIntersect(rect1, rect2)); + BOOST_TEST(!doRectsIntersect(rect2, rect1)); rect2.move(-Position(0, 1)); - BOOST_TEST(DoRectsIntersect(rect1, rect2)); - BOOST_TEST(DoRectsIntersect(rect2, rect1)); + BOOST_TEST(doRectsIntersect(rect1, rect2)); + BOOST_TEST(doRectsIntersect(rect2, rect1)); // Top rect2 = rect1; rect2.move(-Position(0, rect1.getSize().y)); - BOOST_TEST(!DoRectsIntersect(rect1, rect2)); - BOOST_TEST(!DoRectsIntersect(rect2, rect1)); + BOOST_TEST(!doRectsIntersect(rect1, rect2)); + BOOST_TEST(!doRectsIntersect(rect2, rect1)); rect2.move(Position(0, 1)); - BOOST_TEST(DoRectsIntersect(rect1, rect2)); - BOOST_TEST(DoRectsIntersect(rect2, rect1)); + BOOST_TEST(doRectsIntersect(rect1, rect2)); + BOOST_TEST(doRectsIntersect(rect2, rect1)); // Empty rect Rect emptyRect(rect1.getOrigin(), Extent(0, 0)); - BOOST_TEST(!DoRectsIntersect(rect1, emptyRect)); - BOOST_TEST(!DoRectsIntersect(emptyRect, rect1)); + BOOST_TEST(!doRectsIntersect(rect1, emptyRect)); + BOOST_TEST(!doRectsIntersect(emptyRect, rect1)); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/common/testMathHelpers.cpp b/tests/common/testMathHelpers.cpp index a18f493f0e..16550def8a 100644 --- a/tests/common/testMathHelpers.cpp +++ b/tests/common/testMathHelpers.cpp @@ -134,7 +134,7 @@ struct Rep> using type = T; }; -BOOST_AUTO_TEST_CASE_TEMPLATE(Interpolate, T, TimeTypes) +BOOST_AUTO_TEST_CASE_TEMPLATE(interpolate, T, TimeTypes) { using RepT = typename Rep::type; using rttr::test::randomValue; diff --git a/tests/legacyFiles/src/legacy/TerrainData.cpp b/tests/legacyFiles/src/legacy/TerrainData.cpp index ba6cb02444..9c109ff326 100644 --- a/tests/legacyFiles/src/legacy/TerrainData.cpp +++ b/tests/legacyFiles/src/legacy/TerrainData.cpp @@ -38,7 +38,7 @@ unsigned char TerrainData::getTextureIdentifier(TerrainType t) throw std::logic_error("Invalid parameters given"); } -TerrainType TerrainData::MapIdx2Terrain(unsigned char mapIdx) +TerrainType TerrainData::mapIdx2Terrain(unsigned char mapIdx) { // Unset bit 0x40 (harbour) and 0x80 (unknown) mapIdx &= ~(0x40 | 0x80); @@ -464,7 +464,7 @@ const std::array& TerrainData::getEdgePrios(Landscape landsCape) } } -void TerrainData::PrintEdgePrios() +void TerrainData::printEdgePrios() { for(int lt = 0; lt < NUM_LTS; ++lt) { diff --git a/tests/legacyFiles/src/legacy/TerrainData.h b/tests/legacyFiles/src/legacy/TerrainData.h index c91076c414..3ad213ee37 100644 --- a/tests/legacyFiles/src/legacy/TerrainData.h +++ b/tests/legacyFiles/src/legacy/TerrainData.h @@ -18,7 +18,7 @@ class TerrainData TerrainData() = delete; /// Returns the terrain type for a given map terrain index - static TerrainType MapIdx2Terrain(unsigned char mapIdx); + static TerrainType mapIdx2Terrain(unsigned char mapIdx); /// Returns the position in the texture image static Rect getPosInTexture(TerrainType t); /// Returns whether the terrains texture is animated @@ -36,7 +36,7 @@ class TerrainData /// Gets the edge type that t1 draws over t2 /// 0: None, 1: Snow, 2: Mountain, 3: Desert, 4: Meadow, 5: Water static unsigned char getEdgeType(Landscape landsCape, TerrainType t1, TerrainType t2); - static void PrintEdgePrios(); + static void printEdgePrios(); static const std::array& getEdgePrios(Landscape landsCape); /// Returns whether the given map terrain index is a harbour spot static bool isHarborSpot(unsigned char mapIdx) { return (mapIdx & 0x40) != 0; } diff --git a/tests/mockupDrivers/MockupAudioDriver.h b/tests/mockupDrivers/MockupAudioDriver.h index 54a2b20a4b..1dc17cdf23 100644 --- a/tests/mockupDrivers/MockupAudioDriver.h +++ b/tests/mockupDrivers/MockupAudioDriver.h @@ -24,26 +24,26 @@ MOCK_BASE_CLASS(MockAudioDriverCallback, IAudioDriverCallback) MOCK_BASE_CLASS(MockupAudioDriver, driver::AudioDriver) { MockupAudioDriver(IAudioDriverCallback * callback) : AudioDriver(callback) {} - ~MockupAudioDriver() override { CleanUp(); } + ~MockupAudioDriver() override { cleanUp(); } const char* getName() const override { return "MockupAudio"; } - bool Initialize() override + bool initialize() override { setNumChannels(DEFAULT_NUM_CHANNELS); initialized = true; return true; } - MOCK_NON_CONST_METHOD(LoadEffect, 1, driver::RawSoundHandle(const std::string&)); - MOCK_NON_CONST_METHOD(LoadEffect, 2, driver::RawSoundHandle(const std::vector&, const std::string&), + MOCK_NON_CONST_METHOD(loadEffect, 1, driver::RawSoundHandle(const std::string&)); + MOCK_NON_CONST_METHOD(loadEffect, 2, driver::RawSoundHandle(const std::vector&, const std::string&), LoadEffectFromData); - MOCK_NON_CONST_METHOD(LoadMusic, 1, driver::RawSoundHandle(const std::string&)); - MOCK_NON_CONST_METHOD(LoadMusic, 2, driver::RawSoundHandle(const std::vector&, const std::string&), + MOCK_NON_CONST_METHOD(loadMusic, 1, driver::RawSoundHandle(const std::string&)); + MOCK_NON_CONST_METHOD(loadMusic, 2, driver::RawSoundHandle(const std::vector&, const std::string&), LoadMusicFromData); MOCK_NON_CONST_METHOD(doPlayEffect, 3, int(driver::RawSoundHandle::DriverData, uint8_t, bool)); - MOCK_NON_CONST_METHOD(PlayMusic, 2); - MOCK_NON_CONST_METHOD(StopMusic, 0); + MOCK_NON_CONST_METHOD(playMusic, 2); + MOCK_NON_CONST_METHOD(stopMusic, 0); MOCK_NON_CONST_METHOD(doStopEffect, 1, void(int)); MOCK_NON_CONST_METHOD(isEffectPlaying, 1); - MOCK_NON_CONST_METHOD(ChangeVolume, 2); + MOCK_NON_CONST_METHOD(changeVolume, 2); MOCK_NON_CONST_METHOD(setMasterEffectVolume, 1); MOCK_NON_CONST_METHOD(setMusicVolume, 1); MOCK_NON_CONST_METHOD(doUnloadSound, 1, void(driver::RawSoundHandle sound)); diff --git a/tests/mockupDrivers/MockupVideoDriver.cpp b/tests/mockupDrivers/MockupVideoDriver.cpp index b32ebb6873..fcbec8f56b 100644 --- a/tests/mockupDrivers/MockupVideoDriver.cpp +++ b/tests/mockupDrivers/MockupVideoDriver.cpp @@ -23,7 +23,7 @@ const char* MockupVideoDriver::getName() const return "Mockup Video Driver"; } -bool MockupVideoDriver::Initialize() +bool MockupVideoDriver::initialize() { if(initialized) return true; @@ -31,20 +31,20 @@ bool MockupVideoDriver::Initialize() return true; } -bool MockupVideoDriver::CreateScreen(const std::string&, const VideoMode newSize, DisplayMode displayMode) +bool MockupVideoDriver::createScreen(const std::string&, const VideoMode newSize, DisplayMode displayMode) { - ResizeScreen(newSize, displayMode); + resizeScreen(newSize, displayMode); return true; } -bool MockupVideoDriver::ResizeScreen(const VideoMode newSize, DisplayMode displayMode) +bool MockupVideoDriver::resizeScreen(const VideoMode newSize, DisplayMode displayMode) { setNewSize(newSize, Extent(newSize.width, newSize.height)); displayMode_ = displayMode; return true; } -bool MockupVideoDriver::MessageLoop() +bool MockupVideoDriver::messageLoop() { return true; } @@ -64,7 +64,7 @@ OpenGL_Loader_Proc MockupVideoDriver::getLoaderFunction() const return dummyLoader; } -std::vector MockupVideoDriver::ListVideoModes() const +std::vector MockupVideoDriver::listVideoModes() const { return video_modes_; } @@ -84,7 +84,7 @@ void* MockupVideoDriver::getMapPointer() const return nullptr; } -void MockupVideoDriver::ShowErrorMessage(const std::string& title, const std::string& message) +void MockupVideoDriver::showErrorMessage(const std::string& title, const std::string& message) { std::cerr << title << ": " << message << std::endl; } diff --git a/tests/mockupDrivers/MockupVideoDriver.h b/tests/mockupDrivers/MockupVideoDriver.h index 0efcaa71c6..6315d7442c 100644 --- a/tests/mockupDrivers/MockupVideoDriver.h +++ b/tests/mockupDrivers/MockupVideoDriver.h @@ -12,21 +12,21 @@ class MockupVideoDriver : public VideoDriver MockupVideoDriver(VideoDriverLoaderInterface* CallBack); ~MockupVideoDriver() override; const char* getName() const override; - bool Initialize() override; - bool CreateScreen(const std::string& title, VideoMode newSize, DisplayMode displayMode) override; - bool ResizeScreen(VideoMode newSize, DisplayMode displayMode) override; - void DestroyScreen() override {} - bool SwapBuffers() override { return true; } - bool MessageLoop() override; + bool initialize() override; + bool createScreen(const std::string& title, VideoMode newSize, DisplayMode displayMode) override; + bool resizeScreen(VideoMode newSize, DisplayMode displayMode) override; + void destroyScreen() override {} + bool swapBuffers() override { return true; } + bool messageLoop() override; unsigned long getTickCount() const override; OpenGL_Loader_Proc getLoaderFunction() const override; - std::vector ListVideoModes() const override; + std::vector listVideoModes() const override; void setMousePos(Position pos) override; KeyEvent getModKeyState() const override; void* getMapPointer() const override; bool isOpenGL() const override { return false; } - void ShowErrorMessage(const std::string& title, const std::string& message) override; - using VideoDriver::FindClosestVideoMode; + void showErrorMessage(const std::string& title, const std::string& message) override; + using VideoDriver::findClosestVideoMode; using VideoDriver::setNewSize; bool isTouchEvent() const override; diff --git a/tests/s25Main/UI/testAnimations.cpp b/tests/s25Main/UI/testAnimations.cpp index d72abd56cc..34215b9def 100644 --- a/tests/s25Main/UI/testAnimations.cpp +++ b/tests/s25Main/UI/testAnimations.cpp @@ -43,7 +43,7 @@ struct TestWindow : public Window {} protected: - void Draw_() override {} + void drawImpl() override {} }; struct WindowFixture @@ -57,9 +57,9 @@ struct WindowFixture WindowFixture() : wnd(DrawPoint(0, 0), 0, nullptr, Extent(800, 600)), animMgr(wnd.getAnimationManager()), animFinished(false) { - bt = wnd.AddTextButton(0, DrawPoint(10, 20), Extent(100, 20), TextureColor::Red1, "Test", NormalFont); - bt2 = wnd.AddTextButton(1, DrawPoint(10, 40), Extent(100, 20), TextureColor::Red1, "Test", NormalFont); - wnd.Draw(); + bt = wnd.addTextButton(0, DrawPoint(10, 20), Extent(100, 20), TextureColor::Red1, "Test", NormalFont); + bt2 = wnd.addTextButton(1, DrawPoint(10, 40), Extent(100, 20), TextureColor::Red1, "Test", NormalFont); + wnd.draw(); } PredRes testAdvanceTime(TestAnimation* anim, unsigned time, bool reqUpdate, unsigned reqCurFrame, @@ -662,10 +662,10 @@ BOOST_AUTO_TEST_CASE(MoveAniScale) { MockupVideoDriver* video = uiHelper::getVideoDriver(); auto* dsk = WINDOWMANAGER.Switch(std::make_unique(nullptr)); - WINDOWMANAGER.Draw(); - bt = dsk->AddTextButton(0, DrawPoint(10, 20), Extent(100, 150), TextureColor::Red1, "", NormalFont); + WINDOWMANAGER.draw(); + bt = dsk->addTextButton(0, DrawPoint(10, 20), Extent(100, 150), TextureColor::Red1, "", NormalFont); ctrlButton* btReference = - dsk->AddTextButton(1, DrawPoint(130, bt->getPos().y), bt->getSize(), TextureColor::Red1, "", NormalFont); + dsk->addTextButton(1, DrawPoint(130, bt->getPos().y), bt->getSize(), TextureColor::Red1, "", NormalFont); dsk->getAnimationManager().addAnimation( new MoveAnimation(bt, btReference->getPos(), 1000, Animation::RepeatType::None)); dsk->msgPaintBefore(); @@ -681,7 +681,7 @@ BOOST_AUTO_TEST_CASE(MoveAniScale) video->tickCount_ += 1; dsk->msgPaintBefore(); // Resize the screen and test that the final position got updated too - VIDEODRIVER.ResizeScreen(VideoMode(1024, 768), DisplayMode::Windowed); + VIDEODRIVER.resizeScreen(VideoMode(1024, 768), DisplayMode::Windowed); // Pass the animation video->tickCount_ += 1100; dsk->msgPaintBefore(); diff --git a/tests/s25Main/UI/testComboBox.cpp b/tests/s25Main/UI/testComboBox.cpp index b3702e04d3..34ccab6d1f 100644 --- a/tests/s25Main/UI/testComboBox.cpp +++ b/tests/s25Main/UI/testComboBox.cpp @@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE(ItemHandling) REQUIRE(cb->getNumItems() == 0); REQUIRE(!cb->getSelection()); - cb->AddItem("text"); + cb->addItem("text"); REQUIRE(cb->getNumItems() == 1); REQUIRE(!cb->getSelection()); REQUIRE(cb->getText(0) == "text"); @@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(ItemHandling) for(int i = 0; i < 10; i++) { lines.emplace_back(randString()); - cb->AddItem(lines.back()); + cb->addItem(lines.back()); REQUIRE(cb->getNumItems() == lines.size()); REQUIRE(cb->getSelection() == 0u); } @@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE(ItemHandling) REQUIRE(cb->getSelection() == sel); } - cb->DeleteAllItems(); + cb->deleteAllItems(); REQUIRE(cb->getNumItems() == 0); REQUIRE(!cb->getSelection()); } @@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE(ControlWithScrollWheel) for(int i = 0; i < 3; i++) { - cb->AddItem(randString()); + cb->addItem(randString()); } REQUIRE(!cb->getSelection()); mock::sequence s; @@ -118,7 +118,7 @@ BOOST_AUTO_TEST_CASE(ListRemove) for(int i = 0; i < 10; i++) { lines.emplace_back(randString()); - list->AddItem(lines.back()); + list->addItem(lines.back()); REQUIRE(list->getNumLines() == lines.size()); REQUIRE(!list->getSelection()); } @@ -128,18 +128,18 @@ BOOST_AUTO_TEST_CASE(ListRemove) REQUIRE(list->getSelection() == 4u); REQUIRE(list->getSelItemText() == lines[4]); // To big - list->Remove(10); + list->remove(10); REQUIRE(list->getNumLines() == lines.size()); REQUIRE(list->getSelItemText() == lines[4]); // Remove after selected. Selection remains - list->Remove(5); + list->remove(5); REQUIRE(list->getNumLines() == lines.size() - 1); REQUIRE(list->getSelItemText() == lines[4]); lines.erase(lines.begin() + 5); // Remove all before. Selection remains for(int i = 1; i <= 4; i++) { - list->Remove(randomValue(0, 4 - i)); + list->remove(randomValue(0, 4 - i)); REQUIRE(list->getNumLines() == lines.size() - i); REQUIRE(list->getSelItemText() == lines[4]); } @@ -150,7 +150,7 @@ BOOST_AUTO_TEST_CASE(ListRemove) REQUIRE(list->getNumLines() == 5); REQUIRE(list->getSelection() == 0u); MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->getID(), 0).in(s); - list->Remove(0); + list->remove(0); REQUIRE(list->getNumLines() == 4); REQUIRE(list->getSelection() == 0u); REQUIRE(list->getSelItemText() == lines[1]); @@ -159,7 +159,7 @@ BOOST_AUTO_TEST_CASE(ListRemove) MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->getID(), 2).in(s); MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->getID(), 2).in(s); list->setSelection(2); - list->Remove(2); + list->remove(2); REQUIRE(list->getNumLines() == 3); REQUIRE(list->getSelection() == 2u); REQUIRE(list->getSelItemText() == lines[3]); @@ -167,13 +167,13 @@ BOOST_AUTO_TEST_CASE(ListRemove) // For last pos previous is selected list->setSelection(list->getNumLines() - 1); MOCK_EXPECT(wnd.msgListSelectItem).once().with(list->getID(), 1).in(s); - list->Remove(list->getNumLines() - 1); + list->remove(list->getNumLines() - 1); REQUIRE(list->getNumLines() == 2); REQUIRE(list->getSelection() == 1u); REQUIRE(list->getSelItemText() == lines[lines.size() - 2]); // Removing all sets selection to -1 - list->Remove(0); - list->Remove(0); + list->remove(0); + list->remove(0); REQUIRE(list->getNumLines() == 0); REQUIRE(!list->getSelection()); REQUIRE(list->getSelItemText() == ""); diff --git a/tests/s25Main/UI/testControls.cpp b/tests/s25Main/UI/testControls.cpp index e9a11d8899..9c8e903bb9 100644 --- a/tests/s25Main/UI/testControls.cpp +++ b/tests/s25Main/UI/testControls.cpp @@ -368,11 +368,11 @@ BOOST_AUTO_TEST_CASE(AdjustWidthForMaxChars_SetsCorrectSize) TextureColor::Green1, "foo", font.get(), COLOR_BLACK); const Extent sizeBefore = txt.getSize(); // Don't assume size, so get size for 0 chars - txt.ResizeForMaxChars(0); + txt.resizeForMaxChars(0); const Extent sizeZero = txt.getSize(); BOOST_TEST(sizeZero.y == sizeBefore.y); const auto numChars = rttr::test::randomValue(1u, 20u); - txt.ResizeForMaxChars(numChars); + txt.resizeForMaxChars(numChars); BOOST_TEST(txt.getSize() == Extent(sizeZero.x + numChars * font->getDx(), sizeBefore.y)); } { @@ -380,11 +380,11 @@ BOOST_AUTO_TEST_CASE(AdjustWidthForMaxChars_SetsCorrectSize) TextureColor::Green1, "foo", font.get(), "tooltip"); const Extent sizeBefore = txt.getSize(); // Don't assume size, so get size for 0 chars - txt.ResizeForMaxChars(0); + txt.resizeForMaxChars(0); const Extent sizeZero = txt.getSize(); BOOST_TEST(sizeZero.y == sizeBefore.y); const auto numChars = rttr::test::randomValue(1u, 20u); - txt.ResizeForMaxChars(numChars); + txt.resizeForMaxChars(numChars); BOOST_TEST(txt.getSize() == Extent(sizeZero.x + numChars * font->getDx(), sizeBefore.y)); } } @@ -463,12 +463,12 @@ BOOST_AUTO_TEST_CASE(TableSorting) const std::vector r4 = {"ccc", "10x30", "10", "09.11.2000 - 10:12"}; const std::vector r5 = {"zcc", "30x10", "13", "10.12.2000 - 10:12"}; const std::vector r6 = {"tts", "10x22", "42", "10.11.2001 - 10:12"}; - table.AddRow(r1); - table.AddRow(r2); - table.AddRow(r3); - table.AddRow(r4); - table.AddRow(r5); - table.AddRow(r6); + table.addRow(r1); + table.addRow(r2); + table.addRow(r3); + table.addRow(r4); + table.addRow(r5); + table.addRow(r6); auto testRowsEqual = [&table](std::array*, 6> rows) { for(unsigned i = 0; i < rows.size(); i++) @@ -480,26 +480,26 @@ BOOST_AUTO_TEST_CASE(TableSorting) } }; - table.SortRows(0, TableSortDir::Descending); + table.sortRows(0, TableSortDir::Descending); BOOST_TEST(table.getSortColumn() == 0); BOOST_TEST(table.getSortDirection() == TableSortDir::Descending); BOOST_TEST_CONTEXT("String column") testRowsEqual({&r5, &r6, &r4, &r3, &r1, &r2}); - table.SortRows(1, TableSortDir::Ascending); + table.sortRows(1, TableSortDir::Ascending); BOOST_TEST(table.getSortColumn() == 1); BOOST_TEST(table.getSortDirection() == TableSortDir::Ascending); BOOST_TEST_CONTEXT("MapSize column") testRowsEqual({&r3, &r1, &r2, &r6, &r4, &r5}); - table.SortRows(2, TableSortDir::Descending); + table.sortRows(2, TableSortDir::Descending); BOOST_TEST(table.getSortColumn() == 2); BOOST_TEST(table.getSortDirection() == TableSortDir::Descending); BOOST_TEST_CONTEXT("Number column") testRowsEqual({&r6, &r5, &r4, &r3, &r2, &r1}); - table.SortRows(3, TableSortDir::Ascending); + table.sortRows(3, TableSortDir::Ascending); BOOST_TEST(table.getSortColumn() == 3); BOOST_TEST(table.getSortDirection() == TableSortDir::Ascending); BOOST_TEST_CONTEXT("Date column") testRowsEqual({&r4, &r1, &r2, &r3, &r5, &r6}); - table.SortRows(3, TableSortDir::Descending); + table.sortRows(3, TableSortDir::Descending); BOOST_TEST(table.getSortColumn() == 3); BOOST_TEST(table.getSortDirection() == TableSortDir::Descending); BOOST_TEST_CONTEXT("Date column") testRowsEqual({&r6, &r5, &r3, &r2, &r1, &r4}); diff --git a/tests/s25Main/UI/testDskGameLobby.cpp b/tests/s25Main/UI/testDskGameLobby.cpp index 6210e58e26..2588a20aa5 100644 --- a/tests/s25Main/UI/testDskGameLobby.cpp +++ b/tests/s25Main/UI/testDskGameLobby.cpp @@ -25,10 +25,10 @@ BOOST_AUTO_TEST_SUITE(UI) MOCK_BASE_CLASS(MockLobbyClient, ILobbyClient) { MOCK_METHOD(IsLoggedIn, 0); - MOCK_METHOD(AddListener, 1); - MOCK_METHOD(RemoveListener, 1); - MOCK_METHOD(SendServerJoinRequest, 0); - MOCK_METHOD(SendChat, 1); + MOCK_METHOD(addListener, 1); + MOCK_METHOD(removeListener, 1); + MOCK_METHOD(sendServerJoinRequest, 0); + MOCK_METHOD(sendChat, 1); }; BOOST_FIXTURE_TEST_CASE(LobbyChat, uiHelper::Fixture) @@ -44,13 +44,13 @@ BOOST_FIXTURE_TEST_CASE(LobbyChat, uiHelper::Fixture) auto client = std::make_unique(); mock::sequence s, s2; MOCK_EXPECT(client->IsLoggedIn).at_least(1).in(s2).returns(true); - MOCK_EXPECT(client->AddListener).exactly(1).in(s); - MOCK_EXPECT(client->RemoveListener).exactly(1).in(s); - MOCK_EXPECT(client->SendServerJoinRequest).exactly(1).in(s2); - MOCK_EXPECT(client->SendChat).exactly(1); + MOCK_EXPECT(client->addListener).exactly(1).in(s); + MOCK_EXPECT(client->removeListener).exactly(1).in(s); + MOCK_EXPECT(client->sendServerJoinRequest).exactly(1).in(s2); + MOCK_EXPECT(client->sendChat).exactly(1); // TODO: How to trigger through dskGameLobby? - client->SendChat(""); + client->sendChat(""); auto* desktop = WINDOWMANAGER.Switch(std::make_unique( ServerType::Lobby, std::shared_ptr(&gameLobby, [](auto) {}), 0, std::move(client))); @@ -62,7 +62,7 @@ BOOST_FIXTURE_TEST_CASE(LobbyChat, uiHelper::Fixture) std::vector chatBts = chatTab.front()->getCtrls(); BOOST_TEST_REQUIRE(chatBts.size() == 2u); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); // Send a chat message via lobby chat and game chat with either visible for(unsigned i = 0; i < 3; i++) @@ -74,7 +74,7 @@ BOOST_FIXTURE_TEST_CASE(LobbyChat, uiHelper::Fixture) desktop->msgOptionGroupChange(chatTab.front()->getID(), chatBts[i % 2]->getID()); } // Free desktop etc to trigger mock verification - WINDOWMANAGER.CleanUp(); + WINDOWMANAGER.cleanUp(); } BOOST_AUTO_TEST_CASE(CheckServerVersionValidity) diff --git a/tests/s25Main/UI/testFont.cpp b/tests/s25Main/UI/testFont.cpp index 3a74bf3ec2..cf49316702 100644 --- a/tests/s25Main/UI/testFont.cpp +++ b/tests/s25Main/UI/testFont.cpp @@ -15,21 +15,21 @@ BOOST_FIXTURE_TEST_CASE(WrapInfoVaryingLen, uiHelper::Fixture) LOADER.initResourceFolders(); { rttr::test::LogAccessor logAcc; - BOOST_TEST(LOADER.LoadFonts()); + BOOST_TEST(LOADER.loadFonts()); logAcc.clearLog(); } const auto& font = *SmallFont; std::string input = "a\naa\naaa\naaaa\naaaaa\naa"; auto output = std::vector{"a", "aa", "aaa", "aaaa", "aaaa", "a", "aa"}; - glFont::WrapInfo wrapInfo = font.getWrapInfo(input, font.CharWidth('a') * 4, font.CharWidth('a') * 4); + glFont::WrapInfo wrapInfo = font.getWrapInfo(input, font.charWidth('a') * 4, font.charWidth('a') * 4); BOOST_TEST(wrapInfo.lines.size() == output.size()); - BOOST_TEST(wrapInfo.CreateSingleStrings(input) == output, boost::test_tools::per_element{}); + BOOST_TEST(wrapInfo.createSingleStrings(input) == output, boost::test_tools::per_element{}); input = "a aa aaa aaaa aaaaa aa"; output = std::vector{"a aa", "aaa", "aaaa", "aaaa", "a aa"}; - wrapInfo = font.getWrapInfo(input, font.CharWidth('a') * 4, font.CharWidth('a') * 4); + wrapInfo = font.getWrapInfo(input, font.charWidth('a') * 4, font.charWidth('a') * 4); BOOST_TEST(wrapInfo.lines.size() == output.size()); - BOOST_TEST(wrapInfo.CreateSingleStrings(input) == output, boost::test_tools::per_element{}); + BOOST_TEST(wrapInfo.createSingleStrings(input) == output, boost::test_tools::per_element{}); } BOOST_FIXTURE_TEST_CASE(WrapInfoWithTrailingNewlines, uiHelper::Fixture) @@ -38,7 +38,7 @@ BOOST_FIXTURE_TEST_CASE(WrapInfoWithTrailingNewlines, uiHelper::Fixture) const auto output = std::vector{"a1", "b234", "", "c4124", "", "", ""}; const glFont::WrapInfo wrapInfo = SmallFont->getWrapInfo(input, 1000, 1000); BOOST_TEST(wrapInfo.lines.size() == output.size()); - BOOST_TEST(wrapInfo.CreateSingleStrings(input) == output, boost::test_tools::per_element{}); + BOOST_TEST(wrapInfo.createSingleStrings(input) == output, boost::test_tools::per_element{}); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/UI/testImageButton.cpp b/tests/s25Main/UI/testImageButton.cpp index e12c1c390f..98cd1b4acf 100644 --- a/tests/s25Main/UI/testImageButton.cpp +++ b/tests/s25Main/UI/testImageButton.cpp @@ -19,8 +19,8 @@ MOCK_BASE_CLASS(TestTexture, ITexture) TestTexture(Extent size, Position origin) : size_(size), origin_(origin) {} Position getOrigin() const override { return origin_; } Extent getSize() const override { return size_; } - MOCK_NON_CONST_METHOD(DrawFull, 2) // LCOV_EXCL_LINE - MOCK_NON_CONST_METHOD(Draw, 3) + MOCK_NON_CONST_METHOD(drawFull, 2) // LCOV_EXCL_LINE + MOCK_NON_CONST_METHOD(draw, 3) private: Extent size_; @@ -38,16 +38,16 @@ BOOST_AUTO_TEST_CASE(DrawSmallerImageThanButton) TestTexture img(Extent(20, 10), Position(0, 0)); ctrlImageButton btn(&wnd, randomValue(), DrawPoint(10, 5), Extent(40, 30), TextureColor::Green1, &img, ""); - MOCK_EXPECT(img.Draw).once().with(Rect(20, 15, 20, 10), Rect(0, 0, 20, 10), 0xFFFFFFFFu); - btn.Draw(); + MOCK_EXPECT(img.draw).once().with(Rect(20, 15, 20, 10), Rect(0, 0, 20, 10), 0xFFFFFFFFu); + btn.draw(); } { TestTexture img(Extent(20, 10), Position(13, 2)); ctrlImageButton btn(&wnd, randomValue(), DrawPoint(10, 5), Extent(40, 30), TextureColor::Green1, &img, ""); - MOCK_EXPECT(img.Draw).once().with(Rect(33, 17, 20, 10), Rect(0, 0, 20, 10), 0xFFFFFFFFu); - btn.Draw(); + MOCK_EXPECT(img.draw).once().with(Rect(33, 17, 20, 10), Rect(0, 0, 20, 10), 0xFFFFFFFFu); + btn.draw(); } } @@ -61,8 +61,8 @@ BOOST_AUTO_TEST_CASE(DrawLargerImageThanButton) &img, ""); // Note that the image's center part is drawn, shrinked by 2px from each side to prevent dirtying 3d button's // ridge - MOCK_EXPECT(img.Draw).once().with(Rect(12, 22, 36, 26), Rect(32, 27, 36, 26), 0xFFFFFFFFu); - btn.Draw(); + MOCK_EXPECT(img.draw).once().with(Rect(12, 22, 36, 26), Rect(32, 27, 36, 26), 0xFFFFFFFFu); + btn.draw(); } { @@ -71,8 +71,8 @@ BOOST_AUTO_TEST_CASE(DrawLargerImageThanButton) &img, ""); // Note that the image's center part is drawn, shrinked by 2px from each side to prevent dirtying 3d button's // ridge - MOCK_EXPECT(img.Draw).once().with(Rect(80, 54, 36, 26), Rect(32, 27, 36, 26), 0xFFFFFFFFu); - btn.Draw(); + MOCK_EXPECT(img.draw).once().with(Rect(80, 54, 36, 26), Rect(32, 27, 36, 26), 0xFFFFFFFFu); + btn.draw(); } } diff --git a/tests/s25Main/UI/testIngameWindow.cpp b/tests/s25Main/UI/testIngameWindow.cpp index 02d12e2572..28fccdb1c1 100644 --- a/tests/s25Main/UI/testIngameWindow.cpp +++ b/tests/s25Main/UI/testIngameWindow.cpp @@ -119,7 +119,7 @@ BOOST_AUTO_TEST_CASE(IwMapGenerator) BOOST_TEST(wnd.getCtrl(iwMapGenerator::ID_pgStonePiles)->getPosition() == settings.stonePiles); wnd.getCtrl(iwMapGenerator::ID_pgStonePiles)->setPosition(expectedStonePiles); wnd.msgButtonClick(iwMapGenerator::ID_btApply); - BOOST_TEST(wnd.ShouldBeClosed()); + BOOST_TEST(wnd.shouldBeClosed()); BOOST_TEST(settings.numPlayers == expectedNumPlayers); BOOST_TEST(settings.type == DescIdx(expectedMapType)); @@ -149,9 +149,9 @@ BOOST_AUTO_TEST_CASE(ConnectWindow) const auto testHost = rttr::test::randString(10); const auto testPort = rttr::test::randomValue(10, 10000); const auto testIsIpv6 = rttr::test::randomBool(); - wnd.Connect(testHost, testPort, testIsIpv6, + wnd.connect(testHost, testPort, testIsIpv6, true); // When the server has a password, the window shouldn't initiate the connection process - BOOST_TEST_REQUIRE(!wnd.ShouldBeClosed()); // No error or anything, window still open + BOOST_TEST_REQUIRE(!wnd.shouldBeClosed()); // No error or anything, window still open // Fields filled and password field has focus BOOST_TEST(edtIp.getText() == testHost); BOOST_TEST(edtPort.getText() == s25util::toStringClassic(testPort)); @@ -193,10 +193,10 @@ BOOST_AUTO_TEST_CASE(ConnectingWindow) ci.CI_NextConnectState(st); BOOST_TEST(!progressBar.isVisible()); // Hidden again } - BOOST_TEST(!wnd.ShouldBeClosed()); + BOOST_TEST(!wnd.shouldBeClosed()); ci.CI_NextConnectState(ConnectState::Finished); - BOOST_TEST(wnd.ShouldBeClosed()); - WINDOWMANAGER.Draw(); + BOOST_TEST(wnd.shouldBeClosed()); + WINDOWMANAGER.draw(); BOOST_TEST((dynamic_cast(WINDOWMANAGER.getCurrentDesktop()) != nullptr)); } { @@ -206,13 +206,13 @@ BOOST_AUTO_TEST_CASE(ConnectingWindow) // CI_ERROR sends the onError signal and closes the window MOCK_EXPECT(onError).once().with(ClientError::ServerFull); ci.CI_Error(ClientError::ServerFull); - BOOST_TEST(wnd.ShouldBeClosed()); + BOOST_TEST(wnd.shouldBeClosed()); } { iwConnecting wnd(ServerType::Local, nullptr); // Clicking the button sends the onError signal (or if not set opens an error window) and closes the window wnd.msgButtonClick(wnd.getCtrls().at(0)->getID()); - BOOST_TEST(wnd.ShouldBeClosed()); + BOOST_TEST(wnd.shouldBeClosed()); BOOST_TEST((dynamic_cast(WINDOWMANAGER.getTopMostWindow()))); } } @@ -295,7 +295,7 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) const MouseCoords evLDownInsideWindow = makeLeftDown(wnd.getPos() + wnd.getSize() / 2); const MouseCoords evLUp = MouseCoords(evLDown.pos); - BOOST_TEST(!wnd.ShouldBeClosed()); + BOOST_TEST(!wnd.shouldBeClosed()); BOOST_TEST(!wnd.isMinimized()); BOOST_TEST(!wnd.isPinned()); @@ -304,7 +304,7 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) wnd.msgLeftDown(evLDownInsideWindow); wnd.msgMouseMove(evLDown); wnd.msgLeftUp(evLUp); - BOOST_TEST(!wnd.ShouldBeClosed()); + BOOST_TEST(!wnd.shouldBeClosed()); BOOST_TEST(!wnd.isMinimized()); BOOST_TEST(!wnd.isPinned()); // Similar when moving out of the button @@ -312,13 +312,13 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) wnd.msgMouseMove(evLDownInsideWindow); wnd.msgMouseMove(evLDown); wnd.msgLeftUp(evLUp); - BOOST_TEST(!wnd.ShouldBeClosed()); + BOOST_TEST(!wnd.shouldBeClosed()); BOOST_TEST(!wnd.isMinimized()); BOOST_TEST(!wnd.isPinned()); wnd.msgLeftDown(evLDown); wnd.msgLeftUp(evLUp); - BOOST_TEST(wnd.ShouldBeClosed()); + BOOST_TEST(wnd.shouldBeClosed()); BOOST_TEST(!wnd.isMinimized()); BOOST_TEST(!wnd.isPinned()); BOOST_TEST(!settings.isOpen); @@ -332,12 +332,12 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) const MouseCoords evLDown = makeLeftDown(wnd.getPos() + DrawPoint(wnd.getSize().x / 2, 4)); const MouseCoords evLDblClick = makeLeftDblClick(evLDown.pos); - BOOST_TEST(!wnd.ShouldBeClosed()); + BOOST_TEST(!wnd.shouldBeClosed()); BOOST_TEST(!wnd.isMinimized()); BOOST_TEST(!wnd.isPinned()); wnd.msgLeftDown(evLDown); wnd.msgLeftUp(evLDblClick); - BOOST_TEST(!wnd.ShouldBeClosed()); + BOOST_TEST(!wnd.shouldBeClosed()); BOOST_TEST(!wnd.isMinimized()); BOOST_TEST(!wnd.isPinned()); BOOST_TEST(settings.isOpen); @@ -352,12 +352,12 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) const MouseCoords evLDown = makeLeftDown(wnd.getPos() + DrawPoint(wnd.getSize().x, 0) + DrawPoint(-4, 4)); const MouseCoords evLUp = MouseCoords(evLDown.pos); - BOOST_TEST(!wnd.ShouldBeClosed()); + BOOST_TEST(!wnd.shouldBeClosed()); BOOST_TEST(!wnd.isMinimized()); BOOST_TEST(!wnd.isPinned()); wnd.msgLeftDown(evLDown); wnd.msgLeftUp(evLUp); - BOOST_TEST(!wnd.ShouldBeClosed()); + BOOST_TEST(!wnd.shouldBeClosed()); BOOST_TEST(wnd.isMinimized()); BOOST_TEST(!wnd.isPinned()); BOOST_TEST(settings.isOpen); @@ -377,12 +377,12 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) const MouseCoords evLDown = makeLeftDown(wnd.getPos() + DrawPoint(4, 4)); const MouseCoords evLUp = MouseCoords(evLDown.pos); - BOOST_TEST(!wnd.ShouldBeClosed()); + BOOST_TEST(!wnd.shouldBeClosed()); BOOST_TEST(!wnd.isMinimized()); BOOST_TEST(!wnd.isPinned()); wnd.msgLeftDown(evLDown); wnd.msgLeftUp(evLUp); - BOOST_TEST(wnd.ShouldBeClosed()); + BOOST_TEST(wnd.shouldBeClosed()); BOOST_TEST(!wnd.isMinimized()); BOOST_TEST(!wnd.isPinned()); BOOST_TEST(!settings.isOpen); @@ -396,12 +396,12 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) const MouseCoords evLDown = makeLeftDown(wnd.getPos() + DrawPoint(wnd.getSize().x / 2, 4)); const MouseCoords evLDblClick = makeLeftDblClick(evLDown.pos); - BOOST_TEST(!wnd.ShouldBeClosed()); + BOOST_TEST(!wnd.shouldBeClosed()); BOOST_TEST(!wnd.isMinimized()); BOOST_TEST(!wnd.isPinned()); wnd.msgLeftDown(evLDown); wnd.msgLeftUp(evLDblClick); - BOOST_TEST(!wnd.ShouldBeClosed()); + BOOST_TEST(!wnd.shouldBeClosed()); BOOST_TEST(wnd.isMinimized()); BOOST_TEST(!wnd.isPinned()); BOOST_TEST(settings.isOpen); @@ -417,12 +417,12 @@ BOOST_AUTO_TEST_CASE(TitleBarButtons) const MouseCoords evLDown = makeLeftDown(wnd.getPos() + DrawPoint(wnd.getSize().x, 0) + DrawPoint(-4, 4)); const MouseCoords evLUp = MouseCoords(evLDown.pos); - BOOST_TEST(!wnd.ShouldBeClosed()); + BOOST_TEST(!wnd.shouldBeClosed()); BOOST_TEST(!wnd.isMinimized()); BOOST_TEST(!wnd.isPinned()); wnd.msgLeftDown(evLDown); wnd.msgLeftUp(evLUp); - BOOST_TEST(!wnd.ShouldBeClosed()); + BOOST_TEST(!wnd.shouldBeClosed()); BOOST_TEST(!wnd.isMinimized()); BOOST_TEST(wnd.isPinned()); BOOST_TEST(settings.isOpen); @@ -453,7 +453,7 @@ void WindowPositioning_testOne(IngameWindow& wnd, const char* context, const std BOOST_AUTO_TEST_CASE(WindowPositioning) { - VIDEODRIVER.ResizeScreen(VideoMode(800, 600), DisplayMode::Windowed); + VIDEODRIVER.resizeScreen(VideoMode(800, 600), DisplayMode::Windowed); const auto renderSize = VIDEODRIVER.getRenderSize(); @@ -516,7 +516,7 @@ BOOST_AUTO_TEST_CASE(WindowPositioning) WindowPositioning_testOne( wnd, "Increase size, window connects with screen edges and should move", [&]() { - wnd.Resize(wndSizeL); + wnd.resize(wndSizeL); BOOST_TEST(wnd.getPos() == DrawPoint(renderSize - wndSizeL)); BOOST_TEST(wnd.getPos() == settings.lastPos); BOOST_TEST(restorePos == settings.restorePos); @@ -532,7 +532,7 @@ BOOST_AUTO_TEST_CASE(WindowPositioning) WindowPositioning_testOne( wnd, "Decrease size, window no longer connects with screen edges and should move to restorePos", [&]() { - wnd.Resize(wndSizeS); + wnd.resize(wndSizeS); BOOST_TEST(wnd.getPos() == restorePos); BOOST_TEST(wnd.getPos() == settings.lastPos); BOOST_TEST(restorePos == settings.restorePos); @@ -571,7 +571,7 @@ BOOST_AUTO_TEST_CASE(WindowPositioning) WindowPositioning_testOne( wnd, "Increase size, window connects with screen edges and should move", [&]() { - wnd.Resize(wndSizeL); + wnd.resize(wndSizeL); BOOST_TEST(wnd.getPos() == DrawPoint(renderSize - wndSizeL)); BOOST_TEST(wnd.getSize() == wndSizeL); }, @@ -583,7 +583,7 @@ BOOST_AUTO_TEST_CASE(WindowPositioning) WindowPositioning_testOne( wnd, "Decrease size, window no longer connects with screen edges and should move to restorePos", [&]() { - wnd.Resize(wndSizeS); + wnd.resize(wndSizeS); BOOST_TEST(wnd.getPos() == restorePos); BOOST_TEST(wnd.getSize() == wndSizeS); }, @@ -598,11 +598,11 @@ BOOST_AUTO_TEST_CASE(WindowSnapping) { SETTINGS.interface.windowSnapDistance = 10; - VIDEODRIVER.ResizeScreen(VideoMode(800, 600), DisplayMode::Windowed); + VIDEODRIVER.resizeScreen(VideoMode(800, 600), DisplayMode::Windowed); - auto& wnd1 = static_cast(WINDOWMANAGER.Show( + auto& wnd1 = static_cast(WINDOWMANAGER.show( std::make_unique(0, DrawPoint(0, 500), Extent(100, 100), "Test Window 1", nullptr))); - auto& wnd2 = static_cast(WINDOWMANAGER.Show( + auto& wnd2 = static_cast(WINDOWMANAGER.show( std::make_unique(0, DrawPoint(200, 480), Extent(100, 100), "Test Window 2", nullptr))); { @@ -642,7 +642,7 @@ BOOST_AUTO_TEST_CASE(WindowSnapping) BOOST_TEST_CONTEXT("Snap to the closest window") { - auto& wnd3 = static_cast(WINDOWMANAGER.Show( + auto& wnd3 = static_cast(WINDOWMANAGER.show( std::make_unique(0, DrawPoint(200, 0), Extent(100, 100), "Test Window 3", nullptr))); const DrawPoint mousePosRel = DrawPoint(wnd3.getSize().x / 2, 4); diff --git a/tests/s25Main/UI/testSmartBitmap.cpp b/tests/s25Main/UI/testSmartBitmap.cpp index 4700ccaa35..032caa0e64 100644 --- a/tests/s25Main/UI/testSmartBitmap.cpp +++ b/tests/s25Main/UI/testSmartBitmap.cpp @@ -351,7 +351,7 @@ BOOST_AUTO_TEST_CASE(MultiPlayerBitmap) } } -BOOST_AUTO_TEST_CASE(DrawPercent) +BOOST_AUTO_TEST_CASE(drawPercent) { // Make sure that test passes across different image heights, including some random ones auto sizes = diff --git a/tests/s25Main/UI/testTerrainRenderer.cpp b/tests/s25Main/UI/testTerrainRenderer.cpp index 21f1207618..5e36d04a9e 100644 --- a/tests/s25Main/UI/testTerrainRenderer.cpp +++ b/tests/s25Main/UI/testTerrainRenderer.cpp @@ -16,32 +16,32 @@ BOOST_AUTO_TEST_CASE(TR_ConvertCoords) Position offset; // Test border cases - BOOST_TEST_REQUIRE(tr.ConvertCoords(Position(0, 0), &offset) == MapPoint(0, 0)); + BOOST_TEST_REQUIRE(tr.convertCoords(Position(0, 0), &offset) == MapPoint(0, 0)); BOOST_TEST_REQUIRE(offset == Position(0, 0)); - BOOST_TEST_REQUIRE(tr.ConvertCoords(Position(w - 1, h - 1), &offset) == MapPoint(w - 1, h - 1)); + BOOST_TEST_REQUIRE(tr.convertCoords(Position(w - 1, h - 1), &offset) == MapPoint(w - 1, h - 1)); BOOST_TEST_REQUIRE(offset == Position(0, 0)); - BOOST_TEST_REQUIRE(tr.ConvertCoords(Position(w, h - 1), &offset) == MapPoint(0, h - 1)); + BOOST_TEST_REQUIRE(tr.convertCoords(Position(w, h - 1), &offset) == MapPoint(0, h - 1)); BOOST_TEST_REQUIRE(offset == Position(w * TR_W, 0)); - BOOST_TEST_REQUIRE(tr.ConvertCoords(Position(w - 1, h), &offset) == MapPoint(w - 1, 0)); + BOOST_TEST_REQUIRE(tr.convertCoords(Position(w - 1, h), &offset) == MapPoint(w - 1, 0)); BOOST_TEST_REQUIRE(offset == Position(0, h * TR_H)); - BOOST_TEST_REQUIRE(tr.ConvertCoords(Position(w, h), &offset) == MapPoint(0, 0)); + BOOST_TEST_REQUIRE(tr.convertCoords(Position(w, h), &offset) == MapPoint(0, 0)); BOOST_TEST_REQUIRE(offset == Position(w * TR_W, h * TR_H)); - BOOST_TEST_REQUIRE(tr.ConvertCoords(Position(w + w / 2, h + h / 2), &offset) == MapPoint(w / 2, h / 2)); + BOOST_TEST_REQUIRE(tr.convertCoords(Position(w + w / 2, h + h / 2), &offset) == MapPoint(w / 2, h / 2)); BOOST_TEST_REQUIRE(offset == Position(w * TR_W, h * TR_H)); // Big value - BOOST_TEST_REQUIRE(tr.ConvertCoords(Position(10 * w + w / 2, 11 * h + h / 2), &offset) == MapPoint(w / 2, h / 2)); + BOOST_TEST_REQUIRE(tr.convertCoords(Position(10 * w + w / 2, 11 * h + h / 2), &offset) == MapPoint(w / 2, h / 2)); BOOST_TEST_REQUIRE(offset == Position(10 * w * TR_W, 11 * h * TR_H)); // Negative cases - BOOST_TEST_REQUIRE(tr.ConvertCoords(Position(-1, -1), &offset) == MapPoint(w - 1, h - 1)); + BOOST_TEST_REQUIRE(tr.convertCoords(Position(-1, -1), &offset) == MapPoint(w - 1, h - 1)); BOOST_TEST_REQUIRE(offset == Position(-w * TR_W, -h * TR_H)); - BOOST_TEST_REQUIRE(tr.ConvertCoords(Position(-w + 1, -h + 2), &offset) == MapPoint(1, 2)); + BOOST_TEST_REQUIRE(tr.convertCoords(Position(-w + 1, -h + 2), &offset) == MapPoint(1, 2)); BOOST_TEST_REQUIRE(offset == Position(-w * TR_W, -h * TR_H)); - BOOST_TEST_REQUIRE(tr.ConvertCoords(Position(-w, -h), &offset) == MapPoint(0, 0)); + BOOST_TEST_REQUIRE(tr.convertCoords(Position(-w, -h), &offset) == MapPoint(0, 0)); BOOST_TEST_REQUIRE(offset == Position(-w * TR_W, -h * TR_H)); - BOOST_TEST_REQUIRE(tr.ConvertCoords(Position(-w - 1, -h - 2), &offset) == MapPoint(w - 1, h - 2)); + BOOST_TEST_REQUIRE(tr.convertCoords(Position(-w - 1, -h - 2), &offset) == MapPoint(w - 1, h - 2)); BOOST_TEST_REQUIRE(offset == Position(-2 * w * TR_W, -2 * h * TR_H)); // Big value - BOOST_TEST_REQUIRE(tr.ConvertCoords(Position(-10 * w + w / 2, -11 * h + h / 2), &offset) == MapPoint(w / 2, h / 2)); + BOOST_TEST_REQUIRE(tr.convertCoords(Position(-10 * w + w / 2, -11 * h + h / 2), &offset) == MapPoint(w / 2, h / 2)); BOOST_TEST_REQUIRE(offset == Position(-10 * w * TR_W, -11 * h * TR_H)); } diff --git a/tests/s25Main/UI/testTexturePacker.cpp b/tests/s25Main/UI/testTexturePacker.cpp index 52c9348d0c..516deed7c9 100644 --- a/tests/s25Main/UI/testTexturePacker.cpp +++ b/tests/s25Main/UI/testTexturePacker.cpp @@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(SizeAndPosCorrect) continue; Rect rect2(Position(bmp2.texCoords[0] * size), Extent((bmp2.texCoords[2] - bmp2.texCoords[0]) * size)); - BOOST_TEST(!DoRectsIntersect(rect1, rect2)); + BOOST_TEST(!doRectsIntersect(rect1, rect2)); } } } diff --git a/tests/s25Main/UI/testVideoDriver.cpp b/tests/s25Main/UI/testVideoDriver.cpp index ea2cb1698e..99b9f42367 100644 --- a/tests/s25Main/UI/testVideoDriver.cpp +++ b/tests/s25Main/UI/testVideoDriver.cpp @@ -21,18 +21,18 @@ static std::ostream& operator<<(std::ostream& os, const VideoMode mode) } // LCOV_EXCL_STOP -BOOST_AUTO_TEST_CASE(FindClosestVideoMode) +BOOST_AUTO_TEST_CASE(findClosestVideoMode) { auto* driver = uiHelper::getVideoDriver(); driver->video_modes_ = {VideoMode(800, 600), VideoMode(1000, 600), VideoMode(1500, 800)}; // Exact match for(const auto& mode : driver->video_modes_) - BOOST_TEST(driver->FindClosestVideoMode(mode) == mode); + BOOST_TEST(driver->findClosestVideoMode(mode) == mode); // Close match - BOOST_TEST(driver->FindClosestVideoMode(VideoMode(850, 622)) == VideoMode(800, 600)); - BOOST_TEST(driver->FindClosestVideoMode(VideoMode(950, 570)) == VideoMode(1000, 600)); - BOOST_TEST(driver->FindClosestVideoMode(VideoMode(2000, 622)) == VideoMode(1500, 800)); - BOOST_TEST(driver->FindClosestVideoMode(VideoMode(1200, 900)) == VideoMode(1500, 800)); + BOOST_TEST(driver->findClosestVideoMode(VideoMode(850, 622)) == VideoMode(800, 600)); + BOOST_TEST(driver->findClosestVideoMode(VideoMode(950, 570)) == VideoMode(1000, 600)); + BOOST_TEST(driver->findClosestVideoMode(VideoMode(2000, 622)) == VideoMode(1500, 800)); + BOOST_TEST(driver->findClosestVideoMode(VideoMode(1200, 900)) == VideoMode(1500, 800)); } namespace rttrOglMock2 { @@ -67,8 +67,8 @@ BOOST_FIXTURE_TEST_CASE(CreateAndDestroyTextures, uiHelper::Fixture) // Fresh start { rttr::test::LogAccessor logAcc; - VIDEODRIVER.DestroyScreen(); - VIDEODRIVER.CreateScreen(VideoMode(800, 600), DisplayMode::Windowed); + VIDEODRIVER.destroyScreen(); + VIDEODRIVER.createScreen(VideoMode(800, 600), DisplayMode::Windowed); logAcc.clearLog(); } @@ -76,37 +76,37 @@ BOOST_FIXTURE_TEST_CASE(CreateAndDestroyTextures, uiHelper::Fixture) RTTR_STUB_FUNCTION(glDeleteTextures, rttrOglMock2::glDeleteTextures); for(unsigned i = 1u; i <= 5u; ++i) - BOOST_TEST(VIDEODRIVER.GenerateTexture() == i); + BOOST_TEST(VIDEODRIVER.generateTexture() == i); BOOST_TEST_REQUIRE(rttrOglMock2::activeTextures.size() == 5u); { rttr::test::LogAccessor logAcc; - VIDEODRIVER.DestroyScreen(); + VIDEODRIVER.destroyScreen(); logAcc.clearLog(); } BOOST_TEST_REQUIRE(rttrOglMock2::activeTextures.empty()); // Next cleanup call is a no-op (validated inside glDeleteTextures) - VIDEODRIVER.CleanUp(); + VIDEODRIVER.cleanUp(); { rttr::test::LogAccessor logAcc; - VIDEODRIVER.CreateScreen(VideoMode(800, 600), DisplayMode::Windowed); + VIDEODRIVER.createScreen(VideoMode(800, 600), DisplayMode::Windowed); logAcc.clearLog(); } glGenTextures = rttrOglMock2::glGenTextures; glDeleteTextures = rttrOglMock2::glDeleteTextures; for(unsigned i = 1u; i <= 5u; ++i) - VIDEODRIVER.GenerateTexture(); + VIDEODRIVER.generateTexture(); BOOST_TEST_REQUIRE(rttrOglMock2::activeTextures.size() == 5u); - VIDEODRIVER.CleanUp(); + VIDEODRIVER.cleanUp(); BOOST_TEST_REQUIRE(rttrOglMock2::activeTextures.empty()); // Next cleanup call is a no-op (validated inside glDeleteTextures) - VIDEODRIVER.CleanUp(); + VIDEODRIVER.cleanUp(); } BOOST_AUTO_TEST_CASE(TranslateDimensionsBetweenScreenAndViewSpace) { auto* driver = uiHelper::getVideoDriver(); - driver->CreateScreen("", VideoMode(800 * 2, 600 * 2), DisplayMode::Windowed); + driver->createScreen("", VideoMode(800 * 2, 600 * 2), DisplayMode::Windowed); { // GUI scale 100%; translations are no-ops @@ -194,7 +194,7 @@ BOOST_AUTO_TEST_CASE(GuiScaleRangeCalculation) { GuiScaleRange range; auto* driver = uiHelper::getVideoDriver(); - driver->CreateScreen("", VideoMode(800 * 3, 600 * 3), DisplayMode::Windowed); + driver->createScreen("", VideoMode(800 * 3, 600 * 3), DisplayMode::Windowed); // Regular DPI configuration range = driver->getGuiScaleRange(); @@ -203,15 +203,15 @@ BOOST_AUTO_TEST_CASE(GuiScaleRangeCalculation) BOOST_TEST(range.recommendedPercent == 100u); // Maximum is constrained by width - driver->ResizeScreen(VideoMode(800 * 2, 600 * 3), DisplayMode::Windowed); + driver->resizeScreen(VideoMode(800 * 2, 600 * 3), DisplayMode::Windowed); BOOST_TEST(driver->getGuiScaleRange().maxPercent == 200u); // Maximum is constrained by height - driver->ResizeScreen(VideoMode(800 * 3, 600 * 2), DisplayMode::Windowed); + driver->resizeScreen(VideoMode(800 * 3, 600 * 2), DisplayMode::Windowed); BOOST_TEST(driver->getGuiScaleRange().maxPercent == 200u); // HighDPI configuration (50% larger render size than window size) - driver->ResizeScreen(VideoMode(800 * 2, 600 * 2), DisplayMode::Windowed); + driver->resizeScreen(VideoMode(800 * 2, 600 * 2), DisplayMode::Windowed); driver->setNewSize(driver->getWindowSize(), Extent(800 * 3, 600 * 3)); range = driver->getGuiScaleRange(); BOOST_TEST(range.minPercent == 100u); diff --git a/tests/s25Main/UI/testWindowManager.cpp b/tests/s25Main/UI/testWindowManager.cpp index 52396d6cc4..f27a49ba63 100644 --- a/tests/s25Main/UI/testWindowManager.cpp +++ b/tests/s25Main/UI/testWindowManager.cpp @@ -50,7 +50,7 @@ struct WMFixture : mock::cleanup MOCK_EXPECT(dsk->msgMouseMove).once().returns(true); MOCK_EXPECT(dsk->msgLeftDown).once().returns(true); MOCK_EXPECT(dsk->msgLeftUp).once().returns(true); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); // Ensure next click in test won't be registered as double-click // by doing a fake click outside of any relevant space and time @@ -236,7 +236,7 @@ MOCK_BASE_CLASS(TestIngameWnd, IngameWindow) closed.erase(std::remove(closed.begin(), closed.end(), this), closed.end()); } ~TestIngameWnd() override { closed.push_back(this); } - MOCK_METHOD(DrawContent, 0, void()) + MOCK_METHOD(drawContent, 0, void()) MOCK_METHOD(msgKeyDown, 1) MOCK_METHOD(msgLeftDown, 1) MOCK_METHOD(msgMiddleDown, 1) @@ -255,45 +255,45 @@ std::vector TestIngameWnd::closed; BOOST_FIXTURE_TEST_CASE(ShowIngameWnd, uiHelper::Fixture) { - auto* wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); + auto* wnd = &WINDOWMANAGER.show(std::make_unique(CGI_HELP)); BOOST_TEST_REQUIRE(wnd); - MOCK_EXPECT(wnd->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd->drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ACTIVE(wnd); BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); // Closing the window removes it and calls delete - wnd->Close(); - WINDOWMANAGER.Draw(); + wnd->close(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_DESTROYED(wnd); // Desktop active again BOOST_TEST(WINDOWMANAGER.getCurrentDesktop()->IsActive()); // Opening a window with the same ID works. The last gets the focus - wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); - auto* wnd2 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); + wnd = &WINDOWMANAGER.show(std::make_unique(CGI_HELP)); + auto* wnd2 = &WINDOWMANAGER.show(std::make_unique(CGI_HELP)); BOOST_TEST_REQUIRE((wnd && wnd2)); - MOCK_EXPECT(wnd->DrawContent).once(); - MOCK_EXPECT(wnd2->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd->drawContent).once(); + MOCK_EXPECT(wnd2->drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ALIVE(wnd); REQUIRE_WINDOW_ACTIVE(wnd2); // Desktop inactive again BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); // Closing a window and immediately reopening works - wnd->Close(); - wnd2->Close(); - wnd2 = &WINDOWMANAGER.Show(std::make_unique(wnd->getID())); + wnd->close(); + wnd2->close(); + wnd2 = &WINDOWMANAGER.show(std::make_unique(wnd->getID())); BOOST_TEST_REQUIRE(wnd2); - MOCK_EXPECT(wnd2->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd2->drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_DESTROYED(wnd); REQUIRE_WINDOW_ACTIVE(wnd2); BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); // Close by ID - WINDOWMANAGER.Close(wnd2->getID()); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.close(wnd2->getID()); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_DESTROYED(wnd2); BOOST_TEST(WINDOWMANAGER.getCurrentDesktop()->IsActive()); mock::verify(); @@ -302,19 +302,19 @@ BOOST_FIXTURE_TEST_CASE(ShowIngameWnd, uiHelper::Fixture) BOOST_FIXTURE_TEST_CASE(ToggleIngameWnd, uiHelper::Fixture) { // When no window with the ID is open, then this is just Show - auto* wnd = WINDOWMANAGER.ToggleWindow(std::make_unique(CGI_HELP)); + auto* wnd = WINDOWMANAGER.toggleWindow(std::make_unique(CGI_HELP)); BOOST_TEST_REQUIRE(wnd); - MOCK_EXPECT(wnd->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd->drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ACTIVE(wnd); BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); // When window is about to be closed we can open a new one - wnd->Close(); - auto* wnd2 = WINDOWMANAGER.ToggleWindow(std::make_unique(CGI_HELP)); + wnd->close(); + auto* wnd2 = WINDOWMANAGER.toggleWindow(std::make_unique(CGI_HELP)); BOOST_TEST_REQUIRE(wnd2); - MOCK_EXPECT(wnd2->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd2->drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ACTIVE(wnd2); REQUIRE_WINDOW_DESTROYED(wnd); BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); @@ -322,128 +322,128 @@ BOOST_FIXTURE_TEST_CASE(ToggleIngameWnd, uiHelper::Fixture) // Opening a window with the same ID closes and frees both wnd = wnd2; wnd2 = new TestIngameWnd(wnd->getID()); - BOOST_TEST((WINDOWMANAGER.ToggleWindow(std::unique_ptr(wnd2)) == nullptr)); - WINDOWMANAGER.Draw(); + BOOST_TEST((WINDOWMANAGER.toggleWindow(std::unique_ptr(wnd2)) == nullptr)); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_DESTROYED(wnd); REQUIRE_WINDOW_DESTROYED(wnd2); // Desktop active again BOOST_TEST(WINDOWMANAGER.getCurrentDesktop()->IsActive()); // Windows with different IDs are fine - wnd = WINDOWMANAGER.ToggleWindow(std::make_unique(CGI_HELP)); - wnd2 = WINDOWMANAGER.ToggleWindow(std::make_unique(CGI_SETTINGS)); + wnd = WINDOWMANAGER.toggleWindow(std::make_unique(CGI_HELP)); + wnd2 = WINDOWMANAGER.toggleWindow(std::make_unique(CGI_SETTINGS)); BOOST_TEST_REQUIRE((wnd && wnd2)); - MOCK_EXPECT(wnd->DrawContent).once(); - MOCK_EXPECT(wnd2->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd->drawContent).once(); + MOCK_EXPECT(wnd2->drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ALIVE(wnd); REQUIRE_WINDOW_ACTIVE(wnd2); - wnd->Close(); - wnd2->Close(); + wnd->close(); + wnd2->close(); mock::verify(); } BOOST_FIXTURE_TEST_CASE(ReplaceIngameWnd, uiHelper::Fixture) { // When no window with the ID is open, then this is just Show - auto* wnd = &WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_HELP)); - MOCK_EXPECT(wnd->DrawContent).once(); - WINDOWMANAGER.Draw(); + auto* wnd = &WINDOWMANAGER.replaceWindow(std::make_unique(CGI_HELP)); + MOCK_EXPECT(wnd->drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ACTIVE(wnd); BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); // When window is about to be closed we can open a new one - wnd->Close(); - auto* wnd2 = &WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_HELP)); + wnd->close(); + auto* wnd2 = &WINDOWMANAGER.replaceWindow(std::make_unique(CGI_HELP)); BOOST_TEST_REQUIRE(wnd2); - MOCK_EXPECT(wnd2->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd2->drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ACTIVE(wnd2); REQUIRE_WINDOW_DESTROYED(wnd); BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); // Opening a window with the same ID closes and frees the first wnd = wnd2; - wnd2 = &WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_HELP)); + wnd2 = &WINDOWMANAGER.replaceWindow(std::make_unique(CGI_HELP)); BOOST_TEST_REQUIRE(wnd2); - MOCK_EXPECT(wnd2->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd2->drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_DESTROYED(wnd); REQUIRE_WINDOW_ACTIVE(wnd2); BOOST_TEST(!WINDOWMANAGER.getCurrentDesktop()->IsActive()); // Windows with different IDs are fine wnd = wnd2; - wnd2 = &WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_SETTINGS)); + wnd2 = &WINDOWMANAGER.replaceWindow(std::make_unique(CGI_SETTINGS)); BOOST_TEST_REQUIRE(wnd2); - MOCK_EXPECT(wnd->DrawContent).once(); - MOCK_EXPECT(wnd2->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd->drawContent).once(); + MOCK_EXPECT(wnd2->drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ALIVE(wnd); REQUIRE_WINDOW_ACTIVE(wnd2); - wnd->Close(); - wnd2->Close(); + wnd->close(); + wnd2->close(); // Modal windows are not replaced but placed on top of existing ones - wnd = &WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_SETTINGS, true)); - wnd2 = &WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_SETTINGS, true)); + wnd = &WINDOWMANAGER.replaceWindow(std::make_unique(CGI_SETTINGS, true)); + wnd2 = &WINDOWMANAGER.replaceWindow(std::make_unique(CGI_SETTINGS, true)); BOOST_TEST_REQUIRE((wnd && wnd2)); - MOCK_EXPECT(wnd->DrawContent).once(); - MOCK_EXPECT(wnd2->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd->drawContent).once(); + MOCK_EXPECT(wnd2->drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ACTIVE(wnd2); REQUIRE_WINDOW_ALIVE(wnd); - wnd->Close(); - wnd2->Close(); + wnd->close(); + wnd2->close(); mock::verify(); } BOOST_FIXTURE_TEST_CASE(ModalWindowPlacement, uiHelper::Fixture) { // new modal windows get placed on top of older ones, non-modal ones behind all modal ones - auto& wnd = WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_MSGBOX, true)); - MOCK_EXPECT(wnd.DrawContent).once(); - WINDOWMANAGER.Draw(); + auto& wnd = WINDOWMANAGER.replaceWindow(std::make_unique(CGI_MSGBOX, true)); + MOCK_EXPECT(wnd.drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ACTIVE(&wnd); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == &wnd); - auto& wnd2 = WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_MSGBOX, true)); - MOCK_EXPECT(wnd.DrawContent).once(); - MOCK_EXPECT(wnd2.DrawContent).once(); - WINDOWMANAGER.Draw(); + auto& wnd2 = WINDOWMANAGER.replaceWindow(std::make_unique(CGI_MSGBOX, true)); + MOCK_EXPECT(wnd.drawContent).once(); + MOCK_EXPECT(wnd2.drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ACTIVE(&wnd2); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == &wnd2); - auto& wnd3 = WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_MISSION_STATEMENT, true)); - MOCK_EXPECT(wnd.DrawContent).once(); - MOCK_EXPECT(wnd2.DrawContent).once(); - MOCK_EXPECT(wnd3.DrawContent).once(); - WINDOWMANAGER.Draw(); + auto& wnd3 = WINDOWMANAGER.replaceWindow(std::make_unique(CGI_MISSION_STATEMENT, true)); + MOCK_EXPECT(wnd.drawContent).once(); + MOCK_EXPECT(wnd2.drawContent).once(); + MOCK_EXPECT(wnd3.drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ACTIVE(&wnd3); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == &wnd3); - auto& wnd4 = WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_MSGBOX)); - MOCK_EXPECT(wnd.DrawContent).once(); - MOCK_EXPECT(wnd2.DrawContent).once(); - MOCK_EXPECT(wnd3.DrawContent).once(); - MOCK_EXPECT(wnd4.DrawContent).once(); - WINDOWMANAGER.Draw(); + auto& wnd4 = WINDOWMANAGER.replaceWindow(std::make_unique(CGI_MSGBOX)); + MOCK_EXPECT(wnd.drawContent).once(); + MOCK_EXPECT(wnd2.drawContent).once(); + MOCK_EXPECT(wnd3.drawContent).once(); + MOCK_EXPECT(wnd4.drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ACTIVE(&wnd3); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == &wnd3); - auto& wnd5 = WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_HELP, true)); - MOCK_EXPECT(wnd.DrawContent).once(); - MOCK_EXPECT(wnd2.DrawContent).once(); - MOCK_EXPECT(wnd3.DrawContent).once(); - MOCK_EXPECT(wnd4.DrawContent).once(); - MOCK_EXPECT(wnd5.DrawContent).once(); - WINDOWMANAGER.Draw(); + auto& wnd5 = WINDOWMANAGER.replaceWindow(std::make_unique(CGI_HELP, true)); + MOCK_EXPECT(wnd.drawContent).once(); + MOCK_EXPECT(wnd2.drawContent).once(); + MOCK_EXPECT(wnd3.drawContent).once(); + MOCK_EXPECT(wnd4.drawContent).once(); + MOCK_EXPECT(wnd5.drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ACTIVE(&wnd5); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == &wnd5); - auto& wnd6 = WINDOWMANAGER.ReplaceWindow(std::make_unique(CGI_SETTINGS)); - MOCK_EXPECT(wnd.DrawContent).once(); - MOCK_EXPECT(wnd2.DrawContent).once(); - MOCK_EXPECT(wnd3.DrawContent).once(); - MOCK_EXPECT(wnd4.DrawContent).once(); - MOCK_EXPECT(wnd5.DrawContent).once(); - MOCK_EXPECT(wnd6.DrawContent).once(); - WINDOWMANAGER.Draw(); + auto& wnd6 = WINDOWMANAGER.replaceWindow(std::make_unique(CGI_SETTINGS)); + MOCK_EXPECT(wnd.drawContent).once(); + MOCK_EXPECT(wnd2.drawContent).once(); + MOCK_EXPECT(wnd3.drawContent).once(); + MOCK_EXPECT(wnd4.drawContent).once(); + MOCK_EXPECT(wnd5.drawContent).once(); + MOCK_EXPECT(wnd6.drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ACTIVE(&wnd5); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == &wnd5); // Now we have the following order @@ -454,7 +454,7 @@ BOOST_FIXTURE_TEST_CASE(ModalWindowPlacement, uiHelper::Fixture) for(TestIngameWnd* curWnd : expectedOrder) { MOCK_EXPECT(curWnd->msgKeyDown).once().in(s).returns(true); - MOCK_EXPECT(curWnd->DrawContent); // Ignore all draw calls + MOCK_EXPECT(curWnd->drawContent); // Ignore all draw calls } // Way outside any window, should still be handled const KeyEvent ke('a'); @@ -462,20 +462,20 @@ BOOST_FIXTURE_TEST_CASE(ModalWindowPlacement, uiHelper::Fixture) { REQUIRE_WINDOW_ACTIVE(curWnd); WINDOWMANAGER.msgKeyDown(ke); - curWnd->Close(); - WINDOWMANAGER.Draw(); + curWnd->close(); + WINDOWMANAGER.draw(); } mock::verify(); } BOOST_FIXTURE_TEST_CASE(ModalBlocksMouseActivation, uiHelper::Fixture) { - auto* wndA = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); - auto* wndB = &WINDOWMANAGER.Show(std::make_unique(CGI_SETTINGS, true)); + auto* wndA = &WINDOWMANAGER.show(std::make_unique(CGI_HELP)); + auto* wndB = &WINDOWMANAGER.show(std::make_unique(CGI_SETTINGS, true)); wndB->setPos(DrawPoint(200, 200)); - MOCK_EXPECT(wndA->DrawContent).once(); - MOCK_EXPECT(wndB->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wndA->drawContent).once(); + MOCK_EXPECT(wndB->drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ACTIVE(wndB); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wndB); @@ -510,21 +510,21 @@ BOOST_FIXTURE_TEST_CASE(ModalBlocksMouseActivation, uiHelper::Fixture) BOOST_FIXTURE_TEST_CASE(BuriedModalClosedByGame, uiHelper::Fixture) { - auto* wndA = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, true)); - auto* wndB = &WINDOWMANAGER.Show(std::make_unique(CGI_SETTINGS, true)); - auto* wndC = &WINDOWMANAGER.Show(std::make_unique(CGI_MISSION_STATEMENT, true)); - MOCK_EXPECT(wndA->DrawContent).once(); - MOCK_EXPECT(wndB->DrawContent).once(); - MOCK_EXPECT(wndC->DrawContent).once(); - WINDOWMANAGER.Draw(); + auto* wndA = &WINDOWMANAGER.show(std::make_unique(CGI_HELP, true)); + auto* wndB = &WINDOWMANAGER.show(std::make_unique(CGI_SETTINGS, true)); + auto* wndC = &WINDOWMANAGER.show(std::make_unique(CGI_MISSION_STATEMENT, true)); + MOCK_EXPECT(wndA->drawContent).once(); + MOCK_EXPECT(wndB->drawContent).once(); + MOCK_EXPECT(wndC->drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_ACTIVE(wndC); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wndC); // Topmost C must remain topmost after non-topmost B is closed - WINDOWMANAGER.Close(wndB->getID()); - MOCK_EXPECT(wndA->DrawContent).once(); - MOCK_EXPECT(wndC->DrawContent).once(); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.close(wndB->getID()); + MOCK_EXPECT(wndA->drawContent).once(); + MOCK_EXPECT(wndC->drawContent).once(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_DESTROYED(wndB); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wndC); @@ -535,12 +535,12 @@ BOOST_FIXTURE_TEST_CASE(BuriedModalClosedByGame, uiHelper::Fixture) BOOST_FIXTURE_TEST_CASE(ClickActivatesBackgroundNonModal, uiHelper::Fixture) { - auto* wndA = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); - auto* wndB = &WINDOWMANAGER.Show(std::make_unique(CGI_SETTINGS)); + auto* wndA = &WINDOWMANAGER.show(std::make_unique(CGI_HELP)); + auto* wndB = &WINDOWMANAGER.show(std::make_unique(CGI_SETTINGS)); wndB->setPos(DrawPoint(200, 200)); - MOCK_EXPECT(wndA->DrawContent).once(); - MOCK_EXPECT(wndB->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wndA->drawContent).once(); + MOCK_EXPECT(wndB->drawContent).once(); + WINDOWMANAGER.draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wndB); REQUIRE_WINDOW_ACTIVE(wndB); BOOST_TEST(!wndA->IsActive()); @@ -570,101 +570,101 @@ BOOST_FIXTURE_TEST_CASE(ClickActivatesBackgroundNonModal, uiHelper::Fixture) BOOST_FIXTURE_TEST_CASE(EscClosesWindow, uiHelper::Fixture) { - auto* wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); + auto* wnd = &WINDOWMANAGER.show(std::make_unique(CGI_HELP)); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); const KeyEvent evEsc(KeyType::Escape); WINDOWMANAGER.msgKeyDown(evEsc); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == nullptr); REQUIRE_WINDOW_DESTROYED(wnd); // Multiple escapes close multiple windows, even modal ones - auto* wnd1 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); - auto* wnd2 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); - auto* wnd3 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, true)); + auto* wnd1 = &WINDOWMANAGER.show(std::make_unique(CGI_HELP)); + auto* wnd2 = &WINDOWMANAGER.show(std::make_unique(CGI_HELP)); + auto* wnd3 = &WINDOWMANAGER.show(std::make_unique(CGI_HELP, true)); WINDOWMANAGER.msgKeyDown(evEsc); WINDOWMANAGER.msgKeyDown(evEsc); - MOCK_EXPECT(wnd1->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd1->drawContent).once(); + WINDOWMANAGER.draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd1); REQUIRE_WINDOW_DESTROYED(wnd2); REQUIRE_WINDOW_DESTROYED(wnd3); WINDOWMANAGER.msgKeyDown(evEsc); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_DESTROYED(wnd1); // ESC does not close non-user-closable windows - wnd1 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, false, CloseBehavior::Custom)); + wnd1 = &WINDOWMANAGER.show(std::make_unique(CGI_HELP, false, CloseBehavior::Custom)); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd1); WINDOWMANAGER.msgKeyDown(evEsc); REQUIRE_WINDOW_ALIVE(wnd1); - MOCK_EXPECT(wnd1->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd1->drawContent).once(); + WINDOWMANAGER.draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd1); - wnd2 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, true, CloseBehavior::Custom)); + wnd2 = &WINDOWMANAGER.show(std::make_unique(CGI_HELP, true, CloseBehavior::Custom)); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd2); WINDOWMANAGER.msgKeyDown(evEsc); REQUIRE_WINDOW_ALIVE(wnd1); REQUIRE_WINDOW_ALIVE(wnd2); - MOCK_EXPECT(wnd1->DrawContent).once(); - MOCK_EXPECT(wnd2->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd1->drawContent).once(); + MOCK_EXPECT(wnd2->drawContent).once(); + WINDOWMANAGER.draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd2); } BOOST_FIXTURE_TEST_CASE(RightclickClosesWindow, uiHelper::Fixture) { - auto* wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); + auto* wnd = &WINDOWMANAGER.show(std::make_unique(CGI_HELP)); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); MouseCoords evRDown(wnd->getDrawPos() + Position(10, 10)); evRDown.rdown = true; WINDOWMANAGER.msgRightDown(evRDown); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == nullptr); REQUIRE_WINDOW_DESTROYED(wnd); // Only close top most window - auto* wnd1 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); - auto* wnd2 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); + auto* wnd1 = &WINDOWMANAGER.show(std::make_unique(CGI_HELP)); + auto* wnd2 = &WINDOWMANAGER.show(std::make_unique(CGI_HELP)); WINDOWMANAGER.msgRightDown(evRDown); - MOCK_EXPECT(wnd1->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd1->drawContent).once(); + WINDOWMANAGER.draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd1); REQUIRE_WINDOW_DESTROYED(wnd2); // Also modal windows, even when not opened last - wnd2 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, true)); - auto* wnd3 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); + wnd2 = &WINDOWMANAGER.show(std::make_unique(CGI_HELP, true)); + auto* wnd3 = &WINDOWMANAGER.show(std::make_unique(CGI_HELP)); WINDOWMANAGER.msgRightDown(evRDown); REQUIRE_WINDOW_ALIVE(wnd1); REQUIRE_WINDOW_ALIVE(wnd3); - MOCK_EXPECT(wnd1->DrawContent).once(); - MOCK_EXPECT(wnd3->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd1->drawContent).once(); + MOCK_EXPECT(wnd3->drawContent).once(); + WINDOWMANAGER.draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd3); REQUIRE_WINDOW_DESTROYED(wnd2); WINDOWMANAGER.msgRightDown(evRDown); - MOCK_EXPECT(wnd1->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd1->drawContent).once(); + WINDOWMANAGER.draw(); WINDOWMANAGER.msgRightDown(evRDown); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_DESTROYED(wnd1); REQUIRE_WINDOW_DESTROYED(wnd3); // Don't close non-user-closable windows - wnd1 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, false, CloseBehavior::Custom)); + wnd1 = &WINDOWMANAGER.show(std::make_unique(CGI_HELP, false, CloseBehavior::Custom)); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd1); WINDOWMANAGER.msgRightDown(evRDown); - MOCK_EXPECT(wnd1->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd1->drawContent).once(); + WINDOWMANAGER.draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd1); - wnd2 = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP, true, CloseBehavior::NoRightClick)); + wnd2 = &WINDOWMANAGER.show(std::make_unique(CGI_HELP, true, CloseBehavior::NoRightClick)); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd2); WINDOWMANAGER.msgRightDown(evRDown); - MOCK_EXPECT(wnd1->DrawContent).once(); - MOCK_EXPECT(wnd2->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd1->drawContent).once(); + MOCK_EXPECT(wnd2->drawContent).once(); + WINDOWMANAGER.draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd2); } @@ -676,15 +676,15 @@ BOOST_FIXTURE_TEST_CASE(PinnedWindows, uiHelper::Fixture) BOOST_TEST_CONTEXT("Pinned windows ignore escape key") { - auto* wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); + auto* wnd = &WINDOWMANAGER.show(std::make_unique(CGI_HELP)); wnd->setPinned(); BOOST_TEST_CONTEXT("Pinned") { BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); WINDOWMANAGER.msgKeyDown(evEsc); - MOCK_EXPECT(wnd->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd->drawContent).once(); + WINDOWMANAGER.draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); } @@ -692,28 +692,28 @@ BOOST_FIXTURE_TEST_CASE(PinnedWindows, uiHelper::Fixture) BOOST_TEST_CONTEXT("Un-pinned") { WINDOWMANAGER.msgKeyDown(evEsc); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_DESTROYED(wnd); } } BOOST_TEST_CONTEXT("Pinned windows close on Alt+W") { - auto* wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); + auto* wnd = &WINDOWMANAGER.show(std::make_unique(CGI_HELP)); wnd->setPinned(); BOOST_TEST_CONTEXT("Pinned") { BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); WINDOWMANAGER.msgKeyDown(evAltW); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_DESTROYED(wnd); } } BOOST_TEST_CONTEXT("Pinned windows ignore right click") { - auto* wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_HELP)); + auto* wnd = &WINDOWMANAGER.show(std::make_unique(CGI_HELP)); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); MouseCoords evRDown(wnd->getDrawPos() + Position(10, 10)); evRDown.rdown = true; @@ -722,8 +722,8 @@ BOOST_FIXTURE_TEST_CASE(PinnedWindows, uiHelper::Fixture) BOOST_TEST_CONTEXT("Pinned") { WINDOWMANAGER.msgRightDown(evRDown); - MOCK_EXPECT(wnd->DrawContent).once(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd->drawContent).once(); + WINDOWMANAGER.draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); } @@ -731,7 +731,7 @@ BOOST_FIXTURE_TEST_CASE(PinnedWindows, uiHelper::Fixture) BOOST_TEST_CONTEXT("Un-pinned") { WINDOWMANAGER.msgRightDown(evRDown); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); REQUIRE_WINDOW_DESTROYED(wnd); } } @@ -743,9 +743,9 @@ BOOST_FIXTURE_TEST_CASE(SnapWindow, uiHelper::Fixture) { SETTINGS.interface.windowSnapDistance = 10; - WINDOWMANAGER.Show(std::make_unique(0, DrawPoint(0, 0), Extent(100, 100), "", nullptr)); + WINDOWMANAGER.show(std::make_unique(0, DrawPoint(0, 0), Extent(100, 100), "", nullptr)); auto* wnd = - &WINDOWMANAGER.Show(std::make_unique(0, DrawPoint(100, 0), Extent(100, 100), "", nullptr)); + &WINDOWMANAGER.show(std::make_unique(0, DrawPoint(100, 0), Extent(100, 100), "", nullptr)); BOOST_TEST(WINDOWMANAGER.snapWindow(wnd, wnd->getBoundaryRect()) == SnapOffset(0, 0)); @@ -765,57 +765,57 @@ MOCK_BASE_CLASS(MockSettingsWnd, TransmitSettingsIgwAdapter) activeWnds++; } ~MockSettingsWnd() { activeWnds--; } - MOCK_NON_CONST_METHOD(UpdateSettings, 0); // LCOV_EXCL_LINE - MOCK_NON_CONST_METHOD(TransmitSettings, 0); + MOCK_NON_CONST_METHOD(updateSettings, 0); // LCOV_EXCL_LINE + MOCK_NON_CONST_METHOD(transmitSettings, 0); }; int MockSettingsWnd::activeWnds = 0; BOOST_FIXTURE_TEST_CASE(TestTransmitSettingsAdapter, uiHelper::Fixture) { - auto* wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_TOOLS)); + auto* wnd = &WINDOWMANAGER.show(std::make_unique(CGI_TOOLS)); BOOST_TEST_REQUIRE(wnd); { // Save settings on close via window method - MOCK_EXPECT(wnd->TransmitSettings).once(); - wnd->Close(); - WINDOWMANAGER.Draw(); + MOCK_EXPECT(wnd->transmitSettings).once(); + wnd->close(); + WINDOWMANAGER.draw(); BOOST_TEST(MockSettingsWnd::activeWnds == 0); } { // Save settings on close via ID - wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_TOOLS)); - MOCK_EXPECT(wnd->TransmitSettings).once(); - WINDOWMANAGER.Close(CGI_TOOLS); - WINDOWMANAGER.Draw(); + wnd = &WINDOWMANAGER.show(std::make_unique(CGI_TOOLS)); + MOCK_EXPECT(wnd->transmitSettings).once(); + WINDOWMANAGER.close(CGI_TOOLS); + WINDOWMANAGER.draw(); BOOST_TEST(MockSettingsWnd::activeWnds == 0); } { // Save settings on closeNow - wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_TOOLS)); - MOCK_EXPECT(wnd->TransmitSettings).once(); - WINDOWMANAGER.CloseNow(wnd); + wnd = &WINDOWMANAGER.show(std::make_unique(CGI_TOOLS)); + MOCK_EXPECT(wnd->transmitSettings).once(); + WINDOWMANAGER.closeNow(wnd); BOOST_TEST(MockSettingsWnd::activeWnds == 0); } { // Save settings on ESC - wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_TOOLS)); + wnd = &WINDOWMANAGER.show(std::make_unique(CGI_TOOLS)); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); - MOCK_EXPECT(wnd->TransmitSettings).once(); + MOCK_EXPECT(wnd->transmitSettings).once(); WINDOWMANAGER.msgKeyDown(KeyEvent(KeyType::Escape)); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); BOOST_TEST(MockSettingsWnd::activeWnds == 0); BOOST_TEST(WINDOWMANAGER.getTopMostWindow() == nullptr); } { // Save settings on ALT+W - wnd = &WINDOWMANAGER.Show(std::make_unique(CGI_TOOLS)); + wnd = &WINDOWMANAGER.show(std::make_unique(CGI_TOOLS)); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == wnd); - MOCK_EXPECT(wnd->TransmitSettings).once(); + MOCK_EXPECT(wnd->transmitSettings).once(); KeyEvent ke('w'); ke.alt = true; WINDOWMANAGER.msgKeyDown(ke); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); BOOST_TEST(MockSettingsWnd::activeWnds == 0); BOOST_TEST(WINDOWMANAGER.getTopMostWindow() == nullptr); } diff --git a/tests/s25Main/UI/testWindows.cpp b/tests/s25Main/UI/testWindows.cpp index e64bf4353d..3f877c6d98 100644 --- a/tests/s25Main/UI/testWindows.cpp +++ b/tests/s25Main/UI/testWindows.cpp @@ -149,7 +149,7 @@ struct AddonPresetFixture : uiHelper::Fixture return found; } - static void closeMsgbox(iwMsgbox& msgbox) { WINDOWMANAGER.CloseNow(&msgbox); } + static void closeMsgbox(iwMsgbox& msgbox) { WINDOWMANAGER.closeNow(&msgbox); } // Answers the prompt on top and closes it, as its own button would. // Anything the answer opens (e.g. an error) stays open. @@ -294,7 +294,7 @@ BOOST_FIXTURE_TEST_CASE(AddonPresetSaveUnwritable, AddonPresetFixture) auto& msgbox = ensureNonNull(topMsgbox()); BOOST_TEST(msgbox.getTitle() == _("Save Failed")); - BOOST_TEST(!wnd.ShouldBeClosed()); + BOOST_TEST(!wnd.shouldBeClosed()); BOOST_TEST(base.getCtrls().at(0)->getText() == "blocked"); closeMsgbox(msgbox); } @@ -427,7 +427,7 @@ MOCK_BASE_CLASS(TestWindow, Window) TestWindow(Window * parent, unsigned id, const DrawPoint& position) : Window(parent, id, position) {} MOCK_METHOD(msgPaintBefore, 0) MOCK_METHOD(msgPaintAfter, 0) - MOCK_METHOD(Draw_, 0, void()) + MOCK_METHOD(drawImpl, 0, void()) }; } // namespace @@ -440,16 +440,16 @@ BOOST_AUTO_TEST_CASE(DrawOrder) for(int i = 0; i < 3; i++) { wnds.push_back( - dsk->AddCtrl(std::make_unique(dsk, static_cast(wnds.size()), DrawPoint(0, 0)))); + dsk->addCtrl(std::make_unique(dsk, static_cast(wnds.size()), DrawPoint(0, 0)))); } // Some groups with own controls for(int i = 0; i < 3; i++) { - ctrlGroup* grp = dsk->AddGroup(100 + i); + ctrlGroup* grp = dsk->addGroup(100 + i); for(int i = 0; i < 3; i++) { wnds.push_back( - grp->AddCtrl(std::make_unique(dsk, static_cast(wnds.size()), DrawPoint(0, 0)))); + grp->addCtrl(std::make_unique(dsk, static_cast(wnds.size()), DrawPoint(0, 0)))); } } mock::sequence s; @@ -457,10 +457,10 @@ BOOST_AUTO_TEST_CASE(DrawOrder) for(TestWindow* wnd : wnds) MOCK_EXPECT(wnd->msgPaintBefore).once().in(s); for(TestWindow* wnd : wnds) - MOCK_EXPECT(wnd->Draw_).once().in(s); + MOCK_EXPECT(wnd->drawImpl).once().in(s); for(TestWindow* wnd : wnds) MOCK_EXPECT(wnd->msgPaintAfter).once().in(s); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); mock::verify(); } diff --git a/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.cpp b/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.cpp index 75e67ddb9c..14bee468ed 100644 --- a/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.cpp +++ b/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.cpp @@ -27,16 +27,16 @@ void initGUITests() if(!dynamic_cast(VIDEODRIVER.getDriver())) { rttr::test::LogAccessor logAcc; - VIDEODRIVER.LoadDriver(new MockupVideoDriver(&WINDOWMANAGER)); + VIDEODRIVER.loadDriver(new MockupVideoDriver(&WINDOWMANAGER)); RTTR_REQUIRE_LOG_CONTAINS("Mockup Video Driver", false); - VIDEODRIVER.CreateScreen(VideoMode(800, 600), DisplayMode::Windowed); + VIDEODRIVER.createScreen(VideoMode(800, 600), DisplayMode::Windowed); BOOST_TEST_CHECKPOINT("Load dummy files"); - LOADER.LoadDummyGUIFiles(); - LOADER.LoadDummySoundFiles(); + LOADER.loadDummyGUIFiles(); + LOADER.loadDummySoundFiles(); BOOST_TEST_CHECKPOINT("Switch to Desktop"); WINDOWMANAGER.Switch(std::make_unique()); BOOST_TEST_CHECKPOINT("Dummy Draw"); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); logAcc.clearLog(); } // Don't try to play sounds @@ -61,7 +61,7 @@ Fixture::~Fixture() { // Switch back to new, empty desktop to clean up active windows WINDOWMANAGER.Switch(std::make_unique()); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); } } diff --git a/tests/s25Main/audio/LoadMockupAudio.h b/tests/s25Main/audio/LoadMockupAudio.h index 81133afce6..d69ed8520e 100644 --- a/tests/s25Main/audio/LoadMockupAudio.h +++ b/tests/s25Main/audio/LoadMockupAudio.h @@ -22,10 +22,10 @@ struct LoadMockupAudio SETTINGS.sound.musicEnabled = true; auto driver = std::make_unique(audioCallbackMock.get()); audioDriverMock = driver.get(); - AUDIODRIVER.LoadDriver(std::move(driver)); + AUDIODRIVER.loadDriver(std::move(driver)); BOOST_TEST_REQUIRE(AUDIODRIVER.getName() != ""); } - ~LoadMockupAudio() { AUDIODRIVER.UnloadDriver(); } + ~LoadMockupAudio() { AUDIODRIVER.unloadDriver(); } /// Return a callable to be used with MOCK_EXPECT(...).calls(...) that loads a sound of the given type auto makeDoLoad(driver::SoundType type) { diff --git a/tests/s25Main/audio/testPlaylist.cpp b/tests/s25Main/audio/testPlaylist.cpp index ff588d1c77..0e3a484451 100644 --- a/tests/s25Main/audio/testPlaylist.cpp +++ b/tests/s25Main/audio/testPlaylist.cpp @@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(SaveLoadResultsInSamePlaylist) Playlist pl(songs, numRepeats, isRandom); rttr::test::TmpFolder tmpFolder; const auto filepath = tmpFolder.get() / "playlist.pll"; - BOOST_TEST_REQUIRE(pl.SaveAs(filepath)); + BOOST_TEST_REQUIRE(pl.saveAs(filepath)); Playlist pl2; BOOST_TEST_REQUIRE(pl2.Load(LOG, filepath)); BOOST_TEST(pl.getSongs() == pl2.getSongs(), boost::test_tools::per_element()); diff --git a/tests/s25Main/audio/testSoundManager.cpp b/tests/s25Main/audio/testSoundManager.cpp index f776c341f9..f977bda4c9 100644 --- a/tests/s25Main/audio/testSoundManager.cpp +++ b/tests/s25Main/audio/testSoundManager.cpp @@ -29,7 +29,7 @@ class DummyEffect final : public libsiedler2::ArchivItem, public SoundEffectItem DummyEffect() : libsiedler2::ArchivItem(libsiedler2::BobType::Sound) {} RTTR_CLONEABLE(DummyEffect) // LCOV_EXCL_LINE protected: - SoundHandle Load() override { return AUDIODRIVER.LoadEffect("foo.wav"); } + SoundHandle Load() override { return AUDIODRIVER.loadEffect("foo.wav"); } }; class DummyNO final : public noBase @@ -37,8 +37,8 @@ class DummyNO final : public noBase public: DummyNO() : noBase(NodalObjectType::Animal) {} // LCOV_EXCL_START - void Draw(DrawPoint) override {} - void Destroy() override {} + void draw(DrawPoint) override {} + void destroy() override {} GO_Type getGOT() const override { return GO_Type::Animal; } // LCOV_EXCL_STOP }; @@ -60,7 +60,7 @@ struct LoadMockupAudioWithSounds : LoadMockupAudio sounds.alloc(115); for(int i = 50; i < 115; ++i) sounds.set(i, std::make_unique()); - MOCK_EXPECT(audioDriverMock->LoadEffect).calls(makeDoLoad(driver::SoundType::Effect)); + MOCK_EXPECT(audioDriverMock->loadEffect).calls(makeDoLoad(driver::SoundType::Effect)); MOCK_EXPECT(audioDriverMock->doUnloadSound).calls(makeUnloadHandle(driver::SoundType::Effect)); } }; @@ -137,14 +137,14 @@ BOOST_FIXTURE_TEST_CASE(OceanSounds, LoadMockupAudioWithSounds) // If already playing don't change it or play again, just adjust volume MOCK_EXPECT(audioDriverMock->isEffectPlaying).once().returns(true); - MOCK_EXPECT(audioDriverMock->ChangeVolume).once().with(mock::any, volume); + MOCK_EXPECT(audioDriverMock->changeVolume).once().with(mock::any, volume); manager.playOceanBrawling(10); mock::verify(); // More water -> Sound gets louder MOCK_EXPECT(audioDriverMock->isEffectPlaying).once().returns(true); int oldVolume = volume; - MOCK_EXPECT(audioDriverMock->ChangeVolume).once().with(mock::any, mock::retrieve(volume)); + MOCK_EXPECT(audioDriverMock->changeVolume).once().with(mock::any, mock::retrieve(volume)); manager.playOceanBrawling(20); mock::verify(); BOOST_TEST(volume > oldVolume); @@ -152,7 +152,7 @@ BOOST_FIXTURE_TEST_CASE(OceanSounds, LoadMockupAudioWithSounds) // Max volume MOCK_EXPECT(audioDriverMock->isEffectPlaying).once().returns(true); oldVolume = volume; - MOCK_EXPECT(audioDriverMock->ChangeVolume).once().with(mock::any, mock::retrieve(volume)); + MOCK_EXPECT(audioDriverMock->changeVolume).once().with(mock::any, mock::retrieve(volume)); manager.playOceanBrawling(100); mock::verify(); BOOST_TEST(volume > oldVolume); diff --git a/tests/s25Main/audio/testSounds.cpp b/tests/s25Main/audio/testSounds.cpp index 7d3908bd8f..b7afbee072 100644 --- a/tests/s25Main/audio/testSounds.cpp +++ b/tests/s25Main/audio/testSounds.cpp @@ -38,13 +38,13 @@ BOOST_FIXTURE_TEST_CASE(SoundHandleGetUnloadedWhenLastGoesOutOfScope, LoadMockup { { BOOST_TEST_REQUIRE(MockupSoundData::numAlive == 0); - MOCK_EXPECT(audioDriverMock->LoadEffect).once().with("Foo.wav").calls(makeDoLoad(SoundType::Effect)); - SoundHandle handle = AUDIODRIVER.LoadEffect("Foo.wav"); + MOCK_EXPECT(audioDriverMock->loadEffect).once().with("Foo.wav").calls(makeDoLoad(SoundType::Effect)); + SoundHandle handle = AUDIODRIVER.loadEffect("Foo.wav"); BOOST_TEST_REQUIRE(MockupSoundData::numAlive == 1); BOOST_TEST_REQUIRE(handle); BOOST_TEST(handle.getType() == SoundType::Effect); - MOCK_EXPECT(audioDriverMock->LoadMusic).once().with("Foo2.wav").calls(makeDoLoad(SoundType::Music)); - SoundHandle handle2 = AUDIODRIVER.LoadMusic("Foo2.wav"); + MOCK_EXPECT(audioDriverMock->loadMusic).once().with("Foo2.wav").calls(makeDoLoad(SoundType::Music)); + SoundHandle handle2 = AUDIODRIVER.loadMusic("Foo2.wav"); BOOST_TEST_REQUIRE(MockupSoundData::numAlive == 2); BOOST_TEST_REQUIRE(handle2); BOOST_TEST(handle2.getType() == SoundType::Music); @@ -71,15 +71,15 @@ BOOST_FIXTURE_TEST_CASE(SoundHandleGetUnloadedWhenLastGoesOutOfScope, LoadMockup } BOOST_TEST_REQUIRE(MockupSoundData::numAlive == 0); // Release driver. Nothing will be done as sounds already unloaded - AUDIODRIVER.UnloadDriver(); + AUDIODRIVER.unloadDriver(); BOOST_TEST_REQUIRE(MockupSoundData::numAlive == 0); } BOOST_FIXTURE_TEST_CASE(SoundHandlesCanBeUnloadedByDriver, LoadMockupAudio) { { - MOCK_EXPECT(audioDriverMock->LoadEffect).once().with("Foo.wav").calls(makeDoLoad(SoundType::Effect)); - SoundHandle handle = AUDIODRIVER.LoadEffect("Foo.wav"); + MOCK_EXPECT(audioDriverMock->loadEffect).once().with("Foo.wav").calls(makeDoLoad(SoundType::Effect)); + SoundHandle handle = AUDIODRIVER.loadEffect("Foo.wav"); BOOST_TEST_REQUIRE(MockupSoundData::numAlive == 1); BOOST_TEST_REQUIRE(handle); BOOST_TEST(handle.getType() == SoundType::Effect); @@ -89,7 +89,7 @@ BOOST_FIXTURE_TEST_CASE(SoundHandlesCanBeUnloadedByDriver, LoadMockupAudio) .once() .with(handle.getRawHandle()) .calls(makeUnloadHandle(handle.getType())); - AUDIODRIVER.UnloadDriver(); + AUDIODRIVER.unloadDriver(); BOOST_TEST_REQUIRE(!handle); // Driver data was released BOOST_TEST_REQUIRE(MockupSoundData::numAlive == 0); @@ -116,7 +116,7 @@ BOOST_FIXTURE_TEST_CASE(PlayFromFile, LoadMockupAudio) .calls(makeDoLoad(SoundType::Effect)); const int channel = 0; MOCK_EXPECT(audioDriverMock->doPlayEffect).in(s).once().with(mock::affirm, 50, false).returns(channel); - EffectPlayId id = effect->Play(50, false); //-V522 + EffectPlayId id = effect->play(50, false); //-V522 BOOST_TEST_REQUIRE(MockupSoundData::numAlive == 1); BOOST_TEST(effect->getLoadedType() == SoundType::Effect); BOOST_TEST(id != EffectPlayId::Invalid); @@ -128,7 +128,7 @@ BOOST_FIXTURE_TEST_CASE(PlayFromFile, LoadMockupAudio) MOCK_EXPECT(audioDriverMock->doStopEffect).in(s).once().with(channel); MOCK_EXPECT(audioDriverMock->isEffectPlaying).in(s).once().with(id).returns(false); const auto idCopy = id; - AUDIODRIVER.StopEffect(id); + AUDIODRIVER.stopEffect(id); BOOST_TEST(id == EffectPlayId::Invalid); BOOST_TEST_REQUIRE(audioDriverMock->getEffectChannel(idCopy) == -1); BOOST_TEST(!AUDIODRIVER.isEffectPlaying(idCopy)); @@ -157,13 +157,13 @@ BOOST_FIXTURE_TEST_CASE(PlayFromFile, LoadMockupAudio) .once() .with(mock::any, extension) .calls(makeDoLoad(SoundType::Music)); - MOCK_EXPECT(audioDriverMock->PlayMusic).in(s).once().with(mock::any, 0); - music->Play(); + MOCK_EXPECT(audioDriverMock->playMusic).in(s).once().with(mock::any, 0); + music->play(); BOOST_TEST_REQUIRE(MockupSoundData::numAlive == 1); BOOST_TEST(music->getLoadedType() == SoundType::Music); - MOCK_EXPECT(audioDriverMock->StopMusic).in(s).once(); - AUDIODRIVER.StopMusic(); + MOCK_EXPECT(audioDriverMock->stopMusic).in(s).once(); + AUDIODRIVER.stopMusic(); MOCK_EXPECT(audioDriverMock->doUnloadSound).in(s).once().calls(makeUnloadHandle(SoundType::Music)); } BOOST_TEST_REQUIRE(MockupSoundData::numAlive == 0); @@ -201,14 +201,14 @@ BOOST_FIXTURE_TEST_CASE(PlayListRepeatsCorrect, LoadMockupAudio) // Play both songs once (no repeats), then play first again mock::sequence s; - MOCK_EXPECT(audioDriverMock->PlayMusic).in(s).once().with(isHandle(handleOgg1), 0); - MOCK_EXPECT(audioDriverMock->PlayMusic).in(s).once().with(isHandle(handleMidi), 0); - MOCK_EXPECT(audioDriverMock->PlayMusic).in(s).once().with(isHandle(handleOgg2), 0); + MOCK_EXPECT(audioDriverMock->playMusic).in(s).once().with(isHandle(handleOgg1), 0); + MOCK_EXPECT(audioDriverMock->playMusic).in(s).once().with(isHandle(handleMidi), 0); + MOCK_EXPECT(audioDriverMock->playMusic).in(s).once().with(isHandle(handleOgg2), 0); MOCK_EXPECT(audioDriverMock->doUnloadSound).calls(makeUnloadHandle(SoundType::Music)); - player.Play(); - player.MusicFinished(); - player.MusicFinished(); + player.play(); + player.musicFinished(); + player.musicFinished(); mock::verify(); mock::reset(); @@ -221,30 +221,30 @@ BOOST_FIXTURE_TEST_CASE(PlayListRepeatsCorrect, LoadMockupAudio) // Play both songs twice (1 repeat), then play first again Playlist playlist_repeat(playlist.getSongs(), 1, false); player.setPlaylist(playlist_repeat); - MOCK_EXPECT(audioDriverMock->PlayMusic).in(s).exactly(2).with(isType(SoundType::Effect), 0); - MOCK_EXPECT(audioDriverMock->PlayMusic).in(s).exactly(2).with(isType(SoundType::Music), 0); - MOCK_EXPECT(audioDriverMock->PlayMusic).in(s).once().with(isType(SoundType::Effect), 0); + MOCK_EXPECT(audioDriverMock->playMusic).in(s).exactly(2).with(isType(SoundType::Effect), 0); + MOCK_EXPECT(audioDriverMock->playMusic).in(s).exactly(2).with(isType(SoundType::Music), 0); + MOCK_EXPECT(audioDriverMock->playMusic).in(s).once().with(isType(SoundType::Effect), 0); - player.Play(); - player.MusicFinished(); - player.MusicFinished(); - player.MusicFinished(); - player.MusicFinished(); + player.play(); + player.musicFinished(); + player.musicFinished(); + player.musicFinished(); + player.musicFinished(); mock::verify(); // Same but in random order Playlist playlist_random(playlist.getSongs(), 1, true); player.setPlaylist(playlist_random); - MOCK_EXPECT(audioDriverMock->PlayMusic).exactly(2).with(isType(SoundType::Effect), 0); - MOCK_EXPECT(audioDriverMock->PlayMusic).exactly(2).with(isType(SoundType::Music), 0); - MOCK_EXPECT(audioDriverMock->PlayMusic).once().with(mock::any, 0); - - player.Play(); - player.MusicFinished(); - player.MusicFinished(); - player.MusicFinished(); - player.MusicFinished(); + MOCK_EXPECT(audioDriverMock->playMusic).exactly(2).with(isType(SoundType::Effect), 0); + MOCK_EXPECT(audioDriverMock->playMusic).exactly(2).with(isType(SoundType::Music), 0); + MOCK_EXPECT(audioDriverMock->playMusic).once().with(mock::any, 0); + + player.play(); + player.musicFinished(); + player.musicFinished(); + player.musicFinished(); + player.musicFinished(); mock::verify(); } diff --git a/tests/s25Main/autoplay/main.cpp b/tests/s25Main/autoplay/main.cpp index a2be0b43c6..860d598fd6 100644 --- a/tests/s25Main/autoplay/main.cpp +++ b/tests/s25Main/autoplay/main.cpp @@ -45,7 +45,7 @@ static void playReplay(const boost::filesystem::path& replayPath) HeadlessReplay replay(replayPath); const Timer timer(true); - replay.Run(); + replay.run(); const auto duration = std::chrono::duration_cast>(timer.getElapsed()); std::cout << "Replay " << replayPath.filename() << " took " << helpers::withUnit(duration) << std::endl; diff --git a/tests/s25Main/benchmarks/RealWorld_MapTests.cpp b/tests/s25Main/benchmarks/RealWorld_MapTests.cpp index 41e33b89e0..3857330503 100644 --- a/tests/s25Main/benchmarks/RealWorld_MapTests.cpp +++ b/tests/s25Main/benchmarks/RealWorld_MapTests.cpp @@ -43,8 +43,8 @@ static void BM_PathFinding(benchmark::State& state) for(auto _ : state) { - const bool result = state.range() < 6 ? world.FindHumanPath(start, goal).has_value() : - world.FindShipPath(start, goal, 600, nullptr, nullptr); + const bool result = state.range() < 6 ? world.findHumanPath(start, goal).has_value() : + world.findShipPath(start, goal, 600, nullptr, nullptr); benchmark::DoNotOptimize(result); } } @@ -71,7 +71,7 @@ static void BM_BQ_Calculation(benchmark::State& state) for(auto _ : state) { - world.InitAfterLoad(); + world.initAfterLoad(); benchmark::DoNotOptimize(world); } } diff --git a/tests/s25Main/drivers/testDriverWrapper.cpp b/tests/s25Main/drivers/testDriverWrapper.cpp index 45c2003c70..8e71255121 100644 --- a/tests/s25Main/drivers/testDriverWrapper.cpp +++ b/tests/s25Main/drivers/testDriverWrapper.cpp @@ -11,7 +11,7 @@ BOOST_AUTO_TEST_CASE(GetDriverList) { for(auto type : {drivers::DriverType::Video, drivers::DriverType::Audio}) { - const auto drivers = drivers::DriverWrapper::LoadDriverList(type); + const auto drivers = drivers::DriverWrapper::loadDriverList(type); BOOST_TEST(!drivers.empty()); for(const auto& driver : drivers) { @@ -23,29 +23,29 @@ BOOST_AUTO_TEST_CASE(GetDriverList) BOOST_AUTO_TEST_CASE(AllAudioDriversAreLoadable) { - const auto drivers = drivers::DriverWrapper::LoadDriverList(drivers::DriverType::Audio); + const auto drivers = drivers::DriverWrapper::loadDriverList(drivers::DriverType::Audio); for(const auto& driver : drivers) { std::string preference = driver.getName(); BOOST_TEST_CHECKPOINT("Loading " << preference); - BOOST_TEST_REQUIRE(AUDIODRIVER.LoadDriver(preference)); + BOOST_TEST_REQUIRE(AUDIODRIVER.loadDriver(preference)); BOOST_TEST(preference == driver.getName()); BOOST_TEST(AUDIODRIVER.getName() == driver.getName()); - AUDIODRIVER.UnloadDriver(); + AUDIODRIVER.unloadDriver(); } } BOOST_AUTO_TEST_CASE(AllVideoDriversAreLoadable) { - const auto drivers = drivers::DriverWrapper::LoadDriverList(drivers::DriverType::Video); + const auto drivers = drivers::DriverWrapper::loadDriverList(drivers::DriverType::Video); for(const auto& driver : drivers) { std::string preference = driver.getName(); BOOST_TEST_CHECKPOINT("Loading " << preference); - BOOST_TEST_REQUIRE(VIDEODRIVER.LoadDriver(preference)); + BOOST_TEST_REQUIRE(VIDEODRIVER.loadDriver(preference)); BOOST_TEST(preference == driver.getName()); BOOST_TEST(VIDEODRIVER.getName() == driver.getName()); BOOST_TEST(VIDEODRIVER.getDriver()); - VIDEODRIVER.UnloadDriver(); + VIDEODRIVER.unloadDriver(); } } diff --git a/tests/s25Main/integration/testAI.cpp b/tests/s25Main/integration/testAI.cpp index 84bff8d87a..63fa2cfaf8 100644 --- a/tests/s25Main/integration/testAI.cpp +++ b/tests/s25Main/integration/testAI.cpp @@ -72,7 +72,7 @@ void makeWorldMineable(GameWorld& world) node.t1 = node.t2 = mineableTerrain; node.resources = Resource(); } - world.InitAfterLoad(); + world.initAfterLoad(); } // Mark every node as a usable, owned, reachable build spot so the AI's position search only depends on the @@ -93,8 +93,8 @@ struct MockAI final : public AIPlayer { MockAI(unsigned char playerId, const GameWorldBase& gwb, const AI::Level level) : AIPlayer(playerId, gwb, level) {} // LCOV_EXCL_START - void RunGF(unsigned /*gf*/, bool /*gfisnwf*/) override {} - void OnChatMessage(unsigned /*sendPlayerId*/, ChatDestination, const std::string& /*msg*/) override {} + void runGF(unsigned /*gf*/, bool /*gfisnwf*/) override {} + void onChatMessage(unsigned /*sendPlayerId*/, ChatDestination, const std::string& /*msg*/) override {} // LCOV_EXCL_STOP }; } // namespace @@ -111,10 +111,10 @@ BOOST_FIXTURE_TEST_CASE(PlayerHasBld_IsCorrect, EmptyWorldFixture1P) MapPoint pos = player.getHQPos(); for(const auto bld : {BuildingType::Woodcutter, BuildingType::Barracks, BuildingType::Storehouse}) { - pos = world.MakeMapPoint(pos + Position(2, 0)); + pos = world.makeMapPoint(pos + Position(2, 0)); BOOST_TEST_INFO(bld); BOOST_TEST(!playerHasBld(player, bld)); - BuildingFactory::CreateBuilding(world, bld, pos, player.getPlayerId(), Nation::Romans); + BuildingFactory::createBuilding(world, bld, pos, player.getPlayerId(), Nation::Romans); BOOST_TEST_INFO(bld); BOOST_TEST(playerHasBld(player, bld)); } @@ -123,9 +123,9 @@ BOOST_FIXTURE_TEST_CASE(PlayerHasBld_IsCorrect, EmptyWorldFixture1P) BOOST_FIXTURE_TEST_CASE(AIChat, EmptyWorldFixture2P) { MockAI ai(1, world, AI::Level::Easy); - ai.getAIInterface().Chat("Hello players!"); - ai.getAIInterface().Chat("2nd Message!", ChatDestination::Allies); - const auto msgs = ai.getAIInterface().FetchChatMessages(); + ai.getAIInterface().chat("Hello players!"); + ai.getAIInterface().chat("2nd Message!", ChatDestination::Allies); + const auto msgs = ai.getAIInterface().fetchChatMessages(); BOOST_TEST_REQUIRE(msgs.size() == 2u); BOOST_TEST(msgs[0]->player == 1u); BOOST_TEST(msgs[0]->destination == ChatDestination::All); @@ -134,12 +134,12 @@ BOOST_FIXTURE_TEST_CASE(AIChat, EmptyWorldFixture2P) BOOST_TEST(msgs[1]->destination == ChatDestination::Allies); BOOST_TEST(msgs[1]->text == "2nd Message!"); // Messages cleared by first call - BOOST_TEST(ai.getAIInterface().FetchChatMessages().empty()); + BOOST_TEST(ai.getAIInterface().fetchChatMessages().empty()); // Can readd const auto dest = rttr::test::randomEnum(); - ai.getAIInterface().Chat("Hello again!", dest); + ai.getAIInterface().chat("Hello again!", dest); // Iterate just like in ExecuteNWF function - for(auto& msg : ai.getAIInterface().FetchChatMessages()) + for(auto& msg : ai.getAIInterface().fetchChatMessages()) { BOOST_TEST(msg->player == 1u); BOOST_TEST(msg->destination == dest); @@ -149,7 +149,7 @@ BOOST_FIXTURE_TEST_CASE(AIChat, EmptyWorldFixture2P) BOOST_FIXTURE_TEST_CASE(MineResourceRatingAccountsForS4LikeExhaustion, EmptyWorldFixture1P) { - const MapPoint resourcePos = world.MakeMapPoint(world.getPlayer(0).getHQPos() + Position(2, 0)); + const MapPoint resourcePos = world.makeMapPoint(world.getPlayer(0).getHQPos() + Position(2, 0)); world.getNodeWriteable(resourcePos).resources = Resource(ResourceType::Coal, 1); MockAI ai(0, world, AI::Level::Easy); @@ -182,15 +182,15 @@ BOOST_FIXTURE_TEST_CASE(MineWorkEverywhereAffectsMatchingResourceOnly, EmptyWorl // The HQ is the only guaranteed reachable/owned starting spot, so searches are centered on it. const MapPoint searchCenter = world.getPlayer(0).getHQPos(); // The only iron deposit sits well outside the search radius below, so default iron mining has no reachable spot. - const MapPoint ironPos = world.MakeMapPoint(searchCenter + Position(8, 0)); + const MapPoint ironPos = world.makeMapPoint(searchCenter + Position(8, 0)); world.getNodeWriteable(ironPos).resources = Resource(ResourceType::Iron, 4); // WorkEverywhere coal treats any mineable node as a coal spot, even one that actually holds an iron deposit. BOOST_TEST(ai.getAIInterface().getResourceRating(ironPos, AIResource::Coal) == static_cast(RES_RADIUS[AIResource::Coal])); // So coal finds a spot right around the HQ, while default iron finds none because its only deposit is out of range. - BOOST_TEST(ai.FindBestPosition(searchCenter, AIResource::Coal, BuildingQuality::Mine, 5).isValid()); - BOOST_TEST(!ai.FindBestPosition(searchCenter, AIResource::Ironore, BuildingQuality::Mine, 5).isValid()); + BOOST_TEST(ai.findBestPosition(searchCenter, AIResource::Coal, BuildingQuality::Mine, 5).isValid()); + BOOST_TEST(!ai.findBestPosition(searchCenter, AIResource::Ironore, BuildingQuality::Mine, 5).isValid()); } BOOST_FIXTURE_TEST_CASE(GraniteMineResourceBehaviorAffectsAIMineSearch, EmptyWorldFixture1P) @@ -203,7 +203,7 @@ BOOST_FIXTURE_TEST_CASE(GraniteMineResourceBehaviorAffectsAIMineSearch, EmptyWor ggs.setSelection(AddonId::GRANITEMINE_RESOURCE_BEHAVIOR, static_cast(behavior)); AIJH::AIPlayerJH ai(0, world, AI::Level::Hard); initAIJhNodes(ai, world, 0); - return ai.FindBestPosition(searchCenter, res, BuildingQuality::Mine, 5).isValid(); + return ai.findBestPosition(searchCenter, res, BuildingQuality::Mine, 5).isValid(); }; // Default: No resources, no spot. @@ -235,12 +235,12 @@ BOOST_FIXTURE_TEST_CASE(KeepBQUpdated, BiggerWorldWithGCExecution) RTTR_FOREACH_PT(MapPoint, world.getSize()) { if(pt.x % 4 == 0 && pt.y % 2 == 0 && world.getNode(pt).bq == BuildingQuality::Castle - && world.CalcDistance(pt, hqPos) > 6) + && world.calcDistance(pt, hqPos) > 6) world.setNO(pt, new noTree(pt, 0, 3)); } - world.InitAfterLoad(); + world.initAfterLoad(); - auto ai = AIFactory::Create(AI::Info(AI::Type::Default, AI::Level::Hard), curPlayer, world); + auto ai = AIFactory::create(AI::Info(AI::Type::Default, AI::Level::Hard), curPlayer, world); const AIJH::AIPlayerJH& aijh = static_cast(*ai); const auto assertBqEqualOnWholeMap = [this, &aijh](const unsigned lineNr) { @@ -253,7 +253,7 @@ BOOST_FIXTURE_TEST_CASE(KeepBQUpdated, BiggerWorldWithGCExecution) }; const auto assertBqEqualAround = [this, &aijh](const unsigned lineNr, MapPoint pt, unsigned radius) { BOOST_TEST_CONTEXT("Line #" << lineNr) - world.CheckPointsInRadius( + world.checkPointsInRadius( pt, radius, [&](const MapPoint curPt, unsigned) { BOOST_TEST_INFO(curPt); @@ -266,8 +266,8 @@ BOOST_FIXTURE_TEST_CASE(KeepBQUpdated, BiggerWorldWithGCExecution) // 100GFs for initialization for(unsigned gf = 0; gf < 100; ++gf) { - em.ExecuteNextGF(); - ai->RunGF(em.getCurrentGF(), true); + em.executeNextGF(); + ai->runGF(em.getCurrentGF(), true); } assertBqEqualOnWholeMap(__LINE__); @@ -282,54 +282,54 @@ BOOST_FIXTURE_TEST_CASE(KeepBQUpdated, BiggerWorldWithGCExecution) { this->SetFlag(flagPos); BOOST_TEST_REQUIRE(world.getSpecObj(flagPos)); - em.ExecuteNextGF(); - ai->RunGF(em.getCurrentGF(), true); + em.executeNextGF(); + ai->runGF(em.getCurrentGF(), true); assertBqEqualAround(__LINE__, flagPos, 3); this->DestroyFlag(flagPos); BOOST_TEST_REQUIRE(!world.getSpecObj(flagPos)); - em.ExecuteNextGF(); - ai->RunGF(em.getCurrentGF(), true); + em.executeNextGF(); + ai->runGF(em.getCurrentGF(), true); assertBqEqualAround(__LINE__, flagPos, 3); } // Build road - const MapPoint flagPos = world.MakeMapPoint(world.getNeighbour(hqPos, Direction::SouthEast) + Position(4, 0)); + const MapPoint flagPos = world.makeMapPoint(world.getNeighbour(hqPos, Direction::SouthEast) + Position(4, 0)); this->BuildRoad(world.getNeighbour(hqPos, Direction::SouthEast), false, std::vector(4, Direction::East)); BOOST_TEST_REQUIRE(world.getSpecObj(flagPos)->getRoute(Direction::West)); - em.ExecuteNextGF(); - ai->RunGF(em.getCurrentGF(), true); + em.executeNextGF(); + ai->runGF(em.getCurrentGF(), true); assertBqEqualAround(__LINE__, flagPos, 6); // Destroy road and flag this->DestroyFlag(flagPos); - em.ExecuteNextGF(); - ai->RunGF(em.getCurrentGF(), true); + em.executeNextGF(); + ai->runGF(em.getCurrentGF(), true); assertBqEqualAround(__LINE__, flagPos, 6); // Build building - const MapPoint bldPos = world.MakeMapPoint(hqPos + Position(5, 0)); + const MapPoint bldPos = world.makeMapPoint(hqPos + Position(5, 0)); this->SetBuildingSite(bldPos, BuildingType::Barracks); BOOST_TEST_REQUIRE(world.getSpecObj(bldPos)); - em.ExecuteNextGF(); - ai->RunGF(em.getCurrentGF(), true); + em.executeNextGF(); + ai->runGF(em.getCurrentGF(), true); assertBqEqualAround(__LINE__, bldPos, 6); this->BuildRoad(world.getNeighbour(bldPos, Direction::SouthEast), false, std::vector(5, Direction::West)); - em.ExecuteNextGF(); - ai->RunGF(em.getCurrentGF(), true); + em.executeNextGF(); + ai->runGF(em.getCurrentGF(), true); RTTR_EXEC_TILL(2000, world.getSpecObj(bldPos)); - em.ExecuteNextGF(); - ai->RunGF(em.getCurrentGF(), false); + em.executeNextGF(); + ai->runGF(em.getCurrentGF(), false); assertBqEqualOnWholeMap(__LINE__); // Gain land const nobMilitary* bld = world.getSpecObj(bldPos); for(unsigned i = 0; i < 500; i++) { - em.ExecuteNextGF(); - ai->RunGF(em.getCurrentGF(), false); + em.executeNextGF(); + ai->runGF(em.getCurrentGF(), false); if(bld->getNumTroops() > 0u) break; } @@ -344,7 +344,7 @@ BOOST_FIXTURE_TEST_CASE(KeepBQUpdated, BiggerWorldWithGCExecution) if(world.isBorderNode(pt, curPlayer + 1)) { borderNodes.push_back(pt); - world.CheckPointsInRadius( + world.checkPointsInRadius( pt, 1, [&outerBoundaryNodes, &world = this->world, curPlayer = this->curPlayer](const MapPoint curPt, unsigned) { if(world.getNode(curPt).owner != curPlayer + 1) @@ -357,31 +357,31 @@ BOOST_FIXTURE_TEST_CASE(KeepBQUpdated, BiggerWorldWithGCExecution) // Once to outside for(const MapPoint pt : outerBoundaryNodes) world.setOwner(pt, curPlayer + 1); - world.RecalcBorderStones(Position(0, 0), Extent(world.getSize())); + world.recalcBorderStones(Position(0, 0), Extent(world.getSize())); for(const MapPoint pt : outerBoundaryNodes) world.getNotifications().publish(NodeNote(NodeNote::Owner, pt)); - em.ExecuteNextGF(); - ai->RunGF(em.getCurrentGF(), false); + em.executeNextGF(); + ai->runGF(em.getCurrentGF(), false); assertBqEqualOnWholeMap(__LINE__); // And back for(const MapPoint pt : outerBoundaryNodes) world.setOwner(pt, 0); - world.RecalcBorderStones(Position(0, 0), Extent(world.getSize())); + world.recalcBorderStones(Position(0, 0), Extent(world.getSize())); for(const MapPoint pt : outerBoundaryNodes) world.getNotifications().publish(NodeNote(NodeNote::Owner, pt)); - em.ExecuteNextGF(); - ai->RunGF(em.getCurrentGF(), false); + em.executeNextGF(); + ai->runGF(em.getCurrentGF(), false); assertBqEqualOnWholeMap(__LINE__); // And once to inside for(const MapPoint pt : borderNodes) world.setOwner(pt, 0); - world.RecalcBorderStones(Position(0, 0), Extent(world.getSize())); + world.recalcBorderStones(Position(0, 0), Extent(world.getSize())); for(const MapPoint pt : borderNodes) world.getNotifications().publish(NodeNote(NodeNote::Owner, pt)); - em.ExecuteNextGF(); - ai->RunGF(em.getCurrentGF(), false); + em.executeNextGF(); + ai->runGF(em.getCurrentGF(), false); assertBqEqualOnWholeMap(__LINE__); } @@ -393,22 +393,22 @@ BOOST_FIXTURE_TEST_CASE(BuildWoodIndustry, WorldWithGCExecution<1>) if(!world.getNode(pt).obj) world.setNO(pt, new noTree(pt, 0, 3)); } - world.InitAfterLoad(); + world.initAfterLoad(); const GamePlayer& player = world.getPlayer(curPlayer); - auto ai = AIFactory::Create(AI::Info(AI::Type::Default, AI::Level::Hard), curPlayer, world); + auto ai = AIFactory::create(AI::Info(AI::Type::Default, AI::Level::Hard), curPlayer, world); // Build a woodcutter, sawmill and forester at some point for(unsigned gf = 0; gf < 2000;) { std::vector aiGcs = ai->FetchGameCommands(); for(unsigned i = 0; i < 5; i++, gf++) { - em.ExecuteNextGF(); - ai->RunGF(em.getCurrentGF(), i == 0); + em.executeNextGF(); + ai->runGF(em.getCurrentGF(), i == 0); } for(gc::GameCommandPtr& gc : aiGcs) { - gc->Execute(world, curPlayer); + gc->execute(world, curPlayer); } if(playerHasBld(player, BuildingType::Sawmill) && playerHasBld(player, BuildingType::Woodcutter) && playerHasBld(player, BuildingType::Forester)) @@ -426,7 +426,7 @@ void forceExpansion(const GamePlayer& player, GameWorld& world) for(unsigned y = 0; y < world.getHeight(); y += 2) { for(unsigned x = 0; x < world.getWidth(); x += 2) - world.ChangeAltitude(MapPoint(x, y), 13); + world.changeAltitude(MapPoint(x, y), 13); } RTTR_FOREACH_PT(MapPoint, world.getSize()) { @@ -437,18 +437,18 @@ void forceExpansion(const GamePlayer& player, GameWorld& world) void runUntilMilitaryBuildingSiteFound(TestEventManager& em, unsigned curPlayer, GameWorld& world, const std::list& bldSites) { - auto ai = AIFactory::Create(AI::Info(AI::Type::Default, AI::Level::Hard), curPlayer, world); + auto ai = AIFactory::create(AI::Info(AI::Type::Default, AI::Level::Hard), curPlayer, world); for(unsigned gf = 0; gf < 2000;) { std::vector aiGcs = ai->FetchGameCommands(); for(unsigned i = 0; i < 5; i++, gf++) { - em.ExecuteNextGF(); - ai->RunGF(em.getCurrentGF(), i == 0); + em.executeNextGF(); + ai->runGF(em.getCurrentGF(), i == 0); } for(gc::GameCommandPtr& gc : aiGcs) { - gc->Execute(world, curPlayer); + gc->execute(world, curPlayer); } if(containsBldType(bldSites, BuildingType::Barracks) || containsBldType(bldSites, BuildingType::Guardhouse)) break; @@ -502,7 +502,7 @@ BOOST_FIXTURE_TEST_CASE(DoBuildMilitaryBuildingsOutsideComputerBarrier, BiggerWo (containsBldType(bldSites, BuildingType::Barracks) || containsBldType(bldSites, BuildingType::Guardhouse))); for(noBuildingSite* bldSite : bldSites) - BOOST_TEST_REQUIRE(!world.CheckPointsInRadius( + BOOST_TEST_REQUIRE(!world.checkPointsInRadius( barrierPt, radius, [bldSite](const MapPoint& pt, unsigned) { const auto type = bldSite->getBuildingType(); diff --git a/tests/s25Main/integration/testArmor.cpp b/tests/s25Main/integration/testArmor.cpp index dc5bc5be4b..fc0cba8734 100644 --- a/tests/s25Main/integration/testArmor.cpp +++ b/tests/s25Main/integration/testArmor.cpp @@ -26,7 +26,7 @@ struct ArmoredSoldierFixture : public WorldWithGCExecution3P curWh->setRealReserve(getSoldierRank(soldier), 0); curWh->setReserveVisual(getSoldierRank(soldier), 0); } - curWh->AddToInventory(soldiers, true); + curWh->addToInventory(soldiers, true); } } }; @@ -49,7 +49,7 @@ struct ArmorTradeFixture : public ArmoredSoldierFixture world.getPlayer(2).team = Team::Team2; for(unsigned i = 0; i < world.getNumPlayers(); i++) { - world.getPlayer(i).MakeStartPacts(); + world.getPlayer(i).makeStartPacts(); players[i] = &world.getPlayer(i); } BOOST_TEST_REQUIRE(players[1]->isAlly(0)); @@ -166,7 +166,7 @@ BOOST_AUTO_TEST_CASE(TradeArmoredFigures) testAfterLeaving(3); // Let caravan arrive (20GFs per node) - unsigned distance = world.CalcDistance(curWh->getPos(), players[0]->getHQPos()) + 2; + unsigned distance = world.calcDistance(curWh->getPos(), players[0]->getHQPos()) + 2; RTTR_SKIP_GFS(20 * distance); curWh = world.getSpecObj(players[0]->getHQPos()); @@ -200,7 +200,7 @@ BOOST_AUTO_TEST_CASE(ArmorTradeFail) // Add a ring of enemy owned land so they cannot pass for(const MapPoint& pt : world.getPointsInRadius(curWh->getPos(), 10)) { - if(world.CalcDistance(pt, curWh->getPos()) >= 8) + if(world.calcDistance(pt, curWh->getPos()) >= 8) world.setOwner(pt, 2 + 1); // playerID = 2 -> Owner = +1 } diff --git a/tests/s25Main/integration/testAttacking.cpp b/tests/s25Main/integration/testAttacking.cpp index 656085f8f4..2729824f55 100644 --- a/tests/s25Main/integration/testAttacking.cpp +++ b/tests/s25Main/integration/testAttacking.cpp @@ -74,8 +74,8 @@ void DeliverCoin(nobMilitary& bld, GameWorld& world, const MapPoint hqPos) auto* hq = world.getSpecObj(hqPos); BOOST_TEST_REQUIRE(hq); - hq->AddToInventory(GoodCounts::make(GoodType::Coins, 1), true); - bld.SearchCoins(); + hq->addToInventory(GoodCounts::make(GoodType::Coins, 1), true); + bld.searchCoins(); } /// Reschedule the walk event of the obj to be executed in numGFs GFs @@ -86,7 +86,7 @@ void rescheduleWalkEvent(TestEventManager& em, noMovable& obj, unsigned numGFs) { if(ev->id == 0) { - em.RescheduleEvent(ev, em.getCurrentGF() + numGFs); + em.rescheduleEvent(ev, em.getCurrentGF() + numGFs); return; } } @@ -103,11 +103,11 @@ void moveObjTo(GameWorldBase& world, noFigure& obj, const MapPoint& pos) else ownedObj = world.RemoveFigure(world.getNeighbour(obj.getPos(), obj.getCurMoveDir() + 3u), obj); obj.setPos(world.getNeighbour(pos, Direction::West)); - world.AddFigure(obj.getPos(), std::move(ownedObj)); + world.addFigure(obj.getPos(), std::move(ownedObj)); if(obj.isMoving()) - obj.FaceDir(Direction::East); + obj.faceDir(Direction::East); else - obj.StartWalking(Direction::East); + obj.startWalking(Direction::East); } // LCOV_EXCL_STOP @@ -126,20 +126,20 @@ struct AttackFixtureBase : public WorldWithGCExecutionChangeMilitary(MILITARY_SETTINGS_SCALE); } curPlayer = 0; initGameRNG(); } - void MakeVisible(const MapPoint& pt) + void makeVisible(const MapPoint& pt) { for(unsigned i = 0; i < T_numPlayers; i++) - world.MakeVisibleAroundPoint(pt, 1, i); + world.makeVisibleAroundPoint(pt, 1, i); } - void AddSoldiers(MapPoint bldPos, unsigned numSoldiers, Job soldierType, unsigned numArmoredSoldiers = 0) + void addSoldiers(MapPoint bldPos, unsigned numSoldiers, Job soldierType, unsigned numArmoredSoldiers = 0) { auto const rank = getSoldierRank(soldierType); BOOST_TEST_REQUIRE(rank <= world.getGGS().getMaxMilitaryRank()); @@ -149,26 +149,26 @@ struct AttackFixtureBase : public WorldWithGCExecution(bldPos, bld->getPlayer(), bld, bld, rank)); - world.getPlayer(bld->getPlayer()).IncreaseInventoryJob(soldier.getJobType(), 1); + world.addFigure(bldPos, std::make_unique(bldPos, bld->getPlayer(), bld, bld, rank)); + world.getPlayer(bld->getPlayer()).increaseInventoryJob(soldier.getJobType(), 1); if(numArmoredSoldiers > 0) { world.getPlayer(bld->getPlayer()) - .IncreaseInventoryJob(jobEnumToAmoredSoldierEnum(soldier.getJobType()), 1); + .increaseInventoryJob(jobEnumToAmoredSoldierEnum(soldier.getJobType()), 1); soldier.setArmor(true); numArmoredSoldiers--; } // Let him "walk" to goal -> Already reached -> Added and all internal states set correctly - soldier.WalkToGoal(); + soldier.walkToGoal(); BOOST_TEST_REQUIRE(!soldier.getGoal()); } BOOST_TEST_REQUIRE(bld->getNumTroops() == oldNumSoldiers + numSoldiers); } - void AddSoldiers(MapPoint bldPos, unsigned numWeak, unsigned numStrong) + void addSoldiers(MapPoint bldPos, unsigned numWeak, unsigned numStrong) { - AddSoldiers(bldPos, numWeak, Job::Private); - AddSoldiers(bldPos, numStrong, Job::General); + addSoldiers(bldPos, numWeak, Job::Private); + addSoldiers(bldPos, numStrong, Job::General); } // Named constants for indices to make access to the returned array easier to read @@ -209,7 +209,7 @@ struct NumSoldierTestFixture : public AttackFixtureBase<3, 56, 38> // Add some soldiers to the HQs for(const auto pos : hqPos) { - world.getSpecObj(pos)->AddToInventory( + world.getSpecObj(pos)->addToInventory( PeopleCounts::make(Job::General, rttr::test::randomValue(3, 10)), true); } // Assert player positions: 0: Top-Left, 1: Top-Right, 2: Bottom-Middle @@ -221,29 +221,29 @@ struct NumSoldierTestFixture : public AttackFixtureBase<3, 56, 38> milBld0Pos = hqPos[0] + MapPoint(7, 0); BOOST_TEST_REQUIRE(world.GetBQ(milBld0Pos, 0) == BuildingQuality::Castle); milBld0 = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, milBld0Pos, 0, Nation::Babylonians)); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, milBld0Pos, 0, Nation::Babylonians)); BOOST_TEST_REQUIRE(milBld0); milBld1NearPos = hqPos[1] - MapPoint(7, 0); BOOST_TEST_REQUIRE(world.GetBQ(milBld1NearPos, 1) == BuildingQuality::Castle); milBld1Near = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, milBld1NearPos, 1, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, milBld1NearPos, 1, Nation::Romans)); BOOST_TEST_REQUIRE(milBld1Near); milBld1FarPos = hqPos[1] + MapPoint(3, 1); BOOST_TEST_REQUIRE(world.GetBQ(milBld1FarPos, 1) == BuildingQuality::Castle); milBld1Far = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, milBld1FarPos, 1, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, milBld1FarPos, 1, Nation::Romans)); BOOST_TEST_REQUIRE(milBld1Far); - MakeVisible(milBld0Pos); - MakeVisible(milBld1NearPos); - MakeVisible(milBld1FarPos); + makeVisible(milBld0Pos); + makeVisible(milBld1NearPos); + makeVisible(milBld1FarPos); } void setCurPlayer(unsigned playerIdx) { curPlayer = playerIdx; - gwv.ChangePlayer(playerIdx, false); + gwv.changePlayer(playerIdx, false); } }; @@ -254,7 +254,7 @@ struct AttackFixture : public AttackFixtureBase using Parent = AttackFixtureBase; using Parent::curPlayer; using Parent::hqPos; - using Parent::MakeVisible; + using Parent::makeVisible; using Parent::world; /// Tested positions for military buildings @@ -265,23 +265,23 @@ struct AttackFixture : public AttackFixtureBase AttackFixture() { // Build some military buildings far away enough for holding some area outside HQ - milBld0Pos = world.MakeMapPoint(hqPos[0] + Position(0, 6)); + milBld0Pos = world.makeMapPoint(hqPos[0] + Position(0, 6)); BOOST_TEST_REQUIRE(world.GetBQ(milBld0Pos, 0) == BuildingQuality::Castle); milBld0 = static_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, milBld0Pos, 0, Nation::Babylonians)); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, milBld0Pos, 0, Nation::Babylonians)); BOOST_TEST_REQUIRE(milBld0); - milBld1Pos = world.MakeMapPoint(hqPos[1] + Position(0, 6)); + milBld1Pos = world.makeMapPoint(hqPos[1] + Position(0, 6)); BOOST_TEST_REQUIRE(world.GetBQ(milBld1Pos, 1) == BuildingQuality::Castle); milBld1 = static_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, milBld1Pos, 1, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, milBld1Pos, 1, Nation::Romans)); BOOST_TEST_REQUIRE(milBld1); - MakeVisible(milBld0Pos); - MakeVisible(milBld1Pos); + makeVisible(milBld0Pos); + makeVisible(milBld1Pos); } /// Assert that attacking the given building from attackSrc fails - void TestFailingAttack(const GameWorldViewer& gwv, const MapPoint& bldPos, const nobMilitary& attackSrc, + void testFailingAttack(const GameWorldViewer& gwv, const MapPoint& bldPos, const nobMilitary& attackSrc, unsigned numSoldiersLeft = 6u) { BOOST_TEST_REQUIRE(attackSrc.getNumTroops() == numSoldiersLeft); @@ -296,10 +296,10 @@ struct AttackFixture : public AttackFixtureBase BOOST_FIXTURE_TEST_CASE(NumSoldiersForAttack, NumSoldierTestFixture) { - AddSoldiers(milBld0Pos, 5, Job::General); - AddSoldiers(milBld0Pos, 1, Job::Sergeant); - AddSoldiers(milBld1NearPos, 6, Job::General); - AddSoldiers(milBld1FarPos, 6, Job::Private); + addSoldiers(milBld0Pos, 5, Job::General); + addSoldiers(milBld0Pos, 1, Job::Sergeant); + addSoldiers(milBld1NearPos, 6, Job::General); + addSoldiers(milBld1FarPos, 6, Job::Private); // Functions related to stationed soldiers BOOST_TEST_REQUIRE(milBld0->hasMaxRankSoldier()); @@ -348,58 +348,58 @@ BOOST_FIXTURE_TEST_CASE(NumSoldiersForAttack, NumSoldierTestFixture) BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1NearPos) == 0u); } -BOOST_FIXTURE_TEST_CASE(StartAttack, AttackFixture<>) +BOOST_FIXTURE_TEST_CASE(startAttack, AttackFixture<>) { GameWorldViewer gwv(curPlayer, world); // Add soldiers (3 strong, 3 weak) - AddSoldiers(milBld0Pos, 3, 3); + addSoldiers(milBld0Pos, 3, 3); const nobMilitary& attackSrc = *milBld0; const MapPoint usualBldPos = hqPos[1] - MapPoint(2, 3); BOOST_TEST_REQUIRE(world.GetBQ(usualBldPos, 1) >= BuildingQuality::Hut); const noBuilding* usualBld = - BuildingFactory::CreateBuilding(world, BuildingType::Woodcutter, usualBldPos, 1, Nation::Romans); + BuildingFactory::createBuilding(world, BuildingType::Woodcutter, usualBldPos, 1, Nation::Romans); BOOST_TEST_REQUIRE(usualBld); const MapPoint storehousePos = hqPos[1] - MapPoint(2, 0); BOOST_TEST_REQUIRE(world.GetBQ(storehousePos, 1) >= BuildingQuality::House); const noBuilding* storeHouse = - BuildingFactory::CreateBuilding(world, BuildingType::Storehouse, storehousePos, 1, Nation::Romans); + BuildingFactory::createBuilding(world, BuildingType::Storehouse, storehousePos, 1, Nation::Romans); BOOST_TEST_REQUIRE(storeHouse); - MakeVisible(usualBldPos); - MakeVisible(storehousePos); + makeVisible(usualBldPos); + makeVisible(storehousePos); world.getPlayer(0).team = Team::Team1; world.getPlayer(1).team = Team::Team1; for(unsigned i = 0; i < 2; i++) - world.getPlayer(i).MakeStartPacts(); + world.getPlayer(i).makeStartPacts(); // Try to attack ally -> Fail - TestFailingAttack(gwv, milBld1Pos, attackSrc); + testFailingAttack(gwv, milBld1Pos, attackSrc); world.getPlayer(0).team = Team::Team1; world.getPlayer(1).team = Team::Team2; for(unsigned i = 0; i < 2; i++) - world.getPlayer(i).MakeStartPacts(); + world.getPlayer(i).makeStartPacts(); // Try to attack non-military bld -> Fail - TestFailingAttack(gwv, usualBldPos, attackSrc); + testFailingAttack(gwv, usualBldPos, attackSrc); // Try to attack storehouse -> Fail - TestFailingAttack(gwv, storehousePos, attackSrc); + testFailingAttack(gwv, storehousePos, attackSrc); // Try to attack newly build bld -> Fail - BOOST_TEST_REQUIRE(world.CalcVisiblityWithAllies(milBld1Pos, curPlayer) == Visibility::Visible); + BOOST_TEST_REQUIRE(world.calcVisiblityWithAllies(milBld1Pos, curPlayer) == Visibility::Visible); BOOST_TEST_REQUIRE(milBld1->isNewBuilt()); - TestFailingAttack(gwv, milBld1Pos, attackSrc); + testFailingAttack(gwv, milBld1Pos, attackSrc); // Add soldier - AddSoldiers(milBld1Pos, 1, 0); + addSoldiers(milBld1Pos, 1, 0); BOOST_TEST_REQUIRE(!milBld1->isNewBuilt()); // Try to attack invisible bld -> Fail MapNode& node = world.getNodeWriteable(milBld1Pos); node.fow[0].visibility = Visibility::FogOfWar; - BOOST_TEST_REQUIRE(world.CalcVisiblityWithAllies(milBld1Pos, curPlayer) == Visibility::FogOfWar); - TestFailingAttack(gwv, milBld1Pos, attackSrc); + BOOST_TEST_REQUIRE(world.calcVisiblityWithAllies(milBld1Pos, curPlayer) == Visibility::FogOfWar); + testFailingAttack(gwv, milBld1Pos, attackSrc); // Attack it node.fow[0].visibility = Visibility::Visible; @@ -432,7 +432,7 @@ BOOST_FIXTURE_TEST_CASE(StartAttack, AttackFixture<>) BOOST_TEST(attackSrc.getTroops().front().getRank() == 4u); // None left - TestFailingAttack(gwv, milBld1Pos, attackSrc, 1u); + testFailingAttack(gwv, milBld1Pos, attackSrc, 1u); } BOOST_FIXTURE_TEST_CASE(TroopLimitCommandRejectsInvalidSerializedRank, AttackFixture<>) @@ -459,15 +459,15 @@ BOOST_FIXTURE_TEST_CASE(TroopLimitCommandRejectsInvalidSerializedRank, AttackFix BOOST_FIXTURE_TEST_CASE(ConquerBld, AttackFixture<>) { - AddSoldiers(milBld0Pos, 1, 5); - AddSoldiers(milBld1Pos, 1, Job::Private); - AddSoldiers(milBld1Pos, 1, Job::PrivateFirstClass); + addSoldiers(milBld0Pos, 1, 5); + addSoldiers(milBld1Pos, 1, Job::Private); + addSoldiers(milBld1Pos, 1, Job::PrivateFirstClass); // Add soldiers and build road so that HQ and send additional soldiers to the building starting the attack PeopleCounts soldiers; soldiers[Job::Sergeant] = 10; - ensureNonNull(world.getSpecObj(hqPos[curPlayer])).AddToInventory(soldiers, true); - BuildRoadForBlds(milBld0Pos, hqPos[0]); + ensureNonNull(world.getSpecObj(hqPos[curPlayer])).addToInventory(soldiers, true); + buildRoadForBlds(milBld0Pos, hqPos[0]); // Start attack ->1 (weak one first) this->Attack(milBld1Pos, 1, false); @@ -477,7 +477,7 @@ BOOST_FIXTURE_TEST_CASE(ConquerBld, AttackFixture<>) // Run till attackers reach bld. 1 Soldier will leave for them. // 1 stays inside till an attacker is at door // 20 GFs/node + 30 GFs for leaving - const unsigned distance = world.CalcDistance(milBld0Pos, milBld1Pos); + const unsigned distance = world.calcDistance(milBld0Pos, milBld1Pos); RTTR_EXEC_TILL(distance * 20 + 30, milBld1->getNumTroops() == 1); BOOST_TEST_REQUIRE(milBld1->getNumTroops() + milBld1->getLeavingFigures().size() == 2u); const Inventory& attackedPlInventory = world.getPlayer(1).getInventory(); @@ -529,8 +529,8 @@ BOOST_FIXTURE_TEST_CASE(ConquerBld, AttackFixture<>) BOOST_FIXTURE_TEST_CASE(ArmoredSoldierLosesArmorInFight, AttackFixture<>) { - AddSoldiers(milBld0Pos, 3, Job::General, 2); - AddSoldiers(milBld1Pos, 1, Job::Private, 1); + addSoldiers(milBld0Pos, 3, Job::General, 2); + addSoldiers(milBld1Pos, 1, Job::Private, 1); BOOST_TEST_REQUIRE(milBld0->getNumTroops() == 3u); BOOST_TEST_REQUIRE(milBld1->getNumTroops() == 1u); @@ -566,7 +566,7 @@ BOOST_FIXTURE_TEST_CASE(ArmoredSoldierLosesArmorInFight, AttackFixture<>) // Run till attackers reach flag of bld. The bld will send a defender. // 20 GFs/node + 60 GFs for leaving - const unsigned distance = world.CalcDistance(milBld0Pos, milBld1Pos); + const unsigned distance = world.calcDistance(milBld0Pos, milBld1Pos); RTTR_EXEC_TILL(distance * 20 + 60, milBld1->getDefender() != nullptr); const auto soldiers = world.getFigures(milBld1->getFlagPos()); @@ -593,12 +593,12 @@ BOOST_FIXTURE_TEST_CASE(TroopLimitKeepsOrderedRestrictedSoldier, AttackFixture<> const Job soldierJob = Job::Private; const unsigned soldierRank = getSoldierRank(soldierJob); - hq->AddToInventory(PeopleCounts::make(soldierJob, 2), true); + hq->addToInventory(PeopleCounts::make(soldierJob, 2), true); const unsigned hqSoldiersBefore = hq->getNumRealFigures(soldierJob); BOOST_TEST_REQUIRE(hqSoldiersBefore > 0u); - BuildRoadForBlds(milBld0Pos, hqPos[0]); - milBld0->RegulateTroops(); + buildRoadForBlds(milBld0Pos, hqPos[0]); + milBld0->regulateTroops(); BOOST_TEST_REQUIRE(milBld0->getNumTroops() == 0u); BOOST_TEST_REQUIRE(hq->getLeavingFigures().size() == 1u); @@ -620,11 +620,11 @@ BOOST_FIXTURE_TEST_CASE(TroopLimitKeepsOrderedRestrictedSoldier, AttackFixture<> BOOST_FIXTURE_TEST_CASE(CoinTrainingUpgradesRankChainByDefault, AttackFixture<>) { - AddSoldiers(milBld0Pos, 1, Job::Private); - AddSoldiers(milBld0Pos, 1, Job::PrivateFirstClass); - AddSoldiers(milBld0Pos, 1, Job::Sergeant); + addSoldiers(milBld0Pos, 1, Job::Private); + addSoldiers(milBld0Pos, 1, Job::PrivateFirstClass); + addSoldiers(milBld0Pos, 1, Job::Sergeant); - BuildRoadForBlds(milBld0Pos, hqPos[0]); + buildRoadForBlds(milBld0Pos, hqPos[0]); DeliverCoin(*milBld0, world, hqPos[0]); RTTR_EXEC_TILL(5000, CountTroopsByRank(*milBld0)[3] == 1u); @@ -640,11 +640,11 @@ BOOST_FIXTURE_TEST_CASE(SingleSoldierCoinTrainingUpgradesOnlyLowestRankSoldier, { this->ggs.setSelection(AddonId::SINGLE_SOLDIER_COIN_TRAINING, 1); - AddSoldiers(milBld0Pos, 1, Job::Private); - AddSoldiers(milBld0Pos, 1, Job::PrivateFirstClass); - AddSoldiers(milBld0Pos, 1, Job::Sergeant); + addSoldiers(milBld0Pos, 1, Job::Private); + addSoldiers(milBld0Pos, 1, Job::PrivateFirstClass); + addSoldiers(milBld0Pos, 1, Job::Sergeant); - BuildRoadForBlds(milBld0Pos, hqPos[0]); + buildRoadForBlds(milBld0Pos, hqPos[0]); DeliverCoin(*milBld0, world, hqPos[0]); RTTR_EXEC_TILL(5000, CountTroopsByRank(*milBld0)[1] == 2u); @@ -660,8 +660,8 @@ BOOST_FIXTURE_TEST_CASE(ConquerBldCoinAddonEnable, AttackFixture<>) { this->ggs.setSelection(AddonId::COINS_CAPTURED_BLD, 1); // addon is active on second run - AddSoldiers(milBld0Pos, 1, 5); - AddSoldiers(milBld1Pos, 1, Job::Private); + addSoldiers(milBld0Pos, 1, 5); + addSoldiers(milBld1Pos, 1, Job::Private); // ensure that coins are disabled milBld1->SetCoinsAllowed(false); @@ -681,8 +681,8 @@ BOOST_FIXTURE_TEST_CASE(ConquerBldCoinAddonDisable, AttackFixture<>) { this->ggs.setSelection(AddonId::COINS_CAPTURED_BLD, 2); // addon is active on second run - AddSoldiers(milBld0Pos, 1, 5); - AddSoldiers(milBld1Pos, 1, Job::Private); + addSoldiers(milBld0Pos, 1, 5); + addSoldiers(milBld1Pos, 1, Job::Private); // ensure that coins are enabled milBld1->SetCoinsAllowed(true); @@ -717,8 +717,8 @@ BOOST_DATA_TEST_CASE_F(AttackFixture<>, ConquerBldArmorAddon, else this->ggs.setSelection(AddonId::ARMOR_CAPTURED_BLD, 0); - AddSoldiers(milBld0Pos, 1, 5); - AddSoldiers(milBld1Pos, 1, Job::Private); + addSoldiers(milBld0Pos, 1, 5); + addSoldiers(milBld1Pos, 1, Job::Private); // ensure that armor are enabled/disabled bool armorAllowedBeforeAttack = (sample == Case::KeepEnabled || sample == Case::DisableAfterEnable); @@ -744,13 +744,13 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithMultipleWalkingIn, AttackFixture4P) world.getPlayer(2).team = Team::Team1; // Allied to 0 world.getPlayer(3).team = Team::Team2; // Hostile to 0 for(unsigned i = 0; i < 4; i++) - world.getPlayer(i).MakeStartPacts(); + world.getPlayer(i).makeStartPacts(); MilitarySettings milSettings = MILITARY_SETTINGS_SCALE; milSettings[2] = 0; // No aggressive defenders for attacker this->ChangeMilitary(milSettings); - AddSoldiers(milBld0Pos, 0, 6); - AddSoldiers(milBld1Pos, 1, Job::Private); + addSoldiers(milBld0Pos, 0, 6); + addSoldiers(milBld1Pos, 1, Job::Private); const MapPoint milBld1FlagPos = milBld1->getFlagPos(); // Scenario 1: Attack with one soldier. @@ -769,7 +769,7 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithMultipleWalkingIn, AttackFixture4P) // Speed up fight by reducing defenders HP to 1 auto* defender = const_cast(milBld1->getDefender()); while(defender->getHitpoints() > 1u) - defender->TakeHit(); + defender->takeHit(); RTTR_EXEC_TILL(500, milBld1->getDefender() == nullptr); // Defender defeated. Attacker moving in. BOOST_TEST_REQUIRE(attacker.isMoving()); @@ -777,7 +777,7 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithMultipleWalkingIn, AttackFixture4P) // Door opened BOOST_TEST_REQUIRE(milBld1->isDoorOpen()); // New soldiers walked in - AddSoldiers(milBld1Pos, 4, Job::Private); + addSoldiers(milBld1Pos, 4, Job::Private); // Let attacker walk in (try it at least) RTTR_EXEC_TILL(20, attacker.getPos() == milBld1Pos); RTTR_EXEC_TILL(20, attacker.getPos() == milBld1FlagPos); @@ -804,15 +804,15 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithMultipleWalkingIn, AttackFixture4P) BOOST_TEST_REQUIRE(milBld0->getLeavingFigures().size() == 1u); auto& secAttacker = dynamic_cast(milBld0->getLeavingFigures().front()); RTTR_EXEC_TILL(70, milBld0->getLeavingFigures().empty()); //-V807 - moveObjTo(world, secAttacker, world.MakeMapPoint(milBld1FlagPos - Position(15, 0))); - nofAggressiveDefender& aggDefender = ensureNonNull(milBld1->SendAggressiveDefender(secAttacker)); - secAttacker.LetsFight(aggDefender); + moveObjTo(world, secAttacker, world.makeMapPoint(milBld1FlagPos - Position(15, 0))); + nofAggressiveDefender& aggDefender = ensureNonNull(milBld1->sendAggressiveDefender(secAttacker)); + secAttacker.letsFight(aggDefender); // 3. curPlayer = 2; MapPoint bldPos = hqPos[curPlayer] + MapPoint(3, 0); auto* alliedBld = static_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Guardhouse, bldPos, curPlayer, Nation::Africans)); - AddSoldiers(bldPos, 2, Job::Private); + BuildingFactory::createBuilding(world, BuildingType::Guardhouse, bldPos, curPlayer, Nation::Africans)); + addSoldiers(bldPos, 2, Job::Private); this->Attack(milBld1Pos, 1, false); BOOST_TEST_REQUIRE(alliedBld->getLeavingFigures().size() == 1u); auto& alliedAttacker = dynamic_cast(alliedBld->getLeavingFigures().front()); @@ -820,8 +820,8 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithMultipleWalkingIn, AttackFixture4P) curPlayer = 3; bldPos = hqPos[curPlayer] + MapPoint(3, 0); auto* hostileBld = static_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Guardhouse, bldPos, curPlayer, Nation::Africans)); - AddSoldiers(bldPos, 2, Job::Private); + BuildingFactory::createBuilding(world, BuildingType::Guardhouse, bldPos, curPlayer, Nation::Africans)); + addSoldiers(bldPos, 2, Job::Private); this->Attack(milBld1Pos, 1, false); BOOST_TEST_REQUIRE(hostileBld->getLeavingFigures().size() == 1u); auto& hostileAttacker = dynamic_cast(hostileBld->getLeavingFigures().front()); @@ -839,11 +839,11 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithMultipleWalkingIn, AttackFixture4P) // Let defenders (2!) die defender = const_cast(milBld1->getDefender()); while(defender->getHitpoints() > 1u) - defender->TakeHit(); + defender->takeHit(); RTTR_EXEC_TILL(500, milBld1->getNumTroops() == 0u); defender = const_cast(milBld1->getDefender()); while(defender->getHitpoints() > 1u) - defender->TakeHit(); + defender->takeHit(); RTTR_EXEC_TILL(500, milBld1->getDefender() == nullptr); // Defender defeated. Attacker moving in. BOOST_TEST_REQUIRE(attacker.isMoving()); @@ -854,10 +854,10 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithMultipleWalkingIn, AttackFixture4P) RTTR_SKIP_GFS(1); // 5. Create new soldier who walks in after the attacker auto& newSld = - world.AddFigure(milBld1FlagPos, std::make_unique(milBld1FlagPos, 1, milBld1, milBld1, 0)); + world.addFigure(milBld1FlagPos, std::make_unique(milBld1FlagPos, 1, milBld1, milBld1, 0)); ; - milBld1->GotWorker(newSld.getJobType(), newSld); - newSld.ActAtFirst(); + milBld1->gotWorker(newSld.getJobType(), newSld); + newSld.actAtFirst(); // Attacker faster -> Bld taken RTTR_EXEC_TILL(30, milBld1->getPlayer() == 0u); // New soldier should be wandering @@ -897,33 +897,33 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithCarriersWalkingIn, AttackFixture<2>) { // 1. Carrier with coin walking in the building // 2. Carrier with coin walking out of the building - AddSoldiers(milBld0Pos, 0, 6); - AddSoldiers(milBld1Pos, 1, Job::Private); + addSoldiers(milBld0Pos, 0, 6); + addSoldiers(milBld1Pos, 1, Job::Private); const MapPoint milBld1FlagPos = milBld1->getFlagPos(); curPlayer = 1; - const MapPoint flagPos = world.MakeMapPoint(milBld1FlagPos - Position(2, 0)); + const MapPoint flagPos = world.makeMapPoint(milBld1FlagPos - Position(2, 0)); this->BuildRoad(milBld1FlagPos, false, std::vector(2, Direction::West)); auto& flag = ensureNonNull(world.getSpecObj(flagPos)); RoadSegment* rs = flag.getRoute(Direction::East); BOOST_TEST_REQUIRE(rs); auto& carrierIn = - world.AddFigure(flagPos, std::make_unique(CarrierType::Normal, flagPos, curPlayer, rs, &flag)); + world.addFigure(flagPos, std::make_unique(CarrierType::Normal, flagPos, curPlayer, rs, &flag)); auto& carrierOut = - world.AddFigure(flagPos, std::make_unique(CarrierType::Donkey, flagPos, curPlayer, rs, &flag)); + world.addFigure(flagPos, std::make_unique(CarrierType::Donkey, flagPos, curPlayer, rs, &flag)); rs->setCarrier(0, &carrierIn); rs->setCarrier(1, &carrierOut); // Add 2 coins for the bld for(unsigned i = 0; i < 2; i++) { auto coin = std::make_unique(GoodType::Coins, milBld1, &flag); - coin->WaitAtFlag(flag); - coin->RecalcRoute(); - flag.AddWare(std::move(coin)); + coin->waitAtFlag(flag); + coin->recalcRoute(); + flag.addWare(std::move(coin)); } - world.getPlayer(1).IncreaseInventoryWare(GoodType::Coins, 2); - carrierIn.ActAtFirst(); - carrierOut.ActAtFirst(); + world.getPlayer(1).increaseInventoryWare(GoodType::Coins, 2); + carrierIn.actAtFirst(); + carrierOut.actAtFirst(); // Both picked up BOOST_TEST_REQUIRE(flag.getNumWares() == 0u); // Move carriers to flag @@ -943,20 +943,20 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithCarriersWalkingIn, AttackFixture<2>) BOOST_TEST_REQUIRE(carrierOut.getCurMoveDir() == Direction::SouthEast); // Add another for later - MapPoint flagPosE = world.MakeMapPoint(milBld1FlagPos + Position(2, 0)); + MapPoint flagPosE = world.makeMapPoint(milBld1FlagPos + Position(2, 0)); this->BuildRoad(milBld1FlagPos, false, std::vector(2, Direction::East)); auto& flagE = ensureNonNull(world.getSpecObj(flagPosE)); RoadSegment& rsE = ensureNonNull(flagE.getRoute(Direction::West)); auto& carrierInE = - world.AddFigure(flagPosE, std::make_unique(CarrierType::Normal, flagPosE, curPlayer, &rsE, &flagE)); + world.addFigure(flagPosE, std::make_unique(CarrierType::Normal, flagPosE, curPlayer, &rsE, &flagE)); rsE.setCarrier(0, &carrierInE); // He also gets 1 coin auto coin = std::make_unique(GoodType::Coins, milBld1, &flagE); - coin->WaitAtFlag(flagE); - coin->RecalcRoute(); - flagE.AddWare(std::move(coin)); - world.getPlayer(1).IncreaseInventoryWare(GoodType::Coins, 1); - carrierInE.ActAtFirst(); + coin->waitAtFlag(flagE); + coin->recalcRoute(); + flagE.addWare(std::move(coin)); + world.getPlayer(1).increaseInventoryWare(GoodType::Coins, 1); + carrierInE.actAtFirst(); // Picked up BOOST_TEST_REQUIRE(flagE.getNumWares() == 0u); // And pause him @@ -992,7 +992,7 @@ BOOST_FIXTURE_TEST_CASE(ConquerWithCarriersWalkingIn, AttackFixture<2>) // Speed up fight by reducing defenders HP to 1 auto* defender = const_cast(milBld1->getDefender()); while(defender->getHitpoints() > 1u) - defender->TakeHit(); + defender->takeHit(); RTTR_EXEC_TILL(500, milBld1->getDefender() == nullptr); // Defender defeated. Attacker moving in. BOOST_TEST_REQUIRE(attacker.isMoving()); @@ -1033,8 +1033,8 @@ BOOST_FIXTURE_TEST_CASE(FlagBecomesUnreachableForWaitingAttacker, AttackFixture< } const auto attackerBldPos = attackerBld->getPos(); const auto defenderBldPos = defenderBld->getPos(); - AddSoldiers(defenderBldPos, 0, 1); - AddSoldiers(attackerBldPos, 6, Job::Private); + addSoldiers(defenderBldPos, 0, 1); + addSoldiers(attackerBldPos, 6, Job::Private); // Make defender building flag unreachable const auto terrain = this->world.getDescription().terrain.find( [](const TerrainDesc& t) { return !t.Is(ETerrain::Walkable) && t.GetBQ() != TerrainBQ::Danger; }); @@ -1056,7 +1056,7 @@ BOOST_FIXTURE_TEST_CASE(FlagBecomesUnreachableForWaitingAttacker, AttackFixture< { for(const auto dy : helpers::range(-2, 3)) { - MapPoint pt = world.MakeMapPoint(flagPos + Position(dx, dy)); + MapPoint pt = world.makeMapPoint(flagPos + Position(dx, dy)); auto& node = world.getNodeWriteable(pt); node.t1 = node.t2 = terrain; } @@ -1076,7 +1076,7 @@ BOOST_FIXTURE_TEST_CASE(FlagBecomesUnreachableForWaitingAttacker, AttackFixture< BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(defenderBldPos) == 0u); // Road over water makes it reachable curPlayer = plDefender; - const MapPoint roadFlagPos = world.MakeMapPoint(flagPos + Position(2, 0)); + const MapPoint roadFlagPos = world.makeMapPoint(flagPos + Position(2, 0)); this->BuildRoad(flagPos, false, std::vector(2, Direction::East)); auto* flag = world.getSpecObj(roadFlagPos); BOOST_TEST_REQUIRE(flag); @@ -1152,7 +1152,7 @@ void HandleLeavingAggDefendersOnAttack::test(AttackedBldType test_case, bool use // // Handling for "real" military buildings and attackable warehouses (HQ) is different, so test all combinations std::array attackers{}; - AddSoldiers(milBld0Pos, attackers.size() + 1, Job::General); + addSoldiers(milBld0Pos, attackers.size() + 1, Job::General); auto& attackedHq = ensureNonNull(world.getSpecObj(hqPos[1])); auto& attackedBld = (test_case == AttackedBldType::Hq) ? attackedHq : static_cast(*milBld1); const auto attackedPlayer = attackedBld.getPlayer(); @@ -1165,11 +1165,11 @@ void HandleLeavingAggDefendersOnAttack::test(AttackedBldType test_case, bool use attackedHq.setRealReserve(getSoldierRank(Job::Private), 0); auto startSoldiers = PeopleCounts::make(Job::General, numGenerals); startSoldiers[Job::Private] = numPrivates; - attackedHq.AddToInventory(startSoldiers, true); + attackedHq.addToInventory(startSoldiers, true); } else { - AddSoldiers(attackedBld.getPos(), numGenerals, Job::General); - AddSoldiers(attackedBld.getPos(), numPrivates, Job::Private); + addSoldiers(attackedBld.getPos(), numGenerals, Job::General); + addSoldiers(attackedBld.getPos(), numPrivates, Job::Private); } // Total soldiers should not change because none die in this test case // This ensures they are not double-accounted during conversion from agressive defender to defender @@ -1193,9 +1193,9 @@ void HandleLeavingAggDefendersOnAttack::test(AttackedBldType test_case, bool use auto* attacker = attackers[i]; if(attacker && !attacker->getHuntingDefender()) { - auto* aggDefender = attackedBld.SendAggressiveDefender(*attacker); + auto* aggDefender = attackedBld.sendAggressiveDefender(*attacker); if(aggDefender) - attacker->LetsFight(*aggDefender); + attacker->letsFight(*aggDefender); } } if(useAllDefenders) @@ -1254,11 +1254,11 @@ BOOST_FIXTURE_TEST_CASE(LeavingSoldierUsedAsDefender, AttackFixture<2>) { // When the only soldier in a HQ is currently leaving (to a building) it is used as defender // Counts need to be correct at all times - AddSoldiers(milBld0Pos, 2, Job::General); + addSoldiers(milBld0Pos, 2, Job::General); auto& attackedHq = ensureNonNull(world.getSpecObj(hqPos[1])); const auto soldierJob = rttr::test::randomElement(SOLDIER_JOBS); attackedHq.setRealReserve(getSoldierRank(soldierJob), 0); - attackedHq.AddToInventory(PeopleCounts::make(soldierJob, 1), true); + attackedHq.addToInventory(PeopleCounts::make(soldierJob, 1), true); const auto attackedPlayer = attackedHq.getPlayer(); const auto totalSoldiersBefore = getTotalSoldiers(attackedPlayer); const auto soldiersBefore = getNumSoldiers(attackedHq); @@ -1268,7 +1268,7 @@ BOOST_FIXTURE_TEST_CASE(LeavingSoldierUsedAsDefender, AttackFixture<2>) auto& attacker = dynamic_cast(milBld0->getLeavingFigures().front()); RTTR_EXEC_TILL(50, milBld0->getLeavingFigures().empty()); curPlayer = attackedPlayer; - BuildRoadForBlds(milBld1Pos, hqPos[1]); + buildRoadForBlds(milBld1Pos, hqPos[1]); curPlayer = 0; BOOST_TEST_REQUIRE(!attackedHq.getLeavingFigures().empty()); { @@ -1296,30 +1296,30 @@ BOOST_FIXTURE_TEST_CASE(LeavingSoldierUsedAsDefender, AttackFixture<2>) using DestroyRoadsOnConquerFixture = AttackFixture<2, 24>; BOOST_FIXTURE_TEST_CASE(DestroyRoadsOnConquer, DestroyRoadsOnConquerFixture) { - MapPoint leftBldPos = world.MakeMapPoint(milBld1Pos + Position(-5, 2)); + MapPoint leftBldPos = world.makeMapPoint(milBld1Pos + Position(-5, 2)); noBuilding* leftBld = - BuildingFactory::CreateBuilding(world, BuildingType::Barracks, leftBldPos, 1, Nation::Babylonians); + BuildingFactory::createBuilding(world, BuildingType::Barracks, leftBldPos, 1, Nation::Babylonians); BOOST_TEST_REQUIRE(leftBld); - MapPoint rightBldPos = world.MakeMapPoint(milBld1Pos + Position(5, 2)); + MapPoint rightBldPos = world.makeMapPoint(milBld1Pos + Position(5, 2)); noBuilding* rightBld = - BuildingFactory::CreateBuilding(world, BuildingType::Barracks, rightBldPos, 1, Nation::Babylonians); + BuildingFactory::createBuilding(world, BuildingType::Barracks, rightBldPos, 1, Nation::Babylonians); BOOST_TEST_REQUIRE(rightBld); - AddSoldiers(leftBldPos, 1, Job::Private); - AddSoldiers(rightBldPos, 1, Job::Private); - AddSoldiers(milBld1Pos, 1, Job::Private); - AddSoldiers(milBld0Pos, 6, Job::General); + addSoldiers(leftBldPos, 1, Job::Private); + addSoldiers(rightBldPos, 1, Job::Private); + addSoldiers(milBld1Pos, 1, Job::Private); + addSoldiers(milBld0Pos, 6, Job::General); curPlayer = 1; // Build 2 roads to attack building to test that destroying them does not cause a bug // Bld -> Flag - BuildRoadForBlds(milBld1Pos, world.MakeMapPoint(milBld1Pos + Position(2, 0))); + buildRoadForBlds(milBld1Pos, world.makeMapPoint(milBld1Pos + Position(2, 0))); // Flag -> Bld - const MapPoint flagPt = world.MakeMapPoint(milBld1Pos - Position(2, 0)); + const MapPoint flagPt = world.makeMapPoint(milBld1Pos - Position(2, 0)); this->SetFlag(flagPt); - BuildRoadForBlds(world.getNeighbour(flagPt, Direction::NorthWest), milBld1Pos); + buildRoadForBlds(world.getNeighbour(flagPt, Direction::NorthWest), milBld1Pos); // Build a long road connecting left&right w/o any flag in between (See #863) - BuildRoadForBlds(leftBldPos, rightBldPos); + buildRoadForBlds(leftBldPos, rightBldPos); BOOST_TEST_REQUIRE(leftBld->getFlag()->getRoute(Direction::East)->GetLength() >= 10u); curPlayer = 0; @@ -1354,17 +1354,17 @@ struct FreeFightFixture : AttackFixture<2> : attackerBld(*milBld0), attackedBld(*milBld1), attackedBldPos(milBld1Pos), fightSpot(attackedBldPos - MapPoint(3, 0)) { - AddSoldiers(milBld0Pos, 6, Job::Private); - AddSoldiers(milBld1Pos, 6, Job::Private); + addSoldiers(milBld0Pos, 6, Job::Private); + addSoldiers(milBld1Pos, 6, Job::Private); this->Attack(attackedBldPos, 1, true); auto& attacker = dynamic_cast(attackerBld.getLeavingFigures().front()); attacker_ = &attacker; RTTR_EXEC_TILL(70, attackerBld.getLeavingFigures().empty()); //-V807 - nofAggressiveDefender& defender = ensureNonNull(attackedBld.SendAggressiveDefender(attacker)); + nofAggressiveDefender& defender = ensureNonNull(attackedBld.sendAggressiveDefender(attacker)); defender_ = &defender; RTTR_EXEC_TILL(70, attackedBld.getLeavingFigures().empty()); //-V807 - attacker.LetsFight(defender); + attacker.letsFight(defender); // In a distance of 2 they find each other and meet half way const MapPoint fightSpot = attackedBldPos - MapPoint(3, 0); @@ -1389,8 +1389,8 @@ struct FreeFightFixture : AttackFixture<2> auto& rightNode = this->world.getNodeWriteable(MapPoint(attackedBldPos.x + 1, y)); node.t1 = node.t2 = rightNode.t1 = rightNode.t2 = terrain; } - const auto yTop = this->world.MakeMapPoint(Position(attackedBldPos.x, attackedBldPos.y - 3)).y; - const auto yBottom = this->world.MakeMapPoint(Position(attackedBldPos.x, attackedBldPos.y + 3)).y; + const auto yTop = this->world.makeMapPoint(Position(attackedBldPos.x, attackedBldPos.y - 3)).y; + const auto yBottom = this->world.makeMapPoint(Position(attackedBldPos.x, attackedBldPos.y + 3)).y; for(const auto x : helpers::range(x, attackedBldPos.x)) { auto& topNode = this->world.getNodeWriteable(MapPoint(x, yTop)); diff --git a/tests/s25Main/integration/testBaseWarehouse.cpp b/tests/s25Main/integration/testBaseWarehouse.cpp index fd8e2afd91..08b7279d54 100644 --- a/tests/s25Main/integration/testBaseWarehouse.cpp +++ b/tests/s25Main/integration/testBaseWarehouse.cpp @@ -86,7 +86,7 @@ BOOST_FIXTURE_TEST_CASE(AddGoods, AddGoodsFixture) // Add nothing -> nothing changed GoodsAndPeopleCounts newGoods; - hq.AddToInventory(newGoods, true); + hq.addToInventory(newGoods, true); testNumGoodsHQ(); testNumGoodsPlayer(); @@ -106,7 +106,7 @@ BOOST_FIXTURE_TEST_CASE(AddGoods, AddGoodsFixture) } numPeoplePlayer = numPeople; numArmoredSoldiersPlayer = numArmoredSoldiers; - hq.AddToInventory(newGoods, true); + hq.addToInventory(newGoods, true); testNumGoodsHQ(); testNumGoodsPlayer(); @@ -116,7 +116,7 @@ BOOST_FIXTURE_TEST_CASE(AddGoods, AddGoodsFixture) for(const auto i : helpers::enumRange()) numArmoredSoldiers[i] += newGoods[i]; - hq.AddToInventory(newGoods, false); + hq.addToInventory(newGoods, false); testNumGoodsHQ(); testNumGoodsPlayer(); @@ -131,28 +131,28 @@ BOOST_FIXTURE_TEST_CASE(AddGoods, AddGoodsFixture) numGoods[i] += rttr::enum_cast(i) + 2; } numGoodsPlayer = numGoods; - hq.AddToInventory(newGoods, true); + hq.addToInventory(newGoods, true); testNumGoodsHQ(); testNumGoodsPlayer(); // Add only to hq but not to player for(const auto i : helpers::enumRange()) numGoods[i] += newGoods[i]; - hq.AddToInventory(newGoods, false); + hq.addToInventory(newGoods, false); testNumGoodsHQ(); testNumGoodsPlayer(); #if RTTR_ENABLE_ASSERTS - RTTR_REQUIRE_ASSERT(hq.AddToInventory(PeopleCounts::make(Job::BoatCarrier, 1), false)); - RTTR_REQUIRE_ASSERT(hq.AddToInventory(GoodCounts::make(GoodType::ShieldAfricans, 1), false)); + RTTR_REQUIRE_ASSERT(hq.addToInventory(PeopleCounts::make(Job::BoatCarrier, 1), false)); + RTTR_REQUIRE_ASSERT(hq.addToInventory(GoodCounts::make(GoodType::ShieldAfricans, 1), false)); #endif } -BOOST_FIXTURE_TEST_CASE(OrderJob, EmptyWorldFixture1P) +BOOST_FIXTURE_TEST_CASE(orderJob, EmptyWorldFixture1P) { GamePlayer& player = world.getPlayer(0); auto* hq = world.getSpecObj(player.getHQPos()); - auto* wh = static_cast(BuildingFactory::CreateBuilding( + auto* wh = static_cast(BuildingFactory::createBuilding( world, BuildingType::Storehouse, player.getHQPos() + MapPoint(4, 0), 0, Nation::Romans)); world.BuildRoad(0, false, hq->getFlagPos(), {4, Direction::East}); @@ -162,29 +162,29 @@ BOOST_FIXTURE_TEST_CASE(OrderJob, EmptyWorldFixture1P) inv[Job::Builder] = rttr::test::randomValue(3, 7); inv[GoodType::Hammer] = rttr::test::randomValue(3, 7); inv[Job::Helper] = rttr::test::randomValue(7, 23); // At least one per hammer - hq->AddToInventory(inv, true); + hq->addToInventory(inv, true); } // Order all existing builders while(hq->getNumRealFigures(Job::Builder) > 0u) { const auto numBuilders = hq->getNumRealFigures(Job::Builder); - BOOST_TEST(hq->OrderJob(Job::Builder, *wh, false)); + BOOST_TEST(hq->orderJob(Job::Builder, *wh, false)); BOOST_TEST_REQUIRE(hq->getNumRealFigures(Job::Builder) == numBuilders - 1u); } // Ordering another one fails - BOOST_TEST_REQUIRE(!hq->OrderJob(Job::Builder, *wh, false)); + BOOST_TEST_REQUIRE(!hq->orderJob(Job::Builder, *wh, false)); BOOST_TEST_REQUIRE(hq->getNumRealFigures(Job::Builder) == 0u); // Recruit all possible builders while(hq->getNumRealWares(GoodType::Hammer) > 0u) { const auto numHammers = hq->getNumRealWares(GoodType::Hammer); - BOOST_TEST(hq->OrderJob(Job::Builder, *wh, true)); + BOOST_TEST(hq->orderJob(Job::Builder, *wh, true)); BOOST_TEST_REQUIRE(hq->getNumRealWares(GoodType::Hammer) == numHammers - 1u); BOOST_TEST_REQUIRE(hq->getNumRealFigures(Job::Builder) == 0u); } // Ordering another one fails - BOOST_TEST_REQUIRE(!hq->OrderJob(Job::Builder, *wh, true)); + BOOST_TEST_REQUIRE(!hq->orderJob(Job::Builder, *wh, true)); BOOST_TEST(hq->getNumRealFigures(Job::Builder) == 0u); BOOST_TEST(hq->getNumRealWares(GoodType::Hammer) == 0u); } @@ -197,15 +197,15 @@ BOOST_FIXTURE_TEST_CASE(DestroyBuilding, EmptyWorldFixture1P) MapPoint whPos = player.getHQPos() + MapPoint(4, 0); auto* wh = static_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Storehouse, whPos, 0, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Storehouse, whPos, 0, Nation::Romans)); world.BuildRoad(0, false, hq->getFlagPos(), {4, Direction::East}); // Reproduce issue #1559, where a dependent figure on the same position would cause a crash // upon building destruction. auto& scout = - world.AddFigure(whPos, std::make_unique(whPos, 0, world.getSpecObj(whPos))); - wh->AddDependentFigure(scout); + world.addFigure(whPos, std::make_unique(whPos, 0, world.getSpecObj(whPos))); + wh->addDependentFigure(scout); world.DestroyBuilding(whPos, 0); } @@ -218,9 +218,9 @@ BOOST_FIXTURE_TEST_CASE(CollectGoodsAndFigures, WorldWithGCExecution1P) MapPoint wh2Pos = wh1Pos + MapPoint(2, 0); auto* wh1 = static_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Storehouse, wh1Pos, 0, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Storehouse, wh1Pos, 0, Nation::Romans)); auto* wh2 = static_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Storehouse, wh2Pos, 0, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Storehouse, wh2Pos, 0, Nation::Romans)); world.BuildRoad(0, false, wh1->getFlagPos(), {2, Direction::East}); MilitarySettings milSettings = MILITARY_SETTINGS_SCALE; @@ -240,7 +240,7 @@ BOOST_FIXTURE_TEST_CASE(CollectGoodsAndFigures, WorldWithGCExecution1P) continue; inv[good] = 1; } - wh1->AddToInventory(inv, true); + wh1->addToInventory(inv, true); for(const auto job : helpers::enumRange()) { @@ -297,7 +297,7 @@ BOOST_FIXTURE_TEST_CASE(AddSoldierWithArmor, EmptyWorldFixture1P) std::make_unique(player.getHQPos(), 0, nullptr, nullptr, getSoldierRank(Job::Sergeant)); soldierWithArmor->setArmor(true); - hq->AddFigure(std::move(soldierWithArmor)); + hq->addFigure(std::move(soldierWithArmor)); BOOST_TEST(hq->getNumRealArmoredFigures(ArmoredSoldier::Sergeant) == 1); BOOST_TEST(hq->getNumVisualArmoredFigures(ArmoredSoldier::Sergeant) == 1); BOOST_TEST(hq->getNumRealWares(GoodType::Armor) == 0); @@ -314,7 +314,7 @@ BOOST_FIXTURE_TEST_CASE(CheckReserveSoldierWithArmor, EmptyWorldFixture1P) std::make_unique(player.getHQPos(), 0, nullptr, nullptr, getSoldierRank(Job::Sergeant)); soldierWithArmor->setArmor(true); - hq->AddFigure(std::move(soldierWithArmor)); + hq->addFigure(std::move(soldierWithArmor)); BOOST_TEST(hq->getNumRealArmoredFigures(ArmoredSoldier::Sergeant) == 0); BOOST_TEST(hq->getNumVisualArmoredFigures(ArmoredSoldier::Sergeant) == 0); BOOST_TEST(hq->getNumRealFigures(Job::Sergeant) == 0); diff --git a/tests/s25Main/integration/testBoundaryStones.cpp b/tests/s25Main/integration/testBoundaryStones.cpp index fb529cc117..a96936c1fb 100644 --- a/tests/s25Main/integration/testBoundaryStones.cpp +++ b/tests/s25Main/integration/testBoundaryStones.cpp @@ -15,7 +15,7 @@ namespace { using WorldFixtureEmpty0P = WorldFixture; boost::test_tools::predicate_result boundaryStonesMatch(GameWorld& world, const std::vector& expected) { - world.RecalcBorderStones(Position(0, 0), Extent(world.getSize())); + world.recalcBorderStones(Position(0, 0), Extent(world.getSize())); RTTR_FOREACH_PT(MapPoint, world.getSize()) { const BoundaryStones& isValue = world.getNode(pt).boundary_stones; diff --git a/tests/s25Main/integration/testBuilding.cpp b/tests/s25Main/integration/testBuilding.cpp index 31328c5c9e..412f5ca21b 100644 --- a/tests/s25Main/integration/testBuilding.cpp +++ b/tests/s25Main/integration/testBuilding.cpp @@ -70,7 +70,7 @@ boost::test_tools::predicate_result checkBQs(const GameWorldBase& world, const s BOOST_FIXTURE_TEST_CASE(checkBQs_Correct, EmptyWorldFixture1P) { - const MapPoint flagPos = world.MakeMapPoint(world.getPlayer(0).getHQPos() - Position(5, 6)); + const MapPoint flagPos = world.makeMapPoint(world.getPlayer(0).getHQPos() - Position(5, 6)); const std::vector pts = world.GetPointsInRadiusWithCenter(flagPos, 4); std::stringstream s; s << flagPos; @@ -90,7 +90,7 @@ BOOST_FIXTURE_TEST_CASE(checkBQs_Correct, EmptyWorldFixture1P) BOOST_FIXTURE_TEST_CASE(BQNextToBuilding, EmptyWorldFixture1P) { - const MapPoint flagPos = world.MakeMapPoint(world.getPlayer(0).getHQPos() - Position(5, 6)); + const MapPoint flagPos = world.makeMapPoint(world.getPlayer(0).getHQPos() - Position(5, 6)); const MapPoint bldPos = world.getNeighbour(flagPos, Direction::NorthWest); // All points possibly affected by a building const std::vector pts = world.GetPointsInRadiusWithCenter(bldPos, 4); @@ -193,13 +193,13 @@ BOOST_FIXTURE_TEST_CASE(BQWithRoad, EmptyWorldFixture0P) { roadPts.push_back(curPt); world.setPointRoad(curPt, Direction::SouthEast, PointRoad::Normal); - world.RecalcBQForRoad(curPt); + world.recalcBQForRoad(curPt); curPt = world.getNeighbour(curPt, Direction::SouthEast); } // Final pt still belongs to road roadPts.push_back(curPt); // Normally this is done by the flag - world.RecalcBQForRoad(curPt); + world.recalcBQForRoad(curPt); for(MapPoint pt : roadPts) { @@ -223,7 +223,7 @@ BOOST_FIXTURE_TEST_CASE(BQWithVisualRoad, EmptyWorldFixture1PBigger) dskGameInterface gameDesktop(this->game, std::shared_ptr(), 0, false); const GameWorldViewer& gwv = gameDesktop.getView().getViewer(); // Start at a position a bit away from the HQ so all points are castles - const MapPoint roadPt = world.MakeMapPoint(world.getPlayer(0).getHQPos() - Position(6, 6)); + const MapPoint roadPt = world.makeMapPoint(world.getPlayer(0).getHQPos() - Position(6, 6)); const std::vector roadRadiusPts = world.GetPointsInRadiusWithCenter(roadPt, 6); for(const MapPoint& pt : roadRadiusPts) BOOST_TEST_CONTEXT(" at " << pt) @@ -247,7 +247,7 @@ BOOST_FIXTURE_TEST_CASE(BQWithVisualRoad, EmptyWorldFixture1PBigger) roadPts.push_back(curPt); MapPoint curRoadEndPt = curPt; - gameDesktop.BuildRoadPart(curRoadEndPt); + gameDesktop.buildRoadPart(curRoadEndPt); BOOST_TEST_REQUIRE(curRoadEndPt == curPt); for(MapPoint pt : roadPts) @@ -264,7 +264,7 @@ BOOST_FIXTURE_TEST_CASE(BQWithVisualRoad, EmptyWorldFixture1PBigger) // Destroy road partially // The first point (after start) must have ID 2 BOOST_TEST_REQUIRE(gameDesktop.getIdInCurBuildRoad(roadPts[1]) == 2u); - gameDesktop.DemolishRoad(2); + gameDesktop.demolishRoad(2); BOOST_TEST_REQUIRE(gwv.isOnRoad(roadPts[0])); BOOST_TEST_REQUIRE(gwv.isOnRoad(roadPts[1])); for(unsigned i = 2; i < roadPts.size(); i++) @@ -296,7 +296,7 @@ BOOST_FIXTURE_TEST_CASE(BQWithVisualRoad, EmptyWorldFixture1PBigger) roadPts.push_back(curPt); curRoadEndPt = curPt; - gameDesktop.BuildRoadPart(curRoadEndPt); + gameDesktop.buildRoadPart(curRoadEndPt); BOOST_TEST_REQUIRE(curRoadEndPt == curPt); for(MapPoint pt : roadPts) @@ -338,7 +338,7 @@ BOOST_FIXTURE_TEST_CASE(BQ_AtBorder, EmptyWorldFixture1PBiggest) std::vector pts = world.getPointsInRadius(hqPos, hqRadius + 1); for(const MapPoint pt : pts) { - const unsigned distance = world.CalcDistance(pt, hqPos); + const unsigned distance = world.calcDistance(pt, hqPos); if(distance < 3) continue; // Influenced by HQ else if(distance + 1 < hqRadius) @@ -392,14 +392,14 @@ BOOST_FIXTURE_TEST_CASE(BQ_AtBorder, EmptyWorldFixture1PBiggest) static void addStaticObj(GameWorldBase& world, const MapPoint& pos, unsigned size) { - world.DestroyNO(pos, false); + world.destroyNO(pos, false); world.setNO(pos, new noStaticObject(pos, 0, 0, size)); - world.RecalcBQAroundPointBig(pos); + world.recalcBQAroundPointBig(pos); } BOOST_FIXTURE_TEST_CASE(BQNearObjects, EmptyWorldFixture1P) { - const MapPoint objPos = world.MakeMapPoint(world.getPlayer(0).getHQPos() - Position(3, 6)); + const MapPoint objPos = world.makeMapPoint(world.getPlayer(0).getHQPos() - Position(3, 6)); const std::vector ptsAroundObj = world.GetPointsInRadiusWithCenter(objPos, 2); const std::vector radius1Pts = world.getPointsInRadius(objPos, 1); BOOST_TEST_REQUIRE(checkBQs(world, ptsAroundObj, ReducedBQMap())); @@ -458,7 +458,7 @@ BOOST_FIXTURE_TEST_CASE(RoadRemovesObjs, EmptyWorldFixture1P) world.setOwner(pt, 1); const MapPoint hqPos = world.getPlayer(0).getHQPos(); const MapPoint startPos = world.getNeighbour(hqPos, Direction::SouthEast); - const MapPoint endPos = world.MakeMapPoint(startPos + Position(4, 0)); + const MapPoint endPos = world.makeMapPoint(startPos + Position(4, 0)); // Place these env objs const std::vector ids{505, 506, 507, 508, 509, 510, 512, 513, 514, 515, 531, 536, 541, 542, 543, 544, 545, 546, 547, 548, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559}; @@ -487,14 +487,14 @@ BOOST_FIXTURE_TEST_CASE(FisherIgnoresIsolatedFishWater, EmptyWorldFixture1PBigge { const DescIdx tWater = GetWaterTerrain(world.getDescription()); - const MapPoint fisheryPos = world.MakeMapPoint(world.getPlayer(0).getHQPos() - Position(6, 6)); + const MapPoint fisheryPos = world.makeMapPoint(world.getPlayer(0).getHQPos() - Position(6, 6)); auto* fishery = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Fishery, fisheryPos, 0, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Fishery, fisheryPos, 0, Nation::Romans)); BOOST_TEST_REQUIRE(fishery); nofFisher fisher(fisheryPos, 0, fishery); - const MapPoint workPt = world.MakeMapPoint(fisheryPos + Position(4, 0)); + const MapPoint workPt = world.makeMapPoint(fisheryPos + Position(4, 0)); const MapPoint fishPt = world.getNeighbour(workPt, Direction::East); auto makeWaterPoint = [&](const MapPoint pt) { diff --git a/tests/s25Main/integration/testBuildingProps.cpp b/tests/s25Main/integration/testBuildingProps.cpp index c62dc0f0ad..321c21a0a0 100644 --- a/tests/s25Main/integration/testBuildingProps.cpp +++ b/tests/s25Main/integration/testBuildingProps.cpp @@ -23,7 +23,7 @@ BOOST_FIXTURE_TEST_CASE(IsType, EmptyWorldFixture1P) { if(!BuildingProperties::isValid(bldType)) continue; - noBuilding* bld = BuildingFactory::CreateBuilding(world, bldType, bldPos, 0, Nation::Romans); + noBuilding* bld = BuildingFactory::createBuilding(world, bldType, bldPos, 0, Nation::Romans); BOOST_TEST_REQUIRE(bld); if(BuildingProperties::isMilitary(bldType)) BOOST_TEST_REQUIRE(dynamic_cast(bld)); @@ -37,8 +37,8 @@ BOOST_FIXTURE_TEST_CASE(IsType, EmptyWorldFixture1P) BOOST_TEST_REQUIRE(dynamic_cast(bld)); // At least a usual if(BuildingProperties::isUsual(bldType)) BOOST_TEST_REQUIRE(dynamic_cast(bld)); - world.DestroyNO(bldPos); + world.destroyNO(bldPos); // Destroy fire - world.DestroyNO(bldPos); + world.destroyNO(bldPos); } } diff --git a/tests/s25Main/integration/testBuildingRadius.cpp b/tests/s25Main/integration/testBuildingRadius.cpp index ac99522d12..2d720a2189 100644 --- a/tests/s25Main/integration/testBuildingRadius.cpp +++ b/tests/s25Main/integration/testBuildingRadius.cpp @@ -119,46 +119,46 @@ BOOST_FIXTURE_TEST_CASE(GetBuildingRadiusRespectsAddons, GameWorldViewFixture) BOOST_TEST(view.getBuildingRadius(BuildingType::Quarry) > defaultRadius); } -BOOST_AUTO_TEST_CASE(SnapToNearestCopy) +BOOST_AUTO_TEST_CASE(snapToNearestCopy) { const Extent mapSize(122, 84); const DrawPoint pt(37, 17); const DrawPoint ref(pt + mapSize / 5); // Close but not the same // Same point and reference -> no change - BOOST_TEST(GameWorldView::SnapToNearestCopy(pt, pt, mapSize) == pt); + BOOST_TEST(GameWorldView::snapToNearestCopy(pt, pt, mapSize) == pt); // Fixed ref is close enough -> closest is already this point - BOOST_TEST(GameWorldView::SnapToNearestCopy(pt, ref, mapSize) == pt); + BOOST_TEST(GameWorldView::snapToNearestCopy(pt, ref, mapSize) == pt); for(const auto offset : {// 1 map size right,left,top,bottom -> same offset for point Offset(mapSize.x, 0), -Offset(mapSize.x, 0), -Offset(0, mapSize.y), Offset(0, mapSize.y), // diagonal Offset(mapSize), -Offset(mapSize)}) { - BOOST_TEST(GameWorldView::SnapToNearestCopy(pt, ref + offset, mapSize) == pt + offset); + BOOST_TEST(GameWorldView::snapToNearestCopy(pt, ref + offset, mapSize) == pt + offset); const Offset offset2 = offset + mapSize * 3; // Multiple map sizes - BOOST_TEST(GameWorldView::SnapToNearestCopy(pt, ref + offset2, mapSize) == pt + offset2); + BOOST_TEST(GameWorldView::snapToNearestCopy(pt, ref + offset2, mapSize) == pt + offset2); } // Reference is exactly half a map size away -> point wraps to the other side const Extent halfMapSize = mapSize / 2u; - BOOST_TEST(GameWorldView::SnapToNearestCopy(pt, pt - Offset(halfMapSize.x, 0), mapSize) + BOOST_TEST(GameWorldView::snapToNearestCopy(pt, pt - Offset(halfMapSize.x, 0), mapSize) == pt - Offset(mapSize.x, 0)); - BOOST_TEST(GameWorldView::SnapToNearestCopy(pt, pt + Offset(halfMapSize.x, 0), mapSize) + BOOST_TEST(GameWorldView::snapToNearestCopy(pt, pt + Offset(halfMapSize.x, 0), mapSize) == pt + Offset(mapSize.x, 0)); - BOOST_TEST(GameWorldView::SnapToNearestCopy(pt, pt - Offset(0, halfMapSize.y), mapSize) + BOOST_TEST(GameWorldView::snapToNearestCopy(pt, pt - Offset(0, halfMapSize.y), mapSize) == pt - Offset(0, mapSize.y)); - BOOST_TEST(GameWorldView::SnapToNearestCopy(pt, pt + Offset(0, halfMapSize.y), mapSize) + BOOST_TEST(GameWorldView::snapToNearestCopy(pt, pt + Offset(0, halfMapSize.y), mapSize) == pt + Offset(0, mapSize.y)); // Reference at least half a map size to the left -> point wraps to the left const Offset offsetX = Offset(rttr::test::randomValue(mapSize.x / 2, mapSize.x), 0); - BOOST_TEST(GameWorldView::SnapToNearestCopy(pt, pt - offsetX, mapSize) == pt - Offset(mapSize.x, 0)); + BOOST_TEST(GameWorldView::snapToNearestCopy(pt, pt - offsetX, mapSize) == pt - Offset(mapSize.x, 0)); // same for right - BOOST_TEST(GameWorldView::SnapToNearestCopy(pt, pt + offsetX, mapSize) == pt + Offset(mapSize.x, 0)); + BOOST_TEST(GameWorldView::snapToNearestCopy(pt, pt + offsetX, mapSize) == pt + Offset(mapSize.x, 0)); const Offset offsetY = Offset(0, rttr::test::randomValue(mapSize.y / 2, mapSize.y)); // And top/bottom - BOOST_TEST(GameWorldView::SnapToNearestCopy(pt, pt - offsetY, mapSize) == pt - Offset(0, mapSize.y)); - BOOST_TEST(GameWorldView::SnapToNearestCopy(pt, pt + offsetY, mapSize) == pt + Offset(0, mapSize.y)); + BOOST_TEST(GameWorldView::snapToNearestCopy(pt, pt - offsetY, mapSize) == pt - Offset(0, mapSize.y)); + BOOST_TEST(GameWorldView::snapToNearestCopy(pt, pt + offsetY, mapSize) == pt + Offset(0, mapSize.y)); } BOOST_FIXTURE_TEST_CASE(TestUpdateRadiusPreview, GameWorldViewFixture) @@ -189,7 +189,7 @@ BOOST_FIXTURE_TEST_CASE(TestUpdateRadiusPreview, GameWorldViewFixture) // No radius shown in tooltip when addon is disabled ggs.setSelection(AddonId::BUILDING_RADIUS, 0); { - auto& action = WINDOWMANAGER.Show( + auto& action = WINDOWMANAGER.show( std::make_unique(gi, view, tabs, selPt, DrawPoint(0, 0), iwAction::FlagType::Normal, true)); icons = getIcons(action); const auto& findIcon = [&](BuildingType type) -> const ctrlBuildingIcon& { @@ -203,7 +203,7 @@ BOOST_FIXTURE_TEST_CASE(TestUpdateRadiusPreview, GameWorldViewFixture) // Enable addon and re-open iwAction ggs.setSelection(AddonId::BUILDING_RADIUS, 1); - auto& action = WINDOWMANAGER.Show( + auto& action = WINDOWMANAGER.show( std::make_unique(gi, view, tabs, selPt, DrawPoint(0, 0), iwAction::FlagType::Normal, true)); icons = getIcons(action); BOOST_TEST(findIcon(BuildingType::Watchtower).getTooltip().find(_("Range:")) != std::string::npos); @@ -235,7 +235,7 @@ BOOST_FIXTURE_TEST_CASE(TestUpdateRadiusPreview, GameWorldViewFixture) const auto& icon = findIcon(BuildingType::Watchtower); WINDOWMANAGER.msgMouseMove(MouseCoords(icon.getDrawPos() + DrawPoint(1, 1))); BOOST_TEST_REQUIRE(view.getRadiusPreview().has_value()); - WINDOWMANAGER.CloseNow(&action); + WINDOWMANAGER.closeNow(&action); BOOST_TEST(!view.getRadiusPreview()); } diff --git a/tests/s25Main/integration/testCheatCommandTracker.cpp b/tests/s25Main/integration/testCheatCommandTracker.cpp index aaa2e41d7c..cda6e64f40 100644 --- a/tests/s25Main/integration/testCheatCommandTracker.cpp +++ b/tests/s25Main/integration/testCheatCommandTracker.cpp @@ -20,7 +20,7 @@ struct StoreGCFactory : public GameCommandFactory std::vector gcs; protected: - bool AddGC(gc::GameCommandPtr gc) override + bool addGC(gc::GameCommandPtr gc) override { gcs.push_back(gc); return true; diff --git a/tests/s25Main/integration/testCheats.cpp b/tests/s25Main/integration/testCheats.cpp index bd3e4b3d12..d9ff369995 100644 --- a/tests/s25Main/integration/testCheats.cpp +++ b/tests/s25Main/integration/testCheats.cpp @@ -22,7 +22,7 @@ namespace { MOCK_BASE_CLASS(MockGCFactory, GameCommandFactory) { - MOCK_METHOD(AddGC, 1, bool(gc::GameCommandPtr gc)); // LCOV_EXCL_LINE + MOCK_METHOD(addGC, 1, bool(gc::GameCommandPtr gc)); // LCOV_EXCL_LINE }; constexpr auto numPlayers = 3; @@ -178,7 +178,7 @@ BOOST_FIXTURE_TEST_CASE(AllBuildingsAreEnabled_WhenCheatModeIsOn, CheatsFixture) cheats.toggleCheatMode(); GamePlayer& p1 = world.getPlayer(0); const auto bld = BuildingType::Brewery; - p1.DisableBuilding(bld); + p1.disableBuilding(bld); BOOST_TEST_REQUIRE(p1.isBuildingEnabled(bld) == false); cheats.toggleAllBuildingsEnabled(); BOOST_TEST_REQUIRE(p1.isBuildingEnabled(bld) == true); diff --git a/tests/s25Main/integration/testDisappearingMapObjects.cpp b/tests/s25Main/integration/testDisappearingMapObjects.cpp index 281c8f6aca..b54ec420f6 100644 --- a/tests/s25Main/integration/testDisappearingMapObjects.cpp +++ b/tests/s25Main/integration/testDisappearingMapObjects.cpp @@ -34,15 +34,15 @@ struct DummyWorker : GameObject explicit DummyWorker(GameWorld& world, MapPoint pos) : world(world), pos(pos) {} - void HandleEvent(unsigned) override + void handleEvent(unsigned) override { nodeWasEmptyWhenReplaced = (world.getNode(pos).obj == nullptr); - world.DestroyNO(pos, false); + world.destroyNO(pos, false); world.setNO(pos, new noStaticObject(pos, staticObjId)); } // LCOV_EXCL_START - void Destroy() override {} + void destroy() override {} void Serialize(SerializedGameData&) const override {} GO_Type getGOT() const final { return GO_Type::NofGeologist; } // LCOV_EXCL_STOP @@ -91,20 +91,20 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(RemoveEnvObjectFromNodeBeforeKill, T, Disappearing { // Except for fire, which burns until it gets removed, // objects start fading after some time and only then get removed, so trigger the first event. - em.RescheduleEvent(em.getObjEvents(obj).at(0), em.getCurrentGF() + 1); - em.RescheduleEvent(em.getObjEvents(obj2).at(0), em.getCurrentGF() + 1); - em.ExecuteNextGF(); + em.rescheduleEvent(em.getObjEvents(obj).at(0), em.getCurrentGF() + 1); + em.rescheduleEvent(em.getObjEvents(obj2).at(0), em.getCurrentGF() + 1); + em.executeNextGF(); } DummyWorker worker(world, testPos); DummyWorker worker2(world, testPos2); // Add worker event before and after object event, but both in the same GF - em.AddEvent(&worker, 1); - em.RescheduleEvent(em.getObjEvents(obj).at(0), em.getCurrentGF() + 1); - em.RescheduleEvent(em.getObjEvents(obj2).at(0), em.getCurrentGF() + 1); - em.AddEvent(&worker2, 1); + em.addEvent(&worker, 1); + em.rescheduleEvent(em.getObjEvents(obj).at(0), em.getCurrentGF() + 1); + em.rescheduleEvent(em.getObjEvents(obj2).at(0), em.getCurrentGF() + 1); + em.addEvent(&worker2, 1); BOOST_TEST(getNumObjs() == 4u); - em.ExecuteNextGF(); + em.executeNextGF(); // Just replaced the objects, so count should be the same. // A double free would decrease this multiple times per object. BOOST_TEST(getNumObjs() == 4u); @@ -127,11 +127,11 @@ BOOST_AUTO_TEST_CASE(ShipBuildingSiteDestroyDoesNotClobberNode) world.setNO(testPos, site); auto* staticObj = new noStaticObject(testPos, DummyWorker::staticObjId); BOOST_TEST(getNumObjs() == 2u); - world.DestroyNO(testPos); + world.destroyNO(testPos); world.setNO(testPos, staticObj); BOOST_TEST(getNumObjs() == 1u); // Catch possible double-free BOOST_TEST(ensureNonNull(world.getSpecObj(testPos)).getItemID() == DummyWorker::staticObjId); - world.DestroyNO(testPos); + world.destroyNO(testPos); // Fully build ship, then build new object there // Fake a nearby sea @@ -141,7 +141,7 @@ BOOST_AUTO_TEST_CASE(ShipBuildingSiteDestroyDoesNotClobberNode) BOOST_TEST(getNumObjs() == 1u); do { - site->MakeBuildStep(); + site->makeBuildStep(); } while(world.getNO(testPos)->getGOT() == GO_Type::Shipbuildingsite); // Replaced by ship BOOST_TEST(world.getPlayer(0).getNumShips() == 1u); @@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE(ShipBuildingSiteDestroyDoesNotClobberNode) world.setNO(testPos, staticObj); // Should only destroy the building site - em.ExecuteNextGF(); + em.executeNextGF(); BOOST_TEST(getNumObjs() == 2u); BOOST_TEST(ensureNonNull(world.getSpecObj(testPos)).getItemID() == DummyWorker::staticObjId); } diff --git a/tests/s25Main/integration/testDskGameInterface.cpp b/tests/s25Main/integration/testDskGameInterface.cpp index 2a698c4dde..cc88e8f7b7 100644 --- a/tests/s25Main/integration/testDskGameInterface.cpp +++ b/tests/s25Main/integration/testDskGameInterface.cpp @@ -51,7 +51,7 @@ struct GameInterfaceFixture : uiHelper::Fixture { gameDesktop = static_cast( WINDOWMANAGER.Switch(std::make_unique(worldFixture.game))); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); view = &gameDesktop->getView(); } }; @@ -150,7 +150,7 @@ BOOST_FIXTURE_TEST_CASE(Scrolling, GameInterfaceFixture) BOOST_TEST_REQUIRE(view->getOffset() == pos); // Closing it doesn't either WINDOWMANAGER.msgKeyDown(key); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.draw(); BOOST_TEST_REQUIRE(gameDesktop->IsActive()); BOOST_TEST_REQUIRE(!WINDOWMANAGER.getTopMostWindow()); BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Scroll); @@ -175,7 +175,7 @@ BOOST_FIXTURE_TEST_CASE(ScrollingWhileRoadBuilding, GameInterfaceFixture) const int acceleration = 2; MapPoint hqPos = worldFixture.world.getPlayer(0).getFirstWH()->getFlagPos(); //-V522 gameDesktop->GI_StartRoadBuilding(hqPos, false); - BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Remove); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::remove); Position startPos(10, 15); MouseCoords mouse(startPos); mouse.rdown = true; @@ -190,9 +190,9 @@ BOOST_FIXTURE_TEST_CASE(ScrollingWhileRoadBuilding, GameInterfaceFixture) BOOST_TEST_REQUIRE(view->getOffset() == pos); mouse.rdown = false; WINDOWMANAGER.msgRightUp(mouse); - BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Remove); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::remove); BOOST_TEST_REQUIRE(view->getOffset() == pos); - checkNotScrolling(*view, Cursor::Remove); + checkNotScrolling(*view, Cursor::remove); // left click also stops scrolling mouse.rdown = true; @@ -208,9 +208,9 @@ BOOST_FIXTURE_TEST_CASE(ScrollingWhileRoadBuilding, GameInterfaceFixture) WINDOWMANAGER.msgLeftDown(mouse); mouse.ldown = false; WINDOWMANAGER.msgLeftUp(mouse); - BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::Remove); + BOOST_TEST_REQUIRE(WINDOWMANAGER.getCursor() == Cursor::remove); BOOST_TEST_REQUIRE(view->getOffset() == pos); - checkNotScrolling(*view, Cursor::Remove); + checkNotScrolling(*view, Cursor::remove); } BOOST_FIXTURE_TEST_CASE(ScrollingWithCtrl, GameInterfaceFixture) @@ -237,12 +237,12 @@ BOOST_FIXTURE_TEST_CASE(ScrollingWithCtrl, GameInterfaceFixture) BOOST_FIXTURE_TEST_CASE(IwActionClose, GameInterfaceFixture) { - gameDesktop->ShowActionWindow(iwAction::Tabs{}, MapPoint(0, 1), DrawPoint(42, 37), false); - WINDOWMANAGER.Draw(); + gameDesktop->showActionWindow(iwAction::Tabs{}, MapPoint(0, 1), DrawPoint(42, 37), false); + WINDOWMANAGER.draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow()); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == gameDesktop->actionwindow); - WINDOWMANAGER.getTopMostWindow()->Close(); - WINDOWMANAGER.Draw(); + WINDOWMANAGER.getTopMostWindow()->close(); + WINDOWMANAGER.draw(); BOOST_TEST_REQUIRE(WINDOWMANAGER.getTopMostWindow() == nullptr); BOOST_TEST_REQUIRE(gameDesktop->actionwindow == nullptr); } diff --git a/tests/s25Main/integration/testEconomyMode.cpp b/tests/s25Main/integration/testEconomyMode.cpp index 699ad6d226..d1a5a74357 100644 --- a/tests/s25Main/integration/testEconomyMode.cpp +++ b/tests/s25Main/integration/testEconomyMode.cpp @@ -35,7 +35,7 @@ class EconModeFixture : WorldFixture world.getPlayer(2).team = Team::Team2; for(unsigned playerIdx = 0; playerIdx < 3; ++playerIdx) { - world.getPlayer(playerIdx).MakeStartPacts(); + world.getPlayer(playerIdx).makeStartPacts(); hqPos[playerIdx] = world.getPlayer(playerIdx).getHQPos(); } this->ggs.objective = GameObjective::EconomyMode; @@ -50,7 +50,7 @@ class EconModeFixture : WorldFixture BOOST_FIXTURE_TEST_CASE(EconomyMode3Players, EconModeFixture) { - game->Start(false); + game->start(false); BOOST_TEST(world.getEconHandler()); // Just test that we have any constexpr auto amountsToAdd = helpers::make_array(63, 100, 85); @@ -62,9 +62,9 @@ BOOST_FIXTURE_TEST_CASE(EconomyMode3Players, EconModeFixture) BOOST_TEST(econHandler.getEndFrame() == 4u); BOOST_TEST(!econHandler.isOver()); BOOST_TEST(!econHandler.isInfinite()); - BOOST_TEST(world.getEvMgr().ObjectHasEvents(econHandler)); - world.getEvMgr().ExecuteNextGF(); - econHandler.UpdateAmounts(); + BOOST_TEST(world.getEvMgr().objectHasEvents(econHandler)); + world.getEvMgr().executeNextGF(); + econHandler.updateAmounts(); // Individual amount counting unsigned initialAmount = econHandler.getAmount(0, 0); @@ -74,10 +74,10 @@ BOOST_FIXTURE_TEST_CASE(EconomyMode3Players, EconModeFixture) for(unsigned playerIdx = 0; playerIdx < 3; ++playerIdx) { world.getSpecObj(hqPos[playerIdx]) - ->AddToInventory(GoodCounts::make(goodsToCollect[0], amountsToAdd[playerIdx]), true); + ->addToInventory(GoodCounts::make(goodsToCollect[0], amountsToAdd[playerIdx]), true); } - world.getEvMgr().ExecuteNextGF(); - econHandler.UpdateAmounts(); + world.getEvMgr().executeNextGF(); + econHandler.updateAmounts(); for(unsigned playerIdx = 0; playerIdx < 3; ++playerIdx) { BOOST_TEST_REQUIRE(econHandler.getAmount(0, playerIdx) == initialAmount + amountsToAdd[playerIdx]); @@ -107,24 +107,24 @@ BOOST_FIXTURE_TEST_CASE(EconomyModeSerialization, EconModeFixture) { ggs.setSelection(AddonId::ECONOMY_MODE_GAME_LENGTH, rttr::test::randomValue(1, AddonEconomyModeGameLengthList.size() - 1)); - game->Start(false); + game->start(false); const auto& goodsToCollect = world.getEconHandler()->getGoodTypesToCollect(); for(unsigned playerIdx = 0; playerIdx < 3; ++playerIdx) { world.getSpecObj(hqPos[playerIdx]) - ->AddToInventory(GoodCounts::make(goodsToCollect[0], rttr::test::randomValue(1u, 50u)), true); + ->addToInventory(GoodCounts::make(goodsToCollect[0], rttr::test::randomValue(1u, 50u)), true); } - world.getEvMgr().ExecuteNextGF(); - world.getEconHandler()->UpdateAmounts(); + world.getEvMgr().executeNextGF(); + world.getEconHandler()->updateAmounts(); Savegame save; for(const auto& player : world.getPlayers()) - save.AddPlayer(player); + save.addPlayer(player); save.ggs = ggs; save.start_gf = game->em_->getCurrentGF(); - save.sgd.MakeSnapshot(*game); + save.sgd.makeSnapshot(*game); TmpFile tmpFile; - BOOST_TEST_REQUIRE(save.Save(tmpFile.filePath, "MapTitle")); + BOOST_TEST_REQUIRE(save.save(tmpFile.filePath, "MapTitle")); Savegame loadSave; BOOST_TEST_REQUIRE(loadSave.Load(tmpFile.filePath, SaveGameDataToLoad::All)); BOOST_TEST_REQUIRE(loadSave.getNumPlayers() == 3u); @@ -134,7 +134,7 @@ BOOST_FIXTURE_TEST_CASE(EconomyModeSerialization, EconModeFixture) Game newGame(save.ggs, loadSave.start_gf, players); GameWorld& newWorld = newGame.world_; MockLocalGameState localGameState; - save.sgd.ReadSnapshot(newGame, localGameState); + save.sgd.readSnapshot(newGame, localGameState); BOOST_TEST_REQUIRE(newWorld.getEconHandler()); BOOST_TEST(newWorld.getEconHandler()->getEndFrame() == world.getEconHandler()->getEndFrame()); @@ -143,7 +143,7 @@ BOOST_FIXTURE_TEST_CASE(EconomyModeSerialization, EconModeFixture) const auto& econTeams = world.getEconHandler()->getTeams(); const auto& econTeamsAfter = newWorld.getEconHandler()->getTeams(); BOOST_TEST_REQUIRE(econTeams.size() == econTeamsAfter.size()); - newWorld.getEconHandler()->UpdateAmounts(); + newWorld.getEconHandler()->updateAmounts(); for(const auto& teamPair : boost::combine(econTeams, econTeamsAfter)) { const EconomyModeHandler::EconTeam& before = get<0>(teamPair); @@ -152,7 +152,7 @@ BOOST_FIXTURE_TEST_CASE(EconomyModeSerialization, EconModeFixture) BOOST_TEST_REQUIRE(before.amountsTheTeamCollected == after.amountsTheTeamCollected); BOOST_TEST_REQUIRE(before.goodTypeWins == after.goodTypeWins); } - BOOST_TEST(newWorld.getEvMgr().ObjectHasEvents(*newWorld.getEconHandler())); + BOOST_TEST(newWorld.getEvMgr().objectHasEvents(*newWorld.getEconHandler())); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/integration/testEmergencyProtocol.cpp b/tests/s25Main/integration/testEmergencyProtocol.cpp index a0a1d95233..4568716517 100644 --- a/tests/s25Main/integration/testEmergencyProtocol.cpp +++ b/tests/s25Main/integration/testEmergencyProtocol.cpp @@ -14,16 +14,16 @@ struct EmergencyFixture : public WorldWithGCExecution1P nobHQ* hq = world.getPlayer(0).getHQ(); EmergencyFixture() { - hq->AddToInventory(hq->getStartInventory(StartWares::VLow), true); + hq->addToInventory(hq->getStartInventory(StartWares::VLow), true); MapPoint pos; pos = hqPos + MapPoint(3, 0); world.SetBuildingSite(BuildingType::Farm, pos, 0); - BuildRoadForBlds(pos, hqPos); + buildRoadForBlds(pos, hqPos); pos = hqPos + MapPoint(-3, 0); world.SetBuildingSite(BuildingType::Farm, pos, 0); - BuildRoadForBlds(pos, hqPos); + buildRoadForBlds(pos, hqPos); // wait until emergency protocol should be activated RTTR_EXEC_TILL(500, hq->getInventory()[GoodType::Boards] == 10); @@ -43,11 +43,11 @@ BOOST_AUTO_TEST_CASE(CanBuildWoodcutterAndSawmill) { const MapPoint posWoodcutter = hqPos + MapPoint(-1, 2); world.SetBuildingSite(BuildingType::Woodcutter, posWoodcutter, 0); - BuildRoadForBlds(posWoodcutter, hqPos); + buildRoadForBlds(posWoodcutter, hqPos); const MapPoint posSawmill = hqPos + MapPoint(-2, 4); world.SetBuildingSite(BuildingType::Sawmill, posSawmill, 0); - BuildRoadForBlds(posSawmill, hqPos); + buildRoadForBlds(posSawmill, hqPos); // check if inventory boards are given out RTTR_EXEC_TILL(200, hq->getInventory()[GoodType::Boards] < 10); @@ -62,7 +62,7 @@ BOOST_FIXTURE_TEST_CASE(CannotBuildOtherBuldings, EmergencyFixture) const MapPoint pos = hqPos + MapPoint(-3, 0); world.SetBuildingSite(BuildingType::Watchtower, pos, 0); - BuildRoadForBlds(pos, hqPos); + buildRoadForBlds(pos, hqPos); // No boards are carried out to the farms or watchtower due to emergency protocol RTTR_SKIP_GFS(500); diff --git a/tests/s25Main/integration/testFarmer.cpp b/tests/s25Main/integration/testFarmer.cpp index 878ac9ff61..1d9ad515da 100644 --- a/tests/s25Main/integration/testFarmer.cpp +++ b/tests/s25Main/integration/testFarmer.cpp @@ -24,7 +24,7 @@ struct FarmerFixture : public WorldFixture addStartResources(); farmPt = world.getPlayer(0).getHQPos() + MapPoint(5, 0); farm = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Farm, farmPt, 0, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Farm, farmPt, 0, Nation::Romans)); BOOST_TEST_REQUIRE(farm); world.BuildRoad(0, false, world.getNeighbour(farmPt, Direction::SouthEast), std::vector(5, Direction::West)); @@ -44,9 +44,9 @@ BOOST_FIXTURE_TEST_CASE(ForesterAvoidsPotentialFarmFieldSpots, FarmerFixture) const MapPoint fieldPt = world.getNeighbour2(farmPt, 0); BOOST_TEST_REQUIRE(isPointAvailable(*farmer, fieldPt)); - const MapPoint foresterPt = world.MakeMapPoint(world.getPlayer(0).getHQPos() - Position(5, 0)); + const MapPoint foresterPt = world.makeMapPoint(world.getPlayer(0).getHQPos() - Position(5, 0)); auto* foresterBuilding = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Forester, foresterPt, 0, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Forester, foresterPt, 0, Nation::Romans)); BOOST_TEST_REQUIRE(foresterBuilding); nofForester foresterWorker(world.getNeighbour(foresterPt, Direction::SouthEast), 0, foresterBuilding); @@ -107,7 +107,7 @@ BOOST_FIXTURE_TEST_CASE(FarmFieldPlanting, FarmerFixture) { // Let the farmer pick a field RTTR_EXEC_TILL(150, farm->is_working); - MapPoint newField = MapPoint::Invalid(); + MapPoint newField = MapPoint::invalid(); // Find field, only these 3 remaining for(unsigned dir = 8; dir < 11; dir++) { diff --git a/tests/s25Main/integration/testFigures.cpp b/tests/s25Main/integration/testFigures.cpp index 3eca8121ba..d642623ca2 100644 --- a/tests/s25Main/integration/testFigures.cpp +++ b/tests/s25Main/integration/testFigures.cpp @@ -72,12 +72,12 @@ BOOST_AUTO_TEST_CASE(StrandedSoldierReturnSearchVeryLargeEscalatesThroughThreeSt BOOST_FIXTURE_TEST_CASE(DestroyWHWithFigure, WorldWithGCExecution2P) { - world.getPlayer(curPlayer).getFirstWH()->AddToInventory(PeopleCounts::make(Job::Helper, 10), true); + world.getPlayer(curPlayer).getFirstWH()->addToInventory(PeopleCounts::make(Job::Helper, 10), true); MapPoint flagPos = world.getNeighbour(hqPos, Direction::SouthEast); MapPoint whPos(flagPos.x + 5, flagPos.y); auto* wh = static_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Storehouse, whPos, curPlayer, Nation::Romans)); - wh->AddToInventory(PeopleCounts::make(Job::Helper, 1), true); + BuildingFactory::createBuilding(world, BuildingType::Storehouse, whPos, curPlayer, Nation::Romans)); + wh->addToInventory(PeopleCounts::make(Job::Helper, 1), true); const unsigned numHelpers = world.getPlayer(curPlayer).getInventory().people[Job::Helper]; //-V807 MapPoint whFlagPos = world.getNeighbour(whPos, Direction::SouthEast); // Build a road -> Requests a worker @@ -116,7 +116,7 @@ BOOST_FIXTURE_TEST_CASE(DestroyWHWithWare, WorldWithGCExecution2P) MapPoint flagPos = world.getNeighbour(hqPos, Direction::SouthEast); MapPoint whFlagPos(flagPos.x + 5, flagPos.y); MapPoint whPos = world.getNeighbour(whFlagPos, Direction::NorthWest); - BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, whPos, curPlayer, Nation::Romans); + BuildingFactory::createBuilding(world, BuildingType::HarborBuilding, whPos, curPlayer, Nation::Romans); // Build a road this->BuildRoad(whFlagPos, false, std::vector(5, Direction::West)); // Request people and wares @@ -133,14 +133,14 @@ using EmptyWorldFixture1PBig = WorldFixture; BOOST_FIXTURE_TEST_CASE(ScoutScouts, EmptyWorldFixture1PBig) { const MapPoint hqFlagPos = world.getNeighbour(world.getPlayer(0).getHQPos(), Direction::SouthEast); - auto& scout = world.AddFigure( + auto& scout = world.addFigure( hqFlagPos, std::make_unique(hqFlagPos, 0, world.getSpecObj(hqFlagPos))); - scout.ActAtFirst(); + scout.actAtFirst(); const auto countVisibleNodes = [&]() { unsigned numVisibleNodes = 0; RTTR_FOREACH_PT(MapPoint, world.getSize()) { - if(world.CalcVisiblityWithAllies(pt, 0) != Visibility::Invisible) + if(world.calcVisiblityWithAllies(pt, 0) != Visibility::Invisible) numVisibleNodes++; } return numVisibleNodes; @@ -170,8 +170,8 @@ BOOST_FIXTURE_TEST_CASE(GeologistPlacesSigns, EmptyWorldFixture1P) for(unsigned i = 0; i < 10; i++) { world - .AddFigure(hqFlagPos, std::make_unique(hqFlagPos, 0, world.getSpecObj(hqFlagPos))) - .ActAtFirst(); + .addFigure(hqFlagPos, std::make_unique(hqFlagPos, 0, world.getSpecObj(hqFlagPos))) + .actAtFirst(); } std::vector notes; diff --git a/tests/s25Main/integration/testFrontierDistance.cpp b/tests/s25Main/integration/testFrontierDistance.cpp index bff64e8144..660c3922b7 100644 --- a/tests/s25Main/integration/testFrontierDistance.cpp +++ b/tests/s25Main/integration/testFrontierDistance.cpp @@ -48,12 +48,12 @@ struct FrontierWorld : public WorldFixture BOOST_TEST_REQUIRE(milBld0Pos.y == milBld1Pos.y); } // Destroy HQs so only buildings are checked - world.DestroyNO(p0.getHQPos()); - world.DestroyNO(p1.getHQPos()); + world.destroyNO(p0.getHQPos()); + world.destroyNO(p1.getHQPos()); milBld0 = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Barracks, milBld0Pos, 0, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Barracks, milBld0Pos, 0, Nation::Romans)); milBld1 = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, milBld1Pos, 1, Nation::Vikings)); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, milBld1Pos, 1, Nation::Vikings)); } }; using FrontierWorldSmall = FrontierWorld<34u, 20u>; @@ -85,8 +85,8 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceNear, FrontierWorldSmall) for(int i = 0; i <= 1; i++) { this->ggs.setSelection(AddonId::FRONTIER_DISTANCE_REACHABLE, i); // addon is active on second run - world.getPlayer(0).RecalcMilitaryFlags(); - world.getPlayer(1).RecalcMilitaryFlags(); + world.getPlayer(0).recalcMilitaryFlags(); + world.getPlayer(1).recalcMilitaryFlags(); FrontierDistance distance0 = milBld0->getFrontierDistance(); FrontierDistance distance1 = milBld1->getFrontierDistance(); @@ -123,8 +123,8 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceNearOtherFields, FrontierWorldSmall) for(int i = 0; i <= 1; i++) { this->ggs.setSelection(AddonId::FRONTIER_DISTANCE_REACHABLE, i); // addon is active on second run - world.getPlayer(0).RecalcMilitaryFlags(); - world.getPlayer(1).RecalcMilitaryFlags(); + world.getPlayer(0).recalcMilitaryFlags(); + world.getPlayer(1).recalcMilitaryFlags(); FrontierDistance distance0 = milBld0->getFrontierDistance(); FrontierDistance distance1 = milBld1->getFrontierDistance(); @@ -160,8 +160,8 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceMiddle, FrontierWorldMiddle) for(int i = 0; i <= 1; i++) { this->ggs.setSelection(AddonId::FRONTIER_DISTANCE_REACHABLE, i); // addon is active on second run - world.getPlayer(0).RecalcMilitaryFlags(); - world.getPlayer(1).RecalcMilitaryFlags(); + world.getPlayer(0).recalcMilitaryFlags(); + world.getPlayer(1).recalcMilitaryFlags(); FrontierDistance distance0 = milBld0->getFrontierDistance(); FrontierDistance distance1 = milBld1->getFrontierDistance(); @@ -195,8 +195,8 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceFar, FrontierWorldBig) for(int i = 0; i <= 1; i++) { this->ggs.setSelection(AddonId::FRONTIER_DISTANCE_REACHABLE, i); // addon is active on second run - world.getPlayer(0).RecalcMilitaryFlags(); - world.getPlayer(1).RecalcMilitaryFlags(); + world.getPlayer(0).recalcMilitaryFlags(); + world.getPlayer(1).recalcMilitaryFlags(); FrontierDistance distance0 = milBld0->getFrontierDistance(); FrontierDistance distance1 = milBld1->getFrontierDistance(); @@ -210,14 +210,14 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceHarbor, FrontierWorldSea) { // With sea attacks this->ggs.setSelection(AddonId::SEA_ATTACK, 0); - milBld0->LookForEnemyBuildings(milBld1); + milBld0->lookForEnemyBuildings(milBld1); BOOST_TEST(milBld0->getFrontierDistance() == FrontierDistance::Harbor); this->ggs.setSelection(AddonId::SEA_ATTACK, 1); - milBld0->LookForEnemyBuildings(milBld1); + milBld0->lookForEnemyBuildings(milBld1); BOOST_TEST(milBld0->getFrontierDistance() == FrontierDistance::Harbor); // With sea attacks disabled this->ggs.setSelection(AddonId::SEA_ATTACK, 2); - milBld0->LookForEnemyBuildings(milBld1); + milBld0->lookForEnemyBuildings(milBld1); BOOST_TEST(milBld0->getFrontierDistance() == FrontierDistance::Far); } @@ -247,8 +247,8 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceIslandTest, FrontierWorldMiddle) for(int i = 0; i <= 1; i++) { this->ggs.setSelection(AddonId::FRONTIER_DISTANCE_REACHABLE, i); // addon is active on second run - world.getPlayer(0).RecalcMilitaryFlags(); - world.getPlayer(1).RecalcMilitaryFlags(); + world.getPlayer(0).recalcMilitaryFlags(); + world.getPlayer(1).recalcMilitaryFlags(); FrontierDistance distance0 = milBld0->getFrontierDistance(); FrontierDistance distance1 = milBld1->getFrontierDistance(); @@ -332,18 +332,18 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceBug_815, WorldBig) // side of p1 outside the bottle neck, this building will cause the bug MapPoint p1Far(middle + 5, 30); - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, p1Far, p1.getPlayerId(), Nation::Romans); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, p1Far, p1.getPlayerId(), Nation::Romans); // p1 s building, which should cause a frontier distance "near" MapPoint p1Near(middle + 5, 15); auto* milBld1 = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, p1Near, p1.getPlayerId(), Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, p1Near, p1.getPlayerId(), Nation::Romans)); // p0 s building, should be near, like p1 s but, will be far cause p1Far cant be reached (patch is longer then 40 // units). It will override the NEAR-Distance from P1Near, when evaluating P1Far MapPoint p0Near(middle - 5, 15); auto* milBld0 = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, p0Near, p0.getPlayerId(), Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, p0Near, p0.getPlayerId(), Nation::Romans)); FrontierDistance distance0 = milBld0->getFrontierDistance(); FrontierDistance distance1 = milBld1->getFrontierDistance(); @@ -370,33 +370,33 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceReachabilityConsidersStaticObjectBlocker node.t2 = tWater; } - BOOST_TEST_REQUIRE(DoesReachablePathExist(world, startPt, endPt, maxPathLen)); + BOOST_TEST_REQUIRE(doesReachablePathExist(world, startPt, endPt, maxPathLen)); for(const unsigned x : helpers::range(startPt.x + 1, endPt.x)) { const MapPoint passablePt(x, corridorY); - world.DestroyNO(passablePt, false); + world.destroyNO(passablePt, false); world.setNO(passablePt, new noStaticObject(passablePt, 0, 0, 0)); } - BOOST_TEST_REQUIRE(DoesReachablePathExist(world, startPt, endPt, maxPathLen)); + BOOST_TEST_REQUIRE(doesReachablePathExist(world, startPt, endPt, maxPathLen)); for(const unsigned x : helpers::range(startPt.x + 1, endPt.x)) { const MapPoint passablePt(x, corridorY); - world.DestroyNO(passablePt, false); + world.destroyNO(passablePt, false); world.setNO(passablePt, new noEnvObject(passablePt, 0, 0)); } - BOOST_TEST_REQUIRE(DoesReachablePathExist(world, startPt, endPt, maxPathLen)); + BOOST_TEST_REQUIRE(doesReachablePathExist(world, startPt, endPt, maxPathLen)); for(const unsigned x : helpers::range(startPt.x + 1, endPt.x)) { const MapPoint blockerPt(x, corridorY); - world.DestroyNO(blockerPt, false); + world.destroyNO(blockerPt, false); world.setNO(blockerPt, new noStaticObject(blockerPt, 0, 0, 1)); } - BOOST_TEST_REQUIRE(!DoesReachablePathExist(world, startPt, endPt, maxPathLen)); + BOOST_TEST_REQUIRE(!doesReachablePathExist(world, startPt, endPt, maxPathLen)); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/integration/testGameCommands.cpp b/tests/s25Main/integration/testGameCommands.cpp index a8cf2d0eb7..1e05b21370 100644 --- a/tests/s25Main/integration/testGameCommands.cpp +++ b/tests/s25Main/integration/testGameCommands.cpp @@ -381,7 +381,7 @@ BOOST_FIXTURE_TEST_CASE(PlayerEconomySettings, WorldWithGCExecution2P) const GamePlayer& player = world.getPlayer(curPlayer); // TODO: Use better getters once available VisualSettings outSettings; - player.FillVisualSettings(outSettings); + player.fillVisualSettings(outSettings); for(unsigned i = 0; i < inDist.size(); i++) BOOST_TEST_REQUIRE(outSettings.distribution[i] == inDist[i]); BOOST_TEST_REQUIRE(outSettings.useCustomBuildOrder == orderType); @@ -477,7 +477,7 @@ BOOST_FIXTURE_TEST_CASE(SendSoldiersHomeTest, WorldWithGCExecution2P) soldiers[Job::Sergeant] = 1; soldiers[Job::Officer] = 1; soldiers[Job::General] = 2; - wh->AddToInventory(soldiers, true); + wh->addToInventory(soldiers, true); // Don't keep any reserve for(unsigned i = 0; i <= this->ggs.getMaxMilitaryRank(); ++i) this->ChangeReserve(hqPos, i, 0); @@ -485,7 +485,7 @@ BOOST_FIXTURE_TEST_CASE(SendSoldiersHomeTest, WorldWithGCExecution2P) this->ChangeMilitary(MILITARY_SETTINGS_SCALE); // Build a watchtower and connect it auto* bld = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, milPt, curPlayer, player.nation)); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, milPt, curPlayer, player.nation)); BOOST_TEST_REQUIRE(bld); this->BuildRoad(world.getNeighbour(hqPos, Direction::SouthEast), false, std::vector((milPt.x - hqPos.x), Direction::East)); @@ -590,7 +590,7 @@ void FlagWorkerTest(WorldWithGCExecution2P& worldFixture, Job workerJob, GoodTyp // Build road and let worker leave worldFixture.BuildRoad(flagPt, false, std::vector(3, Direction::West)); for(unsigned i = 0; i < 30; i++) - worldFixture.em.ExecuteNextGF(); + worldFixture.em.executeNextGF(); BOOST_TEST_REQUIRE(wh->getLeavingFigures().empty()); // Call one geologist to flag @@ -637,7 +637,7 @@ BOOST_FIXTURE_TEST_CASE(ChangeCoinAccept, WorldWithGCExecution2P) { const MapPoint bldPt = hqPos + MapPoint(3, 0); auto* bld = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, bldPt, curPlayer, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, bldPt, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(bld); BOOST_TEST_REQUIRE(!bld->isGoldDisabled()); //-V522 @@ -664,7 +664,7 @@ BOOST_FIXTURE_TEST_CASE(ChangeArmorAccept, WorldWithGCExecution2P) { const MapPoint bldPt = hqPos + MapPoint(3, 0); auto* bld = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, bldPt, curPlayer, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, bldPt, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(bld); BOOST_TEST_REQUIRE(bld->isArmorAllowed()); //-V522 @@ -691,7 +691,7 @@ BOOST_FIXTURE_TEST_CASE(DisableProduction, WorldWithGCExecution2P) { const MapPoint bldPt = hqPos + MapPoint(3, 0); auto* bld = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Forester, bldPt, curPlayer, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Forester, bldPt, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(bld); BOOST_TEST_REQUIRE(!bld->isProductionDisabled()); //-V522 @@ -725,11 +725,11 @@ void InitPactsAndPost(GameWorldBase& world) { for(unsigned i = 0; i < world.getNumPlayers(); i++) { - world.getPlayer(i).MakeStartPacts(); + world.getPlayer(i).makeStartPacts(); PostBox& box = *world.getPostMgr().getPostBox(i); const unsigned numMsgs = box.getNumMsgs(); for(unsigned j = 0; j < numMsgs; j++) - BOOST_TEST_REQUIRE(box.DeleteMsg(0u)); + BOOST_TEST_REQUIRE(box.deleteMsg(0u)); BOOST_TEST_REQUIRE(box.getNumMsgs() == 0u); } } @@ -743,7 +743,7 @@ BOOST_FIXTURE_TEST_CASE(NotifyAllies, WorldWithGCExecution3P) PostManager& postMgr = world.getPostMgr(); // Add postbox for each player for(unsigned i = 0; i < world.getNumPlayers(); i++) - postMgr.AddPostBox(i); + postMgr.addPostBox(i); // Choose middle player so we can observe side effects and off-by-one errors curPlayer = 1; @@ -822,24 +822,24 @@ BOOST_AUTO_TEST_CASE(InventorySettingType) // Reset and test toggle setting = InventorySetting(); - setting.Toggle(EInventorySetting::Stop); + setting.toggle(EInventorySetting::Stop); BOOST_TEST_REQUIRE(setting == EInventorySetting::Stop); - setting.Toggle(EInventorySetting::Send); + setting.toggle(EInventorySetting::Send); // Both set BOOST_TEST_REQUIRE(setting.isSet(EInventorySetting::Stop)); BOOST_TEST_REQUIRE(setting.isSet(EInventorySetting::Send)); BOOST_TEST_REQUIRE(!setting.isSet(EInventorySetting::Collect)); // Resets others - setting.Toggle(EInventorySetting::Collect); + setting.toggle(EInventorySetting::Collect); BOOST_TEST_REQUIRE(setting == EInventorySetting::Collect); // Resets collect - setting.Toggle(EInventorySetting::Stop); + setting.toggle(EInventorySetting::Stop); BOOST_TEST_REQUIRE(setting == EInventorySetting::Stop); // Enable send, disable stop - setting.Toggle(EInventorySetting::Send); - setting.Toggle(EInventorySetting::Stop); + setting.toggle(EInventorySetting::Send); + setting.toggle(EInventorySetting::Stop); BOOST_TEST_REQUIRE(setting == EInventorySetting::Send); } @@ -860,15 +860,15 @@ BOOST_FIXTURE_TEST_CASE(SetInventorySettingTest, WorldWithGCExecution2P) InventorySetting expectedSetting; BOOST_TEST_REQUIRE(wh->getInventorySetting(GoodType::Boards) == expectedSetting); //-V522 BOOST_TEST_REQUIRE(wh->getInventorySetting(Job::Private) == expectedSetting); - expectedSetting.Toggle(EInventorySetting::Stop); - expectedSetting.Toggle(EInventorySetting::Send); + expectedSetting.toggle(EInventorySetting::Stop); + expectedSetting.toggle(EInventorySetting::Send); this->SetInventorySetting(hqPos, GoodType::Boards, expectedSetting); BOOST_TEST_REQUIRE(wh->getInventorySetting(GoodType::Boards) == expectedSetting); this->SetInventorySetting(hqPos, Job::Private, expectedSetting); BOOST_TEST_REQUIRE(wh->getInventorySetting(Job::Private) == expectedSetting); - expectedSetting.Toggle(EInventorySetting::Collect); + expectedSetting.toggle(EInventorySetting::Collect); this->SetInventorySetting(hqPos, GoodType::Boards, expectedSetting); BOOST_TEST_REQUIRE(wh->getInventorySetting(GoodType::Boards) == expectedSetting); this->SetInventorySetting(hqPos, Job::Private, expectedSetting); @@ -914,7 +914,7 @@ BOOST_FIXTURE_TEST_CASE(SetInventorySettingTest, WorldWithGCExecution2P) numWoodcutters = wh->getNumRealFigures(Job::Woodcutter); MapPoint whPos = hqPos + MapPoint(3, 0); - BuildingFactory::CreateBuilding(world, BuildingType::Storehouse, whPos, curPlayer, Nation::Africans); + BuildingFactory::createBuilding(world, BuildingType::Storehouse, whPos, curPlayer, Nation::Africans); this->BuildRoad(wh->getFlagPos(), false, std::vector(3, Direction::East)); this->SetInventorySetting(hqPos, GoodType::Boards, EInventorySetting::Send); // Send some @@ -938,7 +938,7 @@ BOOST_FIXTURE_TEST_CASE(ChangeReserveTest, WorldWithGCExecution2P) // Add enough soldiers per rank for(auto i : SOLDIER_JOBS) soldiers[i] = 50; - wh->AddToInventory(soldiers, true); //-V522 + wh->addToInventory(soldiers, true); //-V522 // Use more for(unsigned i = 0; i < SOLDIER_JOBS.size(); i++) @@ -974,7 +974,7 @@ BOOST_FIXTURE_TEST_CASE(ChangeReserveTest, WorldWithGCExecution2P) } } -BOOST_FIXTURE_TEST_CASE(Armageddon, WorldWithGCExecution2P) +BOOST_FIXTURE_TEST_CASE(armageddon, WorldWithGCExecution2P) { GamePlayer& player1 = world.getPlayer(0); GamePlayer& player2 = world.getPlayer(1); diff --git a/tests/s25Main/integration/testGameEvents.cpp b/tests/s25Main/integration/testGameEvents.cpp index dd2a5d8ec3..bad0b13a8d 100644 --- a/tests/s25Main/integration/testGameEvents.cpp +++ b/tests/s25Main/integration/testGameEvents.cpp @@ -17,7 +17,7 @@ BOOST_AUTO_TEST_CASE(AdvanceGFs) BOOST_TEST_REQUIRE(evMgr.getCurrentGF() == 42u); for(unsigned gf = 43; gf < 50; gf++) { - evMgr.ExecuteNextGF(); + evMgr.executeNextGF(); BOOST_TEST_REQUIRE(evMgr.getCurrentGF() == gf); } } @@ -27,9 +27,9 @@ class TestEventHandler : public GameObject public: std::vector handledEventIds; - void HandleEvent(unsigned evId) override { handledEventIds.push_back(evId); } + void handleEvent(unsigned evId) override { handledEventIds.push_back(evId); } // LCOV_EXCL_START - void Destroy() override {} + void destroy() override {} void Serialize(SerializedGameData&) const override {} GO_Type getGOT() const final { return GO_Type::Staticobject; } // LCOV_EXCL_STOP @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE(AddAndExecuteEvent) TestEventManager evMgr(startGF); TestEventHandler obj; // Check that adding an event works and data is correctly set - const GameEvent* ev = evMgr.AddEvent(&obj, 5, 42); + const GameEvent* ev = evMgr.addEvent(&obj, 5, 42); BOOST_TEST_REQUIRE(ev->obj == &obj); BOOST_TEST_REQUIRE(ev->startGF == startGF); BOOST_TEST_REQUIRE(ev->length == 5u); @@ -49,22 +49,22 @@ BOOST_AUTO_TEST_CASE(AddAndExecuteEvent) BOOST_TEST_REQUIRE(ev->getTargetGF() == startGF + ev->length); BOOST_TEST(evMgr.isEventActive(obj, 42)); BOOST_TEST(!evMgr.isEventActive(obj, 43)); - BOOST_TEST(evMgr.ObjectHasEvents(obj)); + BOOST_TEST(evMgr.objectHasEvents(obj)); // Check that event is not executed before it is due for(unsigned i = startGF + 1; i < ev->getTargetGF(); i++) { - evMgr.ExecuteNextGF(); + evMgr.executeNextGF(); BOOST_TEST_REQUIRE(evMgr.getCurrentGF() == i); // Rechecked for clarity BOOST_TEST_REQUIRE(obj.handledEventIds.size() == 0u); } BOOST_TEST_REQUIRE(evMgr.getCurrentGF() + 1u == ev->getTargetGF()); // Now the event should be executed - evMgr.ExecuteNextGF(); + evMgr.executeNextGF(); BOOST_TEST_REQUIRE(obj.handledEventIds.size() == 1u); BOOST_TEST_REQUIRE(obj.handledEventIds.front() == 42u); // And nothing should be left BOOST_TEST(!evMgr.isEventActive(obj, 42)); - BOOST_TEST(!evMgr.ObjectHasEvents(obj)); + BOOST_TEST(!evMgr.objectHasEvents(obj)); } BOOST_AUTO_TEST_CASE(AddSuspendedEvent) @@ -73,17 +73,17 @@ BOOST_AUTO_TEST_CASE(AddSuspendedEvent) EventManager evMgr(startGF); TestEventHandler obj; // Add an event with length 50, where 48 GFs have already elapsed (2 left) - const GameEvent* ev = evMgr.AddEvent(&obj, 50, 42, 48); + const GameEvent* ev = evMgr.addEvent(&obj, 50, 42, 48); BOOST_TEST_REQUIRE(ev->obj == &obj); BOOST_TEST_REQUIRE(ev->startGF == startGF - 48u); // "Started" 48 GFs ago BOOST_TEST_REQUIRE(ev->length == 50u); BOOST_TEST_REQUIRE(ev->id == 42u); BOOST_TEST_REQUIRE(ev->getTargetGF() == startGF + 2); // Check that event is not executed before it is due - evMgr.ExecuteNextGF(); + evMgr.executeNextGF(); BOOST_TEST_REQUIRE(obj.handledEventIds.size() == 0u); // Now the event should be executed - evMgr.ExecuteNextGF(); + evMgr.executeNextGF(); BOOST_TEST_REQUIRE(obj.handledEventIds.size() == 1u); BOOST_TEST_REQUIRE(obj.handledEventIds.front() == 42u); } @@ -92,17 +92,17 @@ BOOST_AUTO_TEST_CASE(MultipleEvents) { EventManager evMgr(0); TestEventHandler obj; - evMgr.AddEvent(&obj, 5, 42); //-V525 - evMgr.AddEvent(&obj, 5, 43); - evMgr.AddEvent(&obj, 6, 44); + evMgr.addEvent(&obj, 5, 42); //-V525 + evMgr.addEvent(&obj, 5, 43); + evMgr.addEvent(&obj, 6, 44); // Execute first 2 events for(unsigned i = 1; i <= 5; i++) - evMgr.ExecuteNextGF(); + evMgr.executeNextGF(); BOOST_TEST_REQUIRE(obj.handledEventIds.size() == 2u); BOOST_TEST_REQUIRE(obj.handledEventIds[0] == 42u); BOOST_TEST_REQUIRE(obj.handledEventIds[1] == 43u); // And 3rd - evMgr.ExecuteNextGF(); + evMgr.executeNextGF(); BOOST_TEST_REQUIRE(obj.handledEventIds.size() == 3u); BOOST_TEST_REQUIRE(obj.handledEventIds[2] == 44u); } @@ -111,20 +111,20 @@ BOOST_AUTO_TEST_CASE(Reschedule) { TestEventManager evMgr(0); TestEventHandler obj; - const GameEvent* ev = evMgr.AddEvent(&obj, 5, 42); + const GameEvent* ev = evMgr.addEvent(&obj, 5, 42); // Run 3 of the 5 GFs for(unsigned i = 1; i <= 3; i++) - evMgr.ExecuteNextGF(); + evMgr.executeNextGF(); std::vector evts = evMgr.getObjEvents(obj); BOOST_TEST_REQUIRE(evts.size() == 1u); BOOST_TEST_REQUIRE(evts.front() == ev); // Execute at GF 7 instead - evMgr.RescheduleEvent(evts.front(), 7); + evMgr.rescheduleEvent(evts.front(), 7); for(unsigned i = 3; i <= 5; i++) - evMgr.ExecuteNextGF(); + evMgr.executeNextGF(); BOOST_TEST_REQUIRE(obj.handledEventIds.size() == 0u); for(unsigned i = 5; i <= 7; i++) - evMgr.ExecuteNextGF(); + evMgr.executeNextGF(); BOOST_TEST_REQUIRE(obj.handledEventIds.size() == 1u); } @@ -136,15 +136,15 @@ class TestLogKill final : public GameObject static unsigned killNum, destroyNum; ~TestLogKill() override { killNum++; } - void HandleEvent(unsigned /*evId*/) override + void handleEvent(unsigned /*evId*/) override { BOOST_TEST_REQUIRE(!em.isObjectInKillList(*this)); // Kill this on event - em.AddToKillList(this); + em.addToKillList(this); BOOST_TEST_REQUIRE(em.isObjectInKillList(*this)); } // LCOV_EXCL_START - void Destroy() override { destroyNum++; } + void destroy() override { destroyNum++; } void Serialize(SerializedGameData&) const override {} GO_Type getGOT() const final { return GO_Type::Staticobject; } // LCOV_EXCL_STOP @@ -157,13 +157,13 @@ BOOST_AUTO_TEST_CASE(KillList) { EventManager evMgr(0); auto* obj = new TestLogKill(evMgr); - evMgr.AddEvent(obj, 2); + evMgr.addEvent(obj, 2); // Nothing should happened yet - evMgr.ExecuteNextGF(); + evMgr.executeNextGF(); BOOST_TEST_REQUIRE(TestLogKill::killNum == 0u); BOOST_TEST_REQUIRE(TestLogKill::destroyNum == 0u); // And now it should be killed (destroy and delete) - evMgr.ExecuteNextGF(); + evMgr.executeNextGF(); BOOST_TEST_REQUIRE(TestLogKill::killNum == 1u); BOOST_TEST_REQUIRE(TestLogKill::destroyNum == 1u); BOOST_TEST_REQUIRE(!evMgr.isObjectInKillList(*obj)); @@ -176,37 +176,37 @@ class TestRemoveEvent : public TestEventHandler const GameEvent* ev2Remove; TestRemoveEvent(EventManager& em) : em(em), ev2Remove(nullptr) {} - void HandleEvent(unsigned evId) override + void handleEvent(unsigned evId) override { - TestEventHandler::HandleEvent(evId); + TestEventHandler::handleEvent(evId); if(evId == 42 && ev2Remove) { - em.RemoveEvent(ev2Remove); + em.removeEvent(ev2Remove); // Should be set to nullptr BOOST_TEST_REQUIRE(!ev2Remove); } } }; -BOOST_AUTO_TEST_CASE(RemoveEvent) +BOOST_AUTO_TEST_CASE(removeEvent) { EventManager evMgr(0); TestRemoveEvent obj(evMgr); - evMgr.AddEvent(&obj, 1, 42); - obj.ev2Remove = evMgr.AddEvent(&obj, 2, 43); + evMgr.addEvent(&obj, 1, 42); + obj.ev2Remove = evMgr.addEvent(&obj, 2, 43); // Execute time for both events. Only first should have fired - evMgr.ExecuteNextGF(); - evMgr.ExecuteNextGF(); + evMgr.executeNextGF(); + evMgr.executeNextGF(); BOOST_TEST_REQUIRE(obj.handledEventIds.size() == 1u); BOOST_TEST_REQUIRE(obj.handledEventIds.front() == 42u); // Try the same but with an event in the same GF - evMgr.AddEvent(&obj, 1, 42); - obj.ev2Remove = evMgr.AddEvent(&obj, 1, 43); - evMgr.ExecuteNextGF(); + evMgr.addEvent(&obj, 1, 42); + obj.ev2Remove = evMgr.addEvent(&obj, 1, 43); + evMgr.executeNextGF(); BOOST_TEST_REQUIRE(obj.handledEventIds.size() == 2u); BOOST_TEST_REQUIRE(obj.handledEventIds[1] == 42u); - BOOST_TEST(!evMgr.ObjectHasEvents(obj)); + BOOST_TEST(!evMgr.objectHasEvents(obj)); } #if RTTR_ENABLE_ASSERTS @@ -216,13 +216,13 @@ BOOST_AUTO_TEST_CASE(InvalidEvent) EventManager evMgr(100); TestEventHandler obj; // Need object - RTTR_REQUIRE_ASSERT(evMgr.AddEvent(nullptr, 1)); + RTTR_REQUIRE_ASSERT(evMgr.addEvent(nullptr, 1)); // Length must be > 0 - RTTR_REQUIRE_ASSERT(evMgr.AddEvent(&obj, 0)); + RTTR_REQUIRE_ASSERT(evMgr.addEvent(&obj, 0)); // ... even for continued events - RTTR_REQUIRE_ASSERT(evMgr.AddEvent(nullptr, 50, 0, 50)); + RTTR_REQUIRE_ASSERT(evMgr.addEvent(nullptr, 50, 0, 50)); // continued event cannot start before the game - RTTR_REQUIRE_ASSERT(evMgr.AddEvent(nullptr, 200, 0, 150)); + RTTR_REQUIRE_ASSERT(evMgr.addEvent(nullptr, 200, 0, 150)); } #endif diff --git a/tests/s25Main/integration/testGamePlayer.cpp b/tests/s25Main/integration/testGamePlayer.cpp index 13877a461c..f51294c20a 100644 --- a/tests/s25Main/integration/testGamePlayer.cpp +++ b/tests/s25Main/integration/testGamePlayer.cpp @@ -28,20 +28,20 @@ BOOST_FIXTURE_TEST_CASE(Defeat, WorldFixtureEmpty2P) BOOST_TEST_REQUIRE(!world.getPlayer(0).IsDefeated()); BOOST_TEST_REQUIRE(!world.getPlayer(1).IsDefeated()); // Destroy HQ -> defeated - world.DestroyNO(world.getPlayer(1).getHQPos()); //-V522 + world.destroyNO(world.getPlayer(1).getHQPos()); //-V522 BOOST_TEST_REQUIRE(!world.getPlayer(0).IsDefeated()); BOOST_TEST_REQUIRE(world.getPlayer(1).IsDefeated()); // Destroy HQ but leave a military bld - MapPoint milBldPos = world.MakeMapPoint(world.getPlayer(0).getFirstWH()->getPos() + Position(4, 0)); //-V522 + MapPoint milBldPos = world.makeMapPoint(world.getPlayer(0).getFirstWH()->getPos() + Position(4, 0)); //-V522 auto* milBld = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, milBldPos, 0, Nation::Babylonians)); - auto& sld = world.AddFigure(milBldPos, std::make_unique(milBldPos, 0, milBld, milBld, 0)); - milBld->GotWorker(Job::Private, sld); - sld.WalkToGoal(); - world.DestroyNO(world.getPlayer(0).getHQPos()); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, milBldPos, 0, Nation::Babylonians)); + auto& sld = world.addFigure(milBldPos, std::make_unique(milBldPos, 0, milBld, milBld, 0)); + milBld->gotWorker(Job::Private, sld); + sld.walkToGoal(); + world.destroyNO(world.getPlayer(0).getHQPos()); BOOST_TEST_REQUIRE(!world.getPlayer(0).IsDefeated()); // Destroy this -> defeated - world.DestroyNO(milBldPos); + world.destroyNO(milBldPos); BOOST_TEST_REQUIRE(world.getPlayer(0).IsDefeated()); } @@ -74,9 +74,9 @@ struct MineProductivityFixture : WorldFixture( - BuildingFactory::CreateBuilding(world, BuildingType::CoalMine, minePos, 0, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::CoalMine, minePos, 0, Nation::Romans)); // Clear resources in the radius explicitly. for(const MapPoint pt : world.GetPointsInRadiusWithCenter(minePos, MINER_RADIUS)) world.setResource(pt, Resource()); @@ -110,8 +110,8 @@ BOOST_FIXTURE_TEST_CASE(ProductivityStats, WorldFixtureEmpty1P) using boost::test_tools::per_element; const auto& buildingRegister = world.getPlayer(0).getBuildingRegister(); helpers::EnumArray expectedProductivity{}; - BOOST_TEST(buildingRegister.CalcProductivities() == expectedProductivity, per_element()); - BOOST_TEST(buildingRegister.CalcAverageProductivity() == 0u); + BOOST_TEST(buildingRegister.calcProductivities() == expectedProductivity, per_element()); + BOOST_TEST(buildingRegister.calcAverageProductivity() == 0u); const auto buildingTypesEnum = helpers::EnumRange{}; std::vector buildingTypes(buildingTypesEnum.begin(), buildingTypesEnum.end()); @@ -135,7 +135,7 @@ BOOST_FIXTURE_TEST_CASE(ProductivityStats, WorldFixtureEmpty1P) // Size checks (in x) only for safety. Should never fail due to construction of map size while(world.getNode(curPos).bq != BuildingQuality::Castle) BOOST_TEST_REQUIRE((++curPos.x) < world.getSize().x); - bld = BuildingFactory::CreateBuilding(world, bldType, curPos, 0, Nation::Babylonians); + bld = BuildingFactory::createBuilding(world, bldType, curPos, 0, Nation::Babylonians); BOOST_TEST_REQUIRE((curPos.x += 2) < world.getSize().x); } // Test productivity calculation for all buildings shown in the productivity window @@ -148,17 +148,17 @@ BOOST_FIXTURE_TEST_CASE(ProductivityStats, WorldFixtureEmpty1P) expectedProductivity[bldType] = productivity; } } - BOOST_TEST(buildingRegister.CalcProductivities() == expectedProductivity, per_element()); + BOOST_TEST(buildingRegister.calcProductivities() == expectedProductivity, per_element()); unsigned avgProd = std::accumulate(expectedProductivity.begin(), expectedProductivity.end(), 0u) / iwBuildingProductivities::allIcons.size(); - BOOST_TEST(buildingRegister.CalcAverageProductivity() == avgProd); + BOOST_TEST(buildingRegister.calcAverageProductivity() == avgProd); // Average productivity over multiple buildings of same type avgProd = 0; for(const BuildingType bldType : iwBuildingProductivities::allIcons) { auto* bld = - static_cast(BuildingFactory::CreateBuilding(world, bldType, curPos, 0, Nation::Babylonians)); + static_cast(BuildingFactory::createBuilding(world, bldType, curPos, 0, Nation::Babylonians)); if((curPos.x += 2) >= world.getSize().x) curPos = MapPoint(0, curPos.y + 2); const auto productivity = rttr::test::randomValue(1, 100); @@ -167,8 +167,8 @@ BOOST_FIXTURE_TEST_CASE(ProductivityStats, WorldFixtureEmpty1P) expectedProductivity[bldType] = (productivity + expectedProductivity[bldType]) / 2; } avgProd /= iwBuildingProductivities::allIcons.size() * 2; - BOOST_TEST(buildingRegister.CalcProductivities() == expectedProductivity, per_element()); - BOOST_TEST(buildingRegister.CalcAverageProductivity() == avgProd); + BOOST_TEST(buildingRegister.calcProductivities() == expectedProductivity, per_element()); + BOOST_TEST(buildingRegister.calcAverageProductivity() == avgProd); } BOOST_FIXTURE_TEST_CASE(MineProductivityAccountsForS4LikeResourceChance, MineProductivityFixture) @@ -191,7 +191,7 @@ BOOST_FIXTURE_TEST_CASE(MineProductivityAccountsForS4LikeResourceChance, MinePro // Lowering the base productivity scales the result by the same factor: 80% of the 50% chance -> 40%. setProductivity(coalMine, 80); BOOST_TEST(coalMine->getProductivity() == 40u); - BOOST_TEST(world.getPlayer(0).getBuildingRegister().CalcProductivities()[BuildingType::CoalMine] == 40u); + BOOST_TEST(world.getPlayer(0).getBuildingRegister().calcProductivities()[BuildingType::CoalMine] == 40u); // No resources left -> no production. setProductivity(coalMine, 100); setCoalAmounts(0, 0); @@ -211,7 +211,7 @@ BOOST_FIXTURE_TEST_CASE(MineProductivityUsesAllMatchingResourcesWithinMineRadius // A different resource type in range and matching coal just outside the radius must not count as coal. world.setResource(world.getNeighbour(minePos, Direction::NorthWest), Resource(ResourceType::Iron, 15)); - const MapPoint outOfRangePt = world.MakeMapPoint(minePos + Position(MINER_RADIUS + 1, 0)); + const MapPoint outOfRangePt = world.makeMapPoint(minePos + Position(MINER_RADIUS + 1, 0)); world.setResource(outOfRangePt, Resource(ResourceType::Coal, 15)); BOOST_TEST(getRemainingMineResources(world, minePos, ResourceType::Coal) == 0u); BOOST_TEST(coalMine->getProductivity() == 0u); @@ -221,7 +221,7 @@ BOOST_FIXTURE_TEST_CASE(MineProductivityUsesAllMatchingResourcesWithinMineRadius spreadCoalInRadius(S4LIKE_FULL_PRODUCTIVITY_AMOUNT / 2); BOOST_TEST(getRemainingMineResources(world, minePos, ResourceType::Coal) == 10u); BOOST_TEST(coalMine->getProductivity() == 50u); - BOOST_TEST(world.getPlayer(0).getBuildingRegister().CalcProductivities()[BuildingType::CoalMine] == 50u); + BOOST_TEST(world.getPlayer(0).getBuildingRegister().calcProductivities()[BuildingType::CoalMine] == 50u); } BOOST_FIXTURE_TEST_CASE(IsHQTent_ReturnsFalse_IfPrimaryHQIsNotTent, WorldFixtureEmpty1P) @@ -232,7 +232,7 @@ BOOST_FIXTURE_TEST_CASE(IsHQTent_ReturnsFalse_IfPrimaryHQIsNotTent, WorldFixture MapPoint newHqPos = p1.getHQPos(); newHqPos.x += 3; static_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Headquarters, newHqPos, 0, Nation::Babylonians)) + BuildingFactory::createBuilding(world, BuildingType::Headquarters, newHqPos, 0, Nation::Babylonians)) ->setIsTent(true); BOOST_TEST_REQUIRE(p1.isHQTent() == false); @@ -247,7 +247,7 @@ BOOST_FIXTURE_TEST_CASE(IsHQTent_ReturnsTrue_IfPrimaryHQIsTent, WorldFixtureEmpt MapPoint newHqPos = p1.getHQPos(); newHqPos.x += 3; static_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Headquarters, newHqPos, 0, Nation::Babylonians)) + BuildingFactory::createBuilding(world, BuildingType::Headquarters, newHqPos, 0, Nation::Babylonians)) ->setIsTent(false); BOOST_TEST_REQUIRE(p1.isHQTent() == true); diff --git a/tests/s25Main/integration/testGameWorldView.cpp b/tests/s25Main/integration/testGameWorldView.cpp index aa800c2c7e..40b5d27a96 100644 --- a/tests/s25Main/integration/testGameWorldView.cpp +++ b/tests/s25Main/integration/testGameWorldView.cpp @@ -35,7 +35,7 @@ BOOST_FIXTURE_TEST_CASE(HasCorrectDrawCoords, EmptyWorldFixture1P) const auto origLastPt = view.getLastPt(); auto newOffset = rttr::test::randomPoint(100, 200); BOOST_TEST_REQUIRE(view.getOffset() == DrawPoint(0, 0)); - view.MoveTo(newOffset); + view.moveTo(newOffset); BOOST_TEST_REQUIRE(view.getOffset() == newOffset); const auto offsetFirstPt = view.getFirstPt(); const auto offsetLastPt = view.getLastPt(); @@ -46,7 +46,7 @@ BOOST_FIXTURE_TEST_CASE(HasCorrectDrawCoords, EmptyWorldFixture1P) // Relative move { const auto offset = rttr::test::randomPoint(-100, 70); // Smallish max offset to not exceed map size - view.MoveBy(offset); + view.moveBy(offset); BOOST_TEST_REQUIRE(view.getOffset() == newOffset + offset); } @@ -54,26 +54,26 @@ BOOST_FIXTURE_TEST_CASE(HasCorrectDrawCoords, EmptyWorldFixture1P) { const DrawPoint drawSize(world.getSize() * DrawPoint(TR_W, TR_H)); // Absolute - view.MoveTo(newOffset + drawSize); + view.moveTo(newOffset + drawSize); BOOST_TEST_REQUIRE(view.getOffset() == newOffset); // Relative +- - view.MoveBy(drawSize); + view.moveBy(drawSize); BOOST_TEST_REQUIRE(view.getOffset() == newOffset); - view.MoveBy(drawSize); + view.moveBy(drawSize); BOOST_TEST_REQUIRE(view.getOffset() == newOffset); // Absolute by multiples of the size const auto offset = rttr::test::randomPoint(1, 10); - view.MoveTo(newOffset + (drawSize * rttr::test::randomPoint(2, 5)) + offset); + view.moveTo(newOffset + (drawSize * rttr::test::randomPoint(2, 5)) + offset); BOOST_TEST_REQUIRE(view.getOffset() == newOffset + offset); } // Move back to start restores first/last points - view.MoveTo({0, 0}); + view.moveTo({0, 0}); BOOST_TEST_REQUIRE(view.getOffset() == DrawPoint(0, 0)); BOOST_TEST(view.getFirstPt() == origFirstPt); BOOST_TEST(view.getLastPt() == origLastPt); // Relative move also updates first/last point - view.MoveBy(newOffset); + view.moveBy(newOffset); BOOST_TEST_REQUIRE(view.getOffset() == newOffset); BOOST_TEST(view.getFirstPt() == offsetFirstPt); BOOST_TEST(view.getLastPt() == offsetLastPt); @@ -99,8 +99,8 @@ BOOST_FIXTURE_TEST_CASE(GetsCorrectMaxHeight, EmptyWorldFixture1P) BOOST_TEST(view2.getLastPt().y > view.getLastPt().y); // Should have increased due to higher altitude // React on height changes, at least after moves - world.ChangeAltitude(MapPoint(0, 0), newMaxHeight); - view.MoveBy(DrawPoint(0, 0)); // no-op move + world.changeAltitude(MapPoint(0, 0), newMaxHeight); + view.moveBy(DrawPoint(0, 0)); // no-op move BOOST_TEST(gwv.getMaxNodeAltitude() == newMaxHeight); BOOST_TEST(view.getFirstPt() == view2.getFirstPt()); BOOST_TEST(view.getLastPt() == view2.getLastPt()); diff --git a/tests/s25Main/integration/testHarbor.cpp b/tests/s25Main/integration/testHarbor.cpp index 66c0dc4ecb..9b24e29511 100644 --- a/tests/s25Main/integration/testHarbor.cpp +++ b/tests/s25Main/integration/testHarbor.cpp @@ -16,7 +16,7 @@ struct HarborFixture : WorldFixture { GamePlayer& player = world.getPlayer(0); hq = world.getSpecObj(player.getHQPos()); - hb = static_cast(BuildingFactory::CreateBuilding( + hb = static_cast(BuildingFactory::createBuilding( world, BuildingType::HarborBuilding, player.getHQPos() + MapPoint(4, 0), 0, Nation::Romans)); world.BuildRoad(0, false, hq->getFlagPos(), {4, Direction::East}); } @@ -31,10 +31,10 @@ BOOST_FIXTURE_TEST_CASE(StartExpeditionThenCancel, HarborFixture) addStartResources(); BOOST_TEST_REQUIRE(hq->getNumRealFigures(Job::Builder) >= 1u); // Must have a builder const auto numLeavingFigs = hq->getLeavingFigures().size(); - hb->StartExpedition(); + hb->startExpedition(); // Builder should be ordered BOOST_TEST_REQUIRE(hq->getLeavingFigures().size() == numLeavingFigs + 1u); - hb->StopExpedition(); + hb->stopExpedition(); // Builder should still come BOOST_TEST_REQUIRE(hq->getLeavingFigures().size() == numLeavingFigs + 1u); } @@ -44,7 +44,7 @@ BOOST_FIXTURE_TEST_CASE(StartExpeditionThenDestroy, HarborFixture) addStartResources(); BOOST_TEST_REQUIRE(hq->getNumRealFigures(Job::Builder) >= 1u); // Must have a builder const auto numLeavingFigs = hq->getLeavingFigures().size(); - hb->StartExpedition(); + hb->startExpedition(); // Builder should be ordered BOOST_TEST_REQUIRE(hq->getLeavingFigures().size() == numLeavingFigs + 1u); world.DestroyBuilding(hb->getPos(), 0); diff --git a/tests/s25Main/integration/testHeadlessReplay.cpp b/tests/s25Main/integration/testHeadlessReplay.cpp index 146bfa6336..45461070f7 100644 --- a/tests/s25Main/integration/testHeadlessReplay.cpp +++ b/tests/s25Main/integration/testHeadlessReplay.cpp @@ -20,25 +20,25 @@ BOOST_AUTO_TEST_CASE(ReplayWithCommandOutOfOrderIsRejected) MapInfo mapInfo; mapInfo.type = MapType::OldMap; mapInfo.filepath = rttr::test::rttrBaseDir / "tests" / "testData" / "maps" / "LuaFunctions.SWD"; - BOOST_TEST_REQUIRE(mapInfo.mapData.CompressFromFile(mapInfo.filepath)); + BOOST_TEST_REQUIRE(mapInfo.mapData.compressFromFile(mapInfo.filepath)); PlayerInfo player; player.ps = PlayerState::AI; Replay replay; - replay.AddPlayer(player); + replay.addPlayer(player); TmpFile replayFile(".rpl"); BOOST_TEST_REQUIRE(replayFile.isValid()); replayFile.close(); boost::filesystem::remove(replayFile.filePath); // Recording refuses to overwrite - BOOST_TEST_REQUIRE(replay.StartRecording(replayFile.filePath, mapInfo, 42)); + BOOST_TEST_REQUIRE(replay.startRecording(replayFile.filePath, mapInfo, 42)); const PlayerGameCommands noCmds; - replay.AddGameCommand(10, 0, noCmds); - replay.AddGameCommand(5, 0, noCmds); - replay.UpdateLastGF(20); - BOOST_TEST_REQUIRE(replay.StopRecording()); + replay.addGameCommand(10, 0, noCmds); + replay.addGameCommand(5, 0, noCmds); + replay.updateLastGF(20); + BOOST_TEST_REQUIRE(replay.stopRecording()); HeadlessReplay headlessReplay(replayFile.filePath); - BOOST_CHECK_THROW(headlessReplay.Run(), std::runtime_error); + BOOST_CHECK_THROW(headlessReplay.run(), std::runtime_error); BOOST_TEST(headlessReplay.getCurrentGF() == 11u); } diff --git a/tests/s25Main/integration/testPacts.cpp b/tests/s25Main/integration/testPacts.cpp index 2c5c6ecdeb..44902384b0 100644 --- a/tests/s25Main/integration/testPacts.cpp +++ b/tests/s25Main/integration/testPacts.cpp @@ -93,7 +93,7 @@ void CheckPactState(const GameWorldBase& world, unsigned playerIdFrom, unsigned BOOST_FIXTURE_TEST_CASE(MakePactTest, WorldWithGCExecution3P, *utf::depends_on("PactTestSuite/InitialPactStates")) { for(unsigned i = 0; i < world.getNumPlayers(); i++) - world.getPostMgr().AddPostBox(i); + world.getPostMgr().addPostBox(i); // Use middle player for off-by-one detection curPlayer = 1; GamePlayer& player1 = world.getPlayer(1); @@ -149,7 +149,7 @@ struct PactCreatedFixture : public WorldWithGCExecution3P PactCreatedFixture() { for(unsigned i = 0; i < world.getNumPlayers(); i++) - world.getPostMgr().AddPostBox(i); + world.getPostMgr().addPostBox(i); // Use middle player for off-by-one detection curPlayer = 1; PostBox& postbox2 = *world.getPostMgr().getPostBox(2); @@ -179,8 +179,8 @@ BOOST_FIXTURE_TEST_CASE(PactDurationTest, PactCreatedFixture, *utf::depends_on(" this->AcceptPact(msg->getPactId(), PactType::NonAgressionPact, msg->getPlayerId()); BOOST_TEST_REQUIRE(player1.getRemainingPactTime(PactType::NonAgressionPact, 2) == duration - i); // Advance 1 GF and test pacts - em.ExecuteNextGF(); - player1.TestPacts(); + em.executeNextGF(); + player1.testPacts(); } // On last GF the pact expired BOOST_TEST(player1.getRemainingPactTime(PactType::NonAgressionPact, 2) == 0u); @@ -191,8 +191,8 @@ BOOST_FIXTURE_TEST_CASE(PactCanceling, PactCreatedFixture, *utf::depends_on("Pac { PostBox& postbox1 = *world.getPostMgr().getPostBox(1); PostBox& postbox2 = *world.getPostMgr().getPostBox(2); - postbox1.Clear(); - postbox2.Clear(); + postbox1.clear(); + postbox2.clear(); curPlayer = 2; this->CancelPact(PactType::NonAgressionPact, 1); @@ -236,13 +236,13 @@ BOOST_FIXTURE_TEST_CASE(SuggestNewPactAfterExpiration, PactCreatedFixture, { GamePlayer& player1 = world.getPlayer(1); PostBox& postbox2 = *world.getPostMgr().getPostBox(2); - postbox2.Clear(); + postbox2.clear(); // Execute the GFs until the pact is expired for(unsigned i = 0; i < duration; i++) { - em.ExecuteNextGF(); - player1.TestPacts(); + em.executeNextGF(); + player1.testPacts(); } // On last GF the pact expired. Suggest new pact. diff --git a/tests/s25Main/integration/testPathfinding.cpp b/tests/s25Main/integration/testPathfinding.cpp index 3f7e79f20c..177f47d4c9 100644 --- a/tests/s25Main/integration/testPathfinding.cpp +++ b/tests/s25Main/integration/testPathfinding.cpp @@ -89,10 +89,10 @@ BOOST_FIXTURE_TEST_CASE(WalkStraight, WorldFixtureEmpty0P) endPt = world.getNeighbour(endPt, dir); unsigned length; // Must be able to go there directly - BOOST_TEST_REQUIRE(world.FindHumanPath(startPt, endPt, 99, false, &length)); + BOOST_TEST_REQUIRE(world.findHumanPath(startPt, endPt, 99, false, &length)); BOOST_TEST_REQUIRE(length == 3u); // Inverse route - BOOST_TEST_REQUIRE(world.FindHumanPath(endPt, startPt, 99, false, &length)); + BOOST_TEST_REQUIRE(world.findHumanPath(endPt, startPt, 99, false, &length)); BOOST_TEST_REQUIRE(length == 3u); } } @@ -106,18 +106,18 @@ BOOST_FIXTURE_TEST_CASE(WalkAlongCoast, WorldFixtureEmpty0P) setupTestcase1(world, startPt, tWater, tLand); // 4 steps right - MapPoint endPt = world.MakeMapPoint(Position(startPt.x + 4, startPt.y)); + MapPoint endPt = world.makeMapPoint(Position(startPt.x + 4, startPt.y)); unsigned length; std::vector route; // Forward route - BOOST_TEST_REQUIRE(world.FindHumanPath(startPt, endPt, 99, false, &length, &route)); + BOOST_TEST_REQUIRE(world.findHumanPath(startPt, endPt, 99, false, &length, &route)); BOOST_TEST_REQUIRE(length == 6u); BOOST_TEST_REQUIRE(route.size() == 6u); const std::vector expectedRoute{Direction::NorthEast, Direction::SouthEast, Direction::SouthEast, Direction::NorthEast, Direction::East, Direction::East}; BOOST_TEST_REQUIRE(route == expectedRoute, boost::test_tools::per_element()); // Inverse route - BOOST_TEST_REQUIRE(world.FindHumanPath(endPt, startPt, 99, false, &length, &route)); + BOOST_TEST_REQUIRE(world.findHumanPath(endPt, startPt, 99, false, &length, &route)); BOOST_TEST_REQUIRE(length == 6u); BOOST_TEST_REQUIRE(route.size() == 6u); std::vector expectedRevRoute; @@ -154,10 +154,10 @@ BOOST_FIXTURE_TEST_CASE(CrossTerrain, WorldFixtureEmpty1P) endPt = world.getNeighbour(endPt, dir); // We can't go directly so 1 step detour unsigned length; - BOOST_TEST_REQUIRE(world.FindHumanPath(startPt, endPt, 99, false, &length)); + BOOST_TEST_REQUIRE(world.findHumanPath(startPt, endPt, 99, false, &length)); BOOST_TEST_REQUIRE(length == 4u); // Inverse route - BOOST_TEST_REQUIRE(world.FindHumanPath(endPt, startPt, 99, false, &length)); + BOOST_TEST_REQUIRE(world.findHumanPath(endPt, startPt, 99, false, &length)); BOOST_TEST_REQUIRE(length == 4u); // But road must be constructible world.SetFlag(startPt, 0); @@ -209,10 +209,10 @@ BOOST_FIXTURE_TEST_CASE(DontPassTerrain, WorldFixtureEmpty1P) for(int i = 0; i < 2; i++) { unsigned length; - BOOST_TEST_REQUIRE(world.FindHumanPath(curStartPt, endPt, 99, false, &length)); + BOOST_TEST_REQUIRE(world.findHumanPath(curStartPt, endPt, 99, false, &length)); BOOST_TEST_REQUIRE(length == 4u); // Inverse route - BOOST_TEST_REQUIRE(world.FindHumanPath(endPt, curStartPt, 99, false, &length)); + BOOST_TEST_REQUIRE(world.findHumanPath(endPt, curStartPt, 99, false, &length)); BOOST_TEST_REQUIRE(length == 4u); // No road must be constructible world.SetFlag(startPt, 0); @@ -248,10 +248,10 @@ BOOST_FIXTURE_TEST_CASE(BlockedPaths, WorldFixtureEmpty0P) for(unsigned i = 0; i < 12; i++) surroundingPts2.push_back(world.getNeighbour2(startPt, i)); for(const MapPoint& pt : surroundingPts2) - BOOST_TEST_REQUIRE(!world.FindHumanPath(startPt, pt)); + BOOST_TEST_REQUIRE(!world.findHumanPath(startPt, pt)); // Allow left exit - world.DestroyNO(surroundingPts[0]); - BOOST_TEST_REQUIRE(world.FindHumanPath(startPt, surroundingPts2[0])); + world.destroyNO(surroundingPts[0]); + BOOST_TEST_REQUIRE(world.findHumanPath(startPt, surroundingPts2[0])); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/integration/testProduction.cpp b/tests/s25Main/integration/testProduction.cpp index 7a9cba9cdf..2735e1afa2 100644 --- a/tests/s25Main/integration/testProduction.cpp +++ b/tests/s25Main/integration/testProduction.cpp @@ -51,16 +51,16 @@ struct MineProductionFixture : WorldWithGCExecution1P inv[GoodType::Fish] = 40; inv[GoodType::PickAxe] = 1; inv[Job::Miner] = 1; - world.getSpecObj(hqPos)->AddToInventory(inv, true); + world.getSpecObj(hqPos)->addToInventory(inv, true); } // Places a mine of the given type next to the HQ, optionally seeds its resource spot, connects it by road and // waits until the miner has moved in. Returns the mine position. - MapPoint CreateMine(const BuildingType mineType, const Resource initialResource = Resource()) + MapPoint createMine(const BuildingType mineType, const Resource initialResource = Resource()) { const MapPoint minePos = hqPos + MapPoint(2, 0); const auto* mine = - static_cast(BuildingFactory::CreateBuilding(world, mineType, minePos, curPlayer, Nation::Romans)); + static_cast(BuildingFactory::createBuilding(world, mineType, minePos, curPlayer, Nation::Romans)); if(initialResource.getType() != ResourceType::Nothing) world.getNodeWriteable(minePos).resources = initialResource; BuildRoad(world.getNeighbour(minePos, Direction::SouthEast), false, std::vector(2, Direction::West)); @@ -68,7 +68,7 @@ struct MineProductionFixture : WorldWithGCExecution1P return minePos; } - static void SeedProductionRng(const unsigned seed) { RANDOM.Init(seed); } + static void seedProductionRng(const unsigned seed) { RANDOM.Init(seed); } }; // One S4-like "no output" fallback scenario: a nearly exhausted mine that keeps working but usually mines nothing, @@ -95,13 +95,13 @@ BOOST_FIXTURE_TEST_CASE(MetalWorkerStopped, WorldWithGCExecution1P) rttr::test::LogAccessor logAcc; ggs.setSelection(AddonId::TOOL_ORDERING, 1); ggs.setSelection(AddonId::METALWORKSBEHAVIORONZERO, 1); - world.getSpecObj(hqPos)->AddToInventory(GoodCounts::make(GoodType::Iron, 10), true); + world.getSpecObj(hqPos)->addToInventory(GoodCounts::make(GoodType::Iron, 10), true); MapPoint bldPos = hqPos + MapPoint(2, 0); - BuildingFactory::CreateBuilding(world, BuildingType::Metalworks, bldPos, curPlayer, Nation::Africans); + BuildingFactory::createBuilding(world, BuildingType::Metalworks, bldPos, curPlayer, Nation::Africans); this->BuildRoad(world.getNeighbour(bldPos, Direction::SouthEast), false, std::vector(2, Direction::West)); MapPoint bldPos2 = hqPos - MapPoint(2, 0); - BuildingFactory::CreateBuilding(world, BuildingType::Metalworks, bldPos2, curPlayer, Nation::Africans); + BuildingFactory::createBuilding(world, BuildingType::Metalworks, bldPos2, curPlayer, Nation::Africans); this->BuildRoad(world.getNeighbour(bldPos2, Direction::SouthEast), false, std::vector(2, Direction::East)); @@ -116,13 +116,13 @@ BOOST_FIXTURE_TEST_CASE(MetalWorkerStopped, WorldWithGCExecution1P) toolOrder[Tool::Tongs] = 1; toolOrder[Tool::Cleaver] = 1; toolOrder[Tool::Rollingpin] = 1; - PostBox& postbox = world.getPostMgr().AddPostBox(0); - postbox.Clear(); + PostBox& postbox = world.getPostMgr().addPostBox(0); + postbox.clear(); const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); Inventory expectedInventory = curInventory; - expectedInventory.Add(GoodType::Tongs, toolOrder[Tool::Tongs]); - expectedInventory.Add(GoodType::Cleaver, toolOrder[Tool::Cleaver]); - expectedInventory.Add(GoodType::Rollingpin, toolOrder[Tool::Rollingpin]); + expectedInventory.add(GoodType::Tongs, toolOrder[Tool::Tongs]); + expectedInventory.add(GoodType::Cleaver, toolOrder[Tool::Cleaver]); + expectedInventory.add(GoodType::Rollingpin, toolOrder[Tool::Rollingpin]); // Place order this->ChangeTools(toolSettings, toolOrder.data()); RTTR_REQUIRE_LOG_CONTAINS("Committing an order", true); @@ -144,7 +144,7 @@ BOOST_FIXTURE_TEST_CASE(MetalWorkerOrders, WorldWithGCExecution1P) inv[GoodType::Stones] = 20; inv[GoodType::Iron] = 10; inv[Job::Metalworker] = 1; - world.getSpecObj(hqPos)->AddToInventory(inv, true); + world.getSpecObj(hqPos)->addToInventory(inv, true); ggs.setSelection(AddonId::METALWORKSBEHAVIORONZERO, 1); ggs.setSelection(AddonId::TOOL_ORDERING, 1); ToolSettings settings; @@ -152,7 +152,7 @@ BOOST_FIXTURE_TEST_CASE(MetalWorkerOrders, WorldWithGCExecution1P) this->ChangeTools(settings); MapPoint housePos(hqPos.x + 3, hqPos.y); const nobUsual* mw = static_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Metalworks, housePos, curPlayer, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Metalworks, housePos, curPlayer, Nation::Romans)); MapPoint flagPos = world.getNeighbour(hqPos, Direction::SouthEast); this->BuildRoad(flagPos, false, std::vector(3, Direction::East)); RTTR_EXEC_TILL(200, mw->hasWorker()); @@ -173,7 +173,7 @@ BOOST_FIXTURE_TEST_CASE(MetalWorkerOrders, WorldWithGCExecution1P) // both keep needing an actual resource spot. Depletion/production here is deterministic, so no RNG seed is needed. BOOST_FIXTURE_TEST_CASE(GraniteMineWithoutResourcesNeedsAddon, MineProductionFixture) { - CreateMine(BuildingType::GraniteMine); + createMine(BuildingType::GraniteMine); const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialStones = curInventory[GoodType::Stones]; @@ -186,7 +186,7 @@ BOOST_FIXTURE_TEST_CASE(InexhaustibleGraniteMineStillNeedsResourceSpot, MineProd { ggs.setSelection(AddonId::GRANITEMINE_RESOURCE_BEHAVIOR, static_cast(MineResourceBehavior::Inexhaustible)); - CreateMine(BuildingType::GraniteMine); + createMine(BuildingType::GraniteMine); const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialStones = curInventory[GoodType::Stones]; @@ -199,7 +199,7 @@ BOOST_FIXTURE_TEST_CASE(GraniteMineWorkEverywhereProducesWithoutCreatingResource { ggs.setSelection(AddonId::GRANITEMINE_RESOURCE_BEHAVIOR, static_cast(MineResourceBehavior::WorkEverywhere)); - const MapPoint minePos = CreateMine(BuildingType::GraniteMine); + const MapPoint minePos = createMine(BuildingType::GraniteMine); const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialStones = curInventory[GoodType::Stones]; @@ -216,7 +216,7 @@ BOOST_FIXTURE_TEST_CASE(GraniteMineWorkEverywhereIgnoresExistingResource, MinePr static_cast(MineResourceBehavior::WorkEverywhere)); // A granite mine on a foreign (coal) deposit still just makes stones and leaves the deposit untouched. const Resource foreignDeposit(ResourceType::Coal, 4); - const MapPoint minePos = CreateMine(BuildingType::GraniteMine, foreignDeposit); + const MapPoint minePos = createMine(BuildingType::GraniteMine, foreignDeposit); const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialStones = curInventory[GoodType::Stones]; @@ -229,7 +229,7 @@ BOOST_FIXTURE_TEST_CASE(CoalMineInexhaustibleBehaviorDoesNotDepleteResource, Min { ggs.setSelection(AddonId::COALMINE_RESOURCE_BEHAVIOR, static_cast(MineResourceBehavior::Inexhaustible)); const Resource initCoal(ResourceType::Coal, 4); - const MapPoint minePos = CreateMine(BuildingType::CoalMine, initCoal); + const MapPoint minePos = createMine(BuildingType::CoalMine, initCoal); const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialCoal = curInventory[GoodType::Coal]; @@ -246,11 +246,11 @@ BOOST_FIXTURE_TEST_CASE(CoalMineS4LikeExhaustionCanProduceNothing, MineProductio { ggs.setSelection(AddonId::COALMINE_RESOURCE_BEHAVIOR, static_cast(MineResourceBehavior::S4LikeExhaustion)); - const MapPoint minePos = CreateMine(BuildingType::CoalMine, Resource(ResourceType::Coal, 1)); + const MapPoint minePos = createMine(BuildingType::CoalMine, Resource(ResourceType::Coal, 1)); const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialCoal = curInventory[GoodType::Coal]; - SeedProductionRng(s4LikeComparisonSeed); + seedProductionRng(s4LikeComparisonSeed); RTTR_SKIP_GFS(s4LikeComparisonGFs); BOOST_TEST(curInventory[GoodType::Coal] == initialCoal); @@ -274,12 +274,12 @@ BOOST_DATA_TEST_CASE_F( { ggs.setSelection(sample.mineBehaviorAddon, static_cast(MineResourceBehavior::S4LikeExhaustion)); ggs.setSelection(AddonId::MINE_NO_OUTPUT_FALLBACK, static_cast(sample.fallback)); - const MapPoint minePos = CreateMine(sample.mineType, Resource(sample.mineResource, 1)); + const MapPoint minePos = createMine(sample.mineType, Resource(sample.mineResource, 1)); const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialPrimary = curInventory[sample.primaryGood]; const unsigned initialFallback = curInventory[sample.fallbackGood]; - SeedProductionRng(sample.seed); + seedProductionRng(sample.seed); RTTR_EXEC_TILL(maxProductionGFs, curInventory[sample.fallbackGood] > initialFallback); BOOST_TEST(curInventory[sample.primaryGood] == initialPrimary); @@ -292,9 +292,9 @@ BOOST_FIXTURE_TEST_CASE(CoalMineS4LikeExhaustionReducesResourceOnSuccessfulCycle { ggs.setSelection(AddonId::COALMINE_RESOURCE_BEHAVIOR, static_cast(MineResourceBehavior::S4LikeExhaustion)); - const MapPoint minePos = CreateMine(BuildingType::CoalMine, Resource(ResourceType::Coal, 15)); + const MapPoint minePos = createMine(BuildingType::CoalMine, Resource(ResourceType::Coal, 15)); - SeedProductionRng(s4LikeComparisonSeed); + seedProductionRng(s4LikeComparisonSeed); RTTR_EXEC_TILL(s4LikeComparisonGFs, world.getNode(minePos).resources.getAmount() == 14u); BOOST_TEST(world.getNode(minePos).resources.getAmount() == 14u); @@ -307,13 +307,13 @@ BOOST_FIXTURE_TEST_CASE(CoalMineS4LikeSuccessfulCycleIgnoresNoOutputFallback, Mi ggs.setSelection(AddonId::COALMINE_RESOURCE_BEHAVIOR, static_cast(MineResourceBehavior::S4LikeExhaustion)); ggs.setSelection(AddonId::MINE_NO_OUTPUT_FALLBACK, static_cast(MineNoOutputFallback::ProduceGranite100)); - const MapPoint minePos = CreateMine(BuildingType::CoalMine, Resource(ResourceType::Coal, 15)); + const MapPoint minePos = createMine(BuildingType::CoalMine, Resource(ResourceType::Coal, 15)); const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialCoal = curInventory[GoodType::Coal]; const unsigned initialStones = curInventory[GoodType::Stones]; // Seed chosen so the very first cycle succeeds: otherwise a failed cycle would emit a fallback stone first. - SeedProductionRng(21); + seedProductionRng(21); RTTR_EXEC_TILL(maxProductionGFs, curInventory[GoodType::Coal] > initialCoal); BOOST_TEST(curInventory[GoodType::Stones] == initialStones); @@ -324,7 +324,7 @@ BOOST_FIXTURE_TEST_CASE(CoalMineS4LikeSuccessfulCycleIgnoresNoOutputFallback, Mi BOOST_FIXTURE_TEST_CASE(CoalMineDefaultProductionIgnoresNoOutputFallback, MineProductionFixture) { ggs.setSelection(AddonId::MINE_NO_OUTPUT_FALLBACK, static_cast(MineNoOutputFallback::ProduceGranite100)); - const MapPoint minePos = CreateMine(BuildingType::CoalMine, Resource(ResourceType::Coal, 3)); + const MapPoint minePos = createMine(BuildingType::CoalMine, Resource(ResourceType::Coal, 3)); const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialCoal = curInventory[GoodType::Coal]; const unsigned initialStones = curInventory[GoodType::Stones]; @@ -340,7 +340,7 @@ BOOST_FIXTURE_TEST_CASE(CoalMineDefaultProductionIgnoresNoOutputFallback, MinePr BOOST_FIXTURE_TEST_CASE(CoalMineWorkEverywhereBehaviorProducesWithoutCreatingResource, MineProductionFixture) { ggs.setSelection(AddonId::COALMINE_RESOURCE_BEHAVIOR, static_cast(MineResourceBehavior::WorkEverywhere)); - const MapPoint minePos = CreateMine(BuildingType::CoalMine); + const MapPoint minePos = createMine(BuildingType::CoalMine); const Inventory& curInventory = world.getPlayer(curPlayer).getInventory(); const unsigned initialCoal = curInventory[GoodType::Coal]; @@ -354,15 +354,15 @@ BOOST_FIXTURE_TEST_CASE(CoalMineWorkEverywhereBehaviorProducesWithoutCreatingRes // callers, so every caller (not only mines) must still report it. BOOST_FIXTURE_TEST_CASE(WellWithoutWaterReportsOutOfResources, WorldWithGCExecution1P) { - PostBox& postbox = world.getPostMgr().AddPostBox(curPlayer); + PostBox& postbox = world.getPostMgr().addPostBox(curPlayer); GoodsAndPeopleCounts inv; inv[GoodType::Fish] = 40; inv[Job::Helper] = 2; - world.getSpecObj(hqPos)->AddToInventory(inv, true); + world.getSpecObj(hqPos)->addToInventory(inv, true); const MapPoint wellPos = hqPos + MapPoint(2, 0); const auto* well = static_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Well, wellPos, curPlayer, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Well, wellPos, curPlayer, Nation::Romans)); BuildRoad(world.getNeighbour(wellPos, Direction::SouthEast), false, std::vector(2, Direction::West)); RTTR_EXEC_TILL(500, well->hasWorker()); diff --git a/tests/s25Main/integration/testSeaAttacking.cpp b/tests/s25Main/integration/testSeaAttacking.cpp index ec785ac453..516067ffba 100644 --- a/tests/s25Main/integration/testSeaAttacking.cpp +++ b/tests/s25Main/integration/testSeaAttacking.cpp @@ -61,7 +61,7 @@ struct SeaAttackFixture : public SeaWorldWithGCExecution<3, 62, 64> world.setNO(pt, new noGranite(GraniteType::One, 5)); if(pt.x + 1 < world.getWidth()) world.setNO(pt + MapPoint(1, 0), new noGranite(GraniteType::One, 5)); - world.RecalcBQAroundPointBig(pt); + world.recalcBQAroundPointBig(pt); } pt = MapPoint(world.getHeight() - i - 1u, i); if(pt.x < world.getWidth() && world.getNode(pt).bq != BuildingQuality::Nothing) @@ -69,7 +69,7 @@ struct SeaAttackFixture : public SeaWorldWithGCExecution<3, 62, 64> world.setNO(pt, new noGranite(GraniteType::One, 5)); if(pt.x + 1 < world.getWidth()) world.setNO(pt + MapPoint(1, 0), new noGranite(GraniteType::One, 5)); - world.RecalcBQAroundPointBig(pt); + world.recalcBQAroundPointBig(pt); } } @@ -78,7 +78,7 @@ struct SeaAttackFixture : public SeaWorldWithGCExecution<3, 62, 64> setCurPlayer(i); hqPos[i] = world.getPlayer(i).getHQPos(); auto* hq = world.getSpecObj(hqPos[i]); - hq->AddToInventory(PeopleCounts::make(Job::General, 3), true); + hq->addToInventory(PeopleCounts::make(Job::General, 3), true); this->ChangeMilitary(MILITARY_SETTINGS_SCALE); } // Assert player positions: 0: Top, 1: Left, 2: Right @@ -101,42 +101,42 @@ struct SeaAttackFixture : public SeaWorldWithGCExecution<3, 62, 64> setCurPlayer(i); BOOST_TEST_REQUIRE(gwv.GetBQ(harborPos[i]) == BuildingQuality::Harbor); const noBuilding* hb = - BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, harborPos[i], i, Nation(i)); + BuildingFactory::createBuilding(world, BuildingType::HarborBuilding, harborPos[i], i, Nation(i)); BOOST_TEST_REQUIRE(hb); - BuildRoadForBlds(harborPos[i], hqPos[i]); + buildRoadForBlds(harborPos[i], hqPos[i]); MapPoint shipPos = world.getCoastalPoint(world.getHarborPointID(harborPos[i]), seaId); - shipPos = world.MakeMapPoint(Position(shipPos) + (Position(shipPos) - Position(harborPos[i])) * 8); + shipPos = world.makeMapPoint(Position(shipPos) + (Position(shipPos) - Position(harborPos[i])) * 8); BOOST_TEST_REQUIRE(shipPos.isValid()); - auto& ship = world.AddFigure(shipPos, std::make_unique(shipPos, i)); - world.getPlayer(i).RegisterShip(ship); + auto& ship = world.addFigure(shipPos, std::make_unique(shipPos, i)); + world.getPlayer(i).registerShip(ship); } // Build some military buildings - milBld1NearPos = FindBldPos(world.getHarborPoint(HarborId(3)) + MapPoint(3, 2), BuildingQuality::House, 1); + milBld1NearPos = findBldPos(world.getHarborPoint(HarborId(3)) + MapPoint(3, 2), BuildingQuality::House, 1); BOOST_TEST_REQUIRE(milBld1NearPos.isValid()); BOOST_TEST_REQUIRE(world.GetBQ(milBld1NearPos, 1) >= BuildingQuality::House); milBld1Near = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, milBld1NearPos, 1, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, milBld1NearPos, 1, Nation::Romans)); BOOST_TEST_REQUIRE(milBld1Near); - milBld1FarPos = FindBldPos(world.getHarborPoint(HarborId(4)) - MapPoint(1, 4), BuildingQuality::House, 1); + milBld1FarPos = findBldPos(world.getHarborPoint(HarborId(4)) - MapPoint(1, 4), BuildingQuality::House, 1); BOOST_TEST_REQUIRE(milBld1FarPos.isValid()); BOOST_TEST_REQUIRE(world.GetBQ(milBld1FarPos, 1) >= BuildingQuality::House); milBld1Far = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, milBld1FarPos, 1, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, milBld1FarPos, 1, Nation::Romans)); BOOST_TEST_REQUIRE(milBld1Far); - milBld2Pos = FindBldPos(world.getHarborPoint(HarborId(6)) - MapPoint(2, 2), BuildingQuality::House, 2); + milBld2Pos = findBldPos(world.getHarborPoint(HarborId(6)) - MapPoint(2, 2), BuildingQuality::House, 2); BOOST_TEST_REQUIRE(milBld2Pos.isValid()); BOOST_TEST_REQUIRE(world.GetBQ(milBld2Pos, 2) >= BuildingQuality::House); milBld2 = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Watchtower, milBld2Pos, 2, Nation::Babylonians)); + BuildingFactory::createBuilding(world, BuildingType::Watchtower, milBld2Pos, 2, Nation::Babylonians)); BOOST_TEST_REQUIRE(milBld2); // Add some soldiers (assumed by test cases!) - AddSoldiers(milBld2Pos, 3, 3); - AddSoldiers(milBld1FarPos, 6, 0); + addSoldiers(milBld2Pos, 3, 3); + addSoldiers(milBld1FarPos, 6, 0); // Skip near bld so we have an empty one for testing setCurPlayer(2); @@ -154,7 +154,7 @@ struct SeaAttackFixture : public SeaWorldWithGCExecution<3, 62, 64> bool operator()(const MapPoint& pt) const { return world.GetBQ(pt, player) >= bq; } }; - MapPoint FindBldPos(const MapPoint& preferedPos, BuildingQuality reqBQ, unsigned player) + MapPoint findBldPos(const MapPoint& preferedPos, BuildingQuality reqBQ, unsigned player) { const std::vector pts = world.GetMatchingPointsInRadius<1>(preferedPos, 2, HasBQ(world, player, reqBQ), true); @@ -164,10 +164,10 @@ struct SeaAttackFixture : public SeaWorldWithGCExecution<3, 62, 64> void setCurPlayer(unsigned playerIdx) { curPlayer = playerIdx; - gwv.ChangePlayer(playerIdx, false); + gwv.changePlayer(playerIdx, false); } - void AddSoldiersWithRank(MapPoint bldPos, unsigned numSoldiers, unsigned rank) + void addSoldiersWithRank(MapPoint bldPos, unsigned numSoldiers, unsigned rank) { BOOST_TEST_REQUIRE(rank <= world.getGGS().getMaxMilitaryRank()); auto* bld = world.getSpecObj(bldPos); @@ -176,23 +176,23 @@ struct SeaAttackFixture : public SeaWorldWithGCExecution<3, 62, 64> for(unsigned i = 0; i < numSoldiers; i++) { auto& soldier = - world.AddFigure(bldPos, std::make_unique(bldPos, bld->getPlayer(), bld, bld, rank)); - world.getPlayer(bld->getPlayer()).IncreaseInventoryJob(soldier.getJobType(), 1); + world.addFigure(bldPos, std::make_unique(bldPos, bld->getPlayer(), bld, bld, rank)); + world.getPlayer(bld->getPlayer()).increaseInventoryJob(soldier.getJobType(), 1); // Let him "walk" to goal -> Already reached -> Added and all internal states set correctly - soldier.WalkToGoal(); + soldier.walkToGoal(); BOOST_TEST_REQUIRE(!soldier.getGoal()); } BOOST_TEST_REQUIRE(bld->getNumTroops() == oldNumSoldiers + numSoldiers); } - void AddSoldiers(MapPoint bldPos, unsigned numWeak, unsigned numStrong) + void addSoldiers(MapPoint bldPos, unsigned numWeak, unsigned numStrong) { - AddSoldiersWithRank(bldPos, numWeak, 0); - AddSoldiersWithRank(bldPos, numStrong, 4); + addSoldiersWithRank(bldPos, numWeak, 0); + addSoldiersWithRank(bldPos, numStrong, 4); } /// Assert that attacking the given building from milBld2 fails - void TestFailingSeaAttack(MapPoint bldPos, unsigned numSoldiersLeft = 6u) + void testFailingSeaAttack(MapPoint bldPos, unsigned numSoldiersLeft = 6u) { BOOST_TEST_REQUIRE(milBld2->getNumTroops() == numSoldiersLeft); // No available soldiers @@ -203,7 +203,7 @@ struct SeaAttackFixture : public SeaWorldWithGCExecution<3, 62, 64> } /// Asserts that the milBld2 contains the given amount of strong/weak soldiers - void TestTroopCt(unsigned numStrong, unsigned numWeak) const + void testTroopCt(unsigned numStrong, unsigned numWeak) const { BOOST_TEST_REQUIRE(milBld2->getNumTroops() == numStrong + numWeak); auto itTroops = milBld2->getTroops().begin(); @@ -216,7 +216,7 @@ struct SeaAttackFixture : public SeaWorldWithGCExecution<3, 62, 64> BOOST_FIXTURE_TEST_CASE(SeaAttackDisabled, SeaAttackFixture) { - AddSoldiers(milBld1NearPos, 6, 0); + addSoldiers(milBld1NearPos, 6, 0); // Disable Sea attack ggs.setSelection(AddonId::SEA_ATTACK, 2); @@ -230,16 +230,16 @@ BOOST_FIXTURE_TEST_CASE(SeaAttackDisabled, SeaAttackFixture) BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1FarPos) == 0u); // No sea attack - TestFailingSeaAttack(hqPos[0]); - TestFailingSeaAttack(hqPos[1]); - TestFailingSeaAttack(harborPos[1]); - TestFailingSeaAttack(milBld1NearPos); - TestFailingSeaAttack(milBld1FarPos); + testFailingSeaAttack(hqPos[0]); + testFailingSeaAttack(hqPos[1]); + testFailingSeaAttack(harborPos[1]); + testFailingSeaAttack(milBld1NearPos); + testFailingSeaAttack(milBld1FarPos); } BOOST_FIXTURE_TEST_CASE(SeaAttackInPeacefulMode, SeaAttackFixture) { - AddSoldiers(milBld1NearPos, 6, 0); + addSoldiers(milBld1NearPos, 6, 0); // Set peaceful mode ggs.setSelection(AddonId::PEACEFULMODE, 1); @@ -253,11 +253,11 @@ BOOST_FIXTURE_TEST_CASE(SeaAttackInPeacefulMode, SeaAttackFixture) BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1FarPos) == 0u); // No sea attack - TestFailingSeaAttack(hqPos[0]); - TestFailingSeaAttack(hqPos[1]); - TestFailingSeaAttack(harborPos[1]); - TestFailingSeaAttack(milBld1NearPos); - TestFailingSeaAttack(milBld1FarPos); + testFailingSeaAttack(hqPos[0]); + testFailingSeaAttack(hqPos[1]); + testFailingSeaAttack(harborPos[1]); + testFailingSeaAttack(milBld1NearPos); + testFailingSeaAttack(milBld1FarPos); } BOOST_FIXTURE_TEST_CASE(NoHarborBlock, SeaAttackFixture) @@ -273,22 +273,22 @@ BOOST_FIXTURE_TEST_CASE(NoHarborBlock, SeaAttackFixture) BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1FarPos) == 0u); // No building - TestFailingSeaAttack(harborPos[0]); + testFailingSeaAttack(harborPos[0]); // Non-Military building BOOST_TEST_REQUIRE(world.GetBQ(harborPos[0], 0) > BuildingQuality::Flag); const noBuilding* usualBld = - BuildingFactory::CreateBuilding(world, BuildingType::Woodcutter, harborPos[0], 0, Nation::Romans); + BuildingFactory::createBuilding(world, BuildingType::Woodcutter, harborPos[0], 0, Nation::Romans); BOOST_TEST_REQUIRE(usualBld); - TestFailingSeaAttack(harborPos[0]); + testFailingSeaAttack(harborPos[0]); // Bld to far - TestFailingSeaAttack(milBld1FarPos); + testFailingSeaAttack(milBld1FarPos); // Bld not occupied - TestFailingSeaAttack(milBld1NearPos); + testFailingSeaAttack(milBld1NearPos); // Occupy now - AddSoldiers(milBld1NearPos, 6, 0); + addSoldiers(milBld1NearPos, 6, 0); // Rest is attackable BOOST_TEST_REQUIRE(gwv.getNumSoldiersForSeaAttack(hqPos[0]) == 5u); @@ -308,12 +308,12 @@ BOOST_FIXTURE_TEST_CASE(NoHarborBlock, SeaAttackFixture) BOOST_TEST_REQUIRE(milBld2->getNumTroops() == 1u); // All gone - TestFailingSeaAttack(harborPos[1], 1u); + testFailingSeaAttack(harborPos[1], 1u); } BOOST_FIXTURE_TEST_CASE(HarborsBlock, SeaAttackFixture) { - AddSoldiers(milBld1NearPos, 6, 0); + addSoldiers(milBld1NearPos, 6, 0); // Enemy harbors block ggs.setSelection(AddonId::SEA_ATTACK, 1); @@ -326,18 +326,18 @@ BOOST_FIXTURE_TEST_CASE(HarborsBlock, SeaAttackFixture) BOOST_TEST_REQUIRE(gwv.getNumSoldiersForAttack(milBld1FarPos) == 0u); // Harbor exists -> Can't attack - TestFailingSeaAttack(hqPos[1]); - TestFailingSeaAttack(milBld1NearPos); - TestFailingSeaAttack(milBld1FarPos); + testFailingSeaAttack(hqPos[1]); + testFailingSeaAttack(milBld1NearPos); + testFailingSeaAttack(milBld1FarPos); // No building - TestFailingSeaAttack(harborPos[0]); + testFailingSeaAttack(harborPos[0]); // Non-Military building BOOST_TEST_REQUIRE(world.GetBQ(harborPos[0], 0) > BuildingQuality::Flag); const noBuilding* usualBld = - BuildingFactory::CreateBuilding(world, BuildingType::Woodcutter, harborPos[0], 0, Nation::Romans); + BuildingFactory::createBuilding(world, BuildingType::Woodcutter, harborPos[0], 0, Nation::Romans); BOOST_TEST_REQUIRE(usualBld); - TestFailingSeaAttack(harborPos[0]); + testFailingSeaAttack(harborPos[0]); // HQ Attackable as no harbor at harbor spot (but regular bld) BOOST_TEST_REQUIRE(gwv.getNumSoldiersForSeaAttack(hqPos[0]) == 5u); @@ -358,16 +358,16 @@ BOOST_FIXTURE_TEST_CASE(HarborsBlock, SeaAttackFixture) // Place military bld for player 1, first make some owned land const MapPoint bldPos = (harborBot1 + harborBot2) / MapCoord(2) + MapPoint(6, 0); // Distance: <= attack distance (+ reserve) but greater than range from military bld (current values) - BOOST_TEST_REQUIRE(world.CalcDistance(bldPos, harborBot2) <= 12u); - BOOST_TEST_REQUIRE(world.CalcDistance(bldPos, harborBot2) >= 9u); + BOOST_TEST_REQUIRE(world.calcDistance(bldPos, harborBot2) <= 12u); + BOOST_TEST_REQUIRE(world.calcDistance(bldPos, harborBot2) >= 9u); BOOST_TEST_REQUIRE(world.getNode(bldPos).bq == BuildingQuality::Castle); std::vector pts = world.getPointsInRadius(bldPos, 3); pts.push_back(bldPos); for(const MapPoint& pt : pts) world.setOwner(pt, 1 + 1); - const noBuilding* bld = BuildingFactory::CreateBuilding(world, BuildingType::Barracks, bldPos, 1, Nation::Romans); + const noBuilding* bld = BuildingFactory::createBuilding(world, BuildingType::Barracks, bldPos, 1, Nation::Romans); BOOST_TEST_REQUIRE(bld); - AddSoldiers(bldPos, 2, 0); + addSoldiers(bldPos, 2, 0); // Still unowned harbors BOOST_TEST_REQUIRE(world.getNode(harborBot1).owner == 0u); BOOST_TEST_REQUIRE(world.getNode(harborBot2).owner == 0u); @@ -379,33 +379,33 @@ BOOST_FIXTURE_TEST_CASE(HarborsBlock, SeaAttackFixture) BOOST_FIXTURE_TEST_CASE(AttackWithTeams, SeaAttackFixture) { - AddSoldiers(milBld1NearPos, 6, 0); + addSoldiers(milBld1NearPos, 6, 0); // Enemy harbors block ggs.setSelection(AddonId::SEA_ATTACK, 1); // Build (later) ally harbor noBuilding* harborBld = - BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, harborPos[0], 1, Nation::Romans); + BuildingFactory::createBuilding(world, BuildingType::HarborBuilding, harborPos[0], 1, Nation::Romans); BOOST_TEST_REQUIRE(harborBld); // Enemy harbor blocks - TestFailingSeaAttack(hqPos[1]); + testFailingSeaAttack(hqPos[1]); world.getPlayer(0).team = Team::Team2; //-V525 world.getPlayer(1).team = Team::Team1; world.getPlayer(2).team = Team::Team1; for(unsigned i = 0; i < 3; i++) - world.getPlayer(i).MakeStartPacts(); + world.getPlayer(i).makeStartPacts(); // Can't attack ally - TestFailingSeaAttack(harborPos[1]); - TestFailingSeaAttack(hqPos[1]); + testFailingSeaAttack(harborPos[1]); + testFailingSeaAttack(hqPos[1]); // Invisible point world.setVisibility(hqPos[0], 1, Visibility::FogOfWar, em.getCurrentGF()); world.setVisibility(hqPos[0], 2, Visibility::FogOfWar, em.getCurrentGF()); - TestFailingSeaAttack(hqPos[0]); + testFailingSeaAttack(hqPos[0]); // Visible for ally world.setVisibility(hqPos[0], 1, Visibility::Visible); @@ -419,11 +419,11 @@ BOOST_FIXTURE_TEST_CASE(AttackHarbor, SeaAttackFixture) { initGameRNG(); - BuildRoadForBlds(milBld2Pos, harborPos[2]); - BuildRoadForBlds(milBld2Pos, hqPos[2]); + buildRoadForBlds(milBld2Pos, harborPos[2]); + buildRoadForBlds(milBld2Pos, hqPos[2]); // Add 1 soldier to dest harbor so we have a defender nobHarborBuilding& hbDest = *world.getSpecObj(harborPos[1]); - hbDest.AddToInventory(PeopleCounts::make(Job::Sergeant, 1), true); + hbDest.addToInventory(PeopleCounts::make(Job::Sergeant, 1), true); // Don't keep him in reserve hbDest.setRealReserve(getSoldierRank(Job::Sergeant), 0); BOOST_TEST_REQUIRE(hbDest.getNumVisualFigures(Job::Sergeant) == 1u); @@ -440,7 +440,7 @@ BOOST_FIXTURE_TEST_CASE(AttackHarbor, SeaAttackFixture) BOOST_TEST_REQUIRE(hbSrc.getNumVisualFigures(Job::General) == 0u); // Let soldier walk to harbor - unsigned distance = 2 * world.CalcDistance(milBld2Pos, harborPos[2]); + unsigned distance = 2 * world.calcDistance(milBld2Pos, harborPos[2]); RTTR_EXEC_TILL(distance * 20 + 30, !ship.isIdling()); BOOST_TEST_REQUIRE(ship.isGoingToHarbor(hbSrc)); BOOST_TEST_REQUIRE(hbSrc.getNumVisualFigures(Job::General) == 1u); @@ -450,7 +450,7 @@ BOOST_FIXTURE_TEST_CASE(AttackHarbor, SeaAttackFixture) for(unsigned gf = 0; gf < 60;) { numSoldiersForAttack = hbSrc.getNumVisualFigures(Job::Private) + hbSrc.getNumVisualFigures(Job::General); - unsigned numGfs = em.ExecuteNextEvent(); + unsigned numGfs = em.executeNextEvent(); RTTR_Assert(numGfs > 0u); gf += numGfs; if(ship.isOnAttackMission()) @@ -479,7 +479,7 @@ BOOST_FIXTURE_TEST_CASE(AttackHarbor, SeaAttackFixture) BOOST_TEST_REQUIRE(!ship.isGoingToHarbor(hbSrc)); // Ship must not yet be at target harbor const MapPoint targetPt = world.getCoastalPoint(hbDest.getHarborPosID(), ship.getSeaID()); - distance = world.CalcDistance(ship.getPos(), targetPt); + distance = world.calcDistance(ship.getPos(), targetPt); BOOST_TEST_REQUIRE(distance > 2u); // Ship goes to enemy harbor coast and starts unloading RTTR_EXEC_TILL(distance * 20 + 20, !ship.isMoving()); @@ -493,7 +493,7 @@ BOOST_FIXTURE_TEST_CASE(AttackHarbor, SeaAttackFixture) { for(unsigned gf = 0; gf < 40; gf++) { - em.ExecuteNextGF(); + em.executeNextGF(); if(ship.getFigures().size() + curNumSoldiers <= numSoldiersForAttack) break; } @@ -589,7 +589,7 @@ BOOST_FIXTURE_TEST_CASE(HarborBlocksSpots, SeaAttackFixture) { for(pt.x = harborPos[1].x - 3; pt.x <= harborPos[1].x; pt.x++) { - if(world.CalcDistance(pt, harborPos[1]) < 2) + if(world.calcDistance(pt, harborPos[1]) < 2) continue; world.getNodeWriteable(pt).t1 = tWater; world.getNodeWriteable(pt).t2 = tWater; @@ -611,7 +611,7 @@ BOOST_FIXTURE_TEST_CASE(HarborBlocksSpots, SeaAttackFixture) BOOST_TEST_REQUIRE(world.isWaterPoint(world.getNeighbour(ptNW, Direction::NorthWest))); BOOST_TEST_REQUIRE(world.isWaterPoint(seaPtN)); // Re-init seas/harbors - BOOST_TEST_REQUIRE(MapLoader::InitSeasAndHarbors(world)); + BOOST_TEST_REQUIRE(MapLoader::initSeasAndHarbors(world)); // Still have our harbor const HarborId hbId = world.getHarborPointID(harborPos[1]); @@ -629,12 +629,12 @@ BOOST_FIXTURE_TEST_CASE(HarborBlocksSpots, SeaAttackFixture) // Start attack this->SeaAttack(harborPos[1], 5, true); // Let soldier walk to harbor - unsigned distance = 2 * world.CalcDistance(milBld2Pos, harborPos[2]); + unsigned distance = 2 * world.calcDistance(milBld2Pos, harborPos[2]); RTTR_SKIP_GFS(distance * 20 + 30); // And ship go to harbor (+200 GFs for loading) const noShip& ship = *world.getPlayer(2).getShipByID(0); - distance = world.CalcDistance(ship.getPos(), harborPos[1]); - RTTR_EXEC_TILL(distance * 2 * 20 + 200, (!ship.isMoving() && world.CalcDistance(ship.getPos(), harborPos[1]) <= 2)); + distance = world.calcDistance(ship.getPos(), harborPos[1]); + RTTR_EXEC_TILL(distance * 2 * 20 + 200, (!ship.isMoving() && world.calcDistance(ship.getPos(), harborPos[1]) <= 2)); BOOST_TEST_REQUIRE(ship.isOnAttackMission()); // Harbor should be destroyed and the ship go back RTTR_EXEC_TILL(500, ship.isMoving()); diff --git a/tests/s25Main/integration/testSeaWorldCreation.cpp b/tests/s25Main/integration/testSeaWorldCreation.cpp index 02b384d2c9..e6bc8d4d7d 100644 --- a/tests/s25Main/integration/testSeaWorldCreation.cpp +++ b/tests/s25Main/integration/testSeaWorldCreation.cpp @@ -24,7 +24,7 @@ namespace { /// Return the ship dir from a point to an other point given by their difference ShipDirection getShipDir(const MapBase& world, MapPoint fromPt, const Position& diff) { - MapPoint toPt = world.MakeMapPoint(Position(fromPt) + diff); + MapPoint toPt = world.makeMapPoint(Position(fromPt) + diff); return world.GetShipDir(fromPt, toPt); } @@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE(GetShipDir) { // Width must be > 100*2 and Height > 174 * 2 to avoid wrapping errors (see testShipDir) MapBase world; - world.Resize(MapExtent(202, 350)); + world.resize(MapExtent(202, 350)); // Basic case testShipDir(world, MapPoint(world.getWidth() / 2, world.getHeight() / 2)); // Left/Right border diff --git a/tests/s25Main/integration/testSeafaring.cpp b/tests/s25Main/integration/testSeafaring.cpp index e169583476..b2c99fab6c 100644 --- a/tests/s25Main/integration/testSeafaring.cpp +++ b/tests/s25Main/integration/testSeafaring.cpp @@ -62,10 +62,10 @@ BOOST_FIXTURE_TEST_CASE(HarborPlacing, SeaWorldWithGCExecution<>) const SeaId seaId(1); const HarborId hbId(1); const MapPoint hbPos = world.getHarborPoint(hbId); - BOOST_TEST_REQUIRE(world.CalcDistance(hqPos, hbPos) < HQ_RADIUS); + BOOST_TEST_REQUIRE(world.calcDistance(hqPos, hbPos) < HQ_RADIUS); auto* harbor = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, hbPos, curPlayer, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::HarborBuilding, hbPos, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(harbor); BOOST_TEST_REQUIRE(world.isHarborAtSea(hbId, seaId)); BOOST_TEST_REQUIRE(buildings.getHarbors().size() == 1u); //-V807 @@ -87,7 +87,7 @@ BOOST_FIXTURE_TEST_CASE(ShipConnections, SmallSeaWorld) const auto createHarbor = [this, &curPlayer](HarborId hbId) -> nobHarborBuilding& { MapPoint hbPos = world.getHarborPoint(hbId); auto* harbor = static_cast( - BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, hbPos, curPlayer, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::HarborBuilding, hbPos, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(harbor); return *harbor; }; @@ -147,7 +147,7 @@ BOOST_FIXTURE_TEST_CASE(ShipBuilding, SeaWorldWithGCExecution<>) const MapPoint shipyardPos(hqPos.x + 3, hqPos.y - 5); auto* harbor = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, hbPos, curPlayer, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::HarborBuilding, hbPos, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(harbor); std::vector road = FindRoadPath(hqFlagPos, world.getNeighbour(hbPos, Direction::SouthEast), world); BOOST_TEST_REQUIRE(!road.empty()); @@ -160,7 +160,7 @@ BOOST_FIXTURE_TEST_CASE(ShipBuilding, SeaWorldWithGCExecution<>) } BOOST_TEST_REQUIRE(world.GetBQ(shipyardPos, curPlayer) == BuildingQuality::Castle); auto* shipYard = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Shipyard, shipyardPos, curPlayer, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::Shipyard, shipyardPos, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(shipYard); road = FindRoadPath(hqFlagPos, world.getNeighbour(shipyardPos, Direction::SouthEast), world); BOOST_TEST_REQUIRE(!road.empty()); @@ -177,9 +177,9 @@ BOOST_FIXTURE_TEST_CASE(ShipBuilding, SeaWorldWithGCExecution<>) this->SetShipYardMode(shipyardPos, true); BOOST_TEST_REQUIRE(shipYard->getMode() == nobShipYard::Mode::Ships); - world.getPostMgr().AddPostBox(curPlayer); + world.getPostMgr().addPostBox(curPlayer); PostBox& postBox = *world.getPostMgr().getPostBox(curPlayer); - postBox.Clear(); + postBox.clear(); // Ship building takes 10 steps with ~500 GFs each. +600 GF to let wares and people reach the site RTTR_EXEC_TILL(5600, postBox.getNumMsgs() > 0); // There should be a msg telling the player about the new ship @@ -208,13 +208,13 @@ struct ShipReadyFixture : public SeaWorldWithGCExecution( - BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, hbPos, curPlayer, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::HarborBuilding, hbPos, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(harbor); - world.RecalcBQAroundPointBig(hbPos); + world.recalcBQAroundPointBig(hbPos); std::vector road = FindRoadPath(hqFlagPos, world.getNeighbour(hbPos, Direction::SouthEast), world); BOOST_TEST_REQUIRE(!road.empty()); this->BuildRoad(hqFlagPos, false, road); @@ -229,11 +229,11 @@ struct ShipReadyFixture : public SeaWorldWithGCExecution(shipPos, curPlayer)); - player.RegisterShip(ship); + auto& ship = world.addFigure(shipPos, std::make_unique(shipPos, curPlayer)); + player.registerShip(ship); BOOST_TEST_REQUIRE(player.getNumShips() == 1u); - postBox->Clear(); + postBox->clear(); initGameRNG(); } @@ -296,8 +296,8 @@ BOOST_FIXTURE_TEST_CASE(ExplorationExpedition, ShipReadyFixture<>) // Team visibility, so set one to own team world.getPlayer(curPlayer).team = Team::Team1; world.getPlayer(1).team = Team::Team1; - world.getPlayer(curPlayer).MakeStartPacts(); - world.getPlayer(1).MakeStartPacts(); + world.getPlayer(curPlayer).makeStartPacts(); + world.getPlayer(1).makeStartPacts(); world.getNodeWriteable(world.getHarborPoint(HarborId(3))).fow[1].visibility = Visibility::Visible; HarborId targetHbId(8); @@ -310,22 +310,22 @@ BOOST_FIXTURE_TEST_CASE(ExplorationExpedition, ShipReadyFixture<>) BOOST_TEST_REQUIRE(ship.getHomeHarbor() == hbId); BOOST_TEST_REQUIRE(ship.getTargetHarbor() == targetHbId); - unsigned distance = world.CalcDistance(hbPos, world.getHarborPoint(targetHbId)); + unsigned distance = world.calcDistance(hbPos, world.getHarborPoint(targetHbId)); // Let the ship scout the harbor RTTR_EXEC_TILL(distance * 2 * 20, !ship.isMoving()); BOOST_TEST_REQUIRE(ship.isOnExplorationExpedition()); - BOOST_TEST_REQUIRE(world.CalcDistance(world.getHarborPoint(targetHbId), ship.getPos()) <= 2u); + BOOST_TEST_REQUIRE(world.calcDistance(world.getHarborPoint(targetHbId), ship.getPos()) <= 2u); // Now the ship waits and will select the next harbor. We allow another one: HarborId nextHbId(6); world.getNodeWriteable(world.getHarborPoint(nextHbId)).fow[curPlayer].visibility = Visibility::FogOfWar; RTTR_EXEC_TILL(350, ship.isMoving()); BOOST_TEST_REQUIRE(ship.getHomeHarbor() == hbId); BOOST_TEST_REQUIRE(ship.getTargetHarbor() == nextHbId); - distance = world.CalcDistance(ship.getPos(), world.getHarborPoint(nextHbId)); + distance = world.calcDistance(ship.getPos(), world.getHarborPoint(nextHbId)); // Let the ship scout the harbor RTTR_EXEC_TILL(distance * 2 * 20, !ship.isMoving()); BOOST_TEST_REQUIRE(ship.isOnExplorationExpedition()); - BOOST_TEST_REQUIRE(world.CalcDistance(world.getHarborPoint(nextHbId), ship.getPos()) <= 2u); + BOOST_TEST_REQUIRE(world.calcDistance(world.getHarborPoint(nextHbId), ship.getPos()) <= 2u); // Now disallow the first harbor so ship returns home world.getNodeWriteable(world.getHarborPoint(targetHbId)).fow[curPlayer].visibility = Visibility::Visible; @@ -334,7 +334,7 @@ BOOST_FIXTURE_TEST_CASE(ExplorationExpedition, ShipReadyFixture<>) BOOST_TEST_REQUIRE(ship.getHomeHarbor() == hbId); BOOST_TEST_REQUIRE(ship.getTargetHarbor() == hbId); - distance = world.CalcDistance(ship.getPos(), world.getHarborPoint(hbId)); + distance = world.calcDistance(ship.getPos(), world.getHarborPoint(hbId)); // And at some time it should return home RTTR_EXEC_TILL(distance * 2 * 20 + 200, ship.isIdling()); const SeaId seaId(1); @@ -363,8 +363,8 @@ BOOST_FIXTURE_TEST_CASE(DestroyHomeOnExplExp, ShipReadyFixture<2>) // We want the ship to only scout unexplored harbors, so set all but one to visible world.getPlayer(curPlayer).team = Team::Team1; world.getPlayer(1).team = Team::Team1; - world.getPlayer(curPlayer).MakeStartPacts(); - world.getPlayer(1).MakeStartPacts(); + world.getPlayer(curPlayer).makeStartPacts(); + world.getPlayer(1).makeStartPacts(); world.getNodeWriteable(world.getHarborPoint(HarborId(6))).fow[1].visibility = Visibility::Visible; world.getNodeWriteable(world.getHarborPoint(HarborId(3))).fow[1].visibility = Visibility::Visible; @@ -386,13 +386,13 @@ BOOST_FIXTURE_TEST_CASE(DestroyHomeOnExplExp, ShipReadyFixture<2>) world.getNodeWriteable(world.getHarborPoint(targetHbId)).fow[1].visibility = Visibility::Visible; // Destroy home harbor - world.DestroyNO(hbPos); + world.destroyNO(hbPos); RTTR_EXEC_TILL(2000, ship.isLost()); BOOST_TEST_REQUIRE(!ship.isMoving()); MapPoint newHbPos = world.getHarborPoint(HarborId(6)); auto* newHarbor = dynamic_cast( - BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, newHbPos, curPlayer, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::HarborBuilding, newHbPos, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(!ship.isLost()); BOOST_TEST_REQUIRE(ship.isMoving()); @@ -456,11 +456,11 @@ BOOST_FIXTURE_TEST_CASE(Expedition, ShipReadyFixture<>) BOOST_TEST_REQUIRE(msg->getPos() == ship.getPos()); //-V522 // Harbor pos taken by other player - this->TravelToNextSpot(ShipDirection::SouthEast, player.getShipID(ship)); + this->travelToNextSpot(ShipDirection::SouthEast, player.getShipID(ship)); BOOST_TEST_REQUIRE(ship.isWaitingForExpeditionInstructions()); // Last free one (far south -> North is closer) - this->TravelToNextSpot(ShipDirection::North, player.getShipID(ship)); + this->travelToNextSpot(ShipDirection::North, player.getShipID(ship)); BOOST_TEST_REQUIRE(!ship.isWaitingForExpeditionInstructions()); BOOST_TEST_REQUIRE(ship.isMoving()); @@ -468,7 +468,7 @@ BOOST_FIXTURE_TEST_CASE(Expedition, ShipReadyFixture<>) RTTR_EXEC_TILL_CT_GF(1000, ship.isWaitingForExpeditionInstructions(), gfsToDest); HarborId hbId(8); BOOST_TEST_REQUIRE(ship.getCurrentHarbor() == hbId); - BOOST_TEST_REQUIRE(world.CalcDistance(ship.getPos(), world.getHarborPoint(hbId)) == 1u); + BOOST_TEST_REQUIRE(world.calcDistance(ship.getPos(), world.getHarborPoint(hbId)) == 1u); // Cancel expedition -> Ship is going back to harbor this->CancelExpedition(player.getShipID(ship)); @@ -485,23 +485,23 @@ BOOST_FIXTURE_TEST_CASE(Expedition, ShipReadyFixture<>) BOOST_TEST_REQUIRE(ship.getCurrentHarbor() == harbor.getHarborPosID()); // Try to found colony -> Fail - this->FoundColony(player.getShipID(ship)); + this->foundColony(player.getShipID(ship)); BOOST_TEST_REQUIRE(ship.isWaitingForExpeditionInstructions()); // Go back to free spot - this->TravelToNextSpot(ShipDirection::North, player.getShipID(ship)); + this->travelToNextSpot(ShipDirection::North, player.getShipID(ship)); BOOST_TEST_REQUIRE(!ship.isWaitingForExpeditionInstructions()); for(unsigned gf = 0; gf < 2; gf++) { // Send commands that should be ignored as ship is not expecting them - this->FoundColony(player.getShipID(ship)); + this->foundColony(player.getShipID(ship)); BOOST_TEST_REQUIRE(ship.isMoving()); - this->TravelToNextSpot(ShipDirection::South, player.getShipID(ship)); + this->travelToNextSpot(ShipDirection::South, player.getShipID(ship)); this->CancelExpedition(player.getShipID(ship)); BOOST_TEST_REQUIRE(ship.isMoving()); - this->em.ExecuteNextGF(); + this->em.executeNextGF(); } // Go to destination - postBox->Clear(); + postBox->clear(); RTTR_SKIP_GFS(gfsToDest); BOOST_TEST_REQUIRE(ship.isWaitingForExpeditionInstructions()); // This should again trigger a message @@ -509,7 +509,7 @@ BOOST_FIXTURE_TEST_CASE(Expedition, ShipReadyFixture<>) BOOST_TEST_REQUIRE(msg); BOOST_TEST_REQUIRE(msg->getPos() == ship.getPos()); // And now we can found a new colony - this->FoundColony(player.getShipID(ship)); + this->foundColony(player.getShipID(ship)); // Ship is free again BOOST_TEST_REQUIRE(ship.isIdling()); const noBuildingSite* newHarbor = world.getSpecObj(world.getHarborPoint(hbId)); @@ -533,7 +533,7 @@ BOOST_FIXTURE_TEST_CASE(LongDistanceTravel, ShipReadyFixtureBig) // Make sure that the other harbor is far away BOOST_TEST_REQUIRE(world.getMinHarborDistance(harbor.getHarborPosID(), targetHbId) > 600u); // Add some scouts - harbor.AddToInventory(PeopleCounts::make(Job::Scout, 20), true); + harbor.addToInventory(PeopleCounts::make(Job::Scout, 20), true); // We want the ship to only scout unexplored harbors, so set all but one to visible for(const auto i : helpers::idRange(world.getNumHarborPoints())) world.getNodeWriteable(world.getHarborPoint(i)).fow[curPlayer].visibility = Visibility::Visible; @@ -565,12 +565,12 @@ struct ShipAndHarborsReadyFixture : { MapPoint hbPos = world.getHarborPoint(hbPosId); auto* harbor = static_cast( - BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, hbPos, curPlayer, Nation::Romans)); + BuildingFactory::createBuilding(world, BuildingType::HarborBuilding, hbPos, curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(harbor); GoodsAndPeopleCounts goods; goods[GoodType::Wood] = 10; goods[Job::Woodcutter] = 10; - harbor->AddToInventory(goods, true); + harbor->addToInventory(goods, true); return *harbor; } @@ -581,10 +581,10 @@ struct ShipAndHarborsReadyFixture : createHarbor(HarborId(2)); MapPoint hbPos = world.getHarborPoint(HarborId(1)); - MapPoint shipPos = world.MakeMapPoint(hbPos - Position(2, 0)); + MapPoint shipPos = world.makeMapPoint(hbPos - Position(2, 0)); BOOST_TEST_REQUIRE(world.isSeaPoint(shipPos)); - auto& ship = world.AddFigure(shipPos, std::make_unique(shipPos, curPlayer)); - player.RegisterShip(ship); + auto& ship = world.addFigure(shipPos, std::make_unique(shipPos, curPlayer)); + player.registerShip(ship); BOOST_TEST_REQUIRE(player.getNumShips() == 1u); } @@ -592,9 +592,9 @@ struct ShipAndHarborsReadyFixture : void destroyBldAndFire(GameWorldBase& world, const MapPoint& pos) { - world.DestroyNO(pos); + world.destroyNO(pos); // Remove fire - world.DestroyNO(pos); + world.destroyNO(pos); // Remove burned wh if existing for(noBase& fig : world.getFigures(pos)) { @@ -602,15 +602,15 @@ void destroyBldAndFire(GameWorldBase& world, const MapPoint& pos) { // Remove go-out event (not automatically done as the burned wh is never removed) const GameEvent* ev = static_cast(world.getEvMgr()).getObjEvents(fig).front(); - world.getEvMgr().RemoveEvent(ev); - world.RemoveFigure(pos, fig)->Destroy(); + world.getEvMgr().removeEvent(ev); + world.RemoveFigure(pos, fig)->destroy(); break; } } } } // namespace -BOOST_FIXTURE_TEST_CASE(HarborDestroyed, ShipAndHarborsReadyFixture<1>) +BOOST_FIXTURE_TEST_CASE(harborDestroyed, ShipAndHarborsReadyFixture<1>) { const GamePlayer& player = world.getPlayer(curPlayer); const noShip& ship = *player.getShipByID(0); @@ -760,7 +760,7 @@ BOOST_FIXTURE_TEST_CASE(IncreasedPathLengthWhenHarborDestroyed, ShipReadyFixture node.t1 = node.t2 = t; } } - MapLoader::InitSeasAndHarbors(world); + MapLoader::initSeasAndHarbors(world); // Harbors unchanged BOOST_TEST_REQUIRE(world.getHarborPointID(hbTopPos) == hbIdTop); BOOST_TEST_REQUIRE(world.getHarborPointID(hbLeftPos) == hbIdLeft); @@ -773,9 +773,9 @@ BOOST_FIXTURE_TEST_CASE(IncreasedPathLengthWhenHarborDestroyed, ShipReadyFixture // Start shipment to left harbor nobHarborBuilding& topHarbor = *player.getBuildingRegister().getHarbors().front(); - BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, hbLeftPos, curPlayer, Nation::Romans); + BuildingFactory::createBuilding(world, BuildingType::HarborBuilding, hbLeftPos, curPlayer, Nation::Romans); - topHarbor.AddToInventory(GoodCounts::make(GoodType::Wood, 10), true); + topHarbor.addToInventory(GoodCounts::make(GoodType::Wood, 10), true); SetInventorySetting(hbLeftPos, GoodType::Wood, EInventorySetting::Collect); RTTR_EXEC_TILL(90, ship.isLoading()); @@ -786,7 +786,7 @@ BOOST_FIXTURE_TEST_CASE(IncreasedPathLengthWhenHarborDestroyed, ShipReadyFixture // Wait till ship is close to left harbor constexpr auto extraDist = 16u; // Choosen to be larger than a magic number used as tolerance - RTTR_EXEC_TILL(2000, world.CalcDistance(ship.getPos(), leftCoastPt) < extraDist * 2); + RTTR_EXEC_TILL(2000, world.calcDistance(ship.getPos(), leftCoastPt) < extraDist * 2); // Destroy home so it cannot go back, then target harbor destroyBldAndFire(world, hbTopPos); @@ -798,13 +798,13 @@ BOOST_FIXTURE_TEST_CASE(IncreasedPathLengthWhenHarborDestroyed, ShipReadyFixture // Building harbor at right makes ship go there even though distance is (too) long unsigned len; BOOST_TEST_REQUIRE( - world.FindShipPath(ship.getPos(), world.getCoastalPoint(hbIdRight, seaId), unsigned(-1), nullptr, &len)); + world.findShipPath(ship.getPos(), world.getCoastalPoint(hbIdRight, seaId), unsigned(-1), nullptr, &len)); const auto hbDistance = world.getMinHarborDistance(hbIdLeft, hbIdRight); // Reproducer requires the path to be longer than the direct distance and other connections BOOST_TEST_REQUIRE(len > hbDistance + extraDist); BOOST_TEST_REQUIRE(hbDistance > world.getMinHarborDistance(hbIdRight, hbIdTop)); BOOST_TEST_REQUIRE(hbDistance > world.getMinHarborDistance(hbIdRight, hbIdBottom)); - BuildingFactory::CreateBuilding(world, BuildingType::HarborBuilding, hbRightPos, curPlayer, Nation::Romans); + BuildingFactory::createBuilding(world, BuildingType::HarborBuilding, hbRightPos, curPlayer, Nation::Romans); BOOST_TEST_REQUIRE(ship.isMoving()); BOOST_TEST_REQUIRE(ship.getHomeHarbor() == hbIdRight); BOOST_TEST_REQUIRE(ship.getTargetHarbor() == hbIdRight); @@ -833,19 +833,19 @@ BOOST_FIXTURE_TEST_CASE(AddWareWithUnreachableGoalToHarbor, ShipAndHarborsReadyF BOOST_TEST_REQUIRE(harbors.size() >= 2u); nobHarborBuilding& harbor1 = *harbors.front(); nobHarborBuilding& harbor2 = **(++harbors.begin()); - auto* wh = static_cast(BuildingFactory::CreateBuilding( + auto* wh = static_cast(BuildingFactory::createBuilding( world, BuildingType::Storehouse, harbor2.getPos() + MapPoint(2, 0), curPlayer, Nation::Romans)); BOOST_TEST_REQUIRE(wh); - BuildRoadForBlds(harbor2.getPos(), wh->getPos()); + buildRoadForBlds(harbor2.getPos(), wh->getPos()); constexpr auto goodType = GoodType::Wood; // Sanity check: Move from harbor1 to wh (over harbor2) auto ware = std::make_unique(goodType, wh, &harbor1); auto* warePtr = ware.get(); - ware->Carry(harbor1); + ware->carry(harbor1); auto numVisWaresBefore = harbor1.getNumVisualWares(goodType); auto numRealWaresBefore = harbor1.getNumRealWares(goodType); - harbor1.AddWare(std::move(ware)); + harbor1.addWare(std::move(ware)); BOOST_TEST(harbor1.getNumVisualWares(goodType) == numVisWaresBefore + 1u); // Wares that will be moved out are only in visual count BOOST_TEST(harbor1.getNumRealWares(goodType) == numRealWaresBefore); @@ -861,10 +861,10 @@ BOOST_FIXTURE_TEST_CASE(AddWareWithUnreachableGoalToHarbor, ShipAndHarborsReadyF DestroyRoad(harbor2.getFlagPos(), d); } ware = std::make_unique(goodType, wh, &harbor1); - ware->Carry(harbor1); + ware->carry(harbor1); numVisWaresBefore = harbor1.getNumVisualWares(goodType); numRealWaresBefore = harbor1.getNumRealWares(goodType); - harbor1.AddWare(std::move(ware)); + harbor1.addWare(std::move(ware)); BOOST_TEST(harbor1.getNumVisualWares(goodType) == numVisWaresBefore + 1u); BOOST_TEST(harbor1.getNumRealWares(goodType) == numRealWaresBefore + 1u); BOOST_TEST(MockWare::destroyed); @@ -872,11 +872,11 @@ BOOST_FIXTURE_TEST_CASE(AddWareWithUnreachableGoalToHarbor, ShipAndHarborsReadyF // Same but disallow harbor as goal -> Find another storehouse SetInventorySetting(harbor1.getPos(), goodType, EInventorySetting::Stop); ware = std::make_unique(goodType, wh, &harbor1); - ware->Carry(harbor1); + ware->carry(harbor1); warePtr = ware.get(); numVisWaresBefore = harbor1.getNumVisualWares(goodType); numRealWaresBefore = harbor1.getNumRealWares(goodType); - harbor1.AddWare(std::move(ware)); + harbor1.addWare(std::move(ware)); BOOST_TEST(harbor1.getNumVisualWares(goodType) == numVisWaresBefore + 1u); BOOST_TEST(harbor1.getNumRealWares(goodType) == numRealWaresBefore); BOOST_TEST_REQUIRE(!MockWare::destroyed); @@ -885,10 +885,10 @@ BOOST_FIXTURE_TEST_CASE(AddWareWithUnreachableGoalToHarbor, ShipAndHarborsReadyF // If no other storehouse is available take it anyway SetInventorySetting(harbor2.getPos(), goodType, EInventorySetting::Stop); ware = std::make_unique(goodType, wh, &harbor1); - ware->Carry(harbor1); + ware->carry(harbor1); numVisWaresBefore = harbor1.getNumVisualWares(goodType); numRealWaresBefore = harbor1.getNumRealWares(goodType); - harbor1.AddWare(std::move(ware)); + harbor1.addWare(std::move(ware)); BOOST_TEST(harbor1.getNumVisualWares(goodType) == numVisWaresBefore + 1u); BOOST_TEST(harbor1.getNumRealWares(goodType) == numRealWaresBefore + 1u); BOOST_TEST(MockWare::destroyed); @@ -904,7 +904,7 @@ BOOST_FIXTURE_TEST_CASE(GoToNeighborHarbor, ShipReadyFixture<1>) expWares[Job::Builder] = 1; expWares[GoodType::Boards] = 20; expWares[GoodType::Stones] = 20; - homeHarbor.AddToInventory(expWares, true); + homeHarbor.addToInventory(expWares, true); /* A ship might get stuck when targeting a harbor (2) SE of the current harbor (1): Issue #1784 Harbors are at NE coast of island, (1) directly at sea, (2) one node inland: @@ -919,7 +919,7 @@ BOOST_FIXTURE_TEST_CASE(GoToNeighborHarbor, ShipReadyFixture<1>) // Put the harbors up into the sea so we can control the coastal point const MapPoint harborPos = homeHbPos + MapPoint(7, -3); // (1) const MapPoint nbHbPos = world.getNeighbour(harborPos, Direction::SouthEast); // (2) - const MapPoint otherHbPos = world.MakeMapPoint(homeHbPos - Point(3, 0)); // Unrelated harbor + const MapPoint otherHbPos = world.makeMapPoint(homeHbPos - Point(3, 0)); // Unrelated harbor const std::vector harborPoints = {harborPos, nbHbPos, otherHbPos}; for(const MapPoint p : harborPoints) world.getNodeWriteable(p).bq = BuildingQuality::Harbor; @@ -942,7 +942,7 @@ BOOST_FIXTURE_TEST_CASE(GoToNeighborHarbor, ShipReadyFixture<1>) auto& node = world.getNodeWriteable(world.getNeighbour(coastPoint, Direction::NorthWest)); node.t1 = GetLandTerrain(world.getDescription()); } - MapLoader::InitSeasAndHarbors(world, harborPoints); + MapLoader::initSeasAndHarbors(world, harborPoints); const auto harborId = world.getHarborPointID(harborPos); const auto nbHbId = world.getHarborPointID(nbHbPos); @@ -960,7 +960,7 @@ BOOST_FIXTURE_TEST_CASE(GoToNeighborHarbor, ShipReadyFixture<1>) // Wait till ship has loaded wares and is ready RTTR_EXEC_TILL(500, ship.isWaitingForExpeditionInstructions()); - this->TravelToNextSpot(this->GetShipDir(ship, harborId), player.getShipID(ship)); + this->travelToNextSpot(this->GetShipDir(ship, harborId), player.getShipID(ship)); BOOST_TEST_REQUIRE(!ship.isWaitingForExpeditionInstructions()); BOOST_TEST_REQUIRE(ship.isMoving()); BOOST_TEST_REQUIRE(ship.getTargetHarbor() == harborId); @@ -968,7 +968,7 @@ BOOST_FIXTURE_TEST_CASE(GoToNeighborHarbor, ShipReadyFixture<1>) RTTR_EXEC_TILL(500, ship.isWaitingForExpeditionInstructions()); BOOST_TEST_REQUIRE(ship.getPos() == coastPoint); - this->TravelToNextSpot(this->GetShipDir(ship, nbHbId), player.getShipID(ship)); + this->travelToNextSpot(this->GetShipDir(ship, nbHbId), player.getShipID(ship)); BOOST_TEST_REQUIRE(ship.getTargetHarbor() == nbHbId); // Already there BOOST_TEST(ship.isWaitingForExpeditionInstructions()); @@ -979,7 +979,7 @@ BOOST_FIXTURE_TEST_CASE(GoToNeighborHarbor, ShipReadyFixture<1>) BOOST_TEST_REQUIRE(otherHarborId.isValid()); // Precondition that any ship dir will be found BOOST_TEST_REQUIRE(world.isHarborAtSea(otherHarborId, seaId)); - this->TravelToNextSpot(this->GetShipDir(ship, otherHarborId), player.getShipID(ship)); + this->travelToNextSpot(this->GetShipDir(ship, otherHarborId), player.getShipID(ship)); BOOST_TEST_REQUIRE(ship.getTargetHarbor() == otherHarborId); // Moving BOOST_TEST_REQUIRE(ship.isMoving()); diff --git a/tests/s25Main/integration/testSerialization.cpp b/tests/s25Main/integration/testSerialization.cpp index d6823017a5..aad2ef617b 100644 --- a/tests/s25Main/integration/testSerialization.cpp +++ b/tests/s25Main/integration/testSerialization.cpp @@ -63,7 +63,7 @@ struct RandWorldFixture : public WorldFixture worldNode.seaId = SeaId(rttr::test::randomValue(0, 20)); worldNode.harborId = HarborId(rttr::test::randomValue(0, 20)); } - world.InitAfterLoad(); + world.initAfterLoad(); world.getPlayer(0).name = "Human"; world.getPlayer(1).ps = PlayerState::AI; //-V807 world.getPlayer(1).aiInfo = AI::Info(AI::Type::Default, AI::Level::Medium); @@ -90,7 +90,7 @@ struct GetTestCommands : public GameCommandFactory } protected: - bool AddGC(gc::GameCommandPtr gc) override + bool addGC(gc::GameCommandPtr gc) override { result.gcs.push_back(gc); return true; @@ -99,51 +99,51 @@ struct GetTestCommands : public GameCommandFactory void AddReplayCmds(Replay& replay, const PlayerGameCommands& cmds) { - replay.UpdateLastGF(1); - replay.AddChatCommand(1, 2, ChatDestination::Enemies, "Hello"); - replay.AddChatCommand(1, 3, ChatDestination::All, "Hello2"); - replay.AddChatCommand(2, 2, ChatDestination::Allies, "Hello3"); - - replay.AddGameCommand(2, 0, cmds); - replay.AddChatCommand(2, 2, ChatDestination::Enemies, "Hello4"); - replay.UpdateLastGF(5); + replay.updateLastGF(1); + replay.addChatCommand(1, 2, ChatDestination::Enemies, "Hello"); + replay.addChatCommand(1, 3, ChatDestination::All, "Hello2"); + replay.addChatCommand(2, 2, ChatDestination::Allies, "Hello3"); + + replay.addGameCommand(2, 0, cmds); + replay.addChatCommand(2, 2, ChatDestination::Enemies, "Hello4"); + replay.updateLastGF(5); } void CheckReplayCmds(Replay& loadReplay, const PlayerGameCommands& recordedCmds) { BOOST_TEST_REQUIRE(loadReplay.isReplaying()); - auto gf = loadReplay.ReadGF(); + auto gf = loadReplay.readGF(); BOOST_TEST(gf == 1u); { - const auto cmd = get(loadReplay.ReadCommand()); + const auto cmd = get(loadReplay.readCommand()); BOOST_TEST(cmd.player == 2); BOOST_TEST(cmd.dest == ChatDestination::Enemies); BOOST_TEST(cmd.msg == "Hello"); } - gf = loadReplay.ReadGF(); + gf = loadReplay.readGF(); BOOST_TEST(gf == 1u); { - const auto cmd = get(loadReplay.ReadCommand()); + const auto cmd = get(loadReplay.readCommand()); BOOST_TEST(cmd.player == 3); BOOST_TEST(cmd.dest == ChatDestination::All); BOOST_TEST(cmd.msg == "Hello2"); } - gf = loadReplay.ReadGF(); + gf = loadReplay.readGF(); BOOST_TEST(gf == 2u); { - const auto cmd = get(loadReplay.ReadCommand()); + const auto cmd = get(loadReplay.readCommand()); BOOST_TEST(cmd.player == 2); BOOST_TEST(cmd.dest == ChatDestination::Allies); BOOST_TEST(cmd.msg == "Hello3"); } - gf = loadReplay.ReadGF(); + gf = loadReplay.readGF(); BOOST_TEST(gf == 2u); { - const auto cmd = get(loadReplay.ReadCommand()); + const auto cmd = get(loadReplay.readCommand()); BOOST_TEST(cmd.player == 0); BOOST_TEST(cmd.cmds.checksum == recordedCmds.checksum); BOOST_TEST(cmd.cmds.gcs.size() == recordedCmds.gcs.size()); @@ -151,16 +151,16 @@ void CheckReplayCmds(Replay& loadReplay, const PlayerGameCommands& recordedCmds) BOOST_TEST(dynamic_cast(cmd.cmds.gcs[1].get())); } - gf = loadReplay.ReadGF(); + gf = loadReplay.readGF(); BOOST_TEST(gf == 2u); { - const auto cmd = get(loadReplay.ReadCommand()); + const auto cmd = get(loadReplay.readCommand()); BOOST_TEST(cmd.player == 2); BOOST_TEST(cmd.dest == ChatDestination::Enemies); BOOST_TEST(cmd.msg == "Hello4"); } - gf = loadReplay.ReadGF(); + gf = loadReplay.readGF(); BOOST_TEST(!gf); } @@ -288,57 +288,57 @@ BOOST_FIXTURE_TEST_CASE(BaseSaveLoad, RandWorldFixture) validLuaFile.getStream() << luaScript; validLuaFile.close(); - BOOST_TEST_REQUIRE(loader.LoadLuaScript(*game, lgsGame, validLuaFile.filePath)); + BOOST_TEST_REQUIRE(loader.loadLuaScript(*game, lgsGame, validLuaFile.filePath)); BOOST_TEST(world.hasLua()); } const MapPoint hqPos = world.getPlayer(0).getHQPos(); auto& hq = ensureNonNull(world.getSpecObj(hqPos)); auto& hqFlag = ensureNonNull(hq.getFlag()); - const MapPoint usualBldPos = world.MakeMapPoint(hqPos + Position(3, 0)); + const MapPoint usualBldPos = world.makeMapPoint(hqPos + Position(3, 0)); auto* usualBld = static_cast( - BuildingFactory::CreateBuilding(world, BuildingType::Bakery, usualBldPos, 0, Nation::Vikings)); - world.RecalcBQAroundPointBig(usualBldPos); + BuildingFactory::createBuilding(world, BuildingType::Bakery, usualBldPos, 0, Nation::Vikings)); + world.recalcBQAroundPointBig(usualBldPos); world.BuildRoad(0, false, hqFlag.getPos(), std::vector(3, Direction::East)); usualBld->is_working = true; // Add 3 fires with first between the others to have a mixed event order in the same GF for(const auto& offset : {Position(8, 0), Position(7, 0), Position(9, 0)}) { - const auto pt = world.MakeMapPoint(hqPos + offset); + const auto pt = world.makeMapPoint(hqPos + offset); BOOST_TEST_REQUIRE(!world.getNode(pt).obj); world.setNO(pt, new noFire(pt, false)); - world.RecalcBQAroundPoint(pt); + world.recalcBQAroundPoint(pt); } for(unsigned i = 0; i < 100; i++) - em.ExecuteNextGF(); + em.executeNextGF(); // Do this after running GFs to keep the state // Add ware to flag auto ware = std::make_unique(GoodType::Flour, usualBld, &hqFlag); - ware->WaitAtFlag(hqFlag); - ware->RecalcRoute(); - hqFlag.AddWare(std::move(ware)); + ware->waitAtFlag(hqFlag); + ware->recalcRoute(); + hqFlag.addWare(std::move(ware)); // Add a ware waiting in a warehouse. See https://github.com/Return-To-The-Roots/s25client/issues/1293 ware = std::make_unique(GoodType::Flour, usualBld, &hq); - hq.AddWaitingWare(std::move(ware)); + hq.addWaitingWare(std::move(ware)); Savegame save; for(const auto& player : world.getPlayers()) - save.AddPlayer(player); + save.addPlayer(player); save.ggs = ggs; save.start_gf = em.getCurrentGF(); - save.sgd.MakeSnapshot(*game); + save.sgd.makeSnapshot(*game); TmpFile tmpFile; BOOST_TEST_REQUIRE(tmpFile.isValid()); tmpFile.close(); s25util::time64_t saveTime = s25util::Time::CurrentTime(); - BOOST_TEST_REQUIRE(save.Save(tmpFile.filePath, "MapTitle")); + BOOST_TEST_REQUIRE(save.save(tmpFile.filePath, "MapTitle")); BOOST_TEST(save.getSaveTime() - saveTime <= 20); // 20s difference max const unsigned origObjNum = GameObject::getNumObjs(); const unsigned origObjIdNum = GameObject::getObjIDCounter(); @@ -386,8 +386,8 @@ BOOST_FIXTURE_TEST_CASE(BaseSaveLoad, RandWorldFixture) players.push_back(PlayerInfo(loadSave.getPlayer(j))); Game game(save.ggs, loadSave.start_gf, players); MockLocalGameState localGameState; - save.sgd.ReadSnapshot(game, localGameState); - game.world_.InitAfterLoad(); + save.sgd.readSnapshot(game, localGameState); + game.world_.initAfterLoad(); const World& newWorld = game.world_; auto& newEm = static_cast(game.world_.getEvMgr()); @@ -439,7 +439,7 @@ BOOST_FIXTURE_TEST_CASE(BaseSaveLoad, RandWorldFixture) BOOST_TEST(world.getLua().getScript() == luaScript); SerializedGameData loadedSgd; - loadedSgd.MakeSnapshot(game); + loadedSgd.makeSnapshot(game); BOOST_REQUIRE_EQUAL_COLLECTIONS(loadedSgd.GetData(), loadedSgd.GetData() + loadedSgd.GetLength(), save.sgd.GetData(), save.sgd.GetData() + save.sgd.GetLength()); } @@ -478,7 +478,7 @@ BOOST_FIXTURE_TEST_CASE(EmptyReplayRecordingIsRemoved, ReplayMapFixture) { Replay replay; for(const BasePlayerInfo& player : players) - replay.AddPlayer(player); + replay.addPlayer(player); replay.ggs.speed = GameSpeed::VeryFast; TmpFile tmpFile(".rpl"); @@ -486,11 +486,11 @@ BOOST_FIXTURE_TEST_CASE(EmptyReplayRecordingIsRemoved, ReplayMapFixture) tmpFile.close(); bfs::remove(tmpFile.filePath); - BOOST_TEST_REQUIRE(replay.StartRecording(tmpFile.filePath, map, 42)); + BOOST_TEST_REQUIRE(replay.startRecording(tmpFile.filePath, map, 42)); BOOST_TEST_REQUIRE(replay.isRecording()); BOOST_TEST(replay.getLastGF() == 0u); - BOOST_TEST_REQUIRE(replay.StopRecording()); + BOOST_TEST_REQUIRE(replay.stopRecording()); BOOST_TEST_REQUIRE(!replay.isRecording()); BOOST_TEST(!bfs::exists(tmpFile.filePath)); } @@ -500,20 +500,20 @@ BOOST_FIXTURE_TEST_CASE(ReplayWithMap, ReplayMapFixture) BOOST_TEST_REQUIRE(!replay.isRecording()); BOOST_TEST_REQUIRE(!replay.isReplaying()); for(const BasePlayerInfo& player : players) - replay.AddPlayer(player); + replay.addPlayer(player); replay.ggs.speed = GameSpeed::VeryFast; TmpFile tmpFile; BOOST_TEST_REQUIRE(tmpFile.isValid()); tmpFile.close(); // No overwrite - BOOST_TEST_REQUIRE(!replay.StartRecording(tmpFile.filePath, map, 815)); + BOOST_TEST_REQUIRE(!replay.startRecording(tmpFile.filePath, map, 815)); BOOST_TEST_REQUIRE(!replay.isRecording()); BOOST_TEST(!replay.isReplaying()); bfs::remove(tmpFile.filePath); s25util::time64_t saveTime = s25util::Time::CurrentTime(); - BOOST_TEST_REQUIRE(replay.StartRecording(tmpFile.filePath, map, 42)); + BOOST_TEST_REQUIRE(replay.startRecording(tmpFile.filePath, map, 42)); BOOST_TEST(replay.getSaveTime() - saveTime <= 20); // 20s difference max BOOST_TEST_REQUIRE(replay.isRecording()); BOOST_TEST(!replay.isReplaying()); @@ -523,14 +523,14 @@ BOOST_FIXTURE_TEST_CASE(ReplayWithMap, ReplayMapFixture) PlayerGameCommands cmds = GetTestCommands().create(game).result; AddReplayCmds(replay, cmds); BOOST_TEST(replay.getLastGF() == 5u); - BOOST_TEST_REQUIRE(replay.StopRecording()); + BOOST_TEST_REQUIRE(replay.stopRecording()); BOOST_TEST_REQUIRE(!replay.isRecording()); BOOST_TEST(!replay.isReplaying()); for(const bool loadSettings : {false, true}) { Replay loadReplay; - BOOST_TEST_REQUIRE(loadReplay.LoadHeader(tmpFile.filePath)); + BOOST_TEST_REQUIRE(loadReplay.loadHeader(tmpFile.filePath)); BOOST_TEST(loadReplay.getSaveTime() == replay.getSaveTime()); BOOST_TEST(loadReplay.getMapName() == "MapTitle"); BOOST_TEST_REQUIRE(loadReplay.getPlayerNames().size() == 3u); @@ -589,10 +589,10 @@ BOOST_FIXTURE_TEST_CASE(BrokenReplayWithMap, ReplayMapFixture) { Replay replay; for(const BasePlayerInfo& player : players) - replay.AddPlayer(player); + replay.addPlayer(player); replay.ggs.speed = GameSpeed::VeryFast; - BOOST_TEST_REQUIRE(replay.StartRecording(tmpFile.filePath, map, randomInit)); + BOOST_TEST_REQUIRE(replay.startRecording(tmpFile.filePath, map, randomInit)); saveTime = replay.getSaveTime(); BOOST_TEST_REQUIRE(replay.isRecording()); AddReplayCmds(replay, cmds); @@ -601,7 +601,7 @@ BOOST_FIXTURE_TEST_CASE(BrokenReplayWithMap, ReplayMapFixture) } Replay loadReplay; - BOOST_TEST_REQUIRE(loadReplay.LoadHeader(tmpFile.filePath)); + BOOST_TEST_REQUIRE(loadReplay.loadHeader(tmpFile.filePath)); BOOST_TEST(loadReplay.getSaveTime() == saveTime); BOOST_TEST(loadReplay.getMapName() == map.title); BOOST_TEST(loadReplay.getPlayerNames().size() == 3u); @@ -640,7 +640,7 @@ BOOST_FIXTURE_TEST_CASE(ReplayWithSavegame, RandWorldFixture) map.luaFilepath = "Map.lua"; map.savegame = std::make_unique(); for(const auto& player : world.getPlayers()) - map.savegame->AddPlayer(player); + map.savegame->addPlayer(player); // We can change players std::vector players(4); players[0].ps = PlayerState::AI; @@ -655,13 +655,13 @@ BOOST_FIXTURE_TEST_CASE(ReplayWithSavegame, RandWorldFixture) map.savegame->ggs = ggs; map.savegame->start_gf = em.getCurrentGF(); - map.savegame->sgd.MakeSnapshot(*game); + map.savegame->sgd.makeSnapshot(*game); Replay replay; BOOST_TEST_REQUIRE(!replay.isRecording()); BOOST_TEST_REQUIRE(!replay.isReplaying()); for(const BasePlayerInfo& player : players) - replay.AddPlayer(player); + replay.addPlayer(player); replay.ggs.speed = GameSpeed::VeryFast; TmpFile tmpFile; @@ -669,7 +669,7 @@ BOOST_FIXTURE_TEST_CASE(ReplayWithSavegame, RandWorldFixture) tmpFile.close(); bfs::remove(tmpFile.filePath); s25util::time64_t saveTime = s25util::Time::CurrentTime(); - BOOST_TEST_REQUIRE(replay.StartRecording(tmpFile.filePath, map, 815)); + BOOST_TEST_REQUIRE(replay.startRecording(tmpFile.filePath, map, 815)); BOOST_TEST_REQUIRE(replay.getSaveTime() - saveTime <= 20); // 20s difference max BOOST_TEST_REQUIRE(replay.isRecording()); BOOST_TEST(!replay.isReplaying()); @@ -677,14 +677,14 @@ BOOST_FIXTURE_TEST_CASE(ReplayWithSavegame, RandWorldFixture) PlayerGameCommands cmds = GetTestCommands().create(*game).result; AddReplayCmds(replay, cmds); BOOST_TEST(replay.getLastGF() == 5u); - BOOST_TEST_REQUIRE(replay.StopRecording()); + BOOST_TEST_REQUIRE(replay.stopRecording()); BOOST_TEST(!replay.isRecording()); BOOST_TEST_REQUIRE(!replay.isReplaying()); for(const bool loadSettings : {false, true}) { Replay loadReplay; - BOOST_TEST_REQUIRE(loadReplay.LoadHeader(tmpFile.filePath)); + BOOST_TEST_REQUIRE(loadReplay.loadHeader(tmpFile.filePath)); BOOST_TEST(loadReplay.getSaveTime() == replay.getSaveTime()); BOOST_TEST(loadReplay.getMapName() == "MapTitle"); BOOST_TEST_REQUIRE(loadReplay.getPlayerNames().size() == 3u); @@ -733,25 +733,25 @@ BOOST_FIXTURE_TEST_CASE(ReplayWithSavegame, RandWorldFixture) BOOST_FIXTURE_TEST_CASE(SerializeHunter, EmptyWorldFixture1P) { SerializedGameData sgd; - const auto hunterPos1 = world.MakeMapPoint(world.getPlayer(0).getHQPos() + rttr::test::randomPoint(2, 4)); - const auto hunterPos2 = world.MakeMapPoint(hunterPos1 + Position(2, 0)); + const auto hunterPos1 = world.makeMapPoint(world.getPlayer(0).getHQPos() + rttr::test::randomPoint(2, 4)); + const auto hunterPos2 = world.makeMapPoint(hunterPos1 + Position(2, 0)); { - auto* hunterBld1 = static_cast(BuildingFactory::CreateBuilding( + auto* hunterBld1 = static_cast(BuildingFactory::createBuilding( world, BuildingType::Hunter, hunterPos1, 0, rttr::test::randomEnum())); - auto* hunterBld2 = static_cast(BuildingFactory::CreateBuilding( + auto* hunterBld2 = static_cast(BuildingFactory::createBuilding( world, BuildingType::Hunter, hunterPos2, 0, rttr::test::randomEnum())); - world.AddFigure(hunterPos1, + world.addFigure(hunterPos1, std::make_unique(hunterPos1, rttr::test::randomValue(0u, 10u), hunterBld1)); - auto& hunter2 = world.AddFigure( + auto& hunter2 = world.addFigure( hunterPos2, std::make_unique(hunterPos2, rttr::test::randomValue(0u, 10u), hunterBld2)); - world.AddFigure(hunterPos2, std::make_unique(Species::Deer, hunterPos2)); - hunter2.TryStartHunting(); - sgd.MakeSnapshot(*game); + world.addFigure(hunterPos2, std::make_unique(Species::Deer, hunterPos2)); + hunter2.tryStartHunting(); + sgd.makeSnapshot(*game); } MockLocalGameState lgs; - em.Clear(); - world.Unload(); - sgd.ReadSnapshot(*game, lgs); + em.clear(); + world.unload(); + sgd.readSnapshot(*game, lgs); BOOST_TEST_REQUIRE(world.getFigures(hunterPos1).size() == 1u); BOOST_TEST_REQUIRE(world.getFigures(hunterPos2).size() == 2u); const auto* deserializedHunter1 = dynamic_cast(&world.getFigures(hunterPos1).front()); @@ -762,7 +762,7 @@ BOOST_FIXTURE_TEST_CASE(SerializeHunter, EmptyWorldFixture1P) // Serialize again and compare data SerializedGameData sgd2; - sgd2.MakeSnapshot(*game); + sgd2.makeSnapshot(*game); BOOST_CHECK_EQUAL_COLLECTIONS(sgd.GetData(), sgd.GetData() + sgd.GetLength(), sgd2.GetData(), sgd2.GetData() + sgd2.GetLength()); } diff --git a/tests/s25Main/integration/testTerritoryRegion.cpp b/tests/s25Main/integration/testTerritoryRegion.cpp index b81da34417..f1bebce11b 100644 --- a/tests/s25Main/integration/testTerritoryRegion.cpp +++ b/tests/s25Main/integration/testTerritoryRegion.cpp @@ -208,17 +208,17 @@ BOOST_AUTO_TEST_CASE(isPointValid) // HQ radius = 9, HQs 2 + 5 + 6 = 13 fields apart using WorldFixtureEmpty2P = WorldFixture; -BOOST_FIXTURE_TEST_CASE(CreateTerritoryRegion, WorldFixtureEmpty2P) +BOOST_FIXTURE_TEST_CASE(createTerritoryRegion, WorldFixtureEmpty2P) { std::array milBldPos; - milBldPos[0] = world.MakeMapPoint(world.getPlayer(0).getHQPos() + Position(2, 0)); - milBldPos[1] = world.MakeMapPoint(milBldPos[0] + Position(5, 4)); - milBldPos[2] = world.MakeMapPoint(milBldPos[0] + Position(5, -4)); + milBldPos[0] = world.makeMapPoint(world.getPlayer(0).getHQPos() + Position(2, 0)); + milBldPos[1] = world.makeMapPoint(milBldPos[0] + Position(5, 4)); + milBldPos[2] = world.makeMapPoint(milBldPos[0] + Position(5, -4)); // Distance to HQ must be less than distance to other blds or they will be destroyed on capture - BOOST_TEST_REQUIRE(world.CalcDistance(milBldPos[0], world.getPlayer(0).getHQPos()) + 1 - < world.CalcDistance(milBldPos[0], milBldPos[1])); - BOOST_TEST_REQUIRE(world.CalcDistance(milBldPos[0], world.getPlayer(0).getHQPos()) + 1 - < world.CalcDistance(milBldPos[0], milBldPos[2])); + BOOST_TEST_REQUIRE(world.calcDistance(milBldPos[0], world.getPlayer(0).getHQPos()) + 1 + < world.calcDistance(milBldPos[0], milBldPos[1])); + BOOST_TEST_REQUIRE(world.calcDistance(milBldPos[0], world.getPlayer(0).getHQPos()) + 1 + < world.calcDistance(milBldPos[0], milBldPos[2])); // Create them in different orders. 3 blds -> 6 orders for(unsigned i = 0; i < 6; i++) { @@ -243,7 +243,7 @@ BOOST_FIXTURE_TEST_CASE(CreateTerritoryRegion, WorldFixtureEmpty2P) else positions.push_back(milBldPos[2]); for(const MapPoint pt : positions) - BuildingFactory::CreateBuilding(world, BuildingType::Barracks, pt, (pt == milBldPos[0]) ? 0 : 1, + BuildingFactory::createBuilding(world, BuildingType::Barracks, pt, (pt == milBldPos[0]) ? 0 : 1, Nation::Africans); std::array milBlds; // bld 0 last as it would destroy others @@ -253,17 +253,17 @@ BOOST_FIXTURE_TEST_CASE(CreateTerritoryRegion, WorldFixtureEmpty2P) MapPoint flagPt = milBlds[j]->getFlagPos(); auto sld = std::make_unique(flagPt, milBlds[j]->getPlayer(), milBlds[j], static_cast(milBlds[j]), 0); - world.AddFigure(flagPt, std::move(sld)).ActAtFirst(); + world.addFigure(flagPt, std::move(sld)).actAtFirst(); } milBlds[3] = world.getSpecObj(world.getPlayer(0).getHQPos()); milBlds[4] = world.getSpecObj(world.getPlayer(1).getHQPos()); RTTR_SKIP_GFS(30); TerritoryRegion region(Position(0, 0), Extent(world.getSize()), world); - sortedMilitaryBlds buildings = world.LookForMilitaryBuildings(MapPoint(0, 0), 99); + sortedMilitaryBlds buildings = world.lookForMilitaryBuildings(MapPoint(0, 0), 99); BOOST_TEST_REQUIRE(buildings.size() == 5u); for(const nobBaseMilitary* bld : buildings) - region.CalcTerritoryOfBuilding(*bld); + region.calcTerritoryOfBuilding(*bld); // Check that TerritoryRegion assigned owners as expected RTTR_FOREACH_PT(MapPoint, world.getSize()) { @@ -272,7 +272,7 @@ BOOST_FIXTURE_TEST_CASE(CreateTerritoryRegion, WorldFixtureEmpty2P) unsigned bestID = 0; for(const nobBaseMilitary* bld : milBlds) { - unsigned distance = world.CalcDistance(pt, bld->getPos()); + unsigned distance = world.calcDistance(pt, bld->getPos()); // The closest bld gets the point. If 2 players are tied, the younger bld gets it if(distance > bestDist || distance > bld->getMilitaryRadius()) continue; @@ -298,14 +298,14 @@ BOOST_FIXTURE_TEST_CASE(CreateTerritoryRegion, WorldFixtureEmpty2P) } for(const MapPoint pt : milBldPos) { - world.DestroyNO(pt); - world.DestroyNO(pt); // Destroy fire + world.destroyNO(pt); + world.destroyNO(pt); // Destroy fire // Pause figure for(const noBase& sld : world.getFigures(pt)) { std::vector evts = em.getObjEvents(sld); for(const GameEvent* ev : evts) - em.RescheduleEvent(ev, em.getCurrentGF() + 10000); + em.rescheduleEvent(ev, em.getCurrentGF() + 10000); } } } @@ -325,13 +325,13 @@ BOOST_FIXTURE_TEST_CASE(CreateTerritoryRegionForHQs, WorldFixtureEmpty2P) BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.getNode(pt).owner == 2); } // Remove HQ 1 and its fire to place it closer to HQ 0 - world.DestroyNO(hq1Pos); - world.DestroyNO(hq1Pos); + world.destroyNO(hq1Pos); + world.destroyNO(hq1Pos); this->ggs.setSelection(AddonId::NO_ALLIED_PUSH, true); distance = 7; // Odd number such that there is no point in the same distance to both HQs const MapPoint newHq1Pos = hq0Pos + MapPoint(distance, 0); - BuildingFactory::CreateBuilding(world, BuildingType::Headquarters, newHq1Pos, 1, Nation::Africans); + BuildingFactory::createBuilding(world, BuildingType::Headquarters, newHq1Pos, 1, Nation::Africans); for(const MapPoint pt : world.GetPointsInRadiusWithCenter(hq0Pos, distance / 2)) BOOST_TEST_CONTEXT("pt: " << pt) { BOOST_TEST(world.getNode(pt).owner == 1); } for(const MapPoint pt : world.GetPointsInRadiusWithCenter(newHq1Pos, distance / 2)) @@ -353,8 +353,8 @@ BOOST_FIXTURE_TEST_CASE(CreateTerritoryRegionForDestroyedHQ, WorldFixtureEmpty2P this->ggs.setSelection(AddonId::NO_ALLIED_PUSH, true); // Remove HQ 1 and its fire - world.DestroyNO(hq1Pos); - world.DestroyNO(hq1Pos); + world.destroyNO(hq1Pos); + world.destroyNO(hq1Pos); auto hq0Region = world.GetPointsInRadiusWithCenter(hq0Pos, 9); RTTR_FOREACH_PT(MapPoint, world.getSize()) diff --git a/tests/s25Main/integration/testTrading.cpp b/tests/s25Main/integration/testTrading.cpp index 9b84e761ea..f9b076020a 100644 --- a/tests/s25Main/integration/testTrading.cpp +++ b/tests/s25Main/integration/testTrading.cpp @@ -31,7 +31,7 @@ struct TradeFixture : public WorldWithGCExecution3P world.getPlayer(2).team = Team::Team2; for(unsigned i = 0; i < world.getNumPlayers(); i++) { - world.getPlayer(i).MakeStartPacts(); + world.getPlayer(i).makeStartPacts(); players[i] = &world.getPlayer(i); } BOOST_TEST_REQUIRE(players[1]->isAlly(0)); @@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE(TradeWares) testAfterLeaving(2); // Let caravan arrive (20GFs per node) - unsigned distance = world.CalcDistance(curWh->getPos(), players[0]->getHQPos()) + 2; + unsigned distance = world.calcDistance(curWh->getPos(), players[0]->getHQPos()) + 2; RTTR_SKIP_GFS(20 * distance); // Some were recruited numHelpers -= numSwords; @@ -155,7 +155,7 @@ BOOST_AUTO_TEST_CASE(TradeFigures) testAfterLeaving(2); // Let caravan arrive (20GFs per node) - unsigned distance = world.CalcDistance(curWh->getPos(), players[0]->getHQPos()) + 2; + unsigned distance = world.calcDistance(curWh->getPos(), players[0]->getHQPos()) + 2; RTTR_SKIP_GFS(20 * distance); // Some were recruited numHelpers -= numSwords; @@ -206,14 +206,14 @@ BOOST_AUTO_TEST_CASE(TradeLessFiguresThenInStoreHouse) auto* const hqPlayer1 = world.getSpecObj(players[1]->getHQPos()); // Add second warehouse - auto* wh1 = static_cast(BuildingFactory::CreateBuilding( + auto* wh1 = static_cast(BuildingFactory::createBuilding( world, BuildingType::Storehouse, players[1]->getHQPos() + MapPoint(2, 0), 1, Nation::Romans)); world.BuildRoad(0, false, wh1->getFlagPos(), {2, Direction::East}); PeopleCounts inv; inv[Job::Woodcutter] = 2; inv[Job::Helper] = 1; - wh1->AddToInventory(inv, true); + wh1->addToInventory(inv, true); BOOST_TEST_REQUIRE(hqPlayer1->getNumRealFigures(Job::Woodcutter) == 8); BOOST_TEST_REQUIRE(wh1->getNumRealFigures(Job::Woodcutter) == 2); @@ -252,7 +252,7 @@ BOOST_AUTO_TEST_CASE(TradeFail) std::vector pts = world.getPointsInRadius(curWh->getPos(), 10); for(const MapPoint& pt : pts) { - if(world.CalcDistance(pt, curWh->getPos()) >= 8) + if(world.calcDistance(pt, curWh->getPos()) >= 8) world.setOwner(pt, 2 + 1); // playerID = 2 -> Owner = +1 } // New trade fails @@ -303,14 +303,14 @@ BOOST_AUTO_TEST_CASE(TradeFailDie) BOOST_AUTO_TEST_CASE(TradeMessages) { - const PostBox& postbox = world.getPostMgr().AddPostBox(0); + const PostBox& postbox = world.getPostMgr().addPostBox(0); this->TradeOverLand(players[0]->getHQPos(), Job::Woodcutter, 2); numHelpers -= 1; numWoodcutters -= 2; testAfterLeaving(2); - unsigned distance = world.CalcDistance(curWh->getPos(), players[0]->getHQPos()) + 2; + unsigned distance = world.calcDistance(curWh->getPos(), players[0]->getHQPos()) + 2; RTTR_SKIP_GFS(20 * distance); // warriors are recruited numHelpers -= numSwords; @@ -328,7 +328,7 @@ BOOST_AUTO_TEST_CASE(TradeMessages) numBoards -= 2; testAfterLeaving(2); - distance = world.CalcDistance(curWh->getPos(), players[0]->getHQPos()) + 2; + distance = world.calcDistance(curWh->getPos(), players[0]->getHQPos()) + 2; RTTR_SKIP_GFS(20 * distance); const PostMsg* post2 = postbox.getMsg(1); diff --git a/tests/s25Main/integration/testWorld.cpp b/tests/s25Main/integration/testWorld.cpp index 78bb7bf77d..432cbd3ca1 100644 --- a/tests/s25Main/integration/testWorld.cpp +++ b/tests/s25Main/integration/testWorld.cpp @@ -106,7 +106,7 @@ BOOST_FIXTURE_TEST_CASE(SameBQasInS2, WorldLoadedWithS2MapFixture) { using libsiedler2::MapLayer; // Init BQ - world.InitAfterLoad(); + world.initAfterLoad(); RTTR_FOREACH_PT(MapPoint, world.getSize()) { BOOST_TEST_INFO("pt " << pt); @@ -223,7 +223,7 @@ BOOST_FIXTURE_TEST_CASE(CloseHarborSpots, WorldFixture(world.getNumHarborPoints())) @@ -240,7 +240,7 @@ BOOST_FIXTURE_TEST_CASE(CloseHarborSpots, WorldFixture route; - BOOST_TEST_REQUIRE((startPt == destPt || world.FindShipPath(startPt, destPt, 10000, &route, nullptr))); + BOOST_TEST_REQUIRE((startPt == destPt || world.findShipPath(startPt, destPt, 10000, &route, nullptr))); BOOST_TEST_REQUIRE(route.size() == world.getMinHarborDistance(startHb, targetHb)); } } @@ -271,7 +271,7 @@ BOOST_FIXTURE_TEST_CASE(LoadLua, WorldFixture) invalidLuaFile.close(); { rttr::test::LogAccessor logAcc; - BOOST_TEST_REQUIRE(!loader.LoadLuaScript(*game, lgs, invalidLuaFile.filePath)); + BOOST_TEST_REQUIRE(!loader.loadLuaScript(*game, lgs, invalidLuaFile.filePath)); BOOST_TEST(!world.hasLua()); RTTR_REQUIRE_LOG_CONTAINS("getRequiredLuaVersion()", false); // Should show a warning } @@ -281,7 +281,7 @@ BOOST_FIXTURE_TEST_CASE(LoadLua, WorldFixture) << "\n end"; validLuaFile.close(); - BOOST_TEST_REQUIRE(loader.LoadLuaScript(*game, lgs, validLuaFile.filePath)); + BOOST_TEST_REQUIRE(loader.loadLuaScript(*game, lgs, validLuaFile.filePath)); BOOST_TEST(world.hasLua()); } diff --git a/tests/s25Main/integration/testWorldCreation.cpp b/tests/s25Main/integration/testWorldCreation.cpp index a4bf70f42a..c8f706ecea 100644 --- a/tests/s25Main/integration/testWorldCreation.cpp +++ b/tests/s25Main/integration/testWorldCreation.cpp @@ -23,11 +23,11 @@ BOOST_FIXTURE_TEST_CASE(HQPlacement, WorldFixtureEmpty1P) for(MapPoint pt : ownerPts) { // This should be ensured by `GetPointsInRadius` - BOOST_TEST_REQUIRE(world.CalcDistance(pt, hqPos) <= HQ_RADIUS); + BOOST_TEST_REQUIRE(world.calcDistance(pt, hqPos) <= HQ_RADIUS); // We must own this point BOOST_TEST_REQUIRE(world.getNode(pt).owner == 1); // Points at radius are border nodes, others player territory - if(world.CalcDistance(pt, hqPos) == HQ_RADIUS) + if(world.calcDistance(pt, hqPos) == HQ_RADIUS) BOOST_TEST_REQUIRE(world.isBorderNode(pt, 1)); else BOOST_TEST_REQUIRE(world.isPlayerTerritory(pt)); diff --git a/tests/s25Main/integration/testWorldFixtures.cpp b/tests/s25Main/integration/testWorldFixtures.cpp index a8b06833d8..ae03377001 100644 --- a/tests/s25Main/integration/testWorldFixtures.cpp +++ b/tests/s25Main/integration/testWorldFixtures.cpp @@ -10,12 +10,12 @@ namespace { struct TestGO : GameObject { // LCOV_EXCL_START - void Destroy() override final{}; + void destroy() override final{}; void Serialize(SerializedGameData&) const override final{}; GO_Type getGOT() const override final { return GO_Type::Animal; } // LCOV_EXCL_STOP - void HandleEvent(unsigned) override final { handled = true; } + void handleEvent(unsigned) override final { handled = true; } bool handled = false; }; } // namespace @@ -27,16 +27,16 @@ BOOST_FIXTURE_TEST_CASE(SkipGFs_Works, WorldFixtureEmpty) BOOST_TEST(em.getNumActiveEvents() == 0u); RTTR_SKIP_GFS(0); BOOST_TEST(em.getCurrentGF() == 0u); - BOOST_TEST(em.ExecuteNextEvent(0) == 0u); + BOOST_TEST(em.executeNextEvent(0) == 0u); BOOST_TEST(em.getCurrentGF() == 0u); RTTR_SKIP_GFS(10); BOOST_TEST(em.getCurrentGF() == 10u); - BOOST_TEST(em.ExecuteNextEvent(5) == 0u); - BOOST_TEST(em.ExecuteNextEvent(10) == 0u); + BOOST_TEST(em.executeNextEvent(5) == 0u); + BOOST_TEST(em.executeNextEvent(10) == 0u); BOOST_TEST(em.getCurrentGF() == 10u); TestGO go; - em.AddEvent(&go, 10); + em.addEvent(&go, 10); RTTR_SKIP_GFS(5); // No event triggered BOOST_TEST(em.getCurrentGF() == 15u); BOOST_TEST(!go.handled); @@ -45,7 +45,7 @@ BOOST_FIXTURE_TEST_CASE(SkipGFs_Works, WorldFixtureEmpty) BOOST_TEST(go.handled); go.handled = false; - em.AddEvent(&go, 8); // at +20 + em.addEvent(&go, 8); // at +20 unsigned numGF; RTTR_EXEC_TILL_CT_GF(100, go.handled, numGF); diff --git a/tests/s25Main/lua/GameWithLuaAccess.h b/tests/s25Main/lua/GameWithLuaAccess.h index 61599809e9..d163b75250 100644 --- a/tests/s25Main/lua/GameWithLuaAccess.h +++ b/tests/s25Main/lua/GameWithLuaAccess.h @@ -39,12 +39,12 @@ class GameWithLuaAccess : public Game std::vector aiGcs = ai->FetchGameCommands(); for(unsigned i = 0; i < 5; i++) { - em_->ExecuteNextGF(); - ai->RunGF(em_->getCurrentGF(), i == 0); + em_->executeNextGF(); + ai->runGF(em_->getCurrentGF(), i == 0); } for(gc::GameCommandPtr& gc : aiGcs) { - gc->Execute(world_, 1); + gc->execute(world_, 1); } } @@ -96,13 +96,13 @@ struct LuaTestsFixture : public rttr::test::LogAccessor, public LuaBaseFixture, std::vector playerNations; playerNations.push_back(world.getPlayer(0).nation); playerNations.push_back(world.getPlayer(1).nation); - BOOST_TEST_REQUIRE(MapLoader::PlaceHQs(world, hqPositions, false)); + BOOST_TEST_REQUIRE(MapLoader::placeHQs(world, hqPositions, false)); for(unsigned id = 0; id < world.getNumPlayers(); id++) { GamePlayer& player = world.getPlayer(id); if(!player.isHuman() && player.isUsed()) - game.AddAIPlayer(AIFactory::Create(world.getPlayer(id).aiInfo, id, world)); + game.addAIPlayer(AIFactory::create(world.getPlayer(id).aiInfo, id, world)); } } diff --git a/tests/s25Main/lua/testLua.cpp b/tests/s25Main/lua/testLua.cpp index 5790beb713..bd68ee4936 100644 --- a/tests/s25Main/lua/testLua.cpp +++ b/tests/s25Main/lua/testLua.cpp @@ -92,20 +92,20 @@ BOOST_AUTO_TEST_CASE(BaseFunctions) // No getRequiredLuaVersion LuaInterfaceGameBase& lua = world.getLua(); - BOOST_TEST_REQUIRE(!lua.CheckScriptVersion()); + BOOST_TEST_REQUIRE(!lua.checkScriptVersion()); BOOST_TEST_REQUIRE(getLog() != ""); // Wrong version executeLua("function getRequiredLuaVersion()\n return 0\n end"); - BOOST_TEST_REQUIRE(!lua.CheckScriptVersion()); + BOOST_TEST_REQUIRE(!lua.checkScriptVersion()); BOOST_TEST_REQUIRE(getLog() != ""); executeLua(boost::format("function getRequiredLuaVersion()\n return %1%\n end") % (LuaInterfaceGameBase::getVersion() + 1)); - BOOST_TEST_REQUIRE(!lua.CheckScriptVersion()); + BOOST_TEST_REQUIRE(!lua.checkScriptVersion()); BOOST_TEST_REQUIRE(getLog() != ""); // Correct version executeLua(boost::format("function getRequiredLuaVersion()\n return %1%\n end") % LuaInterfaceGameBase::getVersion()); - BOOST_TEST_REQUIRE(lua.CheckScriptVersion()); + BOOST_TEST_REQUIRE(lua.checkScriptVersion()); BOOST_TEST(isLuaEqual("rttr:GetFeatureLevel()", s25util::toStringClassic(lua.getFeatureLevel()))); @@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE(GameFunctions) inv[ConvertShields(rttr::test::randomEnum())] = rttr::test::randomValue(1u, 10u); } inv[Job::BoatCarrier] = 0; - hq->AddToInventory(inv, true); + hq->addToInventory(inv, true); } executeLua("rttr:ClearResources()"); @@ -200,24 +200,24 @@ BOOST_AUTO_TEST_CASE(GameFunctions) for([[maybe_unused]] const auto i : helpers::range(2)) { BOOST_TEST(isLuaEqual("rttr:GetGF()", s25util::toStringClassic(world.getEvMgr().getCurrentGF()))); - world.getEvMgr().ExecuteNextGF(); + world.getEvMgr().executeNextGF(); } // Set player id MOCK_EXPECT(localGameState.getPlayerId).returns(1); // Send to other player - MOCK_EXPECT(localGameState.SystemChat).never(); + MOCK_EXPECT(localGameState.systemChat).never(); executeLua("rttr:Chat(0, 'Hello World')"); - MOCK_VERIFY(localGameState.SystemChat); - MOCK_RESET(localGameState.SystemChat); + MOCK_VERIFY(localGameState.systemChat); + MOCK_RESET(localGameState.systemChat); // Send to this player and all - MOCK_EXPECT(localGameState.SystemChat).once().with("Hello World"); - MOCK_EXPECT(localGameState.SystemChat).once().with("Hello All"); + MOCK_EXPECT(localGameState.systemChat).once().with("Hello World"); + MOCK_EXPECT(localGameState.systemChat).once().with("Hello All"); executeLua("rttr:Chat(1, 'Hello World')"); executeLua("rttr:Chat(-1, 'Hello All')"); - MOCK_VERIFY(localGameState.SystemChat); + MOCK_VERIFY(localGameState.systemChat); - world.getPostMgr().AddPostBox(1); + world.getPostMgr().addPostBox(1); const PostBox& postBox = *world.getPostMgr().getPostBox(1); // Send to other player or invalid executeLua("rttr:PostMessage(0, 'Hello World')"); @@ -247,7 +247,7 @@ BOOST_AUTO_TEST_CASE(GameFunctions) executeLua("assert(rttr:GetWorld())"); - MOCK_EXPECT(localGameState.FormatGFTime).once().with(1023u).returns("01:13:17"); + MOCK_EXPECT(localGameState.formatGFTime).once().with(1023u).returns("01:13:17"); BOOST_TEST(isLuaEqual("rttr:FormatNumGFs(1023)", "'01:13:17'")); } @@ -255,7 +255,7 @@ BOOST_AUTO_TEST_CASE(MissionGoal) { initWorld(); - const PostBox& postBox = world.getPostMgr().AddPostBox(1); + const PostBox& postBox = world.getPostMgr().addPostBox(1); BOOST_TEST_REQUIRE(postBox.getCurrentMissionGoal().empty()); //-V807 // Set goal for non-existing or other player @@ -342,7 +342,7 @@ BOOST_AUTO_TEST_CASE(IngamePlayer) BOOST_TEST_REQUIRE(!player.isBuildingEnabled(BuildingType::Woodcutter)); BOOST_TEST_REQUIRE(!player.isBuildingEnabled(BuildingType::Fortress)); - world.getPostMgr().AddPostBox(1); + world.getPostMgr().addPostBox(1); const PostBox& postBox = *world.getPostMgr().getPostBox(1); // Enable without notification executeLua("player:EnableBuilding(BLD_WOODCUTTER)"); @@ -481,11 +481,11 @@ BOOST_AUTO_TEST_CASE(IngamePlayer) BOOST_TEST(isLuaEqual("hqY", s25util::toStringClassic(hq->getPos().y))); // Destroy players HQ - world.DestroyNO(hq->getPos()); + world.destroyNO(hq->getPos()); // HQ-Pos is invalid executeLua("hqX, hqY = player:GetHQPos()"); - BOOST_TEST(isLuaEqual("hqX", s25util::toStringClassic(MapPoint::Invalid().x))); - BOOST_TEST(isLuaEqual("hqY", s25util::toStringClassic(MapPoint::Invalid().y))); + BOOST_TEST(isLuaEqual("hqX", s25util::toStringClassic(MapPoint::invalid().x))); + BOOST_TEST(isLuaEqual("hqY", s25util::toStringClassic(MapPoint::invalid().y))); // Adding wares/people returns false executeLua("assert(player:AddWares(wares) == false)"); executeLua("assert(player:AddPeople(people) == false)"); @@ -574,7 +574,7 @@ BOOST_AUTO_TEST_CASE(World) { LogAccessor logAcc; initWorld(); - LOADER.LoadDummyMapFiles(); + LOADER.loadDummyMapFiles(); executeLua("world = rttr:GetWorld()"); const MapPoint envPt(15, 12); @@ -586,7 +586,7 @@ BOOST_AUTO_TEST_CASE(World) BOOST_TEST(obj->getItemFile() == 0xFFFFu); // Replace and test wrap around (envPt2==envPt1) const Position envPt2(envPt.x + world.getWidth(), envPt.y - world.getHeight()); - BOOST_TEST_REQUIRE(world.MakeMapPoint(envPt2) == envPt); + BOOST_TEST_REQUIRE(world.makeMapPoint(envPt2) == envPt); executeLua(boost::format("world:AddEnvObject(%1%, %2%, 1, 2)") % envPt2.x % envPt2.y); obj = world.getSpecObj(envPt); BOOST_TEST_REQUIRE(obj); @@ -684,16 +684,16 @@ BOOST_AUTO_TEST_CASE(WorldEvents) const MapPoint pt1(3, 4), pt2(5, 1), pt3(7, 6); // All events need to work w/o having them LuaInterfaceGame& lua = world.getLua(); - lua.EventStart(true); + lua.eventStart(true); Serializer serData; BOOST_TEST_REQUIRE(lua.Serialize(serData)); BOOST_TEST_REQUIRE(serData.GetLength() == 0u); BOOST_TEST_REQUIRE(lua.Deserialize(serData)); - lua.EventOccupied(1, pt1); - lua.EventAttack(0, 1, 5); - lua.EventExplored(1, pt2, 0); - lua.EventGameFrame(0); - lua.EventResourceFound(1, pt3, ResourceType::Gold, 1); + lua.eventOccupied(1, pt1); + lua.eventAttack(0, 1, 5); + lua.eventExplored(1, pt2, 0); + lua.eventGameFrame(0); + lua.eventResourceFound(1, pt3, ResourceType::Gold, 1); executeLua("function getResName(res)\n if(res==RES_IRON) then return 'Iron' " "elseif(res==RES_GOLD) then return 'Gold' " "elseif(res==RES_COAL) then return 'Coal' " @@ -702,9 +702,9 @@ BOOST_AUTO_TEST_CASE(WorldEvents) "else assert(false)\n end\n end"); executeLua("function onStart(isFirstStart)\n rttr:Log('start: '..tostring(isFirstStart))\nend"); clearLog(); - lua.EventStart(true); + lua.eventStart(true); BOOST_TEST_REQUIRE(getLog() == "start: true\n"); - lua.EventStart(false); + lua.eventStart(false); BOOST_TEST_REQUIRE(getLog() == "start: false\n"); // Returning false should not save anything @@ -762,37 +762,37 @@ BOOST_AUTO_TEST_CASE(WorldEvents) executeLua("function onExplored(player_id, x, y, owner)\n rttr:Log('explored: '..player_id..'('..x..', " "'..y..')'..tostring(owner))\nend"); // Owner == 0 -> No owner (nil in lua) - lua.EventExplored(0, pt2, 0); + lua.eventExplored(0, pt2, 0); BOOST_TEST_REQUIRE(getLog() == (boost::format("explored: %1%%2%%3%\n") % 0 % pt2 % "nil").str()); // Else owner-1 = playerIdx - lua.EventExplored(0, pt2, 2); + lua.eventExplored(0, pt2, 2); BOOST_TEST_REQUIRE(getLog() == (boost::format("explored: %1%%2%%3%\n") % 0 % pt2 % 1).str()); executeLua( "function onAttack(attacker_player_id, defender_player_id, attacker_count)\n" " rttr:Log('attack: '..attacker_player_id..'->'..defender_player_id..' (Attacker: '..attacker_count..')')\nend"); - lua.EventAttack(0, 1, 4); + lua.eventAttack(0, 1, 4); BOOST_TEST_REQUIRE(getLog() == (boost::format("attack: %1%->%2% (Attacker: %3%)\n") % 0 % 1 % 4).str()); executeLua("function onGameFrame(gameframe_number)\n rttr:Log('gf: '..gameframe_number)\nend"); - lua.EventGameFrame(0); + lua.eventGameFrame(0); BOOST_TEST_REQUIRE(getLog() == "gf: 0\n"); - lua.EventGameFrame(42); + lua.eventGameFrame(42); BOOST_TEST_REQUIRE(getLog() == "gf: 42\n"); executeLua( "function onResourceFound(player_id, x, y, type, quantity)\n rttr:Log('resFound: '..player_id..'('..x..', " "'..y..')'..getResName(type)..':'..quantity)\nend"); boost::format resFmt("resFound: %1%%2%%3%:%4%\n"); - lua.EventResourceFound(2, pt3, ResourceType::Iron, 1); + lua.eventResourceFound(2, pt3, ResourceType::Iron, 1); BOOST_TEST_REQUIRE(getLog() == (resFmt % 2 % pt3 % "Iron" % 1).str()); - lua.EventResourceFound(2, pt3, ResourceType::Gold, 2); + lua.eventResourceFound(2, pt3, ResourceType::Gold, 2); BOOST_TEST_REQUIRE(getLog() == (resFmt % 2 % pt3 % "Gold" % 2).str()); - lua.EventResourceFound(2, pt3, ResourceType::Coal, 3); + lua.eventResourceFound(2, pt3, ResourceType::Coal, 3); BOOST_TEST_REQUIRE(getLog() == (resFmt % 2 % pt3 % "Coal" % 3).str()); - lua.EventResourceFound(2, pt3, ResourceType::Granite, 6); + lua.eventResourceFound(2, pt3, ResourceType::Granite, 6); BOOST_TEST_REQUIRE(getLog() == (resFmt % 2 % pt3 % "Granite" % 6).str()); - lua.EventResourceFound(2, pt3, ResourceType::Water, 5); + lua.eventResourceFound(2, pt3, ResourceType::Water, 5); BOOST_TEST_REQUIRE(getLog() == (resFmt % 2 % pt3 % "Water" % 5).str()); } @@ -907,7 +907,7 @@ BOOST_AUTO_TEST_CASE(LuaPacts) BOOST_TEST_REQUIRE(player.isAttackable(1)); BOOST_TEST_REQUIRE(getLog() == "Pact canceled\n"); - const PostBox& postbox = world.getPostMgr().AddPostBox(0); + const PostBox& postbox = world.getPostMgr().addPostBox(0); // Suggest Pact from Lua executeLua("player:SuggestPact(0, TREATY_OF_ALLIANCE, DURATION_INFINITE)"); game.executeAICommands(); diff --git a/tests/s25Main/lua/testLuaGUI.cpp b/tests/s25Main/lua/testLuaGUI.cpp index 36d5576c97..352285eab8 100644 --- a/tests/s25Main/lua/testLuaGUI.cpp +++ b/tests/s25Main/lua/testLuaGUI.cpp @@ -19,7 +19,7 @@ struct LuaGuiFixture : LuaTestsFixture, uiHelper::Fixture BOOST_FIXTURE_TEST_SUITE(LuaGUITestSuite, LuaGuiFixture) -BOOST_AUTO_TEST_CASE(MissionStatement) +BOOST_AUTO_TEST_CASE(missionStatement) { // Set player MOCK_EXPECT(localGameState.getPlayerId).returns(1); @@ -48,14 +48,14 @@ BOOST_AUTO_TEST_CASE(MissionStatement) BOOST_TEST(wnd2 != wnd); BOOST_TEST(wnd2->getTitle() == "Title2"); // Close 2nd (topmost) wnd - WINDOWMANAGER.CloseNow(const_cast(wnd2)); + WINDOWMANAGER.closeNow(const_cast(wnd2)); // 1st shows again wnd2 = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); BOOST_TEST_REQUIRE(wnd2); BOOST_TEST(wnd2 == wnd); BOOST_TEST(wnd2->getTitle() == _("Title")); // Close wnd - WINDOWMANAGER.CloseNow(const_cast(wnd)); + WINDOWMANAGER.closeNow(const_cast(wnd)); BOOST_TEST_REQUIRE(!WINDOWMANAGER.getTopMostWindow()); // No image @@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE(MissionStatement) BOOST_TEST(wnd->IsActive()); BOOST_TEST(wnd->getTitle() == _("Title")); BOOST_TEST(wnd->getCtrls().empty()); - WINDOWMANAGER.CloseNow(const_cast(wnd)); + WINDOWMANAGER.closeNow(const_cast(wnd)); // Non-default image executeLua("rttr:MissionStatement(1, 'Title', 'Text', IM_AVATAR10)"); wnd = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); @@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE(MissionStatement) BOOST_TEST(wnd->IsActive()); BOOST_TEST(wnd->getTitle() == _("Title")); BOOST_TEST(!wnd->getCtrls().empty()); - WINDOWMANAGER.CloseNow(const_cast(wnd)); + WINDOWMANAGER.closeNow(const_cast(wnd)); // Invalid image executeLua("rttr:MissionStatement(1, 'Title', 'Text', 999999)"); wnd = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); @@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE(MissionStatement) BOOST_TEST(wnd->IsActive()); BOOST_TEST(wnd->getTitle() == _("Title")); BOOST_TEST(wnd->getCtrls().empty()); - WINDOWMANAGER.CloseNow(const_cast(wnd)); + WINDOWMANAGER.closeNow(const_cast(wnd)); } BOOST_AUTO_TEST_CASE(MessageBoxTest) @@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE(MessageBoxTest) BOOST_TEST(wnd->getCtrls().front()->getPos().y > 15 * NormalFont->getHeight()); // And window higher than button BOOST_TEST(static_cast(wnd->getIwSize().y) > wnd->getCtrls().front()->getPos().y); - WINDOWMANAGER.CloseNow(const_cast(wnd)); + WINDOWMANAGER.closeNow(const_cast(wnd)); // Error executeLua("rttr:MsgBox('Title', 'Text', true)"); wnd = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); @@ -110,7 +110,7 @@ BOOST_AUTO_TEST_CASE(MessageBoxTest) BOOST_TEST(!wnd->getCtrls().empty()); BOOST_TEST(wnd->getCtrls().front()->getImage() == LOADER.getImageN("io", rttr::enum_cast(MsgboxIcon::ExclamationRed))); - WINDOWMANAGER.CloseNow(const_cast(wnd)); + WINDOWMANAGER.closeNow(const_cast(wnd)); // MsgBoxEx executeLua("rttr:MsgBoxEx('Title', 'Text', 'io', 100)"); wnd = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); @@ -119,7 +119,7 @@ BOOST_AUTO_TEST_CASE(MessageBoxTest) BOOST_TEST(wnd->getTitle() == _("Title")); BOOST_TEST(!wnd->getCtrls().empty()); BOOST_TEST(wnd->getCtrls().front()->getImage() == LOADER.getImageN("io", 100)); - WINDOWMANAGER.CloseNow(const_cast(wnd)); + WINDOWMANAGER.closeNow(const_cast(wnd)); // MsgBoxEx with position executeLua("rttr:MsgBoxEx('Title', 'Text', 'io', 101, 500, 200)"); wnd = dynamic_cast(WINDOWMANAGER.getTopMostWindow()); @@ -148,15 +148,15 @@ BOOST_AUTO_TEST_CASE(MessageBoxTest) const std::vector imgPts{DrawPoint(30, 30), DrawPoint(300, 30), DrawPoint(150, 30), DrawPoint(150, 300)}; for(const auto& imgPt : imgPts) { - const_cast(wnd)->MoveIcon(imgPt); + const_cast(wnd)->moveIcon(imgPt); Rect imgRect(img->getPos() - actImg->getOrigin(), actImg->getSize()); // Image must be in wnd BOOST_TEST(static_cast(wnd->getSize().x) > imgRect.right); BOOST_TEST(static_cast(wnd->getSize().y) > imgRect.bottom); // Not over button or text - BOOST_TEST(!DoRectsIntersect(imgRect, bt->getDrawRect())); + BOOST_TEST(!doRectsIntersect(imgRect, bt->getDrawRect())); const ctrlMultiline* text = wnd->getCtrls().front(); - BOOST_TEST(!DoRectsIntersect(imgRect, text->getDrawRect())); + BOOST_TEST(!doRectsIntersect(imgRect, text->getDrawRect())); } } diff --git a/tests/s25Main/lua/testLuaSettings.cpp b/tests/s25Main/lua/testLuaSettings.cpp index e58dd02ed3..fc039b0f4f 100644 --- a/tests/s25Main/lua/testLuaSettings.cpp +++ b/tests/s25Main/lua/testLuaSettings.cpp @@ -40,8 +40,8 @@ struct LuaSettingsTestsFixture : public LuaBaseFixture, public IGameLobbyControl unsigned getMaxNumPlayers() const override { return players.size(); } JoinPlayerInfo& getJoinPlayer(unsigned playerIdx) override { return players.at(playerIdx); } const GlobalGameSettings& getGGS() const override { return ggs; } - void ChangeGlobalGameSettings(const GlobalGameSettings& ggs) override { this->ggs = ggs; } - void CloseSlot(unsigned playerIdx) override { getJoinPlayer(playerIdx).ps = PlayerState::Locked; } + void changeGlobalGameSettings(const GlobalGameSettings& ggs) override { this->ggs = ggs; } + void closeSlot(unsigned playerIdx) override { getJoinPlayer(playerIdx).ps = PlayerState::Locked; } void setPlayerState(unsigned playerIdx, PlayerState state, const AI::Info& aiInfo) override { getJoinPlayer(playerIdx).ps = state; @@ -110,11 +110,11 @@ BOOST_AUTO_TEST_CASE(AssertionThrows) BOOST_AUTO_TEST_CASE(Events) { // All events need to work w/o having them - lua.EventSettingsInit(true, false); - lua.EventSettingsReady(); - lua.EventPlayerJoined(0); - lua.EventPlayerLeft(0); - lua.EventPlayerReady(0); + lua.eventSettingsInit(true, false); + lua.eventSettingsReady(); + lua.eventPlayerJoined(0); + lua.eventPlayerLeft(0); + lua.eventPlayerReady(0); BOOST_TEST_REQUIRE(lua.isChangeAllowed("general", true)); BOOST_TEST_REQUIRE(!lua.isChangeAllowed("general", false)); std::vector allowedAddons = lua.getAllowedAddons(); @@ -123,25 +123,25 @@ BOOST_AUTO_TEST_CASE(Events) clearLog(); executeLua("function onSettingsInit(isSinglePlayer, isSavegame)\n rttr:Log('init: '..tostring(isSinglePlayer)..' " "'..tostring(isSavegame))\nend"); - lua.EventSettingsInit(true, false); + lua.eventSettingsInit(true, false); BOOST_TEST_REQUIRE(getLog() == "init: true false\n"); - lua.EventSettingsInit(false, true); + lua.eventSettingsInit(false, true); BOOST_TEST_REQUIRE(getLog() == "init: false true\n"); executeLua("function onSettingsReady()\n rttr:Log('ready')\nend"); - lua.EventSettingsReady(); + lua.eventSettingsReady(); BOOST_TEST_REQUIRE(getLog() == "ready\n"); executeLua("function onPlayerJoined(playerIdx)\n rttr:Log('joined'..playerIdx)\nend"); - lua.EventPlayerJoined(2); + lua.eventPlayerJoined(2); BOOST_TEST_REQUIRE(getLog() == "joined2\n"); executeLua("function onPlayerLeft(playerIdx)\n rttr:Log('left'..playerIdx)\nend"); - lua.EventPlayerLeft(2); + lua.eventPlayerLeft(2); BOOST_TEST_REQUIRE(getLog() == "left2\n"); executeLua("function onPlayerReady(playerIdx)\n rttr:Log('ready'..playerIdx)\nend"); - lua.EventPlayerReady(2); + lua.eventPlayerReady(2); BOOST_TEST_REQUIRE(getLog() == "ready2\n"); executeLua("function getAllowedChanges()\n return {general=true, swapping=true}\nend"); diff --git a/tests/s25Main/mapGenerator/testAlgorithms.cpp b/tests/s25Main/mapGenerator/testAlgorithms.cpp index 9b6725ea10..3907db153f 100644 --- a/tests/s25Main/mapGenerator/testAlgorithms.cpp +++ b/tests/s25Main/mapGenerator/testAlgorithms.cpp @@ -37,18 +37,18 @@ BOOST_AUTO_TEST_CASE(UpdateDistances_updates_enqueued_elements_correctly) MapExtent size(8, 8); MapPoint reference(4, 7); NodeMapBase distances; - distances.Resize(size, unsigned(-1)); + distances.resize(size, unsigned(-1)); std::queue queue; queue.push(reference); distances[reference] = 0; - UpdateDistances(distances, queue); + updateDistances(distances, queue); BOOST_TEST_REQUIRE(queue.empty()); RTTR_FOREACH_PT(MapPoint, size) { - BOOST_TEST_REQUIRE(distances[pt] == distances.CalcDistance(pt, reference)); + BOOST_TEST_REQUIRE(distances[pt] == distances.calcDistance(pt, reference)); } } @@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE(Smooth_keeps_homogenous_map_unchanged) const int iterations = 2; const int expectedValue = 1; - nodes.Resize(size, expectedValue); + nodes.resize(size, expectedValue); Smooth(iterations, radius, nodes); @@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE(Smooth_interpolates_values_around_peak) const int iterations = 2; const int defaultValue = 1; - nodes.Resize(size, defaultValue); + nodes.resize(size, defaultValue); nodes[peak] = peakValue; Smooth(iterations, radius, nodes); @@ -101,11 +101,11 @@ BOOST_AUTO_TEST_CASE(Scale_updates_minimum_and_maximum_values_correctly) { MapExtent size(16, 8); NodeMapBase values; - values.Resize(size, 8u); + values.resize(size, 8u); values[0] = 12; // max values[1] = 7; // min - Scale(values, 0u, 20u); + scale(values, 0u, 20u); BOOST_TEST(values[0] == 20u); BOOST_TEST(values[1] == 0u); @@ -115,9 +115,9 @@ BOOST_AUTO_TEST_CASE(Scale_keeps_equal_values_unchanged) { MapExtent size(16, 8); NodeMapBase values; - values.Resize(size, 8u); + values.resize(size, 8u); - Scale(values, 0u, 20u); + scale(values, 0u, 20u); RTTR_FOREACH_PT(MapPoint, size) { @@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(Collect_returns_empty_for_negative_map_point) MapExtent size(16, 8); MapPoint negative(0, 0); - map.Resize(size, 1); + map.resize(size, 1); map[negative] = 0; auto result = Collect(map, negative, [&map](const MapPoint& p) { return map[p]; }); @@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE(Collect_returns_all_map_points_for_entirely_positive_map) MapExtent size(16, 8); MapPoint point(0, 0); - map.Resize(size, 1); + map.resize(size, 1); auto result = Collect(map, point, [&map](const MapPoint& p) { return map[p]; }); @@ -163,7 +163,7 @@ BOOST_AUTO_TEST_CASE(Collect_returns_only_connected_positive_map_points) { NodeMapBase map; MapExtent size(16, 16); - map.Resize(size, 0); + map.resize(size, 0); // positive area around target point MapPoint point(3, 4); @@ -260,7 +260,7 @@ BOOST_AUTO_TEST_CASE(LimitFor_ignores_map_points_outside_of_area) { MapExtent size(8, 16); NodeMapBase values; - values.Resize(size); + values.resize(size); for(int i = 0; i < size.x * size.y; i++) { values[i] = i; @@ -287,7 +287,7 @@ BOOST_AUTO_TEST_CASE(LimitFor_ignores_map_points_below_minimum_threshold) { MapExtent size(8, 16); NodeMapBase values; - values.Resize(size); + values.resize(size); for(int i = 0; i < size.x * size.y; i++) { values[i] = i; @@ -313,7 +313,7 @@ BOOST_AUTO_TEST_CASE(LimitFor_always_chooses_closest_value) { MapExtent size(8, 8); NodeMapBase values; - values.Resize(size); + values.resize(size); double coverage = 0.3; int minimum = 3; unsigned totalNodes = size.x * size.y; diff --git a/tests/s25Main/mapGenerator/testHarbors.cpp b/tests/s25Main/mapGenerator/testHarbors.cpp index 33814975ea..633bea5a74 100644 --- a/tests/s25Main/mapGenerator/testHarbors.cpp +++ b/tests/s25Main/mapGenerator/testHarbors.cpp @@ -18,11 +18,11 @@ BOOST_AUTO_TEST_CASE(PlaceHarborPosition_flattens_ground_around_harbor_position) Map map = createMap(MapExtent(6, 8)); auto land = TexturePair(map.textureMap.Find(isBuildableLand)); - map.getTextures().Resize(map.size, land); + map.getTextures().resize(map.size, land); MapPoint position(3, 4); - map.z.Resize(map.size, map.height.maximum); + map.z.resize(map.size, map.height.maximum); const auto minHeight = map.height.minimum; const auto neighbors = map.z.getNeighbours(position); @@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE(PlaceHarborPosition_flattens_ground_around_harbor_position) } // run actual test - PlaceHarborPosition(map, position); + placeHarborPosition(map, position); BOOST_TEST(map.z[position] == minHeight); for(auto neighbor : neighbors) @@ -49,11 +49,11 @@ BOOST_AUTO_TEST_CASE(PlaceHarborPosition_applies_buildable_terrain_around_positi auto coast = TexturePair(map.textureMap.Find(isCoastTerrain)); auto buildable = map.textureMap.Find(isBuildableCoast); - map.getTextures().Resize(map.size, coast); + map.getTextures().resize(map.size, coast); MapPoint position(3, 4); - PlaceHarborPosition(map, position); + placeHarborPosition(map, position); auto triangles = GetTriangles(position, map.size); const auto& textureTriangles = map.getTextures(); @@ -73,12 +73,12 @@ BOOST_AUTO_TEST_CASE(PlaceHarbors_places_no_harbors_on_coast_below_minimum_size) auto water = TexturePair(map.textureMap.Find(IsWater)); - map.getTextures().Resize(map.size, water); + map.getTextures().resize(map.size, water); auto coast = map.textureMap.Find(isCoastTerrain); map.textureMap.set(island, coast); - PlaceHarbors(map, {}, 100); + placeHarbors(map, {}, 100); BOOST_TEST(map.harbors.empty()); } @@ -90,12 +90,12 @@ BOOST_AUTO_TEST_CASE(PlaceHarbors_places_harbor_on_suitable_island) auto water = TexturePair(map.textureMap.Find(IsWater)); - map.getTextures().Resize(map.size, water); + map.getTextures().resize(map.size, water); auto coast = map.textureMap.Find(isCoastTerrain); map.textureMap.set(island, coast); - PlaceHarbors(map, {}, 5); + placeHarbors(map, {}, 5); BOOST_TEST(!map.harbors.empty()); } @@ -107,14 +107,14 @@ BOOST_AUTO_TEST_CASE(PlaceHarbors_places_no_harbor_near_river) auto water = TexturePair(map.textureMap.Find(IsWater)); - map.getTextures().Resize(map.size, water); + map.getTextures().resize(map.size, water); auto coast = map.textureMap.Find(isCoastTerrain); map.textureMap.set(island, coast); River river{island}; - PlaceHarbors(map, {river}, 5); + placeHarbors(map, {river}, 5); BOOST_TEST(map.harbors.empty()); } diff --git a/tests/s25Main/mapGenerator/testHeadQuarters.cpp b/tests/s25Main/mapGenerator/testHeadQuarters.cpp index 5a57febae4..976edbfb29 100644 --- a/tests/s25Main/mapGenerator/testHeadQuarters.cpp +++ b/tests/s25Main/mapGenerator/testHeadQuarters.cpp @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE(FindLargestConnectedArea_returns_expected_nodes) const auto water = textures.Find(isShipableWater); const auto land = textures.Find(isBuildableLand); - map.getTextures().Resize(size, TexturePair(water)); + map.getTextures().resize(size, TexturePair(water)); MapPoint centerOfLargeArea(2, 3); const auto largeArea = map.getTextures().GetPointsInRadiusWithCenter(centerOfLargeArea, 3); @@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE(FindHqPositions_returns_empty_for_map_without_suitable_posi Map map = createMap(size); const TextureMap& textures = map.textureMap; - map.getTextures().Resize(size, TexturePair(textures.Find(isShipableWater))); + map.getTextures().resize(size, TexturePair(textures.Find(isShipableWater))); const auto mntDist = randomMountainDistance(); const auto positions = FindHqPositions(map, getAllPoints(size), mntDist); @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(FindHqPositions_returns_suitable_position_for_single_player MapPoint obstacle(1, 3); - map.getTextures().Resize(size, TexturePair(buildable)); + map.getTextures().resize(size, TexturePair(buildable)); map.getTextures()[obstacle] = TexturePair(water); const auto mntDist = randomMountainDistance(); @@ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarter_with_suitable_position_for_player) MapPoint obstacle(1, 2); MapPoint hq(3, 4); - map.getTextures().Resize(size, TexturePair(buildable)); + map.getTextures().resize(size, TexturePair(buildable)); map.getTextures()[obstacle] = TexturePair(mountain); std::vector area{hq}; @@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarter_with_suitable_position_without_mountain) const auto mntDist = randomMountainDistance(); const auto buildable = textures.Find(isBuildableLand); MapPoint hq(4, 4); - map.getTextures().Resize(size, TexturePair(buildable)); + map.getTextures().resize(size, TexturePair(buildable)); std::vector area{hq}; BOOST_REQUIRE_NO_THROW(PlaceHeadquarter(map, area, mntDist)); BOOST_TEST_REQUIRE(map.hqPositions.size() == 1u); @@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarter_places_hq_on_map_at_suitable_position) const MapPoint obstacle(1, 3); const MapPoint hq(4, 5); - map.getTextures().Resize(size, TexturePair(textures.Find(isBuildableLand))); + map.getTextures().resize(size, TexturePair(textures.Find(isBuildableLand))); map.getTextures()[obstacle] = TexturePair(textures.Find(IsWater)); std::vector area{hq}; @@ -166,7 +166,7 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarter_with_empty_area_throws_exception) const auto mntDist = randomMountainDistance(); const auto water = textures.Find(isShipableWater); - map.getTextures().Resize(size, TexturePair(water)); + map.getTextures().resize(size, TexturePair(water)); std::vector area; BOOST_CHECK_THROW(PlaceHeadquarter(map, area, mntDist), std::runtime_error); } @@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarter_without_suitable_position_throws_exception const auto mntDist = randomMountainDistance(); const auto water = textures.Find(isShipableWater); - map.getTextures().Resize(size, TexturePair(water)); + map.getTextures().resize(size, TexturePair(water)); std::vector area{MapPoint(0, 0)}; BOOST_CHECK_THROW(PlaceHeadquarter(map, area, mntDist), std::runtime_error); } @@ -193,9 +193,9 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarters_with_suitable_positions_for_all_players) const TextureMap& textures = map.textureMap; const auto mntDist = randomMountainDistance(); - map.getTextures().Resize(size, TexturePair(textures.Find(isBuildableLand))); + map.getTextures().resize(size, TexturePair(textures.Find(isBuildableLand))); map.getTextures()[MapPoint(0, 0)] = TexturePair(textures.Find(IsWater)); - BOOST_REQUIRE_NO_THROW(PlaceHeadquarters(map, rnd, players, mntDist)); + BOOST_REQUIRE_NO_THROW(placeHeadquarters(map, rnd, players, mntDist)); } BOOST_AUTO_TEST_CASE(PlaceHeadquarters_places_hqs_for_any_player_number_on_suitable_map) @@ -207,9 +207,9 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarters_places_hqs_for_any_player_number_on_suita const TextureMap& textures = map.textureMap; const auto mntDist = randomMountainDistance(); - map.getTextures().Resize(size, textures.Find(isBuildableLand)); + map.getTextures().resize(size, textures.Find(isBuildableLand)); map.getTextures()[MapPoint(0, 0)] = TexturePair(textures.Find(IsWater)); - PlaceHeadquarters(map, rnd, players, mntDist); + placeHeadquarters(map, rnd, players, mntDist); BOOST_TEST_REQUIRE(map.hqPositions.size() == players); for(unsigned index = 0; index < players; index++) { @@ -226,8 +226,8 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarters_without_suitable_position_throws_exceptio const TextureMap& textures = map.textureMap; const auto mntDist = randomMountainDistance(); - map.getTextures().Resize(size, textures.Find(IsWater)); - BOOST_CHECK_THROW(PlaceHeadquarters(map, rnd, players, mntDist), std::runtime_error); + map.getTextures().resize(size, textures.Find(IsWater)); + BOOST_CHECK_THROW(placeHeadquarters(map, rnd, players, mntDist), std::runtime_error); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/s25Main/mapGenerator/testIslands.cpp b/tests/s25Main/mapGenerator/testIslands.cpp index 0ee2c0ffc6..6fccc8001f 100644 --- a/tests/s25Main/mapGenerator/testIslands.cpp +++ b/tests/s25Main/mapGenerator/testIslands.cpp @@ -16,17 +16,17 @@ BOOST_AUTO_TEST_CASE(CreateIsland_keeps_minimum_distance_to_land) RandomUtility rnd(0); Map map = createMap(MapExtent(26, 34)); MapPoint land(0, 0); - map.z.Resize(map.size, map.height.minimum); // all sea + map.z.resize(map.size, map.height.minimum); // all sea map.z[land] = map.height.minimum + 1; const double mountainCoverage = 0.1; const unsigned minLandDist = 5; const unsigned size = 800; - const auto island = CreateIsland(map, rnd, size, minLandDist, mountainCoverage); + const auto island = createIsland(map, rnd, size, minLandDist, mountainCoverage); for(MapPoint p : island) { - BOOST_TEST(map.z.CalcDistance(p, land) >= minLandDist); + BOOST_TEST(map.z.calcDistance(p, land) >= minLandDist); } } diff --git a/tests/s25Main/mapGenerator/testMapSettings.cpp b/tests/s25Main/mapGenerator/testMapSettings.cpp index dd0f5d05fe..e7c064fc43 100644 --- a/tests/s25Main/mapGenerator/testMapSettings.cpp +++ b/tests/s25Main/mapGenerator/testMapSettings.cpp @@ -14,7 +14,7 @@ BOOST_AUTO_TEST_SUITE(MapSettingsTests) BOOST_AUTO_TEST_CASE(MakeValid_sets_default_name_and_author) { MapSettings settings; - settings.MakeValid(); + settings.makeValid(); BOOST_TEST(settings.name == "Random"); BOOST_TEST(settings.author == "AutoGenerated"); } @@ -23,11 +23,11 @@ BOOST_AUTO_TEST_CASE(MakeValid_ensures_valid_number_of_players) { MapSettings settings; settings.numPlayers = 0; - settings.MakeValid(); + settings.makeValid(); BOOST_TEST(settings.numPlayers == 1u); settings.numPlayers = MAX_PLAYERS + 1; - settings.MakeValid(); + settings.makeValid(); BOOST_TEST(settings.numPlayers == MAX_PLAYERS); } @@ -35,7 +35,7 @@ BOOST_AUTO_TEST_CASE(MakeValid_ensures_map_size_is_even) { MapSettings settings; settings.size = MapExtent(17, 19); - settings.MakeValid(); + settings.makeValid(); BOOST_TEST(settings.size.x % 2u == 0u); BOOST_TEST(settings.size.y % 2u == 0u); } @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(MakeValid_ensures_minimum_size_is_16_x_16) { MapSettings settings; settings.size = MapExtent(14, 14); - settings.MakeValid(); + settings.makeValid(); BOOST_TEST(settings.size == MapExtent(16, 16)); } @@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(MakeValid_ensures_total_ratio_for_mountain_resources_is_at_ settings.ratioGold = 0; settings.ratioIron = 0; settings.ratioGranite = 0; - settings.MakeValid(); + settings.makeValid(); BOOST_TEST(settings.ratioCoal + settings.ratioGold + settings.ratioIron + settings.ratioGranite > 0); } diff --git a/tests/s25Main/mapGenerator/testNodeMapUtilities.cpp b/tests/s25Main/mapGenerator/testNodeMapUtilities.cpp index 03c719d144..dae70907dc 100644 --- a/tests/s25Main/mapGenerator/testNodeMapUtilities.cpp +++ b/tests/s25Main/mapGenerator/testNodeMapUtilities.cpp @@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE(GetRange_returns_range_of_map_values) { MapExtent size(16, 8); NodeMapBase values; - values.Resize(size, 2); + values.resize(size, 2); values[3] = -1; values[7] = 7; @@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(GetMaximumPoint_returns_map_point_for_maximum_value) { MapExtent size(16, 8); NodeMapBase values; - values.Resize(size, 4); + values.resize(size, 4); MapPoint maximumPoint(3, 5); values[maximumPoint] = 5; diff --git a/tests/s25Main/mapGenerator/testRandomMap.cpp b/tests/s25Main/mapGenerator/testRandomMap.cpp index 9a9db35302..7d1ad5ef61 100644 --- a/tests/s25Main/mapGenerator/testRandomMap.cpp +++ b/tests/s25Main/mapGenerator/testRandomMap.cpp @@ -29,7 +29,7 @@ static void ValidateMap(const Map& map, const MapExtent& size, unsigned players) for(const MapPoint pt : neighbors) { BOOST_TEST_REQUIRE( - map.textureMap.All(pt, [](const TerrainDesc& terrain) { return terrain.GetBQ() == TerrainBQ::Castle; }), + map.textureMap.all(pt, [](const TerrainDesc& terrain) { return terrain.GetBQ() == TerrainBQ::Castle; }), "At point " << pt); } // All direct neighbors must have the same height as the hqPos @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(GenerateRandomMap_returns_valid_land_map) settings.numPlayers = rttr::test::randomValue(2u, MAX_PLAYERS); settings.style = MapStyle::Land; - Map map = GenerateRandomMap(rnd, worldDesc, settings); + Map map = generateRandomMap(rnd, worldDesc, settings); ValidateMap(map, settings.size, settings.numPlayers); } @@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(GenerateRandomMap_returns_valid_water_map) settings.numPlayers = rttr::test::randomValue(2u, MAX_PLAYERS); settings.style = MapStyle::Water; - Map map = GenerateRandomMap(rnd, worldDesc, settings); + Map map = generateRandomMap(rnd, worldDesc, settings); ValidateMap(map, settings.size, settings.numPlayers); } @@ -109,7 +109,7 @@ BOOST_AUTO_TEST_CASE(GenerateRandomMap_returns_valid_mixed_map) settings.numPlayers = rttr::test::randomValue(2u, MAX_PLAYERS); settings.style = MapStyle::Mixed; - Map map = GenerateRandomMap(rnd, worldDesc, settings); + Map map = generateRandomMap(rnd, worldDesc, settings); ValidateMap(map, settings.size, settings.numPlayers); } @@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(GenerateRandomMap_for_many_islands_returns_valid_map) settings.numPlayers = 2u; settings.style = MapStyle::Mixed; - Map map = GenerateRandomMap(rnd, worldDesc, settings); + Map map = generateRandomMap(rnd, worldDesc, settings); ValidateMap(map, settings.size, settings.numPlayers); } @@ -140,7 +140,7 @@ BOOST_AUTO_TEST_CASE(GenerateRandomMap_returns_valid_map_with_max_players) settings.numPlayers = MAX_PLAYERS; settings.style = MapStyle::Land; - Map map = GenerateRandomMap(rnd, worldDesc, settings); + Map map = generateRandomMap(rnd, worldDesc, settings); ValidateMap(map, settings.size, settings.numPlayers); } @@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE(GenerateRandomMap_returns_valid_mapfile_with_max_players) settings.numPlayers = MAX_PLAYERS; settings.style = MapStyle::Land; - CreateRandomMap(mapPath, settings); + createRandomMap(mapPath, settings); libsiedler2::Archiv archive; BOOST_TEST_REQUIRE(libsiedler2::Load(mapPath, archive) == 0); const auto* map = dynamic_cast(archive[0]); diff --git a/tests/s25Main/mapGenerator/testRandomUtility.cpp b/tests/s25Main/mapGenerator/testRandomUtility.cpp index 08314d9bff..1512238224 100644 --- a/tests/s25Main/mapGenerator/testRandomUtility.cpp +++ b/tests/s25Main/mapGenerator/testRandomUtility.cpp @@ -16,7 +16,7 @@ BOOST_AUTO_TEST_CASE(Index_returns_values_gte_zero_and_lt_size) for(auto size = 1u; size < 10u; size++) { - auto result = rnd.Index(size); + auto result = rnd.index(size); BOOST_TEST_REQUIRE(result < size); } @@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE(RandomInt_returns_value_within_thresholds) int minimum = -10; int maximum = 7; - auto result = rnd.RandomValue(minimum, maximum); + auto result = rnd.randomValue(minimum, maximum); BOOST_TEST(result >= minimum); BOOST_TEST(result <= maximum); @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE(RandomDouble_returns_value_within_thresholds) double minimum = -12.123; double maximum = 7.456; - auto result = rnd.RandomDouble(minimum, maximum); + auto result = rnd.randomDouble(minimum, maximum); BOOST_TEST(result >= minimum); BOOST_TEST(result <= maximum); diff --git a/tests/s25Main/mapGenerator/testResources.cpp b/tests/s25Main/mapGenerator/testResources.cpp index 96e2e0a6b0..b28af51a8a 100644 --- a/tests/s25Main/mapGenerator/testResources.cpp +++ b/tests/s25Main/mapGenerator/testResources.cpp @@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(AddObjects_keeps_area_around_hqs_empty) MapPoint hq(3, 3); map.hqPositions.push_back(hq); - AddObjects(map, rnd, settings); + addObjects(map, rnd, settings); auto& objectTypes = map.objectTypes; auto& objectInfos = map.objectInfos; @@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE(AddObjects_keeps_area_around_harbors_empty) MapPoint harbor(3, 3); map.harbors.push_back(Triangle(true, harbor)); - AddObjects(map, rnd, settings); + addObjects(map, rnd, settings); auto& objectTypes = map.objectTypes; auto& objectInfos = map.objectInfos; @@ -110,7 +110,7 @@ BOOST_AUTO_TEST_CASE(AddObjects_adds_objects_to_the_map) const unsigned objectsBefore = countObjects(); - AddObjects(map, rnd, settings); + addObjects(map, rnd, settings); const unsigned objectsAfter = countObjects(); @@ -122,19 +122,19 @@ BOOST_AUTO_TEST_CASE(AddResources_updates_resources_according_to_textures) RandomUtility rnd(0); MapSettings settings; - AddResources(map, rnd, settings); + addResources(map, rnd, settings); unsigned numMountainWithRes = 0; unsigned numMountainWithoutRes = 0; RTTR_FOREACH_PT(MapPoint, map.size) { - if(map.textureMap.All(pt, isMinableMountain)) + if(map.textureMap.all(pt, isMinableMountain)) { if(map.resources[pt] == R_None) numMountainWithoutRes++; // LCOV_EXCL_LINE else numMountainWithRes++; - } else if(map.textureMap.All(pt, IsWater)) + } else if(map.textureMap.all(pt, IsWater)) BOOST_TEST_REQUIRE(map.resources[pt] == R_Fish); else BOOST_TEST_REQUIRE(map.resources[pt] == R_Water); @@ -148,11 +148,11 @@ BOOST_AUTO_TEST_CASE(AddAnimals_updates_animals_according_to_textures) { RandomUtility rnd(0); - AddAnimals(map, rnd); + addAnimals(map, rnd); RTTR_FOREACH_PT(MapPoint, map.size) { - if(map.textureMap.All(pt, IsWater)) + if(map.textureMap.all(pt, IsWater)) { BOOST_TEST_REQUIRE( (map.animals[pt] == Animal::None || map.animals[pt] == Animal::Duck || map.animals[pt] == Animal::Duck2)); diff --git a/tests/s25Main/mapGenerator/testRivers.cpp b/tests/s25Main/mapGenerator/testRivers.cpp index 7d5b577000..fe5b16f492 100644 --- a/tests/s25Main/mapGenerator/testRivers.cpp +++ b/tests/s25Main/mapGenerator/testRivers.cpp @@ -14,7 +14,7 @@ class RiverFixture : public MapGenFixture public: Map map; RandomUtility rnd; - RiverFixture() : map(createMap(MapExtent(8, 10))), rnd(0) { map.z.Resize(map.size, map.height.maximum); } + RiverFixture() : map(createMap(MapExtent(8, 10))), rnd(0) { map.z.resize(map.size, map.height.maximum); } }; BOOST_FIXTURE_TEST_SUITE(RiversTest, RiverFixture) @@ -26,7 +26,7 @@ BOOST_AUTO_TEST_CASE(CreateStream_returns_river_of_expected_size) for(const auto d : helpers::enumRange()) { - auto river = CreateStream(rnd, map, source, d, length); + auto river = createStream(rnd, map, source, d, length); // each point represents one triangle while length is given // in tiles (2 triangles) - and one more for the source (which @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(CreateStream_returns_only_connected_nodes) for(const auto d : helpers::enumRange()) { - auto river = CreateStream(rnd, map, source, d, length); + auto river = createStream(rnd, map, source, d, length); auto containedByRiver = [&river](const MapPoint& pt) { return helpers::contains(river, pt); }; @@ -59,17 +59,17 @@ BOOST_AUTO_TEST_CASE(CreateStream_returns_only_connected_nodes) BOOST_AUTO_TEST_CASE(CreateStream_returns_only_nodes_covered_by_water) { auto land = map.textureMap.Find(isBuildableLand); - map.getTextures().Resize(map.size, land); + map.getTextures().resize(map.size, land); const MapPoint source(3, 2); const int length = 7; for(const auto d : helpers::enumRange()) { - auto river = CreateStream(rnd, map, source, d, length); + auto river = createStream(rnd, map, source, d, length); for(const MapPoint& pt : river) { - BOOST_TEST_REQUIRE(map.textureMap.Any(pt, IsWater)); + BOOST_TEST_REQUIRE(map.textureMap.any(pt, IsWater)); } } } @@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(CreateStream_returns_only_nodes_covered_by_water) BOOST_AUTO_TEST_CASE(CreateStream_reduces_height_of_river_nodes) { NodeMapBase originalZ; - originalZ.Resize(map.size); + originalZ.resize(map.size); RTTR_FOREACH_PT(MapPoint, map.size) { originalZ[pt] = map.z[pt]; @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE(CreateStream_reduces_height_of_river_nodes) for(const auto d : helpers::enumRange()) { - auto river = CreateStream(rnd, map, source, d, length); + auto river = createStream(rnd, map, source, d, length); for(const MapPoint& pt : river) { @@ -100,10 +100,10 @@ BOOST_AUTO_TEST_CASE(CreateStream_reduces_height_of_river_nodes) BOOST_AUTO_TEST_CASE(CreateStream_which_ends_at_minimum_height) { MapPoint source(3, 3); - map.z.Resize(map.size, map.height.minimum); + map.z.resize(map.size, map.height.minimum); map.z[source] = map.height.maximum; - const auto river = CreateStream(rnd, map, source, Direction::East, 20); + const auto river = createStream(rnd, map, source, Direction::East, 20); const auto expectedRange = map.z.GetPointsInRadiusWithCenter(source, 2); for(const MapPoint& pt : river) diff --git a/tests/s25Main/mapGenerator/testTerrain.cpp b/tests/s25Main/mapGenerator/testTerrain.cpp index 76008d6f71..7610590e75 100644 --- a/tests/s25Main/mapGenerator/testTerrain.cpp +++ b/tests/s25Main/mapGenerator/testTerrain.cpp @@ -15,10 +15,10 @@ BOOST_AUTO_TEST_CASE(Restructure_keeps_minimum_and_maximum_values_unchanged) { Map map = createMap(MapExtent(6, 8)); - map.z.Resize(map.size, 5); // default height + map.z.resize(map.size, 5); // default height auto predicate = [](const MapPoint& pt) noexcept { return pt.x == 3 && pt.y == 4; }; - Restructure(map, predicate); + restructure(map, predicate); RTTR_FOREACH_PT(MapPoint, map.size) { @@ -34,9 +34,9 @@ BOOST_AUTO_TEST_CASE(Restructure_increases_height_of_focus_area) MapPoint focus(3, 4); auto predicate = [&focus](const MapPoint& pt) noexcept { return pt == focus; }; const uint8_t heightBefore = 5; - map.z.Resize(map.size, heightBefore); + map.z.resize(map.size, heightBefore); - Restructure(map, predicate); + restructure(map, predicate); const uint8_t heightAfter = map.z[focus]; @@ -52,9 +52,9 @@ BOOST_AUTO_TEST_CASE(Restructure_increases_height_less_when_further_away_from_fo MapPoint nonFocus(0, 3); const uint8_t heightBefore = 5; - map.z.Resize(map.size, heightBefore); + map.z.resize(map.size, heightBefore); - Restructure(map, predicate); + restructure(map, predicate); const int diffFocus = map.z[focus] - heightBefore; const int diffNonFocus = map.z[nonFocus] - heightBefore; diff --git a/tests/s25Main/mapGenerator/testTextures.cpp b/tests/s25Main/mapGenerator/testTextures.cpp index 67456a66f3..a5d091ff98 100644 --- a/tests/s25Main/mapGenerator/testTextures.cpp +++ b/tests/s25Main/mapGenerator/testTextures.cpp @@ -19,7 +19,7 @@ class TextureMapFixture : private MapGenFixture TextureMapFixture() : textureMap(worldDesc, landscape, MapExtent(0, 0)), textures(textureMap.textures_) { const MapExtent size(6, 8); - textures.Resize(size); + textures.resize(size); } }; @@ -28,7 +28,7 @@ class TextureMapFixtureWithZ : public TextureMapFixture public: NodeMapBase z; - TextureMapFixtureWithZ() { z.Resize(textures.getSize()); } + TextureMapFixtureWithZ() { z.resize(textures.getSize()); } }; BOOST_AUTO_TEST_SUITE(TextureTests) @@ -44,7 +44,7 @@ BOOST_FIXTURE_TEST_CASE(AddTextures_sets_valid_textures_for_entire_map, TextureM } Texturizer texturizer(z, textures, textureMap); - texturizer.AddTextures(mountainLevel, coastline); + texturizer.addTextures(mountainLevel, coastline); RTTR_FOREACH_PT(MapPoint, textures.getSize()) { @@ -58,7 +58,7 @@ BOOST_FIXTURE_TEST_CASE(AddTextures_does_not_override_textures, TextureMapFixtur const unsigned mountainLevel = 5; const unsigned coastline = 1; auto water = textureMap.Find(IsWater); - textures.Resize(textures.getSize(), TexturePair(water)); + textures.resize(textures.getSize(), TexturePair(water)); RTTR_FOREACH_PT(MapPoint, z.getSize()) { @@ -66,7 +66,7 @@ BOOST_FIXTURE_TEST_CASE(AddTextures_does_not_override_textures, TextureMapFixtur } Texturizer texturizer(z, textures, textureMap); - texturizer.AddTextures(mountainLevel, coastline); + texturizer.addTextures(mountainLevel, coastline); RTTR_FOREACH_PT(MapPoint, textures.getSize()) { @@ -81,12 +81,12 @@ BOOST_FIXTURE_TEST_CASE(AddTextures_sets_water_textures_for_minimum_height, Text const unsigned coastline = 2; Texturizer texturizer(z, textures, textureMap); - texturizer.AddTextures(mountainLevel, coastline); + texturizer.addTextures(mountainLevel, coastline); RTTR_FOREACH_PT(MapPoint, textures.getSize()) { - BOOST_TEST_REQUIRE(textureMap.Check(Triangle(true, pt), IsWater)); - BOOST_TEST_REQUIRE(textureMap.Check(Triangle(false, pt), IsWater)); + BOOST_TEST_REQUIRE(textureMap.check(Triangle(true, pt), IsWater)); + BOOST_TEST_REQUIRE(textureMap.check(Triangle(false, pt), IsWater)); } } @@ -94,18 +94,18 @@ BOOST_FIXTURE_TEST_CASE(AddTextures_sets_mountain_textures_above_mountain_level, { const unsigned mountainLevel = 10; const unsigned coastline = 2; - z.Resize(z.getSize(), mountainLevel); + z.resize(z.getSize(), mountainLevel); z[0] = 1; // sea Texturizer texturizer(z, textures, textureMap); - texturizer.AddTextures(mountainLevel, coastline); + texturizer.addTextures(mountainLevel, coastline); RTTR_FOREACH_PT(MapPoint, textures.getSize()) { if(z[pt] >= mountainLevel) { - BOOST_TEST_REQUIRE(textureMap.Check(Triangle(true, pt), isMountainOrSnowOrLava)); - BOOST_TEST_REQUIRE(textureMap.Check(Triangle(false, pt), isMountainOrSnowOrLava)); + BOOST_TEST_REQUIRE(textureMap.check(Triangle(true, pt), isMountainOrSnowOrLava)); + BOOST_TEST_REQUIRE(textureMap.check(Triangle(false, pt), isMountainOrSnowOrLava)); } } } @@ -115,11 +115,11 @@ BOOST_FIXTURE_TEST_CASE(ReplaceTextureForPoint_replaces_all_textures, TextureMap auto source = textureMap.Find(IsWater); auto target = textureMap.Find(isSnowOrLava); auto point = MapPoint(textures.getWidth() / 2, textures.getHeight() / 2); - textures.Resize(textures.getSize(), source); + textures.resize(textures.getSize(), source); - ReplaceTextureForPoint(textures, point, target, {}); + replaceTextureForPoint(textures, point, target, {}); - BOOST_TEST(textureMap.All(point, isSnowOrLava)); + BOOST_TEST(textureMap.all(point, isSnowOrLava)); } BOOST_FIXTURE_TEST_CASE(ReplaceTextureForPoint_does_not_replace_excluded_textures, TextureMapFixture) @@ -127,11 +127,11 @@ BOOST_FIXTURE_TEST_CASE(ReplaceTextureForPoint_does_not_replace_excluded_texture auto source = textureMap.Find(IsWater); auto target = textureMap.Find(isSnowOrLava); auto point = MapPoint(textures.getWidth() / 2, textures.getHeight() / 2); - textures.Resize(textures.getSize(), source); + textures.resize(textures.getSize(), source); - ReplaceTextureForPoint(textures, point, target, {source}); + replaceTextureForPoint(textures, point, target, {source}); - BOOST_TEST(textureMap.All(point, IsWater)); + BOOST_TEST(textureMap.all(point, IsWater)); } BOOST_FIXTURE_TEST_CASE(ReplaceTextures_replaces_textures_within_radius, TextureMapFixture) @@ -145,10 +145,10 @@ BOOST_FIXTURE_TEST_CASE(ReplaceTextures_replaces_textures_within_radius, Texture const auto target = textureMap.Find(isSnowOrLava); for(unsigned radius = 0; radius < 4; radius++) { - textures.Resize(textures.getSize(), source); + textures.resize(textures.getSize(), source); std::set nodes(points); - ReplaceTextures(textures, radius, nodes, target, {}); + replaceTextures(textures, radius, nodes, target, {}); for(const MapPoint& pt : points) { @@ -156,11 +156,11 @@ BOOST_FIXTURE_TEST_CASE(ReplaceTextures_replaces_textures_within_radius, Texture { for(const MapPoint& p : textures.getPointsInRadius(pt, radius)) { - BOOST_TEST_REQUIRE(textureMap.All(p, isSnowOrLava)); + BOOST_TEST_REQUIRE(textureMap.all(p, isSnowOrLava)); } } else { - BOOST_TEST_REQUIRE(textureMap.All(pt, isSnowOrLava)); + BOOST_TEST_REQUIRE(textureMap.all(pt, isSnowOrLava)); } } } @@ -178,14 +178,14 @@ BOOST_FIXTURE_TEST_CASE(ReplaceTextures_does_not_replace_excluded_textures, Text for(unsigned radius = 0; radius < 4; radius++) { - textures.Resize(textures.getSize(), source); + textures.resize(textures.getSize(), source); std::set nodes(points); - ReplaceTextures(textures, radius, nodes, target, {source}); + replaceTextures(textures, radius, nodes, target, {source}); RTTR_FOREACH_PT(MapPoint, textures.getSize()) { - BOOST_TEST_REQUIRE(textureMap.All(pt, IsWater)); + BOOST_TEST_REQUIRE(textureMap.all(pt, IsWater)); } } } diff --git a/tests/s25Main/network/testGameClient.cpp b/tests/s25Main/network/testGameClient.cpp index 252b00e6f9..96952bd4ba 100644 --- a/tests/s25Main/network/testGameClient.cpp +++ b/tests/s25Main/network/testGameClient.cpp @@ -97,18 +97,18 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS const auto pw = rttr::test::randString(10); const auto serverType = rttr::test::randomEnum(); MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::Initiated).once(); - BOOST_TEST_REQUIRE(client.Connect("localhost", pw, serverType, serverPort, false, false)); + BOOST_TEST_REQUIRE(client.connect("localhost", pw, serverType, serverPort, false, false)); BOOST_TEST_REQUIRE(client.getState() == ClientState::Connect); { MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::VerifyServer).once(); - clientMsgInterface.OnGameMessage(GameMessage_Player_Id(1)); + clientMsgInterface.onGameMessage(GameMessage_Player_Id(1)); const auto msg = boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop()); BOOST_TEST_REQUIRE(msg); BOOST_TEST(msg->type == serverType); } { MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::QueryPw).once(); - clientMsgInterface.OnGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); + clientMsgInterface.onGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); const auto msg = boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop()); BOOST_TEST_REQUIRE(msg); @@ -116,7 +116,7 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS } { MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::QueryMapInfo).once(); - clientMsgInterface.OnGameMessage(GameMessage_Server_Password("true")); + clientMsgInterface.onGameMessage(GameMessage_Server_Password("true")); BOOST_TEST_REQUIRE(dynamic_cast(client.getMainPlayer().sendQueue.pop().get())); BOOST_TEST_REQUIRE(dynamic_cast(client.getMainPlayer().sendQueue.pop().get())); const auto msg = boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop()); @@ -127,14 +127,14 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS rttr::test::rttrBaseDir / "tests" / "testData" / "maps" / "LuaFunctions.SWD"; const boost::filesystem::path testLuaPath = boost::filesystem::path(testMapPath).replace_extension("lua"); MapInfo mapInfo; - mapInfo.mapData.CompressFromFile(testMapPath, &mapInfo.mapChecksum); + mapInfo.mapData.compressFromFile(testMapPath, &mapInfo.mapChecksum); if(usesLuaScript) - mapInfo.luaData.CompressFromFile(testLuaPath, &mapInfo.luaChecksum); + mapInfo.luaData.compressFromFile(testLuaPath, &mapInfo.luaChecksum); const auto mapDataSize = mapInfo.mapData.data.size(); const auto luaDataSize = (usesLuaScript) ? mapInfo.luaData.data.size() : 0u; { MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::ReceiveMap).once(); - clientMsgInterface.OnGameMessage(GameMessage_Map_Info(testMapPath.filename().string(), MapType::OldMap, + clientMsgInterface.onGameMessage(GameMessage_Map_Info(testMapPath.filename().string(), MapType::OldMap, mapInfo.mapData.uncompressedLength, mapDataSize, mapInfo.luaData.uncompressedLength, luaDataSize)); const auto msg = boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop()); @@ -148,24 +148,24 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS BOOST_TEST_REQUIRE(luaDataSize > 5u); // Should be or we can't chunk the lua data // First part of map MOCK_EXPECT(callbacks.CI_MapPartReceived).with(10u, totalSize).once(); - clientMsgInterface.OnGameMessage(GameMessage_Map_Data(true, 0, mapInfo.mapData.data.data(), 10)); + clientMsgInterface.onGameMessage(GameMessage_Map_Data(true, 0, mapInfo.mapData.data.data(), 10)); BOOST_TEST(client.getMainPlayer().sendQueue.empty()); // Remaining part of map MOCK_EXPECT(callbacks.CI_MapPartReceived).with(mapDataSize, totalSize).once(); if(!usesLuaScript) MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::VerifyMap).once(); - clientMsgInterface.OnGameMessage( + clientMsgInterface.onGameMessage( GameMessage_Map_Data(true, 10, mapInfo.mapData.data.data() + 10, mapDataSize - 10)); if(usesLuaScript) { // First part of lua MOCK_EXPECT(callbacks.CI_MapPartReceived).with(mapDataSize + 5u, totalSize).once(); - clientMsgInterface.OnGameMessage(GameMessage_Map_Data(false, 0, mapInfo.luaData.data.data(), 5)); + clientMsgInterface.onGameMessage(GameMessage_Map_Data(false, 0, mapInfo.luaData.data.data(), 5)); BOOST_TEST(client.getMainPlayer().sendQueue.empty()); // Remaining part of lua -> Transmission done MOCK_EXPECT(callbacks.CI_MapPartReceived).with(totalSize, totalSize).once(); MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::VerifyMap).once(); - clientMsgInterface.OnGameMessage( + clientMsgInterface.onGameMessage( GameMessage_Map_Data(false, 5, mapInfo.luaData.data.data() + 5, luaDataSize - 5)); } @@ -179,23 +179,23 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS } { MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::QueryServerName).once(); - clientMsgInterface.OnGameMessage(GameMessage_Map_ChecksumOK(true, false)); + clientMsgInterface.onGameMessage(GameMessage_Map_ChecksumOK(true, false)); BOOST_TEST(client.getMainPlayer().sendQueue.empty()); } { MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::QueryPlayerList).once(); - clientMsgInterface.OnGameMessage(GameMessage_Server_Name(rttr::test::randString(10))); + clientMsgInterface.onGameMessage(GameMessage_Server_Name(rttr::test::randString(10))); BOOST_TEST(client.getMainPlayer().sendQueue.empty()); } { MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::QuerySettings).once(); - clientMsgInterface.OnGameMessage(GameMessage_Player_List(std::vector(3))); + clientMsgInterface.onGameMessage(GameMessage_Player_List(std::vector(3))); BOOST_TEST(client.getMainPlayer().sendQueue.empty()); } { BOOST_TEST_REQUIRE(client.getState() == ClientState::Connect); MOCK_EXPECT(callbacks.CI_NextConnectState).with(ConnectState::Finished).once(); - clientMsgInterface.OnGameMessage(GameMessage_GGSChange()); + clientMsgInterface.onGameMessage(GameMessage_GGSChange()); BOOST_TEST(client.getMainPlayer().sendQueue.empty()); // And done BOOST_TEST_REQUIRE(client.getState() == ClientState::Config); @@ -215,12 +215,12 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS MOCK_EXPECT(callbacks.CI_NextConnectState).in(s).with(ConnectState::QuerySettings).once(); MOCK_EXPECT(callbacks.CI_NextConnectState).in(s).with(ConnectState::Finished).once(); - client.Stop(); - BOOST_TEST_REQUIRE(client.Connect("localhost", pw, serverType, serverPort, false, false)); - clientMsgInterface.OnGameMessage(GameMessage_Player_Id(1)); - clientMsgInterface.OnGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); - clientMsgInterface.OnGameMessage(GameMessage_Server_Password("true")); - clientMsgInterface.OnGameMessage(GameMessage_Map_Info(testMapPath.filename().string(), MapType::OldMap, + client.stop(); + BOOST_TEST_REQUIRE(client.connect("localhost", pw, serverType, serverPort, false, false)); + clientMsgInterface.onGameMessage(GameMessage_Player_Id(1)); + clientMsgInterface.onGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); + clientMsgInterface.onGameMessage(GameMessage_Server_Password("true")); + clientMsgInterface.onGameMessage(GameMessage_Map_Info(testMapPath.filename().string(), MapType::OldMap, mapInfo.mapData.uncompressedLength, mapDataSize, mapInfo.luaData.uncompressedLength, luaDataSize)); @@ -237,10 +237,10 @@ BOOST_DATA_TEST_CASE(ClientFollowsConnectProtocol, usesLuaScriptValues, usesLuaS BOOST_TEST(msg->mapChecksum == mapInfo.mapChecksum); BOOST_TEST(msg->luaChecksum == mapInfo.luaChecksum); // Remaining packets - clientMsgInterface.OnGameMessage(GameMessage_Map_ChecksumOK(true, false)); - clientMsgInterface.OnGameMessage(GameMessage_Server_Name(rttr::test::randString(10))); - clientMsgInterface.OnGameMessage(GameMessage_Player_List(std::vector(3))); - clientMsgInterface.OnGameMessage(GameMessage_GGSChange()); + clientMsgInterface.onGameMessage(GameMessage_Map_ChecksumOK(true, false)); + clientMsgInterface.onGameMessage(GameMessage_Server_Name(rttr::test::randString(10))); + clientMsgInterface.onGameMessage(GameMessage_Player_List(std::vector(3))); + clientMsgInterface.onGameMessage(GameMessage_GGSChange()); BOOST_TEST_REQUIRE(client.getState() == ClientState::Config); } } @@ -256,18 +256,18 @@ BOOST_AUTO_TEST_CASE(ClientStoresReceivedSavegamesInSaveFolder) const auto serverPort = server.tryListen(); BOOST_TEST_REQUIRE(serverPort >= 0); - BOOST_TEST_REQUIRE(client.Connect("localhost", rttr::test::randString(10), rttr::test::randomEnum(), + BOOST_TEST_REQUIRE(client.connect("localhost", rttr::test::randString(10), rttr::test::randomEnum(), serverPort, false, false)); - clientMsgInterface.OnGameMessage(GameMessage_Player_Id(1)); + clientMsgInterface.onGameMessage(GameMessage_Player_Id(1)); client.getMainPlayer().sendQueue.clear(); - clientMsgInterface.OnGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); + clientMsgInterface.onGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); client.getMainPlayer().sendQueue.clear(); - clientMsgInterface.OnGameMessage(GameMessage_Server_Password("true")); + clientMsgInterface.onGameMessage(GameMessage_Server_Password("true")); client.getMainPlayer().sendQueue.clear(); const auto expectedSavePath = RTTRCONFIG.ExpandPath(s25::folders::save) / "received.sav"; - clientMsgInterface.OnGameMessage(GameMessage_Map_Info("received.sav", MapType::Savegame, 1, 1, 0, 0)); + clientMsgInterface.onGameMessage(GameMessage_Map_Info("received.sav", MapType::Savegame, 1, 1, 0, 0)); const auto msg = boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop()); BOOST_TEST_REQUIRE(msg); BOOST_TEST(!msg->requestInfo); @@ -293,12 +293,12 @@ void ClientTreatsLocalSavegameFilenameVerbatim(ServerType serverType, MapType ma const auto serverPort = server.tryListen(); BOOST_TEST_REQUIRE(serverPort >= 0); - BOOST_TEST_REQUIRE(client.Connect("localhost", rttr::test::randString(10), serverType, serverPort, false, false)); - clientMsgInterface.OnGameMessage(GameMessage_Player_Id(1)); + BOOST_TEST_REQUIRE(client.connect("localhost", rttr::test::randString(10), serverType, serverPort, false, false)); + clientMsgInterface.onGameMessage(GameMessage_Player_Id(1)); client.getMainPlayer().sendQueue.clear(); - clientMsgInterface.OnGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); + clientMsgInterface.onGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); client.getMainPlayer().sendQueue.clear(); - clientMsgInterface.OnGameMessage(GameMessage_Server_Password("true")); + clientMsgInterface.onGameMessage(GameMessage_Server_Password("true")); client.getMainPlayer().sendQueue.clear(); // Only local games (client and server are the same process via loopback) read the savegame @@ -308,7 +308,7 @@ void ClientTreatsLocalSavegameFilenameVerbatim(ServerType serverType, MapType ma // (e.g. a normal map, which is always copied into a separate "played maps" cache folder) must // still go through the usual sanitization. const std::string rawName = (mapType == MapType::Savegame) ? "my save.sav" : "my map.swd"; - clientMsgInterface.OnGameMessage(GameMessage_Map_Info(rawName, mapType, 1, 1, 0, 0)); + clientMsgInterface.onGameMessage(GameMessage_Map_Info(rawName, mapType, 1, 1, 0, 0)); const bool expectVerbatim = (serverType == ServerType::Local && mapType == MapType::Savegame); const std::string sanitizedName = (mapType == MapType::Savegame) ? "my_save.sav" : "my_map.swd"; @@ -335,27 +335,27 @@ BOOST_AUTO_TEST_CASE(ClientDetectsMapBufferOverflow) MOCK_EXPECT(callbacks.CI_NextConnectState).in(s).with(ConnectState::QueryMapInfo).once(); MOCK_EXPECT(callbacks.CI_NextConnectState).in(s).with(ConnectState::ReceiveMap).once(); - BOOST_TEST_REQUIRE(client.Connect("localhost", pw, serverType, serverPort, false, false)); - clientMsgInterface.OnGameMessage(GameMessage_Player_Id(1)); - clientMsgInterface.OnGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); - clientMsgInterface.OnGameMessage(GameMessage_Server_Password("true")); + BOOST_TEST_REQUIRE(client.connect("localhost", pw, serverType, serverPort, false, false)); + clientMsgInterface.onGameMessage(GameMessage_Player_Id(1)); + clientMsgInterface.onGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); + clientMsgInterface.onGameMessage(GameMessage_Server_Password("true")); constexpr auto chunkSize = 10u; const auto mapDataSize = rttr::test::randomValue(2 * chunkSize, 10 * chunkSize); // At least 2 chunks const auto uncompressedSize = rttr::test::randomValue(mapDataSize, 10 * mapDataSize); // Doesn't really matter std::vector mapData(mapDataSize); - clientMsgInterface.OnGameMessage( + clientMsgInterface.onGameMessage( GameMessage_Map_Info("testMap.swd", MapType::OldMap, uncompressedSize, mapDataSize, 0, 0)); // First part of map MOCK_EXPECT(callbacks.CI_MapPartReceived).in(s).with(chunkSize, mapDataSize).once(); - clientMsgInterface.OnGameMessage(GameMessage_Map_Data(true, 0, mapData.data(), chunkSize)); + clientMsgInterface.onGameMessage(GameMessage_Map_Data(true, 0, mapData.data(), chunkSize)); BOOST_TEST_REQUIRE(mock::verify()); BOOST_TEST(client.getState() == ClientState::Connect); // Remaining part of map but to big/wrong offset MOCK_EXPECT(callbacks.CI_Error).with(ClientError::MapTransmission).once(); const auto remainingSize = mapDataSize - chunkSize; - clientMsgInterface.OnGameMessage(GameMessage_Map_Data(true, chunkSize, mapData.data(), remainingSize + 1u)); + clientMsgInterface.onGameMessage(GameMessage_Map_Data(true, chunkSize, mapData.data(), remainingSize + 1u)); BOOST_TEST(client.getState() == ClientState::Stopped); } @@ -375,14 +375,14 @@ BOOST_AUTO_TEST_CASE(ClientReportsWrongPasswordResponse) MOCK_EXPECT(callbacks.CI_NextConnectState).in(s).with(ConnectState::QueryPw).once(); MOCK_EXPECT(callbacks.CI_Error).in(s).with(ClientError::WrongPassword).once(); - BOOST_TEST_REQUIRE(client.Connect("localhost", rttr::test::randString(10), serverType, serverPort, false, false)); - clientMsgInterface.OnGameMessage(GameMessage_Player_Id(1)); - clientMsgInterface.OnGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); + BOOST_TEST_REQUIRE(client.connect("localhost", rttr::test::randString(10), serverType, serverPort, false, false)); + clientMsgInterface.onGameMessage(GameMessage_Player_Id(1)); + clientMsgInterface.onGameMessage(GameMessage_Server_TypeOK(GameMessage_Server_TypeOK::StatusCode::Ok, "")); BOOST_TEST_REQUIRE(boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop())); BOOST_TEST_REQUIRE( boost::dynamic_pointer_cast(client.getMainPlayer().sendQueue.pop())); - clientMsgInterface.OnGameMessage(GameMessage_Server_Password("false")); + clientMsgInterface.onGameMessage(GameMessage_Server_Password("false")); BOOST_TEST(client.getState() == ClientState::Stopped); } @@ -405,13 +405,13 @@ BOOST_AUTO_TEST_CASE(IncreaseSpeed_DecreasesGF_WhenDivisibleBy10_By10) client.setNewSpeed(50ms); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 50ms); - client.IncreaseSpeed(); + client.increaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 40ms); - client.IncreaseSpeed(); + client.increaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 30ms); - client.IncreaseSpeed(); + client.increaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 20ms); - client.IncreaseSpeed(); + client.increaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 10ms); } @@ -421,13 +421,13 @@ BOOST_AUTO_TEST_CASE(DecreaseSpeed_IncreasesGF_WhenDivisible10_By10) client.setNewSpeed(10ms); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 10ms); - client.DecreaseSpeed(); + client.decreaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 20ms); - client.DecreaseSpeed(); + client.decreaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 30ms); - client.DecreaseSpeed(); + client.decreaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 40ms); - client.DecreaseSpeed(); + client.decreaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 50ms); } @@ -437,12 +437,12 @@ BOOST_AUTO_TEST_CASE(IncreaseSpeed_DecreasesGF_WhenNotDivisibleBy10_RoundsDownTo client.setNewSpeed(25ms); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 25ms); - client.IncreaseSpeed(); + client.increaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 20ms); client.setNewSpeed(12ms); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 12ms); - client.IncreaseSpeed(); + client.increaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 10ms); } @@ -452,12 +452,12 @@ BOOST_AUTO_TEST_CASE(DecreaseSpeed_IncreasesGF_WhenNotDivisibleBy10_RoundsUpTo10 client.setNewSpeed(25ms); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 25ms); - client.DecreaseSpeed(); + client.decreaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 30ms); client.setNewSpeed(12ms); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 12ms); - client.DecreaseSpeed(); + client.decreaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == 20ms); } @@ -466,18 +466,18 @@ BOOST_AUTO_TEST_CASE(IncreaseSpeed_WrapsAround_OrCaps) GameClient client; client.setNewSpeed(MAX_SPEED + 2ms); - client.IncreaseSpeed(); + client.increaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == MAX_SPEED); - client.IncreaseSpeed(); + client.increaseSpeed(); #ifndef NDEBUG BOOST_TEST_REQUIRE(client.getGFLengthReq() == MAX_SPEED_DEBUG); - client.IncreaseSpeed(); + client.increaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == MAX_SPEED_DEBUG); #else BOOST_TEST_REQUIRE(client.getGFLengthReq() == MAX_SPEED); #endif // Wrap around if request - client.IncreaseSpeed(true); + client.increaseSpeed(true); BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED); } @@ -487,12 +487,12 @@ BOOST_AUTO_TEST_CASE(DecreaseSpeed_CapsAtMinSpeed) client.setNewSpeed(MIN_SPEED - 2ms); BOOST_TEST_REQUIRE(client.getGFLengthReq() == (MIN_SPEED - 2ms)); - client.DecreaseSpeed(); + client.decreaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED); - client.DecreaseSpeed(); + client.decreaseSpeed(); #ifndef NDEBUG BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED_DEBUG); - client.DecreaseSpeed(); + client.decreaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED_DEBUG); #else BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED); @@ -506,18 +506,18 @@ BOOST_AUTO_TEST_CASE(ChangeSpeed_to_Min_or_Max_directly_when_outside) client.setNewSpeed(MIN_SPEED_DEBUG); BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED_DEBUG); - client.IncreaseSpeed(); + client.increaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED); client.setNewSpeed((MIN_SPEED_DEBUG + MIN_SPEED) / 2); // Any speed between - client.IncreaseSpeed(); + client.increaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == MIN_SPEED); client.setNewSpeed(MAX_SPEED_DEBUG); BOOST_TEST_REQUIRE(client.getGFLengthReq() == MAX_SPEED_DEBUG); - client.DecreaseSpeed(); + client.decreaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == MAX_SPEED); client.setNewSpeed((MAX_SPEED_DEBUG + MAX_SPEED) / 2); // Any speed between - client.DecreaseSpeed(); + client.decreaseSpeed(); BOOST_TEST_REQUIRE(client.getGFLengthReq() == MAX_SPEED); } #endif diff --git a/tests/s25Main/simple/testMapBase.cpp b/tests/s25Main/simple/testMapBase.cpp index 4a47b9b973..d74fb6507f 100644 --- a/tests/s25Main/simple/testMapBase.cpp +++ b/tests/s25Main/simple/testMapBase.cpp @@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE(getAllNeighboursUnion) BOOST_AUTO_TEST_CASE(NeighbourPts) { MapBase world; - world.Resize(MapExtent(20, 30)); + world.resize(MapExtent(20, 30)); /* Note that every 2nd row is shifted by half a triangle to the left, therefore: Modifications for the dirs: */ @@ -86,19 +86,19 @@ BOOST_AUTO_TEST_CASE(NeighbourPts) const Position targetPointRaw = pt + (isEvenRow ? evenPtMod : oddPtMod)[dir]; const MapPoint targetPoint((targetPointRaw.x + world.getWidth()) % world.getWidth(), (targetPointRaw.y + world.getHeight()) % world.getHeight()); - BOOST_TEST_REQUIRE(world.CalcDistance(pt, targetPoint) == 1u); + BOOST_TEST_REQUIRE(world.calcDistance(pt, targetPoint) == 1u); BOOST_TEST_REQUIRE(world.getNeighbour(pt, dir) == targetPoint); // Consistency check: The inverse must also match BOOST_TEST_REQUIRE(world.getNeighbour(targetPoint, Direction(dir + 3)) == pt); // Also the global function must return the same: BOOST_TEST_REQUIRE(::getNeighbour(Position(pt), dir) == targetPointRaw); - BOOST_TEST_REQUIRE(world.MakeMapPoint(::getNeighbour(Position(pt), dir)) == targetPoint); + BOOST_TEST_REQUIRE(world.makeMapPoint(::getNeighbour(Position(pt), dir)) == targetPoint); } // Neighbour 2 -> Radius 2, right circle MapPoint curTargetPoint = world.getNeighbour(world.getNeighbour(pt, Direction::West), Direction::West); - BOOST_TEST_REQUIRE(world.CalcDistance(pt, curTargetPoint) == 2u); + BOOST_TEST_REQUIRE(world.calcDistance(pt, curTargetPoint) == 2u); BOOST_TEST_REQUIRE(world.getNeighbour2(pt, 0) == curTargetPoint); // We now go 2 steps in each direction to describe the circle // (Note: Could iterator over directions, but to easily identify errors and make intentions clear we do it @@ -111,7 +111,7 @@ BOOST_AUTO_TEST_CASE(NeighbourPts) for(unsigned j = 1; j < 12; j++) { curTargetPoint = world.getNeighbour(curTargetPoint, steps.at(j - 1)); - BOOST_TEST_REQUIRE(world.CalcDistance(pt, curTargetPoint) == 2u); + BOOST_TEST_REQUIRE(world.calcDistance(pt, curTargetPoint) == 2u); BOOST_TEST_REQUIRE(world.getNeighbour2(pt, j) == curTargetPoint); } @@ -124,7 +124,7 @@ BOOST_AUTO_TEST_CASE(NeighbourPts) for(unsigned j = 0; j < 12; j++) BOOST_TEST_REQUIRE(radiusPts[j + 7] == world.getNeighbour2(pt, j)); for(unsigned j = 0; j < 18; j++) - BOOST_TEST_REQUIRE(world.CalcDistance(pt, radiusPts[j + 19]) == 3u); + BOOST_TEST_REQUIRE(world.calcDistance(pt, radiusPts[j + 19]) == 3u); const helpers::EnumArray neighbours = world.getNeighbours(pt); for(const auto dir : helpers::EnumRange{}) @@ -135,7 +135,7 @@ BOOST_AUTO_TEST_CASE(NeighbourPts) BOOST_AUTO_TEST_CASE(GetMatchingPointsInRadius) { MapBase world; - world.Resize(MapExtent(20, 30)); + world.resize(MapExtent(20, 30)); const MapPoint center = rttr::test::randomPoint(0, 19); const std::vector oddPts = world.GetMatchingPointsInRadius(center, 5, [](const MapPoint pt) { return pt.x % 2 == 1; }); @@ -156,14 +156,14 @@ BOOST_AUTO_TEST_CASE(getIdx) { MapBase world; // Small world - world.Resize(MapExtent(100, 50)); + world.resize(MapExtent(100, 50)); BOOST_TEST_REQUIRE(world.getIdx(MapPoint(0, 0)) == 0u); BOOST_TEST_REQUIRE(world.getIdx(MapPoint(99, 0)) == 99u); BOOST_TEST_REQUIRE(world.getIdx(MapPoint(0, 1)) == 100u); BOOST_TEST_REQUIRE(world.getIdx(MapPoint(1, 1)) == 101u); BOOST_TEST_REQUIRE(world.getIdx(MapPoint(99, 49)) == 50u * 100u - 1u); // Big world. - world.Resize(MapExtent(MAX_MAP_SIZE, MAX_MAP_SIZE - 2)); + world.resize(MapExtent(MAX_MAP_SIZE, MAX_MAP_SIZE - 2)); BOOST_TEST_REQUIRE(world.getIdx(MapPoint(0, 0)) == 0u); BOOST_TEST_REQUIRE(world.getIdx(MapPoint(MAX_MAP_SIZE - 1, 0)) == MAX_MAP_SIZE - 1); BOOST_TEST_REQUIRE(world.getIdx(MapPoint(0, 1)) == MAX_MAP_SIZE); diff --git a/tests/s25Main/simple/testPostBox.cpp b/tests/s25Main/simple/testPostBox.cpp index 70e6d681a2..8f5646fa97 100644 --- a/tests/s25Main/simple/testPostBox.cpp +++ b/tests/s25Main/simple/testPostBox.cpp @@ -9,7 +9,7 @@ BOOST_AUTO_TEST_SUITE(PostBoxTestSuite) -BOOST_AUTO_TEST_CASE(AddMsg) +BOOST_AUTO_TEST_CASE(addMsg) { PostBox box; std::vector msgs; @@ -19,7 +19,7 @@ BOOST_AUTO_TEST_CASE(AddMsg) { auto msg = std::make_unique(0, "Test", PostCategory::General); const auto* msgPtr = msg.get(); - box.AddMsg(std::move(msg)); + box.addMsg(std::move(msg)); BOOST_TEST_REQUIRE(box.getNumMsgs() == i + 1); BOOST_TEST_REQUIRE(box.getMsg(i) == msgPtr); BOOST_TEST_REQUIRE(!box.getMsg(i + 1)); @@ -31,7 +31,7 @@ BOOST_AUTO_TEST_CASE(AddMsg) // Overfill auto msg = std::make_unique(0, "Test2", PostCategory::General); const auto* msgPtr = msg.get(); - box.AddMsg(std::move(msg)); + box.addMsg(std::move(msg)); BOOST_TEST_REQUIRE(box.getNumMsgs() == box.getMaxMsgs()); BOOST_TEST_REQUIRE(box.getMsg(box.getMaxMsgs() - 1) == msgPtr); // Check that messages have been shifted @@ -39,30 +39,30 @@ BOOST_AUTO_TEST_CASE(AddMsg) BOOST_TEST_REQUIRE(box.getMsg(i) == msgs[i + 1]); } -BOOST_AUTO_TEST_CASE(DeleteMsg) +BOOST_AUTO_TEST_CASE(deleteMsg) { PostBox box; - BOOST_TEST_REQUIRE(box.DeleteMsg(0u) == false); - BOOST_TEST_REQUIRE(box.DeleteMsg(box.getMaxMsgs()) == false); + BOOST_TEST_REQUIRE(box.deleteMsg(0u) == false); + BOOST_TEST_REQUIRE(box.deleteMsg(box.getMaxMsgs()) == false); // Add 1 msg - box.AddMsg(std::make_unique(0, "", PostCategory::General)); + box.addMsg(std::make_unique(0, "", PostCategory::General)); // Deleting only this msg should succeed for(unsigned i = 1; i < PostBox::getMaxMsgs(); i++) - BOOST_TEST_REQUIRE(box.DeleteMsg(i) == false); + BOOST_TEST_REQUIRE(box.deleteMsg(i) == false); BOOST_TEST_REQUIRE(box.getNumMsgs() == 1u); - BOOST_TEST_REQUIRE(box.DeleteMsg(0u) == true); + BOOST_TEST_REQUIRE(box.deleteMsg(0u) == true); BOOST_TEST_REQUIRE(box.getNumMsgs() == 0u); auto msg = std::make_unique(0, "", PostCategory::General); const auto* msgPtr = msg.get(); - box.AddMsg(std::move(msg)); - BOOST_TEST_REQUIRE(box.DeleteMsg(msgPtr) == true); + box.addMsg(std::move(msg)); + BOOST_TEST_REQUIRE(box.deleteMsg(msgPtr) == true); BOOST_TEST_REQUIRE(box.getNumMsgs() == 0u); // Now fill it for(unsigned i = 0; i < PostBox::getMaxMsgs(); i++) - box.AddMsg(std::make_unique(i, "Test", PostCategory::General)); - BOOST_TEST_REQUIRE(box.DeleteMsg(0u) == true); - BOOST_TEST_REQUIRE(box.DeleteMsg(5u) == true); - BOOST_TEST_REQUIRE(box.DeleteMsg(box.getMaxMsgs() - 3) == true); + box.addMsg(std::make_unique(i, "Test", PostCategory::General)); + BOOST_TEST_REQUIRE(box.deleteMsg(0u) == true); + BOOST_TEST_REQUIRE(box.deleteMsg(5u) == true); + BOOST_TEST_REQUIRE(box.deleteMsg(box.getMaxMsgs() - 3) == true); BOOST_TEST_REQUIRE(box.getNumMsgs() == box.getMaxMsgs() - 3); unsigned expected = 1; for(unsigned i = 0; i < box.getNumMsgs(); i++, expected++) @@ -79,12 +79,12 @@ struct CallbackChecker PostBox& box; unsigned newCalls, delCalls; CallbackChecker(PostBox& box) : box(box), newCalls(0), delCalls(0) {} - void OnNew(const PostMsg& /*msg*/, unsigned ct) + void onNew(const PostMsg& /*msg*/, unsigned ct) { newCalls++; BOOST_TEST_REQUIRE(box.getNumMsgs() == ct); } - void OnDel(unsigned ct) + void onDel(unsigned ct) { delCalls++; BOOST_TEST_REQUIRE(box.getNumMsgs() == ct); @@ -95,14 +95,14 @@ BOOST_AUTO_TEST_CASE(MsgCallbacks) { PostBox box; CallbackChecker cb(box); - box.ObserveNewMsg([&cb](const auto& msg, auto ct) { cb.OnNew(msg, ct); }); - box.ObserveDeletedMsg([&cb](auto ct) { cb.OnDel(ct); }); + box.observeNewMsg([&cb](const auto& msg, auto ct) { cb.onNew(msg, ct); }); + box.observeDeletedMsg([&cb](auto ct) { cb.onDel(ct); }); for(unsigned i = 0; i < PostBox::getMaxMsgs(); i++) - box.AddMsg(std::make_unique(i, "Test", PostCategory::General)); + box.addMsg(std::make_unique(i, "Test", PostCategory::General)); BOOST_TEST_REQUIRE(cb.newCalls == box.getMaxMsgs()); BOOST_TEST_REQUIRE(cb.delCalls == 0u); for(unsigned i = 0; i < PostBox::getMaxMsgs(); i++) - box.DeleteMsg(0u); + box.deleteMsg(0u); BOOST_TEST_REQUIRE(cb.newCalls == box.getMaxMsgs()); BOOST_TEST_REQUIRE(cb.delCalls == box.getMaxMsgs()); } @@ -111,11 +111,11 @@ BOOST_AUTO_TEST_CASE(ClearMsgs) { PostBox box; CallbackChecker cb(box); - box.ObserveDeletedMsg([&cb](auto ct) { cb.OnDel(ct); }); + box.observeDeletedMsg([&cb](auto ct) { cb.onDel(ct); }); for(unsigned i = 0; i < PostBox::getMaxMsgs(); i++) - box.AddMsg(std::make_unique(i, "Test", PostCategory::General)); + box.addMsg(std::make_unique(i, "Test", PostCategory::General)); // Deleting should delete all messages and call delete callback for each one - box.Clear(); + box.clear(); BOOST_TEST_REQUIRE(box.getNumMsgs() == 0u); BOOST_TEST_REQUIRE(cb.delCalls == box.getMaxMsgs()); } diff --git a/tests/s25Main/worldFixtures/CreateEmptyWorld.cpp b/tests/s25Main/worldFixtures/CreateEmptyWorld.cpp index cec0d21f16..3dd6610a82 100644 --- a/tests/s25Main/worldFixtures/CreateEmptyWorld.cpp +++ b/tests/s25Main/worldFixtures/CreateEmptyWorld.cpp @@ -67,9 +67,9 @@ bool CreateEmptyWorld::operator()(GameWorld& world) const } curPt.y += playerDist.y; } - BOOST_TEST_REQUIRE(MapLoader::PlaceHQs(world, hqPositions, false)); + BOOST_TEST_REQUIRE(MapLoader::placeHQs(world, hqPositions, false)); } - world.InitAfterLoad(); + world.initAfterLoad(); return true; } diff --git a/tests/s25Main/worldFixtures/CreateSeaWorld.cpp b/tests/s25Main/worldFixtures/CreateSeaWorld.cpp index 453f2f074c..e903c002e0 100644 --- a/tests/s25Main/worldFixtures/CreateSeaWorld.cpp +++ b/tests/s25Main/worldFixtures/CreateSeaWorld.cpp @@ -21,7 +21,7 @@ bool PlaceHarbor(MapPoint pt, GameWorldBase& world, std::vector& harbo for(MapPoint curPt : pts) { // Harbor only at castles - world.RecalcBQ(curPt); + world.recalcBQ(curPt); if(world.getNode(curPt).bq != BuildingQuality::Castle) continue; // We must have a coast around @@ -139,10 +139,10 @@ bool CreateSeaWorld::operator()(GameWorld& world) const BOOST_TEST_REQUIRE(PlaceHarbor(hqPositions[3] - MapPoint(0, landSize / 2), world, harbors)); BOOST_TEST_REQUIRE(PlaceHarbor(hqPositions[3] + MapPoint(0, landSize / 2), world, harbors)); - BOOST_TEST_REQUIRE(MapLoader::InitSeasAndHarbors(world, harbors)); + BOOST_TEST_REQUIRE(MapLoader::initSeasAndHarbors(world, harbors)); - BOOST_TEST_REQUIRE(MapLoader::PlaceHQs(world, hqPositions, false)); - world.InitAfterLoad(); + BOOST_TEST_REQUIRE(MapLoader::placeHQs(world, hqPositions, false)); + world.initAfterLoad(); /* The HQs and harbor(ids) are here: (H=HQ, 1-8=harbor) * WWWWWWWWWWWWWWWWWWWWWWW @@ -182,7 +182,7 @@ bool CreateWaterWorld::operator()(GameWorld& world) const std::vector hqPositions; hqPositions.push_back(MapPoint(10, 10)); if(world.getNumPlayers() > 1) - hqPositions.push_back(world.MakeMapPoint(hqPositions.front() + size_ / 2)); // LCOV_EXCL_LINE + hqPositions.push_back(world.makeMapPoint(hqPositions.front() + size_ / 2)); // LCOV_EXCL_LINE t = GetLandTerrain(world.getDescription(), ETerrain::Buildable); for(MapPoint hqPos : hqPositions) { @@ -193,17 +193,17 @@ bool CreateWaterWorld::operator()(GameWorld& world) const node.t1 = node.t2 = t; } } - BOOST_TEST_REQUIRE(MapLoader::PlaceHQs(world, hqPositions, false)); + BOOST_TEST_REQUIRE(MapLoader::placeHQs(world, hqPositions, false)); std::vector harbors; for(MapPoint hqPos : hqPositions) { - BOOST_TEST_REQUIRE(PlaceHarbor(world.MakeMapPoint(hqPos - Position(landRadius, 0)), world, harbors)); - BOOST_TEST_REQUIRE(PlaceHarbor(world.MakeMapPoint(hqPos - Position(0, landRadius)), world, harbors)); - BOOST_TEST_REQUIRE(PlaceHarbor(world.MakeMapPoint(hqPos + Position(landRadius, 0)), world, harbors)); - BOOST_TEST_REQUIRE(PlaceHarbor(world.MakeMapPoint(hqPos + Position(0, landRadius)), world, harbors)); + BOOST_TEST_REQUIRE(PlaceHarbor(world.makeMapPoint(hqPos - Position(landRadius, 0)), world, harbors)); + BOOST_TEST_REQUIRE(PlaceHarbor(world.makeMapPoint(hqPos - Position(0, landRadius)), world, harbors)); + BOOST_TEST_REQUIRE(PlaceHarbor(world.makeMapPoint(hqPos + Position(landRadius, 0)), world, harbors)); + BOOST_TEST_REQUIRE(PlaceHarbor(world.makeMapPoint(hqPos + Position(0, landRadius)), world, harbors)); } RTTR_Assert(harbors.size() == hqPositions.size() * 4u); - BOOST_TEST_REQUIRE(MapLoader::InitSeasAndHarbors(world, harbors)); + BOOST_TEST_REQUIRE(MapLoader::initSeasAndHarbors(world, harbors)); return true; } diff --git a/tests/s25Main/worldFixtures/GCExecutor.cpp b/tests/s25Main/worldFixtures/GCExecutor.cpp index 04982c8e5c..489617f9a5 100644 --- a/tests/s25Main/worldFixtures/GCExecutor.cpp +++ b/tests/s25Main/worldFixtures/GCExecutor.cpp @@ -3,7 +3,7 @@ #include "world/GameWorld.h" #include "gameTypes/GameTypesOutput.h" -void GCExecutor::BuildRoadForBlds(const MapPoint bldPosFrom, const MapPoint bldPosTo) +void GCExecutor::buildRoadForBlds(const MapPoint bldPosFrom, const MapPoint bldPosTo) { auto& world = getWorld(); const MapPoint start = world.getNeighbour(bldPosFrom, Direction::SouthEast); diff --git a/tests/s25Main/worldFixtures/GCExecutor.h b/tests/s25Main/worldFixtures/GCExecutor.h index 44d880ce61..a94c24f2db 100644 --- a/tests/s25Main/worldFixtures/GCExecutor.h +++ b/tests/s25Main/worldFixtures/GCExecutor.h @@ -15,7 +15,7 @@ class GCExecutor : public GameCommandFactory GCExecutor() : curPlayer(0) {} protected: - bool AddGC(gc::GameCommandPtr gc) override + bool addGC(gc::GameCommandPtr gc) override { // Go through serialization to check if that works too gc::Deserializer ser; @@ -27,12 +27,12 @@ class GCExecutor : public GameCommandFactory gc->Serialize(ser2); BOOST_TEST_REQUIRE(ser2.GetLength() == ser.GetLength()); BOOST_TEST_REQUIRE(memcmp(ser2.GetData(), ser.GetData(), ser.GetLength()) == 0); - gc->Execute(getWorld(), curPlayer); + gc->execute(getWorld(), curPlayer); return true; } /// Constructs a road connecting 2 buildings and checks for success - void BuildRoadForBlds(MapPoint bldPosFrom, MapPoint bldPosTo); + void buildRoadForBlds(MapPoint bldPosFrom, MapPoint bldPosTo); virtual GameWorld& getWorld() = 0; }; diff --git a/tests/s25Main/worldFixtures/MockLocalGameState.h b/tests/s25Main/worldFixtures/MockLocalGameState.h index 0f6cc9c6cd..60296b7f37 100644 --- a/tests/s25Main/worldFixtures/MockLocalGameState.h +++ b/tests/s25Main/worldFixtures/MockLocalGameState.h @@ -11,6 +11,6 @@ MOCK_BASE_CLASS(MockLocalGameState, ILocalGameState) { MOCK_CONST_METHOD(getPlayerId, 0); MOCK_CONST_METHOD(isHost, 0); - MOCK_CONST_METHOD(FormatGFTime, 1); - MOCK_NON_CONST_METHOD(SystemChat, 1); + MOCK_CONST_METHOD(formatGFTime, 1); + MOCK_NON_CONST_METHOD(systemChat, 1); }; diff --git a/tests/s25Main/worldFixtures/TestEventManager.cpp b/tests/s25Main/worldFixtures/TestEventManager.cpp index 1cd80e91dc..32ef4aa1fb 100644 --- a/tests/s25Main/worldFixtures/TestEventManager.cpp +++ b/tests/s25Main/worldFixtures/TestEventManager.cpp @@ -26,12 +26,12 @@ unsigned TestEventManager::doExecuteNextEvent(unsigned maxGF) } unsigned numGFs = itEvents->first - getCurrentGF(); currentGF = itEvents->first; - ExecuteEvents(itEvents); - DestroyCurrentObjects(); + executeEvents(itEvents); + destroyCurrentObjects(); return numGFs; } -unsigned TestEventManager::ExecuteNextEvent(unsigned maxGF) +unsigned TestEventManager::executeNextEvent(unsigned maxGF) { const auto numGFs = doExecuteNextEvent(maxGF); if(numGFs > 0) @@ -40,8 +40,8 @@ unsigned TestEventManager::ExecuteNextEvent(unsigned maxGF) { if(player.isUsed()) { - player.TestForEmergencyProgramm(); - player.TestPacts(); + player.testForEmergencyProgramm(); + player.testPacts(); } } } @@ -76,12 +76,12 @@ bool TestEventManager::isEventActive(const GameObject& obj, const unsigned id) c return false; } -const GameEvent* TestEventManager::RescheduleEvent(const GameEvent* event, unsigned targetGF) +const GameEvent* TestEventManager::rescheduleEvent(const GameEvent* event, unsigned targetGF) { - RemoveEventFromQueue(*event); + removeEventFromQueue(*event); // Hacky but we need to preserve the location (pointer) of the event as objects store it const_cast(event)->length = targetGF - event->startGF; - return AddEventToQueue(event); + return addEventToQueue(event); } std::vector TestEventManager::getEvents() const diff --git a/tests/s25Main/worldFixtures/TestEventManager.h b/tests/s25Main/worldFixtures/TestEventManager.h index 2cdb945a39..8a30225ccc 100644 --- a/tests/s25Main/worldFixtures/TestEventManager.h +++ b/tests/s25Main/worldFixtures/TestEventManager.h @@ -19,13 +19,13 @@ class TestEventManager : public EventManager /// Execute the next event increasing the GF to the events GF /// If maxGF is given the event is only executed if its GF is <= maxGF and the new GF will be at most maxGF (even if /// no event was executed Returns the number of GFs executed - unsigned ExecuteNextEvent(unsigned maxGF = std::numeric_limits::max()); + unsigned executeNextEvent(unsigned maxGF = std::numeric_limits::max()); /// Return all events of the given object std::vector getObjEvents(const GameObject& obj) const; /// Check if there is already an event of the given id for this object bool isEventActive(const GameObject& obj, unsigned id) const; /// Remove the event and add a copy that is executed at the given GF - const GameEvent* RescheduleEvent(const GameEvent* event, unsigned targetGF); + const GameEvent* rescheduleEvent(const GameEvent* event, unsigned targetGF); std::vector getEvents() const; void setWorld(GameWorldBase& world) { world_ = &world; } }; diff --git a/tests/s25Main/worldFixtures/WorldFixture.h b/tests/s25Main/worldFixtures/WorldFixture.h index 96b3822aa0..cb373d197c 100644 --- a/tests/s25Main/worldFixtures/WorldFixture.h +++ b/tests/s25Main/worldFixtures/WorldFixture.h @@ -28,7 +28,7 @@ unsigned rttr_exec_till_ct_gf(TestEventManager& em, unsigned maxGFs, T&& cond) unsigned gfsExecuted = 0; while(!cond()) { - const unsigned numGF = em.ExecuteNextEvent(endGf); + const unsigned numGF = em.executeNextEvent(endGf); if(numGF == 0) break; gfsExecuted += numGF; @@ -138,7 +138,7 @@ class TestWorld : public World protected: // LCOV_EXCL_START - void AltitudeChanged(MapPoint) override {} - void VisibilityChanged(MapPoint, unsigned, Visibility, Visibility) override {} + void altitudeChanged(MapPoint) override {} + void visibilityChanged(MapPoint, unsigned, Visibility, Visibility) override {} // LCOV_EXCL_STOP }; From b9481cfaea02dd1881b8b5ed3e494107d4f0e602 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Mon, 16 Nov 2026 12:54:05 +0100 Subject: [PATCH 6/7] Rename Lua registration and desktop switch methods to lowerCamelCase --- libs/libGamedata/lua/CampaignDataLoader.cpp | 4 +- libs/libGamedata/lua/CampaignDataLoader.h | 2 +- libs/libGamedata/lua/GameDataLoader.cpp | 4 +- libs/libGamedata/lua/GameDataLoader.h | 2 +- libs/libGamedata/lua/LuaInterfaceBase.cpp | 4 +- libs/libGamedata/lua/LuaInterfaceBase.h | 2 +- libs/s25main/AsyncChecksum.cpp | 6 +- libs/s25main/AsyncChecksum.h | 4 +- libs/s25main/BasePlayerInfo.cpp | 2 +- libs/s25main/BasePlayerInfo.h | 2 +- libs/s25main/BuildingRegister.cpp | 4 +- libs/s25main/BuildingRegister.h | 4 +- libs/s25main/CatapultStone.cpp | 2 +- libs/s25main/CatapultStone.h | 2 +- libs/s25main/EconomyModeHandler.cpp | 4 +- libs/s25main/EconomyModeHandler.h | 4 +- libs/s25main/EventManager.cpp | 4 +- libs/s25main/EventManager.h | 4 +- libs/s25main/FOWObjects.cpp | 10 +- libs/s25main/FOWObjects.h | 10 +- libs/s25main/FoWObject.h | 2 +- libs/s25main/GameCommand.cpp | 4 +- libs/s25main/GameCommand.h | 4 +- libs/s25main/GameCommands.cpp | 12 +- libs/s25main/GameCommands.h | 106 +++++++++--------- libs/s25main/GameEvent.cpp | 2 +- libs/s25main/GameEvent.h | 2 +- libs/s25main/GameManager.cpp | 6 +- libs/s25main/GameObject.h | 2 +- libs/s25main/GamePlayer.cpp | 12 +- libs/s25main/GamePlayer.h | 6 +- libs/s25main/GlobalGameSettings.cpp | 4 +- libs/s25main/GlobalGameSettings.h | 4 +- libs/s25main/JoinPlayerInfo.cpp | 4 +- libs/s25main/JoinPlayerInfo.h | 2 +- libs/s25main/PlayerInfo.cpp | 4 +- libs/s25main/PlayerInfo.h | 2 +- libs/s25main/QuickStartGame.cpp | 4 +- libs/s25main/Replay.cpp | 4 +- libs/s25main/RoadSegment.cpp | 2 +- libs/s25main/RoadSegment.h | 2 +- libs/s25main/SavedFile.cpp | 6 +- libs/s25main/SerializedGameData.cpp | 18 +-- libs/s25main/Ware.cpp | 2 +- libs/s25main/Ware.h | 2 +- libs/s25main/WindowManager.cpp | 2 +- libs/s25main/WindowManager.h | 2 +- libs/s25main/buildings/BurnedWarehouse.cpp | 4 +- libs/s25main/buildings/BurnedWarehouse.h | 2 +- libs/s25main/buildings/noBaseBuilding.cpp | 4 +- libs/s25main/buildings/noBaseBuilding.h | 2 +- libs/s25main/buildings/noBuilding.cpp | 4 +- libs/s25main/buildings/noBuilding.h | 2 +- libs/s25main/buildings/noBuildingSite.cpp | 4 +- libs/s25main/buildings/noBuildingSite.h | 2 +- libs/s25main/buildings/nobBaseMilitary.cpp | 4 +- libs/s25main/buildings/nobBaseMilitary.h | 2 +- libs/s25main/buildings/nobBaseWarehouse.cpp | 4 +- libs/s25main/buildings/nobBaseWarehouse.h | 2 +- libs/s25main/buildings/nobHQ.cpp | 4 +- libs/s25main/buildings/nobHQ.h | 2 +- libs/s25main/buildings/nobHarborBuilding.cpp | 12 +- libs/s25main/buildings/nobHarborBuilding.h | 6 +- libs/s25main/buildings/nobMilitary.cpp | 4 +- libs/s25main/buildings/nobMilitary.h | 2 +- libs/s25main/buildings/nobShipYard.cpp | 4 +- libs/s25main/buildings/nobShipYard.h | 2 +- libs/s25main/buildings/nobTemple.cpp | 4 +- libs/s25main/buildings/nobTemple.h | 2 +- libs/s25main/buildings/nobUsual.cpp | 4 +- libs/s25main/buildings/nobUsual.h | 2 +- libs/s25main/desktops/dskBenchmark.cpp | 2 +- .../desktops/dskCampaignMissionSelection.cpp | 2 +- .../s25main/desktops/dskCampaignSelection.cpp | 4 +- libs/s25main/desktops/dskCredits.cpp | 2 +- libs/s25main/desktops/dskDirectIP.cpp | 2 +- libs/s25main/desktops/dskGameLoader.cpp | 8 +- libs/s25main/desktops/dskGameLobby.cpp | 10 +- libs/s25main/desktops/dskIntro.cpp | 2 +- libs/s25main/desktops/dskLAN.cpp | 4 +- libs/s25main/desktops/dskLobby.cpp | 4 +- libs/s25main/desktops/dskMainMenu.cpp | 12 +- libs/s25main/desktops/dskMultiPlayer.cpp | 6 +- libs/s25main/desktops/dskOptions.cpp | 6 +- libs/s25main/desktops/dskSelectMap.cpp | 16 +-- libs/s25main/desktops/dskSinglePlayer.cpp | 10 +- libs/s25main/desktops/dskSplash.cpp | 4 +- libs/s25main/desktops/dskTest.cpp | 6 +- libs/s25main/desktops/dskTextureTest.cpp | 2 +- libs/s25main/figures/noFigure.cpp | 4 +- libs/s25main/figures/noFigure.h | 2 +- libs/s25main/figures/nofActiveSoldier.cpp | 4 +- libs/s25main/figures/nofActiveSoldier.h | 2 +- .../s25main/figures/nofAggressiveDefender.cpp | 4 +- libs/s25main/figures/nofAggressiveDefender.h | 2 +- libs/s25main/figures/nofArmorer.cpp | 4 +- libs/s25main/figures/nofArmorer.h | 2 +- libs/s25main/figures/nofAttacker.cpp | 4 +- libs/s25main/figures/nofAttacker.h | 2 +- libs/s25main/figures/nofBuilder.cpp | 4 +- libs/s25main/figures/nofBuilder.h | 2 +- libs/s25main/figures/nofBuildingWorker.cpp | 4 +- libs/s25main/figures/nofBuildingWorker.h | 2 +- libs/s25main/figures/nofCarrier.cpp | 4 +- libs/s25main/figures/nofCarrier.h | 2 +- libs/s25main/figures/nofCatapultMan.cpp | 8 +- libs/s25main/figures/nofCatapultMan.h | 4 +- libs/s25main/figures/nofCharburner.cpp | 4 +- libs/s25main/figures/nofCharburner.h | 2 +- libs/s25main/figures/nofDefender.cpp | 4 +- libs/s25main/figures/nofDefender.h | 2 +- libs/s25main/figures/nofFarmer.cpp | 4 +- libs/s25main/figures/nofFarmer.h | 2 +- libs/s25main/figures/nofFarmhand.cpp | 4 +- libs/s25main/figures/nofFarmhand.h | 2 +- libs/s25main/figures/nofFisher.cpp | 4 +- libs/s25main/figures/nofFisher.h | 2 +- libs/s25main/figures/nofFlagWorker.cpp | 4 +- libs/s25main/figures/nofFlagWorker.h | 2 +- libs/s25main/figures/nofGeologist.cpp | 4 +- libs/s25main/figures/nofGeologist.h | 2 +- libs/s25main/figures/nofHunter.cpp | 4 +- libs/s25main/figures/nofHunter.h | 2 +- libs/s25main/figures/nofMetalworker.cpp | 4 +- libs/s25main/figures/nofMetalworker.h | 2 +- libs/s25main/figures/nofPassiveSoldier.cpp | 4 +- libs/s25main/figures/nofPassiveSoldier.h | 2 +- libs/s25main/figures/nofPlaner.cpp | 4 +- libs/s25main/figures/nofPlaner.h | 2 +- libs/s25main/figures/nofScout_Free.cpp | 4 +- libs/s25main/figures/nofScout_Free.h | 2 +- libs/s25main/figures/nofShipWright.cpp | 4 +- libs/s25main/figures/nofShipWright.h | 2 +- libs/s25main/figures/nofSkinner.cpp | 4 +- libs/s25main/figures/nofSkinner.h | 2 +- libs/s25main/figures/nofSoldier.cpp | 4 +- libs/s25main/figures/nofSoldier.h | 2 +- libs/s25main/figures/nofTempleServant.cpp | 4 +- libs/s25main/figures/nofTempleServant.h | 2 +- libs/s25main/figures/nofTradeDonkey.cpp | 4 +- libs/s25main/figures/nofTradeDonkey.h | 2 +- libs/s25main/figures/nofTradeLeader.cpp | 6 +- libs/s25main/figures/nofTradeLeader.h | 2 +- libs/s25main/figures/nofWarehouseWorker.cpp | 4 +- libs/s25main/figures/nofWarehouseWorker.h | 2 +- libs/s25main/figures/nofWinegrower.cpp | 4 +- libs/s25main/figures/nofWinegrower.h | 2 +- libs/s25main/gameTypes/FoWNode.cpp | 4 +- libs/s25main/gameTypes/FoWNode.h | 4 +- libs/s25main/gameTypes/LanGameInfo.cpp | 4 +- libs/s25main/gameTypes/LanGameInfo.h | 4 +- libs/s25main/gameTypes/MapNode.cpp | 8 +- libs/s25main/gameTypes/MapNode.h | 4 +- libs/s25main/ingameWindows/iwConnecting.cpp | 4 +- .../ingameWindows/iwDirectIPCreate.cpp | 2 +- libs/s25main/ingameWindows/iwLobbyConnect.cpp | 2 +- libs/s25main/ingameWindows/iwPlayReplay.cpp | 2 +- libs/s25main/ingameWindows/iwSave.cpp | 2 +- libs/s25main/lua/LuaInterfaceGame.cpp | 12 +- libs/s25main/lua/LuaInterfaceGame.h | 6 +- libs/s25main/lua/LuaInterfaceGameBase.cpp | 4 +- libs/s25main/lua/LuaInterfaceGameBase.h | 2 +- libs/s25main/lua/LuaInterfaceSettings.cpp | 6 +- libs/s25main/lua/LuaInterfaceSettings.h | 2 +- libs/s25main/lua/LuaPlayer.cpp | 4 +- libs/s25main/lua/LuaPlayer.h | 2 +- libs/s25main/lua/LuaPlayerBase.cpp | 2 +- libs/s25main/lua/LuaPlayerBase.h | 2 +- libs/s25main/lua/LuaServerPlayer.cpp | 4 +- libs/s25main/lua/LuaServerPlayer.h | 2 +- libs/s25main/lua/LuaWorld.cpp | 2 +- libs/s25main/lua/LuaWorld.h | 2 +- .../network/GameMessage_GameCommand.cpp | 4 +- libs/s25main/network/GameMessages.cpp | 2 +- libs/s25main/network/GameMessages.h | 8 +- libs/s25main/network/GameServer.cpp | 2 +- libs/s25main/network/PlayerGameCommands.cpp | 12 +- libs/s25main/network/PlayerGameCommands.h | 4 +- libs/s25main/nodeObjs/noAnimal.cpp | 4 +- libs/s25main/nodeObjs/noAnimal.h | 2 +- libs/s25main/nodeObjs/noBase.cpp | 2 +- libs/s25main/nodeObjs/noBase.h | 2 +- libs/s25main/nodeObjs/noCharburnerPile.cpp | 4 +- libs/s25main/nodeObjs/noCharburnerPile.h | 2 +- libs/s25main/nodeObjs/noCoordBase.cpp | 4 +- libs/s25main/nodeObjs/noCoordBase.h | 2 +- .../nodeObjs/noDisappearingEnvObject.cpp | 4 +- .../nodeObjs/noDisappearingEnvObject.h | 2 +- .../nodeObjs/noDisappearingMapEnvObject.cpp | 4 +- .../nodeObjs/noDisappearingMapEnvObject.h | 2 +- libs/s25main/nodeObjs/noExtension.cpp | 4 +- libs/s25main/nodeObjs/noExtension.h | 2 +- libs/s25main/nodeObjs/noFighting.cpp | 4 +- libs/s25main/nodeObjs/noFighting.h | 2 +- libs/s25main/nodeObjs/noFire.cpp | 4 +- libs/s25main/nodeObjs/noFire.h | 2 +- libs/s25main/nodeObjs/noFlag.cpp | 4 +- libs/s25main/nodeObjs/noFlag.h | 2 +- libs/s25main/nodeObjs/noGrainfield.cpp | 4 +- libs/s25main/nodeObjs/noGrainfield.h | 2 +- libs/s25main/nodeObjs/noGranite.cpp | 4 +- libs/s25main/nodeObjs/noGranite.h | 2 +- libs/s25main/nodeObjs/noGrapefield.cpp | 4 +- libs/s25main/nodeObjs/noGrapefield.h | 2 +- libs/s25main/nodeObjs/noMovable.cpp | 4 +- libs/s25main/nodeObjs/noMovable.h | 2 +- libs/s25main/nodeObjs/noRoadNode.cpp | 4 +- libs/s25main/nodeObjs/noRoadNode.h | 2 +- libs/s25main/nodeObjs/noShip.cpp | 4 +- libs/s25main/nodeObjs/noShip.h | 2 +- libs/s25main/nodeObjs/noShipBuildingSite.cpp | 4 +- libs/s25main/nodeObjs/noShipBuildingSite.h | 2 +- libs/s25main/nodeObjs/noSign.cpp | 4 +- libs/s25main/nodeObjs/noSign.h | 2 +- libs/s25main/nodeObjs/noSkeleton.cpp | 4 +- libs/s25main/nodeObjs/noSkeleton.h | 2 +- libs/s25main/nodeObjs/noStaticObject.cpp | 4 +- libs/s25main/nodeObjs/noStaticObject.h | 2 +- libs/s25main/nodeObjs/noTree.cpp | 4 +- libs/s25main/nodeObjs/noTree.h | 2 +- libs/s25main/random/Random.cpp | 4 +- libs/s25main/random/Random.h | 4 +- libs/s25main/world/MapSerializer.cpp | 12 +- libs/s25main/world/MapSerializer.h | 4 +- libs/s25main/world/TradePath.cpp | 2 +- libs/s25main/world/TradePath.h | 2 +- libs/s25main/world/TradeRoute.cpp | 4 +- libs/s25main/world/TradeRoute.h | 2 +- tests/s25Main/UI/testAnimations.cpp | 2 +- tests/s25Main/UI/testDskGameLobby.cpp | 2 +- tests/s25Main/UI/testWindowManager.cpp | 2 +- .../UI/uiHelper/uiHelper/uiHelpers.cpp | 4 +- .../testDisappearingMapObjects.cpp | 2 +- .../integration/testDskGameInterface.cpp | 2 +- .../s25Main/integration/testGameCommands.cpp | 8 +- tests/s25Main/integration/testGameEvents.cpp | 4 +- .../s25Main/integration/testSerialization.cpp | 10 +- .../s25Main/integration/testWorldFixtures.cpp | 2 +- tests/s25Main/lua/testLua.cpp | 18 +-- tests/s25Main/worldFixtures/GCExecutor.h | 6 +- 240 files changed, 507 insertions(+), 507 deletions(-) diff --git a/libs/libGamedata/lua/CampaignDataLoader.cpp b/libs/libGamedata/lua/CampaignDataLoader.cpp index dd5af9f64a..7e2cbef498 100644 --- a/libs/libGamedata/lua/CampaignDataLoader.cpp +++ b/libs/libGamedata/lua/CampaignDataLoader.cpp @@ -23,7 +23,7 @@ unsigned CampaignDataLoader::getVersion() CampaignDataLoader::CampaignDataLoader(CampaignDescription& campaignDesc, const boost::filesystem::path& basePath) : campaignDesc_(campaignDesc), basePath_(basePath.lexically_normal().make_preferred()) { - Register(lua); + registerClasses(lua); lua["rttr"] = this; } @@ -73,7 +73,7 @@ bool CampaignDataLoader::Load() } return true; } -void CampaignDataLoader::Register(kaguya::State& state) +void CampaignDataLoader::registerClasses(kaguya::State& state) { state["RTTRCampaignData"].setClass(kaguya::UserdataMetatable()); } diff --git a/libs/libGamedata/lua/CampaignDataLoader.h b/libs/libGamedata/lua/CampaignDataLoader.h index 615f477d07..dfa5f23397 100644 --- a/libs/libGamedata/lua/CampaignDataLoader.h +++ b/libs/libGamedata/lua/CampaignDataLoader.h @@ -23,7 +23,7 @@ class CampaignDataLoader : public LuaInterfaceBase bool Load(); - static void Register(kaguya::State& state); + static void registerClasses(kaguya::State& state); private: CampaignDescription& campaignDesc_; diff --git a/libs/libGamedata/lua/GameDataLoader.cpp b/libs/libGamedata/lua/GameDataLoader.cpp index 56e492c1e0..907e6a9994 100644 --- a/libs/libGamedata/lua/GameDataLoader.cpp +++ b/libs/libGamedata/lua/GameDataLoader.cpp @@ -22,7 +22,7 @@ namespace bfs = boost::filesystem; GameDataLoader::GameDataLoader(WorldDescription& worldDesc, const boost::filesystem::path& basePath) : worldDesc_(worldDesc), basePath_(basePath.lexically_normal().make_preferred()), curIncludeDepth_(0) { - Register(lua); + registerClasses(lua); lua["rttr"] = this; lua["include"] = kaguya::function([this](const std::string& file) { include(file); }); @@ -41,7 +41,7 @@ bool GameDataLoader::Load() return loadScript(curFile_); } -void GameDataLoader::Register(kaguya::State& state) +void GameDataLoader::registerClasses(kaguya::State& state) { state["RTTRGameData"].setClass(kaguya::UserdataMetatable() .addFunction("AddLandscape", &GameDataLoader::addLandscape) diff --git a/libs/libGamedata/lua/GameDataLoader.h b/libs/libGamedata/lua/GameDataLoader.h index 747e94b291..fade26076c 100644 --- a/libs/libGamedata/lua/GameDataLoader.h +++ b/libs/libGamedata/lua/GameDataLoader.h @@ -22,7 +22,7 @@ class GameDataLoader : public LuaInterfaceBase bool Load(); - static void Register(kaguya::State& state); + static void registerClasses(kaguya::State& state); private: void include(const std::string& filepath); diff --git a/libs/libGamedata/lua/LuaInterfaceBase.cpp b/libs/libGamedata/lua/LuaInterfaceBase.cpp index ae74da7659..a2a0896f4c 100644 --- a/libs/libGamedata/lua/LuaInterfaceBase.cpp +++ b/libs/libGamedata/lua/LuaInterfaceBase.cpp @@ -22,7 +22,7 @@ LuaInterfaceBase::LuaInterfaceBase() : lua(kaguya::NoLoadLib()), logger_(LOG), e lua.openlib("table", luaopen_table); lua.openlib("math", luaopen_math); - Register(lua); + registerClasses(lua); setThrowOnError(true); // Quasi-Standard translate function lua["_"] = kaguya::function([this](const std::string& s) { return translate(s); }); @@ -32,7 +32,7 @@ LuaInterfaceBase::LuaInterfaceBase() : lua(kaguya::NoLoadLib()), logger_(LOG), e LuaInterfaceBase::~LuaInterfaceBase() = default; -void LuaInterfaceBase::Register(kaguya::State& state) +void LuaInterfaceBase::registerClasses(kaguya::State& state) { state["RTTRBase"].setClass(kaguya::UserdataMetatable() .addFunction("Log", &LuaInterfaceBase::log) diff --git a/libs/libGamedata/lua/LuaInterfaceBase.h b/libs/libGamedata/lua/LuaInterfaceBase.h index 5134299202..73301d6ccc 100644 --- a/libs/libGamedata/lua/LuaInterfaceBase.h +++ b/libs/libGamedata/lua/LuaInterfaceBase.h @@ -27,7 +27,7 @@ class LuaExecutionError : public std::runtime_error class LuaInterfaceBase { public: - static void Register(kaguya::State& state); + static void registerClasses(kaguya::State& state); bool loadScript(const boost::filesystem::path& scriptPath); bool loadScriptString(const std::string& script, bool rethrowError = false); diff --git a/libs/s25main/AsyncChecksum.cpp b/libs/s25main/AsyncChecksum.cpp index 5a7fa3e70a..f86acfcda1 100644 --- a/libs/s25main/AsyncChecksum.cpp +++ b/libs/s25main/AsyncChecksum.cpp @@ -18,7 +18,7 @@ AsyncChecksum::AsyncChecksum(unsigned randChecksum, unsigned objCt, unsigned obj : randChecksum(randChecksum), objCt(objCt), objIdCt(objIdCt), eventCt(eventCt), evInstanceCt(evInstanceCt) {} -void AsyncChecksum::Serialize(Serializer& ser) const +void AsyncChecksum::serialize(Serializer& ser) const { ser.PushUnsignedInt(randChecksum); ser.PushUnsignedInt(objCt); @@ -27,7 +27,7 @@ void AsyncChecksum::Serialize(Serializer& ser) const ser.PushUnsignedInt(evInstanceCt); } -void AsyncChecksum::Deserialize(Serializer& ser) +void AsyncChecksum::deserialize(Serializer& ser) { randChecksum = ser.PopUnsignedInt(); objCt = ser.PopUnsignedInt(); @@ -39,7 +39,7 @@ void AsyncChecksum::Deserialize(Serializer& ser) unsigned AsyncChecksum::getHash() const { Serializer ser; - Serialize(ser); + serialize(ser); return calcChecksumOfBuffer(ser.GetData(), ser.GetLength()); } diff --git a/libs/s25main/AsyncChecksum.h b/libs/s25main/AsyncChecksum.h index f54da55f11..9dc7e940b5 100644 --- a/libs/s25main/AsyncChecksum.h +++ b/libs/s25main/AsyncChecksum.h @@ -17,8 +17,8 @@ struct AsyncChecksum unsigned eventCt, evInstanceCt; AsyncChecksum(); AsyncChecksum(unsigned randChecksum, unsigned objCt, unsigned objIdCt, unsigned eventCt, unsigned evInstanceCt); - void Serialize(Serializer& ser) const; - void Deserialize(Serializer& ser); + void serialize(Serializer& ser) const; + void deserialize(Serializer& ser); /// Get a hash for this checksum unsigned getHash() const; diff --git a/libs/s25main/BasePlayerInfo.cpp b/libs/s25main/BasePlayerInfo.cpp index ba10768b4f..c92c4b2abc 100644 --- a/libs/s25main/BasePlayerInfo.cpp +++ b/libs/s25main/BasePlayerInfo.cpp @@ -34,7 +34,7 @@ BasePlayerInfo::BasePlayerInfo(Serializer& ser, int serializedVersion, bool ligh } } -void BasePlayerInfo::Serialize(Serializer& ser, bool lightData) const +void BasePlayerInfo::serialize(Serializer& ser, bool lightData) const { helpers::pushEnum(ser, ps); if(lightData && !isUsed()) diff --git a/libs/s25main/BasePlayerInfo.h b/libs/s25main/BasePlayerInfo.h index e06b9338ba..d8c380ba53 100644 --- a/libs/s25main/BasePlayerInfo.h +++ b/libs/s25main/BasePlayerInfo.h @@ -28,7 +28,7 @@ struct BasePlayerInfo /// Deserialize data. If lightData is true, unused data is not read (e.g. unused slot -> Skip rest) BasePlayerInfo(Serializer& ser, int serializedVersion, bool lightData); /// Serialize data. If lightData is true, unused data is not written (e.g. unused slot -> Skip rest) - void Serialize(Serializer& ser, bool lightData) const; + void serialize(Serializer& ser, bool lightData) const; /// Slot used by a human player (has socket etc) bool isHuman() const { return (ps == PlayerState::Occupied); } diff --git a/libs/s25main/BuildingRegister.cpp b/libs/s25main/BuildingRegister.cpp index 7519602a19..23e5e2689d 100644 --- a/libs/s25main/BuildingRegister.cpp +++ b/libs/s25main/BuildingRegister.cpp @@ -17,7 +17,7 @@ #include "gameData/BuildingConsts.h" #include "gameData/BuildingProperties.h" -void BuildingRegister::Serialize(SerializedGameData& sgd) const +void BuildingRegister::serialize(SerializedGameData& sgd) const { sgd.pushObjectContainer(warehouses); sgd.pushObjectContainer(harbors, true); @@ -30,7 +30,7 @@ void BuildingRegister::Serialize(SerializedGameData& sgd) const sgd.pushObjectContainer(military_buildings, true); } -void BuildingRegister::Deserialize(SerializedGameData& sgd) +void BuildingRegister::deserialize(SerializedGameData& sgd) { sgd.popObjectContainer(warehouses); sgd.popObjectContainer(harbors, GO_Type::NobHarborbuilding); diff --git a/libs/s25main/BuildingRegister.h b/libs/s25main/BuildingRegister.h index ce09200b78..dc1ea8e1bd 100644 --- a/libs/s25main/BuildingRegister.h +++ b/libs/s25main/BuildingRegister.h @@ -20,9 +20,9 @@ class BuildingRegister { public: /// Serialisieren - void Serialize(SerializedGameData& sgd) const; + void serialize(SerializedGameData& sgd) const; // Deserialisieren - void Deserialize(SerializedGameData& sgd); + void deserialize(SerializedGameData& sgd); /// Compatibility with old savegames void deserialize2(SerializedGameData& sgd); diff --git a/libs/s25main/CatapultStone.cpp b/libs/s25main/CatapultStone.cpp index f0b1b38ea8..ec236daf92 100644 --- a/libs/s25main/CatapultStone.cpp +++ b/libs/s25main/CatapultStone.cpp @@ -32,7 +32,7 @@ CatapultStone::CatapultStone(SerializedGameData& sgd, const unsigned obj_id) {} /// Serialisierungsfunktionen -void CatapultStone::Serialize(SerializedGameData& sgd) const +void CatapultStone::serialize(SerializedGameData& sgd) const { helpers::pushPoint(sgd, dest_building); helpers::pushPoint(sgd, dest_map); diff --git a/libs/s25main/CatapultStone.h b/libs/s25main/CatapultStone.h index 8c0ebf4d2b..0c7a7e6ea1 100644 --- a/libs/s25main/CatapultStone.h +++ b/libs/s25main/CatapultStone.h @@ -37,7 +37,7 @@ class CatapultStone : public GameObject /// Zerstören void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; // Zeichnet den fliegenden Stein void draw(DrawPoint drawOffset); diff --git a/libs/s25main/EconomyModeHandler.cpp b/libs/s25main/EconomyModeHandler.cpp index 971f3156e1..e21aee0a01 100644 --- a/libs/s25main/EconomyModeHandler.cpp +++ b/libs/s25main/EconomyModeHandler.cpp @@ -106,7 +106,7 @@ EconomyModeHandler::EconomyModeHandler(SerializedGameData& sgd, unsigned objId) void EconomyModeHandler::destroy() {} /// Serialisierungsfunktion -void EconomyModeHandler::Serialize(SerializedGameData& sgd) const +void EconomyModeHandler::serialize(SerializedGameData& sgd) const { sgd.PushUnsignedInt(endFrame); helpers::pushContainer(sgd, goodsToCollect); @@ -286,7 +286,7 @@ EconomyModeHandler::EconTeam::EconTeam(SerializedGameData& sgd, unsigned numGood : playersInTeam(sgd.PopSignedInt()), amountsTheTeamCollected(numGoodTypesToCollect, 0), goodTypeWins(0) {} -void EconomyModeHandler::EconTeam::Serialize(SerializedGameData& sgd) const +void EconomyModeHandler::EconTeam::serialize(SerializedGameData& sgd) const { sgd.PushUnsignedInt(playersInTeam.to_ulong()); } diff --git a/libs/s25main/EconomyModeHandler.h b/libs/s25main/EconomyModeHandler.h index 38483f5741..85952cd02c 100644 --- a/libs/s25main/EconomyModeHandler.h +++ b/libs/s25main/EconomyModeHandler.h @@ -37,7 +37,7 @@ class EconomyModeHandler : public GameObject EconTeam(SerializedGameData& sgd, unsigned numGoodTypesToCollect); - void Serialize(SerializedGameData& sgd) const; + void serialize(SerializedGameData& sgd) const; /// Returns true if the player is in the team bool containsPlayer(unsigned playerId) const; @@ -75,7 +75,7 @@ class EconomyModeHandler : public GameObject EconomyModeHandler(SerializedGameData& sgd, unsigned objId); void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; /// Event-Handler void handleEvent(unsigned id) override; diff --git a/libs/s25main/EventManager.cpp b/libs/s25main/EventManager.cpp index 58e16327b0..7141421d38 100644 --- a/libs/s25main/EventManager.cpp +++ b/libs/s25main/EventManager.cpp @@ -147,7 +147,7 @@ void EventManager::executeEvents(const EventMap::iterator& itEvents) events.erase(itEvents); } -void EventManager::Serialize(SerializedGameData& sgd) const +void EventManager::serialize(SerializedGameData& sgd) const { // Kill list must be empty (do not store to-be-killed objects) RTTR_Assert(killList.empty()); @@ -166,7 +166,7 @@ void EventManager::Serialize(SerializedGameData& sgd) const sgd.PushUnsignedInt(eventInstanceCtr); } -void EventManager::Deserialize(SerializedGameData& sgd) +void EventManager::deserialize(SerializedGameData& sgd) { if(numActiveEvents != 0) throw SerializedGameData::Error(_("Cannot deserialize event manager when there are still events active!")); diff --git a/libs/s25main/EventManager.h b/libs/s25main/EventManager.h index 29551fdbe9..a706409839 100644 --- a/libs/s25main/EventManager.h +++ b/libs/s25main/EventManager.h @@ -41,8 +41,8 @@ class EventManager void addToKillList(GameObject* obj); void addToKillList(std::unique_ptr obj); - void Serialize(SerializedGameData& sgd) const; - void Deserialize(SerializedGameData& sgd); + void serialize(SerializedGameData& sgd) const; + void deserialize(SerializedGameData& sgd); unsigned getNextEventInstanceId(); diff --git a/libs/s25main/FOWObjects.cpp b/libs/s25main/FOWObjects.cpp index acecf6b114..25c78f0c15 100644 --- a/libs/s25main/FOWObjects.cpp +++ b/libs/s25main/FOWObjects.cpp @@ -32,7 +32,7 @@ fowBuilding::fowBuilding(const BuildingType type, const Nation nation) : type(ty fowBuilding::fowBuilding(SerializedGameData& sgd) : type(sgd.pop()), nation(sgd.pop()) {} -void fowBuilding::Serialize(SerializedGameData& sgd) const +void fowBuilding::serialize(SerializedGameData& sgd) const { sgd.pushEnum(type); sgd.pushEnum(nation); @@ -56,7 +56,7 @@ fowBuildingSite::fowBuildingSite(SerializedGameData& sgd) build_progress(sgd.PopUnsignedChar()) {} -void fowBuildingSite::Serialize(SerializedGameData& sgd) const +void fowBuildingSite::serialize(SerializedGameData& sgd) const { sgd.PushBool(planing); sgd.pushEnum(type); @@ -114,7 +114,7 @@ fowFlag::fowFlag(SerializedGameData& sgd) : color(sgd.PopUnsignedInt()), nation(sgd.pop()), flag_type(sgd.pop()) {} -void fowFlag::Serialize(SerializedGameData& sgd) const +void fowFlag::serialize(SerializedGameData& sgd) const { sgd.PushUnsignedInt(color); sgd.pushEnum(nation); @@ -133,7 +133,7 @@ fowTree::fowTree(const unsigned char type, const unsigned char size) : type(type fowTree::fowTree(SerializedGameData& sgd) : type(sgd.PopUnsignedChar()), size(sgd.PopUnsignedChar()) {} -void fowTree::Serialize(SerializedGameData& sgd) const +void fowTree::serialize(SerializedGameData& sgd) const { sgd.PushUnsignedChar(type); sgd.PushUnsignedChar(size); @@ -160,7 +160,7 @@ fowGranite::fowGranite(const GraniteType type, const unsigned char state) : type fowGranite::fowGranite(SerializedGameData& sgd) : type(sgd.pop()), state(sgd.PopUnsignedChar()) {} -void fowGranite::Serialize(SerializedGameData& sgd) const +void fowGranite::serialize(SerializedGameData& sgd) const { sgd.pushEnum(type); sgd.PushUnsignedChar(state); diff --git a/libs/s25main/FOWObjects.h b/libs/s25main/FOWObjects.h index 6f443bb0ae..7cd6158676 100644 --- a/libs/s25main/FOWObjects.h +++ b/libs/s25main/FOWObjects.h @@ -29,7 +29,7 @@ class fowBuilding : public FOWObject public: fowBuilding(BuildingType type, Nation nation); fowBuilding(SerializedGameData& sgd); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; void draw(DrawPoint drawPt) const override; FoW_Type getType() const override { return FoW_Type::Building; } BuildingType getBuildingType() const { return type; } @@ -51,7 +51,7 @@ class fowBuildingSite : public FOWObject public: fowBuildingSite(bool planing, BuildingType type, Nation nation, unsigned char build_progress); fowBuildingSite(SerializedGameData& sgd); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; void draw(DrawPoint drawPt) const override; FoW_Type getType() const override { return FoW_Type::Buildingsite; } }; @@ -68,7 +68,7 @@ class fowFlag : public FOWObject public: fowFlag(unsigned playerColor, Nation nation, FlagType flag_type); fowFlag(SerializedGameData& sgd); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; void draw(DrawPoint drawPt) const override; FoW_Type getType() const override { return FoW_Type::Flag; } }; @@ -85,7 +85,7 @@ class fowTree : public FOWObject public: fowTree(unsigned char type, unsigned char size); fowTree(SerializedGameData& sgd); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; void draw(DrawPoint drawPt) const override; FoW_Type getType() const override { return FoW_Type::Tree; } }; @@ -100,7 +100,7 @@ class fowGranite : public FOWObject public: fowGranite(GraniteType type, unsigned char state); fowGranite(SerializedGameData& sgd); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; void draw(DrawPoint drawPt) const override; FoW_Type getType() const override { return FoW_Type::Granite; } }; diff --git a/libs/s25main/FoWObject.h b/libs/s25main/FoWObject.h index 759af63f3b..ad627f84a5 100644 --- a/libs/s25main/FoWObject.h +++ b/libs/s25main/FoWObject.h @@ -30,6 +30,6 @@ class FOWObject public: virtual ~FOWObject() = default; virtual void draw(DrawPoint drawPt) const = 0; - virtual void Serialize(SerializedGameData& sgd) const = 0; + virtual void serialize(SerializedGameData& sgd) const = 0; virtual FoW_Type getType() const = 0; }; diff --git a/libs/s25main/GameCommand.cpp b/libs/s25main/GameCommand.cpp index 2de5a924e0..1b7b3ae652 100644 --- a/libs/s25main/GameCommand.cpp +++ b/libs/s25main/GameCommand.cpp @@ -18,7 +18,7 @@ unsigned Deserializer::getCurrentVersion() return 2; } -GameCommandPtr GameCommand::Deserialize(Deserializer& ser) +GameCommandPtr GameCommand::deserialize(Deserializer& ser) { auto gcType = helpers::popEnum(ser); GameCommand* gc; @@ -65,7 +65,7 @@ GameCommandPtr GameCommand::Deserialize(Deserializer& ser) return gc; } -void GameCommand::Serialize(Serializer& ser) const +void GameCommand::serialize(Serializer& ser) const { helpers::pushEnum(ser, gcType); } diff --git a/libs/s25main/GameCommand.h b/libs/s25main/GameCommand.h index 30d915ab5c..37591a20a8 100644 --- a/libs/s25main/GameCommand.h +++ b/libs/s25main/GameCommand.h @@ -91,10 +91,10 @@ class GameCommand } /// Builds a GameCommand depending on Type - static GameCommandPtr Deserialize(Deserializer& ser); + static GameCommandPtr deserialize(Deserializer& ser); /// Serializes this GameCommand - virtual void Serialize(Serializer& ser) const; + virtual void serialize(Serializer& ser) const; /// Execute this GameCommand virtual void execute(GameWorld& world, uint8_t playerId) = 0; diff --git a/libs/s25main/GameCommands.cpp b/libs/s25main/GameCommands.cpp index 76897c533f..5c730feb42 100644 --- a/libs/s25main/GameCommands.cpp +++ b/libs/s25main/GameCommands.cpp @@ -41,9 +41,9 @@ BuildRoad::BuildRoad(Serializer& ser) i = helpers::popEnum(ser); } -void BuildRoad::Serialize(Serializer& ser) const +void BuildRoad::serialize(Serializer& ser) const { - Coords::Serialize(ser); + Coords::serialize(ser); ser.PushBool(boat_road); ser.PushUnsignedInt(route.size()); @@ -60,9 +60,9 @@ DestroyRoad::DestroyRoad(Serializer& ser) : Coords(GCType::DestroyRoad, ser), start_dir(helpers::popEnum(ser)) {} -void DestroyRoad::Serialize(Serializer& ser) const +void DestroyRoad::serialize(Serializer& ser) const { - Coords::Serialize(ser); + Coords::serialize(ser); helpers::pushEnum(ser, start_dir); } @@ -78,9 +78,9 @@ UpgradeRoad::UpgradeRoad(Serializer& ser) : Coords(GCType::UpgradeRoad, ser), start_dir(helpers::popEnum(ser)) {} -void UpgradeRoad::Serialize(Serializer& ser) const +void UpgradeRoad::serialize(Serializer& ser) const { - Coords::Serialize(ser); + Coords::serialize(ser); helpers::pushEnum(ser, start_dir); } diff --git a/libs/s25main/GameCommands.h b/libs/s25main/GameCommands.h index 72f45d210e..f0bc19af5f 100644 --- a/libs/s25main/GameCommands.h +++ b/libs/s25main/GameCommands.h @@ -48,9 +48,9 @@ class Coords : public GameCommand Coords(const GCType gst, Serializer& ser) : GameCommand(gst), pt_(helpers::popPoint(ser)) {} public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - GameCommand::Serialize(ser); + GameCommand::serialize(ser); helpers::pushPoint(ser, pt_); } }; @@ -97,7 +97,7 @@ class BuildRoad : public Coords BuildRoad(Serializer& ser); public: - void Serialize(Serializer& ser) const override; + void serialize(Serializer& ser) const override; void execute(GameWorld& world, uint8_t playerId) override; }; @@ -114,7 +114,7 @@ class DestroyRoad : public Coords DestroyRoad(Serializer& ser); public: - void Serialize(Serializer& ser) const override; + void serialize(Serializer& ser) const override; void execute(GameWorld& world, uint8_t playerId) override; }; @@ -131,7 +131,7 @@ class UpgradeRoad : public Coords UpgradeRoad(Serializer& ser); public: - void Serialize(Serializer& ser) const override; + void serialize(Serializer& ser) const override; void execute(GameWorld& world, uint8_t playerId) override; }; @@ -148,9 +148,9 @@ class ChangeDistribution : public GameCommand ChangeDistribution(Deserializer& ser); public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - GameCommand::Serialize(ser); + GameCommand::serialize(ser); helpers::pushContainer(ser, data); } @@ -173,9 +173,9 @@ class ChangeBuildOrder : public GameCommand ChangeBuildOrder(Deserializer& ser); public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - GameCommand::Serialize(ser); + GameCommand::serialize(ser); ser.PushBool(useCustomBuildOrder); for(auto i : data) helpers::pushEnum(ser, i); @@ -196,9 +196,9 @@ class SetBuildingSite : public Coords SetBuildingSite(Serializer& ser) : Coords(GCType::SetBuildingsite, ser), bt(helpers::popEnum(ser)) {} public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - Coords::Serialize(ser); + Coords::serialize(ser); helpers::pushEnum(ser, bt); } @@ -235,9 +235,9 @@ class SetTroopLimit : public Coords {} public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - Coords::Serialize(ser); + Coords::serialize(ser); ser.PushUnsignedChar(rank); ser.PushUnsignedInt(count); @@ -258,9 +258,9 @@ class ChangeTransport : public GameCommand ChangeTransport(Deserializer& ser); public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - GameCommand::Serialize(ser); + GameCommand::serialize(ser); helpers::pushContainer(ser, data); } @@ -279,9 +279,9 @@ class ChangeMilitary : public GameCommand ChangeMilitary(Serializer& ser) : GameCommand(GCType::ChangeMilitary) { helpers::popContainer(ser, data); } public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - GameCommand::Serialize(ser); + GameCommand::serialize(ser); helpers::pushContainer(ser, data); } @@ -306,9 +306,9 @@ class ChangeTools : public GameCommand } public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - GameCommand::Serialize(ser); + GameCommand::serialize(ser); helpers::pushContainer(ser, data); helpers::pushContainer(ser, orders); } @@ -327,9 +327,9 @@ class CallSpecialist : public Coords CallSpecialist(Serializer& ser) : Coords(GCType::CallSpecialist, ser), job(helpers::popEnum(ser)) {} public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - Coords::Serialize(ser); + Coords::serialize(ser); helpers::pushEnum(ser, job); } void execute(GameWorld& world, uint8_t playerId) override; @@ -354,9 +354,9 @@ class BaseAttack : public Coords {} public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - Coords::Serialize(ser); + Coords::serialize(ser); ser.PushUnsignedInt(soldiers_count); ser.PushBool(strong_soldiers); @@ -404,9 +404,9 @@ class SetCoinsAllowed : public Coords SetCoinsAllowed(Serializer& ser) : Coords(GCType::SetCoinsAllowed, ser), enabled(ser.PopBool()) {} public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - Coords::Serialize(ser); + Coords::serialize(ser); ser.PushBool(enabled); } void execute(GameWorld& world, uint8_t playerId) override; @@ -423,9 +423,9 @@ class SetArmorAllowed : public Coords SetArmorAllowed(Serializer& ser) : Coords(GCType::SetArmorAllowed, ser), enabled(ser.PopBool()) {} public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - Coords::Serialize(ser); + Coords::serialize(ser); ser.PushBool(enabled); } void execute(GameWorld& world, uint8_t playerId) override; @@ -443,9 +443,9 @@ class SetProductionEnabled : public Coords SetProductionEnabled(Serializer& ser) : Coords(GCType::SetProductionEnabled, ser), enabled(ser.PopBool()) {} public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - Coords::Serialize(ser); + Coords::serialize(ser); ser.PushBool(enabled); } void execute(GameWorld& world, uint8_t playerId) override; @@ -486,9 +486,9 @@ class SetInventorySetting : public Coords } public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - Coords::Serialize(ser); + Coords::serialize(ser); ser.PushBool(holds_alternative(what)); visit([&ser](auto type) { helpers::pushEnum(ser, type); }, what); @@ -513,9 +513,9 @@ class SetAllInventorySettings : public Coords SetAllInventorySettings(Deserializer& ser); public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - Coords::Serialize(ser); + Coords::serialize(ser); ser.PushBool(isJob); RTTR_Assert(states.size() == (isJob ? helpers::NumEnumValues_v : helpers::NumEnumValues_v)); @@ -544,9 +544,9 @@ class ChangeReserve : public Coords {} public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - Coords::Serialize(ser); + Coords::serialize(ser); ser.PushUnsignedChar(rank); ser.PushUnsignedInt(count); @@ -615,9 +615,9 @@ class SuggestPact : public GameCommand {} public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - GameCommand::Serialize(ser); + GameCommand::serialize(ser); ser.PushUnsignedChar(targetPlayer); helpers::pushEnum(ser, pt); ser.PushUnsignedInt(duration); @@ -647,9 +647,9 @@ class AcceptPact : public GameCommand {} public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - GameCommand::Serialize(ser); + GameCommand::serialize(ser); ser.PushUnsignedInt(id); helpers::pushEnum(ser, pt); ser.PushUnsignedChar(fromPlayer); @@ -676,9 +676,9 @@ class CancelPact : public GameCommand {} public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - GameCommand::Serialize(ser); + GameCommand::serialize(ser); helpers::pushEnum(ser, pt); ser.PushUnsignedChar(otherPlayer); } @@ -698,9 +698,9 @@ class SetShipYardMode : public Coords public: void execute(GameWorld& world, uint8_t playerId) override; - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - Coords::Serialize(ser); + Coords::serialize(ser); ser.PushBool(buildShips); } }; @@ -721,9 +721,9 @@ class SetTempleProductionMode : public Coords public: void execute(GameWorld& world, uint8_t playerId) override; - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - Coords::Serialize(ser); + Coords::serialize(ser); helpers::pushEnum(ser, productionMode); } }; @@ -740,9 +740,9 @@ class StartStopExpedition : public Coords public: void execute(GameWorld& world, uint8_t playerId) override; - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - Coords::Serialize(ser); + Coords::serialize(ser); ser.PushBool(start); } }; @@ -763,9 +763,9 @@ class StartStopExplorationExpedition : public Coords public: void execute(GameWorld& world, uint8_t playerId) override; - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - Coords::Serialize(ser); + Coords::serialize(ser); ser.PushBool(start); } }; @@ -799,9 +799,9 @@ class ExpeditionCommand : public GameCommand {} public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - GameCommand::Serialize(ser); + GameCommand::serialize(ser); helpers::pushEnum(ser, action); ser.PushUnsignedInt(ship_id); } @@ -838,9 +838,9 @@ class TradeOverLand : public Coords } public: - void Serialize(Serializer& ser) const override + void serialize(Serializer& ser) const override { - Coords::Serialize(ser); + Coords::serialize(ser); ser.PushBool(holds_alternative(what)); visit([&ser](auto type) { helpers::pushEnum(ser, type); }, what); diff --git a/libs/s25main/GameEvent.cpp b/libs/s25main/GameEvent.cpp index 81cd5d2c31..01b1df1c9b 100644 --- a/libs/s25main/GameEvent.cpp +++ b/libs/s25main/GameEvent.cpp @@ -20,7 +20,7 @@ GameEvent::GameEvent(SerializedGameData& sgd, const unsigned instanceId) RTTR_Assert(obj); } -void GameEvent::Serialize(SerializedGameData& sgd) const +void GameEvent::serialize(SerializedGameData& sgd) const { sgd.pushObject(obj); sgd.PushUnsignedInt(startGF); diff --git a/libs/s25main/GameEvent.h b/libs/s25main/GameEvent.h index 9f399fbe62..60f2d40a3b 100644 --- a/libs/s25main/GameEvent.h +++ b/libs/s25main/GameEvent.h @@ -22,7 +22,7 @@ class GameEvent GameEvent(unsigned instanceId, GameObject* obj, unsigned startGF, unsigned length, unsigned id); GameEvent(SerializedGameData& sgd, unsigned instanceId); - void Serialize(SerializedGameData& sgd) const; + void serialize(SerializedGameData& sgd) const; /// Return GF at which this event will be executed unsigned getTargetGF() const { return startGF + length; } diff --git a/libs/s25main/GameManager.cpp b/libs/s25main/GameManager.cpp index 0f24815e4e..05788341ce 100644 --- a/libs/s25main/GameManager.cpp +++ b/libs/s25main/GameManager.cpp @@ -169,7 +169,7 @@ bool GameManager::showSplashscreen() s25util::error(_("Splash screen couldn't be loaded!")); return false; } - windowManager_.Switch(std::make_unique(std::move(image))); + windowManager_.switchTo(std::make_unique(std::move(image))); return true; } @@ -183,10 +183,10 @@ bool GameManager::showMenu() if(LOBBYCLIENT.IsLoggedIn()) // Lobby zeigen - windowManager_.Switch(std::make_unique()); + windowManager_.switchTo(std::make_unique()); else // Hauptmenü zeigen - windowManager_.Switch(std::make_unique()); + windowManager_.switchTo(std::make_unique()); return true; } diff --git a/libs/s25main/GameObject.h b/libs/s25main/GameObject.h index 292610f9e7..fc521e42ae 100644 --- a/libs/s25main/GameObject.h +++ b/libs/s25main/GameObject.h @@ -39,7 +39,7 @@ class GameObject /// Return the unique ID of an object. Always non-zero! unsigned getObjId() const { return objId; } - virtual void Serialize(SerializedGameData& sgd) const = 0; + virtual void serialize(SerializedGameData& sgd) const = 0; virtual GO_Type getGOT() const = 0; virtual std::string toString() const; diff --git a/libs/s25main/GamePlayer.cpp b/libs/s25main/GamePlayer.cpp index d631945109..1cca06cade 100644 --- a/libs/s25main/GamePlayer.cpp +++ b/libs/s25main/GamePlayer.cpp @@ -159,7 +159,7 @@ void GamePlayer::loadStandardDistribution() GamePlayer::~GamePlayer() = default; -void GamePlayer::Serialize(SerializedGameData& sgd) const +void GamePlayer::serialize(SerializedGameData& sgd) const { // PlayerStatus speichern, ehemalig sgd.pushEnum(ps); @@ -170,7 +170,7 @@ void GamePlayer::Serialize(SerializedGameData& sgd) const sgd.PushBool(isDefeated); - buildings.Serialize(sgd); + buildings.serialize(sgd); sgd.pushObjectContainer(roads, true); @@ -227,13 +227,13 @@ void GamePlayer::Serialize(SerializedGameData& sgd) const for(const auto& playerPacts : pacts) { for(const Pact& pact : playerPacts) - pact.Serialize(sgd); + pact.serialize(sgd); } sgd.PushBool(emergency); } -void GamePlayer::Deserialize(SerializedGameData& sgd) +void GamePlayer::deserialize(SerializedGameData& sgd) { std::fill(building_enabled.begin(), building_enabled.end(), true); @@ -244,7 +244,7 @@ void GamePlayer::Deserialize(SerializedGameData& sgd) return; isDefeated = sgd.PopBool(); - buildings.Deserialize(sgd); + buildings.deserialize(sgd); sgd.popObjectContainer(roads, GO_Type::Roadsegment); @@ -1654,7 +1654,7 @@ GamePlayer::Pact::Pact(SerializedGameData& sgd) : duration(sgd.PopUnsignedInt()), start(sgd.PopUnsignedInt()), accepted(sgd.PopBool()), want_cancel(sgd.PopBool()) {} -void GamePlayer::Pact::Serialize(SerializedGameData& sgd) const +void GamePlayer::Pact::serialize(SerializedGameData& sgd) const { sgd.PushUnsignedInt(duration); sgd.PushUnsignedInt(start); diff --git a/libs/s25main/GamePlayer.h b/libs/s25main/GamePlayer.h index b75d0598df..64dcdc79af 100644 --- a/libs/s25main/GamePlayer.h +++ b/libs/s25main/GamePlayer.h @@ -85,9 +85,9 @@ class GamePlayer : public GamePlayerInfo ~GamePlayer(); /// Serialisieren - void Serialize(SerializedGameData& sgd) const; + void serialize(SerializedGameData& sgd) const; // Deserialisieren - void Deserialize(SerializedGameData& sgd); + void deserialize(SerializedGameData& sgd); GameWorld& getGameWorld() { return world; } const GameWorld& getGameWorld() const { return world; } @@ -411,7 +411,7 @@ class GamePlayer : public GamePlayerInfo Pact() : duration(0), start(0), accepted(false), want_cancel(false) {} explicit Pact(SerializedGameData& sgd); - void Serialize(SerializedGameData& sgd) const; + void serialize(SerializedGameData& sgd) const; }; /// Bündnisse dieses Spielers mit anderen Spielern std::array, MAX_PLAYERS> pacts; diff --git a/libs/s25main/GlobalGameSettings.cpp b/libs/s25main/GlobalGameSettings.cpp index c9a4f82a4f..93e394405b 100644 --- a/libs/s25main/GlobalGameSettings.cpp +++ b/libs/s25main/GlobalGameSettings.cpp @@ -247,7 +247,7 @@ void GlobalGameSettings::saveSettings() const /** * saves the current addon configuration to a serializer object. */ -void GlobalGameSettings::Serialize(Serializer& ser) const +void GlobalGameSettings::serialize(Serializer& ser) const { // LOG.writeToFile(">>> Addon Status:\n"); @@ -272,7 +272,7 @@ void GlobalGameSettings::Serialize(Serializer& ser) const /** * reads the current addon configuration from a serializer object. */ -void GlobalGameSettings::Deserialize(Serializer& ser) +void GlobalGameSettings::deserialize(Serializer& ser) { speed = helpers::popEnum(ser); objective = helpers::popEnum(ser); diff --git a/libs/s25main/GlobalGameSettings.h b/libs/s25main/GlobalGameSettings.h index a6012d71b3..1813df5d80 100644 --- a/libs/s25main/GlobalGameSettings.h +++ b/libs/s25main/GlobalGameSettings.h @@ -24,8 +24,8 @@ class GlobalGameSettings GlobalGameSettings& operator=(GlobalGameSettings&&) noexcept; /// Serialisierung und Deserialisierung - void Serialize(Serializer& ser) const; - void Deserialize(Serializer& ser); + void serialize(Serializer& ser) const; + void deserialize(Serializer& ser); GameSpeed speed; GameObjective objective; diff --git a/libs/s25main/JoinPlayerInfo.cpp b/libs/s25main/JoinPlayerInfo.cpp index a2622e602d..32d611e880 100644 --- a/libs/s25main/JoinPlayerInfo.cpp +++ b/libs/s25main/JoinPlayerInfo.cpp @@ -18,9 +18,9 @@ JoinPlayerInfo::JoinPlayerInfo(Serializer& ser) : PlayerInfo(ser, BasePlayerInfo::getCurrentVersion()), originName(ser.PopLongString()), isReady(ser.PopBool()) {} -void JoinPlayerInfo::Serialize(Serializer& ser) const +void JoinPlayerInfo::serialize(Serializer& ser) const { - PlayerInfo::Serialize(ser); + PlayerInfo::serialize(ser); ser.PushLongString(originName); ser.PushBool(isReady); } diff --git a/libs/s25main/JoinPlayerInfo.h b/libs/s25main/JoinPlayerInfo.h index 4f4a632f3b..a3e677ee42 100644 --- a/libs/s25main/JoinPlayerInfo.h +++ b/libs/s25main/JoinPlayerInfo.h @@ -18,7 +18,7 @@ struct JoinPlayerInfo : public PlayerInfo explicit JoinPlayerInfo(Serializer& ser); // Serialize complete struct - void Serialize(Serializer& ser) const; + void serialize(Serializer& ser) const; void setAIName(unsigned playerId); // Recovers fixed data in savegames after player slots are swapped diff --git a/libs/s25main/PlayerInfo.cpp b/libs/s25main/PlayerInfo.cpp index 940bb699e5..4662b85358 100644 --- a/libs/s25main/PlayerInfo.cpp +++ b/libs/s25main/PlayerInfo.cpp @@ -13,9 +13,9 @@ PlayerInfo::PlayerInfo(Serializer& ser, int basePlayerInfoVersion) : BasePlayerInfo(ser, basePlayerInfoVersion, false), isHost(ser.PopBool()), ping(ser.PopUnsignedInt()) {} -void PlayerInfo::Serialize(Serializer& ser) const +void PlayerInfo::serialize(Serializer& ser) const { - BasePlayerInfo::Serialize(ser, false); + BasePlayerInfo::serialize(ser, false); ser.PushBool(isHost); ser.PushUnsignedInt(ping); } diff --git a/libs/s25main/PlayerInfo.h b/libs/s25main/PlayerInfo.h index 616b2674f6..a23de65245 100644 --- a/libs/s25main/PlayerInfo.h +++ b/libs/s25main/PlayerInfo.h @@ -17,5 +17,5 @@ struct PlayerInfo : public BasePlayerInfo explicit PlayerInfo(Serializer& ser, int basePlayerInfoVersion); // Serialize complete struct - void Serialize(Serializer& ser) const; + void serialize(Serializer& ser) const; }; diff --git a/libs/s25main/QuickStartGame.cpp b/libs/s25main/QuickStartGame.cpp index c76bf2dfa6..7c815fd66a 100644 --- a/libs/s25main/QuickStartGame.cpp +++ b/libs/s25main/QuickStartGame.cpp @@ -28,7 +28,7 @@ class SwitchOnStart : public ClientInterface void CI_GameLoading(std::shared_ptr game) override { - WINDOWMANAGER.Switch(std::make_unique(std::move(game))); + WINDOWMANAGER.switchTo(std::make_unique(std::move(game))); } }; @@ -85,7 +85,7 @@ bool quickStartGame(const boost::filesystem::path& mapOrReplayPath, const std::v LOG.write(_("Loading game...\n")); const std::string extension = s25util::toLower(mapOrReplayPath.extension().string()); - WINDOWMANAGER.Switch(std::make_unique(csi)); + WINDOWMANAGER.switchTo(std::make_unique(csi)); if((extension == ".sav" && GAMECLIENT.hostGame(csi, {mapOrReplayPath, MapType::Savegame})) || ((extension == ".swd" || extension == ".wld") diff --git a/libs/s25main/Replay.cpp b/libs/s25main/Replay.cpp index 487158923b..3cdd255d54 100644 --- a/libs/s25main/Replay.cpp +++ b/libs/s25main/Replay.cpp @@ -339,7 +339,7 @@ void Replay::addGameCommand(unsigned gf, uint8_t player, const PlayerGameCommand file_.WriteUnsignedChar(rttr::enum_cast(CommandType::Game)); Serializer ser; ser.PushUnsignedChar(player); - cmds.Serialize(ser); + cmds.serialize(ser); ser.WriteToFile(file_); // Prevent loss in case of crash @@ -394,5 +394,5 @@ Replay::GameCommand::GameCommand(BinaryFile& file, const unsigned version) gc::Deserializer ser{version}; ser.ReadFromFile(file); player = ser.PopUnsignedChar(); - cmds.Deserialize(ser); + cmds.deserialize(ser); } diff --git a/libs/s25main/RoadSegment.cpp b/libs/s25main/RoadSegment.cpp index 56c3e596c7..b08b58963d 100644 --- a/libs/s25main/RoadSegment.cpp +++ b/libs/s25main/RoadSegment.cpp @@ -94,7 +94,7 @@ void RoadSegment::destroy() } } -void RoadSegment::Serialize(SerializedGameData& sgd) const +void RoadSegment::serialize(SerializedGameData& sgd) const { sgd.pushEnum(rt); sgd.pushObject(f1); diff --git a/libs/s25main/RoadSegment.h b/libs/s25main/RoadSegment.h index 9bfb52113c..05471ce772 100644 --- a/libs/s25main/RoadSegment.h +++ b/libs/s25main/RoadSegment.h @@ -36,7 +36,7 @@ class RoadSegment : public GameObject /// zerstört das Objekt. void destroy() override; /// serialisiert das Objekt. - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; /// liefert den GO-Type. GO_Type getGOT() const final { return GO_Type::Roadsegment; } /// Gibt die ID (0 oder 1) eines RoadNodes dieser Straße zurück (die Flagge muss zu dieser Straße gehören, sonst diff --git a/libs/s25main/SavedFile.cpp b/libs/s25main/SavedFile.cpp index 80438e48b9..93be816185 100644 --- a/libs/s25main/SavedFile.cpp +++ b/libs/s25main/SavedFile.cpp @@ -136,7 +136,7 @@ void SavedFile::writePlayerData(BinaryFile& file) Serializer ser; ser.PushUnsignedChar(players.size()); for(const auto& player : players) - player.Serialize(ser, true); + player.serialize(ser, true); ser.WriteToFile(file); } @@ -172,7 +172,7 @@ void SavedFile::readPlayerData(BinaryFile& file) void SavedFile::writeGGS(BinaryFile& file) const { Serializer ser; - ggs.Serialize(ser); + ggs.serialize(ser); ser.WriteToFile(file); } @@ -183,7 +183,7 @@ void SavedFile::readGGS(BinaryFile& file) { Serializer ser; ser.ReadFromFile(file); - ggs.Deserialize(ser); + ggs.deserialize(ser); } const BasePlayerInfo& SavedFile::getPlayer(unsigned idx) const diff --git a/libs/s25main/SerializedGameData.cpp b/libs/s25main/SerializedGameData.cpp index c91c110a22..fe14a657ac 100644 --- a/libs/s25main/SerializedGameData.cpp +++ b/libs/s25main/SerializedGameData.cpp @@ -250,9 +250,9 @@ void SerializedGameData::makeSnapshot(const Game& game) PushUnsignedInt(expectedNumObjects); // World and objects - MapSerializer::Serialize(gw, *this); + MapSerializer::serialize(gw, *this); // EventManager - writeEm->Serialize(*this); + writeEm->serialize(*this); if(game.ggs_.objective == GameObjective::EconomyMode) { pushObject(gw.getEconHandler(), true); @@ -262,7 +262,7 @@ void SerializedGameData::makeSnapshot(const Game& game) { if(debugMode) LOG.write("Start serializing player %1% at %2%\n") % player.getPlayerId() % GetLength(); - player.Serialize(*this); + player.serialize(*this); if(debugMode) LOG.write("Done serializing player %1% at %2%\n") % player.getPlayerId() % GetLength(); } @@ -293,8 +293,8 @@ void SerializedGameData::readSnapshot(Game& game, ILocalGameState& localGameStat expectedNumObjects = PopUnsignedInt(); - MapSerializer::Deserialize(gw, *this, game, localGameState); - em->Deserialize(*this); + MapSerializer::deserialize(gw, *this, game, localGameState); + em->deserialize(*this); if(gw.getGGS().objective == GameObjective::EconomyMode) { gw.setEconHandler( @@ -302,7 +302,7 @@ void SerializedGameData::readSnapshot(Game& game, ILocalGameState& localGameStat } for(auto& player : gw.getPlayers()) - player.Deserialize(*this); + player.deserialize(*this); // If this check fails, we did not serialize all objects or there was an async if(readEvents.size() != em->getNumActiveEvents()) @@ -383,7 +383,7 @@ void SerializedGameData::pushObjectImpl(const GameObject* go, const bool known) // Objekt serialisieren if(debugMode) LOG.write("Start serializing %1% at %2%\n") % objId % GetLength(); - go->Serialize(*this); + go->serialize(*this); if(debugMode) LOG.write("Done serializing %1% at %2%\n") % objId % GetLength(); @@ -406,7 +406,7 @@ void SerializedGameData::pushEvent(const GameEvent* event) writtenEventIds.insert(instanceId); if(debugMode) LOG.write("Start serializing event %1% at %2%\n") % instanceId % GetLength(); - event->Serialize(*this); + event->serialize(*this); if(debugMode) LOG.write("Done serializing event %1% at %2%\n") % instanceId % GetLength(); PushUnsignedShort(getSafetyCode(*event)); @@ -450,7 +450,7 @@ void SerializedGameData::pushFOWObject(const FOWObject* fowobj) pushEnum(fowobj->getType()); // Objekt serialisieren - fowobj->Serialize(*this); + fowobj->serialize(*this); } std::unique_ptr SerializedGameData::popFOWObject() diff --git a/libs/s25main/Ware.cpp b/libs/s25main/Ware.cpp index 133457a5d6..fea09bedac 100644 --- a/libs/s25main/Ware.cpp +++ b/libs/s25main/Ware.cpp @@ -48,7 +48,7 @@ void Ware::destroy() #endif } -void Ware::Serialize(SerializedGameData& sgd) const +void Ware::serialize(SerializedGameData& sgd) const { sgd.pushEnum(next_dir); sgd.pushEnum(state); diff --git a/libs/s25main/Ware.h b/libs/s25main/Ware.h index 7a09850965..7ade825808 100644 --- a/libs/s25main/Ware.h +++ b/libs/s25main/Ware.h @@ -54,7 +54,7 @@ class Ware : public GameObject ~Ware() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Ware; } diff --git a/libs/s25main/WindowManager.cpp b/libs/s25main/WindowManager.cpp index c3488bd0ab..61a5390aa3 100644 --- a/libs/s25main/WindowManager.cpp +++ b/libs/s25main/WindowManager.cpp @@ -203,7 +203,7 @@ IngameWindow* WindowManager::showAfterSwitch(std::unique_ptr windo * @param[in] desktop Pointer zum neuen Desktop, auf dem gewechselt werden soll * @param[in] data Daten für den neuen Desktop */ -Desktop* WindowManager::Switch(std::unique_ptr desktop) +Desktop* WindowManager::switchTo(std::unique_ptr desktop) { nextdesktop = std::move(desktop); // Disable the mouse till the next desktop is shown to avoid e.g. double-switching diff --git a/libs/s25main/WindowManager.h b/libs/s25main/WindowManager.h index 87900e93f3..a026f828d8 100644 --- a/libs/s25main/WindowManager.h +++ b/libs/s25main/WindowManager.h @@ -86,7 +86,7 @@ class WindowManager : public Singleton, public VideoDriverLoaderI /// Close the window right away and free it. void closeNow(IngameWindow* window); /// merkt einen Desktop zum Wechsel vor. - Desktop* Switch(std::unique_ptr desktop); + Desktop* switchTo(std::unique_ptr desktop); /// Process press of left mouse button void msgLeftDown(MouseCoords mc) override; /// Process release of left mouse button diff --git a/libs/s25main/buildings/BurnedWarehouse.cpp b/libs/s25main/buildings/BurnedWarehouse.cpp index a94fa4f7da..b303ed0209 100644 --- a/libs/s25main/buildings/BurnedWarehouse.cpp +++ b/libs/s25main/buildings/BurnedWarehouse.cpp @@ -43,9 +43,9 @@ void BurnedWarehouse::destroy() noCoordBase::destroy(); } -void BurnedWarehouse::Serialize(SerializedGameData& sgd) const +void BurnedWarehouse::serialize(SerializedGameData& sgd) const { - noCoordBase::Serialize(sgd); + noCoordBase::serialize(sgd); sgd.PushUnsignedChar(player); sgd.PushUnsignedInt(go_out_phase); diff --git a/libs/s25main/buildings/BurnedWarehouse.h b/libs/s25main/buildings/BurnedWarehouse.h index 76ddf0ae60..5cecf1fa5a 100644 --- a/libs/s25main/buildings/BurnedWarehouse.h +++ b/libs/s25main/buildings/BurnedWarehouse.h @@ -18,7 +18,7 @@ class BurnedWarehouse : public noCoordBase ~BurnedWarehouse() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Burnedwarehouse; } diff --git a/libs/s25main/buildings/noBaseBuilding.cpp b/libs/s25main/buildings/noBaseBuilding.cpp index b3e97b3f7e..656ed703b1 100644 --- a/libs/s25main/buildings/noBaseBuilding.cpp +++ b/libs/s25main/buildings/noBaseBuilding.cpp @@ -150,9 +150,9 @@ void noBaseBuilding::destroy() noRoadNode::destroy(); } -void noBaseBuilding::Serialize(SerializedGameData& sgd) const +void noBaseBuilding::serialize(SerializedGameData& sgd) const { - noRoadNode::Serialize(sgd); + noRoadNode::serialize(sgd); sgd.pushEnum(bldType_); sgd.pushEnum(nation); diff --git a/libs/s25main/buildings/noBaseBuilding.h b/libs/s25main/buildings/noBaseBuilding.h index 6b3e224619..a3c21138c0 100644 --- a/libs/s25main/buildings/noBaseBuilding.h +++ b/libs/s25main/buildings/noBaseBuilding.h @@ -40,7 +40,7 @@ class noBaseBuilding : public noRoadNode ~noBaseBuilding() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; /// Eine bestellte Ware konnte doch nicht kommen virtual void wareLost(Ware& ware) = 0; diff --git a/libs/s25main/buildings/noBuilding.cpp b/libs/s25main/buildings/noBuilding.cpp index c3755203aa..8b5789334c 100644 --- a/libs/s25main/buildings/noBuilding.cpp +++ b/libs/s25main/buildings/noBuilding.cpp @@ -28,9 +28,9 @@ void noBuilding::destroy() noBaseBuilding::destroy(); } -void noBuilding::Serialize(SerializedGameData& sgd) const +void noBuilding::serialize(SerializedGameData& sgd) const { - noBaseBuilding::Serialize(sgd); + noBaseBuilding::serialize(sgd); sgd.PushSignedChar(opendoor); } diff --git a/libs/s25main/buildings/noBuilding.h b/libs/s25main/buildings/noBuilding.h index f5d94ff2ec..d41c90995a 100644 --- a/libs/s25main/buildings/noBuilding.h +++ b/libs/s25main/buildings/noBuilding.h @@ -22,7 +22,7 @@ class noBuilding : public noBaseBuilding public: void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; /// Draws the basic building (no fires etc.) with the door void drawBaseBuilding(DrawPoint drawPt) const; diff --git a/libs/s25main/buildings/noBuildingSite.cpp b/libs/s25main/buildings/noBuildingSite.cpp index 725cf7af84..c78ec0c2b1 100644 --- a/libs/s25main/buildings/noBuildingSite.cpp +++ b/libs/s25main/buildings/noBuildingSite.cpp @@ -116,9 +116,9 @@ void noBuildingSite::destroy() world->recalcBQAroundPointBig(pos); } -void noBuildingSite::Serialize(SerializedGameData& sgd) const +void noBuildingSite::serialize(SerializedGameData& sgd) const { - noBaseBuilding::Serialize(sgd); + noBaseBuilding::serialize(sgd); sgd.pushEnum(state); sgd.pushObject(planer, true); diff --git a/libs/s25main/buildings/noBuildingSite.h b/libs/s25main/buildings/noBuildingSite.h index 6a59090816..8b99387a41 100644 --- a/libs/s25main/buildings/noBuildingSite.h +++ b/libs/s25main/buildings/noBuildingSite.h @@ -57,7 +57,7 @@ class noBuildingSite : public noBaseBuilding ~noBuildingSite() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Buildingsite; } unsigned getMilitaryRadius() const override; diff --git a/libs/s25main/buildings/nobBaseMilitary.cpp b/libs/s25main/buildings/nobBaseMilitary.cpp index 79b7b9611c..9efed9974e 100644 --- a/libs/s25main/buildings/nobBaseMilitary.cpp +++ b/libs/s25main/buildings/nobBaseMilitary.cpp @@ -85,9 +85,9 @@ void nobBaseMilitary::DestroyBuilding() } } -void nobBaseMilitary::Serialize(SerializedGameData& sgd) const +void nobBaseMilitary::serialize(SerializedGameData& sgd) const { - noBuilding::Serialize(sgd); + noBuilding::serialize(sgd); sgd.pushObjectContainer(leave_house); sgd.pushEvent(leaving_event); diff --git a/libs/s25main/buildings/nobBaseMilitary.h b/libs/s25main/buildings/nobBaseMilitary.h index 38f8afa2d6..21d7f8f1c6 100644 --- a/libs/s25main/buildings/nobBaseMilitary.h +++ b/libs/s25main/buildings/nobBaseMilitary.h @@ -48,7 +48,7 @@ class nobBaseMilitary : public noBuilding void DestroyBuilding() override; public: - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; auto getLeavingFigures() const { return helpers::nonNullPtrSpan(leave_house); } diff --git a/libs/s25main/buildings/nobBaseWarehouse.cpp b/libs/s25main/buildings/nobBaseWarehouse.cpp index 1542f5f62c..095a6bb08a 100644 --- a/libs/s25main/buildings/nobBaseWarehouse.cpp +++ b/libs/s25main/buildings/nobBaseWarehouse.cpp @@ -119,9 +119,9 @@ void nobBaseWarehouse::DestroyBuilding() nobBaseMilitary::DestroyBuilding(); } -void nobBaseWarehouse::Serialize(SerializedGameData& sgd) const +void nobBaseWarehouse::serialize(SerializedGameData& sgd) const { - nobBaseMilitary::Serialize(sgd); + nobBaseMilitary::serialize(sgd); sgd.pushObjectContainer(waiting_wares, true); sgd.PushBool(fetch_double_protection); diff --git a/libs/s25main/buildings/nobBaseWarehouse.h b/libs/s25main/buildings/nobBaseWarehouse.h index f1b6b28522..2756d54ee2 100644 --- a/libs/s25main/buildings/nobBaseWarehouse.h +++ b/libs/s25main/buildings/nobBaseWarehouse.h @@ -141,7 +141,7 @@ class nobBaseWarehouse : public nobBaseMilitary, public DataChangedObservable void DestroyBuilding() override; public: - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; const Inventory& getInventory() const; diff --git a/libs/s25main/buildings/nobHQ.cpp b/libs/s25main/buildings/nobHQ.cpp index 9a75265479..da9ebc37ce 100644 --- a/libs/s25main/buildings/nobHQ.cpp +++ b/libs/s25main/buildings/nobHQ.cpp @@ -331,9 +331,9 @@ void nobHQ::DestroyBuilding() world->recalcTerritory(*this, TerritoryChangeReason::Destroyed); } -void nobHQ::Serialize(SerializedGameData& sgd) const +void nobHQ::serialize(SerializedGameData& sgd) const { - nobBaseWarehouse::Serialize(sgd); + nobBaseWarehouse::serialize(sgd); sgd.PushBool(isTent_); } diff --git a/libs/s25main/buildings/nobHQ.h b/libs/s25main/buildings/nobHQ.h index 88290be43f..2c990446b4 100644 --- a/libs/s25main/buildings/nobHQ.h +++ b/libs/s25main/buildings/nobHQ.h @@ -21,7 +21,7 @@ class nobHQ : public nobBaseWarehouse static GoodsAndPeopleCounts getStartInventory(StartWares setting); void addStartWares(); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NobHq; } diff --git a/libs/s25main/buildings/nobHarborBuilding.cpp b/libs/s25main/buildings/nobHarborBuilding.cpp index f0a603d77a..da27f0e7cc 100644 --- a/libs/s25main/buildings/nobHarborBuilding.cpp +++ b/libs/s25main/buildings/nobHarborBuilding.cpp @@ -34,7 +34,7 @@ nobHarborBuilding::ExpeditionInfo::ExpeditionInfo(SerializedGameData& sgd) : boards(sgd.PopUnsignedInt()), stones(sgd.PopUnsignedInt()), active(sgd.PopBool()), builder(sgd.PopBool()) {} -void nobHarborBuilding::ExpeditionInfo::Serialize(SerializedGameData& sgd) const +void nobHarborBuilding::ExpeditionInfo::serialize(SerializedGameData& sgd) const { sgd.PushUnsignedInt(boards); sgd.PushUnsignedInt(stones); @@ -46,7 +46,7 @@ nobHarborBuilding::ExplorationExpeditionInfo::ExplorationExpeditionInfo(Serializ : active(sgd.PopBool()), scouts(sgd.PopUnsignedInt()) {} -void nobHarborBuilding::ExplorationExpeditionInfo::Serialize(SerializedGameData& sgd) const +void nobHarborBuilding::ExplorationExpeditionInfo::serialize(SerializedGameData& sgd) const { sgd.PushBool(active); sgd.PushUnsignedInt(scouts); @@ -143,11 +143,11 @@ void nobHarborBuilding::DestroyBuilding() world->recalcTerritory(*this, TerritoryChangeReason::Destroyed); } -void nobHarborBuilding::Serialize(SerializedGameData& sgd) const +void nobHarborBuilding::serialize(SerializedGameData& sgd) const { - nobBaseWarehouse::Serialize(sgd); - expedition.Serialize(sgd); - exploration_expedition.Serialize(sgd); + nobBaseWarehouse::serialize(sgd); + expedition.serialize(sgd); + exploration_expedition.serialize(sgd); sgd.pushEvent(orderware_ev); helpers::pushContainer(sgd, seaIds); sgd.pushObjectContainer(wares_for_ships, true); diff --git a/libs/s25main/buildings/nobHarborBuilding.h b/libs/s25main/buildings/nobHarborBuilding.h index 09b4fcfaec..b29faa7c89 100644 --- a/libs/s25main/buildings/nobHarborBuilding.h +++ b/libs/s25main/buildings/nobHarborBuilding.h @@ -27,7 +27,7 @@ class nobHarborBuilding : public nobBaseWarehouse { ExpeditionInfo() : boards(0), stones(0), active(false), builder(false) {} ExpeditionInfo(SerializedGameData& sgd); - void Serialize(SerializedGameData& sgd) const; + void serialize(SerializedGameData& sgd) const; /// Anzahl an Brettern und Steinen, die bereits angesammelt wurden unsigned boards, stones; @@ -41,7 +41,7 @@ class nobHarborBuilding : public nobBaseWarehouse { ExplorationExpeditionInfo() : active(false), scouts(0) {} ExplorationExpeditionInfo(SerializedGameData& sgd); - void Serialize(SerializedGameData& sgd) const; + void serialize(SerializedGameData& sgd) const; /// Expedition in Vorbereitung? bool active; @@ -107,7 +107,7 @@ class nobHarborBuilding : public nobBaseWarehouse unsigned getMilitaryRadius() const override { return HARBOR_RADIUS; } /// Serialisierung - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NobHarborbuilding; } void draw(DrawPoint drawPt) override; void handleEvent(unsigned id) override; diff --git a/libs/s25main/buildings/nobMilitary.cpp b/libs/s25main/buildings/nobMilitary.cpp index 01e7e8cb18..10c7160ce3 100644 --- a/libs/s25main/buildings/nobMilitary.cpp +++ b/libs/s25main/buildings/nobMilitary.cpp @@ -147,9 +147,9 @@ void nobMilitary::DestroyBuilding() world->getNotifications().publish(BuildingNote(BuildingNote::Lost, player, pos, bldType_)); } -void nobMilitary::Serialize(SerializedGameData& sgd) const +void nobMilitary::serialize(SerializedGameData& sgd) const { - nobBaseMilitary::Serialize(sgd); + nobBaseMilitary::serialize(sgd); sgd.PushBool(new_built); sgd.PushUnsignedChar(numCoins); sgd.PushBool(coinsDisabled); diff --git a/libs/s25main/buildings/nobMilitary.h b/libs/s25main/buildings/nobMilitary.h index 251f65dd57..33649e0b56 100644 --- a/libs/s25main/buildings/nobMilitary.h +++ b/libs/s25main/buildings/nobMilitary.h @@ -110,7 +110,7 @@ class nobMilitary : public nobBaseMilitary void DestroyBuilding() override; public: - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NobMilitary; } diff --git a/libs/s25main/buildings/nobShipYard.cpp b/libs/s25main/buildings/nobShipYard.cpp index 0626b6fee5..ec4d3f054a 100644 --- a/libs/s25main/buildings/nobShipYard.cpp +++ b/libs/s25main/buildings/nobShipYard.cpp @@ -14,9 +14,9 @@ nobShipYard::nobShipYard(SerializedGameData& sgd, const unsigned obj_id) {} /// Serialisierungsfunktionen -void nobShipYard::Serialize(SerializedGameData& sgd) const +void nobShipYard::serialize(SerializedGameData& sgd) const { - nobUsual::Serialize(sgd); + nobUsual::serialize(sgd); sgd.pushEnum(mode); } diff --git a/libs/s25main/buildings/nobShipYard.h b/libs/s25main/buildings/nobShipYard.h index 65ed652c66..fa2a9da2e0 100644 --- a/libs/s25main/buildings/nobShipYard.h +++ b/libs/s25main/buildings/nobShipYard.h @@ -31,7 +31,7 @@ class nobShipYard : public nobUsual public: /// Serialisierungsfunktionen - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NobShipyard; } diff --git a/libs/s25main/buildings/nobTemple.cpp b/libs/s25main/buildings/nobTemple.cpp index f5513d0c49..72bf4f1dd7 100644 --- a/libs/s25main/buildings/nobTemple.cpp +++ b/libs/s25main/buildings/nobTemple.cpp @@ -18,9 +18,9 @@ nobTemple::nobTemple(SerializedGameData& sgd, const unsigned obj_id) : nobUsual(sgd, obj_id), productionMode(sgd.pop()) {} -void nobTemple::Serialize(SerializedGameData& sgd) const +void nobTemple::serialize(SerializedGameData& sgd) const { - nobUsual::Serialize(sgd); + nobUsual::serialize(sgd); sgd.pushEnum(productionMode); } diff --git a/libs/s25main/buildings/nobTemple.h b/libs/s25main/buildings/nobTemple.h index 05f50bff7e..3dc09da467 100644 --- a/libs/s25main/buildings/nobTemple.h +++ b/libs/s25main/buildings/nobTemple.h @@ -19,7 +19,7 @@ class nobTemple : public nobUsual nobTemple(SerializedGameData& sgd, unsigned obj_id); public: - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NobTemple; } diff --git a/libs/s25main/buildings/nobUsual.cpp b/libs/s25main/buildings/nobUsual.cpp index 4911c9e35a..38a45cbd4a 100644 --- a/libs/s25main/buildings/nobUsual.cpp +++ b/libs/s25main/buildings/nobUsual.cpp @@ -67,9 +67,9 @@ nobUsual::nobUsual(SerializedGameData& sgd, const unsigned obj_id) helpers::popContainer(sgd, lastProductivities); } -void nobUsual::Serialize(SerializedGameData& sgd) const +void nobUsual::serialize(SerializedGameData& sgd) const { - noBuilding::Serialize(sgd); + noBuilding::serialize(sgd); sgd.pushObject(worker); sgd.PushUnsignedShort(productivity); diff --git a/libs/s25main/buildings/nobUsual.h b/libs/s25main/buildings/nobUsual.h index b2d4219721..c0155a99b9 100644 --- a/libs/s25main/buildings/nobUsual.h +++ b/libs/s25main/buildings/nobUsual.h @@ -59,7 +59,7 @@ class nobUsual : public noBuilding ~nobUsual() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const override { return GO_Type::NobUsual; } unsigned getMilitaryRadius() const override { return 0; } diff --git a/libs/s25main/desktops/dskBenchmark.cpp b/libs/s25main/desktops/dskBenchmark.cpp index 0c81d9e66c..e119577985 100644 --- a/libs/s25main/desktops/dskBenchmark.cpp +++ b/libs/s25main/desktops/dskBenchmark.cpp @@ -80,7 +80,7 @@ bool dskBenchmark::msgKeyDown(const KeyEvent& ke) { switch(ke.kt) { - case KeyType::Escape: WINDOWMANAGER.Switch(std::make_unique()); break; + case KeyType::Escape: WINDOWMANAGER.switchTo(std::make_unique()); break; case KeyType::F1: startTest(Benchmark::Text); break; case KeyType::F2: startTest(Benchmark::Primitives); break; case KeyType::F3: startTest(Benchmark::EmptyGame); break; diff --git a/libs/s25main/desktops/dskCampaignMissionSelection.cpp b/libs/s25main/desktops/dskCampaignMissionSelection.cpp index a291d2c625..e42af27485 100644 --- a/libs/s25main/desktops/dskCampaignMissionSelection.cpp +++ b/libs/s25main/desktops/dskCampaignMissionSelection.cpp @@ -190,7 +190,7 @@ void dskCampaignMissionSelection::msgGroupButtonClick(unsigned group_id, unsigne void dskCampaignMissionSelection::msgButtonClick(unsigned ctrl_id) { if(ctrl_id == ID_btBack) - WINDOWMANAGER.Switch(std::make_unique(csi_)); + WINDOWMANAGER.switchTo(std::make_unique(csi_)); else if(ctrl_id == ID_btStart) { const auto selectedMission = getCtrl(ID_MapSelection)->getSelection(); diff --git a/libs/s25main/desktops/dskCampaignSelection.cpp b/libs/s25main/desktops/dskCampaignSelection.cpp index 911b71edb0..d034b0f79e 100644 --- a/libs/s25main/desktops/dskCampaignSelection.cpp +++ b/libs/s25main/desktops/dskCampaignSelection.cpp @@ -154,13 +154,13 @@ void dskCampaignSelection::showCampaignInfo(const bool show) void dskCampaignSelection::showCampaignMissionSelectionScreen() { const auto& campaign = campaigns_.at(getCtrl(ID_Table)->getSelection().value()); - WINDOWMANAGER.Switch(std::make_unique(csi_, campaign)); + WINDOWMANAGER.switchTo(std::make_unique(csi_, campaign)); } void dskCampaignSelection::msgButtonClick(unsigned ctrl_id) { if(ctrl_id == ID_btBack) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); else if(ctrl_id == ID_Next) showCampaignMissionSelectionScreen(); } diff --git a/libs/s25main/desktops/dskCredits.cpp b/libs/s25main/desktops/dskCredits.cpp index f14d7c2f29..9d78859a32 100644 --- a/libs/s25main/desktops/dskCredits.cpp +++ b/libs/s25main/desktops/dskCredits.cpp @@ -483,7 +483,7 @@ void dskCredits::msgTimer(unsigned timerId) bool dskCredits::close() { - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); return true; } diff --git a/libs/s25main/desktops/dskDirectIP.cpp b/libs/s25main/desktops/dskDirectIP.cpp index ae51d3b238..914f373df5 100644 --- a/libs/s25main/desktops/dskDirectIP.cpp +++ b/libs/s25main/desktops/dskDirectIP.cpp @@ -49,6 +49,6 @@ void dskDirectIP::msgButtonClick(const unsigned ctrl_id) WINDOWMANAGER.replaceWindow(std::make_unique(ServerType::Direct)); break; case ID_btJoinGame: WINDOWMANAGER.replaceWindow(std::make_unique(ServerType::Direct)); break; - case ID_btBack: WINDOWMANAGER.Switch(std::make_unique()); break; + case ID_btBack: WINDOWMANAGER.switchTo(std::make_unique()); break; } } diff --git a/libs/s25main/desktops/dskGameLoader.cpp b/libs/s25main/desktops/dskGameLoader.cpp index 09f96d5e17..f38ca5562e 100644 --- a/libs/s25main/desktops/dskGameLoader.cpp +++ b/libs/s25main/desktops/dskGameLoader.cpp @@ -56,11 +56,11 @@ void dskGameLoader::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult GAMECLIENT.stop(); if(LOBBYCLIENT.IsLoggedIn()) // steht die Lobbyverbindung noch? - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); else if(loader_.getGame()->world_.isSinglePlayer()) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); else - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); } } @@ -151,7 +151,7 @@ void dskGameLoader::LC_Status_Error(const std::string& error) void dskGameLoader::CI_GameStarted() { RTTR_Assert(gameInterface); - WINDOWMANAGER.Switch(std::move(gameInterface)); + WINDOWMANAGER.switchTo(std::move(gameInterface)); } void dskGameLoader::CI_Error(const ClientError ce) diff --git a/libs/s25main/desktops/dskGameLobby.cpp b/libs/s25main/desktops/dskGameLobby.cpp index 1adfc5b96c..2a063a14d8 100644 --- a/libs/s25main/desktops/dskGameLobby.cpp +++ b/libs/s25main/desktops/dskGameLobby.cpp @@ -691,13 +691,13 @@ void dskGameLobby::msgGroupComboSelectItem(const unsigned group_id, const unsign void dskGameLobby::goBack() { if(isSinglePlayer()) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); else if(serverType == ServerType::LAN) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); else if(serverType == ServerType::Lobby && lobbyClient_ && lobbyClient_->IsLoggedIn()) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); else - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); } bool dskGameLobby::isChangeAllowed(const std::string& setting) const @@ -1051,7 +1051,7 @@ void dskGameLobby::CI_PlayerLeft(const unsigned playerId) void dskGameLobby::CI_GameLoading(std::shared_ptr game) { - WINDOWMANAGER.Switch(std::make_unique(std::move(game))); + WINDOWMANAGER.switchTo(std::make_unique(std::move(game))); } void dskGameLobby::CI_PlayerDataChanged(unsigned playerId) diff --git a/libs/s25main/desktops/dskIntro.cpp b/libs/s25main/desktops/dskIntro.cpp index fd10d1ee83..9a6de86c33 100644 --- a/libs/s25main/desktops/dskIntro.cpp +++ b/libs/s25main/desktops/dskIntro.cpp @@ -28,7 +28,7 @@ void dskIntro::msgButtonClick(const unsigned ctrl_id) { case 0: // "Zurück" { - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); } break; } diff --git a/libs/s25main/desktops/dskLAN.cpp b/libs/s25main/desktops/dskLAN.cpp index 9e61d452fd..1ce256ec4a 100644 --- a/libs/s25main/desktops/dskLAN.cpp +++ b/libs/s25main/desktops/dskLAN.cpp @@ -75,7 +75,7 @@ void dskLAN::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { - case ID_btBack: WINDOWMANAGER.Switch(std::make_unique()); break; + case ID_btBack: WINDOWMANAGER.switchTo(std::make_unique()); break; case ID_btConnect: connectToSelectedGame(); break; case ID_btAddServer: if(SETTINGS.proxy.type != ProxyType::None) @@ -105,7 +105,7 @@ void dskLAN::readOpenGames() Serializer ser(&service.second.info.GetPayload().front(), service.second.info.GetPayload().size()); //-V807 GameInfo info; info.ip = service.second.ip; - info.info.Deserialize(ser); + info.info.deserialize(ser); openGames.push_back(info); } } diff --git a/libs/s25main/desktops/dskLobby.cpp b/libs/s25main/desktops/dskLobby.cpp index 579add4e72..655da3ae0c 100644 --- a/libs/s25main/desktops/dskLobby.cpp +++ b/libs/s25main/desktops/dskLobby.cpp @@ -101,7 +101,7 @@ void dskLobby::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult /*mb { // Verbindung verloren if(msgbox_id == 0) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); } void dskLobby::msgButtonClick(const unsigned ctrl_id) @@ -111,7 +111,7 @@ void dskLobby::msgButtonClick(const unsigned ctrl_id) case ID_btBack: { LOBBYCLIENT.Stop(); - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); } break; case ID_btConnect: connectToSelectedGame(); break; diff --git a/libs/s25main/desktops/dskMainMenu.cpp b/libs/s25main/desktops/dskMainMenu.cpp index ee5c2e5690..d81f4fd879 100644 --- a/libs/s25main/desktops/dskMainMenu.cpp +++ b/libs/s25main/desktops/dskMainMenu.cpp @@ -86,7 +86,7 @@ bool dskMainMenu::msgLeftUp(const MouseCoords& mc) auto* txtVersion = getCtrl(dskMenuBase::ID_txtVersion); if(mc.dbl_click && IsPointInRect(mc.pos, txtVersion->getBoundaryRect())) { - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); return true; } return false; @@ -97,19 +97,19 @@ void dskMainMenu::msgButtonClick(const unsigned ctrl_id) switch(ctrl_id) { case ID_btSingleplayer: // "Single Player" - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); break; case ID_btMultiplayer: // "Multiplayer" - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); break; case ID_btOptions: // "Options" - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); break; case ID_btIntro: // "Intro" - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); break; case ID_btCredits: // "Credits" - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); break; case ID_btQuit: // "Quit" GLOBALVARS.notdone = false; diff --git a/libs/s25main/desktops/dskMultiPlayer.cpp b/libs/s25main/desktops/dskMultiPlayer.cpp index c73ff38d1e..199f2b9ac1 100644 --- a/libs/s25main/desktops/dskMultiPlayer.cpp +++ b/libs/s25main/desktops/dskMultiPlayer.cpp @@ -41,13 +41,13 @@ void dskMultiPlayer::msgButtonClick(const unsigned ctrl_id) WINDOWMANAGER.show(std::make_unique(), true); break; case 4: // Local Area Network - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); break; case 5: // Direct IP - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); break; case 6: // Zurück - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); break; } } diff --git a/libs/s25main/desktops/dskOptions.cpp b/libs/s25main/desktops/dskOptions.cpp index 4e226069ab..ea232a7e46 100644 --- a/libs/s25main/desktops/dskOptions.cpp +++ b/libs/s25main/desktops/dskOptions.cpp @@ -537,7 +537,7 @@ void dskOptions::msgGroupComboSelectItem(const unsigned group_id, const unsigned std::string old_lang = SETTINGS.language.language; //-V807 SETTINGS.language.language = LANGUAGES.setLanguage(selection); if(SETTINGS.language.language != old_lang) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); } break; case ID_cbProxyType: @@ -721,7 +721,7 @@ void dskOptions::msgButtonClick(const unsigned ctrl_id) return; } - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); } break; case ID_btAddons: WINDOWMANAGER.toggleWindow(std::make_unique(ggs)); break; @@ -751,7 +751,7 @@ void dskOptions::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult /* default: break; // "You need to restart your game ..." // "The selected video driver does not support GUI scaling!" - case 1: WINDOWMANAGER.Switch(std::make_unique()); break; + case 1: WINDOWMANAGER.switchTo(std::make_unique()); break; } } diff --git a/libs/s25main/desktops/dskSelectMap.cpp b/libs/s25main/desktops/dskSelectMap.cpp index c1adfeced4..e97d027350 100644 --- a/libs/s25main/desktops/dskSelectMap.cpp +++ b/libs/s25main/desktops/dskSelectMap.cpp @@ -247,13 +247,13 @@ void dskSelectMap::msgTableSelectItem(const unsigned ctrl_id, const std::optiona void dskSelectMap::goBack() const { if(csi.type == ServerType::Local) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); else if(csi.type == ServerType::LAN) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); else if(csi.type == ServerType::Lobby && LOBBYCLIENT.IsLoggedIn()) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); else - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); } void dskSelectMap::msgButtonClick(const unsigned ctrl_id) @@ -374,13 +374,13 @@ void dskSelectMap::msgMsgBoxResult(const unsigned msgbox_id, const MsgboxResult GAMECLIENT.stop(); if(csi.type == ServerType::Lobby && LOBBYCLIENT.IsLoggedIn()) // steht die Lobbyverbindung noch? - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); else if(csi.type == ServerType::Lobby) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); else if(csi.type == ServerType::LAN) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); else - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); } } diff --git a/libs/s25main/desktops/dskSinglePlayer.cpp b/libs/s25main/desktops/dskSinglePlayer.cpp index 1d2c273e38..66a99e31a4 100644 --- a/libs/s25main/desktops/dskSinglePlayer.cpp +++ b/libs/s25main/desktops/dskSinglePlayer.cpp @@ -86,7 +86,7 @@ void dskSinglePlayer::msgButtonClick(const unsigned ctrl_id) // Server info CreateServerInfo csi = createLocalGameInfo(name); - WINDOWMANAGER.Switch(std::make_unique(csi)); + WINDOWMANAGER.switchTo(std::make_unique(csi)); if(GAMECLIENT.hostGame(csi, {mostRecentFilepath, MapType::Savegame})) WINDOWMANAGER.showAfterSwitch(std::make_unique(csi.type, nullptr)); @@ -108,7 +108,7 @@ void dskSinglePlayer::msgButtonClick(const unsigned ctrl_id) break; case 5: // "Kampagne" { - WINDOWMANAGER.Switch(std::make_unique(createLocalGameInfo(_("Campaign")))); + WINDOWMANAGER.switchTo(std::make_unique(createLocalGameInfo(_("Campaign")))); } break; case 6: // "Freies Spiel" @@ -123,7 +123,7 @@ void dskSinglePlayer::msgButtonClick(const unsigned ctrl_id) break; case 8: // "Zurück" { - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); } break; } @@ -131,13 +131,13 @@ void dskSinglePlayer::msgButtonClick(const unsigned ctrl_id) void dskSinglePlayer::prepareSinglePlayerServer() { - WINDOWMANAGER.Switch(std::make_unique(createLocalGameInfo(_("Unlimited Play")))); + WINDOWMANAGER.switchTo(std::make_unique(createLocalGameInfo(_("Unlimited Play")))); } void dskSinglePlayer::prepareLoadGame() { CreateServerInfo csi = createLocalGameInfo(_("Unlimited Play")); - WINDOWMANAGER.Switch(std::make_unique(csi)); + WINDOWMANAGER.switchTo(std::make_unique(csi)); WINDOWMANAGER.showAfterSwitch(std::make_unique(csi)); } diff --git a/libs/s25main/desktops/dskSplash.cpp b/libs/s25main/desktops/dskSplash.cpp index 9cd6837a47..81434955f9 100644 --- a/libs/s25main/desktops/dskSplash.cpp +++ b/libs/s25main/desktops/dskSplash.cpp @@ -52,13 +52,13 @@ void dskSplash::msgTimer(const unsigned ctrl_id) isLoading = true; loadFiles(); } else if(isLoaded) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); } bool dskSplash::msgLeftDown(const MouseCoords& /*mc*/) { if(isLoaded) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); return true; } diff --git a/libs/s25main/desktops/dskTest.cpp b/libs/s25main/desktops/dskTest.cpp index c1dcaf50ce..98a9ee1e85 100644 --- a/libs/s25main/desktops/dskTest.cpp +++ b/libs/s25main/desktops/dskTest.cpp @@ -129,8 +129,8 @@ void dskTest::msgButtonClick(const unsigned ctrl_id) { switch(ctrl_id) { - case ID_btTextureTest: WINDOWMANAGER.Switch(std::make_unique()); break; - case ID_btShowBenchmark: WINDOWMANAGER.Switch(std::make_unique()); break; + case ID_btTextureTest: WINDOWMANAGER.switchTo(std::make_unique()); break; + case ID_btShowBenchmark: WINDOWMANAGER.switchTo(std::make_unique()); break; case ID_btDisable: for(unsigned i = ID_grpBtStart; i < ID_grpBtEnd; i++) { @@ -205,7 +205,7 @@ bool dskTest::msgKeyDown(const KeyEvent& ke) curBGIdx = (curBGIdx < LOAD_SCREENS.size() - 1) ? curBGIdx + 1 : 0; background = LOADER.getImageN(ResourceId(LOAD_SCREENS[curBGIdx]), 0); } else if(ke.kt == KeyType::Escape) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); else return false; return true; diff --git a/libs/s25main/desktops/dskTextureTest.cpp b/libs/s25main/desktops/dskTextureTest.cpp index 181bd1a858..100be44498 100644 --- a/libs/s25main/desktops/dskTextureTest.cpp +++ b/libs/s25main/desktops/dskTextureTest.cpp @@ -72,7 +72,7 @@ void dskTextureTest::msgComboSelectItem(const unsigned ctrl_id, const unsigned s void dskTextureTest::msgButtonClick(const unsigned /*ctrl_id*/) { - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); } using PointF = Point; diff --git a/libs/s25main/figures/noFigure.cpp b/libs/s25main/figures/noFigure.cpp index e2b402a3c6..aec2904c42 100644 --- a/libs/s25main/figures/noFigure.cpp +++ b/libs/s25main/figures/noFigure.cpp @@ -74,9 +74,9 @@ void noFigure::destroy() RTTR_Assert(!world->getPlayer(player).isDependentFigure(*this)); } -void noFigure::Serialize(SerializedGameData& sgd) const +void noFigure::serialize(SerializedGameData& sgd) const { - noMovable::Serialize(sgd); + noMovable::serialize(sgd); sgd.pushEnum(fs); sgd.pushEnum(job_); diff --git a/libs/s25main/figures/noFigure.h b/libs/s25main/figures/noFigure.h index 3fb7c914b4..523bfc5e32 100644 --- a/libs/s25main/figures/noFigure.h +++ b/libs/s25main/figures/noFigure.h @@ -151,7 +151,7 @@ class noFigure : public noMovable noFigure(SerializedGameData& sgd, unsigned obj_id); void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; void handleEvent(unsigned id) override; diff --git a/libs/s25main/figures/nofActiveSoldier.cpp b/libs/s25main/figures/nofActiveSoldier.cpp index 52c9da036e..e80e5904e3 100644 --- a/libs/s25main/figures/nofActiveSoldier.cpp +++ b/libs/s25main/figures/nofActiveSoldier.cpp @@ -24,9 +24,9 @@ nofActiveSoldier::nofActiveSoldier(const nofSoldier& other, const SoldierState i : nofSoldier(other), state(init_state), enemy(nullptr) {} -void nofActiveSoldier::Serialize(SerializedGameData& sgd) const +void nofActiveSoldier::serialize(SerializedGameData& sgd) const { - nofSoldier::Serialize(sgd); + nofSoldier::serialize(sgd); sgd.pushEnum(state); sgd.pushObject(enemy); diff --git a/libs/s25main/figures/nofActiveSoldier.h b/libs/s25main/figures/nofActiveSoldier.h index a8b3e74008..ceb1cc943c 100644 --- a/libs/s25main/figures/nofActiveSoldier.h +++ b/libs/s25main/figures/nofActiveSoldier.h @@ -106,7 +106,7 @@ class nofActiveSoldier : public nofSoldier RTTR_Assert(!enemy); nofSoldier::destroy(); } - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; /// Draw soldier (for all types of soldiers done by this base class!) void draw(DrawPoint drawPt) override; diff --git a/libs/s25main/figures/nofAggressiveDefender.cpp b/libs/s25main/figures/nofAggressiveDefender.cpp index 14a98aed2a..2723dc9e0b 100644 --- a/libs/s25main/figures/nofAggressiveDefender.cpp +++ b/libs/s25main/figures/nofAggressiveDefender.cpp @@ -37,9 +37,9 @@ void nofAggressiveDefender::destroy() nofActiveSoldier::destroy(); } -void nofAggressiveDefender::Serialize(SerializedGameData& sgd) const +void nofAggressiveDefender::serialize(SerializedGameData& sgd) const { - nofActiveSoldier::Serialize(sgd); + nofActiveSoldier::serialize(sgd); if(state != SoldierState::WalkingHome && state != SoldierState::FigureWork) { diff --git a/libs/s25main/figures/nofAggressiveDefender.h b/libs/s25main/figures/nofAggressiveDefender.h index e50d5c8162..45146145f8 100644 --- a/libs/s25main/figures/nofAggressiveDefender.h +++ b/libs/s25main/figures/nofAggressiveDefender.h @@ -47,7 +47,7 @@ class nofAggressiveDefender : public nofActiveSoldier ~nofAggressiveDefender() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofAggressivedefender; } diff --git a/libs/s25main/figures/nofArmorer.cpp b/libs/s25main/figures/nofArmorer.cpp index 303628ea9d..789e60c7ba 100644 --- a/libs/s25main/figures/nofArmorer.cpp +++ b/libs/s25main/figures/nofArmorer.cpp @@ -21,9 +21,9 @@ nofArmorer::nofArmorer(const MapPoint pos, const unsigned char player, nobUsual* : nofWorkman(Job::Armorer, pos, player, workplace), sword_shield(false) {} -void nofArmorer::Serialize(SerializedGameData& sgd) const +void nofArmorer::serialize(SerializedGameData& sgd) const { - nofWorkman::Serialize(sgd); + nofWorkman::serialize(sgd); sgd.PushBool(sword_shield); } diff --git a/libs/s25main/figures/nofArmorer.h b/libs/s25main/figures/nofArmorer.h index e79bd93236..735ac8fc5e 100644 --- a/libs/s25main/figures/nofArmorer.h +++ b/libs/s25main/figures/nofArmorer.h @@ -30,7 +30,7 @@ class nofArmorer : public nofWorkman nofArmorer(MapPoint pos, unsigned char player, nobUsual* workplace); nofArmorer(SerializedGameData& sgd, unsigned obj_id); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofArmorer; } }; diff --git a/libs/s25main/figures/nofAttacker.cpp b/libs/s25main/figures/nofAttacker.cpp index 68f18cc471..91b35ff2e9 100644 --- a/libs/s25main/figures/nofAttacker.cpp +++ b/libs/s25main/figures/nofAttacker.cpp @@ -50,9 +50,9 @@ void nofAttacker::destroy() RTTR_Assert(!world->GetPlayer(oplayer).GetFirstWH()->Test(this));*/ } -void nofAttacker::Serialize(SerializedGameData& sgd) const +void nofAttacker::serialize(SerializedGameData& sgd) const { - nofActiveSoldier::Serialize(sgd); + nofActiveSoldier::serialize(sgd); if(state != SoldierState::WalkingHome && state != SoldierState::FigureWork) { diff --git a/libs/s25main/figures/nofAttacker.h b/libs/s25main/figures/nofAttacker.h index 670aae1575..ecdb8cacee 100644 --- a/libs/s25main/figures/nofAttacker.h +++ b/libs/s25main/figures/nofAttacker.h @@ -91,7 +91,7 @@ class nofAttacker : public nofActiveSoldier ~nofAttacker() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofAttacker; } const nofAggressiveDefender* getHuntingDefender() const { return huntingDefender; } diff --git a/libs/s25main/figures/nofBuilder.cpp b/libs/s25main/figures/nofBuilder.cpp index 113653e083..341aa61b4f 100644 --- a/libs/s25main/figures/nofBuilder.cpp +++ b/libs/s25main/figures/nofBuilder.cpp @@ -37,9 +37,9 @@ nofBuilder::nofBuilder(const MapPoint pos, const unsigned char player, noBuildin } } -void nofBuilder::Serialize(SerializedGameData& sgd) const +void nofBuilder::serialize(SerializedGameData& sgd) const { - noFigure::Serialize(sgd); + noFigure::serialize(sgd); sgd.pushEnum(state); sgd.pushObject(building_site, true); diff --git a/libs/s25main/figures/nofBuilder.h b/libs/s25main/figures/nofBuilder.h index 7b204a1d11..350151e370 100644 --- a/libs/s25main/figures/nofBuilder.h +++ b/libs/s25main/figures/nofBuilder.h @@ -61,7 +61,7 @@ class nofBuilder final : public noFigure noFigure::destroy(); } - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofBuilder; } diff --git a/libs/s25main/figures/nofBuildingWorker.cpp b/libs/s25main/figures/nofBuildingWorker.cpp index 17b7c6a96f..03f3eec5ad 100644 --- a/libs/s25main/figures/nofBuildingWorker.cpp +++ b/libs/s25main/figures/nofBuildingWorker.cpp @@ -25,9 +25,9 @@ nofBuildingWorker::nofBuildingWorker(const Job job, const MapPoint pos, const un workplace))); // Assume we have at least a GameObject and check if it is a valid workplace } -void nofBuildingWorker::Serialize(SerializedGameData& sgd) const +void nofBuildingWorker::serialize(SerializedGameData& sgd) const { - noFigure::Serialize(sgd); + noFigure::serialize(sgd); sgd.pushEnum(state); diff --git a/libs/s25main/figures/nofBuildingWorker.h b/libs/s25main/figures/nofBuildingWorker.h index f1c221b1d0..33c7a9cbb9 100644 --- a/libs/s25main/figures/nofBuildingWorker.h +++ b/libs/s25main/figures/nofBuildingWorker.h @@ -102,7 +102,7 @@ class nofBuildingWorker : public noFigure RTTR_Assert(!workplace); noFigure::destroy(); } - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; void draw(DrawPoint drawPt) override; diff --git a/libs/s25main/figures/nofCarrier.cpp b/libs/s25main/figures/nofCarrier.cpp index 1d7ad25ebe..042942fe1d 100644 --- a/libs/s25main/figures/nofCarrier.cpp +++ b/libs/s25main/figures/nofCarrier.cpp @@ -96,9 +96,9 @@ nofCarrier::nofCarrier(SerializedGameData& sgd, unsigned obj_id) } } -void nofCarrier::Serialize(SerializedGameData& sgd) const +void nofCarrier::serialize(SerializedGameData& sgd) const { - noFigure::Serialize(sgd); + noFigure::serialize(sgd); sgd.pushEnum(ct); sgd.pushEnum(state); diff --git a/libs/s25main/figures/nofCarrier.h b/libs/s25main/figures/nofCarrier.h index 690419c1ea..204adc3755 100644 --- a/libs/s25main/figures/nofCarrier.h +++ b/libs/s25main/figures/nofCarrier.h @@ -105,7 +105,7 @@ class nofCarrier : public noFigure ~nofCarrier() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; void destroy() override; diff --git a/libs/s25main/figures/nofCatapultMan.cpp b/libs/s25main/figures/nofCatapultMan.cpp index ff6f73eec8..0b84da7809 100644 --- a/libs/s25main/figures/nofCatapultMan.cpp +++ b/libs/s25main/figures/nofCatapultMan.cpp @@ -24,7 +24,7 @@ nofCatapultMan::PossibleTarget::PossibleTarget(SerializedGameData& sgd) : pos(sgd.popMapPoint()), distance(sgd.PopUnsignedInt()) {} -void nofCatapultMan::PossibleTarget::Serialize(SerializedGameData& sgd) const +void nofCatapultMan::PossibleTarget::serialize(SerializedGameData& sgd) const { helpers::pushPoint(sgd, pos); sgd.PushUnsignedInt(distance); @@ -38,12 +38,12 @@ nofCatapultMan::nofCatapultMan(SerializedGameData& sgd, const unsigned obj_id) : nofBuildingWorker(sgd, obj_id), wheel_steps(sgd.PopSignedInt()), target(sgd) {} -void nofCatapultMan::Serialize(SerializedGameData& sgd) const +void nofCatapultMan::serialize(SerializedGameData& sgd) const { - nofBuildingWorker::Serialize(sgd); + nofBuildingWorker::serialize(sgd); sgd.PushSignedInt(wheel_steps); - target.PossibleTarget::Serialize(sgd); + target.PossibleTarget::serialize(sgd); } void nofCatapultMan::walkedDerived() {} diff --git a/libs/s25main/figures/nofCatapultMan.h b/libs/s25main/figures/nofCatapultMan.h index 6e2b070121..82821c8fed 100644 --- a/libs/s25main/figures/nofCatapultMan.h +++ b/libs/s25main/figures/nofCatapultMan.h @@ -28,7 +28,7 @@ class nofCatapultMan : public nofBuildingWorker PossibleTarget(const MapPoint pt, unsigned distance) : pos(pt), distance(distance) {} PossibleTarget(SerializedGameData& sgd); - void Serialize(SerializedGameData& sgd) const; + void serialize(SerializedGameData& sgd) const; } target; /// das anvisierte Ziel @@ -44,7 +44,7 @@ class nofCatapultMan : public nofBuildingWorker nofCatapultMan(MapPoint pos, unsigned char player, nobUsual* workplace); nofCatapultMan(SerializedGameData& sgd, unsigned obj_id); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofCatapultman; } diff --git a/libs/s25main/figures/nofCharburner.cpp b/libs/s25main/figures/nofCharburner.cpp index f4f4f22003..f4bb3cd86e 100644 --- a/libs/s25main/figures/nofCharburner.cpp +++ b/libs/s25main/figures/nofCharburner.cpp @@ -24,9 +24,9 @@ nofCharburner::nofCharburner(SerializedGameData& sgd, const unsigned obj_id) : nofFarmhand(sgd, obj_id), harvest(sgd.PopBool()), wt(sgd.pop()) {} -void nofCharburner::Serialize(SerializedGameData& sgd) const +void nofCharburner::serialize(SerializedGameData& sgd) const { - nofFarmhand::Serialize(sgd); + nofFarmhand::serialize(sgd); sgd.PushBool(harvest); sgd.pushEnum(wt); diff --git a/libs/s25main/figures/nofCharburner.h b/libs/s25main/figures/nofCharburner.h index 6deda72b27..a2ff32b322 100644 --- a/libs/s25main/figures/nofCharburner.h +++ b/libs/s25main/figures/nofCharburner.h @@ -51,7 +51,7 @@ class nofCharburner : public nofFarmhand nofCharburner(MapPoint pos, unsigned char player, nobUsual* workplace); nofCharburner(SerializedGameData& sgd, unsigned obj_id); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofCharburner; } }; diff --git a/libs/s25main/figures/nofDefender.cpp b/libs/s25main/figures/nofDefender.cpp index 5579562ca8..70a3128462 100644 --- a/libs/s25main/figures/nofDefender.cpp +++ b/libs/s25main/figures/nofDefender.cpp @@ -24,9 +24,9 @@ nofDefender::nofDefender(const nofPassiveSoldier& other, nofAttacker& attacker) : nofActiveSoldier(other, SoldierState::DefendingWalkingTo), attacker(&attacker) {} -void nofDefender::Serialize(SerializedGameData& sgd) const +void nofDefender::serialize(SerializedGameData& sgd) const { - nofActiveSoldier::Serialize(sgd); + nofActiveSoldier::serialize(sgd); if(state != SoldierState::FigureWork) sgd.pushObject(attacker, true); diff --git a/libs/s25main/figures/nofDefender.h b/libs/s25main/figures/nofDefender.h index 6a7d1b8811..050b40871e 100644 --- a/libs/s25main/figures/nofDefender.h +++ b/libs/s25main/figures/nofDefender.h @@ -40,7 +40,7 @@ class nofDefender : public nofActiveSoldier RTTR_Assert(!attacker); nofActiveSoldier::destroy(); } - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofDefender; } diff --git a/libs/s25main/figures/nofFarmer.cpp b/libs/s25main/figures/nofFarmer.cpp index 3fc9cc8357..25a0058c57 100644 --- a/libs/s25main/figures/nofFarmer.cpp +++ b/libs/s25main/figures/nofFarmer.cpp @@ -18,9 +18,9 @@ nofFarmer::nofFarmer(const MapPoint pos, const unsigned char player, nobUsual* w : nofFarmhand(Job::Farmer, pos, player, workplace), harvest(false) {} -void nofFarmer::Serialize(SerializedGameData& sgd) const +void nofFarmer::serialize(SerializedGameData& sgd) const { - nofFarmhand::Serialize(sgd); + nofFarmhand::serialize(sgd); sgd.PushBool(harvest); } diff --git a/libs/s25main/figures/nofFarmer.h b/libs/s25main/figures/nofFarmer.h index 5c743bf468..113af86c49 100644 --- a/libs/s25main/figures/nofFarmer.h +++ b/libs/s25main/figures/nofFarmer.h @@ -37,7 +37,7 @@ class nofFarmer : public nofFarmhand static nofFarmhand::PointQuality getNewFieldPointQuality(const GameWorld& world, MapPoint pt); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofFarmer; } }; diff --git a/libs/s25main/figures/nofFarmhand.cpp b/libs/s25main/figures/nofFarmhand.cpp index 4629bb1a46..126b5aac2c 100644 --- a/libs/s25main/figures/nofFarmhand.cpp +++ b/libs/s25main/figures/nofFarmhand.cpp @@ -21,9 +21,9 @@ nofFarmhand::nofFarmhand(const Job job, const MapPoint pos, const unsigned char : nofBuildingWorker(job, pos, player, workplace), dest(0, 0) {} -void nofFarmhand::Serialize(SerializedGameData& sgd) const +void nofFarmhand::serialize(SerializedGameData& sgd) const { - nofBuildingWorker::Serialize(sgd); + nofBuildingWorker::serialize(sgd); helpers::pushPoint(sgd, dest); } diff --git a/libs/s25main/figures/nofFarmhand.h b/libs/s25main/figures/nofFarmhand.h index b7d9e830a4..9a1246e609 100644 --- a/libs/s25main/figures/nofFarmhand.h +++ b/libs/s25main/figures/nofFarmhand.h @@ -58,7 +58,7 @@ class nofFarmhand : public nofBuildingWorker static unsigned getWorkRadius(const GlobalGameSettings& ggs, Job job); unsigned getWorkRadius(Job job); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; void handleDerivedEvent(unsigned id) override; /// Return the quality of this working point (including if the worker can work here at all) diff --git a/libs/s25main/figures/nofFisher.cpp b/libs/s25main/figures/nofFisher.cpp index b5f89b8de5..db89d149f5 100644 --- a/libs/s25main/figures/nofFisher.cpp +++ b/libs/s25main/figures/nofFisher.cpp @@ -21,9 +21,9 @@ nofFisher::nofFisher(const MapPoint pos, const unsigned char player, nobUsual* w : nofFarmhand(Job::Fisher, pos, player, workplace), fishing_dir(Direction::West), successful(false) {} -void nofFisher::Serialize(SerializedGameData& sgd) const +void nofFisher::serialize(SerializedGameData& sgd) const { - nofFarmhand::Serialize(sgd); + nofFarmhand::serialize(sgd); sgd.pushEnum(fishing_dir); sgd.PushBool(successful); diff --git a/libs/s25main/figures/nofFisher.h b/libs/s25main/figures/nofFisher.h index 0f3b8dabae..6275989cd8 100644 --- a/libs/s25main/figures/nofFisher.h +++ b/libs/s25main/figures/nofFisher.h @@ -32,7 +32,7 @@ class nofFisher : public nofFarmhand ~nofFisher() override = default; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofFisher; } diff --git a/libs/s25main/figures/nofFlagWorker.cpp b/libs/s25main/figures/nofFlagWorker.cpp index 2111c01a69..b6a03cf9b0 100644 --- a/libs/s25main/figures/nofFlagWorker.cpp +++ b/libs/s25main/figures/nofFlagWorker.cpp @@ -31,9 +31,9 @@ nofFlagWorker::nofFlagWorker(SerializedGameData& sgd, const unsigned obj_id) : noFigure(sgd, obj_id), flag(sgd.popObject(GO_Type::Flag)), state(sgd.pop()) {} -void nofFlagWorker::Serialize(SerializedGameData& sgd) const +void nofFlagWorker::serialize(SerializedGameData& sgd) const { - noFigure::Serialize(sgd); + noFigure::serialize(sgd); sgd.pushObject(flag, true); sgd.pushEnum(state); diff --git a/libs/s25main/figures/nofFlagWorker.h b/libs/s25main/figures/nofFlagWorker.h index ee71ac0989..75cf7c603f 100644 --- a/libs/s25main/figures/nofFlagWorker.h +++ b/libs/s25main/figures/nofFlagWorker.h @@ -41,7 +41,7 @@ class nofFlagWorker : public noFigure nofFlagWorker(const nofFlagWorker&) = delete; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; /// Wird aufgerufen, wenn die Flagge abgerissen wurde virtual void lostWork() = 0; diff --git a/libs/s25main/figures/nofGeologist.cpp b/libs/s25main/figures/nofGeologist.cpp index d1e2314a75..e7590bca95 100644 --- a/libs/s25main/figures/nofGeologist.cpp +++ b/libs/s25main/figures/nofGeologist.cpp @@ -29,9 +29,9 @@ nofGeologist::nofGeologist(const MapPoint pos, const unsigned char player, noRoa std::fill(resAlreadyFound.begin(), resAlreadyFound.end(), false); } -void nofGeologist::Serialize(SerializedGameData& sgd) const +void nofGeologist::serialize(SerializedGameData& sgd) const { - nofFlagWorker::Serialize(sgd); + nofFlagWorker::serialize(sgd); sgd.PushUnsignedShort(signs); diff --git a/libs/s25main/figures/nofGeologist.h b/libs/s25main/figures/nofGeologist.h index 8785e30d56..5bcfc42a8e 100644 --- a/libs/s25main/figures/nofGeologist.h +++ b/libs/s25main/figures/nofGeologist.h @@ -54,7 +54,7 @@ class nofGeologist : public nofFlagWorker nofGeologist(MapPoint pos, unsigned char player, noRoadNode* goal); nofGeologist(SerializedGameData& sgd, unsigned obj_id); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofGeologist; } diff --git a/libs/s25main/figures/nofHunter.cpp b/libs/s25main/figures/nofHunter.cpp index 79aa53f170..c2a260820d 100644 --- a/libs/s25main/figures/nofHunter.cpp +++ b/libs/s25main/figures/nofHunter.cpp @@ -30,9 +30,9 @@ nofHunter::nofHunter(const MapPoint pos, const unsigned char player, nobUsual* w shooting_dir(Direction::West) {} -void nofHunter::Serialize(SerializedGameData& sgd) const +void nofHunter::serialize(SerializedGameData& sgd) const { - nofBuildingWorker::Serialize(sgd); + nofBuildingWorker::serialize(sgd); if(state != State::FigureWork && state != State::Waiting1) { diff --git a/libs/s25main/figures/nofHunter.h b/libs/s25main/figures/nofHunter.h index e0b47083f7..15b6847bb5 100644 --- a/libs/s25main/figures/nofHunter.h +++ b/libs/s25main/figures/nofHunter.h @@ -58,7 +58,7 @@ class nofHunter : public nofBuildingWorker nofBuildingWorker::destroy(); } - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofHunter; } diff --git a/libs/s25main/figures/nofMetalworker.cpp b/libs/s25main/figures/nofMetalworker.cpp index f583759bb4..f6fc27e191 100644 --- a/libs/s25main/figures/nofMetalworker.cpp +++ b/libs/s25main/figures/nofMetalworker.cpp @@ -61,9 +61,9 @@ nofMetalworker::nofMetalworker(SerializedGameData& sgd, const unsigned obj_id) : }); } -void nofMetalworker::Serialize(SerializedGameData& sgd) const +void nofMetalworker::serialize(SerializedGameData& sgd) const { - nofWorkman::Serialize(sgd); + nofWorkman::serialize(sgd); sgd.pushOptionalEnum(nextProducedTool); } diff --git a/libs/s25main/figures/nofMetalworker.h b/libs/s25main/figures/nofMetalworker.h index b9c36f4134..29f3737cb0 100644 --- a/libs/s25main/figures/nofMetalworker.h +++ b/libs/s25main/figures/nofMetalworker.h @@ -37,7 +37,7 @@ class nofMetalworker : public nofWorkman public: nofMetalworker(MapPoint pos, unsigned char player, nobUsual* workplace); nofMetalworker(SerializedGameData& sgd, unsigned obj_id); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofMetalworker; } }; diff --git a/libs/s25main/figures/nofPassiveSoldier.cpp b/libs/s25main/figures/nofPassiveSoldier.cpp index fd24f8b6d0..cbdde41f4a 100644 --- a/libs/s25main/figures/nofPassiveSoldier.cpp +++ b/libs/s25main/figures/nofPassiveSoldier.cpp @@ -34,9 +34,9 @@ void nofPassiveSoldier::destroy() nofSoldier::destroy(); } -void nofPassiveSoldier::Serialize(SerializedGameData& sgd) const +void nofPassiveSoldier::serialize(SerializedGameData& sgd) const { - nofSoldier::Serialize(sgd); + nofSoldier::serialize(sgd); sgd.pushEvent(healing_event); } diff --git a/libs/s25main/figures/nofPassiveSoldier.h b/libs/s25main/figures/nofPassiveSoldier.h index 1d09cf79f3..8a46c0c45c 100644 --- a/libs/s25main/figures/nofPassiveSoldier.h +++ b/libs/s25main/figures/nofPassiveSoldier.h @@ -37,7 +37,7 @@ class nofPassiveSoldier : public nofSoldier ~nofPassiveSoldier() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofPassivesoldier; } diff --git a/libs/s25main/figures/nofPlaner.cpp b/libs/s25main/figures/nofPlaner.cpp index 1c9b6d7985..067c838273 100644 --- a/libs/s25main/figures/nofPlaner.cpp +++ b/libs/s25main/figures/nofPlaner.cpp @@ -20,9 +20,9 @@ nofPlaner::nofPlaner(const MapPoint pos, const unsigned char player, noBuildingS pd(PlaningDir::NotWorking) {} -void nofPlaner::Serialize(SerializedGameData& sgd) const +void nofPlaner::serialize(SerializedGameData& sgd) const { - noFigure::Serialize(sgd); + noFigure::serialize(sgd); sgd.pushEnum(state); sgd.pushObject(building_site, true); diff --git a/libs/s25main/figures/nofPlaner.h b/libs/s25main/figures/nofPlaner.h index 8e2eda75dc..68f2258550 100644 --- a/libs/s25main/figures/nofPlaner.h +++ b/libs/s25main/figures/nofPlaner.h @@ -44,7 +44,7 @@ class nofPlaner : public noFigure nofPlaner(SerializedGameData& sgd, unsigned obj_id); nofPlaner(const nofPlaner&) = delete; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofPlaner; } diff --git a/libs/s25main/figures/nofScout_Free.cpp b/libs/s25main/figures/nofScout_Free.cpp index 8f28a34a95..2968b5d226 100644 --- a/libs/s25main/figures/nofScout_Free.cpp +++ b/libs/s25main/figures/nofScout_Free.cpp @@ -17,9 +17,9 @@ nofScout_Free::nofScout_Free(const MapPoint pos, const unsigned char player, noR : nofFlagWorker(Job::Scout, pos, player, goal), nextPos(pos), rest_way(0) {} -void nofScout_Free::Serialize(SerializedGameData& sgd) const +void nofScout_Free::serialize(SerializedGameData& sgd) const { - nofFlagWorker::Serialize(sgd); + nofFlagWorker::serialize(sgd); helpers::pushPoint(sgd, nextPos); sgd.PushUnsignedInt(rest_way); } diff --git a/libs/s25main/figures/nofScout_Free.h b/libs/s25main/figures/nofScout_Free.h index 684ef6716a..d9989f5eec 100644 --- a/libs/s25main/figures/nofScout_Free.h +++ b/libs/s25main/figures/nofScout_Free.h @@ -35,7 +35,7 @@ class nofScout_Free : public nofFlagWorker nofScout_Free(MapPoint pos, unsigned char player, noRoadNode* goal); nofScout_Free(SerializedGameData& sgd, unsigned obj_id); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofScoutFree; } diff --git a/libs/s25main/figures/nofShipWright.cpp b/libs/s25main/figures/nofShipWright.cpp index 15b210b9ef..476a56bd49 100644 --- a/libs/s25main/figures/nofShipWright.cpp +++ b/libs/s25main/figures/nofShipWright.cpp @@ -142,9 +142,9 @@ nofShipWright::nofShipWright(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id), curShipBuildPos(sgd.popMapPoint()) {} -void nofShipWright::Serialize(SerializedGameData& sgd) const +void nofShipWright::serialize(SerializedGameData& sgd) const { - nofWorkman::Serialize(sgd); + nofWorkman::serialize(sgd); helpers::pushPoint(sgd, curShipBuildPos); } diff --git a/libs/s25main/figures/nofShipWright.h b/libs/s25main/figures/nofShipWright.h index 5b68482b49..a2a7a78dbf 100644 --- a/libs/s25main/figures/nofShipWright.h +++ b/libs/s25main/figures/nofShipWright.h @@ -45,5 +45,5 @@ class nofShipWright : public nofWorkman nofShipWright(SerializedGameData& sgd, unsigned obj_id); GO_Type getGOT() const final { return GO_Type::NofShipwright; } void handleDerivedEvent(unsigned id) override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; }; diff --git a/libs/s25main/figures/nofSkinner.cpp b/libs/s25main/figures/nofSkinner.cpp index 569ed30e1e..2137ff3b2e 100644 --- a/libs/s25main/figures/nofSkinner.cpp +++ b/libs/s25main/figures/nofSkinner.cpp @@ -36,9 +36,9 @@ nofSkinner::nofSkinner(SerializedGameData& sgd, const unsigned obj_id) : nofWork animal = nullptr; } -void nofSkinner::Serialize(SerializedGameData& sgd) const +void nofSkinner::serialize(SerializedGameData& sgd) const { - nofBuildingWorker::Serialize(sgd); + nofBuildingWorker::serialize(sgd); if(state != State::FigureWork && state != State::Waiting1) sgd.pushObject(animal, true); diff --git a/libs/s25main/figures/nofSkinner.h b/libs/s25main/figures/nofSkinner.h index fdefdc80cc..83fc3bff11 100644 --- a/libs/s25main/figures/nofSkinner.h +++ b/libs/s25main/figures/nofSkinner.h @@ -37,7 +37,7 @@ class nofSkinner : public nofWorkman nofSkinner(MapPoint pos, unsigned char player, nobUsual* workplace); nofSkinner(SerializedGameData& sgd, unsigned obj_id); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofSkinner; } diff --git a/libs/s25main/figures/nofSoldier.cpp b/libs/s25main/figures/nofSoldier.cpp index 789c2d419a..00faf09b82 100644 --- a/libs/s25main/figures/nofSoldier.cpp +++ b/libs/s25main/figures/nofSoldier.cpp @@ -26,9 +26,9 @@ nofSoldier::nofSoldier(const MapPoint pos, const unsigned char player, nobBaseMi RTTR_Assert(IsSoldier()); } -void nofSoldier::Serialize(SerializedGameData& sgd) const +void nofSoldier::serialize(SerializedGameData& sgd) const { - noFigure::Serialize(sgd); + noFigure::serialize(sgd); if(fs != FigureState::Wander && fs != FigureState::GoHome) sgd.pushObject(homeBld); diff --git a/libs/s25main/figures/nofSoldier.h b/libs/s25main/figures/nofSoldier.h index 7ae9503125..260668e195 100644 --- a/libs/s25main/figures/nofSoldier.h +++ b/libs/s25main/figures/nofSoldier.h @@ -36,7 +36,7 @@ class nofSoldier : public noFigure RTTR_Assert(!getHomeBld()); noFigure::destroy(); } - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; unsigned char getRank() const; unsigned char getHitpoints() const; diff --git a/libs/s25main/figures/nofTempleServant.cpp b/libs/s25main/figures/nofTempleServant.cpp index 4c96da00d4..7f9c0d722c 100644 --- a/libs/s25main/figures/nofTempleServant.cpp +++ b/libs/s25main/figures/nofTempleServant.cpp @@ -25,9 +25,9 @@ nofTempleServant::nofTempleServant(SerializedGameData& sgd, const unsigned obj_i : nofWorkman(sgd, obj_id), currentProduction(sgd.pop()) {} -void nofTempleServant::Serialize(SerializedGameData& sgd) const +void nofTempleServant::serialize(SerializedGameData& sgd) const { - nofWorkman::Serialize(sgd); + nofWorkman::serialize(sgd); sgd.pushEnum(currentProduction); } diff --git a/libs/s25main/figures/nofTempleServant.h b/libs/s25main/figures/nofTempleServant.h index 7c39054a63..94990b73d9 100644 --- a/libs/s25main/figures/nofTempleServant.h +++ b/libs/s25main/figures/nofTempleServant.h @@ -26,7 +26,7 @@ class nofTempleServant : public nofWorkman public: nofTempleServant(MapPoint pos, unsigned char player, nobUsual* workplace); nofTempleServant(SerializedGameData& sgd, unsigned obj_id); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofTempleservant; } }; diff --git a/libs/s25main/figures/nofTradeDonkey.cpp b/libs/s25main/figures/nofTradeDonkey.cpp index 1b9c8e836e..e8ca19ac71 100644 --- a/libs/s25main/figures/nofTradeDonkey.cpp +++ b/libs/s25main/figures/nofTradeDonkey.cpp @@ -35,9 +35,9 @@ nofTradeDonkey::nofTradeDonkey(SerializedGameData& sgd, const unsigned obj_id) helpers::popContainer(sgd, next_dirs); } -void nofTradeDonkey::Serialize(SerializedGameData& sgd) const +void nofTradeDonkey::serialize(SerializedGameData& sgd) const { - noFigure::Serialize(sgd); + noFigure::serialize(sgd); sgd.pushObject(successor, true); sgd.pushOptionalEnum(gt); diff --git a/libs/s25main/figures/nofTradeDonkey.h b/libs/s25main/figures/nofTradeDonkey.h index e18ca31e4e..66dca1858a 100644 --- a/libs/s25main/figures/nofTradeDonkey.h +++ b/libs/s25main/figures/nofTradeDonkey.h @@ -47,7 +47,7 @@ class nofTradeDonkey : public noFigure noFigure::destroy(); } - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofTradedonkey; } diff --git a/libs/s25main/figures/nofTradeLeader.cpp b/libs/s25main/figures/nofTradeLeader.cpp index 204a8ad521..397b8aa335 100644 --- a/libs/s25main/figures/nofTradeLeader.cpp +++ b/libs/s25main/figures/nofTradeLeader.cpp @@ -30,11 +30,11 @@ nofTradeLeader::nofTradeLeader(SerializedGameData& sgd, const unsigned obj_id) homePos(sgd.popMapPoint()), goalPos(sgd.popMapPoint()) {} -void nofTradeLeader::Serialize(SerializedGameData& sgd) const +void nofTradeLeader::serialize(SerializedGameData& sgd) const { - noFigure::Serialize(sgd); + noFigure::serialize(sgd); - tr.Serialize(sgd); + tr.serialize(sgd); sgd.pushObject(successor, true); helpers::pushPoint(sgd, homePos); diff --git a/libs/s25main/figures/nofTradeLeader.h b/libs/s25main/figures/nofTradeLeader.h index 102725bb4a..4cff41f55a 100644 --- a/libs/s25main/figures/nofTradeLeader.h +++ b/libs/s25main/figures/nofTradeLeader.h @@ -42,7 +42,7 @@ class nofTradeLeader : public noFigure noFigure::destroy(); } - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofTradeleader; } diff --git a/libs/s25main/figures/nofWarehouseWorker.cpp b/libs/s25main/figures/nofWarehouseWorker.cpp index e8e16fb5b5..3db3cf914d 100644 --- a/libs/s25main/figures/nofWarehouseWorker.cpp +++ b/libs/s25main/figures/nofWarehouseWorker.cpp @@ -35,9 +35,9 @@ void nofWarehouseWorker::destroy() looseWare(); } -void nofWarehouseWorker::Serialize(SerializedGameData& sgd) const +void nofWarehouseWorker::serialize(SerializedGameData& sgd) const { - noFigure::Serialize(sgd); + noFigure::serialize(sgd); sgd.pushObject(carried_ware, true); sgd.PushBool(shouldBringWareIn); diff --git a/libs/s25main/figures/nofWarehouseWorker.h b/libs/s25main/figures/nofWarehouseWorker.h index e762594b92..21062b0915 100644 --- a/libs/s25main/figures/nofWarehouseWorker.h +++ b/libs/s25main/figures/nofWarehouseWorker.h @@ -43,7 +43,7 @@ class nofWarehouseWorker : public noFigure ~nofWarehouseWorker() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofWarehouseworker; } diff --git a/libs/s25main/figures/nofWinegrower.cpp b/libs/s25main/figures/nofWinegrower.cpp index da48c46dd1..671610a05f 100644 --- a/libs/s25main/figures/nofWinegrower.cpp +++ b/libs/s25main/figures/nofWinegrower.cpp @@ -27,9 +27,9 @@ nofWinegrower::nofWinegrower(SerializedGameData& sgd, const unsigned obj_id) : nofFarmhand(sgd, obj_id), harvest(sgd.PopBool()) {} -void nofWinegrower::Serialize(SerializedGameData& sgd) const +void nofWinegrower::serialize(SerializedGameData& sgd) const { - nofFarmhand::Serialize(sgd); + nofFarmhand::serialize(sgd); sgd.PushBool(harvest); } diff --git a/libs/s25main/figures/nofWinegrower.h b/libs/s25main/figures/nofWinegrower.h index fef3e8752e..ff3a285123 100644 --- a/libs/s25main/figures/nofWinegrower.h +++ b/libs/s25main/figures/nofWinegrower.h @@ -46,7 +46,7 @@ class nofWinegrower : public nofFarmhand nofWinegrower(MapPoint pos, unsigned char player, nobUsual* workplace); nofWinegrower(SerializedGameData& sgd, unsigned obj_id); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::NofWinegrower; } }; diff --git a/libs/s25main/gameTypes/FoWNode.cpp b/libs/s25main/gameTypes/FoWNode.cpp index 6be2280b8b..1db9631c64 100644 --- a/libs/s25main/gameTypes/FoWNode.cpp +++ b/libs/s25main/gameTypes/FoWNode.cpp @@ -13,7 +13,7 @@ FoWNode::FoWNode() : last_update_time(0), visibility(Visibility::Invisible), own std::fill(boundary_stones.begin(), boundary_stones.end(), 0); } -void FoWNode::Serialize(SerializedGameData& sgd) const +void FoWNode::serialize(SerializedGameData& sgd) const { sgd.pushEnum(visibility); // Only in FoW can be FoW objects @@ -27,7 +27,7 @@ void FoWNode::Serialize(SerializedGameData& sgd) const } } -void FoWNode::Deserialize(SerializedGameData& sgd) +void FoWNode::deserialize(SerializedGameData& sgd) { visibility = sgd.pop(); // Only in FoW can be FoW objects diff --git a/libs/s25main/gameTypes/FoWNode.h b/libs/s25main/gameTypes/FoWNode.h index 010e3eb416..718515ec95 100644 --- a/libs/s25main/gameTypes/FoWNode.h +++ b/libs/s25main/gameTypes/FoWNode.h @@ -56,6 +56,6 @@ struct FoWNode BoundaryStones boundary_stones; FoWNode(); - void Serialize(SerializedGameData& sgd) const; - void Deserialize(SerializedGameData& sgd); + void serialize(SerializedGameData& sgd) const; + void deserialize(SerializedGameData& sgd); }; diff --git a/libs/s25main/gameTypes/LanGameInfo.cpp b/libs/s25main/gameTypes/LanGameInfo.cpp index b4e200f8eb..e0a8d6fafa 100644 --- a/libs/s25main/gameTypes/LanGameInfo.cpp +++ b/libs/s25main/gameTypes/LanGameInfo.cpp @@ -5,7 +5,7 @@ #include "LanGameInfo.h" #include "s25util/Serializer.h" -bool LanGameInfo::Serialize(Serializer& serializer) +bool LanGameInfo::serialize(Serializer& serializer) { if(name.size() > 64) name.resize(64); @@ -25,7 +25,7 @@ bool LanGameInfo::Serialize(Serializer& serializer) return true; } -bool LanGameInfo::Deserialize(Serializer& serializer) +bool LanGameInfo::deserialize(Serializer& serializer) { name = serializer.PopString(); hasPwd = serializer.PopBool(); diff --git a/libs/s25main/gameTypes/LanGameInfo.h b/libs/s25main/gameTypes/LanGameInfo.h index 11baaf47a8..c667f5c02b 100644 --- a/libs/s25main/gameTypes/LanGameInfo.h +++ b/libs/s25main/gameTypes/LanGameInfo.h @@ -20,6 +20,6 @@ struct LanGameInfo std::string version; std::string revision; - bool Serialize(Serializer& serializer); - bool Deserialize(Serializer& serializer); + bool serialize(Serializer& serializer); + bool deserialize(Serializer& serializer); }; diff --git a/libs/s25main/gameTypes/MapNode.cpp b/libs/s25main/gameTypes/MapNode.cpp index e0b1ee7b4e..e166bc5ef9 100644 --- a/libs/s25main/gameTypes/MapNode.cpp +++ b/libs/s25main/gameTypes/MapNode.cpp @@ -17,7 +17,7 @@ MapNode::MapNode() std::fill(boundary_stones.begin(), boundary_stones.end(), 0); } -void MapNode::Serialize(SerializedGameData& sgd, const unsigned numPlayers, const WorldDescription& desc) const +void MapNode::serialize(SerializedGameData& sgd, const unsigned numPlayers, const WorldDescription& desc) const { helpers::pushContainer(sgd, roads); sgd.PushUnsignedChar(altitude); @@ -30,14 +30,14 @@ void MapNode::Serialize(SerializedGameData& sgd, const unsigned numPlayers, cons helpers::pushContainer(sgd, boundary_stones); RTTR_Assert(numPlayers <= fow.size()); for(unsigned z = 0; z < numPlayers; ++z) - fow[z].Serialize(sgd); + fow[z].serialize(sgd); sgd.pushObject(obj); sgd.pushObjectContainer(figures); sgd.PushUnsignedShort(seaId.value()); sgd.PushUnsignedInt(harborId.value()); } -void MapNode::Deserialize(SerializedGameData& sgd, const unsigned numPlayers, const WorldDescription& desc, +void MapNode::deserialize(SerializedGameData& sgd, const unsigned numPlayers, const WorldDescription& desc, const std::vector>& landscapeTerrains) { helpers::popContainer(sgd, roads); @@ -69,7 +69,7 @@ void MapNode::Deserialize(SerializedGameData& sgd, const unsigned numPlayers, co bq = sgd.pop(); RTTR_Assert(numPlayers <= fow.size()); for(unsigned z = 0; z < numPlayers; ++z) - fow[z].Deserialize(sgd); + fow[z].deserialize(sgd); obj = sgd.popObject(); sgd.popObjectContainer(figures); seaId = SeaId(sgd.PopUnsignedShort()); diff --git a/libs/s25main/gameTypes/MapNode.h b/libs/s25main/gameTypes/MapNode.h index 2c7fbb51a2..5636c4cd2c 100644 --- a/libs/s25main/gameTypes/MapNode.h +++ b/libs/s25main/gameTypes/MapNode.h @@ -59,7 +59,7 @@ struct MapNode MapNode(MapNode&&) = default; MapNode& operator=(const MapNode&) = delete; MapNode& operator=(MapNode&&) = default; - void Serialize(SerializedGameData& sgd, unsigned numPlayers, const WorldDescription& desc) const; - void Deserialize(SerializedGameData& sgd, unsigned numPlayers, const WorldDescription& desc, + void serialize(SerializedGameData& sgd, unsigned numPlayers, const WorldDescription& desc) const; + void deserialize(SerializedGameData& sgd, unsigned numPlayers, const WorldDescription& desc, const std::vector>& landscapeTerrains); }; diff --git a/libs/s25main/ingameWindows/iwConnecting.cpp b/libs/s25main/ingameWindows/iwConnecting.cpp index c9ac4a94f8..95e5402ec4 100644 --- a/libs/s25main/ingameWindows/iwConnecting.cpp +++ b/libs/s25main/ingameWindows/iwConnecting.cpp @@ -83,8 +83,8 @@ void iwConnecting::CI_NextConnectState(const ConnectState cs) case ConnectState::QueryPlayerList: setStatus(_("Waiting for Playerinfo...")); break; case ConnectState::QuerySettings: setStatus(_("Waiting for server info...")); break; case ConnectState::Finished: - WINDOWMANAGER.Switch(std::make_unique(serverType_, GAMECLIENT.getGameLobby(), - GAMECLIENT.getPlayerId(), std::move(lobbyClient_))); + WINDOWMANAGER.switchTo(std::make_unique(serverType_, GAMECLIENT.getGameLobby(), + GAMECLIENT.getPlayerId(), std::move(lobbyClient_))); close(); break; } diff --git a/libs/s25main/ingameWindows/iwDirectIPCreate.cpp b/libs/s25main/ingameWindows/iwDirectIPCreate.cpp index c69140774d..584420e42d 100644 --- a/libs/s25main/ingameWindows/iwDirectIPCreate.cpp +++ b/libs/s25main/ingameWindows/iwDirectIPCreate.cpp @@ -146,7 +146,7 @@ void iwDirectIPCreate::msgButtonClick(const unsigned ctrl_id) SETTINGS.global.useUPNP); // Map auswählen - WINDOWMANAGER.Switch(std::make_unique(csi)); + WINDOWMANAGER.switchTo(std::make_unique(csi)); } break; case 8: diff --git a/libs/s25main/ingameWindows/iwLobbyConnect.cpp b/libs/s25main/ingameWindows/iwLobbyConnect.cpp index 9b827c8578..08c68074ae 100644 --- a/libs/s25main/ingameWindows/iwLobbyConnect.cpp +++ b/libs/s25main/ingameWindows/iwLobbyConnect.cpp @@ -224,7 +224,7 @@ void iwLobbyConnect::LC_LoggedIn(const std::string& /*email*/) { getCtrl(ID_btRegister)->setEnabled(false); - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); } void iwLobbyConnect::LC_Status_Waiting() diff --git a/libs/s25main/ingameWindows/iwPlayReplay.cpp b/libs/s25main/ingameWindows/iwPlayReplay.cpp index dba09a7977..050b6f5249 100644 --- a/libs/s25main/ingameWindows/iwPlayReplay.cpp +++ b/libs/s25main/ingameWindows/iwPlayReplay.cpp @@ -32,7 +32,7 @@ class SwitchOnStart : public ClientInterface void CI_GameLoading(std::shared_ptr game) override { - WINDOWMANAGER.Switch(std::make_unique(std::move(game))); + WINDOWMANAGER.switchTo(std::make_unique(std::move(game))); } }; diff --git a/libs/s25main/ingameWindows/iwSave.cpp b/libs/s25main/ingameWindows/iwSave.cpp index 8906879c61..c3d3648be5 100644 --- a/libs/s25main/ingameWindows/iwSave.cpp +++ b/libs/s25main/ingameWindows/iwSave.cpp @@ -208,7 +208,7 @@ void iwLoad::saveLoad() } else { if(LOBBYCLIENT.IsLoggedIn()) - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); else close(); } diff --git a/libs/s25main/lua/LuaInterfaceGame.cpp b/libs/s25main/lua/LuaInterfaceGame.cpp index 8bf99c3570..7ddebf2b5a 100644 --- a/libs/s25main/lua/LuaInterfaceGame.cpp +++ b/libs/s25main/lua/LuaInterfaceGame.cpp @@ -192,9 +192,9 @@ LuaInterfaceGame::LuaInterfaceGame(Game& gameInstance, ILocalGameState& localGam #undef ADD_LUA_CONST #pragma endregion ConstDefs - Register(lua); - LuaPlayer::Register(lua); - LuaWorld::Register(lua); + registerClasses(lua); + LuaPlayer::registerClasses(lua); + LuaWorld::registerClasses(lua); lua["rttr"] = this; } @@ -203,7 +203,7 @@ LuaInterfaceGame::~LuaInterfaceGame() = default; KAGUYA_MEMBER_FUNCTION_OVERLOADS(SetMissionGoalWrapper, LuaInterfaceGame, setMissionGoal, 1, 2) -void LuaInterfaceGame::Register(kaguya::State& state) +void LuaInterfaceGame::registerClasses(kaguya::State& state) { state["RTTRGame"].setClass(kaguya::UserdataMetatable() .addFunction("ClearResources", &LuaInterfaceGame::clearResources) @@ -231,7 +231,7 @@ void LuaInterfaceGame::Register(kaguya::State& state) .addFunction("PopString", &Serializer::PopString)); } -bool LuaInterfaceGame::Serialize(Serializer& luaSaveState) +bool LuaInterfaceGame::serialize(Serializer& luaSaveState) { kaguya::LuaRef save = lua["onSave"]; if(save.type() == LUA_TFUNCTION) @@ -248,7 +248,7 @@ bool LuaInterfaceGame::Serialize(Serializer& luaSaveState) return true; } -bool LuaInterfaceGame::Deserialize(Serializer& luaSaveState) +bool LuaInterfaceGame::deserialize(Serializer& luaSaveState) { kaguya::LuaRef load = lua["onLoad"]; if(load.type() == LUA_TFUNCTION) diff --git a/libs/s25main/lua/LuaInterfaceGame.h b/libs/s25main/lua/LuaInterfaceGame.h index c197febc19..a80b6e4bd2 100644 --- a/libs/s25main/lua/LuaInterfaceGame.h +++ b/libs/s25main/lua/LuaInterfaceGame.h @@ -24,10 +24,10 @@ class LuaInterfaceGame : public LuaInterfaceGameBase LuaInterfaceGame(Game& gameInstance, ILocalGameState& localGameState); virtual ~LuaInterfaceGame(); - static void Register(kaguya::State& state); + static void registerClasses(kaguya::State& state); - bool Serialize(Serializer& luaSaveState); - bool Deserialize(Serializer& luaSaveState); + bool serialize(Serializer& luaSaveState); + bool deserialize(Serializer& luaSaveState); void eventExplored(unsigned player, MapPoint pt, unsigned char owner); void eventOccupied(unsigned player, MapPoint pt); diff --git a/libs/s25main/lua/LuaInterfaceGameBase.cpp b/libs/s25main/lua/LuaInterfaceGameBase.cpp index 371798d895..06b624fa89 100644 --- a/libs/s25main/lua/LuaInterfaceGameBase.cpp +++ b/libs/s25main/lua/LuaInterfaceGameBase.cpp @@ -21,10 +21,10 @@ unsigned LuaInterfaceGameBase::getFeatureLevel() LuaInterfaceGameBase::LuaInterfaceGameBase(const ILocalGameState& localGameState) : localGameState(localGameState) { - Register(lua); + registerClasses(lua); } -void LuaInterfaceGameBase::Register(kaguya::State& state) +void LuaInterfaceGameBase::registerClasses(kaguya::State& state) { state["RTTRGameBase"].setClass( kaguya::UserdataMetatable() diff --git a/libs/s25main/lua/LuaInterfaceGameBase.h b/libs/s25main/lua/LuaInterfaceGameBase.h index 38f0b0267f..ed55a91e5a 100644 --- a/libs/s25main/lua/LuaInterfaceGameBase.h +++ b/libs/s25main/lua/LuaInterfaceGameBase.h @@ -10,7 +10,7 @@ class LuaInterfaceGameBase : public LuaInterfaceBase { public: - static void Register(kaguya::State& state); + static void registerClasses(kaguya::State& state); bool checkScriptVersion(); diff --git a/libs/s25main/lua/LuaInterfaceSettings.cpp b/libs/s25main/lua/LuaInterfaceSettings.cpp index 87b1230e43..9c2402b8de 100644 --- a/libs/s25main/lua/LuaInterfaceSettings.cpp +++ b/libs/s25main/lua/LuaInterfaceSettings.cpp @@ -25,14 +25,14 @@ LuaInterfaceSettings::LuaInterfaceSettings(IGameLobbyController& lobbyServerCont const ILocalGameState& localGameState) : LuaInterfaceGameBase(localGameState), lobbyServerController_(lobbyServerController) { - Register(lua); - LuaServerPlayer::Register(lua); + registerClasses(lua); + LuaServerPlayer::registerClasses(lua); lua["rttr"] = this; } LuaInterfaceSettings::~LuaInterfaceSettings() = default; -void LuaInterfaceSettings::Register(kaguya::State& state) +void LuaInterfaceSettings::registerClasses(kaguya::State& state) { state["RTTRSettings"].setClass( kaguya::UserdataMetatable() diff --git a/libs/s25main/lua/LuaInterfaceSettings.h b/libs/s25main/lua/LuaInterfaceSettings.h index 851293edb6..058ac8fc72 100644 --- a/libs/s25main/lua/LuaInterfaceSettings.h +++ b/libs/s25main/lua/LuaInterfaceSettings.h @@ -20,7 +20,7 @@ class LuaInterfaceSettings : public LuaInterfaceGameBase LuaInterfaceSettings(IGameLobbyController& lobbyServerController, const ILocalGameState& localGameState); virtual ~LuaInterfaceSettings(); - static void Register(kaguya::State& state); + static void registerClasses(kaguya::State& state); // Interface for C++ /// Called when settings are entered. Returns whether script should be executed diff --git a/libs/s25main/lua/LuaPlayer.cpp b/libs/s25main/lua/LuaPlayer.cpp index 56e6d6c058..5fac62c287 100644 --- a/libs/s25main/lua/LuaPlayer.cpp +++ b/libs/s25main/lua/LuaPlayer.cpp @@ -27,9 +27,9 @@ const BasePlayerInfo& LuaPlayer::getPlayer() const return player; } -void LuaPlayer::Register(kaguya::State& state) +void LuaPlayer::registerClasses(kaguya::State& state) { - LuaPlayerBase::Register(state); + LuaPlayerBase::registerClasses(state); state["Player"].setClass(kaguya::UserdataMetatable() .addFunction("EnableBuilding", &LuaPlayer::enableBuilding) .addFunction("DisableBuilding", &LuaPlayer::disableBuilding) diff --git a/libs/s25main/lua/LuaPlayer.h b/libs/s25main/lua/LuaPlayer.h index 4b52f55091..54054499ab 100644 --- a/libs/s25main/lua/LuaPlayer.h +++ b/libs/s25main/lua/LuaPlayer.h @@ -33,7 +33,7 @@ class LuaPlayer : public LuaPlayerBase public: LuaPlayer(Game& game, GamePlayer& player) : game(game), player(player) {} - static void Register(kaguya::State& state); + static void registerClasses(kaguya::State& state); void enableBuilding(lua::SafeEnum bld, bool notify); void disableBuilding(lua::SafeEnum bld); diff --git a/libs/s25main/lua/LuaPlayerBase.cpp b/libs/s25main/lua/LuaPlayerBase.cpp index 74c042060b..1d99d72e71 100644 --- a/libs/s25main/lua/LuaPlayerBase.cpp +++ b/libs/s25main/lua/LuaPlayerBase.cpp @@ -8,7 +8,7 @@ #include "luaRegistrationHelpers.h" #include -void LuaPlayerBase::Register(kaguya::State& state) +void LuaPlayerBase::registerClasses(kaguya::State& state) { state["PlayerBase"].setClass(kaguya::UserdataMetatable() .addFunction("GetName", &LuaPlayerBase::getName) diff --git a/libs/s25main/lua/LuaPlayerBase.h b/libs/s25main/lua/LuaPlayerBase.h index cf4c09f4e3..b5362836f6 100644 --- a/libs/s25main/lua/LuaPlayerBase.h +++ b/libs/s25main/lua/LuaPlayerBase.h @@ -22,7 +22,7 @@ class LuaPlayerBase virtual const BasePlayerInfo& getPlayer() const = 0; public: - static void Register(kaguya::State& state); + static void registerClasses(kaguya::State& state); std::string getName() const; Nation getNation() const; diff --git a/libs/s25main/lua/LuaServerPlayer.cpp b/libs/s25main/lua/LuaServerPlayer.cpp index 0cab30d16c..fa2a9b3121 100644 --- a/libs/s25main/lua/LuaServerPlayer.cpp +++ b/libs/s25main/lua/LuaServerPlayer.cpp @@ -19,9 +19,9 @@ LuaServerPlayer::LuaServerPlayer(IGameLobbyController& lobbyServerController, un player(lobbyServerController_.getJoinPlayer(playerId)) {} -void LuaServerPlayer::Register(kaguya::State& state) +void LuaServerPlayer::registerClasses(kaguya::State& state) { - LuaPlayerBase::Register(state); + LuaPlayerBase::registerClasses(state); state["Player"].setClass(kaguya::UserdataMetatable() .addFunction("SetNation", &LuaServerPlayer::setNation) .addFunction("SetTeam", &LuaServerPlayer::setTeam) diff --git a/libs/s25main/lua/LuaServerPlayer.h b/libs/s25main/lua/LuaServerPlayer.h index 2bfa1f2abb..9f306ddb4f 100644 --- a/libs/s25main/lua/LuaServerPlayer.h +++ b/libs/s25main/lua/LuaServerPlayer.h @@ -22,7 +22,7 @@ class LuaServerPlayer : public LuaPlayerBase public: LuaServerPlayer(IGameLobbyController& lobbyServerController, unsigned playerId); - static void Register(kaguya::State& state); + static void registerClasses(kaguya::State& state); void setNation(lua::SafeEnum nat); void setTeam(lua::SafeEnum team); diff --git a/libs/s25main/lua/LuaWorld.cpp b/libs/s25main/lua/LuaWorld.cpp index ed0c2cd7db..98c52de0f7 100644 --- a/libs/s25main/lua/LuaWorld.cpp +++ b/libs/s25main/lua/LuaWorld.cpp @@ -15,7 +15,7 @@ KAGUYA_MEMBER_FUNCTION_OVERLOADS(AddEnvObjectWrapper, LuaWorld, addEnvObject, 3, 4) KAGUYA_MEMBER_FUNCTION_OVERLOADS(AddStaticObjectWrapper, LuaWorld, addStaticObject, 3, 5) -void LuaWorld::Register(kaguya::State& state) +void LuaWorld::registerClasses(kaguya::State& state) { #pragma region ConstDefs #define ADD_LUA_CONST(name) state["SPEC_" + s25util::toUpper(#name)] = Species::name diff --git a/libs/s25main/lua/LuaWorld.h b/libs/s25main/lua/LuaWorld.h index 7288aeb61d..e4959f741e 100644 --- a/libs/s25main/lua/LuaWorld.h +++ b/libs/s25main/lua/LuaWorld.h @@ -19,7 +19,7 @@ class LuaWorld public: LuaWorld(GameWorld& gw) : gw(gw) {} - static void Register(kaguya::State& state); + static void registerClasses(kaguya::State& state); bool addEnvObject(int x, int y, unsigned id, unsigned file = 0xFFFF); bool addStaticObject(int x, int y, unsigned id, unsigned file = 0xFFFF, unsigned size = 1); void addAnimal(int x, int y, lua::SafeEnum species); diff --git a/libs/s25main/network/GameMessage_GameCommand.cpp b/libs/s25main/network/GameMessage_GameCommand.cpp index 3e09a8f89d..76dee2b09d 100644 --- a/libs/s25main/network/GameMessage_GameCommand.cpp +++ b/libs/s25main/network/GameMessage_GameCommand.cpp @@ -18,14 +18,14 @@ GameMessage_GameCommand::GameMessage_GameCommand(uint8_t player, const AsyncChec void GameMessage_GameCommand::Serialize(Serializer& ser) const { GameMessageWithPlayer::Serialize(ser); - cmds.Serialize(ser); + cmds.serialize(ser); } void GameMessage_GameCommand::Deserialize(Serializer& ser) { GameMessageWithPlayer::Deserialize(ser); gc::Deserializer deser(ser); - cmds.Deserialize(deser); + cmds.deserialize(deser); } bool GameMessage_GameCommand::runGame(GameMessageInterface* callback) const diff --git a/libs/s25main/network/GameMessages.cpp b/libs/s25main/network/GameMessages.cpp index 5aaebcf402..d26d6007a0 100644 --- a/libs/s25main/network/GameMessages.cpp +++ b/libs/s25main/network/GameMessages.cpp @@ -23,7 +23,7 @@ void GameMessage_Player_List::Serialize(Serializer& ser) const GameMessage::Serialize(ser); ser.PushUnsignedInt(playerInfos.size()); for(const auto& playerInfo : playerInfos) - playerInfo.Serialize(ser); + playerInfo.serialize(ser); } void GameMessage_Player_List::Deserialize(Serializer& ser) diff --git a/libs/s25main/network/GameMessages.h b/libs/s25main/network/GameMessages.h index 1f8f554f1e..0beb7893d1 100644 --- a/libs/s25main/network/GameMessages.h +++ b/libs/s25main/network/GameMessages.h @@ -886,13 +886,13 @@ class GameMessage_GGSChange : public GameMessage void Serialize(Serializer& ser) const override { GameMessage::Serialize(ser); - ggs.Serialize(ser); + ggs.serialize(ser); } void Deserialize(Serializer& ser) override { GameMessage::Deserialize(ser); - ggs.Deserialize(ser); + ggs.deserialize(ser); } bool runGame(GameMessageInterface* callback) const override @@ -1065,7 +1065,7 @@ class GameMessage_AsyncLog : public GameMessage ser.PushUnsignedInt(entries.size()); for(const RandomEntry& entry : entries) - entry.Serialize(ser); + entry.serialize(ser); ser.PushBool(last); } @@ -1079,7 +1079,7 @@ class GameMessage_AsyncLog : public GameMessage entries.clear(); entries.resize(cnt); for(RandomEntry& entry : entries) - entry.Deserialize(ser); + entry.deserialize(ser); last = ser.PopBool(); } diff --git a/libs/s25main/network/GameServer.cpp b/libs/s25main/network/GameServer.cpp index 92d16f9732..fbd56eccc5 100644 --- a/libs/s25main/network/GameServer.cpp +++ b/libs/s25main/network/GameServer.cpp @@ -252,7 +252,7 @@ void GameServer::announceStatusChange() info.version = rttr::version::getReadableVersion(); info.revision = rttr::version::getRevision(); Serializer ser; - info.Serialize(ser); + info.serialize(ser); lanAnnouncer.SetPayload(ser.GetData(), ser.GetLength()); } else if(config.servertype == ServerType::Lobby) { diff --git a/libs/s25main/network/PlayerGameCommands.cpp b/libs/s25main/network/PlayerGameCommands.cpp index a2fc869790..bd4220af0b 100644 --- a/libs/s25main/network/PlayerGameCommands.cpp +++ b/libs/s25main/network/PlayerGameCommands.cpp @@ -5,20 +5,20 @@ #include "PlayerGameCommands.h" #include "s25util/Serializer.h" -void PlayerGameCommands::Serialize(Serializer& ser) const +void PlayerGameCommands::serialize(Serializer& ser) const { - checksum.Serialize(ser); + checksum.serialize(ser); ser.PushUnsignedInt(gcs.size()); for(const gc::GameCommandPtr& gc : gcs) - gc->Serialize(ser); + gc->serialize(ser); } -void PlayerGameCommands::Deserialize(gc::Deserializer& ser) +void PlayerGameCommands::deserialize(gc::Deserializer& ser) { - checksum.Deserialize(ser); + checksum.deserialize(ser); gcs.resize(ser.PopUnsignedInt()); for(gc::GameCommandPtr& gc : gcs) - gc = gc::GameCommand::Deserialize(ser); + gc = gc::GameCommand::deserialize(ser); } diff --git a/libs/s25main/network/PlayerGameCommands.h b/libs/s25main/network/PlayerGameCommands.h index 90fddf8b8d..8518a90311 100644 --- a/libs/s25main/network/PlayerGameCommands.h +++ b/libs/s25main/network/PlayerGameCommands.h @@ -21,6 +21,6 @@ struct PlayerGameCommands PlayerGameCommands(const AsyncChecksum& checksum, std::vector gcs) : checksum(checksum), gcs(std::move(gcs)) {} - void Serialize(Serializer& ser) const; - void Deserialize(gc::Deserializer& ser); + void serialize(Serializer& ser) const; + void deserialize(gc::Deserializer& ser); }; diff --git a/libs/s25main/nodeObjs/noAnimal.cpp b/libs/s25main/nodeObjs/noAnimal.cpp index cecf1c0e49..acd6c90e2c 100644 --- a/libs/s25main/nodeObjs/noAnimal.cpp +++ b/libs/s25main/nodeObjs/noAnimal.cpp @@ -33,9 +33,9 @@ noAnimal::noAnimal(const Species species, const MapPoint pos) hunter(nullptr), skinner(nullptr), sound_moment(0) {} -void noAnimal::Serialize(SerializedGameData& sgd) const +void noAnimal::serialize(SerializedGameData& sgd) const { - noMovable::Serialize(sgd); + noMovable::serialize(sgd); sgd.pushEnum(species); sgd.pushEnum(state); diff --git a/libs/s25main/nodeObjs/noAnimal.h b/libs/s25main/nodeObjs/noAnimal.h index 0899eada36..1d14dc88ea 100644 --- a/libs/s25main/nodeObjs/noAnimal.h +++ b/libs/s25main/nodeObjs/noAnimal.h @@ -55,7 +55,7 @@ class noAnimal : public noMovable ~noAnimal() override = default; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; void destroy() override { RTTR_Assert(!hunter); diff --git a/libs/s25main/nodeObjs/noBase.cpp b/libs/s25main/nodeObjs/noBase.cpp index 07704e8a05..f0ecd9db85 100644 --- a/libs/s25main/nodeObjs/noBase.cpp +++ b/libs/s25main/nodeObjs/noBase.cpp @@ -10,7 +10,7 @@ noBase::noBase(SerializedGameData& sgd, const unsigned obj_id) : GameObject(sgd, nop = sgd.pop(); } -void noBase::Serialize(SerializedGameData& sgd) const +void noBase::serialize(SerializedGameData& sgd) const { sgd.pushEnum(nop); } diff --git a/libs/s25main/nodeObjs/noBase.h b/libs/s25main/nodeObjs/noBase.h index 02cc39de33..00d2e8f73f 100644 --- a/libs/s25main/nodeObjs/noBase.h +++ b/libs/s25main/nodeObjs/noBase.h @@ -36,7 +36,7 @@ class noBase : public GameObject /// Type zurückgeben. NodalObjectType getType() const { return nop; } - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; /// Erzeugt von ihnen selbst ein FOW Objekt als visuelle "Erinnerung" für den Fog of War virtual std::unique_ptr createFOWObject() const; diff --git a/libs/s25main/nodeObjs/noCharburnerPile.cpp b/libs/s25main/nodeObjs/noCharburnerPile.cpp index 71eab7f873..3b38722848 100644 --- a/libs/s25main/nodeObjs/noCharburnerPile.cpp +++ b/libs/s25main/nodeObjs/noCharburnerPile.cpp @@ -45,9 +45,9 @@ void noCharburnerPile::destroy() noCoordBase::destroy(); } -void noCharburnerPile::Serialize(SerializedGameData& sgd) const +void noCharburnerPile::serialize(SerializedGameData& sgd) const { - noCoordBase::Serialize(sgd); + noCoordBase::serialize(sgd); sgd.pushEnum(state); sgd.PushUnsignedShort(step); diff --git a/libs/s25main/nodeObjs/noCharburnerPile.h b/libs/s25main/nodeObjs/noCharburnerPile.h index 33a8dfb159..698ba625bc 100644 --- a/libs/s25main/nodeObjs/noCharburnerPile.h +++ b/libs/s25main/nodeObjs/noCharburnerPile.h @@ -42,7 +42,7 @@ class noCharburnerPile : public noCoordBase ~noCharburnerPile() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Charburnerpile; } diff --git a/libs/s25main/nodeObjs/noCoordBase.cpp b/libs/s25main/nodeObjs/noCoordBase.cpp index 6d8d09ca7d..1e52edea54 100644 --- a/libs/s25main/nodeObjs/noCoordBase.cpp +++ b/libs/s25main/nodeObjs/noCoordBase.cpp @@ -7,9 +7,9 @@ #include "world/GameWorld.h" #include "gameData/MapConsts.h" -void noCoordBase::Serialize(SerializedGameData& sgd) const +void noCoordBase::serialize(SerializedGameData& sgd) const { - noBase::Serialize(sgd); + noBase::serialize(sgd); helpers::pushPoint(sgd, pos); } diff --git a/libs/s25main/nodeObjs/noCoordBase.h b/libs/s25main/nodeObjs/noCoordBase.h index ae665676c2..29f5e069f7 100644 --- a/libs/s25main/nodeObjs/noCoordBase.h +++ b/libs/s25main/nodeObjs/noCoordBase.h @@ -14,7 +14,7 @@ class noCoordBase : public noBase noCoordBase(const NodalObjectType nop, const MapPoint pt) : noBase(nop), pos(pt) {} noCoordBase(SerializedGameData& sgd, unsigned obj_id); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; /// liefert die X-Koordinate. MapCoord getX() const { return pos.x; } diff --git a/libs/s25main/nodeObjs/noDisappearingEnvObject.cpp b/libs/s25main/nodeObjs/noDisappearingEnvObject.cpp index f2a9d83175..97fbfa856f 100644 --- a/libs/s25main/nodeObjs/noDisappearingEnvObject.cpp +++ b/libs/s25main/nodeObjs/noDisappearingEnvObject.cpp @@ -18,9 +18,9 @@ noDisappearingEnvObject::noDisappearingEnvObject(const MapPoint pos, const unsig dead_event = getEvMgr().addEvent(this, living_time + RANDOM_RAND(add_var_living_time)); } -void noDisappearingEnvObject::Serialize(SerializedGameData& sgd) const +void noDisappearingEnvObject::serialize(SerializedGameData& sgd) const { - noCoordBase::Serialize(sgd); + noCoordBase::serialize(sgd); sgd.PushBool(disappearing); sgd.pushEvent(dead_event); diff --git a/libs/s25main/nodeObjs/noDisappearingEnvObject.h b/libs/s25main/nodeObjs/noDisappearingEnvObject.h index aa5881275f..a15922bbd5 100644 --- a/libs/s25main/nodeObjs/noDisappearingEnvObject.h +++ b/libs/s25main/nodeObjs/noDisappearingEnvObject.h @@ -16,7 +16,7 @@ class noDisappearingEnvObject : public noCoordBase noDisappearingEnvObject(SerializedGameData& sgd, unsigned obj_id); void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; void handleEvent(unsigned id) override; diff --git a/libs/s25main/nodeObjs/noDisappearingMapEnvObject.cpp b/libs/s25main/nodeObjs/noDisappearingMapEnvObject.cpp index d59294eeec..d873a81dcf 100644 --- a/libs/s25main/nodeObjs/noDisappearingMapEnvObject.cpp +++ b/libs/s25main/nodeObjs/noDisappearingMapEnvObject.cpp @@ -19,9 +19,9 @@ noDisappearingMapEnvObject::noDisappearingMapEnvObject(const MapPoint pos, const : noDisappearingEnvObject(pos, 4000, 1000), map_id(map_id) {} -void noDisappearingMapEnvObject::Serialize(SerializedGameData& sgd) const +void noDisappearingMapEnvObject::serialize(SerializedGameData& sgd) const { - noDisappearingEnvObject::Serialize(sgd); + noDisappearingEnvObject::serialize(sgd); sgd.PushUnsignedShort(map_id); } diff --git a/libs/s25main/nodeObjs/noDisappearingMapEnvObject.h b/libs/s25main/nodeObjs/noDisappearingMapEnvObject.h index 59c95ed0d8..39f59351f8 100644 --- a/libs/s25main/nodeObjs/noDisappearingMapEnvObject.h +++ b/libs/s25main/nodeObjs/noDisappearingMapEnvObject.h @@ -14,7 +14,7 @@ class noDisappearingMapEnvObject : public noDisappearingEnvObject noDisappearingMapEnvObject(MapPoint pos, unsigned short map_id); noDisappearingMapEnvObject(SerializedGameData& sgd, unsigned obj_id); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Disappearingmapenvobject; } diff --git a/libs/s25main/nodeObjs/noExtension.cpp b/libs/s25main/nodeObjs/noExtension.cpp index 9cbbde10a0..7a050a83dc 100644 --- a/libs/s25main/nodeObjs/noExtension.cpp +++ b/libs/s25main/nodeObjs/noExtension.cpp @@ -5,9 +5,9 @@ #include "noExtension.h" #include "SerializedGameData.h" -void noExtension::Serialize(SerializedGameData& sgd) const +void noExtension::serialize(SerializedGameData& sgd) const { - noBase::Serialize(sgd); + noBase::serialize(sgd); sgd.pushObject(base); } diff --git a/libs/s25main/nodeObjs/noExtension.h b/libs/s25main/nodeObjs/noExtension.h index 7a5db23f91..25d90205da 100644 --- a/libs/s25main/nodeObjs/noExtension.h +++ b/libs/s25main/nodeObjs/noExtension.h @@ -19,7 +19,7 @@ class noExtension final : public noBase void draw(DrawPoint /*drawPt*/) override {} void destroy() override {} - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Extension; } diff --git a/libs/s25main/nodeObjs/noFighting.cpp b/libs/s25main/nodeObjs/noFighting.cpp index 728fd9eedd..a79e8dc277 100644 --- a/libs/s25main/nodeObjs/noFighting.cpp +++ b/libs/s25main/nodeObjs/noFighting.cpp @@ -43,9 +43,9 @@ noFighting::noFighting(nofActiveSoldier& soldier1, nofActiveSoldier& soldier2) : noFighting::~noFighting() = default; -void noFighting::Serialize(SerializedGameData& sgd) const +void noFighting::serialize(SerializedGameData& sgd) const { - noBase::Serialize(sgd); + noBase::serialize(sgd); sgd.PushUnsignedChar(turn); sgd.PushUnsignedChar(defending_animation); diff --git a/libs/s25main/nodeObjs/noFighting.h b/libs/s25main/nodeObjs/noFighting.h index b4e8b2967f..eda94399e3 100644 --- a/libs/s25main/nodeObjs/noFighting.h +++ b/libs/s25main/nodeObjs/noFighting.h @@ -37,7 +37,7 @@ class noFighting : public noBase ~noFighting() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Fighting; } diff --git a/libs/s25main/nodeObjs/noFire.cpp b/libs/s25main/nodeObjs/noFire.cpp index 429acf9926..219601c5fc 100644 --- a/libs/s25main/nodeObjs/noFire.cpp +++ b/libs/s25main/nodeObjs/noFire.cpp @@ -39,9 +39,9 @@ void noFire::destroy() noCoordBase::destroy(); } -void noFire::Serialize(SerializedGameData& sgd) const +void noFire::serialize(SerializedGameData& sgd) const { - noCoordBase::Serialize(sgd); + noCoordBase::serialize(sgd); sgd.PushBool(isBig); sgd.pushEvent(dead_event); diff --git a/libs/s25main/nodeObjs/noFire.h b/libs/s25main/nodeObjs/noFire.h index 2ad7d64d67..f923b8ff56 100644 --- a/libs/s25main/nodeObjs/noFire.h +++ b/libs/s25main/nodeObjs/noFire.h @@ -29,7 +29,7 @@ class noFire : public noCoordBase ~noFire() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Fire; } diff --git a/libs/s25main/nodeObjs/noFlag.cpp b/libs/s25main/nodeObjs/noFlag.cpp index 7c3631bc1c..d065a8a344 100644 --- a/libs/s25main/nodeObjs/noFlag.cpp +++ b/libs/s25main/nodeObjs/noFlag.cpp @@ -88,9 +88,9 @@ void noFlag::destroy() noRoadNode::destroy(); } -void noFlag::Serialize(SerializedGameData& sgd) const +void noFlag::serialize(SerializedGameData& sgd) const { - noRoadNode::Serialize(sgd); + noRoadNode::serialize(sgd); sgd.pushEnum(flagtype); sgd.pushObjectContainer(wares, true); diff --git a/libs/s25main/nodeObjs/noFlag.h b/libs/s25main/nodeObjs/noFlag.h index fad386988d..d4a2eb7447 100644 --- a/libs/s25main/nodeObjs/noFlag.h +++ b/libs/s25main/nodeObjs/noFlag.h @@ -24,7 +24,7 @@ class noFlag : public noRoadNode ~noFlag() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Flag; } FlagType getFlagType() const { return flagtype; } diff --git a/libs/s25main/nodeObjs/noGrainfield.cpp b/libs/s25main/nodeObjs/noGrainfield.cpp index 990f4691a1..48db5b8e5c 100644 --- a/libs/s25main/nodeObjs/noGrainfield.cpp +++ b/libs/s25main/nodeObjs/noGrainfield.cpp @@ -36,9 +36,9 @@ void noGrainfield::destroy() noCoordBase::destroy(); } -void noGrainfield::Serialize(SerializedGameData& sgd) const +void noGrainfield::serialize(SerializedGameData& sgd) const { - noCoordBase::Serialize(sgd); + noCoordBase::serialize(sgd); sgd.PushUnsignedChar(type); sgd.pushEnum(state); diff --git a/libs/s25main/nodeObjs/noGrainfield.h b/libs/s25main/nodeObjs/noGrainfield.h index 9046400684..e6db23b038 100644 --- a/libs/s25main/nodeObjs/noGrainfield.h +++ b/libs/s25main/nodeObjs/noGrainfield.h @@ -38,7 +38,7 @@ class noGrainfield : public noCoordBase ~noGrainfield() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Grainfield; } diff --git a/libs/s25main/nodeObjs/noGranite.cpp b/libs/s25main/nodeObjs/noGranite.cpp index 680fc8ec5e..2a60d571eb 100644 --- a/libs/s25main/nodeObjs/noGranite.cpp +++ b/libs/s25main/nodeObjs/noGranite.cpp @@ -14,9 +14,9 @@ noGranite::noGranite(const GraniteType type, const unsigned char state) : noBase(NodalObjectType::Granite), type(type), state(state) {} -void noGranite::Serialize(SerializedGameData& sgd) const +void noGranite::serialize(SerializedGameData& sgd) const { - noBase::Serialize(sgd); + noBase::serialize(sgd); sgd.pushEnum(type); sgd.PushUnsignedChar(state); diff --git a/libs/s25main/nodeObjs/noGranite.h b/libs/s25main/nodeObjs/noGranite.h index bbc7891495..d9be0bff30 100644 --- a/libs/s25main/nodeObjs/noGranite.h +++ b/libs/s25main/nodeObjs/noGranite.h @@ -19,7 +19,7 @@ class noGranite final : public noBase noGranite(SerializedGameData& sgd, unsigned obj_id); void destroy() override {} - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Granite; } diff --git a/libs/s25main/nodeObjs/noGrapefield.cpp b/libs/s25main/nodeObjs/noGrapefield.cpp index ccf8e60351..3cfd946045 100644 --- a/libs/s25main/nodeObjs/noGrapefield.cpp +++ b/libs/s25main/nodeObjs/noGrapefield.cpp @@ -40,9 +40,9 @@ void noGrapefield::destroy() noCoordBase::destroy(); } -void noGrapefield::Serialize(SerializedGameData& sgd) const +void noGrapefield::serialize(SerializedGameData& sgd) const { - noCoordBase::Serialize(sgd); + noCoordBase::serialize(sgd); sgd.PushUnsignedChar(type); sgd.pushEnum(state); diff --git a/libs/s25main/nodeObjs/noGrapefield.h b/libs/s25main/nodeObjs/noGrapefield.h index 96e2ce08ae..341601ce84 100644 --- a/libs/s25main/nodeObjs/noGrapefield.h +++ b/libs/s25main/nodeObjs/noGrapefield.h @@ -38,7 +38,7 @@ class noGrapefield : public noCoordBase ~noGrapefield() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Grapefield; } diff --git a/libs/s25main/nodeObjs/noMovable.cpp b/libs/s25main/nodeObjs/noMovable.cpp index 674186fe46..ff714ee178 100644 --- a/libs/s25main/nodeObjs/noMovable.cpp +++ b/libs/s25main/nodeObjs/noMovable.cpp @@ -19,9 +19,9 @@ noMovable::noMovable(const NodalObjectType nop, const MapPoint pos) : noCoordBase(nop, pos), curMoveDir(Direction::SouthEast), ascent(0), moving(false), current_ev(nullptr) {} -void noMovable::Serialize(SerializedGameData& sgd) const +void noMovable::serialize(SerializedGameData& sgd) const { - noCoordBase::Serialize(sgd); + noCoordBase::serialize(sgd); sgd.pushEnum(curMoveDir); sgd.PushUnsignedChar(ascent); diff --git a/libs/s25main/nodeObjs/noMovable.h b/libs/s25main/nodeObjs/noMovable.h index b3bd2e1043..2be9c4a21a 100644 --- a/libs/s25main/nodeObjs/noMovable.h +++ b/libs/s25main/nodeObjs/noMovable.h @@ -42,7 +42,7 @@ class noMovable : public noCoordBase noMovable(NodalObjectType nop, MapPoint pos); noMovable(SerializedGameData& sgd, unsigned obj_id); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; /// Sets the position. Usually not required as all position changes are done by the walk functions void setPos(const MapPoint& pos) { this->pos = pos; } diff --git a/libs/s25main/nodeObjs/noRoadNode.cpp b/libs/s25main/nodeObjs/noRoadNode.cpp index c52c0187a5..982cfb82a8 100644 --- a/libs/s25main/nodeObjs/noRoadNode.cpp +++ b/libs/s25main/nodeObjs/noRoadNode.cpp @@ -24,9 +24,9 @@ void noRoadNode::destroy() noCoordBase::destroy(); } -void noRoadNode::Serialize(SerializedGameData& sgd) const +void noRoadNode::serialize(SerializedGameData& sgd) const { - noCoordBase::Serialize(sgd); + noCoordBase::serialize(sgd); sgd.PushUnsignedChar(player); diff --git a/libs/s25main/nodeObjs/noRoadNode.h b/libs/s25main/nodeObjs/noRoadNode.h index 5cc3988d95..5e23ee2319 100644 --- a/libs/s25main/nodeObjs/noRoadNode.h +++ b/libs/s25main/nodeObjs/noRoadNode.h @@ -41,7 +41,7 @@ class noRoadNode : public noCoordBase ~noRoadNode() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; RoadSegment* getRoute(const Direction dir) const { return routes[dir]; } void setRoute(const Direction dir, RoadSegment* route) { routes[dir] = route; } diff --git a/libs/s25main/nodeObjs/noShip.cpp b/libs/s25main/nodeObjs/noShip.cpp index 02c96f482d..1d360fcc3f 100644 --- a/libs/s25main/nodeObjs/noShip.cpp +++ b/libs/s25main/nodeObjs/noShip.cpp @@ -66,9 +66,9 @@ noShip::noShip(const MapPoint pos, const unsigned char player) noShip::~noShip() = default; -void noShip::Serialize(SerializedGameData& sgd) const +void noShip::serialize(SerializedGameData& sgd) const { - noMovable::Serialize(sgd); + noMovable::serialize(sgd); sgd.PushUnsignedChar(ownerId_); sgd.pushEnum(state); diff --git a/libs/s25main/nodeObjs/noShip.h b/libs/s25main/nodeObjs/noShip.h index 7660abd42f..e444a0128a 100644 --- a/libs/s25main/nodeObjs/noShip.h +++ b/libs/s25main/nodeObjs/noShip.h @@ -133,7 +133,7 @@ class noShip : public noMovable ~noShip() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; void destroy() override; GO_Type getGOT() const final { return GO_Type::Ship; } diff --git a/libs/s25main/nodeObjs/noShipBuildingSite.cpp b/libs/s25main/nodeObjs/noShipBuildingSite.cpp index f05f5339a8..a01c77b036 100644 --- a/libs/s25main/nodeObjs/noShipBuildingSite.cpp +++ b/libs/s25main/nodeObjs/noShipBuildingSite.cpp @@ -28,9 +28,9 @@ void noShipBuildingSite::destroy() noCoordBase::destroy(); } -void noShipBuildingSite::Serialize(SerializedGameData& sgd) const +void noShipBuildingSite::serialize(SerializedGameData& sgd) const { - noCoordBase::Serialize(sgd); + noCoordBase::serialize(sgd); sgd.PushUnsignedChar(player); sgd.PushUnsignedChar(progress); diff --git a/libs/s25main/nodeObjs/noShipBuildingSite.h b/libs/s25main/nodeObjs/noShipBuildingSite.h index 9aeaecdaf0..e6dac9a4b7 100644 --- a/libs/s25main/nodeObjs/noShipBuildingSite.h +++ b/libs/s25main/nodeObjs/noShipBuildingSite.h @@ -15,7 +15,7 @@ class noShipBuildingSite : public noCoordBase noShipBuildingSite(SerializedGameData& sgd, unsigned obj_id); ~noShipBuildingSite() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Shipbuildingsite; } /// Gibt den Eigentümer zurück diff --git a/libs/s25main/nodeObjs/noSign.cpp b/libs/s25main/nodeObjs/noSign.cpp index b17d9629c2..5257141fa1 100644 --- a/libs/s25main/nodeObjs/noSign.cpp +++ b/libs/s25main/nodeObjs/noSign.cpp @@ -23,9 +23,9 @@ noSign::noSign(const MapPoint pos, Resource resource) this->resource.setType(ResourceType::Nothing); } -void noSign::Serialize(SerializedGameData& sgd) const +void noSign::serialize(SerializedGameData& sgd) const { - noDisappearingEnvObject::Serialize(sgd); + noDisappearingEnvObject::serialize(sgd); sgd.PushUnsignedChar(resource.getValue()); } diff --git a/libs/s25main/nodeObjs/noSign.h b/libs/s25main/nodeObjs/noSign.h index c182dc36ae..14ba3ecb65 100644 --- a/libs/s25main/nodeObjs/noSign.h +++ b/libs/s25main/nodeObjs/noSign.h @@ -15,7 +15,7 @@ class noSign : public noDisappearingEnvObject noSign(MapPoint pos, Resource resource); noSign(SerializedGameData& sgd, unsigned obj_id); - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Sign; } diff --git a/libs/s25main/nodeObjs/noSkeleton.cpp b/libs/s25main/nodeObjs/noSkeleton.cpp index 95fe870dcd..e17c467b4f 100644 --- a/libs/s25main/nodeObjs/noSkeleton.cpp +++ b/libs/s25main/nodeObjs/noSkeleton.cpp @@ -28,9 +28,9 @@ void noSkeleton::destroy() noCoordBase::destroy(); } -void noSkeleton::Serialize(SerializedGameData& sgd) const +void noSkeleton::serialize(SerializedGameData& sgd) const { - noCoordBase::Serialize(sgd); + noCoordBase::serialize(sgd); sgd.PushUnsignedChar(type); sgd.pushEvent(current_event); diff --git a/libs/s25main/nodeObjs/noSkeleton.h b/libs/s25main/nodeObjs/noSkeleton.h index 35c63d8af5..cd9fa6cb54 100644 --- a/libs/s25main/nodeObjs/noSkeleton.h +++ b/libs/s25main/nodeObjs/noSkeleton.h @@ -18,7 +18,7 @@ class noSkeleton : public noCoordBase ~noSkeleton() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Skeleton; } diff --git a/libs/s25main/nodeObjs/noStaticObject.cpp b/libs/s25main/nodeObjs/noStaticObject.cpp index ff46697433..b1a3b99eb0 100644 --- a/libs/s25main/nodeObjs/noStaticObject.cpp +++ b/libs/s25main/nodeObjs/noStaticObject.cpp @@ -41,9 +41,9 @@ noStaticObject::noStaticObject(SerializedGameData& sgd, const unsigned obj_id) : noCoordBase(sgd, obj_id), id(sgd.PopUnsignedShort()), file(sgd.PopUnsignedShort()), size(sgd.PopUnsignedChar()) {} -void noStaticObject::Serialize(SerializedGameData& sgd) const +void noStaticObject::serialize(SerializedGameData& sgd) const { - noCoordBase::Serialize(sgd); + noCoordBase::serialize(sgd); sgd.PushUnsignedShort(id); sgd.PushUnsignedShort(file); diff --git a/libs/s25main/nodeObjs/noStaticObject.h b/libs/s25main/nodeObjs/noStaticObject.h index fc1b2ef54a..343c1e3921 100644 --- a/libs/s25main/nodeObjs/noStaticObject.h +++ b/libs/s25main/nodeObjs/noStaticObject.h @@ -21,7 +21,7 @@ class noStaticObject : public noCoordBase noStaticObject(SerializedGameData& sgd, unsigned obj_id); void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const override { return GO_Type::Staticobject; } /// gibt die Item-ID zurück (nr in der jeweiligen File) diff --git a/libs/s25main/nodeObjs/noTree.cpp b/libs/s25main/nodeObjs/noTree.cpp index 16ed5fe720..97f6108701 100644 --- a/libs/s25main/nodeObjs/noTree.cpp +++ b/libs/s25main/nodeObjs/noTree.cpp @@ -51,9 +51,9 @@ void noTree::destroy() noCoordBase::destroy(); } -void noTree::Serialize(SerializedGameData& sgd) const +void noTree::serialize(SerializedGameData& sgd) const { - noCoordBase::Serialize(sgd); + noCoordBase::serialize(sgd); sgd.PushUnsignedChar(type); sgd.PushUnsignedChar(size); diff --git a/libs/s25main/nodeObjs/noTree.h b/libs/s25main/nodeObjs/noTree.h index b331026483..10ea3e5331 100644 --- a/libs/s25main/nodeObjs/noTree.h +++ b/libs/s25main/nodeObjs/noTree.h @@ -71,7 +71,7 @@ class noTree : public noCoordBase ~noTree() override; void destroy() override; - void Serialize(SerializedGameData& sgd) const override; + void serialize(SerializedGameData& sgd) const override; GO_Type getGOT() const final { return GO_Type::Tree; } diff --git a/libs/s25main/random/Random.cpp b/libs/s25main/random/Random.cpp index a20cb9ce98..a1e9e5ef4d 100644 --- a/libs/s25main/random/Random.cpp +++ b/libs/s25main/random/Random.cpp @@ -99,7 +99,7 @@ std::vector::RandomEntry> Random::GetAsyncLog() ////////////////////////////////////////////////////////////////////////// template -void Random::RandomEntry::Serialize(Serializer& ser) const +void Random::RandomEntry::serialize(Serializer& ser) const { ser.PushUnsignedInt(counter); ser.PushSignedInt(maxExcl); @@ -112,7 +112,7 @@ void Random::RandomEntry::Serialize(Serializer& ser) const } template -void Random::RandomEntry::Deserialize(Serializer& ser) +void Random::RandomEntry::deserialize(Serializer& ser) { counter = ser.PopUnsignedInt(); maxExcl = ser.PopSignedInt(); diff --git a/libs/s25main/random/Random.h b/libs/s25main/random/Random.h index c0d1201f38..1315540625 100644 --- a/libs/s25main/random/Random.h +++ b/libs/s25main/random/Random.h @@ -51,8 +51,8 @@ class Random : public Singleton> : counter(counter), maxExcl(maxExcl), rngState(rngState), srcName(ctx.srcName), srcLine(ctx.srcLine), objId(ctx.objId){}; - void Serialize(Serializer& ser) const; - void Deserialize(Serializer& ser); + void serialize(Serializer& ser) const; + void deserialize(Serializer& ser); int getValue() const; }; diff --git a/libs/s25main/world/MapSerializer.cpp b/libs/s25main/world/MapSerializer.cpp index 8ca2f2803f..3329593a17 100644 --- a/libs/s25main/world/MapSerializer.cpp +++ b/libs/s25main/world/MapSerializer.cpp @@ -14,7 +14,7 @@ #include #include -void MapSerializer::Serialize(const GameWorldBase& world, SerializedGameData& sgd) +void MapSerializer::serialize(const GameWorldBase& world, SerializedGameData& sgd) { // Headinformationen helpers::pushPoint(sgd, world.getSize()); @@ -26,7 +26,7 @@ void MapSerializer::Serialize(const GameWorldBase& world, SerializedGameData& sg const unsigned numPlayers = world.getNumPlayers(); for(const auto& node : world.nodes) { - node.Serialize(sgd, numPlayers, world.getDescription()); + node.serialize(sgd, numPlayers, world.getDescription()); } // Katapultsteine serialisieren @@ -66,7 +66,7 @@ void MapSerializer::Serialize(const GameWorldBase& world, SerializedGameData& sg Serializer luaSaveState; try { - if(!world.getLua().Serialize(luaSaveState)) + if(!world.getLua().serialize(luaSaveState)) throw SerializedGameData::Error(_("Failed to save lua state!")); } catch(const std::exception& e) { @@ -79,7 +79,7 @@ void MapSerializer::Serialize(const GameWorldBase& world, SerializedGameData& sg } } -void MapSerializer::Deserialize(GameWorldBase& world, SerializedGameData& sgd, Game& game, +void MapSerializer::deserialize(GameWorldBase& world, SerializedGameData& sgd, Game& game, ILocalGameState& localgameState) { // Initialisierungen @@ -116,7 +116,7 @@ void MapSerializer::Deserialize(GameWorldBase& world, SerializedGameData& sgd, G const unsigned numPlayers = world.getNumPlayers(); for(auto& node : world.nodes) { - node.Deserialize(sgd, numPlayers, world.getDescription(), landscapeTerrains); + node.deserialize(sgd, numPlayers, world.getDescription(), landscapeTerrains); curPos.x++; if(curPos.x >= world.getWidth()) { @@ -240,7 +240,7 @@ void MapSerializer::Deserialize(GameWorldBase& world, SerializedGameData& sgd, G throw SerializedGameData::Error(_("Wrong version for lua script.")); try { - if(!lua->Deserialize(luaSaveState)) + if(!lua->deserialize(luaSaveState)) throw SerializedGameData::Error(_("Lua load callback returned failure!")); } catch(const std::exception& e) { diff --git a/libs/s25main/world/MapSerializer.h b/libs/s25main/world/MapSerializer.h index 508015e92e..68071ecb48 100644 --- a/libs/s25main/world/MapSerializer.h +++ b/libs/s25main/world/MapSerializer.h @@ -12,6 +12,6 @@ class ILocalGameState; class MapSerializer { public: - static void Serialize(const GameWorldBase& world, SerializedGameData& sgd); - static void Deserialize(GameWorldBase& world, SerializedGameData& sgd, Game& game, ILocalGameState& localgameState); + static void serialize(const GameWorldBase& world, SerializedGameData& sgd); + static void deserialize(GameWorldBase& world, SerializedGameData& sgd, Game& game, ILocalGameState& localgameState); }; diff --git a/libs/s25main/world/TradePath.cpp b/libs/s25main/world/TradePath.cpp index 7679d504a7..7304644216 100644 --- a/libs/s25main/world/TradePath.cpp +++ b/libs/s25main/world/TradePath.cpp @@ -14,7 +14,7 @@ TradePath::TradePath(SerializedGameData& sgd) : start(sgd.popMapPoint()), goal(s } } -void TradePath::Serialize(SerializedGameData& sgd) const +void TradePath::serialize(SerializedGameData& sgd) const { helpers::pushPoint(sgd, start); helpers::pushPoint(sgd, goal); diff --git a/libs/s25main/world/TradePath.h b/libs/s25main/world/TradePath.h index 88066599d0..5498d1bde2 100644 --- a/libs/s25main/world/TradePath.h +++ b/libs/s25main/world/TradePath.h @@ -23,5 +23,5 @@ struct TradePath {} TradePath(SerializedGameData& sgd); - void Serialize(SerializedGameData& sgd) const; + void serialize(SerializedGameData& sgd) const; }; diff --git a/libs/s25main/world/TradeRoute.cpp b/libs/s25main/world/TradeRoute.cpp index 8a6ab6319b..e1b8e627ef 100644 --- a/libs/s25main/world/TradeRoute.cpp +++ b/libs/s25main/world/TradeRoute.cpp @@ -17,9 +17,9 @@ TradeRoute::TradeRoute(SerializedGameData& sgd, const GameWorld& world, const un : world(world), player(player), path(sgd), curPos(sgd.popMapPoint()), curRouteIdx(sgd.PopUnsignedInt()) {} -void TradeRoute::Serialize(SerializedGameData& sgd) const +void TradeRoute::serialize(SerializedGameData& sgd) const { - path.Serialize(sgd); + path.serialize(sgd); helpers::pushPoint(sgd, curPos); sgd.PushUnsignedInt(curRouteIdx); } diff --git a/libs/s25main/world/TradeRoute.h b/libs/s25main/world/TradeRoute.h index fd41c6613a..48543ae948 100644 --- a/libs/s25main/world/TradeRoute.h +++ b/libs/s25main/world/TradeRoute.h @@ -27,7 +27,7 @@ class TradeRoute TradeRoute(const GameWorld& world, unsigned char player, const MapPoint& start, const MapPoint& goal); TradeRoute(SerializedGameData& sgd, const GameWorld& world, unsigned char player); - void Serialize(SerializedGameData& sgd) const; + void serialize(SerializedGameData& sgd) const; /// Gets the next direction the caravane has to take, TradeDirection::ReachedGoal or std::nullopt_t helpers::OptionalEnum getNextDir(); diff --git a/tests/s25Main/UI/testAnimations.cpp b/tests/s25Main/UI/testAnimations.cpp index 34215b9def..466417ae6e 100644 --- a/tests/s25Main/UI/testAnimations.cpp +++ b/tests/s25Main/UI/testAnimations.cpp @@ -661,7 +661,7 @@ BOOST_AUTO_TEST_CASE(MoveAni) BOOST_AUTO_TEST_CASE(MoveAniScale) { MockupVideoDriver* video = uiHelper::getVideoDriver(); - auto* dsk = WINDOWMANAGER.Switch(std::make_unique(nullptr)); + auto* dsk = WINDOWMANAGER.switchTo(std::make_unique(nullptr)); WINDOWMANAGER.draw(); bt = dsk->addTextButton(0, DrawPoint(10, 20), Extent(100, 150), TextureColor::Red1, "", NormalFont); ctrlButton* btReference = diff --git a/tests/s25Main/UI/testDskGameLobby.cpp b/tests/s25Main/UI/testDskGameLobby.cpp index 2588a20aa5..9ddae687a0 100644 --- a/tests/s25Main/UI/testDskGameLobby.cpp +++ b/tests/s25Main/UI/testDskGameLobby.cpp @@ -52,7 +52,7 @@ BOOST_FIXTURE_TEST_CASE(LobbyChat, uiHelper::Fixture) // TODO: How to trigger through dskGameLobby? client->sendChat(""); - auto* desktop = WINDOWMANAGER.Switch(std::make_unique( + auto* desktop = WINDOWMANAGER.switchTo(std::make_unique( ServerType::Lobby, std::shared_ptr(&gameLobby, [](auto) {}), 0, std::move(client))); auto* ci = dynamic_cast(desktop); auto* li = dynamic_cast(desktop); diff --git a/tests/s25Main/UI/testWindowManager.cpp b/tests/s25Main/UI/testWindowManager.cpp index f27a49ba63..9378b8ba43 100644 --- a/tests/s25Main/UI/testWindowManager.cpp +++ b/tests/s25Main/UI/testWindowManager.cpp @@ -46,7 +46,7 @@ struct WMFixture : mock::cleanup TestDesktop* dsk; WMFixture() : video(uiHelper::getVideoDriver()) { - dsk = static_cast(WINDOWMANAGER.Switch(std::make_unique())); + dsk = static_cast(WINDOWMANAGER.switchTo(std::make_unique())); MOCK_EXPECT(dsk->msgMouseMove).once().returns(true); MOCK_EXPECT(dsk->msgLeftDown).once().returns(true); MOCK_EXPECT(dsk->msgLeftUp).once().returns(true); diff --git a/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.cpp b/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.cpp index 14bee468ed..690e793c2b 100644 --- a/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.cpp +++ b/tests/s25Main/UI/uiHelper/uiHelper/uiHelpers.cpp @@ -34,7 +34,7 @@ void initGUITests() LOADER.loadDummyGUIFiles(); LOADER.loadDummySoundFiles(); BOOST_TEST_CHECKPOINT("Switch to Desktop"); - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); BOOST_TEST_CHECKPOINT("Dummy Draw"); WINDOWMANAGER.draw(); logAcc.clearLog(); @@ -60,7 +60,7 @@ Fixture::~Fixture() if(!dynamic_cast(WINDOWMANAGER.getCurrentDesktop()) || WINDOWMANAGER.getTopMostWindow()) { // Switch back to new, empty desktop to clean up active windows - WINDOWMANAGER.Switch(std::make_unique()); + WINDOWMANAGER.switchTo(std::make_unique()); WINDOWMANAGER.draw(); } } diff --git a/tests/s25Main/integration/testDisappearingMapObjects.cpp b/tests/s25Main/integration/testDisappearingMapObjects.cpp index b54ec420f6..ff86d6c9af 100644 --- a/tests/s25Main/integration/testDisappearingMapObjects.cpp +++ b/tests/s25Main/integration/testDisappearingMapObjects.cpp @@ -43,7 +43,7 @@ struct DummyWorker : GameObject // LCOV_EXCL_START void destroy() override {} - void Serialize(SerializedGameData&) const override {} + void serialize(SerializedGameData&) const override {} GO_Type getGOT() const final { return GO_Type::NofGeologist; } // LCOV_EXCL_STOP }; diff --git a/tests/s25Main/integration/testDskGameInterface.cpp b/tests/s25Main/integration/testDskGameInterface.cpp index cc88e8f7b7..f0aa6df64c 100644 --- a/tests/s25Main/integration/testDskGameInterface.cpp +++ b/tests/s25Main/integration/testDskGameInterface.cpp @@ -50,7 +50,7 @@ struct GameInterfaceFixture : uiHelper::Fixture GameInterfaceFixture() { gameDesktop = static_cast( - WINDOWMANAGER.Switch(std::make_unique(worldFixture.game))); + WINDOWMANAGER.switchTo(std::make_unique(worldFixture.game))); WINDOWMANAGER.draw(); view = &gameDesktop->getView(); } diff --git a/tests/s25Main/integration/testGameCommands.cpp b/tests/s25Main/integration/testGameCommands.cpp index 1e05b21370..846d08595e 100644 --- a/tests/s25Main/integration/testGameCommands.cpp +++ b/tests/s25Main/integration/testGameCommands.cpp @@ -83,12 +83,12 @@ BOOST_AUTO_TEST_CASE(SoldierRankCommandsRejectInvalidSerializedRank) const auto count = rttr::test::randomValue(); gc::Deserializer troopLimitCommand; - TestSetTroopLimit(pt, invalidRank, count).Serialize(troopLimitCommand); - BOOST_REQUIRE_THROW(gc::GameCommand::Deserialize(troopLimitCommand), std::range_error); + TestSetTroopLimit(pt, invalidRank, count).serialize(troopLimitCommand); + BOOST_REQUIRE_THROW(gc::GameCommand::deserialize(troopLimitCommand), std::range_error); gc::Deserializer reserveCommand; - TestChangeReserve(pt, invalidRank, count).Serialize(reserveCommand); - BOOST_REQUIRE_THROW(gc::GameCommand::Deserialize(reserveCommand), std::range_error); + TestChangeReserve(pt, invalidRank, count).serialize(reserveCommand); + BOOST_REQUIRE_THROW(gc::GameCommand::deserialize(reserveCommand), std::range_error); } BOOST_FIXTURE_TEST_CASE(PlaceFlagTest, WorldWithGCExecution2P) diff --git a/tests/s25Main/integration/testGameEvents.cpp b/tests/s25Main/integration/testGameEvents.cpp index bad0b13a8d..f5ea1a1de6 100644 --- a/tests/s25Main/integration/testGameEvents.cpp +++ b/tests/s25Main/integration/testGameEvents.cpp @@ -30,7 +30,7 @@ class TestEventHandler : public GameObject void handleEvent(unsigned evId) override { handledEventIds.push_back(evId); } // LCOV_EXCL_START void destroy() override {} - void Serialize(SerializedGameData&) const override {} + void serialize(SerializedGameData&) const override {} GO_Type getGOT() const final { return GO_Type::Staticobject; } // LCOV_EXCL_STOP }; @@ -145,7 +145,7 @@ class TestLogKill final : public GameObject } // LCOV_EXCL_START void destroy() override { destroyNum++; } - void Serialize(SerializedGameData&) const override {} + void serialize(SerializedGameData&) const override {} GO_Type getGOT() const final { return GO_Type::Staticobject; } // LCOV_EXCL_STOP }; diff --git a/tests/s25Main/integration/testSerialization.cpp b/tests/s25Main/integration/testSerialization.cpp index aad2ef617b..12f5fc2f1e 100644 --- a/tests/s25Main/integration/testSerialization.cpp +++ b/tests/s25Main/integration/testSerialization.cpp @@ -195,10 +195,10 @@ BOOST_AUTO_TEST_CASE(SerializeGGS) ggs.setSelection(addon->getId(), rttr::test::randomValue(0u, addon->getNumOptions() - 1)); } ::Serializer ser; - ggs.Serialize(ser); + ggs.serialize(ser); ::Serializer loader(ser.GetData(), ser.GetLength()); GlobalGameSettings ggsLoaded; - ggsLoaded.Deserialize(loader); + ggsLoaded.deserialize(loader); BOOST_TEST(ggs.speed == ggsLoaded.speed); BOOST_TEST(ggs.objective == ggsLoaded.objective); BOOST_TEST(ggs.startWares == ggsLoaded.startWares); @@ -226,7 +226,7 @@ BOOST_AUTO_TEST_CASE(LegacyInexhaustibleMinesDeserializeMigratesToPerMineBehavio Serializer loader(ser.GetData(), ser.GetLength()); GlobalGameSettings ggsLoaded; - ggsLoaded.Deserialize(loader); + ggsLoaded.deserialize(loader); for(const BuildingType mineType : {BuildingType::GraniteMine, BuildingType::CoalMine, BuildingType::IronMine, BuildingType::GoldMine}) @@ -250,7 +250,7 @@ BOOST_AUTO_TEST_CASE(LegacyInexhaustibleMinesDeserializeAlsoMigratesLegacyGranit Serializer loader(ser.GetData(), ser.GetLength()); GlobalGameSettings ggsLoaded; - ggsLoaded.Deserialize(loader); + ggsLoaded.deserialize(loader); for(const BuildingType mineType : {BuildingType::GraniteMine, BuildingType::CoalMine, BuildingType::IronMine, BuildingType::GoldMine}) @@ -269,7 +269,7 @@ BOOST_AUTO_TEST_CASE(LegacyInexhaustibleMinesDeserializeDoesNotOverridePerMineBe Serializer loader(ser.GetData(), ser.GetLength()); GlobalGameSettings ggsLoaded; - ggsLoaded.Deserialize(loader); + ggsLoaded.deserialize(loader); BOOST_TEST(getMineResourceBehavior(ggsLoaded, BuildingType::CoalMine) == MineResourceBehavior::S4LikeExhaustion); BOOST_TEST(getMineResourceBehavior(ggsLoaded, BuildingType::GraniteMine) == MineResourceBehavior::Inexhaustible); diff --git a/tests/s25Main/integration/testWorldFixtures.cpp b/tests/s25Main/integration/testWorldFixtures.cpp index ae03377001..ebf741abe5 100644 --- a/tests/s25Main/integration/testWorldFixtures.cpp +++ b/tests/s25Main/integration/testWorldFixtures.cpp @@ -11,7 +11,7 @@ struct TestGO : GameObject { // LCOV_EXCL_START void destroy() override final{}; - void Serialize(SerializedGameData&) const override final{}; + void serialize(SerializedGameData&) const override final{}; GO_Type getGOT() const override final { return GO_Type::Animal; } // LCOV_EXCL_STOP diff --git a/tests/s25Main/lua/testLua.cpp b/tests/s25Main/lua/testLua.cpp index bd68ee4936..646d2b92f0 100644 --- a/tests/s25Main/lua/testLua.cpp +++ b/tests/s25Main/lua/testLua.cpp @@ -686,9 +686,9 @@ BOOST_AUTO_TEST_CASE(WorldEvents) LuaInterfaceGame& lua = world.getLua(); lua.eventStart(true); Serializer serData; - BOOST_TEST_REQUIRE(lua.Serialize(serData)); + BOOST_TEST_REQUIRE(lua.serialize(serData)); BOOST_TEST_REQUIRE(serData.GetLength() == 0u); - BOOST_TEST_REQUIRE(lua.Deserialize(serData)); + BOOST_TEST_REQUIRE(lua.deserialize(serData)); lua.eventOccupied(1, pt1); lua.eventAttack(0, 1, 5); lua.eventExplored(1, pt2, 0); @@ -711,7 +711,7 @@ BOOST_AUTO_TEST_CASE(WorldEvents) executeLua("function onSave(serializer)\n" "serializer:PushInt(42)\n return false\nend"); serData.Clear(); - BOOST_TEST_REQUIRE(!lua.Serialize(serData)); + BOOST_TEST_REQUIRE(!lua.serialize(serData)); BOOST_TEST_REQUIRE(serData.GetLength() == 0u); executeLua("function onSave(serializer)\n" @@ -721,7 +721,7 @@ BOOST_AUTO_TEST_CASE(WorldEvents) "serializer:PushString('Hello World!')\n" "rttr:Log('saved')\n return true\nend"); serData.Clear(); - BOOST_TEST_REQUIRE(lua.Serialize(serData)); + BOOST_TEST_REQUIRE(lua.serialize(serData)); BOOST_TEST_REQUIRE(getLog() == "saved\n"); BOOST_TEST_REQUIRE(serData.GetLength() > 0u); @@ -731,31 +731,31 @@ BOOST_AUTO_TEST_CASE(WorldEvents) "assert(serializer:PopBool() == false)\n" "assert(serializer:PopString() == 'Hello World!')\n" "rttr:Log('loaded')\n return true\nend"); - BOOST_TEST_REQUIRE(lua.Deserialize(serData)); + BOOST_TEST_REQUIRE(lua.deserialize(serData)); BOOST_TEST_REQUIRE(getLog() == "loaded\n"); BOOST_TEST_REQUIRE(serData.GetBytesLeft() == 0u); // Errors in onSave/onLoad should result in false returned even with throw disabled executeLua("function onSave(serializer)\n serializer:PushInt(42)\n assert(false)\nend"); serData.Clear(); - BOOST_REQUIRE_THROW(lua.Serialize(serData), LuaExecutionError); + BOOST_REQUIRE_THROW(lua.serialize(serData), LuaExecutionError); BOOST_TEST_REQUIRE(getLog() != ""); lua.setThrowOnError(false); executeLua("function onSave(serializer)\n serializer:PushInt(42)\n assert(false)\nend"); serData.Clear(); - BOOST_TEST_REQUIRE(!lua.Serialize(serData)); + BOOST_TEST_REQUIRE(!lua.serialize(serData)); BOOST_TEST_REQUIRE(serData.GetLength() == 0u); BOOST_TEST_REQUIRE(getLog() != ""); // Error from C++ - BOOST_TEST_REQUIRE(!lua.Deserialize(serData)); + BOOST_TEST_REQUIRE(!lua.deserialize(serData)); BOOST_TEST_REQUIRE(getLog() != ""); // False returned executeLua("function onLoad(serializer)\n return false\nend"); - BOOST_TEST_REQUIRE(!lua.Deserialize(serData)); + BOOST_TEST_REQUIRE(!lua.deserialize(serData)); // Re-enable lua.setThrowOnError(true); diff --git a/tests/s25Main/worldFixtures/GCExecutor.h b/tests/s25Main/worldFixtures/GCExecutor.h index a94c24f2db..ce0f36ab7e 100644 --- a/tests/s25Main/worldFixtures/GCExecutor.h +++ b/tests/s25Main/worldFixtures/GCExecutor.h @@ -19,12 +19,12 @@ class GCExecutor : public GameCommandFactory { // Go through serialization to check if that works too gc::Deserializer ser; - gc->Serialize(ser); + gc->serialize(ser); gc.reset(); - gc = gc::GameCommand::Deserialize(ser); + gc = gc::GameCommand::deserialize(ser); BOOST_TEST_REQUIRE(ser.GetBytesLeft() == 0u); Serializer ser2; - gc->Serialize(ser2); + gc->serialize(ser2); BOOST_TEST_REQUIRE(ser2.GetLength() == ser.GetLength()); BOOST_TEST_REQUIRE(memcmp(ser2.GetData(), ser.GetData(), ser.GetLength()) == 0); gc->execute(getWorld(), curPlayer); From 5b9ad21764ef8bb839a2cd5f26f1fdae652d4e7d Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Mon, 16 Nov 2026 14:12:13 +0100 Subject: [PATCH 7/7] Rename remaining colliding methods and disambiguate lookups --- libs/s25main/HeadlessReplay.cpp | 2 +- libs/s25main/ILobbyClient.hpp | 2 +- libs/s25main/Replay.cpp | 2 +- libs/s25main/Replay.h | 2 +- libs/s25main/RoadSegment.h | 2 +- libs/s25main/RttrLobbyClient.cpp | 2 +- libs/s25main/RttrLobbyClient.hpp | 2 +- libs/s25main/ai/aijh/AIConstruction.cpp | 2 +- libs/s25main/ai/aijh/AIPlayerJH.cpp | 2 +- libs/s25main/controls/ctrlList.cpp | 2 +- libs/s25main/controls/ctrlList.h | 2 +- libs/s25main/desktops/dskGameLobby.cpp | 10 ++--- libs/s25main/figures/noFigure.cpp | 24 +++++------ libs/s25main/figures/noFigure.h | 2 +- libs/s25main/figures/nofActiveSoldier.cpp | 2 +- libs/s25main/figures/nofCarrier.cpp | 26 ++++++------ libs/s25main/figures/nofSoldier.cpp | 6 +-- libs/s25main/figures/nofWarehouseWorker.cpp | 2 +- libs/s25main/ingameWindows/iwBuildOrder.cpp | 8 ++-- libs/s25main/ingameWindows/iwMusicPlayer.cpp | 4 +- libs/s25main/mapGenerator/Harbors.cpp | 8 ++-- libs/s25main/mapGenerator/HeadQuarters.cpp | 2 +- libs/s25main/mapGenerator/Resources.cpp | 6 +-- libs/s25main/mapGenerator/Rivers.cpp | 2 +- libs/s25main/mapGenerator/TextureHelper.cpp | 2 +- libs/s25main/mapGenerator/TextureHelper.h | 2 +- libs/s25main/mapGenerator/Textures.cpp | 8 ++-- libs/s25main/network/GameClient.cpp | 2 +- libs/s25main/nodeObjs/noFlag.cpp | 2 +- libs/s25main/nodeObjs/noRoadNode.cpp | 2 +- libs/s25main/pathfinding/RoadPathFinder.cpp | 2 +- libs/s25main/world/MapBase.cpp | 2 +- libs/s25main/world/MapBase.h | 2 +- libs/s25main/world/MapLoader.cpp | 4 +- tests/legacyFiles/src/legacy/TerrainData.cpp | 4 +- tests/legacyFiles/src/legacy/TerrainData.h | 2 +- tests/s25Main/UI/testDskGameLobby.cpp | 4 +- tests/s25Main/integration/testAttacking.cpp | 2 +- .../integration/testSeaWorldCreation.cpp | 40 +++++++++---------- tests/s25Main/integration/testSeafaring.cpp | 8 ++-- .../s25Main/integration/testSerialization.cpp | 6 +-- tests/s25Main/mapGenerator/testHarbors.cpp | 6 +-- .../s25Main/mapGenerator/testHeadQuarters.cpp | 10 ++--- tests/s25Main/mapGenerator/testResources.cpp | 6 +-- tests/s25Main/mapGenerator/testRivers.cpp | 2 +- tests/s25Main/mapGenerator/testTextures.cpp | 18 ++++----- 46 files changed, 130 insertions(+), 130 deletions(-) diff --git a/libs/s25main/HeadlessReplay.cpp b/libs/s25main/HeadlessReplay.cpp index 2eb266f19b..c1917b86f7 100644 --- a/libs/s25main/HeadlessReplay.cpp +++ b/libs/s25main/HeadlessReplay.cpp @@ -16,7 +16,7 @@ HeadlessReplay::HeadlessReplay(const boost::filesystem::path& replayPath) { - if(!replay_.loadHeader(replayPath) || !replay_.LoadGameData(mapInfo_)) + if(!replay_.loadHeader(replayPath) || !replay_.loadGameData(mapInfo_)) { const std::string reason = replay_.getLastErrorMsg().empty() ? std::string("Unknown error") : replay_.getLastErrorMsg(); diff --git a/libs/s25main/ILobbyClient.hpp b/libs/s25main/ILobbyClient.hpp index 9d0c657bf7..d3ffd7172a 100644 --- a/libs/s25main/ILobbyClient.hpp +++ b/libs/s25main/ILobbyClient.hpp @@ -13,7 +13,7 @@ class ILobbyClient { public: virtual ~ILobbyClient() = default; - virtual bool IsLoggedIn() const = 0; + virtual bool isLoggedIn() const = 0; virtual void addListener(LobbyInterface* listener) = 0; virtual void removeListener(LobbyInterface* listener) = 0; virtual void sendServerJoinRequest() = 0; diff --git a/libs/s25main/Replay.cpp b/libs/s25main/Replay.cpp index 3cdd255d54..993053447e 100644 --- a/libs/s25main/Replay.cpp +++ b/libs/s25main/Replay.cpp @@ -255,7 +255,7 @@ bool Replay::loadHeader(const boost::filesystem::path& filepath) return true; } -bool Replay::LoadGameData(MapInfo& mapInfo) +bool Replay::loadGameData(MapInfo& mapInfo) { try { diff --git a/libs/s25main/Replay.h b/libs/s25main/Replay.h index af71120f83..067cbd43eb 100644 --- a/libs/s25main/Replay.h +++ b/libs/s25main/Replay.h @@ -68,7 +68,7 @@ class Replay : public SavedFile /// Load the header (containing map and player names) bool loadHeader(const boost::filesystem::path& filepath); /// Load the remaining data into the mapInfo - bool LoadGameData(MapInfo& mapInfo); + bool loadGameData(MapInfo& mapInfo); /// Record a chat message void addChatCommand(unsigned gf, uint8_t player, ChatDestination dest, const std::string& str); diff --git a/libs/s25main/RoadSegment.h b/libs/s25main/RoadSegment.h index 05471ce772..cbd1de757e 100644 --- a/libs/s25main/RoadSegment.h +++ b/libs/s25main/RoadSegment.h @@ -45,7 +45,7 @@ class RoadSegment : public GameObject /// Gibt Straßen-Typ zurück RoadType getRoadType() const { return rt; } /// Gibt die Länge der Staße zurück - unsigned GetLength() const { return route.size(); } + unsigned getLength() const { return route.size(); } /// gibt Flagge 1 zurück noRoadNode* getF1() const { return f1; } /// setzt Flagge 1 auf o diff --git a/libs/s25main/RttrLobbyClient.cpp b/libs/s25main/RttrLobbyClient.cpp index 4ebcbaca05..3e0c369f8f 100644 --- a/libs/s25main/RttrLobbyClient.cpp +++ b/libs/s25main/RttrLobbyClient.cpp @@ -7,7 +7,7 @@ RttrLobbyClient::RttrLobbyClient(LobbyClient& client) : client_(client) {} -bool RttrLobbyClient::IsLoggedIn() const +bool RttrLobbyClient::isLoggedIn() const { return client_.IsLoggedIn(); } diff --git a/libs/s25main/RttrLobbyClient.hpp b/libs/s25main/RttrLobbyClient.hpp index e08feee94b..a7f2301578 100644 --- a/libs/s25main/RttrLobbyClient.hpp +++ b/libs/s25main/RttrLobbyClient.hpp @@ -15,7 +15,7 @@ class RttrLobbyClient : public ILobbyClient public: explicit RttrLobbyClient(LobbyClient& client); - bool IsLoggedIn() const override; + bool isLoggedIn() const override; void addListener(LobbyInterface* listener) override; void removeListener(LobbyInterface* listener) override; void sendServerJoinRequest() override; diff --git a/libs/s25main/ai/aijh/AIConstruction.cpp b/libs/s25main/ai/aijh/AIConstruction.cpp index d33de6b08e..febc505580 100644 --- a/libs/s25main/ai/aijh/AIConstruction.cpp +++ b/libs/s25main/ai/aijh/AIConstruction.cpp @@ -123,7 +123,7 @@ void AIConstruction::setFlagsAlongRoad(const noRoadNode& roadNode, Direction dir curPos = aii.gwb.getNeighbour(curPos, roadSeg.getDir(isBwdDir, 0)); // Start after getting first neighbor (min distance == 2) // and skip last 2 points (min distance and last is flag) - for(unsigned i = 1; i + 2 < roadSeg.GetLength(); ++i) + for(unsigned i = 1; i + 2 < roadSeg.getLength(); ++i) { curPos = aii.gwb.getNeighbour(curPos, roadSeg.getDir(isBwdDir, i)); aii.SetFlag(curPos); diff --git a/libs/s25main/ai/aijh/AIPlayerJH.cpp b/libs/s25main/ai/aijh/AIPlayerJH.cpp index 2fd459f075..5f5b3c693e 100644 --- a/libs/s25main/ai/aijh/AIPlayerJH.cpp +++ b/libs/s25main/ai/aijh/AIPlayerJH.cpp @@ -1128,7 +1128,7 @@ void AIPlayerJH::handleRoadConstructionComplete(MapPoint pt, Direction dir) return; // does the roadsegment still exist? const RoadSegment* const roadSeg = flag->getRoute(dir); - if(!roadSeg || roadSeg->GetLength() < 4) // road too short to need flags + if(!roadSeg || roadSeg->getLength() < 4) // road too short to need flags return; // check if this road leads to a warehouseflag and if it does start setting flags from the warehouseflag else from // the new flag goal is to move roadsegments with a length of more than 2 away from the warehouse diff --git a/libs/s25main/controls/ctrlList.cpp b/libs/s25main/controls/ctrlList.cpp index 5d3219911a..bcd1f793cb 100644 --- a/libs/s25main/controls/ctrlList.cpp +++ b/libs/s25main/controls/ctrlList.cpp @@ -210,7 +210,7 @@ void ctrlList::resize(const Extent& newSize) Window::resize(newSize); } -void ctrlList::Swap(unsigned first, unsigned second) +void ctrlList::swap(unsigned first, unsigned second) { // Evtl Selection auf das jeweilige Element beibehalten? if(first == selection_) diff --git a/libs/s25main/controls/ctrlList.h b/libs/s25main/controls/ctrlList.h index 77ec774a8e..12866128d6 100644 --- a/libs/s25main/controls/ctrlList.h +++ b/libs/s25main/controls/ctrlList.h @@ -32,7 +32,7 @@ class ctrlList : public Window /// Get the value of the currently selected item const std::string& getSelItemText() const; /// Exchange the text of 2 items - void Swap(unsigned first, unsigned second); + void swap(unsigned first, unsigned second); /// Deletes an item. If the deleted item is selected then the selection is cleared. void remove(unsigned index); diff --git a/libs/s25main/desktops/dskGameLobby.cpp b/libs/s25main/desktops/dskGameLobby.cpp index 2a063a14d8..321a0a2735 100644 --- a/libs/s25main/desktops/dskGameLobby.cpp +++ b/libs/s25main/desktops/dskGameLobby.cpp @@ -191,7 +191,7 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam if(!isSinglePlayer()) { // Enable lobby chat when we are logged in - if(lobbyClient_ && lobbyClient_->IsLoggedIn()) + if(lobbyClient_ && lobbyClient_->isLoggedIn()) { ctrlOptionGroup* chatTab = addOptionGroup(ID_optChatTab, GroupSelectType::Check); chatTab->addTextButton(ID_btChatGame, DrawPoint(20, 320), Extent(178, 22), TextureColor::Green2, @@ -255,7 +255,7 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam combo->addItem(_("Economy mode")); // Lobby game? - if(lobbyClient_ && lobbyClient_->IsLoggedIn()) + if(lobbyClient_ && lobbyClient_->isLoggedIn()) { // Then add tournament modes as possible "objectives" for(const auto duration : TOURNAMENT_MODES_DURATION) @@ -348,7 +348,7 @@ dskGameLobby::dskGameLobby(ServerType serverType, std::shared_ptr gam } CI_GGSChanged(gameLobby_->getSettings()); - if(serverType == ServerType::Lobby && lobbyClient_ && lobbyClient_->IsLoggedIn()) + if(serverType == ServerType::Lobby && lobbyClient_ && lobbyClient_->isLoggedIn()) { lobbyClient_->addListener(this); lobbyClient_->sendServerJoinRequest(); @@ -694,7 +694,7 @@ void dskGameLobby::goBack() WINDOWMANAGER.switchTo(std::make_unique()); else if(serverType == ServerType::LAN) WINDOWMANAGER.switchTo(std::make_unique()); - else if(serverType == ServerType::Lobby && lobbyClient_ && lobbyClient_->IsLoggedIn()) + else if(serverType == ServerType::Lobby && lobbyClient_ && lobbyClient_->isLoggedIn()) WINDOWMANAGER.switchTo(std::make_unique()); else WINDOWMANAGER.switchTo(std::make_unique()); @@ -778,7 +778,7 @@ void dskGameLobby::msgEditEnter(const unsigned ctrl_id) edit->setText(""); if(gameChat->isVisible()) GAMECLIENT.commandChat(msg, ChatDestination::All); - else if(lobbyClient_ && lobbyClient_->IsLoggedIn() && lobbyChat->isVisible()) + else if(lobbyClient_ && lobbyClient_->isLoggedIn() && lobbyChat->isVisible()) lobbyClient_->sendChat(msg); } diff --git a/libs/s25main/figures/noFigure.cpp b/libs/s25main/figures/noFigure.cpp index aec2904c42..bad5ef37dd 100644 --- a/libs/s25main/figures/noFigure.cpp +++ b/libs/s25main/figures/noFigure.cpp @@ -124,9 +124,9 @@ noFigure::noFigure(SerializedGameData& sgd, const unsigned obj_id) } } -bool noFigure::IsSoldier() const +bool noFigure::isSoldier() const { - return isSoldier(job_); + return ::isSoldier(job_); } void noFigure::actAtFirst() @@ -263,7 +263,7 @@ void noFigure::walkToGoal() } // Straße abgelaufen oder noch gar keine Straße vorhanden? - if(!cur_rs || rs_pos == cur_rs->GetLength()) + if(!cur_rs || rs_pos == cur_rs->getLength()) { // Ziel erreicht? // Bei dem Träger können das beide Flaggen sein! @@ -464,7 +464,7 @@ void noFigure::startWandering(const unsigned burned_wh_id) // 3x rumirren und eine Flagge suchen, wenn dann keine gefunden wurde, stirbt die Figur wander_way = WANDER_WAY_MIN + RANDOM_RAND(WANDER_WAY_MAX - WANDER_WAY_MIN); // Soldaten sind härter im Nehmen - wander_tryings = IsSoldier() ? getStrandedSoldierReturnSearchTryings(world->getGGS()) : WANDER_TRYINGS; + wander_tryings = isSoldier() ? getStrandedSoldierReturnSearchTryings(world->getGGS()) : WANDER_TRYINGS; // Wenn wir stehen, zusätzlich noch loslaufen! if(waiting_for_free_node) @@ -546,7 +546,7 @@ void noFigure::wander() { // Soldaten sind härter im Nehmen const unsigned short wander_radius = - IsSoldier() ? getStrandedSoldierReturnSearchRadius(world->getGGS(), wander_tryings) : WANDER_RADIUS; + isSoldier() ? getStrandedSoldierReturnSearchRadius(world->getGGS(), wander_tryings) : WANDER_RADIUS; // Flaggen sammeln und dann zufällig eine auswählen const std::vector flags = @@ -711,23 +711,23 @@ void noFigure::correctSplitData(const RoadSegment* const rs2) // cur_rs entspricht Teilstück 1 ! // Wenn man sich auf den ersten Teilstück befindet... - if((rs_pos < cur_rs->GetLength() && !rs_dir) || (rs_pos > rs2->GetLength() && rs_dir)) + if((rs_pos < cur_rs->getLength() && !rs_dir) || (rs_pos > rs2->getLength() && rs_dir)) { // Nur Position berichtigen if(rs_dir) - rs_pos -= rs2->GetLength(); + rs_pos -= rs2->getLength(); } // Wenn man auf dem 2. steht, ... - else if((rs_pos > cur_rs->GetLength() && !rs_dir) || (rs_pos < rs2->GetLength() && rs_dir)) + else if((rs_pos > cur_rs->getLength() && !rs_dir) || (rs_pos < rs2->getLength() && rs_dir)) { // Position berichtigen (wenn man in umgekehrter Richtung läuft, beibehalten!) if(!rs_dir) - rs_pos -= cur_rs->GetLength(); + rs_pos -= cur_rs->getLength(); // wir laufen auf dem 2. Teilstück cur_rs = rs2; - } else if((rs_pos == cur_rs->GetLength() && !rs_dir) || (rs_pos == rs2->GetLength() && rs_dir)) + } else if((rs_pos == cur_rs->getLength() && !rs_dir) || (rs_pos == rs2->getLength() && rs_dir)) { // wir stehen genau in der Mitte // abhängig von der Richtung machen, in die man gerade läuft @@ -737,7 +737,7 @@ void noFigure::correctSplitData(const RoadSegment* const rs2) cur_rs = rs2; // und wir sind da noch am Anfang rs_pos = 0; - } else if(getCurMoveDir() == cur_rs->getRoute(cur_rs->GetLength() - 1) + 3u) + } else if(getCurMoveDir() == cur_rs->getRoute(cur_rs->getLength() - 1) + 3u) { // wir laufen auf dem 1. Teilstück @@ -896,7 +896,7 @@ void noFigure::removeFromInventory() } else { world->getPlayer(player).decreaseInventoryJob(job_, 1); - if(isSoldier(getJobType()) && hasArmor_) + if(::isSoldier(getJobType()) && hasArmor_) world->getPlayer(player).decreaseInventoryJob(jobEnumToAmoredSoldierEnum(getJobType()), 1); } } diff --git a/libs/s25main/figures/noFigure.h b/libs/s25main/figures/noFigure.h index 523bfc5e32..300eaf43e8 100644 --- a/libs/s25main/figures/noFigure.h +++ b/libs/s25main/figures/noFigure.h @@ -174,7 +174,7 @@ class noFigure : public noMovable /// Gibt Job-Typ zurück Job getJobType() const { return job_; } /// Returns true if this is a soldier (they get some special handling at some points) - bool IsSoldier() const; + bool isSoldier() const; unsigned calcWalkAnimationFrame() const; DrawPoint interpolateWalkDrawPos(DrawPoint drawPt) const; diff --git a/libs/s25main/figures/nofActiveSoldier.cpp b/libs/s25main/figures/nofActiveSoldier.cpp index e80e5904e3..31874f9ce0 100644 --- a/libs/s25main/figures/nofActiveSoldier.cpp +++ b/libs/s25main/figures/nofActiveSoldier.cpp @@ -181,7 +181,7 @@ void nofActiveSoldier::expelEnemies() const for(auto* fig : figures) { // Enemy of us but no soldier, and walking on the road (i.e. no free workers like woodcutters etc.) - if(!owner.isAlly(fig->getPlayer()) && !fig->IsSoldier() && fig->isWalkingOnRoad()) + if(!owner.isAlly(fig->getPlayer()) && !fig->isSoldier() && fig->isWalkingOnRoad()) { // Then he should start wandering around fig->abrogate(); diff --git a/libs/s25main/figures/nofCarrier.cpp b/libs/s25main/figures/nofCarrier.cpp index 042942fe1d..f85e9e2aa6 100644 --- a/libs/s25main/figures/nofCarrier.cpp +++ b/libs/s25main/figures/nofCarrier.cpp @@ -327,11 +327,11 @@ void nofCarrier::walked() { // Dann umdrehen und holen rs_dir = !rs_dir; - rs_pos = workplace->GetLength() - rs_pos; + rs_pos = workplace->getLength() - rs_pos; state = CarrierState::FetchWare; startWalking(cur_rs->getDir(rs_dir, rs_pos)); - } else if(rs_pos == cur_rs->GetLength() / 2 || rs_pos == cur_rs->GetLength() / 2 + cur_rs->GetLength() % 2) + } else if(rs_pos == cur_rs->getLength() / 2 || rs_pos == cur_rs->getLength() / 2 + cur_rs->getLength() % 2) { // Wir sind in der Mitte angekommen state = CarrierState::WaitForWare; @@ -351,10 +351,10 @@ void nofCarrier::walked() } else { // Eventuell laufen wir in die falsche Richtung? - if(rs_pos > cur_rs->GetLength() / 2) + if(rs_pos > cur_rs->getLength() / 2) { rs_dir = !rs_dir; - rs_pos = cur_rs->GetLength() - rs_pos; + rs_pos = cur_rs->getLength() - rs_pos; } startWalking(cur_rs->getDir(rs_dir, rs_pos)); @@ -366,7 +366,7 @@ void nofCarrier::walked() // Zur Flagge laufen, um die Ware zu holen // Sind wir schon da? - if(rs_pos == cur_rs->GetLength()) + if(rs_pos == cur_rs->getLength()) // Dann Ware aufnehmnen fetchWare(false); else @@ -376,7 +376,7 @@ void nofCarrier::walked() case CarrierState::CarryWare: { // Reached target flag? - if(rs_pos == cur_rs->GetLength()) + if(rs_pos == cur_rs->getLength()) { // Flag just reached auto& this_flag = assertNonNull(((rs_dir) ? workplace->getF1() : workplace->getF2())); @@ -428,11 +428,11 @@ void nofCarrier::walked() // No space at flag, go back and try again later state = CarrierState::GoBackFromFlag; rs_dir = !rs_dir; - rs_pos = cur_rs->GetLength() - rs_pos; + rs_pos = cur_rs->getLength() - rs_pos; startWalking(getCurMoveDir() + 3u); } } - } else if(rs_pos == cur_rs->GetLength() - 1) + } else if(rs_pos == cur_rs->getLength() - 1) { // If we are one step before the flag, check if we have to wait for space auto* this_flag = static_cast(((rs_dir) ? workplace->getF1() : workplace->getF2())); @@ -467,7 +467,7 @@ void nofCarrier::walked() { // So tun, als ob der Träger gerade vom anderen Ende des Weges kommt, damit alles korrekt funktioniert cur_rs = workplace; - faceDir(workplace->getDir(rs_dir, workplace->GetLength() - 1)); + faceDir(workplace->getDir(rs_dir, workplace->getLength() - 1)); lookForWares(); } break; @@ -475,7 +475,7 @@ void nofCarrier::walked() { // Wieder umdrehen und so tun, als wären wir gerade normal angekommen rs_dir = !rs_dir; - rs_pos = cur_rs->GetLength() - rs_pos; + rs_pos = cur_rs->getLength() - rs_pos; state = CarrierState::CarryWare; walked(); } @@ -767,7 +767,7 @@ bool nofCarrier::addWareJob(const noRoadNode* rn) if(rs_dir == workplace->getNodeID(*rn) && state == CarrierState::WaitForWare) { rs_dir = !rs_dir; - rs_pos = cur_rs->GetLength() - rs_pos; + rs_pos = cur_rs->getLength() - rs_pos; } // beim Gehen in die Mitte nicht sofort umdrehen! else if(rs_dir == workplace->getNodeID(*rn)) @@ -811,7 +811,7 @@ void nofCarrier::removeWareJob() //// Wenn es an der anderen Flagge noch einen gibt, dort hin gehen // if(workplace->AreWareJobs(rs_dir)) //{ - // rs_pos = cur_rs->GetLength()-rs_pos-2; + // rs_pos = cur_rs->getLength()-rs_pos-2; // rs_dir = !rs_dir; //} // else @@ -861,7 +861,7 @@ bool nofCarrier::wantInBuilding(bool* calculated) if(!rs) return false; - if(rs->GetLength() != 1) + if(rs->getLength() != 1) return false; if(calculated) diff --git a/libs/s25main/figures/nofSoldier.cpp b/libs/s25main/figures/nofSoldier.cpp index 00faf09b82..b9e7bacfe7 100644 --- a/libs/s25main/figures/nofSoldier.cpp +++ b/libs/s25main/figures/nofSoldier.cpp @@ -15,7 +15,7 @@ nofSoldier::nofSoldier(const MapPoint pos, const unsigned char player, nobBaseMi : noFigure(SOLDIER_JOBS[rank], pos, player, goal), homeBld(home), hitpoints(HITPOINTS[rank]) { hasArmor_ = armor; - RTTR_Assert(IsSoldier()); + RTTR_Assert(isSoldier()); } nofSoldier::nofSoldier(const MapPoint pos, const unsigned char player, nobBaseMilitary& home, const unsigned char rank, @@ -23,7 +23,7 @@ nofSoldier::nofSoldier(const MapPoint pos, const unsigned char player, nobBaseMi : noFigure(SOLDIER_JOBS[rank], pos, player), homeBld(&home), hitpoints(HITPOINTS[rank]) { hasArmor_ = armor; - RTTR_Assert(IsSoldier()); + RTTR_Assert(isSoldier()); } void nofSoldier::serialize(SerializedGameData& sgd) const @@ -38,7 +38,7 @@ void nofSoldier::serialize(SerializedGameData& sgd) const nofSoldier::nofSoldier(SerializedGameData& sgd, const unsigned obj_id) : noFigure(sgd, obj_id) { - RTTR_Assert(IsSoldier()); + RTTR_Assert(isSoldier()); if(fs != FigureState::Wander && fs != FigureState::GoHome) homeBld = sgd.popObject(); diff --git a/libs/s25main/figures/nofWarehouseWorker.cpp b/libs/s25main/figures/nofWarehouseWorker.cpp index 3db3cf914d..43bb02b4b9 100644 --- a/libs/s25main/figures/nofWarehouseWorker.cpp +++ b/libs/s25main/figures/nofWarehouseWorker.cpp @@ -23,7 +23,7 @@ nofWarehouseWorker::nofWarehouseWorker(const MapPoint pos, const unsigned char p /// Set the road to building flag (1-piece) cur_rs = static_cast(getGoal())->getRoute(Direction::NorthWest); - RTTR_Assert(cur_rs->GetLength() == 1); + RTTR_Assert(cur_rs->getLength() == 1); rs_dir = true; } diff --git a/libs/s25main/ingameWindows/iwBuildOrder.cpp b/libs/s25main/ingameWindows/iwBuildOrder.cpp index d553b70d11..e387b05e3a 100644 --- a/libs/s25main/ingameWindows/iwBuildOrder.cpp +++ b/libs/s25main/ingameWindows/iwBuildOrder.cpp @@ -158,7 +158,7 @@ void iwBuildOrder::msgButtonClick(const unsigned ctrl_id) while(selection > 0) { std::swap(pendingBuildOrder[selection - 1], pendingBuildOrder[selection]); - list->Swap(selection - 1, selection); + list->swap(selection - 1, selection); --selection; } settings_changed = true; @@ -169,7 +169,7 @@ void iwBuildOrder::msgButtonClick(const unsigned ctrl_id) if(selection > 0) { std::swap(pendingBuildOrder[selection - 1], pendingBuildOrder[selection]); - list->Swap(selection - 1, selection); + list->swap(selection - 1, selection); } settings_changed = true; } @@ -179,7 +179,7 @@ void iwBuildOrder::msgButtonClick(const unsigned ctrl_id) if(selection < numOptions - 1u) { std::swap(pendingBuildOrder[selection + 1], pendingBuildOrder[selection]); - list->Swap(selection + 1, selection); + list->swap(selection + 1, selection); } settings_changed = true; } @@ -189,7 +189,7 @@ void iwBuildOrder::msgButtonClick(const unsigned ctrl_id) while(selection < numOptions - 1u) { std::swap(pendingBuildOrder[selection + 1], pendingBuildOrder[selection]); - list->Swap(selection + 1, selection); + list->swap(selection + 1, selection); ++selection; } settings_changed = true; diff --git a/libs/s25main/ingameWindows/iwMusicPlayer.cpp b/libs/s25main/ingameWindows/iwMusicPlayer.cpp index 248429b75e..827822696b 100644 --- a/libs/s25main/ingameWindows/iwMusicPlayer.cpp +++ b/libs/s25main/ingameWindows/iwMusicPlayer.cpp @@ -305,7 +305,7 @@ void iwMusicPlayer::msgButtonClick(const unsigned ctrl_id) const auto& selection = getCtrl(ID_lstSongs)->getSelection(); if(selection && *selection > 0u) - getCtrl(ID_lstSongs)->Swap(*selection - 1u, *selection); + getCtrl(ID_lstSongs)->swap(*selection - 1u, *selection); } break; case ID_btDown: @@ -313,7 +313,7 @@ void iwMusicPlayer::msgButtonClick(const unsigned ctrl_id) const auto& selection = getCtrl(ID_lstSongs)->getSelection(); if(selection && *selection < getCtrl(ID_lstSongs)->getNumLines() - 1u) - getCtrl(ID_lstSongs)->Swap(*selection + 1u, *selection); + getCtrl(ID_lstSongs)->swap(*selection + 1u, *selection); } break; case ID_btDecRepeat: diff --git a/libs/s25main/mapGenerator/Harbors.cpp b/libs/s25main/mapGenerator/Harbors.cpp index 11fcf81ee0..6b0671a4f8 100644 --- a/libs/s25main/mapGenerator/Harbors.cpp +++ b/libs/s25main/mapGenerator/Harbors.cpp @@ -19,7 +19,7 @@ void placeHarborPosition(Map& map, const MapPoint& position) auto harborTexture = textures.Find(isBuildableCoast); auto triangles = GetTriangles(position, map.size); - auto isWater = [&textures](const MapPoint& pt) { return textures.any(pt, IsWater); }; + auto isWaterTerrain = [&textures](const MapPoint& pt) { return textures.any(pt, isWater); }; for(const Triangle& triangle : triangles) { @@ -28,7 +28,7 @@ void placeHarborPosition(Map& map, const MapPoint& position) for(const Triangle& triangle : triangles) { - if(helpers::contains_if(GetTriangleEdges(triangle, map.size), isWater)) + if(helpers::contains_if(GetTriangleEdges(triangle, map.size), isWaterTerrain)) { map.harbors.push_back(triangle); } @@ -41,8 +41,8 @@ std::vector> FindCoastlines(const Map& map, const std::vec std::set visited; const auto isCoast = [&map](const MapPoint& pt) { - const auto allWater = [&map](const MapPoint& p) { return map.textureMap.all(p, IsWater); }; - return map.textureMap.any(pt, isLand) && map.textureMap.any(pt, IsWater) + const auto allWater = [&map](const MapPoint& p) { return map.textureMap.all(p, isWater); }; + return map.textureMap.any(pt, isLand) && map.textureMap.any(pt, isWater) && helpers::contains_if(map.getTextures().getNeighbours(pt), allWater); }; diff --git a/libs/s25main/mapGenerator/HeadQuarters.cpp b/libs/s25main/mapGenerator/HeadQuarters.cpp index 96c1d1fcae..8a6c919db3 100644 --- a/libs/s25main/mapGenerator/HeadQuarters.cpp +++ b/libs/s25main/mapGenerator/HeadQuarters.cpp @@ -37,7 +37,7 @@ std::vector FindLargestConnectedArea(const Map& map) // added before due to allowing tiny rivers to be part of // connected areas - helpers::erase_if(connectedArea, [&map](const MapPoint& pt) { return map.textureMap.any(pt, IsWater); }); + helpers::erase_if(connectedArea, [&map](const MapPoint& pt) { return map.textureMap.any(pt, isWater); }); return connectedArea; } diff --git a/libs/s25main/mapGenerator/Resources.cpp b/libs/s25main/mapGenerator/Resources.cpp index 073cc7eaf1..40bfeac620 100644 --- a/libs/s25main/mapGenerator/Resources.cpp +++ b/libs/s25main/mapGenerator/Resources.cpp @@ -87,7 +87,7 @@ void addObjects(Map& map, RandomUtility& rnd, const MapSettings& settings) const auto mountain = [&textureMap](const MapPoint& pt) { return textureMap.any(pt, isMountainOrSnowOrLava); }; const auto mountainDistance = DistancesTo(map.size, mountain); - const auto water = [&textureMap](const MapPoint& pt) { return textureMap.any(pt, IsWater); }; + const auto water = [&textureMap](const MapPoint& pt) { return textureMap.any(pt, isWater); }; auto waterDistance = DistancesTo(map.size, water); RTTR_FOREACH_PT(MapPoint, map.size) @@ -233,7 +233,7 @@ void addResources(Map& map, RandomUtility& rnd, const MapSettings& settings) } } } - } else if(textures.all(pt, IsWater)) + } else if(textures.all(pt, isWater)) { resources[pt] = libsiedler2::R_Fish; } else @@ -253,7 +253,7 @@ void addAnimals(Map& map, RandomUtility& rnd) { if(rnd.byChance(3)) { - if(textures.all(pt, IsWater)) + if(textures.all(pt, isWater)) { map.animals[pt] = libsiedler2::Animal::Duck; } else if(textures.all(pt, isLand)) diff --git a/libs/s25main/mapGenerator/Rivers.cpp b/libs/s25main/mapGenerator/Rivers.cpp index 7718226979..f4d49a9c7b 100644 --- a/libs/s25main/mapGenerator/Rivers.cpp +++ b/libs/s25main/mapGenerator/Rivers.cpp @@ -17,7 +17,7 @@ River createStream(RandomUtility& rnd, Map& map, const MapPoint& source, Directi std::vector exlcuded{direction + 2, direction + 3, direction + 4}; auto& textures = map.textureMap; - const auto water = textures.Find(IsWater); + const auto water = textures.Find(isWater); MapPoint currentNode = source; Direction currentDir = direction; diff --git a/libs/s25main/mapGenerator/TextureHelper.cpp b/libs/s25main/mapGenerator/TextureHelper.cpp index e5431f0ae3..07f4f5bc92 100644 --- a/libs/s25main/mapGenerator/TextureHelper.cpp +++ b/libs/s25main/mapGenerator/TextureHelper.cpp @@ -11,7 +11,7 @@ uint8_t byHumidity(const TerrainDesc& terrain) return terrain.humidity; } -bool IsWater(const TerrainDesc& terrain) +bool isWater(const TerrainDesc& terrain) { return terrain.kind == TerrainKind::Water; } diff --git a/libs/s25main/mapGenerator/TextureHelper.h b/libs/s25main/mapGenerator/TextureHelper.h index c17c82774c..bc0581a8b8 100644 --- a/libs/s25main/mapGenerator/TextureHelper.h +++ b/libs/s25main/mapGenerator/TextureHelper.h @@ -10,7 +10,7 @@ namespace rttr::mapGenerator { uint8_t byHumidity(const TerrainDesc& terrain); -bool IsWater(const TerrainDesc& terrain); +bool isWater(const TerrainDesc& terrain); bool isSwamp(const TerrainDesc& terrain); diff --git a/libs/s25main/mapGenerator/Textures.cpp b/libs/s25main/mapGenerator/Textures.cpp index 65d52a9946..f5c23ea489 100644 --- a/libs/s25main/mapGenerator/Textures.cpp +++ b/libs/s25main/mapGenerator/Textures.cpp @@ -154,7 +154,7 @@ void Texturizer::applyMountainWaterTransitions(const std::vector& tran { std::set nodes; nodes.insert(transitions.begin(), transitions.end()); - const auto water = textureMap_.Find(IsWater); + const auto water = textureMap_.Find(isWater); const auto boulder = textureMap_.Find(isBuildableMountain); const auto swamp = textureMap_.Find(isSwamp); replaceTextures(textures_, 0, nodes, swamp, {water}); @@ -166,13 +166,13 @@ void Texturizer::addTextures(unsigned mountainLevel, unsigned coastline) applyTexturingByHeightMap(mountainLevel); auto coast = SelectPoints( - [this](const MapPoint& pt) { return this->textureMap_.any(pt, isLand) && this->textureMap_.any(pt, IsWater); }, + [this](const MapPoint& pt) { return this->textureMap_.any(pt, isLand) && this->textureMap_.any(pt, isWater); }, this->textures_.getSize()); applyCoastTexturing(coast, 1); // small for tiny rivers auto isRiver = [this](const MapPoint& pt) { - auto suroundedByWater = [this](const MapPoint& pt) { return this->textureMap_.all(pt, IsWater); }; + auto suroundedByWater = [this](const MapPoint& pt) { return this->textureMap_.all(pt, isWater); }; return !helpers::contains_if(this->textures_.getNeighbours(pt), suroundedByWater); }; helpers::erase_if(coast, isRiver); @@ -189,7 +189,7 @@ void Texturizer::addTextures(unsigned mountainLevel, unsigned coastline) const auto moutainWaterTransition = SelectPoints( [this](const MapPoint& pt) { - return this->textureMap_.any(pt, isMinableMountain) && this->textureMap_.any(pt, IsWater); + return this->textureMap_.any(pt, isMinableMountain) && this->textureMap_.any(pt, isWater); }, this->textures_.getSize()); diff --git a/libs/s25main/network/GameClient.cpp b/libs/s25main/network/GameClient.cpp index 02747b9927..d45aa28ea2 100644 --- a/libs/s25main/network/GameClient.cpp +++ b/libs/s25main/network/GameClient.cpp @@ -1469,7 +1469,7 @@ bool GameClient::startReplay(const boost::filesystem::path& path) mapinfo.clear(); replayinfo = std::make_unique(); - if(!replayinfo->replay.loadHeader(path) || !replayinfo->replay.LoadGameData(mapinfo)) //-V807 + if(!replayinfo->replay.loadHeader(path) || !replayinfo->replay.loadGameData(mapinfo)) //-V807 { LOG.write(_("Invalid Replay %1%! Reason: %2%\n")) % path % (replayinfo->replay.getLastErrorMsg().empty() ? _("Unknown") : replayinfo->replay.getLastErrorMsg()); diff --git a/libs/s25main/nodeObjs/noFlag.cpp b/libs/s25main/nodeObjs/noFlag.cpp index d065a8a344..9ba2e0bdf4 100644 --- a/libs/s25main/nodeObjs/noFlag.cpp +++ b/libs/s25main/nodeObjs/noFlag.cpp @@ -194,7 +194,7 @@ std::unique_ptr noFlag::selectWare(const Direction roadDir, const bool swa if(!route) continue; - if(route->GetLength() == 1) + if(route->getLength() == 1) { // Gebäude? diff --git a/libs/s25main/nodeObjs/noRoadNode.cpp b/libs/s25main/nodeObjs/noRoadNode.cpp index 982cfb82a8..082b8eb111 100644 --- a/libs/s25main/nodeObjs/noRoadNode.cpp +++ b/libs/s25main/nodeObjs/noRoadNode.cpp @@ -68,7 +68,7 @@ void noRoadNode::DestroyRoad(const Direction dir) if(!route) return; MapPoint t = route->getF1()->getPos(); - for(unsigned z = 0; z < route->GetLength(); ++z) + for(unsigned z = 0; z < route->getLength(); ++z) { world->setPointRoad(t, route->getRoute(z), PointRoad::None); world->recalcBQForRoad(t); diff --git a/libs/s25main/pathfinding/RoadPathFinder.cpp b/libs/s25main/pathfinding/RoadPathFinder.cpp index eb87c91dd7..75b41f6e49 100644 --- a/libs/s25main/pathfinding/RoadPathFinder.cpp +++ b/libs/s25main/pathfinding/RoadPathFinder.cpp @@ -219,7 +219,7 @@ bool RoadPathFinder::findPathImpl(const noRoadNode& start, const noRoadNode& goa if(!isSegmentAllowed(*route)) continue; - const unsigned cost = best.cost + route->GetLength() + (neighbour != goalBld ? addCosts(best, dir) : 0); + const unsigned cost = best.cost + route->getLength() + (neighbour != goalBld ? addCosts(best, dir) : 0); if(cost > max) continue; diff --git a/libs/s25main/world/MapBase.cpp b/libs/s25main/world/MapBase.cpp index 5b899f2276..181f0bd358 100644 --- a/libs/s25main/world/MapBase.cpp +++ b/libs/s25main/world/MapBase.cpp @@ -142,7 +142,7 @@ unsigned MapBase::calcMaxDistance() const return calcDistance(MapPoint::all(0), MapPoint(size_.x / 2, size_.y / 2)); } -ShipDirection MapBase::GetShipDir(MapPoint fromPt, MapPoint toPt) const +ShipDirection MapBase::getShipDir(MapPoint fromPt, MapPoint toPt) const { // First divide into North/South by only looking at the y-Difference. On equal we choose South // Then choose between main dir (S/N) or partial E/W: diff --git a/libs/s25main/world/MapBase.h b/libs/s25main/world/MapBase.h index 16ba02bb86..3a73f0f92d 100644 --- a/libs/s25main/world/MapBase.h +++ b/libs/s25main/world/MapBase.h @@ -97,7 +97,7 @@ class MapBase } unsigned calcMaxDistance() const; /// Return the direction for ships for going from one point to another - ShipDirection GetShipDir(MapPoint fromPt, MapPoint toPt) const; + ShipDirection getShipDir(MapPoint fromPt, MapPoint toPt) const; }; ////////////////////////////////////////////////////////////////////////// diff --git a/libs/s25main/world/MapLoader.cpp b/libs/s25main/world/MapLoader.cpp index 3712453967..6f76b4e5d3 100644 --- a/libs/s25main/world/MapLoader.cpp +++ b/libs/s25main/world/MapLoader.cpp @@ -668,7 +668,7 @@ void MapLoader::calcHarborPosNeighbors(World& world) auto const coastToHbs = coastToHarborPerSea[seaId].equal_range(world.getIdx(ownCoastPt)); for(auto it = coastToHbs.first; it != coastToHbs.second; ++it) { - ShipDirection shipDir = world.GetShipDir(ownCoastPt, ownCoastPt); + ShipDirection shipDir = world.getShipDir(ownCoastPt, ownCoastPt); world.harborData[startHbId].neighbors[shipDir].push_back(HarborPos::Neighbor(it->second, seaId, 0)); hbFound[it->second] = true; } @@ -695,7 +695,7 @@ void MapLoader::calcHarborPosNeighbors(World& world) if(ptValue > 0) // found harbor(s) { - const ShipDirection shipDir = world.GetShipDir(world.harborData[startHbId].pos, curPt); + const ShipDirection shipDir = world.getShipDir(world.harborData[startHbId].pos, curPt); const SeaId seaId = world.getSeaFromCoastalPoint(curPt); RTTR_Assert(seaId); auto const coastToHbs = coastToHarborPerSea[seaId].equal_range(idx); diff --git a/tests/legacyFiles/src/legacy/TerrainData.cpp b/tests/legacyFiles/src/legacy/TerrainData.cpp index 9c109ff326..021075aba7 100644 --- a/tests/legacyFiles/src/legacy/TerrainData.cpp +++ b/tests/legacyFiles/src/legacy/TerrainData.cpp @@ -105,7 +105,7 @@ Rect TerrainData::getPosInTexture(TerrainType t) bool TerrainData::isAnimated(TerrainType t) { - return IsWater(t) || isLava(t); + return isWater(t) || isLava(t); } unsigned TerrainData::getNumFrames(TerrainType t) @@ -518,7 +518,7 @@ bool TerrainData::isVital(TerrainType t) } } -bool TerrainData::IsWater(TerrainType t) +bool TerrainData::isWater(TerrainType t) { switch(t) { diff --git a/tests/legacyFiles/src/legacy/TerrainData.h b/tests/legacyFiles/src/legacy/TerrainData.h index 3ad213ee37..8997c10bae 100644 --- a/tests/legacyFiles/src/legacy/TerrainData.h +++ b/tests/legacyFiles/src/legacy/TerrainData.h @@ -49,7 +49,7 @@ class TerrainData /// Returns whether corn fields can grow on the terrain (no dessert, mountain etc) static bool isVital(TerrainType t); /// Returns whether the given terrain is any kind of water - static bool IsWater(TerrainType t); + static bool isWater(TerrainType t); /// Returns whether the given terrain is any kind of lava static bool isLava(TerrainType t); /// Returns whether the given terrain is any kind of snow diff --git a/tests/s25Main/UI/testDskGameLobby.cpp b/tests/s25Main/UI/testDskGameLobby.cpp index 9ddae687a0..9b21634f7a 100644 --- a/tests/s25Main/UI/testDskGameLobby.cpp +++ b/tests/s25Main/UI/testDskGameLobby.cpp @@ -24,7 +24,7 @@ BOOST_AUTO_TEST_SUITE(UI) MOCK_BASE_CLASS(MockLobbyClient, ILobbyClient) { - MOCK_METHOD(IsLoggedIn, 0); + MOCK_METHOD(isLoggedIn, 0); MOCK_METHOD(addListener, 1); MOCK_METHOD(removeListener, 1); MOCK_METHOD(sendServerJoinRequest, 0); @@ -43,7 +43,7 @@ BOOST_FIXTURE_TEST_CASE(LobbyChat, uiHelper::Fixture) auto client = std::make_unique(); mock::sequence s, s2; - MOCK_EXPECT(client->IsLoggedIn).at_least(1).in(s2).returns(true); + MOCK_EXPECT(client->isLoggedIn).at_least(1).in(s2).returns(true); MOCK_EXPECT(client->addListener).exactly(1).in(s); MOCK_EXPECT(client->removeListener).exactly(1).in(s); MOCK_EXPECT(client->sendServerJoinRequest).exactly(1).in(s2); diff --git a/tests/s25Main/integration/testAttacking.cpp b/tests/s25Main/integration/testAttacking.cpp index 2729824f55..93a05e9106 100644 --- a/tests/s25Main/integration/testAttacking.cpp +++ b/tests/s25Main/integration/testAttacking.cpp @@ -1320,7 +1320,7 @@ BOOST_FIXTURE_TEST_CASE(DestroyRoadsOnConquer, DestroyRoadsOnConquerFixture) buildRoadForBlds(world.getNeighbour(flagPt, Direction::NorthWest), milBld1Pos); // Build a long road connecting left&right w/o any flag in between (See #863) buildRoadForBlds(leftBldPos, rightBldPos); - BOOST_TEST_REQUIRE(leftBld->getFlag()->getRoute(Direction::East)->GetLength() >= 10u); + BOOST_TEST_REQUIRE(leftBld->getFlag()->getRoute(Direction::East)->getLength() >= 10u); curPlayer = 0; this->Attack(milBld1Pos, 5, true); diff --git a/tests/s25Main/integration/testSeaWorldCreation.cpp b/tests/s25Main/integration/testSeaWorldCreation.cpp index e6bc8d4d7d..06769d3093 100644 --- a/tests/s25Main/integration/testSeaWorldCreation.cpp +++ b/tests/s25Main/integration/testSeaWorldCreation.cpp @@ -22,10 +22,10 @@ BOOST_AUTO_TEST_SUITE(SeaWorldCreationSuite) namespace { /// Return the ship dir from a point to an other point given by their difference -ShipDirection getShipDir(const MapBase& world, MapPoint fromPt, const Position& diff) +ShipDirection getShipDirFromDiff(const MapBase& world, MapPoint fromPt, const Position& diff) { MapPoint toPt = world.makeMapPoint(Position(fromPt) + diff); - return world.GetShipDir(fromPt, toPt); + return world.getShipDir(fromPt, toPt); } /// Test getting the ship dir for the various cases coming from a single point @@ -33,33 +33,33 @@ void testShipDir(const MapBase& world, const MapPoint fromPt) { using DiffPt = Position; // General cases - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(0, -10)) == ShipDirection::North); - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(10, -1)) == ShipDirection::NorthEast); - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(10, 1)) == ShipDirection::SouthEast); - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(0, 10)) == ShipDirection::South); - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(-10, 1)) == ShipDirection::SouthWest); - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(-10, -1)) == ShipDirection::NorthWest); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(0, -10)) == ShipDirection::North); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(10, -1)) == ShipDirection::NorthEast); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(10, 1)) == ShipDirection::SouthEast); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(0, 10)) == ShipDirection::South); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(-10, 1)) == ShipDirection::SouthWest); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(-10, -1)) == ShipDirection::NorthWest); // y diff is zero -> Go south (convention) - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(-10, 0)) == ShipDirection::SouthWest); - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(10, 0)) == ShipDirection::SouthEast); - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(1, 0)) == ShipDirection::SouthEast); - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(-1, 0)) == ShipDirection::SouthWest); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(-10, 0)) == ShipDirection::SouthWest); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(10, 0)) == ShipDirection::SouthEast); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(1, 0)) == ShipDirection::SouthEast); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(-1, 0)) == ShipDirection::SouthWest); // 6 directions -> 60deg covered per direction, mainDir +- 30deg // Switch pt between north and south is simple: Above or below zero diff (already tested above) // But S to SE or SW (same for N) is harder. Dividing line as an angle of +- 60deg compared to x-axis // hence: |dy/dx| > tan(60deg) -> South, tan(60deg) ~= 1.732. Test here with |dy| = |dx| * 1.732 as the divider - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(100, 173)) == ShipDirection::SouthEast); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(100, 173)) == ShipDirection::SouthEast); // Switch point - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(100, 174)) == ShipDirection::South); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(100, 174)) == ShipDirection::South); // Same for other 3 switch points - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(-100, 173)) == ShipDirection::SouthWest); - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(-100, 174)) == ShipDirection::South); - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(-100, -173)) == ShipDirection::NorthWest); - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(-100, -174)) == ShipDirection::North); - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(100, -173)) == ShipDirection::NorthEast); - BOOST_TEST_REQUIRE(getShipDir(world, fromPt, DiffPt(100, -174)) == ShipDirection::North); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(-100, 173)) == ShipDirection::SouthWest); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(-100, 174)) == ShipDirection::South); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(-100, -173)) == ShipDirection::NorthWest); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(-100, -174)) == ShipDirection::North); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(100, -173)) == ShipDirection::NorthEast); + BOOST_TEST_REQUIRE(getShipDirFromDiff(world, fromPt, DiffPt(100, -174)) == ShipDirection::North); } } // namespace diff --git a/tests/s25Main/integration/testSeafaring.cpp b/tests/s25Main/integration/testSeafaring.cpp index b2c99fab6c..9c08d98d9d 100644 --- a/tests/s25Main/integration/testSeafaring.cpp +++ b/tests/s25Main/integration/testSeafaring.cpp @@ -237,7 +237,7 @@ struct ShipReadyFixture : public SeaWorldWithGCExecution()) { @@ -960,7 +960,7 @@ BOOST_FIXTURE_TEST_CASE(GoToNeighborHarbor, ShipReadyFixture<1>) // Wait till ship has loaded wares and is ready RTTR_EXEC_TILL(500, ship.isWaitingForExpeditionInstructions()); - this->travelToNextSpot(this->GetShipDir(ship, harborId), player.getShipID(ship)); + this->travelToNextSpot(this->getShipDir(ship, harborId), player.getShipID(ship)); BOOST_TEST_REQUIRE(!ship.isWaitingForExpeditionInstructions()); BOOST_TEST_REQUIRE(ship.isMoving()); BOOST_TEST_REQUIRE(ship.getTargetHarbor() == harborId); @@ -968,7 +968,7 @@ BOOST_FIXTURE_TEST_CASE(GoToNeighborHarbor, ShipReadyFixture<1>) RTTR_EXEC_TILL(500, ship.isWaitingForExpeditionInstructions()); BOOST_TEST_REQUIRE(ship.getPos() == coastPoint); - this->travelToNextSpot(this->GetShipDir(ship, nbHbId), player.getShipID(ship)); + this->travelToNextSpot(this->getShipDir(ship, nbHbId), player.getShipID(ship)); BOOST_TEST_REQUIRE(ship.getTargetHarbor() == nbHbId); // Already there BOOST_TEST(ship.isWaitingForExpeditionInstructions()); @@ -979,7 +979,7 @@ BOOST_FIXTURE_TEST_CASE(GoToNeighborHarbor, ShipReadyFixture<1>) BOOST_TEST_REQUIRE(otherHarborId.isValid()); // Precondition that any ship dir will be found BOOST_TEST_REQUIRE(world.isHarborAtSea(otherHarborId, seaId)); - this->travelToNextSpot(this->GetShipDir(ship, otherHarborId), player.getShipID(ship)); + this->travelToNextSpot(this->getShipDir(ship, otherHarborId), player.getShipID(ship)); BOOST_TEST_REQUIRE(ship.getTargetHarbor() == otherHarborId); // Moving BOOST_TEST_REQUIRE(ship.isMoving()); diff --git a/tests/s25Main/integration/testSerialization.cpp b/tests/s25Main/integration/testSerialization.cpp index 12f5fc2f1e..7755e30e65 100644 --- a/tests/s25Main/integration/testSerialization.cpp +++ b/tests/s25Main/integration/testSerialization.cpp @@ -545,7 +545,7 @@ BOOST_FIXTURE_TEST_CASE(ReplayWithMap, ReplayMapFixture) continue; } MapInfo newMap; - BOOST_TEST_REQUIRE(loadReplay.LoadGameData(newMap)); + BOOST_TEST_REQUIRE(loadReplay.loadGameData(newMap)); BOOST_TEST_REQUIRE(loadReplay.getNumPlayers() == 4u); for(unsigned j = 0; j < 4; j++) { @@ -610,7 +610,7 @@ BOOST_FIXTURE_TEST_CASE(BrokenReplayWithMap, ReplayMapFixture) BOOST_TEST(loadReplay.getPlayerNames()[2] == "PlAI2"); BOOST_TEST(loadReplay.getLastGF() == 5u); MapInfo newMap; - BOOST_TEST_REQUIRE(loadReplay.LoadGameData(newMap)); + BOOST_TEST_REQUIRE(loadReplay.loadGameData(newMap)); BOOST_TEST_REQUIRE(loadReplay.getNumPlayers() == 4u); for(unsigned j = 0; j < 4; j++) { @@ -699,7 +699,7 @@ BOOST_FIXTURE_TEST_CASE(ReplayWithSavegame, RandWorldFixture) continue; } MapInfo newMap; - BOOST_TEST_REQUIRE(loadReplay.LoadGameData(newMap)); + BOOST_TEST_REQUIRE(loadReplay.loadGameData(newMap)); BOOST_TEST_REQUIRE(loadReplay.getNumPlayers() == 4u); for(unsigned j = 0; j < 4; j++) { diff --git a/tests/s25Main/mapGenerator/testHarbors.cpp b/tests/s25Main/mapGenerator/testHarbors.cpp index 633bea5a74..c124ffac7f 100644 --- a/tests/s25Main/mapGenerator/testHarbors.cpp +++ b/tests/s25Main/mapGenerator/testHarbors.cpp @@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE(PlaceHarbors_places_no_harbors_on_coast_below_minimum_size) Map map = createMap(MapExtent(6, 8)); MapPoint island(3, 3); - auto water = TexturePair(map.textureMap.Find(IsWater)); + auto water = TexturePair(map.textureMap.Find(isWater)); map.getTextures().resize(map.size, water); @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE(PlaceHarbors_places_harbor_on_suitable_island) Map map = createMap(MapExtent(6, 8)); MapPoint island(3, 3); - auto water = TexturePair(map.textureMap.Find(IsWater)); + auto water = TexturePair(map.textureMap.Find(isWater)); map.getTextures().resize(map.size, water); @@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE(PlaceHarbors_places_no_harbor_near_river) Map map = createMap(MapExtent(6, 8)); MapPoint island(3, 3); - auto water = TexturePair(map.textureMap.Find(IsWater)); + auto water = TexturePair(map.textureMap.Find(isWater)); map.getTextures().resize(map.size, water); diff --git a/tests/s25Main/mapGenerator/testHeadQuarters.cpp b/tests/s25Main/mapGenerator/testHeadQuarters.cpp index 976edbfb29..0fc35c9036 100644 --- a/tests/s25Main/mapGenerator/testHeadQuarters.cpp +++ b/tests/s25Main/mapGenerator/testHeadQuarters.cpp @@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE(FindHqPositions_returns_suitable_position_for_single_player Map map = createMap(size); const TextureMap& textures = map.textureMap; - const auto water = textures.Find(IsWater); + const auto water = textures.Find(isWater); const auto buildable = textures.Find(isBuildableLand); MapPoint obstacle(1, 3); @@ -149,7 +149,7 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarter_places_hq_on_map_at_suitable_position) const MapPoint hq(4, 5); map.getTextures().resize(size, TexturePair(textures.Find(isBuildableLand))); - map.getTextures()[obstacle] = TexturePair(textures.Find(IsWater)); + map.getTextures()[obstacle] = TexturePair(textures.Find(isWater)); std::vector area{hq}; @@ -194,7 +194,7 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarters_with_suitable_positions_for_all_players) const auto mntDist = randomMountainDistance(); map.getTextures().resize(size, TexturePair(textures.Find(isBuildableLand))); - map.getTextures()[MapPoint(0, 0)] = TexturePair(textures.Find(IsWater)); + map.getTextures()[MapPoint(0, 0)] = TexturePair(textures.Find(isWater)); BOOST_REQUIRE_NO_THROW(placeHeadquarters(map, rnd, players, mntDist)); } @@ -208,7 +208,7 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarters_places_hqs_for_any_player_number_on_suita const auto mntDist = randomMountainDistance(); map.getTextures().resize(size, textures.Find(isBuildableLand)); - map.getTextures()[MapPoint(0, 0)] = TexturePair(textures.Find(IsWater)); + map.getTextures()[MapPoint(0, 0)] = TexturePair(textures.Find(isWater)); placeHeadquarters(map, rnd, players, mntDist); BOOST_TEST_REQUIRE(map.hqPositions.size() == players); for(unsigned index = 0; index < players; index++) @@ -226,7 +226,7 @@ BOOST_AUTO_TEST_CASE(PlaceHeadquarters_without_suitable_position_throws_exceptio const TextureMap& textures = map.textureMap; const auto mntDist = randomMountainDistance(); - map.getTextures().resize(size, textures.Find(IsWater)); + map.getTextures().resize(size, textures.Find(isWater)); BOOST_CHECK_THROW(placeHeadquarters(map, rnd, players, mntDist), std::runtime_error); } diff --git a/tests/s25Main/mapGenerator/testResources.cpp b/tests/s25Main/mapGenerator/testResources.cpp index b28af51a8a..05dfb8fdf7 100644 --- a/tests/s25Main/mapGenerator/testResources.cpp +++ b/tests/s25Main/mapGenerator/testResources.cpp @@ -19,7 +19,7 @@ struct ResourceTestFixture : MapGenFixture ResourceTestFixture() : map(createMap(size)) { auto mountain = map.textureMap.Find(isMinableMountain); - auto water = map.textureMap.Find(IsWater); + auto water = map.textureMap.Find(isWater); auto land = map.textureMap.Find(isBuildableCoast); /* @@ -134,7 +134,7 @@ BOOST_AUTO_TEST_CASE(AddResources_updates_resources_according_to_textures) numMountainWithoutRes++; // LCOV_EXCL_LINE else numMountainWithRes++; - } else if(map.textureMap.all(pt, IsWater)) + } else if(map.textureMap.all(pt, isWater)) BOOST_TEST_REQUIRE(map.resources[pt] == R_Fish); else BOOST_TEST_REQUIRE(map.resources[pt] == R_Water); @@ -152,7 +152,7 @@ BOOST_AUTO_TEST_CASE(AddAnimals_updates_animals_according_to_textures) RTTR_FOREACH_PT(MapPoint, map.size) { - if(map.textureMap.all(pt, IsWater)) + if(map.textureMap.all(pt, isWater)) { BOOST_TEST_REQUIRE( (map.animals[pt] == Animal::None || map.animals[pt] == Animal::Duck || map.animals[pt] == Animal::Duck2)); diff --git a/tests/s25Main/mapGenerator/testRivers.cpp b/tests/s25Main/mapGenerator/testRivers.cpp index fe5b16f492..7d4ccd8c6d 100644 --- a/tests/s25Main/mapGenerator/testRivers.cpp +++ b/tests/s25Main/mapGenerator/testRivers.cpp @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(CreateStream_returns_only_nodes_covered_by_water) for(const MapPoint& pt : river) { - BOOST_TEST_REQUIRE(map.textureMap.any(pt, IsWater)); + BOOST_TEST_REQUIRE(map.textureMap.any(pt, isWater)); } } } diff --git a/tests/s25Main/mapGenerator/testTextures.cpp b/tests/s25Main/mapGenerator/testTextures.cpp index a5d091ff98..72dc0f32a5 100644 --- a/tests/s25Main/mapGenerator/testTextures.cpp +++ b/tests/s25Main/mapGenerator/testTextures.cpp @@ -57,7 +57,7 @@ BOOST_FIXTURE_TEST_CASE(AddTextures_does_not_override_textures, TextureMapFixtur { const unsigned mountainLevel = 5; const unsigned coastline = 1; - auto water = textureMap.Find(IsWater); + auto water = textureMap.Find(isWater); textures.resize(textures.getSize(), TexturePair(water)); RTTR_FOREACH_PT(MapPoint, z.getSize()) @@ -85,8 +85,8 @@ BOOST_FIXTURE_TEST_CASE(AddTextures_sets_water_textures_for_minimum_height, Text RTTR_FOREACH_PT(MapPoint, textures.getSize()) { - BOOST_TEST_REQUIRE(textureMap.check(Triangle(true, pt), IsWater)); - BOOST_TEST_REQUIRE(textureMap.check(Triangle(false, pt), IsWater)); + BOOST_TEST_REQUIRE(textureMap.check(Triangle(true, pt), isWater)); + BOOST_TEST_REQUIRE(textureMap.check(Triangle(false, pt), isWater)); } } @@ -112,7 +112,7 @@ BOOST_FIXTURE_TEST_CASE(AddTextures_sets_mountain_textures_above_mountain_level, BOOST_FIXTURE_TEST_CASE(ReplaceTextureForPoint_replaces_all_textures, TextureMapFixture) { - auto source = textureMap.Find(IsWater); + auto source = textureMap.Find(isWater); auto target = textureMap.Find(isSnowOrLava); auto point = MapPoint(textures.getWidth() / 2, textures.getHeight() / 2); textures.resize(textures.getSize(), source); @@ -124,14 +124,14 @@ BOOST_FIXTURE_TEST_CASE(ReplaceTextureForPoint_replaces_all_textures, TextureMap BOOST_FIXTURE_TEST_CASE(ReplaceTextureForPoint_does_not_replace_excluded_textures, TextureMapFixture) { - auto source = textureMap.Find(IsWater); + auto source = textureMap.Find(isWater); auto target = textureMap.Find(isSnowOrLava); auto point = MapPoint(textures.getWidth() / 2, textures.getHeight() / 2); textures.resize(textures.getSize(), source); replaceTextureForPoint(textures, point, target, {source}); - BOOST_TEST(textureMap.all(point, IsWater)); + BOOST_TEST(textureMap.all(point, isWater)); } BOOST_FIXTURE_TEST_CASE(ReplaceTextures_replaces_textures_within_radius, TextureMapFixture) @@ -141,7 +141,7 @@ BOOST_FIXTURE_TEST_CASE(ReplaceTextures_replaces_textures_within_radius, Texture MapPoint(1, 0), }; - const auto source = textureMap.Find(IsWater); + const auto source = textureMap.Find(isWater); const auto target = textureMap.Find(isSnowOrLava); for(unsigned radius = 0; radius < 4; radius++) { @@ -173,7 +173,7 @@ BOOST_FIXTURE_TEST_CASE(ReplaceTextures_does_not_replace_excluded_textures, Text MapPoint(3, 0), }; - const auto source = textureMap.Find(IsWater); + const auto source = textureMap.Find(isWater); const auto target = textureMap.Find(isSnowOrLava); for(unsigned radius = 0; radius < 4; radius++) @@ -185,7 +185,7 @@ BOOST_FIXTURE_TEST_CASE(ReplaceTextures_does_not_replace_excluded_textures, Text RTTR_FOREACH_PT(MapPoint, textures.getSize()) { - BOOST_TEST_REQUIRE(textureMap.all(pt, IsWater)); + BOOST_TEST_REQUIRE(textureMap.all(pt, isWater)); } } }